@struktoai/mirage-node 0.0.4 → 0.0.5
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 +2 -1
- package/dist/aliyun-S62BR3TB.js +11 -0
- package/dist/append.lua +17 -0
- package/dist/backblaze-4EKSW63F.js +11 -0
- package/dist/box-ZPLZAGMK.js +8 -0
- package/dist/ceph-ALKLD3MO.js +11 -0
- package/dist/{chunk-VLRSOWHP.js → chunk-2A4YGVBM.js} +5 -14
- package/dist/chunk-2A4YGVBM.js.map +1 -0
- package/dist/chunk-2HCYLVGY.js +28 -0
- package/dist/chunk-2HCYLVGY.js.map +1 -0
- package/dist/chunk-2VPZAH5Q.js +20 -0
- package/dist/chunk-2VPZAH5Q.js.map +1 -0
- package/dist/{chunk-HCU3B6FW.js → chunk-3JZQ6VSZ.js} +5 -4
- package/dist/chunk-3JZQ6VSZ.js.map +1 -0
- package/dist/chunk-4IF4TGAI.js +11 -0
- package/dist/chunk-4IF4TGAI.js.map +1 -0
- package/dist/{chunk-L7FEZ7LU.js → chunk-5H6KNEPP.js} +4 -5
- package/dist/{chunk-L7FEZ7LU.js.map → chunk-5H6KNEPP.js.map} +1 -1
- package/dist/{chunk-25W4XQJZ.js → chunk-5K2MWDCE.js} +4 -5
- package/dist/{chunk-25W4XQJZ.js.map → chunk-5K2MWDCE.js.map} +1 -1
- package/dist/{chunk-L4GMDSMB.js → chunk-6SVXWRKX.js} +4 -5
- package/dist/{chunk-L4GMDSMB.js.map → chunk-6SVXWRKX.js.map} +1 -1
- package/dist/{chunk-H62XQZUM.js → chunk-6VOIUGAD.js} +22 -10
- package/dist/chunk-6VOIUGAD.js.map +1 -0
- package/dist/{chunk-SI4GMRXD.js → chunk-7JYHFXXC.js} +4 -8
- package/dist/chunk-7JYHFXXC.js.map +1 -0
- package/dist/chunk-7VQQFWV6.js +20 -0
- package/dist/chunk-7VQQFWV6.js.map +1 -0
- package/dist/chunk-7ZP6TPHX.js +87 -0
- package/dist/chunk-7ZP6TPHX.js.map +1 -0
- package/dist/{chunk-HWQPEBID.js → chunk-ADEXNSYU.js} +6 -12
- package/dist/chunk-ADEXNSYU.js.map +1 -0
- package/dist/chunk-AQSYAXL4.js +16 -0
- package/dist/chunk-AQSYAXL4.js.map +1 -0
- package/dist/{chunk-NJ42VNXG.js → chunk-ATLXMNKD.js} +8 -3
- package/dist/chunk-ATLXMNKD.js.map +1 -0
- package/dist/{chunk-CB76WPUS.js → chunk-BYCUGFRF.js} +5 -4
- package/dist/chunk-BYCUGFRF.js.map +1 -0
- package/dist/{chunk-4M73WHIE.js → chunk-BZTVYOES.js} +3 -3
- package/dist/{chunk-CQCTCW4S.js → chunk-CRC4YWXB.js} +28 -9
- package/dist/chunk-CRC4YWXB.js.map +1 -0
- package/dist/{chunk-C7TNKIK5.js → chunk-CTGXJHO5.js} +1 -1
- package/dist/chunk-CTGXJHO5.js.map +1 -0
- package/dist/{chunk-HSD24IP2.js → chunk-DCDBIXVZ.js} +7 -2
- package/dist/chunk-DCDBIXVZ.js.map +1 -0
- package/dist/{chunk-HEDE2377.js → chunk-DDAFNROK.js} +318 -322
- package/dist/chunk-DDAFNROK.js.map +1 -0
- package/dist/chunk-DQIEWEAW.js +85 -0
- package/dist/chunk-DQIEWEAW.js.map +1 -0
- package/dist/{chunk-2ERLWAGG.js → chunk-EBI4IHDC.js} +20 -11
- package/dist/chunk-EBI4IHDC.js.map +1 -0
- package/dist/{chunk-RHUEV4I7.js → chunk-EIUTZ6N7.js} +10 -24
- package/dist/chunk-EIUTZ6N7.js.map +1 -0
- package/dist/{chunk-IUXXZHY3.js → chunk-EJZG5VUF.js} +24 -12
- package/dist/chunk-EJZG5VUF.js.map +1 -0
- package/dist/{chunk-BWWU5T2D.js → chunk-ENW5BVYN.js} +3 -3
- package/dist/{chunk-F5NWRF32.js → chunk-ETIAW4YD.js} +3 -3
- package/dist/chunk-EUPXAYPB.js +20 -0
- package/dist/chunk-EUPXAYPB.js.map +1 -0
- package/dist/{chunk-EGZNOUMH.js → chunk-FA6YNU75.js} +4 -5
- package/dist/{chunk-EGZNOUMH.js.map → chunk-FA6YNU75.js.map} +1 -1
- package/dist/{chunk-XUUSWR4U.js → chunk-FFH6R5VQ.js} +7 -2
- package/dist/{chunk-XUUSWR4U.js.map → chunk-FFH6R5VQ.js.map} +1 -1
- package/dist/{chunk-JEBH5APX.js → chunk-GE6H2COM.js} +5 -13
- package/dist/chunk-GE6H2COM.js.map +1 -0
- package/dist/{chunk-TUNR4VUM.js → chunk-GMMQ3ZK4.js} +3 -3
- package/dist/{chunk-SAOQW6ZJ.js → chunk-GSGE3M5P.js} +5 -13
- package/dist/chunk-GSGE3M5P.js.map +1 -0
- package/dist/{chunk-DXU7NZPH.js → chunk-HCRYAFBI.js} +3 -3
- package/dist/{chunk-OSVZKYXS.js → chunk-HOPUP6LA.js} +192 -156
- package/dist/chunk-HOPUP6LA.js.map +1 -0
- package/dist/chunk-HS24BL6W.js +160 -0
- package/dist/chunk-HS24BL6W.js.map +1 -0
- package/dist/chunk-HVYVG5KQ.js +16 -0
- package/dist/chunk-HVYVG5KQ.js.map +1 -0
- package/dist/{chunk-XEMLYWHK.js → chunk-I7CPLZNW.js} +4 -5
- package/dist/{chunk-XEMLYWHK.js.map → chunk-I7CPLZNW.js.map} +1 -1
- package/dist/{chunk-AULFV3KY.js → chunk-IFUCGI4I.js} +7 -2
- package/dist/chunk-IFUCGI4I.js.map +1 -0
- package/dist/{chunk-HGIPWY5Y.js → chunk-IFYXSSKR.js} +6 -6
- package/dist/chunk-IFYXSSKR.js.map +1 -0
- package/dist/chunk-IXA4DQE4.js +20 -0
- package/dist/chunk-IXA4DQE4.js.map +1 -0
- package/dist/chunk-IZMKMD3O.js +11 -0
- package/dist/chunk-IZMKMD3O.js.map +1 -0
- package/dist/{chunk-4X6CLF4F.js → chunk-JJERW2BI.js} +4 -5
- package/dist/{chunk-4X6CLF4F.js.map → chunk-JJERW2BI.js.map} +1 -1
- package/dist/{chunk-M6E7VK4D.js → chunk-JQR4HVUX.js} +2 -5
- package/dist/chunk-JQR4HVUX.js.map +1 -0
- package/dist/{chunk-BWLUBJQG.js → chunk-JXOMDLFS.js} +6 -15
- package/dist/chunk-JXOMDLFS.js.map +1 -0
- package/dist/{chunk-5ZHNPNDD.js → chunk-KIX6N7NT.js} +198 -141
- package/dist/chunk-KIX6N7NT.js.map +1 -0
- package/dist/{chunk-XFSEADPC.js → chunk-L42UTDFK.js} +7 -2
- package/dist/chunk-L42UTDFK.js.map +1 -0
- package/dist/chunk-M2UF2JHJ.js +11 -0
- package/dist/chunk-M2UF2JHJ.js.map +1 -0
- package/dist/{chunk-LPLZLSMK.js → chunk-MONC734W.js} +7 -2
- package/dist/chunk-MONC734W.js.map +1 -0
- package/dist/{chunk-XADEMW6B.js → chunk-N72RLCMU.js} +4 -5
- package/dist/{chunk-XADEMW6B.js.map → chunk-N72RLCMU.js.map} +1 -1
- package/dist/{chunk-ZPB3SLPK.js → chunk-ND4IWJ4V.js} +7 -2
- package/dist/chunk-ND4IWJ4V.js.map +1 -0
- package/dist/{chunk-ZPZQXHW2.js → chunk-NZ3EKGW4.js} +260 -178
- package/dist/chunk-NZ3EKGW4.js.map +1 -0
- package/dist/{chunk-E3KXVEYI.js → chunk-OAE57MNL.js} +22 -10
- package/dist/chunk-OAE57MNL.js.map +1 -0
- package/dist/{chunk-JBDFYIN2.js → chunk-OHKGIQB4.js} +2 -5
- package/dist/chunk-OHKGIQB4.js.map +1 -0
- package/dist/{chunk-V7JVMG63.js → chunk-OXEQSPND.js} +3 -3
- package/dist/{chunk-YRJICL2Q.js → chunk-PKNE5J2B.js} +5 -13
- package/dist/chunk-PKNE5J2B.js.map +1 -0
- package/dist/chunk-PSXXEGYQ.js +16 -0
- package/dist/chunk-PSXXEGYQ.js.map +1 -0
- package/dist/{chunk-KAWDDS27.js → chunk-QAOVABCR.js} +7 -2
- package/dist/chunk-QAOVABCR.js.map +1 -0
- package/dist/{chunk-SYMNWNC3.js → chunk-QQ7FP4GD.js} +4 -5
- package/dist/{chunk-SYMNWNC3.js.map → chunk-QQ7FP4GD.js.map} +1 -1
- package/dist/{chunk-3JZN3GYO.js → chunk-QYLVMC6B.js} +2 -5
- package/dist/chunk-QYLVMC6B.js.map +1 -0
- package/dist/{chunk-CXQGMFI7.js → chunk-RX3XR65X.js} +4 -5
- package/dist/{chunk-CXQGMFI7.js.map → chunk-RX3XR65X.js.map} +1 -1
- package/dist/{chunk-MRXTUFBZ.js → chunk-RYQJJB4C.js} +1 -1
- package/dist/chunk-RYQJJB4C.js.map +1 -0
- package/dist/{chunk-5I7Q7RHW.js → chunk-TUF7TCN7.js} +4 -5
- package/dist/{chunk-5I7Q7RHW.js.map → chunk-TUF7TCN7.js.map} +1 -1
- package/dist/{chunk-NLXJMXVE.js → chunk-TUX36JY5.js} +4 -5
- package/dist/{chunk-NLXJMXVE.js.map → chunk-TUX36JY5.js.map} +1 -1
- package/dist/{chunk-4GYB7DGC.js → chunk-TWRQCQWU.js} +327 -558
- package/dist/chunk-TWRQCQWU.js.map +1 -0
- package/dist/chunk-U6DFQRG3.js +20 -0
- package/dist/chunk-U6DFQRG3.js.map +1 -0
- package/dist/chunk-VI5YTKNY.js +20 -0
- package/dist/chunk-VI5YTKNY.js.map +1 -0
- package/dist/{chunk-FRGTDZQT.js → chunk-VQDF2UH5.js} +19 -5
- package/dist/chunk-VQDF2UH5.js.map +1 -0
- package/dist/{chunk-W5ZLIQFR.js → chunk-WG5YS6TC.js} +308 -200
- package/dist/chunk-WG5YS6TC.js.map +1 -0
- package/dist/{chunk-ZM44MGC5.js → chunk-WMJJ4WGF.js} +4 -5
- package/dist/{chunk-ZM44MGC5.js.map → chunk-WMJJ4WGF.js.map} +1 -1
- package/dist/{chunk-5YRWF5RP.js → chunk-WY4FNH42.js} +6 -5
- package/dist/chunk-WY4FNH42.js.map +1 -0
- package/dist/{chunk-VBYIDRNU.js → chunk-XIG5BWWH.js} +19 -10
- package/dist/chunk-XIG5BWWH.js.map +1 -0
- package/dist/chunk-XJBC3OYX.js +11 -0
- package/dist/chunk-XJBC3OYX.js.map +1 -0
- package/dist/{chunk-ZMREYTHA.js → chunk-XPRDXWK7.js} +8 -8
- package/dist/chunk-XPRDXWK7.js.map +1 -0
- package/dist/chunk-YKRQSZS7.js +96 -0
- package/dist/chunk-YKRQSZS7.js.map +1 -0
- package/dist/{chunk-IEVLWEBO.js → chunk-YMBL3VJB.js} +9 -8
- package/dist/chunk-YMBL3VJB.js.map +1 -0
- package/dist/{chunk-CGGO5NKD.js → chunk-YUJBXFYK.js} +357 -346
- package/dist/chunk-YUJBXFYK.js.map +1 -0
- package/dist/{chunk-S4KVLPBR.js → chunk-YZ4ZJNOL.js} +22 -10
- package/dist/chunk-YZ4ZJNOL.js.map +1 -0
- package/dist/chunk-ZTHVEXIV.js +11 -0
- package/dist/chunk-ZTHVEXIV.js.map +1 -0
- package/dist/{chunk-VHED2STW.js → chunk-ZVSYUCYS.js} +2 -1
- package/dist/chunk-ZVSYUCYS.js.map +1 -0
- package/dist/{config-T2IUIU5C.js → config-2YBCHU2W.js} +2 -2
- package/dist/{config-M3Z47VYU.js → config-3YRGRW72.js} +3 -2
- package/dist/config-4GSOMUMF.js +9 -0
- package/dist/config-5YBUWFUP.js +9 -0
- package/dist/{config-2LASFFRD.js → config-5ZRKJTKG.js} +3 -2
- package/dist/{config-W7EVPJNK.js → config-A25LTL5W.js} +2 -2
- package/dist/{config-WKQ3FGTZ.js → config-CLU7JABG.js} +2 -2
- package/dist/{config-E22XAGYN.js → config-D2RF7L3N.js} +2 -2
- package/dist/{config-HQXNFQZS.js → config-E55TKM6K.js} +2 -2
- package/dist/config-ELDOFRJW.js +9 -0
- package/dist/{config-EX3ZJTZI.js → config-FPC3RBFD.js} +2 -2
- package/dist/config-FPM3LAW7.js +9 -0
- package/dist/{config-IPNWAJHH.js → config-G3F54CS4.js} +3 -2
- package/dist/{config-BBOLI7VE.js → config-G43HRUI3.js} +2 -2
- package/dist/{config-QO2XUME4.js → config-GG3WO5PB.js} +3 -2
- package/dist/{config-QWQGOXQ5.js → config-JUYBWAZE.js} +2 -2
- package/dist/{config-SPW6NESU.js → config-LJ5T6TVA.js} +2 -2
- package/dist/{config-WVILHDFV.js → config-MDSAE4O3.js} +2 -2
- package/dist/{config-MZM3IPFM.js → config-NRIOKK5T.js} +2 -2
- package/dist/{config-L7SBSH5L.js → config-OYK2BSJK.js} +2 -2
- package/dist/config-PB3KA2CE.js +9 -0
- package/dist/{config-54USUVSE.js → config-QY4IL3PH.js} +3 -2
- package/dist/{config-VKKZGC7V.js → config-R4LAOEDS.js} +2 -2
- package/dist/{config-FRK7ZL37.js → config-RIAAD6RW.js} +3 -2
- package/dist/{config-J2C53GOT.js → config-SYNEQAUB.js} +2 -2
- package/dist/{config-XU6D5C7E.js → config-TJKGYA2B.js} +3 -2
- package/dist/{config-DWSJL3NH.js → config-UURRGA7U.js} +4 -2
- package/dist/{config-BIBFLUIR.js → config-VPLHQXVE.js} +2 -2
- package/dist/config-WRACCRPN.js +9 -0
- package/dist/{config-OJ2BPESH.js → config-WVHKXEVE.js} +3 -2
- package/dist/{config-CPYFOUQO.js → config-XU7R36IE.js} +3 -2
- package/dist/{config-A2GQYJDB.js → config-Y2KOUYSS.js} +2 -2
- package/dist/databricks_volume-CNCPTZHS.js +7 -0
- package/dist/digitalocean-DJZOUB6Q.js +11 -0
- package/dist/discord-ETB2CADR.js +7 -0
- package/dist/disk-WEHSTK3F.js +7 -0
- package/dist/dropbox-XN6PGLNE.js +8 -0
- package/dist/email-OV7XCP3T.js +8 -0
- package/dist/gcal-P56MRCGU.js +8 -0
- package/dist/gcs-HFBIAE2C.js +10 -0
- package/dist/gdocs-LQ3UXP3J.js +8 -0
- package/dist/gdrive-N6UBYLON.js +8 -0
- package/dist/github-BPZREGPI.js +8 -0
- package/dist/github_ci-7A4LUIZ7.js +8 -0
- package/dist/{gmail-2TBT4CVH.js → gmail-YED2MF6H.js} +2 -2
- package/dist/gridfs-CPLQ4G62.js +9 -0
- package/dist/gsheets-4BNIJPQ6.js +8 -0
- package/dist/gslides-GDBYLO5A.js +8 -0
- package/dist/hf_buckets-FTJITQ3P.js +10 -0
- package/dist/hf_datasets-6GXVKQD7.js +10 -0
- package/dist/hf_models-PJPGZAC5.js +10 -0
- package/dist/hf_spaces-LFNFOLBF.js +10 -0
- package/dist/index.d.ts +897 -609
- package/dist/index.js +2371 -781
- package/dist/index.js.map +1 -1
- package/dist/jaeger-GCA6MJ6E.js +8 -0
- package/dist/lancedb-TJ5YSJY5.js +7 -0
- package/dist/langfuse-RUMTUMXS.js +8 -0
- package/dist/linear-BCE4KEAC.js +7 -0
- package/dist/minio-5SO6KBTK.js +11 -0
- package/dist/mongodb-7C5MBESV.js +7 -0
- package/dist/nextcloud-4O2LZVW2.js +9 -0
- package/dist/notion-RVKEAQ2M.js +7 -0
- package/dist/oci-OQXOIC62.js +10 -0
- package/dist/postgres-AV45GNRS.js +7 -0
- package/dist/qingstor-W277YA4K.js +11 -0
- package/dist/r2-FUA4IORE.js +10 -0
- package/dist/{redis-6D55Q2WB.js → redis-LPS357NF.js} +2 -2
- package/dist/s3-FPNWWIVM.js +8 -0
- package/dist/scaleway-BP3732U7.js +11 -0
- package/dist/seaweedfs-MC6HIEP4.js +11 -0
- package/dist/slack-JFGW7VLN.js +7 -0
- package/dist/ssh-UYPG42LM.js +8 -0
- package/dist/supabase-A3KUFMDC.js +10 -0
- package/dist/tencent-5464UQ2X.js +11 -0
- package/dist/trello-O2KB3FUO.js +8 -0
- package/dist/wasabi-2IKBIWNO.js +10 -0
- package/dist/wasabi-2IKBIWNO.js.map +1 -0
- package/package.json +15 -3
- package/dist/aliyun-PGI57A43.js +0 -10
- package/dist/backblaze-TSPL6Y56.js +0 -10
- package/dist/box-7XTZYDSO.js +0 -8
- package/dist/ceph-C265UI5T.js +0 -10
- package/dist/chunk-2ERLWAGG.js.map +0 -1
- package/dist/chunk-2QNPKPZZ.js +0 -59
- package/dist/chunk-2QNPKPZZ.js.map +0 -1
- package/dist/chunk-3ASOQTZB.js +0 -59
- package/dist/chunk-3ASOQTZB.js.map +0 -1
- package/dist/chunk-3JZN3GYO.js.map +0 -1
- package/dist/chunk-4GYB7DGC.js.map +0 -1
- package/dist/chunk-5YRWF5RP.js.map +0 -1
- package/dist/chunk-5ZHNPNDD.js.map +0 -1
- package/dist/chunk-AULFV3KY.js.map +0 -1
- package/dist/chunk-BWLUBJQG.js.map +0 -1
- package/dist/chunk-C7TNKIK5.js.map +0 -1
- package/dist/chunk-CB76WPUS.js.map +0 -1
- package/dist/chunk-CGGO5NKD.js.map +0 -1
- package/dist/chunk-CQCTCW4S.js.map +0 -1
- package/dist/chunk-D3U7VQCG.js +0 -25
- package/dist/chunk-D3U7VQCG.js.map +0 -1
- package/dist/chunk-E3KXVEYI.js.map +0 -1
- package/dist/chunk-EVK6HH6Z.js +0 -17
- package/dist/chunk-EVK6HH6Z.js.map +0 -1
- package/dist/chunk-FRGTDZQT.js.map +0 -1
- package/dist/chunk-GF75O2EN.js +0 -54
- package/dist/chunk-GF75O2EN.js.map +0 -1
- package/dist/chunk-GTAS3QVC.js +0 -25
- package/dist/chunk-GTAS3QVC.js.map +0 -1
- package/dist/chunk-H62XQZUM.js.map +0 -1
- package/dist/chunk-HCU3B6FW.js.map +0 -1
- package/dist/chunk-HEDE2377.js.map +0 -1
- package/dist/chunk-HGIPWY5Y.js.map +0 -1
- package/dist/chunk-HSD24IP2.js.map +0 -1
- package/dist/chunk-HWQPEBID.js.map +0 -1
- package/dist/chunk-IEHPTILN.js +0 -21
- package/dist/chunk-IEHPTILN.js.map +0 -1
- package/dist/chunk-IEVLWEBO.js.map +0 -1
- package/dist/chunk-IKJQOYI4.js +0 -26
- package/dist/chunk-IKJQOYI4.js.map +0 -1
- package/dist/chunk-IUXXZHY3.js.map +0 -1
- package/dist/chunk-JBDFYIN2.js.map +0 -1
- package/dist/chunk-JEBH5APX.js.map +0 -1
- package/dist/chunk-JHI2PHHD.js +0 -25
- package/dist/chunk-JHI2PHHD.js.map +0 -1
- package/dist/chunk-KAWDDS27.js.map +0 -1
- package/dist/chunk-KGC2OGXI.js +0 -27
- package/dist/chunk-KGC2OGXI.js.map +0 -1
- package/dist/chunk-LPLZLSMK.js.map +0 -1
- package/dist/chunk-M6E7VK4D.js.map +0 -1
- package/dist/chunk-MIQ3ECZM.js +0 -54
- package/dist/chunk-MIQ3ECZM.js.map +0 -1
- package/dist/chunk-MRXTUFBZ.js.map +0 -1
- package/dist/chunk-NJ42VNXG.js.map +0 -1
- package/dist/chunk-OSVZKYXS.js.map +0 -1
- package/dist/chunk-RHUEV4I7.js.map +0 -1
- package/dist/chunk-S4KVLPBR.js.map +0 -1
- package/dist/chunk-SAOQW6ZJ.js.map +0 -1
- package/dist/chunk-SI4GMRXD.js.map +0 -1
- package/dist/chunk-UAJYJP5C.js +0 -59
- package/dist/chunk-UAJYJP5C.js.map +0 -1
- package/dist/chunk-UYA3XL3J.js +0 -54
- package/dist/chunk-UYA3XL3J.js.map +0 -1
- package/dist/chunk-VBYIDRNU.js.map +0 -1
- package/dist/chunk-VHED2STW.js.map +0 -1
- package/dist/chunk-VIICUPWQ.js +0 -23
- package/dist/chunk-VIICUPWQ.js.map +0 -1
- package/dist/chunk-VLRSOWHP.js.map +0 -1
- package/dist/chunk-W5ZLIQFR.js.map +0 -1
- package/dist/chunk-WTSSEUOZ.js +0 -59
- package/dist/chunk-WTSSEUOZ.js.map +0 -1
- package/dist/chunk-WWP2STF5.js +0 -59
- package/dist/chunk-WWP2STF5.js.map +0 -1
- package/dist/chunk-XFSEADPC.js.map +0 -1
- package/dist/chunk-YBVMZ7SR.js +0 -59
- package/dist/chunk-YBVMZ7SR.js.map +0 -1
- package/dist/chunk-YRJICL2Q.js.map +0 -1
- package/dist/chunk-ZMREYTHA.js.map +0 -1
- package/dist/chunk-ZPB3SLPK.js.map +0 -1
- package/dist/chunk-ZPZQXHW2.js.map +0 -1
- package/dist/config-3WDIJPTG.js +0 -9
- package/dist/config-4QV4QYI5.js +0 -9
- package/dist/config-5ZXN2T2H.js +0 -9
- package/dist/config-EHE52ZTK.js +0 -9
- package/dist/config-HTXOOAOD.js +0 -9
- package/dist/config-K63RX6EU.js +0 -9
- package/dist/config-LEALEMKA.js +0 -9
- package/dist/config-RI7IEZUF.js +0 -9
- package/dist/databricks_volume-ETRDJVVQ.js +0 -7
- package/dist/digitalocean-QP72DR4J.js +0 -10
- package/dist/discord-BSN5RB3E.js +0 -8
- package/dist/disk-24NWTN2I.js +0 -7
- package/dist/dropbox-OSTZXSIE.js +0 -8
- package/dist/email-4ZFPSWIN.js +0 -8
- package/dist/gcs-PFWR6MIW.js +0 -10
- package/dist/gdocs-GPAZRQG5.js +0 -8
- package/dist/gdrive-XSX6A7B3.js +0 -8
- package/dist/github-EQ4NXUTA.js +0 -8
- package/dist/github_ci-QL5B2Q2N.js +0 -8
- package/dist/gridfs-KZRZ6SIB.js +0 -9
- package/dist/gsheets-N53WEXN2.js +0 -8
- package/dist/gslides-TATSARTH.js +0 -8
- package/dist/hf_buckets-BK7NGJWS.js +0 -10
- package/dist/hf_datasets-UQ5QGM4L.js +0 -10
- package/dist/hf_models-75LFCQCS.js +0 -10
- package/dist/hf_spaces-6T2KB3UC.js +0 -10
- package/dist/langfuse-AMQCQWNE.js +0 -8
- package/dist/linear-V3TXO6CV.js +0 -8
- package/dist/minio-IZRZY4C5.js +0 -10
- package/dist/mongodb-VMKPQCPX.js +0 -7
- package/dist/nextcloud-5RHQCGDO.js +0 -9
- package/dist/notion-6PPNTQFM.js +0 -8
- package/dist/oci-CKYBSFZJ.js +0 -10
- package/dist/postgres-WIQBVL5M.js +0 -7
- package/dist/qingstor-AP4IIPLY.js +0 -10
- package/dist/r2-C4XGEWQY.js +0 -10
- package/dist/s3-XQBI2CXN.js +0 -8
- package/dist/scaleway-SEZJVURB.js +0 -10
- package/dist/seaweedfs-3XYIAFU2.js +0 -10
- package/dist/slack-ZHXDJQY4.js +0 -8
- package/dist/ssh-X2MO7JOV.js +0 -8
- package/dist/supabase-BBM44UTM.js +0 -10
- package/dist/tencent-X72USLJ7.js +0 -10
- package/dist/trello-EER5NG7L.js +0 -8
- package/dist/wasabi-O4MVIUFG.js +0 -10
- /package/dist/{aliyun-PGI57A43.js.map → aliyun-S62BR3TB.js.map} +0 -0
- /package/dist/{backblaze-TSPL6Y56.js.map → backblaze-4EKSW63F.js.map} +0 -0
- /package/dist/{box-7XTZYDSO.js.map → box-ZPLZAGMK.js.map} +0 -0
- /package/dist/{ceph-C265UI5T.js.map → ceph-ALKLD3MO.js.map} +0 -0
- /package/dist/{chunk-4M73WHIE.js.map → chunk-BZTVYOES.js.map} +0 -0
- /package/dist/{chunk-BWWU5T2D.js.map → chunk-ENW5BVYN.js.map} +0 -0
- /package/dist/{chunk-F5NWRF32.js.map → chunk-ETIAW4YD.js.map} +0 -0
- /package/dist/{chunk-TUNR4VUM.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
- /package/dist/{chunk-DXU7NZPH.js.map → chunk-HCRYAFBI.js.map} +0 -0
- /package/dist/{chunk-V7JVMG63.js.map → chunk-OXEQSPND.js.map} +0 -0
- /package/dist/{config-2LASFFRD.js.map → config-2YBCHU2W.js.map} +0 -0
- /package/dist/{config-3WDIJPTG.js.map → config-3YRGRW72.js.map} +0 -0
- /package/dist/{config-4QV4QYI5.js.map → config-4GSOMUMF.js.map} +0 -0
- /package/dist/{config-54USUVSE.js.map → config-5YBUWFUP.js.map} +0 -0
- /package/dist/{config-5ZXN2T2H.js.map → config-5ZRKJTKG.js.map} +0 -0
- /package/dist/{config-A2GQYJDB.js.map → config-A25LTL5W.js.map} +0 -0
- /package/dist/{config-BBOLI7VE.js.map → config-CLU7JABG.js.map} +0 -0
- /package/dist/{config-BIBFLUIR.js.map → config-D2RF7L3N.js.map} +0 -0
- /package/dist/{config-CPYFOUQO.js.map → config-E55TKM6K.js.map} +0 -0
- /package/dist/{config-DWSJL3NH.js.map → config-ELDOFRJW.js.map} +0 -0
- /package/dist/{config-E22XAGYN.js.map → config-FPC3RBFD.js.map} +0 -0
- /package/dist/{config-EHE52ZTK.js.map → config-FPM3LAW7.js.map} +0 -0
- /package/dist/{config-EX3ZJTZI.js.map → config-G3F54CS4.js.map} +0 -0
- /package/dist/{config-FRK7ZL37.js.map → config-G43HRUI3.js.map} +0 -0
- /package/dist/{config-HQXNFQZS.js.map → config-GG3WO5PB.js.map} +0 -0
- /package/dist/{config-HTXOOAOD.js.map → config-JUYBWAZE.js.map} +0 -0
- /package/dist/{config-IPNWAJHH.js.map → config-LJ5T6TVA.js.map} +0 -0
- /package/dist/{config-J2C53GOT.js.map → config-MDSAE4O3.js.map} +0 -0
- /package/dist/{config-K63RX6EU.js.map → config-NRIOKK5T.js.map} +0 -0
- /package/dist/{config-L7SBSH5L.js.map → config-OYK2BSJK.js.map} +0 -0
- /package/dist/{config-LEALEMKA.js.map → config-PB3KA2CE.js.map} +0 -0
- /package/dist/{config-M3Z47VYU.js.map → config-QY4IL3PH.js.map} +0 -0
- /package/dist/{config-MZM3IPFM.js.map → config-R4LAOEDS.js.map} +0 -0
- /package/dist/{config-OJ2BPESH.js.map → config-RIAAD6RW.js.map} +0 -0
- /package/dist/{config-QO2XUME4.js.map → config-SYNEQAUB.js.map} +0 -0
- /package/dist/{config-QWQGOXQ5.js.map → config-TJKGYA2B.js.map} +0 -0
- /package/dist/{config-RI7IEZUF.js.map → config-UURRGA7U.js.map} +0 -0
- /package/dist/{config-SPW6NESU.js.map → config-VPLHQXVE.js.map} +0 -0
- /package/dist/{config-T2IUIU5C.js.map → config-WRACCRPN.js.map} +0 -0
- /package/dist/{config-VKKZGC7V.js.map → config-WVHKXEVE.js.map} +0 -0
- /package/dist/{config-W7EVPJNK.js.map → config-XU7R36IE.js.map} +0 -0
- /package/dist/{config-WKQ3FGTZ.js.map → config-Y2KOUYSS.js.map} +0 -0
- /package/dist/{config-WVILHDFV.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
- /package/dist/{config-XU6D5C7E.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
- /package/dist/{databricks_volume-ETRDJVVQ.js.map → discord-ETB2CADR.js.map} +0 -0
- /package/dist/{digitalocean-QP72DR4J.js.map → disk-WEHSTK3F.js.map} +0 -0
- /package/dist/{discord-BSN5RB3E.js.map → dropbox-XN6PGLNE.js.map} +0 -0
- /package/dist/{disk-24NWTN2I.js.map → email-OV7XCP3T.js.map} +0 -0
- /package/dist/{dropbox-OSTZXSIE.js.map → gcal-P56MRCGU.js.map} +0 -0
- /package/dist/{email-4ZFPSWIN.js.map → gcs-HFBIAE2C.js.map} +0 -0
- /package/dist/{gcs-PFWR6MIW.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
- /package/dist/{gdocs-GPAZRQG5.js.map → gdrive-N6UBYLON.js.map} +0 -0
- /package/dist/{gdrive-XSX6A7B3.js.map → github-BPZREGPI.js.map} +0 -0
- /package/dist/{github-EQ4NXUTA.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
- /package/dist/{github_ci-QL5B2Q2N.js.map → gmail-YED2MF6H.js.map} +0 -0
- /package/dist/{gmail-2TBT4CVH.js.map → gridfs-CPLQ4G62.js.map} +0 -0
- /package/dist/{gridfs-KZRZ6SIB.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
- /package/dist/{gsheets-N53WEXN2.js.map → gslides-GDBYLO5A.js.map} +0 -0
- /package/dist/{gslides-TATSARTH.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
- /package/dist/{hf_buckets-BK7NGJWS.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
- /package/dist/{hf_datasets-UQ5QGM4L.js.map → hf_models-PJPGZAC5.js.map} +0 -0
- /package/dist/{hf_models-75LFCQCS.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
- /package/dist/{hf_spaces-6T2KB3UC.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
- /package/dist/{langfuse-AMQCQWNE.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
- /package/dist/{linear-V3TXO6CV.js.map → langfuse-RUMTUMXS.js.map} +0 -0
- /package/dist/{minio-IZRZY4C5.js.map → linear-BCE4KEAC.js.map} +0 -0
- /package/dist/{mongodb-VMKPQCPX.js.map → minio-5SO6KBTK.js.map} +0 -0
- /package/dist/{nextcloud-5RHQCGDO.js.map → mongodb-7C5MBESV.js.map} +0 -0
- /package/dist/{notion-6PPNTQFM.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
- /package/dist/{oci-CKYBSFZJ.js.map → notion-RVKEAQ2M.js.map} +0 -0
- /package/dist/{postgres-WIQBVL5M.js.map → oci-OQXOIC62.js.map} +0 -0
- /package/dist/{qingstor-AP4IIPLY.js.map → postgres-AV45GNRS.js.map} +0 -0
- /package/dist/{r2-C4XGEWQY.js.map → qingstor-W277YA4K.js.map} +0 -0
- /package/dist/{redis-6D55Q2WB.js.map → r2-FUA4IORE.js.map} +0 -0
- /package/dist/{s3-XQBI2CXN.js.map → redis-LPS357NF.js.map} +0 -0
- /package/dist/{scaleway-SEZJVURB.js.map → s3-FPNWWIVM.js.map} +0 -0
- /package/dist/{seaweedfs-3XYIAFU2.js.map → scaleway-BP3732U7.js.map} +0 -0
- /package/dist/{slack-ZHXDJQY4.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
- /package/dist/{ssh-X2MO7JOV.js.map → slack-JFGW7VLN.js.map} +0 -0
- /package/dist/{supabase-BBM44UTM.js.map → ssh-UYPG42LM.js.map} +0 -0
- /package/dist/{tencent-X72USLJ7.js.map → supabase-A3KUFMDC.js.map} +0 -0
- /package/dist/{trello-EER5NG7L.js.map → tencent-5464UQ2X.js.map} +0 -0
- /package/dist/{wasabi-O4MVIUFG.js.map → trello-O2KB3FUO.js.map} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
redactEmailConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CRC4YWXB.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 PathSpec2,
|
|
9
|
+
ResourceName as ResourceName6,
|
|
10
10
|
makeResolveGlob,
|
|
11
|
-
mountKey as
|
|
12
|
-
mountPrefixOf as
|
|
11
|
+
mountKey as mountKey3,
|
|
12
|
+
mountPrefixOf as mountPrefixOf6
|
|
13
13
|
} from "@struktoai/mirage-core";
|
|
14
14
|
|
|
15
15
|
// src/accessor/email.ts
|
|
@@ -56,30 +56,26 @@ var EmailAccessor = class extends Accessor {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
// src/commands/builtin/email/index.ts
|
|
59
|
-
import { ResourceName as
|
|
59
|
+
import { ResourceName as ResourceName4, makeGenericCommands } from "@struktoai/mirage-core";
|
|
60
60
|
|
|
61
61
|
// src/commands/builtin/email/find.ts
|
|
62
62
|
import {
|
|
63
|
-
FileType as FileType2,
|
|
64
|
-
IOResult,
|
|
65
|
-
PathSpec as PathSpec2,
|
|
66
63
|
ResourceName,
|
|
67
64
|
command,
|
|
68
|
-
|
|
69
|
-
mountKey as mountKey3,
|
|
70
|
-
mountPrefixOf as mountPrefixOf4,
|
|
65
|
+
findGeneric,
|
|
71
66
|
resolveGlobOf,
|
|
72
|
-
rstripSlash,
|
|
73
67
|
specOf,
|
|
74
|
-
|
|
68
|
+
walkFind
|
|
75
69
|
} from "@struktoai/mirage-core";
|
|
76
70
|
|
|
77
71
|
// src/core/email/readdir.ts
|
|
78
72
|
import {
|
|
73
|
+
enoent,
|
|
79
74
|
IndexEntry,
|
|
80
75
|
PathSpec as PathSpecCtor,
|
|
81
76
|
mountKey,
|
|
82
|
-
mountPrefixOf
|
|
77
|
+
mountPrefixOf,
|
|
78
|
+
compareCodePoints
|
|
83
79
|
} from "@struktoai/mirage-core";
|
|
84
80
|
|
|
85
81
|
// src/core/email/_parse.ts
|
|
@@ -122,6 +118,7 @@ function fromParsed(parsed, headersOnly) {
|
|
|
122
118
|
const references = typeof refsRaw === "string" ? refsRaw.split(/\s+/).filter((s) => s !== "") : refsRaw ?? [];
|
|
123
119
|
return {
|
|
124
120
|
from: toAddr(parsed.from?.value[0]),
|
|
121
|
+
reply_to: toAddrList(parsed.replyTo),
|
|
125
122
|
to: toAddrList(parsed.to),
|
|
126
123
|
cc: toAddrList(parsed.cc),
|
|
127
124
|
subject: parsed.subject ?? "",
|
|
@@ -153,18 +150,35 @@ async function parseWithPayloads(raw) {
|
|
|
153
150
|
}
|
|
154
151
|
|
|
155
152
|
// src/core/email/_client.ts
|
|
156
|
-
|
|
153
|
+
function internalDateOf(value) {
|
|
154
|
+
if (value === void 0) return "";
|
|
155
|
+
if (typeof value === "string") return value;
|
|
156
|
+
return value.toISOString();
|
|
157
|
+
}
|
|
158
|
+
async function listFolderEntries(accessor) {
|
|
157
159
|
const imap = await accessor.getImap();
|
|
158
160
|
const tree = await imap.list();
|
|
159
|
-
return tree.map((m) => m.pathAsListed);
|
|
161
|
+
return tree.map((m) => ({ name: m.pathAsListed, specialUse: m.specialUse ?? null }));
|
|
162
|
+
}
|
|
163
|
+
async function listFolders(accessor) {
|
|
164
|
+
return (await listFolderEntries(accessor)).map((entry) => entry.name);
|
|
165
|
+
}
|
|
166
|
+
async function lockMailbox(imap, folder) {
|
|
167
|
+
try {
|
|
168
|
+
return await imap.getMailboxLock(folder);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
const answered = error.responseText !== void 0;
|
|
171
|
+
if (answered) throw new Error(`no such mailbox '${folder}'`);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
160
174
|
}
|
|
161
175
|
async function listMessageUids(accessor, folder, searchCriteria = "ALL", maxResults = null) {
|
|
162
176
|
const imap = await accessor.getImap();
|
|
163
|
-
const lock = await imap
|
|
177
|
+
const lock = await lockMailbox(imap, folder);
|
|
164
178
|
try {
|
|
165
179
|
const query = parseSearchCriteria(searchCriteria);
|
|
166
180
|
const uidsRaw = await imap.search(query, { uid: true });
|
|
167
|
-
if (uidsRaw === false)
|
|
181
|
+
if (uidsRaw === false) throw new Error(`IMAP rejected the search: ${searchCriteria}`);
|
|
168
182
|
const uids = uidsRaw.map((n) => String(n));
|
|
169
183
|
if (maxResults !== null && uids.length > maxResults) {
|
|
170
184
|
return uids.slice(uids.length - maxResults);
|
|
@@ -174,58 +188,119 @@ async function listMessageUids(accessor, folder, searchCriteria = "ALL", maxResu
|
|
|
174
188
|
lock.release();
|
|
175
189
|
}
|
|
176
190
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
var FLAG_KEYS = {
|
|
192
|
+
SEEN: "seen",
|
|
193
|
+
ANSWERED: "answered",
|
|
194
|
+
FLAGGED: "flagged",
|
|
195
|
+
DRAFT: "draft",
|
|
196
|
+
DELETED: "deleted"
|
|
197
|
+
};
|
|
198
|
+
var TEXT_KEYS = {
|
|
199
|
+
BODY: "body",
|
|
200
|
+
TEXT: "text",
|
|
201
|
+
SUBJECT: "subject",
|
|
202
|
+
FROM: "from",
|
|
203
|
+
TO: "to"
|
|
204
|
+
};
|
|
205
|
+
var DATE_KEYS = {
|
|
206
|
+
ON: "on",
|
|
207
|
+
SINCE: "since",
|
|
208
|
+
BEFORE: "before",
|
|
209
|
+
SENTON: "sentOn",
|
|
210
|
+
SENTSINCE: "sentSince",
|
|
211
|
+
SENTBEFORE: "sentBefore"
|
|
212
|
+
};
|
|
213
|
+
function andQueries(left, right) {
|
|
214
|
+
const collides = Object.keys(right).some((key) => key in left);
|
|
215
|
+
if (!collides) return { ...left, ...right };
|
|
216
|
+
return { not: { or: [{ not: left }, { not: right }] } };
|
|
217
|
+
}
|
|
218
|
+
var CriteriaParser = class {
|
|
219
|
+
constructor(tokens) {
|
|
220
|
+
this.tokens = tokens;
|
|
221
|
+
}
|
|
222
|
+
tokens;
|
|
223
|
+
index = 0;
|
|
224
|
+
peek() {
|
|
225
|
+
return this.tokens[this.index];
|
|
226
|
+
}
|
|
227
|
+
take() {
|
|
228
|
+
const token = this.peek();
|
|
229
|
+
if (token === void 0) throw new Error("email: truncated IMAP search criteria");
|
|
230
|
+
this.index += 1;
|
|
231
|
+
return token;
|
|
232
|
+
}
|
|
233
|
+
atEnd() {
|
|
234
|
+
return this.index >= this.tokens.length;
|
|
235
|
+
}
|
|
236
|
+
/** One or more keys juxtaposed, which IMAP reads as AND. */
|
|
237
|
+
parseSequence(stopAtParen = false) {
|
|
238
|
+
let query = null;
|
|
239
|
+
while (!this.atEnd()) {
|
|
240
|
+
if (stopAtParen && this.peek() === ")") break;
|
|
241
|
+
const next = this.parseKey();
|
|
242
|
+
query = query === null ? next : andQueries(query, next);
|
|
188
243
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
244
|
+
return query ?? { all: true };
|
|
245
|
+
}
|
|
246
|
+
parseKey() {
|
|
247
|
+
const token = this.take();
|
|
248
|
+
if (token === "(") {
|
|
249
|
+
const inner = this.parseSequence(true);
|
|
250
|
+
if (this.peek() !== ")") throw new Error("email: unbalanced IMAP search criteria");
|
|
251
|
+
this.index += 1;
|
|
252
|
+
return inner;
|
|
253
|
+
}
|
|
254
|
+
const word = token.toUpperCase();
|
|
255
|
+
if (word === "ALL") return { all: true };
|
|
256
|
+
if (word === "NOT") return { not: this.parseKey() };
|
|
257
|
+
if (word === "OR") return { or: [this.parseKey(), this.parseKey()] };
|
|
258
|
+
if (word === "UNSEEN") return { seen: false };
|
|
259
|
+
const flag = FLAG_KEYS[word];
|
|
260
|
+
if (flag !== void 0) return { [flag]: true };
|
|
261
|
+
const textKey = TEXT_KEYS[word];
|
|
262
|
+
if (textKey !== void 0) return { [textKey]: this.take() };
|
|
263
|
+
const dateKey = DATE_KEYS[word];
|
|
264
|
+
if (dateKey !== void 0) {
|
|
265
|
+
const parsed = parseImapDate(this.take());
|
|
266
|
+
if (parsed === null) throw new Error(`email: bad date in IMAP search criteria: ${token}`);
|
|
267
|
+
return { [dateKey]: parsed };
|
|
204
268
|
}
|
|
205
|
-
|
|
269
|
+
throw new Error(`email: unsupported IMAP search key '${token}'`);
|
|
206
270
|
}
|
|
207
|
-
|
|
271
|
+
};
|
|
272
|
+
function parseSearchCriteria(criteria) {
|
|
273
|
+
if (criteria === "ALL" || criteria === "") return { all: true };
|
|
274
|
+
return new CriteriaParser(tokenizeCriteria(criteria)).parseSequence();
|
|
208
275
|
}
|
|
209
276
|
function tokenizeCriteria(criteria) {
|
|
210
277
|
const tokens = [];
|
|
211
278
|
let i = 0;
|
|
212
279
|
while (i < criteria.length) {
|
|
213
|
-
|
|
280
|
+
const char = criteria.charAt(i);
|
|
281
|
+
if (char === " ") {
|
|
282
|
+
i += 1;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
if (char === "(" || char === ")") {
|
|
286
|
+
tokens.push(char);
|
|
214
287
|
i += 1;
|
|
215
288
|
continue;
|
|
216
289
|
}
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
290
|
+
if (char === '"') {
|
|
291
|
+
let value = "";
|
|
292
|
+
let j = i + 1;
|
|
293
|
+
while (j < criteria.length && criteria.charAt(j) !== '"') {
|
|
294
|
+
if (criteria.charAt(j) === "\\" && j + 1 < criteria.length) j += 1;
|
|
295
|
+
value += criteria.charAt(j);
|
|
296
|
+
j += 1;
|
|
222
297
|
}
|
|
223
|
-
tokens.push(
|
|
224
|
-
i =
|
|
298
|
+
tokens.push(value);
|
|
299
|
+
i = j + 1;
|
|
225
300
|
continue;
|
|
226
301
|
}
|
|
227
|
-
let end =
|
|
228
|
-
|
|
302
|
+
let end = i;
|
|
303
|
+
while (end < criteria.length && !" ()".includes(criteria.charAt(end))) end += 1;
|
|
229
304
|
tokens.push(criteria.slice(i, end));
|
|
230
305
|
i = end;
|
|
231
306
|
}
|
|
@@ -250,15 +325,35 @@ function parseImapDate(s) {
|
|
|
250
325
|
};
|
|
251
326
|
const day = Number.parseInt(m[1] ?? "0", 10);
|
|
252
327
|
const monKey = (m[2] ?? "").slice(0, 1).toUpperCase() + (m[2] ?? "").slice(1).toLowerCase();
|
|
253
|
-
const mon = months[monKey]
|
|
328
|
+
const mon = months[monKey];
|
|
254
329
|
const year = Number.parseInt(m[3] ?? "1970", 10);
|
|
255
|
-
|
|
330
|
+
if (mon === void 0) return null;
|
|
331
|
+
const value = new Date(Date.UTC(year, mon, day));
|
|
332
|
+
if (value.getUTCMonth() !== mon || value.getUTCDate() !== day) return null;
|
|
333
|
+
return value;
|
|
334
|
+
}
|
|
335
|
+
async function fetchRawMessage(accessor, folder, uid) {
|
|
336
|
+
const imap = await accessor.getImap();
|
|
337
|
+
const lock = await lockMailbox(imap, folder);
|
|
338
|
+
try {
|
|
339
|
+
const msg = await imap.fetchOne(uid, { source: true, uid: true }, { uid: true });
|
|
340
|
+
if (msg === false) {
|
|
341
|
+
throw new Error(`email: uid ${uid} not found in ${folder}`);
|
|
342
|
+
}
|
|
343
|
+
return msg.source instanceof Buffer ? new Uint8Array(msg.source) : new Uint8Array(0);
|
|
344
|
+
} finally {
|
|
345
|
+
lock.release();
|
|
346
|
+
}
|
|
256
347
|
}
|
|
257
348
|
async function fetchMessage(accessor, folder, uid) {
|
|
258
349
|
const imap = await accessor.getImap();
|
|
259
|
-
const lock = await imap
|
|
350
|
+
const lock = await lockMailbox(imap, folder);
|
|
260
351
|
try {
|
|
261
|
-
const msg = await imap.fetchOne(
|
|
352
|
+
const msg = await imap.fetchOne(
|
|
353
|
+
uid,
|
|
354
|
+
{ source: true, flags: true, uid: true, internalDate: true },
|
|
355
|
+
{ uid: true }
|
|
356
|
+
);
|
|
262
357
|
if (msg === false) {
|
|
263
358
|
throw new Error(`email: uid ${uid} not found in ${folder}`);
|
|
264
359
|
}
|
|
@@ -267,7 +362,8 @@ async function fetchMessage(accessor, folder, uid) {
|
|
|
267
362
|
return {
|
|
268
363
|
...parsed,
|
|
269
364
|
uid,
|
|
270
|
-
flags: msg.flags !== void 0 ? [...msg.flags] : []
|
|
365
|
+
flags: msg.flags !== void 0 ? [...msg.flags] : [],
|
|
366
|
+
internalDate: internalDateOf(msg.internalDate)
|
|
271
367
|
};
|
|
272
368
|
} finally {
|
|
273
369
|
lock.release();
|
|
@@ -276,18 +372,23 @@ async function fetchMessage(accessor, folder, uid) {
|
|
|
276
372
|
async function fetchHeaders(accessor, folder, uids) {
|
|
277
373
|
if (uids.length === 0) return [];
|
|
278
374
|
const imap = await accessor.getImap();
|
|
279
|
-
const lock = await imap
|
|
375
|
+
const lock = await lockMailbox(imap, folder);
|
|
280
376
|
try {
|
|
281
377
|
const results = [];
|
|
282
378
|
for (const uid of uids) {
|
|
283
|
-
const msg = await imap.fetchOne(
|
|
379
|
+
const msg = await imap.fetchOne(
|
|
380
|
+
uid,
|
|
381
|
+
{ source: true, flags: true, uid: true, internalDate: true },
|
|
382
|
+
{ uid: true }
|
|
383
|
+
);
|
|
284
384
|
if (msg === false) continue;
|
|
285
385
|
const source = msg.source instanceof Buffer ? new Uint8Array(msg.source) : new Uint8Array(0);
|
|
286
386
|
const parsed = await parseRfc822(source);
|
|
287
387
|
results.push({
|
|
288
388
|
...parsed,
|
|
289
389
|
uid,
|
|
290
|
-
flags: msg.flags !== void 0 ? [...msg.flags] : []
|
|
390
|
+
flags: msg.flags !== void 0 ? [...msg.flags] : [],
|
|
391
|
+
internalDate: internalDateOf(msg.internalDate)
|
|
291
392
|
});
|
|
292
393
|
}
|
|
293
394
|
return results;
|
|
@@ -297,7 +398,7 @@ async function fetchHeaders(accessor, folder, uids) {
|
|
|
297
398
|
}
|
|
298
399
|
async function fetchAttachment(accessor, folder, uid, filename) {
|
|
299
400
|
const imap = await accessor.getImap();
|
|
300
|
-
const lock = await imap
|
|
401
|
+
const lock = await lockMailbox(imap, folder);
|
|
301
402
|
try {
|
|
302
403
|
const msg = await imap.fetchOne(uid, { source: true }, { uid: true });
|
|
303
404
|
if (msg === false) return null;
|
|
@@ -317,10 +418,28 @@ async function listFolders2(accessor) {
|
|
|
317
418
|
return listFolders(accessor);
|
|
318
419
|
}
|
|
319
420
|
|
|
421
|
+
// src/core/email/render.ts
|
|
422
|
+
var encoder = new TextEncoder();
|
|
423
|
+
function messageDocument(message) {
|
|
424
|
+
const body = { ...message };
|
|
425
|
+
delete body.internalDate;
|
|
426
|
+
return body;
|
|
427
|
+
}
|
|
428
|
+
function messageJsonText(message) {
|
|
429
|
+
return JSON.stringify(messageDocument(message));
|
|
430
|
+
}
|
|
431
|
+
function messageJsonBytes(message) {
|
|
432
|
+
return encoder.encode(messageJsonText(message));
|
|
433
|
+
}
|
|
434
|
+
function messagesJsonBytes(messages) {
|
|
435
|
+
return encoder.encode(JSON.stringify(messages.map((m) => messageDocument(m))));
|
|
436
|
+
}
|
|
437
|
+
|
|
320
438
|
// src/core/email/readdir.ts
|
|
321
439
|
var TITLE_MAX = 80;
|
|
322
440
|
var UNSAFE = /[^\w\s\-.]/g;
|
|
323
441
|
var MULTI_UNDERSCORE = /_+/g;
|
|
442
|
+
var EPOCH_DATE = "1970-01-01";
|
|
324
443
|
function sanitize(text) {
|
|
325
444
|
if (text.trim() === "") return "No_Subject";
|
|
326
445
|
let cleaned = text.replace(UNSAFE, "_").replace(/ /g, "_");
|
|
@@ -331,19 +450,43 @@ function sanitize(text) {
|
|
|
331
450
|
function msgFilename(subject, uid) {
|
|
332
451
|
return `${sanitize(subject)}__${uid}.email.json`;
|
|
333
452
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
453
|
+
var NAMED_ZONES = {
|
|
454
|
+
UT: 0,
|
|
455
|
+
UTC: 0,
|
|
456
|
+
GMT: 0,
|
|
457
|
+
Z: 0,
|
|
458
|
+
EST: -300,
|
|
459
|
+
EDT: -240,
|
|
460
|
+
CST: -360,
|
|
461
|
+
CDT: -300,
|
|
462
|
+
MST: -420,
|
|
463
|
+
MDT: -360,
|
|
464
|
+
PST: -480,
|
|
465
|
+
PDT: -420
|
|
466
|
+
};
|
|
467
|
+
function statedOffset(value) {
|
|
468
|
+
const numeric = /([+-])(\d{2}):?(\d{2})\s*$/.exec(value);
|
|
469
|
+
if (numeric !== null) {
|
|
470
|
+
const sign = numeric[1] === "-" ? -1 : 1;
|
|
471
|
+
return sign * (Number(numeric[2]) * 60 + Number(numeric[3]));
|
|
472
|
+
}
|
|
473
|
+
const named = /([A-Z]{1,3})\s*$/.exec(value.toUpperCase());
|
|
474
|
+
return NAMED_ZONES[named?.[1] ?? ""] ?? null;
|
|
475
|
+
}
|
|
476
|
+
function ymd(year, month, day) {
|
|
477
|
+
return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}`;
|
|
478
|
+
}
|
|
479
|
+
function parseDate(value) {
|
|
480
|
+
if (value.trim() === "") return null;
|
|
481
|
+
const d = new Date(value);
|
|
482
|
+
if (Number.isNaN(d.getTime())) return null;
|
|
483
|
+
const offset = statedOffset(value);
|
|
484
|
+
if (offset === null) return ymd(d.getFullYear(), d.getMonth() + 1, d.getDate());
|
|
485
|
+
const shifted = new Date(d.getTime() + offset * 6e4);
|
|
486
|
+
return ymd(shifted.getUTCFullYear(), shifted.getUTCMonth() + 1, shifted.getUTCDate());
|
|
342
487
|
}
|
|
343
|
-
function
|
|
344
|
-
|
|
345
|
-
e.code = "ENOENT";
|
|
346
|
-
return e;
|
|
488
|
+
function dateBucket(message) {
|
|
489
|
+
return parseDate(message.date) ?? parseDate(message.internalDate) ?? EPOCH_DATE;
|
|
347
490
|
}
|
|
348
491
|
async function readdir(accessor, path, index) {
|
|
349
492
|
const prefix = mountPrefixOf(path.virtual, path.resourcePath);
|
|
@@ -377,12 +520,13 @@ async function readdir(accessor, path, index) {
|
|
|
377
520
|
if (cached.entries !== void 0 && cached.entries !== null) return cached.entries;
|
|
378
521
|
}
|
|
379
522
|
if (index === void 0) throw enoent(path.virtual);
|
|
523
|
+
if (!(await listFolders2(accessor)).includes(folderName)) throw enoent(path.virtual);
|
|
380
524
|
const maxMessages = accessor.config.maxMessages;
|
|
381
525
|
const uids = await listMessageUids(accessor, folderName, "ALL", maxMessages);
|
|
382
526
|
const headersList = await fetchHeaders(accessor, folderName, uids);
|
|
383
527
|
const dateGroups = /* @__PURE__ */ new Map();
|
|
384
528
|
for (const hdr of headersList) {
|
|
385
|
-
const dateStr =
|
|
529
|
+
const dateStr = dateBucket(hdr);
|
|
386
530
|
let bucket = dateGroups.get(dateStr);
|
|
387
531
|
if (bucket === void 0) {
|
|
388
532
|
bucket = [];
|
|
@@ -390,7 +534,7 @@ async function readdir(accessor, path, index) {
|
|
|
390
534
|
}
|
|
391
535
|
bucket.push(hdr);
|
|
392
536
|
}
|
|
393
|
-
const sortedDates = [...dateGroups.keys()].sort().reverse();
|
|
537
|
+
const sortedDates = [...dateGroups.keys()].sort(compareCodePoints).reverse();
|
|
394
538
|
const dateEntries = [];
|
|
395
539
|
for (const dateStr of sortedDates) {
|
|
396
540
|
const dateEntry = new IndexEntry({
|
|
@@ -409,7 +553,8 @@ async function readdir(accessor, path, index) {
|
|
|
409
553
|
id: uid,
|
|
410
554
|
name: subject,
|
|
411
555
|
resourceType: "email/message",
|
|
412
|
-
vfsName: filename
|
|
556
|
+
vfsName: filename,
|
|
557
|
+
size: messageJsonBytes(hdr).byteLength
|
|
413
558
|
});
|
|
414
559
|
msgEntries.push([filename, msgEntry]);
|
|
415
560
|
const attachments = hdr.attachments;
|
|
@@ -462,27 +607,15 @@ async function readdir(accessor, path, index) {
|
|
|
462
607
|
}
|
|
463
608
|
|
|
464
609
|
// src/core/email/stat.ts
|
|
465
|
-
import {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
if (lower.endsWith(".gz") || lower.endsWith(".gzip")) return FileType.GZIP;
|
|
475
|
-
if (lower.endsWith(".pdf")) return FileType.PDF;
|
|
476
|
-
if (lower.endsWith(".txt") || lower.endsWith(".md") || lower.endsWith(".log")) {
|
|
477
|
-
return FileType.TEXT;
|
|
478
|
-
}
|
|
479
|
-
return FileType.BINARY;
|
|
480
|
-
}
|
|
481
|
-
function enoent2(p) {
|
|
482
|
-
const e = new Error(`ENOENT: ${p}`);
|
|
483
|
-
e.code = "ENOENT";
|
|
484
|
-
return e;
|
|
485
|
-
}
|
|
610
|
+
import {
|
|
611
|
+
FileStat,
|
|
612
|
+
FileType,
|
|
613
|
+
PathSpec,
|
|
614
|
+
enoent as enoent2,
|
|
615
|
+
guessType,
|
|
616
|
+
mountKey as mountKey2,
|
|
617
|
+
mountPrefixOf as mountPrefixOf2
|
|
618
|
+
} from "@struktoai/mirage-core";
|
|
486
619
|
async function stat(accessor, path, index) {
|
|
487
620
|
const prefix = mountPrefixOf2(path.virtual, path.resourcePath);
|
|
488
621
|
const key = path.resourcePath;
|
|
@@ -545,18 +678,7 @@ async function stat(accessor, path, index) {
|
|
|
545
678
|
}
|
|
546
679
|
|
|
547
680
|
// 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
|
-
}
|
|
681
|
+
import { eisdir, enoent as enoent3, gnuDirname, mountPrefixOf as mountPrefixOf3, stripSlash } from "@struktoai/mirage-core";
|
|
560
682
|
async function read(accessor, path, index) {
|
|
561
683
|
const prefix = mountPrefixOf3(path.virtual, path.resourcePath);
|
|
562
684
|
const key = path.resourcePath;
|
|
@@ -586,7 +708,7 @@ async function read(accessor, path, index) {
|
|
|
586
708
|
const folder = prefix !== "" ? parts[1] ?? "" : parts[0] ?? "";
|
|
587
709
|
const uid = result.entry.id;
|
|
588
710
|
const msg = await fetchMessage(accessor, folder, uid);
|
|
589
|
-
return
|
|
711
|
+
return messageJsonBytes(msg);
|
|
590
712
|
}
|
|
591
713
|
|
|
592
714
|
// src/commands/builtin/email/io.ts
|
|
@@ -634,78 +756,32 @@ function metadataProvision(_accessor, _paths, _texts, _opts) {
|
|
|
634
756
|
}
|
|
635
757
|
|
|
636
758
|
// src/commands/builtin/email/find.ts
|
|
637
|
-
import { fnmatch } from "@struktoai/mirage-core";
|
|
638
|
-
import { findSizeMtimeError, invalidFindArg } from "@struktoai/mirage-core";
|
|
639
759
|
var resolveGlob = resolveGlobOf(EMAIL_IO);
|
|
640
|
-
async function
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const sub = await walk(accessor, childSpec, index, maxDepth, depth + 1);
|
|
666
|
-
results.push(...sub);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
return results;
|
|
670
|
-
}
|
|
671
|
-
async function findCommand(accessor, paths, _texts, opts) {
|
|
672
|
-
const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
|
|
673
|
-
const p0 = resolved[0] ?? new PathSpec2({
|
|
674
|
-
virtual: "/",
|
|
675
|
-
directory: "/",
|
|
676
|
-
resolved: false,
|
|
677
|
-
resourcePath: ""
|
|
678
|
-
});
|
|
679
|
-
const nameFlag = typeof opts.flags.name === "string" ? opts.flags.name : null;
|
|
680
|
-
const inameFlag = typeof opts.flags.iname === "string" ? opts.flags.iname : null;
|
|
681
|
-
const maxDepthRaw = typeof opts.flags.maxdepth === "string" ? opts.flags.maxdepth : null;
|
|
682
|
-
const minDepthRaw = typeof opts.flags.mindepth === "string" ? opts.flags.mindepth : null;
|
|
683
|
-
const maxDepth = maxDepthRaw !== null ? Number.parseInt(maxDepthRaw, 10) : null;
|
|
684
|
-
const minDepth = minDepthRaw !== null ? Number.parseInt(minDepthRaw, 10) : null;
|
|
685
|
-
if (maxDepthRaw !== null && Number.isNaN(maxDepth))
|
|
686
|
-
return invalidFindArg(maxDepthRaw, "-maxdepth");
|
|
687
|
-
if (minDepthRaw !== null && Number.isNaN(minDepth))
|
|
688
|
-
return invalidFindArg(minDepthRaw, "-mindepth");
|
|
689
|
-
const sizeFlag = typeof opts.flags.size === "string" ? opts.flags.size : null;
|
|
690
|
-
const mtimeFlag = typeof opts.flags.mtime === "string" ? opts.flags.mtime : null;
|
|
691
|
-
const sizeMtimeErr = findSizeMtimeError(sizeFlag, mtimeFlag);
|
|
692
|
-
if (sizeMtimeErr !== null) return sizeMtimeErr;
|
|
693
|
-
const allPaths = await walk(accessor, p0, opts.index, maxDepth, 0);
|
|
694
|
-
const searchKey = stripSlash2(p0.mountPath);
|
|
695
|
-
const baseDepth = searchKey === "" ? -1 : searchKey.split("/").length - 1;
|
|
696
|
-
const results = [];
|
|
697
|
-
for (const p of [...allPaths].sort()) {
|
|
698
|
-
const stripped = p.startsWith(mountPrefixOf4(p0.virtual, p0.resourcePath)) ? p.slice(mountPrefixOf4(p0.virtual, p0.resourcePath).length) : p;
|
|
699
|
-
const trimmed = stripSlash2(stripped);
|
|
700
|
-
const depth = trimmed === "" ? -1 : trimmed.split("/").length - (baseDepth + 2);
|
|
701
|
-
if (minDepth !== null && depth < minDepth) continue;
|
|
702
|
-
const entryName = p.split("/").pop() ?? p;
|
|
703
|
-
if (nameFlag !== null && !fnmatch(entryName, nameFlag)) continue;
|
|
704
|
-
if (inameFlag !== null && !fnmatch(entryName.toLowerCase(), inameFlag.toLowerCase())) continue;
|
|
705
|
-
results.push(p);
|
|
706
|
-
}
|
|
707
|
-
const out = formatRecords(results);
|
|
708
|
-
return [out, new IOResult()];
|
|
760
|
+
async function findCommand(accessor, paths, texts, opts) {
|
|
761
|
+
const idx = opts.index ?? void 0;
|
|
762
|
+
const resolved = await resolveGlob(accessor, paths, idx);
|
|
763
|
+
const dirEmpty = async (spec) => (await readdir(accessor, spec, idx)).length === 0;
|
|
764
|
+
return findGeneric(
|
|
765
|
+
resolved,
|
|
766
|
+
texts,
|
|
767
|
+
opts,
|
|
768
|
+
(root, options) => walkFind(
|
|
769
|
+
root,
|
|
770
|
+
{
|
|
771
|
+
readdir: (spec, i) => readdir(accessor, spec, i),
|
|
772
|
+
stat: async (spec, i) => {
|
|
773
|
+
const st = await stat(accessor, spec, i);
|
|
774
|
+
const overlay = opts.ns?.statOverlay;
|
|
775
|
+
return overlay !== void 0 ? overlay(spec.virtual, st) : st;
|
|
776
|
+
},
|
|
777
|
+
links: opts.ns?.links ?? null
|
|
778
|
+
},
|
|
779
|
+
options,
|
|
780
|
+
idx
|
|
781
|
+
),
|
|
782
|
+
void 0,
|
|
783
|
+
dirEmpty
|
|
784
|
+
);
|
|
709
785
|
}
|
|
710
786
|
var EMAIL_FIND = command({
|
|
711
787
|
name: "find",
|
|
@@ -715,142 +791,24 @@ var EMAIL_FIND = command({
|
|
|
715
791
|
provision: metadataProvision
|
|
716
792
|
});
|
|
717
793
|
|
|
718
|
-
// src/commands/builtin/email/email_forward.ts
|
|
719
|
-
import {
|
|
720
|
-
CommandSpec,
|
|
721
|
-
IOResult as IOResult2,
|
|
722
|
-
OperandKind,
|
|
723
|
-
Option,
|
|
724
|
-
ResourceName as ResourceName2,
|
|
725
|
-
command as command2
|
|
726
|
-
} from "@struktoai/mirage-core";
|
|
727
|
-
|
|
728
|
-
// src/core/email/send.ts
|
|
729
|
-
import { loadOptionalPeer as loadOptionalPeer3 } from "@struktoai/mirage-core";
|
|
730
|
-
var transporterCache = /* @__PURE__ */ new WeakMap();
|
|
731
|
-
async function getTransporter(config) {
|
|
732
|
-
const existing = transporterCache.get(config);
|
|
733
|
-
if (existing !== void 0) return existing;
|
|
734
|
-
const mod = await loadOptionalPeer3(
|
|
735
|
-
() => import("nodemailer"),
|
|
736
|
-
{ feature: "email send/reply/forward", packageName: "nodemailer" }
|
|
737
|
-
);
|
|
738
|
-
const transporter = mod.createTransport({
|
|
739
|
-
host: config.smtpHost,
|
|
740
|
-
port: config.smtpPort,
|
|
741
|
-
secure: config.smtpPort === 465,
|
|
742
|
-
auth: { user: config.username, pass: config.password }
|
|
743
|
-
});
|
|
744
|
-
transporterCache.set(config, transporter);
|
|
745
|
-
return transporter;
|
|
746
|
-
}
|
|
747
|
-
async function sendMessage(config, to, subject, body) {
|
|
748
|
-
const t = await getTransporter(config);
|
|
749
|
-
await t.sendMail({ from: config.username, to, subject, text: body });
|
|
750
|
-
return { status: "sent", to, subject };
|
|
751
|
-
}
|
|
752
|
-
async function replyMessage(config, original, body) {
|
|
753
|
-
const t = await getTransporter(config);
|
|
754
|
-
const refs = [...original.references];
|
|
755
|
-
if (original.message_id !== "") refs.push(original.message_id);
|
|
756
|
-
const subject = `Re: ${original.subject}`;
|
|
757
|
-
await t.sendMail({
|
|
758
|
-
from: config.username,
|
|
759
|
-
to: original.from.email,
|
|
760
|
-
subject,
|
|
761
|
-
text: body,
|
|
762
|
-
inReplyTo: original.message_id,
|
|
763
|
-
references: refs
|
|
764
|
-
});
|
|
765
|
-
return { status: "sent", to: original.from.email, subject };
|
|
766
|
-
}
|
|
767
|
-
async function replyAllMessage(config, original, body) {
|
|
768
|
-
const t = await getTransporter(config);
|
|
769
|
-
const all = /* @__PURE__ */ new Set();
|
|
770
|
-
if (original.from.email !== "") all.add(original.from.email);
|
|
771
|
-
for (const r of original.to) if (r.email !== "") all.add(r.email);
|
|
772
|
-
for (const r of original.cc) if (r.email !== "") all.add(r.email);
|
|
773
|
-
all.delete(config.username);
|
|
774
|
-
const recipients = [...all].sort();
|
|
775
|
-
const refs = [...original.references];
|
|
776
|
-
if (original.message_id !== "") refs.push(original.message_id);
|
|
777
|
-
const subject = `Re: ${original.subject}`;
|
|
778
|
-
await t.sendMail({
|
|
779
|
-
from: config.username,
|
|
780
|
-
to: recipients,
|
|
781
|
-
subject,
|
|
782
|
-
text: body,
|
|
783
|
-
inReplyTo: original.message_id,
|
|
784
|
-
references: refs
|
|
785
|
-
});
|
|
786
|
-
return { status: "sent", to: recipients, subject };
|
|
787
|
-
}
|
|
788
|
-
async function forwardMessage(config, original, to) {
|
|
789
|
-
const t = await getTransporter(config);
|
|
790
|
-
const subject = `Fwd: ${original.subject}`;
|
|
791
|
-
const fwdBody = `---------- Forwarded message ----------
|
|
792
|
-
From: ${original.from.name} <${original.from.email}>
|
|
793
|
-
Date: ${original.date}
|
|
794
|
-
Subject: ${original.subject}
|
|
795
|
-
|
|
796
|
-
` + original.body_text;
|
|
797
|
-
await t.sendMail({ from: config.username, to, subject, text: fwdBody });
|
|
798
|
-
return { status: "sent", to, subject };
|
|
799
|
-
}
|
|
800
|
-
|
|
801
|
-
// src/commands/builtin/email/email_forward.ts
|
|
802
|
-
var ENC2 = new TextEncoder();
|
|
803
|
-
var SPEC = new CommandSpec({
|
|
804
|
-
options: [
|
|
805
|
-
new Option({ long: "--uid", valueKind: OperandKind.TEXT }),
|
|
806
|
-
new Option({ long: "--folder", valueKind: OperandKind.TEXT }),
|
|
807
|
-
new Option({ long: "--to", valueKind: OperandKind.TEXT })
|
|
808
|
-
]
|
|
809
|
-
});
|
|
810
|
-
async function emailForwardCommand(accessor, _paths, _texts, opts) {
|
|
811
|
-
const uid = typeof opts.flags.uid === "string" ? opts.flags.uid : "";
|
|
812
|
-
const folder = typeof opts.flags.folder === "string" ? opts.flags.folder : "";
|
|
813
|
-
const to = typeof opts.flags.to === "string" ? opts.flags.to : "";
|
|
814
|
-
if (uid === "") {
|
|
815
|
-
return [null, new IOResult2({ exitCode: 2, stderr: ENC2.encode("--uid is required\n") })];
|
|
816
|
-
}
|
|
817
|
-
if (folder === "") {
|
|
818
|
-
return [null, new IOResult2({ exitCode: 2, stderr: ENC2.encode("--folder is required\n") })];
|
|
819
|
-
}
|
|
820
|
-
if (to === "") {
|
|
821
|
-
return [null, new IOResult2({ exitCode: 2, stderr: ENC2.encode("--to is required\n") })];
|
|
822
|
-
}
|
|
823
|
-
const original = await fetchMessage(accessor, folder, uid);
|
|
824
|
-
const result = await forwardMessage(accessor.config, original, to);
|
|
825
|
-
const out = ENC2.encode(JSON.stringify(result));
|
|
826
|
-
return [out, new IOResult2()];
|
|
827
|
-
}
|
|
828
|
-
var EMAIL_FORWARD = command2({
|
|
829
|
-
name: "himalaya message forward",
|
|
830
|
-
resource: ResourceName2.EMAIL,
|
|
831
|
-
spec: SPEC,
|
|
832
|
-
fn: emailForwardCommand,
|
|
833
|
-
write: true
|
|
834
|
-
});
|
|
835
|
-
|
|
836
794
|
// src/commands/builtin/email/grep.ts
|
|
837
795
|
import {
|
|
838
|
-
IOResult
|
|
839
|
-
ResourceName as
|
|
840
|
-
command as
|
|
796
|
+
IOResult,
|
|
797
|
+
ResourceName as ResourceName2,
|
|
798
|
+
command as command2,
|
|
841
799
|
compilePattern,
|
|
842
800
|
grepGeneric,
|
|
843
801
|
grepLines,
|
|
844
|
-
mountPrefixOf as
|
|
802
|
+
mountPrefixOf as mountPrefixOf4,
|
|
845
803
|
prefixAggregate,
|
|
846
804
|
resolveGlobOf as resolveGlobOf2,
|
|
847
805
|
specOf as specOf2
|
|
848
806
|
} from "@struktoai/mirage-core";
|
|
849
807
|
|
|
850
808
|
// src/core/email/scope.ts
|
|
851
|
-
import { stripSlash as
|
|
809
|
+
import { stripSlash as stripSlash2 } from "@struktoai/mirage-core";
|
|
852
810
|
function detectScope(path) {
|
|
853
|
-
const key =
|
|
811
|
+
const key = stripSlash2(path.mountPath);
|
|
854
812
|
if (key === "") {
|
|
855
813
|
return { useNative: false, folder: null, resourcePath: "/" };
|
|
856
814
|
}
|
|
@@ -868,25 +826,6 @@ function detectScope(path) {
|
|
|
868
826
|
}
|
|
869
827
|
|
|
870
828
|
// src/core/email/search.ts
|
|
871
|
-
var TITLE_MAX2 = 80;
|
|
872
|
-
var UNSAFE2 = /[^\w\s\-.]/g;
|
|
873
|
-
var MULTI_UNDERSCORE2 = /_+/g;
|
|
874
|
-
function sanitize2(text) {
|
|
875
|
-
if (text.trim() === "") return "No_Subject";
|
|
876
|
-
let cleaned = text.replace(UNSAFE2, "_").replace(/ /g, "_");
|
|
877
|
-
cleaned = cleaned.replace(MULTI_UNDERSCORE2, "_").replace(/^_+|_+$/g, "");
|
|
878
|
-
if (cleaned.length > TITLE_MAX2) cleaned = `${cleaned.slice(0, TITLE_MAX2 - 3)}...`;
|
|
879
|
-
return cleaned;
|
|
880
|
-
}
|
|
881
|
-
function dateFromHeader2(dateStr) {
|
|
882
|
-
if (dateStr === "") return "1970-01-01";
|
|
883
|
-
const d = new Date(dateStr);
|
|
884
|
-
if (Number.isNaN(d.getTime())) return "1970-01-01";
|
|
885
|
-
const yyyy = d.getUTCFullYear().toString().padStart(4, "0");
|
|
886
|
-
const mm = (d.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
887
|
-
const dd = d.getUTCDate().toString().padStart(2, "0");
|
|
888
|
-
return `${yyyy}-${mm}-${dd}`;
|
|
889
|
-
}
|
|
890
829
|
function buildSearchCriteria(opts) {
|
|
891
830
|
const parts = [];
|
|
892
831
|
if (opts.unseen === true) parts.push("UNSEEN");
|
|
@@ -915,8 +854,8 @@ async function searchMessages(accessor, folder, opts = {}, maxResults = null) {
|
|
|
915
854
|
return listMessageUids(accessor, folder, criteria, maxResults);
|
|
916
855
|
}
|
|
917
856
|
function buildVfsPath(prefix, folder, msg) {
|
|
918
|
-
const dateStr =
|
|
919
|
-
const subject =
|
|
857
|
+
const dateStr = dateBucket(msg);
|
|
858
|
+
const subject = sanitize(msg.subject !== "" ? msg.subject : "No Subject");
|
|
920
859
|
const filename = `${subject}__${msg.uid}.email.json`;
|
|
921
860
|
return [prefix, folder, dateStr, filename].filter((p) => p !== "").join("/");
|
|
922
861
|
}
|
|
@@ -927,7 +866,7 @@ async function searchAndFormat(accessor, scope, pattern, prefix, maxResults = nu
|
|
|
927
866
|
const pairs = [];
|
|
928
867
|
for (const uid of uids) {
|
|
929
868
|
const msg = await fetchMessage(accessor, folder, uid);
|
|
930
|
-
const msgText =
|
|
869
|
+
const msgText = messageJsonText(msg);
|
|
931
870
|
const vfsPath = buildVfsPath(prefix, folder, msg);
|
|
932
871
|
pairs.push([vfsPath, msgText]);
|
|
933
872
|
}
|
|
@@ -936,7 +875,7 @@ async function searchAndFormat(accessor, scope, pattern, prefix, maxResults = nu
|
|
|
936
875
|
|
|
937
876
|
// src/commands/builtin/email/grep.ts
|
|
938
877
|
var resolveGlob2 = resolveGlobOf2(EMAIL_IO);
|
|
939
|
-
var
|
|
878
|
+
var ENC = new TextEncoder();
|
|
940
879
|
async function* emailStream(accessor, p, index) {
|
|
941
880
|
yield await read(accessor, p, index);
|
|
942
881
|
}
|
|
@@ -971,7 +910,7 @@ async function grepCommand(accessor, paths, texts, opts) {
|
|
|
971
910
|
pattern = getPattern(texts, opts.flags);
|
|
972
911
|
} catch (err) {
|
|
973
912
|
const msg = err instanceof Error ? err.message : String(err);
|
|
974
|
-
return [null, new
|
|
913
|
+
return [null, new IOResult({ exitCode: 2, stderr: ENC.encode(`${msg}
|
|
975
914
|
`) })];
|
|
976
915
|
}
|
|
977
916
|
const f = parseFlags(opts.flags);
|
|
@@ -980,7 +919,7 @@ async function grepCommand(accessor, paths, texts, opts) {
|
|
|
980
919
|
if (first !== void 0) {
|
|
981
920
|
const scope = detectScope(first);
|
|
982
921
|
if (scope.useNative && !pattern.includes("\n")) {
|
|
983
|
-
const filePrefix =
|
|
922
|
+
const filePrefix = mountPrefixOf4(first.virtual, first.resourcePath) !== "" ? mountPrefixOf4(first.virtual, first.resourcePath) : "";
|
|
984
923
|
const pairs = await searchAndFormat(accessor, scope, pattern, filePrefix, f.maxCount ?? 50);
|
|
985
924
|
const lines = [];
|
|
986
925
|
for (const [vfsPath, msgText] of pairs) {
|
|
@@ -992,9 +931,9 @@ async function grepCommand(accessor, paths, texts, opts) {
|
|
|
992
931
|
);
|
|
993
932
|
for (const line of matched) lines.push(`${vfsPath}:${line}`);
|
|
994
933
|
}
|
|
995
|
-
if (lines.length === 0) return [new Uint8Array(0), new
|
|
996
|
-
const out =
|
|
997
|
-
return [out, new
|
|
934
|
+
if (lines.length === 0) return [new Uint8Array(0), new IOResult({ exitCode: 1 })];
|
|
935
|
+
const out = ENC.encode(lines.join("\n") + "\n");
|
|
936
|
+
return [out, new IOResult()];
|
|
998
937
|
}
|
|
999
938
|
}
|
|
1000
939
|
}
|
|
@@ -1011,110 +950,31 @@ async function grepCommand(accessor, paths, texts, opts) {
|
|
|
1011
950
|
(p) => emailStream(accessor, p, opts.index ?? void 0)
|
|
1012
951
|
);
|
|
1013
952
|
}
|
|
1014
|
-
var EMAIL_GREP =
|
|
953
|
+
var EMAIL_GREP = command2({
|
|
1015
954
|
name: "grep",
|
|
1016
|
-
resource:
|
|
955
|
+
resource: ResourceName2.EMAIL,
|
|
1017
956
|
spec: specOf2("grep"),
|
|
1018
957
|
fn: grepCommand,
|
|
1019
958
|
aggregate: prefixAggregate,
|
|
1020
959
|
provision: fileReadProvision
|
|
1021
960
|
});
|
|
1022
961
|
|
|
1023
|
-
// src/commands/builtin/email/email_read.ts
|
|
1024
|
-
import {
|
|
1025
|
-
CommandSpec as CommandSpec2,
|
|
1026
|
-
IOResult as IOResult4,
|
|
1027
|
-
OperandKind as OperandKind2,
|
|
1028
|
-
Option as Option2,
|
|
1029
|
-
ResourceName as ResourceName4,
|
|
1030
|
-
command as command4
|
|
1031
|
-
} from "@struktoai/mirage-core";
|
|
1032
|
-
var ENC4 = new TextEncoder();
|
|
1033
|
-
var SPEC2 = new CommandSpec2({
|
|
1034
|
-
options: [
|
|
1035
|
-
new Option2({ long: "--uid", valueKind: OperandKind2.TEXT }),
|
|
1036
|
-
new Option2({ long: "--folder", valueKind: OperandKind2.TEXT })
|
|
1037
|
-
]
|
|
1038
|
-
});
|
|
1039
|
-
async function emailReadCommand(accessor, _paths, _texts, opts) {
|
|
1040
|
-
const uid = typeof opts.flags.uid === "string" ? opts.flags.uid : "";
|
|
1041
|
-
const folder = typeof opts.flags.folder === "string" ? opts.flags.folder : "";
|
|
1042
|
-
if (uid === "") {
|
|
1043
|
-
return [null, new IOResult4({ exitCode: 2, stderr: ENC4.encode("--uid is required\n") })];
|
|
1044
|
-
}
|
|
1045
|
-
if (folder === "") {
|
|
1046
|
-
return [null, new IOResult4({ exitCode: 2, stderr: ENC4.encode("--folder is required\n") })];
|
|
1047
|
-
}
|
|
1048
|
-
const processed = await fetchMessage(accessor, folder, uid);
|
|
1049
|
-
const out = ENC4.encode(JSON.stringify(processed));
|
|
1050
|
-
return [out, new IOResult4()];
|
|
1051
|
-
}
|
|
1052
|
-
var EMAIL_READ = command4({
|
|
1053
|
-
name: "himalaya message read",
|
|
1054
|
-
resource: ResourceName4.EMAIL,
|
|
1055
|
-
spec: SPEC2,
|
|
1056
|
-
fn: emailReadCommand
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
// src/commands/builtin/email/email_reply.ts
|
|
1060
|
-
import {
|
|
1061
|
-
CommandSpec as CommandSpec3,
|
|
1062
|
-
IOResult as IOResult5,
|
|
1063
|
-
OperandKind as OperandKind3,
|
|
1064
|
-
Option as Option3,
|
|
1065
|
-
ResourceName as ResourceName5,
|
|
1066
|
-
command as command5
|
|
1067
|
-
} from "@struktoai/mirage-core";
|
|
1068
|
-
var ENC5 = new TextEncoder();
|
|
1069
|
-
var SPEC3 = new CommandSpec3({
|
|
1070
|
-
options: [
|
|
1071
|
-
new Option3({ long: "--uid", valueKind: OperandKind3.TEXT }),
|
|
1072
|
-
new Option3({ long: "--folder", valueKind: OperandKind3.TEXT }),
|
|
1073
|
-
new Option3({ long: "--body", valueKind: OperandKind3.TEXT }),
|
|
1074
|
-
new Option3({ long: "--all" })
|
|
1075
|
-
]
|
|
1076
|
-
});
|
|
1077
|
-
async function emailReplyCommand(accessor, _paths, _texts, opts) {
|
|
1078
|
-
const uid = typeof opts.flags.uid === "string" ? opts.flags.uid : "";
|
|
1079
|
-
const folder = typeof opts.flags.folder === "string" ? opts.flags.folder : "";
|
|
1080
|
-
const body = typeof opts.flags.body === "string" ? opts.flags.body : "";
|
|
1081
|
-
if (uid === "") {
|
|
1082
|
-
return [null, new IOResult5({ exitCode: 2, stderr: ENC5.encode("--uid is required\n") })];
|
|
1083
|
-
}
|
|
1084
|
-
if (folder === "") {
|
|
1085
|
-
return [null, new IOResult5({ exitCode: 2, stderr: ENC5.encode("--folder is required\n") })];
|
|
1086
|
-
}
|
|
1087
|
-
if (body === "") {
|
|
1088
|
-
return [null, new IOResult5({ exitCode: 2, stderr: ENC5.encode("--body is required\n") })];
|
|
1089
|
-
}
|
|
1090
|
-
const original = await fetchMessage(accessor, folder, uid);
|
|
1091
|
-
const result = opts.flags.all === true ? await replyAllMessage(accessor.config, original, body) : await replyMessage(accessor.config, original, body);
|
|
1092
|
-
const out = ENC5.encode(JSON.stringify(result));
|
|
1093
|
-
return [out, new IOResult5()];
|
|
1094
|
-
}
|
|
1095
|
-
var EMAIL_REPLY = command5({
|
|
1096
|
-
name: "himalaya message reply",
|
|
1097
|
-
resource: ResourceName5.EMAIL,
|
|
1098
|
-
spec: SPEC3,
|
|
1099
|
-
fn: emailReplyCommand,
|
|
1100
|
-
write: true
|
|
1101
|
-
});
|
|
1102
|
-
|
|
1103
962
|
// src/commands/builtin/email/rg.ts
|
|
1104
963
|
import {
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
964
|
+
FlagView,
|
|
965
|
+
IOResult as IOResult2,
|
|
966
|
+
ResourceName as ResourceName3,
|
|
967
|
+
command as command3,
|
|
1108
968
|
compilePattern as compilePattern2,
|
|
1109
969
|
grepLines as grepLines2,
|
|
1110
|
-
mountPrefixOf as
|
|
970
|
+
mountPrefixOf as mountPrefixOf5,
|
|
1111
971
|
patternArg,
|
|
1112
972
|
resolveGlobOf as resolveGlobOf3,
|
|
1113
973
|
rgGeneric,
|
|
1114
974
|
specOf as specOf3
|
|
1115
975
|
} from "@struktoai/mirage-core";
|
|
1116
976
|
var resolveGlob3 = resolveGlobOf3(EMAIL_IO);
|
|
1117
|
-
var
|
|
977
|
+
var ENC2 = new TextEncoder();
|
|
1118
978
|
async function* emailStream2(accessor, p, index) {
|
|
1119
979
|
yield await read(accessor, p, index);
|
|
1120
980
|
}
|
|
@@ -1123,18 +983,19 @@ async function rgCommand(accessor, paths, texts, opts) {
|
|
|
1123
983
|
if (pattern === null) {
|
|
1124
984
|
return [
|
|
1125
985
|
null,
|
|
1126
|
-
new
|
|
986
|
+
new IOResult2({ exitCode: 2, stderr: ENC2.encode("rg: usage: rg [flags] pattern [path]\n") })
|
|
1127
987
|
];
|
|
1128
988
|
}
|
|
1129
|
-
const
|
|
1130
|
-
const
|
|
1131
|
-
const
|
|
1132
|
-
const
|
|
1133
|
-
const
|
|
1134
|
-
const
|
|
1135
|
-
const
|
|
1136
|
-
const
|
|
1137
|
-
const
|
|
989
|
+
const fl = new FlagView(opts.flags, specOf3("rg"));
|
|
990
|
+
const ignoreCase = fl.asBool("i");
|
|
991
|
+
const invert = fl.asBool("v");
|
|
992
|
+
const lineNumbers = fl.asBool("n");
|
|
993
|
+
const countOnly = fl.asBool("c");
|
|
994
|
+
const filesOnly = fl.asBool("args_l");
|
|
995
|
+
const wholeWord = fl.asBool("w");
|
|
996
|
+
const fixedString = fl.asBool("F");
|
|
997
|
+
const onlyMatching = fl.asBool("o");
|
|
998
|
+
const maxCount = fl.asInt("m") ?? null;
|
|
1138
999
|
const pat = compilePattern2(pattern, ignoreCase, fixedString, wholeWord);
|
|
1139
1000
|
const lineOpts = {
|
|
1140
1001
|
invert,
|
|
@@ -1149,16 +1010,16 @@ async function rgCommand(accessor, paths, texts, opts) {
|
|
|
1149
1010
|
if (first !== void 0) {
|
|
1150
1011
|
const scope = detectScope(first);
|
|
1151
1012
|
if (scope.useNative && !pattern.includes("\n")) {
|
|
1152
|
-
const filePrefix =
|
|
1013
|
+
const filePrefix = mountPrefixOf5(first.virtual, first.resourcePath) !== "" ? mountPrefixOf5(first.virtual, first.resourcePath) : "";
|
|
1153
1014
|
const pairs = await searchAndFormat(accessor, scope, pattern, filePrefix, maxCount ?? 50);
|
|
1154
1015
|
const lines = [];
|
|
1155
1016
|
for (const [vfsPath, msgText] of pairs) {
|
|
1156
1017
|
const matched = grepLines2(vfsPath, [msgText], pat, lineOpts);
|
|
1157
1018
|
for (const line of matched) lines.push(`${vfsPath}:${line}`);
|
|
1158
1019
|
}
|
|
1159
|
-
if (lines.length === 0) return [new Uint8Array(0), new
|
|
1160
|
-
const out =
|
|
1161
|
-
return [out, new
|
|
1020
|
+
if (lines.length === 0) return [new Uint8Array(0), new IOResult2({ exitCode: 1 })];
|
|
1021
|
+
const out = ENC2.encode(lines.join("\n") + "\n");
|
|
1022
|
+
return [out, new IOResult2()];
|
|
1162
1023
|
}
|
|
1163
1024
|
}
|
|
1164
1025
|
}
|
|
@@ -1174,129 +1035,27 @@ async function rgCommand(accessor, paths, texts, opts) {
|
|
|
1174
1035
|
(p) => emailStream2(accessor, p, opts.index ?? void 0)
|
|
1175
1036
|
);
|
|
1176
1037
|
}
|
|
1177
|
-
var EMAIL_RG =
|
|
1038
|
+
var EMAIL_RG = command3({
|
|
1178
1039
|
name: "rg",
|
|
1179
|
-
resource:
|
|
1040
|
+
resource: ResourceName3.EMAIL,
|
|
1180
1041
|
spec: specOf3("rg"),
|
|
1181
1042
|
fn: rgCommand
|
|
1182
1043
|
});
|
|
1183
1044
|
|
|
1184
|
-
// src/commands/builtin/email/email_send.ts
|
|
1185
|
-
import {
|
|
1186
|
-
CommandSpec as CommandSpec4,
|
|
1187
|
-
IOResult as IOResult7,
|
|
1188
|
-
OperandKind as OperandKind4,
|
|
1189
|
-
Option as Option4,
|
|
1190
|
-
ResourceName as ResourceName7,
|
|
1191
|
-
command as command7
|
|
1192
|
-
} from "@struktoai/mirage-core";
|
|
1193
|
-
var ENC7 = new TextEncoder();
|
|
1194
|
-
var SPEC4 = new CommandSpec4({
|
|
1195
|
-
options: [
|
|
1196
|
-
new Option4({ long: "--to", valueKind: OperandKind4.TEXT }),
|
|
1197
|
-
new Option4({ long: "--subject", valueKind: OperandKind4.TEXT }),
|
|
1198
|
-
new Option4({ long: "--body", valueKind: OperandKind4.TEXT })
|
|
1199
|
-
]
|
|
1200
|
-
});
|
|
1201
|
-
async function emailSendCommand(accessor, _paths, _texts, opts) {
|
|
1202
|
-
const to = typeof opts.flags.to === "string" ? opts.flags.to : "";
|
|
1203
|
-
const subject = typeof opts.flags.subject === "string" ? opts.flags.subject : "";
|
|
1204
|
-
const body = typeof opts.flags.body === "string" ? opts.flags.body : "";
|
|
1205
|
-
if (to === "") {
|
|
1206
|
-
return [null, new IOResult7({ exitCode: 2, stderr: ENC7.encode("--to is required\n") })];
|
|
1207
|
-
}
|
|
1208
|
-
if (subject === "") {
|
|
1209
|
-
return [null, new IOResult7({ exitCode: 2, stderr: ENC7.encode("--subject is required\n") })];
|
|
1210
|
-
}
|
|
1211
|
-
if (body === "") {
|
|
1212
|
-
return [null, new IOResult7({ exitCode: 2, stderr: ENC7.encode("--body is required\n") })];
|
|
1213
|
-
}
|
|
1214
|
-
const result = await sendMessage(accessor.config, to, subject, body);
|
|
1215
|
-
const out = ENC7.encode(JSON.stringify(result));
|
|
1216
|
-
return [out, new IOResult7()];
|
|
1217
|
-
}
|
|
1218
|
-
var EMAIL_SEND = command7({
|
|
1219
|
-
name: "himalaya message send",
|
|
1220
|
-
resource: ResourceName7.EMAIL,
|
|
1221
|
-
spec: SPEC4,
|
|
1222
|
-
fn: emailSendCommand,
|
|
1223
|
-
write: true
|
|
1224
|
-
});
|
|
1225
|
-
|
|
1226
|
-
// src/commands/builtin/email/email_triage.ts
|
|
1227
|
-
import {
|
|
1228
|
-
CommandSpec as CommandSpec5,
|
|
1229
|
-
IOResult as IOResult8,
|
|
1230
|
-
OperandKind as OperandKind5,
|
|
1231
|
-
Option as Option5,
|
|
1232
|
-
ResourceName as ResourceName8,
|
|
1233
|
-
command as command8
|
|
1234
|
-
} from "@struktoai/mirage-core";
|
|
1235
|
-
var ENC8 = new TextEncoder();
|
|
1236
|
-
var SPEC5 = new CommandSpec5({
|
|
1237
|
-
options: [
|
|
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 })
|
|
1247
|
-
]
|
|
1248
|
-
});
|
|
1249
|
-
async function emailTriageCommand(accessor, _paths, _texts, opts) {
|
|
1250
|
-
const folder = typeof opts.flags.folder === "string" ? opts.flags.folder : "INBOX";
|
|
1251
|
-
const maxResults = typeof opts.flags.max === "string" ? Number.parseInt(opts.flags.max, 10) : 20;
|
|
1252
|
-
const uids = await searchMessages(
|
|
1253
|
-
accessor,
|
|
1254
|
-
folder,
|
|
1255
|
-
{
|
|
1256
|
-
text: typeof opts.flags.body === "string" ? opts.flags.body : null,
|
|
1257
|
-
subject: typeof opts.flags.subject === "string" ? opts.flags.subject : null,
|
|
1258
|
-
fromAddr: typeof opts.flags.from === "string" ? opts.flags.from : null,
|
|
1259
|
-
toAddr: typeof opts.flags.to === "string" ? opts.flags.to : null,
|
|
1260
|
-
since: typeof opts.flags.since === "string" ? opts.flags.since : null,
|
|
1261
|
-
before: typeof opts.flags.before === "string" ? opts.flags.before : null,
|
|
1262
|
-
unseen: opts.flags.unseen === true
|
|
1263
|
-
},
|
|
1264
|
-
maxResults
|
|
1265
|
-
);
|
|
1266
|
-
if (uids.length === 0) {
|
|
1267
|
-
const out2 = ENC8.encode("[]");
|
|
1268
|
-
return [out2, new IOResult8()];
|
|
1269
|
-
}
|
|
1270
|
-
const headers = await fetchHeaders(accessor, folder, uids);
|
|
1271
|
-
const out = ENC8.encode(JSON.stringify(headers));
|
|
1272
|
-
return [out, new IOResult8()];
|
|
1273
|
-
}
|
|
1274
|
-
var EMAIL_TRIAGE = command8({
|
|
1275
|
-
name: "himalaya envelope list",
|
|
1276
|
-
resource: ResourceName8.EMAIL,
|
|
1277
|
-
spec: SPEC5,
|
|
1278
|
-
fn: emailTriageCommand
|
|
1279
|
-
});
|
|
1280
|
-
|
|
1281
1045
|
// src/commands/builtin/email/index.ts
|
|
1282
1046
|
var EMAIL_OVERRIDES = /* @__PURE__ */ new Set(["find", "grep", "rg"]);
|
|
1283
1047
|
var EMAIL_COMMANDS = [
|
|
1284
|
-
...makeGenericCommands(
|
|
1048
|
+
...makeGenericCommands(ResourceName4.EMAIL, EMAIL_IO, {
|
|
1285
1049
|
overrides: EMAIL_OVERRIDES
|
|
1286
1050
|
}),
|
|
1287
1051
|
...EMAIL_FIND,
|
|
1288
1052
|
...EMAIL_GREP,
|
|
1289
|
-
...EMAIL_RG
|
|
1290
|
-
...EMAIL_SEND,
|
|
1291
|
-
...EMAIL_REPLY,
|
|
1292
|
-
...EMAIL_FORWARD,
|
|
1293
|
-
...EMAIL_TRIAGE,
|
|
1294
|
-
...EMAIL_READ
|
|
1053
|
+
...EMAIL_RG
|
|
1295
1054
|
];
|
|
1296
1055
|
|
|
1297
1056
|
// src/ops/email/index.ts
|
|
1298
|
-
import { ResourceName as
|
|
1299
|
-
var EMAIL_OPS = makeGenericOps(
|
|
1057
|
+
import { ResourceName as ResourceName5, makeGenericOps } from "@struktoai/mirage-core";
|
|
1058
|
+
var EMAIL_OPS = makeGenericOps(ResourceName5.EMAIL, EMAIL_IO);
|
|
1300
1059
|
|
|
1301
1060
|
// src/resource/email/prompt.ts
|
|
1302
1061
|
var EMAIL_PROMPT = `{prefix}
|
|
@@ -1307,19 +1066,20 @@ var EMAIL_PROMPT = `{prefix}
|
|
|
1307
1066
|
<attachment-filename>
|
|
1308
1067
|
Folders include: INBOX, Sent, Drafts, etc. cat shows email as JSON.
|
|
1309
1068
|
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
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"`;
|
|
1069
|
+
To act on mail (list/read/send/reply/forward), use the himalaya CLI
|
|
1070
|
+
if installed: himalaya --help`;
|
|
1071
|
+
var EMAIL_WRITE_PROMPT = ` Sending mail goes through the himalaya CLI if installed:
|
|
1072
|
+
himalaya message send --to "to@email.com" --subject "Hi" --body "..."`;
|
|
1317
1073
|
|
|
1318
1074
|
// src/resource/email/email.ts
|
|
1319
1075
|
var resolveGlob4 = makeResolveGlob(readdir);
|
|
1320
1076
|
var EmailResource = class extends BaseResource {
|
|
1321
|
-
kind =
|
|
1077
|
+
kind = ResourceName6.EMAIL;
|
|
1322
1078
|
cachesReads = true;
|
|
1079
|
+
// Every listed file carries an exact size: .email.json is rendered at
|
|
1080
|
+
// readdir from the full message source the listing already fetches, and an
|
|
1081
|
+
// attachment's size is its decoded payload length.
|
|
1082
|
+
sizesAlwaysKnown = true;
|
|
1323
1083
|
indexTtl = 86400;
|
|
1324
1084
|
prompt = EMAIL_PROMPT;
|
|
1325
1085
|
config;
|
|
@@ -1334,6 +1094,7 @@ var EmailResource = class extends BaseResource {
|
|
|
1334
1094
|
}
|
|
1335
1095
|
async close() {
|
|
1336
1096
|
await this.accessor.close();
|
|
1097
|
+
await super.close();
|
|
1337
1098
|
}
|
|
1338
1099
|
commands() {
|
|
1339
1100
|
return EMAIL_COMMANDS;
|
|
@@ -1352,12 +1113,12 @@ var EmailResource = class extends BaseResource {
|
|
|
1352
1113
|
}
|
|
1353
1114
|
glob(paths, prefix = "") {
|
|
1354
1115
|
const effective = prefix !== "" ? paths.map(
|
|
1355
|
-
(p) =>
|
|
1116
|
+
(p) => mountPrefixOf6(p.virtual, p.resourcePath) !== "" ? p : new PathSpec2({
|
|
1356
1117
|
virtual: p.virtual,
|
|
1357
1118
|
directory: p.directory,
|
|
1358
1119
|
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
1359
1120
|
resolved: p.resolved,
|
|
1360
|
-
resourcePath:
|
|
1121
|
+
resourcePath: mountKey3(p.virtual, prefix)
|
|
1361
1122
|
})
|
|
1362
1123
|
) : paths;
|
|
1363
1124
|
return resolveGlob4(this.accessor, effective, this.index);
|
|
@@ -1375,10 +1136,18 @@ var EmailResource = class extends BaseResource {
|
|
|
1375
1136
|
|
|
1376
1137
|
export {
|
|
1377
1138
|
EmailAccessor,
|
|
1139
|
+
parseRfc822,
|
|
1140
|
+
listFolderEntries,
|
|
1141
|
+
listMessageUids,
|
|
1142
|
+
fetchRawMessage,
|
|
1143
|
+
fetchMessage,
|
|
1144
|
+
fetchHeaders,
|
|
1145
|
+
messageJsonBytes,
|
|
1146
|
+
messagesJsonBytes,
|
|
1378
1147
|
EMAIL_COMMANDS,
|
|
1379
1148
|
EMAIL_OPS,
|
|
1380
1149
|
EMAIL_PROMPT,
|
|
1381
1150
|
EMAIL_WRITE_PROMPT,
|
|
1382
1151
|
EmailResource
|
|
1383
1152
|
};
|
|
1384
|
-
//# sourceMappingURL=chunk-
|
|
1153
|
+
//# sourceMappingURL=chunk-TWRQCQWU.js.map
|