cf 0.9.1 → 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.
- package/README.md +20 -5
- package/dist/_meta/agent-context.json +46 -39
- package/dist/_meta/commands.json +9358 -10581
- package/dist/_meta/hand-written-commands.json +784 -0
- package/dist/_meta/schemas.json +14870 -14667
- package/dist/abuse-reports-sDBTV0qZ.mjs +8 -0
- package/dist/{access-CxyW_sIW.mjs → access-DcNzuCue.mjs} +1 -1
- package/dist/account-BX90zXn5.mjs +2 -0
- package/dist/account-tags-Bz3JG5hI.mjs +9 -0
- package/dist/accounts-DCuW3xyZ.mjs +28 -0
- package/dist/{acm-CHacxa3s.mjs → acm-zjfShZLS.mjs} +1 -1
- package/dist/{addressing-BnqNmmYN.mjs → addressing-DORQ64Ux.mjs} +11 -11
- package/dist/{agent-context-Bu6yvDqA.mjs → agent-context-BgPR_aQr.mjs} +1 -1
- package/dist/agent-memory-C0hAUMeC.mjs +6 -0
- package/dist/ai-BpEBGMT2.mjs +5 -0
- package/dist/ai-audit-DnU3vn3E.mjs +2 -0
- package/dist/ai-gateway-COOrr_Yw.mjs +13 -0
- package/dist/ai-search-DKbN9Tyd.mjs +7 -0
- package/dist/ai-security-C_I5lo58.mjs +4 -0
- package/dist/{alerting-qa8SkXlD.mjs → alerting-4T8gmZs-.mjs} +4 -4
- package/dist/analytics-Bxh4TCP7.mjs +3 -0
- package/dist/analytics_engine-fV56bjVN.mjs +2 -0
- package/dist/{api-security-MfHbfZyf.mjs → api-security-COk_i184.mjs} +20 -20
- package/dist/argo-DIRfvxvv.mjs +2 -0
- package/dist/args-DlUhyGU0.mjs +2 -0
- package/dist/artifacts-BBfXNfUg.mjs +4 -0
- package/dist/audit-logs-BlOrlAWe.mjs +2 -0
- package/dist/{auth-DuLchM18.mjs → auth-D3X9HYhD.mjs} +3 -3
- package/dist/auth-DPhNN3Ly.mjs +5 -0
- package/dist/billing-B9e4PnvN.mjs +3 -0
- package/dist/body-parser-BshbixEq.mjs +2 -0
- package/dist/bot-management-D2JVeS-V.mjs +5 -0
- package/dist/botnet-feed-BTzTYs5d.mjs +3 -0
- package/dist/brand-protection-C5Q6Gpw9.mjs +3 -0
- package/dist/{browser-extension-q79xHrVW.mjs → browser-extension-u5uA0Lwk.mjs} +1 -1
- package/dist/browser-run-CHGOCTdG.mjs +4 -0
- package/dist/build-D0FhOj40.mjs +8 -0
- package/dist/{cache-Cl7vKJwH.mjs → cache-C6V7PbQM.mjs} +1 -1
- package/dist/{calls-DtK_ANxq.mjs → calls-Bye8Tyy-.mjs} +1 -1
- package/dist/certificate-authorities-B-U_e6JJ.mjs +2 -0
- package/dist/cf-Ds4JFovl.mjs +18 -0
- package/dist/chunk-LQW53VED-22IYZovK.mjs +119 -0
- package/dist/chunk-QBZBEHZB-CKzQKcIp.mjs +2 -0
- package/dist/{client-certificates-BtPU9GsQ.mjs → client-certificates-3RrC-6LG.mjs} +1 -1
- package/dist/{client-side-security-DAn-3jwp.mjs → client-side-security-DIdKvRMT.mjs} +1 -1
- package/dist/cloud-connector-CL1jPQud.mjs +2 -0
- package/dist/cloudforce-one-DULeqLkR.mjs +36 -0
- package/dist/command-C9VP3xaA.mjs +2 -0
- package/dist/{completions-BHE4pRjB.mjs → completions-CqgGKRAC.mjs} +3 -3
- package/dist/config.d.mts +1460 -1348
- package/dist/config.mjs +1 -1
- package/dist/connector-interrupts-CXlLObDv.mjs +2 -0
- package/dist/connector-telemetry-events-BrYX4ig4.mjs +2 -0
- package/dist/connector-telemetry-events-latest-BbpcII3_.mjs +2 -0
- package/dist/connector-telemetry-snapshots-BdeBQYcM.mjs +2 -0
- package/dist/connector-telemetry-snapshots-latest-DuCiimXl.mjs +2 -0
- package/dist/{connectors-Bo6ZT8PT.mjs → connectors-BQwyBJ4_.mjs} +1 -1
- package/dist/containers-BrQtGiNp.mjs +58 -0
- package/dist/{content-scan-D03UfK2X.mjs → content-scan-DNzhXYkY.mjs} +1 -1
- package/dist/{csamScanner-DgS-7ADh.mjs → csamScanner-CFq5s1Q3.mjs} +1 -1
- package/dist/{ct-alerting-8AKtNnUg.mjs → ct-alerting-CH6UmsGQ.mjs} +1 -1
- package/dist/custom-certificates-DnG73Wg2.mjs +5 -0
- package/dist/custom-csrs-bhClr2SU.mjs +3 -0
- package/dist/custom-hostnames-C0eiGvG9.mjs +5 -0
- package/dist/custom-nameservers-CVMhhLm6.mjs +3 -0
- package/dist/custom-pages-DTINMR30.mjs +3 -0
- package/dist/d1-sKdExJYF.mjs +20 -0
- package/dist/data-security-mV3a6UfW.mjs +7 -0
- package/dist/dcv-delegation-dBu3jdRw.mjs +2 -0
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-DGlmjPTS.mjs → deploy-BL59O1O1.mjs} +1 -1
- package/dist/deploy-input-Dz6q-__n.mjs +2 -0
- package/dist/{dev-BbLV0Ti-.mjs → dev-BDaavgH1.mjs} +2 -2
- package/dist/diagnostics-CJV6qWUA.mjs +3 -0
- package/dist/{directory-CCndFkbQ.mjs → directory-B5zCMusW.mjs} +1 -1
- package/dist/{dispatch-namespaces-C48JQ9EA.mjs → dispatch-namespaces-Dg5lu5xX.mjs} +1 -1
- package/dist/dist-BHi7UhXO.mjs +72 -0
- package/dist/dist-BWpErtDM.mjs +384 -0
- package/dist/{dls-BBq99pjI.mjs → dls-t0hnIe_P.mjs} +1 -1
- package/dist/dns-C8FC2hbh.mjs +29 -0
- package/dist/{dns-firewall-DdwVtm12.mjs → dns-firewall-CuhhUm55.mjs} +1 -1
- package/dist/{dot-prop-6SRZBKHT-C_xd7eTS.mjs → dot-prop-6SRZBKHT-wwGHcwAa.mjs} +1 -1
- package/dist/dry-run-DL2V6yFm.mjs +2 -0
- package/dist/durable-objects-BLrgM3Cw.mjs +2 -0
- package/dist/email-auth-BmYrl0pO.mjs +2 -0
- package/dist/email-routing-CF3_Z957.mjs +6 -0
- package/dist/email-security-F7OYcMkZ.mjs +18 -0
- package/dist/email-sending-EyU3WvGQ.mjs +7 -0
- package/dist/fieldExtractors-Cno37T2m.mjs +3 -0
- package/dist/firewall-8YWWy4iB.mjs +11 -0
- package/dist/flagship-C4x0l-8J.mjs +4 -0
- package/dist/{fraud-AH47n-wL.mjs → fraud-HR_SdUx3.mjs} +1 -1
- package/dist/google-tag-gateway-BdcS0WnX.mjs +2 -0
- package/dist/{healthchecks-DfEUG007.mjs → healthchecks-4qOvjrTN.mjs} +2 -2
- package/dist/{hostnames-DQUiD3Vr.mjs → hostnames-DehdYOMz.mjs} +1 -1
- package/dist/{hyperdrive-RyQboMWI.mjs → hyperdrive-3gD3hn70.mjs} +1 -1
- package/dist/iam-DR72hmii.mjs +6 -0
- package/dist/images-CeKc5JPh.mjs +8 -0
- package/dist/index.mjs +1 -1
- package/dist/intel-DtFix9WL.mjs +8 -0
- package/dist/{interactive-mV8PABm6.mjs → interactive-C7M55Wxx.mjs} +1 -1
- package/dist/ips-CtWCjXAN.mjs +2 -0
- package/dist/{keyless-certificates-oNu5jWKF.mjs → keyless-certificates-Dk24yQFz.mjs} +1 -1
- package/dist/keys-BmhG6Kn1.mjs +2 -0
- package/dist/{kv-Bi9B4E0A.mjs → kv-BuVPAuZP.mjs} +1 -1
- package/dist/{leaked-credential-checks-DKRjBLcr.mjs → leaked-credential-checks-XcZmt1I-.mjs} +1 -1
- package/dist/load-balancers-CylN-l7n.mjs +6 -0
- package/dist/{local-DTyuGwTw.mjs → local-Be3lg_9E.mjs} +1 -1
- package/dist/{local-runtime-IAXhEugU.mjs → local-runtime-Ce7k598H.mjs} +1 -1
- package/dist/logexplorer-CvRPoKbj.mjs +17 -0
- package/dist/logo-matches-Heuft3yF.mjs +2 -0
- package/dist/logos-DRYjGBDq.mjs +3 -0
- package/dist/logpush-Dve9jOMp.mjs +4 -0
- package/dist/{logs-DmWWL5f9.mjs → logs-SC86FE89.mjs} +1 -1
- package/dist/{magic-cloud-networking-XbTa6P52.mjs → magic-cloud-networking-DXzeqwX-.mjs} +4 -4
- package/dist/magic-network-monitoring-DW0Jl74i.mjs +4 -0
- package/dist/magic-transit-BK_3asH2.mjs +111 -0
- package/dist/managed-transforms-B6TV4qoE.mjs +3 -0
- package/dist/matches-Iss9Fo4R.mjs +2 -0
- package/dist/mcp-8wxXT6JU.mjs +4 -0
- package/dist/mesh-Bf9UAS4J.mjs +4 -0
- package/dist/{moq-CJpE-eNj.mjs → moq-ZKMFOeVz.mjs} +1 -1
- package/dist/mtls-certificates-DoWm6GiE.mjs +3 -0
- package/dist/{network-D2WRXCDe.mjs → network-B1lBARU9.mjs} +1 -1
- package/dist/{network-interconnects-Clq4X1U8.mjs → network-interconnects-CLYIFHfU.mjs} +1 -1
- package/dist/oauth-DuEONNgC.mjs +14 -0
- package/dist/{oauth-clients-hilWfAlm.mjs → oauth-clients-DgiTzLzu.mjs} +1 -1
- package/dist/oauth-scopes-BOBRMxjm.mjs +2 -0
- package/dist/observability-Jya7-zkl.mjs +4 -0
- package/dist/{open-PBXRGS4R-C46yIm3u.mjs → open-PBXRGS4R-CX8K4WYl.mjs} +3 -3
- package/dist/{organization-D41rIvJa.mjs → organization-CYxYV4e0.mjs} +6 -6
- package/dist/organizations-SacGUW44.mjs +2 -0
- package/dist/origin-ca-certificates-Ph1bJGQ1.mjs +3 -0
- package/dist/origin-post-quantum-encryption-BBLiGAGB.mjs +2 -0
- package/dist/origin-tls-client-auth-DSDgTN2X.mjs +4 -0
- package/dist/{output-DgW1hQGX.mjs → output-Ccqw2WOb.mjs} +1 -1
- package/dist/page-rules-BqEyFR2c.mjs +27 -0
- package/dist/pages-CQ7ZVWk1.mjs +14 -0
- package/dist/pay-per-crawl-BMe_3_Qj.mjs +4 -0
- package/dist/pipelines-6De2Pe2C.mjs +6 -0
- package/dist/precursor-iwK-1P_d.mjs +4 -0
- package/dist/progress-BqQcF5QH.mjs +2 -0
- package/dist/project-settings-C_1-JI6Y.mjs +3 -0
- package/dist/prompt-B0sWIs9c.mjs +3 -0
- package/dist/{public-BwQqexwo-DbWj8rrr.mjs → public-BYCVISMH-DnMJ5Jct.mjs} +1 -1
- package/dist/queries-c7zvnfEQ.mjs +3 -0
- package/dist/queues-BU6y16qS.mjs +6 -0
- package/dist/r2-Jo3QMahK.mjs +24 -0
- package/dist/{r2-data-catalog-DLtf9d6o.mjs → r2-data-catalog-B-tw-JdG.mjs} +1 -1
- package/dist/radar-DIYAMEof.mjs +2 -0
- package/dist/{rate-limits-B1YjnGue.mjs → rate-limits-DewOcznT.mjs} +1 -1
- package/dist/raw-fetch-Cc-MjHeL.mjs +2 -0
- package/dist/realtimekit-cnZEVNDn.mjs +7 -0
- package/dist/registrar-BsWr_aPM.mjs +23 -0
- package/dist/{registrar-sandbox-0i1T3zne.mjs → registrar-sandbox-BlcpUyIH.mjs} +6 -6
- package/dist/{registry-DDcSvd8H.mjs → registry-jifR3_Y6.mjs} +1 -1
- package/dist/reporting--1AyTV7k.mjs +2 -0
- package/dist/request-tracers-C_VX7X6-.mjs +2 -0
- package/dist/{resource-sharing-Ctdi9D-j.mjs → resource-sharing-Br5dqr3o.mjs} +1 -1
- package/dist/resource-tagging-C33U6T74.mjs +2 -0
- package/dist/rules-BfjzALMi.mjs +4 -0
- package/dist/rulesets-3i_1Vwt-.mjs +5 -0
- package/dist/rum-CjmIckiR.mjs +4 -0
- package/dist/{schema-BeXPWeK9.mjs → schema-1mwmslUV.mjs} +1 -1
- package/dist/schema-flags-llLJuFFw.mjs +5 -0
- package/dist/{scim-BgGsmHrL.mjs → scim-pApmzA5B.mjs} +1 -1
- package/dist/sdk-ZctLa5jW.mjs +3 -0
- package/dist/{secrets-store-BCpFhYFv.mjs → secrets-store-DBC9WJau.mjs} +1 -1
- package/dist/security-center-Djm06dq-.mjs +2 -0
- package/dist/{security-txt-Be2Bif0z.mjs → security-txt-Ci7bP4zH.mjs} +1 -1
- package/dist/{share-Bz2tFTUP.mjs → share-Dj-MNXrw.mjs} +4 -4
- package/dist/shared-BJvq4DkR.mjs +290 -0
- package/dist/smart-shield--8EpJjrF.mjs +4 -0
- package/dist/snippets-Dyz0PH60.mjs +4 -0
- package/dist/{spawn-CHkoow5W.mjs → spawn-C5Z7oWdp.mjs} +108 -112
- package/dist/{spectrum-BA0a42eM.mjs → spectrum-rAHWz8rH.mjs} +1 -1
- package/dist/{speed-mmOjxOzo.mjs → speed-BKepWBXj.mjs} +1 -1
- package/dist/src-gJma71Ec.mjs +108 -0
- package/dist/{ssl-Yr6kELqg.mjs → ssl-KdFiY3ev.mjs} +1 -1
- package/dist/startup-profile-GLNPHQ9U.mjs +17 -0
- package/dist/{state-DZC531l2.mjs → state-Cu3cItUg.mjs} +1 -1
- package/dist/{stream-Cu0kYWbc.mjs → stream-CKJ6Tb0M.mjs} +13 -13
- package/dist/submit-BxbKKhBn.mjs +2 -0
- package/dist/tags-DA8dq9fx.mjs +2 -0
- package/dist/tenant-DLXw48hS.mjs +2 -0
- package/dist/tenant-custom-nameservers-9G93XuvU.mjs +3 -0
- package/dist/{tools-D2Xxfkrc.mjs → tools-x8bj9E6b.mjs} +1 -1
- package/dist/{tunnel-CDYkWjnt.mjs → tunnel-CNQA5Flp.mjs} +1 -1
- package/dist/tunnels-CC10EOsU.mjs +2 -0
- package/dist/turnstile-CH58hnf4.mjs +23 -0
- package/dist/{ui-DIpjthrV.mjs → ui-CmnnBm_O.mjs} +1 -1
- package/dist/url-info-BpCgdUtL.mjs +2 -0
- package/dist/{url-normalization-BeKkOZz7.mjs → url-normalization-BzuynEy1.mjs} +1 -1
- package/dist/url-scanner-APIZbhB7.mjs +2 -0
- package/dist/user-2-NGebfI.mjs +12 -0
- package/dist/values-S_bNv819.mjs +2 -0
- package/dist/{vectorize-CjXfiFH4.mjs → vectorize-Bv7feLBC.mjs} +1 -1
- package/dist/waiting-rooms-Dk4LIpvm.mjs +11 -0
- package/dist/{web-assets-BzM5vVzy.mjs → web-assets-C1UmOyzD.mjs} +1 -1
- package/dist/web3-GnUocVYH.mjs +4 -0
- package/dist/workers-J1-PLwdl.mjs +28 -0
- package/dist/{workers-builds-B44wc67O.mjs → workers-builds-DCHmWOMS.mjs} +4 -4
- package/dist/{workflows-rFuQWClt.mjs → workflows-CArfEI2c.mjs} +2 -2
- package/dist/zaraz-mg2YlR3_.mjs +2 -0
- package/dist/zero-trust-DVdUPtj1.mjs +93 -0
- package/dist/zone-DMAfrDJX.mjs +2 -0
- package/dist/zones-CNwxUi7I.mjs +21 -0
- package/package.json +10 -7
- package/dist/abuse-reports-CzDAjFpo.mjs +0 -8
- package/dist/account-Dd4-tDYJ.mjs +0 -2
- package/dist/account-tags-65fAlHrf.mjs +0 -9
- package/dist/accounts-Bp5KGc6r.mjs +0 -28
- package/dist/agent-memory-D--BQS0W.mjs +0 -6
- package/dist/ai-BnVlQDiI.mjs +0 -5
- package/dist/ai-audit-CfpDKXkD.mjs +0 -2
- package/dist/ai-gateway-oG4j_oYN.mjs +0 -13
- package/dist/ai-search-B2l3B_jn.mjs +0 -7
- package/dist/ai-security-byjIIrfl.mjs +0 -4
- package/dist/analytics-DeIKjC9n.mjs +0 -3
- package/dist/analytics_engine-BnECMIWJ.mjs +0 -2
- package/dist/argo-DFerMyXF.mjs +0 -2
- package/dist/artifacts-CtyEYYDa.mjs +0 -4
- package/dist/audit-logs-retFtvow.mjs +0 -2
- package/dist/auth-aazs91XL.mjs +0 -5
- package/dist/billing-CxQVqpGZ.mjs +0 -3
- package/dist/body-parser-CYD7PKFC.mjs +0 -2
- package/dist/bot-management-Rli7v7tg.mjs +0 -5
- package/dist/botnet-feed-Cw6XSEf8.mjs +0 -3
- package/dist/brand-protection-CTvnHGfV.mjs +0 -3
- package/dist/browser-run-FwtwnBzA.mjs +0 -4
- package/dist/build-Dji9BYmV.mjs +0 -2
- package/dist/certificate-authorities-DZP1RzAs.mjs +0 -2
- package/dist/cf-oSz9pud_.mjs +0 -18
- package/dist/chunk-LQW53VED-Xakf_rUn.mjs +0 -499
- package/dist/cloud-connector-BpVcvhjZ.mjs +0 -2
- package/dist/cloudforce-one-2PecncfX.mjs +0 -30
- package/dist/connector-interrupts-ollUcksZ.mjs +0 -2
- package/dist/connector-telemetry-events-D5_3X7XW.mjs +0 -2
- package/dist/connector-telemetry-snapshots-CJ9gLRFR.mjs +0 -2
- package/dist/containers-Bog7j0Hw.mjs +0 -54
- package/dist/custom-certificates-4y35UC1X.mjs +0 -5
- package/dist/custom-csrs-DwBrLh-H.mjs +0 -4
- package/dist/custom-hostnames-CDIAnsRa.mjs +0 -5
- package/dist/custom-nameservers-stk7ymnP.mjs +0 -3
- package/dist/custom-pages-vfDxrXbt.mjs +0 -4
- package/dist/d1-Cllm-iTT.mjs +0 -20
- package/dist/data-security-rnoSCEdL.mjs +0 -7
- package/dist/dcv-delegation-DCRCOL6l.mjs +0 -2
- package/dist/deploy-input-DhCo1I0I.mjs +0 -242
- package/dist/diagnostics-D5Yo2xqx.mjs +0 -3
- package/dist/dist-COfwjT96.mjs +0 -72
- package/dist/dns-DdQYtenF.mjs +0 -29
- package/dist/durable-objects-BvxXBht_.mjs +0 -2
- package/dist/email-CGOC_evd.mjs +0 -2
- package/dist/email-auth-DFvXKSkg.mjs +0 -2
- package/dist/email-routing-QBRPBlyl.mjs +0 -6
- package/dist/email-security-BFagcRPP.mjs +0 -18
- package/dist/email-sending-Ddhe7xjN.mjs +0 -7
- package/dist/filters-CGisPGD1.mjs +0 -4
- package/dist/firewall-DD8U-Brd.mjs +0 -11
- package/dist/flagship-FJHc4mFi.mjs +0 -4
- package/dist/google-tag-gateway-149kbuG_.mjs +0 -2
- package/dist/iam-BhHYhMXO.mjs +0 -6
- package/dist/images-CDViyKtZ.mjs +0 -8
- package/dist/intel-YHZbPlS3.mjs +0 -8
- package/dist/ips-BpCdldFx.mjs +0 -2
- package/dist/keys-yYtv7Ztr.mjs +0 -2
- package/dist/load-balancers-jRCN75mX.mjs +0 -7
- package/dist/logexplorer-kO8CULiK.mjs +0 -24
- package/dist/logo-matches-LyDAYPbI.mjs +0 -2
- package/dist/logos-O9f5bGSB.mjs +0 -3
- package/dist/logpush-dtXLu3Ck.mjs +0 -5
- package/dist/magic-network-monitoring-CpfkgZMp.mjs +0 -4
- package/dist/magic-transit-DwgZeIj-.mjs +0 -111
- package/dist/managed-transforms-DCmogkxv.mjs +0 -3
- package/dist/matches-BAeN8VM1.mjs +0 -2
- package/dist/mcp-DKZ2D050.mjs +0 -4
- package/dist/media-CnxgOViL.mjs +0 -2
- package/dist/mesh-CzIPtuaM.mjs +0 -4
- package/dist/mtls-certificates-Bbm_1lQI.mjs +0 -3
- package/dist/oauth-BPizUUqP.mjs +0 -15
- package/dist/oauth-scopes-CmbgsPYd.mjs +0 -2
- package/dist/observability-DXYgDdU5.mjs +0 -4
- package/dist/organizations-eNzfOwlP.mjs +0 -2
- package/dist/origin-ca-certificates-DaiAmw45.mjs +0 -3
- package/dist/origin-post-quantum-encryption-7YztBged.mjs +0 -2
- package/dist/origin-tls-client-auth-DRwURM8s.mjs +0 -4
- package/dist/page-rules-B2Csdc4h.mjs +0 -18
- package/dist/pages-BAL6Q7OY.mjs +0 -14
- package/dist/pay-per-crawl-C-1-ZAtn.mjs +0 -4
- package/dist/pipelines-cyQOuFLb.mjs +0 -6
- package/dist/precursor-BrweY39h.mjs +0 -4
- package/dist/progress-B84wYh91.mjs +0 -2
- package/dist/prompt-CDtLWxNv.mjs +0 -3
- package/dist/queries-oM8uGZy5.mjs +0 -3
- package/dist/queues-CTx04ZNw.mjs +0 -6
- package/dist/r2-CnlIUn7R.mjs +0 -24
- package/dist/radar-CGNgGh8v.mjs +0 -2
- package/dist/raw-fetch-Dz-QBoP_.mjs +0 -2
- package/dist/realtimekit-BPwzhNS9.mjs +0 -7
- package/dist/registrar-BEcb90RX.mjs +0 -21
- package/dist/reporting-CLbjHlnw.mjs +0 -2
- package/dist/request-tracers-BcKpofP1.mjs +0 -2
- package/dist/resource-tagging-DGEyVTDN.mjs +0 -2
- package/dist/rules-CmuB5rIN.mjs +0 -4
- package/dist/rulesets-CGaMq8vG.mjs +0 -8
- package/dist/rum-QT6EP4JK.mjs +0 -4
- package/dist/schema-flags-DHryz6SF.mjs +0 -5
- package/dist/sdk-m4xeaua4.mjs +0 -3
- package/dist/security-center-BNm4uPVB.mjs +0 -2
- package/dist/session-Ckt20hHa.mjs +0 -2
- package/dist/shared-BzPQog8H.mjs +0 -2
- package/dist/smart-shield-SODkOUyO.mjs +0 -4
- package/dist/snippets-B5jY8v_7.mjs +0 -4
- package/dist/src-CHW7s5IS.mjs +0 -108
- package/dist/submit-Dl_27e0n.mjs +0 -2
- package/dist/tags-Cdo_Pwtr.mjs +0 -2
- package/dist/tenant-EX-ANl6X.mjs +0 -2
- package/dist/tenant-custom-nameservers-BPHUeckw.mjs +0 -3
- package/dist/triggers-Bf9hbP3h.mjs +0 -2
- package/dist/tunnels-CgyX8R2J.mjs +0 -2
- package/dist/turnstile-BUtzlW-0.mjs +0 -23
- package/dist/url-info-CJsa1Oc9.mjs +0 -2
- package/dist/url-scanner-Cz-yl0_3.mjs +0 -2
- package/dist/user-BxHjEqpd.mjs +0 -12
- package/dist/values-C43NurfT.mjs +0 -2
- package/dist/versions-BFbc90Wu.mjs +0 -2
- package/dist/waiting-rooms-C5jSQv_r.mjs +0 -11
- package/dist/web3-Ctv9HGiR.mjs +0 -4
- package/dist/workers-D-YbIedB.mjs +0 -24
- package/dist/zaraz-BA6kY-b6.mjs +0 -2
- package/dist/zero-trust-DOFLlUz1.mjs +0 -102
- package/dist/zone-B_rgejLV.mjs +0 -2
- package/dist/zone-tags-BWdza4rH.mjs +0 -9
- package/dist/zones-DTWO7Vvn.mjs +0 -21
- /package/dist/{Page-C-JHZnIy.mjs → Page-9ry_XAVC.mjs} +0 -0
- /package/dist/{alerts-B85uj2Vx.mjs → alerts-15-IW4jE.mjs} +0 -0
- /package/dist/{autorag-Do9l_LyY.mjs → autorag-CFwRkEKw.mjs} +0 -0
- /package/dist/{brands-DateHCdd.mjs → brands-BgT1vu9B.mjs} +0 -0
- /package/dist/{chunk-6EUZQHAF-l8tR2Qyj.mjs → chunk-6EUZQHAF-C3w62dek.mjs} +0 -0
- /package/dist/{chunk-Q72B4Q5Z-CPy_WJKU.mjs → chunk-Q72B4Q5Z-DVMMVVEs.mjs} +0 -0
- /package/dist/{clear-CB2kgcEB.mjs → clear-BlCK85Me.mjs} +0 -0
- /package/dist/{cli-types-BWdZbsFE.mjs → cli-types-DAYeL_Mj.mjs} +0 -0
- /package/dist/{domain-info-DJHEt8JJ.mjs → domain-info-C7LBxPBt.mjs} +0 -0
- /package/dist/{health-buY5f5pp.mjs → health-DZFfafkX.mjs} +0 -0
- /package/dist/{input-validation-BBKJRoRB.mjs → input-validation-QDIYu7Vb.mjs} +0 -0
- /package/dist/{internal-CwyoJUHh.mjs → internal-BKHC2D1Y.mjs} +0 -0
- /package/dist/{live-wEpA5V_n.mjs → live-DwCvDmaH.mjs} +0 -0
- /package/dist/{metadata-8AkOftcB.mjs → metadata-B5yfL0ln.mjs} +0 -0
- /package/dist/{rate-limit-analytics-Bf1uT0lT.mjs → rate-limit-analytics-B8Vuu1sU.mjs} +0 -0
- /package/dist/{ready-CBSCPiHE.mjs → ready-D9H2zHHI.mjs} +0 -0
- /package/dist/{recent-submissions-Dpmq1f7z.mjs → recent-submissions-BPo0J80d.mjs} +0 -0
- /package/dist/{refute-u7ZPQJZy.mjs → refute-2W8NLCN4.mjs} +0 -0
- /package/dist/{resolve-XgxRJ-Ys.mjs → resolve-B8CyM1mi.mjs} +0 -0
- /package/dist/{scan-logo-Ba8WZAyp.mjs → scan-logo-D5x6F1Y0.mjs} +0 -0
- /package/dist/{scan-page-Bcq3Ei86.mjs → scan-page-CWhta3x7.mjs} +0 -0
- /package/dist/{search-D9WDwnV4.mjs → search-DZmBQJL9.mjs} +0 -0
- /package/dist/{signed-url-CjPbG5zV.mjs → signed-url-CQrmWgz5.mjs} +0 -0
- /package/dist/{submission-info-Z9hhp9Rq.mjs → submission-info-C98A0bqq.mjs} +0 -0
- /package/dist/{theme-BePJemMn.mjs → theme-CrIBazAF.mjs} +0 -0
- /package/dist/{total-queries-aKAYX1iX.mjs → total-queries-BZoaFoDE.mjs} +0 -0
- /package/dist/{tracked-domains-Ck7Jm4Kn.mjs → tracked-domains-CNHogPHx.mjs} +0 -0
- /package/dist/{verify-2yi0H93r.mjs → verify-4e4L9IRk.mjs} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{t}from"./resolve-B8CyM1mi.mjs";import{f as n,g 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,t as h}from"./prompt-B0sWIs9c.mjs";import{t as g}from"./cli-types-DAYeL_Mj.mjs";import _ from"node:fs";import v from"node:path";const y=(e,t,n)=>{let r=e instanceof RegExp?b(e,n):e,i=t instanceof RegExp?b(t,n):t,a=r!==null&&i!=null&&ee(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},b=(e,t)=>{let n=t.match(e);return n?n[0]:null},ee=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},te=`\0SLASH`+Math.random()+`\0`,x=`\0OPEN`+Math.random()+`\0`,S=`\0CLOSE`+Math.random()+`\0`,C=`\0COMMA`+Math.random()+`\0`,w=`\0PERIOD`+Math.random()+`\0`,ne=new RegExp(te,`g`),re=new RegExp(x,`g`),ie=new RegExp(S,`g`),ae=new RegExp(C,`g`),oe=new RegExp(w,`g`),se=/\\\\/g,ce=/\\{/g,le=/\\}/g,ue=/\\,/g,de=/\\\./g;function T(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function fe(e){return e.replace(se,te).replace(ce,x).replace(le,S).replace(ue,C).replace(de,w)}function pe(e){return e.replace(ne,`\\`).replace(re,`{`).replace(ie,`}`).replace(ae,`,`).replace(oe,`.`)}function me(e){if(!e)return[``];let t=[],n=y(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=me(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function he(e,t={}){if(!e)return[];let{max:n=1e5}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),E(fe(e),n,!0).map(pe)}function ge(e){return`{`+e+`}`}function _e(e){return/^-?0\d/.test(e)}function ve(e,t){return e<=t}function ye(e,t){return e>=t}function E(e,t,n){let r=[],i=y(`{`,`}`,e);if(!i)return[e];let a=i.pre,o=i.post.length?E(i.post,t,!1):[``];if(/\$$/.test(i.pre))for(let e=0;e<o.length&&e<t;e++){let t=a+`{`+i.body+`}`+o[e];r.push(t)}else{let s=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),c=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),l=s||c,u=i.body.indexOf(`,`)>=0;if(!l&&!u)return i.post.match(/,(?!,).*\}/)?(e=i.pre+`{`+i.body+S+i.post,E(e,t,!0)):[e];let d;if(l)d=i.body.split(/\.\./);else if(d=me(i.body),d.length===1&&d[0]!==void 0&&(d=E(d[0],t,!1).map(ge),d.length===1))return o.map(e=>i.pre+d[0]+e);let f;if(l&&d[0]!==void 0&&d[1]!==void 0){let e=T(d[0]),n=T(d[1]),r=Math.max(d[0].length,d[1].length),i=d.length===3&&d[2]!==void 0?Math.max(Math.abs(T(d[2])),1):1,a=ve;n<e&&(i*=-1,a=ye);let o=d.some(_e);f=[];for(let s=e;a(s,n)&&f.length<t;s+=i){let e;if(c)e=String.fromCharCode(s),e===`\\`&&(e=``);else if(e=String(s),o){let t=r-e.length;if(t>0){let n=Array(t+1).join(`0`);e=s<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,E(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<o.length&&r.length<t;i++){let t=a+f[e]+o[i];(!n||l||t)&&r.push(t)}}return r}const D=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},be={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},O=e=>e.replace(/[[\]\\-]/g,`\\$&`),xe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),k=e=>e.join(``),Se=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(be))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(O(d)+`-`+O(t)):t===d&&r.push(O(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(O(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(O(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l)return[xe(r[0].length===2?r[0].slice(-1):r[0]),!1,u-n,!1];let f=`[`+(l?`^`:``)+k(r)+`]`,p=`[`+(l?``:`^`)+k(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},A=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var j;const Ce=new Set([`!`,`?`,`+`,`*`,`@`]),M=e=>Ce.has(e),N=e=>M(e.type),we=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),Te=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),Ee=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),P=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),F=`(?!\\.)`,De=new Set([`[`,`.`]),Oe=new Set([`..`,`.`]),ke=new Set(`().*{}+?[]^$\\!`),Ae=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),I=`[^/]`,je=I+`*?`,L=I+`+?`;let Me=0;var R=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Me;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof j&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof j&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new j(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&M(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new j(n,t);u=j.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new j(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&M(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new j(n,d);d.push(o),u=j.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new j(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,Te)}#m(e,t=we){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=Ee){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new j(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!P.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=P.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new j(null,void 0,t);return j.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!N(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?j.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&Oe.has(this.#r[0]))){let n=De,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?F:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,A(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,A(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?F:``)+L;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?F:``)+je+`)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,A(i),this.#t=!!this.#t,this.#n]}#x(){if(N(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(ke.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?L:je,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=Se(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=I,t=!0;continue}i+=Ae(c)}return[i,A(e),!!t,a]}};j=R;const Ne=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),z=(e,t,n={})=>(D(t),!n.nocomment&&t.charAt(0)===`#`?!1:new J(t,n).match(e)),Pe=/^\*+([^+@!?*[(]*)$/,Fe=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ie=e=>t=>t.endsWith(e),Le=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Re=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),ze=/^\*+\.\*+$/,Be=e=>!e.startsWith(`.`)&&e.includes(`.`),Ve=e=>e!==`.`&&e!==`..`&&e.includes(`.`),He=/^\.\*+$/,Ue=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),We=/^\*+$/,Ge=e=>e.length!==0&&!e.startsWith(`.`),Ke=e=>e.length!==0&&e!==`.`&&e!==`..`,qe=/^\?+([^+@!?*[(]*)?$/,Je=([e,t=``])=>{let n=B([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Ye=([e,t=``])=>{let n=V([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Xe=([e,t=``])=>{let n=V([e]);return t?e=>n(e)&&e.endsWith(t):n},Ze=([e,t=``])=>{let n=B([e]);return t?e=>n(e)&&e.endsWith(t):n},B=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},V=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},H=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,U={win32:{sep:`\\`},posix:{sep:`/`}};z.sep=H===`win32`?U.win32.sep:U.posix.sep;const W=Symbol(`globstar **`);z.GLOBSTAR=W,z.filter=(e,t={})=>n=>z(n,e,t);const G=(e,t={})=>Object.assign({},e,t);z.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return z;let t=z;return Object.assign((n,r,i={})=>t(n,r,G(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,G(e,n))}static defaults(n){return t.defaults(G(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,G(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,G(e,r))}},unescape:(n,r={})=>t.unescape(n,G(e,r)),escape:(n,r={})=>t.escape(n,G(e,r)),filter:(n,r={})=>t.filter(n,G(e,r)),defaults:n=>t.defaults(G(e,n)),makeRe:(n,r={})=>t.makeRe(n,G(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,G(e,r)),match:(n,r,i={})=>t.match(n,r,G(e,i)),sep:t.sep,GLOBSTAR:W})};const K=(e,t={})=>(D(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:he(e,{max:t.braceExpandMax}));z.braceExpand=K,z.makeRe=(e,t={})=>new J(e,t).makeRe(),z.match=(e,t,n={})=>{let r=new J(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const q=/[?*]|[+@!]\(.*?\)|\[|\]/,Qe=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var J=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){D(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||H,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!q.test(e[2]))&&!q.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(W)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(W,i),o=t.lastIndexOf(W),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===W?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===W)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return K(this.pattern,this.options)}parse(e){D(e);let t=this.options;if(e===`**`)return W;if(e===``)return``;let n,r=null;(n=e.match(We))?r=t.dot?Ke:Ge:(n=e.match(Pe))?r=(t.nocase?t.dot?Re:Le:t.dot?Ie:Fe)(n[1]):(n=e.match(qe))?r=(t.nocase?t.dot?Ye:Je:t.dot?Xe:Ze)(n):(n=e.match(ze))?r=t.dot?Ve:Be:(n=e.match(He))&&(r=Ue);let i=R.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,`test`,{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?Qe(e):e===W?W:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==W||a===W||(a===void 0?i!==void 0&&i!==W?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==W&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=W))});let i=t.filter(e=>e!==W);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return z.defaults(e).Minimatch}};z.AST=R,z.Minimatch=J,z.escape=Ne,z.unescape=A;function Y(e){let t=e.replace(/\\/g,`/`),n=v.posix.normalize(t);return n.endsWith(`/`)?n.slice(0,-1):n}function X(e,t){if(t===`.`)return e;let n=`${t}/`;if(!e.startsWith(n))throw Error(`Expected migrations pattern ${JSON.stringify(e)} to start with ${JSON.stringify(n)}`);return e.slice(n.length)}function Z(e){return`"${e.replace(/"/g,`""`)}"`}function $e(e){return`CREATE TABLE IF NOT EXISTS ${Z(e)}(
|
|
3
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
+
name TEXT UNIQUE,
|
|
5
|
+
applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
6
|
+
);`}function et(e){return`SELECT *
|
|
7
|
+
FROM ${Z(e)}
|
|
8
|
+
ORDER BY id`}function tt(e){if(e.pattern!==void 0&&e.dir===void 0)throw Error(`You have set --pattern "${e.pattern}" but have not set --dir.\n\nWhen --pattern is set, --dir must also be set, and --pattern must start with "<dir>/".`);let t=Y(e.dir??`./migrations`),n=Y(`${t}/*.sql`),r;if(e.pattern===void 0)r=n;else{r=Y(e.pattern);try{X(r,t)}catch{throw Error(`--pattern "${e.pattern}" must start with "${t}/" to match --dir "${t}".\nEither change --pattern so it starts with "${t}/" (for example, "${n}"), or change --dir to match the start of your pattern.`)}}return{migrationsPath:v.resolve(e.cwd??process.cwd(),t),migrationsDir:t,migrationsPattern:r,migrationsTableName:e.table??`d1_migrations`}}function nt(e,t){let n=[],r=[{abs:e,rel:``}];for(;r.length>0;){let{abs:e,rel:i}=r.pop(),a;try{a=_.readdirSync(e,{withFileTypes:!0})}catch{continue}for(let o of a){let a=i===``?o.name:`${i}/${o.name}`;o.isDirectory()?t.match(a,!0)&&r.push({abs:v.join(e,o.name),rel:a}):o.isFile()&&t.match(a)&&n.push(a)}}return n.sort(it)}function Q(e){let t=e.split(`/`)[0]??``;return parseInt(t.split(`_`)[0]??``,10)}function rt(e,t){let n=Q(e),r=Q(t);if(n!==r){if(Number.isFinite(n)&&Number.isFinite(r))return n-r;if(Number.isFinite(n))return-1;if(Number.isFinite(r))return 1}return e<t?-1:+(e>t)}function it(e,t){let n=e.split(`/`),r=t.split(`/`),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=rt(n[e]??``,r[e]??``);if(t!==0)return t}return n.length-r.length}function at(e){let t=X(e.migrationsPattern,e.migrationsDir);return nt(e.migrationsPath,new J(t,{dot:!1}))}function ot(e,t){let n=[];for(let r of e)t.includes(r)||n.push(r);return n}function st(e){let t=at(e).map(e=>Q(e)).filter(e=>Number.isFinite(e));return Math.max(...t,0)+1}function ct(e){if(nt(e.migrationsPath,new J(`*/migration.sql`,{dot:!1})).length!==0)return Y(`${e.migrationsDir}/*/migration.sql`)}function lt(e){let t=``,n,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=e[a+1];if(n!==void 0){t+=o,o===n&&(s===n?(t+=s,a++):n=void 0);continue}if(r){o===`\r`&&s===`
|
|
9
|
+
`?(t+=`
|
|
10
|
+
`,a++,r=!1):(t+=o,r=o!==`
|
|
11
|
+
`);continue}if(i){o===`\r`&&s===`
|
|
12
|
+
`?(t+=`
|
|
13
|
+
`,a++):(t+=o,o===`*`&&s===`/`&&(t+=s,a++,i=!1));continue}if(o===`-`&&s===`-`){t+=`--`,a++,r=!0;continue}if(o===`/`&&s===`*`){t+=`/*`,a++,i=!0;continue}if(o===`'`||o===`"`||o==="`"){t+=o,n=o;continue}if(o===`[`){t+=o,n=`]`;continue}if(o===`\r`&&s===`
|
|
14
|
+
`){t+=`
|
|
15
|
+
`,a++;continue}t+=o}return t}function ut({migrationsPath:e,migrationName:t,migrationsTableName:n}){return`${_.readFileSync(v.join(e,t),`utf8`)}
|
|
16
|
+
INSERT INTO ${Z(n)} (name)
|
|
17
|
+
values ('${t.replace(/'/g,`''`)}');`}function dt(e){return e.option(`dir`,{type:`string`,description:`Directory containing migration files (default: ./migrations)`}).option(`pattern`,{type:`string`,description:`Glob for discovering migration files under --dir. Defaults to "<dir>/*.sql"; Drizzle's nested layout uses "<dir>/*/migration.sql"`})}function ft(e){return dt(e).option(`table`,{type:`string`,description:`Table recording applied migrations`,default:`d1_migrations`})}async function $(e,t,n,r,i,a=!1){return s(i,async()=>{let i={account_id:t,database_id:n,body:{sql:lt(r)}};return a?((await e.d1.raw(i))?.result??[]).map(e=>{let t=e.results?.columns??[],n=e.results?.rows??[];return{...e,results:n.map(e=>Object.fromEntries(t.map((t,n)=>[t,e[n]])))}}):(await e.d1.query(i))?.result??[]})}async function pt(r){if(!t(r.database))throw Error(`Expected a D1 database ID, but received <database>=${JSON.stringify(r.database)}. Database names and binding names are not accepted.`);let a=tt({dir:r.dir,pattern:r.pattern,table:r.table});if(!_.existsSync(a.migrationsPath))throw Error(`No migrations directory at ${a.migrationsPath}.`+(r.dir===void 0?` Pass --dir to point at one.`:``));return{client:await i(r),accountId:r.local?e:await n(),databaseId:r.database,config:a,local:r.local===!0}}async function mt(e){let{client:t,accountId:n,databaseId:r,config:i}=e;await $(t,n,r,$e(i.migrationsTableName),`Preparing`,e.local);let a=(await $(t,n,r,et(i.migrationsTableName),`Loading`,e.local))[0].results.map(e=>e.name),o=at(i);if(o.length===0){let e=ct(i);e!==void 0&&process.stderr.write(`No files matched --pattern "${i.migrationsPattern}", but "${e}" does match. If an ORM such as drizzle manages your migrations, pass --pattern "${e}".\n`)}return{applied:a,all:o,unapplied:ot(o,a)}}function ht(e){return ft(e.positional(`database`,{type:`string`,description:`D1 database ID`,demandOption:!0}))}const gt={command:`apply <database>`,describe:`Apply any unapplied D1 migrations`,builder:ht,handler:async e=>{let t=await pt(e),n=(await mt(t)).unapplied.map(e=>({name:e,status:`🕒️`}));if(n.length===0){a([],{successLabel:`No migrations to apply`,quiet:e.quiet});return}if(await h(`About to apply ${n.length} migration(s)\nYour database may not be available to serve requests during the migration, continue?`)){for(let e of n){let n=ut({migrationsPath:t.config.migrationsPath,migrationName:e.name,migrationsTableName:t.config.migrationsTableName}),r=!0,i=[];try{let i=await $(t.client,t.accountId,t.databaseId,n,`Applying ${e.name}`,t.local);for(let e of i)e.success||(r=!1)}catch(e){r=!1,i=[e instanceof Error?e.message:String(e)]}if(e.status=r?`✅`:`❌`,i.length>0)throw Error(i.join(`
|
|
18
|
+
`))}a(n,{quiet:e.quiet})}}};function _t(e){return dt(e.positional(`message`,{type:`string`,description:`Describes what the migration does`,demandOption:!0}))}const vt={command:`create <message>`,describe:`Create a new empty D1 migration file`,builder:_t,handler:async e=>{if(e.local)throw Error("--local is not supported with `cf d1 migrations create`. This command only creates a migration file on your local filesystem, so you do not need --local.");let t=tt({dir:e.dir,pattern:e.pattern}),n=yt(st(t),4),r=e.message.replaceAll(` `,`_`);if(/[\\/]/.test(r))throw Error(`The migration name ${JSON.stringify(e.message)} contains a path separator ("/" or "\\"). Remove it and try again.`);let i=`${n}_${r}.sql`,o=Y(`${t.migrationsDir}/${i}`);if(!new J(t.migrationsPattern,{dot:!1}).match(o))throw Error(`Would create "${o}", but --pattern "${t.migrationsPattern}" would not match it, so \`cf d1 migrations apply\` would skip it.\n\`cf d1 migrations create\` only writes top-level files inside --dir. If you are using an ORM like Drizzle, use \`drizzle-kit generate\` instead — it writes the nested layout your pattern expects.`);if(!_.existsSync(t.migrationsPath)){if(!await h(`No migrations folder found.\nOk to create ${t.migrationsPath}?`))throw Error(`No migrations folder present at ${t.migrationsPath}.`);_.mkdirSync(t.migrationsPath,{recursive:!0})}let s=v.join(t.migrationsPath,i);_.writeFileSync(s,`-- Migration number: ${n} \t ${new Date().toISOString()}\n`),a({name:i,path:s},{successLabel:`Created ${i}`,quiet:e.quiet})}};function yt(e,t){let n=e.toString();for(;n.length<t;)n=`0`+n;return n}function bt(e){return ft(e.positional(`database`,{type:`string`,description:`D1 database ID`,demandOption:!0}))}const xt={command:`list <database>`,describe:`View a list of unapplied migration files`,builder:bt,handler:async e=>{let{unapplied:t}=await mt(await pt(e));a(t.map(e=>({Name:e})),{quiet:e.quiet})}},St={command:`migrations`,describe:`Create, list, and apply D1 database migrations`,builder:e=>e.command(gt).command(vt).command(xt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Ct(e){return e.option(`jurisdiction`,{type:`string`,description:`Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored.`,choices:[`eu`,`fedramp`,`us`]}).option(`name`,{type:`string`,description:`D1 database name.`}).option(`primary-location-hint`,{type:`string`,description:`Specify the region to create the D1 primary, if available. If this option is omitted, the D1 will be created as close as possible to the current user.`,choices:[`wnam`,`enam`,`weur`,`eeur`,`apac`,`oc`]}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`read-replication-mode`].some(t=>e[t]!==void 0)){let t=[`read-replication-mode`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --read_replication-* flag is set`)}return!0})}const wt={command:`create`,describe:`Returns the created D1 database.`,builder:Ct,handler:async t=>{if(t.dryRun){o({command:`cf d1 create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database`,pathParams:{},bodyKind:`json`,body:t.body===void 0?u({jurisdiction:d(t.jurisdiction,`jurisdiction`,`text`),name:d(t.name,`name`,`text`),primary_location_hint:d(t[`primary-location-hint`],`primary-location-hint`,`text`),read_replication:{mode:d(t[`read-replication-mode`],`read-replication-mode`,`text`)}}):c(t.body)});return}let l=await i(t),p=t.local?e:await n();if(t.accountId=p,t.body){let e=c(t.body);a(await s(`Creating`,async()=>l.d1.create({...e,account_id:p})),{successLabel:`Created`});return}t.name===void 0&&(t.name=await f(`name`,`D1 database name.`));let m=u({jurisdiction:d(t.jurisdiction,`jurisdiction`,`text`),name:d(t.name,`name`,`text`),primary_location_hint:d(t[`primary-location-hint`],`primary-location-hint`,`text`),read_replication:{mode:d(t[`read-replication-mode`],`read-replication-mode`,`text`)}});a(await s(`Creating`,async()=>l.d1.create({...m,account_id:p})),{successLabel:`Created`})}};function Tt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const Et={command:`delete <database-id>`,describe:`Deletes the specified D1 database.`,builder:Tt,handler:async t=>{if(t.dryRun){o({command:`cf d1 delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`none`});return}let c=await i(t),l=t.local?e:await n();if(t.accountId=l,!await m({force:!!t.force})){process.stderr.write(`Aborted.
|
|
19
|
+
`);return}a(await s(`Deleting`,async()=>c.d1.delete({account_id:l,database_id:t[`database-id`]})),{successLabel:`Deleted`})}};function Dt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).check(e=>{if([`read-replication-mode`].some(t=>e[t]!==void 0)){let t=[`read-replication-mode`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --read_replication-* flag is set`)}return!0})}const Ot={command:`edit <database-id>`,describe:`Updates partially the specified D1 database.`,builder:Dt,handler:async t=>{if(t.dryRun){o({command:`cf d1 edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`json`,body:t.body===void 0?u({read_replication:{mode:d(t[`read-replication-mode`],`read-replication-mode`,`text`)}}):c(t.body)});return}let l=await i(t),f=t.local?e:await n();if(t.accountId=f,t.body){let e=c(t.body);a(await s(`Updating`,async()=>l.d1.edit({...e,account_id:f,database_id:t[`database-id`]})),{successLabel:`Updated`});return}let p=u({read_replication:{mode:d(t[`read-replication-mode`],`read-replication-mode`,`text`)}});a(await s(`Updating`,async()=>l.d1.edit({...p,account_id:f,database_id:t[`database-id`]})),{successLabel:`Updated`})}};function kt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`current-bookmark`,{type:`string`,description:`To poll an in-progress export, provide the current bookmark (returned by your first polling response)`}).option(`dump-options-no-data`,{type:`boolean`,description:`Export only the table definitions, not their contents`}).option(`dump-options-no-schema`,{type:`boolean`,description:`Export only each table's contents, not its definition`}).option(`dump-options-tables`,{type:`string`,array:!0,description:`Filter the export to just one or more tables. Passing an empty array is the same as not passing anything and means: export all tables.`}).option(`output-format`,{type:`string`,description:`Specifies that you will poll this endpoint until the export completes`,choices:[`polling`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const At={command:`export <database-id>`,describe:`Returns a URL where the SQL contents of your D1 can be downloaded. Note: this process may take some time for larger DBs, during which your D1 will be unavailable to serve queries. To avoid blocking your DB unnecessarily, an in-progress export must be continually polled or will automatically cancel.`,builder:kt,handler:async t=>{if(t.dryRun){o({command:`cf d1 export`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}/export`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`json`,body:t.body===void 0?u({current_bookmark:d(t[`current-bookmark`],`current-bookmark`,`text`),dump_options:{no_data:t[`dump-options-no-data`],no_schema:t[`dump-options-no-schema`],tables:t[`dump-options-tables`]},output_format:d(t[`output-format`],`output-format`,`text`)}):c(t.body)});return}let l=await i(t),f=t.local?e:await n();if(t.accountId=f,t.body){let e=c(t.body);a(await s(`Loading`,async()=>l.d1.export({...e,account_id:f,database_id:t[`database-id`]})),{successLabel:`Loaded`});return}t[`output-format`]===void 0&&(t[`output-format`]=await p(`output-format`,`Specifies that you will poll this endpoint until the export completes`,[`polling`]));let m=u({current_bookmark:d(t[`current-bookmark`],`current-bookmark`,`text`),dump_options:{no_data:t[`dump-options-no-data`],no_schema:t[`dump-options-no-schema`],tables:t[`dump-options-tables`]},output_format:d(t[`output-format`],`output-format`,`text`)});a(await s(`Loading`,async()=>l.d1.export({...m,account_id:f,database_id:t[`database-id`]})),{successLabel:`Loaded`})}};function jt(e){return e.positional(`database-id`,{type:`string`,description:`Database ID`,demandOption:!0}).option(`fields`,{type:`string`,description:`Comma-separated list of fields to include in the response. When omitted,
|
|
20
|
+
all fields are returned.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Mt={command:`get <database-id>`,describe:`Returns the specified D1 database.`,builder:g(jt),handler:async t=>{let c={fields:t.fields};if(t.dryRun){o({command:`cf d1 get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}`,pathParams:{"database-id":String(t[`database-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(t),u=t.local?e:await n();t.accountId=u,a(await s(`Loading`,async()=>l.d1.get({account_id:u,database_id:t[`database-id`],...c})),{successLabel:`Loaded`})}};function Nt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`action`,{type:`string`,description:`Indicates you have a new SQL file to upload.`,choices:[`init`,`ingest`,`poll`]}).option(`etag`,{type:`string`,description:`Required when action is 'init' or 'ingest'. An md5 hash of the file you're uploading. Used to check if it already exists, and validate its contents before ingesting.`}).option(`filename`,{type:`string`,description:`The filename you have successfully uploaded.`}).option(`current-bookmark`,{type:`string`,description:`This identifies the currently-running import, checking its status.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`etag`,[`current-bookmark`]).conflicts(`filename`,[`current-bookmark`]).implies(`filename`,[`etag`]).conflicts(`current-bookmark`,[`etag`,`filename`])}const Pt={command:`import <database-id>`,describe:`Generates a temporary URL for uploading an SQL file to, then instructing the D1 to import it and polling it for status updates. Imports block the D1 for their duration.`,builder:Nt,handler:async t=>{if(t.dryRun){o({command:`cf d1 import`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}/import`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`json`,body:t.body===void 0?u({action:d(t.action,`action`,`text`),etag:d(t.etag,`etag`,`text`),filename:d(t.filename,`filename`,`text`),current_bookmark:d(t[`current-bookmark`],`current-bookmark`,`text`)}):c(t.body)});return}let l=await i(t),f=t.local?e:await n();if(t.accountId=f,t.body){let e=c(t.body);a(await s(`Creating`,async()=>l.d1.import({body:e,account_id:f,database_id:t[`database-id`]})),{successLabel:`Created`});return}t.action===void 0&&(t.action=await p(`action`,`Indicates you have a new SQL file to upload.`,[`init`,`ingest`,`poll`]));let m=u({action:d(t.action,`action`,`text`),etag:d(t.etag,`etag`,`text`),filename:d(t.filename,`filename`,`text`),current_bookmark:d(t[`current-bookmark`],`current-bookmark`,`text`)});a(await s(`Creating`,async()=>l.d1.import({body:m,account_id:f,database_id:t[`database-id`]})),{successLabel:`Created`})}};function Ft(e){return e.option(`name`,{type:`string`,description:`a database name to search for.`}).option(`page`,{type:`number`,description:`Page number of paginated results.`}).option(`per-page`,{type:`number`,description:`Number of items per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const It={command:`list`,describe:`Returns a list of D1 databases.`,builder:Ft,handler:async t=>{let c={name:t.name,page:t.page,per_page:t[`per-page`]};if(t.dryRun){o({command:`cf d1 list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database`,pathParams:{},query:c,bodyKind:`none`});return}let l=await i(t),u=t.local?e:await n();t.accountId=u,a(await s(`Loading`,async()=>l.d1.list({account_id:u,...c})),{successLabel:`Loaded`})}};function Lt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`params`,{type:`string`,array:!0,description:`The params field`}).option(`sql`,{type:`string`,description:`Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch.`}).option(`batch`,{type:`string`,description:`The batch 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:`A single query object or a batch query object`}).conflicts(`params`,[`batch`]).conflicts(`sql`,[`batch`]).conflicts(`batch`,[`params`,`sql`])}const Rt={command:`query <database-id>`,describe:`Returns the query result as an object.`,builder:Lt,handler:async t=>{if(t.dryRun){o({command:`cf d1 query`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}/query`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`json`,body:t.body===void 0?u({params:t.params,sql:d(t.sql,`sql`,`text`),batch:l(t.batch,`batch`)}):c(t.body)});return}let f=await i(t),p=t.local?e:await n();if(t.accountId=p,t.body){let e=c(t.body);a(await s(`Loading`,async()=>f.d1.query({body:e,account_id:p,database_id:t[`database-id`]})),{successLabel:`Loaded`});return}let m=u({params:t.params,sql:d(t.sql,`sql`,`text`),batch:l(t.batch,`batch`)});a(await s(`Loading`,async()=>f.d1.query({body:m,account_id:p,database_id:t[`database-id`]})),{successLabel:`Loaded`})}};function zt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`params`,{type:`string`,array:!0,description:`The params field`}).option(`sql`,{type:`string`,description:`Your SQL query. Supports multiple statements, joined by semicolons, which will be executed as a batch.`}).option(`batch`,{type:`string`,description:`The batch 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:`A single query object or a batch query object`}).conflicts(`params`,[`batch`]).conflicts(`sql`,[`batch`]).conflicts(`batch`,[`params`,`sql`])}const Bt={command:`raw <database-id>`,describe:`Returns the query result rows as arrays rather than objects. This is a performance-optimized version of the /query endpoint.`,builder:zt,handler:async t=>{if(t.dryRun){o({command:`cf d1 raw`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}/raw`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`json`,body:t.body===void 0?u({params:t.params,sql:d(t.sql,`sql`,`text`),batch:l(t.batch,`batch`)}):c(t.body)});return}let f=await i(t),p=t.local?e:await n();if(t.accountId=p,t.body){let e=c(t.body);a(await s(`Loading`,async()=>f.d1.raw({body:e,account_id:p,database_id:t[`database-id`]})),{successLabel:`Loaded`});return}let m=u({params:t.params,sql:d(t.sql,`sql`,`text`),batch:l(t.batch,`batch`)});a(await s(`Loading`,async()=>f.d1.raw({body:m,account_id:p,database_id:t[`database-id`]})),{successLabel:`Loaded`})}};function Vt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`timestamp`,{type:`string`,description:`An optional ISO 8601 timestamp. If provided, returns the nearest available bookmark at or before this timestamp. If omitted, returns the current bookmark.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ht={command:`get-bookmark <database-id>`,describe:`Retrieves the current bookmark, or the nearest bookmark at or before a provided timestamp. Bookmarks can be used with the restore endpoint to revert the database to a previous point in time.`,builder:Vt,handler:async t=>{let c={timestamp:t.timestamp};if(t.dryRun){o({command:`cf d1 time-travel get-bookmark`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}/time_travel/bookmark`,pathParams:{"database-id":String(t[`database-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(t),u=t.local?e:await n();t.accountId=u,a(await s(`Loading`,async()=>l.d1.timeTravel.getBookmark({account_id:u,database_id:t[`database-id`],...c})),{successLabel:`Loaded`})}};function Ut(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`bookmark`,{type:`string`,description:"A bookmark to restore the database to. Required if `timestamp` is not provided."}).option(`timestamp`,{type:`string`,description:"An ISO 8601 timestamp to restore the database to. Required if `bookmark` is not provided."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Wt={command:`restore <database-id>`,describe:`Restores a D1 database to a previous point in time either via a bookmark or a timestamp.`,builder:Ut,handler:async t=>{let c={bookmark:t.bookmark,timestamp:t.timestamp};if(t.dryRun){o({command:`cf d1 time-travel restore`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}/time_travel/restore`,pathParams:{"database-id":String(t[`database-id`]??``)},query:c,bodyKind:`none`});return}let l=await i(t),u=t.local?e:await n();t.accountId=u,a(await s(`Creating`,async()=>l.d1.timeTravel.restore({account_id:u,database_id:t[`database-id`],...c})),{successLabel:`Created`})}},Gt={command:`time-travel`,describe:`use specific point-in-time backups of your D1 database`,builder:e=>e.command(Ht).command(Wt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function Kt(e){return e.positional(`database-id`,{type:`string`,description:`D1 database identifier (UUID).`,demandOption:!0}).option(`read-replication-mode`,{type:`string`,description:`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,choices:[`auto`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const qt={command:`update <database-id>`,describe:`Updates the specified D1 database.`,builder:Kt,handler:async t=>{if(t.dryRun){o({command:`cf d1 update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await r()??`<account-id>`}/d1/database/${t[`database-id`]==null?`<database-id>`:encodeURIComponent(String(t[`database-id`]))}`,pathParams:{"database-id":String(t[`database-id`]??``)},bodyKind:`json`,body:t.body===void 0?u({read_replication:{mode:d(t[`read-replication-mode`],`read-replication-mode`,`text`)}}):c(t.body)});return}let l=await i(t),f=t.local?e:await n();if(t.accountId=f,t.body){let e=c(t.body);a(await s(`Updating`,async()=>l.d1.update({...e,account_id:f,database_id:t[`database-id`]})),{successLabel:`Updated`});return}t[`read-replication-mode`]===void 0&&(t[`read-replication-mode`]=await p(`read-replication-mode`,`The read replication mode for the database. Use 'auto' to create replicas and allow D1 automatically place them around the world, or 'disabled' to not use any database replicas (it can take a few hours for all replicas to be deleted).`,[`auto`,`disabled`]));let m=u({read_replication:{mode:d(t[`read-replication-mode`],`read-replication-mode`,`text`)}});a(await s(`Updating`,async()=>l.d1.update({...m,account_id:f,database_id:t[`database-id`]})),{successLabel:`Updated`})}},Jt={command:`d1`,describe:`D1 is Cloudflare's managed, serverless database with SQLite's SQL semantics, built-in disaster recovery, and Worker and HTTP API access.`,builder:e=>e.command(wt).command(Et).command(Ot).command(At).command(Mt).command(Pt).command(It).command(Rt).command(Bt).command(qt).command(St).command(Gt).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Jt 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}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.positional(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`check-instances`,{type:`string`,array:!0,description:`A list of finding instance IDs to pass along.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for bulk actions on finding instances.`})}const g={command:`archiveFindingInstance <finding-id>`,describe:`Archive one or more finding instances.`,builder:h,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture archiveFindingInstance`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${c[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(c[`finding-id`]))}/instances/archive`,pathParams:{"finding-id":String(c[`finding-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({check_instances:c[`check-instances`]}):s(c.body)});return}let u=await r(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=s(c.body);i(await o(`Creating`,async()=>u.dataSecurity.posture.archiveFindingInstance({body:e,account_id:d,finding_id:c[`finding-id`]})),{successLabel:`Created`});return}if(c[`check-instances`]===void 0)throw Error(`--check-instances is required (or pass --body with this field set).`);let f=l({check_instances:c[`check-instances`]});i(await o(`Creating`,async()=>u.dataSecurity.posture.archiveFindingInstance({body:f,account_id:d,finding_id:c[`finding-id`]})),{successLabel:`Created`})}};function ee(e){return e.positional(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`new-severity`,{type:`number`,description:`The numeric severity value to apply to the finding.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for updating a finding's severity.`})}const _={command:`changeFindingSeverity <finding-id>`,describe:"Update the severity of a Finding. This will update the `severity_override` field on the Finding payload with the new severity value.",builder:ee,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture changeFindingSeverity`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${c[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(c[`finding-id`]))}/tune_finding_severity`,pathParams:{"finding-id":String(c[`finding-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({new_severity:c[`new-severity`]}):s(c.body)});return}let u=await r(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=s(c.body);i(await o(`Creating`,async()=>u.dataSecurity.posture.changeFindingSeverity({...e,account_id:d,finding_id:c[`finding-id`]})),{successLabel:`Created`});return}if(c[`new-severity`]===void 0)throw Error(`--new-severity is required (or pass --body with this field set).`);let f=l({new_severity:c[`new-severity`]});i(await o(`Creating`,async()=>u.dataSecurity.posture.changeFindingSeverity({...f,account_id:d,finding_id:c[`finding-id`]})),{successLabel:`Created`})}};function v(e){return e.option(`dlp-profile-id`,{type:`string`,array:!0,description:`Filter by DLP profile IDs.`}).option(`dlp-profile-information`,{type:`string`,description:`DLP profile metadata for the export. Provide as a JSON array of objects or @path/to/file.json.`}).option(`integration-id`,{type:`string`,array:!0,description:`Filter by integration IDs.`}).option(`max-affliction-date`,{type:`string`,description:`Filter to view content flagged on or before this date.`}).option(`min-affliction-date`,{type:`string`,description:`Filter to view content flagged on or after this date.`}).option(`orders`,{type:`string`,description:`Ordering specifications for the export. Provide as a JSON array of objects or @path/to/file.json.`}).option(`search`,{type:`string`,description:`Search term to filter content.`}).option(`vendors`,{type:`string`,array:!0,description:`Filter by vendor types.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating content exports.`})}const y={command:`createContentExport`,describe:`Creates a CSV export for content and accepts optional filters in the payload.`,builder:v,handler:async d=>{if(d.dryRun){a({command:`cf data-security posture createContentExport`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/content/export`,pathParams:{},bodyKind:`json`,body:d.body===void 0?l({dlp_profile_id:d[`dlp-profile-id`],dlp_profile_information:c(d[`dlp-profile-information`],`dlp-profile-information`),integration_id:d[`integration-id`],max_affliction_date:u(d[`max-affliction-date`],`max-affliction-date`,`text`),min_affliction_date:u(d[`min-affliction-date`],`min-affliction-date`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`),vendors:d.vendors}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.dataSecurity.posture.createContentExport({...e,account_id:p})),{successLabel:`Created`});return}if(d[`dlp-profile-information`]===void 0)throw Error(`--dlp-profile-information is required (or pass --body with this field set).`);let m=l({dlp_profile_id:d[`dlp-profile-id`],dlp_profile_information:c(d[`dlp-profile-information`],`dlp-profile-information`),integration_id:d[`integration-id`],max_affliction_date:u(d[`max-affliction-date`],`max-affliction-date`,`text`),min_affliction_date:u(d[`min-affliction-date`],`min-affliction-date`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`),vendors:d.vendors});i(await o(`Creating`,async()=>f.dataSecurity.posture.createContentExport({...m,account_id:p})),{successLabel:`Created`})}};function b(e){return e.option(`ignored`,{type:`boolean`,description:`Filter for only the ignored findings. Set to false to only see active items.`}).option(`integration-id`,{type:`string`,array:!0,description:`Filter by multiple integration IDs.`}).option(`max-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or before the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`min-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or after the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`orders`,{type:`string`,description:`Which fields to use when ordering the findings. Provide as a JSON array of objects or @path/to/file.json.`}).option(`search`,{type:`string`,description:`A search term.`}).option(`severities`,{type:`string`,array:!0,description:`Filter by severity levels.`}).option(`vendors`,{type:`string`,array:!0,description:`Filter by vendor types.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Filter specification for findings export jobs.`})}const x={command:`createFindingExportCSV`,describe:`Creates a CSV export for findings and accepts optional filters in the payload.`,builder:b,handler:async d=>{if(d.dryRun){a({command:`cf data-security posture createFindingExportCSV`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/export`,pathParams:{},bodyKind:`json`,body:d.body===void 0?l({ignored:d.ignored,integration_id:d[`integration-id`],max_affliction_date:u(d[`max-affliction-date`],`max-affliction-date`,`text`),min_affliction_date:u(d[`min-affliction-date`],`min-affliction-date`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`),severities:d.severities,vendors:d.vendors}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.dataSecurity.posture.createFindingExportCsv({...e,account_id:p})),{successLabel:`Created`});return}let m=l({ignored:d.ignored,integration_id:d[`integration-id`],max_affliction_date:u(d[`max-affliction-date`],`max-affliction-date`,`text`),min_affliction_date:u(d[`min-affliction-date`],`min-affliction-date`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`),severities:d.severities,vendors:d.vendors});i(await o(`Creating`,async()=>f.dataSecurity.posture.createFindingExportCsv({...m,account_id:p})),{successLabel:`Created`})}};function S(e){return e.positional(`storage-namespace-id`,{type:`string`,description:"A storage namespace identifier for the finding, used to scope finding instance exports. Constructed by base64-decoding the finding ID (which encodes `integration_id:finding_type_id`) and replacing the colon separator with a hyphen. For example, a finding ID that decodes to `00000000-0000-0000-0000-000000000001:00000000-0000-0000-0000-000000000002` becomes `00000000-0000-0000-0000-000000000001-00000000-0000-0000-0000-000000000002`.",demandOption:!0}).option(`archived`,{type:`boolean`,description:`Filter for archived status.`}).option(`max-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or before the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`min-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or after the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`orders`,{type:`string`,description:`Ordering specifications for the export. Provide as a JSON array of objects or @path/to/file.json.`}).option(`search`,{type:`string`,description:`A search term.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Filter specification for finding instance exports.`})}const C={command:`createFindingInstancesExportCSV <storage-namespace-id>`,describe:"Creates a CSV export for Finding instances and accepts optional filters in the payload. The `storage_namespace_id` path parameter is derived from the finding ID by base64-decoding it (which yields `integration_id:finding_type_id`) and replacing the colon with a hyphen.",builder:S,handler:async d=>{if(d.dryRun){a({command:`cf data-security posture createFindingInstancesExportCSV`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${d[`storage-namespace-id`]==null?`<storage-namespace-id>`:encodeURIComponent(String(d[`storage-namespace-id`]))}/instances/export`,pathParams:{"storage-namespace-id":String(d[`storage-namespace-id`]??``)},bodyKind:`json`,body:d.body===void 0?l({archived:d.archived,max_affliction_date:u(d[`max-affliction-date`],`max-affliction-date`,`text`),min_affliction_date:u(d[`min-affliction-date`],`min-affliction-date`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`)}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.dataSecurity.posture.createFindingInstancesExportCsv({...e,account_id:p,storage_namespace_id:d[`storage-namespace-id`]})),{successLabel:`Created`});return}let m=l({archived:d.archived,max_affliction_date:u(d[`max-affliction-date`],`max-affliction-date`,`text`),min_affliction_date:u(d[`min-affliction-date`],`min-affliction-date`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`)});i(await o(`Creating`,async()=>f.dataSecurity.posture.createFindingInstancesExportCsv({...m,account_id:p,storage_namespace_id:d[`storage-namespace-id`]})),{successLabel:`Created`})}};function w(e){return e.option(`applies-to-all-integrations`,{type:`boolean`,description:`When true, the policy applies to all integrations for the account. When false, integration_ids must be provided.`}).option(`description`,{type:`string`,description:`Optional description of what this policy does.`}).option(`display-name`,{type:`string`,description:`Display name for the policy configuration.`}).option(`enabled`,{type:`boolean`,description:`Boolean specifying if the policy is enabled or disabled.`}).option(`finding-type-id`,{type:`string`,description:`The finding type this policy is associated with. All remediation actions must match this finding type.`}).option(`integration-ids`,{type:`string`,array:!0,description:`The integrations this policy applies to. Required when applies_to_all_integrations is false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a new policy configuration.`})}const T={command:`createPolicy`,describe:`Creates a new policy configuration that defines automated actions to be executed when security findings are detected. A policy can include multiple remediation and/or webhook actions that will be triggered automatically.`,builder:w,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture createPolicy`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/policies`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({applies_to_all_integrations:c[`applies-to-all-integrations`],description:u(c.description,`description`,`text`),display_name:u(c[`display-name`],`display-name`,`text`),enabled:c.enabled,finding_type_id:u(c[`finding-type-id`],`finding-type-id`,`text`),integration_ids:c[`integration-ids`]}):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.dataSecurity.posture.createPolicy({...e,account_id:p})),{successLabel:`Created`});return}if(c[`applies-to-all-integrations`]===void 0)throw Error(`--applies-to-all-integrations is required (or pass --body with this field set).`);if(c[`display-name`]===void 0&&(c[`display-name`]=await d(`display-name`,`Display name for the policy configuration.`)),c.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);c[`finding-type-id`]===void 0&&(c[`finding-type-id`]=await d(`finding-type-id`,`The finding type this policy is associated with. All remediation actions must match this finding type.`));let m=l({applies_to_all_integrations:c[`applies-to-all-integrations`],description:u(c.description,`description`,`text`),display_name:u(c[`display-name`],`display-name`,`text`),enabled:c.enabled,finding_type_id:u(c[`finding-type-id`],`finding-type-id`,`text`),integration_ids:c[`integration-ids`]});i(await o(`Creating`,async()=>f.dataSecurity.posture.createPolicy({...m,account_id:p})),{successLabel:`Created`})}};function E(e){return e.option(`finding-instance-ids`,{type:`string`,array:!0,description:`UUIDs identifying Finding Instances.`}).option(`remediation-type-id`,{type:`string`,description:`A UUID identifying this Remediation Type.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating remediation jobs.`})}const D={command:`createRemediationJobs`,describe:`Create one or more remediation jobs tied to a specific Cloudflare Account.`,builder:E,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture createRemediationJobs`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/remediations/jobs`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({finding_instance_ids:c[`finding-instance-ids`],remediation_type_id:u(c[`remediation-type-id`],`remediation-type-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.dataSecurity.posture.createRemediationJobs({...e,account_id:p})),{successLabel:`Created`});return}if(c[`finding-instance-ids`]===void 0)throw Error(`--finding-instance-ids is required (or pass --body with this field set).`);c[`remediation-type-id`]===void 0&&(c[`remediation-type-id`]=await d(`remediation-type-id`,`A UUID identifying this Remediation Type.`));let m=l({finding_instance_ids:c[`finding-instance-ids`],remediation_type_id:u(c[`remediation-type-id`],`remediation-type-id`,`text`)});i(await o(`Creating`,async()=>f.dataSecurity.posture.createRemediationJobs({...m,account_id:p})),{successLabel:`Created`})}};function O(e){return e.option(`integration-id`,{type:`string`,array:!0,description:`Filter by multiple integration IDs.`}).option(`max-updated-at`,{type:`string`,description:`Filter to view remediation jobs updated on or before this datetime. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`min-updated-at`,{type:`string`,description:`Filter to view remediation jobs updated on or after this datetime. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`orders`,{type:`string`,description:`Ordering specifications for the export. Provide as a JSON array of objects or @path/to/file.json.`}).option(`search`,{type:`string`,description:`A search term.`}).option(`status`,{type:`string`,array:!0,description:`Filter by remediation job status.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Filter specification for remediation jobs export.`})}const k={command:`createRemediationJobsExportCSV`,describe:`Creates a CSV export for remediation jobs and accepts optional filters in the payload.`,builder:O,handler:async d=>{if(d.dryRun){a({command:`cf data-security posture createRemediationJobsExportCSV`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/remediations/jobs/export`,pathParams:{},bodyKind:`json`,body:d.body===void 0?l({integration_id:d[`integration-id`],max_updated_at:u(d[`max-updated-at`],`max-updated-at`,`text`),min_updated_at:u(d[`min-updated-at`],`min-updated-at`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`),status:d.status}):s(d.body)});return}let f=await r(d),p=d.local?e:await t();if(d.accountId=p,d.body){let e=s(d.body);i(await o(`Creating`,async()=>f.dataSecurity.posture.createRemediationJobsExportCsv({...e,account_id:p})),{successLabel:`Created`});return}let m=l({integration_id:d[`integration-id`],max_updated_at:u(d[`max-updated-at`],`max-updated-at`,`text`),min_updated_at:u(d[`min-updated-at`],`min-updated-at`,`text`),orders:c(d.orders,`orders`),search:u(d.search,`search`,`text`),status:d.status});i(await o(`Creating`,async()=>f.dataSecurity.posture.createRemediationJobsExportCsv({...m,account_id:p})),{successLabel:`Created`})}};function A(e){return e.option(`authentication-type`,{type:`string`,description:`Type of authentication used for the webhook.`,choices:[`Basic Auth`,`None`,`Bearer Auth`,`Static Headers`,`HMAC-Signing`]}).option(`destination-url`,{type:`string`,description:`Target URL for the webhook configuration. Where resulting data will be sent.`}).option(`headers`,{type:`string`,description:`List of custom headers to include in webhook requests. Provide as a JSON array of objects or @path/to/file.json.`}).option(`label`,{type:`string`,description:`Account-specified display label for the webhook configuration.`}).option(`signing-secret`,{type:`string`,description:`Secret key used for HMAC signing when authentication_type is "HMAC-Signing".`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating a new webhook configuration.`})}const j={command:`createWebhook`,describe:`Creates a new webhook configuration for sending finding notifications to external endpoints.`,builder:A,handler:async p=>{if(p.dryRun){a({command:`cf data-security posture createWebhook`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks`,pathParams:{},bodyKind:`json`,body:p.body===void 0?l({authentication_type:u(p[`authentication-type`],`authentication-type`,`text`),destination_url:u(p[`destination-url`],`destination-url`,`text`),headers:c(p.headers,`headers`),label:u(p.label,`label`,`text`),signing_secret:u(p[`signing-secret`],`signing-secret`,`text`)}):s(p.body)});return}let m=await r(p),h=p.local?e:await t();if(p.accountId=h,p.body){let e=s(p.body);i(await o(`Creating`,async()=>m.dataSecurity.posture.createWebhook({...e,account_id:h})),{successLabel:`Created`});return}p[`authentication-type`]===void 0&&(p[`authentication-type`]=await f(`authentication-type`,`Type of authentication used for the webhook.`,[`Basic Auth`,`None`,`Bearer Auth`,`Static Headers`,`HMAC-Signing`])),p[`destination-url`]===void 0&&(p[`destination-url`]=await d(`destination-url`,`Target URL for the webhook configuration. Where resulting data will be sent.`)),p.label===void 0&&(p.label=await d(`label`,`Account-specified display label for the webhook configuration.`));let g=l({authentication_type:u(p[`authentication-type`],`authentication-type`,`text`),destination_url:u(p[`destination-url`],`destination-url`,`text`),headers:c(p.headers,`headers`),label:u(p.label,`label`,`text`),signing_secret:u(p[`signing-secret`],`signing-secret`,`text`)});i(await o(`Creating`,async()=>m.dataSecurity.posture.createWebhook({...g,account_id:h})),{successLabel:`Created`})}};function M(e){return e.option(`finding-instance-ids`,{type:`string`,array:!0,description:`Array of finding instance IDs to send to the webhooks.`}).option(`webhook-ids`,{type:`string`,array:!0,description:`Array of webhook IDs to trigger jobs for.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for creating up to 100 webhook jobs. The number of jobs is the product of webhook_ids and finding_instance_ids.`})}const N={command:`createWebhookJobs`,describe:`Creates webhook jobs to send a finding instance to one or more configured webhooks.`,builder:M,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture createWebhookJobs`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks/jobs`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({finding_instance_ids:c[`finding-instance-ids`],webhook_ids:c[`webhook-ids`]}):s(c.body)});return}let u=await r(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=s(c.body);i(await o(`Creating`,async()=>u.dataSecurity.posture.createWebhookJobs({...e,account_id:d})),{successLabel:`Created`});return}if(c[`finding-instance-ids`]===void 0)throw Error(`--finding-instance-ids is required (or pass --body with this field set).`);if(c[`webhook-ids`]===void 0)throw Error(`--webhook-ids is required (or pass --body with this field set).`);let f=l({finding_instance_ids:c[`finding-instance-ids`],webhook_ids:c[`webhook-ids`]});i(await o(`Creating`,async()=>u.dataSecurity.posture.createWebhookJobs({...f,account_id:d})),{successLabel:`Created`})}};function P(e){return e.positional(`policy-id`,{type:`string`,description:`A UUID identifying the policy.`,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:`deletePolicy <policy-id>`,describe:`Deletes a policy configuration.`,builder:P,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture deletePolicy`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/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})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>c.dataSecurity.posture.deletePolicy({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Deleted`})}};function I(e){return e.positional(`webhook-id`,{type:`string`,description:`A UUID identifying the webhook configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const L={command:`deleteWebhook <webhook-id>`,describe:`Soft deletes a webhook configuration by its unique identifier. The webhook will be marked as deleted and will no longer be available for use.`,builder:I,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture deleteWebhook`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await p({force:!!s.force})){process.stderr.write(`Aborted.
|
|
4
|
+
`);return}i(await o(`Deleting`,async()=>c.dataSecurity.posture.deleteWebhook({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Deleted`})}};function R(e){return e.positional(`webhook-id`,{type:`string`,description:`A UUID identifying the webhook configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const z={command:`evaluateExistingWebhook <webhook-id>`,describe:`Sends a test webhook event using an existing webhook configuration. This allows customers to verify their webhook endpoint is still reachable and properly configured after creating the webhook resource. The test payload includes: - event_type: "webhook.test" - timestamp: Current UTC timestamp - message: Test message indicating this is from Cloudflare CASB - data: Object with test: true`,builder:R,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture evaluateExistingWebhook`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}/evaluate`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.dataSecurity.posture.evaluateExistingWebhook({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Created`})}};function B(e){return e.option(`authentication-type`,{type:`string`,description:`Type of authentication to use for the test webhook request.`,choices:[`Basic Auth`,`None`,`Bearer Auth`,`Static Headers`,`HMAC-Signing`]}).option(`destination-url`,{type:`string`,description:`Target URL to send the test webhook event to.`}).option(`headers`,{type:`string`,description:`List of custom headers to include in the test webhook request. Provide as a JSON array of objects or @path/to/file.json.`}).option(`signing-secret`,{type:`string`,description:`Secret key used for HMAC signing when authentication_type is "HMAC-Signing".`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for testing a webhook configuration before creating it.`})}const V={command:`evaluateNewWebhook`,describe:`Sends a test webhook event to the specified destination URL to verify the webhook endpoint is reachable and properly configured. This allows customers to validate their webhook configuration before creating the actual webhook resource. The test payload includes: - event_type: "webhook.test" - timestamp: Current UTC timestamp - message: Test message indicating this is from Cloudflare CASB - data: Object with test: true`,builder:B,handler:async p=>{if(p.dryRun){a({command:`cf data-security posture evaluateNewWebhook`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks/evaluate`,pathParams:{},bodyKind:`json`,body:p.body===void 0?l({authentication_type:u(p[`authentication-type`],`authentication-type`,`text`),destination_url:u(p[`destination-url`],`destination-url`,`text`),headers:c(p.headers,`headers`),signing_secret:u(p[`signing-secret`],`signing-secret`,`text`)}):s(p.body)});return}let m=await r(p),h=p.local?e:await t();if(p.accountId=h,p.body){let e=s(p.body);i(await o(`Creating`,async()=>m.dataSecurity.posture.evaluateNewWebhook({...e,account_id:h})),{successLabel:`Created`});return}p[`authentication-type`]===void 0&&(p[`authentication-type`]=await f(`authentication-type`,`Type of authentication to use for the test webhook request.`,[`Basic Auth`,`None`,`Bearer Auth`,`Static Headers`,`HMAC-Signing`])),p[`destination-url`]===void 0&&(p[`destination-url`]=await d(`destination-url`,`Target URL to send the test webhook event to.`));let g=l({authentication_type:u(p[`authentication-type`],`authentication-type`,`text`),destination_url:u(p[`destination-url`],`destination-url`,`text`),headers:c(p.headers,`headers`),signing_secret:u(p[`signing-secret`],`signing-secret`,`text`)});i(await o(`Creating`,async()=>m.dataSecurity.posture.evaluateNewWebhook({...g,account_id:h})),{successLabel:`Created`})}};function H(e){return e.positional(`id`,{type:`string`,description:`Unique identifier for the export job`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const U={command:`getExportJob <id>`,describe:`Retrieves a single export job by its unique identifier`,builder:H,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture getExportJob`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/exports/${s.id==null?`<id>`:encodeURIComponent(String(s.id))}`,pathParams:{id:String(s.id??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.dataSecurity.posture.getExportJob({account_id:l,id:s.id})),{successLabel:`Loaded`})}};function W(e){return e.positional(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const G={command:`getFinding <finding-id>`,describe:`Gets a security Finding that has been identified as being problematic.`,builder:W,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture getFinding`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${s[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(s[`finding-id`]))}`,pathParams:{"finding-id":String(s[`finding-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.dataSecurity.posture.getFinding({account_id:l,finding_id:s[`finding-id`]})),{successLabel:`Loaded`})}};function K(e){return e.positional(`instance-id`,{type:`string`,description:`A uuid ID identifying this Finding instance.`,demandOption:!0}).option(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const q={command:`getFindingInstance <instance-id>`,describe:`Gets a security Finding instance by id.`,builder:K,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture getFindingInstance`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${s[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(s[`finding-id`]))}/instances/${s[`instance-id`]==null?`<instance-id>`:encodeURIComponent(String(s[`instance-id`]))}`,pathParams:{"finding-id":String(s[`finding-id`]??``),"instance-id":String(s[`instance-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.dataSecurity.posture.getFindingInstance({account_id:l,finding_id:s[`finding-id`],instance_id:s[`instance-id`]})),{successLabel:`Loaded`})}};function J(e){return e.positional(`finding-type-id`,{type:`string`,description:`A UUID string identifying the finding type.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Y={command:`getFindingType <finding-type-id>`,describe:`Retrieve a specific finding type by its unique identifier.`,builder:J,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture getFindingType`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/finding_types/${s[`finding-type-id`]==null?`<finding-type-id>`:encodeURIComponent(String(s[`finding-type-id`]))}`,pathParams:{"finding-type-id":String(s[`finding-type-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.dataSecurity.posture.getFindingType({account_id:l,finding_type_id:s[`finding-type-id`]})),{successLabel:`Loaded`})}};function X(e){return e.positional(`policy-id`,{type:`string`,description:`The UUID of the policy configuration to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`getPolicyByID <policy-id>`,describe:`Retrieves the details of a specific policy configuration, including its associated remediation and webhook actions.`,builder:X,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture getPolicyByID`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/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.dataSecurity.posture.getPolicyById({account_id:l,policy_id:s[`policy-id`]})),{successLabel:`Loaded`})}};function Q(e){return e.positional(`finding-type-id`,{type:`string`,description:`A UUID string identifying the finding type.`,demandOption:!0}).option(`integration-id`,{type:`string`,description:`Filter by an integration ID`}).option(`cursor`,{type:`string`,description:`A cursor for pagination.`}).option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const te={command:`getRemediationTypesForFindingType <finding-type-id>`,describe:"List all remediation types for a given finding type. This endpoint supports both cursor and offset pagination. Note that `cursor` and `page` are mutually exclusive.",builder:Q,handler:async s=>{let c={integration_id:s[`integration-id`],cursor:s.cursor,page:s.page,per_page:s[`per-page`]};if(s.dryRun){a({command:`cf data-security posture getRemediationTypesForFindingType`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/finding_types/${s[`finding-type-id`]==null?`<finding-type-id>`:encodeURIComponent(String(s[`finding-type-id`]))}/remediation_types`,pathParams:{"finding-type-id":String(s[`finding-type-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.dataSecurity.posture.getRemediationTypesForFindingType({account_id:u,finding_type_id:s[`finding-type-id`],...c})),{successLabel:`Loaded`})}};function ne(e){return e.positional(`webhook-id`,{type:`string`,description:`A UUID identifying the webhook configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`getWebhookConfigByID <webhook-id>`,describe:`Retrieves a specific webhook configuration by its unique identifier.`,builder:ne,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture getWebhookConfigByID`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks/${s[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(s[`webhook-id`]))}`,pathParams:{"webhook-id":String(s[`webhook-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.dataSecurity.posture.getWebhookConfigById({account_id:l,webhook_id:s[`webhook-id`]})),{successLabel:`Loaded`})}};function ie(e){return e.option(`checks`,{type:`string`,array:!0,description:`A list of finding IDs to pass along.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for bulk actions on findings.`})}const ae={command:`ignoreFinding`,describe:`Given a list of findings, mark as ignored. Does nothing if Finding is already ignored.`,builder:ie,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture ignoreFinding`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/ignore`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({checks:c.checks}):s(c.body)});return}let u=await r(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=s(c.body);i(await o(`Creating`,async()=>u.dataSecurity.posture.ignoreFinding({body:e,account_id:d})),{successLabel:`Created`});return}if(c.checks===void 0)throw Error(`--checks is required (or pass --body with this field set).`);let f=l({checks:c.checks});i(await o(`Creating`,async()=>u.dataSecurity.posture.ignoreFinding({body:f,account_id:d})),{successLabel:`Created`})}};function oe(e){return e.option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`dlp-profile-id`,{type:`string`,description:`Filter by an DLP profile ID`}).option(`integration-id`,{type:`string`,description:`Filter by an integration ID`}).option(`max-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or before the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`min-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or after the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`order`,{type:`string`,description:`Which field to use when ordering content assets.`,choices:[`asset_name`,`dlp_profile_count`,`integration_name`,`latest_affliction_date`]}).option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`search`,{type:`string`,description:`A search term.`}).option(`vendor`,{type:`string`,description:`Filter by vendor`,choices:[`ANTHROPIC`,`AWS`,`BITBUCKET`,`BOX`,`CONFLUENCE`,`DROPBOX`,`GITHUB`,`GOOGLE_CLOUD_PLATFORM`,`GOOGLE_WORKSPACE`,`JIRA`,`MICROSOFT`,`MICROSOFT_INTERNAL`,`OPENAI`,`SALESFORCE`,`SERVICENOW`,`SLACK`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const se={command:`listContentAssets`,describe:`List DLP content findings`,builder:m(oe),handler:async s=>{let c={direction:s.direction,dlp_profile_id:s[`dlp-profile-id`],integration_id:s[`integration-id`],max_affliction_date:s[`max-affliction-date`],min_affliction_date:s[`min-affliction-date`],order:s.order,page:s.page,per_page:s[`per-page`],search:s.search,vendor:s.vendor};if(s.dryRun){a({command:`cf data-security posture listContentAssets`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/content`,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.dataSecurity.posture.listContentAssets({account_id:u,...c})),{successLabel:`Loaded`})}};function ce(e){return e.option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`status`,{type:`string`,description:`Filter on export job's status`,choices:[`Pending`,`Success`,`Failure`,`Rescheduled`,`In-Progress`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`listExportJobs`,describe:`List all export jobs for a given requestor's organization`,builder:m(ce),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],status:s.status};if(s.dryRun){a({command:`cf data-security posture listExportJobs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/exports`,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.dataSecurity.posture.listExportJobs({account_id:u,...c})),{successLabel:`Loaded`})}};function ue(e){return e.positional(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`archived`,{type:`boolean`,description:`Archived`}).option(`cursor`,{type:`string`,description:"A cursor for pagination. Obtained from the `result_info.cursor` field of a previous response."}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`max-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or before the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`min-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or after the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`order`,{type:`string`,description:`Which field to use when ordering the Finding's instances.
|
|
5
|
+
When ordering by 'remediation.status', only the most recent non-stale remediation job is considered. Stale jobs (created before the instance's affliction_date) are treated as having no status for ordering purposes.`,choices:[`affliction_date`,`asset.name`,`remediation.status`]}).option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`search`,{type:`string`,description:`A search term.`}).option(`remediation-statuses`,{type:`string`,description:`Filter finding instances by most recent remediation job status. Supports multiple comma-separated values.
|
|
6
|
+
Use 'none' to filter instances with no remediation jobs or instances where the most recent job is stale.
|
|
7
|
+
Note: Stale jobs (created before the instance's affliction_date) are ignored for filtering purposes, but are still included in the 'remediations' array with stale=true.`}).option(`finding-instance-ids`,{type:`string`,description:`Filter finding instances by an array of finding instance IDs. Supports multiple comma-separated values.`}).option(`asset-ids`,{type:`string`,description:`Filter finding instances by an array of asset IDs. Supports multiple comma-separated values.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const de={command:`listFindingInstances <finding-id>`,describe:`Lists all security finding instances for a given security finding.`,builder:m(ue),handler:async s=>{let c={archived:s.archived,cursor:s.cursor,direction:s.direction,max_affliction_date:s[`max-affliction-date`],min_affliction_date:s[`min-affliction-date`],order:s.order,page:s.page,per_page:s[`per-page`],search:s.search,remediation_statuses:s[`remediation-statuses`],finding_instance_ids:s[`finding-instance-ids`],asset_ids:s[`asset-ids`]};if(s.dryRun){a({command:`cf data-security posture listFindingInstances`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${s[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(s[`finding-id`]))}/instances`,pathParams:{"finding-id":String(s[`finding-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.dataSecurity.posture.listFindingInstances({account_id:u,finding_id:s[`finding-id`],...c})),{successLabel:`Loaded`})}};function fe(e){return e.option(`cursor`,{type:`string`,description:"A cursor for pagination. Obtained from the `result_info.cursor` field of a previous response."}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`ignored`,{type:`boolean`,description:`Filter for only the ignored findings. Set to false to only see "active" items`}).option(`integration-id`,{type:`string`,description:`Filter by an integration ID`}).option(`max-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or before the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`min-affliction-date`,{type:`string`,description:`Filter to view findings that occurred on or after the affliction date. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`observation`,{type:`string`,description:`Filter by observation type of the finding`,choices:[`Activity`,`Insight`,`Issue`]}).option(`order`,{type:`string`,description:`Which field to use when ordering the findings.`,choices:[`finding.name`,`instance_count`,`integration.name`,`latest_affliction_date`,`severity`]}).option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`product`,{type:`string`,description:`Filter by product category of the finding`,choices:[`Cloud`,`Saas`]}).option(`search`,{type:`string`,description:`A search term.`}).option(`severity`,{type:`string`,description:`Filter by severity`,choices:[`Critical`,`High`,`Medium`,`Low`]}).option(`type`,{type:`string`,description:`Filter by type of the finding`,choices:[`Content`,`Posture`]}).option(`vendor`,{type:`string`,description:`Filter by vendor`,choices:[`ANTHROPIC`,`AWS`,`BITBUCKET`,`BOX`,`CONFLUENCE`,`DROPBOX`,`GITHUB`,`GOOGLE_CLOUD_PLATFORM`,`GOOGLE_WORKSPACE`,`JIRA`,`MICROSOFT`,`MICROSOFT_INTERNAL`,`OPENAI`,`SALESFORCE`,`SERVICENOW`,`SLACK`]}).option(`finding-type-ids`,{type:`string`,description:`A comma separated list of UUIDs identifying the finding type(s).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const pe={command:`listFindings`,describe:`List all security findings that have been identified as being problematic. This will return a list of findings regardless if they have been ignored or not.`,builder:m(fe),handler:async s=>{let c={cursor:s.cursor,direction:s.direction,ignored:s.ignored,integration_id:s[`integration-id`],max_affliction_date:s[`max-affliction-date`],min_affliction_date:s[`min-affliction-date`],observation:s.observation,order:s.order,page:s.page,per_page:s[`per-page`],product:s.product,search:s.search,severity:s.severity,type:s.type,vendor:s.vendor,finding_type_ids:s[`finding-type-ids`]};if(s.dryRun){a({command:`cf data-security posture listFindings`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings`,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.dataSecurity.posture.listFindings({account_id:u,...c})),{successLabel:`Loaded`})}};function me(e){return e.option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`vendors`,{type:`string`,description:`Filter finding types by vendor. Supports multiple comma-separated values. Each value may be either the vendor enum (GOOGLE_WORKSPACE) or the friendly name returned by the read routes (Google Workspace).`}).option(`search`,{type:`string`,description:`Filter finding types by name or ID (case-insensitive substring match).`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const he={command:`listFindingTypes`,describe:`List all available finding types with pagination support.`,builder:m(me),handler:async s=>{let c={page:s.page,per_page:s[`per-page`],vendors:s.vendors,search:s.search};if(s.dryRun){a({command:`cf data-security posture listFindingTypes`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/finding_types`,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.dataSecurity.posture.listFindingTypes({account_id:u,...c})),{successLabel:`Loaded`})}};function ge(e){return e.option(`cursor`,{type:`string`,description:"Cursor for pagination. Obtained from the `result_info.cursor` field of a previous response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const _e={command:`listPolicies`,describe:`Returns a list of integration-scoped policy configurations for the given account. This endpoint supports cursor based pagination. By default, results are returned in sorted order based on created_at.`,builder:ge,handler:async s=>{let c={cursor:s.cursor};if(s.dryRun){a({command:`cf data-security posture listPolicies`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/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.dataSecurity.posture.listPolicies({account_id:u,...c})),{successLabel:`Loaded`})}};function ve(e){return e.option(`since`,{type:`string`,description:"Lower bound on the log entry timestamp. Accepts ISO 8601 / RFC3339 or epoch seconds. Defaults to 7 days before `until`. The window between `since` and `until` cannot exceed 180 days."}).option(`until`,{type:`string`,description:"Upper bound on the log entry timestamp. Accepts ISO 8601 / RFC3339 or epoch seconds. Defaults to the current time. Must be greater than or equal to `since`."}).option(`integration-id`,{type:`string`,description:`Comma-separated list of CASB integration IDs to filter by. At most 100 values, each at most 128 characters. Values outside the account's tenancy allowlist are silently ignored. When omitted, results are scoped to the full allowlist.`}).option(`policy-name`,{type:`string`,description:`Comma-separated list of policy display names to filter by. At most 100 values, each at most 255 characters.`}).option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ye={command:`listPolicyLogs`,describe:"Returns a list of policy invocation logs for the given account, sourced from ClickHouse via Ready Analytics. Each entry represents one execution of a policy against a finding instance, including the actions (remediation jobs and webhooks) it dispatched. Results are scoped to the requesting account's CASB integrations. The `integration_id` query parameter, when supplied, is intersected against the account's integration allowlist; values outside the allowlist are silently dropped. Pagination is offset-based. The response does not include a total row count; clients should treat a result with fewer than `per_page` entries as the end of the list.",builder:ve,handler:async s=>{let c={since:s.since,until:s.until,integration_id:s[`integration-id`],policy_name:s[`policy-name`],page:s.page,per_page:s[`per-page`]};if(s.dryRun){a({command:`cf data-security posture listPolicyLogs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/policies/logs`,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.dataSecurity.posture.listPolicyLogs({account_id:u,...c})),{successLabel:`Loaded`})}};function be(e){return e.option(`cursor`,{type:`string`,description:`A cursor for pagination.`}).option(`page`,{type:`number`,description:`A page number within the paginated result set.`}).option(`per-page`,{type:`number`,description:`Number of results to return per page.`}).option(`search`,{type:`string`,description:`A search term.`}).option(`min-updated-at`,{type:`string`,description:`Filter to view remediations updated on or after the min updated datetime. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`max-updated-at`,{type:`string`,description:`Filter to view remediations updated on or before the max updated datetime. Can be a date-time in ISO 8601 format or an epoch timestamp.`}).option(`status`,{type:`string`,description:`Filter to view remediations with the given status.`,choices:[`pending`,`processing`,`completed`,`failed`,`validating`]}).option(`triggered-by-actor`,{type:`string`,description:`Filter remediations by what kind of actor triggered them. Supports multiple comma-separated values.`}).option(`integration-id`,{type:`string`,description:`Filter by an integration ID`}).option(`order`,{type:`string`,description:`An optional param to sort the results by the given field.`,choices:[`created_at`,`affliction_date`,`integration_name`,`status`,`last_updated_at`,`asset_name`,`finding_type_name`]}).option(`direction`,{type:`string`,description:`Direction to order results.`,choices:[`asc`,`desc`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`listRemediationJobs`,describe:"List all remediation jobs tied to a specific Cloudflare Account. Note that `cursor` and `page` are mutually exclusive.",builder:m(be),handler:async s=>{let c={cursor:s.cursor,page:s.page,per_page:s[`per-page`],search:s.search,min_updated_at:s[`min-updated-at`],max_updated_at:s[`max-updated-at`],status:s.status,triggered_by_actor:s[`triggered-by-actor`],integration_id:s[`integration-id`],order:s.order,direction:s.direction};if(s.dryRun){a({command:`cf data-security posture listRemediationJobs`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/remediations/jobs`,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.dataSecurity.posture.listRemediationJobs({account_id:u,...c})),{successLabel:`Loaded`})}};function Se(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ce={command:`listWebhooks`,describe:`Retrieves all webhook configurations for the authenticated account. Returns an array of webhook configurations that can be used to send finding notifications.`,builder:Se,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture listWebhooks`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.dataSecurity.posture.listWebhooks({account_id:l})),{successLabel:`Loaded`})}};function we(e){return e.positional(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Te={command:`resetFindingSeverity <finding-id>`,describe:`If a Finding's severity has been changed, reset it back to default value. Does nothing if no override exists.`,builder:we,handler:async s=>{if(s.dryRun){a({command:`cf data-security posture resetFindingSeverity`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${s[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(s[`finding-id`]))}/reset_finding_severity`,pathParams:{"finding-id":String(s[`finding-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Creating`,async()=>c.dataSecurity.posture.resetFindingSeverity({account_id:l,finding_id:s[`finding-id`]})),{successLabel:`Created`})}};function Ee(e){return e.positional(`finding-id`,{type:`string`,description:`A base64-encoded ID identifying this Finding.`,demandOption:!0}).option(`check-instances`,{type:`string`,array:!0,description:`A list of finding instance IDs to pass along.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for bulk actions on finding instances.`})}const De={command:`unarchiveFindingInstance <finding-id>`,describe:`Remove the archive marking from one or more finding instances.`,builder:Ee,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture unarchiveFindingInstance`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/${c[`finding-id`]==null?`<finding-id>`:encodeURIComponent(String(c[`finding-id`]))}/instances/unarchive`,pathParams:{"finding-id":String(c[`finding-id`]??``)},bodyKind:`json`,body:c.body===void 0?l({check_instances:c[`check-instances`]}):s(c.body)});return}let u=await r(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=s(c.body);i(await o(`Creating`,async()=>u.dataSecurity.posture.unarchiveFindingInstance({body:e,account_id:d,finding_id:c[`finding-id`]})),{successLabel:`Created`});return}if(c[`check-instances`]===void 0)throw Error(`--check-instances is required (or pass --body with this field set).`);let f=l({check_instances:c[`check-instances`]});i(await o(`Creating`,async()=>u.dataSecurity.posture.unarchiveFindingInstance({body:f,account_id:d,finding_id:c[`finding-id`]})),{successLabel:`Created`})}};function $(e){return e.option(`checks`,{type:`string`,array:!0,description:`A list of finding IDs to pass along.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for bulk actions on findings.`})}const Oe={command:`unIgnoreFinding`,describe:`Ability to un-ignore a Finding if it's previously been ignored. Does nothing if the Finding is not ignored.`,builder:$,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture unIgnoreFinding`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/findings/unignore`,pathParams:{},bodyKind:`json`,body:c.body===void 0?l({checks:c.checks}):s(c.body)});return}let u=await r(c),d=c.local?e:await t();if(c.accountId=d,c.body){let e=s(c.body);i(await o(`Creating`,async()=>u.dataSecurity.posture.unIgnoreFinding({body:e,account_id:d})),{successLabel:`Created`});return}if(c.checks===void 0)throw Error(`--checks is required (or pass --body with this field set).`);let f=l({checks:c.checks});i(await o(`Creating`,async()=>u.dataSecurity.posture.unIgnoreFinding({body:f,account_id:d})),{successLabel:`Created`})}};function ke(e){return e.positional(`policy-id`,{type:`string`,description:`Policy configuration ID`,demandOption:!0}).option(`applies-to-all-integrations`,{type:`boolean`,description:`When true, the policy applies to all integrations for the account. When false, integration_ids must be provided.`}).option(`description`,{type:`string`,description:`Optional description of what this policy does.`}).option(`display-name`,{type:`string`,description:`Display name for the policy configuration.`}).option(`enabled`,{type:`boolean`,description:`Boolean specifying if the policy is enabled or disabled.`}).option(`integration-ids`,{type:`string`,array:!0,description:`The integrations this policy applies to. Required when applies_to_all_integrations is false.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for updating an existing policy configuration.`})}const Ae={command:`updatePolicy <policy-id>`,describe:`Updates an existing policy configuration and replaces its actions.`,builder:ke,handler:async c=>{if(c.dryRun){a({command:`cf data-security posture updatePolicy`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/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({applies_to_all_integrations:c[`applies-to-all-integrations`],description:u(c.description,`description`,`text`),display_name:u(c[`display-name`],`display-name`,`text`),enabled:c.enabled,integration_ids:c[`integration-ids`]}):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.dataSecurity.posture.updatePolicy({...e,account_id:p,policy_id:c[`policy-id`]})),{successLabel:`Updated`});return}if(c[`applies-to-all-integrations`]===void 0)throw Error(`--applies-to-all-integrations is required (or pass --body with this field set).`);if(c[`display-name`]===void 0&&(c[`display-name`]=await d(`display-name`,`Display name for the policy configuration.`)),c.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);let m=l({applies_to_all_integrations:c[`applies-to-all-integrations`],description:u(c.description,`description`,`text`),display_name:u(c[`display-name`],`display-name`,`text`),enabled:c.enabled,integration_ids:c[`integration-ids`]});i(await o(`Updating`,async()=>f.dataSecurity.posture.updatePolicy({...m,account_id:p,policy_id:c[`policy-id`]})),{successLabel:`Updated`})}};function je(e){return e.positional(`webhook-id`,{type:`string`,description:`A UUID identifying the webhook configuration.`,demandOption:!0}).option(`authentication-type`,{type:`string`,description:`Type of authentication used for the webhook.`,choices:[`Basic Auth`,`None`,`Bearer Auth`,`Static Headers`,`HMAC-Signing`]}).option(`destination-url`,{type:`string`,description:`Target URL for the webhook configuration. Where resulting data will be sent.`}).option(`headers`,{type:`string`,description:`List of custom headers to include in webhook requests. Provide as a JSON array of objects or @path/to/file.json.`}).option(`label`,{type:`string`,description:`Account-specified display label for the webhook configuration.`}).option(`signing-secret`,{type:`string`,description:`Secret key used for HMAC signing when authentication_type is "HMAC-Signing".`}).option(`status`,{type:`string`,description:`Status of the webhook configuration.`,choices:[`enabled`,`disabled`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Request body for updating an existing webhook configuration.`})}const Me={command:`updateWebhook <webhook-id>`,describe:`Updates an existing webhook configuration with new settings.`,builder:je,handler:async p=>{if(p.dryRun){a({command:`cf data-security posture updateWebhook`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/data-security/posture/webhooks/${p[`webhook-id`]==null?`<webhook-id>`:encodeURIComponent(String(p[`webhook-id`]))}`,pathParams:{"webhook-id":String(p[`webhook-id`]??``)},bodyKind:`json`,body:p.body===void 0?l({authentication_type:u(p[`authentication-type`],`authentication-type`,`text`),destination_url:u(p[`destination-url`],`destination-url`,`text`),headers:c(p.headers,`headers`),label:u(p.label,`label`,`text`),signing_secret:u(p[`signing-secret`],`signing-secret`,`text`),status:u(p.status,`status`,`text`)}):s(p.body)});return}let m=await r(p),h=p.local?e:await t();if(p.accountId=h,p.body){let e=s(p.body);i(await o(`Updating`,async()=>m.dataSecurity.posture.updateWebhook({...e,account_id:h,webhook_id:p[`webhook-id`]})),{successLabel:`Updated`});return}p[`authentication-type`]===void 0&&(p[`authentication-type`]=await f(`authentication-type`,`Type of authentication used for the webhook.`,[`Basic Auth`,`None`,`Bearer Auth`,`Static Headers`,`HMAC-Signing`])),p[`destination-url`]===void 0&&(p[`destination-url`]=await d(`destination-url`,`Target URL for the webhook configuration. Where resulting data will be sent.`)),p.label===void 0&&(p.label=await d(`label`,`Account-specified display label for the webhook configuration.`)),p.status===void 0&&(p.status=await f(`status`,`Status of the webhook configuration.`,[`enabled`,`disabled`]));let g=l({authentication_type:u(p[`authentication-type`],`authentication-type`,`text`),destination_url:u(p[`destination-url`],`destination-url`,`text`),headers:c(p.headers,`headers`),label:u(p.label,`label`,`text`),signing_secret:u(p[`signing-secret`],`signing-secret`,`text`),status:u(p.status,`status`,`text`)});i(await o(`Updating`,async()=>m.dataSecurity.posture.updateWebhook({...g,account_id:h,webhook_id:p[`webhook-id`]})),{successLabel:`Updated`})}},Ne={command:`posture`,describe:`Operations for posture`,builder:e=>e.command(g).command(_).command(y).command(x).command(C).command(T).command(D).command(k).command(j).command(N).command(F).command(L).command(z).command(V).command(U).command(G).command(q).command(Y).command(Z).command(te).command(re).command(ae).command(se).command(le).command(de).command(he).command(pe).command(_e).command(ye).command(xe).command(Ce).command(Te).command(Oe).command(De).command(Ae).command(Me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},Pe={command:`data-security`,describe:`data-security`,builder:e=>e.command(Ne).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Pe as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{h as e}from"./oauth-DuEONNgC.mjs";import{r as t}from"./auth-D3X9HYhD.mjs";import{t as n}from"./output-Ccqw2WOb.mjs";import{t as r}from"./dry-run-DL2V6yFm.mjs";import{t as i}from"./progress-BqQcF5QH.mjs";function a(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const o={command:`get`,describe:`Retrieve the account and zone specific unique identifier used as part of the CNAME target for DCV Delegation.`,builder:a,handler:async a=>{if(a.dryRun){r({command:`cf dcv-delegation get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${a.zone??a.zoneId??`<zone>`}/dcv_delegation/uuid`,pathParams:{"zone-id":String(a.zone??a[`zone-id`]??``)},bodyKind:`none`});return}let o=await t(a),s=await e({zone:a.zone},o,{quiet:a.quiet});a.zoneId=s,n(await i(`Loading`,async()=>o.dcvDelegation.get({zone_id:s})),{successLabel:`Loaded`})}},s={command:`dcv-delegation`,describe:`dcv-delegation`,builder:e=>e.command(o).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{s as default};
|
package/dist/delegate.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as e}from"node:module";import{existsSync as t,readFileSync as n,realpathSync as r}from"node:fs";import{dirname as i,resolve as a}from"node:path";import{constants as o}from"node:os";import{
|
|
2
|
+
import{createRequire as e}from"node:module";import{existsSync as t,readFileSync as n,realpathSync as r}from"node:fs";import{dirname as i,resolve as a}from"node:path";import{constants as o}from"node:os";import{fileURLToPath as s}from"node:url";import{spawn as c}from"node:child_process";const l=`CF_DELEGATION`;function u(r){if(r.env.CF_DELEGATION||_(r.ownPackageJsonPath))return null;let o;try{o=e(a(r.cwd,`package.json`)).resolve(`cf/package.json`)}catch{return null}if(r.ownPackageJsonPath&&g(o,r.ownPackageJsonPath))return null;let s;try{s=JSON.parse(n(o,`utf-8`))}catch{return null}let c=h(s.bin);if(!c)return null;let l=a(i(o),c);return t(l)?{packageJsonPath:o,binPath:l,version:typeof s.version==`string`?s.version:`unknown`}:null}async function d(e={}){let t=e.cwd??process.cwd(),n=e.argv??process.argv.slice(2),r=e.env??process.env,i=u({cwd:t,ownPackageJsonPath:e.ownPackageJsonPath===void 0?v():e.ownPackageJsonPath,env:r});return i?{delegated:!0,exitCode:await m(i.binPath,n,r)}:{delegated:!1}}async function f(){let e=process.argv.slice(2);return p(e)?{delegated:!1}:d({argv:e})}function p(e){return e.find(e=>!e.startsWith(`-`))===`complete`}function m(e,t,n){return new Promise((r,i)=>{let a=c(process.execPath,[e,...t],{stdio:[`inherit`,`inherit`,`inherit`,`ipc`],env:{...n,[l]:`1`}});a.on(`message`,e=>{process.send&&process.send(e)});let s=e=>()=>{a.kill(e)},u=s(`SIGINT`),d=s(`SIGTERM`);process.on(`SIGINT`,u),process.on(`SIGTERM`,d);let f=()=>{process.off(`SIGINT`,u),process.off(`SIGTERM`,d)};a.once(`exit`,(e,t)=>{f(),r(e===null?t?128+(o.signals[t]??1):0:e)}),a.once(`error`,e=>{f(),i(e)})})}function h(e){if(typeof e==`string`)return e;if(e&&typeof e==`object`){let t=e,n=t.cf;if(typeof n==`string`)return n;for(let e of Object.values(t))if(typeof e==`string`)return e}return null}function g(e,t){try{return r(e)===r(t)}catch{return a(e)===a(t)}}function _(e){return e?e.split(/[\\/]/).some(e=>e===`_npx`||e===`dlx`||e.startsWith(`dlx-`)):!1}function v(){let e=i(s(import.meta.url));for(;;){let n=a(e,`package.json`);if(t(n))return n;let r=i(e);if(r===e)return null;e=r}}export{l as DELEGATION_SENTINEL,f as maybeDelegateFromProcess,d as maybeDelegateToLocalInstall,u as resolveDelegateTarget};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{n as e,t}from"./shared-
|
|
2
|
+
import{n as e,t}from"./shared-BJvq4DkR.mjs";function n(t){return e(t).option(`dispatch-namespace`,{type:`string`,description:`Name of a dispatch namespace to deploy the Worker to (Workers for Platforms)`,requiresArg:!0})}const r={command:`deploy`,describe:`Deploy a worker to Cloudflare`,builder:n,handler:async e=>{await t(e,{command:`Deploy`})}};export{r as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{r as e}from"./build-D0FhOj40.mjs";import{existsSync as t,readFileSync as n,statSync as r}from"node:fs";import{dirname as i,join as a,sep as o}from"node:path";function s(){return{source:void 0,standard:{normalized:[],builtImages:[]},durableObjects:{builtImages:[]}}}const c={esm:`esm`,cjs:`commonjs`,python:`python`,"python-requirement":`python-requirement`,wasm:`compiled-wasm`,text:`text`,data:`buffer`,json:`text`};function l(e,t,n,r){let a=process.cwd(),o=t.main??``;return{entry:{file:o,projectRoot:a,configPath:e.configPath,format:`modules`,moduleRoot:o?i(o):e.bundleDir??``,exports:[]},name:e.config.name,compatibilityDate:t.compatibility_date,compatibilityFlags:t.compatibility_flags??[],assetsDir:m(e,t),main:t.main??void 0,keepVars:t.keep_vars??!1,dryRun:r[`dry-run`],env:void 0,outfile:void 0,tag:r.tag,message:r.message,secretsFile:r[`secrets-file`],experimentalAutoCreate:!0,accountId:n,sendMetrics:!1,resourcesProvision:!0,skipProvisioningConfigWriteback:!0,skipLastDeployedFromApiCheck:!1,containers:s(),cliVars:{},isWorkersSite:!1,useServiceEnvApiPath:!1}}function u(e,t,n,r){return{...l(e,t,n,r),command:`deploy`,containersRollout:void 0,triggers:t.triggers?.crons,routes:p(t),logpush:t.logpush,dispatchNamespace:r[`dispatch-namespace`],strict:!0,legacyAssetPaths:void 0,oldAssetTtl:void 0}}function d(e,t,n,r){return{...l(e,t,n,r),command:`versions upload`,strict:!0,previewAlias:r[`preview-alias`]}}function f(e,t,n,r){return{config:t,accountId:n,scriptName:t.name??e.config.name,crons:t.triggers?.crons,routes:p(t),firstDeploy:!1,dryRun:r[`dry-run`],validated:!1}}function p(e){return e.routes?e.routes:e.route?[e.route]:[]}function m(t,n){let r=t.assetsDir;if(!r)return;let i=!!n.main,a=n.assets?.run_worker_first;if(!i&&a)throw new e(`assets.run_worker_first requires a Worker entrypoint, but no main module is configured.`);return{directory:r,binding:n.assets?.binding,directoryExists:!0}}function h(i,o){if(!o.manifest||!i.bundleDir)return{modules:[],sourceMaps:void 0,dependencies:{},resolvedEntryPointPath:``,bundleType:`esm`,content:``};let{mainModule:s,modules:l}=o.manifest;g(s,i.bundleDir);let u=a(i.bundleDir,s);if(!t(u))throw new e(`Main module not found: ${u}`);let d=l?.[s]?.type??`esm`;if(d===`sourcemap`)throw new e(`Main module "${s}" cannot be a sourcemap.`);let f=n(u,`utf8`),p=c[d],m=[],h=[],_={};if(_[u]={bytesInOutput:r(u).size},l)for(let[o,u]of Object.entries(l)){if(o===s)continue;g(o,i.bundleDir);let l=a(i.bundleDir,o);if(u.type===`sourcemap`){if(!t(l))throw new e(`Module not found: ${l}`);h.push({name:o,content:n(l,`utf8`)});continue}if(!t(l))throw new e(`Module not found: ${l}`);let d=u.type===`wasm`||u.type===`data`?n(l):n(l,`utf8`);m.push({name:`./${o}`,filePath:l,content:d,type:c[u.type]}),_[l]={bytesInOutput:r(l).size}}return{modules:m,sourceMaps:h.length>0?h:void 0,dependencies:_,resolvedEntryPointPath:u,bundleType:p,content:f}}function g(t,n){let r=a(n,t);if(r!==n&&!r.startsWith(n+o))throw new e(`Module path "${t}" escapes the bundle directory.`)}export{d as i,u as n,f as r,h as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./src-
|
|
2
|
+
import{t as e}from"./src-gJma71Ec.mjs";import{a as t}from"./theme-CrIBazAF.mjs";import"./ui-CmnnBm_O.mjs";import{a as n,i as r,n as i,r as a,t as o}from"./spawn-C5Z7oWdp.mjs";import{t as s}from"./registry-jifR3_Y6.mjs";const c={command:`dev [implArgs..]`,describe:`Run the project's Cloudflare dev server`,builder:e=>e.positional(`implArgs`,{type:`string`,array:!0,describe:`Arguments forwarded to the dev-server implementation`}).parserConfiguration({"unknown-options-as-args":!0,"camel-case-expansion":!1}).epilogue(`cf dev starts the appropriate development server for your project. It runs your framework's dev command when available, falling back to an installed Cloudflare dev server.
|
|
3
3
|
|
|
4
|
-
Arguments after ${t.brand(`cf dev`)} are not forwarded to non-Cloudflare development servers. Run the non-Cloudflare dev command directly to pass additional arguments.`),handler:async t=>{let c=process.cwd(),l=await a(c);l&&!l.configured&&await r(l);let u=(t.implArgs??[]).map(String);throw l?.devCommand?u.length>0?Error(`Arguments cannot currently be forwarded to the detected dev command \`${l.devCommand}\`. Run that command directly with the required arguments.`):new e(await n(l.devCommand,c,{...l.env,...s()})):new e(await o(i(c),`dev`,u))}};export{c as default};
|
|
4
|
+
Arguments after ${t.brand(`cf dev`)} are not forwarded to non-Cloudflare development servers. Run the non-Cloudflare dev command directly to pass additional arguments.`),handler:async t=>{let c=process.cwd(),l=await a(c);l&&!l.configured&&await r(l);let u=(t.implArgs??[]).map(String),d=t.mode?[`--mode`,t.mode]:[];throw l?.devCommand?u.length>0?Error(`Arguments cannot currently be forwarded to the detected dev command \`${l.devCommand}\`. Run that command directly with the required arguments.`):new e(await n(l.devCommand,c,{env:{...l.env,...s()},args:d})):new e(await o(i(c),`dev`,[...d,...u]))}};export{c 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,t as c}from"./body-parser-BshbixEq.mjs";import{n as l}from"./input-validation-QDIYu7Vb.mjs";import{a as u,i as d,n as f}from"./prompt-B0sWIs9c.mjs";function p(e){return e.option(`check-type`,{type:`string`,description:`type of check to perform`,choices:[`icmp`],default:`icmp`}).option(`endpoint`,{type:`string`,description:`the IP address of the host to perform checks against`}).option(`name`,{type:`string`,description:`Optional name associated with this check`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const m={command:`create`,describe:`Create Endpoint Health Check.`,builder:p,handler:async f=>{if(f.dryRun){a({command:`cf diagnostics endpoint-healthchecks create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/diagnostics/endpoint-healthchecks`,pathParams:{},bodyKind:`json`,body:f.body===void 0?c({check_type:l(f[`check-type`],`check-type`,`text`),endpoint:l(f.endpoint,`endpoint`,`text`),name:l(f.name,`name`,`text`)}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Creating`,async()=>p.diagnostics.endpointHealthchecks.create({body:e,account_id:m})),{successLabel:`Created`});return}f[`check-type`]===void 0&&(f[`check-type`]=await d(`check-type`,`type of check to perform`,[`icmp`])),f.endpoint===void 0&&(f.endpoint=await u(`endpoint`,`the IP address of the host to perform checks against`));let h=c({check_type:l(f[`check-type`],`check-type`,`text`),endpoint:l(f.endpoint,`endpoint`,`text`),name:l(f.name,`name`,`text`)});i(await o(`Creating`,async()=>p.diagnostics.endpointHealthchecks.create({body:h,account_id:m})),{successLabel:`Created`})}};function h(e){return e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const g={command:`delete <id>`,describe:`Delete Endpoint Health Check.`,builder:h,handler:async s=>{if(s.dryRun){a({command:`cf diagnostics endpoint-healthchecks delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/diagnostics/endpoint-healthchecks/${s.id==null?`<id>`:encodeURIComponent(String(s.id))}`,pathParams:{id:String(s.id??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
|
|
3
|
+
`);return}i(await o(`Deleting`,async()=>c.diagnostics.endpointHealthchecks.delete({account_id:l,id:s.id})),{successLabel:`Deleted`})}};function _(e){return e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const v={command:`get <id>`,describe:`Get a single Endpoint Health Check.`,builder:_,handler:async s=>{if(s.dryRun){a({command:`cf diagnostics endpoint-healthchecks get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/diagnostics/endpoint-healthchecks/${s.id==null?`<id>`:encodeURIComponent(String(s.id))}`,pathParams:{id:String(s.id??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.diagnostics.endpointHealthchecks.get({account_id:l,id:s.id})),{successLabel:`Loaded`})}};function y(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const b={command:`list`,describe:`List Endpoint Health Checks.`,builder:y,handler:async s=>{if(s.dryRun){a({command:`cf diagnostics endpoint-healthchecks list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/diagnostics/endpoint-healthchecks`,pathParams:{},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.diagnostics.endpointHealthchecks.list({account_id:l})),{successLabel:`Loaded`})}};function x(e){return e.positional(`id`,{type:`string`,description:`UUID.`,demandOption:!0}).option(`check-type`,{type:`string`,description:`type of check to perform`,choices:[`icmp`]}).option(`endpoint`,{type:`string`,description:`the IP address of the host to perform checks against`}).option(`name`,{type:`string`,description:`Optional name associated with this check`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const S={command:`update <id>`,describe:`Update a Endpoint Health Check.`,builder:x,handler:async f=>{if(f.dryRun){a({command:`cf diagnostics endpoint-healthchecks update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/diagnostics/endpoint-healthchecks/${f.id==null?`<id>`:encodeURIComponent(String(f.id))}`,pathParams:{id:String(f.id??``)},bodyKind:`json`,body:f.body===void 0?c({check_type:l(f[`check-type`],`check-type`,`text`),endpoint:l(f.endpoint,`endpoint`,`text`),name:l(f.name,`name`,`text`)}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Updating`,async()=>p.diagnostics.endpointHealthchecks.update({body:e,account_id:m,id:f.id})),{successLabel:`Updated`});return}f[`check-type`]===void 0&&(f[`check-type`]=await d(`check-type`,`type of check to perform`,[`icmp`])),f.endpoint===void 0&&(f.endpoint=await u(`endpoint`,`the IP address of the host to perform checks against`));let h=c({check_type:l(f[`check-type`],`check-type`,`text`),endpoint:l(f.endpoint,`endpoint`,`text`),name:l(f.name,`name`,`text`)});i(await o(`Updating`,async()=>p.diagnostics.endpointHealthchecks.update({body:h,account_id:m,id:f.id})),{successLabel:`Updated`})}},C={command:`endpoint-healthchecks`,describe:`Monitor external endpoint availability with periodic HTTP/HTTPS health checks`,builder:e=>e.command(m).command(g).command(v).command(b).command(S).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function w(e){return e.option(`colos`,{type:`string`,array:!0,description:`If no source colo names specified, all colos will be used. China colos are unavailable for traceroutes.`}).option(`options-max-ttl`,{type:`number`,description:`Max TTL.`}).option(`options-packet-type`,{type:`string`,description:`Type of packet sent.`,choices:[`icmp`,`tcp`,`udp`,`gre`,`gre+icmp`]}).option(`options-packets-per-ttl`,{type:`number`,description:`Number of packets sent at each TTL.`}).option(`options-port`,{type:`number`,description:`For UDP and TCP, specifies the destination port. For ICMP, specifies the initial ICMP sequence value. Default value 0 will choose the best value to use for each protocol.`}).option(`options-wait-time`,{type:`number`,description:`Set the time (in seconds) to wait for a response to a probe.`}).option(`targets`,{type:`string`,array:!0,description:`The targets field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create`,describe:`Run traceroutes from Cloudflare colos.`,builder:w,handler:async u=>{if(u.dryRun){a({command:`cf diagnostics traceroutes create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/diagnostics/traceroute`,pathParams:{},bodyKind:`json`,body:u.body===void 0?c({colos:u.colos,options:{max_ttl:u[`options-max-ttl`],packet_type:l(u[`options-packet-type`],`options-packet-type`,`text`),packets_per_ttl:u[`options-packets-per-ttl`],port:u[`options-port`],wait_time:u[`options-wait-time`]},targets:u.targets}):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(`Creating`,async()=>d.diagnostics.traceroutes.create({...e,account_id:f})),{successLabel:`Created`});return}if(u.targets===void 0)throw Error(`--targets is required (or pass --body with this field set).`);let p=c({colos:u.colos,options:{max_ttl:u[`options-max-ttl`],packet_type:l(u[`options-packet-type`],`options-packet-type`,`text`),packets_per_ttl:u[`options-packets-per-ttl`],port:u[`options-port`],wait_time:u[`options-wait-time`]},targets:u.targets});i(await o(`Creating`,async()=>d.diagnostics.traceroutes.create({...p,account_id:f})),{successLabel:`Created`})}},E={command:`traceroutes`,describe:`Run traceroutes from Cloudflare data centers to diagnose network path issues`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},D={command:`diagnostics`,describe:`Network diagnostic tools — traceroutes from Cloudflare's edge and endpoint health checks`,builder:e=>e.command(C).command(E).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{D as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
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,t as c}from"./body-parser-BshbixEq.mjs";import{n as l}from"./input-validation-QDIYu7Vb.mjs";import{a as u,i as d,n as f}from"./prompt-B0sWIs9c.mjs";import{t as p}from"./cli-types-DAYeL_Mj.mjs";function m(e){return e.option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin.\n\n- `"verify_full"` — verify certificate chain and hostname (default)\n- `"verify_ca"` — verify certificate chain only, skip hostname check\n- `"disabled"` — do not verify the server certificate at all'}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0}).check(e=>{if([`tls-settings-cert-verification-mode`].some(t=>e[t]!==void 0)){let t=[`tls-settings-cert-verification-mode`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --tls_settings-* flag is set`)}return!0})}const h={command:`create`,describe:`Creates a new Workers VPC connectivity service in the account.`,builder:m,handler:async f=>{if(f.dryRun){a({command:`cf directory services create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/connectivity/directory/services`,pathParams:{},bodyKind:`json`,body:f.body===void 0?c({host:{ipv4:l(f[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:l(f[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:l(f[`host-ipv6`],`host-ipv6`,`text`),hostname:l(f[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:f[`host-resolver-network-resolver-ips`],tunnel_id:l(f[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:l(f.name,`name`,`text`),tls_settings:{cert_verification_mode:l(f[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:l(f.type,`type`,`text`),http_port:f[`http-port`],https_port:f[`https-port`],app_protocol:l(f[`app-protocol`],`app-protocol`,`text`),tcp_port:f[`tcp-port`]}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Creating`,async()=>p.directory.services.create({body:e,account_id:m})),{successLabel:`Created`});return}f.name===void 0&&(f.name=await u(`name`,`The name field`)),f.type===void 0&&(f.type=await d(`type`,`The type field`,[`tcp`,`http`]));let h=c({host:{ipv4:l(f[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:l(f[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:l(f[`host-ipv6`],`host-ipv6`,`text`),hostname:l(f[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:f[`host-resolver-network-resolver-ips`],tunnel_id:l(f[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:l(f.name,`name`,`text`),tls_settings:{cert_verification_mode:l(f[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:l(f.type,`type`,`text`),http_port:f[`http-port`],https_port:f[`https-port`],app_protocol:l(f[`app-protocol`],`app-protocol`,`text`),tcp_port:f[`tcp-port`]});i(await o(`Creating`,async()=>p.directory.services.create({body:h,account_id:m})),{successLabel:`Created`})}};function g(e){return e.positional(`service-id`,{type:`string`,description:`Service 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 _={command:`delete <service-id>`,describe:`Removes a single Workers VPC connectivity service by its ID.`,builder:g,handler:async s=>{if(s.dryRun){a({command:`cf directory services delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/connectivity/directory/services/${s[`service-id`]==null?`<service-id>`:encodeURIComponent(String(s[`service-id`]))}`,pathParams:{"service-id":String(s[`service-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();if(s.accountId=l,!await f({force:!!s.force})){process.stderr.write(`Aborted.
|
|
3
3
|
`);return}i(await o(`Deleting`,async()=>c.directory.services.delete({account_id:l,service_id:s[`service-id`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const y={command:`get <service-id>`,describe:`Fetches a single Workers VPC connectivity service by its ID.`,builder:v,handler:async s=>{if(s.dryRun){a({command:`cf directory services get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/connectivity/directory/services/${s[`service-id`]==null?`<service-id>`:encodeURIComponent(String(s[`service-id`]))}`,pathParams:{"service-id":String(s[`service-id`]??``)},bodyKind:`none`});return}let c=await r(s),l=s.local?e:await t();s.accountId=l,i(await o(`Loading`,async()=>c.directory.services.get({account_id:l,service_id:s[`service-id`]})),{successLabel:`Loaded`})}};function b(e){return e.option(`type`,{type:`string`,description:`Type`,choices:[`tcp`,`http`]}).option(`page`,{type:`number`,description:`Current page in the response`}).option(`per-page`,{type:`number`,description:`Max amount of entries returned per page`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`Lists the Workers VPC connectivity services in the account.`,builder:p(b),handler:async s=>{let c={type:s.type,page:s.page,per_page:s[`per-page`]};if(s.dryRun){a({command:`cf directory services list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/connectivity/directory/services`,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.directory.services.list({account_id:u,...c})),{successLabel:`Loaded`})}};function S(e){return e.positional(`service-id`,{type:`string`,description:`Service ID`,demandOption:!0}).option(`host-ipv4`,{type:`string`,description:`The host.ipv4 field`}).option(`host-network-tunnel-id`,{type:`string`,description:`The host.network.tunnel_id field`}).option(`host-ipv6`,{type:`string`,description:`The host.ipv6 field`}).option(`host-hostname`,{type:`string`,description:`The host.hostname field`}).option(`host-resolver-network-resolver-ips`,{type:`string`,array:!0,description:`The host.resolver_network.resolver_ips field`}).option(`host-resolver-network-tunnel-id`,{type:`string`,description:`The host.resolver_network.tunnel_id field`}).option(`name`,{type:`string`,description:`The name field`}).option(`tls-settings-cert-verification-mode`,{type:`string`,description:'TLS certificate verification mode for the connection to the origin.\n\n- `"verify_full"` — verify certificate chain and hostname (default)\n- `"verify_ca"` — verify certificate chain only, skip hostname check\n- `"disabled"` — do not verify the server certificate at all'}).option(`type`,{type:`string`,description:`The type field`,choices:[`tcp`,`http`]}).option(`http-port`,{type:`number`,description:`The http_port field`}).option(`https-port`,{type:`number`,description:`The https_port field`}).option(`app-protocol`,{type:`string`,description:`The app_protocol field`,choices:[`postgresql`,`mysql`]}).option(`tcp-port`,{type:`number`,description:`The tcp_port field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).conflicts(`host-ipv4`,[`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-ipv6`,[`host-ipv4`,`host-hostname`,`host-resolver-network-resolver-ips`]).conflicts(`host-hostname`,[`host-ipv4`,`host-ipv6`]).conflicts(`host-resolver-network-resolver-ips`,[`host-ipv4`,`host-ipv6`]).conflicts(`http-port`,[`app-protocol`,`tcp-port`]).conflicts(`https-port`,[`app-protocol`,`tcp-port`]).conflicts(`app-protocol`,[`http-port`,`https-port`]).conflicts(`tcp-port`,[`http-port`,`https-port`]).check(e=>{if([`host-ipv4`,`host-network-tunnel-id`,`host-ipv6`,`host-hostname`,`host-resolver-network-resolver-ips`,`host-resolver-network-tunnel-id`].some(t=>e[t]!==void 0)){let t=[`host-network-tunnel-id`,`host-resolver-network-tunnel-id`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --host-* flag is set`)}return!0}).check(e=>{if([`tls-settings-cert-verification-mode`].some(t=>e[t]!==void 0)){let t=[`tls-settings-cert-verification-mode`].filter(t=>e[t]===void 0);if(t.length>0)throw Error(`${t.map(e=>`--`+e).join(`, `)} ${t.length===1?`is`:`are`} required when any --tls_settings-* flag is set`)}return!0})}const C={command:`update <service-id>`,describe:`Updates an existing Workers VPC connectivity service by its ID.`,builder:S,handler:async f=>{if(f.dryRun){a({command:`cf directory services update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/connectivity/directory/services/${f[`service-id`]==null?`<service-id>`:encodeURIComponent(String(f[`service-id`]))}`,pathParams:{"service-id":String(f[`service-id`]??``)},bodyKind:`json`,body:f.body===void 0?c({host:{ipv4:l(f[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:l(f[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:l(f[`host-ipv6`],`host-ipv6`,`text`),hostname:l(f[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:f[`host-resolver-network-resolver-ips`],tunnel_id:l(f[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:l(f.name,`name`,`text`),tls_settings:{cert_verification_mode:l(f[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:l(f.type,`type`,`text`),http_port:f[`http-port`],https_port:f[`https-port`],app_protocol:l(f[`app-protocol`],`app-protocol`,`text`),tcp_port:f[`tcp-port`]}):s(f.body)});return}let p=await r(f),m=f.local?e:await t();if(f.accountId=m,f.body){let e=s(f.body);i(await o(`Updating`,async()=>p.directory.services.update({body:e,account_id:m,service_id:f[`service-id`]})),{successLabel:`Updated`});return}f.name===void 0&&(f.name=await u(`name`,`The name field`)),f.type===void 0&&(f.type=await d(`type`,`The type field`,[`tcp`,`http`]));let h=c({host:{ipv4:l(f[`host-ipv4`],`host-ipv4`,`text`),network:{tunnel_id:l(f[`host-network-tunnel-id`],`host-network-tunnel-id`,`text`)},ipv6:l(f[`host-ipv6`],`host-ipv6`,`text`),hostname:l(f[`host-hostname`],`host-hostname`,`text`),resolver_network:{resolver_ips:f[`host-resolver-network-resolver-ips`],tunnel_id:l(f[`host-resolver-network-tunnel-id`],`host-resolver-network-tunnel-id`,`text`)}},name:l(f.name,`name`,`text`),tls_settings:{cert_verification_mode:l(f[`tls-settings-cert-verification-mode`],`tls-settings-cert-verification-mode`,`text`)},type:l(f.type,`type`,`text`),http_port:f[`http-port`],https_port:f[`https-port`],app_protocol:l(f[`app-protocol`],`app-protocol`,`text`),tcp_port:f[`tcp-port`]});i(await o(`Updating`,async()=>p.directory.services.update({body:h,account_id:m,service_id:f[`service-id`]})),{successLabel:`Updated`})}},w={command:`services`,describe:`Operations for services`,builder:e=>e.command(h).command(_).command(y).command(x).command(C).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},T={command:`directory`,describe:`directory`,builder:e=>e.command(w).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{T as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./local-
|
|
2
|
+
import{t as e}from"./local-Be3lg_9E.mjs";import{f as t,g as n}from"./oauth-DuEONNgC.mjs";import{a as r,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,t as l}from"./body-parser-BshbixEq.mjs";import{n as u,t as d}from"./input-validation-QDIYu7Vb.mjs";import{a as f,i as p,n as m}from"./prompt-B0sWIs9c.mjs";function h(e){return e.option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const ee={command:`create`,describe:`Create a new Workers for Platforms namespace.`,builder:h,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces`,pathParams:{},bodyKind:`json`,body:r.body===void 0?l({name:u(r.name,`name`,`text`)}):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.dispatchNamespaces.create({...e,account_id:f})),{successLabel:`Created`});return}let p=l({name:u(r.name,`name`,`text`)});a(await s(`Creating`,async()=>d.dispatchNamespaces.create({...p,account_id:f})),{successLabel:`Created`})}};function g(e){return e.positional(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const _={command:`delete <dispatch-namespace>`,describe:`Delete a Workers for Platforms namespace.`,builder:g,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``)},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
3
|
`);return}a(await s(`Deleting`,async()=>c.dispatchNamespaces.delete({account_id:l,dispatch_namespace:r[`dispatch-namespace`]})),{successLabel:`Deleted`})}};function v(e){return e.positional(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the dispatch namespace.`}).option(`trusted-workers`,{type:`boolean`,description:'Whether the Workers in the namespace are executed in a "trusted" manner. When a Worker is trusted, it has access to the shared caches for the zone in the Cache API, and has access to the `request.cf` object on incoming Requests. When a Worker is untrusted, caches are not shared across the zone, and `request.cf` is undefined. By default, Workers in a namespace are "untrusted".'}).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:`edit <dispatch-namespace>`,describe:`Patch a Workers for Platforms namespace. Omitted fields are left unchanged.`,builder:v,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``)},bodyKind:`json`,body:r.body===void 0?l({name:u(r.name,`name`,`text`),trusted_workers:r[`trusted-workers`]}):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(`Updating`,async()=>d.dispatchNamespaces.edit({...e,account_id:f,dispatch_namespace:r[`dispatch-namespace`]})),{successLabel:`Updated`});return}let p=l({name:u(r.name,`name`,`text`),trusted_workers:r[`trusted-workers`]});a(await s(`Updating`,async()=>d.dispatchNamespaces.edit({...p,account_id:f,dispatch_namespace:r[`dispatch-namespace`]})),{successLabel:`Updated`})}};function b(e){return e.positional(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`get <dispatch-namespace>`,describe:`Get a Workers for Platforms namespace.`,builder:b,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.dispatchNamespaces.get({account_id:l,dispatch_namespace:r[`dispatch-namespace`]})),{successLabel:`Loaded`})}};function S(e){return e.option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const C={command:`list`,describe:`Fetch a list of Workers for Platforms namespaces.`,builder:S,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces`,pathParams:{},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.dispatchNamespaces.list({account_id:l})),{successLabel:`Loaded`})}};function w(e){return e.positional(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const T={command:`create <script-name>`,describe:`Start uploading a collection of assets for use in a Worker version. To learn more about the direct uploads of assets, see https://developers.cloudflare.com/workers/static-assets/direct-upload/.`,builder:w,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces scripts asset-upload create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts/${r[`script-name`]==null?`<script-name>`:encodeURIComponent(String(r[`script-name`]))}/assets-upload-session`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``),"script-name":String(r[`script-name`]??``)},bodyKind:`json`,body:r.body===void 0?void 0:c(r.body)});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,r.body){let e=c(r.body);a(await s(`Creating`,async()=>l.dispatchNamespaces.scripts.assetUpload.create({body:e,account_id:u,dispatch_namespace:r[`dispatch-namespace`],script_name:r[`script-name`]})),{successLabel:`Created`});return}if(r.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},E={command:`asset-upload`,describe:`Operations for scripts.asset-upload`,builder:e=>e.command(T).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function D(e){return e.positional(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <script-name>`,describe:`Fetch script bindings from a script uploaded to a Workers for Platforms namespace.`,builder:D,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces scripts bindings get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts/${r[`script-name`]==null?`<script-name>`:encodeURIComponent(String(r[`script-name`]))}/bindings`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``),"script-name":String(r[`script-name`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.dispatchNamespaces.scripts.bindings.get({account_id:l,dispatch_namespace:r[`dispatch-namespace`],script_name:r[`script-name`]})),{successLabel:`Loaded`})}},k={command:`bindings`,describe:`Operations for scripts.bindings`,builder:e=>e.command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function A(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`tags`,{type:`string`,description:`Filter scripts by tags before deletion. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.`}).option(`limit`,{type:`number`,description:`Limit the number of scripts to delete.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const j={command:`bulk-delete`,describe:`Delete multiple scripts from a Workers for Platforms namespace based on optional tag filters.`,builder:A,handler:async r=>{let c={tags:r.tags,limit:r.limit};if(r.dryRun){o({command:`cf dispatch-namespaces scripts bulk-delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await m({force:!!r.force})){process.stderr.write(`Aborted.
|
|
4
4
|
`);return}a(await s(`Deleting`,async()=>l.dispatchNamespaces.scripts.bulkDelete({account_id:u,dispatch_namespace:r[`dispatch-namespace`],...c})),{successLabel:`Deleted`})}};function M(e){return e.positional(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const N={command:`get <script-name>`,describe:`Fetch script content from a script uploaded to a Workers for Platforms namespace.`,builder:M,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces scripts content get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts/${r[`script-name`]==null?`<script-name>`:encodeURIComponent(String(r[`script-name`]))}/content`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``),"script-name":String(r[`script-name`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.dispatchNamespaces.scripts.content.get({account_id:l,dispatch_namespace:r[`dispatch-namespace`],script_name:r[`script-name`]})),{successLabel:`Loaded`})}};function P(e){return e.positional(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`cf-worker-body-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in service worker format. Alternative to including in a metadata part.`}).option(`cf-worker-main-module-part`,{type:`string`,description:`The multipart name of a script upload part containing script content in es module format. Alternative to including in a metadata part.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`}).option(`files`,{type:`string`,description:"An array of modules (often JavaScript files) comprising a Worker script. At least one module must be present and referenced in the metadata as `main_module` or `body_part` by filename.<br/>Possible Content-Type(s) are: `application/javascript+module`, `text/javascript+module`, `application/javascript`, `text/javascript`, `text/x-python`, `text/x-python-requirement`, `application/wasm`, `text/plain`, `application/octet-stream`, `application/source-map`."}).option(`metadata`,{type:`string`,description:`JSON-encoded metadata about the uploaded parts and Worker configuration.`})}const F={command:`update <script-name>`,describe:`Put script content for a script uploaded to a Workers for Platforms namespace.`,builder:P,handler:async c=>{let l={};if(c[`cf-worker-body-part`]!==void 0&&(l[`CF-WORKER-BODY-PART`]=String(c[`cf-worker-body-part`])),c[`cf-worker-main-module-part`]!==void 0&&(l[`CF-WORKER-MAIN-MODULE-PART`]=String(c[`cf-worker-main-module-part`])),c.dryRun){o({command:`cf dispatch-namespaces scripts content update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${c[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(c[`dispatch-namespace`]))}/scripts/${c[`script-name`]==null?`<script-name>`:encodeURIComponent(String(c[`script-name`]))}/content`,pathParams:{"dispatch-namespace":String(c[`dispatch-namespace`]??``),"script-name":String(c[`script-name`]??``)},bodyKind:`multipart`,body:{body:c.body,file:c.file,files:c.files,metadata:c.metadata}});return}let f=await i(c),p=c.local?e:await t();if(c.accountId=p,c.file!==void 0||c.body!==void 0||c.files!==void 0||c.metadata!==void 0){let e=new FormData;if(c.file){let t=d(c.file);e.append(`file`,new Blob([t]),c.file.split(/[\\/]/).filter(Boolean).pop())}else c.body!==void 0&&e.append(`file`,c.body);if(c.files!==void 0){let t=typeof c.files==`string`?u(c.files,`files`,`text`):c.files;e.append(`files`,typeof t==`string`?t:JSON.stringify(t))}if(c.metadata!==void 0){let t=typeof c.metadata==`string`?u(c.metadata,`metadata`,`text`):c.metadata;e.append(`metadata`,typeof t==`string`?t:JSON.stringify(t))}a(await s(`Updating`,async()=>r(f,`PUT`,`/accounts/${p}/workers/dispatch/namespaces/${encodeURIComponent(String(c[`dispatch-namespace`]))}/scripts/${encodeURIComponent(String(c[`script-name`]))}/content`,{body:e,headers:Object.keys(l).length>0?l:void 0})),{successLabel:`Updated`});return}if(c.body){let e=u(c.body,`body`,`binary`);a(await s(`Updating`,async()=>r(f,`PUT`,`/accounts/${p}/workers/dispatch/namespaces/${encodeURIComponent(String(c[`dispatch-namespace`]))}/scripts/${encodeURIComponent(String(c[`script-name`]))}/content`,{body:e,headers:{"Content-Type":`multipart/form-data`,...l}})),{successLabel:`Updated`});return}if(c.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}},I={command:`content`,describe:`Operations for scripts.content`,builder:e=>e.command(N).command(F).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function L(e){return e.positional(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`force`,{type:`boolean`,description:`If set to true, delete will not be stopped by associated service binding, durable object, or other binding. Any of these associated bindings/durable objects will be deleted along with the script.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const R={command:`delete <script-name>`,describe:`Delete a worker from a Workers for Platforms namespace. This call has no response body on a successful delete.`,builder:L,handler:async r=>{let c={force:r.force};if(r.dryRun){o({command:`cf dispatch-namespaces scripts delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts/${r[`script-name`]==null?`<script-name>`:encodeURIComponent(String(r[`script-name`]))}`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``),"script-name":String(r[`script-name`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await m({force:!!r.force})){process.stderr.write(`Aborted.
|
|
5
5
|
`);return}a(await s(`Deleting`,async()=>l.dispatchNamespaces.scripts.delete({account_id:u,dispatch_namespace:r[`dispatch-namespace`],script_name:r[`script-name`],...c})),{successLabel:`Deleted`})}};function z(e){return e.positional(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`get <script-name>`,describe:`Fetch information about a script uploaded to a Workers for Platforms namespace.`,builder:z,handler:async r=>{if(r.dryRun){o({command:`cf dispatch-namespaces scripts get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts/${r[`script-name`]==null?`<script-name>`:encodeURIComponent(String(r[`script-name`]))}`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``),"script-name":String(r[`script-name`]??``)},bodyKind:`none`});return}let c=await i(r),l=r.local?e:await t();r.accountId=l,a(await s(`Loading`,async()=>c.dispatchNamespaces.scripts.get({account_id:l,dispatch_namespace:r[`dispatch-namespace`],script_name:r[`script-name`]})),{successLabel:`Loaded`})}};function V(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`tags`,{type:`string`,description:`Filter scripts by tags. Format: comma-separated list of tag:allowed pairs where allowed is 'yes' or 'no'.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const H={command:`list`,describe:`Fetch a list of scripts uploaded to a Workers for Platforms namespace.`,builder:V,handler:async r=>{let c={tags:r.tags};if(r.dryRun){o({command:`cf dispatch-namespaces scripts list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``)},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.dispatchNamespaces.scripts.list({account_id:u,dispatch_namespace:r[`dispatch-namespace`],...c})),{successLabel:`Loaded`})}};function U(e){return e.option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`JSON Merge Patch (RFC 7396) request body for bulk secret changes. `}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const te={command:`bulk-edit`,describe:"Create, update, or delete multiple secrets on a script in a single operation using JSON Merge Patch (RFC 7396). Usage: - To create or update a secret, set its value to a secret object. - To delete a secret, set its value to `null`. - Secrets not included in the request are left unchanged.",builder:U,handler:async l=>{if(l.dryRun){o({command:`cf dispatch-namespaces scripts secrets bulk-edit`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${l[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(l[`dispatch-namespace`]))}/scripts/${l[`script-name`]==null?`<script-name>`:encodeURIComponent(String(l[`script-name`]))}/secrets-bulk`,pathParams:{"dispatch-namespace":String(l[`dispatch-namespace`]??``),"script-name":String(l[`script-name`]??``)},bodyKind:`json`,body:l.body===void 0?void 0:c(l.body)});return}let u=await i(l),f=l.local?e:await t();if(l.accountId=f,l.file){let e=d(l.file);a(await s(`Updating`,async()=>r(u,`PATCH`,`/accounts/${f}/workers/dispatch/namespaces/${encodeURIComponent(String(l[`dispatch-namespace`]))}/scripts/${encodeURIComponent(String(l[`script-name`]))}/secrets-bulk`,{body:e,headers:{"Content-Type":`application/merge-patch+json`}})),{successLabel:`Updated`});return}if(l.body){let e=c(l.body);a(await s(`Updating`,async()=>r(u,`PATCH`,`/accounts/${f}/workers/dispatch/namespaces/${encodeURIComponent(String(l[`dispatch-namespace`]))}/scripts/${encodeURIComponent(String(l[`script-name`]))}/secrets-bulk`,{body:e})),{successLabel:`Updated`});return}if(l.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)}};function W(e){return e.positional(`secret-name`,{type:`string`,description:`A JavaScript variable name for the secret binding.`,demandOption:!0}).option(`dispatch-namespace`,{type:`string`,description:`Name of the Workers for Platforms dispatch namespace.`,demandOption:!0}).option(`script-name`,{type:`string`,description:`Name of the script, used in URLs and route configuration.`,demandOption:!0}).option(`url-encoded`,{type:`boolean`,description:`Flag that indicates whether the secret name is URL encoded.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const G={command:`delete <secret-name>`,describe:`Remove a secret from a script uploaded to a Workers for Platforms namespace.`,builder:W,handler:async r=>{let c={url_encoded:r[`url-encoded`]};if(r.dryRun){o({command:`cf dispatch-namespaces scripts secrets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${await n()??`<account-id>`}/workers/dispatch/namespaces/${r[`dispatch-namespace`]==null?`<dispatch-namespace>`:encodeURIComponent(String(r[`dispatch-namespace`]))}/scripts/${r[`script-name`]==null?`<script-name>`:encodeURIComponent(String(r[`script-name`]))}/secrets/${r[`secret-name`]==null?`<secret-name>`:encodeURIComponent(String(r[`secret-name`]))}`,pathParams:{"dispatch-namespace":String(r[`dispatch-namespace`]??``),"script-name":String(r[`script-name`]??``),"secret-name":String(r[`secret-name`]??``)},query:c,bodyKind:`none`});return}let l=await i(r),u=r.local?e:await t();if(r.accountId=u,!await m({force:!!r.force})){process.stderr.write(`Aborted.
|