@struktoai/mirage-node 0.0.3-alpha.0 → 0.0.4
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 +1 -1
- package/dist/aliyun-PGI57A43.js +10 -0
- package/dist/backblaze-TSPL6Y56.js +10 -0
- package/dist/box-7XTZYDSO.js +8 -0
- package/dist/cas.lua +15 -0
- package/dist/ceph-C265UI5T.js +10 -0
- package/dist/{chunk-IQVNVTOP.js → chunk-25W4XQJZ.js} +5 -5
- package/dist/{chunk-QGRDPSAH.js → chunk-2ERLWAGG.js} +4 -2
- package/dist/chunk-2ERLWAGG.js.map +1 -0
- package/dist/{chunk-NJMGCT63.js → chunk-2QNPKPZZ.js} +7 -2
- package/dist/chunk-2QNPKPZZ.js.map +1 -0
- package/dist/{chunk-ZNWVJ6UW.js → chunk-3ASOQTZB.js} +7 -2
- package/dist/chunk-3ASOQTZB.js.map +1 -0
- package/dist/{chunk-ERELJ7BS.js → chunk-3JZN3GYO.js} +14 -13
- package/dist/chunk-3JZN3GYO.js.map +1 -0
- package/dist/{chunk-DTAY7LPC.js → chunk-4GYB7DGC.js} +295 -706
- package/dist/chunk-4GYB7DGC.js.map +1 -0
- package/dist/{chunk-G5BZE7UA.js → chunk-4M73WHIE.js} +3 -3
- package/dist/{chunk-Q6CDMOM6.js → chunk-4X6CLF4F.js} +3 -3
- package/dist/{chunk-3IJSIVKT.js → chunk-5I7Q7RHW.js} +3 -3
- package/dist/{chunk-YPT4JBUY.js → chunk-5YRWF5RP.js} +18 -16
- package/dist/chunk-5YRWF5RP.js.map +1 -0
- package/dist/chunk-5ZHNPNDD.js +944 -0
- package/dist/chunk-5ZHNPNDD.js.map +1 -0
- package/dist/{chunk-VGLHY6BK.js → chunk-AULFV3KY.js} +1 -2
- package/dist/chunk-AULFV3KY.js.map +1 -0
- package/dist/{chunk-A4Z6DZ22.js → chunk-BWLUBJQG.js} +20 -16
- package/dist/chunk-BWLUBJQG.js.map +1 -0
- package/dist/{chunk-OYV2DN66.js → chunk-BWWU5T2D.js} +3 -3
- package/dist/chunk-C7TNKIK5.js +39 -0
- package/dist/chunk-C7TNKIK5.js.map +1 -0
- package/dist/{chunk-HEHERHQ5.js → chunk-CB76WPUS.js} +13 -14
- package/dist/chunk-CB76WPUS.js.map +1 -0
- package/dist/chunk-CGGO5NKD.js +1194 -0
- package/dist/chunk-CGGO5NKD.js.map +1 -0
- package/dist/{chunk-B2ZOKNN4.js → chunk-CQCTCW4S.js} +1 -2
- package/dist/chunk-CQCTCW4S.js.map +1 -0
- package/dist/{chunk-AJICZLHT.js → chunk-CXQGMFI7.js} +3 -3
- package/dist/{chunk-LW25LMIH.js → chunk-D3U7VQCG.js} +1 -2
- package/dist/{chunk-LW25LMIH.js.map → chunk-D3U7VQCG.js.map} +1 -1
- package/dist/{chunk-RQYEEA2O.js → chunk-DXU7NZPH.js} +3 -3
- package/dist/{chunk-XGJ2QERC.js → chunk-E3KXVEYI.js} +8 -4
- package/dist/chunk-E3KXVEYI.js.map +1 -0
- package/dist/{chunk-L6JPBJAS.js → chunk-EGZNOUMH.js} +3 -3
- package/dist/{chunk-DNBAMB5J.js → chunk-EVK6HH6Z.js} +1 -2
- package/dist/{chunk-DNBAMB5J.js.map → chunk-EVK6HH6Z.js.map} +1 -1
- package/dist/{chunk-BYTU2YC3.js → chunk-F5NWRF32.js} +3 -3
- package/dist/{chunk-RLGWMJD3.js → chunk-FRGTDZQT.js} +146 -11
- package/dist/chunk-FRGTDZQT.js.map +1 -0
- package/dist/{chunk-DYXEITK3.js → chunk-GF75O2EN.js} +4 -2
- package/dist/chunk-GF75O2EN.js.map +1 -0
- package/dist/{chunk-W7FLHT65.js → chunk-GTAS3QVC.js} +1 -2
- package/dist/{chunk-W7FLHT65.js.map → chunk-GTAS3QVC.js.map} +1 -1
- package/dist/{chunk-RQK5UPMP.js → chunk-H62XQZUM.js} +4 -3
- package/dist/chunk-H62XQZUM.js.map +1 -0
- package/dist/{chunk-UT2OPSN4.js → chunk-HCU3B6FW.js} +1 -2
- package/dist/chunk-HCU3B6FW.js.map +1 -0
- package/dist/chunk-HEDE2377.js +754 -0
- package/dist/chunk-HEDE2377.js.map +1 -0
- package/dist/{chunk-JZQHKDSY.js → chunk-HGIPWY5Y.js} +22 -11
- package/dist/chunk-HGIPWY5Y.js.map +1 -0
- package/dist/{chunk-Q2IAILVC.js → chunk-HSD24IP2.js} +8 -4
- package/dist/chunk-HSD24IP2.js.map +1 -0
- package/dist/{chunk-5YOCVEUB.js → chunk-HWQPEBID.js} +19 -15
- package/dist/chunk-HWQPEBID.js.map +1 -0
- package/dist/{chunk-SFUCUARB.js → chunk-IEHPTILN.js} +4 -4
- package/dist/chunk-IEHPTILN.js.map +1 -0
- package/dist/{chunk-C6NHEDHY.js → chunk-IEVLWEBO.js} +15 -14
- package/dist/chunk-IEVLWEBO.js.map +1 -0
- package/dist/{chunk-YUK3X3B4.js → chunk-IKJQOYI4.js} +1 -2
- package/dist/{chunk-YUK3X3B4.js.map → chunk-IKJQOYI4.js.map} +1 -1
- package/dist/{chunk-MHCMHKM6.js → chunk-IUXXZHY3.js} +17 -23
- package/dist/chunk-IUXXZHY3.js.map +1 -0
- package/dist/{chunk-ABTEGAFB.js → chunk-JBDFYIN2.js} +13 -14
- package/dist/chunk-JBDFYIN2.js.map +1 -0
- package/dist/{chunk-A7X4L4JM.js → chunk-JEBH5APX.js} +15 -15
- package/dist/chunk-JEBH5APX.js.map +1 -0
- package/dist/{chunk-H3BST2LI.js → chunk-JHI2PHHD.js} +1 -2
- package/dist/{chunk-H3BST2LI.js.map → chunk-JHI2PHHD.js.map} +1 -1
- package/dist/{chunk-EGB7V74Z.js → chunk-KAWDDS27.js} +1 -3
- package/dist/chunk-KAWDDS27.js.map +1 -0
- package/dist/{chunk-DP2PP5V2.js → chunk-KGC2OGXI.js} +5 -4
- package/dist/chunk-KGC2OGXI.js.map +1 -0
- package/dist/{chunk-FXFDBF3P.js → chunk-L4GMDSMB.js} +3 -3
- package/dist/{chunk-O7ODGJYL.js → chunk-L7FEZ7LU.js} +3 -3
- package/dist/{chunk-54NTYJEO.js → chunk-LPDLPRPS.js} +1 -3
- package/dist/{chunk-54NTYJEO.js.map → chunk-LPDLPRPS.js.map} +1 -1
- package/dist/{chunk-UGK4TAVK.js → chunk-LPLZLSMK.js} +1 -2
- package/dist/chunk-LPLZLSMK.js.map +1 -0
- package/dist/{chunk-5DLOHQJ2.js → chunk-M6E7VK4D.js} +14 -14
- package/dist/chunk-M6E7VK4D.js.map +1 -0
- package/dist/{chunk-2CC5VW7K.js → chunk-MIQ3ECZM.js} +4 -2
- package/dist/chunk-MIQ3ECZM.js.map +1 -0
- package/dist/chunk-MRXTUFBZ.js +30 -0
- package/dist/chunk-MRXTUFBZ.js.map +1 -0
- package/dist/{chunk-RO5IQEDQ.js → chunk-NJ42VNXG.js} +1 -2
- package/dist/chunk-NJ42VNXG.js.map +1 -0
- package/dist/{chunk-3T3RMDNX.js → chunk-NLXJMXVE.js} +3 -3
- package/dist/{chunk-E2ISWXLB.js → chunk-OQKNDS66.js} +1 -1
- package/dist/{chunk-E2ISWXLB.js.map → chunk-OQKNDS66.js.map} +1 -1
- package/dist/chunk-OSVZKYXS.js +946 -0
- package/dist/chunk-OSVZKYXS.js.map +1 -0
- package/dist/{chunk-LYDMMNL2.js → chunk-RHUEV4I7.js} +12 -13
- package/dist/chunk-RHUEV4I7.js.map +1 -0
- package/dist/{chunk-JALIYI6M.js → chunk-S4KVLPBR.js} +7 -2
- package/dist/chunk-S4KVLPBR.js.map +1 -0
- package/dist/{chunk-XRU5WXZX.js → chunk-SAOQW6ZJ.js} +15 -15
- package/dist/chunk-SAOQW6ZJ.js.map +1 -0
- package/dist/{chunk-CASCUFK2.js → chunk-SI4GMRXD.js} +14 -15
- package/dist/chunk-SI4GMRXD.js.map +1 -0
- package/dist/{chunk-HQ4KWN76.js → chunk-SYMNWNC3.js} +3 -3
- package/dist/{chunk-PJBQKMCD.js → chunk-TUNR4VUM.js} +3 -3
- package/dist/{chunk-XHCBHYN4.js → chunk-UAJYJP5C.js} +7 -2
- package/dist/chunk-UAJYJP5C.js.map +1 -0
- package/dist/{chunk-OPYQ5KIO.js → chunk-UYA3XL3J.js} +4 -2
- package/dist/chunk-UYA3XL3J.js.map +1 -0
- package/dist/{chunk-WL7HS7EM.js → chunk-V7JVMG63.js} +3 -3
- package/dist/{chunk-LAJJPLEV.js → chunk-VBYIDRNU.js} +7 -3
- package/dist/chunk-VBYIDRNU.js.map +1 -0
- package/dist/{chunk-NHS7WLEQ.js → chunk-VHED2STW.js} +11 -8
- package/dist/chunk-VHED2STW.js.map +1 -0
- package/dist/{chunk-JZT4QGIP.js → chunk-VIICUPWQ.js} +1 -2
- package/dist/{chunk-JZT4QGIP.js.map → chunk-VIICUPWQ.js.map} +1 -1
- package/dist/{chunk-TRTUHCS4.js → chunk-VLRSOWHP.js} +17 -15
- package/dist/chunk-VLRSOWHP.js.map +1 -0
- package/dist/chunk-W5ZLIQFR.js +764 -0
- package/dist/chunk-W5ZLIQFR.js.map +1 -0
- package/dist/{chunk-YGZMVNN5.js → chunk-WTSSEUOZ.js} +7 -2
- package/dist/chunk-WTSSEUOZ.js.map +1 -0
- package/dist/{chunk-OHROA3FQ.js → chunk-WWP2STF5.js} +7 -2
- package/dist/chunk-WWP2STF5.js.map +1 -0
- package/dist/{chunk-C6NHFMIP.js → chunk-XADEMW6B.js} +3 -3
- package/dist/{chunk-KTNDT45N.js → chunk-XEMLYWHK.js} +3 -3
- package/dist/{chunk-OZAEWZZ3.js → chunk-XFSEADPC.js} +6 -2
- package/dist/chunk-XFSEADPC.js.map +1 -0
- package/dist/{chunk-TWGVQLG2.js → chunk-XUUSWR4U.js} +1 -2
- package/dist/{chunk-TWGVQLG2.js.map → chunk-XUUSWR4U.js.map} +1 -1
- package/dist/{chunk-XLQI4IT2.js → chunk-YBVMZ7SR.js} +7 -2
- package/dist/chunk-YBVMZ7SR.js.map +1 -0
- package/dist/{chunk-E7RW3SBV.js → chunk-YRJICL2Q.js} +15 -15
- package/dist/chunk-YRJICL2Q.js.map +1 -0
- package/dist/{chunk-B6SXRCBO.js → chunk-ZM44MGC5.js} +3 -3
- package/dist/{chunk-YAVGCQUP.js → chunk-ZMREYTHA.js} +16 -15
- package/dist/chunk-ZMREYTHA.js.map +1 -0
- package/dist/{chunk-H3I2KZIY.js → chunk-ZPB3SLPK.js} +1 -2
- package/dist/{chunk-H3I2KZIY.js.map → chunk-ZPB3SLPK.js.map} +1 -1
- package/dist/chunk-ZPZQXHW2.js +1230 -0
- package/dist/chunk-ZPZQXHW2.js.map +1 -0
- package/dist/{config-34LHOGLM.js → config-2LASFFRD.js} +2 -4
- package/dist/config-3WDIJPTG.js +9 -0
- package/dist/config-4QV4QYI5.js +9 -0
- package/dist/{config-ZFJYQZCH.js → config-54USUVSE.js} +2 -4
- package/dist/config-5ZXN2T2H.js +9 -0
- package/dist/config-A2GQYJDB.js +9 -0
- package/dist/config-BBOLI7VE.js +9 -0
- package/dist/{config-VM526IKB.js → config-BIBFLUIR.js} +2 -4
- package/dist/{config-EO23EY62.js → config-CPYFOUQO.js} +2 -4
- package/dist/{config-3IVQJBNW.js → config-DWSJL3NH.js} +2 -4
- package/dist/config-E22XAGYN.js +9 -0
- package/dist/config-EHE52ZTK.js +9 -0
- package/dist/{config-GE4W4ZJC.js → config-EX3ZJTZI.js} +2 -4
- package/dist/{config-QNMKWJ4M.js → config-FRK7ZL37.js} +2 -4
- package/dist/{config-LHFFXVYI.js → config-HQXNFQZS.js} +2 -4
- package/dist/config-HTXOOAOD.js +9 -0
- package/dist/{config-HKRMKD76.js → config-IPNWAJHH.js} +2 -4
- package/dist/config-J2C53GOT.js +9 -0
- package/dist/config-K63RX6EU.js +9 -0
- package/dist/config-L7SBSH5L.js +9 -0
- package/dist/config-LEALEMKA.js +9 -0
- package/dist/{config-IVY5EQQ2.js → config-M3Z47VYU.js} +2 -4
- package/dist/{config-EIHSP5DZ.js → config-MZM3IPFM.js} +2 -4
- package/dist/{config-GHRUKEQ6.js → config-OJ2BPESH.js} +2 -4
- package/dist/{config-WDAZFXYD.js → config-QO2XUME4.js} +2 -4
- package/dist/config-QWQGOXQ5.js +9 -0
- package/dist/config-RI7IEZUF.js +9 -0
- package/dist/{config-CVZ2AGCO.js → config-SPW6NESU.js} +2 -6
- package/dist/{config-QAA646XB.js → config-T2IUIU5C.js} +2 -4
- package/dist/{config-NV5WXP64.js → config-UU27ALAA.js} +2 -4
- package/dist/config-VKKZGC7V.js +9 -0
- package/dist/config-W7EVPJNK.js +11 -0
- package/dist/config-WKQ3FGTZ.js +9 -0
- package/dist/config-WVILHDFV.js +11 -0
- package/dist/{config-Q45Y46YT.js → config-XU6D5C7E.js} +2 -4
- package/dist/databricks_volume-ETRDJVVQ.js +7 -0
- package/dist/digitalocean-QP72DR4J.js +10 -0
- package/dist/discord-BSN5RB3E.js +8 -0
- package/dist/disk-24NWTN2I.js +7 -0
- package/dist/dropbox-OSTZXSIE.js +8 -0
- package/dist/email-4ZFPSWIN.js +8 -0
- package/dist/gcs-PFWR6MIW.js +10 -0
- package/dist/gdocs-GPAZRQG5.js +8 -0
- package/dist/gdrive-XSX6A7B3.js +8 -0
- package/dist/github-EQ4NXUTA.js +8 -0
- package/dist/github_ci-QL5B2Q2N.js +8 -0
- package/dist/gmail-2TBT4CVH.js +8 -0
- package/dist/gridfs-KZRZ6SIB.js +9 -0
- package/dist/gsheets-N53WEXN2.js +8 -0
- package/dist/gslides-TATSARTH.js +8 -0
- package/dist/hf_buckets-BK7NGJWS.js +10 -0
- package/dist/hf_datasets-UQ5QGM4L.js +10 -0
- package/dist/hf_models-75LFCQCS.js +10 -0
- package/dist/hf_spaces-6T2KB3UC.js +10 -0
- package/dist/index.d.ts +599 -79
- package/dist/index.js +1515 -422
- package/dist/index.js.map +1 -1
- package/dist/langfuse-AMQCQWNE.js +8 -0
- package/dist/linear-V3TXO6CV.js +8 -0
- package/dist/minio-IZRZY4C5.js +10 -0
- package/dist/mongodb-VMKPQCPX.js +7 -0
- package/dist/nextcloud-5RHQCGDO.js +9 -0
- package/dist/notion-6PPNTQFM.js +8 -0
- package/dist/oci-CKYBSFZJ.js +10 -0
- package/dist/postgres-WIQBVL5M.js +7 -0
- package/dist/qingstor-AP4IIPLY.js +10 -0
- package/dist/r2-C4XGEWQY.js +10 -0
- package/dist/redis-6D55Q2WB.js +8 -0
- package/dist/s3-XQBI2CXN.js +8 -0
- package/dist/scaleway-SEZJVURB.js +10 -0
- package/dist/seaweedfs-3XYIAFU2.js +10 -0
- package/dist/slack-ZHXDJQY4.js +8 -0
- package/dist/ssh-X2MO7JOV.js +8 -0
- package/dist/supabase-BBM44UTM.js +10 -0
- package/dist/supabase-BBM44UTM.js.map +1 -0
- package/dist/tencent-X72USLJ7.js +10 -0
- package/dist/tencent-X72USLJ7.js.map +1 -0
- package/dist/trello-EER5NG7L.js +8 -0
- package/dist/trello-EER5NG7L.js.map +1 -0
- package/dist/wasabi-O4MVIUFG.js +10 -0
- package/dist/wasabi-O4MVIUFG.js.map +1 -0
- package/package.json +9 -5
- package/dist/aliyun-TMZRUYCG.js +0 -10
- package/dist/backblaze-OHW57DLK.js +0 -10
- package/dist/box-UXTCAFOZ.js +0 -8
- package/dist/ceph-TNN4I2FT.js +0 -10
- package/dist/chunk-2CC5VW7K.js.map +0 -1
- package/dist/chunk-5DLOHQJ2.js.map +0 -1
- package/dist/chunk-5HCVKTP3.js +0 -2086
- package/dist/chunk-5HCVKTP3.js.map +0 -1
- package/dist/chunk-5YOCVEUB.js.map +0 -1
- package/dist/chunk-A4Z6DZ22.js.map +0 -1
- package/dist/chunk-A7X4L4JM.js.map +0 -1
- package/dist/chunk-ABTEGAFB.js.map +0 -1
- package/dist/chunk-B2ZOKNN4.js.map +0 -1
- package/dist/chunk-C6NHEDHY.js.map +0 -1
- package/dist/chunk-CASCUFK2.js.map +0 -1
- package/dist/chunk-DP2PP5V2.js.map +0 -1
- package/dist/chunk-DTAY7LPC.js.map +0 -1
- package/dist/chunk-DYXEITK3.js.map +0 -1
- package/dist/chunk-E7RW3SBV.js.map +0 -1
- package/dist/chunk-EGB7V74Z.js.map +0 -1
- package/dist/chunk-ERELJ7BS.js.map +0 -1
- package/dist/chunk-HEHERHQ5.js.map +0 -1
- package/dist/chunk-JALIYI6M.js.map +0 -1
- package/dist/chunk-JZQHKDSY.js.map +0 -1
- package/dist/chunk-LAJJPLEV.js.map +0 -1
- package/dist/chunk-LYDMMNL2.js.map +0 -1
- package/dist/chunk-MHCMHKM6.js.map +0 -1
- package/dist/chunk-N72CAZEH.js +0 -1990
- package/dist/chunk-N72CAZEH.js.map +0 -1
- package/dist/chunk-NHS7WLEQ.js.map +0 -1
- package/dist/chunk-NJMGCT63.js.map +0 -1
- package/dist/chunk-OHROA3FQ.js.map +0 -1
- package/dist/chunk-OPYQ5KIO.js.map +0 -1
- package/dist/chunk-OZAEWZZ3.js.map +0 -1
- package/dist/chunk-PBBG7VFT.js +0 -1896
- package/dist/chunk-PBBG7VFT.js.map +0 -1
- package/dist/chunk-Q2IAILVC.js.map +0 -1
- package/dist/chunk-QGRDPSAH.js.map +0 -1
- package/dist/chunk-RLGWMJD3.js.map +0 -1
- package/dist/chunk-RO5IQEDQ.js.map +0 -1
- package/dist/chunk-RQK5UPMP.js.map +0 -1
- package/dist/chunk-SFUCUARB.js.map +0 -1
- package/dist/chunk-TRTUHCS4.js.map +0 -1
- package/dist/chunk-U6QSXTUS.js +0 -7
- package/dist/chunk-U6QSXTUS.js.map +0 -1
- package/dist/chunk-UGK4TAVK.js.map +0 -1
- package/dist/chunk-UT2OPSN4.js.map +0 -1
- package/dist/chunk-VGLHY6BK.js.map +0 -1
- package/dist/chunk-WSGEIVY3.js +0 -1766
- package/dist/chunk-WSGEIVY3.js.map +0 -1
- package/dist/chunk-XGJ2QERC.js.map +0 -1
- package/dist/chunk-XHCBHYN4.js.map +0 -1
- package/dist/chunk-XLQI4IT2.js.map +0 -1
- package/dist/chunk-XRU5WXZX.js.map +0 -1
- package/dist/chunk-YAVGCQUP.js.map +0 -1
- package/dist/chunk-YGZMVNN5.js.map +0 -1
- package/dist/chunk-YPT4JBUY.js.map +0 -1
- package/dist/chunk-ZNWVJ6UW.js.map +0 -1
- package/dist/config-3BBWD5AB.js +0 -11
- package/dist/config-4UDVSUQJ.js +0 -11
- package/dist/config-CMDBAPDH.js +0 -11
- package/dist/config-D3RLSPNF.js +0 -11
- package/dist/config-DG65OEG3.js +0 -11
- package/dist/config-GCQK6NJY.js +0 -11
- package/dist/config-GVH27UPE.js +0 -11
- package/dist/config-HXVYIXP5.js +0 -11
- package/dist/config-IDZMEW73.js +0 -11
- package/dist/config-IJJXGLBQ.js +0 -11
- package/dist/config-KJOLGVB2.js +0 -11
- package/dist/config-KMVCVBYN.js +0 -15
- package/dist/config-KYTRXAB2.js +0 -15
- package/dist/config-OT2TQQCN.js +0 -11
- package/dist/config-QWCY3LBQ.js +0 -11
- package/dist/config-ZV6G2ZEC.js +0 -11
- package/dist/databricks_volume-HNQ4DJVJ.js +0 -7
- package/dist/digitalocean-6SPR4S7V.js +0 -10
- package/dist/discord-SAV2RBJV.js +0 -8
- package/dist/disk-POACMF4G.js +0 -8
- package/dist/dropbox-CQ7MTYX2.js +0 -8
- package/dist/email-KBQ7CXS7.js +0 -8
- package/dist/gcs-SMIE4VMT.js +0 -10
- package/dist/gdocs-X5Y2SIQX.js +0 -8
- package/dist/gdrive-SIQPRIGI.js +0 -8
- package/dist/github-KBHWANKQ.js +0 -8
- package/dist/github_ci-HPITNK37.js +0 -8
- package/dist/gmail-DKHAGJNX.js +0 -8
- package/dist/gsheets-ZSUDIWGK.js +0 -8
- package/dist/gslides-GYXM7IMJ.js +0 -8
- package/dist/hf_buckets-RIOMV7WG.js +0 -10
- package/dist/hf_datasets-QF4BQ3OK.js +0 -10
- package/dist/hf_models-62GC2HPZ.js +0 -10
- package/dist/hf_spaces-NVSMUNRM.js +0 -10
- package/dist/langfuse-HUAYVPHF.js +0 -8
- package/dist/linear-2MM55KBC.js +0 -8
- package/dist/minio-L3XE6PQS.js +0 -10
- package/dist/mongodb-ZOX4FRHJ.js +0 -7
- package/dist/notion-UK4GTMT4.js +0 -8
- package/dist/oci-NURLWPL2.js +0 -10
- package/dist/postgres-JNFMPAO2.js +0 -7
- package/dist/qingstor-W55D5YFO.js +0 -10
- package/dist/r2-FSZK7IFI.js +0 -10
- package/dist/redis-S6GIPA4Z.js +0 -8
- package/dist/s3-GMPUJ65D.js +0 -8
- package/dist/scaleway-5VM55Y6D.js +0 -10
- package/dist/seaweedfs-J3EPUEPE.js +0 -10
- package/dist/slack-FVBXY7KD.js +0 -8
- package/dist/ssh-GCXETJ3Z.js +0 -9
- package/dist/supabase-HLWNHBBE.js +0 -10
- package/dist/tencent-YDO73XBD.js +0 -10
- package/dist/trello-CQ53BQUL.js +0 -8
- package/dist/wasabi-SOZKPMRQ.js +0 -10
- /package/dist/{aliyun-TMZRUYCG.js.map → aliyun-PGI57A43.js.map} +0 -0
- /package/dist/{backblaze-OHW57DLK.js.map → backblaze-TSPL6Y56.js.map} +0 -0
- /package/dist/{box-UXTCAFOZ.js.map → box-7XTZYDSO.js.map} +0 -0
- /package/dist/{ceph-TNN4I2FT.js.map → ceph-C265UI5T.js.map} +0 -0
- /package/dist/{chunk-IQVNVTOP.js.map → chunk-25W4XQJZ.js.map} +0 -0
- /package/dist/{chunk-G5BZE7UA.js.map → chunk-4M73WHIE.js.map} +0 -0
- /package/dist/{chunk-Q6CDMOM6.js.map → chunk-4X6CLF4F.js.map} +0 -0
- /package/dist/{chunk-3IJSIVKT.js.map → chunk-5I7Q7RHW.js.map} +0 -0
- /package/dist/{chunk-OYV2DN66.js.map → chunk-BWWU5T2D.js.map} +0 -0
- /package/dist/{chunk-AJICZLHT.js.map → chunk-CXQGMFI7.js.map} +0 -0
- /package/dist/{chunk-RQYEEA2O.js.map → chunk-DXU7NZPH.js.map} +0 -0
- /package/dist/{chunk-L6JPBJAS.js.map → chunk-EGZNOUMH.js.map} +0 -0
- /package/dist/{chunk-BYTU2YC3.js.map → chunk-F5NWRF32.js.map} +0 -0
- /package/dist/{chunk-FXFDBF3P.js.map → chunk-L4GMDSMB.js.map} +0 -0
- /package/dist/{chunk-O7ODGJYL.js.map → chunk-L7FEZ7LU.js.map} +0 -0
- /package/dist/{chunk-3T3RMDNX.js.map → chunk-NLXJMXVE.js.map} +0 -0
- /package/dist/{chunk-HQ4KWN76.js.map → chunk-SYMNWNC3.js.map} +0 -0
- /package/dist/{chunk-PJBQKMCD.js.map → chunk-TUNR4VUM.js.map} +0 -0
- /package/dist/{chunk-WL7HS7EM.js.map → chunk-V7JVMG63.js.map} +0 -0
- /package/dist/{chunk-C6NHFMIP.js.map → chunk-XADEMW6B.js.map} +0 -0
- /package/dist/{chunk-KTNDT45N.js.map → chunk-XEMLYWHK.js.map} +0 -0
- /package/dist/{chunk-B6SXRCBO.js.map → chunk-ZM44MGC5.js.map} +0 -0
- /package/dist/{config-34LHOGLM.js.map → config-2LASFFRD.js.map} +0 -0
- /package/dist/{config-3BBWD5AB.js.map → config-3WDIJPTG.js.map} +0 -0
- /package/dist/{config-3IVQJBNW.js.map → config-4QV4QYI5.js.map} +0 -0
- /package/dist/{config-4UDVSUQJ.js.map → config-54USUVSE.js.map} +0 -0
- /package/dist/{config-CMDBAPDH.js.map → config-5ZXN2T2H.js.map} +0 -0
- /package/dist/{config-CVZ2AGCO.js.map → config-A2GQYJDB.js.map} +0 -0
- /package/dist/{config-D3RLSPNF.js.map → config-BBOLI7VE.js.map} +0 -0
- /package/dist/{config-DG65OEG3.js.map → config-BIBFLUIR.js.map} +0 -0
- /package/dist/{config-EIHSP5DZ.js.map → config-CPYFOUQO.js.map} +0 -0
- /package/dist/{config-EO23EY62.js.map → config-DWSJL3NH.js.map} +0 -0
- /package/dist/{config-GCQK6NJY.js.map → config-E22XAGYN.js.map} +0 -0
- /package/dist/{config-GE4W4ZJC.js.map → config-EHE52ZTK.js.map} +0 -0
- /package/dist/{config-GHRUKEQ6.js.map → config-EX3ZJTZI.js.map} +0 -0
- /package/dist/{config-GVH27UPE.js.map → config-FRK7ZL37.js.map} +0 -0
- /package/dist/{config-HKRMKD76.js.map → config-HQXNFQZS.js.map} +0 -0
- /package/dist/{config-HXVYIXP5.js.map → config-HTXOOAOD.js.map} +0 -0
- /package/dist/{config-IDZMEW73.js.map → config-IPNWAJHH.js.map} +0 -0
- /package/dist/{config-IJJXGLBQ.js.map → config-J2C53GOT.js.map} +0 -0
- /package/dist/{config-IVY5EQQ2.js.map → config-K63RX6EU.js.map} +0 -0
- /package/dist/{config-KJOLGVB2.js.map → config-L7SBSH5L.js.map} +0 -0
- /package/dist/{config-KMVCVBYN.js.map → config-LEALEMKA.js.map} +0 -0
- /package/dist/{config-KYTRXAB2.js.map → config-M3Z47VYU.js.map} +0 -0
- /package/dist/{config-LHFFXVYI.js.map → config-MZM3IPFM.js.map} +0 -0
- /package/dist/{config-NV5WXP64.js.map → config-OJ2BPESH.js.map} +0 -0
- /package/dist/{config-OT2TQQCN.js.map → config-QO2XUME4.js.map} +0 -0
- /package/dist/{config-Q45Y46YT.js.map → config-QWQGOXQ5.js.map} +0 -0
- /package/dist/{config-QAA646XB.js.map → config-RI7IEZUF.js.map} +0 -0
- /package/dist/{config-QNMKWJ4M.js.map → config-SPW6NESU.js.map} +0 -0
- /package/dist/{config-QWCY3LBQ.js.map → config-T2IUIU5C.js.map} +0 -0
- /package/dist/{config-VM526IKB.js.map → config-UU27ALAA.js.map} +0 -0
- /package/dist/{config-WDAZFXYD.js.map → config-VKKZGC7V.js.map} +0 -0
- /package/dist/{config-ZFJYQZCH.js.map → config-W7EVPJNK.js.map} +0 -0
- /package/dist/{config-ZV6G2ZEC.js.map → config-WKQ3FGTZ.js.map} +0 -0
- /package/dist/{databricks_volume-HNQ4DJVJ.js.map → config-WVILHDFV.js.map} +0 -0
- /package/dist/{digitalocean-6SPR4S7V.js.map → config-XU6D5C7E.js.map} +0 -0
- /package/dist/{discord-SAV2RBJV.js.map → databricks_volume-ETRDJVVQ.js.map} +0 -0
- /package/dist/{disk-POACMF4G.js.map → digitalocean-QP72DR4J.js.map} +0 -0
- /package/dist/{dropbox-CQ7MTYX2.js.map → discord-BSN5RB3E.js.map} +0 -0
- /package/dist/{email-KBQ7CXS7.js.map → disk-24NWTN2I.js.map} +0 -0
- /package/dist/{gcs-SMIE4VMT.js.map → dropbox-OSTZXSIE.js.map} +0 -0
- /package/dist/{gdocs-X5Y2SIQX.js.map → email-4ZFPSWIN.js.map} +0 -0
- /package/dist/{gdrive-SIQPRIGI.js.map → gcs-PFWR6MIW.js.map} +0 -0
- /package/dist/{github-KBHWANKQ.js.map → gdocs-GPAZRQG5.js.map} +0 -0
- /package/dist/{github_ci-HPITNK37.js.map → gdrive-XSX6A7B3.js.map} +0 -0
- /package/dist/{gmail-DKHAGJNX.js.map → github-EQ4NXUTA.js.map} +0 -0
- /package/dist/{gsheets-ZSUDIWGK.js.map → github_ci-QL5B2Q2N.js.map} +0 -0
- /package/dist/{gslides-GYXM7IMJ.js.map → gmail-2TBT4CVH.js.map} +0 -0
- /package/dist/{hf_buckets-RIOMV7WG.js.map → gridfs-KZRZ6SIB.js.map} +0 -0
- /package/dist/{hf_datasets-QF4BQ3OK.js.map → gsheets-N53WEXN2.js.map} +0 -0
- /package/dist/{hf_models-62GC2HPZ.js.map → gslides-TATSARTH.js.map} +0 -0
- /package/dist/{hf_spaces-NVSMUNRM.js.map → hf_buckets-BK7NGJWS.js.map} +0 -0
- /package/dist/{langfuse-HUAYVPHF.js.map → hf_datasets-UQ5QGM4L.js.map} +0 -0
- /package/dist/{linear-2MM55KBC.js.map → hf_models-75LFCQCS.js.map} +0 -0
- /package/dist/{minio-L3XE6PQS.js.map → hf_spaces-6T2KB3UC.js.map} +0 -0
- /package/dist/{mongodb-ZOX4FRHJ.js.map → langfuse-AMQCQWNE.js.map} +0 -0
- /package/dist/{notion-UK4GTMT4.js.map → linear-V3TXO6CV.js.map} +0 -0
- /package/dist/{oci-NURLWPL2.js.map → minio-IZRZY4C5.js.map} +0 -0
- /package/dist/{postgres-JNFMPAO2.js.map → mongodb-VMKPQCPX.js.map} +0 -0
- /package/dist/{qingstor-W55D5YFO.js.map → nextcloud-5RHQCGDO.js.map} +0 -0
- /package/dist/{r2-FSZK7IFI.js.map → notion-6PPNTQFM.js.map} +0 -0
- /package/dist/{redis-S6GIPA4Z.js.map → oci-CKYBSFZJ.js.map} +0 -0
- /package/dist/{s3-GMPUJ65D.js.map → postgres-WIQBVL5M.js.map} +0 -0
- /package/dist/{scaleway-5VM55Y6D.js.map → qingstor-AP4IIPLY.js.map} +0 -0
- /package/dist/{seaweedfs-J3EPUEPE.js.map → r2-C4XGEWQY.js.map} +0 -0
- /package/dist/{slack-FVBXY7KD.js.map → redis-6D55Q2WB.js.map} +0 -0
- /package/dist/{ssh-GCXETJ3Z.js.map → s3-XQBI2CXN.js.map} +0 -0
- /package/dist/{supabase-HLWNHBBE.js.map → scaleway-SEZJVURB.js.map} +0 -0
- /package/dist/{tencent-YDO73XBD.js.map → seaweedfs-3XYIAFU2.js.map} +0 -0
- /package/dist/{trello-CQ53BQUL.js.map → slack-ZHXDJQY4.js.map} +0 -0
- /package/dist/{wasabi-SOZKPMRQ.js.map → ssh-X2MO7JOV.js.map} +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
redactEmailConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CQCTCW4S.js";
|
|
4
4
|
|
|
5
5
|
// src/resource/email/email.ts
|
|
6
6
|
import {
|
|
7
7
|
BaseResource,
|
|
8
|
-
PathSpec as
|
|
9
|
-
ResourceName as
|
|
8
|
+
PathSpec as PathSpec3,
|
|
9
|
+
ResourceName as ResourceName11,
|
|
10
|
+
makeResolveGlob,
|
|
11
|
+
mountKey as mountKey4,
|
|
12
|
+
mountPrefixOf as mountPrefixOf7
|
|
10
13
|
} from "@struktoai/mirage-core";
|
|
11
14
|
|
|
12
15
|
// src/accessor/email.ts
|
|
@@ -52,28 +55,32 @@ var EmailAccessor = class extends Accessor {
|
|
|
52
55
|
}
|
|
53
56
|
};
|
|
54
57
|
|
|
55
|
-
// src/commands/builtin/email/
|
|
56
|
-
import { ResourceName
|
|
57
|
-
var EMAIL_BASENAME = command({
|
|
58
|
-
name: "basename",
|
|
59
|
-
resource: ResourceName.EMAIL,
|
|
60
|
-
spec: specOf("basename"),
|
|
61
|
-
fn: basenameFn
|
|
62
|
-
});
|
|
58
|
+
// src/commands/builtin/email/index.ts
|
|
59
|
+
import { ResourceName as ResourceName9, makeGenericCommands } from "@struktoai/mirage-core";
|
|
63
60
|
|
|
64
|
-
// src/commands/builtin/email/
|
|
61
|
+
// src/commands/builtin/email/find.ts
|
|
65
62
|
import {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
FileType as FileType2,
|
|
64
|
+
IOResult,
|
|
65
|
+
PathSpec as PathSpec2,
|
|
66
|
+
ResourceName,
|
|
67
|
+
command,
|
|
68
|
+
formatRecords,
|
|
69
|
+
mountKey as mountKey3,
|
|
70
|
+
mountPrefixOf as mountPrefixOf4,
|
|
71
|
+
resolveGlobOf,
|
|
72
|
+
rstripSlash,
|
|
73
|
+
specOf,
|
|
74
|
+
stripSlash as stripSlash2
|
|
70
75
|
} from "@struktoai/mirage-core";
|
|
71
76
|
|
|
72
|
-
// src/core/email/glob.ts
|
|
73
|
-
import { PathSpec as PathSpecCtor2, rstripSlash } from "@struktoai/mirage-core";
|
|
74
|
-
|
|
75
77
|
// src/core/email/readdir.ts
|
|
76
|
-
import {
|
|
78
|
+
import {
|
|
79
|
+
IndexEntry,
|
|
80
|
+
PathSpec as PathSpecCtor,
|
|
81
|
+
mountKey,
|
|
82
|
+
mountPrefixOf
|
|
83
|
+
} from "@struktoai/mirage-core";
|
|
77
84
|
|
|
78
85
|
// src/core/email/_parse.ts
|
|
79
86
|
import { loadOptionalPeer as loadOptionalPeer2 } from "@struktoai/mirage-core";
|
|
@@ -97,6 +104,12 @@ function toAddrList(list) {
|
|
|
97
104
|
const objs = Array.isArray(list) ? list : [list];
|
|
98
105
|
return objs.flatMap((obj) => obj.value.map((a) => toAddr(a)));
|
|
99
106
|
}
|
|
107
|
+
function rawDateHeader(parsed) {
|
|
108
|
+
const found = parsed.headerLines.find((h) => h.key === "date");
|
|
109
|
+
if (found === void 0) return "";
|
|
110
|
+
const colon = found.line.indexOf(":");
|
|
111
|
+
return colon === -1 ? "" : found.line.slice(colon + 1).trim();
|
|
112
|
+
}
|
|
100
113
|
function fromParsed(parsed, headersOnly) {
|
|
101
114
|
const text = headersOnly ? "" : parsed.text ?? "";
|
|
102
115
|
const html = headersOnly ? "" : typeof parsed.html === "string" ? parsed.html : "";
|
|
@@ -112,7 +125,7 @@ function fromParsed(parsed, headersOnly) {
|
|
|
112
125
|
to: toAddrList(parsed.to),
|
|
113
126
|
cc: toAddrList(parsed.cc),
|
|
114
127
|
subject: parsed.subject ?? "",
|
|
115
|
-
date: parsed
|
|
128
|
+
date: rawDateHeader(parsed),
|
|
116
129
|
body_text: text,
|
|
117
130
|
body_html: html,
|
|
118
131
|
snippet: text.slice(0, 100),
|
|
@@ -267,10 +280,10 @@ async function fetchHeaders(accessor, folder, uids) {
|
|
|
267
280
|
try {
|
|
268
281
|
const results = [];
|
|
269
282
|
for (const uid of uids) {
|
|
270
|
-
const msg = await imap.fetchOne(uid, {
|
|
283
|
+
const msg = await imap.fetchOne(uid, { source: true, flags: true, uid: true }, { uid: true });
|
|
271
284
|
if (msg === false) continue;
|
|
272
|
-
const
|
|
273
|
-
const parsed = await parseRfc822(
|
|
285
|
+
const source = msg.source instanceof Buffer ? new Uint8Array(msg.source) : new Uint8Array(0);
|
|
286
|
+
const parsed = await parseRfc822(source);
|
|
274
287
|
results.push({
|
|
275
288
|
...parsed,
|
|
276
289
|
uid,
|
|
@@ -333,11 +346,8 @@ function enoent(p) {
|
|
|
333
346
|
return e;
|
|
334
347
|
}
|
|
335
348
|
async function readdir(accessor, path, index) {
|
|
336
|
-
const prefix = path.
|
|
337
|
-
const
|
|
338
|
-
let p = raw;
|
|
339
|
-
if (prefix !== "" && p.startsWith(prefix)) p = p.slice(prefix.length) || "/";
|
|
340
|
-
const key = stripSlash(p);
|
|
349
|
+
const prefix = mountPrefixOf(path.virtual, path.resourcePath);
|
|
350
|
+
const key = (path.pattern !== null ? path.dir : path).resourcePath;
|
|
341
351
|
const virtualKey = key !== "" ? `${prefix}/${key}` : prefix !== "" ? prefix : "/";
|
|
342
352
|
const parts = key === "" ? [] : key.split("/");
|
|
343
353
|
const depth = parts.length;
|
|
@@ -366,7 +376,7 @@ async function readdir(accessor, path, index) {
|
|
|
366
376
|
const cached = await index.listDir(virtualKey);
|
|
367
377
|
if (cached.entries !== void 0 && cached.entries !== null) return cached.entries;
|
|
368
378
|
}
|
|
369
|
-
if (index === void 0) throw enoent(path.
|
|
379
|
+
if (index === void 0) throw enoent(path.virtual);
|
|
370
380
|
const maxMessages = accessor.config.maxMessages;
|
|
371
381
|
const uids = await listMessageUids(accessor, folderName, "ALL", maxMessages);
|
|
372
382
|
const headersList = await fetchHeaders(accessor, folderName, uids);
|
|
@@ -434,96 +444,25 @@ async function readdir(accessor, path, index) {
|
|
|
434
444
|
return dateEntries.map(([name]) => `${prefix}/${key}/${name}`);
|
|
435
445
|
}
|
|
436
446
|
if (depth === 2 || depth === 3) {
|
|
437
|
-
if (index === void 0) throw enoent(path.
|
|
447
|
+
if (index === void 0) throw enoent(path.virtual);
|
|
438
448
|
let cached = await index.listDir(virtualKey);
|
|
439
449
|
if (cached.entries !== void 0 && cached.entries !== null) return cached.entries;
|
|
440
450
|
const folderPath = prefix !== "" ? `${prefix}/${parts[0] ?? ""}` : `/${parts[0] ?? ""}`;
|
|
441
|
-
const folderSpec = new PathSpecCtor({
|
|
451
|
+
const folderSpec = new PathSpecCtor({
|
|
452
|
+
virtual: folderPath,
|
|
453
|
+
directory: folderPath,
|
|
454
|
+
resourcePath: mountKey(folderPath, prefix)
|
|
455
|
+
});
|
|
442
456
|
await readdir(accessor, folderSpec, index);
|
|
443
457
|
cached = await index.listDir(virtualKey);
|
|
444
458
|
if (cached.entries !== void 0 && cached.entries !== null) return cached.entries;
|
|
445
|
-
throw enoent(path.
|
|
459
|
+
throw enoent(path.virtual);
|
|
446
460
|
}
|
|
447
|
-
throw enoent(path.
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// src/core/email/glob.ts
|
|
451
|
-
import { fnmatch } from "@struktoai/mirage-core";
|
|
452
|
-
var SCOPE_ERROR = 1e3;
|
|
453
|
-
async function resolveGlob(accessor, paths, index) {
|
|
454
|
-
const result = [];
|
|
455
|
-
for (const p of paths) {
|
|
456
|
-
if (p.resolved) {
|
|
457
|
-
result.push(p);
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
if (p.pattern !== null && p.pattern !== "") {
|
|
461
|
-
const entries = await readdir(accessor, p, index);
|
|
462
|
-
const matched = [];
|
|
463
|
-
for (const entry of entries) {
|
|
464
|
-
const trimmed = rstripSlash(entry);
|
|
465
|
-
const base = trimmed.split("/").pop() ?? trimmed;
|
|
466
|
-
if (!fnmatch(base, p.pattern)) continue;
|
|
467
|
-
matched.push(PathSpecCtor2.fromStrPath(trimmed, p.prefix));
|
|
468
|
-
}
|
|
469
|
-
const truncated = matched.length > SCOPE_ERROR ? matched.slice(0, SCOPE_ERROR) : matched;
|
|
470
|
-
result.push(...truncated);
|
|
471
|
-
} else {
|
|
472
|
-
result.push(p);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
return result;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/core/email/read.ts
|
|
479
|
-
import { gnuDirname, stripSlash as stripSlash2 } from "@struktoai/mirage-core";
|
|
480
|
-
var ENC = new TextEncoder();
|
|
481
|
-
function enoent2(p) {
|
|
482
|
-
const e = new Error(`ENOENT: ${p}`);
|
|
483
|
-
e.code = "ENOENT";
|
|
484
|
-
return e;
|
|
485
|
-
}
|
|
486
|
-
function eisdir(p) {
|
|
487
|
-
const e = new Error(`EISDIR: ${p}`);
|
|
488
|
-
e.code = "EISDIR";
|
|
489
|
-
return e;
|
|
490
|
-
}
|
|
491
|
-
async function read(accessor, path, index) {
|
|
492
|
-
const prefix = path.prefix;
|
|
493
|
-
let p = path.original;
|
|
494
|
-
if (prefix !== "" && p.startsWith(prefix)) p = p.slice(prefix.length) || "/";
|
|
495
|
-
const key = stripSlash2(p);
|
|
496
|
-
if (index === void 0) throw enoent2(path.original);
|
|
497
|
-
const virtualKey = prefix !== "" ? `${prefix}/${key}` : `/${key}`;
|
|
498
|
-
const result = await index.get(virtualKey);
|
|
499
|
-
if (result.entry === void 0 || result.entry === null) throw enoent2(path.original);
|
|
500
|
-
const rt = result.entry.resourceType;
|
|
501
|
-
if (rt === "email/folder" || rt === "email/date" || rt === "email/attachment_dir") {
|
|
502
|
-
throw eisdir(path.original);
|
|
503
|
-
}
|
|
504
|
-
if (rt === "email/attachment") {
|
|
505
|
-
const parentKey = gnuDirname(virtualKey);
|
|
506
|
-
const parentResult = await index.get(parentKey);
|
|
507
|
-
if (parentResult.entry === void 0 || parentResult.entry === null) {
|
|
508
|
-
throw enoent2(path.original);
|
|
509
|
-
}
|
|
510
|
-
const uid2 = parentResult.entry.id;
|
|
511
|
-
const parts2 = stripSlash2(virtualKey).split("/");
|
|
512
|
-
const folder2 = prefix !== "" ? parts2[1] ?? "" : parts2[0] ?? "";
|
|
513
|
-
const filename = result.entry.vfsName !== "" ? result.entry.vfsName : result.entry.name;
|
|
514
|
-
const data = await fetchAttachment(accessor, folder2, uid2, filename);
|
|
515
|
-
if (data === null) throw enoent2(path.original);
|
|
516
|
-
return data;
|
|
517
|
-
}
|
|
518
|
-
const parts = stripSlash2(virtualKey).split("/");
|
|
519
|
-
const folder = prefix !== "" ? parts[1] ?? "" : parts[0] ?? "";
|
|
520
|
-
const uid = result.entry.id;
|
|
521
|
-
const msg = await fetchMessage(accessor, folder, uid);
|
|
522
|
-
return ENC.encode(JSON.stringify(msg));
|
|
461
|
+
throw enoent(path.virtual);
|
|
523
462
|
}
|
|
524
463
|
|
|
525
464
|
// src/core/email/stat.ts
|
|
526
|
-
import { FileStat, FileType,
|
|
465
|
+
import { FileStat, FileType, PathSpec, mountKey as mountKey2, mountPrefixOf as mountPrefixOf2 } from "@struktoai/mirage-core";
|
|
527
466
|
function guessType(name) {
|
|
528
467
|
const lower = name.toLowerCase();
|
|
529
468
|
if (lower.endsWith(".json") || lower.endsWith(".email.json")) return FileType.JSON;
|
|
@@ -539,27 +478,41 @@ function guessType(name) {
|
|
|
539
478
|
}
|
|
540
479
|
return FileType.BINARY;
|
|
541
480
|
}
|
|
542
|
-
function
|
|
481
|
+
function enoent2(p) {
|
|
543
482
|
const e = new Error(`ENOENT: ${p}`);
|
|
544
483
|
e.code = "ENOENT";
|
|
545
484
|
return e;
|
|
546
485
|
}
|
|
547
486
|
async function stat(accessor, path, index) {
|
|
548
|
-
const prefix = path.
|
|
549
|
-
|
|
550
|
-
if (prefix !== "" && p.startsWith(prefix)) p = p.slice(prefix.length) || "/";
|
|
551
|
-
const key = stripSlash3(p);
|
|
487
|
+
const prefix = mountPrefixOf2(path.virtual, path.resourcePath);
|
|
488
|
+
const key = path.resourcePath;
|
|
552
489
|
if (key === "") return new FileStat({ name: "/", type: FileType.DIRECTORY });
|
|
553
|
-
if (index === void 0) throw
|
|
490
|
+
if (index === void 0) throw enoent2(path.virtual);
|
|
554
491
|
const virtualKey = prefix !== "" ? `${prefix}/${key}` : `/${key}`;
|
|
555
|
-
|
|
492
|
+
let result = await index.get(virtualKey);
|
|
556
493
|
if (result.entry === void 0 || result.entry === null) {
|
|
557
494
|
if (!key.includes("/")) {
|
|
558
495
|
const folders = await listFolders2(accessor);
|
|
559
496
|
if (folders.includes(key)) return new FileStat({ name: key, type: FileType.DIRECTORY });
|
|
560
|
-
throw
|
|
497
|
+
throw enoent2(path.virtual);
|
|
498
|
+
}
|
|
499
|
+
const parentVirtual = virtualKey.slice(0, virtualKey.lastIndexOf("/")) || "/";
|
|
500
|
+
try {
|
|
501
|
+
await readdir(
|
|
502
|
+
accessor,
|
|
503
|
+
new PathSpec({
|
|
504
|
+
virtual: parentVirtual,
|
|
505
|
+
directory: parentVirtual,
|
|
506
|
+
resolved: false,
|
|
507
|
+
resourcePath: mountKey2(parentVirtual, prefix)
|
|
508
|
+
}),
|
|
509
|
+
index
|
|
510
|
+
);
|
|
511
|
+
} catch {
|
|
512
|
+
throw enoent2(path.virtual);
|
|
561
513
|
}
|
|
562
|
-
|
|
514
|
+
result = await index.get(virtualKey);
|
|
515
|
+
if (result.entry === void 0 || result.entry === null) throw enoent2(path.virtual);
|
|
563
516
|
}
|
|
564
517
|
const rt = result.entry.resourceType;
|
|
565
518
|
const vfsName = result.entry.vfsName !== "" ? result.entry.vfsName : result.entry.name;
|
|
@@ -591,6 +544,64 @@ async function stat(accessor, path, index) {
|
|
|
591
544
|
return new FileStat({ name: vfsName, type: FileType.JSON, extra: { uid: result.entry.id } });
|
|
592
545
|
}
|
|
593
546
|
|
|
547
|
+
// src/core/email/read.ts
|
|
548
|
+
import { gnuDirname, mountPrefixOf as mountPrefixOf3, stripSlash } from "@struktoai/mirage-core";
|
|
549
|
+
var ENC = new TextEncoder();
|
|
550
|
+
function enoent3(p) {
|
|
551
|
+
const e = new Error(`ENOENT: ${p}`);
|
|
552
|
+
e.code = "ENOENT";
|
|
553
|
+
return e;
|
|
554
|
+
}
|
|
555
|
+
function eisdir(p) {
|
|
556
|
+
const e = new Error(`EISDIR: ${p}`);
|
|
557
|
+
e.code = "EISDIR";
|
|
558
|
+
return e;
|
|
559
|
+
}
|
|
560
|
+
async function read(accessor, path, index) {
|
|
561
|
+
const prefix = mountPrefixOf3(path.virtual, path.resourcePath);
|
|
562
|
+
const key = path.resourcePath;
|
|
563
|
+
if (index === void 0) throw enoent3(path.virtual);
|
|
564
|
+
const virtualKey = prefix !== "" ? `${prefix}/${key}` : `/${key}`;
|
|
565
|
+
const result = await index.get(virtualKey);
|
|
566
|
+
if (result.entry === void 0 || result.entry === null) throw enoent3(path.virtual);
|
|
567
|
+
const rt = result.entry.resourceType;
|
|
568
|
+
if (rt === "email/folder" || rt === "email/date" || rt === "email/attachment_dir") {
|
|
569
|
+
throw eisdir(path.virtual);
|
|
570
|
+
}
|
|
571
|
+
if (rt === "email/attachment") {
|
|
572
|
+
const parentKey = gnuDirname(virtualKey);
|
|
573
|
+
const parentResult = await index.get(parentKey);
|
|
574
|
+
if (parentResult.entry === void 0 || parentResult.entry === null) {
|
|
575
|
+
throw enoent3(path.virtual);
|
|
576
|
+
}
|
|
577
|
+
const uid2 = parentResult.entry.id;
|
|
578
|
+
const parts2 = stripSlash(virtualKey).split("/");
|
|
579
|
+
const folder2 = prefix !== "" ? parts2[1] ?? "" : parts2[0] ?? "";
|
|
580
|
+
const filename = result.entry.vfsName !== "" ? result.entry.vfsName : result.entry.name;
|
|
581
|
+
const data = await fetchAttachment(accessor, folder2, uid2, filename);
|
|
582
|
+
if (data === null) throw enoent3(path.virtual);
|
|
583
|
+
return data;
|
|
584
|
+
}
|
|
585
|
+
const parts = stripSlash(virtualKey).split("/");
|
|
586
|
+
const folder = prefix !== "" ? parts[1] ?? "" : parts[0] ?? "";
|
|
587
|
+
const uid = result.entry.id;
|
|
588
|
+
const msg = await fetchMessage(accessor, folder, uid);
|
|
589
|
+
return ENC.encode(JSON.stringify(msg));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// src/commands/builtin/email/io.ts
|
|
593
|
+
async function* emailReadStream(accessor, path, index) {
|
|
594
|
+
yield await read(accessor, path, index);
|
|
595
|
+
}
|
|
596
|
+
var EMAIL_IO = {
|
|
597
|
+
readdir,
|
|
598
|
+
readBytes: read,
|
|
599
|
+
readStream: emailReadStream,
|
|
600
|
+
stat,
|
|
601
|
+
isMounted: () => true,
|
|
602
|
+
local: false
|
|
603
|
+
};
|
|
604
|
+
|
|
594
605
|
// src/commands/builtin/email/provision.ts
|
|
595
606
|
import {
|
|
596
607
|
Precision,
|
|
@@ -602,7 +613,7 @@ async function fileReadProvision(_accessor, paths, _texts, opts) {
|
|
|
602
613
|
let ops = 0;
|
|
603
614
|
if (index !== void 0) {
|
|
604
615
|
for (const p of paths) {
|
|
605
|
-
const lookup = await index.get(p.
|
|
616
|
+
const lookup = await index.get(p.virtual);
|
|
606
617
|
if (lookup.entry !== void 0 && lookup.entry !== null) ops += 1;
|
|
607
618
|
}
|
|
608
619
|
}
|
|
@@ -622,50 +633,10 @@ function metadataProvision(_accessor, _paths, _texts, _opts) {
|
|
|
622
633
|
});
|
|
623
634
|
}
|
|
624
635
|
|
|
625
|
-
// src/commands/builtin/email/cat.ts
|
|
626
|
-
async function* emailStream(accessor, p, index) {
|
|
627
|
-
yield await read(accessor, p, index);
|
|
628
|
-
}
|
|
629
|
-
async function catCommand(accessor, paths, texts, opts) {
|
|
630
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
631
|
-
return catGeneric(
|
|
632
|
-
resolved,
|
|
633
|
-
texts,
|
|
634
|
-
opts,
|
|
635
|
-
(p) => stat(accessor, p, opts.index ?? void 0),
|
|
636
|
-
(p) => emailStream(accessor, p, opts.index ?? void 0)
|
|
637
|
-
);
|
|
638
|
-
}
|
|
639
|
-
var EMAIL_CAT = command2({
|
|
640
|
-
name: "cat",
|
|
641
|
-
resource: ResourceName2.EMAIL,
|
|
642
|
-
spec: specOf2("cat"),
|
|
643
|
-
fn: catCommand,
|
|
644
|
-
provision: fileReadProvision
|
|
645
|
-
});
|
|
646
|
-
|
|
647
|
-
// src/commands/builtin/email/dirname.ts
|
|
648
|
-
import { ResourceName as ResourceName3, command as command3, specOf as specOf3, dirnameFn } from "@struktoai/mirage-core";
|
|
649
|
-
var EMAIL_DIRNAME = command3({
|
|
650
|
-
name: "dirname",
|
|
651
|
-
resource: ResourceName3.EMAIL,
|
|
652
|
-
spec: specOf3("dirname"),
|
|
653
|
-
fn: dirnameFn
|
|
654
|
-
});
|
|
655
|
-
|
|
656
636
|
// src/commands/builtin/email/find.ts
|
|
657
|
-
import {
|
|
658
|
-
IOResult,
|
|
659
|
-
PathSpec,
|
|
660
|
-
ResourceName as ResourceName4,
|
|
661
|
-
command as command4,
|
|
662
|
-
specOf as specOf4,
|
|
663
|
-
rstripSlash as rstripSlash2,
|
|
664
|
-
stripSlash as stripSlash4,
|
|
665
|
-
formatRecords
|
|
666
|
-
} from "@struktoai/mirage-core";
|
|
667
|
-
import { fnmatch as fnmatch2 } from "@struktoai/mirage-core";
|
|
637
|
+
import { fnmatch } from "@struktoai/mirage-core";
|
|
668
638
|
import { findSizeMtimeError, invalidFindArg } from "@struktoai/mirage-core";
|
|
639
|
+
var resolveGlob = resolveGlobOf(EMAIL_IO);
|
|
669
640
|
async function walk(accessor, path, index, maxDepth, depth) {
|
|
670
641
|
if (maxDepth !== null && depth > maxDepth) return [];
|
|
671
642
|
let children;
|
|
@@ -676,16 +647,21 @@ async function walk(accessor, path, index, maxDepth, depth) {
|
|
|
676
647
|
}
|
|
677
648
|
const results = [];
|
|
678
649
|
for (const child of children) {
|
|
679
|
-
const
|
|
680
|
-
const trimmed = isFolder ? rstripSlash2(child) : child;
|
|
650
|
+
const trimmed = rstripSlash(child);
|
|
681
651
|
results.push(trimmed);
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
652
|
+
const childSpec = new PathSpec2({
|
|
653
|
+
virtual: trimmed,
|
|
654
|
+
directory: trimmed,
|
|
655
|
+
resolved: false,
|
|
656
|
+
resourcePath: mountKey3(trimmed, mountPrefixOf4(path.virtual, path.resourcePath))
|
|
657
|
+
});
|
|
658
|
+
let st;
|
|
659
|
+
try {
|
|
660
|
+
st = await stat(accessor, childSpec, index ?? void 0);
|
|
661
|
+
} catch {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
if (st.type === FileType2.DIRECTORY) {
|
|
689
665
|
const sub = await walk(accessor, childSpec, index, maxDepth, depth + 1);
|
|
690
666
|
results.push(...sub);
|
|
691
667
|
}
|
|
@@ -694,11 +670,11 @@ async function walk(accessor, path, index, maxDepth, depth) {
|
|
|
694
670
|
}
|
|
695
671
|
async function findCommand(accessor, paths, _texts, opts) {
|
|
696
672
|
const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
|
|
697
|
-
const p0 = resolved[0] ?? new
|
|
698
|
-
|
|
673
|
+
const p0 = resolved[0] ?? new PathSpec2({
|
|
674
|
+
virtual: "/",
|
|
699
675
|
directory: "/",
|
|
700
676
|
resolved: false,
|
|
701
|
-
|
|
677
|
+
resourcePath: ""
|
|
702
678
|
});
|
|
703
679
|
const nameFlag = typeof opts.flags.name === "string" ? opts.flags.name : null;
|
|
704
680
|
const inameFlag = typeof opts.flags.iname === "string" ? opts.flags.iname : null;
|
|
@@ -715,26 +691,26 @@ async function findCommand(accessor, paths, _texts, opts) {
|
|
|
715
691
|
const sizeMtimeErr = findSizeMtimeError(sizeFlag, mtimeFlag);
|
|
716
692
|
if (sizeMtimeErr !== null) return sizeMtimeErr;
|
|
717
693
|
const allPaths = await walk(accessor, p0, opts.index, maxDepth, 0);
|
|
718
|
-
const searchKey =
|
|
694
|
+
const searchKey = stripSlash2(p0.mountPath);
|
|
719
695
|
const baseDepth = searchKey === "" ? -1 : searchKey.split("/").length - 1;
|
|
720
696
|
const results = [];
|
|
721
697
|
for (const p of [...allPaths].sort()) {
|
|
722
|
-
const stripped = p.startsWith(p0.
|
|
723
|
-
const trimmed =
|
|
698
|
+
const stripped = p.startsWith(mountPrefixOf4(p0.virtual, p0.resourcePath)) ? p.slice(mountPrefixOf4(p0.virtual, p0.resourcePath).length) : p;
|
|
699
|
+
const trimmed = stripSlash2(stripped);
|
|
724
700
|
const depth = trimmed === "" ? -1 : trimmed.split("/").length - (baseDepth + 2);
|
|
725
701
|
if (minDepth !== null && depth < minDepth) continue;
|
|
726
702
|
const entryName = p.split("/").pop() ?? p;
|
|
727
|
-
if (nameFlag !== null && !
|
|
728
|
-
if (inameFlag !== null && !
|
|
703
|
+
if (nameFlag !== null && !fnmatch(entryName, nameFlag)) continue;
|
|
704
|
+
if (inameFlag !== null && !fnmatch(entryName.toLowerCase(), inameFlag.toLowerCase())) continue;
|
|
729
705
|
results.push(p);
|
|
730
706
|
}
|
|
731
707
|
const out = formatRecords(results);
|
|
732
708
|
return [out, new IOResult()];
|
|
733
709
|
}
|
|
734
|
-
var EMAIL_FIND =
|
|
710
|
+
var EMAIL_FIND = command({
|
|
735
711
|
name: "find",
|
|
736
|
-
resource:
|
|
737
|
-
spec:
|
|
712
|
+
resource: ResourceName.EMAIL,
|
|
713
|
+
spec: specOf("find"),
|
|
738
714
|
fn: findCommand,
|
|
739
715
|
provision: metadataProvision
|
|
740
716
|
});
|
|
@@ -745,8 +721,8 @@ import {
|
|
|
745
721
|
IOResult as IOResult2,
|
|
746
722
|
OperandKind,
|
|
747
723
|
Option,
|
|
748
|
-
ResourceName as
|
|
749
|
-
command as
|
|
724
|
+
ResourceName as ResourceName2,
|
|
725
|
+
command as command2
|
|
750
726
|
} from "@struktoai/mirage-core";
|
|
751
727
|
|
|
752
728
|
// src/core/email/send.ts
|
|
@@ -849,9 +825,9 @@ async function emailForwardCommand(accessor, _paths, _texts, opts) {
|
|
|
849
825
|
const out = ENC2.encode(JSON.stringify(result));
|
|
850
826
|
return [out, new IOResult2()];
|
|
851
827
|
}
|
|
852
|
-
var EMAIL_FORWARD =
|
|
853
|
-
name: "
|
|
854
|
-
resource:
|
|
828
|
+
var EMAIL_FORWARD = command2({
|
|
829
|
+
name: "himalaya message forward",
|
|
830
|
+
resource: ResourceName2.EMAIL,
|
|
855
831
|
spec: SPEC,
|
|
856
832
|
fn: emailForwardCommand,
|
|
857
833
|
write: true
|
|
@@ -860,26 +836,21 @@ var EMAIL_FORWARD = command5({
|
|
|
860
836
|
// src/commands/builtin/email/grep.ts
|
|
861
837
|
import {
|
|
862
838
|
IOResult as IOResult3,
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
command as command6,
|
|
839
|
+
ResourceName as ResourceName3,
|
|
840
|
+
command as command3,
|
|
866
841
|
compilePattern,
|
|
867
|
-
|
|
868
|
-
grepFilesOnly,
|
|
842
|
+
grepGeneric,
|
|
869
843
|
grepLines,
|
|
870
|
-
|
|
844
|
+
mountPrefixOf as mountPrefixOf5,
|
|
871
845
|
prefixAggregate,
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
specOf as specOf5,
|
|
875
|
-
yieldBytes,
|
|
876
|
-
formatRecords as formatRecords2
|
|
846
|
+
resolveGlobOf as resolveGlobOf2,
|
|
847
|
+
specOf as specOf2
|
|
877
848
|
} from "@struktoai/mirage-core";
|
|
878
849
|
|
|
879
850
|
// src/core/email/scope.ts
|
|
880
|
-
import { stripSlash as
|
|
851
|
+
import { stripSlash as stripSlash3 } from "@struktoai/mirage-core";
|
|
881
852
|
function detectScope(path) {
|
|
882
|
-
const key =
|
|
853
|
+
const key = stripSlash3(path.mountPath);
|
|
883
854
|
if (key === "") {
|
|
884
855
|
return { useNative: false, folder: null, resourcePath: "/" };
|
|
885
856
|
}
|
|
@@ -964,8 +935,11 @@ async function searchAndFormat(accessor, scope, pattern, prefix, maxResults = nu
|
|
|
964
935
|
}
|
|
965
936
|
|
|
966
937
|
// src/commands/builtin/email/grep.ts
|
|
938
|
+
var resolveGlob2 = resolveGlobOf2(EMAIL_IO);
|
|
967
939
|
var ENC3 = new TextEncoder();
|
|
968
|
-
|
|
940
|
+
async function* emailStream(accessor, p, index) {
|
|
941
|
+
yield await read(accessor, p, index);
|
|
942
|
+
}
|
|
969
943
|
function parseFlags(flags) {
|
|
970
944
|
const toInt = (v) => typeof v === "string" ? Number.parseInt(v, 10) : null;
|
|
971
945
|
const aCtx = toInt(flags.A);
|
|
@@ -991,10 +965,6 @@ function getPattern(texts, flags) {
|
|
|
991
965
|
if (texts.length > 0 && texts[0] !== void 0) return texts[0];
|
|
992
966
|
throw new Error("grep: usage: grep [flags] pattern [path]");
|
|
993
967
|
}
|
|
994
|
-
function splitLinesNoTrailing(text) {
|
|
995
|
-
const stripped = text.endsWith("\n") ? text.slice(0, -1) : text;
|
|
996
|
-
return stripped === "" ? [] : stripped.split("\n");
|
|
997
|
-
}
|
|
998
968
|
async function grepCommand(accessor, paths, texts, opts) {
|
|
999
969
|
let pattern;
|
|
1000
970
|
try {
|
|
@@ -1005,14 +975,13 @@ async function grepCommand(accessor, paths, texts, opts) {
|
|
|
1005
975
|
`) })];
|
|
1006
976
|
}
|
|
1007
977
|
const f = parseFlags(opts.flags);
|
|
1008
|
-
const recursive = opts.flags.r === true || opts.flags.R === true;
|
|
1009
978
|
if (paths.length > 0) {
|
|
1010
979
|
const first = paths[0];
|
|
1011
980
|
if (first !== void 0) {
|
|
1012
981
|
const scope = detectScope(first);
|
|
1013
|
-
if (scope.useNative) {
|
|
1014
|
-
const
|
|
1015
|
-
const pairs = await searchAndFormat(accessor, scope, pattern,
|
|
982
|
+
if (scope.useNative && !pattern.includes("\n")) {
|
|
983
|
+
const filePrefix = mountPrefixOf5(first.virtual, first.resourcePath) !== "" ? mountPrefixOf5(first.virtual, first.resourcePath) : "";
|
|
984
|
+
const pairs = await searchAndFormat(accessor, scope, pattern, filePrefix, f.maxCount ?? 50);
|
|
1016
985
|
const lines = [];
|
|
1017
986
|
for (const [vfsPath, msgText] of pairs) {
|
|
1018
987
|
const matched = grepLines(
|
|
@@ -1028,225 +997,26 @@ async function grepCommand(accessor, paths, texts, opts) {
|
|
|
1028
997
|
return [out, new IOResult3()];
|
|
1029
998
|
}
|
|
1030
999
|
}
|
|
1031
|
-
const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
|
|
1032
|
-
if (resolved.length === 0) return [new Uint8Array(0), new IOResult3({ exitCode: 1 })];
|
|
1033
|
-
const filePrefix = resolved[0]?.prefix ?? "";
|
|
1034
|
-
const readdirFn = async (path) => {
|
|
1035
|
-
const spec = new PathSpec2({
|
|
1036
|
-
original: path,
|
|
1037
|
-
directory: path,
|
|
1038
|
-
resolved: false,
|
|
1039
|
-
prefix: filePrefix
|
|
1040
|
-
});
|
|
1041
|
-
return readdir(accessor, spec, opts.index ?? void 0);
|
|
1042
|
-
};
|
|
1043
|
-
const statFn = async (path) => {
|
|
1044
|
-
const spec = new PathSpec2({
|
|
1045
|
-
original: path,
|
|
1046
|
-
directory: path,
|
|
1047
|
-
resolved: false,
|
|
1048
|
-
prefix: filePrefix
|
|
1049
|
-
});
|
|
1050
|
-
return stat(accessor, spec, opts.index ?? void 0);
|
|
1051
|
-
};
|
|
1052
|
-
const readBytesFn = async (path) => {
|
|
1053
|
-
const spec = new PathSpec2({
|
|
1054
|
-
original: path,
|
|
1055
|
-
directory: path,
|
|
1056
|
-
resolved: true,
|
|
1057
|
-
prefix: filePrefix
|
|
1058
|
-
});
|
|
1059
|
-
return read(accessor, spec, opts.index ?? void 0);
|
|
1060
|
-
};
|
|
1061
|
-
if (f.filesOnly) {
|
|
1062
|
-
const warnings = [];
|
|
1063
|
-
const firstResolved2 = resolved[0];
|
|
1064
|
-
if (firstResolved2 === void 0) return [new Uint8Array(0), new IOResult3({ exitCode: 1 })];
|
|
1065
|
-
const results = await grepFilesOnly(
|
|
1066
|
-
readdirFn,
|
|
1067
|
-
statFn,
|
|
1068
|
-
readBytesFn,
|
|
1069
|
-
firstResolved2.original,
|
|
1070
|
-
pattern,
|
|
1071
|
-
{
|
|
1072
|
-
recursive,
|
|
1073
|
-
ignoreCase: f.ignoreCase,
|
|
1074
|
-
invert: f.invert,
|
|
1075
|
-
lineNumbers: f.lineNumbers,
|
|
1076
|
-
countOnly: f.countOnly,
|
|
1077
|
-
fixedString: f.fixedString,
|
|
1078
|
-
onlyMatching: f.onlyMatching,
|
|
1079
|
-
maxCount: f.maxCount,
|
|
1080
|
-
wholeWord: f.wholeWord
|
|
1081
|
-
},
|
|
1082
|
-
warnings
|
|
1083
|
-
);
|
|
1084
|
-
const stderr = warnings.length > 0 ? formatRecords2(warnings) : null;
|
|
1085
|
-
if (results.length === 0) return [new Uint8Array(0), new IOResult3({ exitCode: 1, stderr })];
|
|
1086
|
-
const out = formatRecords2(results);
|
|
1087
|
-
return [out, new IOResult3({ stderr })];
|
|
1088
|
-
}
|
|
1089
|
-
const pat2 = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord);
|
|
1090
|
-
if (resolved.length > 1) {
|
|
1091
|
-
const allResults = [];
|
|
1092
|
-
for (const p of resolved) {
|
|
1093
|
-
const data2 = splitLinesNoTrailing(
|
|
1094
|
-
DEC.decode(await read(accessor, p, opts.index ?? void 0))
|
|
1095
|
-
);
|
|
1096
|
-
const hits = grepLines(p.original, data2, pat2, f);
|
|
1097
|
-
if (f.countOnly) {
|
|
1098
|
-
if (hits.length > 0) allResults.push(`${p.original}:${hits[0] ?? ""}`);
|
|
1099
|
-
} else {
|
|
1100
|
-
for (const h of hits) allResults.push(`${p.original}:${h}`);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
if (allResults.length === 0) return [new Uint8Array(0), new IOResult3({ exitCode: 1 })];
|
|
1104
|
-
const out = formatRecords2(allResults);
|
|
1105
|
-
return [out, new IOResult3()];
|
|
1106
|
-
}
|
|
1107
|
-
const firstResolved = resolved[0];
|
|
1108
|
-
if (firstResolved === void 0) return [null, new IOResult3()];
|
|
1109
|
-
const data = await read(accessor, firstResolved, opts.index ?? void 0);
|
|
1110
|
-
const source2 = yieldBytes(data);
|
|
1111
|
-
const stream2 = grepStream(source2, pat2, f);
|
|
1112
|
-
if (f.quiet) {
|
|
1113
|
-
const io3 = new IOResult3({ exitCode: 1 });
|
|
1114
|
-
return [quietMatch(stream2, io3), io3];
|
|
1115
|
-
}
|
|
1116
|
-
const io2 = new IOResult3();
|
|
1117
|
-
return [exitOnEmpty(stream2, io2), io2];
|
|
1118
1000
|
}
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
return [null, new IOResult3({ exitCode: 2, stderr: ENC3.encode(`${msg}
|
|
1125
|
-
`) })];
|
|
1126
|
-
}
|
|
1127
|
-
const pat = compilePattern(pattern, f.ignoreCase, f.fixedString, f.wholeWord);
|
|
1128
|
-
const stream = grepStream(source, pat, f);
|
|
1129
|
-
if (f.quiet) {
|
|
1130
|
-
const io2 = new IOResult3({ exitCode: 1 });
|
|
1131
|
-
return [quietMatch(stream, io2), io2];
|
|
1132
|
-
}
|
|
1133
|
-
const io = new IOResult3();
|
|
1134
|
-
return [exitOnEmpty(stream, io), io];
|
|
1135
|
-
}
|
|
1136
|
-
var EMAIL_GREP = command6({
|
|
1137
|
-
name: "grep",
|
|
1138
|
-
resource: ResourceName6.EMAIL,
|
|
1139
|
-
spec: specOf5("grep"),
|
|
1140
|
-
fn: grepCommand,
|
|
1141
|
-
aggregate: prefixAggregate,
|
|
1142
|
-
provision: fileReadProvision
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
// src/commands/builtin/email/head.ts
|
|
1146
|
-
import {
|
|
1147
|
-
ResourceName as ResourceName7,
|
|
1148
|
-
command as command7,
|
|
1149
|
-
headGeneric,
|
|
1150
|
-
specOf as specOf6
|
|
1151
|
-
} from "@struktoai/mirage-core";
|
|
1152
|
-
async function* emailStream2(accessor, p, index) {
|
|
1153
|
-
yield await read(accessor, p, index);
|
|
1154
|
-
}
|
|
1155
|
-
async function headCommand(accessor, paths, texts, opts) {
|
|
1156
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1157
|
-
return headGeneric(
|
|
1001
|
+
const resolved = paths.length > 0 ? await resolveGlob2(accessor, paths, opts.index ?? void 0) : [];
|
|
1002
|
+
const stat2 = (p) => stat(accessor, p, opts.index ?? void 0);
|
|
1003
|
+
const readdir2 = (p) => readdir(accessor, p, opts.index ?? void 0);
|
|
1004
|
+
return grepGeneric(
|
|
1005
|
+
"grep",
|
|
1158
1006
|
resolved,
|
|
1159
1007
|
texts,
|
|
1160
1008
|
opts,
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
}
|
|
1165
|
-
var EMAIL_HEAD = command7({
|
|
1166
|
-
name: "head",
|
|
1167
|
-
resource: ResourceName7.EMAIL,
|
|
1168
|
-
spec: specOf6("head"),
|
|
1169
|
-
fn: headCommand,
|
|
1170
|
-
provision: fileReadProvision
|
|
1171
|
-
});
|
|
1172
|
-
|
|
1173
|
-
// src/commands/builtin/email/jq.ts
|
|
1174
|
-
import {
|
|
1175
|
-
ResourceName as ResourceName8,
|
|
1176
|
-
command as command8,
|
|
1177
|
-
jqGeneric,
|
|
1178
|
-
specOf as specOf7
|
|
1179
|
-
} from "@struktoai/mirage-core";
|
|
1180
|
-
async function* emailStream3(accessor, p, index) {
|
|
1181
|
-
yield await read(accessor, p, index);
|
|
1182
|
-
}
|
|
1183
|
-
async function jqCommand(accessor, paths, texts, opts) {
|
|
1184
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1185
|
-
const stream = (p) => emailStream3(accessor, p, opts.index ?? void 0);
|
|
1186
|
-
return jqGeneric(resolved, texts, opts, stream);
|
|
1187
|
-
}
|
|
1188
|
-
var EMAIL_JQ = command8({
|
|
1189
|
-
name: "jq",
|
|
1190
|
-
resource: ResourceName8.EMAIL,
|
|
1191
|
-
spec: specOf7("jq"),
|
|
1192
|
-
fn: jqCommand
|
|
1193
|
-
});
|
|
1194
|
-
|
|
1195
|
-
// src/commands/builtin/email/ls.ts
|
|
1196
|
-
import {
|
|
1197
|
-
PathSpec as PathSpec3,
|
|
1198
|
-
ResourceName as ResourceName9,
|
|
1199
|
-
command as command9,
|
|
1200
|
-
lsGeneric,
|
|
1201
|
-
specOf as specOf8
|
|
1202
|
-
} from "@struktoai/mirage-core";
|
|
1203
|
-
async function lsCommand(accessor, paths, _texts, opts) {
|
|
1204
|
-
let workingPaths = paths;
|
|
1205
|
-
if (workingPaths.length === 0) {
|
|
1206
|
-
workingPaths = [
|
|
1207
|
-
new PathSpec3({
|
|
1208
|
-
original: opts.cwd,
|
|
1209
|
-
directory: opts.cwd,
|
|
1210
|
-
resolved: false,
|
|
1211
|
-
prefix: opts.mountPrefix ?? ""
|
|
1212
|
-
})
|
|
1213
|
-
];
|
|
1214
|
-
}
|
|
1215
|
-
const resolved = await resolveGlob(accessor, workingPaths, opts.index ?? void 0);
|
|
1216
|
-
return lsGeneric(
|
|
1217
|
-
resolved,
|
|
1218
|
-
opts,
|
|
1219
|
-
(p) => readdir(accessor, p, opts.index ?? void 0),
|
|
1220
|
-
(p) => stat(accessor, p, opts.index ?? void 0)
|
|
1009
|
+
stat2,
|
|
1010
|
+
readdir2,
|
|
1011
|
+
(p) => emailStream(accessor, p, opts.index ?? void 0)
|
|
1221
1012
|
);
|
|
1222
1013
|
}
|
|
1223
|
-
var
|
|
1224
|
-
name: "
|
|
1225
|
-
resource:
|
|
1226
|
-
spec:
|
|
1227
|
-
fn:
|
|
1228
|
-
|
|
1229
|
-
});
|
|
1230
|
-
|
|
1231
|
-
// src/commands/builtin/email/nl.ts
|
|
1232
|
-
import {
|
|
1233
|
-
ResourceName as ResourceName10,
|
|
1234
|
-
command as command10,
|
|
1235
|
-
nlGeneric,
|
|
1236
|
-
specOf as specOf9
|
|
1237
|
-
} from "@struktoai/mirage-core";
|
|
1238
|
-
async function* emailStream4(accessor, p, index) {
|
|
1239
|
-
yield await read(accessor, p, index);
|
|
1240
|
-
}
|
|
1241
|
-
async function nlCommand(accessor, paths, _texts, opts) {
|
|
1242
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1243
|
-
return nlGeneric(resolved, opts, (p) => emailStream4(accessor, p, opts.index ?? void 0));
|
|
1244
|
-
}
|
|
1245
|
-
var EMAIL_NL = command10({
|
|
1246
|
-
name: "nl",
|
|
1247
|
-
resource: ResourceName10.EMAIL,
|
|
1248
|
-
spec: specOf9("nl"),
|
|
1249
|
-
fn: nlCommand,
|
|
1014
|
+
var EMAIL_GREP = command3({
|
|
1015
|
+
name: "grep",
|
|
1016
|
+
resource: ResourceName3.EMAIL,
|
|
1017
|
+
spec: specOf2("grep"),
|
|
1018
|
+
fn: grepCommand,
|
|
1019
|
+
aggregate: prefixAggregate,
|
|
1250
1020
|
provision: fileReadProvision
|
|
1251
1021
|
});
|
|
1252
1022
|
|
|
@@ -1256,8 +1026,8 @@ import {
|
|
|
1256
1026
|
IOResult as IOResult4,
|
|
1257
1027
|
OperandKind as OperandKind2,
|
|
1258
1028
|
Option as Option2,
|
|
1259
|
-
ResourceName as
|
|
1260
|
-
command as
|
|
1029
|
+
ResourceName as ResourceName4,
|
|
1030
|
+
command as command4
|
|
1261
1031
|
} from "@struktoai/mirage-core";
|
|
1262
1032
|
var ENC4 = new TextEncoder();
|
|
1263
1033
|
var SPEC2 = new CommandSpec2({
|
|
@@ -1279,37 +1049,29 @@ async function emailReadCommand(accessor, _paths, _texts, opts) {
|
|
|
1279
1049
|
const out = ENC4.encode(JSON.stringify(processed));
|
|
1280
1050
|
return [out, new IOResult4()];
|
|
1281
1051
|
}
|
|
1282
|
-
var EMAIL_READ =
|
|
1283
|
-
name: "
|
|
1284
|
-
resource:
|
|
1052
|
+
var EMAIL_READ = command4({
|
|
1053
|
+
name: "himalaya message read",
|
|
1054
|
+
resource: ResourceName4.EMAIL,
|
|
1285
1055
|
spec: SPEC2,
|
|
1286
1056
|
fn: emailReadCommand
|
|
1287
1057
|
});
|
|
1288
1058
|
|
|
1289
|
-
// src/commands/builtin/email/realpath.ts
|
|
1290
|
-
import { ResourceName as ResourceName12, command as command12, realpathGeneric, specOf as specOf10 } from "@struktoai/mirage-core";
|
|
1291
|
-
var EMAIL_REALPATH = command12({
|
|
1292
|
-
name: "realpath",
|
|
1293
|
-
resource: ResourceName12.EMAIL,
|
|
1294
|
-
spec: specOf10("realpath"),
|
|
1295
|
-
fn: (accessor, paths, texts, opts) => realpathGeneric(paths, texts, opts, (p) => stat(accessor, p, opts.index ?? void 0))
|
|
1296
|
-
});
|
|
1297
|
-
|
|
1298
1059
|
// src/commands/builtin/email/email_reply.ts
|
|
1299
1060
|
import {
|
|
1300
1061
|
CommandSpec as CommandSpec3,
|
|
1301
1062
|
IOResult as IOResult5,
|
|
1302
1063
|
OperandKind as OperandKind3,
|
|
1303
1064
|
Option as Option3,
|
|
1304
|
-
ResourceName as
|
|
1305
|
-
command as
|
|
1065
|
+
ResourceName as ResourceName5,
|
|
1066
|
+
command as command5
|
|
1306
1067
|
} from "@struktoai/mirage-core";
|
|
1307
1068
|
var ENC5 = new TextEncoder();
|
|
1308
1069
|
var SPEC3 = new CommandSpec3({
|
|
1309
1070
|
options: [
|
|
1310
1071
|
new Option3({ long: "--uid", valueKind: OperandKind3.TEXT }),
|
|
1311
1072
|
new Option3({ long: "--folder", valueKind: OperandKind3.TEXT }),
|
|
1312
|
-
new Option3({ long: "--body", valueKind: OperandKind3.TEXT })
|
|
1073
|
+
new Option3({ long: "--body", valueKind: OperandKind3.TEXT }),
|
|
1074
|
+
new Option3({ long: "--all" })
|
|
1313
1075
|
]
|
|
1314
1076
|
});
|
|
1315
1077
|
async function emailReplyCommand(accessor, _paths, _texts, opts) {
|
|
@@ -1326,83 +1088,44 @@ async function emailReplyCommand(accessor, _paths, _texts, opts) {
|
|
|
1326
1088
|
return [null, new IOResult5({ exitCode: 2, stderr: ENC5.encode("--body is required\n") })];
|
|
1327
1089
|
}
|
|
1328
1090
|
const original = await fetchMessage(accessor, folder, uid);
|
|
1329
|
-
const result = await replyMessage(accessor.config, original, body);
|
|
1091
|
+
const result = opts.flags.all === true ? await replyAllMessage(accessor.config, original, body) : await replyMessage(accessor.config, original, body);
|
|
1330
1092
|
const out = ENC5.encode(JSON.stringify(result));
|
|
1331
1093
|
return [out, new IOResult5()];
|
|
1332
1094
|
}
|
|
1333
|
-
var EMAIL_REPLY =
|
|
1334
|
-
name: "
|
|
1335
|
-
resource:
|
|
1095
|
+
var EMAIL_REPLY = command5({
|
|
1096
|
+
name: "himalaya message reply",
|
|
1097
|
+
resource: ResourceName5.EMAIL,
|
|
1336
1098
|
spec: SPEC3,
|
|
1337
1099
|
fn: emailReplyCommand,
|
|
1338
1100
|
write: true
|
|
1339
1101
|
});
|
|
1340
1102
|
|
|
1341
|
-
// src/commands/builtin/email/email_reply_all.ts
|
|
1342
|
-
import {
|
|
1343
|
-
CommandSpec as CommandSpec4,
|
|
1344
|
-
IOResult as IOResult6,
|
|
1345
|
-
OperandKind as OperandKind4,
|
|
1346
|
-
Option as Option4,
|
|
1347
|
-
ResourceName as ResourceName14,
|
|
1348
|
-
command as command14
|
|
1349
|
-
} from "@struktoai/mirage-core";
|
|
1350
|
-
var ENC6 = new TextEncoder();
|
|
1351
|
-
var SPEC4 = new CommandSpec4({
|
|
1352
|
-
options: [
|
|
1353
|
-
new Option4({ long: "--uid", valueKind: OperandKind4.TEXT }),
|
|
1354
|
-
new Option4({ long: "--folder", valueKind: OperandKind4.TEXT }),
|
|
1355
|
-
new Option4({ long: "--body", valueKind: OperandKind4.TEXT })
|
|
1356
|
-
]
|
|
1357
|
-
});
|
|
1358
|
-
async function emailReplyAllCommand(accessor, _paths, _texts, opts) {
|
|
1359
|
-
const uid = typeof opts.flags.uid === "string" ? opts.flags.uid : "";
|
|
1360
|
-
const folder = typeof opts.flags.folder === "string" ? opts.flags.folder : "";
|
|
1361
|
-
const body = typeof opts.flags.body === "string" ? opts.flags.body : "";
|
|
1362
|
-
if (uid === "") {
|
|
1363
|
-
return [null, new IOResult6({ exitCode: 2, stderr: ENC6.encode("--uid is required\n") })];
|
|
1364
|
-
}
|
|
1365
|
-
if (folder === "") {
|
|
1366
|
-
return [null, new IOResult6({ exitCode: 2, stderr: ENC6.encode("--folder is required\n") })];
|
|
1367
|
-
}
|
|
1368
|
-
if (body === "") {
|
|
1369
|
-
return [null, new IOResult6({ exitCode: 2, stderr: ENC6.encode("--body is required\n") })];
|
|
1370
|
-
}
|
|
1371
|
-
const original = await fetchMessage(accessor, folder, uid);
|
|
1372
|
-
const result = await replyAllMessage(accessor.config, original, body);
|
|
1373
|
-
const out = ENC6.encode(JSON.stringify(result));
|
|
1374
|
-
return [out, new IOResult6()];
|
|
1375
|
-
}
|
|
1376
|
-
var EMAIL_REPLY_ALL = command14({
|
|
1377
|
-
name: "email-reply-all",
|
|
1378
|
-
resource: ResourceName14.EMAIL,
|
|
1379
|
-
spec: SPEC4,
|
|
1380
|
-
fn: emailReplyAllCommand,
|
|
1381
|
-
write: true
|
|
1382
|
-
});
|
|
1383
|
-
|
|
1384
1103
|
// src/commands/builtin/email/rg.ts
|
|
1385
1104
|
import {
|
|
1386
|
-
IOResult as
|
|
1387
|
-
ResourceName as
|
|
1388
|
-
command as
|
|
1105
|
+
IOResult as IOResult6,
|
|
1106
|
+
ResourceName as ResourceName6,
|
|
1107
|
+
command as command6,
|
|
1389
1108
|
compilePattern as compilePattern2,
|
|
1390
1109
|
grepLines as grepLines2,
|
|
1110
|
+
mountPrefixOf as mountPrefixOf6,
|
|
1111
|
+
patternArg,
|
|
1112
|
+
resolveGlobOf as resolveGlobOf3,
|
|
1391
1113
|
rgGeneric,
|
|
1392
|
-
specOf as
|
|
1114
|
+
specOf as specOf3
|
|
1393
1115
|
} from "@struktoai/mirage-core";
|
|
1394
|
-
var
|
|
1395
|
-
|
|
1116
|
+
var resolveGlob3 = resolveGlobOf3(EMAIL_IO);
|
|
1117
|
+
var ENC6 = new TextEncoder();
|
|
1118
|
+
async function* emailStream2(accessor, p, index) {
|
|
1396
1119
|
yield await read(accessor, p, index);
|
|
1397
1120
|
}
|
|
1398
1121
|
async function rgCommand(accessor, paths, texts, opts) {
|
|
1399
|
-
|
|
1122
|
+
const pattern = patternArg(texts, opts.flags);
|
|
1123
|
+
if (pattern === null) {
|
|
1400
1124
|
return [
|
|
1401
1125
|
null,
|
|
1402
|
-
new
|
|
1126
|
+
new IOResult6({ exitCode: 2, stderr: ENC6.encode("rg: usage: rg [flags] pattern [path]\n") })
|
|
1403
1127
|
];
|
|
1404
1128
|
}
|
|
1405
|
-
const pattern = texts[0];
|
|
1406
1129
|
const ignoreCase = opts.flags.i === true;
|
|
1407
1130
|
const invert = opts.flags.v === true;
|
|
1408
1131
|
const lineNumbers = opts.flags.n === true;
|
|
@@ -1425,21 +1148,21 @@ async function rgCommand(accessor, paths, texts, opts) {
|
|
|
1425
1148
|
const first = paths[0];
|
|
1426
1149
|
if (first !== void 0) {
|
|
1427
1150
|
const scope = detectScope(first);
|
|
1428
|
-
if (scope.useNative) {
|
|
1429
|
-
const filePrefix = first.
|
|
1151
|
+
if (scope.useNative && !pattern.includes("\n")) {
|
|
1152
|
+
const filePrefix = mountPrefixOf6(first.virtual, first.resourcePath) !== "" ? mountPrefixOf6(first.virtual, first.resourcePath) : "";
|
|
1430
1153
|
const pairs = await searchAndFormat(accessor, scope, pattern, filePrefix, maxCount ?? 50);
|
|
1431
1154
|
const lines = [];
|
|
1432
1155
|
for (const [vfsPath, msgText] of pairs) {
|
|
1433
1156
|
const matched = grepLines2(vfsPath, [msgText], pat, lineOpts);
|
|
1434
1157
|
for (const line of matched) lines.push(`${vfsPath}:${line}`);
|
|
1435
1158
|
}
|
|
1436
|
-
if (lines.length === 0) return [new Uint8Array(0), new
|
|
1437
|
-
const out =
|
|
1438
|
-
return [out, new
|
|
1159
|
+
if (lines.length === 0) return [new Uint8Array(0), new IOResult6({ exitCode: 1 })];
|
|
1160
|
+
const out = ENC6.encode(lines.join("\n") + "\n");
|
|
1161
|
+
return [out, new IOResult6()];
|
|
1439
1162
|
}
|
|
1440
1163
|
}
|
|
1441
1164
|
}
|
|
1442
|
-
const resolved = paths.length > 0 ? await
|
|
1165
|
+
const resolved = paths.length > 0 ? await resolveGlob3(accessor, paths, opts.index ?? void 0) : [];
|
|
1443
1166
|
const stat2 = (p) => stat(accessor, p, opts.index ?? void 0);
|
|
1444
1167
|
const readdir2 = (p) => readdir(accessor, p, opts.index ?? void 0);
|
|
1445
1168
|
return rgGeneric(
|
|
@@ -1448,31 +1171,31 @@ async function rgCommand(accessor, paths, texts, opts) {
|
|
|
1448
1171
|
opts,
|
|
1449
1172
|
stat2,
|
|
1450
1173
|
readdir2,
|
|
1451
|
-
(p) =>
|
|
1174
|
+
(p) => emailStream2(accessor, p, opts.index ?? void 0)
|
|
1452
1175
|
);
|
|
1453
1176
|
}
|
|
1454
|
-
var EMAIL_RG =
|
|
1177
|
+
var EMAIL_RG = command6({
|
|
1455
1178
|
name: "rg",
|
|
1456
|
-
resource:
|
|
1457
|
-
spec:
|
|
1179
|
+
resource: ResourceName6.EMAIL,
|
|
1180
|
+
spec: specOf3("rg"),
|
|
1458
1181
|
fn: rgCommand
|
|
1459
1182
|
});
|
|
1460
1183
|
|
|
1461
1184
|
// src/commands/builtin/email/email_send.ts
|
|
1462
1185
|
import {
|
|
1463
|
-
CommandSpec as
|
|
1464
|
-
IOResult as
|
|
1465
|
-
OperandKind as
|
|
1466
|
-
Option as
|
|
1467
|
-
ResourceName as
|
|
1468
|
-
command as
|
|
1186
|
+
CommandSpec as CommandSpec4,
|
|
1187
|
+
IOResult as IOResult7,
|
|
1188
|
+
OperandKind as OperandKind4,
|
|
1189
|
+
Option as Option4,
|
|
1190
|
+
ResourceName as ResourceName7,
|
|
1191
|
+
command as command7
|
|
1469
1192
|
} from "@struktoai/mirage-core";
|
|
1470
|
-
var
|
|
1471
|
-
var
|
|
1193
|
+
var ENC7 = new TextEncoder();
|
|
1194
|
+
var SPEC4 = new CommandSpec4({
|
|
1472
1195
|
options: [
|
|
1473
|
-
new
|
|
1474
|
-
new
|
|
1475
|
-
new
|
|
1196
|
+
new Option4({ long: "--to", valueKind: OperandKind4.TEXT }),
|
|
1197
|
+
new Option4({ long: "--subject", valueKind: OperandKind4.TEXT }),
|
|
1198
|
+
new Option4({ long: "--body", valueKind: OperandKind4.TEXT })
|
|
1476
1199
|
]
|
|
1477
1200
|
});
|
|
1478
1201
|
async function emailSendCommand(accessor, _paths, _texts, opts) {
|
|
@@ -1480,116 +1203,47 @@ async function emailSendCommand(accessor, _paths, _texts, opts) {
|
|
|
1480
1203
|
const subject = typeof opts.flags.subject === "string" ? opts.flags.subject : "";
|
|
1481
1204
|
const body = typeof opts.flags.body === "string" ? opts.flags.body : "";
|
|
1482
1205
|
if (to === "") {
|
|
1483
|
-
return [null, new
|
|
1206
|
+
return [null, new IOResult7({ exitCode: 2, stderr: ENC7.encode("--to is required\n") })];
|
|
1484
1207
|
}
|
|
1485
1208
|
if (subject === "") {
|
|
1486
|
-
return [null, new
|
|
1209
|
+
return [null, new IOResult7({ exitCode: 2, stderr: ENC7.encode("--subject is required\n") })];
|
|
1487
1210
|
}
|
|
1488
1211
|
if (body === "") {
|
|
1489
|
-
return [null, new
|
|
1212
|
+
return [null, new IOResult7({ exitCode: 2, stderr: ENC7.encode("--body is required\n") })];
|
|
1490
1213
|
}
|
|
1491
1214
|
const result = await sendMessage(accessor.config, to, subject, body);
|
|
1492
|
-
const out =
|
|
1493
|
-
return [out, new
|
|
1215
|
+
const out = ENC7.encode(JSON.stringify(result));
|
|
1216
|
+
return [out, new IOResult7()];
|
|
1494
1217
|
}
|
|
1495
|
-
var EMAIL_SEND =
|
|
1496
|
-
name: "
|
|
1497
|
-
resource:
|
|
1498
|
-
spec:
|
|
1218
|
+
var EMAIL_SEND = command7({
|
|
1219
|
+
name: "himalaya message send",
|
|
1220
|
+
resource: ResourceName7.EMAIL,
|
|
1221
|
+
spec: SPEC4,
|
|
1499
1222
|
fn: emailSendCommand,
|
|
1500
1223
|
write: true
|
|
1501
1224
|
});
|
|
1502
1225
|
|
|
1503
|
-
// src/commands/builtin/email/stat.ts
|
|
1504
|
-
import {
|
|
1505
|
-
ResourceName as ResourceName17,
|
|
1506
|
-
command as command17,
|
|
1507
|
-
specOf as specOf12,
|
|
1508
|
-
statGeneric
|
|
1509
|
-
} from "@struktoai/mirage-core";
|
|
1510
|
-
async function statCommand(accessor, paths, _texts, opts) {
|
|
1511
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1512
|
-
return statGeneric(resolved, opts, (p) => stat(accessor, p, opts.index ?? void 0));
|
|
1513
|
-
}
|
|
1514
|
-
var EMAIL_STAT = command17({
|
|
1515
|
-
name: "stat",
|
|
1516
|
-
resource: ResourceName17.EMAIL,
|
|
1517
|
-
spec: specOf12("stat"),
|
|
1518
|
-
fn: statCommand,
|
|
1519
|
-
provision: metadataProvision
|
|
1520
|
-
});
|
|
1521
|
-
|
|
1522
|
-
// src/commands/builtin/email/tail.ts
|
|
1523
|
-
import {
|
|
1524
|
-
ResourceName as ResourceName18,
|
|
1525
|
-
command as command18,
|
|
1526
|
-
specOf as specOf13,
|
|
1527
|
-
tailGeneric
|
|
1528
|
-
} from "@struktoai/mirage-core";
|
|
1529
|
-
async function* emailStream6(accessor, p, index) {
|
|
1530
|
-
yield await read(accessor, p, index);
|
|
1531
|
-
}
|
|
1532
|
-
async function tailCommand(accessor, paths, texts, opts) {
|
|
1533
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1534
|
-
return tailGeneric(
|
|
1535
|
-
resolved,
|
|
1536
|
-
texts,
|
|
1537
|
-
opts,
|
|
1538
|
-
(p) => emailStream6(accessor, p, opts.index ?? void 0)
|
|
1539
|
-
);
|
|
1540
|
-
}
|
|
1541
|
-
var EMAIL_TAIL = command18({
|
|
1542
|
-
name: "tail",
|
|
1543
|
-
resource: ResourceName18.EMAIL,
|
|
1544
|
-
spec: specOf13("tail"),
|
|
1545
|
-
fn: tailCommand,
|
|
1546
|
-
provision: fileReadProvision
|
|
1547
|
-
});
|
|
1548
|
-
|
|
1549
|
-
// src/commands/builtin/email/tree.ts
|
|
1550
|
-
import {
|
|
1551
|
-
ResourceName as ResourceName19,
|
|
1552
|
-
command as command19,
|
|
1553
|
-
specOf as specOf14,
|
|
1554
|
-
treeGeneric
|
|
1555
|
-
} from "@struktoai/mirage-core";
|
|
1556
|
-
async function treeCommand(accessor, paths, _texts, opts) {
|
|
1557
|
-
const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
|
|
1558
|
-
return treeGeneric(
|
|
1559
|
-
resolved,
|
|
1560
|
-
opts,
|
|
1561
|
-
(p) => readdir(accessor, p, opts.index ?? void 0),
|
|
1562
|
-
(p) => stat(accessor, p, opts.index ?? void 0)
|
|
1563
|
-
);
|
|
1564
|
-
}
|
|
1565
|
-
var EMAIL_TREE = command19({
|
|
1566
|
-
name: "tree",
|
|
1567
|
-
resource: ResourceName19.EMAIL,
|
|
1568
|
-
spec: specOf14("tree"),
|
|
1569
|
-
fn: treeCommand
|
|
1570
|
-
});
|
|
1571
|
-
|
|
1572
1226
|
// src/commands/builtin/email/email_triage.ts
|
|
1573
1227
|
import {
|
|
1574
|
-
CommandSpec as
|
|
1575
|
-
IOResult as
|
|
1576
|
-
OperandKind as
|
|
1577
|
-
Option as
|
|
1578
|
-
ResourceName as
|
|
1579
|
-
command as
|
|
1228
|
+
CommandSpec as CommandSpec5,
|
|
1229
|
+
IOResult as IOResult8,
|
|
1230
|
+
OperandKind as OperandKind5,
|
|
1231
|
+
Option as Option5,
|
|
1232
|
+
ResourceName as ResourceName8,
|
|
1233
|
+
command as command8
|
|
1580
1234
|
} from "@struktoai/mirage-core";
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1235
|
+
var ENC8 = new TextEncoder();
|
|
1236
|
+
var SPEC5 = new CommandSpec5({
|
|
1583
1237
|
options: [
|
|
1584
|
-
new
|
|
1585
|
-
new
|
|
1586
|
-
new
|
|
1587
|
-
new
|
|
1588
|
-
new
|
|
1589
|
-
new
|
|
1590
|
-
new
|
|
1591
|
-
new
|
|
1592
|
-
new
|
|
1238
|
+
new Option5({ long: "--folder", valueKind: OperandKind5.TEXT }),
|
|
1239
|
+
new Option5({ long: "--max", valueKind: OperandKind5.TEXT }),
|
|
1240
|
+
new Option5({ long: "--unseen" }),
|
|
1241
|
+
new Option5({ long: "--subject", valueKind: OperandKind5.TEXT }),
|
|
1242
|
+
new Option5({ long: "--from", valueKind: OperandKind5.TEXT }),
|
|
1243
|
+
new Option5({ long: "--to", valueKind: OperandKind5.TEXT }),
|
|
1244
|
+
new Option5({ long: "--body", valueKind: OperandKind5.TEXT }),
|
|
1245
|
+
new Option5({ long: "--since", valueKind: OperandKind5.TEXT }),
|
|
1246
|
+
new Option5({ long: "--before", valueKind: OperandKind5.TEXT })
|
|
1593
1247
|
]
|
|
1594
1248
|
});
|
|
1595
1249
|
async function emailTriageCommand(accessor, _paths, _texts, opts) {
|
|
@@ -1610,105 +1264,39 @@ async function emailTriageCommand(accessor, _paths, _texts, opts) {
|
|
|
1610
1264
|
maxResults
|
|
1611
1265
|
);
|
|
1612
1266
|
if (uids.length === 0) {
|
|
1613
|
-
const out2 =
|
|
1614
|
-
return [out2, new
|
|
1267
|
+
const out2 = ENC8.encode("[]");
|
|
1268
|
+
return [out2, new IOResult8()];
|
|
1615
1269
|
}
|
|
1616
1270
|
const headers = await fetchHeaders(accessor, folder, uids);
|
|
1617
|
-
const out =
|
|
1618
|
-
return [out, new
|
|
1271
|
+
const out = ENC8.encode(JSON.stringify(headers));
|
|
1272
|
+
return [out, new IOResult8()];
|
|
1619
1273
|
}
|
|
1620
|
-
var EMAIL_TRIAGE =
|
|
1621
|
-
name: "
|
|
1622
|
-
resource:
|
|
1623
|
-
spec:
|
|
1274
|
+
var EMAIL_TRIAGE = command8({
|
|
1275
|
+
name: "himalaya envelope list",
|
|
1276
|
+
resource: ResourceName8.EMAIL,
|
|
1277
|
+
spec: SPEC5,
|
|
1624
1278
|
fn: emailTriageCommand
|
|
1625
1279
|
});
|
|
1626
1280
|
|
|
1627
|
-
// src/commands/builtin/email/wc.ts
|
|
1628
|
-
import {
|
|
1629
|
-
ResourceName as ResourceName21,
|
|
1630
|
-
command as command21,
|
|
1631
|
-
specOf as specOf15,
|
|
1632
|
-
wcGeneric
|
|
1633
|
-
} from "@struktoai/mirage-core";
|
|
1634
|
-
async function* emailStream7(accessor, p, index) {
|
|
1635
|
-
yield await read(accessor, p, index);
|
|
1636
|
-
}
|
|
1637
|
-
async function wcCommand(accessor, paths, texts, opts) {
|
|
1638
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1639
|
-
return wcGeneric(resolved, texts, opts, (p) => emailStream7(accessor, p, opts.index ?? void 0));
|
|
1640
|
-
}
|
|
1641
|
-
var EMAIL_WC = command21({
|
|
1642
|
-
name: "wc",
|
|
1643
|
-
resource: ResourceName21.EMAIL,
|
|
1644
|
-
spec: specOf15("wc"),
|
|
1645
|
-
fn: wcCommand,
|
|
1646
|
-
provision: fileReadProvision
|
|
1647
|
-
});
|
|
1648
|
-
|
|
1649
1281
|
// src/commands/builtin/email/index.ts
|
|
1282
|
+
var EMAIL_OVERRIDES = /* @__PURE__ */ new Set(["find", "grep", "rg"]);
|
|
1650
1283
|
var EMAIL_COMMANDS = [
|
|
1651
|
-
...
|
|
1652
|
-
|
|
1653
|
-
|
|
1284
|
+
...makeGenericCommands(ResourceName9.EMAIL, EMAIL_IO, {
|
|
1285
|
+
overrides: EMAIL_OVERRIDES
|
|
1286
|
+
}),
|
|
1654
1287
|
...EMAIL_FIND,
|
|
1655
1288
|
...EMAIL_GREP,
|
|
1656
|
-
...EMAIL_HEAD,
|
|
1657
|
-
...EMAIL_JQ,
|
|
1658
|
-
...EMAIL_LS,
|
|
1659
|
-
...EMAIL_NL,
|
|
1660
|
-
...EMAIL_REALPATH,
|
|
1661
1289
|
...EMAIL_RG,
|
|
1662
|
-
...EMAIL_STAT,
|
|
1663
|
-
...EMAIL_TAIL,
|
|
1664
|
-
...EMAIL_TREE,
|
|
1665
|
-
...EMAIL_WC,
|
|
1666
1290
|
...EMAIL_SEND,
|
|
1667
1291
|
...EMAIL_REPLY,
|
|
1668
|
-
...EMAIL_REPLY_ALL,
|
|
1669
1292
|
...EMAIL_FORWARD,
|
|
1670
1293
|
...EMAIL_TRIAGE,
|
|
1671
1294
|
...EMAIL_READ
|
|
1672
1295
|
];
|
|
1673
1296
|
|
|
1674
|
-
// src/ops/email/read.ts
|
|
1675
|
-
import { ResourceName as ResourceName22 } from "@struktoai/mirage-core";
|
|
1676
|
-
var readOp = {
|
|
1677
|
-
name: "read",
|
|
1678
|
-
resource: ResourceName22.EMAIL,
|
|
1679
|
-
filetype: null,
|
|
1680
|
-
write: false,
|
|
1681
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1682
|
-
return read(accessor, path, kwargs.index);
|
|
1683
|
-
}
|
|
1684
|
-
};
|
|
1685
|
-
|
|
1686
|
-
// src/ops/email/readdir.ts
|
|
1687
|
-
import { ResourceName as ResourceName23 } from "@struktoai/mirage-core";
|
|
1688
|
-
var readdirOp = {
|
|
1689
|
-
name: "readdir",
|
|
1690
|
-
resource: ResourceName23.EMAIL,
|
|
1691
|
-
filetype: null,
|
|
1692
|
-
write: false,
|
|
1693
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1694
|
-
return readdir(accessor, path, kwargs.index);
|
|
1695
|
-
}
|
|
1696
|
-
};
|
|
1697
|
-
|
|
1698
|
-
// src/ops/email/stat.ts
|
|
1699
|
-
import { ResourceName as ResourceName24 } from "@struktoai/mirage-core";
|
|
1700
|
-
var statOp = {
|
|
1701
|
-
name: "stat",
|
|
1702
|
-
resource: ResourceName24.EMAIL,
|
|
1703
|
-
filetype: null,
|
|
1704
|
-
write: false,
|
|
1705
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1706
|
-
return stat(accessor, path, kwargs.index);
|
|
1707
|
-
}
|
|
1708
|
-
};
|
|
1709
|
-
|
|
1710
1297
|
// src/ops/email/index.ts
|
|
1711
|
-
|
|
1298
|
+
import { ResourceName as ResourceName10, makeGenericOps } from "@struktoai/mirage-core";
|
|
1299
|
+
var EMAIL_OPS = makeGenericOps(ResourceName10.EMAIL, EMAIL_IO);
|
|
1712
1300
|
|
|
1713
1301
|
// src/resource/email/prompt.ts
|
|
1714
1302
|
var EMAIL_PROMPT = `{prefix}
|
|
@@ -1717,16 +1305,21 @@ var EMAIL_PROMPT = `{prefix}
|
|
|
1717
1305
|
<subject>__<uid>.email.json
|
|
1718
1306
|
<subject>__<uid>/ # if attachments exist
|
|
1719
1307
|
<attachment-filename>
|
|
1720
|
-
Folders include: INBOX, Sent, Drafts, etc. cat shows email as JSON
|
|
1308
|
+
Folders include: INBOX, Sent, Drafts, etc. cat shows email as JSON.
|
|
1309
|
+
|
|
1310
|
+
Read commands:
|
|
1311
|
+
himalaya envelope list --folder INBOX --unseen # id/from/subject/date
|
|
1312
|
+
himalaya message read --folder INBOX --uid <uid> # one message as JSON`;
|
|
1721
1313
|
var EMAIL_WRITE_PROMPT = ` Write commands:
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1314
|
+
himalaya message send --to "to@email.com" --subject "Hi" --body "..."
|
|
1315
|
+
himalaya message reply --folder INBOX --uid <uid> --body "..." [--all]
|
|
1316
|
+
himalaya message forward --folder INBOX --uid <uid> --to "to@email.com"`;
|
|
1725
1317
|
|
|
1726
1318
|
// src/resource/email/email.ts
|
|
1319
|
+
var resolveGlob4 = makeResolveGlob(readdir);
|
|
1727
1320
|
var EmailResource = class extends BaseResource {
|
|
1728
|
-
kind =
|
|
1729
|
-
|
|
1321
|
+
kind = ResourceName11.EMAIL;
|
|
1322
|
+
cachesReads = true;
|
|
1730
1323
|
indexTtl = 86400;
|
|
1731
1324
|
prompt = EMAIL_PROMPT;
|
|
1732
1325
|
config;
|
|
@@ -1757,21 +1350,17 @@ var EmailResource = class extends BaseResource {
|
|
|
1757
1350
|
stat(p) {
|
|
1758
1351
|
return stat(this.accessor, p, this.index);
|
|
1759
1352
|
}
|
|
1760
|
-
async fingerprint(p) {
|
|
1761
|
-
const lookup = await this.index.get(p.original);
|
|
1762
|
-
return lookup.entry?.remoteTime ?? null;
|
|
1763
|
-
}
|
|
1764
1353
|
glob(paths, prefix = "") {
|
|
1765
1354
|
const effective = prefix !== "" ? paths.map(
|
|
1766
|
-
(p) => p.
|
|
1767
|
-
|
|
1355
|
+
(p) => mountPrefixOf7(p.virtual, p.resourcePath) !== "" ? p : new PathSpec3({
|
|
1356
|
+
virtual: p.virtual,
|
|
1768
1357
|
directory: p.directory,
|
|
1769
1358
|
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
1770
1359
|
resolved: p.resolved,
|
|
1771
|
-
prefix
|
|
1360
|
+
resourcePath: mountKey4(p.virtual, prefix)
|
|
1772
1361
|
})
|
|
1773
1362
|
) : paths;
|
|
1774
|
-
return
|
|
1363
|
+
return resolveGlob4(this.accessor, effective, this.index);
|
|
1775
1364
|
}
|
|
1776
1365
|
getState() {
|
|
1777
1366
|
return Promise.resolve({
|
|
@@ -1792,4 +1381,4 @@ export {
|
|
|
1792
1381
|
EMAIL_WRITE_PROMPT,
|
|
1793
1382
|
EmailResource
|
|
1794
1383
|
};
|
|
1795
|
-
//# sourceMappingURL=chunk-
|
|
1384
|
+
//# sourceMappingURL=chunk-4GYB7DGC.js.map
|