@vercel/cli-support 65.11.0 → 65.12.0-snapshot-801db9d533c3
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 +8 -120
- package/dist/chunks/add-BDJYCIBT.js +8 -0
- package/dist/chunks/add-LZR4CD7O.js +8 -0
- package/dist/chunks/add-MR6YZTRQ.js +8 -0
- package/dist/chunks/{alerts-JGRRCQA4.js → alerts-VOYMO6NJ.js} +1 -1
- package/dist/chunks/build-H2U56DYB.js +7 -0
- package/dist/chunks/{chunk-UF2E5BDE.js → chunk-23PO6JK6.js} +1 -1
- package/dist/chunks/{chunk-PUKYAALC.js → chunk-24SIHFEW.js} +1 -1
- package/dist/chunks/{chunk-EBIJ26IV.js → chunk-2C6TLXE5.js} +1 -1
- package/dist/chunks/{chunk-QROI2U32.js → chunk-2CQJKBKV.js} +2 -4
- package/dist/chunks/{chunk-7MZLV3KK.js → chunk-2CZL3GJU.js} +1 -1
- package/dist/chunks/{chunk-XH2R2EIK.js → chunk-2EV53VB5.js} +1 -1
- package/dist/chunks/{chunk-5B5CLOKM.js → chunk-2FNOYPRB.js} +1 -1
- package/dist/chunks/{chunk-4E6BGQWR.js → chunk-2LOA3LC6.js} +1 -1
- package/dist/chunks/{chunk-M3Z6NSC2.js → chunk-2V6UURUN.js} +1 -1
- package/dist/chunks/{chunk-B6QVH6IG.js → chunk-32EEQITR.js} +1 -1
- package/dist/chunks/{chunk-4VP57TOJ.js → chunk-33OMDQTW.js} +1 -1
- package/dist/chunks/{chunk-CFYLTZSV.js → chunk-3AGRCSWN.js} +1 -1
- package/dist/chunks/{chunk-42J2KCDF.js → chunk-3EFPSM6M.js} +1 -1
- package/dist/chunks/{chunk-DQASZDQT.js → chunk-3SNWIYU7.js} +1 -1
- package/dist/chunks/{chunk-EVBGFSK5.js → chunk-42Y46TZ3.js} +1 -1
- package/dist/chunks/{chunk-KV3QXTRZ.js → chunk-4OO6TXBM.js} +1 -1
- package/dist/chunks/{chunk-UUDE44NV.js → chunk-54FY6GJ5.js} +1 -1
- package/dist/chunks/{chunk-RIJ45N7C.js → chunk-5HQEYPDO.js} +1 -1
- package/dist/chunks/chunk-5KL6UFII.js +7 -0
- package/dist/chunks/{chunk-ECFLIVEE.js → chunk-5L566FZB.js} +1 -1
- package/dist/chunks/{chunk-NZW3RIQM.js → chunk-5MFGTXWC.js} +1 -1
- package/dist/chunks/{chunk-4ELZOAQH.js → chunk-5TMHRECT.js} +1 -1
- package/dist/chunks/{chunk-74VQ7PQV.js → chunk-5YLKPSZI.js} +1 -1
- package/dist/chunks/chunk-66TKNVRG.js +60 -0
- package/dist/chunks/{chunk-RDWLLSPU.js → chunk-6737KAJP.js} +1 -1
- package/dist/chunks/{chunk-V5TOMLK4.js → chunk-6Q2XEYCJ.js} +1 -1
- package/dist/chunks/{chunk-7VGBGUX7.js → chunk-6S6UZV3V.js} +1 -1
- package/dist/chunks/{chunk-EZLPMOHM.js → chunk-6WTGR7UP.js} +1 -1
- package/dist/chunks/chunk-7BDQUBSO.js +7 -0
- package/dist/chunks/chunk-7M6EHM5B.js +7 -0
- package/dist/chunks/{chunk-42FOKWGX.js → chunk-7PGDJTAH.js} +1 -1
- package/dist/chunks/{chunk-BZIC36KP.js → chunk-7TVNKTN2.js} +1 -1
- package/dist/chunks/{chunk-IIGNDMLO.js → chunk-ABSFPYM4.js} +1 -1
- package/dist/chunks/{chunk-MBXLL2HF.js → chunk-AGLOVMPC.js} +3 -3
- package/dist/chunks/{chunk-B56SRT5W.js → chunk-AIZIVXNX.js} +1 -1
- package/dist/chunks/{chunk-WBSFE6IE.js → chunk-AQBK55BT.js} +1 -1
- package/dist/chunks/chunk-AW33SRYY.js +7 -0
- package/dist/chunks/{chunk-UNPK7LVC.js → chunk-B3IBBNIR.js} +1 -1
- package/dist/chunks/{chunk-VRH7LWOC.js → chunk-B4KA3ZH2.js} +1 -1
- package/dist/chunks/{chunk-2J35YKA2.js → chunk-BC74BRVP.js} +12 -12
- package/dist/chunks/{chunk-PFZCGMJ7.js → chunk-BH5OASEJ.js} +1 -1
- package/dist/chunks/chunk-BIGJEDOA.js +11 -0
- package/dist/chunks/chunk-BOJDM3O7.js +7 -0
- package/dist/chunks/{chunk-375JVQYK.js → chunk-CJZE7647.js} +1 -1
- package/dist/chunks/{chunk-YZKARZ2B.js → chunk-CKJZSRAC.js} +1 -1
- package/dist/chunks/{chunk-TUAS3L5I.js → chunk-D5JRYYTT.js} +1 -1
- package/dist/chunks/{chunk-SF4E3AQ3.js → chunk-E3WP42P2.js} +1 -1
- package/dist/chunks/{chunk-6UMVJ7RL.js → chunk-E7CEQ2PO.js} +1 -1
- package/dist/chunks/chunk-E7IFYSQT.js +12 -0
- package/dist/chunks/chunk-EDO66J3L.js +7 -0
- package/dist/chunks/{chunk-C5QEQSEX.js → chunk-EIFBF3JQ.js} +1 -1
- package/dist/chunks/chunk-EM3U6PRB.js +7 -0
- package/dist/chunks/{chunk-AMPJ6RWT.js → chunk-EZVNGJN5.js} +1 -1
- package/dist/chunks/{chunk-ZPBGAZC2.js → chunk-F6KURUPQ.js} +1 -1
- package/dist/chunks/{chunk-5DXC4TE2.js → chunk-F7L5SXJM.js} +1 -1
- package/dist/chunks/{chunk-ZTHW5VNH.js → chunk-FFS3QJCU.js} +2 -2
- package/dist/chunks/{chunk-FNH3T3CF.js → chunk-FGZXIHGN.js} +1 -1
- package/dist/chunks/chunk-FXOKM2RM.js +7 -0
- package/dist/chunks/{chunk-NUSKXXZZ.js → chunk-FZLCDLWD.js} +1 -1
- package/dist/chunks/{chunk-CD6ZWCKT.js → chunk-G63MSB6N.js} +1 -1
- package/dist/chunks/{chunk-HNH3DPIZ.js → chunk-GAILIG45.js} +1 -1
- package/dist/chunks/{chunk-FVVOHGQE.js → chunk-GHNHUSVK.js} +1 -1
- package/dist/chunks/{chunk-4DMKP6AO.js → chunk-GOI2VVI7.js} +2 -2
- package/dist/chunks/chunk-GORL5DZC.js +11 -0
- package/dist/chunks/{chunk-WMWB7QKG.js → chunk-GP3KGUCK.js} +1 -1
- package/dist/chunks/{chunk-GL66K54F.js → chunk-GPDERS2D.js} +1 -1
- package/dist/chunks/{chunk-CU3LNJZV.js → chunk-GUSOYIW6.js} +1 -1
- package/dist/chunks/{chunk-AO6AMYBF.js → chunk-GY44CQXK.js} +1 -1
- package/dist/chunks/chunk-H64GR57G.js +7 -0
- package/dist/chunks/{chunk-VKCBEW6R.js → chunk-HBWRIR42.js} +1 -1
- package/dist/chunks/{chunk-4U6ACPA4.js → chunk-HR66URIC.js} +1 -1
- package/dist/chunks/chunk-HRGJO4HK.js +7 -0
- package/dist/chunks/chunk-HU5NUOWH.js +7 -0
- package/dist/chunks/{chunk-4KM733OB.js → chunk-HVJN2SSK.js} +1 -1
- package/dist/chunks/chunk-HXLOBW75.js +10 -0
- package/dist/chunks/{chunk-4T57TXQ3.js → chunk-IBBLLUXD.js} +1 -1
- package/dist/chunks/{chunk-MO2G2ND2.js → chunk-IJBRT2AD.js} +1 -1
- package/dist/chunks/{chunk-NT2N5UR4.js → chunk-IRIFXCZW.js} +1 -1
- package/dist/chunks/{chunk-ECGY67NB.js → chunk-J7RNU6AO.js} +1 -1
- package/dist/chunks/{chunk-SDYCW5JM.js → chunk-JONZUKWX.js} +1 -1
- package/dist/chunks/{chunk-P24YBQ6H.js → chunk-JVGENO2R.js} +1 -1
- package/dist/chunks/{chunk-PKNEWN4W.js → chunk-K46QQRUN.js} +1 -1
- package/dist/chunks/{chunk-BJXLR2RE.js → chunk-KKYNEEM7.js} +1 -1
- package/dist/chunks/{chunk-3TDFSO4X.js → chunk-KPSINH7T.js} +1 -1
- package/dist/chunks/chunk-KR4DMT3I.js +7 -0
- package/dist/chunks/{chunk-RCUDI7OF.js → chunk-M32HBBPK.js} +1 -1
- package/dist/chunks/{chunk-ZQXXESKG.js → chunk-MAA5GRIM.js} +1 -1
- package/dist/chunks/chunk-MCYG7CCE.js +7 -0
- package/dist/chunks/{chunk-VAZ7JG2Z.js → chunk-MNZYFYYH.js} +1 -1
- package/dist/chunks/{chunk-HDISAMDF.js → chunk-MQJ4MINN.js} +1 -1
- package/dist/chunks/{chunk-ITQPDXXA.js → chunk-MTZYPCZ7.js} +1 -1
- package/dist/chunks/{chunk-NE6PKR2J.js → chunk-MWWMY5R6.js} +1 -1
- package/dist/chunks/{chunk-UBJVL3NJ.js → chunk-MWXL6HYB.js} +3 -3
- package/dist/chunks/{chunk-UFXIPUNI.js → chunk-MXALPSIX.js} +1 -1
- package/dist/chunks/{chunk-7JMN657A.js → chunk-NBTFAXL4.js} +1 -1
- package/dist/chunks/{chunk-HYOWFNOP.js → chunk-NIZW6D6D.js} +1 -1
- package/dist/chunks/{chunk-KBVYN635.js → chunk-NREH4VSU.js} +1 -1
- package/dist/chunks/{chunk-TPJV5UNE.js → chunk-NTYBDY24.js} +1 -1
- package/dist/chunks/{chunk-NDMQVBTV.js → chunk-NYJTWSSD.js} +1 -1
- package/dist/chunks/{chunk-7ZJ7VUIR.js → chunk-O3DAPRJ3.js} +1 -1
- package/dist/chunks/chunk-O7TFWXLZ.js +13 -0
- package/dist/chunks/{chunk-K7ARJYAG.js → chunk-OFOZ5DBA.js} +1 -1
- package/dist/chunks/{chunk-FYE7ILRR.js → chunk-OFZUWHZW.js} +1 -1
- package/dist/chunks/{chunk-RI6DJAFI.js → chunk-OHEM2CSW.js} +1 -1
- package/dist/chunks/{chunk-6ORJPXDQ.js → chunk-OHK3Y5NS.js} +1 -1
- package/dist/chunks/{chunk-IHTWZEQW.js → chunk-OKKG2FUS.js} +1 -1
- package/dist/chunks/{chunk-7NMC4E66.js → chunk-OR3ZEVBW.js} +1 -1
- package/dist/chunks/{chunk-QDHTI5WK.js → chunk-POR6KNXT.js} +1 -1
- package/dist/chunks/{chunk-JUSNW3IF.js → chunk-PSFHYOLD.js} +1 -1
- package/dist/chunks/{chunk-TZE4CS4K.js → chunk-QBHTNUM5.js} +1 -1
- package/dist/chunks/chunk-QJDWNTYH.js +7 -0
- package/dist/chunks/{chunk-YUHKH4TK.js → chunk-QKOLFLLP.js} +1 -1
- package/dist/chunks/chunk-REJLEESP.js +10 -0
- package/dist/chunks/{chunk-EIMHC5UY.js → chunk-ROKZIMRO.js} +1 -1
- package/dist/chunks/{chunk-DR6OJB6P.js → chunk-RPIBJRIT.js} +1 -1
- package/dist/chunks/chunk-SEHERY6U.js +7 -0
- package/dist/chunks/{chunk-RR5SDYNN.js → chunk-SHMHL6W7.js} +1 -1
- package/dist/chunks/{chunk-5FIY443M.js → chunk-SMETSNPH.js} +1 -1
- package/dist/chunks/{chunk-NMIZSQDN.js → chunk-SP6E7PHW.js} +1 -1
- package/dist/chunks/chunk-SQBDW5FO.js +10 -0
- package/dist/chunks/chunk-SWFG73OS.js +8 -0
- package/dist/chunks/{chunk-CHIYT3V4.js → chunk-TA7KTIDV.js} +1 -1
- package/dist/chunks/{chunk-W24TLPO5.js → chunk-TJBVFVXK.js} +1 -1
- package/dist/chunks/{chunk-JTAUWH5V.js → chunk-TJUZVODP.js} +1 -1
- package/dist/chunks/{chunk-VWJXV5ZM.js → chunk-TKVUWTBK.js} +1 -1
- package/dist/chunks/chunk-U7ZEFVSQ.js +8 -0
- package/dist/chunks/{chunk-WTFD4MDT.js → chunk-UZQJQXGJ.js} +1 -1
- package/dist/chunks/{chunk-UIMJNASP.js → chunk-V7G4VDZI.js} +1 -1
- package/dist/chunks/{chunk-WNDR5HCU.js → chunk-VCJIB3FB.js} +1 -1
- package/dist/chunks/{chunk-EGTJTCCW.js → chunk-VFBELAGX.js} +1 -1
- package/dist/chunks/{chunk-AYZ52QDF.js → chunk-VM6X5BTK.js} +1 -1
- package/dist/chunks/{chunk-HZEKH3RO.js → chunk-VVTMF2AY.js} +1 -1
- package/dist/chunks/{chunk-N65H4JMJ.js → chunk-W25UARQV.js} +1 -1
- package/dist/chunks/chunk-WLMW7K7F.js +7 -0
- package/dist/chunks/{chunk-IHCYNUI2.js → chunk-XJYDISH3.js} +1 -1
- package/dist/chunks/chunk-XSQZ35V6.js +7 -0
- package/dist/chunks/{chunk-YODQLETL.js → chunk-XVDUP67R.js} +1 -1
- package/dist/chunks/{chunk-SLCPSRDR.js → chunk-Y2FVJ7YO.js} +1 -1
- package/dist/chunks/chunk-Y2SQC4GV.js +10 -0
- package/dist/chunks/{chunk-FVTRIRML.js → chunk-Y5S2OEJH.js} +1 -1
- package/dist/chunks/{chunk-EJN55YDV.js → chunk-YANOBY2G.js} +1 -1
- package/dist/chunks/{chunk-2RXUQ72I.js → chunk-YIOMTAUF.js} +1 -1
- package/dist/chunks/{chunk-BW25OFQG.js → chunk-YLCIOXSX.js} +1 -1
- package/dist/chunks/{chunk-GZLYNPNU.js → chunk-YNCWSPPJ.js} +1 -1
- package/dist/chunks/chunk-YQQ3A3YC.js +13 -0
- package/dist/chunks/{chunk-UI2H2EIM.js → chunk-YTRKHRL3.js} +1 -1
- package/dist/chunks/{chunk-MIIHBRKV.js → chunk-Z2K2JR7F.js} +1 -1
- package/dist/chunks/{chunk-F7AVGV4Y.js → chunk-Z73UJVGD.js} +1 -1
- package/dist/chunks/{chunk-6Y2ZL5XJ.js → chunk-ZKNEIE44.js} +2 -2
- package/dist/chunks/chunk-ZXEWWSTH.js +10 -0
- package/dist/chunks/chunk-ZZLCRSES.js +11 -0
- package/dist/chunks/clear-7QUM5KH7.js +8 -0
- package/dist/chunks/{cli-embedded-Y74S252S.js → cli-embedded-ABHGJLYX.js} +1 -1
- package/dist/chunks/compile-vercel-config-RDISBTDC.js +7 -0
- package/dist/chunks/config-2YNYR6YI.js +7 -0
- package/dist/chunks/config-4AOTKKGI.js +8 -0
- package/dist/chunks/config-validator.mjs +1 -1
- package/dist/chunks/{connect-git-provider-GFAJLQLU.js → connect-git-provider-BMUUC7ND.js} +1 -1
- package/dist/chunks/contract-3VSUIBEY.js +10 -0
- package/dist/chunks/delete-EJNR4UYC.js +10 -0
- package/dist/chunks/delete-OYOBFPEG.js +9 -0
- package/dist/chunks/describe-ORIEHT3R.js +25 -0
- package/dist/chunks/detect-projects-AKK2XI76.js +7 -0
- package/dist/chunks/detect-services-3LYPKUVL.js +7 -0
- package/dist/chunks/disable-U6JU546S.js +7 -0
- package/dist/chunks/discard-6SHAFQ2H.js +14 -0
- package/dist/chunks/edit-YMWKFN3H.js +8 -0
- package/dist/chunks/edit-YTTKJFTG.js +9 -0
- package/dist/chunks/enable-A6KBPFXJ.js +7 -0
- package/dist/chunks/{esm-4ZHGYTUV.js → esm-CF5UHWPM.js} +1 -1
- package/dist/chunks/{esm-LNIAU767.js → esm-EYOXGOVF.js} +1 -1
- package/dist/chunks/{esm-IBY43SSX.js → esm-FSME24KA.js} +1 -1
- package/dist/chunks/{esm-7FVTQHRH.js → esm-IUATPKKB.js} +1 -1
- package/dist/chunks/{esm-GTSUYLKG.js → esm-L6OKDFWP.js} +1 -1
- package/dist/chunks/{esm-TEM4KPXZ.js → esm-ORQC2ZSA.js} +1 -1
- package/dist/chunks/{esm-TLAM7FSK.js → esm-PYIZNQIK.js} +1 -1
- package/dist/chunks/{exec-H3X7U4P3.js → exec-RQ257MTR.js} +1 -1
- package/dist/chunks/{export-25TQ3YBT.js → export-MMU6VVFK.js} +1 -1
- package/dist/chunks/future-ANILGGFQ.js +7 -0
- package/dist/chunks/generate-cert-for-deploy-LKKZUKWF.js +7 -0
- package/dist/chunks/image-OWWKVBTU.js +7 -0
- package/dist/chunks/import-builders-VENL23EH.js +7 -0
- package/dist/chunks/{inspect-3W3TUJ6P.js → inspect-BPIJT4OX.js} +1 -1
- package/dist/chunks/inspect-GDZJZGHW.js +13 -0
- package/dist/chunks/{inspect-TN2QY3BP.js → inspect-H7JGEVL7.js} +1 -1
- package/dist/chunks/inspect-I6LQLOBG.js +8 -0
- package/dist/chunks/{inspect-BRYVSQBD.js → inspect-IGFAKTAX.js} +1 -1
- package/dist/chunks/inspect-U6V4UQXC.js +9 -0
- package/dist/chunks/list-763XVNFH.js +8 -0
- package/dist/chunks/{list-WA6Q7DUN.js → list-OX2N4JK7.js} +1 -1
- package/dist/chunks/list-WHZXMZJ5.js +12 -0
- package/dist/chunks/{list-6W4UQBY4.js → list-XLPMNNI7.js} +1 -1
- package/dist/chunks/login-2PGWWOKB.js +7 -0
- package/dist/chunks/login-T63WJL4S.js +9 -0
- package/dist/chunks/logs-S2KJGEIG.js +7 -0
- package/dist/chunks/ls-5HXYPIFR.js +11 -0
- package/dist/chunks/ls-M4GJOBZP.js +8 -0
- package/dist/chunks/ls-N56BWH2L.js +8 -0
- package/dist/chunks/{ls-L5LLKZBV.js → ls-O5B3LY4D.js} +1 -1
- package/dist/chunks/{ls-MAJ4QZTY.js → ls-PNGTHVUK.js} +1 -1
- package/dist/chunks/{ls-UXE5RSZN.js → ls-Q7FAOSVD.js} +1 -1
- package/dist/chunks/{ls-4WP6LHLL.js → ls-R4UDBWS3.js} +1 -1
- package/dist/chunks/migrate-experimental-services-HWJXO4AJ.js +7 -0
- package/dist/chunks/mutate-FM6BLE46.js +9 -0
- package/dist/chunks/{native-self-update-DEVBYOH2.js → native-self-update-7LL6RPJW.js} +1 -1
- package/dist/chunks/notifications-ZSZN35BQ.js +7 -0
- package/dist/chunks/open-4RXUUYQP.js +7 -0
- package/dist/chunks/openapi-457MABMI.js +7 -0
- package/dist/chunks/permissions-UJRTMOT7.js +7 -0
- package/dist/chunks/{plugin-offer-JUYWL4I7.js → plugin-offer-KJCRPUU5.js} +1 -1
- package/dist/chunks/prompt-missing-credentials-B5DGQFI7.js +7 -0
- package/dist/chunks/publish-I3APOD3N.js +15 -0
- package/dist/chunks/pull-2YUNTVPQ.js +7 -0
- package/dist/chunks/purchase-domain-if-available-3YOXUXII.js +7 -0
- package/dist/chunks/push-4QQJQRGZ.js +7 -0
- package/dist/chunks/query-2JO6HH5N.js +12 -0
- package/dist/chunks/reauthenticate-COYQMMAG.js +7 -0
- package/dist/chunks/remove-PWS5EJ7F.js +9 -0
- package/dist/chunks/reorder-COZQX64R.js +10 -0
- package/dist/chunks/reply-XDYZNHW2.js +9 -0
- package/dist/chunks/resolve-6KUFCZRX.js +12 -0
- package/dist/chunks/resolve-agent-team-NOT235ZN.js +7 -0
- package/dist/chunks/{resolve-deployment-framework-preset-AXXYBFCL.js → resolve-deployment-framework-preset-4TKUU6AH.js} +1 -1
- package/dist/chunks/restore-GSSD4ZWH.js +16 -0
- package/dist/chunks/rm-AUNVZPJ5.js +8 -0
- package/dist/chunks/rm-EIMUYBJT.js +8 -0
- package/dist/chunks/rm-EJH37HYN.js +8 -0
- package/dist/chunks/rm-O5NMCBC3.js +8 -0
- package/dist/chunks/rm-PHTOXG4E.js +8 -0
- package/dist/chunks/{routes-BP54NO3Z.js → routes-NEZJKMR5.js} +1 -1
- package/dist/chunks/rule-inspect-7HNYKQ6X.js +8 -0
- package/dist/chunks/{schema-753JMRZA.js → schema-5P7HROXE.js} +1 -1
- package/dist/chunks/schema-MZM5MN5V.js +14 -0
- package/dist/chunks/select-org-3BZWQD6R.js +7 -0
- package/dist/chunks/set-2RH74ZC3.js +7 -0
- package/dist/chunks/set-Q2EJ3V44.js +9 -0
- package/dist/chunks/setup-and-link-BT5TNY4J.js +7 -0
- package/dist/chunks/{skills-QZ4AMS2K.js → skills-DUOUHPBY.js} +1 -1
- package/dist/chunks/{statuspage-KHTMA4WL.js → statuspage-K5SC7KAQ.js} +1 -1
- package/dist/chunks/{detect-projects-K7SVMH5T.js → table-W6LOHWWF.js} +1 -1
- package/dist/chunks/tags-QOJEEMKS.js +7 -0
- package/dist/chunks/{types-NPUAHKSK.js → types-7L6HBXAU.js} +1 -1
- package/dist/chunks/{update-7XH7HM5F.js → update-HS6QFTQK.js} +1 -1
- package/dist/chunks/usage-3N6IA5SX.js +13 -0
- package/dist/chunks/validate-config-YLL6RPCP.js +7 -0
- package/dist/commands/build/index.js +1 -1
- package/dist/commands/deploy/index.js +19 -37
- package/dist/commands/dev/index.js +4 -4
- package/dist/commands/env/index.js +1 -1
- package/dist/commands/link/index.js +1 -1
- package/dist/commands/list/index.js +1 -1
- package/dist/commands/project/index.js +1 -1
- package/dist/commands-account.js +3 -3
- package/dist/commands-ai.js +6 -6
- package/dist/commands-blob.js +1 -1
- package/dist/commands-core.js +20 -20
- package/dist/commands-deployments.js +5 -5
- package/dist/commands-flags.js +1 -1
- package/dist/commands-integrations.js +1 -1
- package/dist/commands-observability.js +15 -8
- package/dist/commands-routing.js +5 -4
- package/dist/help.js +1 -1
- package/dist/index.js +5 -5
- package/dist/internal-build.js +1 -1
- package/dist/package.json +45 -245
- package/dist/vc.js +47 -695
- package/dist/version.mjs +1 -1
- package/package.json +51 -196
- package/dist/chunks/add-4R6FUHQT.js +0 -8
- package/dist/chunks/add-F3H4BFJZ.js +0 -8
- package/dist/chunks/add-TCOJ4SIQ.js +0 -8
- package/dist/chunks/build-GOLTZF6S.js +0 -7
- package/dist/chunks/chunk-3KJ6HWSX.js +0 -7
- package/dist/chunks/chunk-5X635INY.js +0 -11
- package/dist/chunks/chunk-7LPNDK2O.js +0 -7
- package/dist/chunks/chunk-A3M2BHWR.js +0 -13
- package/dist/chunks/chunk-BUFEV3T4.js +0 -11
- package/dist/chunks/chunk-BVR6OIU5.js +0 -7
- package/dist/chunks/chunk-D7BB5BPA.js +0 -10
- package/dist/chunks/chunk-DBT6PGEH.js +0 -7
- package/dist/chunks/chunk-DRZVM7CB.js +0 -12
- package/dist/chunks/chunk-EICEQXVS.js +0 -7
- package/dist/chunks/chunk-F2R7L3ZB.js +0 -7
- package/dist/chunks/chunk-FHMCTV5E.js +0 -7
- package/dist/chunks/chunk-FOE3MWES.js +0 -7
- package/dist/chunks/chunk-HKU6D7DU.js +0 -8
- package/dist/chunks/chunk-IOTKHTZH.js +0 -7
- package/dist/chunks/chunk-K4JTCVNW.js +0 -13
- package/dist/chunks/chunk-LALPOYIA.js +0 -8
- package/dist/chunks/chunk-M3R7F2N4.js +0 -7
- package/dist/chunks/chunk-MUKXOI2K.js +0 -8
- package/dist/chunks/chunk-NIS66BFX.js +0 -63
- package/dist/chunks/chunk-NSPW47RU.js +0 -7
- package/dist/chunks/chunk-NTDP6RTQ.js +0 -11
- package/dist/chunks/chunk-Q2QVK3TH.js +0 -7
- package/dist/chunks/chunk-RM3ZDRYE.js +0 -7
- package/dist/chunks/chunk-UCRMJMH6.js +0 -10
- package/dist/chunks/chunk-XQDHMFQY.js +0 -7
- package/dist/chunks/chunk-XRIM4BUF.js +0 -7
- package/dist/chunks/chunk-Z64MQIOE.js +0 -10
- package/dist/chunks/chunk-ZS2WS4AM.js +0 -7
- package/dist/chunks/clear-PECHXMV5.js +0 -8
- package/dist/chunks/compile-vercel-config-EM3HYOQC.js +0 -7
- package/dist/chunks/config-DA2NZUDH.js +0 -8
- package/dist/chunks/config-X6O3DT7V.js +0 -7
- package/dist/chunks/contract-RHMWRX4W.js +0 -10
- package/dist/chunks/delete-5RN5VW5L.js +0 -9
- package/dist/chunks/delete-MT6I7R7K.js +0 -10
- package/dist/chunks/detect-services-HSA4JHJX.js +0 -7
- package/dist/chunks/disable-LXPZDQMC.js +0 -7
- package/dist/chunks/discard-PW65T65S.js +0 -14
- package/dist/chunks/edit-WFSONASO.js +0 -8
- package/dist/chunks/edit-YID3FOJ3.js +0 -9
- package/dist/chunks/enable-X2EKQCIY.js +0 -7
- package/dist/chunks/future-DQBK457G.js +0 -7
- package/dist/chunks/generate-cert-for-deploy-OMEACY5G.js +0 -7
- package/dist/chunks/image-AO2OZG4W.js +0 -7
- package/dist/chunks/import-builders-GSDV4K4A.js +0 -7
- package/dist/chunks/inspect-4244CRHI.js +0 -13
- package/dist/chunks/inspect-C43IV7X4.js +0 -9
- package/dist/chunks/inspect-RP5KXOYQ.js +0 -8
- package/dist/chunks/list-2SY6PZLC.js +0 -12
- package/dist/chunks/list-WBKZGIMQ.js +0 -8
- package/dist/chunks/login-K6XBWOFD.js +0 -9
- package/dist/chunks/login-OGMXEW5N.js +0 -7
- package/dist/chunks/logs-R3ZERQ7M.js +0 -7
- package/dist/chunks/ls-EVAQD3LI.js +0 -8
- package/dist/chunks/ls-O5DKK3TY.js +0 -8
- package/dist/chunks/ls-PTHGXQLK.js +0 -11
- package/dist/chunks/mutate-EKZWPQQJ.js +0 -9
- package/dist/chunks/notifications-F5S3RKZF.js +0 -7
- package/dist/chunks/open-KGVG54NN.js +0 -7
- package/dist/chunks/openapi-7TPDTMCU.js +0 -7
- package/dist/chunks/permissions-5K7JZOMB.js +0 -7
- package/dist/chunks/prompt-missing-credentials-DX2KJB5X.js +0 -7
- package/dist/chunks/publish-KIRTO2ZO.js +0 -15
- package/dist/chunks/pull-3CRJK7BX.js +0 -7
- package/dist/chunks/purchase-domain-if-available-55IXEF43.js +0 -7
- package/dist/chunks/push-4YG5HKSD.js +0 -7
- package/dist/chunks/query-67KQVLTR.js +0 -12
- package/dist/chunks/reauthenticate-SWSBFGDU.js +0 -7
- package/dist/chunks/remove-SYTIFVWW.js +0 -9
- package/dist/chunks/reorder-TX5MXJEB.js +0 -10
- package/dist/chunks/reply-XVK33N5T.js +0 -9
- package/dist/chunks/resolve-JZ262ZF4.js +0 -12
- package/dist/chunks/resolve-agent-team-BG5YW55B.js +0 -7
- package/dist/chunks/restore-IPFL7TKT.js +0 -16
- package/dist/chunks/rm-2BCAZGQU.js +0 -8
- package/dist/chunks/rm-3CCU3CE6.js +0 -8
- package/dist/chunks/rm-5CQV5LYG.js +0 -8
- package/dist/chunks/rm-OV4OU6H2.js +0 -8
- package/dist/chunks/rm-WFGMOZ3G.js +0 -8
- package/dist/chunks/rule-inspect-RFJIIXZH.js +0 -8
- package/dist/chunks/schema-SUNFQGUL.js +0 -14
- package/dist/chunks/select-org-MPHPWWPU.js +0 -7
- package/dist/chunks/set-BR6EEOPB.js +0 -7
- package/dist/chunks/set-I3NWZRSI.js +0 -9
- package/dist/chunks/setup-and-link-MRTKVOWD.js +0 -7
- package/dist/chunks/tags-7DIZEAVE.js +0 -7
- package/dist/chunks/usage-3BS7JCCU.js +0 -13
- package/dist/chunks/validate-config-LAD7BU3B.js +0 -7
- package/dist/launcher-errors.js +0 -11
- package/dist/native-download.js +0 -8
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{printProjectNotFoundError}from"./chunk-PSFHYOLD.js";import{param}from"./chunk-3G3FQYMW.js";import{detectExplicitScope}from"./chunk-XSQZ35V6.js";import{AGENT_REASON,AGENT_STATUS,buildCommandWithYes,outputActionRequired,outputAgentError}from"./chunk-GORL5DZC.js";import{getLinkedProject,resolveProjectCwd}from"./chunk-BC74BRVP.js";import{getCommandName,getCommandNamePlain}from"./chunk-B4KA3ZH2.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{require_build_utils}from"./chunk-5MDNVAE6.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_build_utils=__toESM(require_build_utils(),1);async function ensureLink(commandName,client,cwd,opts={}){cwd=await resolveProjectCwd(cwd);let link=opts.link,nonInteractive=opts.nonInteractive??client.nonInteractive??!1;if(opts.nonInteractive=nonInteractive,link||(opts.forceDelete?link={status:"not_linked",org:null,project:null}:link=await getLinkedProject(client,{cwd,projectName:opts.projectName,projectNameIsExplicit:!!(opts.projectName&&opts.failIfNotFound),scopeIsExplicit:detectExplicitScope(client),allowOwnerLookupFallback:opts.allowOwnerLookupFallback,skipOwnerLookup:opts.skipOwnerLookup,skipRemoteLookup:opts.skipRemoteLookup}),opts.link=link),link.status==="linked"&&opts.forceDelete||link.status==="not_linked"){if(link.status==="not_linked"&&opts.failIfNotFound&&opts.projectName){let pinnedProjectId=(0,import_build_utils.getPlatformEnv)("PROJECT_ID"),creatable=!opts.projectName.startsWith("prj_")&&!pinnedProjectId;if(!opts.createIfNotFound||opts.projectName.startsWith("prj_")||pinnedProjectId===opts.projectName)return await printProjectNotFoundError(client,opts.projectName,commandName,link.orgId,{createCommand:creatable?opts.createCommand:void 0}),1;if(pinnedProjectId){let message=`Can't use --project with VERCEL_PROJECT_ID. --project is "${opts.projectName}" and VERCEL_PROJECT_ID is "${pinnedProjectId}". Remove one of them.`,helpCommand=getCommandNamePlain(`${commandName} --help`);return output_manager_default.error(`${message}
|
|
8
|
+
|
|
9
|
+
See all options:
|
|
10
|
+
${helpCommand}`),outputAgentError(client,{status:AGENT_STATUS.ERROR,reason:AGENT_REASON.INVALID_ARGUMENTS,message,next:[{command:helpCommand,when:"see all options"}]}),2}}if(link.status==="not_linked"&&opts.requireExistingLink)return output_manager_default.error(`Project is not linked. Run ${getCommandName("link")} first.`),1;let{default:setupAndLink}=await import("./setup-and-link-BT5TNY4J.js");if(link=await setupAndLink(client,cwd,opts),link.status==="not_linked")return 0}return link.status==="error"?(link.reason==="HEADLESS"&&(nonInteractive?outputActionRequired(client,{status:"action_required",reason:"confirmation_required",message:`Command ${getCommandNamePlain(commandName)} requires confirmation. Use option --yes to confirm.`,next:[{command:buildCommandWithYes(client.argv),when:"Confirm and run"}]},link.exitCode):output_manager_default.error(`Command ${getCommandName(commandName)} requires confirmation. Use option ${param("--yes")} to confirm.`)),nonInteractive&&!client.jsonMode&&process.exit(link.exitCode),link.exitCode):link}export{ensureLink};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{withWarnings}from"./chunk-WLMW7K7F.js";import{agentErrorMetadata,buildCommandWithGlobalFlags,clientObservabilityPlanRecovery,getErrorRecovery,trackAgentError}from"./chunk-GORL5DZC.js";import{isAPIError}from"./chunk-GOI2VVI7.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import{require_strip_ansi}from"./chunk-BULSRTQE.js";import{__toESM}from"./chunk-BZENIQ7N.js";var import_strip_ansi=__toESM(require_strip_ansi(),1);function getRollupColumnName(metric,aggregation){return`${metric}_${aggregation}`.replace(/[./]/g,"_")}function getResolvedOrderMetadata(query,response){let orderBy=query.orderBy??(response.orderBy?"count":void 0),orderDirection=response.orderDirection??query.orderDirection;return{...orderBy?{orderBy}:{},...orderDirection?{orderDirection}:{}}}function formatQueryJson(query,response,warnings=[]){let orderMetadata=getResolvedOrderMetadata(query,response),queryWithResponseMetadata={...query,...orderMetadata};return JSON.stringify(withWarnings({query:queryWithResponseMetadata,summary:response.summary??[],data:response.data??[],...orderMetadata},warnings),null,2)}function formatErrorJson(code,message,allowedValues,recovery={}){let error={code,message};return allowedValues&&allowedValues.length>0&&(error.allowedValues=allowedValues),JSON.stringify({error:{...error,...recovery}},null,2)}function projectSelectorFromArgv(argv){let args=argv.slice(2);for(let i=0;i<args.length;i++){let arg=args[i];if(arg.startsWith("--project="))return arg.slice(10);if(arg==="--project"&&i+1<args.length)return args[i+1]}}function hintRestatesCommand(hint,steps){if(!steps?.length)return!1;let plain=(0,import_strip_ansi.default)(hint).replace(/`/g,"").trim();return steps.some(step=>{let command=step.command.trim();return command===plain||command.startsWith(`${plain} `)})}function handleApiError(err,jsonOutput,client,overrides={},target={}){let code,message,override=overrides[err.status];if(override)code=override.code||err.code||"BAD_REQUEST",message=override.message;else switch(err.status){case 402:code=err.code||"PAYMENT_REQUIRED",message=err.serverMessage||"This feature requires an Observability Plus subscription.";break;case 429:code=err.code||"RATE_LIMITED",message=err.serverMessage||"You have reached the metrics query rate limit. Please wait and try again. If you need a higher limit, request one from your Vercel account team.";break;case 403:code="FORBIDDEN",message=err.serverMessage&&err.serverMessage!=="Response Error"?err.serverMessage:"You do not have permission to query metrics for this project/team.";break;case 500:code="INTERNAL_ERROR",message="An internal error occurred. Please try again later.";break;case 504:code="TIMEOUT",message="The query timed out. Try a shorter time range or fewer groups.";break;case 400:code=err.code||"BAD_REQUEST",message=err.serverMessage||`API error (${err.status})`;break;default:code=err.code||"BAD_REQUEST",message=err.serverMessage||`API error (${err.status})`}let billing=err.status===402?clientObservabilityPlanRecovery(client,err,message,target.projectName??projectSelectorFromArgv(client.argv),target.scope):void 0,recovery={...getErrorRecovery({...err,serverMessage:message},client),...billing&&{hint:billing.hint}},next=billing?.command?[{command:buildCommandWithGlobalFlags(client.argv.filter(arg=>!/^(?:--yes|--force|-y)(?:=|$)/.test(arg)),billing.command,void 0,{excludeFlags:billing.excludeFlags,preserveProject:billing.preserveProject}),when:billing.when}]:void 0;recovery.hint&&hintRestatesCommand(recovery.hint,next)&&delete recovery.hint;let details={...recovery,...next&&{next},...agentErrorMetadata(client)};if(trackAgentError(client,{reason:err.status===403?"forbidden":err.status===402?"payment_required":err.status===429?"rate_limited":code,...recovery}),jsonOutput||client.nonInteractive)client.stdout.write(formatErrorJson(code,message,err.allowedValues,details));else{output_manager_default.fatal(message),recovery.hint&&output_manager_default.print(` ${recovery.hint}
|
|
8
|
+
`);for(let step of next??[])output_manager_default.print(` ${step.command}
|
|
9
|
+
`);err.allowedValues&&err.allowedValues.length>0&&output_manager_default.print(`
|
|
10
|
+
Available values: ${err.allowedValues.join(", ")}
|
|
11
|
+
`)}return 1}var OBSERVABILITY_METRICS_PATH="/metrics/v1",METRIC_CATALOG_PAGE_SIZE=250;async function fetchMetricCatalog(client,accountId,kind,search,activeSince){let metrics=[],cursor=null;do{let searchParams=new URLSearchParams({limit:String(METRIC_CATALOG_PAGE_SIZE),kind});search&&searchParams.set("search",search),activeSince&&searchParams.set("activeSince",activeSince),cursor&&searchParams.set("cursor",cursor);let response=await client.fetch(`${OBSERVABILITY_METRICS_PATH}?${searchParams}`,{accountId,bailOn429:!0});metrics.push(...response.metrics.map(metric=>({id:metric.id,description:metric.description,dimensions:metric.dimensions,unit:metric.unit,aggregations:metric.aggregations}))),cursor=response.pagination.hasMore?response.pagination.nextCursor:null}while(cursor);return metrics.filter(metric=>(kind==="all"||(kind==="system"?metric.id.startsWith("vercel."):!metric.id.startsWith("vercel.")))&&(!search||metric.id.startsWith(search))).sort((left,right)=>left.id.localeCompare(right.id))}async function fetchCatalogMetricDetail(client,accountId,metricId,kind,activeSince){let metrics=await fetchMetricCatalog(client,accountId,kind,metricId,activeSince),exactMetric=metrics.find(metric=>metric.id===metricId);return exactMetric?[exactMetric]:metrics}async function fetchSchemaOrExit(client,jsonOutput,operation,accountId){try{return await operation()}catch(err){if(isAPIError(err))return handleApiError(err,jsonOutput,client,{401:{code:"SCHEMA_UNAUTHORIZED",message:"The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again."},403:{code:"SCHEMA_UNAUTHORIZED",message:"The metrics schema API request was not authorized. Run `vercel login` to authenticate and `vercel switch` to select a team, then try again."}},accountId?.startsWith("team_")?{scope:accountId}:{});let message=err instanceof Error?`Failed to fetch metrics schema: ${err.message}`:`Failed to fetch metrics schema: ${String(err)}`;return jsonOutput?client.stdout.write(formatErrorJson("SCHEMA_FETCH_FAILED",message)):output_manager_default.error(message),1}}function fetchCatalogMetricDetailOrExit(client,accountId,jsonOutput,metricId,kind,activeSince){return fetchSchemaOrExit(client,jsonOutput,()=>fetchCatalogMetricDetail(client,accountId,metricId,kind,activeSince),accountId)}function fetchMetricCatalogListOrExit(client,accountId,jsonOutput){return fetchSchemaOrExit(client,jsonOutput,()=>fetchMetricCatalog(client,accountId,"all").then(metrics=>metrics.map(({id,description})=>({id,description}))),accountId)}export{getRollupColumnName,getResolvedOrderMetadata,formatQueryJson,formatErrorJson,handleApiError,OBSERVABILITY_METRICS_PATH,fetchCatalogMetricDetailOrExit,fetchMetricCatalogListOrExit};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{repositoryPermissionsClearPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,handleVcrApiError,requireVcrRepository,resolveVcrScope,validateVcrJsonOutput}from"./chunk-HXLOBW75.js";import"./chunk-7PGDJTAH.js";import"./chunk-D3M2JG5C.js";import"./chunk-M32HBBPK.js";import"./chunk-GD7AV7BO.js";import{permissionsClearSubcommand}from"./chunk-SP6E7PHW.js";import{printError}from"./chunk-NYJTWSSD.js";import"./chunk-XSQZ35V6.js";import{AGENT_REASON,buildCommandWithYes,outputAgentError}from"./chunk-GORL5DZC.js";import"./chunk-OFZUWHZW.js";import"./chunk-BC74BRVP.js";import"./chunk-4HR3I3ML.js";import"./chunk-K46QQRUN.js";import"./chunk-MTZYPCZ7.js";import"./chunk-GPDERS2D.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-VM6X5BTK.js";import"./chunk-2VBFQZ72.js";import"./chunk-JONZUKWX.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-D6REP5QQ.js";import"./chunk-FBYA6LLM.js";import"./chunk-MY4MONOH.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-GOI2VVI7.js";import"./chunk-B4KA3ZH2.js";import"./chunk-BOJDM3O7.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import"./chunk-BLUPZPAS.js";import"./chunk-AW33SRYY.js";import"./chunk-5MDNVAE6.js";import"./chunk-OCR5CRTH.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import"./chunk-MCYG7CCE.js";import"./chunk-YHPPP3SF.js";import{getFlagsSpecification}from"./chunk-EZVNGJN5.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BULSRTQE.js";import"./chunk-BZENIQ7N.js";async function clear(client,argv,telemetry){let parsedArgs;try{parsedArgs=parseArguments(argv,getFlagsSpecification(permissionsClearSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,"vcr permissions <repository> clear"),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;let repository=parsedArgs.args[0],project=parsedArgs.flags["--project"],skipConfirmation=!!parsedArgs.flags["--yes"];telemetry.trackCliOptionProject(project),telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);let missingRepository=requireVcrRepository(client,repository,fr.jsonOutput,"vcr permissions <repository> clear");if(typeof missingRepository=="number")return missingRepository;let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;if(!skipConfirmation&&(outputAgentError(client,{status:"error",reason:AGENT_REASON.CONFIRMATION_REQUIRED,message:"Clearing repository permissions removes access for every team. Re-run with --yes.",next:[{command:buildCommandWithYes(client.argv)}]},1),!await client.input.confirm(`Remove access to ${repository} for all teams? They will no longer be able to pull its images.`,!1)))return output_manager_default.log("Canceled"),0;let path=repositoryPermissionsClearPath(scope,repository);output_manager_default.spinner("Clearing repository permissions...");try{return await client.fetch(path,{method:"DELETE"}),fr.jsonOutput?client.stdout.write(`${JSON.stringify({repository,cleared:!0},null,2)}
|
|
8
|
+
`):output_manager_default.success(`Cleared repository permissions for ${repository}`),0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput);throw err}finally{output_manager_default.stopSpinner()}}export{clear as default};
|
|
@@ -4,7 +4,7 @@ import { dirname as __dirname_ } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
const __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
|
-
import{require_auth_errors,require_token_error,require_token_util}from"./chunk-DIHB5BUY.js";import{DERIVED_ID,DroppedError,ExternalAuthor,ExternalEvent,ExternalTarget,Link,Origin,derivedId,displayText,extractMentions,isThreadTarget,keyId,replaceMentions,runMiddleware,sha256,waitUntil}from"./chunk-CJ6XPDSS.js";import{
|
|
7
|
+
import{compileAccess,createAuthority,decodeJwt,fromTokens,hostPrincipal,issuersOf,parseScope,verifiesTokens}from"./chunk-A3C67PNC.js";import{require_auth_errors,require_token_error,require_token_util}from"./chunk-DIHB5BUY.js";import{DERIVED_ID,DroppedError,ExternalAuthor,ExternalEvent,ExternalTarget,Link,Origin,derivedId,displayText,extractMentions,isThreadTarget,keyId,replaceMentions,runMiddleware,sha256,waitUntil}from"./chunk-CJ6XPDSS.js";import{ActorId,AttachmentId,BoardError,ChannelPath,Emoji,HttpError,LabelKey,LabelValue,Labels,MESSAGE_TEXT_MAX,MessageText,RejectedError,RemoteWatcherId,badRequest,createBoardClient,displayEmoji,duration,fileSize,forbidden,json,normalizeEmoji,notFound,platformAvatar,storable,toErrorResponse,unauthorized}from"./chunk-WFS3XBAA.js";import{external_exports}from"./chunk-2AMO2VMV.js";import{require_cjs}from"./chunk-AY523IYR.js";import"./chunk-WKSXBH7X.js";import"./chunk-GD7AV7BO.js";import{commands,filters,globalOptions,groups,options,usage}from"./chunk-SNGM6NSO.js";import"./chunk-OPORM35X.js";import"./chunk-BLUPZPAS.js";import{__commonJS,__toESM}from"./chunk-BZENIQ7N.js";var require_version=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/version.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),version_exports={};__export(version_exports,{version:()=>version});module.exports=__toCommonJS(version_exports);var version="3.8.10"}});var require_exchange_vercel_oidc_token=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/exchange-vercel-oidc-token.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),exchange_vercel_oidc_token_exports={};__export(exchange_vercel_oidc_token_exports,{exchangeVercelOidcToken:()=>exchangeVercelOidcToken3});module.exports=__toCommonJS(exchange_vercel_oidc_token_exports);var import_version=require_version(),TokenCache=class{constructor(maxEntries){this.maxEntries=maxEntries,this.entries=new Map}get(key){let entry=this.entries.get(key);if(entry!==void 0){if(entry.expiresAt<=Date.now()){this.entries.delete(key);return}return this.entries.delete(key),this.entries.set(key,entry),entry.token}}set({key,token:token2,expiresAt}){for(this.entries.delete(key),this.entries.set(key,{token:token2,expiresAt});this.entries.size>this.maxEntries;){let oldest=this.entries.keys().next().value;if(oldest===void 0)break;this.entries.delete(oldest)}}},MAX_CACHE_ENTRIES=1e3,tokenCache=new TokenCache(MAX_CACHE_ENTRIES);async function getCacheKey(options2){let input=JSON.stringify([options2.token,options2.audience,options2.jti]),digest=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(input));return Array.from(new Uint8Array(digest)).map(byte=>byte.toString(16).padStart(2,"0")).join("")}async function exchangeVercelOidcToken3(options2){let cacheKey=await getCacheKey(options2);if(!options2.skipCache){let cached=tokenCache.get(cacheKey);if(cached!==void 0)return cached}let response=await fetch("https://oidc.vercel.com/~token",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","User-Agent":`@vercel/oidc@${import_version.version}`},body:JSON.stringify({token:options2.token,aud:options2.audience,...options2.jti?{jti:options2.jti}:void 0})});if(!response.ok)throw new Error(`Failed to exchange token: ${await readErrorMessage(response)}`);let data;try{data=await response.json()}catch{throw new Error("Failed to exchange token: response was not valid JSON")}if(!data||typeof data!="object"||!("token"in data)||typeof data.token!="string")throw new Error("Failed to exchange token: response did not contain a token");let{token:token2}=data,expiry2="expiry"in data&&typeof data.expiry=="number"?data.expiry:void 0;if(expiry2!==void 0){let expiresAt=expiry2*1e3;expiresAt>Date.now()&&tokenCache.set({key:cacheKey,token:token2,expiresAt})}return token2}async function readErrorMessage(response){try{let data=await response.json();if(data&&typeof data=="object"&&"error"in data&&typeof data.error=="string")return data.error}catch{}return response.statusText||`HTTP ${response.status}`}}});var require_get_context=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/get-context.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),get_context_exports={};__export(get_context_exports,{SYMBOL_FOR_REQ_CONTEXT:()=>SYMBOL_FOR_REQ_CONTEXT,getContext:()=>getContext2});module.exports=__toCommonJS(get_context_exports);var SYMBOL_FOR_REQ_CONTEXT=Symbol.for("@vercel/request-context");function getContext2(){return globalThis[SYMBOL_FOR_REQ_CONTEXT]?.get?.()??{}}}});var require_get_vercel_oidc_token_sync=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-sync.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),get_vercel_oidc_token_sync_exports={};__export(get_vercel_oidc_token_sync_exports,{getVercelOidcTokenSync:()=>getVercelOidcTokenSync2});module.exports=__toCommonJS(get_vercel_oidc_token_sync_exports);var import_get_context=require_get_context();function getVercelOidcTokenSync2(){let token2=(0,import_get_context.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!token2)throw new Error("The 'x-vercel-oidc-token' header is missing from the request.");return token2}}});var require_get_vercel_oidc_token_with_refresh=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/get-vercel-oidc-token-with-refresh.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),get_vercel_oidc_token_with_refresh_exports={};__export(get_vercel_oidc_token_with_refresh_exports,{getVercelOidcToken:()=>getVercelOidcToken4});module.exports=__toCommonJS(get_vercel_oidc_token_with_refresh_exports);var import_exchange_vercel_oidc_token=require_exchange_vercel_oidc_token(),import_get_vercel_oidc_token_sync=require_get_vercel_oidc_token_sync(),import_token_error=require_token_error();async function getVercelOidcToken4(options2){let token2="",err;try{token2=(0,import_get_vercel_oidc_token_sync.getVercelOidcTokenSync)()}catch(error){err=error}try{let[{getTokenPayload,isExpired},{refreshToken}]=await Promise.all([await import("./token-util-A4BSB3KP.js"),await import("./token-JJLQVXPI.js")]);(!token2||isExpired(getTokenPayload(token2),options2?.expirationBufferMs))&&(await refreshToken(options2),token2=(0,import_get_vercel_oidc_token_sync.getVercelOidcTokenSync)())}catch(error){let message=err instanceof Error?err.message:"";throw error instanceof Error&&(message=`${message}
|
|
8
8
|
${error.message}`),message?new import_token_error.VercelOidcTokenError(message):error}return options2?.audience&&(token2=await(0,import_exchange_vercel_oidc_token.exchangeVercelOidcToken)({token:token2,audience:options2.audience,jti:options2.jti,skipCache:options2.skipCache})),token2}}});var require_verify_vercel_oidc_token=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/verify-vercel-oidc-token.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),verify_vercel_oidc_token_exports={};__export(verify_vercel_oidc_token_exports,{verifyVercelOidcToken:()=>verifyVercelOidcToken2});module.exports=__toCommonJS(verify_vercel_oidc_token_exports);var import_jose3=require_cjs(),VERCEL_OIDC_ISSUER="https://oidc.vercel.com",VERCEL_OIDC_JWKS_URL=new URL("https://oidc.vercel.com/.well-known/jwks"),DEFAULT_ALGORITHMS=["RS256"],VERCEL_OIDC_JWKS=(0,import_jose3.createRemoteJWKSet)(VERCEL_OIDC_JWKS_URL);async function verifyVercelOidcToken2(token2,options2){let{algorithms,projectId=process.env.VERCEL_PROJECT_ID,environment:environment3=process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV,ownerId,...verifyOptions}=options2??{};if(projectId==="*"&&ownerId===void 0&&!hasAudienceVerification(verifyOptions.audience))throw new TypeError("Expected ownerId or audience to be provided when projectId is '*'.");let result2=await(0,import_jose3.jwtVerify)(token2,VERCEL_OIDC_JWKS,{...verifyOptions,algorithms:algorithms??DEFAULT_ALGORITHMS});return validateIssuer(result2.payload.iss),validateClaim({actual:result2.payload.project_id,claim:"project_id",env:"VERCEL_PROJECT_ID",expected:projectId,option:"projectId"}),validateClaim({actual:result2.payload.environment,claim:"environment",env:"VERCEL_TARGET_ENV or VERCEL_ENV",expected:environment3,option:"environment"}),validateOptionalClaim({actual:result2.payload.owner_id,claim:"owner_id",expected:ownerId}),result2}function hasAudienceVerification(audience){return Array.isArray(audience)?audience.length>0:audience!==void 0}function validateIssuer(actual){if(actual!==VERCEL_OIDC_ISSUER&&(typeof actual!="string"||!actual.startsWith(`${VERCEL_OIDC_ISSUER}/`)))throw new TypeError(`Expected Vercel OIDC token iss claim to be "${VERCEL_OIDC_ISSUER}" or to start with "${VERCEL_OIDC_ISSUER}/".`)}function validateClaim({actual,claim,env,expected,option}){if(expected!=="*"){if(expected===void 0||expected.length===0)throw new TypeError(`Expected ${env} to be set or ${option} to be provided. Pass ${option}: '*' to allow any ${claim} claim.`);if(!(Array.isArray(expected)&&typeof actual=="string"&&expected.includes(actual))&&actual!==expected)throw new TypeError(Array.isArray(expected)?`Expected Vercel OIDC token ${claim} claim to be one of: ${expected.map(value=>`"${value}"`).join(", ")}.`:`Expected Vercel OIDC token ${claim} claim to be "${expected}".`)}}function validateOptionalClaim({actual,claim,expected}){if(expected!==void 0&&actual!==expected)throw new TypeError(`Expected Vercel OIDC token ${claim} claim to be "${expected}".`)}}});var require_dist=__commonJS({"../../node_modules/.pnpm/@vercel+oidc@3.8.10/node_modules/@vercel/oidc/dist/index.js"(exports,module){"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod),src_exports={};__export(src_exports,{AccessTokenMissingError:()=>import_auth_errors.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>import_auth_errors.RefreshAccessTokenFailedError,exchangeVercelOidcToken:()=>import_exchange_vercel_oidc_token.exchangeVercelOidcToken,getContext:()=>import_get_context.getContext,getVercelOidcToken:()=>import_get_vercel_oidc_token_with_refresh.getVercelOidcToken,getVercelOidcTokenSync:()=>import_get_vercel_oidc_token_sync.getVercelOidcTokenSync,getVercelToken:()=>import_token_util.getVercelToken,verifyVercelOidcToken:()=>import_verify_vercel_oidc_token.verifyVercelOidcToken});module.exports=__toCommonJS(src_exports);var import_get_vercel_oidc_token_with_refresh=require_get_vercel_oidc_token_with_refresh(),import_get_vercel_oidc_token_sync=require_get_vercel_oidc_token_sync(),import_get_context=require_get_context(),import_verify_vercel_oidc_token=require_verify_vercel_oidc_token(),import_auth_errors=require_auth_errors(),import_exchange_vercel_oidc_token=require_exchange_vercel_oidc_token(),import_token_util=require_token_util()}});var Ref=external_exports.string().min(1).max(128),Revision=external_exports.number().int().positive(),id=Ref,repeated=external_exports.union([external_exports.string(),external_exports.array(external_exports.string())]).transform(value=>Array.isArray(value)?value:[value]),LabelFilter=external_exports.string().regex(/^[a-z0-9][a-z0-9_.-]*(=.*)?$/,"label filters look like key, key=value, or key=a|b").transform(value=>{let at=value.indexOf("=");return at===-1?[value,null]:[value.slice(0,at),value.slice(at+1).split("|")]}),ResolvedSyncTarget=external_exports.object({target:ExternalTarget,kind:external_exports.enum(["channel","thread"])}),Filters=external_exports.object({channel:external_exports.string().optional(),re:id.optional(),by:external_exports.string().optional(),mentions:external_exports.string().optional(),label:repeated.pipe(external_exports.array(LabelFilter)).optional(),from:external_exports.string().min(1).max(64).optional(),text:external_exports.string().min(1).max(200).optional()}),MessagesQuery=Filters.extend({after:Ref.optional(),before:id.optional(),limit:external_exports.coerce.number().int().min(1).max(500).optional()}),ThreadsQuery=Filters.extend({after:Ref.optional(),limit:external_exports.coerce.number().int().min(1).max(500).optional()}),EventsQuery=Filters.extend({after:Ref.optional(),wait:external_exports.coerce.number().min(0).max(300).optional(),all:external_exports.coerce.boolean().optional()}),PostBody=external_exports.object({channel:ChannelPath.optional(),re:Ref.optional(),text:external_exports.string().max(MESSAGE_TEXT_MAX).default(""),labels:Labels.optional(),noSync:external_exports.boolean().optional(),sync:external_exports.array(external_exports.union([external_exports.string().min(3).max(300),ResolvedSyncTarget])).max(10).optional(),id:external_exports.string().min(1).max(200).refine(storable,"id has a NUL character or a lone surrogate").optional(),attachments:external_exports.array(AttachmentId).max(10).optional(),after:Ref.optional()}).refine(body=>body.text.trim().length>0||(body.attachments?.length??0)>0,{message:"message text is empty",path:["text"]}).refine(body=>body.channel===void 0!=(body.re===void 0),{message:"a post needs `channel`; a reply needs `re`"}).refine(body=>!(body.noSync&&body.sync?.length),{message:"`noSync` and `sync` contradict each other"}).refine(body=>body.after===void 0||body.re!==void 0,{message:"`after` is for replies: it names the newest message in `re`'s thread",path:["after"]}),Duration=external_exports.string().regex(/^\d+(\.\d+)?(s|m|h|d)$/,"durations look like 30s, 30m, 12h, or 1d"),Instant=external_exports.string().datetime({offset:!0}),ScheduleBody=external_exports.object({channel:ChannelPath.optional(),re:Ref.optional(),text:external_exports.string().max(MESSAGE_TEXT_MAX).default(""),labels:Labels.optional(),noSync:external_exports.boolean().optional(),attachments:external_exports.array(AttachmentId).max(10).optional(),in:Duration.optional(),at:Instant.optional(),every:Duration.optional(),until:Instant.optional(),for:Duration.optional(),times:external_exports.number().int().positive().optional()}).refine(body=>body.text.trim().length>0||(body.attachments?.length??0)>0,{message:"message text is empty",path:["text"]}).refine(body=>body.channel===void 0!=(body.re===void 0),{message:"a schedule needs `channel` for a new thread, or `re` for a reply"}).refine(body=>body.in!==void 0||body.at!==void 0||body.every!==void 0,{message:"say when: `in`, `at`, or `every`"}).refine(body=>!(body.in!==void 0&&body.at!==void 0),{message:"`in` and `at` contradict each other"}).refine(body=>[body.until,body.for,body.times].filter(v=>v!==void 0).length<=1,{message:"pick one stop: `until`, `for`, or `times`"}).refine(body=>body.every!==void 0||body.until===void 0&&body.for===void 0&&body.times===void 0,{message:"`until`, `for`, and `times` stop a repeat: add `every`"}),SchedulesQuery=external_exports.object({re:id.optional(),channel:external_exports.string().optional(),by:external_exports.string().optional(),all:external_exports.coerce.boolean().optional()}),SyncBody=external_exports.object({target:external_exports.string().min(3).max(300)}),InboxQuery=external_exports.object({channel:external_exports.string().optional(),limit:external_exports.coerce.number().int().min(1).max(500).optional()}),Registering=external_exports.object({watch:external_exports.record(external_exports.string().max(100),external_exports.object({tail:external_exports.string().max(1e3),when:external_exports.enum(["matches","enters"]).default("matches")})).refine(watch=>Object.keys(watch).length<=32,"a board registers at most 32 watchers"),sync:external_exports.array(external_exports.object({key:external_exports.string().min(1).max(64),platform:external_exports.string().min(1).max(64),signIn:external_exports.boolean().default(!1)})).max(32).optional()}),RegisterBody=external_exports.union([Registering.extend({url:external_exports.string().url().max(500).refine(url=>/^https:\/\//.test(url),"wake-ups go over https").transform(url=>url.replace(/\/+$/,"")).nullable().optional(),path:external_exports.null({error:"register a url or a path, not both"}).optional(),branch:external_exports.null({error:"a branch goes with a path"}).optional()}),Registering.extend({url:external_exports.null({error:"register a url or a path, not both"}).optional(),path:external_exports.string().max(300).regex(/^\/[^?#]*$/,"a path starts with / and has no query or fragment").transform(path=>path.replace(/(.)\/+$/,"$1")),branch:external_exports.string().min(1).max(255).nullable().optional()})]),MatchesQuery=external_exports.object({limit:external_exports.coerce.number().int().min(1).max(50).optional(),wait:external_exports.coerce.number().min(0).max(25).optional()}),AckBody=external_exports.object({lease:external_exports.string().min(1).max(64),error:external_exports.string().min(1).max(500).optional(),skip:external_exports.boolean().optional()}),SourceReadQuery=external_exports.object({target:external_exports.string().min(1).max(4e3),limit:external_exports.coerce.number().int().min(1).max(200).optional(),after:external_exports.string().min(1).max(400).optional()}),SourceJoinBody=external_exports.object({target:external_exports.string().min(1).max(4e3)}),LinkedQuery=external_exports.object({url:external_exports.string().url().max(4e3)}),IdentityUnlinkBody=external_exports.object({actor:external_exports.string().min(1).max(256)}),SyncKey=external_exports.string().min(1).max(64),ImportOrigin=external_exports.object({thread:ExternalTarget,message:external_exports.string().min(1).max(300).optional()}),ImportLink=Link.extend({message:Ref.nullable()}),PlatformUser=ExternalAuthor.extend({avatar:external_exports.string().nullable().transform(platformAvatar)}),Imported={author:PlatformUser,from:SyncKey.nullable()},ImportSource=external_exports.object({key:SyncKey,channel:ExternalTarget,thread:ExternalTarget}),Changed={origin:ImportOrigin.optional(),message:Ref.optional()},SyncImportBody=external_exports.discriminatedUnion("op",[external_exports.object({op:external_exports.literal("post"),...Imported,origin:Origin.nullable().default(null),source:ImportSource.optional(),channel:ChannelPath.optional(),re:Ref.optional(),text:external_exports.string().max(MESSAGE_TEXT_MAX).default(""),labels:Labels.optional(),noSync:external_exports.boolean().optional(),attachments:external_exports.array(AttachmentId).max(10).optional(),links:external_exports.array(ImportLink).max(10).optional(),id:external_exports.string().min(1).max(200).refine(storable,"id has a NUL character or a lone surrogate").optional(),after:Ref.optional()}),external_exports.object({op:external_exports.literal("edit"),...Imported,...Changed,text:MessageText,source:ImportSource.optional(),revision:Revision.optional()}),external_exports.object({op:external_exports.literal("delete"),...Imported,...Changed,revision:Revision.optional()}),external_exports.object({op:external_exports.literal("react"),...Imported,...Changed,emoji:Emoji,remove:external_exports.boolean().optional()}),external_exports.object({op:external_exports.literal("labels"),...Imported,...Changed,set:Labels.optional(),unset:external_exports.array(LabelKey).optional(),if:external_exports.record(LabelKey,LabelValue.nullable()).optional()}),external_exports.object({op:external_exports.literal("links"),...Imported,...Changed,links:external_exports.array(ImportLink).max(10)}),external_exports.object({op:external_exports.literal("seen"),author:PlatformUser})]),PlatformFiles=external_exports.array(external_exports.string().min(1).max(300)).max(10).nullable(),SyncReceiptBody=external_exports.discriminatedUnion("kind",[external_exports.object({kind:external_exports.literal("message"),message:Ref,target:ExternalTarget,external:external_exports.object({thread:ExternalTarget,message:external_exports.string().min(1).max(300),asUser:external_exports.literal(!0).optional()}),files:PlatformFiles.optional()}),external_exports.object({kind:external_exports.literal("files"),message:Ref,target:ExternalTarget,files:PlatformFiles}),external_exports.object({kind:external_exports.literal("failed"),message:Ref,target:ExternalTarget,error:external_exports.string().min(1).max(500)}),external_exports.object({kind:external_exports.literal("thread"),message:Ref,target:ExternalTarget,targetKind:external_exports.enum(["channel","thread"]),cause:external_exports.enum(["config","request"])})]),SyncFindQuery=external_exports.object({code:external_exports.string().min(1).max(64).optional(),post:external_exports.string().min(1).max(200).optional(),thread:ExternalTarget.optional(),message:external_exports.string().min(1).max(300).optional(),account:ActorId.optional(),person:ActorId.optional()}),SyncCopiesQuery=external_exports.object({message:repeated.pipe(external_exports.array(Ref).min(1).max(100))}),SyncRootsQuery=external_exports.object({by:ActorId,since:external_exports.coerce.number().int().nonnegative()}),InboxPushBody=external_exports.object({events:external_exports.array(external_exports.object({id:external_exports.string().min(1).max(300),event:ExternalEvent,raw:external_exports.unknown()})).min(1).max(50)}),InboxNextQuery=external_exports.object({limit:external_exports.coerce.number().int().min(1).max(50).optional()}),InboxAckBody=external_exports.object({lease:external_exports.string().min(1).max(64),error:external_exports.string().min(1).max(500).optional()}),SyncCodeBody=external_exports.object({sync:SyncKey}),SyncAccountBody=external_exports.object({sync:SyncKey,account:PlatformUser,code:external_exports.string().min(1).max(64),message:external_exports.string().max(1024).optional(),method:external_exports.enum(["code","consent"]).optional()}),SignInQuery=external_exports.object({sync:SyncKey,code:external_exports.string().min(1).max(64)}),SyncUnlinkBody=external_exports.object({account:ActorId}),UploadStartBody=external_exports.object({name:external_exports.string().max(1024).nullable().optional(),type:external_exports.string().max(1024).nullable().optional(),size:external_exports.number().int().positive().max(104857600,`direct uploads are at most ${104857600/1024/1024} MB`),sha256:external_exports.string().regex(/^[A-Za-z0-9+/]{43}=$/,"sha256 is the base64 SHA-256 of the bytes").optional()}),EditBody=external_exports.object({text:MessageText,revision:Revision.optional()}),DeleteBody=external_exports.object({revision:Revision.optional()}).optional(),TypingBody=external_exports.object({status:external_exports.string().trim().min(1).max(100).optional()}).optional(),ReactBody=external_exports.object({emoji:Emoji,remove:external_exports.boolean().optional()}),LabelBody=external_exports.object({set:Labels.optional(),unset:external_exports.array(LabelKey).optional(),if:external_exports.record(LabelKey,LabelValue.nullable()).refine(expected=>Object.keys(expected).length<=16,"at most 16 labels").optional()}).refine(body=>body.set!==void 0||body.unset!==void 0,{message:"nothing to change: pass `set` or `unset`"}),routes={discovery:{method:"GET",path:"/"},me:{method:"GET",path:"/me"},channels:{method:"GET",path:"/channels"},actors:{method:"GET",path:"/actors"},messages:{method:"GET",path:"/messages",query:MessagesQuery},message:{method:"GET",path:"/messages/:id"},threads:{method:"GET",path:"/threads",query:ThreadsQuery},post:{method:"POST",path:"/messages",body:PostBody},edit:{method:"POST",path:"/messages/:id/edit",body:EditBody},delete:{method:"POST",path:"/messages/:id/delete",body:DeleteBody},react:{method:"POST",path:"/messages/:id/reactions",body:ReactBody},label:{method:"POST",path:"/messages/:id/labels",body:LabelBody},sync:{method:"POST",path:"/messages/:id/sync",body:SyncBody},synced:{method:"GET",path:"/messages/:id/sync"},linked:{method:"GET",path:"/links",query:LinkedQuery},typing:{method:"POST",path:"/messages/:id/typing",body:TypingBody},schedule:{method:"POST",path:"/schedules",body:ScheduleBody},schedules:{method:"GET",path:"/schedules",query:SchedulesQuery},cancelSchedule:{method:"POST",path:"/schedules/:id/cancel"},posted:{method:"GET",path:"/posts/:id"},inbox:{method:"GET",path:"/inbox/:key",query:InboxQuery},inboxPush:{method:"POST",path:"/inbox/:key",body:InboxPushBody},inboxNext:{method:"GET",path:"/inbox/:key/next",query:InboxNextQuery},inboxAck:{method:"POST",path:"/inbox/:key/:id/ack",body:InboxAckBody},syncImport:{method:"POST",path:"/sync/imports",body:SyncImportBody},syncReceipt:{method:"POST",path:"/sync/receipts",body:SyncReceiptBody},syncThread:{method:"GET",path:"/sync/threads/:thread"},syncFind:{method:"GET",path:"/sync/find",query:SyncFindQuery},syncCopies:{method:"GET",path:"/sync/copies",query:SyncCopiesQuery},syncRoots:{method:"GET",path:"/sync/roots",query:SyncRootsQuery},syncCode:{method:"POST",path:"/sync/codes",body:SyncCodeBody},syncAccount:{method:"POST",path:"/sync/accounts",body:SyncAccountBody},syncUnlink:{method:"POST",path:"/sync/accounts/unlink",body:SyncUnlinkBody},readSource:{method:"GET",path:"/sources/:key/read",query:SourceReadQuery},joinSource:{method:"POST",path:"/sources/:key/join",body:SourceJoinBody},webhook:{method:"POST",path:"/webhooks/:key"},events:{method:"GET",path:"/events",query:EventsQuery},avatar:{method:"GET",path:"/avatars/:name"},upload:{method:"POST",path:"/attachments"},attachment:{method:"GET",path:"/attachments/:id"},uploadStart:{method:"POST",path:"/attachments/uploads",body:UploadStartBody},uploadFinish:{method:"POST",path:"/attachments/uploads/:id"},openapi:{method:"GET",path:"/openapi.json"},identity:{method:"GET",path:"/identity"},signIn:{method:"GET",path:"/identity/sign-in",query:SignInQuery},signedIn:{method:"GET",path:"/identity/signed-in",query:SignInQuery},identityUnlink:{method:"POST",path:"/identity/unlink",body:IdentityUnlinkBody},watchers:{method:"GET",path:"/watchers"},register:{method:"POST",path:"/watchers",body:RegisterBody},matches:{method:"GET",path:"/watchers/matches",query:MatchesQuery},ack:{method:"POST",path:"/watchers/matches/:id/ack",body:AckBody},wake:{method:"POST",path:"/wake"}},SYNC="@sync",VERSION="0.30.0",BOARD_ROUTES=["avatar","openapi","webhook","signIn","signedIn","identityUnlink","sync"],METHODS=["discovery","me","channels","actors","identity","messages","threads","message","post","posted","edit","delete","react","label","schedule","schedules","cancelSchedule","upload","attachment","uploadStart","uploadFinish","watchers","register","matches","ack","events","syncImport","syncReceipt","syncThread","syncFind","syncCopies","syncRoots","inboxPush","inboxNext","inboxAck","inbox","syncCode","syncAccount","syncUnlink","typing","readSource","joinSource","synced","linked"],escape=literal=>literal.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function compile(method,path,target,own2){let parts=path.split("/").filter(Boolean),source=parts.map(part=>part.startsWith(":")?"/([^/]+)":`/${escape(part)}`).join("");return{method,pattern:new RegExp(`${source}$`),names:parts.filter(part=>part.startsWith(":")).map(part=>part.slice(1)),target,segments:parts.length,literals:parts.filter(part=>!part.startsWith(":")).length,own:own2}}function createRouter(backendRoutes,basePath){let patterns=[...BOARD_ROUTES.map(name=>compile(routes[name].method,routes[name].path,{kind:"board",name},!1)),...METHODS.filter(name=>name!=="discovery").map(name=>compile(routes[name].method,routes[name].path,{kind:"protocol",name},!1)),...backendRoutes.map(route=>compile(route.method,route.path,{kind:"backend",route},!0))].sort((a,b)=>b.segments-a.segments||b.literals-a.literals||Number(b.own)-Number(a.own)),found=(candidate,base,values)=>{let params={};try{candidate.names.forEach((name,i)=>params[name]=decodeURIComponent(values[i]))}catch{return null}let first=candidate.names[0];return{target:candidate.target,base,param:first===void 0?null:params[first],params}},discovery=base=>({target:{kind:"protocol",name:"discovery"},base,param:null,params:{},root:!0});return function(method,pathname){let path=pathname.length>1?pathname.replace(/\/+$/,""):pathname;if(basePath!==void 0){let base=basePath.replace(/\/+$/,"");if(path!==base&&!path.startsWith(`${base}/`))return null;let rest=path.slice(base.length)||"/";if(rest==="/")return method==="GET"?discovery(base):null;for(let candidate of patterns){let hit=candidate.method===method?rest.match(new RegExp(`^${candidate.pattern.source}`)):null;if(hit)return found(candidate,base,hit.slice(1))}return null}for(let candidate of patterns){if(candidate.method!==method)continue;let hit=path.match(candidate.pattern);if(hit)return found(candidate,path.slice(0,hit.index),hit.slice(1))}return method==="GET"?discovery(path==="/"?"":path):null}}function queryObject(url){let out2={};for(let key of new Set(url.searchParams.keys())){let values=url.searchParams.getAll(key);out2[key]=values.length>1?values:values[0]}return out2}async function readJson(request){let text2=await request.text();if(text2.trim()!=="")try{return JSON.parse(text2)}catch{throw badRequest("request body is not valid JSON")}}var tooLarge=()=>new HttpError(413,"too_large",`attachments are at most ${4194304/1024/1024} MB`);async function readCapped(request,max){if(Number(request.headers.get("content-length")??0)>max)throw tooLarge();let chunks=[],size=0;for await(let chunk of request.body??[]){if(size+=chunk.byteLength,size>max)throw tooLarge();chunks.push(chunk)}let body=new Uint8Array(size),at=0;for(let chunk of chunks)body.set(chunk,at),at+=chunk.byteLength;return body}function openapi(){let paths={};for(let[name,definition]of Object.entries(routes)){let path=definition.path.replace(/:(\w+)/g,"{$1}"),operation={operationId:name};"query"in definition&&(operation["x-query-schema"]=external_exports.toJSONSchema(definition.query,{io:"input"})),"body"in definition&&(operation.requestBody={content:{"application/json":{schema:external_exports.toJSONSchema(definition.body,{io:"input"})}}}),(paths[path]??={})[definition.method.toLowerCase()]=operation}return{openapi:"3.1.0",info:{title:"board",version:VERSION},paths}}var FILTER_FLAGS={re:options.re,by:options.by,mentions:options.mentions,label:options.label,source:options.source,text:options.text};function withMentions(args){let out2=[];for(let i=0;i<args.length;i++){let arg=args[i];arg!=="--mentions"?out2.push(arg):args[i+1]?.startsWith("@")?out2.push(`--mentions=${args[++i]}`):out2.push("--mentions=me")}return out2}function words(expression){let out2=[],word=null,quote=null;for(let i=0;i<expression.length;i++){let char=expression[i];quote?char===quote?quote=null:char==="\\"&"e==='"'&&i+1<expression.length?word+=expression[++i]:word+=char:/\s/.test(char)?(word!==null&&out2.push(word),word=null):char==='"'||char==="'"?(quote=char,word??=""):char==="\\"&&i+1<expression.length?word=(word??"")+expression[++i]:word=(word??"")+char}if(quote)throw new Error(`unterminated ${quote}`);return word!==null&&out2.push(word),out2}var TAIL_FLAGS={...FILTER_FLAGS,all:{type:"boolean"}};function parseFilterFlags(args){let values={},positionals2=[];for(let i=0;i<args.length;i++){let arg=args[i];if(arg==="--"){positionals2.push(...args.slice(i+1));break}if(!arg.startsWith("-")||arg==="-"){positionals2.push(arg);continue}let eq=arg.indexOf("="),name=arg.startsWith("--")?arg.slice(2,eq===-1?void 0:eq):null,spec=name!==null&&Object.hasOwn(TAIL_FLAGS,name)?TAIL_FLAGS[name]:null;if(!spec)throw new Error(`${name!==null?`--${name}`:arg.slice(0,2)} isn't a filter`);if(spec.type==="boolean"){if(eq!==-1)throw new Error(`--${name} takes no value`);values[name]=!0;continue}let value;if(eq!==-1)value=arg.slice(eq+1);else{let next=args[i+1];if(next===void 0||next.length>1&&next.startsWith("-"))throw new Error(`--${name} needs a value`);value=next,i++}"multiple"in spec?values[name]=[...values[name]??[],value]:values[name]=value}return{values,positionals:positionals2}}function parseWatchTail(expression){let{values,positionals:positionals2}=parseFilterFlags(withMentions(words(expression)));if(positionals2.length>1)throw new Error(`expected one channel, got: ${positionals2.join(" ")}`);let channel=positionals2[0],parsed=Filters.safeParse({...channel?{channel}:{},...values.re?{re:values.re.replace(/^#/,"")}:{},...values.by?{by:values.by.replace(/^@/,"")}:{},...values.mentions?{mentions:values.mentions.replace(/^@/,"")}:{},...values.label?.length?{label:values.label}:{},...values.source?{from:values.source}:{},...values.text?{text:values.text}:{}});if(!parsed.success){let issue=parsed.error.issues[0];throw new Error(`${issue?.path.length?`--${String(issue.path[0])}: `:""}${issue?.message??"invalid filters"}`)}return{filters:parsed.data,all:values.all===!0}}var hasCriteria=filters3=>filters3.channel!==void 0||filters3.re!==void 0||filters3.by!==void 0||filters3.mentions!==void 0||filters3.from!==void 0||filters3.text!==void 0||(filters3.label?.length??0)>0;function compileWatcher(id2,spec){let filters3,all;try{({filters:filters3,all}=parseWatchTail(spec.tail))}catch(error){throw new Error(`watch ${id2}: ${error.message}`)}if(filters3.mentions==="me")throw new Error(`watch ${id2}: a watcher has no "me": use --mentions @handle`);let criteria=hasCriteria(filters3);if(spec.when==="enters"&&!criteria)throw new Error(`watch ${id2}: \`when: enters\` needs a filter to enter`);return{filters:filters3,criteria,enters:spec.when==="enters",all}}var byCodeUnit=(a,b)=>a<b?-1:a>b?1:0;function canonicalWatchers(watch,sync=[]){let canonical2=Object.keys(watch).sort(byCodeUnit).map(id2=>[id2,watch[id2].tail,watch[id2].when]);return sync.length>0&&canonical2.push(["sync",[...sync].sort((a,b)=>byCodeUnit(a.key,b.key)).map(entry=>[entry.key,entry.platform,entry.signIn])]),JSON.stringify(canonical2)}import{execFile}from"node:child_process";import{createHash}from"node:crypto";import{mkdir,readFile,readdir,stat,unlink,writeFile}from"node:fs/promises";import{existsSync,readFileSync,statSync}from"node:fs";import{homedir}from"node:os";import{dirname,join,resolve}from"node:path";import{promisify}from"node:util";var import_oidc=__toESM(require_dist(),1),configDir=()=>join(process.env.XDG_CONFIG_HOME||join(homedir(),".config"),"board");function isCheckout(directory){let git=join(directory,".git");try{return statSync(git).isDirectory()?existsSync(join(git,"HEAD")):readFileSync(git,"utf8").startsWith("gitdir:")}catch{return!1}}function vercelProjectFile(cwd=process.cwd()){let directory=resolve(cwd);for(;;){let file=join(directory,".vercel","project.json");if(existsSync(file))return file;let parent=dirname(directory);if(isCheckout(directory)||parent===directory)return null;directory=parent}}var LOOPBACK=new Set(["127.0.0.1","localhost","[::1]"]),PROJECT_ID=/^prj_[A-Za-z0-9]{1,64}$/,URL_SHAPE=/^https?:\/\/[A-Za-z0-9.-]{1,253}(:\d{1,5})?(\/[A-Za-z0-9._~%/-]{0,2000})?$/,shown=(value,shape)=>typeof value=="string"&&shape.test(value)?value:void 0;function localTokenFile(url){let normalized=url.replace(/\/+$/,"");return join(configDir(),"local",`${createHash("sha256").update(normalized).digest("hex").slice(0,32)}.json`)}function localToken(url){try{if(!LOOPBACK.has(new URL(url).hostname))return null;let saved=JSON.parse(readFileSync(localTokenFile(url),"utf8"));return saved.url!==url.replace(/\/+$/,"")||typeof saved.token!="string"?null:{token:saved.token,handle:saved.handle??null}}catch{return null}}function detectAgent(env=process.env){let found=[];(env.CLAUDECODE==="1"||env.CLAUDE_CODE_SESSION_ID)&&found.push({profile:"claude",session:env.CLAUDE_CODE_SESSION_ID||null}),(env.CODEX_THREAD_ID||env.CODEX_SESSION_ID)&&found.push({profile:"codex",session:env.CODEX_THREAD_ID||env.CODEX_SESSION_ID||null}),env.GROK_SESSION_ID&&found.push({profile:"grok",session:env.GROK_SESSION_ID}),env.CURSOR_AGENT==="1"&&found.push({profile:"cursor",session:null}),(env.PI_CODING_AGENT==="true"||env.AI_AGENT==="pi")&&found.push({profile:"pi",session:env.PI_SESSION_ID||null});let named2=env.AI_AGENT?.trim().toLowerCase();if(named2&&/^[a-z][a-z0-9-]{0,31}$/.test(named2)&&!found.some(agent=>agent.profile===named2)&&found.push({profile:named2,session:null}),found.length>1)throw new BoardError("ambiguous_agent",`Several coding agents' environments are set (${found.map(a=>a.profile).join(", ")}), so it can't tell which one is writing.`,0,{hint:"Pick one with a profile, or none to write as yourself."});return found[0]??null}var expiry=token2=>{try{let{exp}=decodeJwt(token2);return exp?exp*1e3:Date.now()+3e5}catch{return Date.now()+3e5}},cacheFile=(audience,login)=>{let key=login?`${audience}
|
|
9
9
|
${login}`:audience;return join(configDir(),"tokens",`${createHash("sha256").update(key).digest("hex").slice(0,32)}.json`)};async function readCache(audience,login){try{let cached=JSON.parse(await readFile(cacheFile(audience,login),"utf8"));return cached.expiresAt-3e5>Date.now()?cached:null}catch{return null}}async function writeCache(audience,login,cached){let tokens=join(configDir(),"tokens");await mkdir(tokens,{recursive:!0,mode:448}),await writeFile(cacheFile(audience,login),JSON.stringify(cached),{mode:384});let dead=Date.now()-864e5;for(let name of await readdir(tokens).catch(()=>[])){let file=join(tokens,name),written=(await stat(file).catch(()=>null))?.mtimeMs;written!==void 0&&written<dead&&await unlink(file).catch(()=>{})}}var handed=null;function handLogin(login){handed=login}var handedFetch=null;function handFetch(send){handedFetch=send}function asYou(input,init,login,send=fetch){if(handedFetch&&loginHanded())return handedFetch(input,init);let headers=new Headers(input instanceof Request?input.headers:void 0);return new Headers(init.headers).forEach((value,name)=>headers.set(name,value)),headers.set("authorization",`Bearer ${login}`),send(input,{...init,headers})}var loginHanded=()=>handed!==null||!!process.env.VERCEL_AUTH_TOKEN,vercelLogin=()=>handed?handed():process.env.VERCEL_AUTH_TOKEN?Promise.resolve(process.env.VERCEL_AUTH_TOKEN):(0,import_oidc.getVercelToken)();async function handedToken(){if(!loginHanded())return null;try{return await vercelLogin()}catch{throw new BoardError("not_logged_in","You're not logged in to Vercel.",0,{hint:"Run vercel login."})}}var apiLogin=async handed3=>handed3??await(0,import_oidc.getVercelToken)().catch(()=>null);async function personToken(audience,discovery){let login=await handedToken(),cached=await readCache(audience,login);if(cached&&cached.name===void 0){let authToken2=await apiLogin(login),user2=authToken2?await vercelUser(authToken2):null,filled={...cached,name:user2?.name??null,avatar:user2?.avatar??null};return await writeCache(audience,login,filled).catch(()=>{}),filled}if(cached)return cached;if(!discovery.project_id)throw new BoardError("no_project",`The board at ${audience} doesn't know its Vercel project, so there's no Vercel login token to mint for it.`,0,{hint:"Pass a token it accepts in BOARD_TOKEN."});let authToken=await apiLogin(login),project=await boardProject(audience,discovery,authToken),development;try{if(!authToken)throw new Error("no Vercel CLI credentials file");let response=await asYou(`https://api.vercel.com/v1/projects/${project.id}/token?source=board${project.team?`&teamId=${project.team}`:""}`,{method:"POST"},authToken);if(response.status===403||response.status===404)throw new BoardError("no_access","Your Vercel account can't access this board's project.",response.status,{hint:"Ask someone on the project's team for access to it."});if(!response.ok)throw new Error(`${response.status} ${response.statusText}`);development=(await response.json()).token}catch(error){if(error instanceof BoardError||login)throw error;development=await tokenFromVercelCli(project)}let token2=await(0,import_oidc.exchangeVercelOidcToken)({token:development,audience}),user=authToken?await vercelUser(authToken):null,fresh={token:token2,expiresAt:expiry(token2),handle:user?.handle??null,name:user?.name??null,avatar:user?.avatar??null};return await writeCache(audience,login,fresh).catch(()=>{}),fresh}async function boardProject(url,discovery,authToken){let{host,hostname}=new URL(url);if(LOOPBACK.has(hostname))return{id:discovery.project_id,team:discovery.team_id};let found=await findProject(authToken?async(method,path)=>{let response=await asYou(`https://api.vercel.com${path}`,{method},authToken);return response.ok?await response.json():null}:vercelCliApi,host);if(!found)throw new BoardError("no_access",`Your Vercel login can't see the project ${host} belongs to.`,0,{hint:"Log in as someone on the project's team (vercel login), or ask for access to it."});if(found.projectId!==discovery.project_id)throw new BoardError("wrong_project",`The board at ${url} says its project is ${shown(discovery.project_id,PROJECT_ID)??"another one"}, but it's a deployment of ${found.projectId}, so no token is minted for it.`,0);return{id:found.projectId,team:found.ownerId.startsWith("team_")?found.ownerId:null}}async function tokenFromVercelCli(project){let args=["project","token",project.id,"--format=json"];project.team&&args.push("--scope",project.team);try{let{stdout}=await promisify(execFile)("vercel",args,{timeout:3e4});return JSON.parse(stdout).token}catch{throw new BoardError("not_logged_in","You're not logged in to Vercel.",0,{hint:"Run vercel login."})}}async function vercelUser(authToken){try{let response=await asYou("https://api.vercel.com/v2/user",{},authToken);if(!response.ok)return null;let{user}=await response.json();return{handle:user?.username?.toLowerCase()??null,name:user?.name?.trim()||null,avatar:user?.avatar&&/^[0-9a-f]+$/i.test(user.avatar)?`https://vercel.com/api/www/avatar/${user.avatar}?s=128`:null}}catch{return null}}async function githubActionsToken(audience){let url=new URL(process.env.ACTIONS_ID_TOKEN_REQUEST_URL);url.searchParams.set("audience",audience);let response=await fetch(url,{headers:{authorization:`bearer ${process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN}`}});if(!response.ok)throw new BoardError("no_token",`GitHub Actions refused an OIDC token (${response.status}).`,0,{hint:"Give the job `permissions: id-token: write`."});return(await response.json()).value}function boardUrl(){let url=process.env.BOARD_URL?.replace(/\/+$/,"");if(!url)throw new BoardError("no_board","There's no board URL: BOARD_URL isn't set.",0,{hint:"Set BOARD_URL, or pass the URL to http()."});return url}function connect(url,options2={}){url=url.replace(/\/+$/,"");let doFetch=guarded(url,options2.fetch??((input,init)=>globalThis.fetch(input,init)),options2.token),discovery,discover=()=>discovery??=doFetch(url).then(async response=>{if(!response.ok)throw new BoardError("no_board",`There's no board at ${url}: it answered ${response.status}.`,response.status);let found=await response.json();if(found.audience!==url)throw new BoardError("wrong_audience",`The board at ${url} says its URL is ${shown(found.audience,URL_SHAPE)??"another one"}.`,0,{hint:shown(found.audience,URL_SHAPE)?`Use ${found.audience}.`:"Use the URL its discovery names."});return found}),cached=null,source=null,person=null,mint=async()=>{if(options2.token!==void 0){let token3=typeof options2.token=="function"?await options2.token():options2.token;return{token:token3,expiresAt:expiry(token3)}}if(process.env.BOARD_TOKEN){let token3=process.env.BOARD_TOKEN;return source="BOARD_TOKEN",{token:token3,expiresAt:expiry(token3)}}let local=localToken(url);if(local)return source="vb serve",{token:local.token,expiresAt:expiry(local.token),handle:local.handle,name:null,avatar:null};let discovered=await discover();if(process.env.ACTIONS_ID_TOKEN_REQUEST_URL&&process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN){let token3=await githubActionsToken(url);return source="GitHub Actions OIDC",{token:token3,expiresAt:expiry(token3)}}if(process.env.VERCEL==="1"){let token3=await hostedToken(url);return source="Vercel OIDC",{token:token3,expiresAt:expiry(token3)}}person??=personToken(url,discovered).finally(()=>{person=null});let minted=await person;return source="vercel login",minted},token2=async()=>((options2.token!==void 0||!cached||cached.expiresAt-6e4<Date.now())&&(cached=await mint()),cached.token);return{fetch:async(input,init={})=>{let href=input instanceof Request?input.url:String(input),method=(init.method??(input instanceof Request?input.method:"GET")).toUpperCase(),path=(href.startsWith(url)?href.slice(url.length):new URL(href).pathname).split("?")[0]||"/",headers=new Headers(init.headers??(input instanceof Request?input.headers:void 0));if(!(method==="GET"&&path==="/")){headers.has("authorization")||headers.set("authorization",`Bearer ${await token2()}`);let handle=options2.handle??(process.env.BOARD_HANDLE||(options2.token===void 0?cached?.handle:null));handle&&!headers.has("x-board-handle")&&headers.set("x-board-handle",handle),!headers.has("x-board-profile")&&options2.token===void 0&&(cached?.name&&!headers.has("x-board-name")&&headers.set("x-board-name",encodeURIComponent(cached.name)),cached?.avatar&&!headers.has("x-board-avatar")&&headers.set("x-board-avatar",cached.avatar))}return doFetch(input,{...init,headers})},source:()=>source}}function environmentProfile(){let detected=detectAgent(),name=process.env.BOARD_AS||detected?.profile,avatar=process.env.BOARD_AVATAR;return{profile:name?avatar?{name,avatar}:name:null,session:detected?.session??null}}var WHERE="Project \u2192 Settings \u2192 Deployment Protection \u2192 Protection Bypass for Automation",Wall=class extends Error{status;constructor(status){super("protected"),this.status=status}},Moved=class extends Error{origin;status;constructor(origin,status){super("moved"),this.origin=origin,this.status=status}};async function hostedToken(url){try{return await(0,import_oidc.getVercelOidcToken)({audience:url})}catch(cause){throw Object.assign(new BoardError("no_token",`This deployment can't get a Vercel OIDC token for ${url}.`,0,{hint:"Enable OIDC on its project, or pass a token (BOARD_TOKEN), and add its project to the board project's Deployment Protection Trusted Sources."}),{cause})}}var ownHost=host=>[process.env.VERCEL_URL,process.env.VERCEL_BRANCH_URL,process.env.VERCEL_PROJECT_PRODUCTION_URL].some(own2=>!!own2&&own2.toLowerCase()===host.toLowerCase());function guarded(url,doFetch,suppliedToken){let host=new URL(url).host,secret,looked,envRejected=!1;return(input,init)=>attempt(input,init).catch(error=>{if(!(error instanceof Moved))throw error;let there=shown(`${error.origin}${new URL(url).pathname}`,URL_SHAPE);throw new BoardError("redirected",`${url} redirects to ${there?new URL(there).origin:"another origin"}, and its credentials don't follow it there, so Deployment Protection turns it away.`,error.status,{hint:there?`Use ${there}.`:"Use the URL it redirects to."})});async function attempt(input,init={}){let headers=new Headers(init.headers??(input instanceof Request?input.headers:void 0));init={...init,headers};let fromEnv=process.env.VERCEL_AUTOMATION_BYPASS_SECRET;if(fromEnv&&!envRejected&&(process.env.VERCEL!=="1"||ownHost(host)))try{return await through(doFetch,input,init,fromEnv)}catch(error){if(!(error instanceof Wall))throw error;if(process.env.VERCEL!=="1")throw new BoardError("protected",`${url} is behind Vercel Deployment Protection, and it rejected VERCEL_AUTOMATION_BYPASS_SECRET.`,error.status,{hint:`Check VERCEL_AUTOMATION_BYPASS_SECRET against ${WHERE}.`});envRejected=!0}if(process.env.VERCEL==="1"){if(!headers.has("x-vercel-trusted-oidc-idp-token")){let token2=headers.get("authorization")?.match(/^Bearer (.+)$/i)?.[1]??(typeof suppliedToken=="function"?await suppliedToken():suppliedToken)??(process.env.BOARD_TOKEN||await hostedToken(url));headers.set("x-vercel-trusted-oidc-idp-token",token2)}return through(doFetch,input,init,null).catch(error=>{throw error instanceof Wall?new BoardError("protected",`${url} is behind Vercel Deployment Protection, and it rejected this deployment's Vercel OIDC token.`,error.status,{hint:"Add this project and environment to the board project's Deployment Protection Trusted Sources."}):error})}let used=await(secret??=readBypass(host));try{return await through(doFetch,input,init,used)}catch(error){if(!(error instanceof Wall))throw error}looked??=projectBypass(url,host,doFetch).then(async found2=>(await writeBypass(host,found2.secret).catch(()=>{}),found2));let{secret:found,created}=await looked;secret=Promise.resolve(found);try{return await through(doFetch,input,init,found).catch(async error=>{if(!(error instanceof Wall)||!created)throw error;return await new Promise(resolve2=>setTimeout(resolve2,1e3)),through(doFetch,input,init,found)})}catch(error){throw error instanceof Wall?new BoardError("protected",`${url} is behind Vercel Deployment Protection, and its project's automation bypass didn't get through.`,error.status,{hint:`Set VERCEL_AUTOMATION_BYPASS_SECRET (${WHERE}).`}):error}}}async function through(doFetch,input,init,bypass){let target=typeof input=="string"?input:input instanceof URL?input.href:input.url,method=(init.method??(input instanceof Request?input.method:"GET")).toUpperCase(),headers=new Headers(init.headers??(input instanceof Request?input.headers:void 0));bypass&&headers.set("x-vercel-protection-bypass",bypass);let moved=null,wall=status=>moved?new Moved(moved,status):new Wall(status);for(let hops=0;;hops++){let response=await doFetch(hops===0?input:target,{...init,headers,redirect:"manual"}),location=response.status>=300&&response.status<400?response.headers.get("location"):null;if(location){let next=new URL(location,target);if(next.pathname.startsWith("/sso-api"))throw wall(response.status);if(method==="GET"||method==="HEAD"){if(hops>=20)throw new BoardError("too_many_redirects",`${target} redirected more than 20 times.`,response.status);next.origin!==new URL(target).origin&&(moved=next.origin,headers=new Headers(headers),headers.delete("authorization"),headers.delete("x-vercel-trusted-oidc-idp-token"),headers.delete("x-vercel-protection-bypass")),target=next.href;continue}}let{status}=response;if(/^text\/html\b/i.test(response.headers.get("content-type")??"")&&!response.headers.has("content-disposition")&&(status>=200&&status<300||status===401||status===403)||status===401&&response.headers.has("x-vercel-error"))throw wall(status);return response}}var bypassFile=host=>join(configDir(),"bypass",`${createHash("sha256").update(host).digest("hex").slice(0,32)}.json`);async function readBypass(host){try{return JSON.parse(await readFile(bypassFile(host),"utf8")).secret||null}catch{return null}}async function writeBypass(host,secret){await mkdir(join(configDir(),"bypass"),{recursive:!0,mode:448}),await writeFile(bypassFile(host),JSON.stringify({host,secret}),{mode:384})}var automationBypass=bypasses=>Object.entries(bypasses??{}).find(([,value])=>value.scope==="automation-bypass")?.[0]??null;async function projectBypass(url,host,doFetch){let blocked=(why,fix)=>new BoardError("protected",`${url} is behind Vercel Deployment Protection, and your Vercel login ${why}.`,0,{hint:`${fix}, or set VERCEL_AUTOMATION_BYPASS_SECRET (${WHERE}).`}),token2=await apiLogin(await handedToken()),api=token2?async(method,path)=>{let response=await asYou(`https://api.vercel.com${path}`,{method,...method==="PATCH"?{headers:{"content-type":"application/json"},body:"{}"}:{}},token2,doFetch);return response.ok?await response.json():null}:vercelCliApi,project=await findProject(api,host);if(!project)throw blocked("can't see its project","Log in as someone on its project's team (vercel login), ask for access");let scope=project.ownerId.startsWith("team_")?`?teamId=${project.ownerId}`:"",details=await api("GET",`/v9/projects/${project.projectId}${scope}`);if(!details)throw blocked("can't read its project's settings","Ask for access to its project");let existing=automationBypass(details.protectionBypass);if(existing)return{secret:existing,created:!1};if(!details.ssoProtection&&!details.passwordProtection&&!details.passport)throw new BoardError("no_board",`There's no board at ${url}: it answered with a web page, and its Vercel project isn't protected.`,0);let created=await api("PATCH",`/v1/projects/${project.projectId}/protection-bypass${scope}`),secret=automationBypass(created?.protectionBypass);if(!secret)throw blocked("can't read or create its project's automation bypass","Ask a project admin to create one");return process.stderr.write(`created a Protection Bypass for Automation on the Vercel project ${details?.name??project.projectId}
|
|
10
10
|
`),{secret,created:!0}}async function findProject(api,host){let lookup=async(kind,team2)=>{let found=await api("GET",`${kind==="deployment"?`/v13/deployments/${encodeURIComponent(host)}`:`/now/aliases/${encodeURIComponent(host)}`}${team2?`?teamId=${team2}`:""}`).catch(()=>null),owner=found?.ownerId??found?.team?.id??team2;return found?.projectId&&owner?{projectId:found.projectId,ownerId:owner}:null},own2=await lookup("deployment",null)??await lookup("alias",null);if(own2)return own2;let{teams}=await api("GET","/v2/teams?limit=100").catch(()=>null)??{},ids=(teams??[]).filter(team2=>!team2.limited).map(team2=>team2.id);for(let kind of["deployment","alias"])for(let i=0;i<ids.length;i+=8){let found=(await Promise.all(ids.slice(i,i+8).map(id2=>lookup(kind,id2)))).find(Boolean);if(found)return found}return null}var vercelCli,vercelCliApi=async(method,path)=>{if(vercelCli??=promisify(execFile)("vercel",["whoami","--non-interactive"],{timeout:1e4}).then(()=>!0,()=>!1),!await vercelCli)throw new BoardError("not_logged_in","You're not logged in to Vercel.",0,{hint:"Run vercel login."});let args=["api",path,"-X",method,"--raw","--non-interactive"];method==="PATCH"&&args.push("--input","-");try{let run2=promisify(execFile)("vercel",args,{timeout:3e4});return run2.child.stdin?.on("error",()=>{}),run2.child.stdin?.end(method==="PATCH"?"{}":""),JSON.parse((await run2).stdout)}catch(error){if(error.code==="ENOENT")throw new BoardError("not_logged_in","You're not logged in to Vercel.",0,{hint:"Run vercel login."});return null}};var REGISTER_EVERY_MS=1e4,DRAIN_MS=24e4,WAKE_ANSWER_MS=2e3,POLL_WAIT_S=25,describe$1=error=>((error instanceof Error?error.message:String(error))||"unknown error").slice(0,500),wakeable=here=>here?.startsWith("https://")?here:null;function wakePath(here){let env=typeof process<"u"&&process.env.VERCEL==="1"?process.env:null,environment3=env?.VERCEL_TARGET_ENV||env?.VERCEL_ENV,branch=environment3==="preview"&&env?.VERCEL_GIT_COMMIT_REF||null;return!here||environment3!=="production"&&!branch?null:{path:new URL(here).pathname,...branch?{branch}:{}}}function registrant(options2){let{registry,rethrow:rethrow2}=options2,bound=options2.binding,last=null,registering=null;async function register(here){let current2=await options2.hash();return last&&last.url===here&&last.result.hash===current2&&Date.now()-last.at<REGISTER_EVERY_MS?last.result:(registering??=options2.wakeAt(here).then(where=>registry.register(where)).then(result2=>(last={url:here,at:Date.now(),result:result2},result2)).finally(()=>{registering=null}),registering)}async function runOne(match){let outcome={};if(!bound().subscriptions[match.watcher])outcome={skip:!0};else try{await bound().run(match.watcher,match.event,{trigger:`watch:${match.watcher}:${match.id}`,attempt:match.attempt+1})}catch(error){console.error(`[board] watcher ${match.watcher} failed:`,error),outcome={error:describe$1(error)}}await registry.ack(match.id,{lease:match.lease,...outcome}).catch(error=>console.error("[board] couldn't ack a match:",describe$1(error)))}async function drain(){let ran=0,until2=Date.now()+DRAIN_MS;for(;Date.now()<until2;){let matches=await registry.matches({limit:10});if(matches.length===0)break;await Promise.all(matches.map(runOne)),ran+=matches.length}return ran+await bound().pull()}let polling=null;function poll(){if(polling)return;let controller=polling=new AbortController;(async()=>{for(let pause=1e3;!controller.signal.aborted;)try{await register(null);let matches=await registry.matches({limit:10,wait:POLL_WAIT_S,signal:controller.signal});await Promise.all(matches.map(runOne)),await bound().pull(),pause=1e3}catch(error){if(controller.signal.aborted)break;console.error(`[board] couldn't pull matches from ${options2.remote}:`,describe$1(error)),await new Promise(resolve2=>setTimeout(resolve2,pause)),pause=Math.min(pause*2,6e4)}})()}let started=null,failedAt=0;function start(){if(started)return started;if(!options2.hasWork()||Date.now()-failedAt<REGISTER_EVERY_MS)return Promise.resolve();let here=wakeable(bound().url());return!here&&typeof process<"u"&&process.env.VERCEL==="1"?Promise.resolve():(started=register(here).then(()=>{},error=>{started=null,failedAt=Date.now(),console.error(`[board] couldn't register with ${options2.remote}:`,describe$1(error))}),here||poll(),started)}return{start,routes:[{method:"POST",path:"/wake",async handle(request){started??=Promise.resolve();let stale=request.headers.get("x-board-watchers")!==await options2.hash(),running=(async()=>(stale&&await register(wakeable(bound().url())),drain()))();waitUntil(running.catch(error=>console.error("[board] couldn't run what woke it:",describe$1(error))));let timer,waited=new Promise(resolve2=>timer=setTimeout(()=>resolve2(null),WAKE_ANSWER_MS));try{let ran=await Promise.race([running.catch(rethrow2),waited]);return ran===null?new Response(null,{status:202}):json({ran})}finally{clearTimeout(timer)}}},{method:"POST",path:"/watchers",async handle(request,{caller}){if(caller)return options2.registerFor(caller,request);started??=Promise.resolve();let here=wakeable(bound().url()),registration=await register(here).catch(rethrow2);return here||poll(),json(registration)}}],registerNow:()=>register(wakeable(bound().url())),close:()=>{polling?.abort(),polling=null}}}var PROFILE=/^[A-Za-z][A-Za-z0-9-]{0,31}$/,PROFILE_RULE="ids start with a letter and use up to 32 letters, numbers, and hyphens",PROJECTS_OWN=new Set(["identity","edit","delete","schedule","cancelSchedule","upload","uploadStart","uploadFinish","watchers","register","matches","ack","syncImport","syncReceipt","syncThread","syncFind","syncCopies","syncRoots","inboxPush","inboxNext","inboxAck","inbox","syncCode","syncAccount","syncUnlink"]);function profileOf(handle){let name=handle.replace(/[^A-Za-z0-9-]+/g,"-").replace(/^-+|-+$/g,"");return/^[A-Za-z]/.test(name)||(name=`u-${name}`),name.slice(0,32).replace(/-+$/,"")}function callerProfile(handle,own2){let taken=new Set([...own2,"middleware","client"].map(name2=>name2.toLowerCase())),base=profileOf(handle),name=base;for(let n=2;taken.has(name.toLowerCase());n++)name=`${base.slice(0,31-String(n).length)}-${n}`;return name}function scopeOf(identity2){let{access}=identity2.principal;if(access.everywhere("manage"))return null;let entries=Object.entries(access.summary()).map(([pattern,permissions])=>`${pattern}=${permissions.join(",")}`);return entries.length>0?entries.join(";"):"*="}var describe=error=>((error instanceof Error?error.message:String(error))||"unknown error").slice(0,500),rethrow=error=>{throw error instanceof BoardError?new HttpError(error.status>=400?error.status:502,error.code,error.message,{...error.hint!==void 0?{hint:error.hint}:{},origin:error.origin}):error instanceof HttpError||error instanceof Error&&error.name==="AbortError"?error:new HttpError(502,"unreachable",`the board didn't answer: ${describe(error)}`)};function queryString(input){let params=new URLSearchParams;for(let[key,value]of Object.entries(input))if(!(value==null||value===!1))if(key==="label"&&Array.isArray(value))for(let[name,values]of value)params.append("label",values===null?name:`${name}=${values.join("|")}`);else if(Array.isArray(value))for(let item of value)params.append(key,String(item));else params.set(key,String(value));let text2=params.toString();return text2?`?${text2}`:""}function attachmentOf(id2,response){let encoded=(response.headers.get("content-disposition")??"").match(/filename\*=UTF-8''([^;]+)/)?.[1],name="file";try{encoded&&(name=decodeURIComponent(encoded))}catch{}return{attachment:{id:id2,name,type:response.headers.get("content-type")??"application/octet-stream",size:Number(response.headers.get("content-length")??0)},data:response.body??new Uint8Array}}function createHttp(url,options2,environment3){if(url!==void 0&&!/^https?:\/\/[^/]/.test(url))throw new Error(`http: ${url} isn't a URL: pass the board's, like https://board.example.com/api/board`);if(url===void 0&&!environment3)throw new Error("http: pass the board's URL: outside Node there's no environment to find it in");let remote=(url??environment3.url()).replace(/\/+$/,""),doFetch=options2.fetch??environment3?.fetch(remote)??((input,init)=>globalThis.fetch(input,init)),binding=null,specs={},sync=[],hash=null,watchersHash=()=>hash??=sha256(canonicalWatchers(specs,sync)).then(hex=>hex.slice(0,32)),bound=()=>{if(!binding)throw new Error("http: this backend isn't serving a board yet: pass it to board({ backend })");return binding},sdk=(profile,quiet)=>createBoardClient({url:remote,fetch:doFetch,profile:profile!==void 0?profile:()=>environment3?.profile().profile??null,session:quiet||profile===null?null:()=>environment3?.profile().session??null}),own2=sdk(null,!0),profiles=new Map;function asProfile(profile){if(!PROFILE.test(profile))throw new HttpError(400,"invalid_request",`as: ${profile}: profiles start with a letter and use up to 32 letters, numbers, and hyphens`);let client2=profiles.get(profile);return client2||profiles.set(profile,client2=sdk(profile,!0)),client2}let holders=new Map;function holder(profile){let key=JSON.stringify(profile??(profile===null?null:"\0")),client2=holders.get(key);return client2||holders.set(key,client2=sdk(profile,!1)),client2}function clientOf(caller){return caller.origin.via?.kind==="engine"?own2:caller.origin.via?.kind==="client"?(caller.self!==null&&asProfile(caller.self),holder("profile"in caller?caller.profile:caller.self??void 0)):asProfile(caller.self??"client")}let discovered=null,discovery=()=>(discovered??=doFetch(remote).then(async response=>{if(!response.ok)throw new HttpError(response.status>=400?response.status:502,"no_board",`There's no board at ${remote}: it answered ${response.status}.`,{origin:"handle"});return await response.json()},rethrow)).catch(error=>{throw discovered=null,error}),principal=null,self=()=>principal??=own2.me().then(me=>me.principal).catch(error=>{throw principal=null,error}),ownKey=async derived=>keyId(await self(),derived);async function call(client2,method,input,signal){let route=routes[method],fields={...input},path=route.path.replace(/:(\w+)/g,(_,name)=>{let value=fields[name];return delete fields[name],encodeURIComponent(String(value))}),response;if(method==="upload"){let{data,name,type}=input;if(data.byteLength>4194304){let attachment=await client2.upload({data,name:name??"file",...type?{type}:{}}).catch(rethrow);return Response.json({attachment})}response=await client2.request(path,{method:"POST",body:data,headers:{...type?{"content-type":type}:{},...name!==null?{"x-board-filename":encodeURIComponent(name)}:{}},signal}).catch(rethrow)}else route.method==="GET"?response=await client2.request(`${path}${queryString(fields)}`,{signal}).catch(rethrow):response=await client2.request(path,{method:"POST",body:new TextEncoder().encode(JSON.stringify(fields)),headers:{"content-type":"application/json"},signal}).catch(rethrow);if(response.ok)return response;try{let body=await response.json();if(body.error?.message)throw new HttpError(response.status,body.error.code??"error",body.error.message,typeof body.error.hint=="string"?{hint:body.error.hint}:{})}catch(error){if(error instanceof HttpError)throw error}throw new HttpError(502,"remote_error",`${remote} answered ${response.status}`)}async function asProject(method,identity2,input,signal){if(method==="me"){let{principal:principal2,author,actor}=identity2;return{actor:actor.id,principal:principal2.id,kind:actor.kind,handle:actor.handle,name:actor.name,avatar:actor.avatar,profile:author.profile,session:author.session,expiresAt:principal2.expiresAt?.toISOString()??null,can:principal2.access.summary()}}if(PROJECTS_OWN.has(method))throw forbidden(`this board's callers act as its project on ${remote}, which can't tell them apart: ${method} is the project's own to do there`);let scope=scopeOf(identity2),avatar=identity2.actor.avatar?.startsWith("https://")?identity2.actor.avatar:void 0,client2=createBoardClient({url:remote,fetch:doFetch,profile:{name:callerProfile(identity2.actor.handle,Object.keys(specs)),...avatar?{avatar}:{}},session:null,...scope!==null?{headers:{"x-board-scope":scope}}:{}});(method==="post"||method==="posted")&&typeof input.id=="string"&&(input={...input,id:await ownKey(await derivedId("board-gateway",identity2.principal.id,input.id)).catch(rethrow)});let response=await call(client2,method,input,signal);return method==="attachment"?attachmentOf(String(input.id),response):response.json()}async function remoteCall(method,caller,input,signal){let registering=start();if("identity"in caller)return asProject(method,caller.identity,input,signal);let client2=clientOf(caller);"self"in caller&&caller.origin.via?.kind==="engine"&&await registering,(method==="post"||method==="posted")&&"self"in caller&&typeof input.id=="string"&&DERIVED_ID.test(input.id)&&(input={...input,id:await ownKey(input.id).catch(rethrow)});let response=await call(client2,method,input,signal);return method==="attachment"?attachmentOf(String(input.id),response):response.json()}let methods={...Object.fromEntries(METHODS.map(method=>[method,(caller,input,signal)=>remoteCall(method,caller,input,signal)])),async discovery(){return discovery()},async readSource(caller,input,signal){return"self"in caller&&bound().sync.some(entry=>entry.key===input.key)?bound().readSource(input.key,input.target,input.limit??50,input.after??null):remoteCall("readSource",caller,input,signal)},async joinSource(caller,input,signal){return"self"in caller&&bound().sync.some(entry=>entry.key===input.key)?bound().joinSource(input.key,input.target):remoteCall("joinSource",caller,input,signal)},async synced(caller,input,signal){let{targets}=await remoteCall("synced",caller,input,signal);return{targets:await Promise.all(targets.map(async row=>({...row,url:row.url??(row.thread!==null&&row.message!==null?await bound().linkOf(row.key,row.thread,row.message):null)})))}},async linked(caller,input,signal){let missing2=()=>new HttpError(404,"message_not_found","no message on this board for that link"),id2=await(async()=>{for(let{platform,thread,message}of bound().locate(input.url))for(let entry of bound().sync.filter(candidate=>candidate.platform===platform)){let at=await own2.syncFind({thread:`${entry.key}:${thread}`,...message!==null?{message}:{}},{signal}).catch(rethrow),found=message!==null?at.message:at.thread===null?null:(await own2.syncThread(at.thread).catch(rethrow)).root;if(found!==null)return found}return null})();if(id2===null)return remoteCall("linked",caller,input,signal);try{return await methods.message(caller,{id:id2},signal)}catch(error){throw error instanceof HttpError&&error.status===404?missing2():error}},async typing(caller,input,signal){let{targets}=await remoteCall("typing",caller,input,signal);if(!("self"in caller)||bound().sync.length===0)return{targets};let{message,replies}=await methods.message(caller,{id:input.id},signal),here=await bound().typing([message,...replies],input.status).catch(error=>(console.warn("[board] skipped typing where this board syncs:",describe(error)),[]));return{targets:[...targets,...here]}}};async function wakeAt(here){let path=wakePath(here);return path&&(await discovery()).wake_by_path?path:{url:here}}let runner=registrant({remote,registry:{register:where=>own2.register({...where,watch:specs,...sync.length>0?{sync}:{}}),matches:query=>own2.matches(query),ack:(id2,body)=>own2.ack(id2,body)},wakeAt,binding:bound,hash:watchersHash,hasWork:()=>Object.keys(specs).length>0||sync.length>0,rethrow,registerFor:async(caller,request)=>json(await methods.register(caller,RegisterBody.parse(await request.json()),request.signal))}),start=runner.start;return{...methods,routes:runner.routes,keeps:!1,bind(next){if(binding)throw new Error("http: this backend already serves a board: create one http() per board()");for(let[id2,spec]of Object.entries(next.subscriptions)){if(spec.kind==="sync"){id2==="@sync"&&(sync=next.sync.map(entry=>({...entry})));continue}if(!PROFILE.test(id2))throw new Error(`watch ${id2}: ${PROFILE_RULE}`);compileWatcher(id2,spec),specs[id2]={tail:spec.tail,when:spec.when}}hash=null,binding=next},registerWatchers:runner.registerNow,close:runner.close}}var environment={url:boardUrl,fetch:url=>connect(url).fetch,profile:environmentProfile};function http(url,options2={}){return createHttp(url,options2,environment)}var KNOWN_AGENTS=["claude","codex","grok","pi"],PROFILE2=/^[A-Za-z][A-Za-z0-9-]{0,31}$/,HANDLE=/^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/;function claimsOf(headers){let profile=headers.get("x-board-profile")?.trim()||null;if(profile!==null&&!PROFILE2.test(profile))throw badRequest("profile names start with a letter and use up to 32 letters, numbers, and hyphens");let avatar=headers.get("x-board-avatar")?.trim()||null;if(avatar!==null&&!isAvatarUrl(avatar))throw badRequest("avatars must be https URLs (http only on localhost)");let session=headers.get("x-board-session")?.trim().slice(0,200)||null,handle=headers.get("x-board-handle")?.trim().toLowerCase()||null;if(handle!==null&&!HANDLE.test(handle))throw badRequest(`invalid handle: ${handle}`);let encoded=headers.get("x-board-name"),name=null;if(encoded)try{name=decodeURIComponent(encoded).replace(/[\u0000-\u001f\u007f]/g,"").trim().slice(0,128)||null}catch{throw badRequest("x-board-name must be URI-encoded")}let scope=headers.get("x-board-scope");if(scope!==null)try{parseScope(scope)}catch(error){throw badRequest(error.message,"invalid_scope")}return{profile,avatar,session,handle,name,scope}}function resolveActor(principal,claims,audience){let baseHandle=principal.kind==="person"&&principal.facts?.issuer!=="host"&&claims.handle?claims.handle:principal.handle,personName=principal.kind==="person"?claims.name:null,profile=claims.profile?.toLowerCase()??null,id2=profile===null?principal.id:`${principal.id}+${profile}`,known=profile!==null&&KNOWN_AGENTS.includes(profile),actor={id:id2,kind:profile===null?principal.kind:"agent",handle:profile===null?baseHandle:`${baseHandle}/${profile}`,name:claims.profile??personName??baseHandle,avatar:claims.avatar??(known?`${audience}/avatars/${profile}`:null)};return{author:{actor:id2,principal:principal.id,profile,session:claims.session},actor}}function isAvatarUrl(value){try{let url=new URL(value);return url.protocol==="https:"||url.protocol==="http:"&&["localhost","127.0.0.1"].includes(url.hostname)}catch{return!1}}var syncTarget=target=>typeof target=="string"?{target,kind:isThreadTarget(target)?"thread":"channel"}:target,mentionsEmails=text2=>extractMentions(text2).some(token2=>token2.kind==="actor"&&token2.actor.includes("@"));async function withEmailMentions(text2,find){let emails=extractMentions(text2).flatMap(token2=>token2.kind==="actor"&&token2.actor.includes("@")?[token2.actor]:[]);if(emails.length===0)return{text:text2,found:[]};let byEmail=new Map;for(let email of emails)byEmail.set(email,await find?.(email).catch(()=>null)??null);return{text:replaceMentions(text2,token2=>{if(token2.kind!=="actor"||!byEmail.has(token2.actor))return null;let actor=byEmail.get(token2.actor);return actor?`@[${actor.id}]`:token2.actor}),found:[...byEmail.values()].filter(actor=>actor!==null)}}function createPolicy(options2,keeps,serving){let open=keeps||options2.access!==void 0,access=options2.access??[],own2=null,project=()=>(own2??=(async()=>{if(!serving)return{id:options2.project?.id??null,teamId:options2.project?.teamId??null};let found=await serving(),[id2,teamId]=await Promise.all([found.ownProjectId(options2.project),found.ownTeamId(options2.project)]);return{id:id2,teamId}})()).catch(error=>{throw own2=null,error});async function discoveryIdentity(headers){return serving?(await serving()).discoveryIdentity(headers,options2.project):{projectId:options2.project?.id??null,teamId:options2.project?.teamId??null}}let tokens=null,verifier=()=>options2.authenticate?Promise.resolve(options2.authenticate):tokens??=serving?serving().then(found=>found.oidcTokens()):Promise.reject(new HttpError(501,"no_verifier","this build of board verifies no tokens: pass board({ authenticate })")),authority=createAuthority({access,project,hosts:options2.authenticate!==void 0&&!verifiesTokens(options2.authenticate)}),context2={project,issuers:typeof access=="function"?[]:issuersOf(access)},verified=new Map,perRequest=new WeakMap;async function principalOf(request){let live=principal2=>principal2.expiresAt===null||principal2.expiresAt.getTime()>Date.now(),known=perRequest.get(request);if(known){let principal2=await known;if(live(principal2))return principal2}let key=request.credential===null?null:[request.audience,request.credential,request.headers.get("x-vercel-oidc-token")??""].join(""),cached=key===null?void 0:verified.get(key);if(cached&&cached.until>Date.now())return perRequest.set(request,cached.principal),cached.principal;let principal=verify(request);return perRequest.set(request,principal),key!==null&&principal.then(found=>{found.facts?.issuer==="host"||found.expiresAt===null||(verified.size>=1e3&&verified.delete(verified.keys().next().value),verified.set(key,{principal,until:found.expiresAt.getTime()}))},()=>perRequest.delete(request)),principal}async function verify(request){let authenticate=await verifier(),result2;try{result2=await authenticate({...request,board:context2})}catch(error){throw error instanceof Response?new RejectedError(error):error}if(result2 instanceof Response)throw new RejectedError(result2);if(result2==null)throw unauthorized("missing bearer token");return fromTokens(result2)?result2:hostPrincipal(result2)}return{open,project,discoveryIdentity,async identify(request){let found=await principalOf(request),principal=request.claims.scope===null?found:{...found,scope:request.claims.scope},{author,actor}=resolveActor(principal,request.claims,request.audience);return{principal:{...principal,access:await authority.grant(principal)},author,actor}},accessNow:principal=>authority.accessNow(principal)}}var LOGOS={claude:"m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z",openai:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z",x:"M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z",slack:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z",github:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",whatsapp:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"},STYLES={claude:{background:"#D97757",mark:{path:LOGOS.claude}},codex:{background:"#000000",mark:{path:LOGOS.openai}},grok:{background:"#000000",mark:{path:LOGOS.x}},pi:{background:"#1f1f1f",mark:{glyph:"\u03C0"}}};function avatarSvg(name){let style=STYLES[name]??{background:"#666666",mark:{glyph:name.slice(0,1).toUpperCase()}},mark="path"in style.mark?`<path transform="translate(30 30) scale(2.8333)" fill="#ffffff" d="${style.mark.path}"/>`:`<text x="64" y="86" font-family="ui-sans-serif,system-ui,sans-serif" font-size="66" font-weight="600" text-anchor="middle" fill="#ffffff">${style.mark.glyph}</text>`;return`<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><rect width="128" height="128" rx="28" fill="${style.background}"/>${mark}</svg>`}var CREATED=new Set(["post","schedule","upload","uploadFinish"]),INLINE=/^(image\/(png|jpeg|gif|webp|avif)|video\/(mp4|webm)|text\/plain)$/;function attachmentResponse({attachment,data}){let disposition=INLINE.test(attachment.type)?"inline":"attachment",body=data instanceof Uint8Array?new Blob([data]):data;return new Response(body,{headers:{"content-type":attachment.type,"content-length":String(attachment.size),"content-disposition":`${disposition}; filename*=UTF-8''${encodeURIComponent(attachment.name)}`,"content-security-policy":"sandbox; default-src 'none'","x-content-type-options":"nosniff","cache-control":"private, max-age=31536000, immutable"}})}async function inputOf(name,request,url,params){let id2=params.id??"",key=params.key??"",body=()=>readJson(request);switch(name){case"discovery":case"me":case"channels":case"actors":case"identity":case"watchers":return{};case"message":case"posted":case"synced":case"cancelSchedule":case"attachment":case"uploadFinish":return{id:id2};case"messages":return MessagesQuery.parse(queryObject(url));case"threads":return ThreadsQuery.parse(queryObject(url));case"schedules":return SchedulesQuery.parse(queryObject(url));case"matches":return MatchesQuery.parse(queryObject(url));case"events":{let query=EventsQuery.parse(queryObject(url)),last=request.headers.get("last-event-id");return query.after===void 0&&last&&Ref.safeParse(last).success&&(query.after=last),query}case"post":return PostBody.parse(await body());case"schedule":return ScheduleBody.parse(await body());case"register":return RegisterBody.parse(await body());case"edit":return{id:id2,...EditBody.parse(await body())};case"delete":return{id:id2,...DeleteBody.parse(await body())};case"react":return{id:id2,...ReactBody.parse(await body())};case"label":return{id:id2,...LabelBody.parse(await body())};case"ack":return{id:id2,...AckBody.parse(await body())};case"upload":{let header=request.headers.get("x-board-filename"),name2=null;try{name2=header===null?null:decodeURIComponent(header)}catch{throw badRequest("`x-board-filename` is not URI-encoded")}return{data:await readCapped(request,4194304),name:name2,type:request.headers.get("content-type")}}case"uploadStart":return UploadStartBody.parse(await body());case"syncImport":return SyncImportBody.parse(await body());case"syncReceipt":return SyncReceiptBody.parse(await body());case"syncThread":return{thread:params.thread??""};case"syncFind":return SyncFindQuery.parse(queryObject(url));case"syncCopies":return SyncCopiesQuery.parse(queryObject(url));case"syncRoots":return SyncRootsQuery.parse(queryObject(url));case"inboxPush":return{key,...InboxPushBody.parse(await body())};case"inboxNext":return{key,...InboxNextQuery.parse(queryObject(url))};case"inboxAck":return{key,id:id2,...InboxAckBody.parse(await body())};case"inbox":return{key,...InboxQuery.parse(queryObject(url))};case"syncCode":return SyncCodeBody.parse(await body());case"syncAccount":return SyncAccountBody.parse(await body());case"syncUnlink":return SyncUnlinkBody.parse(await body());case"typing":return{id:id2,...TypingBody.parse(await body())??{}};case"readSource":return{key,...SourceReadQuery.parse(queryObject(url))};case"joinSource":return{key,...SourceJoinBody.parse(await body())};case"linked":return LinkedQuery.parse(queryObject(url))}}var externalActor=author=>({id:author.id,kind:"external",handle:author.handle,name:author.name,avatar:author.avatar});function sourceOf(caller){let via=caller.origin.via;return via?.kind==="middleware"||via?.kind==="engine"?null:via??{kind:"api"}}var MIDDLEWARE={self:"middleware",origin:{via:{kind:"middleware"}}},OWN={self:null,origin:{via:{kind:"client",name:null}}};async function createServe(context2){let{options:options2,backend,runtime,policy}=context2,entries=options2.sync??{},engine=Object.keys(entries).length>0?(await runtime.sync()).createSyncEngine(entries):null,streamMaxMs=options2.streamMaxMs??28e4,route=createRouter(backend.routes,options2.basePath),{state,ownUrl,clientAs,handleOf}=context2,watch=options2.watch??{},middleware=options2.middleware??[];function requestOf(request,audience){return{credential:(request.headers.get("authorization")??"").match(/^Bearer\s+(.+)$/i)?.[1]??null,claims:claimsOf(request.headers),audience,headers:request.headers}}async function callerOf(request){return{identity:await policy.identify(request),origin:{via:{kind:"api"}}}}let servesOnly=()=>new HttpError(404,"not_found",`${ownUrl()??"this board"} answers only wake-ups and webhooks`);async function withEmails(text2){return(await withEmailMentions(text2,engine?async email=>{let actor=await engine.findByEmail(email);return actor&&await backend.syncImport(engine.caller,{op:"seen",author:{...actor,isBot:!1}},new AbortController().signal),actor}:void 0)).text}async function resolveTarget(target){if(typeof target!="string")return target;let at=target.indexOf(":");if(at<=0)throw badRequest(`sync targets look like <key>:<channel or thread>, got: ${target}`);let key=target.slice(0,at);if(engine&&entries[key])return engine.normalizeTarget(target);if(engine)throw badRequest(`no sync entry named ${key}`);return syncTarget(target)}let accessOf2=caller=>"identity"in caller?caller.identity.principal.access:null;async function mayPost(caller,where,signal){let access=accessOf2(caller);if(access===null)return{access:null,channel:where.channel??""};let channel=where.channel??(where.re===void 0?void 0:(await lookup(caller,where.re,signal))?.channel);return channel===void 0?null:access.can("post",channel)?{access,channel}:null}let selves=new Map;async function whoIs(caller,signal){if("identity"in caller)return{principal:caller.identity.principal.id,actor:caller.identity.actor};let key=JSON.stringify([caller.origin.via?.kind??"",caller.self,caller.profile??null]),found2=selves.get(key);return found2||(selves.set(key,found2=backend.me(caller,{},signal).then(me=>({principal:me.principal,actor:{id:me.actor,kind:me.kind,handle:me.handle,name:me.name,avatar:me.avatar}}))),found2.catch(()=>selves.delete(key))),found2}let middlewareBoard=null,screen=(write,author,source,commit)=>runMiddleware(middleware,{write,author,source,board:()=>middlewareBoard??=handleOf(MIDDLEWARE,null)},commit);async function found(lookup2){try{return await lookup2(),!0}catch(error){if(error instanceof HttpError&&error.status===404)return!1;throw error}}async function attachmentsOf(caller,ids,signal){let attachments2=[];for(let id2 of new Set(ids??[])){let{attachment,data}=await backend.attachment(caller,{id:id2},signal);data instanceof ReadableStream&&await data.cancel().catch(()=>{}),attachments2.push(attachment)}return attachments2}async function screenPost(caller,input,signal,send){let source=sourceOf(caller);if(middleware.length===0||source===null||input.id!==void 0&&await found(()=>backend.posted(caller,{id:input.id},signal)))return send(input);let channel=input.channel,re=null;if(input.re!==void 0){let root=await lookup(caller,input.re,signal);if(!root)return send(input);channel=root.channel,re=root.re??root.id}let access=accessOf2(caller),labels2=Object.keys(input.labels??{}).length>0,syncs=input.re===void 0&&(input.sync?.length??0)>0;if(channel===void 0||access&&(!access.can("post",channel)||labels2&&!access.can("label",channel)||syncs&&!access.can("sync",channel)))return send(input);let attachments2=await attachmentsOf(caller,input.attachments,signal),{actor}=await whoIs(caller,signal);return screen({kind:"post",channel,re,text:input.text,labels:input.labels??{},attachments:attachments2},actor,source,write=>send({...input,text:write.text,labels:write.labels}))}function screenSchedule(caller,input,signal){let{channel,re,text:text2,labels:labels2,noSync,attachments:attachments2}=input;return screenPost(caller,{...channel!==void 0?{channel}:{},...re!==void 0?{re}:{},text:text2,...labels2?{labels:labels2}:{},...noSync!==void 0?{noSync}:{},...attachments2?{attachments:attachments2}:{}},signal,screened=>backend.schedule(caller,{...input,text:screened.text,...screened.labels?{labels:screened.labels}:{}},signal))}async function ownMessage(caller,id2,signal){let access=accessOf2(caller),readable=await lookup(caller,id2,signal),message=readable??(access!==null?await lookup(OWN,id2,signal):null);return!message||message.deleted||access&&!access.can("post",message.channel)||!readable&&!message.blind?null:message.by.principal===(await whoIs(caller,signal)).principal?message:null}async function screenEdit(caller,input,signal,send){let source=sourceOf(caller);if(middleware.length===0||source===null)return send(input);let message=await ownMessage(caller,input.id,signal);if(!message)return send(input);let{actor}=await whoIs(caller,signal);return screen({kind:"edit",id:message.id,channel:message.channel,re:message.re,text:input.text},actor,source,write=>send({...input,text:write.text}))}async function importSource(caller,body,found2,signal){let key=body.source?.key??body.from;if(body.source&&!("identity"in caller?(await backend.watchers(caller,{},signal)).watchers.some(registration=>registration.owner===caller.identity.principal.id&®istration.sync.some(entry=>entry.key===key)):entries[body.source.key]!==void 0))return null;let origin=(body.op==="post"?body.origin:null)??found2?.origin??null;return{kind:"sync",key:key??"",platform:body.author.id.slice(0,Math.max(0,body.author.id.indexOf(":"))),channel:body.source?.channel??found2?.origin?.channel??origin?.channel??"",thread:body.source?.thread??(origin?origin.subthread??origin.thread:"")}}async function importTarget(caller,body,signal){let id2=body.message??null;if(body.origin!==void 0){let{thread,message}=await backend.syncFind(caller,{thread:body.origin.thread,...body.origin.message!==void 0?{message:body.origin.message}:{}},signal);id2=body.origin.message!==void 0?message:thread===null?null:(await backend.syncThread(caller,{thread},signal)).root}return id2===null?null:lookup(caller,id2,signal)}async function syncImport(caller,body,signal){let send=patched=>backend.syncImport(caller,patched,signal);if(middleware.length===0||caller.origin.via?.kind==="middleware"||body.op!=="post"&&body.op!=="edit")return send(body);let access=accessOf2(caller);if(access&&(!access.anywhere("sync")||"identity"in caller&&caller.identity.principal.scope!==void 0))return send(body);let dropped=async commit=>{try{return await commit()}catch(error){if(!(error instanceof DroppedError))throw error;return{message:null,dropped:[...error.responses]}}};if(body.op==="post"){if(body.id!==void 0&&(await backend.syncFind(caller,{post:body.id},signal)).message!==null)return send(body);let channel=body.channel,re=null;if(body.re!==void 0){let root=await lookup(caller,body.re,signal);if(!root)return send(body);channel=root.channel,re=root.re??root.id}if(channel===void 0||access&&!access.can("sync",channel))return send(body);let source2=await importSource(caller,body,null,signal);if(!source2)return send(body);let attachments2=await attachmentsOf(caller,body.attachments,signal);return dropped(async()=>screen({kind:"post",channel,re,text:body.text,labels:body.labels??{},attachments:attachments2},externalActor(body.author),source2,async write=>send({...body,text:write.text,labels:write.labels})))}if(body.origin===void 0==(body.message===void 0))return send(body);let found2=await importTarget(caller,body,signal);if(!found2||found2.deleted||access&&!access.can("sync",found2.channel)||body.message!==void 0&&found2.by.principal!==body.author.id)return send(body);let source=await importSource(caller,body,found2,signal);return source?dropped(async()=>screen({kind:"edit",id:found2.id,channel:found2.channel,re:found2.re,text:body.text},externalActor(body.author),source,async write=>send({...body,text:write.text}))):send(body)}async function lookup(caller,id2,signal){try{let{message,replies}=await backend.message(caller,{id:id2},signal);return[message,...replies].find(candidate=>candidate.id===id2)??null}catch(error){if(error instanceof HttpError&&error.status===404)return null;throw error}}async function post2(caller,input,signal){let send=(poster,body2)=>screenPost(poster,body2,signal,patched=>backend.post(poster,patched,signal));if(!engine)return send(caller,input.sync?.length?{...input,sync:await Promise.all(input.sync.map(resolveTarget))}:input);let allowed=(input.sync?.length??0)>0||mentionsEmails(input.text)?await mayPost(caller,input,signal):null;if(!allowed)return send(caller,input);let{access,channel}=allowed,body=input.re===void 0&&(input.sync?.length??0)>0&&(access===null||access.can("sync",channel))?{...input,sync:await Promise.all(input.sync.map(resolveTarget))}:input,text2=await withEmails(body.text),answer=await send(caller,{...body,text:text2});return text2!==input.text&&access!==null&&!access.readable(answer.message.channel)?{...answer,message:{...answer.message,text:input.text}}:answer}async function landed(caller,answer){if(!answer.dropped)return answer.message;for(let text2 of answer.dropped)await caller.platform.respond(text2);throw new DroppedError(answer.dropped)}async function asPlatform(name,caller,input,signal){let me=engine.caller,{author,key}=caller.platform,{via}=caller.origin,source={key,channel:via.channel,thread:via.thread},change=async body=>{if(await landed(caller,await syncImport(me,body,signal))===null)throw notFound(`message not found: #${body.message}`,"message_not_found");return{ok:!0}};switch(name){case"post":return importPost(caller,input,signal);case"edit":{let{id:id2,text:text2,revision}=input;return change({op:"edit",author,from:null,message:id2,text:await withEmails(text2),source,...revision!==void 0?{revision}:{}})}case"delete":{let{id:id2,revision}=input;return change({op:"delete",author,from:null,message:id2,...revision!==void 0?{revision}:{}})}case"react":{let{id:id2,emoji,remove}=input;return change({op:"react",author,from:null,message:id2,emoji,...remove!==void 0?{remove}:{}})}case"label":{let{id:id2,set,unset,if:expected}=input;return change({op:"labels",author,from:null,message:id2,...set?{set}:{},...unset?{unset}:{},...expected?{if:expected}:{}})}default:return invoke(name,me,input,signal)}}async function importPost(caller,input,signal){let me=engine.caller,{author,key}=caller.platform,{via}=caller.origin,read=async id2=>{let message2=await lookup(me,id2,signal);if(!message2)throw notFound(`message not found: #${id2}`,"message_not_found");return message2};if(input.id!==void 0){let found2=(await backend.syncFind(me,{post:input.id},signal)).message;if(found2!==null)return{message:await read(found2)}}let targets=await Promise.all((input.sync??[]).map(resolveTarget)),message=await landed(caller,await syncImport(me,{op:"post",author,from:null,origin:null,source:{key,channel:via.channel,thread:via.thread},...input.channel!==void 0?{channel:input.channel}:{re:input.re},text:await withEmails(input.text),...input.labels?{labels:input.labels}:{},...input.noSync?{noSync:!0}:{},...input.attachments?.length?{attachments:input.attachments}:{},...input.id!==void 0?{id:input.id}:{},...input.after!==void 0?{after:input.after}:{}},signal));for(let target of targets)await backend.syncReceipt(me,{kind:"thread",message,target:target.target,targetKind:target.kind,cause:"request"},signal);return{message:await read(message)}}async function invoke(name,caller,input,signal){switch(name){case"post":return post2(caller,input,signal);case"edit":{let edit=input,send=body=>screenEdit(caller,body,signal,patched=>backend.edit(caller,patched,signal));return!engine||!mentionsEmails(edit.text)||!await mayPost(caller,{re:edit.id},signal)?send(edit):send({...edit,text:await withEmails(edit.text)})}case"syncImport":return syncImport(caller,input,signal);case"schedule":{let body=input,schedule=made=>backend.sendsSchedulesHere===!1?screenSchedule(caller,made,signal):backend.schedule(caller,made,signal),allowed=engine&&mentionsEmails(body.text)?await mayPost(caller,body,signal):null;if(!allowed)return schedule(body);let text2=await withEmails(body.text),answer=await schedule({...body,text:text2}),{access}=allowed;return text2!==body.text&&access!==null&&!access.readable(answer.schedule.channel)?{...answer,schedule:{...answer.schedule,text:body.text}}:answer}case"inbox":{let query=input;if(engine&&entries[query.key]&&query.channel!==void 0){let access=accessOf2(caller);if(access===null||access.anywhere("sync"))return backend.inbox(caller,{...query,channel:await engine.inboxChannel(query.key,query.channel)},signal)}return backend.inbox(caller,query,signal)}default:{let method=backend[name];if(typeof method!="function")throw notFound(`no route: ${name}`);return method.call(backend,caller,input,signal)}}}async function signingIn(name,url,signal){let{sync:key,code}=SignInQuery.parse(queryObject(url));if(!engine||!entries[key])throw notFound(`no sync entry named ${key}`);let page=(status,text2)=>new Response(`${text2}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{compileVercelConfig,findSourceVercelConfigFile,getVercelConfigPath,normalizeConfig}from"./chunk-33OMDQTW.js";import{DEFAULT_VERCEL_CONFIG_FILENAME,VERCEL_CONFIG_EXTENSIONS}from"./chunk-BC74BRVP.js";import"./chunk-4HR3I3ML.js";import"./chunk-K46QQRUN.js";import"./chunk-MTZYPCZ7.js";import"./chunk-GPDERS2D.js";import"./chunk-4NTBYNFR.js";import"./chunk-VM6X5BTK.js";import"./chunk-2VBFQZ72.js";import"./chunk-JONZUKWX.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-D6REP5QQ.js";import"./chunk-FBYA6LLM.js";import"./chunk-MY4MONOH.js";import"./chunk-4SAVH3H7.js";import"./chunk-GOI2VVI7.js";import"./chunk-B4KA3ZH2.js";import"./chunk-BOJDM3O7.js";import"./chunk-YNCWSPPJ.js";import"./chunk-BLUPZPAS.js";import"./chunk-AW33SRYY.js";import"./chunk-5MDNVAE6.js";import"./chunk-OCR5CRTH.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import"./chunk-MCYG7CCE.js";import"./chunk-YHPPP3SF.js";import"./chunk-EZVNGJN5.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BULSRTQE.js";import"./chunk-BZENIQ7N.js";export{DEFAULT_VERCEL_CONFIG_FILENAME,VERCEL_CONFIG_EXTENSIONS,compileVercelConfig,findSourceVercelConfigFile,getVercelConfigPath,normalizeConfig};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{getSubcommand}from"./chunk-ETV3C2CV.js";import{getCommandAliases}from"./chunk-2CQJKBKV.js";import{tracesCommand}from"./chunk-2V6UURUN.js";import{lsSubcommand,rmSubcommand,setSubcommand,tracesConfigCommand}from"./chunk-OKKG2FUS.js";import"./chunk-5L566FZB.js";import"./chunk-6737KAJP.js";import"./chunk-O3DAPRJ3.js";import"./chunk-UZQJQXGJ.js";import"./chunk-5YLKPSZI.js";import"./chunk-SNGM6NSO.js";import"./chunk-JVGENO2R.js";import"./chunk-SP6E7PHW.js";import"./chunk-OFOZ5DBA.js";import"./chunk-6Q2XEYCJ.js";import"./chunk-SEHERY6U.js";import"./chunk-2LOA3LC6.js";import"./chunk-E7CEQ2PO.js";import"./chunk-W25UARQV.js";import"./chunk-7BDQUBSO.js";import"./chunk-ABSFPYM4.js";import"./chunk-YANOBY2G.js";import"./chunk-F7L5SXJM.js";import"./chunk-6S6UZV3V.js";import"./chunk-GUSOYIW6.js";import"./chunk-JALVF3C2.js";import"./chunk-7TVNKTN2.js";import"./chunk-HR66URIC.js";import{help}from"./chunk-VVTMF2AY.js";import{TelemetryClient}from"./chunk-AGLOVMPC.js";import"./chunk-2EYYB6YN.js";import"./chunk-NWGBDBZI.js";import"./chunk-OFZUWHZW.js";import"./chunk-4NTBYNFR.js";import{warnDeprecatedSubcommand}from"./chunk-JONZUKWX.js";import"./chunk-4SAVH3H7.js";import"./chunk-B4KA3ZH2.js";import"./chunk-BOJDM3O7.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import"./chunk-BLUPZPAS.js";import"./chunk-5MDNVAE6.js";import"./chunk-MCYG7CCE.js";import"./chunk-YHPPP3SF.js";import"./chunk-24SIHFEW.js";import"./chunk-EZVNGJN5.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BULSRTQE.js";import"./chunk-BZENIQ7N.js";var TracesConfigTelemetryClient=class extends TelemetryClient{trackCliSubcommandLs(actual){this.trackCliSubcommand({subcommand:"ls",value:actual})}trackCliSubcommandSet(actual){this.trackCliSubcommand({subcommand:"set",value:actual})}trackCliSubcommandRemove(actual){this.trackCliSubcommand({subcommand:"remove",value:actual})}};var COMMAND_CONFIG={ls:getCommandAliases(lsSubcommand),set:getCommandAliases(setSubcommand),remove:getCommandAliases(rmSubcommand)},SUBCOMMAND_METADATA={ls:lsSubcommand,set:setSubcommand,remove:rmSubcommand};async function config(client,{args,needHelp,subcommandOriginal,telemetry}){let{subcommand:action,subcommandOriginal:actionOriginal}=getSubcommand(args,COMMAND_CONFIG),actionMetadata=typeof action=="string"?SUBCOMMAND_METADATA[action]:void 0;function printHelp(command){return output_manager_default.print(help(command,{stream:client.stderr,parent:tracesCommand,columns:client.stderr.columns})),needHelp?0:2}if(needHelp)return telemetry.trackCliFlagHelp("traces",subcommandOriginal),printHelp(actionMetadata||tracesConfigCommand);telemetry.trackCliSubcommandConfig(subcommandOriginal);let configTelemetry=new TracesConfigTelemetryClient({opts:{store:client.telemetryEventStore}});switch(action){case"ls":return configTelemetry.trackCliSubcommandLs(actionOriginal),(await import("./ls-N56BWH2L.js")).default(client);case"set":return configTelemetry.trackCliSubcommandSet(actionOriginal),(await import("./set-2RH74ZC3.js")).default(client);case"remove":return configTelemetry.trackCliSubcommandRemove(actionOriginal),actionOriginal==="delete"&&warnDeprecatedSubcommand(client,"traces config delete","traces config remove"),(await import("./rm-EJH37HYN.js")).default(client);default:return printHelp(tracesConfigCommand)}}export{config as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import{repositoryPath}from"./chunk-DFVNL5ML.js";import{emitVcrArgParseError,handleVcrApiError,requireVcrRepository,resolveVcrScope,validateVcrJsonOutput}from"./chunk-HXLOBW75.js";import{outputError}from"./chunk-7PGDJTAH.js";import"./chunk-D3M2JG5C.js";import"./chunk-M32HBBPK.js";import{readOnOffOption,rewriteLegacyOnOffValues}from"./chunk-BH5OASEJ.js";import"./chunk-GD7AV7BO.js";import{configSubcommand}from"./chunk-JVGENO2R.js";import"./chunk-SP6E7PHW.js";import"./chunk-OFOZ5DBA.js";import"./chunk-6Q2XEYCJ.js";import{printError}from"./chunk-NYJTWSSD.js";import"./chunk-XSQZ35V6.js";import{AGENT_REASON,buildCommandWithGlobalFlags,outputAgentError}from"./chunk-GORL5DZC.js";import"./chunk-OFZUWHZW.js";import"./chunk-BC74BRVP.js";import"./chunk-4HR3I3ML.js";import"./chunk-K46QQRUN.js";import"./chunk-MTZYPCZ7.js";import"./chunk-GPDERS2D.js";import"./chunk-4NTBYNFR.js";import{parseArguments}from"./chunk-VM6X5BTK.js";import"./chunk-2VBFQZ72.js";import"./chunk-JONZUKWX.js";import"./chunk-LUX4PBJL.js";import"./chunk-OPORM35X.js";import"./chunk-MXTC4ZAQ.js";import"./chunk-D6REP5QQ.js";import"./chunk-FBYA6LLM.js";import"./chunk-MY4MONOH.js";import"./chunk-4SAVH3H7.js";import{isAPIError}from"./chunk-GOI2VVI7.js";import"./chunk-B4KA3ZH2.js";import"./chunk-BOJDM3O7.js";import{output_manager_default}from"./chunk-YNCWSPPJ.js";import"./chunk-BLUPZPAS.js";import"./chunk-AW33SRYY.js";import"./chunk-5MDNVAE6.js";import"./chunk-OCR5CRTH.js";import"./chunk-7EJQLVWX.js";import"./chunk-SCV7XEEO.js";import"./chunk-MCYG7CCE.js";import"./chunk-YHPPP3SF.js";import{getFlagsSpecification}from"./chunk-EZVNGJN5.js";import"./chunk-2BKALEOP.js";import"./chunk-NB2WLB3J.js";import"./chunk-ISWW3DKF.js";import"./chunk-BRQUZ5NC.js";import"./chunk-BULSRTQE.js";import"./chunk-BZENIQ7N.js";var USAGE="vcr update <repository> --public";async function config(client,argv,telemetry){let rewritten=rewriteLegacyOnOffValues(argv,configSubcommand.options,client),parsedArgs;try{parsedArgs=parseArguments("error"in rewritten?argv:rewritten.args,getFlagsSpecification(configSubcommand.options))}catch(err){return emitVcrArgParseError(client,err,USAGE),printError(err),2}let fr=validateVcrJsonOutput(client,parsedArgs.flags);if(typeof fr=="number")return fr;if("error"in rewritten)return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message:rewritten.error},2),outputError(client,fr.jsonOutput,"INVALID_ARGUMENTS",rewritten.error);let repository=parsedArgs.args[0],project=parsedArgs.flags["--project"],visibility=readOnOffOption(client,parsedArgs.flags,{on:"--public",off:"--no-public"});if("error"in visibility){let err=new Error(visibility.error);return emitVcrArgParseError(client,err,USAGE),outputError(client,fr.jsonOutput,"INVALID_ARGUMENTS",visibility.error)}let desiredPublic=visibility.value;telemetry.trackCliOptionProject(project),telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]),telemetry.trackCliOptionPublic(rewritten.legacy.get("--public")),rewritten.legacy.has("--public")||(telemetry.trackCliFlagPublic(parsedArgs.flags["--public"]),telemetry.trackCliFlagNoPublic(parsedArgs.flags["--no-public"]));let missingRepository=requireVcrRepository(client,repository,fr.jsonOutput,USAGE);if(typeof missingRepository=="number")return missingRepository;if(parsedArgs.args.length>1){let message="`vcr update` takes one repository. Pass --public or --no-public without a value.";return outputAgentError(client,{status:"error",reason:AGENT_REASON.INVALID_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Re-run with one repository"}]},2),outputError(client,fr.jsonOutput,"INVALID_ARGUMENTS",message)}if(desiredPublic===void 0){let message="Missing a setting to change. Pass --public to make the repository public, or --no-public to make it private.";return outputAgentError(client,{status:"error",reason:AGENT_REASON.MISSING_ARGUMENTS,message,next:[{command:buildCommandWithGlobalFlags(client.argv,USAGE),when:"Re-run with --public or --no-public"}]},2),outputError(client,fr.jsonOutput,"MISSING_ARGUMENTS",message)}let scope=await resolveVcrScope(client,{project,jsonOutput:fr.jsonOutput});if(typeof scope=="number")return scope;let path=repositoryPath(scope,repository);output_manager_default.spinner("Updating repository...");try{let updated=await client.fetch(path,{method:"PATCH",body:{public:desiredPublic}});if(fr.jsonOutput)client.stdout.write(`${JSON.stringify(updated,null,2)}
|
|
8
|
+
`);else{let isPublic=updated.repository?.public??desiredPublic;output_manager_default.success(`Repository ${updated.repository?.name??repository} is now ${isPublic?"public":"private"}`)}return 0}catch(err){if(isAPIError(err))return handleVcrApiError(client,err,fr.jsonOutput,{retry:{command:buildCommandWithGlobalFlags(client.argv,"vcr ls"),when:"List repositories to confirm the name or id"}});throw err}finally{output_manager_default.stopSpinner()}}export{config as default};
|