cf 0.10.0 → 0.11.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.
Files changed (342) hide show
  1. package/README.md +15 -5
  2. package/dist/_meta/agent-context.json +12 -4
  3. package/dist/_meta/commands.json +2249 -262
  4. package/dist/_meta/hand-written-commands.json +784 -0
  5. package/dist/_meta/schemas.json +1882 -155
  6. package/dist/{abuse-reports-CGF4zcKf.mjs → abuse-reports-sDBTV0qZ.mjs} +2 -2
  7. package/dist/{access-lhLJo1v2.mjs → access-DcNzuCue.mjs} +1 -1
  8. package/dist/account-BX90zXn5.mjs +2 -0
  9. package/dist/{account-tags-B88TotoH.mjs → account-tags-Bz3JG5hI.mjs} +4 -4
  10. package/dist/{accounts-BSIAT_iP.mjs → accounts-DCuW3xyZ.mjs} +12 -12
  11. package/dist/{acm-VULm1djv.mjs → acm-zjfShZLS.mjs} +1 -1
  12. package/dist/{addressing-BHPBIkRY.mjs → addressing-DORQ64Ux.mjs} +11 -11
  13. package/dist/{agent-context-KBy48G1b.mjs → agent-context-BgPR_aQr.mjs} +1 -1
  14. package/dist/agent-memory-C0hAUMeC.mjs +6 -0
  15. package/dist/ai-BpEBGMT2.mjs +5 -0
  16. package/dist/ai-audit-DnU3vn3E.mjs +2 -0
  17. package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
  18. package/dist/ai-search-DKbN9Tyd.mjs +7 -0
  19. package/dist/ai-security-C_I5lo58.mjs +4 -0
  20. package/dist/{alerting-Bl8OqViR.mjs → alerting-4T8gmZs-.mjs} +1 -1
  21. package/dist/analytics-Bxh4TCP7.mjs +3 -0
  22. package/dist/analytics_engine-fV56bjVN.mjs +2 -0
  23. package/dist/{api-security-4FVrD4n8.mjs → api-security-COk_i184.mjs} +20 -20
  24. package/dist/argo-DIRfvxvv.mjs +2 -0
  25. package/dist/{artifacts-CVDGnr2V.mjs → artifacts-BBfXNfUg.mjs} +1 -1
  26. package/dist/audit-logs-BlOrlAWe.mjs +2 -0
  27. package/dist/{auth-MQEamPN9.mjs → auth-D3X9HYhD.mjs} +3 -3
  28. package/dist/auth-DPhNN3Ly.mjs +5 -0
  29. package/dist/billing-B9e4PnvN.mjs +3 -0
  30. package/dist/body-parser-BshbixEq.mjs +2 -0
  31. package/dist/bot-management-D2JVeS-V.mjs +5 -0
  32. package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
  33. package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
  34. package/dist/{browser-extension-BtpCbh-2.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
  35. package/dist/browser-run-CHGOCTdG.mjs +4 -0
  36. package/dist/build-D0FhOj40.mjs +8 -0
  37. package/dist/{cache-VyWK1SjY.mjs → cache-C6V7PbQM.mjs} +1 -1
  38. package/dist/{calls-BxoRYxs4.mjs → calls-Bye8Tyy-.mjs} +1 -1
  39. package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
  40. package/dist/cf-Ds4JFovl.mjs +18 -0
  41. package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
  42. package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
  43. package/dist/{client-certificates-DDUv8K0a.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
  44. package/dist/{client-side-security-D4ysjwWT.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
  45. package/dist/cloud-connector-CL1jPQud.mjs +2 -0
  46. package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
  47. package/dist/command-C9VP3xaA.mjs +2 -0
  48. package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
  49. package/dist/config.d.mts +1460 -1348
  50. package/dist/config.mjs +1 -1
  51. package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
  52. package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
  53. package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
  54. package/dist/{connectors-BqxYMMtQ.mjs → connectors-BQwyBJ4_.mjs} +1 -1
  55. package/dist/{containers-CKW081JA.mjs → containers-BrQtGiNp.mjs} +12 -8
  56. package/dist/{content-scan-Dgd7A8KF.mjs → content-scan-DNzhXYkY.mjs} +1 -1
  57. package/dist/{csamScanner-DYL37wLc.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
  58. package/dist/{ct-alerting-CkhSbfAs.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
  59. package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
  60. package/dist/custom-csrs-bhClr2SU.mjs +3 -0
  61. package/dist/{custom-hostnames-q_nsnlye.mjs → custom-hostnames-C0eiGvG9.mjs} +1 -1
  62. package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
  63. package/dist/custom-pages-DTINMR30.mjs +3 -0
  64. package/dist/d1-sKdExJYF.mjs +20 -0
  65. package/dist/data-security-mV3a6UfW.mjs +7 -0
  66. package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
  67. package/dist/delegate.mjs +1 -1
  68. package/dist/{deploy-CZ7bgNDu.mjs → deploy-BL59O1O1.mjs} +1 -1
  69. package/dist/deploy-input-Dz6q-__n.mjs +2 -0
  70. package/dist/{dev-V10MG-Bg.mjs → dev-BDaavgH1.mjs} +2 -2
  71. package/dist/{diagnostics-BTH-8nJH.mjs → diagnostics-CJV6qWUA.mjs} +1 -1
  72. package/dist/{directory-BlH6N6Qy.mjs → directory-B5zCMusW.mjs} +1 -1
  73. package/dist/{dispatch-namespaces-BCjH1JzB.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
  74. package/dist/dist-BHi7UhXO.mjs +72 -0
  75. package/dist/dist-BWpErtDM.mjs +384 -0
  76. package/dist/{dls-BF5iN78p.mjs → dls-t0hnIe_P.mjs} +1 -1
  77. package/dist/{dns-CeCTNqRk.mjs → dns-C8FC2hbh.mjs} +13 -13
  78. package/dist/{dns-firewall-B54MaLGm.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
  79. package/dist/{dot-prop-6SRZBKHT-wIVDg_fl.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
  80. package/dist/dry-run-DL2V6yFm.mjs +2 -0
  81. package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
  82. package/dist/email-auth-BmYrl0pO.mjs +2 -0
  83. package/dist/email-routing-CF3_Z957.mjs +6 -0
  84. package/dist/email-security-F7OYcMkZ.mjs +18 -0
  85. package/dist/email-sending-EyU3WvGQ.mjs +7 -0
  86. package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
  87. package/dist/{firewall-CBPGJ43p.mjs → firewall-8YWWy4iB.mjs} +9 -9
  88. package/dist/flagship-C4x0l-8J.mjs +4 -0
  89. package/dist/{fraud-BIhS8pLf.mjs → fraud-HR_SdUx3.mjs} +1 -1
  90. package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
  91. package/dist/{healthchecks-FiXIk-KP.mjs → healthchecks-4qOvjrTN.mjs} +1 -1
  92. package/dist/{hostnames-Bx0mykMR.mjs → hostnames-DehdYOMz.mjs} +1 -1
  93. package/dist/{hyperdrive-C8qCabBF.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
  94. package/dist/iam-DR72hmii.mjs +6 -0
  95. package/dist/images-CeKc5JPh.mjs +8 -0
  96. package/dist/index.mjs +1 -1
  97. package/dist/{intel-B-9Z_sJs.mjs → intel-DtFix9WL.mjs} +1 -1
  98. package/dist/{interactive-DtsCYfrK.mjs → interactive-C7M55Wxx.mjs} +1 -1
  99. package/dist/ips-CtWCjXAN.mjs +2 -0
  100. package/dist/{keyless-certificates-THHvoXX3.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
  101. package/dist/keys-BmhG6Kn1.mjs +2 -0
  102. package/dist/{kv-BFDUCnft.mjs → kv-BuVPAuZP.mjs} +1 -1
  103. package/dist/{leaked-credential-checks-DUlUCOoJ.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
  104. package/dist/load-balancers-CylN-l7n.mjs +6 -0
  105. package/dist/{local-D-aVNu6A.mjs → local-Be3lg_9E.mjs} +1 -1
  106. package/dist/{local-runtime-Dh3keC5v.mjs → local-runtime-Ce7k598H.mjs} +1 -1
  107. package/dist/logexplorer-CvRPoKbj.mjs +17 -0
  108. package/dist/logo-matches-Heuft3yF.mjs +2 -0
  109. package/dist/logos-DRYjGBDq.mjs +3 -0
  110. package/dist/{logpush-BK34mMQs.mjs → logpush-Dve9jOMp.mjs} +1 -1
  111. package/dist/{logs-CLAqX9h2.mjs → logs-SC86FE89.mjs} +1 -1
  112. package/dist/{magic-cloud-networking-h_ozrC5S.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
  113. package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
  114. package/dist/magic-transit-BK_3asH2.mjs +111 -0
  115. package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
  116. package/dist/matches-Iss9Fo4R.mjs +2 -0
  117. package/dist/mcp-8wxXT6JU.mjs +4 -0
  118. package/dist/mesh-Bf9UAS4J.mjs +4 -0
  119. package/dist/{moq-qmuVPAO0.mjs → moq-ZKMFOeVz.mjs} +1 -1
  120. package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
  121. package/dist/{network-D74cSy3t.mjs → network-B1lBARU9.mjs} +1 -1
  122. package/dist/{network-interconnects-BJ0Nc48J.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
  123. package/dist/oauth-DuEONNgC.mjs +14 -0
  124. package/dist/{oauth-clients-Br-smLxQ.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
  125. package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
  126. package/dist/observability-Jya7-zkl.mjs +4 -0
  127. package/dist/{open-PBXRGS4R-R-qesf18.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
  128. package/dist/{organization-NX7yCZrq.mjs → organization-CYxYV4e0.mjs} +6 -6
  129. package/dist/organizations-SacGUW44.mjs +2 -0
  130. package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
  131. package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
  132. package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
  133. package/dist/{output-DrpYYfnB.mjs → output-Ccqw2WOb.mjs} +1 -1
  134. package/dist/page-rules-BqEyFR2c.mjs +27 -0
  135. package/dist/pages-CQ7ZVWk1.mjs +14 -0
  136. package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
  137. package/dist/pipelines-6De2Pe2C.mjs +6 -0
  138. package/dist/precursor-iwK-1P_d.mjs +4 -0
  139. package/dist/progress-BqQcF5QH.mjs +2 -0
  140. package/dist/project-settings-C_1-JI6Y.mjs +3 -0
  141. package/dist/prompt-B0sWIs9c.mjs +3 -0
  142. package/dist/{public-BwQqexwo-CNW_dPly.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
  143. package/dist/queries-c7zvnfEQ.mjs +3 -0
  144. package/dist/queues-BU6y16qS.mjs +6 -0
  145. package/dist/r2-Jo3QMahK.mjs +24 -0
  146. package/dist/{r2-data-catalog-Du7hN9jA.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
  147. package/dist/radar-DIYAMEof.mjs +2 -0
  148. package/dist/{rate-limits-yBF3qoYD.mjs → rate-limits-DewOcznT.mjs} +1 -1
  149. package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
  150. package/dist/{realtimekit-CIP7lP-a.mjs → realtimekit-cnZEVNDn.mjs} +1 -1
  151. package/dist/registrar-BsWr_aPM.mjs +23 -0
  152. package/dist/{registrar-sandbox-DiXg8p_1.mjs → registrar-sandbox-BlcpUyIH.mjs} +4 -4
  153. package/dist/{registry-Bck_zFkz.mjs → registry-jifR3_Y6.mjs} +1 -1
  154. package/dist/reporting--1AyTV7k.mjs +2 -0
  155. package/dist/request-tracers-C_VX7X6-.mjs +2 -0
  156. package/dist/{resource-sharing-D1pSDvtf.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
  157. package/dist/resource-tagging-C33U6T74.mjs +2 -0
  158. package/dist/rules-BfjzALMi.mjs +4 -0
  159. package/dist/rulesets-3i_1Vwt-.mjs +5 -0
  160. package/dist/rum-CjmIckiR.mjs +4 -0
  161. package/dist/{schema-B34Q9tLF.mjs → schema-1mwmslUV.mjs} +1 -1
  162. package/dist/schema-flags-llLJuFFw.mjs +5 -0
  163. package/dist/{scim-CcSyfKCH.mjs → scim-pApmzA5B.mjs} +1 -1
  164. package/dist/{secrets-store-DFmvtphu.mjs → secrets-store-DBC9WJau.mjs} +1 -1
  165. package/dist/security-center-Djm06dq-.mjs +2 -0
  166. package/dist/{security-txt-DqnFpjMI.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
  167. package/dist/{share-BuwYUzOL.mjs → share-Dj-MNXrw.mjs} +4 -4
  168. package/dist/shared-BJvq4DkR.mjs +290 -0
  169. package/dist/smart-shield--8EpJjrF.mjs +4 -0
  170. package/dist/snippets-Dyz0PH60.mjs +4 -0
  171. package/dist/{spawn-O1RS01vr.mjs → spawn-C5Z7oWdp.mjs} +108 -112
  172. package/dist/{spectrum-b7N1ZRAm.mjs → spectrum-rAHWz8rH.mjs} +1 -1
  173. package/dist/{speed-cw31yFva.mjs → speed-BKepWBXj.mjs} +1 -1
  174. package/dist/src-gJma71Ec.mjs +108 -0
  175. package/dist/{ssl-CsEhRVTO.mjs → ssl-KdFiY3ev.mjs} +1 -1
  176. package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
  177. package/dist/{state-Bb5Cbc_L.mjs → state-Cu3cItUg.mjs} +1 -1
  178. package/dist/{stream-DFOao6Gu.mjs → stream-CKJ6Tb0M.mjs} +13 -13
  179. package/dist/submit-BxbKKhBn.mjs +2 -0
  180. package/dist/tags-DA8dq9fx.mjs +2 -0
  181. package/dist/tenant-DLXw48hS.mjs +2 -0
  182. package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
  183. package/dist/{tools-BHfBOZOU.mjs → tools-x8bj9E6b.mjs} +1 -1
  184. package/dist/{tunnel-DkMiNtVY.mjs → tunnel-CNQA5Flp.mjs} +1 -1
  185. package/dist/tunnels-CC10EOsU.mjs +2 -0
  186. package/dist/turnstile-CH58hnf4.mjs +23 -0
  187. package/dist/{ui-DE8CNn6c.mjs → ui-CmnnBm_O.mjs} +1 -1
  188. package/dist/url-info-BpCgdUtL.mjs +2 -0
  189. package/dist/{url-normalization-ClfFiruK.mjs → url-normalization-BzuynEy1.mjs} +1 -1
  190. package/dist/url-scanner-APIZbhB7.mjs +2 -0
  191. package/dist/user-2-NGebfI.mjs +12 -0
  192. package/dist/values-S_bNv819.mjs +2 -0
  193. package/dist/{vectorize-CVKu7lEt.mjs → vectorize-Bv7feLBC.mjs} +1 -1
  194. package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
  195. package/dist/{web-assets-C2s9kzWf.mjs → web-assets-C1UmOyzD.mjs} +1 -1
  196. package/dist/web3-GnUocVYH.mjs +4 -0
  197. package/dist/workers-J1-PLwdl.mjs +28 -0
  198. package/dist/{workers-builds-B55-oXOa.mjs → workers-builds-DCHmWOMS.mjs} +1 -1
  199. package/dist/{workflows-B-kGHxFu.mjs → workflows-CArfEI2c.mjs} +1 -1
  200. package/dist/zaraz-mg2YlR3_.mjs +2 -0
  201. package/dist/{zero-trust-DV3sIOvu.mjs → zero-trust-DVdUPtj1.mjs} +67 -66
  202. package/dist/zone-DMAfrDJX.mjs +2 -0
  203. package/dist/zones-CNwxUi7I.mjs +21 -0
  204. package/package.json +10 -7
  205. package/dist/account-CYRm3yoN.mjs +0 -2
  206. package/dist/agent-memory-DDv_Gxr7.mjs +0 -6
  207. package/dist/ai-audit-BWZGvbca.mjs +0 -2
  208. package/dist/ai-gateway-jeB-sAgP.mjs +0 -13
  209. package/dist/ai-search-BmdskMjR.mjs +0 -7
  210. package/dist/ai-security-CsmfcaUx.mjs +0 -4
  211. package/dist/ai-viHB1tgI.mjs +0 -5
  212. package/dist/analytics-vOxw8Hy0.mjs +0 -3
  213. package/dist/analytics_engine-DO4-C0wD.mjs +0 -2
  214. package/dist/argo-CQfCgazW.mjs +0 -2
  215. package/dist/audit-logs-CzpwvQ6A.mjs +0 -2
  216. package/dist/auth-D0xZxAEa.mjs +0 -5
  217. package/dist/billing-aJgapeRm.mjs +0 -3
  218. package/dist/body-parser-C-c9gfH1.mjs +0 -2
  219. package/dist/bot-management-Y2q5d-pi.mjs +0 -5
  220. package/dist/botnet-feed-DANJqfmE.mjs +0 -3
  221. package/dist/brand-protection-CjpZWBjp.mjs +0 -3
  222. package/dist/browser-run-BFn9h2Tz.mjs +0 -4
  223. package/dist/build-DcflwvqN.mjs +0 -2
  224. package/dist/certificate-authorities-D7OAFxF_.mjs +0 -2
  225. package/dist/cf-C7DU4819.mjs +0 -18
  226. package/dist/chunk-LQW53VED-DLrXV-hE.mjs +0 -499
  227. package/dist/cloud-connector-Bhec6z2P.mjs +0 -2
  228. package/dist/cloudforce-one-J_hn9ss9.mjs +0 -36
  229. package/dist/connector-interrupts-Dycx8zFx.mjs +0 -2
  230. package/dist/connector-telemetry-events-BmxOSNtN.mjs +0 -2
  231. package/dist/connector-telemetry-snapshots-CdcqfKnH.mjs +0 -2
  232. package/dist/custom-certificates-BzAOnEoT.mjs +0 -5
  233. package/dist/custom-csrs-CgzG3pd3.mjs +0 -3
  234. package/dist/custom-nameservers-BUBmfhUe.mjs +0 -3
  235. package/dist/custom-pages-M7jA2Hit.mjs +0 -3
  236. package/dist/d1-BFvMd6-S.mjs +0 -20
  237. package/dist/data-security-Bji4Or_j.mjs +0 -7
  238. package/dist/dcv-delegation-BuoRQ1Yh.mjs +0 -2
  239. package/dist/deploy-input-CrvuoDGJ.mjs +0 -242
  240. package/dist/dist-CgrMkXFx.mjs +0 -72
  241. package/dist/durable-objects-D8FQORrL.mjs +0 -2
  242. package/dist/email-auth-DJK0Eb30.mjs +0 -2
  243. package/dist/email-routing-NpmiKIrl.mjs +0 -6
  244. package/dist/email-security-BLZ7WZ9Z.mjs +0 -18
  245. package/dist/email-sending-dn-353Nx.mjs +0 -7
  246. package/dist/fieldExtractors-ahysj57J.mjs +0 -3
  247. package/dist/flagship-BusjRNIb.mjs +0 -4
  248. package/dist/google-tag-gateway-TZZ3F1tV.mjs +0 -2
  249. package/dist/iam-Cj63Kjc6.mjs +0 -6
  250. package/dist/images-CBWXCDhy.mjs +0 -8
  251. package/dist/ips-qs9eGJnI.mjs +0 -2
  252. package/dist/keys-D7N0j4-x.mjs +0 -2
  253. package/dist/load-balancers-D2zbQ8fT.mjs +0 -6
  254. package/dist/logexplorer-CUsfZ_bS.mjs +0 -13
  255. package/dist/logo-matches-CJcthPHf.mjs +0 -2
  256. package/dist/logos-BS65zN8q.mjs +0 -3
  257. package/dist/magic-network-monitoring-C7tAPNKP.mjs +0 -4
  258. package/dist/magic-transit-BtsFePMx.mjs +0 -111
  259. package/dist/managed-transforms-Cm_KVCMB.mjs +0 -3
  260. package/dist/matches-InA1hwII.mjs +0 -2
  261. package/dist/mcp-mJ7bekNJ.mjs +0 -4
  262. package/dist/mesh-BK4S1Ezy.mjs +0 -4
  263. package/dist/mtls-certificates-CU4OAAXY.mjs +0 -3
  264. package/dist/oauth-B0ETkNcX.mjs +0 -15
  265. package/dist/oauth-scopes-D5bF11ju.mjs +0 -2
  266. package/dist/observability-BWE0Gg3V.mjs +0 -4
  267. package/dist/organizations-DLhiRt8g.mjs +0 -2
  268. package/dist/origin-ca-certificates-Ff4McZRQ.mjs +0 -3
  269. package/dist/origin-post-quantum-encryption-UuTr4_SW.mjs +0 -2
  270. package/dist/origin-tls-client-auth-DOJ1zlH3.mjs +0 -4
  271. package/dist/page-rules-BSz1gO-_.mjs +0 -18
  272. package/dist/pages-DVDogxPs.mjs +0 -14
  273. package/dist/pay-per-crawl-BrLXK7gT.mjs +0 -4
  274. package/dist/pipelines-BszRk4sM.mjs +0 -6
  275. package/dist/precursor-BPNjQr76.mjs +0 -4
  276. package/dist/progress-CsHIt3Tp.mjs +0 -2
  277. package/dist/prompt-DdegNPpg.mjs +0 -3
  278. package/dist/queries-JL1H1Biz.mjs +0 -3
  279. package/dist/queues-DpkYdRUE.mjs +0 -6
  280. package/dist/r2-CKozthw_.mjs +0 -24
  281. package/dist/radar-C-92vggG.mjs +0 -2
  282. package/dist/raw-fetch-CteyTOM2.mjs +0 -2
  283. package/dist/registrar-DKKN0M29.mjs +0 -21
  284. package/dist/reporting-fg_GKXe1.mjs +0 -2
  285. package/dist/request-tracers-CkMya96z.mjs +0 -2
  286. package/dist/resource-tagging-z48JGHCq.mjs +0 -2
  287. package/dist/rules-BTmNjDN-.mjs +0 -4
  288. package/dist/rulesets-CsoSM-17.mjs +0 -5
  289. package/dist/rum-DB4iO2q5.mjs +0 -4
  290. package/dist/schema-flags-iGoOriJt.mjs +0 -5
  291. package/dist/security-center-DFKeHq5c.mjs +0 -2
  292. package/dist/session-D6KHthHf.mjs +0 -2
  293. package/dist/shared-VppSAQf4.mjs +0 -2
  294. package/dist/smart-shield-D6X8L7p8.mjs +0 -4
  295. package/dist/snippets-DIpc9pb_.mjs +0 -4
  296. package/dist/src-D_HETJNy.mjs +0 -108
  297. package/dist/submit--xTzyNPy.mjs +0 -2
  298. package/dist/tags-efICDkah.mjs +0 -2
  299. package/dist/tenant-CerHuToJ.mjs +0 -2
  300. package/dist/tenant-custom-nameservers-C4otMBm2.mjs +0 -3
  301. package/dist/triggers-BEsiiKAf.mjs +0 -2
  302. package/dist/tunnels-D0J8lJoI.mjs +0 -2
  303. package/dist/turnstile-CFmtY5bn.mjs +0 -23
  304. package/dist/url-info-DBCeRWwb.mjs +0 -2
  305. package/dist/url-scanner-CNyvg65L.mjs +0 -2
  306. package/dist/user-bifVEQq5.mjs +0 -12
  307. package/dist/values-OxkdP1tV.mjs +0 -2
  308. package/dist/versions-BVL-Ludh.mjs +0 -2
  309. package/dist/waiting-rooms-CmRAl51T.mjs +0 -11
  310. package/dist/web3-y_cY91V_.mjs +0 -4
  311. package/dist/workers-jDcq14GH.mjs +0 -24
  312. package/dist/zaraz-27zwjLvv.mjs +0 -2
  313. package/dist/zone-BJix2KQ9.mjs +0 -2
  314. package/dist/zones-Bkj5i92c.mjs +0 -21
  315. /package/dist/{alerts-CRmjqOZi.mjs → alerts-15-IW4jE.mjs} +0 -0
  316. /package/dist/{autorag-BD7cu5NU.mjs → autorag-CFwRkEKw.mjs} +0 -0
  317. /package/dist/{brands-BhALBkX2.mjs → brands-BgT1vu9B.mjs} +0 -0
  318. /package/dist/{chunk-6EUZQHAF-B7bSMYLe.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
  319. /package/dist/{clear-BgF8No7D.mjs → clear-BlCK85Me.mjs} +0 -0
  320. /package/dist/{cli-types-BsTty22w.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
  321. /package/dist/{connector-telemetry-events-latest-BY2556uL.mjs → connector-telemetry-events-latest-BbpcII3_.mjs} +0 -0
  322. /package/dist/{connector-telemetry-snapshots-latest-BHYdxUEF.mjs → connector-telemetry-snapshots-latest-DuCiimXl.mjs} +0 -0
  323. /package/dist/{domain-info-C50W5GhA.mjs → domain-info-C7LBxPBt.mjs} +0 -0
  324. /package/dist/{health-BFNZqiAm.mjs → health-DZFfafkX.mjs} +0 -0
  325. /package/dist/{input-validation-Bav2M9F-.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
  326. /package/dist/{internal-BTeSewwB.mjs → internal-BKHC2D1Y.mjs} +0 -0
  327. /package/dist/{live-Dkiyu30_.mjs → live-DwCvDmaH.mjs} +0 -0
  328. /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
  329. /package/dist/{rate-limit-analytics-Dz-Wv1T0.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
  330. /package/dist/{ready-TKOkKeRg.mjs → ready-D9H2zHHI.mjs} +0 -0
  331. /package/dist/{recent-submissions-3Asm6eIi.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
  332. /package/dist/{refute-BVz9nMyd.mjs → refute-2W8NLCN4.mjs} +0 -0
  333. /package/dist/{resolve-CeBbH6Pq.mjs → resolve-B8CyM1mi.mjs} +0 -0
  334. /package/dist/{scan-logo-ZteA-PUV.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
  335. /package/dist/{scan-page-DWDSyzQ7.mjs → scan-page-CWhta3x7.mjs} +0 -0
  336. /package/dist/{search-DGNc37HK.mjs → search-DZmBQJL9.mjs} +0 -0
  337. /package/dist/{signed-url-B5Qpn2mn.mjs → signed-url-CQrmWgz5.mjs} +0 -0
  338. /package/dist/{submission-info-FjUolE6A.mjs → submission-info-C98A0bqq.mjs} +0 -0
  339. /package/dist/{theme-CeVf-5qG.mjs → theme-CrIBazAF.mjs} +0 -0
  340. /package/dist/{total-queries-NHJj1HGq.mjs → total-queries-BZoaFoDE.mjs} +0 -0
  341. /package/dist/{tracked-domains-CniKVHIp.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
  342. /package/dist/{verify-DS1PWAJe.mjs → verify-4e4L9IRk.mjs} +0 -0
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n,h as r}from"./oauth-DuEONNgC.mjs";import{r as i}from"./auth-D3X9HYhD.mjs";import{t as a}from"./output-Ccqw2WOb.mjs";import{t as o}from"./dry-run-DL2V6yFm.mjs";import{t as s}from"./progress-BqQcF5QH.mjs";import{n as c,r as l,t as u}from"./body-parser-BshbixEq.mjs";import{n as d}from"./input-validation-QDIYu7Vb.mjs";import{a as f,i as p,n as m}from"./prompt-B0sWIs9c.mjs";import{t as h}from"./cli-types-DAYeL_Mj.mjs";function ee(e){return e.option(`email`,{type:`string`,description:`The contact email address of the user.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const g={command:`create`,describe:`Create a destination address to forward your emails to. Destination addresses need to be verified before they can be used.`,builder:ee,handler:async r=>{if(r.dryRun){o({command:`cf email-routing addresses create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/routing/addresses`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({email:d(r.email,`email`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.emailRouting.addresses.create({...e,account_id:p})),{successLabel:`Created`});return}r.email===void 0&&(r.email=await f(`email`,`The contact email address of the user.`));let m=u({email:d(r.email,`email`,`text`)});a(await s(`Creating`,async()=>l.emailRouting.addresses.create({...m,account_id:p})),{successLabel:`Created`})}};function _(e){return e.positional(`destination-address-identifier`,{type:`string`,description:`Destination address identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete <destination-address-identifier>`,describe:`Deletes a specific destination address.`,builder:_,handler:async r=>{if(r.dryRun){o({command:`cf email-routing addresses delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/routing/addresses/${r[`destination-address-identifier`]==null?`<destination-address-identifier>`:encodeURIComponent(String(r[`destination-address-identifier`]))}`,pathParams:{"destination-address-identifier":String(r[`destination-address-identifier`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await m({force:!!r.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>c.emailRouting.addresses.delete({account_id:l,destination_address_identifier:r[`destination-address-identifier`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`destination-address-identifier`,{type:`string`,description:`Destination address identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get <destination-address-identifier>`,describe:`Gets information for a specific destination email already created.`,builder:y,handler:async r=>{if(r.dryRun){o({command:`cf email-routing addresses get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/routing/addresses/${r[`destination-address-identifier`]==null?`<destination-address-identifier>`:encodeURIComponent(String(r[`destination-address-identifier`]))}`,pathParams:{"destination-address-identifier":String(r[`destination-address-identifier`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.emailRouting.addresses.get({account_id:l,destination_address_identifier:r[`destination-address-identifier`]})),{successLabel:`Loaded`})}};function x(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`direction`,{type:`string`,description:`Sorts results in an ascending or descending order.`,choices:[`asc`,`desc`]}).option(`verified`,{type:`string`,description:`Filter by verified destination addresses.`,choices:[`true`,`false`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`list`,describe:`Lists existing destination addresses.`,builder:h(x),handler:async r=>{let c={page:r.page,per_page:r[`per-page`],direction:r.direction,verified:r.verified};if(r.dryRun){o({command:`cf email-routing addresses list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/routing/addresses`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.emailRouting.addresses.list({account_id:u,...c})),{successLabel:`Loaded`})}};function C(e){return e.positional(`destination-address-identifier`,{type:`string`,description:`Destination address identifier.`,demandOption:!0}).option(`status`,{type:`string`,description:`Destination address status. Non-admin callers may only set verified addresses back to unverified; setting to verified requires admin privileges.`,choices:[`unverified`,`verified`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const w={command:`update <destination-address-identifier>`,describe:`Updates the status of a specific destination address.`,builder:C,handler:async r=>{if(r.dryRun){o({command:`cf email-routing addresses update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/routing/addresses/${r[`destination-address-identifier`]==null?`<destination-address-identifier>`:encodeURIComponent(String(r[`destination-address-identifier`]))}`,pathParams:{"destination-address-identifier":String(r[`destination-address-identifier`]??``)},bodyKind:`json`,body:r.body===void 0?u({status:d(r.status,`status`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.emailRouting.addresses.update({...e,account_id:f,destination_address_identifier:r[`destination-address-identifier`]})),{successLabel:`Updated`});return}r.status===void 0&&(r.status=await p(`status`,`Destination address status. Non-admin callers may only set verified addresses back to unverified; setting to verified requires admin privileges.`,[`unverified`,`verified`]));let m=u({status:d(r.status,`status`,`text`)});a(await s(`Updating`,async()=>l.emailRouting.addresses.update({...m,account_id:f,destination_address_identifier:r[`destination-address-identifier`]})),{successLabel:`Updated`})}},T={command:`addresses`,describe:`Verified destination email addresses that can receive forwarded mail`,builder:e=>e.command(g).command(v).command(b).command(S).command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function E(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const D={command:`disable`,describe:`Disable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.`,builder:E,handler:async e=>{if(e.dryRun){o({command:`cf email-routing disable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/disable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await m({force:!!e.force,message:`This operation turns off email routing for a zone.`})){process.stderr.write(`Aborted.
4
+ `);return}a(await s(`Deleting`,async()=>t.emailRouting.disable({zone_id:n})),{successLabel:`Deleted`})}};function O(e){return e.option(`name`,{type:`string`,description:`Domain of your 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)`})}const k={command:`create`,describe:`Enable you Email Routing zone. Add and lock the necessary MX and SPF records.`,builder:O,handler:async e=>{if(e.dryRun){o({command:`cf email-routing dns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/dns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({name:d(e.name,`name`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Creating`,async()=>t.emailRouting.dns.create({body:r,zone_id:n})),{successLabel:`Created`});return}let l=u({name:d(e.name,`name`,`text`)});a(await s(`Creating`,async()=>t.emailRouting.dns.create({body:l,zone_id:n})),{successLabel:`Created`})}};function A(e){return e.option(`name`,{type:`string`,description:`Domain of your zone.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const j={command:`delete`,describe:`Disable your Email Routing zone. Also removes additional MX records previously required for Email Routing to work.`,builder:A,handler:async e=>{if(e.dryRun){o({command:`cf email-routing dns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/dns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({name:d(e.name,`name`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await m({force:!!e.force})){process.stderr.write(`Aborted.
5
+ `);return}if(e.body){let r=c(e.body);a(await s(`Deleting`,async()=>t.emailRouting.dns.delete({body:r,zone_id:n})),{successLabel:`Deleted`});return}let l=u({name:d(e.name,`name`,`text`)});a(await s(`Deleting`,async()=>t.emailRouting.dns.delete({body:l,zone_id:n})),{successLabel:`Deleted`})}};function M(e){return e.option(`name`,{type:`string`,description:`Domain of your 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)`})}const N={command:`edit`,describe:`Unlock MX Records previously locked by Email Routing.`,builder:M,handler:async e=>{if(e.dryRun){o({command:`cf email-routing dns edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/dns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({name:d(e.name,`name`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Updating`,async()=>t.emailRouting.dns.edit({body:r,zone_id:n})),{successLabel:`Updated`});return}let l=u({name:d(e.name,`name`,`text`)});a(await s(`Updating`,async()=>t.emailRouting.dns.edit({body:l,zone_id:n})),{successLabel:`Updated`})}};function P(e){return e.option(`subdomain`,{type:`string`,description:`Deprecated. When supplied, the response shape differs from the documented default and is not modeled in generated SDKs. Do not rely on this parameter.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get`,describe:`Show the DNS records needed to configure your Email Routing zone.`,builder:P,handler:async e=>{let t={subdomain:e.subdomain};if(e.dryRun){o({command:`cf email-routing dns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/dns`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>n.emailRouting.dns.get({zone_id:c,...t})),{successLabel:`Loaded`})}},I={command:`dns`,describe:`DNS records required for email routing (MX, SPF, DKIM) — enable, lock, or disable`,builder:e=>e.command(k).command(j).command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.option(`enabled`,{type:`boolean`,description:"State of your zone Email Routing settings. No-op on this endpoint - use `POST`/`DELETE /zones/{zone_id}/email/routing/dns`."}).option(`skip-wizard`,{type:`boolean`,description:`Flag to check if the user skipped the configuration wizard.`}).option(`support-subaddress`,{type:`boolean`,description:`Whether subaddressing (plus-addressing) is honored when matching incoming mail against routing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const R={command:`edit`,describe:`Update the settings for your Email Routing zone.`,builder:L,handler:async e=>{if(e.dryRun){o({command:`cf email-routing edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({enabled:e.enabled,skip_wizard:e[`skip-wizard`],support_subaddress:e[`support-subaddress`]}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Updating`,async()=>t.emailRouting.edit({...r,zone_id:n})),{successLabel:`Updated`});return}let l=u({enabled:e.enabled,skip_wizard:e[`skip-wizard`],support_subaddress:e[`support-subaddress`]});a(await s(`Updating`,async()=>t.emailRouting.edit({...l,zone_id:n})),{successLabel:`Updated`})}};function z(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`enable`,describe:`Enable you Email Routing zone. Add and lock the necessary MX and SPF records.`,builder:z,handler:async e=>{if(e.dryRun){o({command:`cf email-routing enable`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/enable`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Creating`,async()=>t.emailRouting.enable({zone_id:n})),{successLabel:`Created`})}};function B(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const V={command:`get`,describe:`Get information about the settings for your Email Routing zone.`,builder:B,handler:async e=>{if(e.dryRun){o({command:`cf email-routing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailRouting.get({zone_id:n})),{successLabel:`Loaded`})}};function H(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get`,describe:`Get information on the default catch-all routing rule.`,builder:H,handler:async e=>{if(e.dryRun){o({command:`cf email-routing rules catch-alls get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/rules/catch_all`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailRouting.rules.catchAlls.get({zone_id:n})),{successLabel:`Loaded`})}};function W(e){return e.option(`actions`,{type:`string`,description:`List actions for the catch-all routing rule. Provide as a JSON array of objects or @path/to/file.json.`}).option(`enabled`,{type:`boolean`,description:`Routing rule status.`}).option(`matchers`,{type:`string`,description:`List of matchers for the catch-all routing rule. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`Routing rule name.`}).option(`owner-worker-tag`,{type:`string`,description:"Public tag (script_tag) of the Worker that owns this rule. Required when\n`source` is `wrangler`.\n"}).option(`source`,{type:`string`,description:"Who manages the rule. `api` covers dashboard, generic API, and Terraform;\n`wrangler` means the rule is managed by a Worker's wrangler.jsonc. Defaults\nto `api` when omitted on write.\n",choices:[`api`,`wrangler`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const G={command:`update`,describe:`Enable or disable catch-all routing rule, or change action to forward to a specific destination address. Forward actions require exactly one verified destination address.`,builder:W,handler:async e=>{if(e.dryRun){o({command:`cf email-routing rules catch-alls update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/rules/catch_all`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({actions:l(e.actions,`actions`),enabled:e.enabled,matchers:l(e.matchers,`matchers`),name:d(e.name,`name`,`text`),owner_worker_tag:d(e[`owner-worker-tag`],`owner-worker-tag`,`text`),source:d(e.source,`source`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Updating`,async()=>t.emailRouting.rules.catchAlls.update({...r,zone_id:n})),{successLabel:`Updated`});return}if(e.actions===void 0)throw Error(`--actions is required (or pass --body with this field set).`);if(e.matchers===void 0)throw Error(`--matchers is required (or pass --body with this field set).`);let f=u({actions:l(e.actions,`actions`),enabled:e.enabled,matchers:l(e.matchers,`matchers`),name:d(e.name,`name`,`text`),owner_worker_tag:d(e[`owner-worker-tag`],`owner-worker-tag`,`text`),source:d(e.source,`source`,`text`)});a(await s(`Updating`,async()=>t.emailRouting.rules.catchAlls.update({...f,zone_id:n})),{successLabel:`Updated`})}},K={command:`catch-alls`,describe:`Operations for rules.catch-alls`,builder:e=>e.command(U).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function q(e){return e.option(`actions`,{type:`string`,description:`List actions patterns. Provide as a JSON array of objects or @path/to/file.json.`}).option(`enabled`,{type:`boolean`,description:`Routing rule status.`,default:!0}).option(`matchers`,{type:`string`,description:`Matching patterns to forward to your actions. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`Routing rule name.`}).option(`owner-worker-tag`,{type:`string`,description:"Public tag (script_tag) of the Worker that owns this rule. Required when\n`source` is `wrangler`.\n"}).option(`priority`,{type:`number`,description:`Priority of the routing rule.`,default:0}).option(`source`,{type:`string`,description:"Who manages the rule. `api` covers dashboard, generic API, and Terraform;\n`wrangler` means the rule is managed by a Worker's wrangler.jsonc. Defaults\nto `api` when omitted on write.\n",choices:[`api`,`wrangler`],default:`api`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const J={command:`create`,describe:`Rules consist of a set of criteria for matching emails (such as an email being sent to a specific custom email address) plus a set of actions to take on the email (like forwarding it to a specific destination address). Forward actions require exactly one verified destination address.`,builder:q,handler:async e=>{if(e.dryRun){o({command:`cf email-routing rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/rules`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({actions:l(e.actions,`actions`),enabled:e.enabled,matchers:l(e.matchers,`matchers`),name:d(e.name,`name`,`text`),owner_worker_tag:d(e[`owner-worker-tag`],`owner-worker-tag`,`text`),priority:e.priority,source:d(e.source,`source`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Creating`,async()=>t.emailRouting.rules.create({...r,zone_id:n})),{successLabel:`Created`});return}if(e.actions===void 0)throw Error(`--actions is required (or pass --body with this field set).`);if(e.matchers===void 0)throw Error(`--matchers is required (or pass --body with this field set).`);let f=u({actions:l(e.actions,`actions`),enabled:e.enabled,matchers:l(e.matchers,`matchers`),name:d(e.name,`name`,`text`),owner_worker_tag:d(e[`owner-worker-tag`],`owner-worker-tag`,`text`),priority:e.priority,source:d(e.source,`source`,`text`)});a(await s(`Creating`,async()=>t.emailRouting.rules.create({...f,zone_id:n})),{successLabel:`Created`})}};function Y(e){return e.positional(`rule-identifier`,{type:`string`,description:`Routing rule identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const X={command:`delete <rule-identifier>`,describe:`Delete a specific routing rule.`,builder:Y,handler:async e=>{if(e.dryRun){o({command:`cf email-routing rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/rules/${e[`rule-identifier`]==null?`<rule-identifier>`:encodeURIComponent(String(e[`rule-identifier`]))}`,pathParams:{"rule-identifier":String(e[`rule-identifier`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await m({force:!!e.force})){process.stderr.write(`Aborted.
6
+ `);return}a(await s(`Deleting`,async()=>t.emailRouting.rules.delete({zone_id:n,rule_identifier:e[`rule-identifier`]})),{successLabel:`Deleted`})}};function Z(e){return e.positional(`rule-identifier`,{type:`string`,description:`Routing rule identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <rule-identifier>`,describe:`Get information for a specific routing rule already created.`,builder:Z,handler:async e=>{if(e.dryRun){o({command:`cf email-routing rules get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/rules/${e[`rule-identifier`]==null?`<rule-identifier>`:encodeURIComponent(String(e[`rule-identifier`]))}`,pathParams:{"rule-identifier":String(e[`rule-identifier`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailRouting.rules.get({zone_id:n,rule_identifier:e[`rule-identifier`]})),{successLabel:`Loaded`})}};function ne(e){return e.option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Maximum number of results per page.`}).option(`enabled`,{type:`string`,description:`Filter by enabled routing rules.`,choices:[`true`,`false`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list-account`,describe:`Lists existing routing rules across all zones in the account or zone.`,builder:h(ne),handler:async c=>{let l={page:c.page,per_page:c[`per-page`],enabled:c.enabled};if(c.dryRun){let e=c.zone===void 0?await n():void 0,t=c.zone===void 0?`accounts`:`zones`,r=c.zone??e??`<account-id>`;o({command:`cf email-routing rules list-account`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${t}/${r}/email/routing/rules`,pathParams:{"account-or-zone":String(t),"account-or-zone-id":String(r)},query:l,bodyKind:`none`});return}let u=await i(c),d=c.zone===void 0?`accounts`:`zones`,f=d===`zones`?await r({zone:c.zone},u,{quiet:c.quiet}):c.local?e:await t();d===`zones`?c.zoneId=f:c.accountId=f,a(await s(`Loading`,async()=>u.emailRouting.rules.listAccount({account_or_zone:d,account_or_zone_id:f,...l})),{successLabel:`Loaded`})}};function ie(e){return e.option(`catch-all-rules`,{type:`string`,description:`Desired catch-all Email Routing rules managed by the deploying Worker. Provide as a JSON array of objects or @path/to/file.json.`}).option(`owner-worker-tag`,{type:`string`,description:"Public tag (script_tag) of the Worker that owns this rule. Required when\n`source` is `wrangler`.\n"}).option(`rules`,{type:`string`,description:`Desired normal Email Routing rules managed by the deploying Worker. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ae={command:`plan`,describe:`Computes the Email Routing rule changes that would be needed to reconcile a Wrangler-managed desired ruleset. This endpoint is read-only and does not create, update, or delete rules.`,builder:ie,handler:async r=>{if(r.dryRun){o({command:`cf email-routing rules plan`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/routing/rules/plan`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({catch_all_rules:l(r[`catch-all-rules`],`catch-all-rules`),owner_worker_tag:d(r[`owner-worker-tag`],`owner-worker-tag`,`text`),rules:l(r.rules,`rules`)}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Creating`,async()=>p.emailRouting.rules.plan({...e,account_id:m})),{successLabel:`Created`});return}r[`owner-worker-tag`]===void 0&&(r[`owner-worker-tag`]=await f(`owner-worker-tag`,"Public tag (script_tag) of the Worker that owns this rule. Required when `source` is `wrangler`. "));let h=u({catch_all_rules:l(r[`catch-all-rules`],`catch-all-rules`),owner_worker_tag:d(r[`owner-worker-tag`],`owner-worker-tag`,`text`),rules:l(r.rules,`rules`)});a(await s(`Creating`,async()=>p.emailRouting.rules.plan({...h,account_id:m})),{successLabel:`Created`})}};function oe(e){return e.positional(`rule-identifier`,{type:`string`,description:`Routing rule identifier.`,demandOption:!0}).option(`actions`,{type:`string`,description:`List actions patterns. Provide as a JSON array of objects or @path/to/file.json.`}).option(`enabled`,{type:`boolean`,description:`Routing rule status.`}).option(`matchers`,{type:`string`,description:`Matching patterns to forward to your actions. Provide as a JSON array of objects or @path/to/file.json.`}).option(`name`,{type:`string`,description:`Routing rule name.`}).option(`owner-worker-tag`,{type:`string`,description:"Public tag (script_tag) of the Worker that owns this rule. Required when\n`source` is `wrangler`.\n"}).option(`priority`,{type:`number`,description:`Priority of the routing rule.`}).option(`source`,{type:`string`,description:"Who manages the rule. `api` covers dashboard, generic API, and Terraform;\n`wrangler` means the rule is managed by a Worker's wrangler.jsonc. Defaults\nto `api` when omitted on write.\n",choices:[`api`,`wrangler`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const $={command:`update <rule-identifier>`,describe:`Update actions and matches, or enable/disable specific routing rules. Forward actions require exactly one verified destination address.`,builder:oe,handler:async e=>{if(e.dryRun){o({command:`cf email-routing rules update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/rules/${e[`rule-identifier`]==null?`<rule-identifier>`:encodeURIComponent(String(e[`rule-identifier`]))}`,pathParams:{"rule-identifier":String(e[`rule-identifier`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({actions:l(e.actions,`actions`),enabled:e.enabled,matchers:l(e.matchers,`matchers`),name:d(e.name,`name`,`text`),owner_worker_tag:d(e[`owner-worker-tag`],`owner-worker-tag`,`text`),priority:e.priority,source:d(e.source,`source`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Updating`,async()=>t.emailRouting.rules.update({...r,zone_id:n,rule_identifier:e[`rule-identifier`]})),{successLabel:`Updated`});return}if(e.actions===void 0)throw Error(`--actions is required (or pass --body with this field set).`);if(e.matchers===void 0)throw Error(`--matchers is required (or pass --body with this field set).`);let f=u({actions:l(e.actions,`actions`),enabled:e.enabled,matchers:l(e.matchers,`matchers`),name:d(e.name,`name`,`text`),owner_worker_tag:d(e[`owner-worker-tag`],`owner-worker-tag`,`text`),priority:e.priority,source:d(e.source,`source`,`text`)});a(await s(`Updating`,async()=>t.emailRouting.rules.update({...f,zone_id:n,rule_identifier:e[`rule-identifier`]})),{successLabel:`Updated`})}},se={command:`rules`,describe:`Routing rules that match incoming email addresses and forward to destination mailboxes`,builder:e=>e.command(J).command(X).command(Q).command(re).command(ae).command($).command(K).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ce(e){return e.option(`name`,{type:`string`,description:`Domain of your 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)`})}const le={command:`unlock`,describe:`Unlock MX records previously locked by Email Routing. Deprecated - use PATCH /zones/{zone_id}/email/routing/dns instead.`,builder:ce,handler:async e=>{if(e.dryRun){o({command:`cf email-routing unlock`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing/unlock`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({name:d(e.name,`name`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Creating`,async()=>t.emailRouting.unlock({body:r,zone_id:n})),{successLabel:`Created`});return}let l=u({name:d(e.name,`name`,`text`)});a(await s(`Creating`,async()=>t.emailRouting.unlock({body:l,zone_id:n})),{successLabel:`Created`})}};function ue(e){return e.option(`enabled`,{type:`boolean`,description:"State of your zone Email Routing settings. No-op on this endpoint - use `POST`/`DELETE /zones/{zone_id}/email/routing/dns`."}).option(`skip-wizard`,{type:`boolean`,description:`Flag to check if the user skipped the configuration wizard.`}).option(`support-subaddress`,{type:`boolean`,description:`Whether subaddressing (plus-addressing) is honored when matching incoming mail against routing rules.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const de={command:`update`,describe:`Update the settings for your Email Routing zone.`,builder:ue,handler:async e=>{if(e.dryRun){o({command:`cf email-routing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/routing`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({enabled:e.enabled,skip_wizard:e[`skip-wizard`],support_subaddress:e[`support-subaddress`]}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Updating`,async()=>t.emailRouting.update({...r,zone_id:n})),{successLabel:`Updated`});return}let l=u({enabled:e.enabled,skip_wizard:e[`skip-wizard`],support_subaddress:e[`support-subaddress`]});a(await s(`Updating`,async()=>t.emailRouting.update({...l,zone_id:n})),{successLabel:`Updated`})}},fe={command:`email-routing`,describe:`Route incoming emails to destination addresses using custom rules, catch-all handlers, and DNS configuration`,builder:e=>e.command(D).command(R).command(te).command(V).command(le).command(de).command(T).command(I).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{fe as default};
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n}from"./oauth-DuEONNgC.mjs";import{r}from"./auth-D3X9HYhD.mjs";import{t as i}from"./output-Ccqw2WOb.mjs";import{t as a}from"./dry-run-DL2V6yFm.mjs";import{t as o}from"./progress-BqQcF5QH.mjs";import{n as s,r as c,t as l}from"./body-parser-BshbixEq.mjs";import{n as u}from"./input-validation-QDIYu7Vb.mjs";import{a as d,i as f,n as p}from"./prompt-B0sWIs9c.mjs";import{t as m}from"./cli-types-DAYeL_Mj.mjs";function h(e){return e.option(`deletes`,{type:`string`,description:`The deletes field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`patches`,{type:`string`,description:`The patches field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`posts`,{type:`string`,description:`The posts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`puts`,{type:`string`,description:`The puts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`batch`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:h,handler:async u=>{if(u.dryRun){a({command:`cf email-security allow-policies batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies/batch`,pathParams:{},bodyKind:`json`,body:u.body===void 0?l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,!await p({force:!!u.force,message:`This operation may delete the selected allow policies and restore normal security scanning and disposition actions for matching emails.`})){process.stderr.write(`Aborted.
3
+ `);return}if(u.body){let e=s(u.body);i(await o(`Deleting`,async()=>d.emailSecurity.allowPolicies.batch({...e,account_id:f})),{successLabel:`Deleted`});return}if(u.deletes===void 0)throw Error(`--deletes is required (or pass --body with this field set).`);if(u.patches===void 0)throw Error(`--patches is required (or pass --body with this field set).`);if(u.posts===void 0)throw Error(`--posts is required (or pass --body with this field set).`);if(u.puts===void 0)throw Error(`--puts is required (or pass --body with this field set).`);let m=l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)});i(await o(`Deleting`,async()=>d.emailSecurity.allowPolicies.batch({...m,account_id:f})),{successLabel:`Deleted`})}};function te(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Exempts messages from this sender from Spam, Spoof and Bulk dispositions only; Malicious and Suspicious dispositions still apply.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Bypasses all detections for messages to this recipient.`}).option(`is-recipient`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Bypasses all detections and link following for messages from this sender.`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create an allow policy.`})}const g={command:`create`,describe:`Creates a new allow policy that exempts matching emails from security detections. Use with caution as this bypasses email security scanning. Policies can match on sender patterns and apply to specific detections or all detections.`,builder:te,handler:async c=>{if(c.dryRun){a({command:`cf email-security allow-policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_acceptable_sender:c[`is-acceptable-sender`],is_exempt_recipient:c[`is-exempt-recipient`],is_recipient:c[`is-recipient`],is_regex:c[`is-regex`],is_sender:c[`is-sender`],is_spoof:c[`is-spoof`],is_trusted_sender:c[`is-trusted-sender`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`),verify_sender:c[`verify-sender`]}):s(c.body)});return}let p=await r(c),m=c.local?e:await t();if(c.accountId=m,c.body){let e=s(c.body);i(await o(`Creating`,async()=>p.emailSecurity.allowPolicies.create({body:e,account_id:m})),{successLabel:`Created`});return}if(c[`is-acceptable-sender`]===void 0)throw Error(`--is-acceptable-sender is required (or pass --body with this field set).`);if(c[`is-exempt-recipient`]===void 0)throw Error(`--is-exempt-recipient is required (or pass --body with this field set).`);if(c[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);if(c[`is-trusted-sender`]===void 0)throw Error(`--is-trusted-sender is required (or pass --body with this field set).`);if(c.pattern===void 0&&(c.pattern=await d(`pattern`,"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.")),c[`pattern-type`]===void 0&&(c[`pattern-type`]=await f(`pattern-type`,"Type of pattern matching. - EMAIL: matches a full email address (e.g. `user@example.com`) - DOMAIN: matches a domain name (e.g. `example.com`) - IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents. - UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries. ",[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`])),c[`verify-sender`]===void 0)throw Error(`--verify-sender is required (or pass --body with this field set).`);let h=l({comments:u(c.comments,`comments`,`text`),is_acceptable_sender:c[`is-acceptable-sender`],is_exempt_recipient:c[`is-exempt-recipient`],is_recipient:c[`is-recipient`],is_regex:c[`is-regex`],is_sender:c[`is-sender`],is_spoof:c[`is-spoof`],is_trusted_sender:c[`is-trusted-sender`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`),verify_sender:c[`verify-sender`]});i(await o(`Creating`,async()=>p.emailSecurity.allowPolicies.create({body:h,account_id:m})),{successLabel:`Created`})}};function _(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const v={command:`delete <policy-id>`,describe:`Removes an allow policy. After deletion, emails matching this pattern will be subject to normal security scanning and disposition actions.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf email-security allow-policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the allow policy and restores normal security scanning and disposition actions for matching emails.`})){process.stderr.write(`Aborted.
4
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.allowPolicies.delete({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Deleted`})}};function y(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Exempts messages from this sender from Spam, Spoof and Bulk dispositions only; Malicious and Suspicious dispositions still apply.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Bypasses all detections for messages to this recipient.`}).option(`is-recipient`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Bypasses all detections and link following for messages from this sender.`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update an allow policy.`})}const b={command:`edit <policy-id>`,describe:`Updates an existing allow policy. Only provided fields will be modified. Changes take effect for new emails matching the pattern.`,builder:y,handler:async c=>{if(c.dryRun){a({command:`cf email-security allow-policies edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies/${c[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(c[`policy-id`]))}`,pathParams:{"policy-id":String(c[`policy-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_acceptable_sender:c[`is-acceptable-sender`],is_exempt_recipient:c[`is-exempt-recipient`],is_recipient:c[`is-recipient`],is_regex:c[`is-regex`],is_sender:c[`is-sender`],is_spoof:c[`is-spoof`],is_trusted_sender:c[`is-trusted-sender`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`),verify_sender:c[`verify-sender`]}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.allowPolicies.edit({body:e,account_id:f,policy_id:c[`policy-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(c.comments,`comments`,`text`),is_acceptable_sender:c[`is-acceptable-sender`],is_exempt_recipient:c[`is-exempt-recipient`],is_recipient:c[`is-recipient`],is_regex:c[`is-regex`],is_sender:c[`is-sender`],is_spoof:c[`is-spoof`],is_trusted_sender:c[`is-trusted-sender`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`),verify_sender:c[`verify-sender`]});i(await o(`Updating`,async()=>d.emailSecurity.allowPolicies.edit({body:p,account_id:f,policy_id:c[`policy-id`]})),{successLabel:`Updated`})}};function x(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get <policy-id>`,describe:`Retrieves details for a specific allow policy including its pattern, dispositions that are exempted, and whether it applies to all detections.`,builder:x,handler:async s=>{if(s.dryRun){a({command:`cf email-security allow-policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.allowPolicies.get({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Loaded`})}};function C(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`is-exempt-recipient`,{type:`boolean`,description:`Filter to show only policies where messages to the recipient bypass all detections.`}).option(`is-trusted-sender`,{type:`boolean`,description:`Filter to show only policies where messages from the sender bypass all detections and link following.`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Filter to show only policies where messages from the sender are exempted from Spam, Spoof, and Bulk dispositions (not Malicious or Suspicious).`}).option(`verify-sender`,{type:`boolean`,description:`Filter to show only policies that enforce DMARC, SPF, or DKIM authentication.`}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`list`,describe:`Returns a paginated list of email allow policies. These policies exempt matching emails from security detection, allowing them to bypass disposition actions. Supports filtering by pattern type and policy attributes.`,builder:m(C),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction,is_exempt_recipient:s[`is-exempt-recipient`],is_trusted_sender:s[`is-trusted-sender`],is_acceptable_sender:s[`is-acceptable-sender`],verify_sender:s[`verify-sender`],pattern_type:s[`pattern-type`],pattern:s.pattern};if(s.dryRun){a({command:`cf email-security allow-policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.allowPolicies.list({account_id:u,...c})),{successLabel:`Loaded`})}};function T(e){return e.positional(`policy-id`,{type:`string`,description:`Allow policy identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-acceptable-sender`,{type:`boolean`,description:`Exempts messages from this sender from Spam, Spoof and Bulk dispositions only; Malicious and Suspicious dispositions still apply.`}).option(`is-exempt-recipient`,{type:`boolean`,description:`Bypasses all detections for messages to this recipient.`}).option(`is-recipient`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026."}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-sender`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026."}).option(`is-spoof`,{type:`boolean`,description:"Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026."}).option(`is-trusted-sender`,{type:`boolean`,description:`Bypasses all detections and link following for messages from this sender.`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`verify-sender`,{type:`boolean`,description:`Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create an allow policy.`})}const E={command:`update <policy-id>`,describe:`Replaces an existing allow policy in full. Unlike PATCH, every field is taken from the request body, so optional fields that are omitted are reset rather than left untouched. Use this when managing policies declaratively.`,builder:T,handler:async c=>{if(c.dryRun){a({command:`cf email-security allow-policies update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/allow_policies/${c[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(c[`policy-id`]))}`,pathParams:{"policy-id":String(c[`policy-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_acceptable_sender:c[`is-acceptable-sender`],is_exempt_recipient:c[`is-exempt-recipient`],is_recipient:c[`is-recipient`],is_regex:c[`is-regex`],is_sender:c[`is-sender`],is_spoof:c[`is-spoof`],is_trusted_sender:c[`is-trusted-sender`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`),verify_sender:c[`verify-sender`]}):s(c.body)});return}let p=await r(c),m=c.local?e:await t();if(c.accountId=m,c.body){let e=s(c.body);i(await o(`Updating`,async()=>p.emailSecurity.allowPolicies.update({body:e,account_id:m,policy_id:c[`policy-id`]})),{successLabel:`Updated`});return}if(c[`is-acceptable-sender`]===void 0)throw Error(`--is-acceptable-sender is required (or pass --body with this field set).`);if(c[`is-exempt-recipient`]===void 0)throw Error(`--is-exempt-recipient is required (or pass --body with this field set).`);if(c[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);if(c[`is-trusted-sender`]===void 0)throw Error(`--is-trusted-sender is required (or pass --body with this field set).`);if(c.pattern===void 0&&(c.pattern=await d(`pattern`,"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.")),c[`pattern-type`]===void 0&&(c[`pattern-type`]=await f(`pattern-type`,"Type of pattern matching. - EMAIL: matches a full email address (e.g. `user@example.com`) - DOMAIN: matches a domain name (e.g. `example.com`) - IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents. - UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries. ",[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`])),c[`verify-sender`]===void 0)throw Error(`--verify-sender is required (or pass --body with this field set).`);let h=l({comments:u(c.comments,`comments`,`text`),is_acceptable_sender:c[`is-acceptable-sender`],is_exempt_recipient:c[`is-exempt-recipient`],is_recipient:c[`is-recipient`],is_regex:c[`is-regex`],is_sender:c[`is-sender`],is_spoof:c[`is-spoof`],is_trusted_sender:c[`is-trusted-sender`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`),verify_sender:c[`verify-sender`]});i(await o(`Updating`,async()=>p.emailSecurity.allowPolicies.update({body:h,account_id:m,policy_id:c[`policy-id`]})),{successLabel:`Updated`})}},D={command:`allow-policies`,describe:`Operations for allow-policies`,builder:e=>e.command(ee).command(g).command(v).command(b).command(S).command(w).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function O(e){return e.option(`deletes`,{type:`string`,description:`The deletes field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`patches`,{type:`string`,description:`The patches field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`posts`,{type:`string`,description:`The posts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`puts`,{type:`string`,description:`The puts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const k={command:`batch`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:O,handler:async u=>{if(u.dryRun){a({command:`cf email-security block-senders batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders/batch`,pathParams:{},bodyKind:`json`,body:u.body===void 0?l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,!await p({force:!!u.force,message:`This operation may delete the selected blocked sender patterns and stop automatically blocking matching emails based on those rules.`})){process.stderr.write(`Aborted.
5
+ `);return}if(u.body){let e=s(u.body);i(await o(`Deleting`,async()=>d.emailSecurity.blockSenders.batch({...e,account_id:f})),{successLabel:`Deleted`});return}if(u.deletes===void 0)throw Error(`--deletes is required (or pass --body with this field set).`);if(u.patches===void 0)throw Error(`--patches is required (or pass --body with this field set).`);if(u.posts===void 0)throw Error(`--posts is required (or pass --body with this field set).`);if(u.puts===void 0)throw Error(`--puts is required (or pass --body with this field set).`);let m=l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)});i(await o(`Deleting`,async()=>d.emailSecurity.blockSenders.batch({...m,account_id:f})),{successLabel:`Deleted`})}};function A(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a blocked sender pattern.`})}const j={command:`create`,describe:`Creates a new blocked sender pattern. Emails matching this pattern will be blocked from delivery. Patterns can be email addresses, domains, or IP addresses, and support regular expressions.`,builder:A,handler:async c=>{if(c.dryRun){a({command:`cf email-security block-senders create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_regex:c[`is-regex`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`)}):s(c.body)});return}let p=await r(c),m=c.local?e:await t();if(c.accountId=m,c.body){let e=s(c.body);i(await o(`Creating`,async()=>p.emailSecurity.blockSenders.create({body:e,account_id:m})),{successLabel:`Created`});return}if(c[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);c.pattern===void 0&&(c.pattern=await d(`pattern`,"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.")),c[`pattern-type`]===void 0&&(c[`pattern-type`]=await f(`pattern-type`,"Type of pattern matching. - EMAIL: matches a full email address (e.g. `user@example.com`) - DOMAIN: matches a domain name (e.g. `example.com`) - IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents. - UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries. ",[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]));let h=l({comments:u(c.comments,`comments`,`text`),is_regex:c[`is-regex`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`)});i(await o(`Creating`,async()=>p.emailSecurity.blockSenders.create({body:h,account_id:m})),{successLabel:`Created`})}};function M(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const N={command:`delete <pattern-id>`,describe:`Removes a blocked sender pattern. After deletion, emails from this sender will no longer be automatically blocked based on this rule.`,builder:M,handler:async s=>{if(s.dryRun){a({command:`cf email-security block-senders delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders/${s[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(s[`pattern-id`]))}`,pathParams:{"pattern-id":String(s[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the blocked sender pattern and stops automatically blocking matching emails based on this rule.`})){process.stderr.write(`Aborted.
6
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.blockSenders.delete({account_id:l,pattern_id:s[`pattern-id`]})),{successLabel:`Deleted`})}};function P(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a blocked sender pattern.`})}const F={command:`edit <pattern-id>`,describe:`Updates an existing blocked sender pattern. Only provided fields will be modified. The pattern will continue blocking emails until deleted.`,builder:P,handler:async c=>{if(c.dryRun){a({command:`cf email-security block-senders edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders/${c[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(c[`pattern-id`]))}`,pathParams:{"pattern-id":String(c[`pattern-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_regex:c[`is-regex`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`)}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.blockSenders.edit({body:e,account_id:f,pattern_id:c[`pattern-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(c.comments,`comments`,`text`),is_regex:c[`is-regex`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.blockSenders.edit({body:p,account_id:f,pattern_id:c[`pattern-id`]})),{successLabel:`Updated`})}};function I(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <pattern-id>`,describe:`Retrieves details for a specific blocked sender pattern including its pattern type, value, and metadata.`,builder:I,handler:async s=>{if(s.dryRun){a({command:`cf email-security block-senders get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders/${s[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(s[`pattern-id`]))}`,pathParams:{"pattern-id":String(s[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.blockSenders.get({account_id:l,pattern_id:s[`pattern-id`]})),{successLabel:`Loaded`})}};function R(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`pattern-type`,{type:`string`,description:`Filter by pattern type.`,choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`pattern`,{type:`string`,description:`Filter by pattern value.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`Returns a paginated list of blocked email sender patterns. These patterns prevent emails from matching senders from being delivered. Supports filtering by pattern type and searching across patterns.`,builder:m(R),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction,pattern_type:s[`pattern-type`],pattern:s.pattern};if(s.dryRun){a({command:`cf email-security block-senders list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.blockSenders.list({account_id:u,...c})),{successLabel:`Loaded`})}};function B(e){return e.positional(`pattern-id`,{type:`string`,description:`Blocked sender pattern identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`pattern`,{type:`string`,description:"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents."}).option(`pattern-type`,{type:`string`,description:"Type of pattern matching.\n- EMAIL: matches a full email address (e.g. `user@example.com`)\n- DOMAIN: matches a domain name (e.g. `example.com`)\n- IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.\n- UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries.\n",choices:[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a blocked sender pattern.`})}const V={command:`update <pattern-id>`,describe:`Replaces an existing blocked sender pattern in full. Unlike PATCH, every field is taken from the request body, so optional fields that are omitted are reset rather than left untouched. Use this when managing blocked senders declaratively.`,builder:B,handler:async c=>{if(c.dryRun){a({command:`cf email-security block-senders update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/block_senders/${c[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(c[`pattern-id`]))}`,pathParams:{"pattern-id":String(c[`pattern-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_regex:c[`is-regex`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`)}):s(c.body)});return}let p=await r(c),m=c.local?e:await t();if(c.accountId=m,c.body){let e=s(c.body);i(await o(`Updating`,async()=>p.emailSecurity.blockSenders.update({body:e,account_id:m,pattern_id:c[`pattern-id`]})),{successLabel:`Updated`});return}if(c[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);c.pattern===void 0&&(c.pattern=await d(`pattern`,"The pattern value to match. The format depends on `pattern_type`: a valid email address for EMAIL (e.g. `user@example.com`), a valid domain name for DOMAIN (e.g. `example.com`), or a plain IPv4 or IPv6 address or CIDR block for IP (e.g. `1.2.3.4`, `1.2.3.0/24`, `2606:4700:4700::1111`, or `2606:4700:4700::/48`); the API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents.")),c[`pattern-type`]===void 0&&(c[`pattern-type`]=await f(`pattern-type`,"Type of pattern matching. - EMAIL: matches a full email address (e.g. `user@example.com`) - DOMAIN: matches a domain name (e.g. `example.com`) - IP: matches a plain IPv4 or IPv6 address (e.g. `1.2.3.4` or `2606:4700:4700::1111`) or CIDR block (e.g. `1.2.3.0/24` or `2606:4700:4700::/48`). The API rejects private or unique-local, loopback, link-local, unspecified, and IPv4 broadcast addresses, including their IPv4-mapped IPv6 equivalents. - UNKNOWN: deprecated; you cannot use this when creating or updating policies, but it may appear on existing entries. ",[`EMAIL`,`DOMAIN`,`IP`,`UNKNOWN`]));let h=l({comments:u(c.comments,`comments`,`text`),is_regex:c[`is-regex`],pattern:u(c.pattern,`pattern`,`text`),pattern_type:u(c[`pattern-type`],`pattern-type`,`text`)});i(await o(`Updating`,async()=>p.emailSecurity.blockSenders.update({body:h,account_id:m,pattern_id:c[`pattern-id`]})),{successLabel:`Updated`})}},H={command:`block-senders`,describe:`Operations for block-senders`,builder:e=>e.command(k).command(j).command(N).command(F).command(L).command(z).command(V).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function U(e){return e.option(`deletes`,{type:`string`,description:`The deletes field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`patches`,{type:`string`,description:`The patches field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`posts`,{type:`string`,description:`The posts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`puts`,{type:`string`,description:`The puts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const W={command:`batch`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:U,handler:async u=>{if(u.dryRun){a({command:`cf email-security content-policies batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/content_policies/batch`,pathParams:{},bodyKind:`json`,body:u.body===void 0?l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,!await p({force:!!u.force,message:`This operation may delete the selected content policies and stop evaluating emails against their patterns.`})){process.stderr.write(`Aborted.
7
+ `);return}if(u.body){let e=s(u.body);i(await o(`Deleting`,async()=>d.emailSecurity.contentPolicies.batch({...e,account_id:f})),{successLabel:`Deleted`});return}if(u.deletes===void 0)throw Error(`--deletes is required (or pass --body with this field set).`);if(u.patches===void 0)throw Error(`--patches is required (or pass --body with this field set).`);if(u.posts===void 0)throw Error(`--posts is required (or pass --body with this field set).`);if(u.puts===void 0)throw Error(`--puts is required (or pass --body with this field set).`);let m=l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)});i(await o(`Deleting`,async()=>d.emailSecurity.contentPolicies.batch({...m,account_id:f})),{successLabel:`Deleted`})}};function G(e){return e.option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`pattern`,{type:`string`,description:`The pattern field`}).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:`Create a content policy.`})}const K={command:`create`,describe:`Creates a new content policy. Emails whose subject or body matches the pattern will be subject to the configured action.`,builder:G,handler:async c=>{if(c.dryRun){a({command:`cf email-security content-policies create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/content_policies`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({enabled:c.enabled,name:u(c.name,`name`,`text`),notes:u(c.notes,`notes`,`text`),pattern:u(c.pattern,`pattern`,`text`),targets:c.targets}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.contentPolicies.create({body:e,account_id:p})),{successLabel:`Created`});return}if(c.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);if(c.name===void 0&&(c.name=await d(`name`,`The name field`)),c.pattern===void 0&&(c.pattern=await d(`pattern`,`The pattern field`)),c.targets===void 0)throw Error(`--targets is required (or pass --body with this field set).`);let m=l({enabled:c.enabled,name:u(c.name,`name`,`text`),notes:u(c.notes,`notes`,`text`),pattern:u(c.pattern,`pattern`,`text`),targets:c.targets});i(await o(`Creating`,async()=>f.emailSecurity.contentPolicies.create({body:m,account_id:p})),{successLabel:`Created`})}};function q(e){return e.positional(`policy-id`,{type:`string`,description:`Content policy identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const J={command:`delete <policy-id>`,describe:`Removes a content policy. After deletion, emails will no longer be evaluated against this pattern.`,builder:q,handler:async s=>{if(s.dryRun){a({command:`cf email-security content-policies delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/content_policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the content policy and stops evaluating emails against its pattern.`})){process.stderr.write(`Aborted.
8
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.contentPolicies.delete({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Deleted`})}};function Y(e){return e.positional(`policy-id`,{type:`string`,description:`Content policy identifier.`,demandOption:!0}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`notes`,{type:`string`,description:`The notes field`}).option(`pattern`,{type:`string`,description:`The pattern field`}).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:`Update a content policy.`})}const X={command:`edit <policy-id>`,describe:`Updates an existing content policy. Only provided fields will be modified.`,builder:Y,handler:async c=>{if(c.dryRun){a({command:`cf email-security content-policies edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/content_policies/${c[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(c[`policy-id`]))}`,pathParams:{"policy-id":String(c[`policy-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({enabled:c.enabled,name:u(c.name,`name`,`text`),notes:u(c.notes,`notes`,`text`),pattern:u(c.pattern,`pattern`,`text`),targets:c.targets}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.contentPolicies.edit({body:e,account_id:f,policy_id:c[`policy-id`]})),{successLabel:`Updated`});return}let p=l({enabled:c.enabled,name:u(c.name,`name`,`text`),notes:u(c.notes,`notes`,`text`),pattern:u(c.pattern,`pattern`,`text`),targets:c.targets});i(await o(`Updating`,async()=>d.emailSecurity.contentPolicies.edit({body:p,account_id:f,policy_id:c[`policy-id`]})),{successLabel:`Updated`})}};function Z(e){return e.positional(`policy-id`,{type:`string`,description:`Content policy identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Q={command:`get <policy-id>`,describe:`Retrieves details for a specific content policy including its pattern, targets, and metadata.`,builder:Z,handler:async s=>{if(s.dryRun){a({command:`cf email-security content-policies get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/content_policies/${s[`policy-id`]==null?`<policy-id>`:encodeURIComponent(String(s[`policy-id`]))}`,pathParams:{"policy-id":String(s[`policy-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.contentPolicies.get({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Loaded`})}};function ne(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`name`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`enabled`,{type:`boolean`,description:`Filter by enabled status.`}).option(`name`,{type:`string`,description:`Filter by exact policy name.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`list`,describe:`Returns a paginated list of content policies. These policies match against the subject or body of emails using a pattern. Supports filtering by name or enabled status, and searching across name and pattern fields.`,builder:m(ne),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction,enabled:s.enabled,name:s.name};if(s.dryRun){a({command:`cf email-security content-policies list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/content_policies`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.contentPolicies.list({account_id:u,...c})),{successLabel:`Loaded`})}},ie={command:`content-policies`,describe:`Operations for content-policies`,builder:e=>e.command(W).command(K).command(J).command(X).command(Q).command(re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ae(e){return e.option(`deletes`,{type:`string`,description:`The deletes field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`patches`,{type:`string`,description:`The patches field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`posts`,{type:`string`,description:`The posts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`puts`,{type:`string`,description:`The puts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`batch`,describe:`Executes multiple domain operations in a single request. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:ae,handler:async u=>{if(u.dryRun){a({command:`cf email-security domains batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains/batch`,pathParams:{},bodyKind:`json`,body:u.body===void 0?l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,!await p({force:!!u.force,message:`This operation may permanently delete protection for the selected email domains. Emails for those domains will no longer be processed by Email Security.`})){process.stderr.write(`Aborted.
9
+ `);return}if(u.body){let e=s(u.body);i(await o(`Deleting`,async()=>d.emailSecurity.domains.batch({...e,account_id:f})),{successLabel:`Deleted`});return}if(u.deletes===void 0)throw Error(`--deletes is required (or pass --body with this field set).`);if(u.patches===void 0)throw Error(`--patches is required (or pass --body with this field set).`);if(u.posts===void 0)throw Error(`--posts is required (or pass --body with this field set).`);if(u.puts===void 0)throw Error(`--puts is required (or pass --body with this field set).`);let m=l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)});i(await o(`Deleting`,async()=>d.emailSecurity.domains.batch({...m,account_id:f})),{successLabel:`Deleted`})}};function se(e){return e.option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`domain`,{type:`string`,description:`The domain field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ce={command:`create`,describe:`Protects a new email domain by adding it to Email Security. Accepts a flat configuration object covering all delivery modes. Returns the newly created domain configuration.`,builder:se,handler:async c=>{if(c.dryRun){a({command:`cf email-security domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({allowed_delivery_modes:c[`allowed-delivery-modes`],domain:u(c.domain,`domain`,`text`),drop_dispositions:c[`drop-dispositions`],integration_id:u(c[`integration-id`],`integration-id`,`text`),ip_restrictions:c[`ip-restrictions`],lookback_hops:c[`lookback-hops`],regions:c.regions,require_tls_inbound:c[`require-tls-inbound`],require_tls_outbound:c[`require-tls-outbound`],transport:u(c.transport,`transport`,`text`)}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.domains.create({body:e,account_id:p})),{successLabel:`Created`});return}if(c[`allowed-delivery-modes`]===void 0)throw Error(`--allowed-delivery-modes is required (or pass --body with this field set).`);if(c.domain===void 0&&(c.domain=await d(`domain`,`The domain field`)),c[`drop-dispositions`]===void 0)throw Error(`--drop-dispositions is required (or pass --body with this field set).`);if(c[`ip-restrictions`]===void 0)throw Error(`--ip-restrictions is required (or pass --body with this field set).`);if(c.regions===void 0)throw Error(`--regions is required (or pass --body with this field set).`);let m=l({allowed_delivery_modes:c[`allowed-delivery-modes`],domain:u(c.domain,`domain`,`text`),drop_dispositions:c[`drop-dispositions`],integration_id:u(c[`integration-id`],`integration-id`,`text`),ip_restrictions:c[`ip-restrictions`],lookback_hops:c[`lookback-hops`],regions:c.regions,require_tls_inbound:c[`require-tls-inbound`],require_tls_outbound:c[`require-tls-outbound`],transport:u(c.transport,`transport`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.domains.create({body:m,account_id:p})),{successLabel:`Created`})}};function le(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ue={command:`delete <domain-id>`,describe:`Removes email security protection from a domain. After deletion, emails for this domain will no longer be processed by Email Security. This action cannot be undone.`,builder:le,handler:async s=>{if(s.dryRun){a({command:`cf email-security domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains/${s[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(s[`domain-id`]))}`,pathParams:{"domain-id":String(s[`domain-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation permanently deletes protection for the email domain. Emails for this domain will no longer be processed by Email Security.`})){process.stderr.write(`Aborted.
10
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.domains.delete({account_id:l,domain_id:s[`domain-id`]})),{successLabel:`Deleted`})}};function de(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`edit <domain-id>`,describe:`Updates configuration for a protected email domain. Only provided fields will be modified. Changes affect delivery mode, security settings, and regional processing.`,builder:de,handler:async c=>{if(c.dryRun){a({command:`cf email-security domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains/${c[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(c[`domain-id`]))}`,pathParams:{"domain-id":String(c[`domain-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({allowed_delivery_modes:c[`allowed-delivery-modes`],drop_dispositions:c[`drop-dispositions`],integration_id:u(c[`integration-id`],`integration-id`,`text`),ip_restrictions:c[`ip-restrictions`],lookback_hops:c[`lookback-hops`],regions:c.regions,require_tls_inbound:c[`require-tls-inbound`],require_tls_outbound:c[`require-tls-outbound`],transport:u(c.transport,`transport`,`text`)}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.domains.edit({body:e,account_id:f,domain_id:c[`domain-id`]})),{successLabel:`Updated`});return}let p=l({allowed_delivery_modes:c[`allowed-delivery-modes`],drop_dispositions:c[`drop-dispositions`],integration_id:u(c[`integration-id`],`integration-id`,`text`),ip_restrictions:c[`ip-restrictions`],lookback_hops:c[`lookback-hops`],regions:c.regions,require_tls_inbound:c[`require-tls-inbound`],require_tls_outbound:c[`require-tls-outbound`],transport:u(c.transport,`transport`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.domains.edit({body:p,account_id:f,domain_id:c[`domain-id`]})),{successLabel:`Updated`})}};function pe(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const me={command:`get <domain-id>`,describe:`Retrieves detailed information for a specific protected email domain including its delivery configuration, SPF/DMARC status, and authorization state.`,builder:pe,handler:async s=>{if(s.dryRun){a({command:`cf email-security domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains/${s[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(s[`domain-id`]))}`,pathParams:{"domain-id":String(s[`domain-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.domains.get({account_id:l,domain_id:s[`domain-id`]})),{successLabel:`Loaded`})}};function he(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`domain`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`allowed-delivery-mode`,{type:`string`,description:`Delivery mode to filter by.`,choices:[`DIRECT`,`BCC`,`JOURNAL`,`API`,`RETRO_SCAN`]}).option(`domain`,{type:`string`,description:`Domain names to filter by.`}).option(`active-delivery-mode`,{type:`string`,description:`Currently active delivery mode to filter by.`,choices:[`DIRECT`,`BCC`,`JOURNAL`,`API`,`RETRO_SCAN`]}).option(`integration-id`,{type:`string`,description:`Integration ID to filter by.`}).option(`status`,{type:`string`,description:`Filters response to domains with the provided status.`,choices:[`PENDING`,`ACTIVE`,`FAILED`,`TIMEOUT`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ge={command:`list`,describe:`Returns a paginated list of email domains protected by Email Security. Includes domain configuration, delivery modes, and authorization status. Supports filtering by delivery mode and integration ID.`,builder:m(he),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction,allowed_delivery_mode:s[`allowed-delivery-mode`],domain:s.domain,active_delivery_mode:s[`active-delivery-mode`],integration_id:s[`integration-id`],status:s.status};if(s.dryRun){a({command:`cf email-security domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.domains.list({account_id:u,...c})),{successLabel:`Loaded`})}};function _e(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`allowed-delivery-modes`,{type:`string`,array:!0,description:`The allowed_delivery_modes field`}).option(`drop-dispositions`,{type:`string`,array:!0,description:`The drop_dispositions field`}).option(`integration-id`,{type:`string`,description:`The integration_id field`}).option(`ip-restrictions`,{type:`string`,array:!0,description:`The ip_restrictions field`}).option(`lookback-hops`,{type:`number`,description:`The lookback_hops field`}).option(`regions`,{type:`string`,array:!0,description:`The regions field`}).option(`require-tls-inbound`,{type:`boolean`,description:`The require_tls_inbound field`}).option(`require-tls-outbound`,{type:`boolean`,description:`The require_tls_outbound field`}).option(`transport`,{type:`string`,description:`The transport field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for replacing an email domain. The `domain` field is intentionally absent — the domain name is immutable after creation. "})}const ve={command:`update <domain-id>`,describe:`Replaces all mutable fields of a protected email domain in a single atomic operation. Unlike PATCH, all non-computed fields are required.`,builder:_e,handler:async c=>{if(c.dryRun){a({command:`cf email-security domains update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains/${c[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(c[`domain-id`]))}`,pathParams:{"domain-id":String(c[`domain-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({allowed_delivery_modes:c[`allowed-delivery-modes`],drop_dispositions:c[`drop-dispositions`],integration_id:u(c[`integration-id`],`integration-id`,`text`),ip_restrictions:c[`ip-restrictions`],lookback_hops:c[`lookback-hops`],regions:c.regions,require_tls_inbound:c[`require-tls-inbound`],require_tls_outbound:c[`require-tls-outbound`],transport:u(c.transport,`transport`,`text`)}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.domains.update({body:e,account_id:f,domain_id:c[`domain-id`]})),{successLabel:`Updated`});return}if(c[`allowed-delivery-modes`]===void 0)throw Error(`--allowed-delivery-modes is required (or pass --body with this field set).`);if(c[`drop-dispositions`]===void 0)throw Error(`--drop-dispositions is required (or pass --body with this field set).`);if(c[`ip-restrictions`]===void 0)throw Error(`--ip-restrictions is required (or pass --body with this field set).`);if(c.regions===void 0)throw Error(`--regions is required (or pass --body with this field set).`);let p=l({allowed_delivery_modes:c[`allowed-delivery-modes`],drop_dispositions:c[`drop-dispositions`],integration_id:u(c[`integration-id`],`integration-id`,`text`),ip_restrictions:c[`ip-restrictions`],lookback_hops:c[`lookback-hops`],regions:c.regions,require_tls_inbound:c[`require-tls-inbound`],require_tls_outbound:c[`require-tls-outbound`],transport:u(c.transport,`transport`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.domains.update({body:p,account_id:f,domain_id:c[`domain-id`]})),{successLabel:`Updated`})}};function ye(e){return e.positional(`domain-id`,{type:`string`,description:`Domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const be={command:`get <domain-id>`,describe:`Returns the DNS TXT record information when the domain ownership isn't verified through Cloudflare zone ownership or CASB integration.`,builder:ye,handler:async s=>{if(s.dryRun){a({command:`cf email-security domains verification get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/domains/${s[`domain-id`]==null?`<domain-id>`:encodeURIComponent(String(s[`domain-id`]))}/verification`,pathParams:{"domain-id":String(s[`domain-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.domains.verification.get({account_id:l,domain_id:s[`domain-id`]})),{successLabel:`Loaded`})}},xe={command:`verification`,describe:`Operations for domains.verification`,builder:e=>e.command(be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Se={command:`domains`,describe:`Operations for domains`,builder:e=>e.command(oe).command(ce).command(ue).command(fe).command(me).command(ge).command(ve).command(xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ce(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`directory-id`,{type:`number`,description:`The directory_id field`}).option(`directory-node-id`,{type:`number`,description:`The directory_node_id field`}).option(`email`,{type:`string`,description:`The email field`}).option(`external-directory-node-id`,{type:`string`,description:`The external_directory_node_id field`}).option(`is-email-regex`,{type:`boolean`,description:`The is_email_regex field`}).option(`name`,{type:`string`,description:`The name field`}).option(`provenance`,{type:`string`,description:`The provenance field`,choices:[`A1S_INTERNAL`,`SNOOPY-CASB_OFFICE_365`,`SNOOPY-OFFICE_365`,`SNOOPY-GOOGLE_DIRECTORY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create an impersonation registry entry.`})}const we={command:`create`,describe:`Creates a new entry in the impersonation registry to protect against impersonation. Emails attempting to impersonate this identity will be flagged. Supports regex patterns for flexible email matching.`,builder:Ce,handler:async c=>{if(c.dryRun){a({command:`cf email-security impersonation-registry create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),directory_id:c[`directory-id`],directory_node_id:c[`directory-node-id`],email:u(c.email,`email`,`text`),external_directory_node_id:u(c[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:c[`is-email-regex`],name:u(c.name,`name`,`text`),provenance:u(c.provenance,`provenance`,`text`)}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.impersonationRegistry.create({...e,account_id:p})),{successLabel:`Created`});return}if(c.email===void 0&&(c.email=await d(`email`,`The email field`)),c[`is-email-regex`]===void 0)throw Error(`--is-email-regex is required (or pass --body with this field set).`);c.name===void 0&&(c.name=await d(`name`,`The name field`));let m=l({comments:u(c.comments,`comments`,`text`),directory_id:c[`directory-id`],directory_node_id:c[`directory-node-id`],email:u(c.email,`email`,`text`),external_directory_node_id:u(c[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:c[`is-email-regex`],name:u(c.name,`name`,`text`),provenance:u(c.provenance,`provenance`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.impersonationRegistry.create({...m,account_id:p})),{successLabel:`Created`})}};function Te(e){return e.positional(`impersonation-registry-id`,{type:`string`,description:`Impersonation registry entry identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ee={command:`delete <impersonation-registry-id>`,describe:`Removes an entry from the impersonation registry. After deletion, this identity will no longer be protected from impersonation.`,builder:Te,handler:async s=>{if(s.dryRun){a({command:`cf email-security impersonation-registry delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/impersonation_registry/${s[`impersonation-registry-id`]==null?`<impersonation-registry-id>`:encodeURIComponent(String(s[`impersonation-registry-id`]))}`,pathParams:{"impersonation-registry-id":String(s[`impersonation-registry-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the impersonation registry entry and stops protecting the identity from impersonation.`})){process.stderr.write(`Aborted.
11
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.impersonationRegistry.delete({account_id:l,impersonation_registry_id:s[`impersonation-registry-id`]})),{successLabel:`Deleted`})}};function De(e){return e.positional(`impersonation-registry-id`,{type:`string`,description:`Impersonation registry entry identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`directory-id`,{type:`number`,description:`The directory_id field`}).option(`directory-node-id`,{type:`number`,description:`The directory_node_id field`}).option(`email`,{type:`string`,description:`The email field`}).option(`external-directory-node-id`,{type:`string`,description:`The external_directory_node_id field`}).option(`is-email-regex`,{type:`boolean`,description:`The is_email_regex field`}).option(`name`,{type:`string`,description:`The name field`}).option(`provenance`,{type:`string`,description:`The provenance field`,choices:[`A1S_INTERNAL`,`SNOOPY-CASB_OFFICE_365`,`SNOOPY-OFFICE_365`,`SNOOPY-GOOGLE_DIRECTORY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update an impersonation registry entry.`})}const Oe={command:`edit <impersonation-registry-id>`,describe:`Updates an existing impersonation registry entry. Only provided fields will be modified. Directory-synced entries can't be updated.`,builder:De,handler:async c=>{if(c.dryRun){a({command:`cf email-security impersonation-registry edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/impersonation_registry/${c[`impersonation-registry-id`]==null?`<impersonation-registry-id>`:encodeURIComponent(String(c[`impersonation-registry-id`]))}`,pathParams:{"impersonation-registry-id":String(c[`impersonation-registry-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),directory_id:c[`directory-id`],directory_node_id:c[`directory-node-id`],email:u(c.email,`email`,`text`),external_directory_node_id:u(c[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:c[`is-email-regex`],name:u(c.name,`name`,`text`),provenance:u(c.provenance,`provenance`,`text`)}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.impersonationRegistry.edit({...e,account_id:f,impersonation_registry_id:c[`impersonation-registry-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(c.comments,`comments`,`text`),directory_id:c[`directory-id`],directory_node_id:c[`directory-node-id`],email:u(c.email,`email`,`text`),external_directory_node_id:u(c[`external-directory-node-id`],`external-directory-node-id`,`text`),is_email_regex:c[`is-email-regex`],name:u(c.name,`name`,`text`),provenance:u(c.provenance,`provenance`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.impersonationRegistry.edit({...p,account_id:f,impersonation_registry_id:c[`impersonation-registry-id`]})),{successLabel:`Updated`})}};function ke(e){return e.positional(`impersonation-registry-id`,{type:`string`,description:`Impersonation registry entry identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`get <impersonation-registry-id>`,describe:`Retrieves details for a specific impersonation registry entry including the protected identity, email pattern, and synchronization source if directory-synced.`,builder:ke,handler:async s=>{if(s.dryRun){a({command:`cf email-security impersonation-registry get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/impersonation_registry/${s[`impersonation-registry-id`]==null?`<impersonation-registry-id>`:encodeURIComponent(String(s[`impersonation-registry-id`]))}`,pathParams:{"impersonation-registry-id":String(s[`impersonation-registry-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.impersonationRegistry.get({account_id:l,impersonation_registry_id:s[`impersonation-registry-id`]})),{successLabel:`Loaded`})}};function je(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`name`,`email`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`provenance`,{type:`string`,description:`Provenance`,choices:[`A1S_INTERNAL`,`SNOOPY-CASB_OFFICE_365`,`SNOOPY-OFFICE_365`,`SNOOPY-GOOGLE_DIRECTORY`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Me={command:`list`,describe:`Returns a paginated list of protected identities in the impersonation registry. These entries define identities and email addresses to protect from impersonation attacks. Can be manually added or automatically synced from directory integrations.`,builder:m(je),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction,provenance:s.provenance};if(s.dryRun){a({command:`cf email-security impersonation-registry list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/impersonation_registry`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.impersonationRegistry.list({account_id:u,...c})),{successLabel:`Loaded`})}},Ne={command:`impersonation-registry`,describe:`Operations for impersonation-registry`,builder:e=>e.command(we).command(Ee).command(Oe).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Pe(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Fe={command:`get <investigate-id>`,describe:`Returns the list of post-delivery actions (moves, quarantine releases, previews, etc.) that have been applied to a specific email message.`,builder:Pe,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate action-log get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${s[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(s[`investigate-id`]))}/action_log`,pathParams:{"investigate-id":String(s[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.actionLog.get({account_id:l,investigate_id:s[`investigate-id`]})),{successLabel:`Loaded`})}},Ie={command:`action-log`,describe:`Operations for investigate.action-log`,builder:e=>e.command(Fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Le(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Re={command:`create <job-id>`,describe:`Cancels the job, marking it as cancelled and stopping any pending message processing. The job record remains visible in list and detail endpoints.`,builder:Le,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate bulk cancel create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/bulk/${s[`job-id`]==null?`<job-id>`:encodeURIComponent(String(s[`job-id`]))}/cancel`,pathParams:{"job-id":String(s[`job-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.emailSecurity.investigate.bulk.cancel.create({account_id:l,job_id:s[`job-id`]})),{successLabel:`Created`})}},ze={command:`cancel`,describe:`Operations for investigate.bulk.cancel`,builder:e=>e.command(Re).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Be(e){return e.option(`action`,{type:`string`,description:`The action field`,choices:[`MOVE`,`RELEASE`]}).option(`comment`,{type:`string`,description:`The comment field`}).option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`search-params-action-log`,{type:`boolean`,description:"Deprecated, use `GET /investigate/{investigate_id}/action_log` instead. End of life: November 1, 2026.",default:!1}).option(`search-params-alert-id`,{type:`string`,description:`The search_params.alert_id field`}).option(`search-params-delivery-status`,{type:`string`,description:`Delivery status of the message.`,choices:[`delivered`,`moved`,`quarantined`,`rejected`,`deferred`,`bounced`,`queued`,`move_failed`]}).option(`search-params-detections-only`,{type:`boolean`,description:`The search_params.detections_only field`,default:!0}).option(`search-params-domain`,{type:`string`,description:`The search_params.domain field`}).option(`search-params-end`,{type:`string`,description:`End of search date range.`}).option(`search-params-exact-subject`,{type:`string`,description:`The search_params.exact_subject field`}).option(`search-params-final-disposition`,{type:`string`,description:`The search_params.final_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`search-params-message-action`,{type:`string`,description:`The search_params.message_action field`,choices:[`PREVIEW`,`QUARANTINE_RELEASED`,`MOVED`]}).option(`search-params-message-id`,{type:`string`,description:`The search_params.message_id field`}).option(`search-params-metric`,{type:`string`,description:`The search_params.metric field`}).option(`search-params-query`,{type:`string`,description:`The search_params.query field`}).option(`search-params-recipient`,{type:`string`,description:`The search_params.recipient field`}).option(`search-params-sender`,{type:`string`,description:`The search_params.sender field`}).option(`search-params-smtp-helo-ip`,{type:`string`,description:`Matches messages whose SMTP HELO server IP address equals this value.`}).option(`search-params-start`,{type:`string`,description:`Beginning of search date range.`}).option(`search-params-subject`,{type:`string`,description:`The search_params.subject field`}).option(`search-params-submissions`,{type:`boolean`,description:`The search_params.submissions field`,default:!1}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Ve={command:`create`,describe:`Creates a new bulk action job to move or release messages that match the provided search parameters.`,builder:Be,handler:async c=>{if(c.dryRun){a({command:`cf email-security investigate bulk create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/bulk`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({action:u(c.action,`action`,`text`),comment:u(c.comment,`comment`,`text`),destination:u(c.destination,`destination`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`),search_params:{action_log:c[`search-params-action-log`],alert_id:u(c[`search-params-alert-id`],`search-params-alert-id`,`text`),delivery_status:u(c[`search-params-delivery-status`],`search-params-delivery-status`,`text`),detections_only:c[`search-params-detections-only`],domain:u(c[`search-params-domain`],`search-params-domain`,`text`),end:u(c[`search-params-end`],`search-params-end`,`text`),exact_subject:u(c[`search-params-exact-subject`],`search-params-exact-subject`,`text`),final_disposition:u(c[`search-params-final-disposition`],`search-params-final-disposition`,`text`),message_action:u(c[`search-params-message-action`],`search-params-message-action`,`text`),message_id:u(c[`search-params-message-id`],`search-params-message-id`,`text`),metric:u(c[`search-params-metric`],`search-params-metric`,`text`),query:u(c[`search-params-query`],`search-params-query`,`text`),recipient:u(c[`search-params-recipient`],`search-params-recipient`,`text`),sender:u(c[`search-params-sender`],`search-params-sender`,`text`),smtp_helo_ip:u(c[`search-params-smtp-helo-ip`],`search-params-smtp-helo-ip`,`text`),start:u(c[`search-params-start`],`search-params-start`,`text`),subject:u(c[`search-params-subject`],`search-params-subject`,`text`),submissions:c[`search-params-submissions`]}}):s(c.body)});return}let d=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>d.emailSecurity.investigate.bulk.create({...e,account_id:p})),{successLabel:`Created`});return}c.action===void 0&&(c.action=await f(`action`,`The action field`,[`MOVE`,`RELEASE`]));let m=l({action:u(c.action,`action`,`text`),comment:u(c.comment,`comment`,`text`),destination:u(c.destination,`destination`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`),search_params:{action_log:c[`search-params-action-log`],alert_id:u(c[`search-params-alert-id`],`search-params-alert-id`,`text`),delivery_status:u(c[`search-params-delivery-status`],`search-params-delivery-status`,`text`),detections_only:c[`search-params-detections-only`],domain:u(c[`search-params-domain`],`search-params-domain`,`text`),end:u(c[`search-params-end`],`search-params-end`,`text`),exact_subject:u(c[`search-params-exact-subject`],`search-params-exact-subject`,`text`),final_disposition:u(c[`search-params-final-disposition`],`search-params-final-disposition`,`text`),message_action:u(c[`search-params-message-action`],`search-params-message-action`,`text`),message_id:u(c[`search-params-message-id`],`search-params-message-id`,`text`),metric:u(c[`search-params-metric`],`search-params-metric`,`text`),query:u(c[`search-params-query`],`search-params-query`,`text`),recipient:u(c[`search-params-recipient`],`search-params-recipient`,`text`),sender:u(c[`search-params-sender`],`search-params-sender`,`text`),smtp_helo_ip:u(c[`search-params-smtp-helo-ip`],`search-params-smtp-helo-ip`,`text`),start:u(c[`search-params-start`],`search-params-start`,`text`),subject:u(c[`search-params-subject`],`search-params-subject`,`text`),submissions:c[`search-params-submissions`]}});i(await o(`Creating`,async()=>d.emailSecurity.investigate.bulk.create({...m,account_id:p})),{successLabel:`Created`})}};function He(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ue={command:`delete <job-id>`,describe:"Deletes the job, removing it from all list and detail endpoints. Only jobs in a terminal state (`COMPLETED`, `CANCELLED`, `FAILED`, or `SKIPPED`) can be deleted. To stop an in-progress job without removing it, use the cancel endpoint instead.",builder:He,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate bulk delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/bulk/${s[`job-id`]==null?`<job-id>`:encodeURIComponent(String(s[`job-id`]))}`,pathParams:{"job-id":String(s[`job-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation permanently deletes the completed, cancelled, failed, or skipped bulk action job from all list and detail endpoints.`})){process.stderr.write(`Aborted.
12
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.investigate.bulk.delete({account_id:l,job_id:s[`job-id`]})),{successLabel:`Deleted`})}};function We(e){return e.positional(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ge={command:`get <job-id>`,describe:`Returns the status and details of a specific bulk action job.`,builder:We,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate bulk get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/bulk/${s[`job-id`]==null?`<job-id>`:encodeURIComponent(String(s[`job-id`]))}`,pathParams:{"job-id":String(s[`job-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.bulk.get({account_id:l,job_id:s[`job-id`]})),{successLabel:`Loaded`})}};function Ke(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`action-type`,{type:`string`,description:`Action type`,choices:[`MOVE`,`RELEASE`]}).option(`status`,{type:`string`,description:`Status`,choices:[`PENDING`,`DISCOVERING`,`PROCESSING`,`COMPLETED`,`FAILED`,`CANCELLED`,`SKIPPED`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const qe={command:`list`,describe:`Returns a paginated list of bulk action jobs for the account.`,builder:m(Ke),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],action_type:s[`action-type`],status:s.status};if(s.dryRun){a({command:`cf email-security investigate bulk list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/bulk`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.bulk.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Je(e){return e.option(`job-id`,{type:`string`,description:`Job ID`,demandOption:!0}).option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`status`,{type:`string`,description:`Status`,choices:[`PENDING`,`DISCOVERING`,`PROCESSING`,`COMPLETED`,`FAILED`,`CANCELLED`,`SKIPPED`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ye={command:`list`,describe:`Returns the individual messages associated with a bulk action job, including their processing status.`,builder:m(Je),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],status:s.status};if(s.dryRun){a({command:`cf email-security investigate bulk messages list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/bulk/${s[`job-id`]==null?`<job-id>`:encodeURIComponent(String(s[`job-id`]))}/messages`,pathParams:{"job-id":String(s[`job-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.bulk.messages.list({account_id:u,job_id:s[`job-id`],...c})),{successLabel:`Loaded`})}},Xe={command:`messages`,describe:`Operations for investigate.bulk.messages`,builder:e=>e.command(Ye).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Ze={command:`bulk`,describe:`Operations for investigate.bulk`,builder:e=>e.command(Ve).command(Ue).command(Ge).command(qe).command(ze).command(Xe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Qe(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $e={command:`get <investigate-id>`,describe:`Returns detection details such as threat categories and sender information for non-benign messages.`,builder:Qe,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate detections get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${s[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(s[`investigate-id`]))}/detections`,pathParams:{"investigate-id":String(s[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.detections.get({account_id:l,investigate_id:s[`investigate-id`]})),{successLabel:`Loaded`})}},et={command:`detections`,describe:`Operations for investigate.detections`,builder:e=>e.command($e).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function tt(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`submission`,{type:`boolean`,description:`When true, search the submissions datastore only. When false or omitted, search the
13
+ regular datastore only.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nt={command:`get <investigate-id>`,describe:`Retrieves comprehensive details for a specific email message including headers, recipients, sender information, and current quarantine status. Use the investigate_id from search results to fetch detailed information.`,builder:tt,handler:async s=>{let c={submission:s.submission};if(s.dryRun){a({command:`cf email-security investigate get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${s[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(s[`investigate-id`]))}`,pathParams:{"investigate-id":String(s[`investigate-id`]??``)},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.get({account_id:u,investigate_id:s[`investigate-id`],...c})),{successLabel:`Loaded`})}};function rt(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days`. Must not be in the future."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now`."}).option(`query`,{type:`string`,description:`Space-delimited search term. Case-insensitive.`}).option(`detections-only`,{type:`boolean`,description:`Whether to include only detections in search results.`}).option(`final-disposition`,{type:`string`,description:`Dispositions to filter by.`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`metric`,{type:`string`,description:`Metric`}).option(`message-action`,{type:`string`,description:`Message actions to filter by.`,choices:[`PREVIEW`,`QUARANTINE_RELEASED`,`MOVED`]}).option(`recipient`,{type:`string`,description:`Recipient`}).option(`sender`,{type:`string`,description:`Sender`}).option(`smtp-helo-ip`,{type:`string`,description:`Matches messages whose SMTP HELO server IP address equals this value.`}).option(`alert-id`,{type:`string`,description:`Alert ID`}).option(`domain`,{type:`string`,description:`Sender domains to filter by.`}).option(`message-id`,{type:`string`,description:`Message ID`}).option(`subject`,{type:`string`,description:`Subject`}).option(`delivery-status`,{type:`string`,description:`Delivery status to filter by.`,choices:[`delivered`,`moved`,`quarantined`,`rejected`,`deferred`,`bounced`,`queued`,`move_failed`]}).option(`cursor`,{type:`string`,description:`Cursor`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`page`,{type:`number`,description:`Deprecated: Use cursor pagination instead. End of life: November 1, 2026.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const it={command:`list`,describe:`Returns information for each email that matches the search parameter(s).`,builder:m(rt),handler:async s=>{let c={start:s.start,end:s.end,query:s.query,detections_only:s[`detections-only`],final_disposition:s[`final-disposition`],metric:s.metric,message_action:s[`message-action`],recipient:s.recipient,sender:s.sender,smtp_helo_ip:s[`smtp-helo-ip`],alert_id:s[`alert-id`],domain:s.domain,message_id:s[`message-id`],subject:s.subject,delivery_status:s[`delivery-status`],cursor:s.cursor,per_page:s[`per-page`],page:s.page};if(s.dryRun){a({command:`cf email-security investigate list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.investigate.list({account_id:u,...c})),{successLabel:`Loaded`})}};function at(e){return e.option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`ids`,{type:`string`,array:!0,description:`List of message IDs to move.`}).option(`postfix-ids`,{type:`string`,array:!0,description:"Deprecated, use `ids` instead. End of life: November 1, 2026."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ot={command:`bulk`,describe:`Moves multiple messages to a specified mailbox folder (Inbox, JunkEmail, DeletedItems, RecoverableItemsDeletions, or RecoverableItemsPurges). Requires active integration.`,builder:at,handler:async c=>{if(c.dryRun){a({command:`cf email-security investigate move bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/move`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({destination:u(c.destination,`destination`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`),ids:c.ids,postfix_ids:c[`postfix-ids`]}):s(c.body)});return}let d=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>d.emailSecurity.investigate.move.bulk({...e,account_id:p})),{successLabel:`Created`});return}c.destination===void 0&&(c.destination=await f(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let m=l({destination:u(c.destination,`destination`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`),ids:c.ids,postfix_ids:c[`postfix-ids`]});i(await o(`Creating`,async()=>d.emailSecurity.investigate.move.bulk({...m,account_id:p})),{successLabel:`Created`})}};function st(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`destination`,{type:`string`,description:`The destination field`,choices:[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`MALICIOUS`,`MALICIOUS-BEC`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`ENCRYPTED`,`EXTERNAL`,`UNKNOWN`,`NONE`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ct={command:`create <investigate-id>`,describe:`Moves a single message to a specified mailbox folder (Inbox, JunkEmail, DeletedItems, RecoverableItemsDeletions, or RecoverableItemsPurges). Requires active integration.`,builder:st,handler:async c=>{if(c.dryRun){a({command:`cf email-security investigate move create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${c[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(c[`investigate-id`]))}/move`,pathParams:{"investigate-id":String(c[`investigate-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({destination:u(c.destination,`destination`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`)}):s(c.body)});return}let d=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>d.emailSecurity.investigate.move.create({...e,account_id:p,investigate_id:c[`investigate-id`]})),{successLabel:`Created`});return}c.destination===void 0&&(c.destination=await f(`destination`,`The destination field`,[`Inbox`,`JunkEmail`,`DeletedItems`,`RecoverableItemsDeletions`,`RecoverableItemsPurges`]));let m=l({destination:u(c.destination,`destination`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.investigate.move.create({...m,account_id:p,investigate_id:c[`investigate-id`]})),{successLabel:`Created`})}},lt={command:`move`,describe:`Operations for investigate.move`,builder:e=>e.command(ot).command(ct).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ut(e){return e.option(`postfix-id`,{type:`string`,description:`The identifier of the message.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const dt={command:`create`,describe:`Generates a preview image for a message that was not flagged as a detection. Useful for investigating benign messages. Returns a base64-encoded PNG screenshot of the email body.`,builder:ut,handler:async c=>{if(c.dryRun){a({command:`cf email-security investigate preview create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/preview`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({postfix_id:u(c[`postfix-id`],`postfix-id`,`text`)}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.investigate.preview.create({...e,account_id:p})),{successLabel:`Created`});return}c[`postfix-id`]===void 0&&(c[`postfix-id`]=await d(`postfix-id`,`The identifier of the message.`));let m=l({postfix_id:u(c[`postfix-id`],`postfix-id`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.investigate.preview.create({...m,account_id:p})),{successLabel:`Created`})}};function ft(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pt={command:`get <investigate-id>`,describe:`Returns a preview of the message body as a base64 encoded PNG image for non-benign messages.`,builder:ft,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate preview get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${s[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(s[`investigate-id`]))}/preview`,pathParams:{"investigate-id":String(s[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.preview.get({account_id:l,investigate_id:s[`investigate-id`]})),{successLabel:`Loaded`})}},mt={command:`preview`,describe:`Operations for investigate.preview`,builder:e=>e.command(dt).command(pt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function ht(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gt={command:`get <investigate-id>`,describe:`Returns the raw eml of any non-benign message.`,builder:ht,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate raw get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${s[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(s[`investigate-id`]))}/raw`,pathParams:{"investigate-id":String(s[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.raw.get({account_id:l,investigate_id:s[`investigate-id`]})),{successLabel:`Loaded`})}},_t={command:`raw`,describe:`Operations for investigate.raw`,builder:e=>e.command(gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function vt(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`eml-content`,{type:`string`,description:`Base64 encoded content of the EML file.`}).option(`escalated-submission-id`,{type:`string`,description:`The escalated_submission_id field`}).option(`expected-disposition`,{type:`string`,description:`The expected_disposition field`,choices:[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const yt={command:`create <investigate-id>`,describe:`Submits a request to reclassify an email's disposition. Use for reporting false positives or false negatives. Optionally provide the raw EML content for reanalysis. The reclassification is processed asynchronously.`,builder:vt,handler:async c=>{if(c.dryRun){a({command:`cf email-security investigate reclassify create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${c[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(c[`investigate-id`]))}/reclassify`,pathParams:{"investigate-id":String(c[`investigate-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({eml_content:u(c[`eml-content`],`eml-content`,`text`),escalated_submission_id:u(c[`escalated-submission-id`],`escalated-submission-id`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`)}):s(c.body)});return}let d=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>d.emailSecurity.investigate.reclassify.create({...e,account_id:p,investigate_id:c[`investigate-id`]})),{successLabel:`Created`});return}c[`expected-disposition`]===void 0&&(c[`expected-disposition`]=await f(`expected-disposition`,`The expected_disposition field`,[`NONE`,`BULK`,`MALICIOUS`,`SPAM`,`SPOOF`,`SUSPICIOUS`]));let m=l({eml_content:u(c[`eml-content`],`eml-content`,`text`),escalated_submission_id:u(c[`escalated-submission-id`],`escalated-submission-id`,`text`),expected_disposition:u(c[`expected-disposition`],`expected-disposition`,`text`)});i(await o(`Creating`,async()=>d.emailSecurity.investigate.reclassify.create({...m,account_id:p,investigate_id:c[`investigate-id`]})),{successLabel:`Created`})}},bt={command:`reclassify`,describe:`Operations for investigate.reclassify`,builder:e=>e.command(yt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function xt(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`A list of investigate IDs identifying the messages to release.`})}const St={command:`bulk`,describe:`Delivers one or more quarantined messages to their intended recipients, for cases where a message was incorrectly quarantined. The response includes delivery status for each recipient.`,builder:xt,handler:async c=>{if(c.dryRun){a({command:`cf email-security investigate release bulk`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/release`,pathParams:{},bodyKind:`json`,body:c.body===void 0?void 0:s(c.body)});return}let l=await r(c),u=c.local?e:await t();if(c.accountId=u,c.body){let e=s(c.body);i(await o(`Creating`,async()=>l.emailSecurity.investigate.release.bulk({body:e,account_id:u})),{successLabel:`Created`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},Ct={command:`release`,describe:`Operations for investigate.release`,builder:e=>e.command(St).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function wt(e){return e.positional(`investigate-id`,{type:`string`,description:`Unique identifier for a message retrieved from investigation.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Tt={command:`get <investigate-id>`,describe:`Retrieves delivery and processing trace information for an email message. Shows the delivery path, retraction history, and move operations performed on the message. Useful for debugging delivery issues.`,builder:wt,handler:async s=>{if(s.dryRun){a({command:`cf email-security investigate trace get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/investigate/${s[`investigate-id`]==null?`<investigate-id>`:encodeURIComponent(String(s[`investigate-id`]))}/trace`,pathParams:{"investigate-id":String(s[`investigate-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.investigate.trace.get({account_id:l,investigate_id:s[`investigate-id`]})),{successLabel:`Loaded`})}},Et={command:`trace`,describe:`Operations for investigate.trace`,builder:e=>e.command(Tt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Dt={command:`investigate`,describe:`Search and investigate email messages — view detections, traces, raw content, and take remediation actions`,builder:e=>e.command(nt).command(it).command(Ie).command(Ze).command(et).command(lt).command(mt).command(_t).command(bt).command(Ct).command(Et).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ot(e){return e.option(`start`,{type:`string`,description:`Start of the time range (RFC3339). Takes precedence over from_date.`}).option(`end`,{type:`string`,description:`End of the time range (RFC3339). Takes precedence over to_date.`}).option(`from-date`,{type:`string`,description:"Deprecated, use `start` instead. Start date in YYYY-MM-DD format."}).option(`to-date`,{type:`string`,description:"Deprecated, use `end` instead. End date in YYYY-MM-DD format."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const kt={command:`list`,describe:`Retrieves PhishGuard security alert reports for a specified date range. Reports include detected threats, dispositions, and contextual information. Use for security monitoring and threat analysis.`,builder:Ot,handler:async s=>{let c={start:s.start,end:s.end,from_date:s[`from-date`],to_date:s[`to-date`]};if(s.dryRun){a({command:`cf email-security phishguard reports list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/phishguard/reports`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.phishguard.reports.list({account_id:u,...c})),{successLabel:`Loaded`})}},At={command:`reports`,describe:`Operations for phishguard.reports`,builder:e=>e.command(kt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},jt={command:`phishguard`,describe:`PhishGuard user-reported phishing submissions and analysis reports`,builder:e=>e.command(At).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Mt(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`domain`,{type:`string`,description:`Domain that requires TLS enforcement.`}).option(`exclude`,{type:`string`,array:!0,description:`Subdomains to exempt from TLS requirements.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a sending domain restriction.`})}const Nt={command:`create`,describe:`Creates a new sending domain restriction to enforce TLS requirements for a domain. Emails without TLS from this domain will be dropped unless the subdomain is in the exclude list.`,builder:Mt,handler:async c=>{if(c.dryRun){a({command:`cf email-security sending-domain-restrictions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/sending_domain_restrictions`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),domain:u(c.domain,`domain`,`text`),exclude:c.exclude}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.sendingDomainRestrictions.create({...e,account_id:p})),{successLabel:`Created`});return}if(c.domain===void 0&&(c.domain=await d(`domain`,`Domain that requires TLS enforcement.`)),c.exclude===void 0)throw Error(`--exclude is required (or pass --body with this field set).`);let m=l({comments:u(c.comments,`comments`,`text`),domain:u(c.domain,`domain`,`text`),exclude:c.exclude});i(await o(`Creating`,async()=>f.emailSecurity.sendingDomainRestrictions.create({...m,account_id:p})),{successLabel:`Created`})}};function Pt(e){return e.positional(`sending-domain-restriction-id`,{type:`string`,description:`Sending domain restriction identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Ft={command:`delete <sending-domain-restriction-id>`,describe:`Removes a sending domain restriction. After deletion, TLS will no longer be enforced for emails from this domain.`,builder:Pt,handler:async s=>{if(s.dryRun){a({command:`cf email-security sending-domain-restrictions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/sending_domain_restrictions/${s[`sending-domain-restriction-id`]==null?`<sending-domain-restriction-id>`:encodeURIComponent(String(s[`sending-domain-restriction-id`]))}`,pathParams:{"sending-domain-restriction-id":String(s[`sending-domain-restriction-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the sending domain restriction and removes TLS enforcement for emails from this domain.`})){process.stderr.write(`Aborted.
14
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.sendingDomainRestrictions.delete({account_id:l,sending_domain_restriction_id:s[`sending-domain-restriction-id`]})),{successLabel:`Deleted`})}};function It(e){return e.positional(`sending-domain-restriction-id`,{type:`string`,description:`Sending domain restriction identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`domain`,{type:`string`,description:`Domain that requires TLS enforcement.`}).option(`exclude`,{type:`string`,array:!0,description:`Subdomains to exempt from TLS requirements.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a sending domain restriction.`})}const Lt={command:`edit <sending-domain-restriction-id>`,describe:`Updates an existing sending domain restriction. Only provided fields will be modified. Changes affect which domains require TLS and which subdomains are excluded.`,builder:It,handler:async c=>{if(c.dryRun){a({command:`cf email-security sending-domain-restrictions edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/sending_domain_restrictions/${c[`sending-domain-restriction-id`]==null?`<sending-domain-restriction-id>`:encodeURIComponent(String(c[`sending-domain-restriction-id`]))}`,pathParams:{"sending-domain-restriction-id":String(c[`sending-domain-restriction-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),domain:u(c.domain,`domain`,`text`),exclude:c.exclude}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.sendingDomainRestrictions.edit({...e,account_id:f,sending_domain_restriction_id:c[`sending-domain-restriction-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(c.comments,`comments`,`text`),domain:u(c.domain,`domain`,`text`),exclude:c.exclude});i(await o(`Updating`,async()=>d.emailSecurity.sendingDomainRestrictions.edit({...p,account_id:f,sending_domain_restriction_id:c[`sending-domain-restriction-id`]})),{successLabel:`Updated`})}};function Rt(e){return e.positional(`sending-domain-restriction-id`,{type:`string`,description:`Sending domain restriction identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const zt={command:`get <sending-domain-restriction-id>`,describe:`Retrieves details for a specific sending domain restriction including the domain requiring TLS and any excluded subdomains exempt from the TLS requirement.`,builder:Rt,handler:async s=>{if(s.dryRun){a({command:`cf email-security sending-domain-restrictions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/sending_domain_restrictions/${s[`sending-domain-restriction-id`]==null?`<sending-domain-restriction-id>`:encodeURIComponent(String(s[`sending-domain-restriction-id`]))}`,pathParams:{"sending-domain-restriction-id":String(s[`sending-domain-restriction-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.sendingDomainRestrictions.get({account_id:l,sending_domain_restriction_id:s[`sending-domain-restriction-id`]})),{successLabel:`Loaded`})}};function Bt(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`domain`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Vt={command:`list`,describe:`Returns a paginated list of sending domain restrictions. These restrictions enforce TLS requirements for emails from specific domains. Mail without TLS from restricted domains will be dropped unless the subdomain is in the exclude list. Supports sorting and searching.`,builder:m(Bt),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction};if(s.dryRun){a({command:`cf email-security sending-domain-restrictions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/sending_domain_restrictions`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.sendingDomainRestrictions.list({account_id:u,...c})),{successLabel:`Loaded`})}},Ht={command:`sending-domain-restrictions`,describe:`Operations for sending-domain-restrictions`,builder:e=>e.command(Nt).command(Ft).command(Lt).command(zt).command(Vt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ut(e){return e.option(`start`,{type:`string`,description:"The beginning of the search date range. Defaults to `now - 30 days`."}).option(`end`,{type:`string`,description:"The end of the search date range. Defaults to `now`."}).option(`type`,{type:`string`,description:`Type`,choices:[`TEAM`,`USER`]}).option(`submission-id`,{type:`string`,description:`Submission ID`}).option(`original-disposition`,{type:`string`,description:`Original disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`requested-disposition`,{type:`string`,description:`Requested disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`outcome-disposition`,{type:`string`,description:`Outcome disposition`,choices:[`MALICIOUS`,`SUSPICIOUS`,`SPOOF`,`SPAM`,`BULK`,`NONE`]}).option(`status`,{type:`string`,description:`Status`}).option(`query`,{type:`string`,description:`Query`}).option(`escalated-from-user`,{type:`boolean`,description:`When true, return only submissions that were escalated by an end user (vs. by the security team). When false, return only submissions that were not escalated by an end user. When omitted, no filter is applied.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`submission_id`,`subject`,`original_disposition`,`requested_disposition`,`outcome_disposition`,`requested_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wt={command:`list`,describe:`Returns information for submissions made to reclassify emails. Shows the status, outcome, and disposition changes for reclassification requests made by users or the security team. Useful for tracking false positive/negative reports.`,builder:m(Ut),handler:async s=>{let c={start:s.start,end:s.end,type:s.type,submission_id:s[`submission-id`],original_disposition:s[`original-disposition`],requested_disposition:s[`requested-disposition`],outcome_disposition:s[`outcome-disposition`],status:s.status,query:s.query,escalated_from_user:s[`escalated-from-user`],order:s.order,direction:s.direction,page:s.page,per_page:s[`per-page`]};if(s.dryRun){a({command:`cf email-security submissions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/submissions`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.submissions.list({account_id:u,...c})),{successLabel:`Loaded`})}},Gt={command:`submissions`,describe:`User and admin email submissions for classification review`,builder:e=>e.command(Wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Kt(e){return e.option(`deletes`,{type:`string`,description:`The deletes field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`patches`,{type:`string`,description:`The patches field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`posts`,{type:`string`,description:`The posts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`puts`,{type:`string`,description:`The puts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qt={command:`batch`,describe:`Executes multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.`,builder:Kt,handler:async u=>{if(u.dryRun){a({command:`cf email-security trusted-domains batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains/batch`,pathParams:{},bodyKind:`json`,body:u.body===void 0?l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,!await p({force:!!u.force,message:`This operation may delete the selected trusted domain patterns and restore normal recent domain and similarity checks for matching emails.`})){process.stderr.write(`Aborted.
15
+ `);return}if(u.body){let e=s(u.body);i(await o(`Deleting`,async()=>d.emailSecurity.trustedDomains.batch({...e,account_id:f})),{successLabel:`Deleted`});return}if(u.deletes===void 0)throw Error(`--deletes is required (or pass --body with this field set).`);if(u.patches===void 0)throw Error(`--patches is required (or pass --body with this field set).`);if(u.posts===void 0)throw Error(`--posts is required (or pass --body with this field set).`);if(u.puts===void 0)throw Error(`--puts is required (or pass --body with this field set).`);let m=l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)});i(await o(`Deleting`,async()=>d.emailSecurity.trustedDomains.batch({...m,account_id:f})),{successLabel:`Deleted`})}};function Jt(e){return e.option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a trusted domain.`})}const Yt={command:`create`,describe:`Creates a new trusted domain pattern. Use for partner domains or approved senders that should bypass recent domain registration and similarity checks. Configure whether it prevents recent domain or spoof dispositions.`,builder:Jt,handler:async c=>{if(c.dryRun){a({command:`cf email-security trusted-domains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_recent:c[`is-recent`],is_regex:c[`is-regex`],is_similarity:c[`is-similarity`],pattern:u(c.pattern,`pattern`,`text`)}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.trustedDomains.create({body:e,account_id:p})),{successLabel:`Created`});return}if(c[`is-recent`]===void 0)throw Error(`--is-recent is required (or pass --body with this field set).`);if(c[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);if(c[`is-similarity`]===void 0)throw Error(`--is-similarity is required (or pass --body with this field set).`);c.pattern===void 0&&(c.pattern=await d(`pattern`,`The pattern field`));let m=l({comments:u(c.comments,`comments`,`text`),is_recent:c[`is-recent`],is_regex:c[`is-regex`],is_similarity:c[`is-similarity`],pattern:u(c.pattern,`pattern`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.trustedDomains.create({body:m,account_id:p})),{successLabel:`Created`})}};function Xt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Zt={command:`delete <trusted-domain-id>`,describe:`Removes a trusted domain pattern. After deletion, emails from this domain will be subject to normal recent domain and similarity checks.`,builder:Xt,handler:async s=>{if(s.dryRun){a({command:`cf email-security trusted-domains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains/${s[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(s[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(s[`trusted-domain-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the trusted domain pattern and restores normal recent domain and similarity checks for matching emails.`})){process.stderr.write(`Aborted.
16
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.trustedDomains.delete({account_id:l,trusted_domain_id:s[`trusted-domain-id`]})),{successLabel:`Deleted`})}};function Qt(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Update a trusted domain.`})}const $t={command:`edit <trusted-domain-id>`,describe:`Updates an existing trusted domain pattern. Only provided fields will be modified. Changes take effect for new emails matching the pattern.`,builder:Qt,handler:async c=>{if(c.dryRun){a({command:`cf email-security trusted-domains edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains/${c[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(c[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(c[`trusted-domain-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_recent:c[`is-recent`],is_regex:c[`is-regex`],is_similarity:c[`is-similarity`],pattern:u(c.pattern,`pattern`,`text`)}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.trustedDomains.edit({body:e,account_id:f,trusted_domain_id:c[`trusted-domain-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(c.comments,`comments`,`text`),is_recent:c[`is-recent`],is_regex:c[`is-regex`],is_similarity:c[`is-similarity`],pattern:u(c.pattern,`pattern`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.trustedDomains.edit({body:p,account_id:f,trusted_domain_id:c[`trusted-domain-id`]})),{successLabel:`Updated`})}};function en(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const $={command:`get <trusted-domain-id>`,describe:`Retrieves details for a specific trusted domain pattern including its pattern value, whether it uses regex matching, and which detection types it affects.`,builder:en,handler:async s=>{if(s.dryRun){a({command:`cf email-security trusted-domains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains/${s[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(s[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(s[`trusted-domain-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.trustedDomains.get({account_id:l,trusted_domain_id:s[`trusted-domain-id`]})),{successLabel:`Loaded`})}};function tn(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`search`,{type:`string`,description:`Search term for filtering records. Behavior may change.`}).option(`order`,{type:`string`,description:`Field to sort by.`,choices:[`pattern`,`created_at`]}).option(`direction`,{type:`string`,description:`The sorting direction.`,choices:[`asc`,`desc`]}).option(`is-recent`,{type:`boolean`,description:`Filter to show only recently registered domains that are trusted to prevent triggering Suspicious or Malicious dispositions.`}).option(`is-similarity`,{type:`boolean`,description:`Filter to show only proximity domains (partner or approved domains with similar spelling to connected domains) that prevent Spoof dispositions.`}).option(`pattern`,{type:`string`,description:`Pattern`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const nn={command:`list`,describe:`Returns a paginated list of trusted domain patterns. Trusted domains prevent false positives for recently registered domains and lookalike domain detections. Patterns can use regular expressions for flexible matching.`,builder:m(tn),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],search:s.search,order:s.order,direction:s.direction,is_recent:s[`is-recent`],is_similarity:s[`is-similarity`],pattern:s.pattern};if(s.dryRun){a({command:`cf email-security trusted-domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.trustedDomains.list({account_id:u,...c})),{successLabel:`Loaded`})}};function rn(e){return e.positional(`trusted-domain-id`,{type:`string`,description:`Trusted domain identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`The comments field`}).option(`is-recent`,{type:`boolean`,description:`Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.`}).option(`is-regex`,{type:`boolean`,description:`The is_regex field`}).option(`is-similarity`,{type:`boolean`,description:`Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.`}).option(`pattern`,{type:`string`,description:`The pattern field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Create a trusted domain.`})}const an={command:`update <trusted-domain-id>`,describe:`Replaces an existing trusted domain in full. Unlike PATCH, every field is taken from the request body, so optional fields that are omitted are reset rather than left untouched. Use this when managing trusted domains declaratively.`,builder:rn,handler:async c=>{if(c.dryRun){a({command:`cf email-security trusted-domains update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/trusted_domains/${c[`trusted-domain-id`]==null?`<trusted-domain-id>`:encodeURIComponent(String(c[`trusted-domain-id`]))}`,pathParams:{"trusted-domain-id":String(c[`trusted-domain-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),is_recent:c[`is-recent`],is_regex:c[`is-regex`],is_similarity:c[`is-similarity`],pattern:u(c.pattern,`pattern`,`text`)}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Updating`,async()=>f.emailSecurity.trustedDomains.update({body:e,account_id:p,trusted_domain_id:c[`trusted-domain-id`]})),{successLabel:`Updated`});return}if(c[`is-recent`]===void 0)throw Error(`--is-recent is required (or pass --body with this field set).`);if(c[`is-regex`]===void 0)throw Error(`--is-regex is required (or pass --body with this field set).`);if(c[`is-similarity`]===void 0)throw Error(`--is-similarity is required (or pass --body with this field set).`);c.pattern===void 0&&(c.pattern=await d(`pattern`,`The pattern field`));let m=l({comments:u(c.comments,`comments`,`text`),is_recent:c[`is-recent`],is_regex:c[`is-regex`],is_similarity:c[`is-similarity`],pattern:u(c.pattern,`pattern`,`text`)});i(await o(`Updating`,async()=>f.emailSecurity.trustedDomains.update({body:m,account_id:p,trusted_domain_id:c[`trusted-domain-id`]})),{successLabel:`Updated`})}},on={command:`trusted-domains`,describe:`Operations for trusted-domains`,builder:e=>e.command(qt).command(Yt).command(Zt).command($t).command($).command(nn).command(an).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function sn(e){return e.option(`deletes`,{type:`string`,description:`The deletes field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`patches`,{type:`string`,description:`The patches field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`posts`,{type:`string`,description:`The posts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`puts`,{type:`string`,description:`The puts field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const cn={command:`batch`,describe:`Sends a batch of URL ignore patterns API calls to execute together.`,builder:sn,handler:async u=>{if(u.dryRun){a({command:`cf email-security url-ignore-patterns batch`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/url_ignore_patterns/batch`,pathParams:{},bodyKind:`json`,body:u.body===void 0?l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,!await p({force:!!u.force,message:`This operation may delete the selected URL rewrite ignore patterns and cause matching URLs to be rewritten again.`})){process.stderr.write(`Aborted.
17
+ `);return}if(u.body){let e=s(u.body);i(await o(`Deleting`,async()=>d.emailSecurity.urlIgnorePatterns.batch({...e,account_id:f})),{successLabel:`Deleted`});return}if(u.deletes===void 0)throw Error(`--deletes is required (or pass --body with this field set).`);if(u.patches===void 0)throw Error(`--patches is required (or pass --body with this field set).`);if(u.posts===void 0)throw Error(`--posts is required (or pass --body with this field set).`);if(u.puts===void 0)throw Error(`--puts is required (or pass --body with this field set).`);let m=l({deletes:c(u.deletes,`deletes`),patches:c(u.patches,`patches`),posts:c(u.posts,`posts`),puts:c(u.puts,`puts`)});i(await o(`Deleting`,async()=>d.emailSecurity.urlIgnorePatterns.batch({...m,account_id:f})),{successLabel:`Deleted`})}};function ln(e){return e.option(`comments`,{type:`string`,description:`Optional note describing the reason for the ignore pattern.`}).option(`pattern`,{type:`string`,description:`Regular expression identifying URLs to exempt from rewriting.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Creates a URL ignore pattern that exempts matching URLs from rewriting.`})}const un={command:`create`,describe:`Creates a new URL rewrite ignore pattern. URLs matching this pattern will not be rewritten.`,builder:ln,handler:async c=>{if(c.dryRun){a({command:`cf email-security url-ignore-patterns create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/url_ignore_patterns`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),pattern:u(c.pattern,`pattern`,`text`)}):s(c.body)});return}let f=await r(c),p=c.local?e:await t();if(c.accountId=p,c.body){let e=s(c.body);i(await o(`Creating`,async()=>f.emailSecurity.urlIgnorePatterns.create({body:e,account_id:p})),{successLabel:`Created`});return}c.pattern===void 0&&(c.pattern=await d(`pattern`,`Regular expression identifying URLs to exempt from rewriting.`));let m=l({comments:u(c.comments,`comments`,`text`),pattern:u(c.pattern,`pattern`,`text`)});i(await o(`Creating`,async()=>f.emailSecurity.urlIgnorePatterns.create({body:m,account_id:p})),{successLabel:`Created`})}};function dn(e){return e.positional(`pattern-id`,{type:`string`,description:`URL ignore pattern identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const fn={command:`delete <pattern-id>`,describe:`Removes a URL rewrite ignore pattern. After deletion, URLs matching this pattern will be rewritten again.`,builder:dn,handler:async s=>{if(s.dryRun){a({command:`cf email-security url-ignore-patterns delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/url_ignore_patterns/${s[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(s[`pattern-id`]))}`,pathParams:{"pattern-id":String(s[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force,message:`This operation deletes the URL rewrite ignore pattern and causes matching URLs to be rewritten again.`})){process.stderr.write(`Aborted.
18
+ `);return}i(await o(`Deleting`,async()=>c.emailSecurity.urlIgnorePatterns.delete({account_id:l,pattern_id:s[`pattern-id`]})),{successLabel:`Deleted`})}};function pn(e){return e.positional(`pattern-id`,{type:`string`,description:`URL ignore pattern identifier.`,demandOption:!0}).option(`comments`,{type:`string`,description:`Optional note describing the reason for the ignore pattern.`}).option(`pattern`,{type:`string`,description:`Regular expression identifying URLs to exempt from rewriting.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Updates a URL rewrite ignore pattern; modifies only the provided fields.`})}const mn={command:`edit <pattern-id>`,describe:`Updates an existing URL rewrite ignore pattern. Only provided fields will be modified.`,builder:pn,handler:async c=>{if(c.dryRun){a({command:`cf email-security url-ignore-patterns edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/url_ignore_patterns/${c[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(c[`pattern-id`]))}`,pathParams:{"pattern-id":String(c[`pattern-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({comments:u(c.comments,`comments`,`text`),pattern:u(c.pattern,`pattern`,`text`)}):s(c.body)});return}let d=await r(c),f=c.local?e:await t();if(c.accountId=f,c.body){let e=s(c.body);i(await o(`Updating`,async()=>d.emailSecurity.urlIgnorePatterns.edit({body:e,account_id:f,pattern_id:c[`pattern-id`]})),{successLabel:`Updated`});return}let p=l({comments:u(c.comments,`comments`,`text`),pattern:u(c.pattern,`pattern`,`text`)});i(await o(`Updating`,async()=>d.emailSecurity.urlIgnorePatterns.edit({body:p,account_id:f,pattern_id:c[`pattern-id`]})),{successLabel:`Updated`})}};function hn(e){return e.positional(`pattern-id`,{type:`string`,description:`URL ignore pattern identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const gn={command:`get <pattern-id>`,describe:`Returns a single URL rewrite ignore pattern by its identifier.`,builder:hn,handler:async s=>{if(s.dryRun){a({command:`cf email-security url-ignore-patterns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/url_ignore_patterns/${s[`pattern-id`]==null?`<pattern-id>`:encodeURIComponent(String(s[`pattern-id`]))}`,pathParams:{"pattern-id":String(s[`pattern-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.emailSecurity.urlIgnorePatterns.get({account_id:l,pattern_id:s[`pattern-id`]})),{successLabel:`Loaded`})}};function _n(e){return e.option(`page`,{type:`number`,description:`Current page within paginated list of results.`}).option(`per-page`,{type:`number`,description:`The number of results per page. Maximum value is 1000.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const vn={command:`list`,describe:`Returns a paginated list of URL rewrite ignore patterns for the account. URLs matching these patterns will not be rewritten.`,builder:_n,handler:async s=>{let c={page:s.page,per_page:s[`per-page`]};if(s.dryRun){a({command:`cf email-security url-ignore-patterns list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email-security/settings/url_ignore_patterns`,pathParams:{},query:c,bodyKind:`none`});return}let l=await r(s),u=s.local?e:await t();s.accountId=u,i(await o(`Loading`,async()=>l.emailSecurity.urlIgnorePatterns.list({account_id:u,...c})),{successLabel:`Loaded`})}},yn={command:`url-ignore-patterns`,describe:`Operations for url-ignore-patterns`,builder:e=>e.command(cn).command(un).command(fn).command(mn).command(gn).command(vn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},bn={command:`email-security`,describe:`Cloud email security — investigate threats, manage allow/block policies, and detect phishing`,builder:e=>e.command(D).command(H).command(ie).command(Se).command(Ne).command(Dt).command(jt).command(Ht).command(Gt).command(on).command(yn).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{bn as default};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n,h as r}from"./oauth-DuEONNgC.mjs";import{r as i}from"./auth-D3X9HYhD.mjs";import{t as a}from"./output-Ccqw2WOb.mjs";import{t as o}from"./dry-run-DL2V6yFm.mjs";import{t as s}from"./progress-BqQcF5QH.mjs";import{n as c,r as l,t as u}from"./body-parser-BshbixEq.mjs";import{n as d}from"./input-validation-QDIYu7Vb.mjs";import{a as f,n as p}from"./prompt-B0sWIs9c.mjs";import{t as m}from"./cli-types-DAYeL_Mj.mjs";function h(e){return e.positional(`message-id`,{type:`string`,description:`Message ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ee={command:`get <message-id>`,describe:`Returns the raw RFC 5322 MIME message for the given account and message id.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf email-sending get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/messages/${r[`message-id`]==null?`<message-id>`:encodeURIComponent(String(r[`message-id`]))}`,pathParams:{"message-id":String(r[`message-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.emailSending.get({account_id:l,message_id:r[`message-id`]})),{successLabel:`Loaded`})}};function g(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _={command:`get`,describe:`Returns the current daily sending quota for the account and, when a quota is resolved, the account's current usage against it. Quota is null when not yet available; usage is null when there is no resolved quota or usage is temporarily unavailable.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf email-sending limits get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/limits`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.emailSending.limits.get({account_id:l})),{successLabel:`Loaded`})}},v={command:`limits`,describe:`Operations for limits`,builder:e=>e.command(_).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`get`,describe:`Returns the authoritative Email Sending reputation state and active evaluation policy. Accounts without an evaluation are Healthy with null evaluation timestamps.`,builder:y,handler:async r=>{if(r.dryRun){o({command:`cf email-sending reputation get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/reputation`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.emailSending.reputation.get({account_id:l})),{successLabel:`Loaded`})}},x={command:`reputation`,describe:`Operations for reputation`,builder:e=>e.command(b).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function S(e){return e.option(`from`,{type:`string`,description:`Sender email address.`}).option(`mime-message`,{type:`string`,description:`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`}).option(`recipients`,{type:`string`,array:!0,description:`List of recipient email addresses.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const C={command:`send-raw`,describe:`Send a raw RFC 5322 (MIME) email for the specified account. Provide the full MIME message plus the SMTP envelope (from and recipients).`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf email-sending send-raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/send_raw`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({from:d(r.from,`from`,`text`),mime_message:d(r[`mime-message`],`mime-message`,`text`),recipients:r.recipients}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.emailSending.sendRaw({...e,account_id:p})),{successLabel:`Created`});return}if(r.from===void 0&&(r.from=await f(`from`,`Sender email address.`)),r[`mime-message`]===void 0&&(r[`mime-message`]=await f(`mime-message`,`The full MIME-encoded email message. Should include standard RFC 5322 headers such as From, To, Subject, and Content-Type. The from and recipients fields in the request body control SMTP envelope routing; the From and To headers in the MIME message control what the recipient's email client displays.`)),r.recipients===void 0)throw Error(`--recipients is required (or pass --body with this field set).`);let m=u({from:d(r.from,`from`,`text`),mime_message:d(r[`mime-message`],`mime-message`,`text`),recipients:r.recipients});a(await s(`Creating`,async()=>l.emailSending.sendRaw({...m,account_id:p})),{successLabel:`Created`})}};function w(e){return e.option(`attachments`,{type:`string`,description:`File attachments and inline images. Provide as a JSON array of objects or @path/to/file.json.`}).option(`bcc-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`bcc-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`cc-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`cc-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`from-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`from-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`html`,{type:`string`,description:`HTML body of the email. Provide at least one of text or html (non-empty).`}).option(`reply-to-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`reply-to-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`subject`,{type:`string`,description:`Email subject line.`}).option(`text`,{type:`string`,description:`Plain text body of the email. Provide at least one of text or html (non-empty).`}).option(`to-address`,{type:`string`,description:`Email address (e.g., 'user@example.com').`}).option(`to-name`,{type:`string`,description:`Display name for the email address (e.g., 'John Doe'). Optional; set to null or leave it unset to send the address on its own.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`send`,describe:`Send an email for the specified account using the structured builder. Provide the sender, recipients, subject, and at least one of text or html; attachments are optional.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf email-sending send`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/send`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({attachments:l(r.attachments,`attachments`),bcc:{address:d(r[`bcc-address`],`bcc-address`,`text`),name:d(r[`bcc-name`],`bcc-name`,`text`)},cc:{address:d(r[`cc-address`],`cc-address`,`text`),name:d(r[`cc-name`],`cc-name`,`text`)},from:{address:d(r[`from-address`],`from-address`,`text`),name:d(r[`from-name`],`from-name`,`text`)},html:d(r.html,`html`,`text`),reply_to:{address:d(r[`reply-to-address`],`reply-to-address`,`text`),name:d(r[`reply-to-name`],`reply-to-name`,`text`)},subject:d(r.subject,`subject`,`text`),text:d(r.text,`text`,`text`),to:{address:d(r[`to-address`],`to-address`,`text`),name:d(r[`to-name`],`to-name`,`text`)}}):c(r.body)});return}let p=await i(r),m=r.local?e:await t();if(r.accountId=m,r.body){let e=c(r.body);a(await s(`Creating`,async()=>p.emailSending.send({...e,account_id:m})),{successLabel:`Created`});return}r.subject===void 0&&(r.subject=await f(`subject`,`Email subject line.`));let h=u({attachments:l(r.attachments,`attachments`),bcc:{address:d(r[`bcc-address`],`bcc-address`,`text`),name:d(r[`bcc-name`],`bcc-name`,`text`)},cc:{address:d(r[`cc-address`],`cc-address`,`text`),name:d(r[`cc-name`],`cc-name`,`text`)},from:{address:d(r[`from-address`],`from-address`,`text`),name:d(r[`from-name`],`from-name`,`text`)},html:d(r.html,`html`,`text`),reply_to:{address:d(r[`reply-to-address`],`reply-to-address`,`text`),name:d(r[`reply-to-name`],`reply-to-name`,`text`)},subject:d(r.subject,`subject`,`text`),text:d(r.text,`text`,`text`),to:{address:d(r[`to-address`],`to-address`,`text`),name:d(r[`to-name`],`to-name`,`text`)}});a(await s(`Creating`,async()=>p.emailSending.send({...h,account_id:m})),{successLabel:`Created`})}};function E(e){return e.option(`name`,{type:`string`,description:"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const D={command:`create`,describe:"Creates a new sending subdomain or re-enables sending on an existing subdomain that had it disabled. If zone-level Email Sending has not been enabled yet, the zone flag is automatically set when the entitlement is present. A leftmost wildcard such as `*.example.com` is accepted only for accounts with wildcard Email Sending enabled. Wildcard senders share the base domain's DKIM signing identity and `cf-bounce.<base>` return path.",builder:E,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({name:d(e.name,`name`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Creating`,async()=>t.emailSending.subdomains.create({...r,zone_id:n})),{successLabel:`Created`});return}e.name===void 0&&(e.name=await f(`name`,"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."));let l=u({name:d(e.name,`name`,`text`)});a(await s(`Creating`,async()=>t.emailSending.subdomains.create({...l,zone_id:n})),{successLabel:`Created`})}};function O(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const k={command:`delete <subdomain-id>`,describe:`Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.`,builder:O,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,!await p({force:!!e.force})){process.stderr.write(`Aborted.
3
+ `);return}a(await s(`Deleting`,async()=>t.emailSending.subdomains.delete({zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Deleted`})}};function A(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const j={command:`fix <subdomain-id>`,describe:`Idempotently re-applies the sending DNS records (creates missing records, re-applies the email_routing lock on records whose lock has been cleared). Refuses with a 409 if foreign MX, multiple SPF, multiple DMARC, or multiple DKIM records exist at the relevant DNS names — those require manual cleanup.`,builder:A,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains dns fix`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Creating`,async()=>t.emailSending.subdomains.dns.fix({zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Created`})}};function M(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get-status <subdomain-id>`,describe:`Returns the desired DNS records for a sending subdomain along with a live diff against actual DNS state. Use this to detect missing, unlocked, foreign, or multi-record conflicts before deciding whether to call the fix endpoint. For wildcard sending rows, each call also rechecks the governing organizational-domain DMARC policy and reports policy drift that DNS Fix cannot repair.`,builder:M,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains dns get-status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns/status`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailSending.subdomains.dns.getStatus({zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Loaded`})}};function P(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const F={command:`get <subdomain-id>`,describe:`Returns the expected DNS records for a sending subdomain.`,builder:P,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains dns get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/dns`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailSending.subdomains.dns.get({zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Loaded`})}},te={command:`dns`,describe:`Operations for subdomains.dns`,builder:e=>e.command(j).command(F).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function I(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <subdomain-id>`,describe:`Gets information for a specific sending subdomain.`,builder:I,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailSending.subdomains.get({zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Loaded`})}};function R(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`list`,describe:`Lists all sending-enabled subdomains for the zone.`,builder:R,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});e.zoneId=n,a(await s(`Loading`,async()=>t.emailSending.subdomains.list({zone_id:n})),{successLabel:`Loaded`})}};function B(e){return e.option(`name`,{type:`string`,description:"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const V={command:`preview`,describe:`Returns the DNS records that would be created for a sending subdomain, flags which records are missing, and reports any conflicts with existing DNS records. This is a read-only dry-run — no records are created or modified. Use before or after creating a subdomain to check DNS status. A leftmost wildcard requires wildcard Email Sending to be enabled for the account and previews base-scoped DKIM and return-path records.`,builder:B,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains preview`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/preview`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({name:d(e.name,`name`,`text`)}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Loading`,async()=>t.emailSending.subdomains.preview({...r,zone_id:n})),{successLabel:`Loaded`});return}e.name===void 0&&(e.name=await f(`name`,"The domain name within the zone. A wildcard is allowed only as the complete leftmost label (`*.example.com`) and requires the account wildcard Email Sending entitlement."));let l=u({name:d(e.name,`name`,`text`)});a(await s(`Loading`,async()=>t.emailSending.subdomains.preview({...l,zone_id:n})),{successLabel:`Loaded`})}};function H(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`start-at`,{type:`string`,description:`Start at`,demandOption:!0}).option(`end-at`,{type:`string`,description:`End at`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`get-complaints <subdomain-id>`,describe:`Returns the matched complaint count for a sending subdomain in a half-open time window of up to seven days.`,builder:H,handler:async e=>{let t={start_at:e[`start-at`],end_at:e[`end-at`]};if(e.dryRun){o({command:`cf email-sending subdomains reputation get-complaints`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}/reputation/complaints`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let n=await i(e),c=await r({zone:e.zone},n,{quiet:e.quiet});e.zoneId=c,a(await s(`Loading`,async()=>n.emailSending.subdomains.reputation.getComplaints({zone_id:c,subdomain_id:e[`subdomain-id`],...t})),{successLabel:`Loaded`})}},W={command:`reputation`,describe:`Operations for subdomains.reputation`,builder:e=>e.command(U).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function G(e){return e.positional(`subdomain-id`,{type:`string`,description:`Sending subdomain identifier.`,demandOption:!0}).option(`drop-suppressed-recipients`,{type:`boolean`,description:`Whether a send request that includes a recipient suppressed on
4
+ this subdomain drops that recipient and still delivers to the
5
+ rest, instead of failing the entire request.
6
+ `}).option(`preview-enabled`,{type:`boolean`,description:`Whether sent messages from this subdomain can be previewed in the activity log.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"At least one of `preview_enabled` or `drop_suppressed_recipients` must be provided. A field omitted from the request body is left unchanged. "})}const K={command:`update <subdomain-id>`,describe:`Updates the activity-log preview preference for a sending subdomain.`,builder:G,handler:async e=>{if(e.dryRun){o({command:`cf email-sending subdomains update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/email/sending/subdomains/${e[`subdomain-id`]==null?`<subdomain-id>`:encodeURIComponent(String(e[`subdomain-id`]))}`,pathParams:{"subdomain-id":String(e[`subdomain-id`]??``),"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?u({drop_suppressed_recipients:e[`drop-suppressed-recipients`],preview_enabled:e[`preview-enabled`]}):c(e.body)});return}let t=await i(e),n=await r({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=n,e.body){let r=c(e.body);a(await s(`Updating`,async()=>t.emailSending.subdomains.update({...r,zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Updated`});return}let l=u({drop_suppressed_recipients:e[`drop-suppressed-recipients`],preview_enabled:e[`preview-enabled`]});a(await s(`Updating`,async()=>t.emailSending.subdomains.update({...l,zone_id:n,subdomain_id:e[`subdomain-id`]})),{successLabel:`Updated`})}},q={command:`subdomains`,describe:`Sending subdomain operations`,builder:e=>e.command(D).command(k).command(L).command(z).command(V).command(K).command(te).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function J(e){return e.option(`email`,{type:`string`,description:`The email field`}).option(`expires-at`,{type:`string`,description:`The expires_at field`}).option(`note`,{type:`string`,description:`The note field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`create`,describe:`Creates an account-wide suppression. If a mutable legacy zone-linked row already exists, it is promoted without changing its identifier.`,builder:J,handler:async r=>{if(r.dryRun){o({command:`cf email-sending suppressions create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/suppressions`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({email:d(r.email,`email`,`text`),expires_at:d(r[`expires-at`],`expires-at`,`text`),note:d(r.note,`note`,`text`)}):c(r.body)});return}let l=await i(r),p=r.local?e:await t();if(r.accountId=p,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.emailSending.suppressions.create({...e,account_id:p})),{successLabel:`Created`});return}r.email===void 0&&(r.email=await f(`email`,`The email field`));let m=u({email:d(r.email,`email`,`text`),expires_at:d(r[`expires-at`],`expires-at`,`text`),note:d(r.note,`note`,`text`)});a(await s(`Creating`,async()=>l.emailSending.suppressions.create({...m,account_id:p})),{successLabel:`Created`})}};function X(e){return e.positional(`suppression-id`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Z={command:`delete <suppression-id>`,describe:`Deletes the suppression, its note, and every legacy internal zone membership, allowing future delivery attempts to the address.`,builder:X,handler:async r=>{if(r.dryRun){o({command:`cf email-sending suppressions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/suppressions/${r[`suppression-id`]==null?`<suppression-id>`:encodeURIComponent(String(r[`suppression-id`]))}`,pathParams:{"suppression-id":String(r[`suppression-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();if(r.accountId=l,!await p({force:!!r.force,message:`This operation removes an Email Sending suppression and may allow email delivery to resume for the address.`})){process.stderr.write(`Aborted.
7
+ `);return}a(await s(`Deleting`,async()=>c.emailSending.suppressions.delete({account_id:l,suppression_id:r[`suppression-id`]})),{successLabel:`Deleted`})}};function Q(e){return e.positional(`suppression-id`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`expires-at`,{type:`string`,description:"New expiry. Send `null` to make the suppression permanent; omit to leave it unchanged."}).option(`note`,{type:`string`,description:`Replacement advisory note. Send an empty string to clear it; omit to leave it unchanged.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ne={command:`edit <suppression-id>`,describe:`Updates expiry or advisory note fields without changing legacy internal zone memberships.`,builder:Q,handler:async r=>{if(r.dryRun){o({command:`cf email-sending suppressions edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/suppressions/${r[`suppression-id`]==null?`<suppression-id>`:encodeURIComponent(String(r[`suppression-id`]))}`,pathParams:{"suppression-id":String(r[`suppression-id`]??``)},bodyKind:`json`,body:r.body===void 0?u({expires_at:d(r[`expires-at`],`expires-at`,`text`),note:d(r.note,`note`,`text`)}):c(r.body)});return}let l=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Updating`,async()=>l.emailSending.suppressions.edit({...e,account_id:f,suppression_id:r[`suppression-id`]})),{successLabel:`Updated`});return}let p=u({expires_at:d(r[`expires-at`],`expires-at`,`text`),note:d(r.note,`note`,`text`)});a(await s(`Updating`,async()=>l.emailSending.suppressions.edit({...p,account_id:f,suppression_id:r[`suppression-id`]})),{successLabel:`Updated`})}};function re(e){return e.positional(`suppression-id`,{type:`string`,description:`Suppression ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get <suppression-id>`,describe:`Gets an Email Sending suppression owned by the account.`,builder:re,handler:async r=>{if(r.dryRun){o({command:`cf email-sending suppressions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/suppressions/${r[`suppression-id`]==null?`<suppression-id>`:encodeURIComponent(String(r[`suppression-id`]))}`,pathParams:{"suppression-id":String(r[`suppression-id`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.emailSending.suppressions.get({account_id:l,suppression_id:r[`suppression-id`]})),{successLabel:`Loaded`})}};function ae(e){return e.option(`items`,{type:`string`,description:`The items field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const oe={command:`import`,describe:`Imports up to 1,000 account-level Email Sending suppressions in one request.`,builder:ae,handler:async r=>{if(r.dryRun){o({command:`cf email-sending suppressions import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/suppressions/bulk`,pathParams:{},bodyKind:`json`,body:r.body===void 0?u({items:l(r.items,`items`)}):c(r.body)});return}let d=await i(r),f=r.local?e:await t();if(r.accountId=f,r.body){let e=c(r.body);a(await s(`Creating`,async()=>d.emailSending.suppressions.import({...e,account_id:f})),{successLabel:`Created`});return}if(r.items===void 0)throw Error(`--items is required (or pass --body with this field set).`);let p=u({items:l(r.items,`items`)});a(await s(`Creating`,async()=>d.emailSending.suppressions.import({...p,account_id:f})),{successLabel:`Created`})}};function $(e){return e.option(`per-page`,{type:`number`,description:`Per page`}).option(`cursor`,{type:`string`,description:"Opaque pagination cursor returned as `result_info.next_cursor`. It carries the filters that produced it."}).option(`email`,{type:`string`,description:`Exact email-address filter.`}).option(`search`,{type:`string`,description:"A complete address is an exact match; a value ending in `@` matches that username across every domain. Prefix searches may return short intermediate pages while the bounded account scan advances."}).option(`reason`,{type:`string`,description:`Reason`,choices:[`manual`,`complaint`,`hard_bounce`,`soft_bounce`,`policy`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`list`,describe:`Lists every active Email Sending suppression owned by the account, including legacy rows with internal zone memberships.`,builder:m($),handler:async r=>{let c={per_page:r[`per-page`],cursor:r.cursor,email:r.email,search:r.search,reason:r.reason};if(r.dryRun){o({command:`cf email-sending suppressions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/email/sending/suppressions`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();r.accountId=u,a(await s(`Loading`,async()=>l.emailSending.suppressions.list({account_id:u,...c})),{successLabel:`Loaded`})}},ce={command:`suppressions`,describe:`Operations for suppressions`,builder:e=>e.command(Y).command(Z).command(ne).command(ie).command(oe).command(se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},le={command:`email-sending`,describe:`Send emails and manage sending subdomains`,builder:e=>e.command(ee).command(T).command(C).command(v).command(x).command(q).command(ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{le as default};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n}from"./oauth-DuEONNgC.mjs";import{r}from"./auth-D3X9HYhD.mjs";import{t as i}from"./output-Ccqw2WOb.mjs";import{t as a}from"./dry-run-DL2V6yFm.mjs";import{t as o}from"./progress-BqQcF5QH.mjs";import{n as s,r as c,t as l}from"./body-parser-BshbixEq.mjs";import{n as u}from"./prompt-B0sWIs9c.mjs";function d(e){return e.positional(`extractor`,{type:`string`,description:`Extractor type.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const f={command:`delete <extractor>`,describe:`Deletes all custom extraction rules for an extractor type.`,builder:d,handler:async s=>{if(s.dryRun){a({command:`cf fieldExtractors delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/field_extractors/${s.extractor==null?`<extractor>`:encodeURIComponent(String(s.extractor))}`,pathParams:{extractor:String(s.extractor??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await u({force:!!s.force})){process.stderr.write(`Aborted.
3
+ `);return}i(await o(`Deleting`,async()=>c.fieldExtractors.delete({account_id:l,extractor:s.extractor})),{successLabel:`Deleted`})}};function p(e){return e.positional(`extractor`,{type:`string`,description:`Extractor type.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const m={command:`get <extractor>`,describe:`Retrieves the custom extraction rules configured for a given extractor type.`,builder:p,handler:async s=>{if(s.dryRun){a({command:`cf fieldExtractors get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/field_extractors/${s.extractor==null?`<extractor>`:encodeURIComponent(String(s.extractor))}`,pathParams:{extractor:String(s.extractor??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.fieldExtractors.get({account_id:l,extractor:s.extractor})),{successLabel:`Loaded`})}};function h(e){return e.positional(`extractor`,{type:`string`,description:`Extractor type.`,demandOption:!0}).option(`rules`,{type:`string`,description:`The rules field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Desired-state replacement of all rules for this extractor type.`})}const g={command:`update <extractor>`,describe:`Replaces all custom extraction rules for an extractor type. Omitted rules are deleted.`,builder:h,handler:async u=>{if(u.dryRun){a({command:`cf fieldExtractors update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/field_extractors/${u.extractor==null?`<extractor>`:encodeURIComponent(String(u.extractor))}`,pathParams:{extractor:String(u.extractor??``)},bodyKind:`json`,body:u.body===void 0?l({rules:c(u.rules,`rules`)}):s(u.body)});return}let d=await r(u),f=u.local?e:await t();if(u.accountId=f,u.body){let e=s(u.body);i(await o(`Updating`,async()=>d.fieldExtractors.update({...e,account_id:f,extractor:u.extractor})),{successLabel:`Updated`});return}if(u.rules===void 0)throw Error(`--rules is required (or pass --body with this field set).`);let p=l({rules:c(u.rules,`rules`)});i(await o(`Updating`,async()=>d.fieldExtractors.update({...p,account_id:f,extractor:u.extractor})),{successLabel:`Updated`})}},_={command:`fieldExtractors`,describe:`fieldExtractors`,builder:e=>e.command(f).command(m).command(g).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{_ as default};