cf 1.0.0-beta.26 → 1.0.0-beta.28
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/dist/_meta/commands.json +7373 -4926
- package/dist/_meta/hand-written-commands.json +2 -2
- package/dist/_meta/schemas.json +11614 -4465
- package/dist/abuse-reports-D9edOyag.mjs +24 -0
- package/dist/{access-DCOOmDC5.mjs → access-CKCCSrrU.mjs} +1 -1
- package/dist/{accounts-HC6XuIwP.mjs → accounts-CNb9U9bK.mjs} +33 -27
- package/dist/{acm-DYgr6SAR.mjs → acm-CdKTAToZ.mjs} +3 -3
- package/dist/{addressing-BS66pJ_a.mjs → addressing-eZI_C-b0.mjs} +18 -18
- package/dist/{agent-memory-BbXdueL0.mjs → agent-memory-BBHCEE7h.mjs} +7 -7
- package/dist/{ai-BiIKznNv.mjs → ai-Csl_QNwv.mjs} +7 -7
- package/dist/ai-audit-DlqWsQi-.mjs +6 -0
- package/dist/{ai-gateway-rlYCbts5.mjs → ai-gateway-Lj4On37s.mjs} +13 -13
- package/dist/ai-search-BxyhS3X7.mjs +74 -0
- package/dist/{ai-security-BUwS6kVh.mjs → ai-security-DvU2iYkY.mjs} +3 -3
- package/dist/{alerting-BSzuvFk1.mjs → alerting-r0G2X9y9.mjs} +10 -10
- package/dist/analytics-C6bfqm-W.mjs +17 -0
- package/dist/analytics-engine-BlIecoOe.mjs +4 -0
- package/dist/api-Dnt6lRJG.mjs +3 -0
- package/dist/{api-security-BBxEJjGv.mjs → api-security-DZ7GWOqD.mjs} +26 -26
- package/dist/argo-Bh0_cj49.mjs +14 -0
- package/dist/{artifacts-B9g9aPrk.mjs → artifacts-VZJWVq_6.mjs} +16 -16
- package/dist/{audit-logs-BhJs-OS2.mjs → audit-logs-B8cGL4B9.mjs} +1 -1
- package/dist/auth-B-h0BHg7.mjs +2 -0
- package/dist/auth-B6tswVxH.mjs +2 -0
- package/dist/{auth-C50SqX9F.mjs → auth-clmqFEWU.mjs} +3 -3
- package/dist/{auth-token-DvNoIhRL.mjs → auth-token-DW4dJVdj.mjs} +1 -1
- package/dist/{autoconfig-ldsgXxa6.mjs → autoconfig-C0ynlGHf.mjs} +23 -23
- package/dist/{basin-catalog-CtKFiH-n.mjs → basin-catalog-TehR1sKZ.mjs} +11 -11
- package/dist/billing-B2KusU6g.mjs +22 -0
- package/dist/{blocks-DnNrvi8s.mjs → blocks-BFulF68V.mjs} +1 -1
- package/dist/body-parser-DoewLePl.mjs +2 -0
- package/dist/body-unions-DNs981Ia.mjs +2 -0
- package/dist/bot-management-CXHXgrQC.mjs +9 -0
- package/dist/{botnet-feed-lD9s2oLA.mjs → botnet-feed-UyK7Rfp6.mjs} +1 -1
- package/dist/brand-protection-kv1ba80i.mjs +14 -0
- package/dist/browser-run-D-vRoZmf.mjs +40 -0
- package/dist/build-BzJGqb2o.mjs +2 -0
- package/dist/build-FFxzigo4.mjs +2 -0
- package/dist/{builds-D3mAH87h.mjs → builds-BbxINHRP.mjs} +27 -27
- package/dist/cache-BacNNtLu.mjs +36 -0
- package/dist/{cf-CpC4giTf.mjs → cf-BQ_LRiut.mjs} +2 -2
- package/dist/{chunk-DSGVRFIS-vdfri8fR.mjs → chunk-DSGVRFIS-BaNZNW-M.mjs} +1 -1
- package/dist/chunk-SOBRPAPT-QTjnHSNs.mjs +363 -0
- package/dist/{cli-Cm4Twas4.mjs → cli-B7vslRfu.mjs} +1 -1
- package/dist/{client-side-security-BRn7KBpu.mjs → client-side-security-bzB9JosR.mjs} +6 -6
- package/dist/{cloud-connector-DqkOIRDr.mjs → cloud-connector-BHtf37R5.mjs} +2 -2
- package/dist/{cloudflared-DDp_8PTK.mjs → cloudflared-QDdHMUEY.mjs} +1 -1
- package/dist/{cloudforce-one-B9k8vhso.mjs → cloudforce-one-DWBPQDA3.mjs} +126 -124
- package/dist/{command--Y_QAiU2.mjs → command-AVwd7XjE.mjs} +1 -1
- package/dist/{command-DlI7Z_7j.mjs → command-B87T_f2f.mjs} +1 -1
- package/dist/{command-QHmV62Fv.mjs → command-CEHhi3t0.mjs} +1 -1
- package/dist/{command-B-_ba4rQ.mjs → command-CYmQE79n.mjs} +1 -1
- package/dist/{command-DsOv6z9q.mjs → command-CbxXc5IW.mjs} +1 -1
- package/dist/{command-BKNQsGqu.mjs → command-Ce8CVLth.mjs} +1 -1
- package/dist/{command-MxFFWqMg.mjs → command-CqDudQZs.mjs} +1 -1
- package/dist/{command-BV8-laJK.mjs → command-D4YcwpVp.mjs} +1 -1
- package/dist/{command-BVz2aES3.mjs → command-D895kdlh.mjs} +1 -1
- package/dist/{command-yOG9VUtq.mjs → command-D9Qyi1B0.mjs} +1 -1
- package/dist/{command-CfOqnqlN.mjs → command-DeutqL1n.mjs} +1 -1
- package/dist/{command-Dn39o5xQ.mjs → command-Dl9ICrRK.mjs} +1 -1
- package/dist/{command-CN8NFLs2.mjs → command-DtCSe8Hy.mjs} +1 -1
- package/dist/{command-BsCFkho-.mjs → command-DwzVtmb3.mjs} +1 -1
- package/dist/{command-CQMRxiDz.mjs → command-wtBubtZ4.mjs} +1 -1
- package/dist/{completions-BA52jTea.mjs → completions-BvdKtzsX.mjs} +1 -1
- package/dist/{connector-interrupts-zL7pxPn6.mjs → connector-interrupts-dUPW6Ya_.mjs} +2 -2
- package/dist/{connector-telemetry-events-PL4Fqqvu.mjs → connector-telemetry-events-DWVCqnhn.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-DyBSuEFB.mjs → connector-telemetry-snapshots-CeMP3qeI.mjs} +1 -1
- package/dist/{connectors-D8H6rQz9.mjs → connectors-DZFGNw3i.mjs} +4 -4
- package/dist/{containers-D4sa-Eoy.mjs → containers-B06OGOEB.mjs} +212 -212
- package/dist/{containers-Db-eWudu.mjs → containers-DCzQCo79.mjs} +8 -8
- package/dist/{content-scan-DUVq09i8.mjs → content-scan-XhnNJqXf.mjs} +4 -4
- package/dist/{context-BvLXzoMs.mjs → context-BY1Eh_Qe.mjs} +1 -1
- package/dist/{cps-CqaRliZZ.mjs → cps-CohlxvuN.mjs} +2 -2
- package/dist/create-DmLDMvrj.mjs +2 -0
- package/dist/{csam-scanner-DsXvOOsZ.mjs → csam-scanner-BV4bHq8v.mjs} +2 -4
- package/dist/custom-csrs-BVdMQjYq.mjs +18 -0
- package/dist/{custom-hostnames-Cj_csfo_.mjs → custom-hostnames-r-CxhSa1.mjs} +5 -5
- package/dist/custom-nameservers-CapMDyly.mjs +12 -0
- package/dist/custom-pages-BVIniWfq.mjs +38 -0
- package/dist/d1-nJCOJZb8.mjs +50 -0
- package/dist/{delegate-CMfEjvHn.mjs → delegate-CcL6RoGw.mjs} +1 -1
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-DDbmxkiX.mjs → deploy-DJMnWFNk.mjs} +1 -1
- package/dist/{deploy-context-DsEVu7bf.mjs → deploy-context-YCW3eqP1.mjs} +15 -15
- package/dist/{deploy-input-BA_3Q2Xu.mjs → deploy-input-CQLBXFEB.mjs} +1 -1
- package/dist/{dev-BS156bim.mjs → dev-GsYHvMah.mjs} +1 -1
- package/dist/{diagnostics-BmkQnSEb.mjs → diagnostics-C3nqxsAO.mjs} +4 -4
- package/dist/{dist-DehXZozc.mjs → dist-D-ihn_mV.mjs} +42 -33
- package/dist/{dls-DciZC_gQ.mjs → dls-N1x8sAK3.mjs} +3 -3
- package/dist/{dns-C2YPspGN.mjs → dns-DATWP-PF.mjs} +36 -30
- package/dist/{dns-firewall-CRfde07f.mjs → dns-firewall-n3Y2ui6W.mjs} +8 -8
- package/dist/{docs-CYjyBA8q.mjs → docs-CRc_WOXh.mjs} +1 -1
- package/dist/{dry-run-gy0Hl9xo.mjs → dry-run-kJbjn4kG.mjs} +1 -1
- package/dist/{durable-objects-DcI97y4p.mjs → durable-objects-DHK9w-vO.mjs} +2 -2
- package/dist/{email-auth-CMCQAu99.mjs → email-auth-ptdqNSTZ.mjs} +1 -1
- package/dist/email-domains-uL22-zRY.mjs +14 -0
- package/dist/{email-routing-7p9dr5Ue.mjs → email-routing-CV43rMJC.mjs} +15 -13
- package/dist/{email-security-Bu0fAYh-.mjs → email-security-DK_SJ0yi.mjs} +38 -38
- package/dist/{email-sending-OpMZNaHZ.mjs → email-sending-CTQafGec.mjs} +17 -17
- package/dist/{error-sanitization-DG8WSzHe.mjs → error-sanitization-BkgtZ0Vx.mjs} +1 -1
- package/dist/error-sanitization-D069tpKk.mjs +2 -0
- package/dist/{errors-C5RGao2J.mjs → errors-VG1mgwJl.mjs} +1 -1
- package/dist/{field-extractors-BfsNjd0e.mjs → field-extractors-jcZ_bAGc.mjs} +2 -2
- package/dist/{firewall-CJ-VIOk1.mjs → firewall-CW-fAI9m.mjs} +30 -14
- package/dist/{flagship-C5PTR1ND.mjs → flagship-RiLnDwfJ.mjs} +8 -8
- package/dist/{fraud-B7hwBheX.mjs → fraud-DvfBBTe8.mjs} +2 -2
- package/dist/get-3XNn0upb.mjs +2 -0
- package/dist/global-options-DiKj2cQy.mjs +2 -0
- package/dist/{google-tag-gateway-D7iFDVEa.mjs → google-tag-gateway-C5WYsSXv.mjs} +2 -2
- package/dist/{healthchecks-B4jTcKV7.mjs → healthchecks-BA1fmzTm.mjs} +5 -5
- package/dist/{hyperdrive-1432DM-p.mjs → hyperdrive-Ch6klUp3.mjs} +4 -4
- package/dist/iam-LlGEzRCq.mjs +62 -0
- package/dist/{images-Ttea4khD.mjs → images-C5WqUXkK.mjs} +11 -11
- package/dist/index.mjs +1 -1
- package/dist/{init-BeYrAg7Q.mjs → init-EVsjBrOz.mjs} +2 -2
- package/dist/{intel-CJznBf5n.mjs → intel-vcWyslaX.mjs} +18 -19
- package/dist/{interactive-DsU8VDvK.mjs → interactive-BCDFSPtq.mjs} +1 -1
- package/dist/{internal-DOho_iA0.mjs → internal-BhV9WjLp.mjs} +1 -1
- package/dist/{ips-BgNoRwFN.mjs → ips-CqHjVsqd.mjs} +1 -1
- package/dist/{k2-Cj1ORHul.mjs → k2-CZT2Pd5J.mjs} +2 -2
- package/dist/kv-Ipa7dnvF.mjs +12 -0
- package/dist/{lazy-command-DeTzOWvU.mjs → lazy-command-DbKVgdGT.mjs} +1 -1
- package/dist/{leaked-credential-checks-21Wc7OqL.mjs → leaked-credential-checks-EzT4TTjO.mjs} +4 -4
- package/dist/{live-BfrWKfq8.mjs → live-C9L1bNuE.mjs} +1 -1
- package/dist/load-balancers-Cb3VkSfc.mjs +84 -0
- package/dist/local-D5Vq6ooZ.mjs +2 -0
- package/dist/{local-CvzO-cQH.mjs → local-DIJ7SIKC.mjs} +1 -1
- package/dist/{local-runtime-DOpR_Tnc.mjs → local-runtime-BZjgkacr.mjs} +1 -1
- package/dist/{login-CVWkMh1L.mjs → login-DG5ebyab.mjs} +1 -1
- package/dist/login-DRJugxya.mjs +2 -0
- package/dist/logpush-C5Gw7F_9.mjs +68 -0
- package/dist/logs-y3REfHbb.mjs +51 -0
- package/dist/magic-network-monitoring-BZBGZB6M.mjs +34 -0
- package/dist/{magic-transit-BhP424T-.mjs → magic-transit-BPV_POf5.mjs} +129 -129
- package/dist/{managed-defense-6l_B3hn_.mjs → managed-defense-BaUBSUcz.mjs} +3 -3
- package/dist/{managed-transforms-D7FMBsnq.mjs → managed-transforms-CjkjLzMC.mjs} +2 -2
- package/dist/{mcp-BUOfMkBP.mjs → mcp-RPtrISTy.mjs} +6 -6
- package/dist/{mesh-B1RrhAT1.mjs → mesh-DZ4QHBPE.mjs} +5 -5
- package/dist/{migrate-BTU8AvlP.mjs → migrate-CRIUqGi2.mjs} +1 -1
- package/dist/{monetization-Da3ooFLC.mjs → monetization-CVZqM8Xo.mjs} +9 -5
- package/dist/{network-CjhSzhMm.mjs → network-DLt2JUo1.mjs} +15 -15
- package/dist/{network-interconnects-DEQD6GM8.mjs → network-interconnects-9nS5jL__.mjs} +10 -10
- package/dist/o11y-ySxrnP1Z.mjs +88 -0
- package/dist/{oauth-Dnog5v-Q.mjs → oauth-CFVUl-Wv.mjs} +1 -1
- package/dist/{oauth-DdXkpU44.mjs → oauth-Cidoyxfp.mjs} +1 -1
- package/dist/observability-C-KNh__y.mjs +4 -0
- package/dist/ohttp-gateway-B5nCl4s3.mjs +8 -0
- package/dist/organizations-DbeeWUL4.mjs +71 -0
- package/dist/output-BZQEl3mK.mjs +2 -0
- package/dist/package-B7RgwuFR.mjs +2 -0
- package/dist/{page-rules-D2eFbKWb.mjs → page-rules-DRw763O1.mjs} +4 -4
- package/dist/{pages-DYZDvWK6.mjs → pages-DfQnxiTk.mjs} +12 -12
- package/dist/{pay-per-crawl-CgPFv5HT.mjs → pay-per-crawl-EHYtSKxX.mjs} +13 -13
- package/dist/{pay-per-use-BIQrsrTy.mjs → pay-per-use-wdEhl8k4.mjs} +14 -12
- package/dist/{pipelines-D6pkhlpm.mjs → pipelines-DbyrI6F4.mjs} +11 -11
- package/dist/precursor-Dx8lN4UJ.mjs +4 -0
- package/dist/previews-DEVNSip2.mjs +6 -0
- package/dist/{progress-B-CVX0kn.mjs → progress-yvPscjYg.mjs} +1 -1
- package/dist/{prompt-DJF_Rs5S.mjs → prompt-CEpZ-lQZ.mjs} +1 -1
- package/dist/{queues-DaqLO-UO.mjs → queues-DgMc7Z6A.mjs} +18 -18
- package/dist/{r2-DDIU9JN3.mjs → r2-BpTVicIq.mjs} +43 -43
- package/dist/{radar-D59qCgld.mjs → radar-DW-S1VUh.mjs} +11 -11
- package/dist/{raw-fetch-BrOxDN9k.mjs → raw-fetch-Cl5spWC3.mjs} +1 -1
- package/dist/{ready-DgE08svD.mjs → ready-d0li0X6r.mjs} +1 -1
- package/dist/realtime-DMKHLYF4.mjs +170 -0
- package/dist/registrar-D23gfKBi.mjs +43 -0
- package/dist/{registrar-sandbox-uzs3eOKk.mjs → registrar-sandbox-lVLB1-mC.mjs} +4 -4
- package/dist/{reporting-Dx2YTick.mjs → reporting-WX8P3Y0k.mjs} +2 -2
- package/dist/{request-headers-DHzBX7dQ.mjs → request-headers-C0FpeBhz.mjs} +1 -1
- package/dist/{request-tracers-B49cBKkj.mjs → request-tracers-qd7XOAka.mjs} +2 -2
- package/dist/resource-sharing-B2ZSt_cA.mjs +36 -0
- package/dist/{rules-CjgLSlUC.mjs → rules-CB0QQTB3.mjs} +5 -5
- package/dist/rulesets-DmqwixUC.mjs +42 -0
- package/dist/{rum-vPEpMS_h.mjs → rum-BZ_24qZU.mjs} +9 -9
- package/dist/{run-BZ6Fj3jQ.mjs → run-BOKI1uWa.mjs} +1 -1
- package/dist/run-DBqOjD1P.mjs +2 -0
- package/dist/{schema-DuLIZRhA.mjs → schema-Dj9STsWI.mjs} +1 -1
- package/dist/{schema-cache-C_rvto6Y.mjs → schema-cache-5NkOj7Y3.mjs} +1 -1
- package/dist/schema-flags-CXm9iIv6.mjs +4 -0
- package/dist/{scim-BA7XbsSu.mjs → scim-DchxaJfE.mjs} +8 -8
- package/dist/{secrets-store-MEUNt1Ph.mjs → secrets-store-oAft1cFE.mjs} +5 -5
- package/dist/security-insights-DMm0qg_m.mjs +62 -0
- package/dist/{security-txt-DikhnR2L.mjs → security-txt-CIt0494b.mjs} +2 -2
- package/dist/{session-BOnam-Wv.mjs → session-vzNfUhPl.mjs} +1 -1
- package/dist/{shared-DmmWSObC.mjs → shared-MK-_lkbn.mjs} +1 -1
- package/dist/{signed-url-C-24KbWB.mjs → signed-url-gNangfwc.mjs} +1 -1
- package/dist/{smart-shield-DPqLMz7M.mjs → smart-shield-Boy_qbqd.mjs} +6 -6
- package/dist/{snippets-Bi3Uq1DF.mjs → snippets-DdoDYXW-.mjs} +3 -3
- package/dist/{spawn-C3hzWVrJ.mjs → spawn-B5F4OIHG.mjs} +1 -1
- package/dist/{spectrum-BaWKMoAl.mjs → spectrum-DLYIHelC.mjs} +3 -3
- package/dist/{speed-DShjlpAs.mjs → speed-DugG9Tm9.mjs} +2 -2
- package/dist/{sql-DCoFf15T.mjs → sql-Bb56llsb.mjs} +2 -2
- package/dist/src-BoSDeQ9m.mjs +133 -0
- package/dist/{ssl-C4nt4pJK.mjs → ssl-Bg4X3WGk.mjs} +24 -24
- package/dist/startup-profile-DQVkZZpb.mjs +2 -0
- package/dist/{startup-profile-CFJ_Lu1c.mjs → startup-profile-DZL2DC44.mjs} +1 -1
- package/dist/state-DW3QZtfh.mjs +2 -0
- package/dist/{state-DmjHXZat.mjs → state-mr5ux1Nb.mjs} +1 -1
- package/dist/{stream-CpZbnSpH.mjs → stream-BuZYDbNR.mjs} +21 -21
- package/dist/{tags-BIjQ3Kjh.mjs → tags-SKz2odE_.mjs} +12 -6
- package/dist/{telemetry-BDhqOpUw.mjs → telemetry-B4zmCpT0.mjs} +1 -1
- package/dist/telemetry-DkDUr4KK.mjs +2 -0
- package/dist/tenant-custom-nameservers-BhkhBerL.mjs +8 -0
- package/dist/tenants-DD-GMq0K.mjs +13 -0
- package/dist/{tools-C-vmgYSv.mjs → tools-KW_4hvzY.mjs} +1 -1
- package/dist/{tunnels-CXAO2CeL.mjs → tunnels-D90ztENM.mjs} +6 -6
- package/dist/{turnstile-Ctm0rs0q.mjs → turnstile-DhSU_Xar.mjs} +4 -4
- package/dist/ui-xjCox-gU.mjs +2 -0
- package/dist/{update-check-D_Wtw0_D.mjs → update-check-CRttabfu.mjs} +1 -1
- package/dist/{update-check-Dc7cRFlx.mjs → update-check-HltjTMDE.mjs} +1 -1
- package/dist/update-check-worker.mjs +1 -1
- package/dist/{url-normalization-DOfc2Q7a.mjs → url-normalization-K7gkmPvG.mjs} +2 -2
- package/dist/{url-scanner-J8M3X2tR.mjs → url-scanner-BRdWwka4.mjs} +3 -3
- package/dist/{user-BaF0qvvO.mjs → user-Cmb1_Wu5.mjs} +50 -52
- package/dist/{vectorize-D5qiggZU.mjs → vectorize-BTBerJME.mjs} +11 -11
- package/dist/verify-B9ILCohg.mjs +2 -0
- package/dist/verify-BCuWaO-L.mjs +2 -0
- package/dist/version-6Bpy6Bgt.mjs +2 -0
- package/dist/{waiting-rooms-BdmAq7ul.mjs → waiting-rooms-LymmKIGr.mjs} +16 -14
- package/dist/{web-assets-BySw_Tme.mjs → web-assets-LHPQsrnY.mjs} +21 -21
- package/dist/{web3-BKkKf1RF.mjs → web3-BsOio0Ae.mjs} +12 -12
- package/dist/workers-BnLiOjZf.mjs +39 -0
- package/dist/{workers-builds-CVJ4FqzB.mjs → workers-builds-sKpITeRk.mjs} +4 -4
- package/dist/{workers-for-platforms-mzdtmr6r.mjs → workers-for-platforms-BGp6yr6P.mjs} +9 -9
- package/dist/workers-vpc-D8lefWDo.mjs +12 -0
- package/dist/{workflows-Cr957c4U.mjs → workflows-B-ZIG3y7.mjs} +22 -22
- package/dist/{wrangler-migration-DZV7-4Fp.mjs → wrangler-migration-6E6wT_LZ.mjs} +67 -58
- package/dist/zaraz-BBKki5WS.mjs +22 -0
- package/dist/{zero-trust-BVCvQJ4e.mjs → zero-trust-BZDXM5r6.mjs} +487 -409
- package/dist/{zones-BzyjOT10.mjs → zones-B-UV_DGE.mjs} +24 -24
- package/package.json +16 -16
- package/dist/abuse-reports-zPrsxbRz.mjs +0 -24
- package/dist/ai-audit-DI4Rw2wl.mjs +0 -6
- package/dist/ai-search-QOenIzDL.mjs +0 -74
- package/dist/analytics-CQ-Yt1mm.mjs +0 -17
- package/dist/analytics-engine-CdrY5-95.mjs +0 -4
- package/dist/api-X3wKppsT.mjs +0 -3
- package/dist/argo-BiefH8wc.mjs +0 -14
- package/dist/auth-Czzy5Rs_.mjs +0 -2
- package/dist/auth-D5Yj9eYU.mjs +0 -2
- package/dist/billing-BrLJqlOf.mjs +0 -22
- package/dist/body-parser-BKcZS9iJ.mjs +0 -2
- package/dist/bot-management-BSBVuKc0.mjs +0 -9
- package/dist/brand-protection-Byoa1hvj.mjs +0 -26
- package/dist/browser-run-BSVANGzU.mjs +0 -40
- package/dist/build-CPKxZ3kL.mjs +0 -2
- package/dist/build-Dwd1_7o0.mjs +0 -2
- package/dist/cache-0xCdyNg9.mjs +0 -36
- package/dist/chunk-3PJ54H4K-CY8EY_n2.mjs +0 -363
- package/dist/create-BtmuVqVL.mjs +0 -2
- package/dist/custom-csrs-Dl_daAbX.mjs +0 -10
- package/dist/custom-nameservers-Bw2P7F_W.mjs +0 -8
- package/dist/custom-pages-CJ7ecSX6.mjs +0 -20
- package/dist/d1-BsWI546w.mjs +0 -89
- package/dist/email-domains-1Nx60ETD.mjs +0 -12
- package/dist/error-sanitization-B025CygB.mjs +0 -2
- package/dist/get-Be821dio.mjs +0 -2
- package/dist/iam-DuZenYtc.mjs +0 -48
- package/dist/kv-CTyuvcAz.mjs +0 -12
- package/dist/load-balancers-DMTsh-9q.mjs +0 -72
- package/dist/local-CWTti4ot.mjs +0 -2
- package/dist/login-Djz5mvHJ.mjs +0 -2
- package/dist/logpush-OMhp7VgE.mjs +0 -44
- package/dist/logs-BSyyNwso.mjs +0 -35
- package/dist/magic-cloud-networking-DD29yMnE.mjs +0 -68
- package/dist/magic-network-monitoring-DRRvSrDP.mjs +0 -34
- package/dist/o11y-DeNxXxcp.mjs +0 -86
- package/dist/oauth-clients-UnbMcHkx.mjs +0 -14
- package/dist/oauth-scopes-DbtnZVO4.mjs +0 -4
- package/dist/organization-IsxVyWol.mjs +0 -73
- package/dist/organizations-p8Mgo8A7.mjs +0 -4
- package/dist/origin-post-quantum-encryption-Bwysyttf.mjs +0 -6
- package/dist/output-BJEgbI0G.mjs +0 -2
- package/dist/package-BOE_De2L.mjs +0 -2
- package/dist/precursor-B35P8h6h.mjs +0 -4
- package/dist/previews-B1mqjXaJ.mjs +0 -6
- package/dist/realtime-DWjdrDzv.mjs +0 -168
- package/dist/registrar-uYOU1U27.mjs +0 -43
- package/dist/resource-sharing-CIsLVAcK.mjs +0 -36
- package/dist/rulesets-C7_aZA7m.mjs +0 -34
- package/dist/run-D4-K_cbQ.mjs +0 -2
- package/dist/schema-flags-Cr6kleor.mjs +0 -4
- package/dist/security-insights-ZKtey62s.mjs +0 -40
- package/dist/src-jyCTFHcS.mjs +0 -131
- package/dist/startup-profile-D_Qjgca1.mjs +0 -2
- package/dist/state-C7lNNN31.mjs +0 -2
- package/dist/telemetry-BZdRnr26.mjs +0 -2
- package/dist/tenant-CqYoylyU.mjs +0 -10
- package/dist/tenant-custom-nameservers-DDzzdyY3.mjs +0 -8
- package/dist/ui-BUCBQ3Sq.mjs +0 -2
- package/dist/version-DNcdABcr.mjs +0 -2
- package/dist/workers-TS0oQ-XH.mjs +0 -39
- package/dist/workers-vpc-xB1hHFPd.mjs +0 -12
- package/dist/zaraz-C8__FhOh.mjs +0 -22
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./theme-BGHWSKCw.mjs";import"./api-X3wKppsT.mjs";import{t}from"./path-DRw6Y-nd.mjs";import{n,t as r}from"./local-CvzO-cQH.mjs";import{a as i,i as a,n as o}from"./auth-D5Yj9eYU.mjs";import{a as s,t as c}from"./context-BvLXzoMs.mjs";import{t as l}from"./output-BJEgbI0G.mjs";import{t as u}from"./dry-run-gy0Hl9xo.mjs";import{t as d}from"./progress-B-CVX0kn.mjs";import{n as f,t as p}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{a as m,n as h,r as g,s as _,t as v}from"./body-parser-BKcZS9iJ.mjs";import{n as y}from"./input-validation-D7z60HJH.mjs";import{a as ee,i as b,n as te,o as x,r as S}from"./prompt-DJF_Rs5S.mjs";import{a as C,i as w,n as T,r as E,t as D}from"./schema-cache-C_rvto6Y.mjs";import{a as O,c as k,d as A,i as ne,o as re,r as j,s as M,t as ie,u as ae}from"./schema-flags-Cr6kleor.mjs";import{domainToASCII as oe}from"node:url";import{isDeepStrictEqual as se}from"node:util";var N={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/extensions/${e.extension}`};function ce(e){return e.usage("$0 registrar extensions get <extension>\n\nReturns metadata and JSON Schema documents describing the expected input structure for registration and transfer operations on a specific extension (TLD). Supports HTTP conditional GET via `ETag`. Include the `ETag` value from a previous response in an `If-None-Match` header to receive a `304 Not Modified` when the data has not changed.").positional(`extension`,{type:`string`,description:"The extension name (e.g., `com`, `co.uk`).",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const le={command:`get <extension>`,describe:`Get extension`,builder:ce,handler:async e=>p({command:`registrar extensions get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar extensions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/extensions/${e.extension==null?`<extension>`:encodeURIComponent(String(e.extension))}`,pathParams:{extension:String(e.extension??``)},bodyKind:`none`});return}let t=await o(e),n=e.local?r:await c();e.accountId=n;let i=await d(`Loading`,async()=>t.send(N,{account_id:n,extension:e.extension}));l(i,{successLabel:`Loaded`})})};var ue={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/extensions`,query:[`name`,`cursor`,`per_page`,`direction`,`sort_by`]};function de(e){return e.usage("$0 registrar extensions list\n\nReturns metadata and JSON Schema documents describing the expected input structure for registration and transfer operations on each supported extension (TLD). This endpoint uses cursor-based pagination. Results are ordered by extension name by default. To fetch the next page, pass the `cursor` value from the `result_info` object in the response as the `cursor` query parameter in your next request. An empty `cursor` string indicates there are no more pages. Supports HTTP conditional GET via `ETag`. Include the `ETag` value from a previous response in an `If-None-Match` header to receive a `304 Not Modified` when the data has not changed.").option(`name`,{type:`string`,description:"Filter extensions by exact name match.\nFor example, `name=com` returns only the `com` extension."}).option(`cursor`,{type:`string`,description:`Opaque token from a previous response's \`result_info.cursor\`.
|
|
3
|
-
Pass this value to fetch the next page of results. Omit (or
|
|
4
|
-
pass an empty string) for the first page.`}).option(`per-page`,{type:`number`,description:`Number of items to return per page.`}).option(`direction`,{type:`string`,description:`Sort direction for results. Defaults to ascending order.`,choices:[`asc`,`desc`]}).option(`sort-by`,{type:`string`,description:"Column to sort results by. Defaults to `name` when omitted.",choices:[`name`,`created_at`,`updated_at`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const fe={command:`list`,describe:`List extensions`,builder:de,handler:async e=>p({command:`registrar extensions list`,classification:{safeFlags:[`direction`,`sort-by`,`dry-run`]}},e,async()=>{let t={name:e.name,cursor:e.cursor,per_page:e[`per-page`],direction:e.direction,sort_by:e[`sort-by`]};if(e.dryRun){let e=await s();u({command:`cf registrar extensions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/registrar/extensions`,pathParams:{},query:t,bodyKind:`none`});return}let n=await o(e),i=e.local?r:await c();e.accountId=i;let a=await d(`Loading`,async()=>n.send(ue,{account_id:i,...t}));l(a,{successLabel:`Loaded`})})},pe={command:`extensions`,describe:`Operations for extensions`,builder:e=>e.command(le).command(fe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var P={method:`POST`,path:e=>t`/accounts/${e.account_id}/registrar/domain-check`,body:`json`,errors:{400:`BadRequestError`}};function me(e){return e.usage("$0 registrar registrations check <domains...>\n\nPerforms real-time, authoritative availability checks directly against domain registries. Use this endpoint to verify a domain is available before attempting registration via `POST /registrations`. **Important:** Unlike the Search endpoint, these results are authoritative and reflect current registry status. Always check availability immediately before registration as domain status can change rapidly. **Note:** This endpoint uses POST to accept a list of domains in the request body. It is a read-only operation — it does not create, modify, or reserve any domains. ### Extension support Only domains on extensions supported for programmatic registration by this API can be registered. If you check a domain on an unsupported extension, the response will include `registrable: false` with a `reason` field explaining why: - `extension_not_supported_via_api` — Cloudflare Registrar supports this extension in the dashboard, but it is not yet available for programmatic registration via this API. Register via `https://dash.cloudflare.com/{account_id}/domains/registrations` instead. - `extension_not_supported` — This extension is not supported by Cloudflare Registrar. - `extension_disallows_registration` — The extension's registry has temporarily or permanently frozen new registrations. No registrar can register domains on this extension at this time. - `domain_premium` — The domain is premium priced. Premium registration is not currently supported by this API. - `domain_unavailable` — The domain is already registered, reserved, or otherwise not available for registration on a supported extension. The `reason` field is only present when `registrable` is `false`. ### Behavior - Maximum 20 domains per request - Pricing is only returned for domains where `registrable: true` - Results are not cached; each request queries the registry ### Workflow 1. Call this endpoint with domains the user wants to register. 2. For each domain where `registrable: true`, present pricing to the user. 3. If `tier: premium`, note that premium registration is not currently supported by this API and do not proceed to `POST /registrations`. 4. Proceed to `POST /registrations` only for supported non-premium domains.").positional(`domains`,{type:`string`,array:!0,description:"List of fully qualified domain names (FQDNs) to check for availability. Each domain must include the extension. - Minimum: 1 domain. - Maximum: 20 domains per request. - The response returns domains on unsupported extensions with `registrable: false` and a `reason` field. - The response may omit malformed domain names (e.g., names missing an extension). ",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`List of fully qualified domain names (FQDNs) to check. Each domain must include the extension (e.g., "example.com", not "example").`})}const he={command:`check <domains...>`,describe:`Check domain availability`,builder:me,handler:async e=>p({command:`registrar registrations check`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar registrations check`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/domain-check`,pathParams:{},bodyKind:`json`,body:e.body===void 0?v({domains:e.domains}):h(e.body)});return}let t=await o(e),n=e.local?r:await c();if(e.accountId=n,e.body){let r=h(e.body),i=await d(`Creating`,async()=>t.send(P,{body:r,account_id:n}));l(i,{successLabel:`Created`});return}let i=v({domains:e.domains}),a=await d(`Creating`,async()=>t.send(P,{body:i,account_id:n}));l(a,{successLabel:`Created`})})};var ge={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/registrations/${e.domain_name}/registration-status`};function _e(e){return e.usage("$0 registrar registrations get-registration-status <domain-name>\n\nReturns the current status of a domain registration workflow. Use this endpoint to poll for completion when the POST response returned `202 Accepted`. The URL is provided in the `links.self` field of the workflow status response. Poll this endpoint until the workflow reaches a terminal state or a state that requires user attention. **Terminal states:** `succeeded` and `failed` are terminal and always have `completed: true`. **Non-terminal states:** - `action_required` has `completed: false` and will not resolve on its own. The workflow is paused pending user intervention. - `blocked` has `completed: false` and indicates the workflow is waiting on a third party such as the extension registry or losing registrar. Continue polling while informing the user of the delay. Use increasing backoff between polls. When `state: blocked`, use a longer polling interval and do not poll indefinitely. A naive polling loop that only checks `completed` can run indefinitely when `state: action_required`. Break explicitly on `action_required`: ```js let status; do { await new Promise(r => setTimeout(r, 2000)); status = await cloudflare.request({ method: 'GET', path: reg.result.links.self, }); } while ( !status.result.completed && status.result.state !== 'action_required' ); if (status.result.state === 'action_required') { // Surface context.action and context.confirmation_sent_to to the user. // Do not re-submit the registration request. } ```").positional(`domain-name`,{type:`string`,description:"Provides a fully qualified domain name (FQDN), including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration. Cloudflare permits only one registration per domain, making the domain name a natural idempotency key for registration requests.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`get-registration-status <domain-name>`,describe:`Get Registration Status`,builder:_e,handler:async e=>p({command:`registrar registrations get-registration-status`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar registrations get-registration-status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations/${e[`domain-name`]==null?`<domain-name>`:encodeURIComponent(String(e[`domain-name`]))}/registration-status`,pathParams:{"domain-name":String(e[`domain-name`]??``)},bodyKind:`none`});return}let t=await o(e),n=e.local?r:await c();e.accountId=n;let i=await d(`Loading`,async()=>t.send(ge,{account_id:n,domain_name:e[`domain-name`]}));l(i,{successLabel:`Loaded`})})};var ye={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/registrations/${e.domain_name}/transfer-in-status`};function be(e){return e.usage("$0 registrar registrations get-transfer-status <domain-name>\n\nReturns the current status of a domain transfer workflow. Use this endpoint to poll transfer progress after initiating a transfer with `POST /accounts/{account_id}/registrar/registrations/{domain_name}/transfer-in`. The URL is provided in the `links.self` field of the transfer response. ### Transfer timelines Transfers typically take 1–10 days due to ICANN-mandated approval windows. ### Workflow states **Terminal states:** `succeeded` and `failed` are terminal and always have `completed: true`. **Non-terminal states:** - `in_progress`: Transfer has been submitted to the registry and is being processed. Continue polling. - `blocked`: The workflow is waiting on the losing registrar or registry to release the domain. This is the **most common state** for transfers and is entirely normal — it means the ICANN transfer approval window is in effect. The losing registrar has up to 5 days to approve or reject. Continue polling with longer intervals (e.g., every 30–60 minutes). - `action_required`: The user needs to take action (e.g., the FOA email needs to be accepted). See `context` for details on what is needed. - `pending`: Transfer workflow created but not yet started processing. ### Polling guidance Adjust your polling interval based on the current workflow state: - `pending` or `in_progress`: Poll every 30 seconds. - `blocked`: The transfer is waiting on a third party (e.g., losing registrar approval). Poll every 30–60 minutes. - `action_required`: Stop polling. The workflow will not advance until the user takes action. Check `context` for details on what is needed. - `succeeded` or `failed`: Terminal — stop polling.").positional(`domain-name`,{type:`string`,description:"Provides a fully qualified domain name (FQDN), including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration. Cloudflare permits only one registration per domain, making the domain name a natural idempotency key for registration requests.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`get-transfer-status <domain-name>`,describe:`Get Transfer Status`,builder:be,handler:async e=>p({command:`registrar registrations get-transfer-status`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar registrations get-transfer-status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations/${e[`domain-name`]==null?`<domain-name>`:encodeURIComponent(String(e[`domain-name`]))}/transfer-in-status`,pathParams:{"domain-name":String(e[`domain-name`]??``)},bodyKind:`none`});return}let t=await o(e),n=e.local?r:await c();e.accountId=n;let i=await d(`Loading`,async()=>t.send(ye,{account_id:n,domain_name:e[`domain-name`]}));l(i,{successLabel:`Loaded`})})};var Se={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/registrations/${e.domain_name}/update-status`};function Ce(e){return e.usage("$0 registrar registrations get-update-status <domain-name>\n\nReturns the current status of a domain update workflow. Use this endpoint to poll for completion when the PATCH response returned `202 Accepted`. The URL is provided in the `links.self` field of the workflow status response. Poll this endpoint until the workflow reaches a terminal state or a state that requires user attention. Use increasing backoff between polls. When the workflow remains blocked on a third party, use a longer polling interval and do not poll indefinitely.").positional(`domain-name`,{type:`string`,description:"Provides a fully qualified domain name (FQDN), including the extension (e.g., `example.com`, `mybrand.app`). The domain name uniquely identifies a registration. Cloudflare permits only one registration per domain, making the domain name a natural idempotency key for registration requests.",demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const we={command:`get-update-status <domain-name>`,describe:`Get Update Status`,builder:Ce,handler:async e=>p({command:`registrar registrations get-update-status`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar registrations get-update-status`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations/${e[`domain-name`]==null?`<domain-name>`:encodeURIComponent(String(e[`domain-name`]))}/update-status`,pathParams:{"domain-name":String(e[`domain-name`]??``)},bodyKind:`none`});return}let t=await o(e),n=e.local?r:await c();e.accountId=n;let i=await d(`Loading`,async()=>t.send(Se,{account_id:n,domain_name:e[`domain-name`]}));l(i,{successLabel:`Loaded`})})};var Te={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/registrations/${e.domain_name}`};function Ee(e){return e.usage("$0 registrar registrations get <domain-name>\n\nReturns the current state of a domain registration. This is the canonical read endpoint for a domain you own. It returns the full registration resource including current settings and expiration. When the registration resource is ready, both `created_at` and `expires_at` are present in the response.").positional(`domain-name`,{type:`string`,description:`Domain name to retrieve.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const De={command:`get <domain-name>`,describe:`Get Registration`,builder:Ee,handler:async e=>p({command:`registrar registrations get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar registrations get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations/${e[`domain-name`]==null?`<domain-name>`:encodeURIComponent(String(e[`domain-name`]))}`,pathParams:{"domain-name":String(e[`domain-name`]??``)},bodyKind:`none`});return}let t=await o(e),n=e.local?r:await c();e.accountId=n;let i=await d(`Loading`,async()=>t.send(Te,{account_id:n,domain_name:e[`domain-name`]}));l(i,{successLabel:`Loaded`})})};var Oe={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/registrations`,query:[`cursor`,`per_page`,`direction`,`sort_by`]};function ke(e){return e.usage("$0 registrar registrations list\n\nReturns a paginated list of domain registrations owned by the account. This endpoint uses cursor-based pagination. Results are ordered by registration date by default. To fetch the next page, pass the `cursor` value from the `result_info` object in the response as the `cursor` query parameter in your next request. An empty `cursor` string indicates there are no more pages.").option(`cursor`,{type:`string`,description:`Opaque token from a previous response's \`result_info.cursor\`.
|
|
5
|
-
Pass this value to fetch the next page of results. Omit (or
|
|
6
|
-
pass an empty string) for the first page.`}).option(`per-page`,{type:`number`,description:`Number of items to return per page.`}).option(`direction`,{type:`string`,description:`Sort direction for results. Defaults to ascending order.`,choices:[`asc`,`desc`]}).option(`sort-by`,{type:`string`,description:"Column to sort results by. Defaults to registration date (`registry_created_at`) when omitted.",choices:[`registry_created_at`,`registry_expires_at`,`name`]}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ae={command:`list`,describe:`List Registrations`,builder:ke,handler:async e=>p({command:`registrar registrations list`,classification:{safeFlags:[`direction`,`sort-by`,`dry-run`]}},e,async()=>{let t={cursor:e.cursor,per_page:e[`per-page`],direction:e.direction,sort_by:e[`sort-by`]};if(e.dryRun){let e=await s();u({command:`cf registrar registrations list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/registrar/registrations`,pathParams:{},query:t,bodyKind:`none`});return}let n=await o(e),i=e.local?r:await c();e.accountId=i;let a=await d(`Loading`,async()=>n.send(Oe,{account_id:i,...t}));l(a,{successLabel:`Loaded`})})};var je={method:`GET`,path:e=>t`/accounts/${e.account_id}/registrar/domain-search`,query:[`q`,`extensions`,`limit`],joined:[`extensions`],errors:{400:`BadRequestError`}};function Me(e){return e.usage('$0 registrar registrations search\n\nSearches for domain name suggestions based on a keyword, phrase, or partial domain name. Returns a list of potentially available domains with pricing information. **Important:** Results are non-authoritative and based on cached data. Always use the `/domain-check` endpoint to verify real-time availability before attempting registration. Suggestions are scoped to extensions supported for programmatic registration via this API (`POST /registrations`). Domains on unsupported extensions will not appear in results, even if they are available at the registry level. ### Use cases - Brand name discovery (e.g., "acme corp" → acmecorp.com, acmecorp.dev) - Keyword-based suggestions (e.g., "coffee shop" → coffeeshop.com, mycoffeeshop.net) - Alternative extension discovery (e.g., "example.com" → example.com, example.app, example.xyz) ### Workflow 1. Call this endpoint with a keyword or domain name. 2. Present suggestions to the user. 3. Call `/domain-check` with the user\'s chosen domains to confirm real-time availability and pricing. 4. Proceed to `POST /registrations` only for supported non-premium domains where the Check response returns `registrable: true`. **Note:** Searching with just a domain extension (e.g., "com" or ".app") is not supported. Provide a keyword or domain name.').option(`query`,{type:`string`,description:`The search term to find domain suggestions. Accepts keywords, phrases, or full domain names.
|
|
7
|
-
- Phrases: "coffee shop" returns coffeeshop.com, mycoffeeshop.net, etc.
|
|
8
|
-
- Domain names: "example.com" returns example.com and variations across extensions`,demandOption:!0}).option(`extensions`,{type:`string`,array:!0,description:`Limits results to specific domain extensions from the supported set. If not specified,
|
|
9
|
-
returns results across all supported extensions. Extensions not in the supported
|
|
10
|
-
set are silently ignored.`}).option(`limit`,{type:`number`,description:`Maximum number of domain suggestions to return. Defaults to 20 if not specified.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Ne={command:`search`,describe:`Search for available domains`,builder:Me,handler:async e=>p({command:`registrar registrations search`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={q:e.query,extensions:e.extensions,limit:e.limit};if(e.dryRun){let e=await s();u({command:`cf registrar registrations search`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/registrar/domain-search`,pathParams:{},query:t,bodyKind:`none`});return}let n=await o(e),i=e.local?r:await c();e.accountId=i;let a=await d(`Loading`,async()=>n.send(je,{account_id:i,...t}));l(a,{successLabel:`Loaded`})})};var Pe={method:`POST`,path:e=>t`/accounts/${e.account_id}/registrar/domain-transfer-check`,body:`json`,errors:{400:`BadRequestError`,503:`ServiceUnavailableError`}};function Fe(e){return e.usage("$0 registrar registrations transfer-check\n\nPerforms real-time, authoritative eligibility checks directly against needed requirements. Use this endpoint to verify a domain is available before attempting a transfer via `POST /registrations/:domain_name/transfer-in`. **Note:** This endpoint uses POST to accept a list of domains in the request body. It is a read-only operation — it does not create, modify, or reserve any domains. ### Behavior - Maximum 10 domains per request - Pricing is only returned for domains where `transferable: true` - Results are not cached; each request queries the registry & other needed upstreams ## Extension Support All `.uk` extensions (`.uk`, `.co.uk`, etc) do not support auth codes. As such, Cloudflare will ignore the `auth_code` section of this request for `.uk` domains. This means that a `.uk` domain depends on public data to obtain domain information, so it might be a few minutes outdated. ### Workflow 1. Call this endpoint with domains the user wants to transfer. 2. For each domain where `transferable: true`, present pricing to the user. 3. For each domain where `transferable: false`, present reasons to the user 4. Proceed to `POST /registrations/:domain_name/transfer-in` only for the `transferable: true` domains.").option(`domains`,{type:`string`,description:`List of domain objects to evaluate for transfer eligibility. 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:`List of transferable domain objects to check.`})}const Ie={command:`transfer-check`,describe:`Check domain transfer eligibility`,builder:Fe,handler:async e=>p({command:`registrar registrations transfer-check`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await s();u({command:`cf registrar registrations transfer-check`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/domain-transfer-check`,pathParams:{},bodyKind:`json`,body:e.body===void 0?v({domains:m(e.domains,`domains`)}):h(e.body)});return}let t=await o(e),n=e.local?r:await c();if(e.accountId=n,e.body){let r=h(e.body),i=await d(`Creating`,async()=>t.send(Pe,{body:r,account_id:n}));l(i,{successLabel:`Created`});return}if(e.domains===void 0)throw Error(`--domains is required (or pass --body with this field set).`);let i=v({domains:m(e.domains,`domains`)}),a=await d(`Creating`,async()=>t.send(Pe,{body:i,account_id:n}));l(a,{successLabel:`Created`})})};function Le(e){return e.usage("$0 registrar registrations transfer-in <domain-name>\n\nStarts a domain transfer-in workflow. This is typically a billable operation — successful transfers charge the account's default payment method, except for extensions with zero transfer pricing (e.g. UK extensions). All successful domain transfers are non-refundable. ### How transfers work Domain transfers move a domain from another registrar to Cloudflare. Transfers typically take 1-10 days due to ICANN-mandated approval windows. ### Prerequisites - The domain must already have a zone in the Cloudflare account (added through the dashboard or zone API). - The zone must have DNSSec disabled. - For billable transfers (i.e. extensions with non-zero transfer pricing), the account must have a billing profile with a valid default payment method. Set this up at `https://dash.cloudflare.com/{account_id}/billing/payment-info`. - The domain must be unlocked at the current registrar. - An authorization/EPP code from the current registrar is required, except for UK extensions — see Auth code below. ### Auth code An authorization code (also called EPP code, transfer key, or auth-info code) is required for most extensions, with the exception of UK extensions. Obtain this from your current registrar's control panel. The auth code in the request body must be base64-encoded per RFC 4648 §4 (standard alphabet, no line breaks). ### Response behavior Successful transfer initiation returns `202 Accepted`. Validation or initiation failures return the documented `4XX` responses. Poll `GET /accounts/{account_id}/registrar/registrations/{domain_name}/transfer-in-status` to track progress. ### Premium domains Premium domain transfers are not currently supported by this API. Please use the [dashboard](https://dash.cloudflare.com/) for now. ### Billing The account's default payment method is charged upon successful transfer completion, unless the extension has zero transfer pricing (e.g. UK extensions). The transfer adds time to the domain's existing expiration date (typically 1 year).").positional(`domain-name`,{type:`string`,description:`Domain name to transfer.`,demandOption:!0}).option(`prefer`,{type:`string`,description:"Set to `respond-async` to indicate a preference for asynchronous\nprocessing (RFC 7240)."}).option(`auth-code`,{type:`string`,description:`The EPP/authorization code from your current registrar, base64-encoded
|
|
11
|
-
per RFC 4648 §4. Obtain this from your current registrar's control panel.
|
|
12
|
-
Required for all extensions, except for UK.
|
|
13
|
-
`}).option(`auto-renew`,{type:`boolean`,description:"Enable or disable automatic renewal after transfer. Defaults to `false` if omitted.\n",default:!1}).option(`contact-extensions`,{type:`string`,description:"Registry-specific contact extension values for the registrant.\n`GET /accounts/{account_id}/registrar/extensions/{extension}` documents the\nrequired keys and allowed values for each extension in the\n`transfer_schema.properties.contact_extensions` object.\n\nExamples include `.us` nexus fields, `.uk` registrant type fields,\nand `.ca` legal type fields. Include this object only when the extension's\ntransfer schema defines `contact_extensions`. Provide as a JSON object or @path/to/file.json."}).option(`contacts-administrator-email`,{type:`string`,description:`Email address for the registrant. Used for domain-related
|
|
14
|
-
communications from the registry, including ownership verification
|
|
15
|
-
and renewal notices.
|
|
16
|
-
`}).option(`contacts-administrator-fax`,{type:`string`,description:`Fax number in E.164 format (e.g., \`+1.5555555555\`). Optional.
|
|
17
|
-
Most registrations do not require a fax number.
|
|
18
|
-
`}).option(`contacts-administrator-phone`,{type:`string`,description:"Phone number in E.164 format: `+{country_code}.{number}` without spaces or dashes. Examples: `+1.5555555555` (US), `+44.2071234567` (UK), `+81.312345678` (Japan)."}).option(`contacts-administrator-postal-info-name`,{type:`string`,description:"Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example `Ada Lovelace`; do not send separate first-name or last-name fields."}).option(`contacts-administrator-postal-info-organization`,{type:`string`,description:`Organization or company name. Optional for individual registrants.`}).option(`contacts-billing-email`,{type:`string`,description:`Email address for the registrant. Used for domain-related
|
|
19
|
-
communications from the registry, including ownership verification
|
|
20
|
-
and renewal notices.
|
|
21
|
-
`}).option(`contacts-billing-fax`,{type:`string`,description:`Fax number in E.164 format (e.g., \`+1.5555555555\`). Optional.
|
|
22
|
-
Most registrations do not require a fax number.
|
|
23
|
-
`}).option(`contacts-billing-phone`,{type:`string`,description:"Phone number in E.164 format: `+{country_code}.{number}` without spaces or dashes. Examples: `+1.5555555555` (US), `+44.2071234567` (UK), `+81.312345678` (Japan)."}).option(`contacts-billing-postal-info-name`,{type:`string`,description:"Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example `Ada Lovelace`; do not send separate first-name or last-name fields."}).option(`contacts-billing-postal-info-organization`,{type:`string`,description:`Organization or company name. Optional for individual registrants.`}).option(`contacts-registrant-email`,{type:`string`,description:`Email address for the registrant. Used for domain-related
|
|
24
|
-
communications from the registry, including ownership verification
|
|
25
|
-
and renewal notices.
|
|
26
|
-
`}).option(`contacts-registrant-fax`,{type:`string`,description:`Fax number in E.164 format (e.g., \`+1.5555555555\`). Optional.
|
|
27
|
-
Most registrations do not require a fax number.
|
|
28
|
-
`}).option(`contacts-registrant-phone`,{type:`string`,description:"Phone number in E.164 format: `+{country_code}.{number}` without spaces or dashes. Examples: `+1.5555555555` (US), `+44.2071234567` (UK), `+81.312345678` (Japan)."}).option(`contacts-registrant-postal-info-name`,{type:`string`,description:"Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example `Ada Lovelace`; do not send separate first-name or last-name fields."}).option(`contacts-registrant-postal-info-organization`,{type:`string`,description:`Organization or company name. Optional for individual registrants.`}).option(`contacts-technical-email`,{type:`string`,description:`Email address for the registrant. Used for domain-related
|
|
29
|
-
communications from the registry, including ownership verification
|
|
30
|
-
and renewal notices.
|
|
31
|
-
`}).option(`contacts-technical-fax`,{type:`string`,description:`Fax number in E.164 format (e.g., \`+1.5555555555\`). Optional.
|
|
32
|
-
Most registrations do not require a fax number.
|
|
33
|
-
`}).option(`contacts-technical-phone`,{type:`string`,description:"Phone number in E.164 format: `+{country_code}.{number}` without spaces or dashes. Examples: `+1.5555555555` (US), `+44.2071234567` (UK), `+81.312345678` (Japan)."}).option(`contacts-technical-postal-info-name`,{type:`string`,description:"Full legal name of the contact, including all required name components for an individual or authorized representative. Some registries require a complete personal name that includes a family or last name where applicable. Provide the complete name in this single field, for example `Ada Lovelace`; do not send separate first-name or last-name fields."}).option(`contacts-technical-postal-info-organization`,{type:`string`,description:`Organization or company name. Optional for individual registrants.`}).option(`privacy-mode`,{type:`string`,description:`WHOIS privacy mode to apply after transfer completes. Defaults to
|
|
34
|
-
the extension's default privacy mode (typically \`redaction\`).
|
|
35
|
-
`,choices:[`off`,`redaction`]}).coerce(`privacy-mode`,e=>y(e,`privacy-mode`,`text`)).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([`contacts-administrator-email`,`contacts-administrator-fax`,`contacts-administrator-phone`,`contacts-administrator-postal-info-name`,`contacts-administrator-postal-info-organization`,`contacts-billing-email`,`contacts-billing-fax`,`contacts-billing-phone`,`contacts-billing-postal-info-name`,`contacts-billing-postal-info-organization`,`contacts-registrant-email`,`contacts-registrant-fax`,`contacts-registrant-phone`,`contacts-registrant-postal-info-name`,`contacts-registrant-postal-info-organization`,`contacts-technical-email`,`contacts-technical-fax`,`contacts-technical-phone`,`contacts-technical-postal-info-name`,`contacts-technical-postal-info-organization`].some(t=>e[t]!==void 0)){let t=[`contacts-administrator-email`,`contacts-administrator-phone`,`contacts-administrator-postal-info-name`,`contacts-billing-email`,`contacts-billing-phone`,`contacts-billing-postal-info-name`,`contacts-registrant-email`,`contacts-registrant-phone`,`contacts-registrant-postal-info-name`,`contacts-technical-email`,`contacts-technical-phone`,`contacts-technical-postal-info-name`].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 --contacts-* flag is set`)}return!0})}const Re={command:`transfer-in <domain-name>`,describe:`Initiate Transfer`,builder:Le,handler:async e=>p({command:`registrar registrations transfer-in`,classification:{safeFlags:[`auto-renew`,`privacy-mode`,`dry-run`]}},e,async()=>{let t={};if(e.prefer!==void 0&&(t.Prefer=String(e.prefer)),e.dryRun){let t=await s();u({command:`cf registrar registrations transfer-in`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations/${e[`domain-name`]==null?`<domain-name>`:encodeURIComponent(String(e[`domain-name`]))}/transfer-in`,pathParams:{"domain-name":String(e[`domain-name`]??``)},bodyKind:`json`,body:e.body===void 0?v({auth_code:y(e[`auth-code`],`auth-code`,`text`),auto_renew:e[`auto-renew`],contact_extensions:g(e[`contact-extensions`],`contact-extensions`),contacts:{administrator:{email:y(e[`contacts-administrator-email`],`contacts-administrator-email`,`text`),fax:y(e[`contacts-administrator-fax`],`contacts-administrator-fax`,`text`),phone:y(e[`contacts-administrator-phone`],`contacts-administrator-phone`,`text`),postal_info:{name:y(e[`contacts-administrator-postal-info-name`],`contacts-administrator-postal-info-name`,`text`),organization:y(e[`contacts-administrator-postal-info-organization`],`contacts-administrator-postal-info-organization`,`text`)}},billing:{email:y(e[`contacts-billing-email`],`contacts-billing-email`,`text`),fax:y(e[`contacts-billing-fax`],`contacts-billing-fax`,`text`),phone:y(e[`contacts-billing-phone`],`contacts-billing-phone`,`text`),postal_info:{name:y(e[`contacts-billing-postal-info-name`],`contacts-billing-postal-info-name`,`text`),organization:y(e[`contacts-billing-postal-info-organization`],`contacts-billing-postal-info-organization`,`text`)}},registrant:{email:y(e[`contacts-registrant-email`],`contacts-registrant-email`,`text`),fax:y(e[`contacts-registrant-fax`],`contacts-registrant-fax`,`text`),phone:y(e[`contacts-registrant-phone`],`contacts-registrant-phone`,`text`),postal_info:{name:y(e[`contacts-registrant-postal-info-name`],`contacts-registrant-postal-info-name`,`text`),organization:y(e[`contacts-registrant-postal-info-organization`],`contacts-registrant-postal-info-organization`,`text`)}},technical:{email:y(e[`contacts-technical-email`],`contacts-technical-email`,`text`),fax:y(e[`contacts-technical-fax`],`contacts-technical-fax`,`text`),phone:y(e[`contacts-technical-phone`],`contacts-technical-phone`,`text`),postal_info:{name:y(e[`contacts-technical-postal-info-name`],`contacts-technical-postal-info-name`,`text`),organization:y(e[`contacts-technical-postal-info-organization`],`contacts-technical-postal-info-organization`,`text`)}}},privacy_mode:e[`privacy-mode`]},[[`contact_extensions`]]):h(e.body)});return}let n=await o(e),i=e.local?r:await c();if(e.accountId=i,e.body){let r=h(e.body),o=await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/registrar/registrations/${encodeURIComponent(String(e[`domain-name`]))}/transfer-in`,{body:r,headers:Object.keys(t).length>0?t:void 0}));l(o,{successLabel:`Created`});return}let f={};e[`auth-code`]!==void 0&&_(f,[`auth_code`],y(e[`auth-code`],`auth-code`,`text`)),e[`auto-renew`]!==void 0&&_(f,[`auto_renew`],e[`auto-renew`]),e[`contact-extensions`]!==void 0&&_(f,[`contact_extensions`],g(e[`contact-extensions`],`contact-extensions`)),e[`contacts-administrator-email`]!==void 0&&_(f,[`contacts`,`administrator`,`email`],y(e[`contacts-administrator-email`],`contacts-administrator-email`,`text`)),e[`contacts-administrator-fax`]!==void 0&&_(f,[`contacts`,`administrator`,`fax`],y(e[`contacts-administrator-fax`],`contacts-administrator-fax`,`text`)),e[`contacts-administrator-phone`]!==void 0&&_(f,[`contacts`,`administrator`,`phone`],y(e[`contacts-administrator-phone`],`contacts-administrator-phone`,`text`)),e[`contacts-administrator-postal-info-name`]!==void 0&&_(f,[`contacts`,`administrator`,`postal_info`,`name`],y(e[`contacts-administrator-postal-info-name`],`contacts-administrator-postal-info-name`,`text`)),e[`contacts-administrator-postal-info-organization`]!==void 0&&_(f,[`contacts`,`administrator`,`postal_info`,`organization`],y(e[`contacts-administrator-postal-info-organization`],`contacts-administrator-postal-info-organization`,`text`)),e[`contacts-billing-email`]!==void 0&&_(f,[`contacts`,`billing`,`email`],y(e[`contacts-billing-email`],`contacts-billing-email`,`text`)),e[`contacts-billing-fax`]!==void 0&&_(f,[`contacts`,`billing`,`fax`],y(e[`contacts-billing-fax`],`contacts-billing-fax`,`text`)),e[`contacts-billing-phone`]!==void 0&&_(f,[`contacts`,`billing`,`phone`],y(e[`contacts-billing-phone`],`contacts-billing-phone`,`text`)),e[`contacts-billing-postal-info-name`]!==void 0&&_(f,[`contacts`,`billing`,`postal_info`,`name`],y(e[`contacts-billing-postal-info-name`],`contacts-billing-postal-info-name`,`text`)),e[`contacts-billing-postal-info-organization`]!==void 0&&_(f,[`contacts`,`billing`,`postal_info`,`organization`],y(e[`contacts-billing-postal-info-organization`],`contacts-billing-postal-info-organization`,`text`)),e[`contacts-registrant-email`]!==void 0&&_(f,[`contacts`,`registrant`,`email`],y(e[`contacts-registrant-email`],`contacts-registrant-email`,`text`)),e[`contacts-registrant-fax`]!==void 0&&_(f,[`contacts`,`registrant`,`fax`],y(e[`contacts-registrant-fax`],`contacts-registrant-fax`,`text`)),e[`contacts-registrant-phone`]!==void 0&&_(f,[`contacts`,`registrant`,`phone`],y(e[`contacts-registrant-phone`],`contacts-registrant-phone`,`text`)),e[`contacts-registrant-postal-info-name`]!==void 0&&_(f,[`contacts`,`registrant`,`postal_info`,`name`],y(e[`contacts-registrant-postal-info-name`],`contacts-registrant-postal-info-name`,`text`)),e[`contacts-registrant-postal-info-organization`]!==void 0&&_(f,[`contacts`,`registrant`,`postal_info`,`organization`],y(e[`contacts-registrant-postal-info-organization`],`contacts-registrant-postal-info-organization`,`text`)),e[`contacts-technical-email`]!==void 0&&_(f,[`contacts`,`technical`,`email`],y(e[`contacts-technical-email`],`contacts-technical-email`,`text`)),e[`contacts-technical-fax`]!==void 0&&_(f,[`contacts`,`technical`,`fax`],y(e[`contacts-technical-fax`],`contacts-technical-fax`,`text`)),e[`contacts-technical-phone`]!==void 0&&_(f,[`contacts`,`technical`,`phone`],y(e[`contacts-technical-phone`],`contacts-technical-phone`,`text`)),e[`contacts-technical-postal-info-name`]!==void 0&&_(f,[`contacts`,`technical`,`postal_info`,`name`],y(e[`contacts-technical-postal-info-name`],`contacts-technical-postal-info-name`,`text`)),e[`contacts-technical-postal-info-organization`]!==void 0&&_(f,[`contacts`,`technical`,`postal_info`,`organization`],y(e[`contacts-technical-postal-info-organization`],`contacts-technical-postal-info-organization`,`text`)),e[`privacy-mode`]!==void 0&&_(f,[`privacy_mode`],e[`privacy-mode`]);let p=await d(`Creating`,async()=>a(n,`POST`,`/accounts/${i}/registrar/registrations/${encodeURIComponent(String(e[`domain-name`]))}/transfer-in`,{body:f,headers:Object.keys(t).length>0?t:void 0}));l(p,{successLabel:`Created`})})};function ze(e){return e.usage("$0 registrar registrations update <domain-name>\n\nUpdates an existing domain registration. By default, the server holds the connection for a bounded, server-defined amount of time while the update completes. Most updates finish within this window and return `200 OK` with a completed workflow status. If the update is still processing after this synchronous wait window, the server returns `202 Accepted`. Poll the URL in `links.self` to track progress. To skip the wait and receive an immediate `202`, send `Prefer: respond-async`. This endpoint currently supports updating `auto_renew` only.").positional(`domain-name`,{type:`string`,description:`Domain name to update.`,demandOption:!0}).option(`prefer`,{type:`string`,description:"Set to `respond-async` to receive an immediate `202 Accepted` without\nwaiting for the operation to complete (RFC 7240)."}).option(`auto-renew`,{type:`boolean`,description:`Enable or disable automatic renewal.
|
|
36
|
-
Setting this field to \`true\` authorizes Cloudflare to charge the
|
|
37
|
-
account's default payment method up to 30 days before domain expiry
|
|
38
|
-
to renew the domain automatically. Renewal pricing may change over
|
|
39
|
-
time based on registry pricing.
|
|
40
|
-
`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request to update an existing domain registration. This endpoint currently supports updating `auto_renew` only. "})}const Be={command:`update <domain-name>`,describe:`Update Registration`,builder:ze,handler:async e=>p({command:`registrar registrations update`,classification:{safeFlags:[`auto-renew`,`dry-run`]}},e,async()=>{let t={};if(e.prefer!==void 0&&(t.Prefer=String(e.prefer)),e.dryRun){let t=await s();u({command:`cf registrar registrations update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/registrar/registrations/${e[`domain-name`]==null?`<domain-name>`:encodeURIComponent(String(e[`domain-name`]))}`,pathParams:{"domain-name":String(e[`domain-name`]??``)},bodyKind:`json`,body:e.body===void 0?v({auto_renew:e[`auto-renew`]}):h(e.body)});return}let n=await o(e),i=e.local?r:await c();if(e.accountId=i,e.body){let r=h(e.body),o=await d(`Updating`,async()=>a(n,`PATCH`,`/accounts/${i}/registrar/registrations/${encodeURIComponent(String(e[`domain-name`]))}`,{body:r,headers:Object.keys(t).length>0?t:void 0}));l(o,{successLabel:`Updated`});return}let f={};e[`auto-renew`]!==void 0&&_(f,[`auto_renew`],e[`auto-renew`]);let p=await d(`Updating`,async()=>a(n,`PATCH`,`/accounts/${i}/registrar/registrations/${encodeURIComponent(String(e[`domain-name`]))}`,{body:f,headers:Object.keys(t).length>0?t:void 0}));l(p,{successLabel:`Updated`})})};async function F(e,t,n){let r=x(n),i=oe(n.trim().replace(/\.$/,``)).toLowerCase(),a=await d(`Checking availability`,()=>e.send(P,{account_id:t,body:{domains:[n]}})),o=i===``?[]:a.domains.filter(e=>e.name.toLowerCase()===i),s=o.length===1?o[0]:void 0;if(!s)throw Error(`The availability check returned no result for ${r}, so cf cannot safely register it.`);if(s.registrable!==!0&&s.reason===`domain_premium`)throw Error(`${r} is a premium domain (domain_premium). Premium registration is not supported by this API, so cf will not submit it.`);if(s.registrable!==!0){let e=s.reason===void 0?``:` (${x(s.reason)})`;throw Error(`${r} is not available for registration${e}.`)}if(s.tier===`premium`)throw Error(`${r} is a premium domain. Premium registration is not supported by this API, so cf will not submit it.`);if(s.tier!==`standard`)throw Error(`${r} is not confirmed as a standard domain. This API only supports standard registrations, so cf will not submit it.`);if(!s.pricing)throw Error(`The availability check returned no pricing for ${r}, so cf cannot safely register it.`);return s.pricing}const Ve=`registrar-extension-schema`;function He(e){let t=e.trim().toLowerCase().replace(/\.$/,``).split(`.`);return t.slice(1).map((e,n)=>t.slice(n+1).join(`.`))}async function Ue(e,t,n,r){let i;try{i=r===void 0?await n.send(N,{account_id:t,extension:e}):await n.send(N,{account_id:t,extension:e},{timeoutInSeconds:r/1e3,maxRetries:0})}catch(e){return{ok:!1,reason:T(e)}}let a=E(i,`registration_schema`);return a?{ok:!0,extension:e,schema:a}:{ok:!1,reason:`the API returned no registration schema for .${e}`}}async function I(e,t,n,r,i){let a=t?[t]:He(e);if(a.length===0)return{ok:!1,reason:`'${e}' has no extension — pass a fully qualified domain name`};let o,s=`not found`;for(let e of a){let t=w(Ve,[n,e]);if(t)return{ok:!0,extension:e,schema:t};if(!o)try{o=await r()}catch(e){return{ok:!1,reason:T(e)}}let a;if(i!==void 0&&(a=i-Date.now(),a<=0))return{ok:!1,reason:`the request timed out`};let c=await Ue(e,n,o,a);if(c.ok)return C(Ve,[n,e],c.schema),c;if(s=c.reason,!/not found/i.test(c.reason))return c}return{ok:!1,reason:a.length>1?`no registration schema for ${a.map(e=>`.${e}`).join(` or `)} (${s})`:s}}const We=/* @__PURE__ */ new Set([`domain_name`,`years`,`auto_renew`,`privacy_mode`]),Ge={acknowledgements:`Acknowledgements`,contact_extensions:`Registry Details`,contacts:`Contacts`};function L(e,t){return e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0}function Ke(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).split(/[-_\s]+/).filter(Boolean).map(e=>`${e[0]?.toUpperCase()??``}${e.slice(1)}`).join(` `)}function R(e){return typeof e==`boolean`?e?`Yes`:`No`:e===null?`null`:typeof e==`string`||typeof e==`number`?String(e):JSON.stringify(e)??`undefined`}function z(e,t){return e.find(e=>e.path.length===t.length&&e.path.every((e,n)=>e===t[n]))}function qe(e,t,n){if(typeof t==`boolean`&&e.some(e=>e.includes(`acknowledgement`)))return t?`Accepted`:`Declined`;let r=z(n,e),i=R(t),a=L(r?.choiceLabels,i);if(a)return`${a} (${i})`;let o=(r?.schema.oneOf??r?.schema.anyOf)?.find(e=>e.title&&A(e,t).length===0);return o?.title?`${o.title} (${i})`:i}function Je(e,t){return e.map((n,r)=>r===e.length-1&&t?.schema.title?t.schema.title:L(Ge,n)??Ke(n)).join(` · `)}function B(e,t,n=[]){let r=[];for(let[i,a]of Object.entries(e)){if(n.length===0&&We.has(i))continue;let e=[...n,i];if(typeof a==`object`&&a&&!Array.isArray(a)&&Object.keys(a).length>0){r.push(...B(a,t,e));continue}let o=z(t,e);r.push([Je(e,o),qe(e,a,t)])}return r.sort(([e],[t])=>e.localeCompare(t))}function V(e,t,n){if(Object.hasOwn(e,n))return R(e[n]);let r=Ye(t,n);return r===void 0?`API default`:`${R(r)} (default)`}function H(e){return e===void 0?[]:[...e.default===void 0?[]:[e.default],...(e.allOf??[]).flatMap(H)]}function U(e,t){return e===void 0?[]:[...H(e.properties?.[t]),...(e.allOf??[]).flatMap(e=>U(e,t))]}function Ye(e,t){let n=U(e,t),r=n[0];return n.length>0&&n.every(e=>se(e,r))?r:void 0}function W(t){let n=t.map(([e,t])=>[x(e),x(t)]),r=Math.min(32,Math.max(...n.map(([e])=>e.length),0));return n.map(([t,n])=>`│ ${e.muted(t.padEnd(r))} ${e.bold(n)}`)}function Xe(t){let n=[[`Domain`,t.domain],[`Account`,t.accountId],[`Registration term`,`${t.years} ${t.years===1?`year`:`years`}`],[`Due now`,t.quotedCost],[`Renewal price`,`${t.pricing.currency} ${t.pricing.renewal_cost} per year`],[`Auto-renew`,V(t.body,t.schema,`auto_renew`)],[`Privacy mode`,V(t.body,t.schema,`privacy_mode`)]],r=B(t.body,t.descriptors??[]);return[`│`,`${e.brand(`◇`)} ${e.bold(`Review registration`)}`,`│`,...W(n),...r.length>0?[`│`,`│ ${e.bold(`Registration details`)}`,...W(r)]:[],`│`].join(`
|
|
41
|
-
`)}const G=[`domain_name`],K=`Fully qualified domain name to register, e.g. example.travel`,q=[`domain-name`,`domainName`,`extension`,`force`,`f`,`prefer`,`contacts`];function Ze(e){return`/${e.map(e=>e.replace(/~/g,`~0`).replace(/\//g,`~1`)).join(`/`)}`}function Qe(e,t,n){return t.some(t=>{if(t.path[0]!==e||t.path.length===1)return!1;let r=t.name.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase());return Object.hasOwn(n,t.name)&&n[t.name]!==void 0||Object.hasOwn(n,r)&&n[r]!==void 0})}function $e(e){if(e.choices===void 0)return;let t=(e.schema.enum??(e.schema.oneOf??e.schema.anyOf)?.flatMap(e=>e.const===void 0?e.enum??[]:[e.const]))?.filter(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`);return t?.length===e.choices.length?t:void 0}function et(e){let t=e.type===`boolean`&&e.schema.const===!0,n=e.schema.description,r=n===void 0?void 0:x(n);return{path:Ze(e.path),flag:`--${e.name}`,question:M(e),description:r,choices:$e(e)?.map(t=>{let n=String(t),r=e.choiceLabels!==void 0&&Object.hasOwn(e.choiceLabels,n)?e.choiceLabels[n]??n:n;return{value:t,label:x(r)}}),requiredValue:e.schema.const,acknowledgementText:t?r:void 0}}function J(e,t,n,r,i){let a=O(n,r);return a.length!==0&&(l({submitted:!1,reason:`registration_input_required`,message:`Not submitted. Additional registration input is required.`,domainName:e,extension:t,missingFields:a.map(et),validationErrors:i}),!0)}function tt(e){let t=/^(\d+)(?:\.(\d+))?$/.exec(e);if(!t)return;let n=t[2]??``;return{units:BigInt(`${t[1]}${n}`),scale:n.length}}function nt(e,t){let n=tt(e.registration_cost),r=tt(e.renewal_cost);if(!n||!r)return;let i=Math.max(n.scale,r.scale),a=e=>10n**BigInt(e),o=n.units*a(i-n.scale)+r.units*a(i-r.scale)*BigInt(t-1);if(i===0)return o.toString();let s=a(i);return`${o/s}.${(o%s).toString().padStart(i,`0`)}`}function rt(e,t){let n=nt(e,t);if(!n||!/^[A-Z]{3}$/.test(e.currency))throw Error(`The availability check returned invalid pricing, so cf cannot safely confirm this registration.`);return`${e.currency} ${n}`}function Y(e,t){return e.flatMap(e=>t.map(t=>[...e,...t]))}function X(e,t,n,r=!1,i=[]){let a=e.properties?.[t],o=a!==void 0,s=[a===void 0?[]:[a]],c=e.if&&e.then&&j(e.if)&&A(e.if,n).length===0?[e.then]:[];for(let a of[...e.allOf??[],...c]){let e=X(a,t,n,r,i);e.found&&(o=!0,s=Y(s,e.bundles))}for(let a of[e.oneOf,e.anyOf]){if(!a?.length)continue;let e=r&&a.every(j)?a.filter(e=>st(e,t,n,i)):[],c=(e.length>0?e:a).map(e=>X(e,t,n,r,i));c.some(e=>e.found)&&(o=!0,s=Y(s,c.flatMap(e=>e.bundles)))}return{found:o,bundles:s}}function Z(e,t){let n=e[t];return[...n===void 0?[]:[n],...(e.allOf??[]).flatMap(e=>Z(e,t))]}function Q(e){return e.length===0?{}:e.length===1?e[0]??{}:{allOf:e}}function it(e){let t=[...typeof e.minimum==`number`?[e.exclusiveMinimum===!0?Math.floor(e.minimum)+1:Math.ceil(e.minimum)]:[],...typeof e.exclusiveMinimum==`number`?[Math.floor(e.exclusiveMinimum)+1]:[],...(e.allOf??[]).flatMap(e=>{let t=it(e);return t===void 0?[]:[t]})];return t.length>0?Math.max(1,...t):void 0}function at(e){let t=Z(e,`const`);if(t.length>0)return t.every(e=>Object.is(e,t[0]))?{found:!0,value:t[0]}:{found:!1};let n=Z(e,`default`);if(n.length>0)return n.every(e=>Object.is(e,n[0]))?{found:!0,value:n[0]}:{found:!1};let r=it(e);return r===void 0?{found:!1}:{found:!0,value:r}}function $(e){let{allOf:t,anyOf:n,oneOf:r,...i}=e,a=[Object.keys(i).length===0?[]:[i]];for(let e of t??[])a=Y(a,$(e).map(e=>[e]));for(let e of[r,n])e?.length&&(a=Y(a,e.flatMap(e=>$(e).map(e=>[e]))));return a.map(Q)}function ot(e){return e.flatMap(e=>$(e).map(t=>({schema:e,candidate:at(t)})))}function st(e,t,n,r){let i=A(e,n);return Object.hasOwn(n,t)||i.length===0?i.length===0:r.some(r=>A(e,{...n,[t]:r}).length===0)}function ct(e,t){let n=Object.hasOwn(e,`years`),r=X(t,`years`,e,!1);if(!r.found)throw Error(`The extension schema returned no registration-term field, so cf cannot safely confirm this registration.`);let i=r.bundles.map(Q),a=X(t,`years`,e,!0,n?[]:ot(i).flatMap(({schema:e,candidate:t})=>t.found&&A(e,t.value).length===0?[t.value]:[]));if(!a.found||n&&a.bundles.some(e=>e.length===0))throw Error(`The extension schema returned no registration-term field, so cf cannot safely confirm this registration.`);let o=a.bundles.map(Q),s=o,c,l;if(n)l=e.years;else{let n=ot(o).filter(({schema:e,candidate:t})=>{if(!t.found)return!0;let[n]=A(e,t.value);return n===void 0||(c??=n,!1)});if(j(t)){let r=n.filter(({candidate:e})=>!e.found),i=n.filter(({candidate:n})=>n.found&&A(t,{...e,years:n.value}).length===0);i.length>0&&(n=[...r,...i])}s=n.map(({schema:e})=>e);let r=n.map(({candidate:e})=>e),[i]=r;l=i?.found===!0&&r.every(e=>e.found&&Object.is(e.value,i.value))?i.value:void 0}if(typeof l!=`number`||!Number.isInteger(l)||l<=0)throw!n&&s.length===0&&c?Error(`The extension schema returned an invalid default registration term: ${c}`):Error(n?`The requested registration term must be a positive whole number of years.`:`The extension schema returned no safe default registration term, so cf cannot safely confirm this registration.`);let u=n?A(o.length===1?o[0]??{}:{anyOf:o},l):s.flatMap(e=>A(e,l));if(u.length>0)throw Error(n?`The requested registration term is invalid: ${u[0]}`:`The extension schema returned an invalid default registration term: ${u[0]}`);return e.years=l,l}let lt;function ut(e){let t=y(e,`domain-name`,`text`);if(t!==void 0&&typeof t!=`string`)throw Error(`--domain-name must be a string`);return t}function dt(e){return lt=e,e.positional(`domain-name`,{type:`string`,description:`Fully qualified domain name, e.g. example.travel`}).option(`extension`,{type:`string`,description:`Extension whose registration schema to use (default: derived from the domain)`}).option(`prefer`,{type:`string`,description:"Set the Prefer header, e.g. `respond-async` to skip the synchronous wait"}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip the registration confirmation prompt`,default:!1}).option(`contacts`,{type:`string`,description:`Registrant contacts as inline JSON or @path to a reusable JSON file`}).option(`body`,{type:`string`,description:`Raw JSON request body, or @path to a JSON file`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).strictOptions(!1).help(!1).option(`help`,{type:`boolean`,alias:`h`,description:`Show help, including this extension's input flags`}).epilogue("Input flags depend on the extension: run `cf registrar registrations create <domain> --help`.\ncf rechecks availability and pricing before confirmation. Run `cf registrar registrations check --domains <domain>` to inspect them separately.")}async function ft(t){lt?.showHelp(`log`);let n=ut(t[`domain-name`]);if(!n)return;let r=x(n);if(t.local){console.log(`\n${e.muted(`Registration fields are unavailable in local mode.`)}`);return}let a=Date.now()+D,s=await i(a);if(!s){console.log(`\n${e.muted(`Set \`CLOUDFLARE_ACCOUNT_ID\` or sign in with \`cf auth login\` to see the registration fields for ${r}.`)}`);return}let c=await I(n,t.extension,s,()=>o(t),a);console.log(c.ok?`\n${re(k(c.schema,{exclude:[G]}),`Registration fields for .${c.extension}`)}`:`\n${e.muted(`Could not load the registration fields for ${r}: ${x(c.reason)}.`)}`)}async function pt(e,t,n){for(;;){let r=ne(e,t,n);if(r.length===0)return!0;for(let e of r){let n=e.description??``,r=M(e);if(e.type===`boolean`&&e.schema.const===!0){let r=x(e.schema.description??n);if(!await S(e.name,r))return!1;t[e.name]=!0}else e.choices?.length?t[e.name]=await b(e.name,r,e.choices,e.choiceLabels):t[e.name]=await ee(e.name,r,{validate:t=>ae(e,t)})}}}function mt(e){let t=h(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`--body must contain a JSON object`);return t}function ht(e){let t;if(e.startsWith(`@`))t=y(e,`contacts`,`json`);else try{t=JSON.parse(e)}catch{throw Error(`--contacts must contain a JSON object or @path to a JSON file`)}if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`--contacts must contain a JSON object or @path to a JSON file`);return t}var gt=f({command:`create [domain-name]`,describe:"Register a domain. Billable and non-refundable — input fields are extension-specific, see `create <domain> --help`",builder:dt,handler:async e=>{if(e.help){await ft(e);return}if(e.local)throw Error(n);let t={};e.prefer!==void 0&&(t.Prefer=String(e.prefer));let r;if(e.body!==void 0){let t=ie([],e,{reserved:q}).errors.some(e=>e.startsWith(`Unknown flag`));if(e.contacts!==void 0||t)throw Error(`--body cannot be combined with registration field flags. Pass one or the other.`);r=mt(e.body)}let i=e.contacts===void 0?void 0:ht(e.contacts),f=ut(e[`domain-name`]),p=r?.domain_name;if(p!==void 0&&typeof p!=`string`)throw Error(`--body field domain_name must be a string`);if(f!==void 0&&p!==void 0&&f!==p)throw Error(`The positional domain '${x(f)}' does not match --body domain_name '${x(p)}'`);let m=f??p;if(!m){if(r!==void 0){l({submitted:!1,reason:`registration_input_required`,message:`Not submitted. A domain is required to determine the registration schema.`,missingFields:[{path:`/domain_name`,flag:`--domain-name`,question:K}],validationErrors:["`/domain_name` is required"]});return}m=await ee(`domain-name`,K)}let h=x(m);r&&(r.domain_name=m);let g=e.dryRun?await s()??`<account-id>`:await c(),_,v=async()=>(_||=await o(e),_);e.dryRun||await F(await v(),g,m);let y=await I(m,e.extension,g,v);if(!y.ok)throw Error(`Could not load the registration schema for ${h}: ${x(y.reason)}.`);let b=x(y.extension),S=y.schema,C=k(y.schema,{exclude:[G]});if(!r){if(i!==void 0&&Qe(`contacts`,C,e))throw Error(`--contacts cannot be combined with --contacts-* fields. Pass one or the other.`);let t={...e},n=i===void 0?void 0:{contacts:i};if(n!==void 0&&delete t.contacts,!await pt(C,t,n))return;let a=ie(C,t,{reserved:q,baseBody:n});if(a.errors.length>0)throw Error(`${a.errors.join(`
|
|
42
|
-
`)}\n\nRun \`cf registrar registrations create ${h} --help\` for .${b}'s registration fields.`);r={domain_name:m,...a.body}}let w;try{w=ct(r,S)}catch(e){let t=A(S,r);if(J(m,y.extension,C,r,t))return;throw e}let T=A(S,r);if(J(m,y.extension,C,r,T))return;if(T.length>0)throw Error(`${T.join(`
|
|
43
|
-
`)}\n\nRun \`cf registrar registrations create ${h} --help\` for this extension's registration fields.`);if(e.dryRun){u({command:`cf registrar registrations create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${g}/registrar/registrations`,pathParams:{},bodyKind:`json`,body:r});return}let E=await F(await v(),g,m),D=rt(E,w);if(e.force||process.stderr.write(`${Xe({domain:m,accountId:g,years:w,quotedCost:D,pricing:E,body:r,schema:S,descriptors:C})}\n`),!await te({force:e.force,message:`Registering ${h} for ${w} ${w===1?`year`:`years`} costs ${D}, charges the account's default payment method, and cannot be refunded.`}))return;if(r.years!==w)throw Error(`The registration term changed after confirmation, so cf will not submit this registration.`);let O=await F(await v(),g,m);if(O.currency!==E.currency||O.registration_cost!==E.registration_cost||O.renewal_cost!==E.renewal_cost)throw Error(`Availability or pricing changed while awaiting confirmation, so cf will not submit this registration. Re-run the command to review the current quote.`);let ne=await v();e.accountId=g;let re=await d(`Registering`,async()=>a(ne,`POST`,`/accounts/${g}/registrar/registrations`,{body:r,headers:Object.keys(t).length>0?t:void 0}));l(re,{successLabel:`Registered ${h}`})}},{command:`registrar registrations create`,recordArgs:!1});const _t={command:`registrations`,describe:`Operations for registrations`,builder:e=>e.command(he).command(gt).command(De).command(ve).command(xe).command(we).command(Ae).command(Ne).command(Ie).command(Re).command(Be).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},vt={command:`registrar`,describe:`registrar`,builder:e=>e.command(pe).command(_t).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{vt as default};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CvzO-cQH.mjs";import{n}from"./auth-D5Yj9eYU.mjs";import{a as r,t as i}from"./context-BvLXzoMs.mjs";import{t as a}from"./output-BJEgbI0G.mjs";import{t as o}from"./dry-run-gy0Hl9xo.mjs";import{t as s}from"./progress-B-CVX0kn.mjs";import{t as c}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{a as l,n as u,r as d,t as f}from"./body-parser-BKcZS9iJ.mjs";import{n as p}from"./input-validation-D7z60HJH.mjs";import{a as m,i as h,n as g}from"./prompt-DJF_Rs5S.mjs";var _={method:`POST`,path:t=>e`/accounts/${t.account_id}/shares`,body:`json`};function ee(e){return e.usage(`$0 resource-sharing create
|
|
3
|
-
|
|
4
|
-
Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.`).option(`name`,{type:`string`,description:`The name of the share.`}).option(`recipients`,{type:`string`,description:`The recipients field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`resources`,{type:`string`,description:`The resources field. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const v={command:`create`,describe:`Trigger a share creation`,builder:ee,handler:async e=>c({command:`resource-sharing create`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares`,pathParams:{},bodyKind:`json`,body:e.body===void 0?f({name:p(e.name,`name`,`text`),recipients:l(e.recipients,`recipients`),resources:l(e.resources,`resources`)}):u(e.body)});return}let c=await n(e),d=e.local?t:await i();if(e.accountId=d,e.body){let t=u(e.body),n=await s(`Creating`,async()=>c.send(_,{body:t,account_id:d}));a(n,{successLabel:`Created`});return}if(e.name===void 0&&(e.name=await m(`name`,`The name of the share.`)),e.recipients===void 0)throw Error(`--recipients is required (or pass --body with this field set).`);if(e.resources===void 0)throw Error(`--resources is required (or pass --body with this field set).`);let h=f({name:p(e.name,`name`,`text`),recipients:l(e.recipients,`recipients`),resources:l(e.resources,`resources`)}),g=await s(`Creating`,async()=>c.send(_,{body:h,account_id:d}));a(g,{successLabel:`Created`})})};var te={method:`DELETE`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}`};function ne(e){return e.usage(`$0 resource-sharing delete <share-id>
|
|
5
|
-
|
|
6
|
-
Deletion is not immediate, an updated share object with a new status will be returned.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const re={command:`delete <share-id>`,describe:`Trigger a share deletion`,builder:ne,handler:async e=>c({command:`resource-sharing delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``)},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,!await g({force:!!e.force,message:`Are you sure? This action cannot be undone.`}))return;let u=await s(`Deleting`,async()=>c.send(te,{account_id:l,share_id:e[`share-id`]}));a(u,{successLabel:`Deleted`})})};var y={method:`POST`,path:t=>e`/accounts/${t.account_id_path}/shares/${t.share_id}/excluded-recipients`,body:`json`};function b(e){return e.usage(`$0 resource-sharing excluded-recipients create <share-id>
|
|
7
|
-
|
|
8
|
-
Excludes a single account from an organization-targeted share. The share continues to target the entire organization, but the excluded account is skipped during reconciliation.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`account-id-path`,{type:`string`,description:`Account identifier.`,demandOption:!0}).option(`account-id`,{type:`string`,description:`The account to exclude from the organization-targeted share.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const x={command:`create <share-id>`,describe:`Trigger an account exclusion from a share`,builder:b,handler:async e=>c({command:`resource-sharing excluded-recipients create`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){o({command:`cf resource-sharing excluded-recipients create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/excluded-recipients`,pathParams:{"account-id-path":String(e[`account-id-path`]??``),"share-id":String(e[`share-id`]??``)},bodyKind:`json`,body:e.body===void 0?f({account_id:p(e[`account-id`],`account-id`,`text`)}):u(e.body)});return}let t=await n(e);if(e.body){let n=u(e.body),r=await s(`Creating`,async()=>t.send(y,{body:n,account_id_path:e[`account-id-path`],share_id:e[`share-id`]}));a(r,{successLabel:`Created`});return}e[`account-id`]===void 0&&(e[`account-id`]=await m(`account-id`,`The account to exclude from the organization-targeted share.`));let r=f({account_id:p(e[`account-id`],`account-id`,`text`)}),i=await s(`Creating`,async()=>t.send(y,{body:r,account_id_path:e[`account-id-path`],share_id:e[`share-id`]}));a(i,{successLabel:`Created`})})};var S={method:`DELETE`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/excluded-recipients/${t.excluded_recipient_id}`};function C(e){return e.usage(`$0 resource-sharing excluded-recipients delete <excluded-recipient-id>
|
|
9
|
-
|
|
10
|
-
Removes a single account from a share's excluded-recipient list. The account becomes eligible to receive the share again on the next reconciliation cycle.`).positional(`excluded-recipient-id`,{type:`string`,description:`Share Excluded Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const w={command:`delete <excluded-recipient-id>`,describe:`Trigger an account un-exclusion from a share`,builder:C,handler:async e=>c({command:`resource-sharing excluded-recipients delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing excluded-recipients delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/excluded-recipients/${e[`excluded-recipient-id`]==null?`<excluded-recipient-id>`:encodeURIComponent(String(e[`excluded-recipient-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"excluded-recipient-id":String(e[`excluded-recipient-id`]??``)},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,!await g({force:!!e.force}))return;let u=await s(`Deleting`,async()=>c.send(S,{account_id:l,share_id:e[`share-id`],excluded_recipient_id:e[`excluded-recipient-id`]}));a(u,{successLabel:`Deleted`})})};var T={method:`GET`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/excluded-recipients/${t.excluded_recipient_id}`};function E(e){return e.usage(`$0 resource-sharing excluded-recipients get <excluded-recipient-id>
|
|
11
|
-
|
|
12
|
-
Gets a single excluded recipient of a share by its identifier tag.`).positional(`excluded-recipient-id`,{type:`string`,description:`Share Excluded Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const D={command:`get <excluded-recipient-id>`,describe:`Get share excluded recipient by ID`,builder:E,handler:async e=>c({command:`resource-sharing excluded-recipients get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing excluded-recipients get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/excluded-recipients/${e[`excluded-recipient-id`]==null?`<excluded-recipient-id>`:encodeURIComponent(String(e[`excluded-recipient-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"excluded-recipient-id":String(e[`excluded-recipient-id`]??``)},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();e.accountId=l;let u=await s(`Loading`,async()=>c.send(T,{account_id:l,share_id:e[`share-id`],excluded_recipient_id:e[`excluded-recipient-id`]}));a(u,{successLabel:`Loaded`})})};var O={method:`GET`,path:t=>e`/accounts/${t.account_id_path}/shares/${t.share_id}/excluded-recipients`,query:[`page`,`per_page`]};function k(e){return e.usage(`$0 resource-sharing excluded-recipients list
|
|
13
|
-
|
|
14
|
-
Lists the accounts excluded from an organization-targeted share. Only valid for shares with \`target_type=organization\`.`).option(`account-id-path`,{type:`string`,description:`Account identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`List share excluded recipients by share ID`,builder:k,handler:async e=>c({command:`resource-sharing excluded-recipients list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){o({command:`cf resource-sharing excluded-recipients list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/excluded-recipients`,pathParams:{"account-id-path":String(e[`account-id-path`]??``),"share-id":String(e[`share-id`]??``)},query:t,bodyKind:`none`});return}let r=await n(e),i=await s(`Loading`,async()=>r.send(O,{account_id_path:e[`account-id-path`],share_id:e[`share-id`],...t}));a(i,{successLabel:`Loaded`})})};var j={method:`PUT`,path:t=>e`/accounts/${t.account_id_path}/shares/${t.share_id}/excluded-recipients`,body:`json`,response:!1};function M(e){return e.usage(`$0 resource-sharing excluded-recipients update <share-id>
|
|
15
|
-
|
|
16
|
-
Reconciles a share's excluded recipients to match the given list. Only valid for shares with \`target_type=organization\`.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`account-id-path`,{type:`string`,description:`Account identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const N={command:`update <share-id>`,describe:`Trigger excluded-account reconciliation on a share`,builder:M,handler:async e=>c({command:`resource-sharing excluded-recipients update`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){o({command:`cf resource-sharing excluded-recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/excluded-recipients`,pathParams:{"account-id-path":String(e[`account-id-path`]??``),"share-id":String(e[`share-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:u(e.body)});return}let t=await n(e);if(e.body){let n=u(e.body),r=await s(`Updating`,async()=>t.send(j,{body:n,account_id_path:e[`account-id-path`],share_id:e[`share-id`]}));a(r,{successLabel:`Updated`})}else if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})},P={command:`excluded-recipients`,describe:`Operations for excluded-recipients`,builder:e=>e.command(x).command(w).command(D).command(A).command(N).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var F={method:`GET`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}`,query:[`include_resources`,`include_recipient_counts`]};function I(e){return e.usage(`$0 resource-sharing get <share-id>
|
|
17
|
-
|
|
18
|
-
Fetches share by ID.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`get <share-id>`,describe:`Get account share by ID`,builder:I,handler:async e=>c({command:`resource-sharing get`,classification:{safeFlags:[`include-resources`,`include-recipient-counts`,`dry-run`]}},e,async()=>{let c={include_resources:e[`include-resources`],include_recipient_counts:e[`include-recipient-counts`]};if(e.dryRun){let t=await r();o({command:`cf resource-sharing get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(e),u=e.local?t:await i();e.accountId=u;let d=await s(`Loading`,async()=>l.send(F,{account_id:u,share_id:e[`share-id`],...c}));a(d,{successLabel:`Loaded`})})};var R={method:`GET`,path:t=>e`/accounts/${t.account_id}/shares`,query:[`status`,`kind`,`target_type`,`resource_types`,`order`,`direction`,`page`,`per_page`,`include_resources`,`include_recipient_counts`,`tag`]};function z(e){return e.usage(`$0 resource-sharing list
|
|
19
|
-
|
|
20
|
-
Lists all account shares.`).option(`status`,{type:`string`,description:`Filter shares by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`kind`,{type:`string`,description:`Filter shares by kind.`,choices:[`sent`,`received`]}).option(`target-type`,{type:`string`,description:`Filter shares by target_type.`,choices:[`account`,`organization`]}).option(`resource-types`,{type:`string`,array:!0,description:`Filter share resources by resource_types.`}).option(`order`,{type:`string`,description:`Order shares by values in the given field.`,choices:[`name`,`created`]}).option(`direction`,{type:`string`,description:`Direction to sort objects.`,choices:[`asc`,`desc`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response."}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`include-recipient-counts`,{type:`boolean`,description:`Include recipient counts in the response.`}).option(`tag`,{type:`string`,array:!0,description:"Filter shares by tag. Each value is either `key=value` (matches shares whose tags contain that key/value pair) or `key` alone (matches shares that have any value for that key). May be repeated; multiple `tag` parameters are ANDed together. Maximum 20 `tag` parameters per request."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const B={command:`list`,describe:`List account shares`,builder:z,handler:async e=>c({command:`resource-sharing list`,classification:{safeFlags:[`status`,`kind`,`target-type`,`order`,`direction`,`include-resources`,`include-recipient-counts`,`dry-run`]}},e,async()=>{let c={status:e.status,kind:e.kind,target_type:e[`target-type`],resource_types:e[`resource-types`],order:e.order,direction:e.direction,page:e.page,per_page:e[`per-page`],include_resources:e[`include-resources`],include_recipient_counts:e[`include-recipient-counts`],tag:e.tag};if(e.dryRun){let e=await r();o({command:`cf resource-sharing list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/shares`,pathParams:{},query:c,bodyKind:`none`});return}let l=await n(e),u=e.local?t:await i();e.accountId=u;let d=await s(`Loading`,async()=>l.send(R,{account_id:u,...c}));a(d,{successLabel:`Loaded`})})};var V={method:`POST`,path:t=>e`/accounts/${t.account_id_path}/shares/${t.share_id}/recipients`,body:`json`};function H(e){return e.usage(`$0 resource-sharing recipients create <share-id>
|
|
21
|
-
|
|
22
|
-
Adds a single recipient to an account-targeted resource share, granting them access to the shared resources. The recipient account must belong to the same organization as the share owner. To replace the entire recipient list in one call, use \`PUT /accounts/{account_id}/shares/{share_id}/recipients\` instead.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`account-id-path`,{type:`string`,description:`Account identifier.`,demandOption:!0}).option(`account-id`,{type:`string`,description:"Deprecated alias for `recipient_account_id`. Use `recipient_account_id` instead.\nThe body field collided with the URL path parameter of the same name, which prevented SDK generators from distinguishing the source account (in the URL) from the recipient account (in the body). Both names will continue to be accepted until 2027-05-26 (see `x-sunset`).\n"}).option(`organization-id`,{type:`string`,description:`Organization identifier.`}).option(`recipient-account-id`,{type:`string`,description:`The account that will receive the share.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Optionally specify `recipient_account_id` to target a specific account, or `organization_id` to target the caller's whole organization. If neither is provided, the caller's organization is used. The legacy field `account_id` is accepted as a synonym for `recipient_account_id` during the deprecation period (see `x-sunset` on that field). "})}const U={command:`create <share-id>`,describe:`Trigger a recipient addition to a share`,builder:H,handler:async e=>c({command:`resource-sharing recipients create`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){o({command:`cf resource-sharing recipients create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/recipients`,pathParams:{"account-id-path":String(e[`account-id-path`]??``),"share-id":String(e[`share-id`]??``)},bodyKind:`json`,body:e.body===void 0?f({account_id:p(e[`account-id`],`account-id`,`text`),organization_id:p(e[`organization-id`],`organization-id`,`text`),recipient_account_id:p(e[`recipient-account-id`],`recipient-account-id`,`text`)}):u(e.body)});return}let t=await n(e);if(e.body){let n=u(e.body),r=await s(`Creating`,async()=>t.send(V,{body:n,account_id_path:e[`account-id-path`],share_id:e[`share-id`]}));a(r,{successLabel:`Created`});return}let r=f({account_id:p(e[`account-id`],`account-id`,`text`),organization_id:p(e[`organization-id`],`organization-id`,`text`),recipient_account_id:p(e[`recipient-account-id`],`recipient-account-id`,`text`)}),i=await s(`Creating`,async()=>t.send(V,{body:r,account_id_path:e[`account-id-path`],share_id:e[`share-id`]}));a(i,{successLabel:`Created`})})};var W={method:`DELETE`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/recipients/${t.recipient_id}`};function G(e){return e.usage("$0 resource-sharing recipients delete <recipient-id>\n\nPerforms a **soft delete**: sets the recipient's `desired_association_status` to `disassociated`, which signals the background reconciliation workflow (Temporal) to remove the shared resources from the recipient account. The recipient record remains in the database for audit purposes and is still returned by `GET /accounts/{account_id}/shares/{share_id}/recipients` with its updated status. Resource access is not fully removed until the workflow completes and `current_association_status` transitions to `disassociated`. The recipient record itself is never physically deleted.").positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const K={command:`delete <recipient-id>`,describe:`Trigger a recipient removal from a share`,builder:G,handler:async e=>c({command:`resource-sharing recipients delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing recipients delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/recipients/${e[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(e[`recipient-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"recipient-id":String(e[`recipient-id`]??``)},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,!await g({force:!!e.force,message:`Are you sure? This action cannot be undone.`}))return;let u=await s(`Deleting`,async()=>c.send(W,{account_id:l,share_id:e[`share-id`],recipient_id:e[`recipient-id`]}));a(u,{successLabel:`Deleted`})})};var q={method:`GET`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/recipients/${t.recipient_id}`,query:[`include_resources`]};function ie(e){return e.usage(`$0 resource-sharing recipients get <recipient-id>
|
|
23
|
-
|
|
24
|
-
Get share recipient by ID.`).positional(`recipient-id`,{type:`string`,description:`Share Recipient identifier tag.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const J={command:`get <recipient-id>`,describe:`Get share recipient by ID`,builder:ie,handler:async e=>c({command:`resource-sharing recipients get`,classification:{safeFlags:[`include-resources`,`dry-run`]}},e,async()=>{let c={include_resources:e[`include-resources`]};if(e.dryRun){let t=await r();o({command:`cf resource-sharing recipients get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/recipients/${e[`recipient-id`]==null?`<recipient-id>`:encodeURIComponent(String(e[`recipient-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"recipient-id":String(e[`recipient-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(e),u=e.local?t:await i();e.accountId=u;let d=await s(`Loading`,async()=>l.send(q,{account_id:u,share_id:e[`share-id`],recipient_id:e[`recipient-id`],...c}));a(d,{successLabel:`Loaded`})})};var Y={method:`GET`,path:t=>e`/accounts/${t.account_id_path}/shares/${t.share_id}/recipients`,query:[`include_resources`,`page`,`per_page`]};function ae(e){return e.usage('$0 resource-sharing recipients list\n\nList share recipients by share ID. Returns **all** recipients regardless of their `association_status` (associating, associated, disassociating, disassociated). Callers that want only "active" recipients must filter client-side on the `association_status` field.').option(`account-id-path`,{type:`string`,description:`Account identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`include-resources`,{type:`boolean`,description:`Include resources in the response.`}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const oe={command:`list`,describe:`List share recipients by share ID`,builder:ae,handler:async e=>c({command:`resource-sharing recipients list`,classification:{safeFlags:[`include-resources`,`dry-run`]}},e,async()=>{let t={include_resources:e[`include-resources`],page:e.page,per_page:e[`per-page`]};if(e.dryRun){o({command:`cf resource-sharing recipients list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/recipients`,pathParams:{"account-id-path":String(e[`account-id-path`]??``),"share-id":String(e[`share-id`]??``)},query:t,bodyKind:`none`});return}let r=await n(e),i=await s(`Loading`,async()=>r.send(Y,{account_id_path:e[`account-id-path`],share_id:e[`share-id`],...t}));a(i,{successLabel:`Loaded`})})};var se={method:`PUT`,path:t=>e`/accounts/${t.account_id_path}/shares/${t.share_id}/recipients`,body:`json`,response:!1};function ce(e){return e.usage(`$0 resource-sharing recipients update <share-id>
|
|
25
|
-
|
|
26
|
-
Replaces the full recipient list for an account-targeted share. The server computes the diff between the current and desired recipients: new accounts are added, accounts no longer in the list are marked for disassociation, and unchanged accounts are left as-is. Returns an error if the share targets an organization (\`target_type=organization\`); org-targeted shares derive their recipients dynamically from org membership and cannot be modified through this endpoint.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`account-id-path`,{type:`string`,description:`Account identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const le={command:`update <share-id>`,describe:`Trigger recipient reconciliation on a share`,builder:ce,handler:async e=>c({command:`resource-sharing recipients update`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){o({command:`cf resource-sharing recipients update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${e[`account-id-path`]==null?`<account-id-path>`:encodeURIComponent(String(e[`account-id-path`]))}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/recipients`,pathParams:{"account-id-path":String(e[`account-id-path`]??``),"share-id":String(e[`share-id`]??``)},bodyKind:`json`,body:e.body===void 0?void 0:u(e.body)});return}let t=await n(e);if(e.body){let n=u(e.body),r=await s(`Updating`,async()=>t.send(se,{body:n,account_id_path:e[`account-id-path`],share_id:e[`share-id`]}));a(r,{successLabel:`Updated`})}else if(e.body===void 0)throw Error(`--body is required for this command. Pass --body '<json>' or --body @path/to/file.json.`)})},ue={command:`recipients`,describe:`Update share recipients`,builder:e=>e.command(U).command(K).command(J).command(oe).command(le).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var X={method:`POST`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/resources`,body:`json`};function de(e){return e.usage(`$0 resource-sharing resources create <share-id>
|
|
27
|
-
|
|
28
|
-
Adds a resource to an existing share, making it available to share recipients.`).positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`meta`,{type:`string`,description:`Resource Metadata. Provide as a JSON object or @path/to/file.json.`}).option(`resource-account-id`,{type:`string`,description:`Account identifier.`}).option(`resource-id`,{type:`string`,description:`Share Resource identifier.`}).option(`resource-type`,{type:`string`,description:`Resource Type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`,`trust-grant`]}).coerce(`resource-type`,e=>p(e,`resource-type`,`text`)).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const fe={command:`create <share-id>`,describe:`Trigger a resource addition to a share`,builder:de,handler:async e=>c({command:`resource-sharing resources create`,classification:{safeFlags:[`resource-type`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing resources create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/resources`,pathParams:{"share-id":String(e[`share-id`]??``)},bodyKind:`json`,body:e.body===void 0?f({meta:d(e.meta,`meta`,!0),resource_account_id:p(e[`resource-account-id`],`resource-account-id`,`text`),resource_id:p(e[`resource-id`],`resource-id`,`text`),resource_type:e[`resource-type`]},[[`meta`]]):u(e.body,[{path:[`meta`],flag:`meta`}])});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,e.body){let t=u(e.body,[{path:[`meta`],flag:`meta`}]),n=await s(`Creating`,async()=>c.send(X,{body:t,account_id:l,share_id:e[`share-id`]}));a(n,{successLabel:`Created`});return}if(e.meta===void 0)throw Error(`--meta is required (or pass --body with this field set).`);e[`resource-account-id`]===void 0&&(e[`resource-account-id`]=await m(`resource-account-id`,`Account identifier.`)),e[`resource-id`]===void 0&&(e[`resource-id`]=await m(`resource-id`,`Share Resource identifier.`)),e[`resource-type`]===void 0&&(e[`resource-type`]=await h(`resource-type`,`Resource Type.`,[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`,`trust-grant`]));let g=f({meta:d(e.meta,`meta`,!0),resource_account_id:p(e[`resource-account-id`],`resource-account-id`,`text`),resource_id:p(e[`resource-id`],`resource-id`,`text`),resource_type:e[`resource-type`]},[[`meta`]]),_=await s(`Creating`,async()=>c.send(X,{body:g,account_id:l,share_id:e[`share-id`]}));a(_,{successLabel:`Created`})})};var pe={method:`DELETE`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/resources/${t.share_resource_id}`};function me(e){return e.usage(`$0 resource-sharing resources delete <share-resource-id>
|
|
29
|
-
|
|
30
|
-
Deletion is not immediate, an updated share resource object with a new status will be returned.`).positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const he={command:`delete <share-resource-id>`,describe:`Trigger a resource deletion from a share`,builder:me,handler:async e=>c({command:`resource-sharing resources delete`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing resources delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/resources/${e[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(e[`share-resource-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"share-resource-id":String(e[`share-resource-id`]??``)},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,!await g({force:!!e.force,message:`Are you sure? This action cannot be undone.`}))return;let u=await s(`Deleting`,async()=>c.send(pe,{account_id:l,share_id:e[`share-id`],share_resource_id:e[`share-resource-id`]}));a(u,{successLabel:`Deleted`})})};var ge={method:`GET`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/resources/${t.share_resource_id}`};function _e(e){return e.usage(`$0 resource-sharing resources get <share-resource-id>
|
|
31
|
-
|
|
32
|
-
Get share resource by ID.`).positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ve={command:`get <share-resource-id>`,describe:`Get share resource by ID`,builder:_e,handler:async e=>c({command:`resource-sharing resources get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing resources get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/resources/${e[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(e[`share-resource-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"share-resource-id":String(e[`share-resource-id`]??``)},bodyKind:`none`});return}let c=await n(e),l=e.local?t:await i();e.accountId=l;let u=await s(`Loading`,async()=>c.send(ge,{account_id:l,share_id:e[`share-id`],share_resource_id:e[`share-resource-id`]}));a(u,{successLabel:`Loaded`})})};var ye={method:`GET`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/resources`,query:[`status`,`resource_type`,`page`,`per_page`]};function be(e){return e.usage(`$0 resource-sharing resources list
|
|
33
|
-
|
|
34
|
-
List share resources by share ID.`).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`status`,{type:`string`,description:`Filter share resources by status.`,choices:[`active`,`deleting`,`deleted`]}).option(`resource-type`,{type:`string`,description:`Filter share resources by resource_type.`,choices:[`custom-ruleset`,`gateway-policy`,`gateway-destination-ip`,`gateway-block-page-settings`,`gateway-extended-email-matching`,`idp-federation-grant`,`trust-grant`]}).option(`page`,{type:`number`,description:"Page number. Defaults to `1` when `per_page` is supplied without\n`page`. May be omitted entirely along with `per_page` to receive a\nnon-paginated response."}).option(`per-page`,{type:`number`,description:"Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const xe={command:`list`,describe:`List share resources by share ID`,builder:be,handler:async e=>c({command:`resource-sharing resources list`,classification:{safeFlags:[`status`,`resource-type`,`dry-run`]}},e,async()=>{let c={status:e.status,resource_type:e[`resource-type`],page:e.page,per_page:e[`per-page`]};if(e.dryRun){let t=await r();o({command:`cf resource-sharing resources list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/resources`,pathParams:{"share-id":String(e[`share-id`]??``)},query:c,bodyKind:`none`});return}let l=await n(e),u=e.local?t:await i();e.accountId=u;let d=await s(`Loading`,async()=>l.send(ye,{account_id:u,share_id:e[`share-id`],...c}));a(d,{successLabel:`Loaded`})})};var Z={method:`PUT`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}/resources/${t.share_resource_id}`,body:`json`};function Q(e){return e.usage(`$0 resource-sharing resources update <share-resource-id>
|
|
35
|
-
|
|
36
|
-
Update is not immediate, an updated share resource object with a new status will be returned.`).positional(`share-resource-id`,{type:`string`,description:`Share Resource identifier.`,demandOption:!0}).option(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`meta`,{type:`string`,description:`Resource Metadata. Provide as a JSON object or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Se={command:`update <share-resource-id>`,describe:`Trigger a resource metadata update in a share`,builder:Q,handler:async e=>c({command:`resource-sharing resources update`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing resources update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}/resources/${e[`share-resource-id`]==null?`<share-resource-id>`:encodeURIComponent(String(e[`share-resource-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``),"share-resource-id":String(e[`share-resource-id`]??``)},bodyKind:`json`,body:e.body===void 0?f({meta:d(e.meta,`meta`,!0)},[[`meta`]]):u(e.body,[{path:[`meta`],flag:`meta`}])});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,e.body){let t=u(e.body,[{path:[`meta`],flag:`meta`}]),n=await s(`Updating`,async()=>c.send(Z,{body:t,account_id:l,share_id:e[`share-id`],share_resource_id:e[`share-resource-id`]}));a(n,{successLabel:`Updated`});return}if(e.meta===void 0)throw Error(`--meta is required (or pass --body with this field set).`);let p=f({meta:d(e.meta,`meta`,!0)},[[`meta`]]),m=await s(`Updating`,async()=>c.send(Z,{body:p,account_id:l,share_id:e[`share-id`],share_resource_id:e[`share-resource-id`]}));a(m,{successLabel:`Updated`})})},Ce={command:`resources`,describe:`Individual resources (zones, configs) that have been shared with recipients`,builder:e=>e.command(fe).command(he).command(ve).command(xe).command(Se).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var $={method:`PUT`,path:t=>e`/accounts/${t.account_id}/shares/${t.share_id}`,body:`json`};function we(e){return e.usage("$0 resource-sharing update <share-id>\n\nUpdates the share's display name and tags. This endpoint does **not** modify recipients or resources — those are managed via dedicated subresource endpoints: - **Recipients**: Use `POST /accounts/{account_id}/shares/{share_id}/recipients` to add a single recipient, `PUT /accounts/{account_id}/shares/{share_id}/recipients` to replace the full recipient list, or `DELETE /accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` to remove a recipient. - **Resources**: Use the share's resource subresource endpoints. Updating is not immediate; an updated share object with a new status will be returned.").positional(`share-id`,{type:`string`,description:`Share identifier tag.`,demandOption:!0}).option(`name`,{type:`string`,description:`The name of the share.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:"Request body for `PUT /accounts/{account_id}/shares/{share_id}`. The share's display `name` and `tags` can be updated via this endpoint. To modify recipients, use the `/accounts/{account_id}/shares/{share_id}/recipients` subresource endpoints (POST, PUT, DELETE). "})}const Te={command:`update <share-id>`,describe:`Trigger a share rename`,builder:we,handler:async e=>c({command:`resource-sharing update`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=await r();o({command:`cf resource-sharing update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/shares/${e[`share-id`]==null?`<share-id>`:encodeURIComponent(String(e[`share-id`]))}`,pathParams:{"share-id":String(e[`share-id`]??``)},bodyKind:`json`,body:e.body===void 0?f({name:p(e.name,`name`,`text`)}):u(e.body)});return}let c=await n(e),l=e.local?t:await i();if(e.accountId=l,e.body){let t=u(e.body),n=await s(`Updating`,async()=>c.send($,{body:t,account_id:l,share_id:e[`share-id`]}));a(n,{successLabel:`Updated`});return}e.name===void 0&&(e.name=await m(`name`,`The name of the share.`));let d=f({name:p(e.name,`name`,`text`)}),h=await s(`Updating`,async()=>c.send($,{body:d,account_id:l,share_id:e[`share-id`]}));a(h,{successLabel:`Updated`})})},Ee={command:`resource-sharing`,describe:`Share Cloudflare resources (zones, accounts) across organizations with granular access controls`,builder:e=>e.command(v).command(re).command(L).command(B).command(Te).command(P).command(ue).command(Ce).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{Ee as default};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./api-X3wKppsT.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{t}from"./local-CvzO-cQH.mjs";import{i as n,n as r}from"./auth-D5Yj9eYU.mjs";import{a as i,i as a,t as o}from"./context-BvLXzoMs.mjs";import{t as s}from"./output-BJEgbI0G.mjs";import{t as c}from"./dry-run-gy0Hl9xo.mjs";import{t as l}from"./progress-B-CVX0kn.mjs";import{t as u}from"./run-BZ6Fj3jQ.mjs";import"./telemetry-BZdRnr26.mjs";import{a as d,n as f,s as p,t as m}from"./body-parser-BKcZS9iJ.mjs";import{n as h}from"./input-validation-D7z60HJH.mjs";import{a as g,n as _}from"./prompt-DJF_Rs5S.mjs";var v={method:`POST`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/rulesets`,query:[`dry_run`],body:`json`};function y(e){return e.usage(`$0 rulesets create
|
|
3
|
-
|
|
4
|
-
Creates a ruleset.`).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`,default:``}).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).coerce(`kind`,e=>h(e,`kind`,`text`)).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_custom`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).coerce(`phase`,e=>h(e,`phase`,`text`)).option(`rules`,{type:`string`,description:`The list of rules in the ruleset. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const b={command:`create`,describe:`Create an account or zone ruleset`,builder:y,handler:async e=>u({command:`rulesets create`,classification:{safeFlags:[`validate-only`,`kind`,`phase`,`dry-run`]}},e,async()=>{let n={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,r=e.zone===void 0?`accounts`:`zones`,a=e.zone??t??`<account-id>`;c({command:`cf rulesets create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${r}/${a}/rulesets`,pathParams:{"account-or-zone":String(r),"account-or-zone-id":String(a)},query:n,bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),id:h(e.id,`id`,`text`),name:h(e.name,`name`,`text`),kind:e.kind,phase:e.phase,rules:d(e.rules,`rules`)}):f(e.body)});return}let u=await r(e),p=e.zone===void 0?`accounts`:`zones`,_=p===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();if(p===`zones`?e.zoneId=_:e.accountId=_,e.body){let t=f(e.body);new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let r=await l(`Creating`,async()=>u.send(v,{body:t,account_or_zone:p,account_or_zone_id:_,...n}));s(r,{successLabel:`Created`});return}e.id===void 0&&(e.id=await g(`id`,`The unique ID of the ruleset.`));let y=m({description:h(e.description,`description`,`text`),id:h(e.id,`id`,`text`),name:h(e.name,`name`,`text`),kind:e.kind,phase:e.phase,rules:d(e.rules,`rules`)});new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let b=await l(`Creating`,async()=>u.send(v,{body:y,account_or_zone:p,account_or_zone_id:_,...n}));s(b,{successLabel:`Created`})})};function x(e){return e.usage(`$0 rulesets delete <id>
|
|
5
|
-
|
|
6
|
-
Deletes all versions of an existing account or zone ruleset.`).positional(`id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 S={command:`delete <id>`,describe:`Delete an account or zone ruleset`,builder:x,handler:async e=>u({command:`rulesets delete`,classification:{safeFlags:[`validate-only`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{let u={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),id:String(e.id??``)},query:u,bodyKind:`none`});return}let d=await r(e),f=e.zone===void 0?`accounts`:`zones`,p=f===`zones`?await a({zone:e.zone},d,{quiet:e.quiet}):e.local?t:await o();if(f===`zones`?e.zoneId=p:e.accountId=p,!await _({force:!!e.force}))return;let m=await l(`Deleting`,async()=>n(d,`DELETE`,`/${f}/${p}/rulesets/${encodeURIComponent(String(e.id))}`,{query:u}));s(m,{successLabel:`Deleted`})})};function C(e){return e.usage(`$0 rulesets entrypoint get <phase>
|
|
7
|
-
|
|
8
|
-
Fetches the latest version of the account or zone entry point ruleset for a given phase.`).positional(`phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const w={command:`get <phase>`,describe:`Get an account or zone entry point ruleset`,builder:C,handler:async e=>u({command:`rulesets entrypoint get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets entrypoint get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/phases/${e.phase==null?`<phase>`:encodeURIComponent(String(e.phase))}/entrypoint`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),phase:String(e.phase??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/phases/${encodeURIComponent(String(e.phase))}/entrypoint`));s(p,{successLabel:`Loaded`})})};function T(e){return e.usage(`$0 rulesets entrypoint update <phase>
|
|
9
|
-
|
|
10
|
-
Updates an account or zone entry point ruleset, creating a new version.`).positional(`phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`rules`,{type:`string`,description:`The list of rules in the ruleset. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const E={command:`update <phase>`,describe:`Update an account or zone entry point ruleset`,builder:T,handler:async e=>u({command:`rulesets entrypoint update`,classification:{safeFlags:[`validate-only`,`dry-run`]}},e,async()=>{let u={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets entrypoint update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/phases/${e.phase==null?`<phase>`:encodeURIComponent(String(e.phase))}/entrypoint`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),phase:String(e.phase??``)},query:u,bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),id:h(e.id,`id`,`text`),name:h(e.name,`name`,`text`),rules:d(e.rules,`rules`)}):f(e.body)});return}let _=await r(e),v=e.zone===void 0?`accounts`:`zones`,y=v===`zones`?await a({zone:e.zone},_,{quiet:e.quiet}):e.local?t:await o();if(v===`zones`?e.zoneId=y:e.accountId=y,e.body){let t=f(e.body),r=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),i=await l(`Updating`,async()=>n(_,`PUT`,`/${v}/${y}/rulesets/phases/${encodeURIComponent(String(e.phase))}/entrypoint${r?`?`+r:``}`,{body:t}));s(i,{successLabel:`Updated`});return}e.id===void 0&&(e.id=await g(`id`,`The unique ID of the ruleset.`));let b={};e.description!==void 0&&p(b,[`description`],h(e.description,`description`,`text`)),e.id!==void 0&&p(b,[`id`],h(e.id,`id`,`text`)),e.name!==void 0&&p(b,[`name`],h(e.name,`name`,`text`)),e.rules!==void 0&&p(b,[`rules`],d(e.rules,`rules`));let x=new URLSearchParams(Object.entries(u).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString(),S=await l(`Updating`,async()=>n(_,`PUT`,`/${v}/${y}/rulesets/phases/${encodeURIComponent(String(e.phase))}/entrypoint${x?`?`+x:``}`,{body:b}));s(S,{successLabel:`Updated`})})};function D(e){return e.usage(`$0 rulesets entrypoint versions get <ruleset-version>
|
|
11
|
-
|
|
12
|
-
Fetches a specific version of an account or zone entry point ruleset.`).positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const O={command:`get <ruleset-version>`,describe:`Get an account or zone entry point ruleset version`,builder:D,handler:async e=>u({command:`rulesets entrypoint versions get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets entrypoint versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/phases/${e.phase==null?`<phase>`:encodeURIComponent(String(e.phase))}/entrypoint/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),phase:String(e.phase??``),"ruleset-version":String(e[`ruleset-version`]??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/phases/${encodeURIComponent(String(e.phase))}/entrypoint/versions/${encodeURIComponent(String(e[`ruleset-version`]))}`));s(p,{successLabel:`Loaded`})})};function k(e){return e.usage(`$0 rulesets entrypoint versions list
|
|
13
|
-
|
|
14
|
-
Fetches the versions of an account or zone entry point ruleset.`).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const A={command:`list`,describe:`List an account or zone entry point ruleset's versions`,builder:k,handler:async e=>u({command:`rulesets entrypoint versions list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets entrypoint versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/phases/${e.phase==null?`<phase>`:encodeURIComponent(String(e.phase))}/entrypoint/versions`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),phase:String(e.phase??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/phases/${encodeURIComponent(String(e.phase))}/entrypoint/versions`));s(p,{successLabel:`Loaded`})})},j={command:`versions`,describe:`Operations for entrypoint.versions`,builder:e=>e.command(O).command(A).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},M={command:`entrypoint`,describe:`Operations for entrypoint`,builder:e=>e.command(w).command(E).command(j).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function N(e){return e.usage(`$0 rulesets get <id>
|
|
15
|
-
|
|
16
|
-
Fetches the latest version of an account or zone ruleset.`).positional(`id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const P={command:`get <id>`,describe:`Get an account or zone ruleset`,builder:N,handler:async e=>u({command:`rulesets get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),id:String(e.id??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/${encodeURIComponent(String(e.id))}`));s(p,{successLabel:`Loaded`})})};var F={method:`GET`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/rulesets`,query:[`cursor`,`per_page`]};function I(e){return e.usage(`$0 rulesets list
|
|
17
|
-
|
|
18
|
-
Fetches all rulesets.`).option(`cursor`,{type:`string`,description:`The cursor to use for the next page.`}).option(`per-page`,{type:`number`,description:`The number of rulesets to return per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const L={command:`list`,describe:`List account or zone rulesets`,builder:I,handler:async e=>u({command:`rulesets list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let n={cursor:e.cursor,per_page:e[`per-page`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,r=e.zone===void 0?`accounts`:`zones`,a=e.zone??t??`<account-id>`;c({command:`cf rulesets list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${r}/${a}/rulesets`,pathParams:{"account-or-zone":String(r),"account-or-zone-id":String(a)},query:n,bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>u.send(F,{account_or_zone:d,account_or_zone_id:f,...n}));s(p,{successLabel:`Loaded`})})};var R={method:`POST`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/rulesets/${t.ruleset_id}/rules`,query:[`dry_run`],body:`json`};function z(e){return e.usage(`$0 rulesets rules create <ruleset-id>
|
|
19
|
-
|
|
20
|
-
Adds a new rule to an account or zone ruleset. The rule will be added to the end of the existing list of rules in the ruleset by default.`).positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).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(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const B={command:`create <ruleset-id>`,describe:`Create an account or zone ruleset rule`,builder:z,handler:async e=>u({command:`rulesets rules create`,classification:{safeFlags:[`validate-only`,`dry-run`]}},e,async()=>{let n={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,r=e.zone===void 0?`accounts`:`zones`,a=e.zone??t??`<account-id>`;c({command:`cf rulesets rules create`,method:`POST`,url:`https://api.cloudflare.com/client/v4/${r}/${a}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules`,pathParams:{"account-or-zone":String(r),"account-or-zone-id":String(a),"ruleset-id":String(e[`ruleset-id`]??``)},query:n,bodyKind:`json`,body:e.body===void 0?m({position:{before:h(e[`position-before`],`position-before`,`text`),after:h(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):f(e.body)});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,p=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();if(d===`zones`?e.zoneId=p:e.accountId=p,e.body){let t=f(e.body);new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let r=await l(`Creating`,async()=>u.send(R,{body:t,account_or_zone:d,account_or_zone_id:p,ruleset_id:e[`ruleset-id`],...n}));s(r,{successLabel:`Created`});return}let g=m({position:{before:h(e[`position-before`],`position-before`,`text`),after:h(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let _=await l(`Creating`,async()=>u.send(R,{body:g,account_or_zone:d,account_or_zone_id:p,ruleset_id:e[`ruleset-id`],...n}));s(_,{successLabel:`Created`})})};var V={method:`DELETE`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/rulesets/${t.ruleset_id}/rules/${t.rule_id}`,query:[`dry_run`]};function H(e){return e.usage(`$0 rulesets rules delete <rule-id>
|
|
21
|
-
|
|
22
|
-
Deletes an existing rule from an account or zone ruleset.`).positional(`rule-id`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const ee={command:`delete <rule-id>`,describe:`Delete an account or zone ruleset rule`,builder:H,handler:async e=>u({command:`rulesets rules delete`,classification:{safeFlags:[`validate-only`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{let n={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,r=e.zone===void 0?`accounts`:`zones`,a=e.zone??t??`<account-id>`;c({command:`cf rulesets rules delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${r}/${a}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"account-or-zone":String(r),"account-or-zone-id":String(a),"ruleset-id":String(e[`ruleset-id`]??``),"rule-id":String(e[`rule-id`]??``)},query:n,bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();if(d===`zones`?e.zoneId=f:e.accountId=f,!await _({force:!!e.force}))return;let p=await l(`Deleting`,async()=>u.send(V,{account_or_zone:d,account_or_zone_id:f,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`],...n}));s(p,{successLabel:`Deleted`})})};var U={method:`PATCH`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/rulesets/${t.ruleset_id}/rules/${t.rule_id}`,query:[`dry_run`],body:`json`};function W(e){return e.usage(`$0 rulesets rules update <rule-id>
|
|
23
|
-
|
|
24
|
-
Updates an existing rule in an account or zone ruleset.`).positional(`rule-id`,{type:`string`,description:`The unique ID of the rule.`,demandOption:!0}).option(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`position-before`,{type:`string`,description:`The ID of another rule to place the rule before. An empty value causes the rule to be placed at the top.`}).option(`position-after`,{type:`string`,description:`The ID of another rule to place the rule after. An empty value causes the rule to be placed at the bottom.`}).option(`position-index`,{type:`number`,description:`An index at which to place the rule, where index 1 is the first rule.`}).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(`position-before`,[`position-after`,`position-index`]).conflicts(`position-after`,[`position-before`,`position-index`]).conflicts(`position-index`,[`position-before`,`position-after`])}const G={command:`update <rule-id>`,describe:`Update an account or zone ruleset rule`,builder:W,handler:async e=>u({command:`rulesets rules update`,classification:{safeFlags:[`validate-only`,`dry-run`]}},e,async()=>{let n={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,r=e.zone===void 0?`accounts`:`zones`,a=e.zone??t??`<account-id>`;c({command:`cf rulesets rules update`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/${r}/${a}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}/rules/${e[`rule-id`]==null?`<rule-id>`:encodeURIComponent(String(e[`rule-id`]))}`,pathParams:{"account-or-zone":String(r),"account-or-zone-id":String(a),"ruleset-id":String(e[`ruleset-id`]??``),"rule-id":String(e[`rule-id`]??``)},query:n,bodyKind:`json`,body:e.body===void 0?m({position:{before:h(e[`position-before`],`position-before`,`text`),after:h(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}}):f(e.body)});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,p=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();if(d===`zones`?e.zoneId=p:e.accountId=p,e.body){let t=f(e.body);new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let r=await l(`Updating`,async()=>u.send(U,{body:t,account_or_zone:d,account_or_zone_id:p,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`],...n}));s(r,{successLabel:`Updated`});return}let g=m({position:{before:h(e[`position-before`],`position-before`,`text`),after:h(e[`position-after`],`position-after`,`text`),index:e[`position-index`]}});new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let _=await l(`Updating`,async()=>u.send(U,{body:g,account_or_zone:d,account_or_zone_id:p,ruleset_id:e[`ruleset-id`],rule_id:e[`rule-id`],...n}));s(_,{successLabel:`Updated`})})},K={command:`rules`,describe:`Operations for rules`,builder:e=>e.command(B).command(ee).command(G).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var q={method:`PUT`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/rulesets/${t.ruleset_id}`,query:[`dry_run`],body:`json`};function J(e){return e.usage(`$0 rulesets update <ruleset-id>
|
|
25
|
-
|
|
26
|
-
Updates an account or zone ruleset, creating a new version.`).positional(`ruleset-id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).option(`description`,{type:`string`,description:`An informative description of the ruleset.`}).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`}).option(`name`,{type:`string`,description:`The human-readable name of the ruleset.`}).option(`kind`,{type:`string`,description:`The kind of the ruleset.`,choices:[`managed`,`custom`,`root`,`zone`]}).coerce(`kind`,e=>h(e,`kind`,`text`)).option(`phase`,{type:`string`,description:`The phase of the ruleset.`,choices:[`ddos_l4`,`ddos_l7`,`http_config_settings`,`http_custom_errors`,`http_log_custom_fields`,`http_ratelimit`,`http_request_cache_settings`,`http_request_dynamic_redirect`,`http_request_firewall_custom`,`http_request_firewall_managed`,`http_request_late_transform`,`http_request_origin`,`http_request_redirect`,`http_request_sanitize`,`http_request_sbfm`,`http_request_transform`,`http_response_cache_settings`,`http_response_compression`,`http_response_firewall_custom`,`http_response_firewall_managed`,`http_response_headers_transform`,`magic_transit`,`magic_transit_ids_managed`,`magic_transit_managed`,`magic_transit_ratelimit`]}).coerce(`phase`,e=>h(e,`phase`,`text`)).option(`rules`,{type:`string`,description:`The list of rules in the ruleset. Provide as a JSON array of objects or @path/to/file.json.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`})}const Y={command:`update <ruleset-id>`,describe:`Update an account or zone ruleset`,builder:J,handler:async e=>u({command:`rulesets update`,classification:{safeFlags:[`validate-only`,`kind`,`phase`,`dry-run`]}},e,async()=>{let n={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,r=e.zone===void 0?`accounts`:`zones`,a=e.zone??t??`<account-id>`;c({command:`cf rulesets update`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/${r}/${a}/rulesets/${e[`ruleset-id`]==null?`<ruleset-id>`:encodeURIComponent(String(e[`ruleset-id`]))}`,pathParams:{"account-or-zone":String(r),"account-or-zone-id":String(a),"ruleset-id":String(e[`ruleset-id`]??``)},query:n,bodyKind:`json`,body:e.body===void 0?m({description:h(e.description,`description`,`text`),id:h(e.id,`id`,`text`),name:h(e.name,`name`,`text`),kind:e.kind,phase:e.phase,rules:d(e.rules,`rules`)}):f(e.body)});return}let u=await r(e),p=e.zone===void 0?`accounts`:`zones`,_=p===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();if(p===`zones`?e.zoneId=_:e.accountId=_,e.body){let t=f(e.body);new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let r=await l(`Updating`,async()=>u.send(q,{body:t,account_or_zone:p,account_or_zone_id:_,ruleset_id:e[`ruleset-id`],...n}));s(r,{successLabel:`Updated`});return}e.id===void 0&&(e.id=await g(`id`,`The unique ID of the ruleset.`));let v=m({description:h(e.description,`description`,`text`),id:h(e.id,`id`,`text`),name:h(e.name,`name`,`text`),kind:e.kind,phase:e.phase,rules:d(e.rules,`rules`)});new URLSearchParams(Object.entries(n).filter(([,e])=>e!==void 0).map(([e,t])=>[e,String(t)])).toString();let y=await l(`Updating`,async()=>u.send(q,{body:v,account_or_zone:p,account_or_zone_id:_,ruleset_id:e[`ruleset-id`],...n}));s(y,{successLabel:`Updated`})})};function X(e){return e.usage(`$0 rulesets versions by-tag get <tag>
|
|
27
|
-
|
|
28
|
-
Fetches the rules of a managed account or zone ruleset version for a given tag.`).positional(`tag`,{type:`string`,description:`The category of a rule.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const Z={command:`get <tag>`,describe:`List an account or zone ruleset version's rules by tag`,builder:X,handler:async e=>u({command:`rulesets versions by-tag get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets versions by-tag get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}/by_tag/${e.tag==null?`<tag>`:encodeURIComponent(String(e.tag))}`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),id:String(e.id??``),"ruleset-version":String(e[`ruleset-version`]??``),tag:String(e.tag??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/${encodeURIComponent(String(e.id))}/versions/${encodeURIComponent(String(e[`ruleset-version`]))}/by_tag/${encodeURIComponent(String(e.tag))}`));s(p,{successLabel:`Loaded`})})},Q={command:`by-tag`,describe:`Operations for versions.by-tag`,builder:e=>e.command(Z).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function $(e){return e.usage(`$0 rulesets versions delete <ruleset-version>
|
|
29
|
-
|
|
30
|
-
Deletes an existing version of an account or zone ruleset.`).positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`validate-only`,{type:`boolean`,description:"Validates the request without persisting changes when set to `true`. Responses that normally return 200 return `result: null`; endpoints that normally return 204 continue to return 204."}).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 te={command:`delete <ruleset-version>`,describe:`Delete an account or zone ruleset version`,builder:$,handler:async e=>u({command:`rulesets versions delete`,classification:{safeFlags:[`validate-only`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{let u={dry_run:e[`validate-only`]};if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets versions delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),id:String(e.id??``),"ruleset-version":String(e[`ruleset-version`]??``)},query:u,bodyKind:`none`});return}let d=await r(e),f=e.zone===void 0?`accounts`:`zones`,p=f===`zones`?await a({zone:e.zone},d,{quiet:e.quiet}):e.local?t:await o();if(f===`zones`?e.zoneId=p:e.accountId=p,!await _({force:!!e.force}))return;let m=await l(`Deleting`,async()=>n(d,`DELETE`,`/${f}/${p}/rulesets/${encodeURIComponent(String(e.id))}/versions/${encodeURIComponent(String(e[`ruleset-version`]))}`,{query:u}));s(m,{successLabel:`Deleted`})})};function ne(e){return e.usage(`$0 rulesets versions get <ruleset-version>
|
|
31
|
-
|
|
32
|
-
Fetches a specific version of an account or zone ruleset.`).positional(`ruleset-version`,{type:`string`,description:`The version of the ruleset.`,demandOption:!0}).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const re={command:`get <ruleset-version>`,describe:`Get an account or zone ruleset version`,builder:ne,handler:async e=>u({command:`rulesets versions get`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets versions get`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions/${e[`ruleset-version`]==null?`<ruleset-version>`:encodeURIComponent(String(e[`ruleset-version`]))}`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),id:String(e.id??``),"ruleset-version":String(e[`ruleset-version`]??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/${encodeURIComponent(String(e.id))}/versions/${encodeURIComponent(String(e[`ruleset-version`]))}`));s(p,{successLabel:`Loaded`})})};function ie(e){return e.usage(`$0 rulesets versions list
|
|
33
|
-
|
|
34
|
-
Fetches the versions of an account or zone ruleset.`).option(`id`,{type:`string`,description:`The unique ID of the ruleset.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ae={command:`list`,describe:`List an account or zone ruleset's versions`,builder:ie,handler:async e=>u({command:`rulesets versions list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let t=e.zone===void 0?await i():void 0,n=e.zone===void 0?`accounts`:`zones`,r=e.zone??t??`<account-id>`;c({command:`cf rulesets versions list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${n}/${r}/rulesets/${e.id==null?`<id>`:encodeURIComponent(String(e.id))}/versions`,pathParams:{"account-or-zone":String(n),"account-or-zone-id":String(r),id:String(e.id??``)},bodyKind:`none`});return}let u=await r(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?t:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>n(u,`GET`,`/${d}/${f}/rulesets/${encodeURIComponent(String(e.id))}/versions`));s(p,{successLabel:`Loaded`})})},oe={command:`versions`,describe:`Operations for versions`,builder:e=>e.command(te).command(re).command(ae).command(Q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},se={command:`rulesets`,describe:`rulesets`,builder:e=>e.command(b).command(S).command(P).command(L).command(Y).command(M).command(K).command(oe).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{se as default};
|
package/dist/run-D4-K_cbQ.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./theme-BGHWSKCw.mjs";import{s as t}from"./body-parser-BKcZS9iJ.mjs";import{n}from"./input-validation-D7z60HJH.mjs";import{o as r}from"./prompt-DJF_Rs5S.mjs";import{isDeepStrictEqual as i}from"node:util";const a=/* @__PURE__ */ new Set(/* @__PURE__ */ `$comment.$defs.$id.$schema.additionalProperties.allOf.anyOf.const.default.definitions.deprecated.description.discriminator.enum.example.examples.exclusiveMaximum.exclusiveMinimum.externalDocs.if.items.maxItems.maxLength.maxProperties.maximum.minItems.minLength.minProperties.minimum.multipleOf.oneOf.pattern.properties.readOnly.required.then.title.type.uniqueItems.writeOnly.xml`.split(`.`));function o(e){let t=e.additionalProperties!==void 0&&typeof e.additionalProperties==`object`?[e.additionalProperties]:[],n=e.items===void 0?[]:Array.isArray(e.items)?e.items:[e.items];return[...Object.values(e.properties??{}),...t,...n,...e.oneOf??[],...e.anyOf??[],...e.allOf??[],...e.if?[e.if]:[],...e.then?[e.then]:[]]}function s(e,t){if(t.has(e))return!1;t.add(e);let n=e;return n.nullable===!0||n[`x-nullable`]===!0?!1:Object.keys(n).every(e=>a.has(e)||e.startsWith(`x-`))&&o(e).every(e=>s(e,t))}function c(e){return s(e,/* @__PURE__ */ new WeakSet)}function l(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).split(/[-_\s]+/).filter(Boolean).map(e=>`${e[0]?.toUpperCase()??``}${e.slice(1)}`).join(` `)}function u(e){let t=e.path.at(-1)??e.name,n=r(e.schema.title?.trim()||l(t)),i=e.description?r(e.description.trim()):void 0;return!i||i.toLocaleLowerCase()===n.toLocaleLowerCase()?n:`${n} — ${i}`}function d(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).replace(/_/g,`-`).toLowerCase()}const f=/* @__PURE__ */ new Set([`__proto__`,`constructor`,`prototype`]);function p(e){return e.every(e=>!f.has(e))}function m(e,t){return e!==void 0&&Object.hasOwn(e,t)?e[t]:void 0}function h(e){return e.replace(/-([a-z0-9])/g,(e,t)=>t.toUpperCase())}function g(e){return e.type===void 0&&e.properties===void 0&&e.enum===void 0&&e.const===void 0&&e.oneOf===void 0&&e.anyOf===void 0}function _(e){if(e===null)return`json`;if(Array.isArray(e))return`array`;switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`object`:return`object`;default:return`string`}}function v(e){let t=y(e);if(t.length>1){let e=new Set(t.map(v));return e.size===2&&e.has(`string`)&&e.has(`array`)?`string-or-array`:e.has(void 0)?void 0:e.size===1?[...e][0]??`json`:`json`}if(t[0]!==e)return v(t[0]??{});if(Array.isArray(e.type)&&e.type.includes(`object`)&&e.type.some(e=>e!==`object`))return`json`;let n=Array.isArray(e.type)?e.type.find(e=>e!==`null`):e.type;if(n===`null`||Array.isArray(e.type)&&e.type.length===1&&e.type[0]===`null`)return`json`;if(n===void 0){let t=e.const===void 0?e.enum:[e.const];if(t?.length){let e=new Set(t.map(_));return e.size===1?[...e][0]??`json`:`json`}}if(n===void 0&&e.properties)return`object`;if(n===void 0&&g(e))return`json`;switch(n){case`number`:case`integer`:return`number`;case`boolean`:return`boolean`;case`array`:return`array`;case`object`:return`object`;default:return`string`}}function y(e){let t=e.oneOf??e.anyOf;return t?.length?t:[e]}function b(e,t){if(e===void 0)return t;if(t===void 0)return e;let n=new Set(Array.isArray(e)?e:[e]),r=new Set(Array.isArray(t)?t:[t]),i=(e,t)=>e.has(t)||t===`integer`&&e.has(`number`),a=[`array`,`boolean`,`integer`,`null`,`number`,`object`,`string`].filter(e=>i(n,e)&&i(r,e));return a.includes(`number`)&&a.splice(a.indexOf(`integer`),1),a.length===1?a[0]:a.length>1?a:void 0}function x(e,t){return e===void 0?t:t===void 0?e:e.filter(e=>t.some(t=>i(e,t)))}function S(e,t){let n=t.flatMap(t=>[...t[e]===void 0?[]:[t[e]],...(t.allOf??[]).flatMap(t=>C(e,t))]),r=n[0];return n.length>0&&n.every(e=>i(e,r))?r:void 0}function C(e,t){return[...t[e]===void 0?[]:[t[e]],...(t.allOf??[]).flatMap(t=>C(e,t))]}function ee(e,t){return{type:b(e.type,t.type),title:e.title??t.title,description:e.description??t.description,enum:x(e.enum,t.enum),const:S(`const`,[e,t]),default:S(`default`,[e,t]),oneOf:e.oneOf===void 0?t.oneOf:t.oneOf===void 0?e.oneOf:void 0,anyOf:e.anyOf===void 0?t.anyOf:t.anyOf===void 0?e.anyOf:void 0,allOf:[e,t]}}function w(e){if(!e.allOf?.length)return e;let t=new Map(Object.entries(e.properties??{})),n=new Set(e.required??[]),r=e.type,i=e.title,a=e.description,o=e.enum;for(let s of e.allOf){let e=w(s);r=b(r,e.type),i??=e.title,a??=e.description,o=x(o,e.enum);for(let t of e.required??[])n.add(t);for(let[n,r]of Object.entries(e.properties??{})){let e=t.get(n);t.set(n,e===void 0?r:ee(e,r))}}return{...e,type:r,title:i,description:a,enum:o,const:S(`const`,[e]),default:S(`default`,[e]),properties:t.size>0?Object.fromEntries(t):e.properties,required:n.size>0?[...n]:e.required}}function T(e){return{...e,oneOf:void 0,anyOf:void 0}}function E(e){return(e.allOf??[]).flatMap(e=>[e,...E(e)])}function D(e){return[e,...E(e)].flatMap(e=>[...e.oneOf?.length?[e.oneOf]:[],...e.anyOf?.length?[e.anyOf]:[]])}function O(e){return Object.keys(w(T(e)).properties??{}).length>0||D(e).some(e=>e.some(O))}function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){let t=w(e),n=t.type===void 0?void 0:Array.isArray(t.type)?t.type:[t.type];return n?.length&&n.every(e=>e===`object`)?!0:n!==void 0&&!n.includes(`object`)?!1:t.const===void 0?t.enum?.length&&t.enum.every(e=>k(e))||D(e).some(e=>e.every(A))?!0:e.allOf?.some(A)??!1:k(t.const)}function j(e){let t=e.oneOf??e.anyOf;if(!t?.length)return;let n=[];for(let e of t){let t=e.const===void 0?e.enum?.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`)?e.enum:void 0:[e.const];if(!t?.length||!t.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))return;for(let i of t)n.push({value:i,label:t.length===1&&e.title?r(e.title):void 0})}return n}function te(e){let t=e.enum?.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`)?e.enum:void 0;return t?.length?t.map(e=>({value:e})):j(e)}function M(e){let t=e.oneOf??e.anyOf;if(!t?.length)return;let n=[];for(let e of t){let t=e.const===void 0?e.enum?.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`)?e.enum:void 0:[e.const];if(t?.length&&t.every(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`))for(let i of t){let t=W(i),a=e.title?r(e.title):void 0;n.push(a?`${t} (${a})`:t)}else if(e.pattern&&v(e)===`string`){let t=r(e.pattern),i=e.title?r(e.title):void 0;n.push(i?`${t} (${i})`:t)}else return}return n.length>0?n:void 0}function N(e,t,n,r,i){if(!p(e))return;let a=i??v(t);if(a===void 0)return;let o=a===`json`?void 0:te(t),s=o?.map(({value:e})=>String(e)),c=Object.fromEntries((o??[]).filter(({value:e,label:t})=>t&&t!==String(e)).map(({value:e,label:t})=>[String(e),t])),l=e.map(d).join(`-`);if(![`mode`,`temporary-account`,`event-code`].includes(l))return{name:l,path:e,type:a,required:n,requiredWhen:r,description:t.description?.split(`
|
|
3
|
-
`)[0]??t.title,choices:s?.length?s:void 0,choiceLabels:Object.keys(c).length>0?c:void 0,schema:t}}function ne(e,t){return e===t?e:[.../* @__PURE__ */ new Set([e,t])].every(e=>e===`string`||e===`array`||e===`string-or-array`)?`string-or-array`:`json`}function re(e,t){let n=ne(e.type,t.type),r=e.schema.description??t.schema.description,a=n===`json`||n===`string-or-array`?{description:r}:{type:n===`number`?`number`:n,description:r};return{...e,type:n,required:e.required&&t.required,requiredWhen:F(e.requiredWhen,t.requiredWhen)?e.requiredWhen:void 0,choices:void 0,choiceLabels:void 0,schema:a,requiredIf:i(e.requiredIf,t.requiredIf)?e.requiredIf:void 0,requiredContainer:e.requiredContainer&&t.requiredContainer?!0:void 0}}function P(e,t={}){let n=new Set((t.exclude??[]).map(e=>e.join(`.`))),r=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Set,o=(e,t,n)=>{let i=r.get(e);n?a.has(e)||r.set(e,i===void 0?t:re(i,t)):(a.add(e),r.set(e,t))},s=(e,t,s)=>{for(let c of[e,...E(e)]){let l=c.if,u=c.then?w(c.then):void 0,d=u?.required;if(!l||!d?.length)continue;let f=Object.keys(l),h=l.type===void 0?void 0:Array.isArray(l.type)?l.type:[l.type];if(f.some(e=>![`$comment`,`description`,`properties`,`required`,`title`,`type`].includes(e))||h!==void 0&&!h.includes(`object`))continue;let g=new Set(l.required??[]),_=l.properties??{};if(Object.keys(_).some(e=>!g.has(e)))continue;let v=[],y=!0;for(let e of g){if(!p([...t,e])){y=!1;break}let n=m(_,e),r;if(n){if(Object.keys(n).some(e=>![`$comment`,`const`,`default`,`description`,`enum`,`examples`,`title`,`type`].includes(e))){y=!1;break}if(r=n.enum,n.const!==void 0&&(r=(r??[n.const]).filter(e=>i(e,n.const))),n.type!==void 0){if(r===void 0){y=!1;break}let e=Array.isArray(n.type)?n.type:[n.type];r=r.filter(t=>e.some(e=>J(e,t)))}}v.push({path:[...t,e],values:r})}if(y&&v.length!==0)for(let c of d){let l=[...t,c].join(`.`);if(n.has(l))continue;let d={predicates:v},f=r.get(l),p=s&&m(e.properties,c)===void 0&&!a.has(l);if(!f||p){let e=m(u?.properties,c),n=e===void 0?void 0:N([...t,c],w(e),!1);n&&(o(l,n,s),f=r.get(l))}!s&&f&&!f.requiredIf?.some(e=>i(e,d))&&(f.requiredIf=[...f.requiredIf??[],d])}}},c=(e,t,i,a=!1)=>{let l=w(T(e));if(l.properties){let e=new Set(l.required??[]);for(let[s,u]of Object.entries(l.properties)){let l=[...t,s],d=l.join(`.`);if(!p(l)||n.has(d))continue;let f=w(u),m=O(u),h=m&&A(u),g=!a&&e.has(s),_=g&&i===void 0,v=g&&i!==void 0?i:void 0;if(h){c(u,l,g?i:l,a);let e=[...r.values()].some(e=>e.required===_&&F(e.requiredWhen,v)&&e.path.length>l.length&&l.every((t,n)=>e.path[n]===t));if(g&&!e){let e=N(l,u,_,v);e&&o(d,{...e,requiredContainer:!0},a)}continue}let y=N(l,f,_,v,m?`json`:void 0);y&&o(d,y,a)}}for(let n of D(e))for(let e of n)c(e,t,i,!0);for(let n of[e,...E(e)])n.if&&n.then&&c(n.then,t,i,!0);s(l,t,a)};return c(e,[]),[...r.values()].sort((e,t)=>e.required===t.required?e.name.localeCompare(t.name):e.required?-1:1)}function F(e,t){return e===t||e!==void 0&&t!==void 0&&e.length===t.length&&e.every((e,n)=>e===t[n])}function ie(t,n){if(t.length===0)return`${e.brand(r(n))}\n (no input fields)`;let i=process.stdout.columns??80,a=t.map(e=>`--${r(e.name)}`),o=Math.min(Math.max(...a.map(e=>e.length))+2,42),s=t.map((e,t)=>{let n=[`[${e.type}]`];e.required?n.push(`[required]`):e.requiredWhen&&n.push(`[required with --${r(e.requiredWhen.map(d).join(`-`))}-*]`),e.requiredIf&&n.push(`[conditionally required]`),e.choices&&n.push(`[choices: ${e.choices.map(t=>{let n=r(t),i=e.choiceLabels&&Object.hasOwn(e.choiceLabels,t)?e.choiceLabels[t]:void 0;return i?`${r(i)} (${n})`:n}).join(`, `)}]`),e.schema.const!==void 0&&n.push(`[must be: ${r(JSON.stringify(e.schema.const)??`undefined`)}]`),e.schema.default!==void 0&&n.push(`[default: ${r(JSON.stringify(e.schema.default)??`undefined`)}]`);let s=n.join(` `),c=Math.max(i-o-4,20)-s.length-1,l=e.description===void 0?void 0:r(e.description),u=l===void 0||c<12?``:l.length>c?`${l.slice(0,c-1)}…`:l,f=a[t]??``;return` ${f.length<o?f.padEnd(o):`${f} `}${[u,s].filter(Boolean).join(` `)}`});return[e.brand(r(n)),...s].join(`
|
|
4
|
-
`)}const ae=`_ $0 -- body dry-run dryRun event-code eventCode help h local m mode persist-to persistTo profile quiet q temporary-account temporaryAccount version v zone z`.split(` `);function I(e,t){let n=Object.hasOwn(t,e.name)?t[e.name]:void 0,r=h(e.name);return n===void 0&&Object.hasOwn(t,r)?t[r]:n}function oe(e,t,n){return e.filter(r=>{let i=n!==void 0&&R(n,r.path).found;return z(r,e,t,n)&&I(r,t)===void 0&&!i&&!B(r.path,e,t)&&!(r.requiredContainer&&V(r,e,t))})}function L(e,t){let n=e=>R(t,e);return e.filter(e=>se(e,n)&&!n(e.path).found)}function R(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n)||!Object.hasOwn(n,e))return{found:!1};n=n[e]}return{found:!0,value:n}}function se(e,t){return e.required||e.requiredWhen!==void 0&&t(e.requiredWhen).found||(e.requiredIf?.some(({predicates:e})=>e.every(({path:e,values:n})=>{let r=t(e);return r.found&&(n===void 0||n.some(e=>i(r.value,e)))}))??!1)}function z(e,t,n,r){return e.required||e.requiredWhen!==void 0&&(B(e.requiredWhen,t,n)||r!==void 0&&R(r,e.requiredWhen).found)||(e.requiredIf?.some(({predicates:e})=>e.every(({path:e,values:a})=>{let o=ce(e,t,n),s=o.found||r===void 0?o:R(r,e),c=!o.found||o.descriptor===void 0||!F(o.descriptor.path,e)?s.value:G(o.descriptor,s.value,[]);return s.found&&(a===void 0||a.some(e=>i(c,e)))}))??!1)}function ce(e,t,n){for(let r of t){let t=I(r,n);if(t===void 0||r.path.length>e.length||!r.path.every((t,n)=>e[n]===t))continue;let i=t;if(typeof i==`string`&&r.path.length<e.length)try{i=JSON.parse(i)}catch{continue}for(let t of e.slice(r.path.length)){if(typeof i!=`object`||!i||Array.isArray(i)||!Object.hasOwn(i,t)){i=void 0;break}i=i[t]}if(i!==void 0)return{found:!0,value:i,descriptor:r}}return{found:!1}}function B(e,t,n){return t.some(t=>{let r=I(t,n);if(r===void 0)return!1;if(t.path.length>=e.length)return e.every((e,n)=>t.path[n]===e);if(!t.path.every((t,n)=>e[n]===t))return!1;let i=r;if(typeof i==`string`)try{i=JSON.parse(i)}catch{return!1}for(let n of e.slice(t.path.length)){if(typeof i!=`object`||!i||Array.isArray(i)||!Object.hasOwn(i,n))return!1;i=i[n]}return!0})}function V(e,t,n){return t.some(t=>t!==e&&t.path.length>e.path.length&&e.path.every((e,n)=>t.path[n]===e)&&I(t,n)!==void 0)}function H(e){return e.flatMap(e=>[e.name,h(e.name)])}function U(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)??`undefined`}catch{return`unprintable value`}}function W(e){return r(U(e))}function G(e,t,i){let a=n=>{i.push(`--${r(e.name)} expects ${n} (got '${W(t)}')`)};switch(e.type){case`number`:{let n=typeof t==`number`?t:Number(U(t)),r=Array.isArray(e.schema.type)?e.schema.type:[e.schema.type];return Number.isFinite(n)?r.includes(`integer`)&&!r.includes(`number`)&&!Number.isInteger(n)?a(`an integer`):n:a(`a finite number`)}case`boolean`:return typeof t==`boolean`?t:t===`true`||t!==`false`&&a(`a boolean`);case`array`:case`object`:{let n=t;if(typeof t==`string`)try{n=JSON.parse(t)}catch{return a(`a JSON ${e.type}`)}return(e.type===`array`?Array.isArray(n):typeof n==`object`&&n&&!Array.isArray(n))?n:a(`a JSON ${e.type}`)}case`json`:{let r=Array.isArray(e.schema.type)?e.schema.type:[e.schema.type];if(r.length===1&&r[0]===`null`)return t===null||t===`null`?null:a(`null`);if(typeof t!=`string`)return t;try{return JSON.parse(t)}catch{return n(t,e.name,`json`)}}case`string-or-array`:if(typeof t!=`string`)return Array.isArray(t)?t:a(`a string or JSON array`);try{let e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return n(t,e.name,`text`);default:{let r=Array.isArray(t)?t[t.length-1]:t;return typeof r==`boolean`?a(`a string`):typeof r==`string`?n(r,e.name,`text`):U(r)}}}function K(e){return Array.from(e).length}function q(e,t,n){let a=r(e.name),{const:o,pattern:s,minLength:c,maxLength:l,minimum:u,maximum:d,exclusiveMinimum:f,exclusiveMaximum:p}=e.schema;if(o!==void 0&&!i(t,o)){n.push(`--${a} must be ${r(JSON.stringify(o)??`undefined`)}`);return}let m=e.schema.enum??j(e.schema)?.map(e=>e.value);if(m!==void 0&&!m.some(e=>i(t,e)))n.push(`--${a} must be one of: ${m.map(W).join(`, `)}`);else{if(typeof t==`string`){let e=K(t);s!==void 0&&!new RegExp(s).test(t)&&n.push(`--${a} does not match the required format (${r(s)})`),c!==void 0&&e<c&&n.push(`--${a} must be at least ${c} characters`),l!==void 0&&e>l&&n.push(`--${a} must be at most ${l} characters`)}typeof t==`number`&&(u!==void 0&&(f===!0?t<=u:t<u)&&n.push(f===!0?`--${a} must be greater than ${u}`:`--${a} must be at least ${u}`),d!==void 0&&(p===!0?t>=d:t>d)&&n.push(p===!0?`--${a} must be less than ${d}`:`--${a} must be at most ${d}`),typeof f==`number`&&t<=f&&n.push(`--${a} must be greater than ${f}`),typeof p==`number`&&t>=p&&n.push(`--${a} must be less than ${p}`))}}function le(e,t){let n=[],i=G(e,t,n);if(i===void 0||(q(e,i,n),n.length>0))return n[0];let a=Z(e.schema,i);return a.length>0?`--${r(e.name)} ${a[0]?.replace(/^the request body /,``)}`:void 0}function J(e,t){switch(e){case`null`:return t===null;case`array`:return Array.isArray(t);case`object`:return typeof t==`object`&&!!t&&!Array.isArray(t);case`integer`:return typeof t==`number`&&Number.isInteger(t);default:return typeof t===e}}function ue(e){return e.map(e=>e===`integer`?`an integer`:`a${/^[aeiou]/.test(e)?`n`:``} ${e}`).join(` or `)}function Y(e){return e.length===0?`the request body`:`\`/${e.map(e=>r(e).replace(/~/g,`~0`).replace(/\//g,`~1`)).join(`/`)}\``}function X(e,t,n){let a=[],o=Y(n),s=e.type===void 0?[]:Array.isArray(e.type)?e.type:[e.type];if(s.length>0&&!s.some(e=>J(e,t)))return[`${o} must be ${ue(s)}`];if(e.const!==void 0&&!i(t,e.const))return[`${o} must be ${r(JSON.stringify(e.const)??`undefined`)}`];if(e.enum&&!e.enum.some(e=>i(t,e)))return[`${o} must be one of: ${e.enum.map(W).join(`, `)}`];if(e.oneOf?.length&&e.oneOf.filter(e=>X(e,t,n).length===0).length!==1){let t=M(e);return[t?`${o} must be one of: ${t.join(`, `)}`:`${o} must match exactly one allowed shape`]}if(e.anyOf?.length&&!e.anyOf.some(e=>X(e,t,n).length===0)){let t=M(e);return[t?`${o} must be one of: ${t.join(`, `)}`:`${o} must match an allowed shape`]}for(let r of e.allOf??[])a.push(...X(r,t,n));if(e.if&&X(e.if,t,n).length===0&&e.then&&a.push(...X(e.then,t,n)),typeof t==`string`){let n=K(t);e.pattern!==void 0&&!new RegExp(e.pattern).test(t)&&a.push(`${o} does not match the required format (${r(e.pattern)})`),e.minLength!==void 0&&n<e.minLength&&a.push(`${o} must be at least ${e.minLength} characters`),e.maxLength!==void 0&&n>e.maxLength&&a.push(`${o} must be at most ${e.maxLength} characters`)}if(typeof t==`number`&&(e.minimum!==void 0&&(e.exclusiveMinimum===!0?t<=e.minimum:t<e.minimum)&&a.push(e.exclusiveMinimum===!0?`${o} must be greater than ${e.minimum}`:`${o} must be at least ${e.minimum}`),e.maximum!==void 0&&(e.exclusiveMaximum===!0?t>=e.maximum:t>e.maximum)&&a.push(e.exclusiveMaximum===!0?`${o} must be less than ${e.maximum}`:`${o} must be at most ${e.maximum}`),typeof e.exclusiveMinimum==`number`&&t<=e.exclusiveMinimum&&a.push(`${o} must be greater than ${e.exclusiveMinimum}`),typeof e.exclusiveMaximum==`number`&&t>=e.exclusiveMaximum&&a.push(`${o} must be less than ${e.exclusiveMaximum}`),e.multipleOf!==void 0&&Math.abs(t/e.multipleOf-Math.round(t/e.multipleOf))>2**-52*10&&a.push(`${o} must be a multiple of ${e.multipleOf}`)),Array.isArray(t)){if(e.minItems!==void 0&&t.length<e.minItems&&a.push(`${o} must contain at least ${e.minItems} items`),e.maxItems!==void 0&&t.length>e.maxItems&&a.push(`${o} must contain at most ${e.maxItems} items`),e.uniqueItems&&t.some((e,n)=>t.slice(0,n).some(t=>i(e,t)))&&a.push(`${o} must contain unique items`),e.items&&!Array.isArray(e.items))for(let[r,i]of t.entries())a.push(...X(e.items,i,[...n,String(r)]));else if(Array.isArray(e.items))for(let[r,i]of e.items.entries())r<t.length&&a.push(...X(i,t[r],[...n,String(r)]))}if(typeof t==`object`&&t&&!Array.isArray(t)){let r=t,i=e.properties??{};for(let t of e.required??[])Object.hasOwn(r,t)||a.push(`${Y([...n,t])} is required`);for(let[t,o]of Object.entries(r)){let r=Object.hasOwn(i,t)?i[t]:void 0;r?a.push(...X(r,o,[...n,t])):e.additionalProperties===!1?a.push(`${Y([...n,t])} is not allowed`):e.additionalProperties&&typeof e.additionalProperties==`object`&&a.push(...X(e.additionalProperties,o,[...n,t]))}let s=Object.keys(r).length;e.minProperties!==void 0&&s<e.minProperties&&a.push(`${o} must contain at least ${e.minProperties} properties`),e.maxProperties!==void 0&&s>e.maxProperties&&a.push(`${o} must contain at most ${e.maxProperties} properties`)}return a}function Z(e,t){return[...new Set(X(e,t,[]))]}const de=[`const`,`enum`,`exclusiveMaximum`,`exclusiveMinimum`,`maxItems`,`maxLength`,`maxProperties`,`maximum`,`minItems`,`minLength`,`minProperties`,`minimum`,`multipleOf`,`pattern`,`required`,`title`,`type`,`uniqueItems`];function Q(e){let t=e,n=Object.keys(t);if(t.nullable===!0||t[`x-nullable`]===!0||n.some(e=>[`$dynamicRef`,`$recursiveRef`,`$ref`].includes(e)))return{schema:{},exact:!1};let r={},i=n.every(e=>a.has(e)||e.startsWith(`x-`));for(let t of de){let n=e[t];n!==void 0&&Object.assign(r,{[t]:n})}if(e.properties!==void 0){let t=Object.entries(e.properties).map(([e,t])=>{let n=Q(t);return i&&=n.exact,[e,n.schema]});r.properties=Object.fromEntries(t)}if(e.additionalProperties!==void 0&&!Object.hasOwn(t,`patternProperties`)){if(typeof e.additionalProperties==`boolean`)r.additionalProperties=e.additionalProperties;else{let t=Q(e.additionalProperties);r.additionalProperties=t.schema,i&&=t.exact}}if(e.items!==void 0&&!Object.hasOwn(t,`prefixItems`)){if(Array.isArray(e.items))r.items=e.items.map(e=>{let t=Q(e);return i&&=t.exact,t.schema});else{let t=Q(e.items);r.items=t.schema,i&&=t.exact}}let o=(e.allOf??[]).map(e=>{let t=Q(e);return i&&=t.exact,t.schema});if(e.anyOf?.length&&(r.anyOf=e.anyOf.map(e=>{let t=Q(e);return i&&=t.exact,t.schema})),e.oneOf?.length){let t=e.oneOf.map(Q),n=t.every(e=>e.exact);i&&=n,n?r.oneOf=t.map(e=>e.schema):o.push({anyOf:t.map(e=>e.schema)})}if(e.if&&e.then){let t=Q(e.if),n=Q(e.then);i&&=t.exact&&n.exact,t.exact&&o.push({if:t.schema,then:n.schema})}return o.length>0&&(r.allOf=o),{schema:r,exact:i}}function fe(e,t){return Z(Q(e).schema,t)}function pe(e,t,n){let r=e;for(let e of t.slice(0,-1)){let t=r[e];(typeof t!=`object`||!t||Array.isArray(t))&&(r[e]={}),r=r[e]}let i=t.at(-1);i!==void 0&&(r[i]=n)}function $(e,t=[]){let n=/* @__PURE__ */ new Set([...ae,...t]),r=/* @__PURE__ */ new Map;for(let t of Object.keys(e))!n.has(t)&&!r.has(d(t))&&r.set(d(t),t);return[...r.values()].sort()}function me(e,n,i={}){let a=[],o=i.baseBody!==void 0,s=i.baseBody===void 0?{}:structuredClone(i.baseBody),c=e.filter(({path:e})=>p(e)),l=[...i.reserved??[],...H(c)];for(let e of c){let i=I(e,n);if(i===void 0){!o&&z(e,c,n)&&!B(e.path,c,n)&&!(e.requiredContainer&&V(e,c,n))&&a.push(`--${r(e.name)} is required`);continue}let l=G(e,i,a);l!==void 0&&(q(e,l,a),o?pe(s,e.path,l):t(s,e.path,l))}if(o)for(let e of L(c,s))I(e,n)===void 0&&a.push(`--${r(e.name)} is required`);for(let e of $(n,l))a.push(`Unknown flag --${r(e)}`);return{body:s,errors:a}}export{L as a,P as c,Z as d,fe as f,oe as i,$ as l,H as n,ie as o,c as r,u as s,me as t,le as u};
|