@struktoai/mirage-node 0.0.3 → 0.0.5-alpha.1
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/cas.lua +15 -0
- package/dist/ceph-ALKLD3MO.js +11 -0
- package/dist/{chunk-QCZ2XUKH.js → chunk-2A4YGVBM.js} +16 -23
- 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-UT2OPSN4.js → chunk-3JZQ6VSZ.js} +5 -5
- 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-47AVIIOT.js → chunk-5H6KNEPP.js} +4 -5
- package/dist/{chunk-47AVIIOT.js.map → chunk-5H6KNEPP.js.map} +1 -1
- package/dist/{chunk-I5THIMPP.js → chunk-5K2MWDCE.js} +6 -7
- package/dist/{chunk-I5THIMPP.js.map → chunk-5K2MWDCE.js.map} +1 -1
- package/dist/{chunk-3WIO7NBR.js → chunk-6SVXWRKX.js} +4 -5
- package/dist/{chunk-3WIO7NBR.js.map → chunk-6SVXWRKX.js.map} +1 -1
- package/dist/{chunk-RQK5UPMP.js → chunk-6VOIUGAD.js} +25 -12
- package/dist/chunk-6VOIUGAD.js.map +1 -0
- package/dist/{chunk-NOHWIBRX.js → chunk-7JYHFXXC.js} +15 -20
- 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-SWCDFEUK.js → chunk-ADEXNSYU.js} +20 -22
- 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-RO5IQEDQ.js → chunk-ATLXMNKD.js} +8 -4
- package/dist/chunk-ATLXMNKD.js.map +1 -0
- package/dist/{chunk-MPCCRRE6.js → chunk-BYCUGFRF.js} +16 -16
- package/dist/chunk-BYCUGFRF.js.map +1 -0
- package/dist/{chunk-HJJMP6IX.js → chunk-BZTVYOES.js} +3 -3
- package/dist/{chunk-B2ZOKNN4.js → chunk-CRC4YWXB.js} +27 -9
- package/dist/chunk-CRC4YWXB.js.map +1 -0
- package/dist/chunk-CTGXJHO5.js +39 -0
- package/dist/chunk-CTGXJHO5.js.map +1 -0
- package/dist/{chunk-Q2IAILVC.js → chunk-DCDBIXVZ.js} +14 -5
- package/dist/chunk-DCDBIXVZ.js.map +1 -0
- package/dist/chunk-DDAFNROK.js +750 -0
- 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-QGRDPSAH.js → chunk-EBI4IHDC.js} +23 -12
- package/dist/chunk-EBI4IHDC.js.map +1 -0
- package/dist/{chunk-JAGJTM3Q.js → chunk-EIUTZ6N7.js} +19 -34
- package/dist/chunk-EIUTZ6N7.js.map +1 -0
- package/dist/{chunk-TA3WMOMU.js → chunk-EJZG5VUF.js} +38 -32
- package/dist/chunk-EJZG5VUF.js.map +1 -0
- package/dist/{chunk-X5HF2OFP.js → chunk-ENW5BVYN.js} +3 -3
- package/dist/{chunk-HGCRXJGP.js → chunk-ETIAW4YD.js} +3 -3
- package/dist/chunk-EUPXAYPB.js +20 -0
- package/dist/chunk-EUPXAYPB.js.map +1 -0
- package/dist/{chunk-YAHRT6MB.js → chunk-FA6YNU75.js} +4 -5
- package/dist/{chunk-YAHRT6MB.js.map → chunk-FA6YNU75.js.map} +1 -1
- package/dist/{chunk-TWGVQLG2.js → chunk-FFH6R5VQ.js} +7 -3
- package/dist/chunk-FFH6R5VQ.js.map +1 -0
- package/dist/{chunk-JCC4CU2I.js → chunk-GE6H2COM.js} +15 -23
- package/dist/chunk-GE6H2COM.js.map +1 -0
- package/dist/{chunk-DM4GSE26.js → chunk-GMMQ3ZK4.js} +3 -3
- package/dist/{chunk-ZEGAMJO2.js → chunk-GSGE3M5P.js} +15 -23
- package/dist/chunk-GSGE3M5P.js.map +1 -0
- package/dist/{chunk-GCFYZSVR.js → chunk-H64SB6VO.js} +32 -13
- package/dist/chunk-H64SB6VO.js.map +1 -0
- package/dist/{chunk-N5FSLVKO.js → chunk-HCRYAFBI.js} +3 -3
- package/dist/{chunk-IDYHQQOH.js → chunk-HOPUP6LA.js} +358 -471
- 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-FQ33BYFR.js → chunk-I7CPLZNW.js} +4 -5
- package/dist/{chunk-FQ33BYFR.js.map → chunk-I7CPLZNW.js.map} +1 -1
- package/dist/{chunk-VGLHY6BK.js → chunk-IFUCGI4I.js} +7 -3
- package/dist/chunk-IFUCGI4I.js.map +1 -0
- package/dist/{chunk-RNQN2FOU.js → chunk-IFYXSSKR.js} +24 -13
- 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-7CW3BMPH.js → chunk-JJERW2BI.js} +4 -5
- package/dist/{chunk-7CW3BMPH.js.map → chunk-JJERW2BI.js.map} +1 -1
- package/dist/{chunk-EM4J5EQS.js → chunk-JQR4HVUX.js} +13 -16
- package/dist/chunk-JQR4HVUX.js.map +1 -0
- package/dist/{chunk-VWKUT4CW.js → chunk-JXOMDLFS.js} +21 -26
- package/dist/chunk-JXOMDLFS.js.map +1 -0
- package/dist/chunk-KIX6N7NT.js +1001 -0
- package/dist/chunk-KIX6N7NT.js.map +1 -0
- package/dist/{chunk-OZAEWZZ3.js → chunk-L42UTDFK.js} +12 -3
- package/dist/chunk-L42UTDFK.js.map +1 -0
- 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-M2UF2JHJ.js +11 -0
- package/dist/chunk-M2UF2JHJ.js.map +1 -0
- package/dist/{chunk-UGK4TAVK.js → chunk-MONC734W.js} +7 -3
- package/dist/chunk-MONC734W.js.map +1 -0
- package/dist/{chunk-IK2L4EN3.js → chunk-N72RLCMU.js} +4 -5
- package/dist/{chunk-IK2L4EN3.js.map → chunk-N72RLCMU.js.map} +1 -1
- package/dist/{chunk-H3I2KZIY.js → chunk-ND4IWJ4V.js} +7 -3
- package/dist/chunk-ND4IWJ4V.js.map +1 -0
- package/dist/chunk-NZ3EKGW4.js +1312 -0
- package/dist/chunk-NZ3EKGW4.js.map +1 -0
- package/dist/{chunk-XGJ2QERC.js → chunk-OAE57MNL.js} +27 -11
- package/dist/chunk-OAE57MNL.js.map +1 -0
- package/dist/{chunk-EZQ5HBAC.js → chunk-OHKGIQB4.js} +12 -16
- package/dist/chunk-OHKGIQB4.js.map +1 -0
- 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-UINQOUZR.js → chunk-OXEQSPND.js} +3 -3
- package/dist/{chunk-A7IVFIOP.js → chunk-PKNE5J2B.js} +15 -23
- 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-EGB7V74Z.js → chunk-QAOVABCR.js} +7 -4
- package/dist/chunk-QAOVABCR.js.map +1 -0
- package/dist/{chunk-X3G37FXT.js → chunk-QQ7FP4GD.js} +4 -5
- package/dist/{chunk-X3G37FXT.js.map → chunk-QQ7FP4GD.js.map} +1 -1
- package/dist/{chunk-WAR4Q2NM.js → chunk-QYLVMC6B.js} +13 -15
- package/dist/chunk-QYLVMC6B.js.map +1 -0
- package/dist/{chunk-KPULTUOK.js → chunk-RX3XR65X.js} +4 -5
- package/dist/{chunk-KPULTUOK.js.map → chunk-RX3XR65X.js.map} +1 -1
- package/dist/chunk-RYQJJB4C.js +30 -0
- package/dist/chunk-RYQJJB4C.js.map +1 -0
- package/dist/{chunk-QQBJC2FQ.js → chunk-TUF7TCN7.js} +4 -5
- package/dist/{chunk-QQBJC2FQ.js.map → chunk-TUF7TCN7.js.map} +1 -1
- package/dist/{chunk-AUHSTJJ3.js → chunk-TUX36JY5.js} +4 -5
- package/dist/{chunk-AUHSTJJ3.js.map → chunk-TUX36JY5.js.map} +1 -1
- package/dist/chunk-TWRQCQWU.js +1153 -0
- 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-WG5YS6TC.js +872 -0
- package/dist/chunk-WG5YS6TC.js.map +1 -0
- package/dist/{chunk-ZGSER5TG.js → chunk-WMJJ4WGF.js} +4 -5
- package/dist/{chunk-ZGSER5TG.js.map → chunk-WMJJ4WGF.js.map} +1 -1
- package/dist/{chunk-LV2G7VHL.js → chunk-WY4FNH42.js} +21 -18
- package/dist/chunk-WY4FNH42.js.map +1 -0
- package/dist/{chunk-LAJJPLEV.js → chunk-XIG5BWWH.js} +25 -12
- 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-G2WCEUQL.js → chunk-XPRDXWK7.js} +21 -20
- 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-M5FVUIYP.js → chunk-YMBL3VJB.js} +21 -19
- package/dist/chunk-YMBL3VJB.js.map +1 -0
- package/dist/chunk-YUJBXFYK.js +1205 -0
- package/dist/chunk-YUJBXFYK.js.map +1 -0
- package/dist/{chunk-JALIYI6M.js → chunk-YZ4ZJNOL.js} +28 -11
- 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-GS5AUKUO.js → chunk-ZVSYUCYS.js} +11 -7
- package/dist/chunk-ZVSYUCYS.js.map +1 -0
- package/dist/{config-QAA646XB.js → config-2YBCHU2W.js} +2 -4
- package/dist/{config-IVY5EQQ2.js → config-3YRGRW72.js} +3 -4
- package/dist/config-4GSOMUMF.js +9 -0
- package/dist/config-5YBUWFUP.js +9 -0
- package/dist/{config-34LHOGLM.js → config-5ZRKJTKG.js} +3 -4
- package/dist/config-A25LTL5W.js +11 -0
- package/dist/config-CLU7JABG.js +9 -0
- package/dist/config-D2RF7L3N.js +9 -0
- package/dist/{config-LHFFXVYI.js → config-E55TKM6K.js} +2 -4
- package/dist/config-ELDOFRJW.js +9 -0
- package/dist/{config-GE4W4ZJC.js → config-FPC3RBFD.js} +2 -4
- package/dist/config-FPM3LAW7.js +9 -0
- package/dist/{config-HKRMKD76.js → config-G3F54CS4.js} +3 -4
- package/dist/config-G43HRUI3.js +9 -0
- package/dist/{config-WDAZFXYD.js → config-GG3WO5PB.js} +3 -4
- package/dist/config-JUYBWAZE.js +9 -0
- package/dist/{config-CVZ2AGCO.js → config-LJ5T6TVA.js} +2 -6
- package/dist/config-MDSAE4O3.js +11 -0
- package/dist/{config-EIHSP5DZ.js → config-NRIOKK5T.js} +2 -4
- package/dist/config-OYK2BSJK.js +9 -0
- package/dist/config-PB3KA2CE.js +9 -0
- package/dist/{config-ZFJYQZCH.js → config-QY4IL3PH.js} +3 -4
- package/dist/config-R4LAOEDS.js +9 -0
- package/dist/{config-QNMKWJ4M.js → config-RIAAD6RW.js} +3 -4
- package/dist/config-SYNEQAUB.js +9 -0
- package/dist/{config-Q45Y46YT.js → config-TJKGYA2B.js} +3 -4
- package/dist/{config-NV5WXP64.js → config-UU27ALAA.js} +2 -4
- package/dist/{config-3IVQJBNW.js → config-UURRGA7U.js} +2 -2
- package/dist/{config-VM526IKB.js → config-VPLHQXVE.js} +2 -4
- package/dist/config-WRACCRPN.js +9 -0
- package/dist/{config-GHRUKEQ6.js → config-WVHKXEVE.js} +3 -4
- package/dist/{config-EO23EY62.js → config-XU7R36IE.js} +3 -4
- package/dist/config-Y2KOUYSS.js +9 -0
- 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-YED2MF6H.js +8 -0
- 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 +1311 -569
- package/dist/index.js +3359 -964
- 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-L5CMN2EE.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-LPS357NF.js +8 -0
- 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/ssh-UYPG42LM.js.map +1 -0
- package/dist/supabase-A3KUFMDC.js +10 -0
- package/dist/supabase-A3KUFMDC.js.map +1 -0
- package/dist/tencent-5464UQ2X.js +11 -0
- package/dist/tencent-5464UQ2X.js.map +1 -0
- package/dist/trello-O2KB3FUO.js +8 -0
- package/dist/trello-O2KB3FUO.js.map +1 -0
- package/dist/wasabi-2IKBIWNO.js +10 -0
- package/dist/wasabi-2IKBIWNO.js.map +1 -0
- package/package.json +17 -3
- package/dist/aliyun-JMJ3PFYY.js +0 -10
- package/dist/backblaze-TDFD23QO.js +0 -10
- package/dist/box-GQ2U2R6R.js +0 -8
- package/dist/ceph-S2VOYO6G.js +0 -10
- package/dist/chunk-2CC5VW7K.js +0 -52
- package/dist/chunk-2CC5VW7K.js.map +0 -1
- package/dist/chunk-A7IVFIOP.js.map +0 -1
- package/dist/chunk-B2ZOKNN4.js.map +0 -1
- package/dist/chunk-DNBAMB5J.js +0 -18
- package/dist/chunk-DNBAMB5J.js.map +0 -1
- package/dist/chunk-DP2PP5V2.js +0 -26
- package/dist/chunk-DP2PP5V2.js.map +0 -1
- package/dist/chunk-DYXEITK3.js +0 -52
- package/dist/chunk-DYXEITK3.js.map +0 -1
- package/dist/chunk-EGB7V74Z.js.map +0 -1
- package/dist/chunk-EM4J5EQS.js.map +0 -1
- package/dist/chunk-EZQ5HBAC.js.map +0 -1
- package/dist/chunk-G2WCEUQL.js.map +0 -1
- package/dist/chunk-GCFYZSVR.js.map +0 -1
- package/dist/chunk-GS5AUKUO.js.map +0 -1
- package/dist/chunk-H3BST2LI.js +0 -26
- package/dist/chunk-H3BST2LI.js.map +0 -1
- package/dist/chunk-H3I2KZIY.js.map +0 -1
- package/dist/chunk-IDYHQQOH.js.map +0 -1
- package/dist/chunk-JAGJTM3Q.js.map +0 -1
- package/dist/chunk-JALIYI6M.js.map +0 -1
- package/dist/chunk-JCC4CU2I.js.map +0 -1
- package/dist/chunk-JZT4QGIP.js +0 -24
- package/dist/chunk-JZT4QGIP.js.map +0 -1
- package/dist/chunk-LAJJPLEV.js.map +0 -1
- package/dist/chunk-LV2G7VHL.js.map +0 -1
- package/dist/chunk-LW25LMIH.js +0 -26
- package/dist/chunk-LW25LMIH.js.map +0 -1
- package/dist/chunk-M5FVUIYP.js.map +0 -1
- package/dist/chunk-MPCCRRE6.js.map +0 -1
- package/dist/chunk-NJMGCT63.js +0 -54
- package/dist/chunk-NJMGCT63.js.map +0 -1
- package/dist/chunk-NOHWIBRX.js.map +0 -1
- package/dist/chunk-OHROA3FQ.js +0 -54
- package/dist/chunk-OHROA3FQ.js.map +0 -1
- package/dist/chunk-OPYQ5KIO.js +0 -52
- package/dist/chunk-OPYQ5KIO.js.map +0 -1
- package/dist/chunk-OZAEWZZ3.js.map +0 -1
- package/dist/chunk-Q2IAILVC.js.map +0 -1
- package/dist/chunk-QCZ2XUKH.js.map +0 -1
- package/dist/chunk-QGRDPSAH.js.map +0 -1
- package/dist/chunk-RNQN2FOU.js.map +0 -1
- package/dist/chunk-RO5IQEDQ.js.map +0 -1
- package/dist/chunk-RQK5UPMP.js.map +0 -1
- package/dist/chunk-S5OVP467.js +0 -1795
- package/dist/chunk-S5OVP467.js.map +0 -1
- package/dist/chunk-SFUCUARB.js +0 -21
- package/dist/chunk-SFUCUARB.js.map +0 -1
- package/dist/chunk-SWCDFEUK.js.map +0 -1
- package/dist/chunk-TA3WMOMU.js.map +0 -1
- package/dist/chunk-TURD42QO.js +0 -1782
- package/dist/chunk-TURD42QO.js.map +0 -1
- package/dist/chunk-TWGVQLG2.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-VWKUT4CW.js.map +0 -1
- package/dist/chunk-W7FLHT65.js +0 -26
- package/dist/chunk-W7FLHT65.js.map +0 -1
- package/dist/chunk-WAR4Q2NM.js.map +0 -1
- package/dist/chunk-WHFUWWI6.js +0 -2097
- package/dist/chunk-WHFUWWI6.js.map +0 -1
- package/dist/chunk-XGJ2QERC.js.map +0 -1
- package/dist/chunk-XHCBHYN4.js +0 -54
- package/dist/chunk-XHCBHYN4.js.map +0 -1
- package/dist/chunk-XLQI4IT2.js +0 -54
- package/dist/chunk-XLQI4IT2.js.map +0 -1
- package/dist/chunk-XWVDS66D.js +0 -963
- package/dist/chunk-XWVDS66D.js.map +0 -1
- package/dist/chunk-YGZMVNN5.js +0 -54
- package/dist/chunk-YGZMVNN5.js.map +0 -1
- package/dist/chunk-YUK3X3B4.js +0 -27
- package/dist/chunk-YUK3X3B4.js.map +0 -1
- package/dist/chunk-ZEGAMJO2.js.map +0 -1
- package/dist/chunk-ZNWVJ6UW.js +0 -54
- 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-7XOUYSTY.js +0 -7
- package/dist/digitalocean-3CQ4CPPZ.js +0 -10
- package/dist/discord-BG7OSRJG.js +0 -8
- package/dist/disk-XVLBCVKE.js +0 -8
- package/dist/dropbox-74GYLV3R.js +0 -8
- package/dist/email-5IZ7OBQ4.js +0 -8
- package/dist/gcs-EMEYU2XT.js +0 -10
- package/dist/gdocs-R67TDPON.js +0 -8
- package/dist/gdrive-PRN2ALRK.js +0 -8
- package/dist/github-DV7E6OFV.js +0 -8
- package/dist/github_ci-Q554V5PA.js +0 -8
- package/dist/gmail-OLN2LT4O.js +0 -8
- package/dist/gsheets-H4RYMQJ5.js +0 -8
- package/dist/gslides-YLCHKJOM.js +0 -8
- package/dist/hf_buckets-DTKXKKFF.js +0 -10
- package/dist/hf_datasets-55C4APKR.js +0 -10
- package/dist/hf_models-RO5JR36V.js +0 -10
- package/dist/hf_spaces-ZVZ3EDRX.js +0 -10
- package/dist/langfuse-ACASJZ7O.js +0 -8
- package/dist/linear-IC37LZV7.js +0 -8
- package/dist/minio-HZ576XFQ.js +0 -10
- package/dist/mongodb-JVR62OIO.js +0 -7
- package/dist/notion-HKRPQMJS.js +0 -8
- package/dist/oci-ZLVECXTW.js +0 -10
- package/dist/postgres-P36Z2YN4.js +0 -7
- package/dist/qingstor-YLP6K3L4.js +0 -10
- package/dist/r2-RPK25ANI.js +0 -10
- package/dist/redis-V5ULXULL.js +0 -8
- package/dist/s3-4OIOCAAT.js +0 -8
- package/dist/scaleway-CCWCLUHB.js +0 -10
- package/dist/seaweedfs-QSWKF2FN.js +0 -10
- package/dist/slack-YPS7PII3.js +0 -8
- package/dist/ssh-YFP3SMTJ.js +0 -9
- package/dist/supabase-6CFTOKGZ.js +0 -10
- package/dist/tencent-IWZZOSQ4.js +0 -10
- package/dist/trello-XYKWZD6P.js +0 -8
- package/dist/wasabi-6Z4DC5S5.js +0 -10
- /package/dist/{aliyun-JMJ3PFYY.js.map → aliyun-S62BR3TB.js.map} +0 -0
- /package/dist/{backblaze-TDFD23QO.js.map → backblaze-4EKSW63F.js.map} +0 -0
- /package/dist/{box-GQ2U2R6R.js.map → box-ZPLZAGMK.js.map} +0 -0
- /package/dist/{ceph-S2VOYO6G.js.map → ceph-ALKLD3MO.js.map} +0 -0
- /package/dist/{chunk-HJJMP6IX.js.map → chunk-BZTVYOES.js.map} +0 -0
- /package/dist/{chunk-X5HF2OFP.js.map → chunk-ENW5BVYN.js.map} +0 -0
- /package/dist/{chunk-HGCRXJGP.js.map → chunk-ETIAW4YD.js.map} +0 -0
- /package/dist/{chunk-DM4GSE26.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
- /package/dist/{chunk-N5FSLVKO.js.map → chunk-HCRYAFBI.js.map} +0 -0
- /package/dist/{chunk-UINQOUZR.js.map → chunk-OXEQSPND.js.map} +0 -0
- /package/dist/{config-34LHOGLM.js.map → config-2YBCHU2W.js.map} +0 -0
- /package/dist/{config-3BBWD5AB.js.map → config-3YRGRW72.js.map} +0 -0
- /package/dist/{config-3IVQJBNW.js.map → config-4GSOMUMF.js.map} +0 -0
- /package/dist/{config-4UDVSUQJ.js.map → config-5YBUWFUP.js.map} +0 -0
- /package/dist/{config-CMDBAPDH.js.map → config-5ZRKJTKG.js.map} +0 -0
- /package/dist/{config-CVZ2AGCO.js.map → config-A25LTL5W.js.map} +0 -0
- /package/dist/{config-D3RLSPNF.js.map → config-CLU7JABG.js.map} +0 -0
- /package/dist/{config-DG65OEG3.js.map → config-D2RF7L3N.js.map} +0 -0
- /package/dist/{config-EIHSP5DZ.js.map → config-E55TKM6K.js.map} +0 -0
- /package/dist/{config-EO23EY62.js.map → config-ELDOFRJW.js.map} +0 -0
- /package/dist/{config-GCQK6NJY.js.map → config-FPC3RBFD.js.map} +0 -0
- /package/dist/{config-GE4W4ZJC.js.map → config-FPM3LAW7.js.map} +0 -0
- /package/dist/{config-GHRUKEQ6.js.map → config-G3F54CS4.js.map} +0 -0
- /package/dist/{config-GVH27UPE.js.map → config-G43HRUI3.js.map} +0 -0
- /package/dist/{config-HKRMKD76.js.map → config-GG3WO5PB.js.map} +0 -0
- /package/dist/{config-HXVYIXP5.js.map → config-JUYBWAZE.js.map} +0 -0
- /package/dist/{config-IDZMEW73.js.map → config-LJ5T6TVA.js.map} +0 -0
- /package/dist/{config-IJJXGLBQ.js.map → config-MDSAE4O3.js.map} +0 -0
- /package/dist/{config-IVY5EQQ2.js.map → config-NRIOKK5T.js.map} +0 -0
- /package/dist/{config-KJOLGVB2.js.map → config-OYK2BSJK.js.map} +0 -0
- /package/dist/{config-KMVCVBYN.js.map → config-PB3KA2CE.js.map} +0 -0
- /package/dist/{config-KYTRXAB2.js.map → config-QY4IL3PH.js.map} +0 -0
- /package/dist/{config-LHFFXVYI.js.map → config-R4LAOEDS.js.map} +0 -0
- /package/dist/{config-NV5WXP64.js.map → config-RIAAD6RW.js.map} +0 -0
- /package/dist/{config-OT2TQQCN.js.map → config-SYNEQAUB.js.map} +0 -0
- /package/dist/{config-Q45Y46YT.js.map → config-TJKGYA2B.js.map} +0 -0
- /package/dist/{config-QAA646XB.js.map → config-UU27ALAA.js.map} +0 -0
- /package/dist/{config-QNMKWJ4M.js.map → config-UURRGA7U.js.map} +0 -0
- /package/dist/{config-QWCY3LBQ.js.map → config-VPLHQXVE.js.map} +0 -0
- /package/dist/{config-VM526IKB.js.map → config-WRACCRPN.js.map} +0 -0
- /package/dist/{config-WDAZFXYD.js.map → config-WVHKXEVE.js.map} +0 -0
- /package/dist/{config-ZFJYQZCH.js.map → config-XU7R36IE.js.map} +0 -0
- /package/dist/{config-ZV6G2ZEC.js.map → config-Y2KOUYSS.js.map} +0 -0
- /package/dist/{databricks_volume-7XOUYSTY.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
- /package/dist/{digitalocean-3CQ4CPPZ.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
- /package/dist/{discord-BG7OSRJG.js.map → discord-ETB2CADR.js.map} +0 -0
- /package/dist/{disk-XVLBCVKE.js.map → disk-WEHSTK3F.js.map} +0 -0
- /package/dist/{dropbox-74GYLV3R.js.map → dropbox-XN6PGLNE.js.map} +0 -0
- /package/dist/{email-5IZ7OBQ4.js.map → email-OV7XCP3T.js.map} +0 -0
- /package/dist/{gcs-EMEYU2XT.js.map → gcal-P56MRCGU.js.map} +0 -0
- /package/dist/{gdocs-R67TDPON.js.map → gcs-HFBIAE2C.js.map} +0 -0
- /package/dist/{gdrive-PRN2ALRK.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
- /package/dist/{github-DV7E6OFV.js.map → gdrive-N6UBYLON.js.map} +0 -0
- /package/dist/{github_ci-Q554V5PA.js.map → github-BPZREGPI.js.map} +0 -0
- /package/dist/{gmail-OLN2LT4O.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
- /package/dist/{gsheets-H4RYMQJ5.js.map → gmail-YED2MF6H.js.map} +0 -0
- /package/dist/{gslides-YLCHKJOM.js.map → gridfs-CPLQ4G62.js.map} +0 -0
- /package/dist/{hf_buckets-DTKXKKFF.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
- /package/dist/{hf_datasets-55C4APKR.js.map → gslides-GDBYLO5A.js.map} +0 -0
- /package/dist/{hf_models-RO5JR36V.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
- /package/dist/{hf_spaces-ZVZ3EDRX.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
- /package/dist/{langfuse-ACASJZ7O.js.map → hf_models-PJPGZAC5.js.map} +0 -0
- /package/dist/{linear-IC37LZV7.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
- /package/dist/{minio-HZ576XFQ.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
- /package/dist/{mongodb-JVR62OIO.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
- /package/dist/{notion-HKRPQMJS.js.map → langfuse-RUMTUMXS.js.map} +0 -0
- /package/dist/{oci-ZLVECXTW.js.map → linear-BCE4KEAC.js.map} +0 -0
- /package/dist/{postgres-P36Z2YN4.js.map → minio-5SO6KBTK.js.map} +0 -0
- /package/dist/{qingstor-YLP6K3L4.js.map → mongodb-L5CMN2EE.js.map} +0 -0
- /package/dist/{r2-RPK25ANI.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
- /package/dist/{redis-V5ULXULL.js.map → notion-RVKEAQ2M.js.map} +0 -0
- /package/dist/{s3-4OIOCAAT.js.map → oci-OQXOIC62.js.map} +0 -0
- /package/dist/{scaleway-CCWCLUHB.js.map → postgres-AV45GNRS.js.map} +0 -0
- /package/dist/{seaweedfs-QSWKF2FN.js.map → qingstor-W277YA4K.js.map} +0 -0
- /package/dist/{slack-YPS7PII3.js.map → r2-FUA4IORE.js.map} +0 -0
- /package/dist/{ssh-YFP3SMTJ.js.map → redis-LPS357NF.js.map} +0 -0
- /package/dist/{supabase-6CFTOKGZ.js.map → s3-FPNWWIVM.js.map} +0 -0
- /package/dist/{tencent-IWZZOSQ4.js.map → scaleway-BP3732U7.js.map} +0 -0
- /package/dist/{trello-XYKWZD6P.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
- /package/dist/{wasabi-6Z4DC5S5.js.map → slack-JFGW7VLN.js.map} +0 -0
package/dist/chunk-TURD42QO.js
DELETED
|
@@ -1,1782 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadOptionalPeer
|
|
3
|
-
} from "./chunk-E2ISWXLB.js";
|
|
4
|
-
|
|
5
|
-
// src/accessor/hf.ts
|
|
6
|
-
import { Accessor, ResourceName } from "@struktoai/mirage-core";
|
|
7
|
-
var HF_RESOURCES = [
|
|
8
|
-
ResourceName.HF_BUCKETS,
|
|
9
|
-
ResourceName.HF_DATASETS,
|
|
10
|
-
ResourceName.HF_MODELS,
|
|
11
|
-
ResourceName.HF_SPACES
|
|
12
|
-
];
|
|
13
|
-
var HfAccessor = class extends Accessor {
|
|
14
|
-
constructor(config) {
|
|
15
|
-
super();
|
|
16
|
-
this.config = config;
|
|
17
|
-
}
|
|
18
|
-
config;
|
|
19
|
-
operatorPromise = null;
|
|
20
|
-
get repoId() {
|
|
21
|
-
const config = this.config;
|
|
22
|
-
return config.repoId ?? config.bucket ?? "";
|
|
23
|
-
}
|
|
24
|
-
operatorOptions() {
|
|
25
|
-
const options = {
|
|
26
|
-
repo_type: this.repoType,
|
|
27
|
-
repo_id: this.repoId
|
|
28
|
-
};
|
|
29
|
-
if (this.config.token !== void 0 && this.config.token !== "") {
|
|
30
|
-
options.token = this.config.token;
|
|
31
|
-
}
|
|
32
|
-
if (this.config.endpoint !== void 0 && this.config.endpoint !== "") {
|
|
33
|
-
options.endpoint = this.config.endpoint;
|
|
34
|
-
}
|
|
35
|
-
const keyPrefix = this.config.keyPrefix;
|
|
36
|
-
if (keyPrefix !== void 0 && keyPrefix !== "") {
|
|
37
|
-
options.root = `/${stripSlashes(keyPrefix)}/`;
|
|
38
|
-
}
|
|
39
|
-
const revision = this.config.revision;
|
|
40
|
-
if (revision !== void 0 && revision !== "") {
|
|
41
|
-
options.revision = revision;
|
|
42
|
-
}
|
|
43
|
-
return options;
|
|
44
|
-
}
|
|
45
|
-
operator() {
|
|
46
|
-
this.operatorPromise ??= this.createOperator();
|
|
47
|
-
return this.operatorPromise;
|
|
48
|
-
}
|
|
49
|
-
async createOperator() {
|
|
50
|
-
const mod = await loadOptionalPeer(
|
|
51
|
-
() => import("opendal"),
|
|
52
|
-
{ feature: "HuggingFace resources", packageName: "opendal" }
|
|
53
|
-
);
|
|
54
|
-
return new mod.Operator("hf", this.operatorOptions());
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
function stripSlashes(value) {
|
|
58
|
-
let start = 0;
|
|
59
|
-
let end = value.length;
|
|
60
|
-
while (start < end && value[start] === "/") start += 1;
|
|
61
|
-
while (end > start && value[end - 1] === "/") end -= 1;
|
|
62
|
-
return value.slice(start, end);
|
|
63
|
-
}
|
|
64
|
-
var HfBucketsAccessor = class extends HfAccessor {
|
|
65
|
-
repoType = "bucket";
|
|
66
|
-
resourceName = ResourceName.HF_BUCKETS;
|
|
67
|
-
get bucketUri() {
|
|
68
|
-
return `hf://buckets/${this.repoId}`;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
var HfDatasetsAccessor = class extends HfAccessor {
|
|
72
|
-
repoType = "dataset";
|
|
73
|
-
resourceName = ResourceName.HF_DATASETS;
|
|
74
|
-
get bucketUri() {
|
|
75
|
-
return `hf://datasets/${this.repoId}`;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
var HfModelsAccessor = class extends HfAccessor {
|
|
79
|
-
repoType = "model";
|
|
80
|
-
resourceName = ResourceName.HF_MODELS;
|
|
81
|
-
get bucketUri() {
|
|
82
|
-
return `hf://models/${this.repoId}`;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var HfSpacesAccessor = class extends HfAccessor {
|
|
86
|
-
repoType = "space";
|
|
87
|
-
resourceName = ResourceName.HF_SPACES;
|
|
88
|
-
get bucketUri() {
|
|
89
|
-
return `hf://spaces/${this.repoId}`;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// src/commands/builtin/hf/awk.ts
|
|
94
|
-
import { awkGeneric, command, specOf } from "@struktoai/mirage-core";
|
|
95
|
-
|
|
96
|
-
// src/core/hf/stream.ts
|
|
97
|
-
import { recordStream } from "@struktoai/mirage-core";
|
|
98
|
-
|
|
99
|
-
// src/core/hf/constants.ts
|
|
100
|
-
var SCOPE_ERROR = 1e4;
|
|
101
|
-
var DEFAULT_CHUNK_SIZE = 8192;
|
|
102
|
-
|
|
103
|
-
// src/core/hf/read.ts
|
|
104
|
-
import { record } from "@struktoai/mirage-core";
|
|
105
|
-
|
|
106
|
-
// src/core/hf/util.ts
|
|
107
|
-
function rawPathOf(path) {
|
|
108
|
-
const prefix = path.prefix;
|
|
109
|
-
return prefix !== "" && path.original.startsWith(prefix) ? path.original.slice(prefix.length) || "/" : path.original;
|
|
110
|
-
}
|
|
111
|
-
function hfKey(rawPath) {
|
|
112
|
-
let start = 0;
|
|
113
|
-
while (start < rawPath.length && rawPath[start] === "/") start += 1;
|
|
114
|
-
return rawPath.slice(start);
|
|
115
|
-
}
|
|
116
|
-
function isNotFound(err) {
|
|
117
|
-
return err instanceof Error && err.message.startsWith("NotFound");
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// src/core/hf/read.ts
|
|
121
|
-
import { enoent } from "@struktoai/mirage-core";
|
|
122
|
-
async function read(accessor, path, _index, options = {}) {
|
|
123
|
-
const virtual = path.original;
|
|
124
|
-
const rawPath = rawPathOf(path);
|
|
125
|
-
const key = hfKey(rawPath);
|
|
126
|
-
const op = await accessor.operator();
|
|
127
|
-
const readOptions = {};
|
|
128
|
-
if (options.offset !== void 0 && options.offset > 0) {
|
|
129
|
-
readOptions.offset = BigInt(options.offset);
|
|
130
|
-
}
|
|
131
|
-
if (options.size !== void 0) {
|
|
132
|
-
readOptions.offset ??= 0n;
|
|
133
|
-
readOptions.size = BigInt(options.size);
|
|
134
|
-
}
|
|
135
|
-
const startMs = performance.now();
|
|
136
|
-
let data;
|
|
137
|
-
try {
|
|
138
|
-
data = readOptions.offset !== void 0 || readOptions.size !== void 0 ? await op.read(key, readOptions) : await op.read(key);
|
|
139
|
-
} catch (err) {
|
|
140
|
-
if (isNotFound(err)) throw enoent(path);
|
|
141
|
-
throw err;
|
|
142
|
-
}
|
|
143
|
-
const bytes = new Uint8Array(data);
|
|
144
|
-
record("read", virtual, accessor.resourceName, bytes.byteLength, startMs);
|
|
145
|
-
return bytes;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// src/core/hf/stream.ts
|
|
149
|
-
import { enoent as enoent2 } from "@struktoai/mirage-core";
|
|
150
|
-
async function rangeRead(accessor, path, start, end) {
|
|
151
|
-
return read(accessor, path, void 0, { offset: start, size: end - start });
|
|
152
|
-
}
|
|
153
|
-
async function* stream(accessor, path, _index, chunkSize = DEFAULT_CHUNK_SIZE) {
|
|
154
|
-
const virtual = path.original;
|
|
155
|
-
const rawPath = rawPathOf(path);
|
|
156
|
-
const key = hfKey(rawPath);
|
|
157
|
-
const op = await accessor.operator();
|
|
158
|
-
const rec = recordStream("read", virtual, accessor.resourceName);
|
|
159
|
-
let reader;
|
|
160
|
-
try {
|
|
161
|
-
reader = await op.reader(key);
|
|
162
|
-
} catch (err) {
|
|
163
|
-
if (isNotFound(err)) throw enoent2(path);
|
|
164
|
-
throw err;
|
|
165
|
-
}
|
|
166
|
-
const buf = Buffer.alloc(chunkSize);
|
|
167
|
-
for (; ; ) {
|
|
168
|
-
const n = Number(await reader.read(buf));
|
|
169
|
-
if (n <= 0) break;
|
|
170
|
-
const chunk = new Uint8Array(buf.subarray(0, n));
|
|
171
|
-
if (rec !== null) rec.bytes += chunk.byteLength;
|
|
172
|
-
yield chunk;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// src/commands/builtin/hf/awk.ts
|
|
177
|
-
var HF_AWK = command({
|
|
178
|
-
name: "awk",
|
|
179
|
-
resource: [...HF_RESOURCES],
|
|
180
|
-
spec: specOf("awk"),
|
|
181
|
-
fn: (accessor, paths, texts, opts) => awkGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
// src/commands/builtin/hf/base64_cmd.ts
|
|
185
|
-
import { command as command2, specOf as specOf2, base64Generic } from "@struktoai/mirage-core";
|
|
186
|
-
var HF_BASE64 = command2({
|
|
187
|
-
name: "base64",
|
|
188
|
-
resource: [...HF_RESOURCES],
|
|
189
|
-
spec: specOf2("base64"),
|
|
190
|
-
fn: (accessor, paths, _texts, opts) => base64Generic(paths, opts, (p) => stream(accessor, p))
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
// src/commands/builtin/hf/basename.ts
|
|
194
|
-
import { command as command3, specOf as specOf3, basenameFn } from "@struktoai/mirage-core";
|
|
195
|
-
var HF_BASENAME = command3({
|
|
196
|
-
name: "basename",
|
|
197
|
-
resource: [...HF_RESOURCES],
|
|
198
|
-
spec: specOf3("basename"),
|
|
199
|
-
fn: basenameFn
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// src/commands/builtin/hf/cat/cat.ts
|
|
203
|
-
import {
|
|
204
|
-
catGeneric,
|
|
205
|
-
command as command4,
|
|
206
|
-
concatAggregate,
|
|
207
|
-
specOf as specOf4
|
|
208
|
-
} from "@struktoai/mirage-core";
|
|
209
|
-
|
|
210
|
-
// src/core/hf/glob.ts
|
|
211
|
-
import { fnmatch, PathSpec } from "@struktoai/mirage-core";
|
|
212
|
-
|
|
213
|
-
// src/core/hf/readdir.ts
|
|
214
|
-
import {
|
|
215
|
-
IndexEntry,
|
|
216
|
-
ResourceType,
|
|
217
|
-
rstripSlash,
|
|
218
|
-
stripSlash
|
|
219
|
-
} from "@struktoai/mirage-core";
|
|
220
|
-
import { enoent as enoent3 } from "@struktoai/mirage-core";
|
|
221
|
-
async function readdir(accessor, path, index) {
|
|
222
|
-
const prefix = path.prefix;
|
|
223
|
-
let target = path.pattern !== null ? path.directory : path.original;
|
|
224
|
-
if (prefix !== "" && target.startsWith(prefix)) {
|
|
225
|
-
const rest = target.slice(prefix.length);
|
|
226
|
-
if (prefix.endsWith("/") || rest === "" || rest.startsWith("/")) {
|
|
227
|
-
target = rest || "/";
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
const virtualKey = rstripSlash(prefix !== "" ? `${prefix}${target}` : target) || "/";
|
|
231
|
-
if (index !== void 0) {
|
|
232
|
-
const listing = await index.listDir(virtualKey);
|
|
233
|
-
if (listing.entries !== void 0 && listing.entries !== null) {
|
|
234
|
-
return listing.entries;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
const strippedTarget = stripSlash(target);
|
|
238
|
-
const listPath = strippedTarget !== "" ? `${strippedTarget}/` : "/";
|
|
239
|
-
const op = await accessor.operator();
|
|
240
|
-
const names = [];
|
|
241
|
-
const dirKeys = /* @__PURE__ */ new Set();
|
|
242
|
-
const sizes = /* @__PURE__ */ new Map();
|
|
243
|
-
let entries;
|
|
244
|
-
try {
|
|
245
|
-
entries = await op.list(listPath);
|
|
246
|
-
} catch (err) {
|
|
247
|
-
if (isNotFound(err)) throw enoent3(path);
|
|
248
|
-
throw err;
|
|
249
|
-
}
|
|
250
|
-
for (const entry of entries) {
|
|
251
|
-
const relative = entry.path();
|
|
252
|
-
if (relative === "" || relative === listPath) continue;
|
|
253
|
-
const isDir = relative.endsWith("/");
|
|
254
|
-
const base = `/${rstripSlash(relative)}`;
|
|
255
|
-
names.push(base);
|
|
256
|
-
if (isDir) {
|
|
257
|
-
dirKeys.add(base);
|
|
258
|
-
} else {
|
|
259
|
-
const meta = entry.metadata();
|
|
260
|
-
const length = meta.contentLength;
|
|
261
|
-
sizes.set(base, length !== null ? Number(length) : null);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
names.sort();
|
|
265
|
-
if (names.length > SCOPE_ERROR) {
|
|
266
|
-
console.warn(
|
|
267
|
-
`hf readdir: ${virtualKey} returned ${String(names.length)} entries (limit ${String(SCOPE_ERROR)})`
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
const virtualEntries = names.map((e) => prefix !== "" ? `${prefix}${e}` : e).sort();
|
|
271
|
-
if (index !== void 0) {
|
|
272
|
-
const indexEntries = names.map((e) => {
|
|
273
|
-
const name = e.split("/").pop() ?? e;
|
|
274
|
-
if (dirKeys.has(e)) {
|
|
275
|
-
return [name, new IndexEntry({ id: e, name, resourceType: ResourceType.FOLDER })];
|
|
276
|
-
}
|
|
277
|
-
return [
|
|
278
|
-
name,
|
|
279
|
-
new IndexEntry({
|
|
280
|
-
id: e,
|
|
281
|
-
name,
|
|
282
|
-
resourceType: ResourceType.FILE,
|
|
283
|
-
size: sizes.get(e) ?? null
|
|
284
|
-
})
|
|
285
|
-
];
|
|
286
|
-
});
|
|
287
|
-
await index.setDir(virtualKey, indexEntries);
|
|
288
|
-
}
|
|
289
|
-
return virtualEntries;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// src/core/hf/glob.ts
|
|
293
|
-
async function resolveGlob(accessor, paths, index) {
|
|
294
|
-
const result = [];
|
|
295
|
-
for (const p of paths) {
|
|
296
|
-
if (p.resolved) {
|
|
297
|
-
result.push(p);
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
if (p.pattern !== null && p.pattern !== "") {
|
|
301
|
-
const entries = await readdir(accessor, p.dir, index);
|
|
302
|
-
const matched = [];
|
|
303
|
-
for (const entry of entries) {
|
|
304
|
-
const entryBase = entry.split("/").pop() ?? "";
|
|
305
|
-
if (!fnmatch(entryBase, p.pattern)) continue;
|
|
306
|
-
matched.push(PathSpec.fromStrPath(entry, p.prefix));
|
|
307
|
-
}
|
|
308
|
-
if (matched.length > SCOPE_ERROR) {
|
|
309
|
-
console.warn(
|
|
310
|
-
`${p.directory}: ${String(matched.length)} matches exceeds limit (${String(SCOPE_ERROR)}), truncating`
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
const truncated = matched.length > SCOPE_ERROR ? matched.slice(0, SCOPE_ERROR) : matched;
|
|
314
|
-
result.push(...truncated);
|
|
315
|
-
} else {
|
|
316
|
-
result.push(p);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
return result;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
// src/core/hf/stat.ts
|
|
323
|
-
import {
|
|
324
|
-
FileStat,
|
|
325
|
-
FileType,
|
|
326
|
-
guessType,
|
|
327
|
-
stripSlash as stripSlash2
|
|
328
|
-
} from "@struktoai/mirage-core";
|
|
329
|
-
import { enoent as enoent4 } from "@struktoai/mirage-core";
|
|
330
|
-
async function stat(accessor, path, index) {
|
|
331
|
-
const prefix = path.prefix;
|
|
332
|
-
const rawPath = rawPathOf(path);
|
|
333
|
-
const stripped = stripSlash2(rawPath);
|
|
334
|
-
if (stripped === "") {
|
|
335
|
-
return new FileStat({ name: "/", type: FileType.DIRECTORY });
|
|
336
|
-
}
|
|
337
|
-
if (index !== void 0) {
|
|
338
|
-
const virtualKey = prefix !== "" ? `${prefix}/${stripped}` : `/${stripped}`;
|
|
339
|
-
const lookup = await index.get(virtualKey);
|
|
340
|
-
if (lookup.entry !== void 0 && lookup.entry !== null) {
|
|
341
|
-
const entry = lookup.entry;
|
|
342
|
-
if (entry.resourceType === "folder") {
|
|
343
|
-
return new FileStat({ name: entry.name, type: FileType.DIRECTORY });
|
|
344
|
-
}
|
|
345
|
-
return new FileStat({
|
|
346
|
-
name: entry.name,
|
|
347
|
-
size: entry.size ?? null,
|
|
348
|
-
type: guessType(entry.name)
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
const parent = virtualKey.slice(0, virtualKey.lastIndexOf("/")) || "/";
|
|
352
|
-
const parentListing = await index.listDir(parent);
|
|
353
|
-
if (parentListing.entries !== void 0 && parentListing.entries !== null) {
|
|
354
|
-
throw enoent4(path);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
const op = await accessor.operator();
|
|
358
|
-
let md = null;
|
|
359
|
-
try {
|
|
360
|
-
md = await op.stat(stripped);
|
|
361
|
-
} catch (err) {
|
|
362
|
-
if (!isNotFound(err)) throw err;
|
|
363
|
-
}
|
|
364
|
-
if (md !== null && !md.isDirectory()) {
|
|
365
|
-
const etag = md.etag;
|
|
366
|
-
return new FileStat({
|
|
367
|
-
name: stripped.split("/").pop() ?? stripped,
|
|
368
|
-
size: md.contentLength !== null ? Number(md.contentLength) : null,
|
|
369
|
-
modified: md.lastModified,
|
|
370
|
-
type: guessType(rawPath),
|
|
371
|
-
fingerprint: etag,
|
|
372
|
-
extra: etag !== null && etag !== "" ? { etag } : {}
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
try {
|
|
376
|
-
const mdDir = await op.stat(`${stripped}/`);
|
|
377
|
-
if (mdDir.isDirectory()) {
|
|
378
|
-
return new FileStat({
|
|
379
|
-
name: stripped.split("/").pop() ?? "/",
|
|
380
|
-
type: FileType.DIRECTORY
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
} catch (err) {
|
|
384
|
-
if (!isNotFound(err)) throw err;
|
|
385
|
-
}
|
|
386
|
-
throw enoent4(path);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// src/commands/builtin/hf/provision.ts
|
|
390
|
-
import {
|
|
391
|
-
Precision,
|
|
392
|
-
ProvisionResult
|
|
393
|
-
} from "@struktoai/mirage-core";
|
|
394
|
-
async function resolveSizes(accessor, paths, index) {
|
|
395
|
-
const resolved = [];
|
|
396
|
-
let missing = 0;
|
|
397
|
-
for (const p of paths) {
|
|
398
|
-
const pathStr = p.original;
|
|
399
|
-
let size = null;
|
|
400
|
-
if (index !== void 0) {
|
|
401
|
-
const lookup = await index.get(pathStr);
|
|
402
|
-
if (lookup.entry !== void 0 && lookup.entry !== null) {
|
|
403
|
-
size = lookup.entry.size;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
if (size === null) {
|
|
407
|
-
try {
|
|
408
|
-
const fileStat = await stat(accessor, p, index);
|
|
409
|
-
size = fileStat.size;
|
|
410
|
-
} catch {
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
if (size !== null) {
|
|
414
|
-
resolved.push([pathStr, size]);
|
|
415
|
-
} else {
|
|
416
|
-
missing += 1;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
return { resolved, missing };
|
|
420
|
-
}
|
|
421
|
-
async function fileReadProvision(accessor, paths, _texts, opts) {
|
|
422
|
-
if (paths.length === 0) {
|
|
423
|
-
return new ProvisionResult({ precision: Precision.UNKNOWN });
|
|
424
|
-
}
|
|
425
|
-
const index = opts.index ?? void 0;
|
|
426
|
-
const { resolved, missing } = await resolveSizes(accessor, paths, index);
|
|
427
|
-
if (missing > 0 || resolved.length === 0) {
|
|
428
|
-
return new ProvisionResult({ precision: Precision.UNKNOWN });
|
|
429
|
-
}
|
|
430
|
-
const total = resolved.reduce((sum, [, size]) => sum + size, 0);
|
|
431
|
-
return new ProvisionResult({
|
|
432
|
-
networkReadLow: total,
|
|
433
|
-
networkReadHigh: total,
|
|
434
|
-
readOps: resolved.length,
|
|
435
|
-
precision: Precision.EXACT
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
function parseNumFlag(value) {
|
|
439
|
-
if (typeof value !== "string") return null;
|
|
440
|
-
const n = Number.parseInt(value, 10);
|
|
441
|
-
return Number.isFinite(n) ? n : null;
|
|
442
|
-
}
|
|
443
|
-
async function headTailProvision(accessor, paths, _texts, opts) {
|
|
444
|
-
if (paths.length === 0) {
|
|
445
|
-
return new ProvisionResult({ precision: Precision.UNKNOWN });
|
|
446
|
-
}
|
|
447
|
-
const index = opts.index ?? void 0;
|
|
448
|
-
const { resolved, missing } = await resolveSizes(accessor, paths, index);
|
|
449
|
-
if (missing > 0 || resolved.length === 0) {
|
|
450
|
-
return new ProvisionResult({ precision: Precision.UNKNOWN });
|
|
451
|
-
}
|
|
452
|
-
const c = parseNumFlag(opts.flags.c);
|
|
453
|
-
if (c !== null) {
|
|
454
|
-
const total = resolved.reduce((sum, [, size]) => sum + Math.min(c, size), 0);
|
|
455
|
-
return new ProvisionResult({
|
|
456
|
-
networkReadLow: total,
|
|
457
|
-
networkReadHigh: total,
|
|
458
|
-
readOps: resolved.length,
|
|
459
|
-
precision: Precision.EXACT
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
const full = resolved.reduce((sum, [, size]) => sum + size, 0);
|
|
463
|
-
return new ProvisionResult({
|
|
464
|
-
networkReadLow: 0,
|
|
465
|
-
networkReadHigh: full,
|
|
466
|
-
readOps: resolved.length,
|
|
467
|
-
precision: Precision.RANGE
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
function metadataProvision(_accessor, paths, _texts, _opts) {
|
|
471
|
-
const n = Math.max(1, paths.length > 0 ? paths.length : 1);
|
|
472
|
-
return new ProvisionResult({
|
|
473
|
-
networkReadLow: 0,
|
|
474
|
-
networkReadHigh: 0,
|
|
475
|
-
readOps: n,
|
|
476
|
-
precision: Precision.EXACT
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// src/commands/builtin/hf/cat/cat.ts
|
|
481
|
-
async function catCommand(accessor, paths, texts, opts) {
|
|
482
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
483
|
-
return catGeneric(
|
|
484
|
-
resolved,
|
|
485
|
-
texts,
|
|
486
|
-
opts,
|
|
487
|
-
(p) => stat(accessor, p, opts.index ?? void 0),
|
|
488
|
-
(p) => stream(accessor, p)
|
|
489
|
-
);
|
|
490
|
-
}
|
|
491
|
-
var HF_CAT = command4({
|
|
492
|
-
name: "cat",
|
|
493
|
-
resource: [...HF_RESOURCES],
|
|
494
|
-
spec: specOf4("cat"),
|
|
495
|
-
fn: catCommand,
|
|
496
|
-
provision: fileReadProvision,
|
|
497
|
-
aggregate: concatAggregate
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
// src/commands/builtin/hf/cmp.ts
|
|
501
|
-
import { command as command5, specOf as specOf5, cmpGeneric } from "@struktoai/mirage-core";
|
|
502
|
-
var HF_CMP = command5({
|
|
503
|
-
name: "cmp",
|
|
504
|
-
resource: [...HF_RESOURCES],
|
|
505
|
-
spec: specOf5("cmp"),
|
|
506
|
-
fn: (accessor, paths, _texts, opts) => cmpGeneric(paths, opts, (p) => stream(accessor, p))
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
// src/commands/builtin/hf/column.ts
|
|
510
|
-
import { command as command6, specOf as specOf6, columnGeneric } from "@struktoai/mirage-core";
|
|
511
|
-
var HF_COLUMN = command6({
|
|
512
|
-
name: "column",
|
|
513
|
-
resource: [...HF_RESOURCES],
|
|
514
|
-
spec: specOf6("column"),
|
|
515
|
-
fn: (accessor, paths, _texts, opts) => columnGeneric(paths, opts, (p) => stream(accessor, p))
|
|
516
|
-
});
|
|
517
|
-
|
|
518
|
-
// src/commands/builtin/hf/comm.ts
|
|
519
|
-
import { command as command7, specOf as specOf7, commGeneric } from "@struktoai/mirage-core";
|
|
520
|
-
var HF_COMM = command7({
|
|
521
|
-
name: "comm",
|
|
522
|
-
resource: [...HF_RESOURCES],
|
|
523
|
-
spec: specOf7("comm"),
|
|
524
|
-
fn: (accessor, paths, _texts, opts) => commGeneric(paths, opts, (p) => stream(accessor, p))
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
// src/commands/builtin/hf/csplit.ts
|
|
528
|
-
import { command as command8, specOf as specOf8, csplitGeneric } from "@struktoai/mirage-core";
|
|
529
|
-
|
|
530
|
-
// src/core/hf/write.ts
|
|
531
|
-
import { invalidateAfterWrite } from "@struktoai/mirage-core";
|
|
532
|
-
import { record as record2 } from "@struktoai/mirage-core";
|
|
533
|
-
import { enoent as enoent5 } from "@struktoai/mirage-core";
|
|
534
|
-
async function write(accessor, path, data, _index) {
|
|
535
|
-
const rawPath = rawPathOf(path);
|
|
536
|
-
const key = hfKey(rawPath);
|
|
537
|
-
const op = await accessor.operator();
|
|
538
|
-
const startMs = performance.now();
|
|
539
|
-
try {
|
|
540
|
-
await op.write(key, Buffer.from(data));
|
|
541
|
-
} catch (err) {
|
|
542
|
-
if (isNotFound(err)) throw enoent5(path);
|
|
543
|
-
throw err;
|
|
544
|
-
}
|
|
545
|
-
record2("write", path.original, accessor.resourceName, data.byteLength, startMs);
|
|
546
|
-
await invalidateAfterWrite(path);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
// src/commands/builtin/hf/csplit.ts
|
|
550
|
-
var HF_CSPLIT = command8({
|
|
551
|
-
name: "csplit",
|
|
552
|
-
resource: [...HF_RESOURCES],
|
|
553
|
-
spec: specOf8("csplit"),
|
|
554
|
-
fn: (accessor, paths, texts, opts) => csplitGeneric(
|
|
555
|
-
paths,
|
|
556
|
-
texts,
|
|
557
|
-
opts,
|
|
558
|
-
(p) => stream(accessor, p),
|
|
559
|
-
(p, d) => write(accessor, p, d)
|
|
560
|
-
),
|
|
561
|
-
write: true
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
// src/commands/builtin/hf/cut.ts
|
|
565
|
-
import { command as command9, cutGeneric, specOf as specOf9 } from "@struktoai/mirage-core";
|
|
566
|
-
var HF_CUT = command9({
|
|
567
|
-
name: "cut",
|
|
568
|
-
resource: [...HF_RESOURCES],
|
|
569
|
-
spec: specOf9("cut"),
|
|
570
|
-
fn: (accessor, paths, _texts, opts) => cutGeneric(paths, opts, (p) => stream(accessor, p))
|
|
571
|
-
});
|
|
572
|
-
|
|
573
|
-
// src/commands/builtin/hf/diff.ts
|
|
574
|
-
import { command as command10, diffGeneric, specOf as specOf10 } from "@struktoai/mirage-core";
|
|
575
|
-
var HF_DIFF = command10({
|
|
576
|
-
name: "diff",
|
|
577
|
-
resource: [...HF_RESOURCES],
|
|
578
|
-
spec: specOf10("diff"),
|
|
579
|
-
fn: (accessor, paths, _texts, opts) => diffGeneric(
|
|
580
|
-
paths,
|
|
581
|
-
opts,
|
|
582
|
-
(p) => stream(accessor, p),
|
|
583
|
-
(p) => readdir(accessor, p, opts.index ?? void 0),
|
|
584
|
-
(p) => stat(accessor, p, opts.index ?? void 0)
|
|
585
|
-
)
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
// src/commands/builtin/hf/dirname.ts
|
|
589
|
-
import { command as command11, specOf as specOf11, dirnameFn } from "@struktoai/mirage-core";
|
|
590
|
-
var HF_DIRNAME = command11({
|
|
591
|
-
name: "dirname",
|
|
592
|
-
resource: [...HF_RESOURCES],
|
|
593
|
-
spec: specOf11("dirname"),
|
|
594
|
-
fn: dirnameFn
|
|
595
|
-
});
|
|
596
|
-
|
|
597
|
-
// src/commands/builtin/hf/du.ts
|
|
598
|
-
import {
|
|
599
|
-
command as command12,
|
|
600
|
-
duGeneric,
|
|
601
|
-
specOf as specOf12
|
|
602
|
-
} from "@struktoai/mirage-core";
|
|
603
|
-
|
|
604
|
-
// src/core/hf/du.ts
|
|
605
|
-
import { stripSlash as stripSlash3 } from "@struktoai/mirage-core";
|
|
606
|
-
async function du(accessor, path) {
|
|
607
|
-
const target = rawPathOf(path);
|
|
608
|
-
const pfx = stripSlash3(target);
|
|
609
|
-
const scanPath = pfx !== "" ? `${pfx}/` : "/";
|
|
610
|
-
const op = await accessor.operator();
|
|
611
|
-
let total = 0;
|
|
612
|
-
try {
|
|
613
|
-
for (const entry of await op.list(scanPath, { recursive: true })) {
|
|
614
|
-
if (entry.path().endsWith("/")) continue;
|
|
615
|
-
const length = entry.metadata().contentLength;
|
|
616
|
-
total += length !== null ? Number(length) : 0;
|
|
617
|
-
}
|
|
618
|
-
} catch (err) {
|
|
619
|
-
if (isNotFound(err)) return 0;
|
|
620
|
-
throw err;
|
|
621
|
-
}
|
|
622
|
-
return total;
|
|
623
|
-
}
|
|
624
|
-
async function duAll(accessor, path) {
|
|
625
|
-
const target = rawPathOf(path);
|
|
626
|
-
const pfx = stripSlash3(target);
|
|
627
|
-
const scanPath = pfx !== "" ? `${pfx}/` : "/";
|
|
628
|
-
const op = await accessor.operator();
|
|
629
|
-
const results = [];
|
|
630
|
-
let total = 0;
|
|
631
|
-
try {
|
|
632
|
-
for (const entry of await op.list(scanPath, { recursive: true })) {
|
|
633
|
-
const rel = entry.path();
|
|
634
|
-
if (rel === "" || rel.endsWith("/")) continue;
|
|
635
|
-
const length = entry.metadata().contentLength;
|
|
636
|
-
const size = length !== null ? Number(length) : 0;
|
|
637
|
-
results.push([`/${lstrip(rel)}`, size]);
|
|
638
|
-
total += size;
|
|
639
|
-
}
|
|
640
|
-
} catch (err) {
|
|
641
|
-
if (!isNotFound(err)) throw err;
|
|
642
|
-
}
|
|
643
|
-
results.sort((a, b) => a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0);
|
|
644
|
-
return [results, total];
|
|
645
|
-
}
|
|
646
|
-
function lstrip(value) {
|
|
647
|
-
let start = 0;
|
|
648
|
-
while (start < value.length && value[start] === "/") start += 1;
|
|
649
|
-
return value.slice(start);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
// src/commands/builtin/hf/du.ts
|
|
653
|
-
async function duCommand(accessor, paths, _texts, opts) {
|
|
654
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
655
|
-
return duGeneric(
|
|
656
|
-
resolved,
|
|
657
|
-
opts,
|
|
658
|
-
(p) => du(accessor, p),
|
|
659
|
-
(p) => duAll(accessor, p)
|
|
660
|
-
);
|
|
661
|
-
}
|
|
662
|
-
var HF_DU = command12({
|
|
663
|
-
name: "du",
|
|
664
|
-
resource: [...HF_RESOURCES],
|
|
665
|
-
spec: specOf12("du"),
|
|
666
|
-
fn: duCommand
|
|
667
|
-
});
|
|
668
|
-
|
|
669
|
-
// src/commands/builtin/hf/expand.ts
|
|
670
|
-
import { command as command13, specOf as specOf13, expandGeneric } from "@struktoai/mirage-core";
|
|
671
|
-
var HF_EXPAND = command13({
|
|
672
|
-
name: "expand",
|
|
673
|
-
resource: [...HF_RESOURCES],
|
|
674
|
-
spec: specOf13("expand"),
|
|
675
|
-
fn: (accessor, paths, _texts, opts) => expandGeneric(paths, opts, (p) => stream(accessor, p))
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
// src/commands/builtin/hf/file/file.ts
|
|
679
|
-
import {
|
|
680
|
-
command as command14,
|
|
681
|
-
fileGeneric,
|
|
682
|
-
specOf as specOf14
|
|
683
|
-
} from "@struktoai/mirage-core";
|
|
684
|
-
async function fileCommand(accessor, paths, _texts, opts) {
|
|
685
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
686
|
-
return fileGeneric(
|
|
687
|
-
resolved,
|
|
688
|
-
opts,
|
|
689
|
-
(p) => stat(accessor, p, opts.index ?? void 0),
|
|
690
|
-
(p) => read(accessor, p, opts.index ?? void 0)
|
|
691
|
-
);
|
|
692
|
-
}
|
|
693
|
-
var HF_FILE = command14({
|
|
694
|
-
name: "file",
|
|
695
|
-
resource: [...HF_RESOURCES],
|
|
696
|
-
spec: specOf14("file"),
|
|
697
|
-
fn: fileCommand
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
// src/commands/builtin/hf/find.ts
|
|
701
|
-
import { command as command15, findGeneric, specOf as specOf15 } from "@struktoai/mirage-core";
|
|
702
|
-
|
|
703
|
-
// src/core/hf/find.ts
|
|
704
|
-
import {
|
|
705
|
-
buildTree,
|
|
706
|
-
emitStartPath,
|
|
707
|
-
keep,
|
|
708
|
-
rstripSlash as rstripSlash2,
|
|
709
|
-
startBasename,
|
|
710
|
-
stripSlash as stripSlash4
|
|
711
|
-
} from "@struktoai/mirage-core";
|
|
712
|
-
function matchesFilters(entryPath, kind, meta, baseDepth, options, tree) {
|
|
713
|
-
const entryName = entryPath.split("/").pop() ?? "";
|
|
714
|
-
const depth = (entryPath.match(/\//g) ?? []).length - baseDepth;
|
|
715
|
-
if (options.maxDepth !== null && options.maxDepth !== void 0 && depth > options.maxDepth) {
|
|
716
|
-
return false;
|
|
717
|
-
}
|
|
718
|
-
if (!keep({ key: entryPath, name: entryName, kind, depth }, tree, options.minDepth)) {
|
|
719
|
-
return false;
|
|
720
|
-
}
|
|
721
|
-
if (kind === "f" && (options.minSize !== null || options.maxSize !== null)) {
|
|
722
|
-
if (options.minSize !== null && options.minSize !== void 0 && meta.size < options.minSize) {
|
|
723
|
-
return false;
|
|
724
|
-
}
|
|
725
|
-
if (options.maxSize !== null && options.maxSize !== void 0 && meta.size > options.maxSize) {
|
|
726
|
-
return false;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
if (options.mtimeMin !== null && options.mtimeMin !== void 0 || options.mtimeMax !== null && options.mtimeMax !== void 0) {
|
|
730
|
-
if (meta.mtime === null) return false;
|
|
731
|
-
if (options.mtimeMin !== null && options.mtimeMin !== void 0 && meta.mtime < options.mtimeMin) {
|
|
732
|
-
return false;
|
|
733
|
-
}
|
|
734
|
-
if (options.mtimeMax !== null && options.mtimeMax !== void 0 && meta.mtime > options.mtimeMax) {
|
|
735
|
-
return false;
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
return true;
|
|
739
|
-
}
|
|
740
|
-
async function find(accessor, path, options = {}) {
|
|
741
|
-
const target = rawPathOf(path);
|
|
742
|
-
const pfx = stripSlash4(target);
|
|
743
|
-
const scanPath = pfx !== "" ? `${pfx}/` : "/";
|
|
744
|
-
const base = pfx !== "" ? `/${pfx}` : "/";
|
|
745
|
-
const baseDepth = base === "/" ? 0 : (base.match(/\//g) ?? []).length;
|
|
746
|
-
const startName = startBasename(path.original);
|
|
747
|
-
const op = await accessor.operator();
|
|
748
|
-
const results = [];
|
|
749
|
-
const seenDirs = /* @__PURE__ */ new Set();
|
|
750
|
-
let sawDescendant = false;
|
|
751
|
-
let dirExists = false;
|
|
752
|
-
const tree = options.tree ?? buildTree({
|
|
753
|
-
name: options.name,
|
|
754
|
-
iname: options.iname,
|
|
755
|
-
pathPattern: options.pathPattern,
|
|
756
|
-
type: options.type,
|
|
757
|
-
nameExclude: options.nameExclude,
|
|
758
|
-
orNames: options.orNames
|
|
759
|
-
});
|
|
760
|
-
let entries;
|
|
761
|
-
try {
|
|
762
|
-
entries = await op.list(scanPath, { recursive: true });
|
|
763
|
-
} catch (err) {
|
|
764
|
-
if (isNotFound(err)) return [];
|
|
765
|
-
throw err;
|
|
766
|
-
}
|
|
767
|
-
for (const entry of entries) {
|
|
768
|
-
const rel = entry.path();
|
|
769
|
-
if (rel === "") continue;
|
|
770
|
-
const meta = entry.metadata();
|
|
771
|
-
const isDir = rel.endsWith("/") || meta.isDirectory();
|
|
772
|
-
const entryPath = `/${stripSlash4(rel)}`;
|
|
773
|
-
if (entryPath === base) {
|
|
774
|
-
dirExists = true;
|
|
775
|
-
continue;
|
|
776
|
-
}
|
|
777
|
-
sawDescendant = true;
|
|
778
|
-
const kind = isDir ? "d" : "f";
|
|
779
|
-
const length = meta.contentLength;
|
|
780
|
-
const lm = meta.lastModified;
|
|
781
|
-
const candidateMeta = {
|
|
782
|
-
size: length !== null ? Number(length) : 0,
|
|
783
|
-
mtime: lm !== null ? Date.parse(lm) / 1e3 : null
|
|
784
|
-
};
|
|
785
|
-
const fileEntries = [[entryPath, kind]];
|
|
786
|
-
if (!isDir) {
|
|
787
|
-
let parent = rstripSlash2(entryPath.slice(0, entryPath.lastIndexOf("/"))) || "/";
|
|
788
|
-
while (parent !== "" && parent !== base && parent !== "/") {
|
|
789
|
-
if (!seenDirs.has(parent)) {
|
|
790
|
-
seenDirs.add(parent);
|
|
791
|
-
fileEntries.push([parent, "d"]);
|
|
792
|
-
}
|
|
793
|
-
parent = parent.slice(0, parent.lastIndexOf("/")) || "/";
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
for (const [ep, k] of fileEntries) {
|
|
797
|
-
if (matchesFilters(ep, k, candidateMeta, baseDepth, options, tree)) {
|
|
798
|
-
results.push(ep);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
if (sawDescendant || dirExists) {
|
|
803
|
-
emitStartPath(results, base, startName, {
|
|
804
|
-
kind: "d",
|
|
805
|
-
isEmpty: null,
|
|
806
|
-
exists: true,
|
|
807
|
-
tree,
|
|
808
|
-
maxDepth: options.maxDepth,
|
|
809
|
-
minDepth: options.minDepth
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
return [...new Set(results)].sort();
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
// src/commands/builtin/hf/find.ts
|
|
816
|
-
var HF_FIND = command15({
|
|
817
|
-
name: "find",
|
|
818
|
-
resource: [...HF_RESOURCES],
|
|
819
|
-
spec: specOf15("find"),
|
|
820
|
-
provision: metadataProvision,
|
|
821
|
-
fn: (accessor, paths, texts, opts) => findGeneric(paths, texts, opts, (root, options) => find(accessor, root, options))
|
|
822
|
-
});
|
|
823
|
-
|
|
824
|
-
// src/commands/builtin/hf/fmt.ts
|
|
825
|
-
import {
|
|
826
|
-
command as command16,
|
|
827
|
-
fmtGeneric,
|
|
828
|
-
specOf as specOf16
|
|
829
|
-
} from "@struktoai/mirage-core";
|
|
830
|
-
async function fmtCommand(accessor, paths, _texts, opts) {
|
|
831
|
-
return fmtGeneric(paths, opts, (p) => stream(accessor, p));
|
|
832
|
-
}
|
|
833
|
-
var HF_FMT = command16({
|
|
834
|
-
name: "fmt",
|
|
835
|
-
resource: [...HF_RESOURCES],
|
|
836
|
-
spec: specOf16("fmt"),
|
|
837
|
-
fn: fmtCommand
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
// src/commands/builtin/hf/fold.ts
|
|
841
|
-
import { command as command17, specOf as specOf17, foldGeneric } from "@struktoai/mirage-core";
|
|
842
|
-
var HF_FOLD = command17({
|
|
843
|
-
name: "fold",
|
|
844
|
-
resource: [...HF_RESOURCES],
|
|
845
|
-
spec: specOf17("fold"),
|
|
846
|
-
fn: (accessor, paths, _texts, opts) => foldGeneric(paths, opts, (p) => stream(accessor, p))
|
|
847
|
-
});
|
|
848
|
-
|
|
849
|
-
// src/commands/builtin/hf/grep/grep.ts
|
|
850
|
-
import {
|
|
851
|
-
command as command18,
|
|
852
|
-
grepGeneric,
|
|
853
|
-
prefixAggregate,
|
|
854
|
-
specOf as specOf18
|
|
855
|
-
} from "@struktoai/mirage-core";
|
|
856
|
-
async function grepFn(accessor, paths, texts, opts) {
|
|
857
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
|
|
858
|
-
const stat2 = (p) => stat(accessor, p);
|
|
859
|
-
const readdir2 = (p) => readdir(accessor, p);
|
|
860
|
-
return grepGeneric("grep", resolved, texts, opts, stat2, readdir2, (p) => stream(accessor, p));
|
|
861
|
-
}
|
|
862
|
-
var HF_GREP = command18({
|
|
863
|
-
name: "grep",
|
|
864
|
-
resource: [...HF_RESOURCES],
|
|
865
|
-
spec: specOf18("grep"),
|
|
866
|
-
fn: grepFn,
|
|
867
|
-
provision: fileReadProvision,
|
|
868
|
-
aggregate: prefixAggregate
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
// src/commands/builtin/hf/gunzip.ts
|
|
872
|
-
import { command as command19, specOf as specOf19, gunzipGeneric } from "@struktoai/mirage-core";
|
|
873
|
-
|
|
874
|
-
// src/core/hf/unlink.ts
|
|
875
|
-
import { invalidateAfterUnlink } from "@struktoai/mirage-core";
|
|
876
|
-
import { FileType as FileType2, record as record3 } from "@struktoai/mirage-core";
|
|
877
|
-
import { enoent as enoent6 } from "@struktoai/mirage-core";
|
|
878
|
-
async function unlink(accessor, path, index) {
|
|
879
|
-
const fileStat = await stat(accessor, path, index);
|
|
880
|
-
const rawPath = rawPathOf(path);
|
|
881
|
-
if (fileStat.type === FileType2.DIRECTORY) {
|
|
882
|
-
const e = new Error(`EISDIR: ${rawPath}`);
|
|
883
|
-
e.code = "EISDIR";
|
|
884
|
-
throw e;
|
|
885
|
-
}
|
|
886
|
-
const key = hfKey(rawPath);
|
|
887
|
-
const op = await accessor.operator();
|
|
888
|
-
const startMs = performance.now();
|
|
889
|
-
try {
|
|
890
|
-
await op.delete(key);
|
|
891
|
-
} catch (err) {
|
|
892
|
-
if (isNotFound(err)) throw enoent6(path);
|
|
893
|
-
throw err;
|
|
894
|
-
}
|
|
895
|
-
record3("unlink", path.original, accessor.resourceName, 0, startMs);
|
|
896
|
-
await invalidateAfterUnlink(path);
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
// src/commands/builtin/hf/gunzip.ts
|
|
900
|
-
var HF_GUNZIP = command19({
|
|
901
|
-
name: "gunzip",
|
|
902
|
-
resource: [...HF_RESOURCES],
|
|
903
|
-
spec: specOf19("gunzip"),
|
|
904
|
-
fn: (accessor, paths, _texts, opts) => gunzipGeneric(
|
|
905
|
-
paths,
|
|
906
|
-
opts,
|
|
907
|
-
(p) => stream(accessor, p),
|
|
908
|
-
(p, d) => write(accessor, p, d),
|
|
909
|
-
(p) => unlink(accessor, p)
|
|
910
|
-
),
|
|
911
|
-
write: true
|
|
912
|
-
});
|
|
913
|
-
|
|
914
|
-
// src/commands/builtin/hf/gzip.ts
|
|
915
|
-
import { command as command20, specOf as specOf20, gzipGeneric } from "@struktoai/mirage-core";
|
|
916
|
-
var HF_GZIP = command20({
|
|
917
|
-
name: "gzip",
|
|
918
|
-
resource: [...HF_RESOURCES],
|
|
919
|
-
spec: specOf20("gzip"),
|
|
920
|
-
fn: (accessor, paths, _texts, opts) => gzipGeneric(
|
|
921
|
-
paths,
|
|
922
|
-
opts,
|
|
923
|
-
(p) => stream(accessor, p),
|
|
924
|
-
(p, d) => write(accessor, p, d),
|
|
925
|
-
(p) => unlink(accessor, p)
|
|
926
|
-
),
|
|
927
|
-
write: true
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
// src/commands/builtin/hf/head/head.ts
|
|
931
|
-
import { command as command21, headGeneric, headerAggregate, specOf as specOf21 } from "@struktoai/mirage-core";
|
|
932
|
-
var HF_HEAD = command21({
|
|
933
|
-
name: "head",
|
|
934
|
-
resource: [...HF_RESOURCES],
|
|
935
|
-
spec: specOf21("head"),
|
|
936
|
-
provision: headTailProvision,
|
|
937
|
-
fn: (accessor, paths, texts, opts) => headGeneric(
|
|
938
|
-
paths,
|
|
939
|
-
texts,
|
|
940
|
-
opts,
|
|
941
|
-
(p) => stat(accessor, p),
|
|
942
|
-
(p) => stream(accessor, p)
|
|
943
|
-
),
|
|
944
|
-
aggregate: headerAggregate
|
|
945
|
-
});
|
|
946
|
-
|
|
947
|
-
// src/commands/builtin/hf/iconv.ts
|
|
948
|
-
import { command as command22, specOf as specOf22, iconvGeneric } from "@struktoai/mirage-core";
|
|
949
|
-
var HF_ICONV = command22({
|
|
950
|
-
name: "iconv",
|
|
951
|
-
resource: [...HF_RESOURCES],
|
|
952
|
-
spec: specOf22("iconv"),
|
|
953
|
-
fn: (accessor, paths, _texts, opts) => iconvGeneric(
|
|
954
|
-
paths,
|
|
955
|
-
opts,
|
|
956
|
-
(p) => stream(accessor, p),
|
|
957
|
-
(p, d) => write(accessor, p, d)
|
|
958
|
-
),
|
|
959
|
-
write: true
|
|
960
|
-
});
|
|
961
|
-
|
|
962
|
-
// src/commands/builtin/hf/join.ts
|
|
963
|
-
import { command as command23, specOf as specOf23, joinGeneric } from "@struktoai/mirage-core";
|
|
964
|
-
var HF_JOIN = command23({
|
|
965
|
-
name: "join",
|
|
966
|
-
resource: [...HF_RESOURCES],
|
|
967
|
-
spec: specOf23("join"),
|
|
968
|
-
fn: (accessor, paths, _texts, opts) => joinGeneric(paths, opts, (p) => stream(accessor, p))
|
|
969
|
-
});
|
|
970
|
-
|
|
971
|
-
// src/commands/builtin/hf/jq.ts
|
|
972
|
-
import {
|
|
973
|
-
command as command24,
|
|
974
|
-
isJsonlPath,
|
|
975
|
-
isStreamableJsonlExpr,
|
|
976
|
-
jqGeneric,
|
|
977
|
-
Precision as Precision2,
|
|
978
|
-
ProvisionResult as ProvisionResult2,
|
|
979
|
-
specOf as specOf24
|
|
980
|
-
} from "@struktoai/mirage-core";
|
|
981
|
-
async function jqProvision(accessor, paths, texts, _opts) {
|
|
982
|
-
const [first] = paths;
|
|
983
|
-
const [expr] = texts;
|
|
984
|
-
if (first === void 0 || expr === void 0) return new ProvisionResult2({ command: "jq" });
|
|
985
|
-
try {
|
|
986
|
-
const s = await stat(accessor, first);
|
|
987
|
-
const fileSize = s.size ?? 0;
|
|
988
|
-
if (isJsonlPath(first.original) && isStreamableJsonlExpr(expr)) {
|
|
989
|
-
return new ProvisionResult2({
|
|
990
|
-
command: `jq '${expr}' ${first.original}`,
|
|
991
|
-
networkReadLow: 0,
|
|
992
|
-
networkReadHigh: fileSize,
|
|
993
|
-
readOps: 1,
|
|
994
|
-
precision: Precision2.RANGE
|
|
995
|
-
});
|
|
996
|
-
}
|
|
997
|
-
return new ProvisionResult2({
|
|
998
|
-
command: `jq '${expr}' ${first.original}`,
|
|
999
|
-
networkReadLow: fileSize,
|
|
1000
|
-
networkReadHigh: fileSize,
|
|
1001
|
-
readOps: 1,
|
|
1002
|
-
precision: Precision2.EXACT
|
|
1003
|
-
});
|
|
1004
|
-
} catch {
|
|
1005
|
-
return new ProvisionResult2({ command: "jq" });
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
async function jqCommand(accessor, paths, texts, opts) {
|
|
1009
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1010
|
-
return jqGeneric(resolved, texts, opts, (p) => stream(accessor, p));
|
|
1011
|
-
}
|
|
1012
|
-
var HF_JQ = command24({
|
|
1013
|
-
name: "jq",
|
|
1014
|
-
resource: [...HF_RESOURCES],
|
|
1015
|
-
spec: specOf24("jq"),
|
|
1016
|
-
provision: jqProvision,
|
|
1017
|
-
fn: jqCommand
|
|
1018
|
-
});
|
|
1019
|
-
|
|
1020
|
-
// src/commands/builtin/hf/look.ts
|
|
1021
|
-
import { command as command25, specOf as specOf25, lookGeneric } from "@struktoai/mirage-core";
|
|
1022
|
-
var HF_LOOK = command25({
|
|
1023
|
-
name: "look",
|
|
1024
|
-
resource: [...HF_RESOURCES],
|
|
1025
|
-
spec: specOf25("look"),
|
|
1026
|
-
fn: (accessor, paths, texts, opts) => lookGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1027
|
-
});
|
|
1028
|
-
|
|
1029
|
-
// src/commands/builtin/hf/ls/ls.ts
|
|
1030
|
-
import {
|
|
1031
|
-
command as command26,
|
|
1032
|
-
lsGeneric,
|
|
1033
|
-
specOf as specOf26
|
|
1034
|
-
} from "@struktoai/mirage-core";
|
|
1035
|
-
async function lsCommand(accessor, paths, _texts, opts) {
|
|
1036
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1037
|
-
return lsGeneric(
|
|
1038
|
-
resolved,
|
|
1039
|
-
opts,
|
|
1040
|
-
(p) => readdir(accessor, p, opts.index ?? void 0),
|
|
1041
|
-
(p) => stat(accessor, p, opts.index ?? void 0)
|
|
1042
|
-
);
|
|
1043
|
-
}
|
|
1044
|
-
var HF_LS = command26({
|
|
1045
|
-
name: "ls",
|
|
1046
|
-
resource: [...HF_RESOURCES],
|
|
1047
|
-
spec: specOf26("ls"),
|
|
1048
|
-
fn: lsCommand,
|
|
1049
|
-
provision: metadataProvision
|
|
1050
|
-
});
|
|
1051
|
-
|
|
1052
|
-
// src/commands/builtin/hf/md5.ts
|
|
1053
|
-
import { command as command27, specOf as specOf27, md5Generic } from "@struktoai/mirage-core";
|
|
1054
|
-
var HF_MD5 = command27({
|
|
1055
|
-
name: "md5",
|
|
1056
|
-
resource: [...HF_RESOURCES],
|
|
1057
|
-
spec: specOf27("md5"),
|
|
1058
|
-
fn: (accessor, paths, _texts, opts) => md5Generic(paths, opts, (p) => stream(accessor, p))
|
|
1059
|
-
});
|
|
1060
|
-
|
|
1061
|
-
// src/commands/builtin/hf/mktemp.ts
|
|
1062
|
-
import { command as command28, mktempGeneric, specOf as specOf28 } from "@struktoai/mirage-core";
|
|
1063
|
-
|
|
1064
|
-
// src/core/hf/mkdir.ts
|
|
1065
|
-
async function mkdir(_accessor, _path, _index) {
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
// src/commands/builtin/hf/mktemp.ts
|
|
1069
|
-
var HF_MKTEMP = command28({
|
|
1070
|
-
name: "mktemp",
|
|
1071
|
-
resource: [...HF_RESOURCES],
|
|
1072
|
-
spec: specOf28("mktemp"),
|
|
1073
|
-
fn: (accessor, _paths, texts, opts) => mktempGeneric(
|
|
1074
|
-
texts,
|
|
1075
|
-
opts,
|
|
1076
|
-
(p) => mkdir(accessor, p),
|
|
1077
|
-
(p, d) => write(accessor, p, d)
|
|
1078
|
-
),
|
|
1079
|
-
write: true
|
|
1080
|
-
});
|
|
1081
|
-
|
|
1082
|
-
// src/commands/builtin/hf/nl.ts
|
|
1083
|
-
import { command as command29, specOf as specOf29, nlGeneric } from "@struktoai/mirage-core";
|
|
1084
|
-
var HF_NL = command29({
|
|
1085
|
-
name: "nl",
|
|
1086
|
-
resource: [...HF_RESOURCES],
|
|
1087
|
-
spec: specOf29("nl"),
|
|
1088
|
-
fn: (accessor, paths, _texts, opts) => nlGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
// src/commands/builtin/hf/paste.ts
|
|
1092
|
-
import { command as command30, specOf as specOf30, pasteGeneric } from "@struktoai/mirage-core";
|
|
1093
|
-
var HF_PASTE = command30({
|
|
1094
|
-
name: "paste",
|
|
1095
|
-
resource: [...HF_RESOURCES],
|
|
1096
|
-
spec: specOf30("paste"),
|
|
1097
|
-
fn: (accessor, paths, _texts, opts) => pasteGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1098
|
-
});
|
|
1099
|
-
|
|
1100
|
-
// src/commands/builtin/hf/readlink.ts
|
|
1101
|
-
import { command as command31, readlinkGeneric, specOf as specOf31 } from "@struktoai/mirage-core";
|
|
1102
|
-
var HF_READLINK = command31({
|
|
1103
|
-
name: "readlink",
|
|
1104
|
-
resource: [...HF_RESOURCES],
|
|
1105
|
-
spec: specOf31("readlink"),
|
|
1106
|
-
fn: (_accessor, paths, texts, opts) => readlinkGeneric(paths, texts, opts)
|
|
1107
|
-
});
|
|
1108
|
-
|
|
1109
|
-
// src/commands/builtin/hf/realpath.ts
|
|
1110
|
-
import { command as command32, realpathGeneric, specOf as specOf32 } from "@struktoai/mirage-core";
|
|
1111
|
-
var HF_REALPATH = command32({
|
|
1112
|
-
name: "realpath",
|
|
1113
|
-
resource: [...HF_RESOURCES],
|
|
1114
|
-
spec: specOf32("realpath"),
|
|
1115
|
-
fn: (accessor, paths, texts, opts) => realpathGeneric(paths, texts, opts, (p) => stat(accessor, p, opts.index ?? void 0))
|
|
1116
|
-
});
|
|
1117
|
-
|
|
1118
|
-
// src/commands/builtin/hf/rev.ts
|
|
1119
|
-
import { command as command33, specOf as specOf33, revGeneric } from "@struktoai/mirage-core";
|
|
1120
|
-
var HF_REV = command33({
|
|
1121
|
-
name: "rev",
|
|
1122
|
-
resource: [...HF_RESOURCES],
|
|
1123
|
-
spec: specOf33("rev"),
|
|
1124
|
-
fn: (accessor, paths, _texts, opts) => revGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1125
|
-
});
|
|
1126
|
-
|
|
1127
|
-
// src/commands/builtin/hf/rg.ts
|
|
1128
|
-
import {
|
|
1129
|
-
command as command34,
|
|
1130
|
-
rgGeneric,
|
|
1131
|
-
specOf as specOf34
|
|
1132
|
-
} from "@struktoai/mirage-core";
|
|
1133
|
-
async function rgCommand(accessor, paths, texts, opts) {
|
|
1134
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths) : [];
|
|
1135
|
-
const stat2 = (p) => stat(accessor, p);
|
|
1136
|
-
const readdir2 = (p) => readdir(accessor, p);
|
|
1137
|
-
return rgGeneric(resolved, texts, opts, stat2, readdir2, (p) => stream(accessor, p));
|
|
1138
|
-
}
|
|
1139
|
-
var HF_RG = command34({
|
|
1140
|
-
name: "rg",
|
|
1141
|
-
resource: [...HF_RESOURCES],
|
|
1142
|
-
spec: specOf34("rg"),
|
|
1143
|
-
fn: rgCommand,
|
|
1144
|
-
provision: fileReadProvision
|
|
1145
|
-
});
|
|
1146
|
-
|
|
1147
|
-
// src/commands/builtin/hf/rm.ts
|
|
1148
|
-
import {
|
|
1149
|
-
IOResult,
|
|
1150
|
-
command as command35,
|
|
1151
|
-
specOf as specOf35
|
|
1152
|
-
} from "@struktoai/mirage-core";
|
|
1153
|
-
var ENC = new TextEncoder();
|
|
1154
|
-
async function* lines(parts) {
|
|
1155
|
-
for (const part of parts) yield ENC.encode(`${part}
|
|
1156
|
-
`);
|
|
1157
|
-
}
|
|
1158
|
-
async function rmCommand(accessor, paths, _texts, opts) {
|
|
1159
|
-
if (paths.length === 0) {
|
|
1160
|
-
return [null, new IOResult({ exitCode: 1, stderr: ENC.encode("rm: missing operand\n") })];
|
|
1161
|
-
}
|
|
1162
|
-
if (opts.flags.r === true || opts.flags.R === true || opts.flags.d === true) {
|
|
1163
|
-
return [
|
|
1164
|
-
null,
|
|
1165
|
-
new IOResult({
|
|
1166
|
-
exitCode: 1,
|
|
1167
|
-
stderr: ENC.encode("rm: recursive and directory removal are not supported\n")
|
|
1168
|
-
})
|
|
1169
|
-
];
|
|
1170
|
-
}
|
|
1171
|
-
const force = opts.flags.f === true;
|
|
1172
|
-
const verbose = opts.flags.v === true;
|
|
1173
|
-
const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
|
|
1174
|
-
const verboseParts = [];
|
|
1175
|
-
const removed = {};
|
|
1176
|
-
for (const path of resolved) {
|
|
1177
|
-
try {
|
|
1178
|
-
await unlink(accessor, path, opts.index ?? void 0);
|
|
1179
|
-
} catch (err) {
|
|
1180
|
-
const code = err?.code;
|
|
1181
|
-
if (code === "EISDIR") {
|
|
1182
|
-
throw new Error(`rm: cannot remove '${path.original}': Is a directory`);
|
|
1183
|
-
}
|
|
1184
|
-
if (code === "ENOENT" && force) continue;
|
|
1185
|
-
throw err;
|
|
1186
|
-
}
|
|
1187
|
-
removed[path.stripPrefix] = new Uint8Array();
|
|
1188
|
-
if (verbose) verboseParts.push(`removed '${path.original}'`);
|
|
1189
|
-
}
|
|
1190
|
-
const output = verbose ? lines(verboseParts) : null;
|
|
1191
|
-
return [output, new IOResult({ writes: removed })];
|
|
1192
|
-
}
|
|
1193
|
-
var HF_RM = command35({
|
|
1194
|
-
name: "rm",
|
|
1195
|
-
resource: [...HF_RESOURCES],
|
|
1196
|
-
spec: specOf35("rm"),
|
|
1197
|
-
fn: rmCommand,
|
|
1198
|
-
write: true
|
|
1199
|
-
});
|
|
1200
|
-
|
|
1201
|
-
// src/commands/builtin/hf/sed.ts
|
|
1202
|
-
import { makeSed } from "@struktoai/mirage-core";
|
|
1203
|
-
var HF_SED = makeSed({
|
|
1204
|
-
resource: [...HF_RESOURCES],
|
|
1205
|
-
stream: (a, p) => stream(a, p),
|
|
1206
|
-
write: (a, p, d) => write(a, p, d)
|
|
1207
|
-
});
|
|
1208
|
-
|
|
1209
|
-
// src/commands/builtin/hf/sha256sum.ts
|
|
1210
|
-
import { command as command36, sha256sumGeneric, specOf as specOf36 } from "@struktoai/mirage-core";
|
|
1211
|
-
var HF_SHA256SUM = command36({
|
|
1212
|
-
name: "sha256sum",
|
|
1213
|
-
resource: [...HF_RESOURCES],
|
|
1214
|
-
spec: specOf36("sha256sum"),
|
|
1215
|
-
fn: (accessor, paths, _texts, opts) => sha256sumGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1216
|
-
});
|
|
1217
|
-
|
|
1218
|
-
// src/commands/builtin/hf/shuf.ts
|
|
1219
|
-
import { command as command37, specOf as specOf37, shufGeneric } from "@struktoai/mirage-core";
|
|
1220
|
-
var HF_SHUF = command37({
|
|
1221
|
-
name: "shuf",
|
|
1222
|
-
resource: [...HF_RESOURCES],
|
|
1223
|
-
spec: specOf37("shuf"),
|
|
1224
|
-
fn: (accessor, paths, texts, opts) => shufGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1225
|
-
});
|
|
1226
|
-
|
|
1227
|
-
// src/commands/builtin/hf/sort.ts
|
|
1228
|
-
import { command as command38, specOf as specOf38, sortGeneric } from "@struktoai/mirage-core";
|
|
1229
|
-
var HF_SORT = command38({
|
|
1230
|
-
name: "sort",
|
|
1231
|
-
resource: [...HF_RESOURCES],
|
|
1232
|
-
spec: specOf38("sort"),
|
|
1233
|
-
fn: (accessor, paths, _texts, opts) => sortGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1234
|
-
});
|
|
1235
|
-
|
|
1236
|
-
// src/commands/builtin/hf/split.ts
|
|
1237
|
-
import { command as command39, specOf as specOf39, splitGeneric } from "@struktoai/mirage-core";
|
|
1238
|
-
var HF_SPLIT = command39({
|
|
1239
|
-
name: "split",
|
|
1240
|
-
resource: [...HF_RESOURCES],
|
|
1241
|
-
spec: specOf39("split"),
|
|
1242
|
-
fn: (accessor, paths, _texts, opts) => splitGeneric(
|
|
1243
|
-
paths,
|
|
1244
|
-
opts,
|
|
1245
|
-
(p) => stream(accessor, p),
|
|
1246
|
-
(p, d) => write(accessor, p, d)
|
|
1247
|
-
),
|
|
1248
|
-
write: true
|
|
1249
|
-
});
|
|
1250
|
-
|
|
1251
|
-
// src/commands/builtin/hf/stat/stat.ts
|
|
1252
|
-
import {
|
|
1253
|
-
command as command40,
|
|
1254
|
-
specOf as specOf40,
|
|
1255
|
-
statGeneric
|
|
1256
|
-
} from "@struktoai/mirage-core";
|
|
1257
|
-
async function statCommand(accessor, paths, _texts, opts) {
|
|
1258
|
-
const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
|
|
1259
|
-
return statGeneric(resolved, opts, (p) => stat(accessor, p, opts.index ?? void 0));
|
|
1260
|
-
}
|
|
1261
|
-
var HF_STAT = command40({
|
|
1262
|
-
name: "stat",
|
|
1263
|
-
resource: [...HF_RESOURCES],
|
|
1264
|
-
spec: specOf40("stat"),
|
|
1265
|
-
fn: statCommand,
|
|
1266
|
-
provision: metadataProvision
|
|
1267
|
-
});
|
|
1268
|
-
|
|
1269
|
-
// src/commands/builtin/hf/strings.ts
|
|
1270
|
-
import { command as command41, specOf as specOf41, stringsGeneric } from "@struktoai/mirage-core";
|
|
1271
|
-
var HF_STRINGS = command41({
|
|
1272
|
-
name: "strings",
|
|
1273
|
-
resource: [...HF_RESOURCES],
|
|
1274
|
-
spec: specOf41("strings"),
|
|
1275
|
-
fn: (accessor, paths, _texts, opts) => stringsGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1276
|
-
});
|
|
1277
|
-
|
|
1278
|
-
// src/commands/builtin/hf/tac.ts
|
|
1279
|
-
import { command as command42, specOf as specOf42, tacGeneric } from "@struktoai/mirage-core";
|
|
1280
|
-
var HF_TAC = command42({
|
|
1281
|
-
name: "tac",
|
|
1282
|
-
resource: [...HF_RESOURCES],
|
|
1283
|
-
spec: specOf42("tac"),
|
|
1284
|
-
fn: (accessor, paths, _texts, opts) => tacGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1285
|
-
});
|
|
1286
|
-
|
|
1287
|
-
// src/commands/builtin/hf/tail/tail.ts
|
|
1288
|
-
import { command as command43, headerAggregate as headerAggregate2, specOf as specOf43, tailGeneric } from "@struktoai/mirage-core";
|
|
1289
|
-
var HF_TAIL = command43({
|
|
1290
|
-
name: "tail",
|
|
1291
|
-
resource: [...HF_RESOURCES],
|
|
1292
|
-
spec: specOf43("tail"),
|
|
1293
|
-
provision: headTailProvision,
|
|
1294
|
-
fn: (accessor, paths, texts, opts) => tailGeneric(paths, texts, opts, (p) => stream(accessor, p)),
|
|
1295
|
-
aggregate: headerAggregate2
|
|
1296
|
-
});
|
|
1297
|
-
|
|
1298
|
-
// src/commands/builtin/hf/tar.ts
|
|
1299
|
-
import { command as command44, specOf as specOf44, tarGeneric } from "@struktoai/mirage-core";
|
|
1300
|
-
var HF_TAR = command44({
|
|
1301
|
-
name: "tar",
|
|
1302
|
-
resource: [...HF_RESOURCES],
|
|
1303
|
-
spec: specOf44("tar"),
|
|
1304
|
-
fn: (accessor, paths, _texts, opts) => tarGeneric(
|
|
1305
|
-
paths,
|
|
1306
|
-
opts,
|
|
1307
|
-
(p) => stream(accessor, p),
|
|
1308
|
-
(p, data) => write(accessor, p, data),
|
|
1309
|
-
(p) => mkdir(accessor, p)
|
|
1310
|
-
),
|
|
1311
|
-
write: true
|
|
1312
|
-
});
|
|
1313
|
-
|
|
1314
|
-
// src/commands/builtin/hf/touch.ts
|
|
1315
|
-
import {
|
|
1316
|
-
IOResult as IOResult2,
|
|
1317
|
-
command as command45,
|
|
1318
|
-
specOf as specOf45
|
|
1319
|
-
} from "@struktoai/mirage-core";
|
|
1320
|
-
|
|
1321
|
-
// src/core/hf/exists.ts
|
|
1322
|
-
async function exists(accessor, path) {
|
|
1323
|
-
try {
|
|
1324
|
-
await stat(accessor, path);
|
|
1325
|
-
return true;
|
|
1326
|
-
} catch (err) {
|
|
1327
|
-
if (err?.code === "ENOENT") return false;
|
|
1328
|
-
throw err;
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
// src/commands/builtin/hf/touch.ts
|
|
1333
|
-
var ENC2 = new TextEncoder();
|
|
1334
|
-
async function touchCommand(accessor, paths, texts, opts) {
|
|
1335
|
-
if (paths.length === 0) {
|
|
1336
|
-
return [null, new IOResult2({ exitCode: 1, stderr: ENC2.encode("touch: missing operand\n") })];
|
|
1337
|
-
}
|
|
1338
|
-
const createOnly = opts.flags.c === true;
|
|
1339
|
-
for (const p of paths) {
|
|
1340
|
-
if (createOnly) continue;
|
|
1341
|
-
if (!await exists(accessor, p)) {
|
|
1342
|
-
await write(accessor, p, new Uint8Array(0));
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
return [null, new IOResult2()];
|
|
1346
|
-
}
|
|
1347
|
-
var HF_TOUCH = command45({
|
|
1348
|
-
name: "touch",
|
|
1349
|
-
resource: [...HF_RESOURCES],
|
|
1350
|
-
spec: specOf45("touch"),
|
|
1351
|
-
fn: touchCommand,
|
|
1352
|
-
write: true
|
|
1353
|
-
});
|
|
1354
|
-
|
|
1355
|
-
// src/commands/builtin/hf/tr.ts
|
|
1356
|
-
import { command as command46, specOf as specOf46, trGeneric } from "@struktoai/mirage-core";
|
|
1357
|
-
var HF_TR = command46({
|
|
1358
|
-
name: "tr",
|
|
1359
|
-
resource: [...HF_RESOURCES],
|
|
1360
|
-
spec: specOf46("tr"),
|
|
1361
|
-
fn: (accessor, paths, texts, opts) => trGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1362
|
-
});
|
|
1363
|
-
|
|
1364
|
-
// src/commands/builtin/hf/tree.ts
|
|
1365
|
-
import {
|
|
1366
|
-
command as command47,
|
|
1367
|
-
specOf as specOf47,
|
|
1368
|
-
treeGeneric
|
|
1369
|
-
} from "@struktoai/mirage-core";
|
|
1370
|
-
async function treeCommand(accessor, paths, _texts, opts) {
|
|
1371
|
-
const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
|
|
1372
|
-
return treeGeneric(
|
|
1373
|
-
resolved,
|
|
1374
|
-
opts,
|
|
1375
|
-
(p) => readdir(accessor, p, opts.index ?? void 0),
|
|
1376
|
-
(p) => stat(accessor, p, opts.index ?? void 0)
|
|
1377
|
-
);
|
|
1378
|
-
}
|
|
1379
|
-
var HF_TREE = command47({
|
|
1380
|
-
name: "tree",
|
|
1381
|
-
resource: [...HF_RESOURCES],
|
|
1382
|
-
spec: specOf47("tree"),
|
|
1383
|
-
fn: treeCommand
|
|
1384
|
-
});
|
|
1385
|
-
|
|
1386
|
-
// src/commands/builtin/hf/tsort.ts
|
|
1387
|
-
import { command as command48, specOf as specOf48, tsortGeneric } from "@struktoai/mirage-core";
|
|
1388
|
-
var HF_TSORT = command48({
|
|
1389
|
-
name: "tsort",
|
|
1390
|
-
resource: [...HF_RESOURCES],
|
|
1391
|
-
spec: specOf48("tsort"),
|
|
1392
|
-
fn: (accessor, paths, _texts, opts) => tsortGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1393
|
-
});
|
|
1394
|
-
|
|
1395
|
-
// src/commands/builtin/hf/unexpand.ts
|
|
1396
|
-
import { command as command49, specOf as specOf49, unexpandGeneric } from "@struktoai/mirage-core";
|
|
1397
|
-
var HF_UNEXPAND = command49({
|
|
1398
|
-
name: "unexpand",
|
|
1399
|
-
resource: [...HF_RESOURCES],
|
|
1400
|
-
spec: specOf49("unexpand"),
|
|
1401
|
-
fn: (accessor, paths, _texts, opts) => unexpandGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1402
|
-
});
|
|
1403
|
-
|
|
1404
|
-
// src/commands/builtin/hf/uniq.ts
|
|
1405
|
-
import { command as command50, specOf as specOf50, uniqGeneric } from "@struktoai/mirage-core";
|
|
1406
|
-
var HF_UNIQ = command50({
|
|
1407
|
-
name: "uniq",
|
|
1408
|
-
resource: [...HF_RESOURCES],
|
|
1409
|
-
spec: specOf50("uniq"),
|
|
1410
|
-
fn: (accessor, paths, _texts, opts) => uniqGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
|
-
// src/commands/builtin/hf/unzip.ts
|
|
1414
|
-
import { command as command51, specOf as specOf51, unzipGeneric } from "@struktoai/mirage-core";
|
|
1415
|
-
var HF_UNZIP = command51({
|
|
1416
|
-
name: "unzip",
|
|
1417
|
-
resource: [...HF_RESOURCES],
|
|
1418
|
-
spec: specOf51("unzip"),
|
|
1419
|
-
fn: (accessor, paths, _texts, opts) => unzipGeneric(
|
|
1420
|
-
paths,
|
|
1421
|
-
opts,
|
|
1422
|
-
(p) => stream(accessor, p),
|
|
1423
|
-
(p, d) => write(accessor, p, d),
|
|
1424
|
-
(p) => mkdir(accessor, p)
|
|
1425
|
-
),
|
|
1426
|
-
write: true
|
|
1427
|
-
});
|
|
1428
|
-
|
|
1429
|
-
// src/commands/builtin/hf/wc/wc.ts
|
|
1430
|
-
import { command as command52, specOf as specOf52, wcAggregate, wcGeneric } from "@struktoai/mirage-core";
|
|
1431
|
-
var HF_WC = command52({
|
|
1432
|
-
name: "wc",
|
|
1433
|
-
resource: [...HF_RESOURCES],
|
|
1434
|
-
spec: specOf52("wc"),
|
|
1435
|
-
fn: (accessor, paths, texts, opts) => wcGeneric(paths, texts, opts, (p) => stream(accessor, p)),
|
|
1436
|
-
provision: fileReadProvision,
|
|
1437
|
-
aggregate: wcAggregate
|
|
1438
|
-
});
|
|
1439
|
-
|
|
1440
|
-
// src/commands/builtin/hf/xxd.ts
|
|
1441
|
-
import { command as command53, specOf as specOf53, xxdGeneric } from "@struktoai/mirage-core";
|
|
1442
|
-
var HF_XXD = command53({
|
|
1443
|
-
name: "xxd",
|
|
1444
|
-
resource: [...HF_RESOURCES],
|
|
1445
|
-
spec: specOf53("xxd"),
|
|
1446
|
-
fn: (accessor, paths, _texts, opts) => xxdGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1447
|
-
});
|
|
1448
|
-
|
|
1449
|
-
// src/commands/builtin/hf/zcat.ts
|
|
1450
|
-
import { command as command54, specOf as specOf54, zcatGeneric } from "@struktoai/mirage-core";
|
|
1451
|
-
var HF_ZCAT = command54({
|
|
1452
|
-
name: "zcat",
|
|
1453
|
-
resource: [...HF_RESOURCES],
|
|
1454
|
-
spec: specOf54("zcat"),
|
|
1455
|
-
fn: (accessor, paths, _texts, opts) => zcatGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1456
|
-
});
|
|
1457
|
-
|
|
1458
|
-
// src/commands/builtin/hf/zgrep.ts
|
|
1459
|
-
import { command as command55, specOf as specOf55, zgrepGeneric } from "@struktoai/mirage-core";
|
|
1460
|
-
var HF_ZGREP = command55({
|
|
1461
|
-
name: "zgrep",
|
|
1462
|
-
resource: [...HF_RESOURCES],
|
|
1463
|
-
spec: specOf55("zgrep"),
|
|
1464
|
-
fn: (accessor, paths, texts, opts) => zgrepGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1465
|
-
});
|
|
1466
|
-
|
|
1467
|
-
// src/commands/builtin/hf/zip_cmd.ts
|
|
1468
|
-
import { command as command56, specOf as specOf56, zipGeneric } from "@struktoai/mirage-core";
|
|
1469
|
-
var HF_ZIP = command56({
|
|
1470
|
-
name: "zip",
|
|
1471
|
-
resource: [...HF_RESOURCES],
|
|
1472
|
-
spec: specOf56("zip"),
|
|
1473
|
-
fn: (accessor, paths, _texts, opts) => zipGeneric(
|
|
1474
|
-
paths,
|
|
1475
|
-
opts,
|
|
1476
|
-
(p) => stream(accessor, p),
|
|
1477
|
-
(p, d) => write(accessor, p, d)
|
|
1478
|
-
),
|
|
1479
|
-
write: true
|
|
1480
|
-
});
|
|
1481
|
-
|
|
1482
|
-
// src/commands/builtin/hf/index.ts
|
|
1483
|
-
var HF_COMMANDS = [
|
|
1484
|
-
...HF_AWK,
|
|
1485
|
-
...HF_BASE64,
|
|
1486
|
-
...HF_BASENAME,
|
|
1487
|
-
...HF_CAT,
|
|
1488
|
-
...HF_CMP,
|
|
1489
|
-
...HF_COLUMN,
|
|
1490
|
-
...HF_COMM,
|
|
1491
|
-
...HF_CSPLIT,
|
|
1492
|
-
...HF_CUT,
|
|
1493
|
-
...HF_DIFF,
|
|
1494
|
-
...HF_DIRNAME,
|
|
1495
|
-
...HF_DU,
|
|
1496
|
-
...HF_EXPAND,
|
|
1497
|
-
...HF_FILE,
|
|
1498
|
-
...HF_FIND,
|
|
1499
|
-
...HF_FMT,
|
|
1500
|
-
...HF_FOLD,
|
|
1501
|
-
...HF_GREP,
|
|
1502
|
-
...HF_GUNZIP,
|
|
1503
|
-
...HF_GZIP,
|
|
1504
|
-
...HF_HEAD,
|
|
1505
|
-
...HF_ICONV,
|
|
1506
|
-
...HF_JOIN,
|
|
1507
|
-
...HF_JQ,
|
|
1508
|
-
...HF_LOOK,
|
|
1509
|
-
...HF_LS,
|
|
1510
|
-
...HF_MD5,
|
|
1511
|
-
...HF_MKTEMP,
|
|
1512
|
-
...HF_NL,
|
|
1513
|
-
...HF_PASTE,
|
|
1514
|
-
...HF_READLINK,
|
|
1515
|
-
...HF_REALPATH,
|
|
1516
|
-
...HF_REV,
|
|
1517
|
-
...HF_RG,
|
|
1518
|
-
...HF_RM,
|
|
1519
|
-
...HF_SED,
|
|
1520
|
-
...HF_SHA256SUM,
|
|
1521
|
-
...HF_SHUF,
|
|
1522
|
-
...HF_SORT,
|
|
1523
|
-
...HF_SPLIT,
|
|
1524
|
-
...HF_STAT,
|
|
1525
|
-
...HF_STRINGS,
|
|
1526
|
-
...HF_TAC,
|
|
1527
|
-
...HF_TAIL,
|
|
1528
|
-
...HF_TAR,
|
|
1529
|
-
...HF_TOUCH,
|
|
1530
|
-
...HF_TR,
|
|
1531
|
-
...HF_TREE,
|
|
1532
|
-
...HF_TSORT,
|
|
1533
|
-
...HF_UNEXPAND,
|
|
1534
|
-
...HF_UNIQ,
|
|
1535
|
-
...HF_UNZIP,
|
|
1536
|
-
...HF_WC,
|
|
1537
|
-
...HF_XXD,
|
|
1538
|
-
...HF_ZCAT,
|
|
1539
|
-
...HF_ZGREP,
|
|
1540
|
-
...HF_ZIP
|
|
1541
|
-
];
|
|
1542
|
-
|
|
1543
|
-
// src/core/hf/create.ts
|
|
1544
|
-
async function create(accessor, path, index) {
|
|
1545
|
-
await write(accessor, path, new Uint8Array(), index);
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
// src/ops/hf/create.ts
|
|
1549
|
-
var createOps = HF_RESOURCES.map((resource) => ({
|
|
1550
|
-
name: "create",
|
|
1551
|
-
resource,
|
|
1552
|
-
filetype: null,
|
|
1553
|
-
write: true,
|
|
1554
|
-
fn: (accessor, path) => {
|
|
1555
|
-
return create(accessor, path);
|
|
1556
|
-
}
|
|
1557
|
-
}));
|
|
1558
|
-
|
|
1559
|
-
// src/ops/hf/mkdir.ts
|
|
1560
|
-
var mkdirOps = HF_RESOURCES.map((resource) => ({
|
|
1561
|
-
name: "mkdir",
|
|
1562
|
-
resource,
|
|
1563
|
-
filetype: null,
|
|
1564
|
-
write: true,
|
|
1565
|
-
fn: (accessor, path) => {
|
|
1566
|
-
return mkdir(accessor, path);
|
|
1567
|
-
}
|
|
1568
|
-
}));
|
|
1569
|
-
|
|
1570
|
-
// src/ops/hf/read/read.ts
|
|
1571
|
-
var readOps = HF_RESOURCES.map((resource) => ({
|
|
1572
|
-
name: "read",
|
|
1573
|
-
resource,
|
|
1574
|
-
filetype: null,
|
|
1575
|
-
write: false,
|
|
1576
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1577
|
-
return read(accessor, path, kwargs.index);
|
|
1578
|
-
}
|
|
1579
|
-
}));
|
|
1580
|
-
|
|
1581
|
-
// src/ops/hf/read/read_feather.ts
|
|
1582
|
-
import { featherCat } from "@struktoai/mirage-core";
|
|
1583
|
-
var readFeatherOps = HF_RESOURCES.map((resource) => ({
|
|
1584
|
-
name: "read",
|
|
1585
|
-
resource,
|
|
1586
|
-
filetype: ".feather",
|
|
1587
|
-
write: false,
|
|
1588
|
-
fn: async (accessor, path, _args, kwargs) => {
|
|
1589
|
-
const raw = await read(accessor, path, kwargs.index);
|
|
1590
|
-
return featherCat(raw);
|
|
1591
|
-
}
|
|
1592
|
-
}));
|
|
1593
|
-
|
|
1594
|
-
// src/ops/hf/read/read_hdf5.ts
|
|
1595
|
-
import { hdf5Cat } from "@struktoai/mirage-core";
|
|
1596
|
-
var readHdf5Ops = HF_RESOURCES.map((resource) => ({
|
|
1597
|
-
name: "read",
|
|
1598
|
-
resource,
|
|
1599
|
-
filetype: ".hdf5",
|
|
1600
|
-
write: false,
|
|
1601
|
-
fn: async (accessor, path, _args, kwargs) => {
|
|
1602
|
-
const raw = await read(accessor, path, kwargs.index);
|
|
1603
|
-
return hdf5Cat(raw);
|
|
1604
|
-
}
|
|
1605
|
-
}));
|
|
1606
|
-
|
|
1607
|
-
// src/ops/hf/read/read_parquet.ts
|
|
1608
|
-
import { parquetCat } from "@struktoai/mirage-core";
|
|
1609
|
-
var readParquetOps = HF_RESOURCES.map((resource) => ({
|
|
1610
|
-
name: "read",
|
|
1611
|
-
resource,
|
|
1612
|
-
filetype: ".parquet",
|
|
1613
|
-
write: false,
|
|
1614
|
-
fn: async (accessor, path, _args, kwargs) => {
|
|
1615
|
-
const raw = await read(accessor, path, kwargs.index);
|
|
1616
|
-
return parquetCat(raw);
|
|
1617
|
-
}
|
|
1618
|
-
}));
|
|
1619
|
-
|
|
1620
|
-
// src/ops/hf/readdir.ts
|
|
1621
|
-
var readdirOps = HF_RESOURCES.map((resource) => ({
|
|
1622
|
-
name: "readdir",
|
|
1623
|
-
resource,
|
|
1624
|
-
filetype: null,
|
|
1625
|
-
write: false,
|
|
1626
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1627
|
-
return readdir(accessor, path, kwargs.index);
|
|
1628
|
-
}
|
|
1629
|
-
}));
|
|
1630
|
-
|
|
1631
|
-
// src/ops/hf/stat.ts
|
|
1632
|
-
var statOps = HF_RESOURCES.map((resource) => ({
|
|
1633
|
-
name: "stat",
|
|
1634
|
-
resource,
|
|
1635
|
-
filetype: null,
|
|
1636
|
-
write: false,
|
|
1637
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1638
|
-
return stat(accessor, path, kwargs.index);
|
|
1639
|
-
}
|
|
1640
|
-
}));
|
|
1641
|
-
|
|
1642
|
-
// src/ops/hf/unlink.ts
|
|
1643
|
-
var unlinkOps = HF_RESOURCES.map((resource) => ({
|
|
1644
|
-
name: "unlink",
|
|
1645
|
-
resource,
|
|
1646
|
-
filetype: null,
|
|
1647
|
-
write: true,
|
|
1648
|
-
fn: (accessor, path, _args, kwargs) => {
|
|
1649
|
-
return unlink(accessor, path, kwargs.index);
|
|
1650
|
-
}
|
|
1651
|
-
}));
|
|
1652
|
-
|
|
1653
|
-
// src/ops/hf/write.ts
|
|
1654
|
-
import { extractWriteData } from "@struktoai/mirage-core";
|
|
1655
|
-
var writeOps = HF_RESOURCES.map((resource) => ({
|
|
1656
|
-
name: "write",
|
|
1657
|
-
resource,
|
|
1658
|
-
filetype: null,
|
|
1659
|
-
write: true,
|
|
1660
|
-
fn: (accessor, path, args) => {
|
|
1661
|
-
const data = extractWriteData(args);
|
|
1662
|
-
return write(accessor, path, data);
|
|
1663
|
-
}
|
|
1664
|
-
}));
|
|
1665
|
-
|
|
1666
|
-
// src/ops/hf/index.ts
|
|
1667
|
-
var HF_OPS = [
|
|
1668
|
-
...createOps,
|
|
1669
|
-
...mkdirOps,
|
|
1670
|
-
...readOps,
|
|
1671
|
-
...readFeatherOps,
|
|
1672
|
-
...readHdf5Ops,
|
|
1673
|
-
...readParquetOps,
|
|
1674
|
-
...readdirOps,
|
|
1675
|
-
...statOps,
|
|
1676
|
-
...unlinkOps,
|
|
1677
|
-
...writeOps
|
|
1678
|
-
];
|
|
1679
|
-
|
|
1680
|
-
// src/resource/hf_buckets/base.ts
|
|
1681
|
-
import {
|
|
1682
|
-
BaseResource,
|
|
1683
|
-
PathSpec as PathSpec2
|
|
1684
|
-
} from "@struktoai/mirage-core";
|
|
1685
|
-
var HfResource = class extends BaseResource {
|
|
1686
|
-
cachesReads = true;
|
|
1687
|
-
supportsSnapshot = true;
|
|
1688
|
-
opsMap = {
|
|
1689
|
-
read_bytes: read,
|
|
1690
|
-
readdir,
|
|
1691
|
-
stat,
|
|
1692
|
-
read_stream: stream,
|
|
1693
|
-
range_read: rangeRead,
|
|
1694
|
-
du_total: du,
|
|
1695
|
-
du_all: duAll,
|
|
1696
|
-
exists,
|
|
1697
|
-
find_flat: find,
|
|
1698
|
-
write,
|
|
1699
|
-
create,
|
|
1700
|
-
unlink,
|
|
1701
|
-
mkdir
|
|
1702
|
-
};
|
|
1703
|
-
open() {
|
|
1704
|
-
return Promise.resolve();
|
|
1705
|
-
}
|
|
1706
|
-
close() {
|
|
1707
|
-
return Promise.resolve();
|
|
1708
|
-
}
|
|
1709
|
-
commands() {
|
|
1710
|
-
return HF_COMMANDS;
|
|
1711
|
-
}
|
|
1712
|
-
ops() {
|
|
1713
|
-
return HF_OPS;
|
|
1714
|
-
}
|
|
1715
|
-
streamPath(p) {
|
|
1716
|
-
return stream(this.accessor, p);
|
|
1717
|
-
}
|
|
1718
|
-
readFile(p) {
|
|
1719
|
-
return read(this.accessor, p, this.index);
|
|
1720
|
-
}
|
|
1721
|
-
writeFile(p, data) {
|
|
1722
|
-
return write(this.accessor, p, data, this.index);
|
|
1723
|
-
}
|
|
1724
|
-
readdir(p) {
|
|
1725
|
-
return readdir(this.accessor, p, this.index);
|
|
1726
|
-
}
|
|
1727
|
-
stat(p) {
|
|
1728
|
-
return stat(this.accessor, p, this.index);
|
|
1729
|
-
}
|
|
1730
|
-
exists(p) {
|
|
1731
|
-
return exists(this.accessor, p);
|
|
1732
|
-
}
|
|
1733
|
-
mkdir(p) {
|
|
1734
|
-
return mkdir(this.accessor, p);
|
|
1735
|
-
}
|
|
1736
|
-
unlink(p) {
|
|
1737
|
-
return unlink(this.accessor, p, this.index);
|
|
1738
|
-
}
|
|
1739
|
-
du(p) {
|
|
1740
|
-
return du(this.accessor, p);
|
|
1741
|
-
}
|
|
1742
|
-
find(p, options = {}) {
|
|
1743
|
-
return find(this.accessor, p, options);
|
|
1744
|
-
}
|
|
1745
|
-
glob(paths, prefix = "") {
|
|
1746
|
-
const effective = prefix ? paths.map(
|
|
1747
|
-
(p) => p.prefix ? p : new PathSpec2({
|
|
1748
|
-
original: p.original,
|
|
1749
|
-
directory: p.directory,
|
|
1750
|
-
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
1751
|
-
resolved: p.resolved,
|
|
1752
|
-
prefix
|
|
1753
|
-
})
|
|
1754
|
-
) : paths;
|
|
1755
|
-
return resolveGlob(this.accessor, effective, this.index);
|
|
1756
|
-
}
|
|
1757
|
-
async fingerprint(p) {
|
|
1758
|
-
try {
|
|
1759
|
-
const s = await stat(this.accessor, p);
|
|
1760
|
-
return s.fingerprint;
|
|
1761
|
-
} catch (err) {
|
|
1762
|
-
if (err?.code === "ENOENT") return null;
|
|
1763
|
-
throw err;
|
|
1764
|
-
}
|
|
1765
|
-
}
|
|
1766
|
-
loadState(_state) {
|
|
1767
|
-
return Promise.resolve();
|
|
1768
|
-
}
|
|
1769
|
-
};
|
|
1770
|
-
|
|
1771
|
-
export {
|
|
1772
|
-
HF_RESOURCES,
|
|
1773
|
-
HfAccessor,
|
|
1774
|
-
HfBucketsAccessor,
|
|
1775
|
-
HfDatasetsAccessor,
|
|
1776
|
-
HfModelsAccessor,
|
|
1777
|
-
HfSpacesAccessor,
|
|
1778
|
-
HF_COMMANDS,
|
|
1779
|
-
HF_OPS,
|
|
1780
|
-
HfResource
|
|
1781
|
-
};
|
|
1782
|
-
//# sourceMappingURL=chunk-TURD42QO.js.map
|