cf 1.0.0-rc.2 → 1.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/_meta/commands.json +3235 -2113
- package/dist/_meta/hand-written-commands.json +40 -0
- package/dist/_meta/schemas.json +2519 -1622
- package/dist/{abuse-reports-7pRdd95h.mjs → abuse-reports-DD4Xscda.mjs} +1 -1
- package/dist/{access-CON978TG.mjs → access-C35nZLcR.mjs} +1 -1
- package/dist/{accounts-DfTIQ1ol.mjs → accounts-dvxVNggW.mjs} +1 -1
- package/dist/{acm-DUOtXoq1.mjs → acm-BRx8MrVy.mjs} +1 -1
- package/dist/{addressing-BGI1lmHJ.mjs → addressing-MAedAImE.mjs} +13 -13
- package/dist/{agent-memory-B7_ERHJA.mjs → agent-memory-CPhvBC0V.mjs} +1 -1
- package/dist/{ai-CEUT9znF.mjs → ai-Dx-jS5E8.mjs} +1 -1
- package/dist/{ai-audit-BhbsdF3R.mjs → ai-audit-D5AU3d15.mjs} +1 -1
- package/dist/{ai-gateway-BMJ_sOoU.mjs → ai-gateway-siGcJ3Fd.mjs} +45 -35
- package/dist/{ai-search-jYmV4tZM.mjs → ai-search-30yyrERO.mjs} +1 -1
- package/dist/{ai-security-X7rya3Nc.mjs → ai-security-wIqGn-mp.mjs} +1 -1
- package/dist/{alerting-DrfOZuwU.mjs → alerting-ChL9dtmD.mjs} +1 -1
- package/dist/{analytics-CzMjVnxF.mjs → analytics-DC3GMpt3.mjs} +1 -1
- package/dist/{analytics-engine-DqNMYgeV.mjs → analytics-engine-CoMfFtru.mjs} +1 -1
- package/dist/{api-security-D3WIvBHW.mjs → api-security-DatApWUQ.mjs} +3 -3
- package/dist/{argo-D77o9nA0.mjs → argo-BNnKAmnR.mjs} +1 -1
- package/dist/{artifacts-JhJU8lVg.mjs → artifacts-BwOVrDS2.mjs} +1 -1
- package/dist/{audit-logs-BWNa7T1S.mjs → audit-logs-DCqXY3K2.mjs} +1 -1
- package/dist/auth-B23TQVFv.mjs +2 -0
- package/dist/auth-CMg2zvtO.mjs +2 -0
- package/dist/auth-DC9etXs1.mjs +3 -0
- package/dist/auth-token-DNUW1DyS.mjs +8 -0
- package/dist/authentication-error-CFW0YLMA-CyvbCVD8.mjs +131 -0
- package/dist/autoconfig-BCE1EcKH.mjs +647 -0
- package/dist/{basin-catalog-BLGqOmj3.mjs → basin-catalog-DViOl5uo.mjs} +1 -1
- package/dist/{billing-MKjaJ5OH.mjs → billing-tS4IRYvK.mjs} +2 -2
- package/dist/{blocks-BhHWbQEb.mjs → blocks-C3bPBwwd.mjs} +1 -1
- package/dist/{body-parser-HN91kAf0.mjs → body-parser-DftnWjJP.mjs} +1 -1
- package/dist/{body-unions-QFGGUlIr.mjs → body-unions-DX9G5Vny.mjs} +1 -1
- package/dist/{bot-management-C6XG6ndL.mjs → bot-management-84un7ti1.mjs} +1 -1
- package/dist/{botnet-feed-BKous_vP.mjs → botnet-feed-B4Zgb3WZ.mjs} +1 -1
- package/dist/{brand-protection-D4hFdjyk.mjs → brand-protection-BBpY-kFB.mjs} +1 -1
- package/dist/{browser-run-BHLEEC5E.mjs → browser-run-Bh4PeR1y.mjs} +4 -2
- package/dist/{build-CMyWk3oc.mjs → build-BGoObbc0.mjs} +1 -1
- package/dist/build-CQZMLw83.mjs +2 -0
- package/dist/{builds-Knlir3zp.mjs → builds-E1L2H1sP.mjs} +1 -1
- package/dist/{cache-27OeN2zW.mjs → cache-BCD3UGYE.mjs} +18 -18
- package/dist/cf-zVgRO5PY.mjs +17 -0
- package/dist/{cli-BGJM9SBt.mjs → cli-FRHgCU7v.mjs} +1 -1
- package/dist/{client-side-security-DhFutOIw.mjs → client-side-security-7dg-ZVsu.mjs} +1 -1
- package/dist/{cloud-connector-DUR52h7h.mjs → cloud-connector-BU0juaIN.mjs} +1 -1
- package/dist/{cloudflared-CSDMIBKX.mjs → cloudflared-DJhAGc-2.mjs} +1 -1
- package/dist/{cloudforce-one-C0SzLz65.mjs → cloudforce-one-DgyrexQ7.mjs} +22 -24
- package/dist/command-7YbmYQ25.mjs +2 -0
- package/dist/{command-Co0d2ime.mjs → command-BM_ONo-H.mjs} +1 -1
- package/dist/{command-Bufh8wFd.mjs → command-C7QTONEM.mjs} +1 -1
- package/dist/{command-Drp8GAuW.mjs → command-CNcnWikN.mjs} +1 -1
- package/dist/{command-CxhOAu2x.mjs → command-CvWcSClz.mjs} +1 -1
- package/dist/{command-BzExw-4e.mjs → command-D-ll3vGW.mjs} +1 -1
- package/dist/{command-C6ddiqb8.mjs → command-D3Xg83My.mjs} +1 -1
- package/dist/{command-Bt_yk3sP.mjs → command-DP37O9yH.mjs} +1 -1
- package/dist/{command-B5v4F93a.mjs → command-Das6RBQL.mjs} +1 -1
- package/dist/{command-B8KcAAzJ.mjs → command-Dp2VbxRs.mjs} +1 -1
- package/dist/{command-DMb8_5QR.mjs → command-F-PEA27_.mjs} +1 -1
- package/dist/{command-CLeeImJr.mjs → command-KOIS6pIJ.mjs} +1 -1
- package/dist/{command-BENj0-eD.mjs → command-Kph6cPx4.mjs} +1 -1
- package/dist/{command-DfmJhh-K.mjs → command-kkAVVWsY.mjs} +1 -1
- package/dist/{command-CkBbgXY8.mjs → command-m_RE8Ne6.mjs} +1 -1
- package/dist/{completions-Chw9TYCy.mjs → completions-Dc77ZhDr.mjs} +1 -1
- package/dist/config-WFtvFMMN-DO1DX3tx.mjs +300 -0
- package/dist/{connector-interrupts-DljkLm8i.mjs → connector-interrupts-DkWyiO-i.mjs} +1 -1
- package/dist/{connector-telemetry-events-fZ_Uqwfd.mjs → connector-telemetry-events-puB9H_bN.mjs} +1 -1
- package/dist/{connector-telemetry-snapshots-Bv5aAa_3.mjs → connector-telemetry-snapshots-fydkNSl2.mjs} +1 -1
- package/dist/{connectors-BJQW9yKU.mjs → connectors-C8kBNJU2.mjs} +1 -1
- package/dist/{containers-D_QkjuSF.mjs → containers-plmr4QyC.mjs} +2 -2
- package/dist/{content-scan-mmmapOqc.mjs → content-scan-CxtrHrzD.mjs} +1 -1
- package/dist/{context-ChcbaAGw.mjs → context-CglPDNRF.mjs} +1 -1
- package/dist/{cps-CKOptk6d.mjs → cps-EAJEOLrs.mjs} +1 -1
- package/dist/create-worker-upload-form-DhzLEfNO-BCarSV0E.mjs +2 -0
- package/dist/{csam-scanner-Cgj2eo9n.mjs → csam-scanner-tJhA7hqT.mjs} +1 -1
- package/dist/{custom-csrs-BhpfDaqQ.mjs → custom-csrs-B_s5EV1j.mjs} +1 -1
- package/dist/{custom-hostnames-DW8Rpdm5.mjs → custom-hostnames-Cr3dNRwC.mjs} +1 -1
- package/dist/{custom-nameservers-Djpe8V3o.mjs → custom-nameservers-RCRy6YRK.mjs} +1 -1
- package/dist/{custom-pages-Chhva9aF.mjs → custom-pages-CthLrFCW.mjs} +1 -1
- package/dist/{d1-BssqKsHt.mjs → d1-rfbTquF-.mjs} +1 -1
- package/dist/{delegate-CwB0ZkLX.mjs → delegate-f4FFYc-w.mjs} +1 -1
- package/dist/delegate.mjs +1 -1
- package/dist/{deploy-CYdpmaPG.mjs → deploy-BTvnmAz0.mjs} +1 -1
- package/dist/deploy-context-DO2Ej5Sf.mjs +122 -0
- package/dist/{deploy-input-pcciD1Bc.mjs → deploy-input-D8-f-ULB.mjs} +1 -1
- package/dist/dev-BrqTRIv1.mjs +4 -0
- package/dist/{diagnostics-Cm8Og_bM.mjs → diagnostics-BTKLIL60.mjs} +1 -1
- package/dist/{disk-cache-Csyrc7L_.mjs → disk-cache-SHcAdcTi.mjs} +1 -1
- package/dist/dist-CoYrirmB.mjs +70 -0
- package/dist/{dls-CNMSLaWR.mjs → dls-RyhdHqmj.mjs} +1 -1
- package/dist/{dns-Cwdq9kAp.mjs → dns-D4USVTcI.mjs} +13 -15
- package/dist/{dns-firewall-s33oZN9_.mjs → dns-firewall-BZOjpGEa.mjs} +1 -1
- package/dist/{docs-BX7oBoFp.mjs → docs-BjGZR51O.mjs} +1 -1
- package/dist/dot-prop-XnlHjVnE-Bi3oBTbt.mjs +2 -0
- package/dist/dotenv-Bs0zODmf.mjs +4 -0
- package/dist/{durable-objects-CZcj1eaJ.mjs → durable-objects-X_wDE1kN.mjs} +1 -1
- package/dist/{email-auth-CiOaqD27.mjs → email-auth-DTI45krk.mjs} +1 -1
- package/dist/{email-routing-0dzp8ahc.mjs → email-routing-CcRzdZ7w.mjs} +1 -1
- package/dist/{email-security-CPhkouDM.mjs → email-security-BG4oDbP8.mjs} +1 -1
- package/dist/{email-sending-DkwjDkpK.mjs → email-sending-Bwxz3HOE.mjs} +1 -1
- package/dist/error-sanitization-CoqDzMhY.mjs +2 -0
- package/dist/error-sanitization-DSyaOCwI.mjs +2 -0
- package/dist/{errors-BAF6Z21q.mjs → errors-BIYtgyJ2.mjs} +1 -1
- package/dist/feedback-CkfuTWEC.mjs +4 -0
- package/dist/{field-extractors-rpFJB4FT.mjs → field-extractors-CB0UJfXL.mjs} +1 -1
- package/dist/{firewall-GB6SpbJU.mjs → firewall-D2YIK_3P.mjs} +1 -1
- package/dist/{flagship-B0sIdg7R.mjs → flagship-DqNRMy2W.mjs} +1 -1
- package/dist/{fraud-Ca1zvG-F.mjs → fraud-D53t9Wtw.mjs} +1 -1
- package/dist/{google-tag-gateway-CC4xqAxo.mjs → google-tag-gateway-BHCRSeQm.mjs} +1 -1
- package/dist/{gt-BV-jij5q.mjs → gt-CfD9QGOr.mjs} +1 -1
- package/dist/{healthchecks-Cnl6Pv23.mjs → healthchecks-CTzeTqTV.mjs} +1 -1
- package/dist/{hyperdrive-CK-zHef4.mjs → hyperdrive-ClRYzEMt.mjs} +1 -1
- package/dist/{iam-D4GpREnO.mjs → iam-BPhNCSMt.mjs} +1 -1
- package/dist/{images-CQdKkefj.mjs → images-rjOXp_9M.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-Cj8qCJj7.mjs → init-DYa1i2-N.mjs} +2 -2
- package/dist/{intel-Di4M_luj.mjs → intel-DAEiuVd5.mjs} +5 -5
- package/dist/{interactive-FI8YIUbv.mjs → interactive-Bg9WyJ5G.mjs} +19 -19
- package/dist/{ips-BsSF2_y1.mjs → ips-Du6_SpiX.mjs} +1 -1
- package/dist/{k2-D3q3rmmF.mjs → k2-Dob-33Tv.mjs} +1 -1
- package/dist/{kv-T85sRcDz.mjs → kv-D1JYrgSd.mjs} +1 -1
- package/dist/{lazy-command-B3N4aXWS.mjs → lazy-command-BeOHik4o.mjs} +1 -1
- package/dist/{leaked-credential-checks--ulkoKo8.mjs → leaked-credential-checks-B-8upaC5.mjs} +1 -1
- package/dist/{load-balancers-DcLotLBB.mjs → load-balancers-BxXlkFHe.mjs} +1 -1
- package/dist/login-B3BkeHt6.mjs +2 -0
- package/dist/login-DIPsROTB.mjs +5 -0
- package/dist/{logpush-DAewBJFe.mjs → logpush-Bi88bWhn.mjs} +1 -1
- package/dist/{logs-DIRHM-E9.mjs → logs-Du28TgjU.mjs} +1 -1
- package/dist/{magic-network-monitoring-XtKqbZsz.mjs → magic-network-monitoring-Fs46HFzT.mjs} +1 -1
- package/dist/{magic-transit-DEt-PMS_.mjs → magic-transit-odyvqrYN.mjs} +1 -1
- package/dist/{managed-defense-CGITrGgV.mjs → managed-defense-C6BUvM0n.mjs} +1 -1
- package/dist/{managed-transforms-C27VjoWR.mjs → managed-transforms-DsaxeScz.mjs} +1 -1
- package/dist/{mcp-DMWcXkfV.mjs → mcp-BxtYhOtC.mjs} +2 -2
- package/dist/{mesh-CfZcm-Rl.mjs → mesh-CnbgVcmG.mjs} +1 -1
- package/dist/{migrate-D-xf74Yn.mjs → migrate-DykHgSce.mjs} +1 -1
- package/dist/{monetization-B5ksXOGO.mjs → monetization-xQZpBrQP.mjs} +1 -1
- package/dist/{network-BON9bFrK.mjs → network-LAUNuxaC.mjs} +4 -4
- package/dist/{network-interconnects-BWMs0LvT.mjs → network-interconnects-CUiDUngh.mjs} +1 -1
- package/dist/npm-launcher-Cx4wMwLb.mjs +2 -0
- package/dist/{o11y-CyZO37dy.mjs → o11y-C-c35mMA.mjs} +37 -41
- package/dist/{oauth-Do7K1Ycd.mjs → oauth-EQ8jqFiP.mjs} +1 -1
- package/dist/{oauth-CXm7-A7X.mjs → oauth-rF-C4Io5.mjs} +1 -1
- package/dist/{observability-DYy09kYo.mjs → observability-DoLkj6bq.mjs} +2 -2
- package/dist/{ohttp-gateway-Cqh36jz6.mjs → ohttp-gateway-CENYzFIz.mjs} +1 -1
- package/dist/open-BPppUKSJ-CtZ6XNLR.mjs +3 -0
- package/dist/{organizations-CiMeaQl0.mjs → organizations-BgezURxZ.mjs} +2 -2
- package/dist/package-DCTjwDaM.mjs +2 -0
- package/dist/{page-rules-DFNj-ZUk.mjs → page-rules-Zyhg9DGc.mjs} +1 -1
- package/dist/{pages-SSooyF53.mjs → pages-Vw8GCFpl.mjs} +2 -2
- package/dist/{pay-per-crawl-CC-mvH0h.mjs → pay-per-crawl-bYP31GU8.mjs} +1 -1
- package/dist/pay-per-use-Cz6NlvYS.mjs +40 -0
- package/dist/{pipelines-DGEpLhjs.mjs → pipelines-xSavOmi1.mjs} +2 -2
- package/dist/{precursor-CDnv_b0d.mjs → precursor-BYduCjnv.mjs} +1 -1
- package/dist/previews-Nvo-cl2k.mjs +6 -0
- package/dist/{progress-LGZ6-91a.mjs → progress-DV597tgm.mjs} +1 -1
- package/dist/{prompt-BSLPgIUg.mjs → prompt-WkzeQp66.mjs} +1 -1
- package/dist/{queues-DLGsVwH2.mjs → queues-lJRoRXhz.mjs} +3 -3
- package/dist/{r2-D94n2j1x.mjs → r2-CV2kwsvV.mjs} +2 -2
- package/dist/{radar-FHMHBDvg.mjs → radar-DMWHnxJf.mjs} +3 -3
- package/dist/raw-fetch-CWPKE55l.mjs +2 -0
- package/dist/{realtime-D4ImR9js.mjs → realtime-Cj7nP7c6.mjs} +38 -38
- package/dist/{registrar-BhCVJBi8.mjs → registrar-oO0NOyhZ.mjs} +1 -1
- package/dist/{registrar-sandbox-7S73fEBK.mjs → registrar-sandbox-BgakIlfa.mjs} +1 -1
- package/dist/{reporting-D-QpeRFo.mjs → reporting-Do1AQqTI.mjs} +1 -1
- package/dist/{request-headers-Inpc06QI.mjs → request-headers-Djxo_3pX.mjs} +1 -1
- package/dist/{request-tracers--W_ox55F.mjs → request-tracers-sHkrW5oF.mjs} +1 -1
- package/dist/{resource-sharing-DX-ySgCn.mjs → resource-sharing-DK3ayrt1.mjs} +5 -5
- package/dist/rolldown-runtime-BMUeFane-B0Knkemy.mjs +2 -0
- package/dist/{rules--3pEhUqP.mjs → rules-vWqZK-o-.mjs} +1 -1
- package/dist/{rulesets-UXNMbf21.mjs → rulesets-aaqJ_a0X.mjs} +4 -4
- package/dist/{rum-BI5bcaxj.mjs → rum-DGEDLsnB.mjs} +1 -1
- package/dist/run-BB7jHA1c.mjs +2 -0
- package/dist/run-DygYhh8g.mjs +2 -0
- package/dist/{schema-cache-CoAkY3EL.mjs → schema-cache-sZ4FzRWS.mjs} +1 -1
- package/dist/{schema-flags-YgeJ6Bey.mjs → schema-flags-CDUlHuF1.mjs} +1 -1
- package/dist/{scim-CUDTL74k.mjs → scim-BrUHziC8.mjs} +1 -1
- package/dist/{secrets-store-cpAAAdOD.mjs → secrets-store-DxflmMoF.mjs} +1 -1
- package/dist/{security-insights-DQDGeoGK.mjs → security-insights-BNGHKTWz.mjs} +1 -1
- package/dist/{security-txt-DMqNwxtT.mjs → security-txt-_joWJ0Gp.mjs} +1 -1
- package/dist/session-DZ2yOupF.mjs +2 -0
- package/dist/shared-Pw74xPAo.mjs +2 -0
- package/dist/{smart-shield-Tjh_-EWc.mjs → smart-shield-BoqicemV.mjs} +1 -1
- package/dist/{snippets-DL_OB7QE.mjs → snippets-CvJLit_s.mjs} +1 -1
- package/dist/{spawn-Dcit1ZgW.mjs → spawn-DXVOEwot.mjs} +4 -4
- package/dist/{spectrum-BDbdvXiL.mjs → spectrum-B0UP7LzC.mjs} +1 -1
- package/dist/{speed-PzlKqOxf.mjs → speed-DgzvaMOz.mjs} +1 -1
- package/dist/{sql-DqBcAQOi.mjs → sql-DIG6XE_K.mjs} +1 -1
- package/dist/{src-DY1gO4Hq.mjs → src-Dzp9yby9.mjs} +5 -5
- package/dist/{ssl-DmOr9F4p.mjs → ssl-CbY8Pl3Z.mjs} +2 -2
- package/dist/startup-profile-Cbj0m__A.mjs +2 -0
- package/dist/startup-profile-Dv_n6cTV.mjs +27 -0
- package/dist/state-CLwk9bEA.mjs +2 -0
- package/dist/{state-jXwCUs1C.mjs → state-qrqAdKcE.mjs} +1 -1
- package/dist/static-assets-BgkS3OVR.mjs +268 -0
- package/dist/{stream-BgqXnjWX.mjs → stream-1caalJNi.mjs} +4 -4
- package/dist/{tags-CkXGEaVr.mjs → tags-BjvacIQ7.mjs} +1 -1
- package/dist/{telemetry-CtWrahO4.mjs → telemetry-CWj_fL8y.mjs} +1 -1
- package/dist/telemetry-DTH02h9J.mjs +2 -0
- package/dist/{tenant-custom-nameservers-CbQRqKgy.mjs → tenant-custom-nameservers-B0BjA-UV.mjs} +1 -1
- package/dist/{tenants-fugWMuoJ.mjs → tenants-BPNCJnmb.mjs} +1 -1
- package/dist/{tunnels-C6xf10z5.mjs → tunnels-CCzHprUK.mjs} +23 -13
- package/dist/{turnstile-BRICGTnt.mjs → turnstile-BMmqJC6b.mjs} +4 -5
- package/dist/ui-BU-SZoFd.mjs +2 -0
- package/dist/undici-C4huyh7H.mjs +262 -0
- package/dist/update-BpPQ59qa.mjs +4 -0
- package/dist/update-check-BAv9XVm9.mjs +2 -0
- package/dist/{update-check-Cza2MgCa.mjs → update-check-CGMWCyjh.mjs} +1 -1
- package/dist/update-check-worker.mjs +1 -1
- package/dist/{url-normalization-CosYnVMB.mjs → url-normalization-ClDobamp.mjs} +1 -1
- package/dist/{url-scanner-BVH_6AJG.mjs → url-scanner-wqqX5qUt.mjs} +1 -1
- package/dist/{user-Bu7ff3bx.mjs → user-xQyUKX-z.mjs} +30 -30
- package/dist/valid-DVkqhQD-.mjs +2 -0
- package/dist/vectorize-D-wkY8uk.mjs +30 -0
- package/dist/version-PN64nEci.mjs +2 -0
- package/dist/{waiting-rooms-CXY1SQVQ.mjs → waiting-rooms--ADD0hV3.mjs} +3 -3
- package/dist/{web-assets-OGdIcJ6Q.mjs → web-assets-B0fZPTH3.mjs} +1 -1
- package/dist/web3-UafRTP9F.mjs +26 -0
- package/dist/whoami-CNZdOBDw.mjs +2 -0
- package/dist/{whoami-sg_pvN-b.mjs → whoami-DrdBMfdg.mjs} +3 -3
- package/dist/{workers-CCxmTaS8.mjs → workers-QUJ-FdJE.mjs} +3 -3
- package/dist/{workers-for-platforms-DQyH5xmF.mjs → workers-for-platforms-BC33ReOa.mjs} +1 -1
- package/dist/{workers-vpc-Dv_4bVyj.mjs → workers-vpc-BDcPn4np.mjs} +1 -1
- package/dist/{workflows-Bm0mxDoC.mjs → workflows-BQ2_aoCs.mjs} +1 -1
- package/dist/wrangler-migration-BXwEbK_h.mjs +614 -0
- package/dist/{zaraz-Nw7gzQK9.mjs → zaraz-DVHjNnRT.mjs} +1 -1
- package/dist/{zero-trust-iL97isOb.mjs → zero-trust-_sMgVrcF.mjs} +14 -14
- package/dist/{zones-BNtHBhcK.mjs → zones-Bj5EdxMY.mjs} +2 -2
- package/package.json +15 -14
- package/dist/auth-Bir2IDwr.mjs +0 -2
- package/dist/auth-C2vTENwf.mjs +0 -2
- package/dist/auth-MdFy7pyc.mjs +0 -3
- package/dist/auth-token-e3ippjSj.mjs +0 -8
- package/dist/autoconfig-DdFyUPGn.mjs +0 -812
- package/dist/build-ep4sfzzA.mjs +0 -2
- package/dist/cf-TB3QCSDh.mjs +0 -18
- package/dist/chunk-AAQI36FL-e6E5HW1g.mjs +0 -319
- package/dist/chunk-DSGVRFIS-5bsdVCqZ.mjs +0 -2
- package/dist/chunk-JP6R7L72-C0kFUelb.mjs +0 -2
- package/dist/chunk-SQ32YSCG-CQ3eXDT8.mjs +0 -363
- package/dist/chunk-U6NEESU5-DqqRCaWH.mjs +0 -2
- package/dist/chunk-WMOON6TZ-C0dmPHpM.mjs +0 -2
- package/dist/command-DkM3rDla.mjs +0 -2
- package/dist/deploy-context-DmYBYd8Q.mjs +0 -55
- package/dist/dev-DgerLZtO.mjs +0 -4
- package/dist/dist-aDyCGA5i.mjs +0 -465
- package/dist/dot-prop-IITUZ2XW-C4pkmT-K.mjs +0 -2
- package/dist/dotenv-DKRemNCH.mjs +0 -4
- package/dist/error-sanitization-Bve6lZ3A.mjs +0 -2
- package/dist/error-sanitization-CZolnIrD.mjs +0 -2
- package/dist/login-B8_ufSFI.mjs +0 -2
- package/dist/login-DGY-anz-.mjs +0 -5
- package/dist/open-PCXX3ZDZ-5J5IU2MX-DFe2CQkm.mjs +0 -4
- package/dist/open-PCXX3ZDZ-BD2iNJqn.mjs +0 -4
- package/dist/package-DLWHXbG1.mjs +0 -2
- package/dist/pay-per-use-9W39KK5F.mjs +0 -34
- package/dist/previews-CjBD7r9s.mjs +0 -6
- package/dist/raw-fetch-Cy2YR7bJ.mjs +0 -2
- package/dist/run-Bq0XGAg9.mjs +0 -2
- package/dist/run-CWmtD2lJ.mjs +0 -2
- package/dist/session-BfWuE2ax.mjs +0 -2
- package/dist/shared-BhmS_OQE.mjs +0 -2
- package/dist/startup-profile-C0UCllfs.mjs +0 -27
- package/dist/startup-profile-DT8dG8q7.mjs +0 -2
- package/dist/state-CQZhgMaN.mjs +0 -2
- package/dist/static-assets-n9iBqrrt.mjs +0 -386
- package/dist/telemetry-CvCFWLQU.mjs +0 -2
- package/dist/ui-C6DiSszw.mjs +0 -2
- package/dist/update-check-CO84YQp5.mjs +0 -2
- package/dist/vectorize-CIdh1Bb7.mjs +0 -30
- package/dist/version-DNYoInKC.mjs +0 -2
- package/dist/web3-BkwNeLQR.mjs +0 -26
- package/dist/whoami-DmQbL0w1.mjs +0 -2
- package/dist/wrangler-migration-iPVbGt2G.mjs +0 -959
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{i as e}from"./chunk-WMOON6TZ-C0dmPHpM.mjs";import{createRequire as t}from"node:module";t(import.meta.url||(typeof __filename==`string`?__filename:`/`));var n=/* @__PURE__ */ e(e=>{let t=typeof e;return e!==null&&(t===`object`||t===`function`)},`isObject`),r=/* @__PURE__ */ e(e=>n(e)&&Object.keys(e).length===0,`isEmptyObject`),i=/* @__PURE__ */ new Set([`__proto__`,`prototype`,`constructor`]),a=/* @__PURE__ */ new Set(`0123456789`);function o(e){let t=[],n=``,r=`start`,o=!1;for(let s of e)switch(s){case`\\`:if(r===`index`)throw Error(`Invalid character in an index`);if(r===`indexEnd`)throw Error(`Invalid character after an index`);o&&(n+=s),r=`property`,o=!o;break;case`.`:if(r===`index`)throw Error(`Invalid character in an index`);if(r===`indexEnd`){r=`property`;break}if(o){o=!1,n+=s;break}if(i.has(n))return[];t.push(n),n=``,r=`property`;break;case`[`:if(r===`index`)throw Error(`Invalid character in an index`);if(r===`indexEnd`){r=`index`;break}if(o){o=!1,n+=s;break}if(r===`property`){if(i.has(n))return[];t.push(n),n=``}r=`index`;break;case`]`:if(r===`index`){t.push(Number.parseInt(n,10)),n=``,r=`indexEnd`;break}if(r===`indexEnd`)throw Error(`Invalid character after an index`);default:if(r===`index`&&!a.has(s))throw Error(`Invalid character in an index`);if(r===`indexEnd`)throw Error(`Invalid character after an index`);r===`start`&&(r=`property`),o&&(o=!1,n+=`\\`),n+=s}switch(o&&(n+=`\\`),r){case`property`:if(i.has(n))return[];t.push(n);break;case`index`:throw Error(`Index was not closed`);case`start`:t.push(``)}return t}e(o,`getPathSegments`);function s(e,t){if(typeof t!=`number`&&Array.isArray(e)){let n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}e(s,`isStringIndex`);function c(e,t){if(s(e,t))throw Error(`Cannot use string index`)}e(c,`assertNotStringIndex`);function l(e,t,r){if(!n(e)||typeof t!=`string`)return r===void 0?e:r;let i=o(t);if(i.length===0)return r;for(let t=0;t<i.length;t++){let n=i[t];if(e=s(e,n)?t===i.length-1?void 0:null:e[n],e==null){if(t!==i.length-1)return r;break}}return e===void 0?r:e}e(l,`getProperty`);function u(e,t,r){if(!n(e)||typeof t!=`string`)return e;let i=e,a=o(t);for(let t=0;t<a.length;t++){let i=a[t];c(e,i),t===a.length-1?e[i]=r:n(e[i])||(e[i]=typeof a[t+1]==`number`?[]:{}),e=e[i]}return i}e(u,`setProperty`);function d(e,t){if(!n(e)||typeof t!=`string`)return!1;let r=o(t);for(let t=0;t<r.length;t++){let i=r[t];if(c(e,i),t===r.length-1)return delete e[i],!0;if(e=e[i],!n(e))return!1}}e(d,`deleteProperty`);function f(e,t){if(!n(e)||typeof t!=`string`)return!1;let r=o(t);if(r.length===0)return!1;for(let t of r){if(!n(e)||!(t in e)||s(e,t))return!1;e=e[t]}return!0}e(f,`hasProperty`);function p(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replaceAll(/[\\.[]/g,`\\$&`)}e(p,`escapePath`);function m(e){let t=Object.entries(e);return Array.isArray(e)?t.map(([e,t])=>[Number(e),t]):t}e(m,`entries`);function h(e){let t=``;for(let[n,r]of m(e))typeof r==`number`?t+=`[${r}]`:(r=p(r),t+=n===0?r:`.${r}`);return t}e(h,`stringifyPath`);function*g(e,t=[]){if(!n(e)||r(e))t.length>0&&(yield h(t));else for(let[n,r]of m(e))yield*g(r,[...t,n])}e(g,`deepKeysIterator`);function _(e){return[...g(e)]}e(_,`deepKeys`);export{l as getProperty};
|
package/dist/dotenv-DKRemNCH.mjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{n as e,t}from"./rolldown-runtime-BNtqjh-B.mjs";import{a as n,r,t as i}from"./chunk-U6NEESU5-DqqRCaWH.mjs";import{N as a}from"./chunk-AAQI36FL-e6E5HW1g.mjs";import{createRequire as o}from"node:module";import*as s from"node:path";import*as c from"node:fs/promises";var l=/* @__PURE__ */ t(((e,t)=>{t.exports={name:`dotenv`,version:`16.3.1`,description:`Loads environment variables from .env file`,main:`lib/main.js`,types:`lib/main.d.ts`,exports:{".":{types:`./lib/main.d.ts`,require:`./lib/main.js`,default:`./lib/main.js`},"./config":`./config.js`,"./config.js":`./config.js`,"./lib/env-options":`./lib/env-options.js`,"./lib/env-options.js":`./lib/env-options.js`,"./lib/cli-options":`./lib/cli-options.js`,"./lib/cli-options.js":`./lib/cli-options.js`,"./package.json":`./package.json`},scripts:{"dts-check":`tsc --project tests/types/tsconfig.json`,lint:`standard`,"lint-readme":`standard-markdown`,pretest:`npm run lint && npm run dts-check`,test:`tap tests/*.js --100 -Rspec`,prerelease:`npm test`,release:`standard-version`},repository:{type:`git`,url:`git://github.com/motdotla/dotenv.git`},funding:`https://github.com/motdotla/dotenv?sponsor=1`,keywords:[`dotenv`,`env`,`.env`,`environment`,`variables`,`config`,`settings`],readmeFilename:`README.md`,license:`BSD-2-Clause`,devDependencies:{"@definitelytyped/dtslint":`^0.0.133`,"@types/node":`^18.11.3`,decache:`^4.6.1`,sinon:`^14.0.1`,standard:`^17.0.0`,"standard-markdown":`^7.1.0`,"standard-version":`^9.5.0`,tap:`^16.3.0`,tar:`^6.1.11`,typescript:`^4.8.4`},engines:{node:`>=12`},browser:{fs:!1}}})),u=/* @__PURE__ */ t(((t,n)=>{let r=e(`fs`),i=e(`path`),a=e(`os`),o=e(`crypto`),s=l().version,c=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function u(e){let t={},n=e.toString();n=n.replace(/\r\n?/gm,`
|
|
3
|
-
`);let r;for(;(r=c.exec(n))!=null;){let e=r[1],n=r[2]||``;n=n.trim();let i=n[0];n=n.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),i===`"`&&(n=n.replace(/\\n/g,`
|
|
4
|
-
`),n=n.replace(/\\r/g,`\r`)),t[e]=n}return t}function d(e){let t=_(e),n=w.configDotenv({path:t});if(!n.parsed)throw Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);let r=h(e).split(`,`),i=r.length,a;for(let e=0;e<i;e++)try{let t=g(n,r[e].trim());a=w.decrypt(t.ciphertext,t.key);break}catch(t){if(e+1>=i)throw t}return w.parse(a)}function f(e){console.log(`[dotenv@${s}][INFO] ${e}`)}function p(e){console.log(`[dotenv@${s}][WARN] ${e}`)}function m(e){console.log(`[dotenv@${s}][DEBUG] ${e}`)}function h(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:``}function g(e,t){let n;try{n=new URL(t)}catch(e){throw e.code===`ERR_INVALID_URL`?Error(`INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development`):e}let r=n.password;if(!r)throw Error(`INVALID_DOTENV_KEY: Missing key part`);let i=n.searchParams.get(`environment`);if(!i)throw Error(`INVALID_DOTENV_KEY: Missing environment part`);let a=`DOTENV_VAULT_${i.toUpperCase()}`,o=e.parsed[a];if(!o)throw Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);return{ciphertext:o,key:r}}function _(e){let t=i.resolve(process.cwd(),`.env`);return e&&e.path&&e.path.length>0&&(t=e.path),t.endsWith(`.vault`)?t:`${t}.vault`}function v(e){return e[0]===`~`?i.join(a.homedir(),e.slice(1)):e}function y(e){f(`Loading env from encrypted .env.vault`);let t=w._parseVault(e),n=process.env;return e&&e.processEnv!=null&&(n=e.processEnv),w.populate(n,t,e),{parsed:t}}function b(e){let t=i.resolve(process.cwd(),`.env`),n=`utf8`,a=!!(e&&e.debug);e&&(e.path!=null&&(t=v(e.path)),e.encoding!=null&&(n=e.encoding));try{let i=w.parse(r.readFileSync(t,{encoding:n})),a=process.env;return e&&e.processEnv!=null&&(a=e.processEnv),w.populate(a,i,e),{parsed:i}}catch(e){return a&&m(`Failed to load ${t} ${e.message}`),{error:e}}}function x(e){let t=_(e);return h(e).length===0?w.configDotenv(e):r.existsSync(t)?w._configVault(e):(p(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),w.configDotenv(e))}function S(e,t){let n=Buffer.from(t.slice(-64),`hex`),r=Buffer.from(e,`base64`),i=r.slice(0,12),a=r.slice(-16);r=r.slice(12,-16);try{let e=o.createDecipheriv(`aes-256-gcm`,n,i);return e.setAuthTag(a),`${e.update(r)}${e.final()}`}catch(e){let t=e instanceof RangeError,n=e.message===`Invalid key length`,r=e.message===`Unsupported state or unable to authenticate data`;throw t||n?Error(`INVALID_DOTENV_KEY: It must be 64 characters long (or more)`):r?Error(`DECRYPTION_FAILED: Please check your DOTENV_KEY`):(console.error(`Error: `,e.code),console.error(`Error: `,e.message),e)}}function C(e,t,n={}){let r=!!(n&&n.debug),i=!!(n&&n.override);if(typeof t!=`object`)throw Error(`OBJECT_REQUIRED: Please check the processEnv argument being passed to populate`);for(let n of Object.keys(t))Object.prototype.hasOwnProperty.call(e,n)?(i===!0&&(e[n]=t[n]),r&&m(i===!0?`"${n}" is already defined and WAS overwritten`:`"${n}" is already defined and was NOT overwritten`)):e[n]=t[n]}let w={configDotenv:b,_configVault:y,_parseVault:d,config:x,decrypt:S,parse:u,populate:C};n.exports.configDotenv=w.configDotenv,n.exports._configVault=w._configVault,n.exports._parseVault=w._parseVault,n.exports.config=w.config,n.exports.decrypt=w.decrypt,n.exports.parse=w.parse,n.exports.populate=w.populate,n.exports=w})),d=u();o(import.meta.url||(typeof __filename==`string`?__filename:`/`));var f=i({"../../node_modules/.pnpm/dotenv-expand@13.0.0/node_modules/dotenv-expand/lib/main.js"(e,t){function n(e){return e.replace(/\\\$/g,`$`)}r(n,`_resolveEscapeSequences`);function i(e,t,n){let r={...n,...t},i=/(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g,a=e,o,s=/* @__PURE__ */ new Set;for(;(o=i.exec(a))!==null;){s.add(a);let[e,t,c]=o,l=t||c,u=l.match(/(:\+|\+|:-|-)/),d=u?u[0]:null,f=l.split(d),p,m,h=f.shift();if([`:+`,`+`].includes(d)?(p=r[h]?f.join(d):``,m=null):(p=f.join(d),m=r[h]),a=m?s.has(m)?a.replace(e,p):a.replace(e,m):a.replace(e,p),a===n[h])break;i.lastIndex=0}return a}r(i,`expandValue`);function a(e){let t={},r=process.env;e&&e.processEnv!=null&&(r=e.processEnv);for(let a in e.parsed){let o=e.parsed[a];o=r[a]&&r[a]!==o?r[a]:i(o,r,t),e.parsed[a]=n(o),t[a]=n(o)}for(let t in e.parsed)r[t]=e.parsed[t];return e}r(a,`expand`),t.exports.expand=a}}),p=n(f());function m(){let e=/* @__PURE__ */ new Map,t={},n=/* @__PURE__ */ r(e=>typeof e==`string`?e.toLowerCase():e,`canonical`);return new Proxy(t,{get(t,r,i){let a=e.get(n(r));return a===void 0?void 0:Reflect.get(t,a,i)},set(t,r,i,a){let o=n(r),s=e.get(o);return s!==void 0&&s!==r&&Reflect.deleteProperty(t,s),e.set(o,r),Reflect.set(t,r,i,a)},has(t,r){let i=e.get(n(r));return i!==void 0&&Reflect.has(t,i)},getOwnPropertyDescriptor(t,r){let i=e.get(n(r));return i===void 0?void 0:Reflect.getOwnPropertyDescriptor(t,i)},defineProperty(t,r,i){let a=n(r),o=e.get(a);return o!==void 0&&o!==r&&Reflect.deleteProperty(t,o),e.set(a,r),Reflect.defineProperty(t,r,i)},deleteProperty(t,r){let i=n(r),a=e.get(i);return e.delete(i),a===void 0?Reflect.deleteProperty(t,r):Reflect.deleteProperty(t,a)}})}r(m,`caseInsensitiveEnv`);function h(e,t=process.env){return g((0,d.parse)(e),t)}r(h,`parseAndExpandDotEnv`);function g(e,t){let n={...e},r=Object.keys(n),i=C(t);(0,p.expand)({parsed:n,processEnv:C(t)});for(let e of r)Object.hasOwn(i,e)&&(n[e]=i[e]);return n}r(g,`expandParsedDotEnv`);function _(e,t){return e===!1?[]:[`.env`,`.env.local`,...t===void 0?[]:[`.env.${t}`,`.env.${t}.local`]].map(t=>s.resolve(e,t))}r(_,`getEnvPaths`);function v(e,t){return e===!1?[]:[...t===void 0?[]:[`.dev.vars.${t}`],`.dev.vars`].map(t=>s.resolve(e,t))}r(v,`getDevVarsCandidatePaths`);async function y(e,t){if(t===`local`)throw Error(`"local" cannot be used as a mode name because it conflicts with the .local postfix for .env files.`);let n=_(e,t),r={},i={};for(let e of n){let t=await x(e,d.parse);if(t!==void 0)for(let[e,n]of Object.entries(t.values))r[e]=n,i[e]={type:`file`,path:t.path}}let a=C(process.env),o=g(r,a),s={...i};for(let[e,t]of Object.entries(a))o[e]=t,s[e]={type:`process`};return{values:o,sources:s}}r(y,`loadEnv`);async function b(e,t){let n=v(e,t);for(let e of n){let t=await x(e,d.parse);if(t!==void 0)return t.values}}r(b,`loadDevVars`);async function x(e,t){try{let n=await c.stat(e);return!n.isFile()&&!n.isFIFO()?void 0:{path:e,values:t(await c.readFile(e,`utf8`))}}catch(e){if(S(e))return;throw e}}r(x,`tryParseFile`);function S(e){return e instanceof Error&&`code`in e&&(e.code===`ENOENT`||e.code===`ENOTDIR`)}r(S,`isMissingFileError`);function C(e){let t=process.platform===`win32`?m():{};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}r(C,`copyProcessEnv`);const w=`CLOUDFLARE_DEPENDENCIES_INSTRUMENTATION`;function T(e){let t=process.env[w];if(t===void 0)return e;let n=t.toLowerCase();if(n!==`true`&&n!==`false`)throw new a(`Expected ${w} to be "true" or "false", but got ${JSON.stringify(t)}`,{telemetryMessage:!1});return{...e,dependencies_instrumentation:{...e.dependencies_instrumentation,enabled:n===`true`}}}const E=/* @__PURE__ */ new Set([`CLOUDFLARE_ACCESS_CLIENT_ID`,`CLOUDFLARE_ACCESS_CLIENT_SECRET`,`CLOUDFLARE_ACCOUNT_ID`,`CLOUDFLARE_API_TOKEN`,`CLOUDFLARE_COMPLIANCE_REGION`,w,`CLOUDFLARE_ZONE_ID`,`WRANGLER_API_ENVIRONMENT`]);function D(e){return E.has(e)}async function O(e={}){if(e.local)return()=>{};let t=await y(process.cwd(),e.mode),n=[];for(let[e,r]of Object.entries(t.values))D(e)&&t.sources[e]?.type===`file`&&(process.env[e]=r,n.push(e));return()=>{for(let e of n)delete process.env[e]}}async function k(e,t){let n=await O(e);try{return await t()}finally{n()}}const A=/* @__PURE__ */ new Set(/* @__PURE__ */ `access curl.access login.access rdp.access smb.access ssh.access ssh-config.access ssh-gen.access tcp.access token.build.dev.docs.docs search.init.init workers.migrate.tunnels diag.tunnels login.tunnels quick-start.tunnels ready.tunnels tail.workers check.workers types.deploy.previews deploy.tunnels run.workers triggers deploy.workers versions create`.split(`.`));function j(e,t){return!t&&!A.has(e)}export{h as a,T as i,j as n,u as o,k as r,O as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./chunk-AAQI36FL-e6E5HW1g.mjs";import{i as t}from"./api-5qkbb5HW.mjs";function n(e){if(typeof e!=`object`||!e)return[];let t=e.errors;return Array.isArray(t)?t.flatMap(e=>{if(typeof e!=`object`||!e)return[];let t=e.code;return typeof t==`number`&&Number.isFinite(t)?[t]:[]}):[]}function r(e){return typeof e==`number`&&Number.isInteger(e)&&e>=100&&e<=599}function i(e){try{return a(e)}catch{return{errorType:`Error`}}}function a(i){if(i instanceof t){let e=n(i.body);return{errorType:`APIError`,...r(i.statusCode)?{httpStatus:i.statusCode}:{},...e.length===0?{}:{errorCodes:e}}}return i instanceof e?{errorType:`APIError`,...r(i.status)?{httpStatus:i.status}:{},...typeof i.code==`number`&&Number.isFinite(i.code)?{errorCodes:[i.code]}:{}}:i instanceof Error?{errorType:`Error`}:{errorType:typeof i}}export{i as t};
|
package/dist/login-B8_ufSFI.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./theme-BGHWSKCw.mjs";import"./telemetry-CvCFWLQU.mjs";import"./ui-C6DiSszw.mjs";import{n as t}from"./run-CWmtD2lJ.mjs";import{t as n}from"./log-LXeTb6Zo.mjs";import{n as r,t as i}from"./login-DGY-anz-.mjs";const a={...i,describe:!1,handler:async t=>{t.quiet||n.info(`${e.code(`cf login`)} is an alias for ${e.code(`cf auth login`)}. Authentication commands are under ${e.code(`cf auth`)}.`),await i.handler(t)}};var o=t(a,{command:`login`,classification:r});export{o as default};
|
package/dist/login-DGY-anz-.mjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./theme-BGHWSKCw.mjs";import{b as t,g as n,l as r,p as i,s as a}from"./chunk-SQ32YSCG-CQ3eXDT8.mjs";import{c as o,d as s,f as c,g as l,h as u,i as d,o as f,r as p,s as m,u as h}from"./oauth-CXm7-A7X.mjs";import{l as g,o as _,s as v,t as y}from"./cf-TB3QCSDh.mjs";import{n as b,t as x}from"./state-jXwCUs1C.mjs";import{t as S}from"./log-LXeTb6Zo.mjs";import"./ui-C6DiSszw.mjs";import{n as C,t as w}from"./output-DcDP8hsi.mjs";import T from"node:path";import{randomUUID as E,timingSafeEqual as D}from"node:crypto";function O(){i()===void 0&&v().keyring_enabled===void 0&&(k()?g({keyring_enabled:!0}):x().keyringFallbackWarned||(S.warn("OS keyring storage is unavailable. OAuth credentials will be stored in a plaintext file. cf will try the keyring again on your next login. Use `cf auth login --no-use-keyring` to keep plaintext storage, or set CLOUDFLARE_AUTH_USE_KEYRING=true to require keyring storage."),b({keyringFallbackWarned:!0})))}function k(){try{let e=n(y,`keyring-probe-${E()}`,_());if(e.kind!==`available`)return!1;let t=a(),{provider:r}=e;try{r.setKey(t);let e=r.getKey();return e!==void 0&&e.length===t.length&&D(e,t)}finally{r.deleteKey()}}catch{return!1}}function A(e,t,n){if(!e.profile)return;let r=n?` ${n}`:``;throw Error(`The --profile flag cannot be used with \`cf auth ${t}\`.${r}`)}function j(){if(r({allowGlobalAuthKey:!1})!==void 0)throw Error(`Cannot manage auth profiles while CLOUDFLARE_API_TOKEN is set. Unset CLOUDFLARE_API_TOKEN and try again.`)}const M={command:`create <name>`,describe:`Create or re-authenticate a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name for the auth profile`,demandOption:!0}).option(`browser`,{type:`boolean`,description:`Open the authorization link in a browser (use --no-browser to print it instead)`,default:!0}).option(`device`,{type:`boolean`,description:`Use OAuth device authorization (use --no-device for the localhost callback flow)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}),handler:async e=>{A(e,`create`,"Pass the profile name as the command argument: `cf auth create <name>`."),j(),t(e.name);let n=f().configs.exists(e.name);await h({browser:e.browser,device:e.device,scopes:e.scopes,profile:e.name}),C(n?`Profile "${e.name}" re-authenticated.`:`Profile "${e.name}" created.`),S.info(`To use this profile in a directory, run:`,`cf auth activate ${e.name}`)}},N={command:`delete <name>`,describe:`Delete a named auth profile`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to delete`,demandOption:!0}),handler:async n=>{A(n,`delete`),j(),t(n.name);let r=f();if(!r.configs.exists(n.name))throw Error(`Profile "${n.name}" does not exist.`);let i=r.bindings.removeAllBindingsForProfile(n.name);i.length>0&&S.info([`Removed directory bindings:`,...i.map(e=>` ${e}`)].join(`
|
|
3
|
-
`)),await s(n.name),r.configs.delete(n.name),C(`Profile "${n.name}" deleted.`);let a=r.bindings.getProfileForDirectory(process.cwd());a?S.info(`Active profile for this directory: ${a}.`):r.configs.exists(`default`)?S.info(`This directory now uses the default profile.`):S.info(`No active profile for this directory. Run ${e.code(`cf auth login`)} to set up the default profile, or ${e.code(`cf auth create <name>`)} to create a named profile.`)}},P={command:`activate <name> [dir]`,describe:`Bind a named auth profile to a directory`,builder:e=>e.positional(`name`,{type:`string`,description:`Name of the auth profile to activate`,demandOption:!0}).positional(`dir`,{type:`string`,description:`Directory to bind the profile to (defaults to current directory)`}),handler:e=>{A(e,`activate`,"Pass the profile name as the command argument: `cf auth activate <name>`."),j(),t(e.name);let n=f();if(!n.configs.exists(e.name))throw Error(`Profile "${e.name}" does not exist. Run \`cf auth create ${e.name}\` first.`);let r=e.dir??process.cwd();n.bindings.activate(e.name,r),C(`Profile "${e.name}" activated for "${T.resolve(r)}".`)}},F={command:`deactivate [dir]`,describe:`Remove the auth profile binding from a directory`,builder:e=>e.positional(`dir`,{type:`string`,description:`Directory to unbind (defaults to current directory). Must be the exact directory the profile was bound to.`}),handler:t=>{A(t,`deactivate`),j();let n=f(),r=t.dir??process.cwd(),{removedProfile:i,newResolution:a}=n.bindings.deactivate(r);C(`Profile "${i}" deactivated from "${T.resolve(r)}".`),a.profile===void 0?S.info(`Run ${e.code(`cf auth login`)} to set up the default profile, or ${e.code(`cf auth create <name>`)} to create a named profile.`):a.profile==="default"?S.info(`This directory now uses the default profile.`):S.info(`Now using: ${a.profile} (${a.source}).`)}},I={command:`list`,describe:`List all auth profiles`,handler:e=>{A(e,`list`);let t=f(),n=t.bindings.read(),r={};for(let[e,t]of Object.entries(n))(r[t]??=[]).push(e);w(t.configs.list().map(e=>({name:e,boundDirectories:r[e]??[]})))}},L={safeFlags:[`force`,`browser`,`device`,`use-keyring`,`useKeyring`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}},R={command:`login`,describe:`Authenticate with Cloudflare`,builder:e=>e.option(`force`,{type:`boolean`,alias:`f`,description:`Force re-authentication even if already logged in`,default:!1}).option(`browser`,{type:`boolean`,description:`Open the authorization link in a browser (use --no-browser to print it instead)`,default:!0}).option(`device`,{type:`boolean`,description:`Use OAuth device authorization (use --no-device for the localhost callback flow)`,default:!0}).option(`scopes`,{type:`string`,array:!0,description:`The set of OAuth scopes to request`}).option(`use-keyring`,{type:`boolean`,description:`Encrypt OAuth credentials using the OS keychain (default when available; persisted across invocations; use --no-use-keyring to disable)`}),handler:async t=>{A(t,`login`,"Run `cf auth create <name>` to authenticate a named profile.");let n=p();if(n!=="default"&&S.warn(`This directory has profile "${n}" active. ${e.code(`cf auth login`)} updates the default profile, not "${n}". To re-authenticate "${n}", run:`,`cf auth create ${n}`),l(`default`),t.useKeyring!==void 0&&u(t.useKeyring),r({allowGlobalAuthKey:!1})!==void 0){S.warn(`${e.code(`CLOUDFLARE_API_TOKEN`)} is set and takes precedence. Unset it to log in via OAuth.`);return}if(t.useKeyring===void 0&&O(),!t.force&&o()){if(await m()){let t=c(),n=[`You are already logged in.`,`${e.info(`Config file:`)} ${e.muted(d())}`];t?.expiration_time&&n.push(`${e.info(`Token expires:`)} ${new Date(t.expiration_time).toLocaleString()}`),n.push(`Run ${e.code(`cf auth login --force`)} to re-authenticate, or ${e.code(`cf auth logout`)} to log out.`),S.info(n.join(`
|
|
4
|
-
`));return}S.warn(`Existing tokens are invalid or expired. Starting fresh login...`)}else t.force&&o()&&S.info(`Re-authenticating...`);if(S.info(`Starting OAuth login flow...`),!await h({browser:t.browser,device:t.device,scopes:t.scopes,profile:`default`}))return;let i=c(),a=[`${e.info(`Config file:`)} ${e.muted(d())}`];i?.scopes&&a.push(i.scopes.length>5?`${e.info(`Scopes:`)} ${i.scopes.length} granted. Run ${e.code(`cf auth scopes`)} to view them by product or ${e.code(`cf auth scopes --all`)} for the full list.`:`${e.info(`Scopes:`)} ${i.scopes.join(`, `)}`),i?.expiration_time&&a.push(`${e.info(`Token expires:`)} ${new Date(i.expiration_time).toLocaleString()}`),S.info(a.join(`
|
|
5
|
-
`))}};export{M as a,I as c,A as i,L as n,F as o,P as r,N as s,R as t};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{o as e,s as t}from"./chunk-JP6R7L72-C0kFUelb.mjs";import{createRequire as n}from"node:module";import r from"node:fs";import i from"node:path";import{fileURLToPath as a}from"node:url";import o from"node:process";import s from"node:os";import c,{constants as l}from"node:fs/promises";import{promisify as u}from"node:util";import{Buffer as d}from"node:buffer";import f,{execFile as p}from"node:child_process";n(import.meta.url||(typeof __filename==`string`?__filename:`/`)),n(import.meta.url||(typeof __filename==`string`?__filename:`/`));var m;function h(){try{return r.statSync(`/.dockerenv`),!0}catch{return!1}}e(h,`hasDockerEnv`),t(h,`hasDockerEnv`);function g(){try{return r.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}e(g,`hasDockerCGroup`),t(g,`hasDockerCGroup`);function _(){return m===void 0&&(m=h()||g()),m}e(_,`isDocker`),t(_,`isDocker`);var v,y=/* @__PURE__ */ t(()=>{try{return r.statSync(`/run/.containerenv`),!0}catch{return!1}},`hasContainerEnv`);function b(){return v===void 0&&(v=y()||_()),v}e(b,`isInsideContainer`),t(b,`isInsideContainer`);var x=/* @__PURE__ */ t(()=>{if(o.platform!==`linux`)return!1;if(s.release().toLowerCase().includes(`microsoft`))return!b();try{return r.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`)?!b():!1}catch{return!1}},`isWsl`),S=o.env.__IS_WSL_TEST__?x:x(),ee=u(f.execFile),C=/* @__PURE__ */ t(()=>`${o.env.SYSTEMROOT||o.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,`powerShellPath`),w=/* @__PURE__ */ t(async(e,t={})=>{let{powerShellPath:n,...r}=t,i=w.encodeCommand(e);return ee(n??C(),[...w.argumentsPrefix,i],{encoding:`utf8`,...r})},`executePowerShell`);w.argumentsPrefix=[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`],w.encodeCommand=e=>d.from(e,`utf16le`).toString(`base64`),w.escapeArgument=e=>`'${String(e).replaceAll(`'`,`''`)}'`;function T(e){for(let t of e.split(`
|
|
3
|
-
`)){if(/^\s*#/.test(t))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,``)}}e(T,`parseMountPointFromConfig`),t(T,`parseMountPointFromConfig`);var te=u(f.execFile),ne=/* @__PURE__ */ (()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await c.access(n,l.F_OK),r=!0}catch{}if(!r)return e;let i=T(await c.readFile(n,{encoding:`utf8`}));return i===void 0?e:(t=i,t=t.endsWith(`/`)?t:`${t}/`,t)}})(),E=S?/* @__PURE__ */ t(async()=>`${await ne()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,`powerShellPathFromWsl`):C,D,O=/* @__PURE__ */ t(async()=>(D??=(async()=>{try{let e=await E();return await c.access(e,l.X_OK),!0}catch{return!1}})(),D),`canAccessPowerShell`),k=/* @__PURE__ */ t(async()=>{let e=await E(),{stdout:t}=await w(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{powerShellPath:e});return t.trim()},`wslDefaultBrowser`),A=/* @__PURE__ */ t(async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await te(`wslpath`,[`-aw`,e],{encoding:`utf8`});return t.trim()}catch{return e}},`convertWslPathToWindows`);function j(e,n,r){let i=/* @__PURE__ */ t(t=>Object.defineProperty(e,n,{value:t,enumerable:!0,writable:!0}),`define`);return Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get(){let e=r();return i(e),e},set(e){i(e)}}),e}e(j,`defineLazyProperty`),t(j,`defineLazyProperty`);var re=u(p);async function M(){if(o.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await re(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}e(M,`defaultBrowserId`),t(M,`defaultBrowserId`);var ie=u(p);async function N(e,{humanReadableOutput:t=!0,signal:n}={}){if(o.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:a}=await ie(`osascript`,[`-e`,e,r],i);return a.trim()}e(N,`runAppleScript`),t(N,`runAppleScript`);async function P(e){return N(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
4
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}e(P,`bundleName`),t(P,`bundleName`);var F=u(p),I={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},L=new Map(Object.entries(I)),R=class extends Error{static{e(this,`UnknownBrowserError`)}static{t(this,`UnknownBrowserError`)}};async function z(e=F){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new R(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=I[r];if(!i)throw new R(`Unknown browser ID: ${r}`);return i}e(z,`defaultBrowser`),t(z,`defaultBrowser`);var B=u(p),V=/* @__PURE__ */ t(e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),`titleize`);async function H(){if(o.platform===`darwin`){let e=await M();return{name:await P(e),id:e}}if(o.platform===`linux`){let{stdout:e}=await B(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:V(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(o.platform===`win32`)return z();throw Error(`Only macOS, Linux, and Windows are supported`)}e(H,`defaultBrowser2`),t(H,`defaultBrowser`);var U=!!(o.env.SSH_CONNECTION||o.env.SSH_CLIENT||o.env.SSH_TTY),W=Symbol(`fallbackAttempt`),G=import.meta.url?i.dirname(a(import.meta.url)):``,K=i.join(G,`xdg-open`),{platform:q,arch:J}=o,Y=/* @__PURE__ */ t(async(e,t)=>{if(e.length===0)return;let n=[];for(let r of e)try{return await t(r)}catch(e){n.push(e)}throw AggregateError(n,`Failed to open in all supported apps`)},`tryEachApp`),X=/* @__PURE__ */ t(async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[W]===!0;if(delete e[W],Array.isArray(e.app))return Y(e.app,t=>X({...e,app:t,[W]:!0}));let{name:n,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(n))return Y(n,t=>X({...e,app:{name:t,arguments:r},[W]:!0}));if(n===`browser`||n===`browserPrivate`){let t={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`,"com.apple.safari":`safari`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a;if(S){let e=await k();a=L.get(e)??{}}else a=await H();if(a.id in t){let o=t[a.id.toLowerCase()];if(n===`browserPrivate`){if(o===`safari`)throw Error(`Safari doesn't support opening in private mode via command line`);r.push(i[o])}return X({...e,app:{name:$[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let i,a=[],s={},u=!1;if(S&&!b()&&!U&&!n&&(u=await O()),q===`darwin`)i=`open`,e.wait&&a.push(`--wait-apps`),e.background&&a.push(`--background`),e.newInstance&&a.push(`--new`),n&&a.push(`-a`,n);else if(q===`win32`||u){i=await E(),a.push(...w.argumentsPrefix),S||(s.windowsVerbatimArguments=!0),S&&e.target&&(e.target=await A(e.target));let t=[`$ProgressPreference = 'SilentlyContinue';`,`Start`];e.wait&&t.push(`-Wait`),n?(t.push(w.escapeArgument(n)),e.target&&r.push(e.target)):e.target&&t.push(w.escapeArgument(e.target)),r.length>0&&(r=r.map(e=>w.escapeArgument(e)),t.push(`-ArgumentList`,r.join(`,`))),e.target=w.encodeCommand(t.join(` `)),e.wait||(s.stdio=`ignore`)}else{if(n)i=n;else{let e=!G||G===`/`,t=!1;try{await c.access(K,l.X_OK),t=!0}catch{}i=o.versions.electron??(q===`android`||e||!t)?`xdg-open`:K}r.length>0&&a.push(...r),e.wait||(s.stdio=`ignore`,s.detached=!0)}q===`darwin`&&r.length>0&&a.push(`--args`,...r),e.target&&a.push(e.target);let d=f.spawn(i,a,s);return e.wait?new Promise((t,n)=>{d.once(`error`,n),d.once(`close`,r=>{!e.allowNonzeroExitCode&&r!==0?n(/* @__PURE__ */ Error(`Exited with code ${r}`)):t(d)})}):t?new Promise((e,t)=>{d.once(`error`,t),d.once(`spawn`,()=>{d.once(`close`,n=>{d.off(`error`,t),n===0?(d.unref(),e(d)):t(/* @__PURE__ */ Error(`Exited with code ${n}`))})})}):(d.unref(),new Promise((e,t)=>{d.once(`error`,t),d.once(`spawn`,()=>{d.off(`error`,t),e(d)})}))},`baseOpen`),ae=/* @__PURE__ */ t((e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return X({...t,target:e})},`open`);function Z(e){if(typeof e==`string`||Array.isArray(e))return e;let{[J]:t}=e;if(!t)throw Error(`${J} is not supported`);return t}e(Z,`detectArchBinary`),t(Z,`detectArchBinary`);function Q({[q]:e},{wsl:t}={}){if(t&&S)return Z(t);if(!e)throw Error(`${q} is not supported`);return Z(e)}e(Q,`detectPlatformBinary`),t(Q,`detectPlatformBinary`);var $={browser:`browser`,browserPrivate:`browserPrivate`};j($,`chrome`,()=>Q({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`,`chromium-browser`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),j($,`brave`,()=>Q({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),j($,`firefox`,()=>Q({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),j($,`edge`,()=>Q({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),j($,`safari`,()=>Q({darwin:`Safari`}));var oe=ae;export{oe as default};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{r as e}from"./chunk-U6NEESU5-DqqRCaWH.mjs";import{createRequire as t}from"node:module";import n from"node:fs";import r from"node:path";import{fileURLToPath as i}from"node:url";import a from"node:process";import o from"node:os";import s,{constants as c}from"node:fs/promises";import{promisify as l}from"node:util";import{Buffer as u}from"node:buffer";import d,{execFile as f}from"node:child_process";t(import.meta.url||(typeof __filename==`string`?__filename:`/`));var p;function m(){try{return n.statSync(`/.dockerenv`),!0}catch{return!1}}e(m,`hasDockerEnv`);function h(){try{return n.readFileSync(`/proc/self/cgroup`,`utf8`).includes(`docker`)}catch{return!1}}e(h,`hasDockerCGroup`);function g(){return p===void 0&&(p=m()||h()),p}e(g,`isDocker`);var _,ee=/* @__PURE__ */ e(()=>{try{return n.statSync(`/run/.containerenv`),!0}catch{return!1}},`hasContainerEnv`);function v(){return _===void 0&&(_=ee()||g()),_}e(v,`isInsideContainer`);var y=/* @__PURE__ */ e(()=>{if(a.platform!==`linux`)return!1;if(o.release().toLowerCase().includes(`microsoft`))return!v();try{return n.readFileSync(`/proc/version`,`utf8`).toLowerCase().includes(`microsoft`)?!v():!1}catch{return!1}},`isWsl`),b=a.env.__IS_WSL_TEST__?y:y(),x=l(d.execFile),S=/* @__PURE__ */ e(()=>`${a.env.SYSTEMROOT||a.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,`powerShellPath`),C=/* @__PURE__ */ e(async(e,t={})=>{let{powerShellPath:n,...r}=t,i=C.encodeCommand(e);return x(n??S(),[...C.argumentsPrefix,i],{encoding:`utf8`,...r})},`executePowerShell`);C.argumentsPrefix=[`-NoProfile`,`-NonInteractive`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`],C.encodeCommand=e=>u.from(e,`utf16le`).toString(`base64`),C.escapeArgument=e=>`'${String(e).replaceAll(`'`,`''`)}'`;function w(e){for(let t of e.split(`
|
|
3
|
-
`)){if(/^\s*#/.test(t))continue;let e=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(e)return e.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,``)}}e(w,`parseMountPointFromConfig`);var te=l(d.execFile),ne=/* @__PURE__ */ (()=>{let e=`/mnt/`,t;return async function(){if(t)return t;let n=`/etc/wsl.conf`,r=!1;try{await s.access(n,c.F_OK),r=!0}catch{}if(!r)return e;let i=w(await s.readFile(n,{encoding:`utf8`}));return i===void 0?e:(t=i,t=t.endsWith(`/`)?t:`${t}/`,t)}})(),T=b?/* @__PURE__ */ e(async()=>`${await ne()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,`powerShellPathFromWsl`):S,E,D=/* @__PURE__ */ e(async()=>(E??=(async()=>{try{let e=await T();return await s.access(e,c.X_OK),!0}catch{return!1}})(),E),`canAccessPowerShell`),O=/* @__PURE__ */ e(async()=>{let e=await T(),{stdout:t}=await C(String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{powerShellPath:e});return t.trim()},`wslDefaultBrowser`),k=/* @__PURE__ */ e(async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await te(`wslpath`,[`-aw`,e],{encoding:`utf8`});return t.trim()}catch{return e}},`convertWslPathToWindows`);function A(t,n,r){let i=/* @__PURE__ */ e(e=>Object.defineProperty(t,n,{value:e,enumerable:!0,writable:!0}),`define`);return Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){let e=r();return i(e),e},set(e){i(e)}}),t}e(A,`defineLazyProperty`);var j=l(f);async function M(){if(a.platform!==`darwin`)throw Error(`macOS only`);let{stdout:e}=await j(`defaults`,[`read`,`com.apple.LaunchServices/com.apple.launchservices.secure`,`LSHandlers`]),t=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??`com.apple.Safari`;return t===`com.apple.safari`?`com.apple.Safari`:t}e(M,`defaultBrowserId`);var N=l(f);async function P(e,{humanReadableOutput:t=!0,signal:n}={}){if(a.platform!==`darwin`)throw Error(`macOS only`);let r=t?[]:[`-ss`],i={};n&&(i.signal=n);let{stdout:o}=await N(`osascript`,[`-e`,e,r],i);return o.trim()}e(P,`runAppleScript`);async function F(e){return P(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
4
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}e(F,`bundleName`);var I=l(f),L={MSEdgeHTM:{name:`Edge`,id:`com.microsoft.edge`},MSEdgeBHTML:{name:`Edge Beta`,id:`com.microsoft.edge.beta`},MSEdgeDHTML:{name:`Edge Dev`,id:`com.microsoft.edge.dev`},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:`Edge`,id:`com.microsoft.edge.old`},ChromeHTML:{name:`Chrome`,id:`com.google.chrome`},ChromeBHTML:{name:`Chrome Beta`,id:`com.google.chrome.beta`},ChromeDHTML:{name:`Chrome Dev`,id:`com.google.chrome.dev`},ChromiumHTM:{name:`Chromium`,id:`org.chromium.Chromium`},BraveHTML:{name:`Brave`,id:`com.brave.Browser`},BraveBHTML:{name:`Brave Beta`,id:`com.brave.Browser.beta`},BraveDHTML:{name:`Brave Dev`,id:`com.brave.Browser.dev`},BraveSSHTM:{name:`Brave Nightly`,id:`com.brave.Browser.nightly`},FirefoxURL:{name:`Firefox`,id:`org.mozilla.firefox`},OperaStable:{name:`Opera`,id:`com.operasoftware.Opera`},VivaldiHTM:{name:`Vivaldi`,id:`com.vivaldi.Vivaldi`},"IE.HTTP":{name:`Internet Explorer`,id:`com.microsoft.ie`}},R=new Map(Object.entries(L)),z=class extends Error{static{e(this,`UnknownBrowserError`)}};async function B(e=I){let{stdout:t}=await e(`reg`,[`QUERY`,` HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice`,`/v`,`ProgId`]),n=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!n)throw new z(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:r}=n.groups,i=L[r];if(!i)throw new z(`Unknown browser ID: ${r}`);return i}e(B,`defaultBrowser`);var V=l(f),H=/* @__PURE__ */ e(e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase()),`titleize`);async function U(){if(a.platform===`darwin`){let e=await M();return{name:await F(e),id:e}}if(a.platform===`linux`){let{stdout:e}=await V(`xdg-mime`,[`query`,`default`,`x-scheme-handler/http`]),t=e.trim();return{name:H(t.replace(/.desktop$/,``).replace(`-`,` `)),id:t}}if(a.platform===`win32`)return B();throw Error(`Only macOS, Linux, and Windows are supported`)}e(U,`defaultBrowser`);var re=!!(a.env.SSH_CONNECTION||a.env.SSH_CLIENT||a.env.SSH_TTY),W=Symbol(`fallbackAttempt`),G=import.meta.url?r.dirname(i(import.meta.url)):``,K=r.join(G,`xdg-open`),{platform:q,arch:J}=a,Y=/* @__PURE__ */ e(async(e,t)=>{if(e.length===0)return;let n=[];for(let r of e)try{return await t(r)}catch(e){n.push(e)}throw AggregateError(n,`Failed to open in all supported apps`)},`tryEachApp`),X=/* @__PURE__ */ e(async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[W]===!0;if(delete e[W],Array.isArray(e.app))return Y(e.app,t=>X({...e,app:t,[W]:!0}));let{name:n,arguments:r=[]}=e.app??{};if(r=[...r],Array.isArray(n))return Y(n,t=>X({...e,app:{name:t,arguments:r},[W]:!0}));if(n===`browser`||n===`browserPrivate`){let t={"com.google.chrome":`chrome`,"google-chrome.desktop":`chrome`,"com.brave.browser":`brave`,"org.mozilla.firefox":`firefox`,"firefox.desktop":`firefox`,"com.microsoft.msedge":`edge`,"com.microsoft.edge":`edge`,"com.microsoft.edgemac":`edge`,"microsoft-edge.desktop":`edge`,"com.apple.safari":`safari`},i={chrome:`--incognito`,brave:`--incognito`,firefox:`--private-window`,edge:`--inPrivate`},a;if(b){let e=await O();a=R.get(e)??{}}else a=await U();if(a.id in t){let o=t[a.id.toLowerCase()];if(n===`browserPrivate`){if(o===`safari`)throw Error(`Safari doesn't support opening in private mode via command line`);r.push(i[o])}return X({...e,app:{name:$[o],arguments:r}})}throw Error(`${a.name} is not supported as a default browser`)}let i,o=[],l={},u=!1;if(b&&!v()&&!re&&!n&&(u=await D()),q===`darwin`)i=`open`,e.wait&&o.push(`--wait-apps`),e.background&&o.push(`--background`),e.newInstance&&o.push(`--new`),n&&o.push(`-a`,n);else if(q===`win32`||u){i=await T(),o.push(...C.argumentsPrefix),b||(l.windowsVerbatimArguments=!0),b&&e.target&&(e.target=await k(e.target));let t=[`$ProgressPreference = 'SilentlyContinue';`,`Start`];e.wait&&t.push(`-Wait`),n?(t.push(C.escapeArgument(n)),e.target&&r.push(e.target)):e.target&&t.push(C.escapeArgument(e.target)),r.length>0&&(r=r.map(e=>C.escapeArgument(e)),t.push(`-ArgumentList`,r.join(`,`))),e.target=C.encodeCommand(t.join(` `)),e.wait||(l.stdio=`ignore`)}else{if(n)i=n;else{let e=!G||G===`/`,t=!1;try{await s.access(K,c.X_OK),t=!0}catch{}i=a.versions.electron??(q===`android`||e||!t)?`xdg-open`:K}r.length>0&&o.push(...r),e.wait||(l.stdio=`ignore`,l.detached=!0)}q===`darwin`&&r.length>0&&o.push(`--args`,...r),e.target&&o.push(e.target);let f=d.spawn(i,o,l);return e.wait?new Promise((t,n)=>{f.once(`error`,n),f.once(`close`,r=>{!e.allowNonzeroExitCode&&r!==0?n(/* @__PURE__ */ Error(`Exited with code ${r}`)):t(f)})}):t?new Promise((e,t)=>{f.once(`error`,t),f.once(`spawn`,()=>{f.once(`close`,n=>{f.off(`error`,t),n===0?(f.unref(),e(f)):t(/* @__PURE__ */ Error(`Exited with code ${n}`))})})}):(f.unref(),new Promise((e,t)=>{f.once(`error`,t),f.once(`spawn`,()=>{f.off(`error`,t),e(f)})}))},`baseOpen`),ie=/* @__PURE__ */ e((e,t)=>{if(typeof e!=`string`)throw TypeError("Expected a `target`");return X({...t,target:e})},`open`);function Z(e){if(typeof e==`string`||Array.isArray(e))return e;let{[J]:t}=e;if(!t)throw Error(`${J} is not supported`);return t}e(Z,`detectArchBinary`);function Q({[q]:e},{wsl:t}={}){if(t&&b)return Z(t);if(!e)throw Error(`${q} is not supported`);return Z(e)}e(Q,`detectPlatformBinary`);var $={browser:`browser`,browserPrivate:`browserPrivate`};A($,`chrome`,()=>Q({darwin:`google chrome`,win32:`chrome`,linux:[`google-chrome`,`google-chrome-stable`,`chromium`,`chromium-browser`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`,x64:[`/mnt/c/Program Files/Google/Chrome/Application/chrome.exe`,`/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe`]}})),A($,`brave`,()=>Q({darwin:`brave browser`,win32:`brave`,linux:[`brave-browser`,`brave`]},{wsl:{ia32:`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`,x64:[`/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe`,`/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe`]}})),A($,`firefox`,()=>Q({darwin:`firefox`,win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:`firefox`},{wsl:`/mnt/c/Program Files/Mozilla Firefox/firefox.exe`})),A($,`edge`,()=>Q({darwin:`microsoft edge`,win32:`msedge`,linux:[`microsoft-edge`,`microsoft-edge-dev`]},{wsl:`/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe`})),A($,`safari`,()=>Q({darwin:`Safari`}));var ae=ie;export{ae as default};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./api-5qkbb5HW.mjs";import{t as e}from"./path-DRw6Y-nd.mjs";import{i as t,n}from"./auth-C2vTENwf.mjs";import{t as r}from"./dry-run-B4_5Qb0J.mjs";import{a as i,i as a,t as o}from"./context-ChcbaAGw.mjs";import{t as s}from"./local-CLMvfqkt.mjs";import{t as c}from"./output-DcDP8hsi.mjs";import{t as l}from"./progress-LGZ6-91a.mjs";import{t as u}from"./run-CWmtD2lJ.mjs";import"./telemetry-CvCFWLQU.mjs";import{o as d,r as f,t as p}from"./body-parser-HN91kAf0.mjs";import{n as m,t as h}from"./input-validation-D7z60HJH.mjs";import{a as g,i as _,n as v}from"./prompt-BSLPgIUg.mjs";var y={method:`GET`,path:t=>e`/accounts/${t.account_id}/pay-per-use/enabled-domains`,query:[`cursor`,`per_page`],errors:{400:`BadRequestError`,401:`UnauthorizedError`,403:`ForbiddenError`,500:`InternalServerError`}};function b(e){return e.usage(`$0 pay-per-use enabled-domains list
|
|
3
|
-
|
|
4
|
-
Returns publisher domains associated with the requesting Pay Per Use operator through an accepted price agreement. License expiration is the earlier non-null boundary from the price agreement and publisher zone lifecycles. A future expiration remains active and is exposed to the operator. After expiration, the license remains listed as expired for one calendar month before it is omitted; an active agreement for the same domain takes precedence. The requesting account must be an active Pay Per Use operator.`).option(`cursor`,{type:`string`,description:`Opaque, account-bound cursor returned by the previous page. Cursors expire after one hour; restart pagination without a cursor after receiving a 400 response for an expired cursor.`}).option(`per-page`,{type:`number`,description:`Maximum number of domains to return`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const x={command:`list`,describe:`List enabled Pay Per Use domains`,builder:b,handler:async e=>u({command:`pay-per-use enabled-domains list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={cursor:e.cursor,per_page:e[`per-page`]};if(e.dryRun){let e=await i();r({command:`cf pay-per-use enabled-domains list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/pay-per-use/enabled-domains`,pathParams:{},query:t,bodyKind:`none`});return}let a=await n(e),u=e.local?s:await o();e.accountId=u;let d=await l(`Loading`,async()=>a.send(y,{account_id:u,...t}));c(d,{successLabel:`Loaded`})})},ee={command:`enabled-domains`,describe:`Operations for enabled-domains`,builder:e=>e.command(x).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var te={method:`GET`,path:t=>e`/accounts/${t.account_id}/pay-per-use/operator/configuration`,errors:{403:`ForbiddenError`,404:`NotFoundError`}};function ne(e){return e.usage(`$0 pay-per-use operator get-configuration
|
|
5
|
-
|
|
6
|
-
Gets the pay-per-use operator configuration for an account, including its read-only non-billable classification timestamp.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const S={command:`get-configuration`,describe:`Get pay-per-use operator configuration`,builder:ne,handler:async e=>u({command:`pay-per-use operator get-configuration`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){let e=await i();r({command:`cf pay-per-use operator get-configuration`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/pay-per-use/operator/configuration`,pathParams:{},bodyKind:`none`});return}let t=await n(e),a=e.local?s:await o();e.accountId=a;let u=await l(`Loading`,async()=>t.send(te,{account_id:a}));c(u,{successLabel:`Loaded`})})};var C={method:`PUT`,path:t=>e`/accounts/${t.account_id}/pay-per-use/operator/configuration`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,409:`ConflictError`}};function w(e){return e.usage(`$0 pay-per-use operator set-configuration
|
|
7
|
-
|
|
8
|
-
Creates or updates the pay-per-use operator configuration for an account. Creating an enabled configuration or re-enabling a disabled billable operator requires completed Stripe onboarding, while non-billable operators do not; an already-enabled operator is not affected by later Stripe status changes. A Cloudflare-verified operator's name and default price cannot be changed.`).option(`default-price-usd-microcents`,{type:`number`,description:`Default price in microcents. 1 USD = 100,000,000 microcents. Must be a multiple of 100,000 ($0.001) between $0.001 and $9,999.999.`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Pay-per-use operator configuration`})}const T={command:`set-configuration`,describe:`Set pay-per-use operator configuration`,builder:w,handler:async e=>u({command:`pay-per-use operator set-configuration`,classification:{safeFlags:[`enabled`,`dry-run`]}},e,async()=>{let t=async()=>{if(e[`default-price-usd-microcents`]===void 0)throw Error(`--default-price-usd-microcents is required (or pass --body with this field set).`);if(e.enabled===void 0)throw Error(`--enabled is required (or pass --body with this field set).`);e.name===void 0&&(e.name=await g(`name`,`The name field`))};if(e.dryRun){e.body===void 0&&await t();let n=await i();r({command:`cf pay-per-use operator set-configuration`,method:`PUT`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pay-per-use/operator/configuration`,pathParams:{},bodyKind:`json`,body:e.body===void 0?p({default_price_usd_microcents:e[`default-price-usd-microcents`],enabled:e.enabled,name:m(e.name,`name`,`text`)}):f(e.body)});return}let a=e.body===void 0?void 0:f(e.body),u=await n(e),d=e.local?s:await o();if(e.accountId=d,e.body!==void 0){let e=a,t=await l(`Updating`,async()=>u.send(C,{body:e,account_id:d}));c(t,{successLabel:`Updated`});return}await t();let h=p({default_price_usd_microcents:e[`default-price-usd-microcents`],enabled:e.enabled,name:m(e.name,`name`,`text`)}),_=await l(`Updating`,async()=>u.send(C,{body:h,account_id:d}));c(_,{successLabel:`Updated`})})};var E={method:`PATCH`,path:t=>e`/accounts/${t.account_id}/pay-per-use/operator/configuration`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`,409:`ConflictError`}};function D(e){return e.usage(`$0 pay-per-use operator update-configuration
|
|
9
|
-
|
|
10
|
-
Updates one or more fields of an existing pay-per-use operator configuration. Re-enabling a disabled billable operator requires completed Stripe onboarding, while non-billable operators do not; an already-enabled operator is not affected by later Stripe status changes. A Cloudflare-verified operator's name and default price cannot be changed.`).option(`default-price-usd-microcents`,{type:`number`,description:`Default price in microcents. 1 USD = 100,000,000 microcents. Must be a multiple of 100,000 ($0.001) between $0.001 and $9,999.999.`}).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`name`,{type:`string`,description:`The name field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Pay-per-use operator configuration update`})}const O={command:`update-configuration`,describe:`Update pay-per-use operator configuration`,builder:D,handler:async e=>u({command:`pay-per-use operator update-configuration`,classification:{safeFlags:[`enabled`,`dry-run`]}},e,async()=>{if(e.dryRun){let t=await i();r({command:`cf pay-per-use operator update-configuration`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pay-per-use/operator/configuration`,pathParams:{},bodyKind:`json`,body:e.body===void 0?p({default_price_usd_microcents:e[`default-price-usd-microcents`],enabled:e.enabled,name:m(e.name,`name`,`text`)}):f(e.body)});return}let t=e.body===void 0?void 0:f(e.body),a=await n(e),u=e.local?s:await o();if(e.accountId=u,e.body!==void 0){let e=t,n=await l(`Updating`,async()=>a.send(E,{body:e,account_id:u}));c(n,{successLabel:`Updated`});return}let d=p({default_price_usd_microcents:e[`default-price-usd-microcents`],enabled:e.enabled,name:m(e.name,`name`,`text`)}),h=await l(`Updating`,async()=>a.send(E,{body:d,account_id:u}));c(h,{successLabel:`Updated`})})},k={command:`operator`,describe:`Operations for operator`,builder:e=>e.command(S).command(T).command(O).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var A={method:`GET`,path:t=>e`/zones/${t.zone_id}/pay-per-use/operators`,query:[`page`,`per_page`],errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`}};function j(e){return e.usage(`$0 pay-per-use pricing list-operators
|
|
11
|
-
|
|
12
|
-
Lists a paginated set of enabled pay-per-use operators with verified names, matching billing classification, and their prices for a zone.`).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const M={command:`list-operators`,describe:`List pay-per-use operators`,builder:j,handler:async e=>u({command:`pay-per-use pricing list-operators`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){r({command:`cf pay-per-use pricing list-operators`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-use/operators`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},query:t,bodyKind:`none`});return}let i=await n(e),o=await a({zone:e.zone},i,{quiet:e.quiet});e.zoneId=o;let s=await l(`Loading`,async()=>i.send(A,{zone_id:o,...t}));c(s,{successLabel:`Loaded`})})};var N={method:`DELETE`,path:t=>e`/zones/${t.zone_id}/pay-per-use/operators/${t.operator_id}/price`,errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`}};function P(e){return e.usage(`$0 pay-per-use pricing opt-out-operator-price <operator-id>
|
|
13
|
-
|
|
14
|
-
Opts a zone out by scheduling the current accepted pay-per-use operator price to expire at the start of the next UTC month. Use the withdraw action for a pending proposal.`).positional(`operator-id`,{type:`string`,description:`Stable pay-per-use operator identifier.`,demandOption:!0}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`force`,{type:`boolean`,alias:`f`,description:`Skip confirmation (useful in scripts and CI)`,default:!1})}const F={command:`opt-out-operator-price <operator-id>`,describe:`Opt out of a pay-per-use operator price`,builder:P,handler:async e=>u({command:`pay-per-use pricing opt-out-operator-price`,classification:{safeFlags:[`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},e,async()=>{if(e.dryRun){r({command:`cf pay-per-use pricing opt-out-operator-price`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-use/operators/${e[`operator-id`]==null?`<operator-id>`:encodeURIComponent(String(e[`operator-id`]))}/price`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operator-id":String(e[`operator-id`]??``)},bodyKind:`none`});return}let t=await n(e),i=await a({zone:e.zone},t,{quiet:e.quiet});if(e.zoneId=i,!await v({force:!!e.force}))return;let o=await l(`Deleting`,async()=>t.send(N,{zone_id:i,operator_id:e[`operator-id`]}));c(o,{successLabel:`Deleted`})})};var I={method:`POST`,path:t=>e`/zones/${t.zone_id}/pay-per-use/operators/${t.operator_id}/price`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`,409:`ConflictError`}};function L(e){return e.usage(`$0 pay-per-use pricing set-operator-price <operator-id>
|
|
15
|
-
|
|
16
|
-
Proposes a required price, withdraws a pending proposal, accepts an operator's default pay-per-use price, or resumes an accepted price before its scheduled expiry. Propose, accept_default, and resume require an enabled operator with a verified name, an enabled publisher zone, and matching billing classifications.`).positional(`operator-id`,{type:`string`,description:`Stable pay-per-use operator identifier.`,demandOption:!0}).option(`action`,{type:`string`,description:`The action field`,choices:[`propose`,`withdraw`,`accept_default`,`resume`]}).coerce(`action`,e=>m(e,`action`,`text`)).option(`price-usd-microcents`,{type:`number`,description:`Price in microcents. Must be a multiple of 100,000 ($0.001) between $0.001 and $9,999.999.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Pay-per-use publisher price action`})}const R={command:`set-operator-price <operator-id>`,describe:`Set a pay-per-use operator price`,builder:L,handler:async e=>u({command:`pay-per-use pricing set-operator-price`,classification:{safeFlags:[`action`,`dry-run`]}},e,async()=>{let t=async()=>{if(e.action===void 0&&(e.action=await _(`action`,`The action field`,[`propose`,`withdraw`,`accept_default`,`resume`])),e.action===`propose`&&e[`price-usd-microcents`]===void 0)throw Error(`--price-usd-microcents is required (or pass --body with this field set).`)};if(e.dryRun){e.body===void 0&&await t(),r({command:`cf pay-per-use pricing set-operator-price`,method:`POST`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-use/operators/${e[`operator-id`]==null?`<operator-id>`:encodeURIComponent(String(e[`operator-id`]))}/price`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``),"operator-id":String(e[`operator-id`]??``)},bodyKind:`json`,body:e.body===void 0?p({action:e.action,price_usd_microcents:e[`price-usd-microcents`]}):f(e.body)});return}let i=e.body===void 0?void 0:f(e.body),o=await n(e),s=await a({zone:e.zone},o,{quiet:e.quiet});if(e.zoneId=s,e.body!==void 0){let t=i,n=await l(`Creating`,async()=>o.send(I,{body:t,zone_id:s,operator_id:e[`operator-id`]}));c(n,{successLabel:`Created`});return}await t();let u=p({action:e.action,price_usd_microcents:e[`price-usd-microcents`]}),d=await l(`Creating`,async()=>o.send(I,{body:u,zone_id:s,operator_id:e[`operator-id`]}));c(d,{successLabel:`Created`})})},z={command:`pricing`,describe:`Operations for pricing`,builder:e=>e.command(M).command(F).command(R).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var B={method:`POST`,path:t=>e`/accounts/${t.account_id}/pay-per-use/proposals`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`,409:`ConflictError`}};function V(e){return e.usage(`$0 pay-per-use proposals decide
|
|
17
|
-
|
|
18
|
-
Accepts or rejects the pending pay-per-use price proposal identified by price_id in the request body. Acceptance requires an enabled operator with a verified name, an enabled publisher zone, and matching billing classifications; rejection remains available for cleanup.`).option(`action`,{type:`string`,description:`The action field`,choices:[`accept`,`reject`]}).coerce(`action`,e=>m(e,`action`,`text`)).option(`price-id`,{type:`number`,description:`Pending pay-per-use price id returned in the operator proposal queue.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Pay-per-use operator proposal decision`})}const re={command:`decide`,describe:`Decide a pay-per-use price proposal`,builder:V,handler:async e=>u({command:`pay-per-use proposals decide`,classification:{safeFlags:[`action`,`dry-run`]}},e,async()=>{let t=async()=>{if(e.action===void 0&&(e.action=await _(`action`,`The action field`,[`accept`,`reject`])),e[`price-id`]===void 0)throw Error(`--price-id is required (or pass --body with this field set).`)};if(e.dryRun){e.body===void 0&&await t();let n=await i();r({command:`cf pay-per-use proposals decide`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pay-per-use/proposals`,pathParams:{},bodyKind:`json`,body:e.body===void 0?p({action:e.action,price_id:e[`price-id`]}):f(e.body)});return}let a=e.body===void 0?void 0:f(e.body),u=await n(e),d=e.local?s:await o();if(e.accountId=d,e.body!==void 0){let e=a,t=await l(`Creating`,async()=>u.send(B,{body:e,account_id:d}));c(t,{successLabel:`Created`});return}await t();let m=p({action:e.action,price_id:e[`price-id`]}),h=await l(`Creating`,async()=>u.send(B,{body:m,account_id:d}));c(h,{successLabel:`Created`})})};var H={method:`GET`,path:t=>e`/accounts/${t.account_id}/pay-per-use/proposals`,query:[`page`,`per_page`],errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`}};function U(e){return e.usage(`$0 pay-per-use proposals list
|
|
19
|
-
|
|
20
|
-
Lists a paginated set of outstanding pay-per-use publisher price proposals for an operator. Listing remains available while the operator is disabled or its name is unverified so proposals can be rejected.`).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const W={command:`list`,describe:`List pay-per-use price proposals`,builder:U,handler:async e=>u({command:`pay-per-use proposals list`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={page:e.page,per_page:e[`per-page`]};if(e.dryRun){let e=await i();r({command:`cf pay-per-use proposals list`,method:`GET`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/pay-per-use/proposals`,pathParams:{},query:t,bodyKind:`none`});return}let a=await n(e),u=e.local?s:await o();e.accountId=u;let d=await l(`Loading`,async()=>a.send(H,{account_id:u,...t}));c(d,{successLabel:`Loaded`})})},G={command:`proposals`,describe:`Operations for proposals`,builder:e=>e.command(re).command(W).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};function K(e){return e.usage(`$0 pay-per-use usage-reports submit
|
|
21
|
-
|
|
22
|
-
Validates and submits a usage report for an active Pay Per Use participant. The complete report is rejected if any item is invalid.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Raw JSON request body (bypasses individual flags)`}).option(`file`,{type:`string`,description:`Path to a file to upload as the request body`})}const q={command:`submit`,describe:`Submit a participant usage report`,builder:K,handler:async e=>u({command:`pay-per-use usage-reports submit`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.body===void 0&&e.file===void 0)throw Error(`--body or --file is required for this command. Pass --body '<value>' or --file path/to/file.`);if(e.dryRun){let t=await i();r({command:`cf pay-per-use usage-reports submit`,method:`POST`,url:`https://api.cloudflare.com/client/v4/accounts/${t??`<account-id>`}/pay-per-use/usage-reports`,pathParams:{},bodyKind:`octet-stream`,body:e.file===void 0?e.body:{file:e.file}});return}let a=e.file===void 0?m(e.body,`body`,`binary`):void 0,u=await n(e),d=e.local?s:await o();if(e.accountId=d,e.file!==void 0){let n=h(e.file),r=await l(`Creating`,async()=>t(u,`POST`,`/accounts/${d}/pay-per-use/usage-reports`,{body:n,headers:{"Content-Type":`application/jsonl`}}));c(r,{successLabel:`Created`})}else if(e.body!==void 0){let e=a,n=await l(`Creating`,async()=>t(u,`POST`,`/accounts/${d}/pay-per-use/usage-reports`,{body:e,headers:{"Content-Type":`application/jsonl`}}));c(n,{successLabel:`Created`})}})},J={command:`usage-reports`,describe:`Operations for usage-reports`,builder:e=>e.command(q).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var Y={method:`GET`,path:t=>e`/${t.account_or_zone}/${t.account_or_zone_id}/pay-per-use/usage-stats`,query:[`since`,`until`,`page`,`per_page`],errors:{400:`BadRequestError`,403:`ForbiddenError`,500:`InternalServerError`}};function X(e){return e.usage(`$0 pay-per-use usage-stats get-account
|
|
23
|
-
|
|
24
|
-
Returns reported usage and the full gross value across all Pay Per Use zones in a publisher account or zone over an explicit UTC range of at most 31 days. Usage from every domain and snapshotted price is summed by buyer. Ranges up to and including 7 days use hourly data points; longer ranges use daily data points. Because source data is aggregated hourly, both requested bounds are rounded down to the selected UTC interval and the resolved bounds are returned in the response. The resolved range must contain at least one complete interval. Empty periods are omitted. Buyers and their data points are paginated, while totals cover every buyer in the range. Values are raw usage counts and USD microcents; total_price_usd_microcents is the full value before the publisher revenue share.
|
|
25
|
-
|
|
26
|
-
Runs against your account. Pass --zone to run against a zone instead. CLOUDFLARE_ZONE_ID is ignored.`).option(`since`,{type:`string`,description:`Requested inclusive beginning of the statistics range as an RFC3339 timestamp. Rounded down to the selected UTC interval.`,demandOption:!0}).option(`until`,{type:`string`,description:`Requested exclusive end of the statistics range as an RFC3339 timestamp. Rounded down to the selected UTC interval. The requested duration from since cannot exceed 31 days.`,demandOption:!0}).option(`page`,{type:`number`,description:`Page number.`}).option(`per-page`,{type:`number`,description:`Results per page.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ie={command:`get-account`,describe:`Get pay-per-use usage statistics`,builder:X,handler:async e=>u({command:`pay-per-use usage-stats get-account`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t={since:e.since,until:e.until,page:e.page,per_page:e[`per-page`]};if(e.dryRun){let n=e.zone===void 0?await i():void 0,a=e.zone===void 0?`accounts`:`zones`,o=e.zone??n??`<account-id>`;r({command:`cf pay-per-use usage-stats get-account`,method:`GET`,url:`https://api.cloudflare.com/client/v4/${a}/${o}/pay-per-use/usage-stats`,pathParams:{"account-or-zone":String(a),"account-or-zone-id":String(o)},query:t,bodyKind:`none`});return}let u=await n(e),d=e.zone===void 0?`accounts`:`zones`,f=d===`zones`?await a({zone:e.zone},u,{quiet:e.quiet}):e.local?s:await o();d===`zones`?e.zoneId=f:e.accountId=f;let p=await l(`Loading`,async()=>u.send(Y,{account_or_zone:d,account_or_zone_id:f,...t}));c(p,{successLabel:`Loaded`})})},ae={command:`usage-stats`,describe:`Operations for usage-stats`,builder:e=>e.command(ie).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};var oe={method:`GET`,path:t=>e`/zones/${t.zone_id}/pay-per-use/can_be_enabled`,errors:{403:`ForbiddenError`}};function se(e){return e.usage(`$0 pay-per-use zones get-can-be-enabled
|
|
27
|
-
|
|
28
|
-
Gets whether pay-per-use can be enabled for a zone and the current zone-level grace period.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ce={command:`get-can-be-enabled`,describe:`Get pay-per-use zone eligibility`,builder:se,handler:async e=>u({command:`pay-per-use zones get-can-be-enabled`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){r({command:`cf pay-per-use zones get-can-be-enabled`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-use/can_be_enabled`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),i=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i;let o=await l(`Loading`,async()=>t.send(oe,{zone_id:i}));c(o,{successLabel:`Loaded`})})};var Z={method:`GET`,path:t=>e`/zones/${t.zone_id}/pay-per-use/configuration`,errors:{403:`ForbiddenError`}};function le(e){return e.usage(`$0 pay-per-use zones get-configuration
|
|
29
|
-
|
|
30
|
-
Gets the pay-per-use configuration, zone-level grace period, and read-only non-billable classification timestamp for a zone.`).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1})}const ue={command:`get-configuration`,describe:`Get pay-per-use zone configuration`,builder:le,handler:async e=>u({command:`pay-per-use zones get-configuration`,classification:{safeFlags:[`dry-run`]}},e,async()=>{if(e.dryRun){r({command:`cf pay-per-use zones get-configuration`,method:`GET`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-use/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`none`});return}let t=await n(e),i=await a({zone:e.zone},t,{quiet:e.quiet});e.zoneId=i;let o=await l(`Loading`,async()=>t.send(Z,{zone_id:i}));c(o,{successLabel:`Loaded`})})};var Q={method:`PATCH`,path:t=>e`/accounts/${t.account_id}/pay-per-use/zones_can_be_enabled`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`}};function de(e){return e.usage(`$0 pay-per-use zones set-can-be-enabled
|
|
31
|
-
|
|
32
|
-
Sets pay-per-use eligibility for a list of account zones. An omitted can_be_enabled value leaves that zone unchanged. Revoking eligibility disables the zone immediately while existing accepted licenses remain active until the start of the next UTC month.`).option(`zones`,{type:`string`,description:`The zones field. Provide as a JSON array of objects or @path/to/file.json. Shape: [{"id": string, "can_be_enabled"?: boolean}]. ? marks optional keys.`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Pay-per-use zone eligibility updates`})}const fe={command:`set-can-be-enabled`,describe:`Set pay-per-use zone eligibility`,builder:de,handler:async e=>u({command:`pay-per-use zones set-can-be-enabled`,classification:{safeFlags:[`dry-run`]}},e,async()=>{let t=async()=>{if(e.zones===void 0)throw Error(`--zones is required (or pass --body with this field set).`)};if(e.dryRun){e.body===void 0&&await t();let n=await i();r({command:`cf pay-per-use zones set-can-be-enabled`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/accounts/${n??`<account-id>`}/pay-per-use/zones_can_be_enabled`,pathParams:{},bodyKind:`json`,body:e.body===void 0?p({zones:d(e.zones,`zones`)}):f(e.body)});return}let a=e.body===void 0?void 0:f(e.body),u=await n(e),m=e.local?s:await o();if(e.accountId=m,e.body!==void 0){let e=a,t=await l(`Updating`,async()=>u.send(Q,{body:e,account_id:m}));c(t,{successLabel:`Updated`});return}await t();let h=p({zones:d(e.zones,`zones`)}),g=await l(`Updating`,async()=>u.send(Q,{body:h,account_id:m}));c(g,{successLabel:`Updated`})})};var $={method:`PATCH`,path:t=>e`/zones/${t.zone_id}/pay-per-use/configuration`,body:`json`,errors:{400:`BadRequestError`,403:`ForbiddenError`,404:`NotFoundError`,409:`ConflictError`}};function pe(e){return e.usage(`$0 pay-per-use zones update-configuration
|
|
33
|
-
|
|
34
|
-
Enables or disables an existing pay-per-use zone configuration. Omitting enabled leaves the zone unchanged. Enabling a disabled billable zone requires completed publisher Stripe onboarding, while non-billable zones do not; an already-enabled zone is not affected by later Stripe status changes. Disabling starts a disabled period immediately while existing accepted licenses remain active until the start of the next UTC month; re-enabling before expiry clears the schedule and restores those licenses.`).option(`enabled`,{type:`boolean`,description:`The enabled field`}).option(`dry-run`,{type:`boolean`,description:`Validate and show what would happen without executing`,default:!1}).option(`body`,{type:`string`,description:`Pay-per-use zone configuration update`})}const me={command:`update-configuration`,describe:`Update pay-per-use zone configuration`,builder:pe,handler:async e=>u({command:`pay-per-use zones update-configuration`,classification:{safeFlags:[`enabled`,`dry-run`]}},e,async()=>{if(e.dryRun){r({command:`cf pay-per-use zones update-configuration`,method:`PATCH`,url:`https://api.cloudflare.com/client/v4/zones/${e.zone??e.zoneId??`<zone>`}/pay-per-use/configuration`,pathParams:{"zone-id":String(e.zone??e[`zone-id`]??``)},bodyKind:`json`,body:e.body===void 0?p({enabled:e.enabled}):f(e.body)});return}let t=e.body===void 0?void 0:f(e.body),i=await n(e),o=await a({zone:e.zone},i,{quiet:e.quiet});if(e.zoneId=o,e.body!==void 0){let e=t,n=await l(`Updating`,async()=>i.send($,{body:e,zone_id:o}));c(n,{successLabel:`Updated`});return}let s=p({enabled:e.enabled}),u=await l(`Updating`,async()=>i.send($,{body:s,zone_id:o}));c(u,{successLabel:`Updated`})})},he={command:`zones`,describe:`Operations for zones`,builder:e=>e.command(ce).command(ue).command(fe).command(me).demandCommand(1,`Please specify a subcommand`),handler:()=>{}},ge={command:`pay-per-use`,describe:`pay-per-use`,builder:e=>e.command(ee).command(k).command(z).command(G).command(J).command(ae).command(he).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{ge as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{i as e,n as t}from"./auth-C2vTENwf.mjs";import{t as n}from"./dry-run-B4_5Qb0J.mjs";import{t as r}from"./local-CLMvfqkt.mjs";import{t as i}from"./output-DcDP8hsi.mjs";import{t as a}from"./progress-LGZ6-91a.mjs";import{n as o}from"./prompt-BSLPgIUg.mjs";import{a as s,t as c}from"./context-ChcbaAGw.mjs";import"./telemetry-CvCFWLQU.mjs";import{C as l,_ as u,d,f,l as p,r as m,t as h,x as g,y as _}from"./deploy-context-DmYBYd8Q.mjs";import{a as v,c as y,f as b,i as x,l as S,n as C,o as w,r as T,t as E}from"./static-assets-n9iBqrrt.mjs";import{V as D,Y as O,Z as k,ot as A}from"./dist-aDyCGA5i.mjs";import{a as j,c as M,i as N,l as P,n as F,o as I,s as ee,u as L}from"./build-CMyWk3oc.mjs";import{n as R,t as z}from"./run-CWmtD2lJ.mjs";import{t as B}from"./deploy-input-pcciD1Bc.mjs";import{r as V}from"./dotenv-DKRemNCH.mjs";import{d as H,s as U}from"./interactive-FI8YIUbv.mjs";import{t as W}from"./hand-written-dry-run-B82fRl2N.mjs";import{readBuildOutput as G}from"@cloudflare/build-output-utils";function K(e){return e.usage(`$0 previews delete <name>
|
|
3
|
-
|
|
4
|
-
Delete a Preview.`).positional(`name`,{type:`string`,description:`Identifier for the Preview, which can be ID, slug, or URL-encoded name.`,demandOption:!0}).option(`worker`,{type:`string`,description:`Identifier for the Worker, which can be ID or name.`,demandOption:!0}).option(`delete-with-references`,{type:`boolean`,description:`If true, delete the Preview even when other Workers still reference it. Service bindings in those Workers may be left broken. Durable Object namespaces implemented by the deleted Preview are deleted even if other Workers reference them.`}).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 q={command:`delete <name>`,describe:`Delete Preview`,builder:K,handler:async l=>z({command:`previews delete`,classification:{safeFlags:[`delete-with-references`,`dry-run`,`force`],shortFlagAliases:{f:{canonical:`force`,type:`boolean`}}}},l,async()=>{let u={force:l[`delete-with-references`]};if(l.dryRun){let e=await s();n({command:`cf previews delete`,method:`DELETE`,url:`https://api.cloudflare.com/client/v4/accounts/${e??`<account-id>`}/workers/workers/${l.worker==null?`<worker>`:encodeURIComponent(String(l.worker))}/previews/${l.name==null?`<name>`:encodeURIComponent(String(l.name))}`,pathParams:{worker:String(l.worker??``),name:String(l.name??``)},query:u,bodyKind:`none`});return}let d=await t(l),f=l.local?r:await c();if(l.accountId=f,!await o({force:!!l.force,message:`This operation permanently deletes the Preview.`}))return;let p=await a(`Deleting`,async()=>e(d,`DELETE`,`/accounts/${f}/workers/workers/${encodeURIComponent(String(l.worker))}/previews/${encodeURIComponent(String(l.name))}`,{query:u}));i(p,{successLabel:`Deleted`})})};function J(e){return{getNormalizedContainerOptions:async t=>e.standard.normalized.map(e=>({...e,name:t.containers?.find(({class_name:t})=>t===e.class_name)?.name??e.name})),deployPreviewContainers:async(t,n,r,i,a)=>Y(a.quiet,async()=>{let o=/* @__PURE__ */ new Map;for(let e of Object.values(r.env??{}))e.type===`durable_object_namespace`&&e.class_name&&e.namespace_id&&e.script_name===void 0&&o.set(e.class_name,e.namespace_id);let s;for(let c of n){let n=o.get(c.class_name);if(n||=(s??=await _(t,i),s.find(e=>e.class===c.class_name&&e.preview?.id===r.preview_id)?.id),!n)throw Error(`Could not find a Preview Durable Object namespace for Container class "${c.class_name}".`);let l=await X(c,e,r.id,i,t,a.localImageReferences?.get(c.class_name));await p({imageRef:l,durable_object_namespace_id:n,configFileName:`cloudflare.config.ts`,observabilityTargetPercentageField:`targetInstancePercentage`,observabilityTargetCountField:`targetInstanceCount`},c,t,i)}await d(e.standard.builtImages.filter(({container:e})=>!a.localImageReferences?.has(e.class_name)),A())})}}async function Y(e,t){if(!e)return t();let n=U();H(`error`);try{return await t()}finally{H(n)}}async function X(e,t,n,r,i,a){if(a!==void 0)return l({pathToDocker:A(),sourceTag:a,targetTag:a,accountId:r,complianceConfig:i,containerConfig:`dockerfile`in e?e:void 0,cleanupSourceTag:!1});let o=t.standard.builtImages.find(({container:t})=>t.class_name===e.class_name);if(o)return g(o,n,A(),r,i);if(`image_uri`in e)return{newTag:e.image_uri};throw Error(`Container "${e.name}" has no Build Output image to deploy.`)}function Z(e){return e.positional(`directory`,C).option(`preview-name`,{type:`string`,description:`Preview name. Defaults to the current CI or Git branch; required if no branch is available.`}).option(`prebuilt`,{type:`boolean`,description:`Use existing Preview Build Output Specification files without building`,default:!1}).option(`worker`,j)}function Q(e){return{type:`preview`,version:1,preview_id:e.preview.id,preview_name:e.preview.name,preview_slug:e.preview.slug,preview_urls:e.preview.urls,deployment_id:e.deployment.id,deployment_urls:e.deployment.urls}}async function $(e){let t=e[`preview-name`],n=t??y();if(!n||!t&&n===`HEAD`)throw Error(`We couldn't determine a Preview name from CI or Git. The name is optional when a branch is available. Otherwise, run:
|
|
5
|
-
|
|
6
|
-
cf previews deploy --preview-name PREVIEW_NAME`);let r=await E(e,{isPreview:!0});return!e.prebuilt&&!r&&await F(e.mode,{output:e.quiet?`silent`:`stderr`,worker:e.worker},{isPreview:!0}),V(e,()=>te(e,n))}async function te(e,t){let n=await G(process.cwd());w(n.rootConfig),P(e.mode,n.rootConfig.buildContext.mode),M(n.rootConfig.settings?.accountId,e[`temporary-account`]);let{worker:r}=N(ee(n.workers,e.worker)),{wranglerConfig:i,builtConfig:a}=I(r,n.rootConfig),o=k(i),{authToken:s,accountId:c}=await v({accountId:n.rootConfig.settings?.accountId,complianceRegion:o,isPreview:!0}),l=h(s);b({...l,logger:{...l.logger,log:()=>{},info:()=>{}}}),u({logger:{...l.logger,debug:()=>{},debugWithSanitization:()=>{},log:()=>{},info:()=>{}},fetchResult:l.fetchResult,fetchPagedListResult:l.fetchPagedListResult});let d=new Set(Object.values(a.exports??{}).filter(x).map(({container:e})=>e)),p=n.containers?.filter(({config:e})=>d.has(e.name))??[],g=T(p,i,{accountId:c}),_=g.source;if(_?.some(e=>e.scheduling_policy===`durable_object`))throw new L(`Preview deployments do not support Durable Object-managed Containers (schedulingPolicy: "durable-object").`);_&&_.length>0&&f(c,s,O(i));let y=await S(c,{name:t,json:!0},{workerConfig:a,rootConfig:n.rootConfig,containers:p.filter(({config:e})=>_?.some(({name:t})=>t===e.name)).map(({config:e})=>e),buildResult:r.bundleDir?B(r,a,n.root,{includeSourceMaps:!e[`temporary-account`]}):void 0,assets:r.assetsDir?{directory:r.assetsDir}:void 0},{deployCommand:`cf deploy`,previewCommand:`cf previews deploy`,...J(g),verifyContainersScope:async()=>{await m.listApplications()}});return D({...Q(y),worker_name:a.name??null}),y}var ne=R({command:`deploy [directory]`,describe:`Deploy a Worker Preview`,builder:Z,handler:async e=>{if(e.local)throw Error(`--local is not supported by cf previews deploy.`);let t=await $(e);i(Q(t),{quiet:e.quiet})}},{command:`previews deploy`,classification:{safeFlags:[`prebuilt`]}});const re={command:`previews`,describe:`Manage Worker Previews`,builder:e=>e.command(q).command(W(ne,`preview`)).demandCommand(1,`Please specify a subcommand`),handler:()=>{}};export{re as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{Y as e}from"./dist-aDyCGA5i.mjs";import{c as t,l as n,u as r}from"./auth-C2vTENwf.mjs";import{t as i}from"./auth-token-e3ippjSj.mjs";import{n as a}from"./context-ChcbaAGw.mjs";import{r as o}from"./local-CLMvfqkt.mjs";import{n as s}from"./request-headers-Inpc06QI.mjs";import{i as c}from"./api-5qkbb5HW.mjs";async function l(l,u={}){let{method:d=`GET`,local:f=!1}=u,p=e({compliance_region:await a()}),m=`${p.replace(/\/+$/,``)}${l}`,h={...s()};u.headers&&Object.assign(h,u.headers);let g=n(globalThis.fetch);f?g=o({persistTo:u.persistTo,apiBaseUrl:p}):h.Authorization=`Bearer ${await i()}`;let _,v=u.body;v!=null&&(v instanceof FormData?_=v:Buffer.isBuffer(v)||v instanceof Uint8Array||v instanceof ArrayBuffer?(_=v,h[`Content-Type`]??=u.contentType??`application/octet-stream`):typeof v==`string`?(_=v,u.contentType&&(h[`Content-Type`]??=u.contentType)):(_=JSON.stringify(v),h[`Content-Type`]??=u.contentType??`application/json`));let y=await g(m,{method:d,headers:h,..._===void 0?{}:{body:_},...t(_)?{}:{signal:AbortSignal.timeout(r)}});if(!y.ok){let e=y.headers.get(`content-type`)??``,t;try{t=e.includes(`application/json`)?await y.json():await y.text()}catch{t=null}throw new c({statusCode:y.status,body:t,rawResponse:{status:y.status,statusText:y.statusText,url:y.url||m,headers:y.headers,redirected:y.redirected,type:y.type}})}let b=await y.arrayBuffer();return Buffer.from(b)}function u(e){process.stdout.write(e)}export{u as n,l as t};
|
package/dist/run-Bq0XGAg9.mjs
DELETED
package/dist/run-CWmtD2lJ.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{t as e}from"./cli-exit-CstFZ1eJ.mjs";import{n as t}from"./interactive-FI8YIUbv.mjs";import{n}from"./version-DNYoInKC.mjs";import{t as r}from"./agent-context-Dtyy4aKL.mjs";import{t as i}from"./interactive-CjG4IOes.mjs";import{t as a}from"./request-headers-Inpc06QI.mjs";import{nt as o}from"./dist-aDyCGA5i.mjs";import{n as s,t as c}from"./state-jXwCUs1C.mjs";import{n as l,t as u}from"./delegate-CwB0ZkLX.mjs";import{i as d,r as f}from"./lifecycle-oud60haK.mjs";import{t as p}from"./error-sanitization-CZolnIrD.mjs";import{r as m}from"./sanitization-DkVWMHkc.mjs";import h from"node:os";import{createHash as g,randomUUID as _}from"node:crypto";const v=/* @__PURE__ */ new Date(`2026-01-01T00:00:00.000Z`),y=`CF_SEND_TELEMETRY`,b=`WRANGLER_SEND_METRICS`,x=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function S(e){if(e===void 0)return;let t=e.trim().toLowerCase();if(t===`true`||t===`1`)return!0;if(t===`false`||t===`0`)return!1}function C(){let e=S(process.env[y]);if(e!==void 0)return{enabled:e,source:`env`};let t=S(process.env[b]);if(t!==void 0)return{enabled:t,source:`wrangler-env`}}function w(){return C()?.enabled}function T(){let e=c();if(typeof e.deviceId==`string`&&x.test(e.deviceId))return e.deviceId;let t=_();return s({deviceId:t}),t}function E(){return c().deviceId===void 0}function D(){if(o())return{enabled:!1,source:`do-not-track`};let e=C();if(e!==void 0)return e;let t=c().telemetry?.preference;return t?.enabled===!1?{enabled:!1,source:`config`}:t?.enabled===!0&&typeof t.date==`string`&&new Date(t.date)>=v?{enabled:!0,source:`config`}:{enabled:!0,source:`default`}}function O(e){switch(e){case`do-not-track`:return`DO_NOT_TRACK`;case`env`:return y;case`wrangler-env`:return b;default:return}}function k(e){s({telemetry:{preference:{enabled:e,date:(/* @__PURE__ */ new Date()).toISOString()}}})}function A(){return c().telemetry?.bannerLastShown}function j(e){s({telemetry:{bannerLastShown:e}})}const M=/^\d{1,5}\.\d{1,5}\.\d{1,5}(?:-[0-9A-Za-z.-]{1,40})?(?:\+[0-9A-Za-z.-]{1,40})?$/;function N(){switch(process.platform){case`win32`:return`Windows`;case`darwin`:return`Mac OS`;case`linux`:return`Linux`;default:return`Others: ${process.platform}`}}function P(){return h.version()}function F(){return process.arch}function I(){return Number.parseInt(process.versions.node.split(`.`)[0]??`0`,10)}function L(){let e=process.env.npm_config_user_agent??``;return e.startsWith(`pnpm`)?`pnpm`:e.startsWith(`yarn`)?`yarn`:e.startsWith(`bun`)?`bun`:e.startsWith(`npm`)?`npm`:`unknown`}function R(e=process.env,t=process.ppid){if(!e.CF_DELEGATION)return!1;let n=e[u];return n===void 0||n===String(t)}function z(e=process.env,t=process.ppid){if(!e.CF_DELEGATION_PID||!R(e,t))return;let n=e[l];if(!(typeof n!=`string`||n.length>64||!M.test(n)))return n}function B(e,t,n){return g(`sha256`).update(`cf-agent-session-v1\0`).update(e).update(`\0`).update(t).update(`\0`).update(n).digest(`hex`).slice(0,32)}function V(){return typeof PACKAGE_PRERELEASE_LABEL==`string`?PACKAGE_PRERELEASE_LABEL:void 0}let H;function U(){if(H)return H;let[e,o,s]=n.split(`.`).map(e=>{let t=Number.parseInt(e,10);return Number.isNaN(t)?0:t}),c=Date.now(),l=0,u=E(),{enabled:f}=D(),p=r(),m=p.harness?.id??null,h=p.matches.find(e=>e.sessionId),g=R(),_=z();function v(){let r=V(),d=T();return{product:`cf`,cliVersion:n,cliMajor:e??0,cliMinor:o??0,cliPatch:s??0,...r?{prereleaseLabel:r}:{},osPlatform:N(),osVersion:P(),arch:F(),nodeVersion:I(),packageManager:L(),deviceId:d,amplitude_session_id:c,amplitude_event_id:l++,...h?.sessionId?{agentSessionKey:B(d,h.harness.id,h.sessionId)}:{},isFirstUsage:u,isCI:i,isInteractive:t(),cliMode:a(),agent:m,delegated:g,..._?{globalCliVersion:_}:{}}}function y(e,t){let n={deviceId:t.deviceId,event:e,timestamp:Date.now(),properties:t};if(process.env.DEBUG&&console.error(`Telemetry ${f?`sending`:`would send`}: ${JSON.stringify(n)}`),f)return fetch(`https://sparrow.cloudflare.com/api/v1/event`,{method:`POST`,signal:AbortSignal.timeout(1e3),headers:{Accept:`*/*`,"Content-Type":`application/json`,"Sparrow-Source-Key":`50598e014ed44c739ec8074fdc16057c`},mode:`cors`,keepalive:!0,body:JSON.stringify(n)}).then(()=>void 0).catch(e=>{process.env.DEBUG&&console.error(`Telemetry failed to send:`,e instanceof Error?e.message:String(e))})}return H={enabled:f,sendCommandEvent(e,t){if(f)try{d(y(e,{...v(),...t}))}catch(e){process.env.DEBUG&&console.error(`Telemetry failed to prepare:`,e)}},sendAdhocEvent(e,t={}){if(f)try{d(y(e,{...v(),...t}))}catch(e){process.env.DEBUG&&console.error(`Telemetry failed to prepare:`,e)}}},H}const W=/* @__PURE__ */ new Set([`SIGINT`,`SIGTERM`]),G=1024;function K(t){if(t instanceof e)return t.cancelled||t.signal&&W.has(t.signal)?`cancelled`:t.code===0?`success`:`error`}async function q(e,t,n){let r;try{r=U()}catch{return n()}if(f(),e.sendMetrics===!1||!r.enabled)return n();let i={...e.recordArgs===!1?{sanitizedArgs:{},argsUsed:[],argsCombination:``}:m(t,process.argv.slice(2),e.classification),command:e.command};r.sendCommandEvent(`cf command started`,i);let a=e.searchQuery===void 0?{}:{searchQuery:e.searchQuery.slice(0,G),...e.searchQuery.length>G?{searchQueryTruncated:!0}:{}},o=Date.now();try{let e=await n();return r.sendCommandEvent(`cf command finished`,{...i,...a,outcome:`success`,durationMs:Date.now()-o}),e}catch(e){let t=K(e)??`error`;throw r.sendCommandEvent(`cf command finished`,{...i,...a,outcome:t,durationMs:Date.now()-o,...t===`error`?p(e):{}}),e}}function J(e,t){return{...e,handler:n=>q(t,n,()=>e.handler(n))}}export{v as a,w as c,D as d,j as f,y as i,O as l,J as n,A as o,k as p,U as r,T as s,q as t,E as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{l as e}from"./chunk-SQ32YSCG-CQ3eXDT8.mjs";import{r as t}from"./blocks-BhHWbQEb.mjs";import{r as n}from"./theme-BGHWSKCw.mjs";let r=!1,i=!1,a=!1;function o(){a=!0}function s(e,n={}){r||i||(n.quiet||!process.stderr.isTTY?i=!0:(process.stderr.write(`${t(e,n.update)}\n`),r=!0))}function c(t){!r||i||a||t==="default"||e({allowGlobalAuthKey:!1})!==void 0||(process.stderr.write(`${n.muted(`Active profile:`)} ${n.info(t)}\n`),a=!0)}export{c as n,o as r,s as t};
|
package/dist/shared-BhmS_OQE.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{_ as e,d as t,f as n,t as r}from"./deploy-context-DmYBYd8Q.mjs";import{a as i,d as a,f as o,r as s,s as c}from"./static-assets-n9iBqrrt.mjs";import{Y as l,Z as u,ot as d}from"./dist-aDyCGA5i.mjs";import{a as f,c as p,i as m,l as h,n as g,o as _,r as v,s as y}from"./build-CMyWk3oc.mjs";import{t as b}from"./cli-exit-CstFZ1eJ.mjs";import{i as x,r as S}from"./dotenv-DKRemNCH.mjs";import{i as C,n as w,t as T}from"./deploy-input-pcciD1Bc.mjs";import{t as E}from"./log-LXeTb6Zo.mjs";import{readBuildOutput as D}from"@cloudflare/build-output-utils";function O(e){return e.option(`prebuilt`,{type:`boolean`,description:`Deploy existing Build Output Specification files without building`,default:!1}).option(`tag`,{type:`string`,description:`A tag to associate with this Worker Version`,requiresArg:!0}).option(`message`,{type:`string`,description:`A message to associate with this Worker Version`,requiresArg:!0}).option(`secrets-file`,{type:`string`,description:"Path to a file containing secrets to upload with the version (JSON or .env format). Dotenv values expand $VAR and ${VAR} using process environment values and earlier file values; process environment values override file values, including empty values. Only declared file keys are uploaded. Only use trusted dotenv secrets files: they can read and upload any process environment value. Escape literal dollar signs with \\$ or use JSON.",requiresArg:!0}).option(`dry-run`,{describe:`Build a project and run checks without actually uploading the Worker`,type:`boolean`,default:!1}).option(`worker`,f)}async function k(e,t){if(!e.prebuilt){if(await g(e.mode,{worker:e.worker,dryRun:e[`dry-run`]})===`setup-needed`){E.success(`--dry-run: exiting now.`);return}E.message(``)}return S(e,()=>A(e,t))}async function A(f,g){let{root:S,workers:O,rootConfig:k,containers:A}=await D(process.cwd());if(k.buildContext.isPreview){let e=[`cf previews deploy`,...f.prebuilt?[`--prebuilt`]:[],...k.buildContext.mode===void 0?[]:[`--mode`,k.buildContext.mode]].join(` `);throw Error(`This build output is for a Preview. Run ${e} instead.`)}h(f.mode,k.buildContext.mode),p(k.settings?.accountId,f[`temporary-account`]===!0);let{worker:j,workerNameOverridden:M}=m(y(O,f.worker)),N=_(j,k),P=x(N.wranglerConfig),F=T(j,N.builtConfig,S,{includeSourceMaps:!f[`temporary-account`]}),I=u(P),{authToken:L,accountId:R}=await i({accountId:k.settings?.accountId,complianceRegion:I,dryRun:f[`dry-run`]}),z=r(L);o(z),e({logger:z.logger,fetchResult:z.fetchResult,fetchPagedListResult:z.fetchPagedListResult}),R!==void 0&&A.length>0&&n(R,L,l(P));let B=s(A,P,{accountId:R,containersRollout:f[`containers-rollout`]}),V,H=!1,U=process.exitCode,W=v();try{if(process.exitCode=void 0,g.command===`Deploy`){let e=w(j,P,R,f,B);e.workerNameOverridden=M,E.section(`Deploy`),{versionId:V}=await c(e,P,F,{deployCommand:`cf deploy`,versionsDeployCommand:`cf workers deployments create --worker <worker-name> --strategy percentage --versions <versions-json>`,d1ListCommand:`cf d1 list`,d1DeleteCommand:`cf d1 delete <database-id>`,queueCreateCommand:e=>`cf queues create --queue-name ${e}`,secretPutCommand:`cf workers secrets update --worker <worker-name> --type secret_text`,workersDevConfigFieldName:`workersDev`,workersDevConfigAssignment:e=>`workersDev: ${e}`,previewUrlsConfigFieldName:`previewUrls`,previewUrlsConfigAssignment:e=>`previewUrls: ${e}`,configFileName:`cloudflare.config.ts`,observabilityTargetPercentageField:`targetInstancePercentage`,observabilityTargetCountField:`targetInstanceCount`,syncWorkersSite:void 0,analyseBundle:void 0})}else{let e=C(j,P,R,f,B);e.workerNameOverridden=M,E.section(`Upload`),{versionId:V}=await a(e,P,F,{deployCommand:`cf deploy`,versionsUploadCommand:`cf workers versions create`,versionsDeployCommand:`cf workers deployments create --worker <worker-name> --strategy percentage --versions <versions-json>`,triggersDeployCommand:`cf workers triggers deploy`,d1ListCommand:`cf d1 list`,d1DeleteCommand:`cf d1 delete <database-id>`,queueCreateCommand:e=>`cf queues create --queue-name ${e}`,versionsSecretPutCommand:`wrangler versions secret put`,analyseBundle:void 0})}H=V===null&&process.exitCode===1&&!f[`dry-run`]}finally{process.exitCode??=U,W()}if(H)throw new b(1);V===null||f[`dry-run`]||g.command===`Deploy`&&f[`containers-rollout`]===`none`||await t([...g.command===`Deploy`?B.standard.builtImages:[],...B.durableObjects.builtImages],d()),f[`dry-run`]||E.success(`${g.command} complete`)}export{O as n,k as t};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-BNtqjh-B.mjs";import{n as r,o as i}from"./chunk-DSGVRFIS-5bsdVCqZ.mjs";import{N as a}from"./chunk-AAQI36FL-e6E5HW1g.mjs";import{H as o}from"./dist-aDyCGA5i.mjs";import{createRequire as s}from"node:module";import{readFile as c}from"node:fs/promises";import{gzipSync as l}from"node:zlib";import{randomUUID as u}from"node:crypto";import{clearTimeout as d,setTimeout as f}from"node:timers";import{Miniflare as p,convertV4MiniflareOptions as m}from"miniflare";var h=/* @__PURE__ */ n(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),g=/* @__PURE__ */ n(((t,n)=>{let{EMPTY_BUFFER:r}=h(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}
|
|
3
|
-
/* istanbul ignore else */
|
|
4
|
-
if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let t=e(`bufferutil`);n.exports.mask=function(e,n,r,i,a){a<48?o(e,n,r,i,a):t.mask(e,n,r,i,a)},n.exports.unmask=function(e,n){e.length<32?s(e,n):t.unmask(e,n)}}catch{}})),_=/* @__PURE__ */ n(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),v=/* @__PURE__ */ n(((t,n)=>{let r=e(`zlib`),i=g(),a=_(),{kStatusCode:o}=h(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!m){let e=this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit;m=new a(e)}}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(/* @__PURE__ */ Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,b),this._inflate.on(`data`,y)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,v)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function v(e){this[f].push(e),this[u]+=e.length}function y(e){this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload?this[f].push(e):(this[p]=/* @__PURE__ */ RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,y),this.reset())}function b(e){this[l]._inflate=null,this[p]?this[d](this[p]):(e[o]=1007,this[d](e))}})),y=/* @__PURE__ */ n(((t,n)=>{let{isUtf8:r}=e(`buffer`),{hasBlob:i}=h(),a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=e(`utf-8-validate`);n.exports.isValidUTF8=function(e){return e.length<32?s(e):t(e)}}catch{}})),b=/* @__PURE__ */ n(((t,n)=>{let{Writable:r}=e(`stream`),i=v(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=h(),{concat:l,toArrayBuffer:u,unmask:d}=g(),{isValidStatusCode:f,isValidUTF8:p}=y(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0||e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks?n(this.createError(RangeError,`Too many buffered chunks`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`)):(this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n))}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName])e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));else{if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}}getPayloadLength16(e){this._bufferedBytes<2?this._loop=!1:(this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e))}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);n>2**21-1?e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`)):(this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e))}haveLength(e){this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)?e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`)):this._state=this._masked?3:4}getMask(){this._bufferedBytes<4?this._loop=!1:(this._mask=this.consume(4),this._state=4)}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7)this.controlMessage(t,e);else if(this._compressed)this._state=5,this.decompress(t,e);else{if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0}else this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),x=/* @__PURE__ */ n(((t,n)=>{let{Duplex:r}=e(`stream`),{randomFillSync:i}=e(`crypto`),{types:{isUint8Array:a}}=e(`util`),o=v(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=h(),{isBlob:u,isValidStatusCode:d}=y(),{mask:f,toBuffer:p}=g(),m=Symbol(`kByteLength`),_=Buffer.alloc(4),b=8192,x,S=b;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||_,t.generateMask?t.generateMask(n):(S===b&&(x===void 0&&(x=Buffer.alloc(b)),i(x,0,b),S=0),n[0]=x[S++],n[1]=x[S++],n[2]=x[S++],n[3]=x[S++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=/* @__PURE__ */ Error(`The socket was closed while the blob was being read`);process.nextTick(C,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(w,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=/* @__PURE__ */ Error(`The socket was closed while data was being compressed`);C(this,e,i)}else this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function C(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function w(e,t,n){C(e,t,n),e.onerror(t)}})),S=/* @__PURE__ */ n(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=h(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,"target",{enumerable:!0}),Object.defineProperty(f.prototype,"type",{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean!==void 0&&t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,"code",{enumerable:!0}),Object.defineProperty(p.prototype,"reason",{enumerable:!0}),Object.defineProperty(p.prototype,"wasClean",{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,"error",{enumerable:!0}),Object.defineProperty(m.prototype,"message",{enumerable:!0});var g=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(g.prototype,"data",{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new g(`message`,{data:n?e:e.toString()});r[l]=this,_(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,_(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,_(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,_(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:g};function _(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),C=/* @__PURE__ */ n(((e,t)=>{let{tokenChars:n}=y();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`)}else if(l===void 0){if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s){if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`)}else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),w=/* @__PURE__ */ n(((t,n)=>{let r=e(`events`),i=e(`https`),a=e(`http`),o=e(`net`),s=e(`tls`),{randomBytes:c,createHash:l}=e(`crypto`),{Duplex:u,Readable:d}=e(`stream`),{URL:f}=e(`url`),p=v(),m=b(),_=x(),{isBlob:w}=y(),{BINARY_TYPES:T,CLOSE_TIMEOUT:E,EMPTY_BUFFER:D,GUID:O,kForOnEventAttribute:k,kListener:A,kStatusCode:j,kWebSocket:M,NOOP:N}=h(),{EventTarget:{addEventListener:P,removeEventListener:F}}=S(),{format:I,parse:L}=C(),{toBuffer:R}=g(),z=Symbol(`kAborted`),B=[8,13],V=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],H=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var U=class e extends r{constructor(t,n,r){super(),this._binaryType=T[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=D,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol=``,this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t===null?(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),W(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){T.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}
|
|
5
|
-
/* istanbul ignore next */
|
|
6
|
-
get onclose(){return null}
|
|
7
|
-
/* istanbul ignore next */
|
|
8
|
-
get onerror(){return null}
|
|
9
|
-
/* istanbul ignore next */
|
|
10
|
-
get onopen(){return null}
|
|
11
|
-
/* istanbul ignore next */
|
|
12
|
-
get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new _(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[M]=this,a[M]=this,t[M]=this,i.on(`conclude`,ee),i.on(`drain`,te),i.on(`error`,ne),i.on(`message`,re),i.on(`ping`,ie),i.on(`pong`,ae),a.onerror=oe,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,se),t.on(`data`,$),t.on(`end`,ce),t.on(`error`,le),this._readyState=e.OPEN,this.emit(`open`)}emitClose(){this._socket?(this._extensions[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)):(this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage))}close(t,n){this.readyState!==e.CLOSED&&(this.readyState===e.CONNECTING?J(this,this._req,`WebSocket was closed before the connection was established`):this.readyState===e.CLOSING?this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end():(this._readyState=e.CLOSING,this._sender.close(t,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Q(this)))}pause(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState===e.OPEN?(n===void 0&&(n=!this._isServer),this._sender.ping(t||D,n,r)):Y(this,t,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState===e.OPEN?(n===void 0&&(n=!this._isServer),this._sender.pong(t||D,n,r)):Y(this,t,r)}resume(){this.readyState!==e.CONNECTING&&this.readyState!==e.CLOSED&&(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){Y(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||D,i,r)}terminate(){this.readyState!==e.CLOSED&&(this.readyState===e.CONNECTING?J(this,this._req,`WebSocket was closed before the connection was established`):this._socket&&(this._readyState=e.CLOSING,this._socket.destroy()))}};Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:V.indexOf(`CONNECTING`)}),Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:V.indexOf(`CONNECTING`)}),Object.defineProperty(U,"OPEN",{enumerable:!0,value:V.indexOf(`OPEN`)}),Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:V.indexOf(`OPEN`)}),Object.defineProperty(U,"CLOSING",{enumerable:!0,value:V.indexOf(`CLOSING`)}),Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:V.indexOf(`CLOSING`)}),Object.defineProperty(U,"CLOSED",{enumerable:!0,value:V.indexOf(`CLOSED`)}),Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:V.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(U.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(U.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[k])return t[A];return null},set(t){for(let t of this.listeners(e))if(t[k]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[k]:!0})}})}),U.prototype.addEventListener=P,U.prototype.removeEventListener=F,n.exports=U;function W(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:E,protocolVersion:B[1],maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!B.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${B.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;G(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,v=/* @__PURE__ */ new Set,y;if(o.createConnection=o.createConnection||(u?q:K),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(y=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=I({[p.extensionName]:y.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!H.test(e)||v.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);v.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let b;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:!e._originalIpc&&s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),b=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,b)}else b=e._req=_(o);o.timeout&&b.on(`timeout`,()=>{J(e,b,`Opening handshake has timed out`)}),b.on(`error`,t=>{b===null||b[z]||(b=e._req=null,G(e,t))}),b.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){J(e,b,`Maximum redirects exceeded`);return}b.abort();let i;try{i=new f(a,t)}catch{G(e,/* @__PURE__ */ SyntaxError(`Invalid URL: ${a}`));return}W(e,i,n,r)}else e.emit(`unexpected-response`,b,i)||J(e,b,`Unexpected server response: ${i.statusCode}`)}),b.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==U.CONNECTING)return;b=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){J(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+O).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){J(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?v.size&&(c=`Server sent no subprotocol`):v.size?v.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){J(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!y){J(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=L(u)}catch{J(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){J(e,n,`Server indicated an extension that was not requested`);return}try{y.accept(t[p.extensionName])}catch{J(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=y}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(b,e):b.end()}function G(e,t){e._readyState=U.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function K(e){return e.path=e.socketPath,o.connect(e)}function q(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function J(e,t,n){e._readyState=U.CLOSING;let r=Error(n);Error.captureStackTrace(r,J),t.setHeader?(t[z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(G,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function Y(e,t,n){if(t){let n=w(t)?t.size:R(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=/* @__PURE__ */ Error(`WebSocket is not open: readyState ${e.readyState} (${V[e.readyState]})`);process.nextTick(n,t)}}function ee(e,t){let n=this[M];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[M]!==void 0&&(n._socket.removeListener(`data`,$),process.nextTick(Z,n._socket),e===1005?n.close():n.close(e,t))}function te(){let e=this[M];e.isPaused||e._socket.resume()}function ne(e){let t=this[M];t._socket[M]!==void 0&&(t._socket.removeListener(`data`,$),process.nextTick(Z,t._socket),t.close(e[j])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function X(){this[M].emitClose()}function re(e,t){this[M].emit(`message`,e,t)}function ie(e){let t=this[M];t._autoPong&&t.pong(e,!this._isServer,N),t.emit(`ping`,e)}function ae(e){this[M].emit(`pong`,e)}function Z(e){e.resume()}function oe(e){let t=this[M];t.readyState!==U.CLOSED&&(t.readyState===U.OPEN&&(t._readyState=U.CLOSING,Q(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function Q(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function se(){let e=this[M];if(this.removeListener(`close`,se),this.removeListener(`data`,$),this.removeListener(`end`,ce),e._readyState=U.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[M]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,X),e._receiver.on(`finish`,X))}function $(e){this[M]._receiver.write(e)||this.pause()}function ce(){let e=this[M];e._readyState=U.CLOSING,e._receiver.end(),this.end()}function le(){let e=this[M];this.removeListener(`error`,le),this.on(`error`,N),e&&(e._readyState=U.CLOSING,this.destroy())}})),T=/* @__PURE__ */ n(((t,n)=>{w();let{Duplex:r}=e(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){e.readyState===e.CONNECTING?e.once(`open`,function(){s._final(t)}):e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){e.readyState===e.CONNECTING?e.once(`open`,function(){s._write(t,n,r)}):e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),E=/* @__PURE__ */ n(((e,t)=>{let{tokenChars:n}=y();function r(e){let t=/* @__PURE__ */ new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),D=/* @__PURE__ */ n(((t,n)=>{let r=e(`events`),i=e(`http`),{Duplex:a}=e(`stream`),{createHash:o}=e(`crypto`),s=C(),c=v(),l=E(),u=w(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=h(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1048576,maxFragments:131072,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=g(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=/* @__PURE__ */ new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2)e&&this.once(`close`,()=>{e(/* @__PURE__ */ Error(`The server is not running`))}),process.nextTick(_,this);else if(e&&this.once(`close`,e),this._state!==1){if(this._state=1,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients&&this.clients.size?this._shouldEmitClose=!0:process.nextTick(_,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{_(this)})}}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,y);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){x(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){x(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){x(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){x(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){b(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=/* @__PURE__ */ new Set;if(u!==void 0)try{d=l.parse(u)}catch{x(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{x(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return b(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return b(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return b(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
|
|
13
|
-
`).join(`\r
|
|
14
|
-
`)),i.removeListener(`error`,y),d.setSocket(i,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(_,this)})),l(d,r)}};function g(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function _(e){e._state=2,e.emit(`close`)}function y(){this.destroy()}function b(e,t,n,r){n||=i.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
|
|
15
|
-
`)+`\r
|
|
16
|
-
\r
|
|
17
|
-
`+n)}function x(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,x),e.emit(`wsClientError`,r,n,t)}else b(n,r,i,a)}})),O=o();T(),C(),v(),b(),x(),E();var k=/* @__PURE__ */ t(w(),1);D(),s(import.meta.url||(typeof __filename==`string`?__filename:`/`));var A=1e4,j={esm:`ESModule`,commonjs:`CommonJS`,"compiled-wasm":`CompiledWasm`,buffer:`Data`,text:`Text`,python:`PythonModule`,"python-requirement":`PythonRequirement`};async function M(e){if(typeof e!=`string`)return e;let t=await c(e),n=t.findIndex(e=>e===10),r=Uint8Array.prototype.slice.call(t,2,n).toString();return await new O.Response(t,{headers:{"Content-Type":`multipart/form-data; boundary=${r}`}}).formData()}i(M,`parseWorkerBundle`);async function N(e){let t=[];for(let n of e.values())n instanceof Blob&&n.type!==`application/source-map`&&t.push(n);let n=new Blob(t);return{size:n.size,gzipSize:l(await n.arrayBuffer()).byteLength}}i(N,`getBundleSize`);function P(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=e.samples??[],r=e.timeDeltas??[],i=0,a=0,o=0;for(let[e,s]of r.entries()){i+=s;let r=t.get(n[e]??0)?.callFrame.functionName;r===`(idle)`?a+=s:r===`(garbage collector)`&&(o+=s)}return{profileWindow:e.endTime-e.startTime,sampledTime:i,activeTime:i-a,garbageCollectionTime:o,idleTime:a,sampleCount:n.length}}i(P,`summarizeStartupProfile`);async function F(e){let t=await M(e),n=JSON.parse(t.get(`metadata`));if(typeof n.main_module!=`string`)throw new a(`Startup profiling does not support service-worker format Workers. Refer to https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/ for migration guidance.`,{telemetryMessage:`startup profiling service worker format unsupported`});let r=await I(t,n.bindings),o=new p(m({name:`profiler`,compatibilityDate:typeof n.compatibility_date==`string`?n.compatibility_date:void 0,compatibilityFlags:Array.isArray(n.compatibility_flags)?n.compatibility_flags:void 0,...r.options,modulesRoot:`/`,modules:[{type:`ESModule`,path:u(),contents:`
|
|
18
|
-
async function startup() {
|
|
19
|
-
await import(${JSON.stringify(n.main_module)});
|
|
20
|
-
}
|
|
21
|
-
export default {
|
|
22
|
-
async fetch() {
|
|
23
|
-
await startup();
|
|
24
|
-
return new Response("ok");
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`},...await J(t)],inspectorPort:0,handleStructuredLogs:/* @__PURE__ */ i(()=>void 0,`handleStructuredLogs`)})),s=new AbortController,c=f(()=>{s.abort(new a(`Worker startup profiling timed out after ${A/1e3} seconds.`,{telemetryMessage:`startup profiling timed out`}))},A),l,h=/* @__PURE__ */ i(e=>s.abort(e instanceof Error?e:/* @__PURE__ */ Error(`Worker startup profiler inspector error: ${String(e)}`)),`onInspectorError`),g=/* @__PURE__ */ i(()=>s.abort(/* @__PURE__ */ Error(`The Worker startup profiler inspector connection closed.`)),`onInspectorClose`);try{await U(o.ready,s.signal);let e=await U(o.getInspectorURL(),s.signal);l=new k.default(new URL(`/core:user:profiler`,e.href)),l.on(`error`,h),l.on(`close`,g),await W(l,s.signal),await G(l,1,`Profiler.enable`,s.signal),await G(l,2,`Profiler.start`,s.signal);let t=await U(o.dispatchFetch(`https://example.com`,{signal:s.signal}),s.signal);if(await U(t.text(),s.signal),!t.ok&&r.unsupportedBindings.length>0){let e=` The upload contains bindings that cannot be reproduced locally during startup profiling: ${r.unsupportedBindings.map(e=>`${JSON.stringify(e.name)} (${JSON.stringify(e.type)})`).join(`, `)}.`;throw new a(`Worker startup profiling failed during module evaluation (status ${t.status}).${e}`,{telemetryMessage:`startup profiling module evaluation failed`})}let n=await G(l,3,`Profiler.stop`,s.signal);if(n?.profile===void 0)throw Error(`Inspector command Profiler.stop returned no profile.`);return n.profile}finally{try{await o.dispose()}finally{try{l!==void 0&&(l.off(`error`,h),l.off(`close`,g),l.readyState!==k.default.CLOSED&&(l.once(`error`,()=>void 0),l.terminate()))}finally{d(c)}}}}i(F,`analyseBundle`);async function I(e,t){let n={},r,i={},a={},o={},s={},c={},l,u={},d={},f={},p=[],m={},h={},g,_={},v,y={},b={},x={},S={},C={},w={},T={},E={},D,O={},k,A={},j={},M={},N=[];for(let P of Array.isArray(t)?t:[]){if(!R(P)){N.push({name:`<unknown>`,type:`unknown`});continue}let t=P;if(L(t))E[t.name]=z();else switch(t.type){case`plain_text`:case`secret_text`:c[t.name]=t.text;break;case`json`:c[t.name]=t.json;break;case`text_blob`:c[t.name]=await V(e,t);break;case`data_blob`:u[t.name]=await B(e,t);break;case`kv_namespace`:_[t.name]={id:t.namespace_id};break;case`d1`:d[t.name]={id:t.id};break;case`r2_bucket`:C[t.name]={id:t.bucket_name};break;case`queue`:S[t.name]={queueName:t.queue_name,deliveryDelay:t.delivery_delay};break;case`service`:E[t.name]=z(),N.push(t);break;case`assets`:E[t.name]=z();break;case`browser`:l={binding:t.name};break;case`ai`:r={binding:t.name};break;case`images`:g={binding:t.name};break;case`stream`:D={binding:t.name};break;case`version_metadata`:k=t.name;break;case`ai_search_namespace`:a[t.name]={namespace:t.namespace};break;case`ai_search`:i[t.name]={instance_name:t.instance_name};break;case`agent_memory`:n[t.name]={namespace:t.namespace};break;case`media`:v={binding:t.name};break;case`send_email`:{let e={name:t.name,allowed_sender_addresses:t.allowed_sender_addresses};t.destination_address===void 0?t.allowed_destination_addresses===void 0?p.push(e):p.push({...e,allowed_destination_addresses:t.allowed_destination_addresses}):p.push({...e,destination_address:t.destination_address});break}case`durable_object_namespace`:case`workflow`:N.push(t);break;case`vectorize`:O[t.name]={index_name:t.index_name};break;case`analytics_engine`:o[t.name]={dataset:t.dataset??`dataset`};break;case`dispatch_namespace`:f[t.name]={namespace:t.namespace};break;case`mtls_certificate`:y[t.name]={certificate_id:t.certificate_id};break;case`pipelines`:t.stream===void 0?t.pipeline===void 0?N.push(t):b[t.name]={pipeline:t.pipeline}:b[t.name]={stream:t.stream};break;case`k2`:x[t.name]={stream:t.stream};break;case`secrets_store_secret`:T[t.name]={store_id:t.store_id,secret_name:t.secret_name};break;case`artifacts`:s[t.name]={namespace:t.namespace};break;case`unsafe_hello_world`:h[t.name]={enable_timer:t.enable_timer};break;case`flagship`:m[t.name]={app_id:t.app_id};break;case`ratelimit`:w[t.name]={namespace_id:t.namespace_id,simple:t.simple};break;case`vpc_service`:j[t.name]={service_id:t.service_id};break;case`vpc_network`:t.tunnel_id===void 0?t.network_id===void 0?N.push(t):A[t.name]={network_id:t.network_id}:A[t.name]={tunnel_id:t.tunnel_id};break;case`worker_loader`:M[t.name]={};break;case`inherit`:N.push(t);break;case`wasm_module`:N.push(t);break;case`hyperdrive`:N.push(t);break;case`logfwdr`:N.push(t);break;case`analytics`:N.push(t);break;default:{let e=t;N.push(e)}}}return{options:{agentMemory:n,ai:r,aiSearchInstances:i,aiSearchNamespaces:a,analyticsEngineDatasets:o,artifacts:s,bindings:c,browserRendering:l,dataBlobBindings:u,d1Databases:d,dispatchNamespaces:f,email:{send_email:p},flagship:m,helloWorld:h,images:g,kvNamespaces:_,media:v,mtlsCertificates:y,pipelines:b,k2:x,queueProducers:S,r2Buckets:C,ratelimits:w,secretsStoreSecrets:T,serviceBindings:E,stream:D,vectorize:O,versionMetadata:k,vpcNetworks:A,vpcServices:j,workerLoaders:M},unsupportedBindings:N}}i(I,`convertWorkerBundleBindings`);function L(e){switch(e.type){case`browser`:case`ai`:case`images`:case`kv_namespace`:case`workflow`:case`queue`:case`r2_bucket`:case`d1`:case`vectorize`:return e.raw===!0;default:return!1}}i(L,`isRawWorkerBinding`);function R(e){return typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&`type`in e&&typeof e.type==`string`}i(R,`isNamedWorkerBinding`);function z(){return()=>new O.Response(`Binding calls are unavailable during startup profiling.`,{status:503})}i(z,`createOfflineFetcherBinding`);async function B(e,t){let n=H(e,t);return n instanceof Blob?new Uint8Array(await n.arrayBuffer()):new TextEncoder().encode(n)}i(B,`getBinaryBindingPart`);async function V(e,t){let n=H(e,t);return n instanceof Blob?await n.text():n}i(V,`getTextBindingPart`);function H(e,t){let n=e.get(t.part);if(n===null)throw new a(`Startup profiling could not find multipart part ${JSON.stringify(t.part)} for binding ${JSON.stringify(t.name)}.`,{telemetryMessage:`startup profiling binding part missing`});return n}i(H,`getBindingPart`);async function U(e,t){if(t.aborted)throw t.reason;return await new Promise((n,r)=>{let a=/* @__PURE__ */ i(()=>r(t.reason),`onAbort`);t.addEventListener(`abort`,a,{once:!0}),e.then(n,r).finally(()=>{t.removeEventListener(`abort`,a)})})}i(U,`waitForPromise`);async function W(e,t){if(t.aborted)throw t.reason;return await new Promise((n,r)=>{let a=/* @__PURE__ */ i(()=>{e.off(`open`,o),e.off(`error`,s),e.off(`close`,c),t.removeEventListener(`abort`,l)},`cleanup`),o=/* @__PURE__ */ i(()=>{a(),n()},`onOpen`),s=/* @__PURE__ */ i(e=>{a(),r(e)},`onError`),c=/* @__PURE__ */ i(()=>{a(),r(/* @__PURE__ */ Error(`The Worker startup profiler inspector connection closed.`))},`onClose`),l=/* @__PURE__ */ i(()=>{a(),r(t.reason)},`onAbort`);e.once(`open`,o),e.once(`error`,s),e.once(`close`,c),t.addEventListener(`abort`,l,{once:!0})})}i(W,`waitForInspectorOpen`);async function G(e,t,n,r){if(r.aborted)throw r.reason;return await new Promise((a,o)=>{let s=/* @__PURE__ */ i(()=>{e.off(`message`,c),r.removeEventListener(`abort`,l)},`cleanup`),c=/* @__PURE__ */ i(e=>{let r;try{r=JSON.parse(e.toString())}catch(e){s(),o(e);return}r.id===t&&(s(),r.error==null?a(r.result):o(/* @__PURE__ */ Error(`Inspector command ${n} failed: ${r.error.message??`error ${r.error.code??`unknown`}`}`)))},`onMessage`),l=/* @__PURE__ */ i(()=>{s(),o(r.reason)},`onAbort`);e.on(`message`,c),r.addEventListener(`abort`,l,{once:!0});try{e.send(JSON.stringify({id:t,method:n,params:{}}),e=>{e&&(s(),o(e))})}catch(e){s(),o(e)}})}i(G,`sendInspectorCommand`);async function K(e){return e instanceof Blob?new Uint8Array(await e.arrayBuffer()):e}i(K,`getEntryValue`);function q(e){if(e instanceof Blob)try{return j[r(e.type)]}catch{throw Error(`Unable to determine module type for ${e.type} mime type`)}return`Text`}i(q,`getModuleType`);async function J(e){return await Promise.all([...e.entries()].filter(e=>e[1]instanceof Blob&&e[1].type!==`application/source-map`).map(async([e,t])=>({type:q(t),path:e,contents:await K(t)})))}i(J,`convertWorkerBundleToModules`);export{P as i,N as n,M as r,F as t};
|
package/dist/state-CQZhgMaN.mjs
DELETED