@struktoai/mirage-node 0.0.1 → 0.0.2
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 +63 -129
- package/dist/aliyun-TMZRUYCG.js +10 -0
- package/dist/backblaze-OHW57DLK.js +10 -0
- package/dist/box-UXTCAFOZ.js +8 -0
- package/dist/ceph-TNN4I2FT.js +10 -0
- package/dist/chunk-2CC5VW7K.js +52 -0
- package/dist/chunk-2CC5VW7K.js.map +1 -0
- package/dist/chunk-3IJSIVKT.js +57 -0
- package/dist/chunk-3IJSIVKT.js.map +1 -0
- package/dist/chunk-3T3RMDNX.js +57 -0
- package/dist/chunk-3T3RMDNX.js.map +1 -0
- package/dist/chunk-54NTYJEO.js +13 -0
- package/dist/chunk-54NTYJEO.js.map +1 -0
- package/dist/{chunk-DCJQ2PIX.js → chunk-5DLOHQJ2.js} +5 -8
- package/dist/chunk-5DLOHQJ2.js.map +1 -0
- package/dist/chunk-5HCVKTP3.js +2086 -0
- package/dist/chunk-5HCVKTP3.js.map +1 -0
- package/dist/{chunk-5E6BULAK.js → chunk-5YOCVEUB.js} +5 -8
- package/dist/chunk-5YOCVEUB.js.map +1 -0
- package/dist/{chunk-6M2NL363.js → chunk-A4Z6DZ22.js} +6 -8
- package/dist/chunk-A4Z6DZ22.js.map +1 -0
- package/dist/{chunk-NOZZFJEB.js → chunk-A7X4L4JM.js} +5 -8
- package/dist/chunk-A7X4L4JM.js.map +1 -0
- package/dist/{chunk-GCB4JUF7.js → chunk-ABTEGAFB.js} +5 -8
- package/dist/chunk-ABTEGAFB.js.map +1 -0
- package/dist/chunk-AJICZLHT.js +57 -0
- package/dist/chunk-AJICZLHT.js.map +1 -0
- package/dist/{chunk-H74QYTN7.js → chunk-B2ZOKNN4.js} +14 -3
- package/dist/chunk-B2ZOKNN4.js.map +1 -0
- package/dist/{chunk-ICSS5ETT.js → chunk-B6SXRCBO.js} +8 -18
- package/dist/chunk-B6SXRCBO.js.map +1 -0
- package/dist/{chunk-HEQL3LPK.js → chunk-BYTU2YC3.js} +8 -18
- package/dist/chunk-BYTU2YC3.js.map +1 -0
- package/dist/{chunk-V5OLWE7F.js → chunk-C6NHEDHY.js} +5 -8
- package/dist/chunk-C6NHEDHY.js.map +1 -0
- package/dist/chunk-C6NHFMIP.js +57 -0
- package/dist/chunk-C6NHFMIP.js.map +1 -0
- package/dist/chunk-CASCUFK2.js +87 -0
- package/dist/chunk-CASCUFK2.js.map +1 -0
- package/dist/chunk-DNBAMB5J.js +18 -0
- package/dist/chunk-DNBAMB5J.js.map +1 -0
- package/dist/chunk-DP2PP5V2.js +26 -0
- package/dist/chunk-DP2PP5V2.js.map +1 -0
- package/dist/{chunk-OYJXYJTE.js → chunk-DTAY7LPC.js} +303 -866
- package/dist/chunk-DTAY7LPC.js.map +1 -0
- package/dist/chunk-DYXEITK3.js +52 -0
- package/dist/chunk-DYXEITK3.js.map +1 -0
- package/dist/chunk-E2ISWXLB.js +7 -0
- package/dist/chunk-E2ISWXLB.js.map +1 -0
- package/dist/{chunk-XDEEOTVK.js → chunk-E7RW3SBV.js} +5 -8
- package/dist/chunk-E7RW3SBV.js.map +1 -0
- package/dist/chunk-EGB7V74Z.js +76 -0
- package/dist/chunk-EGB7V74Z.js.map +1 -0
- package/dist/{chunk-LBBM3LKK.js → chunk-ERELJ7BS.js} +5 -8
- package/dist/chunk-ERELJ7BS.js.map +1 -0
- package/dist/chunk-FXFDBF3P.js +57 -0
- package/dist/chunk-FXFDBF3P.js.map +1 -0
- package/dist/chunk-G5BZE7UA.js +50 -0
- package/dist/chunk-G5BZE7UA.js.map +1 -0
- package/dist/chunk-H3BST2LI.js +26 -0
- package/dist/chunk-H3BST2LI.js.map +1 -0
- package/dist/chunk-H3I2KZIY.js +25 -0
- package/dist/chunk-H3I2KZIY.js.map +1 -0
- package/dist/{chunk-UWMOTOXA.js → chunk-HEHERHQ5.js} +8 -15
- package/dist/chunk-HEHERHQ5.js.map +1 -0
- package/dist/chunk-HQ4KWN76.js +57 -0
- package/dist/chunk-HQ4KWN76.js.map +1 -0
- package/dist/{chunk-MY3NUJJD.js → chunk-IQVNVTOP.js} +8 -18
- package/dist/chunk-IQVNVTOP.js.map +1 -0
- package/dist/chunk-JALIYI6M.js +55 -0
- package/dist/chunk-JALIYI6M.js.map +1 -0
- package/dist/chunk-JZQHKDSY.js +216 -0
- package/dist/chunk-JZQHKDSY.js.map +1 -0
- package/dist/chunk-JZT4QGIP.js +24 -0
- package/dist/chunk-JZT4QGIP.js.map +1 -0
- package/dist/chunk-KTNDT45N.js +57 -0
- package/dist/chunk-KTNDT45N.js.map +1 -0
- package/dist/chunk-L6JPBJAS.js +57 -0
- package/dist/chunk-L6JPBJAS.js.map +1 -0
- package/dist/{chunk-6VKNSO6U.js → chunk-LAJJPLEV.js} +17 -11
- package/dist/chunk-LAJJPLEV.js.map +1 -0
- package/dist/chunk-LW25LMIH.js +26 -0
- package/dist/chunk-LW25LMIH.js.map +1 -0
- package/dist/{chunk-WSDQ2MRG.js → chunk-LYDMMNL2.js} +5 -8
- package/dist/chunk-LYDMMNL2.js.map +1 -0
- package/dist/{chunk-G7O6DAWU.js → chunk-MHCMHKM6.js} +15 -9
- package/dist/chunk-MHCMHKM6.js.map +1 -0
- package/dist/chunk-N72CAZEH.js +1990 -0
- package/dist/chunk-N72CAZEH.js.map +1 -0
- package/dist/{chunk-XQUQSNCA.js → chunk-NHS7WLEQ.js} +4 -5
- package/dist/chunk-NHS7WLEQ.js.map +1 -0
- package/dist/chunk-NJMGCT63.js +54 -0
- package/dist/chunk-NJMGCT63.js.map +1 -0
- package/dist/chunk-O7ODGJYL.js +57 -0
- package/dist/chunk-O7ODGJYL.js.map +1 -0
- package/dist/chunk-OHROA3FQ.js +54 -0
- package/dist/chunk-OHROA3FQ.js.map +1 -0
- package/dist/chunk-OPYQ5KIO.js +52 -0
- package/dist/chunk-OPYQ5KIO.js.map +1 -0
- package/dist/chunk-OYV2DN66.js +50 -0
- package/dist/chunk-OYV2DN66.js.map +1 -0
- package/dist/chunk-OZAEWZZ3.js +31 -0
- package/dist/chunk-OZAEWZZ3.js.map +1 -0
- package/dist/chunk-PBBG7VFT.js +1896 -0
- package/dist/chunk-PBBG7VFT.js.map +1 -0
- package/dist/{chunk-HXWGG4K7.js → chunk-PJBQKMCD.js} +10 -20
- package/dist/chunk-PJBQKMCD.js.map +1 -0
- package/dist/chunk-Q2IAILVC.js +26 -0
- package/dist/chunk-Q2IAILVC.js.map +1 -0
- package/dist/chunk-Q6CDMOM6.js +57 -0
- package/dist/chunk-Q6CDMOM6.js.map +1 -0
- package/dist/{chunk-ALAMUIGJ.js → chunk-QGRDPSAH.js} +17 -12
- package/dist/chunk-QGRDPSAH.js.map +1 -0
- package/dist/{chunk-7QXJ4KWQ.js → chunk-RLGWMJD3.js} +63 -9
- package/dist/chunk-RLGWMJD3.js.map +1 -0
- package/dist/chunk-RO5IQEDQ.js +30 -0
- package/dist/chunk-RO5IQEDQ.js.map +1 -0
- package/dist/{chunk-ZC4KNEOQ.js → chunk-RQK5UPMP.js} +16 -11
- package/dist/chunk-RQK5UPMP.js.map +1 -0
- package/dist/chunk-RQYEEA2O.js +50 -0
- package/dist/chunk-RQYEEA2O.js.map +1 -0
- package/dist/chunk-SFUCUARB.js +21 -0
- package/dist/chunk-SFUCUARB.js.map +1 -0
- package/dist/{chunk-MVE5VVMQ.js → chunk-TRTUHCS4.js} +5 -8
- package/dist/chunk-TRTUHCS4.js.map +1 -0
- package/dist/chunk-TWGVQLG2.js +24 -0
- package/dist/chunk-TWGVQLG2.js.map +1 -0
- package/dist/chunk-UGK4TAVK.js +32 -0
- package/dist/chunk-UGK4TAVK.js.map +1 -0
- package/dist/{chunk-LPMPTQYP.js → chunk-UT2OPSN4.js} +12 -10
- package/dist/chunk-UT2OPSN4.js.map +1 -0
- package/dist/chunk-VGLHY6BK.js +31 -0
- package/dist/chunk-VGLHY6BK.js.map +1 -0
- package/dist/chunk-W7FLHT65.js +26 -0
- package/dist/chunk-W7FLHT65.js.map +1 -0
- package/dist/chunk-WL7HS7EM.js +50 -0
- package/dist/chunk-WL7HS7EM.js.map +1 -0
- package/dist/chunk-WSGEIVY3.js +1766 -0
- package/dist/chunk-WSGEIVY3.js.map +1 -0
- package/dist/{chunk-H3JR7MN3.js → chunk-XGJ2QERC.js} +17 -10
- package/dist/chunk-XGJ2QERC.js.map +1 -0
- package/dist/chunk-XHCBHYN4.js +54 -0
- package/dist/chunk-XHCBHYN4.js.map +1 -0
- package/dist/chunk-XLQI4IT2.js +54 -0
- package/dist/chunk-XLQI4IT2.js.map +1 -0
- package/dist/{chunk-3PBSL7BS.js → chunk-XRU5WXZX.js} +5 -8
- package/dist/chunk-XRU5WXZX.js.map +1 -0
- package/dist/{chunk-UZZD4MRJ.js → chunk-YAVGCQUP.js} +5 -8
- package/dist/chunk-YAVGCQUP.js.map +1 -0
- package/dist/chunk-YGZMVNN5.js +54 -0
- package/dist/chunk-YGZMVNN5.js.map +1 -0
- package/dist/{chunk-PEZYBKZH.js → chunk-YPT4JBUY.js} +10 -24
- package/dist/chunk-YPT4JBUY.js.map +1 -0
- package/dist/chunk-YUK3X3B4.js +27 -0
- package/dist/chunk-YUK3X3B4.js.map +1 -0
- package/dist/chunk-ZNWVJ6UW.js +54 -0
- package/dist/chunk-ZNWVJ6UW.js.map +1 -0
- package/dist/config-34LHOGLM.js +13 -0
- package/dist/config-3BBWD5AB.js +11 -0
- package/dist/{config-FNR6LJ5H.js → config-3IVQJBNW.js} +4 -2
- package/dist/config-4UDVSUQJ.js +11 -0
- package/dist/config-CMDBAPDH.js +11 -0
- package/dist/config-CVZ2AGCO.js +21 -0
- package/dist/config-D3RLSPNF.js +11 -0
- package/dist/config-DG65OEG3.js +11 -0
- package/dist/{config-HNSDNQZH.js → config-EIHSP5DZ.js} +4 -2
- package/dist/config-EO23EY62.js +15 -0
- package/dist/config-GCQK6NJY.js +11 -0
- package/dist/{config-5ZPGISS6.js → config-GE4W4ZJC.js} +4 -2
- package/dist/config-GHRUKEQ6.js +13 -0
- package/dist/config-GVH27UPE.js +11 -0
- package/dist/config-HKRMKD76.js +15 -0
- package/dist/config-HXVYIXP5.js +11 -0
- package/dist/config-IDZMEW73.js +11 -0
- package/dist/config-IJJXGLBQ.js +11 -0
- package/dist/config-IVY5EQQ2.js +15 -0
- package/dist/config-KJOLGVB2.js +11 -0
- package/dist/{config-S47UDVRZ.js → config-KMVCVBYN.js} +4 -2
- package/dist/{config-UKZ72IDO.js → config-KYTRXAB2.js} +4 -2
- package/dist/{config-MOLWOSRG.js → config-LHFFXVYI.js} +4 -2
- package/dist/config-NV5WXP64.js +11 -0
- package/dist/config-OT2TQQCN.js +11 -0
- package/dist/config-Q45Y46YT.js +15 -0
- package/dist/config-QAA646XB.js +15 -0
- package/dist/config-QNMKWJ4M.js +15 -0
- package/dist/config-QWCY3LBQ.js +11 -0
- package/dist/{config-HIZHA5VD.js → config-VM526IKB.js} +4 -2
- package/dist/config-WDAZFXYD.js +15 -0
- package/dist/config-ZFJYQZCH.js +13 -0
- package/dist/config-ZV6G2ZEC.js +11 -0
- package/dist/databricks_volume-HNQ4DJVJ.js +7 -0
- package/dist/digitalocean-6SPR4S7V.js +10 -0
- package/dist/discord-SAV2RBJV.js +8 -0
- package/dist/{disk-C7TJNU2B.js → disk-POACMF4G.js} +2 -2
- package/dist/dropbox-CQ7MTYX2.js +8 -0
- package/dist/email-KBQ7CXS7.js +8 -0
- package/dist/gcs-SMIE4VMT.js +10 -0
- package/dist/gdocs-X5Y2SIQX.js +8 -0
- package/dist/gdrive-SIQPRIGI.js +8 -0
- package/dist/github-KBHWANKQ.js +8 -0
- package/dist/github-KBHWANKQ.js.map +1 -0
- package/dist/github_ci-HPITNK37.js +8 -0
- package/dist/github_ci-HPITNK37.js.map +1 -0
- package/dist/gmail-DKHAGJNX.js +8 -0
- package/dist/gmail-DKHAGJNX.js.map +1 -0
- package/dist/gsheets-ZSUDIWGK.js +8 -0
- package/dist/gsheets-ZSUDIWGK.js.map +1 -0
- package/dist/gslides-GYXM7IMJ.js +8 -0
- package/dist/gslides-GYXM7IMJ.js.map +1 -0
- package/dist/hf_buckets-RIOMV7WG.js +10 -0
- package/dist/hf_buckets-RIOMV7WG.js.map +1 -0
- package/dist/hf_datasets-QF4BQ3OK.js +10 -0
- package/dist/hf_datasets-QF4BQ3OK.js.map +1 -0
- package/dist/hf_models-62GC2HPZ.js +10 -0
- package/dist/hf_models-62GC2HPZ.js.map +1 -0
- package/dist/hf_spaces-NVSMUNRM.js +10 -0
- package/dist/hf_spaces-NVSMUNRM.js.map +1 -0
- package/dist/index.d.ts +722 -277
- package/dist/index.js +646 -2268
- package/dist/index.js.map +1 -1
- package/dist/langfuse-HUAYVPHF.js +8 -0
- package/dist/langfuse-HUAYVPHF.js.map +1 -0
- package/dist/linear-2MM55KBC.js +8 -0
- package/dist/linear-2MM55KBC.js.map +1 -0
- package/dist/minio-L3XE6PQS.js +10 -0
- package/dist/minio-L3XE6PQS.js.map +1 -0
- package/dist/mongodb-ZOX4FRHJ.js +7 -0
- package/dist/mongodb-ZOX4FRHJ.js.map +1 -0
- package/dist/notion-UK4GTMT4.js +8 -0
- package/dist/notion-UK4GTMT4.js.map +1 -0
- package/dist/oci-NURLWPL2.js +10 -0
- package/dist/oci-NURLWPL2.js.map +1 -0
- package/dist/postgres-JNFMPAO2.js +7 -0
- package/dist/postgres-JNFMPAO2.js.map +1 -0
- package/dist/qingstor-W55D5YFO.js +10 -0
- package/dist/qingstor-W55D5YFO.js.map +1 -0
- package/dist/r2-FSZK7IFI.js +10 -0
- package/dist/r2-FSZK7IFI.js.map +1 -0
- package/dist/redis-S6GIPA4Z.js +8 -0
- package/dist/redis-S6GIPA4Z.js.map +1 -0
- package/dist/s3-GMPUJ65D.js +8 -0
- package/dist/s3-GMPUJ65D.js.map +1 -0
- package/dist/scaleway-5VM55Y6D.js +10 -0
- package/dist/scaleway-5VM55Y6D.js.map +1 -0
- package/dist/seaweedfs-J3EPUEPE.js +10 -0
- package/dist/seaweedfs-J3EPUEPE.js.map +1 -0
- package/dist/slack-FVBXY7KD.js +8 -0
- package/dist/slack-FVBXY7KD.js.map +1 -0
- package/dist/ssh-GCXETJ3Z.js +9 -0
- package/dist/ssh-GCXETJ3Z.js.map +1 -0
- package/dist/supabase-HLWNHBBE.js +10 -0
- package/dist/supabase-HLWNHBBE.js.map +1 -0
- package/dist/tencent-YDO73XBD.js +10 -0
- package/dist/tencent-YDO73XBD.js.map +1 -0
- package/dist/trello-CQ53BQUL.js +8 -0
- package/dist/trello-CQ53BQUL.js.map +1 -0
- package/dist/wasabi-SOZKPMRQ.js +10 -0
- package/dist/wasabi-SOZKPMRQ.js.map +1 -0
- package/package.json +39 -13
- package/dist/box-4P7DCJH7.js +0 -8
- package/dist/chunk-35PVZRWU.js +0 -24
- package/dist/chunk-35PVZRWU.js.map +0 -1
- package/dist/chunk-3PBSL7BS.js.map +0 -1
- package/dist/chunk-3Y625AUP.js +0 -24
- package/dist/chunk-3Y625AUP.js.map +0 -1
- package/dist/chunk-5E6BULAK.js.map +0 -1
- package/dist/chunk-5ITBZN55.js +0 -24
- package/dist/chunk-5ITBZN55.js.map +0 -1
- package/dist/chunk-6M2NL363.js.map +0 -1
- package/dist/chunk-6M3QVVOH.js +0 -32
- package/dist/chunk-6M3QVVOH.js.map +0 -1
- package/dist/chunk-6VKNSO6U.js.map +0 -1
- package/dist/chunk-6Y6GWMFF.js +0 -24
- package/dist/chunk-6Y6GWMFF.js.map +0 -1
- package/dist/chunk-7QXJ4KWQ.js.map +0 -1
- package/dist/chunk-ALAMUIGJ.js.map +0 -1
- package/dist/chunk-DCJQ2PIX.js.map +0 -1
- package/dist/chunk-EKPH4MMD.js +0 -27
- package/dist/chunk-EKPH4MMD.js.map +0 -1
- package/dist/chunk-FZ2GJ4BJ.js +0 -29
- package/dist/chunk-FZ2GJ4BJ.js.map +0 -1
- package/dist/chunk-G7O6DAWU.js.map +0 -1
- package/dist/chunk-GCB4JUF7.js.map +0 -1
- package/dist/chunk-GKQNMLQU.js +0 -7757
- package/dist/chunk-GKQNMLQU.js.map +0 -1
- package/dist/chunk-GO67AOYK.js +0 -24
- package/dist/chunk-GO67AOYK.js.map +0 -1
- package/dist/chunk-GPF66TH2.js +0 -24
- package/dist/chunk-GPF66TH2.js.map +0 -1
- package/dist/chunk-H3JR7MN3.js.map +0 -1
- package/dist/chunk-H74QYTN7.js.map +0 -1
- package/dist/chunk-HEQL3LPK.js.map +0 -1
- package/dist/chunk-HXWGG4K7.js.map +0 -1
- package/dist/chunk-I4RRGZGB.js +0 -24
- package/dist/chunk-I4RRGZGB.js.map +0 -1
- package/dist/chunk-ICSS5ETT.js.map +0 -1
- package/dist/chunk-KINMBZHC.js +0 -18
- package/dist/chunk-KINMBZHC.js.map +0 -1
- package/dist/chunk-LBBM3LKK.js.map +0 -1
- package/dist/chunk-LPMPTQYP.js.map +0 -1
- package/dist/chunk-M42JTWPR.js +0 -2794
- package/dist/chunk-M42JTWPR.js.map +0 -1
- package/dist/chunk-MVE5VVMQ.js.map +0 -1
- package/dist/chunk-MY3NUJJD.js.map +0 -1
- package/dist/chunk-NOZZFJEB.js.map +0 -1
- package/dist/chunk-OYJXYJTE.js.map +0 -1
- package/dist/chunk-PEZYBKZH.js.map +0 -1
- package/dist/chunk-QWWOBAYU.js +0 -26
- package/dist/chunk-QWWOBAYU.js.map +0 -1
- package/dist/chunk-RQYYYBQG.js +0 -24
- package/dist/chunk-RQYYYBQG.js.map +0 -1
- package/dist/chunk-T2WWAEKH.js +0 -7591
- package/dist/chunk-T2WWAEKH.js.map +0 -1
- package/dist/chunk-UWMOTOXA.js.map +0 -1
- package/dist/chunk-UZZD4MRJ.js.map +0 -1
- package/dist/chunk-V5OLWE7F.js.map +0 -1
- package/dist/chunk-VCLMTMSO.js +0 -23
- package/dist/chunk-VCLMTMSO.js.map +0 -1
- package/dist/chunk-WSDQ2MRG.js.map +0 -1
- package/dist/chunk-XDEEOTVK.js.map +0 -1
- package/dist/chunk-XQUQSNCA.js.map +0 -1
- package/dist/chunk-XVYZO2FG.js +0 -14
- package/dist/chunk-XVYZO2FG.js.map +0 -1
- package/dist/chunk-ZC4KNEOQ.js.map +0 -1
- package/dist/config-6HWSKHEU.js +0 -9
- package/dist/config-6TNFPYZF.js +0 -9
- package/dist/config-BHLXQ3OL.js +0 -9
- package/dist/config-E7UOEWEP.js +0 -9
- package/dist/config-IXLFUSMQ.js +0 -9
- package/dist/config-J3TM7NIS.js +0 -9
- package/dist/config-JXLZ4XEW.js +0 -9
- package/dist/config-KQCEMLNZ.js +0 -9
- package/dist/config-R3XJ5OW4.js +0 -9
- package/dist/config-V7XI5UTG.js +0 -9
- package/dist/config-YLIX3ZBT.js +0 -9
- package/dist/config-Z5JGDOKE.js +0 -9
- package/dist/config-ZCZZAH5W.js +0 -9
- package/dist/config-ZZGIWDUC.js +0 -9
- package/dist/discord-2PWP2MGX.js +0 -8
- package/dist/dropbox-L5DPYGKR.js +0 -8
- package/dist/email-HASRFBKC.js +0 -8
- package/dist/gcs-P5QMKTPR.js +0 -10
- package/dist/gdocs-IF2I35HZ.js +0 -8
- package/dist/gdrive-TAETVCKP.js +0 -8
- package/dist/github-5E6GSCNZ.js +0 -8
- package/dist/github_ci-2DSZI3Y7.js +0 -8
- package/dist/gmail-F5VYGKOT.js +0 -8
- package/dist/gsheets-BAO54CQ7.js +0 -8
- package/dist/gslides-A62CEEMR.js +0 -8
- package/dist/langfuse-YKBYRQLU.js +0 -8
- package/dist/linear-WJDQ6JDE.js +0 -8
- package/dist/mongodb-MK4DVSIK.js +0 -7
- package/dist/oci-KZ7XFZ2X.js +0 -10
- package/dist/postgres-M2N2APFZ.js +0 -7
- package/dist/r2-X4DDNSAZ.js +0 -10
- package/dist/redis-NVCXUUIO.js +0 -7
- package/dist/s3-HVAL7ZX3.js +0 -8
- package/dist/slack-GUQMDGLP.js +0 -8
- package/dist/ssh-LY6WYVVD.js +0 -9
- package/dist/supabase-H3ZP4Y3W.js +0 -10
- package/dist/trello-WR6TEDYD.js +0 -8
- /package/dist/{box-4P7DCJH7.js.map → aliyun-TMZRUYCG.js.map} +0 -0
- /package/dist/{config-5ZPGISS6.js.map → backblaze-OHW57DLK.js.map} +0 -0
- /package/dist/{config-6HWSKHEU.js.map → box-UXTCAFOZ.js.map} +0 -0
- /package/dist/{config-6TNFPYZF.js.map → ceph-TNN4I2FT.js.map} +0 -0
- /package/dist/{config-BHLXQ3OL.js.map → config-34LHOGLM.js.map} +0 -0
- /package/dist/{config-E7UOEWEP.js.map → config-3BBWD5AB.js.map} +0 -0
- /package/dist/{config-FNR6LJ5H.js.map → config-3IVQJBNW.js.map} +0 -0
- /package/dist/{config-HIZHA5VD.js.map → config-4UDVSUQJ.js.map} +0 -0
- /package/dist/{config-HNSDNQZH.js.map → config-CMDBAPDH.js.map} +0 -0
- /package/dist/{config-IXLFUSMQ.js.map → config-CVZ2AGCO.js.map} +0 -0
- /package/dist/{config-J3TM7NIS.js.map → config-D3RLSPNF.js.map} +0 -0
- /package/dist/{config-JXLZ4XEW.js.map → config-DG65OEG3.js.map} +0 -0
- /package/dist/{config-KQCEMLNZ.js.map → config-EIHSP5DZ.js.map} +0 -0
- /package/dist/{config-MOLWOSRG.js.map → config-EO23EY62.js.map} +0 -0
- /package/dist/{config-R3XJ5OW4.js.map → config-GCQK6NJY.js.map} +0 -0
- /package/dist/{config-S47UDVRZ.js.map → config-GE4W4ZJC.js.map} +0 -0
- /package/dist/{config-UKZ72IDO.js.map → config-GHRUKEQ6.js.map} +0 -0
- /package/dist/{config-V7XI5UTG.js.map → config-GVH27UPE.js.map} +0 -0
- /package/dist/{config-YLIX3ZBT.js.map → config-HKRMKD76.js.map} +0 -0
- /package/dist/{config-Z5JGDOKE.js.map → config-HXVYIXP5.js.map} +0 -0
- /package/dist/{config-ZCZZAH5W.js.map → config-IDZMEW73.js.map} +0 -0
- /package/dist/{config-ZZGIWDUC.js.map → config-IJJXGLBQ.js.map} +0 -0
- /package/dist/{discord-2PWP2MGX.js.map → config-IVY5EQQ2.js.map} +0 -0
- /package/dist/{disk-C7TJNU2B.js.map → config-KJOLGVB2.js.map} +0 -0
- /package/dist/{dropbox-L5DPYGKR.js.map → config-KMVCVBYN.js.map} +0 -0
- /package/dist/{email-HASRFBKC.js.map → config-KYTRXAB2.js.map} +0 -0
- /package/dist/{gcs-P5QMKTPR.js.map → config-LHFFXVYI.js.map} +0 -0
- /package/dist/{gdocs-IF2I35HZ.js.map → config-NV5WXP64.js.map} +0 -0
- /package/dist/{gdrive-TAETVCKP.js.map → config-OT2TQQCN.js.map} +0 -0
- /package/dist/{github-5E6GSCNZ.js.map → config-Q45Y46YT.js.map} +0 -0
- /package/dist/{github_ci-2DSZI3Y7.js.map → config-QAA646XB.js.map} +0 -0
- /package/dist/{gmail-F5VYGKOT.js.map → config-QNMKWJ4M.js.map} +0 -0
- /package/dist/{gsheets-BAO54CQ7.js.map → config-QWCY3LBQ.js.map} +0 -0
- /package/dist/{gslides-A62CEEMR.js.map → config-VM526IKB.js.map} +0 -0
- /package/dist/{langfuse-YKBYRQLU.js.map → config-WDAZFXYD.js.map} +0 -0
- /package/dist/{linear-WJDQ6JDE.js.map → config-ZFJYQZCH.js.map} +0 -0
- /package/dist/{mongodb-MK4DVSIK.js.map → config-ZV6G2ZEC.js.map} +0 -0
- /package/dist/{oci-KZ7XFZ2X.js.map → databricks_volume-HNQ4DJVJ.js.map} +0 -0
- /package/dist/{postgres-M2N2APFZ.js.map → digitalocean-6SPR4S7V.js.map} +0 -0
- /package/dist/{r2-X4DDNSAZ.js.map → discord-SAV2RBJV.js.map} +0 -0
- /package/dist/{redis-NVCXUUIO.js.map → disk-POACMF4G.js.map} +0 -0
- /package/dist/{s3-HVAL7ZX3.js.map → dropbox-CQ7MTYX2.js.map} +0 -0
- /package/dist/{slack-GUQMDGLP.js.map → email-KBQ7CXS7.js.map} +0 -0
- /package/dist/{ssh-LY6WYVVD.js.map → gcs-SMIE4VMT.js.map} +0 -0
- /package/dist/{supabase-H3ZP4Y3W.js.map → gdocs-X5Y2SIQX.js.map} +0 -0
- /package/dist/{trello-WR6TEDYD.js.map → gdrive-SIQPRIGI.js.map} +0 -0
|
@@ -0,0 +1,1990 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadOptionalPeer
|
|
3
|
+
} from "./chunk-E2ISWXLB.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/redis/redis.ts
|
|
6
|
+
import {
|
|
7
|
+
BaseResource,
|
|
8
|
+
PathSpec as PathSpec2,
|
|
9
|
+
REDACTED_SECRET,
|
|
10
|
+
ResourceName as ResourceName83
|
|
11
|
+
} from "@struktoai/mirage-core";
|
|
12
|
+
|
|
13
|
+
// src/commands/builtin/redis/index.ts
|
|
14
|
+
import { makeFiletypeCommands, ResourceName as ResourceName67 } from "@struktoai/mirage-core";
|
|
15
|
+
|
|
16
|
+
// src/core/redis/read.ts
|
|
17
|
+
import { record, ResourceName } from "@struktoai/mirage-core";
|
|
18
|
+
import { enoent } from "@struktoai/mirage-core";
|
|
19
|
+
|
|
20
|
+
// src/core/redis/utils.ts
|
|
21
|
+
import { norm, parent, gnuBasename } from "@struktoai/mirage-core";
|
|
22
|
+
function nowIso() {
|
|
23
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/core/redis/read.ts
|
|
27
|
+
async function read(accessor, path, _index) {
|
|
28
|
+
const start = performance.now();
|
|
29
|
+
const p = norm(path.stripPrefix);
|
|
30
|
+
const data = await accessor.store.getFile(p);
|
|
31
|
+
if (data === null) {
|
|
32
|
+
throw enoent(path);
|
|
33
|
+
}
|
|
34
|
+
record("read", p, ResourceName.REDIS, data.byteLength, start);
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/core/redis/stat.ts
|
|
39
|
+
import {
|
|
40
|
+
FileStat,
|
|
41
|
+
FileType,
|
|
42
|
+
guessType
|
|
43
|
+
} from "@struktoai/mirage-core";
|
|
44
|
+
import { enoent as enoent2 } from "@struktoai/mirage-core";
|
|
45
|
+
async function stat(accessor, path, _index) {
|
|
46
|
+
const p = norm(path.stripPrefix);
|
|
47
|
+
const store = accessor.store;
|
|
48
|
+
if (await store.hasDir(p)) {
|
|
49
|
+
return new FileStat({
|
|
50
|
+
name: gnuBasename(p),
|
|
51
|
+
modified: await store.getModified(p),
|
|
52
|
+
type: FileType.DIRECTORY
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (await store.hasFile(p)) {
|
|
56
|
+
const size = await store.fileLen(p);
|
|
57
|
+
return new FileStat({
|
|
58
|
+
name: gnuBasename(p),
|
|
59
|
+
size,
|
|
60
|
+
modified: await store.getModified(p),
|
|
61
|
+
type: guessType(p)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
throw enoent2(path);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/commands/builtin/redis/awk.ts
|
|
68
|
+
import { ResourceName as ResourceName3, awkGeneric, command, specOf } from "@struktoai/mirage-core";
|
|
69
|
+
|
|
70
|
+
// src/core/redis/stream.ts
|
|
71
|
+
import {
|
|
72
|
+
recordStream,
|
|
73
|
+
ResourceName as ResourceName2
|
|
74
|
+
} from "@struktoai/mirage-core";
|
|
75
|
+
import { enoent as enoent3 } from "@struktoai/mirage-core";
|
|
76
|
+
async function* stream(accessor, path, _index) {
|
|
77
|
+
const p = norm(path.stripPrefix);
|
|
78
|
+
const data = await accessor.store.getFile(p);
|
|
79
|
+
if (data === null) throw enoent3(path);
|
|
80
|
+
const rec = recordStream("read", p, ResourceName2.REDIS);
|
|
81
|
+
if (rec !== null) rec.bytes = data.byteLength;
|
|
82
|
+
yield data;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/commands/builtin/redis/awk.ts
|
|
86
|
+
var REDIS_AWK = command({
|
|
87
|
+
name: "awk",
|
|
88
|
+
resource: ResourceName3.REDIS,
|
|
89
|
+
spec: specOf("awk"),
|
|
90
|
+
fn: (accessor, paths, texts, opts) => awkGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// src/commands/builtin/redis/base64_cmd.ts
|
|
94
|
+
import { ResourceName as ResourceName4, command as command2, specOf as specOf2, base64Generic } from "@struktoai/mirage-core";
|
|
95
|
+
var REDIS_BASE64 = command2({
|
|
96
|
+
name: "base64",
|
|
97
|
+
resource: ResourceName4.REDIS,
|
|
98
|
+
spec: specOf2("base64"),
|
|
99
|
+
fn: (accessor, paths, _texts, opts) => base64Generic(paths, opts, (p) => stream(accessor, p))
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// src/commands/builtin/redis/basename.ts
|
|
103
|
+
import { ResourceName as ResourceName5, command as command3, specOf as specOf3, basenameFn } from "@struktoai/mirage-core";
|
|
104
|
+
var REDIS_BASENAME = command3({
|
|
105
|
+
name: "basename",
|
|
106
|
+
resource: ResourceName5.REDIS,
|
|
107
|
+
spec: specOf3("basename"),
|
|
108
|
+
fn: basenameFn
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// src/commands/builtin/redis/cat/cat.ts
|
|
112
|
+
import {
|
|
113
|
+
ResourceName as ResourceName6,
|
|
114
|
+
catGeneric,
|
|
115
|
+
catProvisionGeneric,
|
|
116
|
+
command as command4,
|
|
117
|
+
concatAggregate,
|
|
118
|
+
specOf as specOf4
|
|
119
|
+
} from "@struktoai/mirage-core";
|
|
120
|
+
var REDIS_CAT = command4({
|
|
121
|
+
name: "cat",
|
|
122
|
+
resource: ResourceName6.REDIS,
|
|
123
|
+
spec: specOf4("cat"),
|
|
124
|
+
fn: (accessor, paths, texts, opts) => catGeneric(
|
|
125
|
+
paths,
|
|
126
|
+
texts,
|
|
127
|
+
opts,
|
|
128
|
+
(p) => stat(accessor, p),
|
|
129
|
+
(p) => stream(accessor, p)
|
|
130
|
+
),
|
|
131
|
+
provision: (accessor, paths, _texts, _opts) => catProvisionGeneric(paths, (p) => stat(accessor, p)),
|
|
132
|
+
aggregate: concatAggregate
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// src/commands/builtin/redis/cmp.ts
|
|
136
|
+
import { ResourceName as ResourceName7, command as command5, specOf as specOf5, cmpGeneric } from "@struktoai/mirage-core";
|
|
137
|
+
var REDIS_CMP = command5({
|
|
138
|
+
name: "cmp",
|
|
139
|
+
resource: ResourceName7.REDIS,
|
|
140
|
+
spec: specOf5("cmp"),
|
|
141
|
+
fn: (accessor, paths, _texts, opts) => cmpGeneric(paths, opts, (p) => stream(accessor, p))
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// src/commands/builtin/redis/column.ts
|
|
145
|
+
import { ResourceName as ResourceName8, command as command6, specOf as specOf6, columnGeneric } from "@struktoai/mirage-core";
|
|
146
|
+
var REDIS_COLUMN = command6({
|
|
147
|
+
name: "column",
|
|
148
|
+
resource: ResourceName8.REDIS,
|
|
149
|
+
spec: specOf6("column"),
|
|
150
|
+
fn: (accessor, paths, _texts, opts) => columnGeneric(paths, opts, (p) => stream(accessor, p))
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// src/commands/builtin/redis/comm.ts
|
|
154
|
+
import { ResourceName as ResourceName9, command as command7, specOf as specOf7, commGeneric } from "@struktoai/mirage-core";
|
|
155
|
+
var REDIS_COMM = command7({
|
|
156
|
+
name: "comm",
|
|
157
|
+
resource: ResourceName9.REDIS,
|
|
158
|
+
spec: specOf7("comm"),
|
|
159
|
+
fn: (accessor, paths, _texts, opts) => commGeneric(paths, opts, (p) => stream(accessor, p))
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// src/commands/builtin/redis/cp.ts
|
|
163
|
+
import {
|
|
164
|
+
IOResult,
|
|
165
|
+
ResourceName as ResourceName10,
|
|
166
|
+
command as command8,
|
|
167
|
+
cpGeneric,
|
|
168
|
+
specOf as specOf8
|
|
169
|
+
} from "@struktoai/mirage-core";
|
|
170
|
+
|
|
171
|
+
// src/core/redis/copy.ts
|
|
172
|
+
async function copy(accessor, src, dst) {
|
|
173
|
+
const s = norm(src.stripPrefix);
|
|
174
|
+
const d = norm(dst.stripPrefix);
|
|
175
|
+
const store = accessor.store;
|
|
176
|
+
const data = await store.getFile(s);
|
|
177
|
+
if (data === null) {
|
|
178
|
+
throw new Error(`file not found: ${s}`);
|
|
179
|
+
}
|
|
180
|
+
await store.setFile(d, data);
|
|
181
|
+
await store.setModified(d, nowIso());
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/core/redis/find.ts
|
|
185
|
+
import { rstripSlash } from "@struktoai/mirage-core";
|
|
186
|
+
import { buildTree, computeNonemptyDirs, keep } from "@struktoai/mirage-core";
|
|
187
|
+
async function find(accessor, path, options = {}) {
|
|
188
|
+
const p = norm(path.stripPrefix);
|
|
189
|
+
const store = accessor.store;
|
|
190
|
+
const prefix = rstripSlash(p) + "/";
|
|
191
|
+
const baseDepth = p === "/" ? 0 : (p.match(/\//g) ?? []).length;
|
|
192
|
+
const results = [];
|
|
193
|
+
const tree = options.tree ?? buildTree({
|
|
194
|
+
name: options.name,
|
|
195
|
+
iname: options.iname,
|
|
196
|
+
pathPattern: options.pathPattern,
|
|
197
|
+
type: options.type,
|
|
198
|
+
nameExclude: options.nameExclude,
|
|
199
|
+
orNames: options.orNames,
|
|
200
|
+
empty: options.empty
|
|
201
|
+
});
|
|
202
|
+
const empty = options.empty === true;
|
|
203
|
+
const allFiles = await store.listFiles();
|
|
204
|
+
const allDirs = await store.listDirs();
|
|
205
|
+
const nonempty = empty ? computeNonemptyDirs([...allFiles, ...[...allDirs].filter((k) => k !== "/")]) : /* @__PURE__ */ new Set();
|
|
206
|
+
const candidates = [];
|
|
207
|
+
if (options.type !== "d") {
|
|
208
|
+
for (const key of allFiles) candidates.push([key, "f"]);
|
|
209
|
+
}
|
|
210
|
+
if (options.type !== "f") {
|
|
211
|
+
for (const key of allDirs) {
|
|
212
|
+
if (key !== "/") candidates.push([key, "d"]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
for (const [key, kind] of candidates) {
|
|
216
|
+
if (key !== p && !key.startsWith(prefix)) continue;
|
|
217
|
+
const depth = (key.match(/\//g) ?? []).length - baseDepth;
|
|
218
|
+
if (options.maxDepth !== null && options.maxDepth !== void 0 && depth > options.maxDepth)
|
|
219
|
+
continue;
|
|
220
|
+
const basename = key.slice(key.lastIndexOf("/") + 1);
|
|
221
|
+
let isEmpty = null;
|
|
222
|
+
if (empty) {
|
|
223
|
+
isEmpty = kind === "f" ? await store.fileLen(key) === 0 : !nonempty.has(key);
|
|
224
|
+
}
|
|
225
|
+
if (!keep({ key, name: basename, kind, depth, isEmpty }, tree, options.minDepth)) continue;
|
|
226
|
+
if (kind === "f" && (options.minSize !== null && options.minSize !== void 0 || options.maxSize !== null && options.maxSize !== void 0)) {
|
|
227
|
+
const size = await store.fileLen(key);
|
|
228
|
+
if (options.minSize !== null && options.minSize !== void 0 && size < options.minSize)
|
|
229
|
+
continue;
|
|
230
|
+
if (options.maxSize !== null && options.maxSize !== void 0 && size > options.maxSize)
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
results.push(key);
|
|
234
|
+
}
|
|
235
|
+
results.sort();
|
|
236
|
+
return results;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/commands/builtin/redis/cp.ts
|
|
240
|
+
function cpCommand(accessor, paths, _texts, opts) {
|
|
241
|
+
if (paths.length < 2) {
|
|
242
|
+
return Promise.resolve([
|
|
243
|
+
null,
|
|
244
|
+
new IOResult({ exitCode: 1, stderr: new TextEncoder().encode("cp: missing operand\n") })
|
|
245
|
+
]);
|
|
246
|
+
}
|
|
247
|
+
const recursive = opts.flags.r === true || opts.flags.R === true || opts.flags.a === true;
|
|
248
|
+
return cpGeneric(
|
|
249
|
+
paths,
|
|
250
|
+
(src, target) => copy(accessor, src, target),
|
|
251
|
+
(src, options) => find(accessor, src, options),
|
|
252
|
+
(p) => stat(accessor, p),
|
|
253
|
+
recursive,
|
|
254
|
+
opts.flags.n === true,
|
|
255
|
+
opts.flags.v === true,
|
|
256
|
+
opts.index ?? void 0
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
var REDIS_CP = command8({
|
|
260
|
+
name: "cp",
|
|
261
|
+
resource: ResourceName10.REDIS,
|
|
262
|
+
spec: specOf8("cp"),
|
|
263
|
+
fn: cpCommand,
|
|
264
|
+
write: true
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// src/commands/builtin/redis/csplit.ts
|
|
268
|
+
import { ResourceName as ResourceName12, command as command9, specOf as specOf9, csplitGeneric } from "@struktoai/mirage-core";
|
|
269
|
+
|
|
270
|
+
// src/core/redis/write.ts
|
|
271
|
+
import { record as record2, ResourceName as ResourceName11 } from "@struktoai/mirage-core";
|
|
272
|
+
async function writeBytes(accessor, path, data) {
|
|
273
|
+
const start = performance.now();
|
|
274
|
+
const p = norm(path.stripPrefix);
|
|
275
|
+
const par = parent(p);
|
|
276
|
+
const store = accessor.store;
|
|
277
|
+
if (par !== "/" && !await store.hasDir(par)) {
|
|
278
|
+
throw new Error(`parent directory does not exist: ${par}`);
|
|
279
|
+
}
|
|
280
|
+
await store.setFile(p, data);
|
|
281
|
+
await store.setModified(p, nowIso());
|
|
282
|
+
record2("write", p, ResourceName11.REDIS, data.byteLength, start);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// src/commands/builtin/redis/csplit.ts
|
|
286
|
+
var REDIS_CSPLIT = command9({
|
|
287
|
+
name: "csplit",
|
|
288
|
+
resource: ResourceName12.REDIS,
|
|
289
|
+
spec: specOf9("csplit"),
|
|
290
|
+
fn: (accessor, paths, texts, opts) => csplitGeneric(
|
|
291
|
+
paths,
|
|
292
|
+
texts,
|
|
293
|
+
opts,
|
|
294
|
+
(p) => stream(accessor, p),
|
|
295
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
296
|
+
),
|
|
297
|
+
write: true
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// src/commands/builtin/redis/cut/cut.ts
|
|
301
|
+
import { ResourceName as ResourceName13, command as command10, cutGeneric, specOf as specOf10 } from "@struktoai/mirage-core";
|
|
302
|
+
var REDIS_CUT = command10({
|
|
303
|
+
name: "cut",
|
|
304
|
+
resource: ResourceName13.REDIS,
|
|
305
|
+
spec: specOf10("cut"),
|
|
306
|
+
fn: (accessor, paths, _texts, opts) => cutGeneric(paths, opts, (p) => stream(accessor, p))
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// src/commands/builtin/redis/diff.ts
|
|
310
|
+
import { ResourceName as ResourceName14, command as command11, diffGeneric, specOf as specOf11 } from "@struktoai/mirage-core";
|
|
311
|
+
var REDIS_DIFF = command11({
|
|
312
|
+
name: "diff",
|
|
313
|
+
resource: ResourceName14.REDIS,
|
|
314
|
+
spec: specOf11("diff"),
|
|
315
|
+
fn: (accessor, paths, _texts, opts) => diffGeneric(paths, opts, (p) => stream(accessor, p))
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
// src/commands/builtin/redis/dirname.ts
|
|
319
|
+
import { ResourceName as ResourceName15, command as command12, specOf as specOf12, dirnameFn } from "@struktoai/mirage-core";
|
|
320
|
+
var REDIS_DIRNAME = command12({
|
|
321
|
+
name: "dirname",
|
|
322
|
+
resource: ResourceName15.REDIS,
|
|
323
|
+
spec: specOf12("dirname"),
|
|
324
|
+
fn: dirnameFn
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// src/commands/builtin/redis/du.ts
|
|
328
|
+
import { ResourceName as ResourceName16, command as command13, duGeneric, specOf as specOf13 } from "@struktoai/mirage-core";
|
|
329
|
+
|
|
330
|
+
// src/core/redis/du.ts
|
|
331
|
+
import { rstripSlash as rstripSlash2 } from "@struktoai/mirage-core";
|
|
332
|
+
async function du(accessor, path) {
|
|
333
|
+
const p = norm(path.stripPrefix);
|
|
334
|
+
const store = accessor.store;
|
|
335
|
+
const prefix = rstripSlash2(p) + "/";
|
|
336
|
+
let total = 0;
|
|
337
|
+
for (const key of await store.listFiles()) {
|
|
338
|
+
if (key === p || key.startsWith(prefix)) {
|
|
339
|
+
total += await store.fileLen(key);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return total;
|
|
343
|
+
}
|
|
344
|
+
async function duAll(accessor, path) {
|
|
345
|
+
const p = norm(path.stripPrefix);
|
|
346
|
+
const store = accessor.store;
|
|
347
|
+
const prefix = rstripSlash2(p) + "/";
|
|
348
|
+
const entries = [];
|
|
349
|
+
let total = 0;
|
|
350
|
+
for (const key of await store.listFiles()) {
|
|
351
|
+
if (key === p || key.startsWith(prefix)) {
|
|
352
|
+
const size = await store.fileLen(key);
|
|
353
|
+
entries.push([key, size]);
|
|
354
|
+
total += size;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return { entries, total };
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// src/commands/builtin/redis/du.ts
|
|
361
|
+
var REDIS_DU = command13({
|
|
362
|
+
name: "du",
|
|
363
|
+
resource: ResourceName16.REDIS,
|
|
364
|
+
spec: specOf13("du"),
|
|
365
|
+
fn: (accessor, paths, _texts, opts) => duGeneric(
|
|
366
|
+
paths,
|
|
367
|
+
opts,
|
|
368
|
+
(p) => du(accessor, p),
|
|
369
|
+
async (p) => {
|
|
370
|
+
const { entries, total } = await duAll(accessor, p);
|
|
371
|
+
return [entries, total];
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
// src/commands/builtin/redis/expand.ts
|
|
377
|
+
import { ResourceName as ResourceName17, command as command14, specOf as specOf14, expandGeneric } from "@struktoai/mirage-core";
|
|
378
|
+
var REDIS_EXPAND = command14({
|
|
379
|
+
name: "expand",
|
|
380
|
+
resource: ResourceName17.REDIS,
|
|
381
|
+
spec: specOf14("expand"),
|
|
382
|
+
fn: (accessor, paths, _texts, opts) => expandGeneric(paths, opts, (p) => stream(accessor, p))
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
// src/commands/builtin/redis/file/file.ts
|
|
386
|
+
import { ResourceName as ResourceName18, command as command15, fileGeneric, specOf as specOf15 } from "@struktoai/mirage-core";
|
|
387
|
+
var REDIS_FILE = command15({
|
|
388
|
+
name: "file",
|
|
389
|
+
resource: ResourceName18.REDIS,
|
|
390
|
+
spec: specOf15("file"),
|
|
391
|
+
fn: (accessor, paths, _texts, opts) => fileGeneric(
|
|
392
|
+
paths,
|
|
393
|
+
opts,
|
|
394
|
+
(p) => stat(accessor, p),
|
|
395
|
+
(p) => read(accessor, p)
|
|
396
|
+
)
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// src/commands/builtin/redis/find.ts
|
|
400
|
+
import { ResourceName as ResourceName19, command as command16, findGeneric, specOf as specOf16 } from "@struktoai/mirage-core";
|
|
401
|
+
var REDIS_FIND = command16({
|
|
402
|
+
name: "find",
|
|
403
|
+
resource: ResourceName19.REDIS,
|
|
404
|
+
spec: specOf16("find"),
|
|
405
|
+
fn: (accessor, paths, texts, opts) => findGeneric(paths, texts, opts, (root, options) => find(accessor, root, options))
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
// src/commands/builtin/redis/fmt.ts
|
|
409
|
+
import {
|
|
410
|
+
ResourceName as ResourceName20,
|
|
411
|
+
command as command17,
|
|
412
|
+
fmtGeneric,
|
|
413
|
+
specOf as specOf17
|
|
414
|
+
} from "@struktoai/mirage-core";
|
|
415
|
+
async function fmtCommand(accessor, paths, _texts, opts) {
|
|
416
|
+
return fmtGeneric(paths, opts, (p) => stream(accessor, p));
|
|
417
|
+
}
|
|
418
|
+
var REDIS_FMT = command17({
|
|
419
|
+
name: "fmt",
|
|
420
|
+
resource: ResourceName20.REDIS,
|
|
421
|
+
spec: specOf17("fmt"),
|
|
422
|
+
fn: fmtCommand
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
// src/commands/builtin/redis/fold.ts
|
|
426
|
+
import { ResourceName as ResourceName21, command as command18, specOf as specOf18, foldGeneric } from "@struktoai/mirage-core";
|
|
427
|
+
var REDIS_FOLD = command18({
|
|
428
|
+
name: "fold",
|
|
429
|
+
resource: ResourceName21.REDIS,
|
|
430
|
+
spec: specOf18("fold"),
|
|
431
|
+
fn: (accessor, paths, _texts, opts) => foldGeneric(paths, opts, (p) => stream(accessor, p))
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
// src/commands/builtin/redis/grep/grep.ts
|
|
435
|
+
import { ResourceName as ResourceName22, command as command19, grepGeneric, prefixAggregate, specOf as specOf19 } from "@struktoai/mirage-core";
|
|
436
|
+
|
|
437
|
+
// src/core/redis/readdir.ts
|
|
438
|
+
import "@struktoai/mirage-core";
|
|
439
|
+
import { enotdir } from "@struktoai/mirage-core";
|
|
440
|
+
|
|
441
|
+
// src/core/redis/entry.ts
|
|
442
|
+
import { IndexEntry } from "@struktoai/mirage-core";
|
|
443
|
+
var RedisResourceType = Object.freeze({
|
|
444
|
+
FILE: "file",
|
|
445
|
+
FOLDER: "folder"
|
|
446
|
+
});
|
|
447
|
+
var RedisIndexEntry = class _RedisIndexEntry extends IndexEntry {
|
|
448
|
+
static file(path, size = 0) {
|
|
449
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
450
|
+
return new _RedisIndexEntry({
|
|
451
|
+
id: path,
|
|
452
|
+
name,
|
|
453
|
+
resourceType: RedisResourceType.FILE,
|
|
454
|
+
vfsName: name,
|
|
455
|
+
size
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
static folder(path) {
|
|
459
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
460
|
+
return new _RedisIndexEntry({
|
|
461
|
+
id: path,
|
|
462
|
+
name,
|
|
463
|
+
resourceType: RedisResourceType.FOLDER,
|
|
464
|
+
vfsName: name
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
// src/core/redis/readdir.ts
|
|
470
|
+
async function readdir(accessor, path, index) {
|
|
471
|
+
const virtual = path.pattern !== null ? path.directory : path.stripPrefix;
|
|
472
|
+
const mountPrefix = path.prefix;
|
|
473
|
+
const virtualKey = mountPrefix + virtual;
|
|
474
|
+
if (index !== void 0) {
|
|
475
|
+
const cached = await index.listDir(virtualKey);
|
|
476
|
+
if (cached.entries !== void 0 && cached.entries !== null) {
|
|
477
|
+
return cached.entries;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
const store = accessor.store;
|
|
481
|
+
const p = norm(virtual);
|
|
482
|
+
if (!await store.hasDir(p)) {
|
|
483
|
+
throw enotdir(path);
|
|
484
|
+
}
|
|
485
|
+
const dirPrefix = p === "/" ? "/" : `${p}/`;
|
|
486
|
+
const seen = /* @__PURE__ */ new Set();
|
|
487
|
+
const files = await store.listFiles();
|
|
488
|
+
const dirs = await store.listDirs();
|
|
489
|
+
for (const key of [...files, ...dirs]) {
|
|
490
|
+
if (key === p) continue;
|
|
491
|
+
if (!key.startsWith(dirPrefix)) continue;
|
|
492
|
+
const remainder = key.slice(dirPrefix.length);
|
|
493
|
+
const first = remainder.split("/")[0];
|
|
494
|
+
if (first !== void 0 && first.length > 0) seen.add(dirPrefix + first);
|
|
495
|
+
}
|
|
496
|
+
const sorted = [...seen].sort();
|
|
497
|
+
const virtualEntries = sorted.map((entry) => `${mountPrefix}${entry}`);
|
|
498
|
+
if (index !== void 0) {
|
|
499
|
+
const fileSet = new Set(files);
|
|
500
|
+
const entries = sorted.map((e) => {
|
|
501
|
+
const name = e.slice(e.lastIndexOf("/") + 1);
|
|
502
|
+
return [name, fileSet.has(e) ? RedisIndexEntry.file(e) : RedisIndexEntry.folder(e)];
|
|
503
|
+
});
|
|
504
|
+
await index.setDir(virtualKey, entries);
|
|
505
|
+
}
|
|
506
|
+
return virtualEntries;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/commands/builtin/redis/grep/grep.ts
|
|
510
|
+
var REDIS_GREP = command19({
|
|
511
|
+
name: "grep",
|
|
512
|
+
resource: ResourceName22.REDIS,
|
|
513
|
+
spec: specOf19("grep"),
|
|
514
|
+
fn: (accessor, paths, texts, opts) => grepGeneric(
|
|
515
|
+
"grep",
|
|
516
|
+
paths,
|
|
517
|
+
texts,
|
|
518
|
+
opts,
|
|
519
|
+
(p) => stat(accessor, p),
|
|
520
|
+
(p) => readdir(accessor, p),
|
|
521
|
+
(p) => stream(accessor, p)
|
|
522
|
+
),
|
|
523
|
+
aggregate: prefixAggregate
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
// src/commands/builtin/redis/gunzip.ts
|
|
527
|
+
import { ResourceName as ResourceName23, command as command20, specOf as specOf20, gunzipGeneric } from "@struktoai/mirage-core";
|
|
528
|
+
|
|
529
|
+
// src/core/redis/unlink.ts
|
|
530
|
+
async function unlink(accessor, path) {
|
|
531
|
+
const p = norm(path.stripPrefix);
|
|
532
|
+
const store = accessor.store;
|
|
533
|
+
if (!await store.hasFile(p)) {
|
|
534
|
+
throw new Error(`file not found: ${p}`);
|
|
535
|
+
}
|
|
536
|
+
await store.delFile(p);
|
|
537
|
+
await store.delModified(p);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// src/commands/builtin/redis/gunzip.ts
|
|
541
|
+
var REDIS_GUNZIP = command20({
|
|
542
|
+
name: "gunzip",
|
|
543
|
+
resource: ResourceName23.REDIS,
|
|
544
|
+
spec: specOf20("gunzip"),
|
|
545
|
+
fn: (accessor, paths, _texts, opts) => gunzipGeneric(
|
|
546
|
+
paths,
|
|
547
|
+
opts,
|
|
548
|
+
(p) => stream(accessor, p),
|
|
549
|
+
(p, d) => writeBytes(accessor, p, d),
|
|
550
|
+
(p) => unlink(accessor, p)
|
|
551
|
+
),
|
|
552
|
+
write: true
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// src/commands/builtin/redis/gzip.ts
|
|
556
|
+
import { ResourceName as ResourceName24, command as command21, specOf as specOf21, gzipGeneric } from "@struktoai/mirage-core";
|
|
557
|
+
var REDIS_GZIP = command21({
|
|
558
|
+
name: "gzip",
|
|
559
|
+
resource: ResourceName24.REDIS,
|
|
560
|
+
spec: specOf21("gzip"),
|
|
561
|
+
fn: (accessor, paths, _texts, opts) => gzipGeneric(
|
|
562
|
+
paths,
|
|
563
|
+
opts,
|
|
564
|
+
(p) => stream(accessor, p),
|
|
565
|
+
(p, d) => writeBytes(accessor, p, d),
|
|
566
|
+
(p) => unlink(accessor, p)
|
|
567
|
+
),
|
|
568
|
+
write: true
|
|
569
|
+
});
|
|
570
|
+
|
|
571
|
+
// src/commands/builtin/redis/head/head.ts
|
|
572
|
+
import {
|
|
573
|
+
ResourceName as ResourceName25,
|
|
574
|
+
command as command22,
|
|
575
|
+
headGeneric,
|
|
576
|
+
headProvisionGeneric,
|
|
577
|
+
headerAggregate,
|
|
578
|
+
specOf as specOf22
|
|
579
|
+
} from "@struktoai/mirage-core";
|
|
580
|
+
var REDIS_HEAD = command22({
|
|
581
|
+
name: "head",
|
|
582
|
+
resource: ResourceName25.REDIS,
|
|
583
|
+
spec: specOf22("head"),
|
|
584
|
+
fn: (accessor, paths, texts, opts) => headGeneric(
|
|
585
|
+
paths,
|
|
586
|
+
texts,
|
|
587
|
+
opts,
|
|
588
|
+
(p) => stat(accessor, p),
|
|
589
|
+
(p) => stream(accessor, p)
|
|
590
|
+
),
|
|
591
|
+
provision: (accessor, paths, texts, opts) => headProvisionGeneric(paths, texts, opts, (p) => stat(accessor, p)),
|
|
592
|
+
aggregate: headerAggregate
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
// src/commands/builtin/redis/iconv.ts
|
|
596
|
+
import { ResourceName as ResourceName26, command as command23, specOf as specOf23, iconvGeneric } from "@struktoai/mirage-core";
|
|
597
|
+
var REDIS_ICONV = command23({
|
|
598
|
+
name: "iconv",
|
|
599
|
+
resource: ResourceName26.REDIS,
|
|
600
|
+
spec: specOf23("iconv"),
|
|
601
|
+
fn: (accessor, paths, _texts, opts) => iconvGeneric(
|
|
602
|
+
paths,
|
|
603
|
+
opts,
|
|
604
|
+
(p) => stream(accessor, p),
|
|
605
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
606
|
+
),
|
|
607
|
+
write: true
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// src/commands/builtin/redis/join.ts
|
|
611
|
+
import { ResourceName as ResourceName27, command as command24, specOf as specOf24, joinGeneric } from "@struktoai/mirage-core";
|
|
612
|
+
var REDIS_JOIN = command24({
|
|
613
|
+
name: "join",
|
|
614
|
+
resource: ResourceName27.REDIS,
|
|
615
|
+
spec: specOf24("join"),
|
|
616
|
+
fn: (accessor, paths, _texts, opts) => joinGeneric(paths, opts, (p) => stream(accessor, p))
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
// src/commands/builtin/redis/jq.ts
|
|
620
|
+
import {
|
|
621
|
+
ResourceName as ResourceName28,
|
|
622
|
+
command as command25,
|
|
623
|
+
jqGeneric,
|
|
624
|
+
jqProvisionGeneric,
|
|
625
|
+
specOf as specOf25
|
|
626
|
+
} from "@struktoai/mirage-core";
|
|
627
|
+
var REDIS_JQ = command25({
|
|
628
|
+
name: "jq",
|
|
629
|
+
resource: ResourceName28.REDIS,
|
|
630
|
+
spec: specOf25("jq"),
|
|
631
|
+
fn: (accessor, paths, texts, opts) => jqGeneric(paths, texts, opts, (p) => stream(accessor, p)),
|
|
632
|
+
provision: (accessor, paths, texts, _opts) => jqProvisionGeneric(paths, texts, (p) => stat(accessor, p))
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
// src/commands/builtin/redis/ln.ts
|
|
636
|
+
import {
|
|
637
|
+
IOResult as IOResult2,
|
|
638
|
+
ResourceName as ResourceName29,
|
|
639
|
+
command as command26,
|
|
640
|
+
materialize,
|
|
641
|
+
specOf as specOf26
|
|
642
|
+
} from "@struktoai/mirage-core";
|
|
643
|
+
|
|
644
|
+
// src/core/redis/exists.ts
|
|
645
|
+
async function exists(accessor, path) {
|
|
646
|
+
const p = norm(path.stripPrefix);
|
|
647
|
+
const store = accessor.store;
|
|
648
|
+
return await store.hasFile(p) || await store.hasDir(p);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// src/commands/builtin/redis/ln.ts
|
|
652
|
+
var ENC = new TextEncoder();
|
|
653
|
+
async function lnCommand(accessor, paths, texts, opts) {
|
|
654
|
+
if (paths.length < 2) {
|
|
655
|
+
return [
|
|
656
|
+
null,
|
|
657
|
+
new IOResult2({ exitCode: 1, stderr: ENC.encode("ln: usage: ln [-s] [-f] source dest\n") })
|
|
658
|
+
];
|
|
659
|
+
}
|
|
660
|
+
const source = paths[0];
|
|
661
|
+
const dest = paths[1];
|
|
662
|
+
if (source === void 0 || dest === void 0) return [null, new IOResult2()];
|
|
663
|
+
if (opts.flags.n === true && await exists(accessor, dest)) {
|
|
664
|
+
return [null, new IOResult2()];
|
|
665
|
+
}
|
|
666
|
+
const data = await materialize(stream(accessor, source));
|
|
667
|
+
await writeBytes(accessor, dest, data);
|
|
668
|
+
const out = opts.flags.v === true ? ENC.encode(`'${source.original}' -> '${dest.original}'
|
|
669
|
+
`) : null;
|
|
670
|
+
return [out, new IOResult2({ writes: { [dest.stripPrefix]: data } })];
|
|
671
|
+
}
|
|
672
|
+
var REDIS_LN = command26({
|
|
673
|
+
name: "ln",
|
|
674
|
+
resource: ResourceName29.REDIS,
|
|
675
|
+
spec: specOf26("ln"),
|
|
676
|
+
fn: lnCommand,
|
|
677
|
+
write: true
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// src/commands/builtin/redis/look.ts
|
|
681
|
+
import { ResourceName as ResourceName30, command as command27, specOf as specOf27, lookGeneric } from "@struktoai/mirage-core";
|
|
682
|
+
var REDIS_LOOK = command27({
|
|
683
|
+
name: "look",
|
|
684
|
+
resource: ResourceName30.REDIS,
|
|
685
|
+
spec: specOf27("look"),
|
|
686
|
+
fn: (accessor, paths, texts, opts) => lookGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// src/commands/builtin/redis/ls/ls.ts
|
|
690
|
+
import { ResourceName as ResourceName31, command as command28, lsGeneric, specOf as specOf28 } from "@struktoai/mirage-core";
|
|
691
|
+
var REDIS_LS = command28({
|
|
692
|
+
name: "ls",
|
|
693
|
+
resource: ResourceName31.REDIS,
|
|
694
|
+
spec: specOf28("ls"),
|
|
695
|
+
fn: (accessor, paths, _texts, opts) => lsGeneric(
|
|
696
|
+
paths,
|
|
697
|
+
opts,
|
|
698
|
+
(p) => readdir(accessor, p),
|
|
699
|
+
(p) => stat(accessor, p)
|
|
700
|
+
)
|
|
701
|
+
});
|
|
702
|
+
|
|
703
|
+
// src/commands/builtin/redis/md5.ts
|
|
704
|
+
import { ResourceName as ResourceName32, command as command29, specOf as specOf29, md5Generic } from "@struktoai/mirage-core";
|
|
705
|
+
var REDIS_MD5 = command29({
|
|
706
|
+
name: "md5",
|
|
707
|
+
resource: ResourceName32.REDIS,
|
|
708
|
+
spec: specOf29("md5"),
|
|
709
|
+
fn: (accessor, paths, _texts, opts) => md5Generic(paths, opts, (p) => stream(accessor, p))
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
// src/commands/builtin/redis/mkdir.ts
|
|
713
|
+
import {
|
|
714
|
+
IOResult as IOResult3,
|
|
715
|
+
ResourceName as ResourceName33,
|
|
716
|
+
command as command30,
|
|
717
|
+
specOf as specOf30
|
|
718
|
+
} from "@struktoai/mirage-core";
|
|
719
|
+
|
|
720
|
+
// src/core/redis/mkdir.ts
|
|
721
|
+
import { stripSlash } from "@struktoai/mirage-core";
|
|
722
|
+
async function mkdir(accessor, path, parents = false) {
|
|
723
|
+
const p = norm(path.stripPrefix);
|
|
724
|
+
const store = accessor.store;
|
|
725
|
+
if (parents) {
|
|
726
|
+
const parts = stripSlash(p).split("/");
|
|
727
|
+
let current = "";
|
|
728
|
+
const now = nowIso();
|
|
729
|
+
for (const part of parts) {
|
|
730
|
+
current += `/${part}`;
|
|
731
|
+
await store.addDir(current);
|
|
732
|
+
const mod = await store.getModified(current);
|
|
733
|
+
if (mod === null) {
|
|
734
|
+
await store.setModified(current, now);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
const par = parent(p);
|
|
740
|
+
if (par !== "/" && !await store.hasDir(par)) {
|
|
741
|
+
throw new Error(`parent directory does not exist: ${par}`);
|
|
742
|
+
}
|
|
743
|
+
await store.addDir(p);
|
|
744
|
+
await store.setModified(p, nowIso());
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// src/commands/builtin/redis/mkdir.ts
|
|
748
|
+
async function mkdirCommand(accessor, paths, texts, opts) {
|
|
749
|
+
const parents = opts.flags.p === true;
|
|
750
|
+
if (paths.length === 0) {
|
|
751
|
+
return [
|
|
752
|
+
null,
|
|
753
|
+
new IOResult3({
|
|
754
|
+
exitCode: 1,
|
|
755
|
+
stderr: new TextEncoder().encode("mkdir: missing operand\n")
|
|
756
|
+
})
|
|
757
|
+
];
|
|
758
|
+
}
|
|
759
|
+
for (const p of paths) {
|
|
760
|
+
await mkdir(accessor, p, parents);
|
|
761
|
+
}
|
|
762
|
+
return [null, new IOResult3()];
|
|
763
|
+
}
|
|
764
|
+
var REDIS_MKDIR = command30({
|
|
765
|
+
name: "mkdir",
|
|
766
|
+
resource: ResourceName33.REDIS,
|
|
767
|
+
spec: specOf30("mkdir"),
|
|
768
|
+
fn: mkdirCommand,
|
|
769
|
+
write: true
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
// src/commands/builtin/redis/mktemp.ts
|
|
773
|
+
import { ResourceName as ResourceName34, command as command31, mktempGeneric, specOf as specOf31 } from "@struktoai/mirage-core";
|
|
774
|
+
var REDIS_MKTEMP = command31({
|
|
775
|
+
name: "mktemp",
|
|
776
|
+
resource: ResourceName34.REDIS,
|
|
777
|
+
spec: specOf31("mktemp"),
|
|
778
|
+
fn: (accessor, _paths, texts, opts) => mktempGeneric(
|
|
779
|
+
texts,
|
|
780
|
+
opts,
|
|
781
|
+
(p, parents) => mkdir(accessor, p, parents),
|
|
782
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
783
|
+
),
|
|
784
|
+
write: true
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
// src/commands/builtin/redis/mv.ts
|
|
788
|
+
import {
|
|
789
|
+
IOResult as IOResult4,
|
|
790
|
+
ResourceName as ResourceName35,
|
|
791
|
+
command as command32,
|
|
792
|
+
mvGeneric,
|
|
793
|
+
specOf as specOf32
|
|
794
|
+
} from "@struktoai/mirage-core";
|
|
795
|
+
|
|
796
|
+
// src/core/redis/rename.ts
|
|
797
|
+
import { rstripSlash as rstripSlash3 } from "@struktoai/mirage-core";
|
|
798
|
+
async function rename(accessor, src, dst) {
|
|
799
|
+
const s = norm(src.stripPrefix);
|
|
800
|
+
const d = norm(dst.stripPrefix);
|
|
801
|
+
const now = nowIso();
|
|
802
|
+
const store = accessor.store;
|
|
803
|
+
if (await store.hasFile(s)) {
|
|
804
|
+
const data = await store.getFile(s);
|
|
805
|
+
const mod = await store.getModified(s);
|
|
806
|
+
if (data === null) throw new Error(`file not found: ${s}`);
|
|
807
|
+
await store.delFile(s);
|
|
808
|
+
await store.delModified(s);
|
|
809
|
+
await store.setFile(d, data);
|
|
810
|
+
await store.setModified(d, mod ?? now);
|
|
811
|
+
return;
|
|
812
|
+
}
|
|
813
|
+
if (await store.hasDir(s)) {
|
|
814
|
+
const mod = await store.getModified(s);
|
|
815
|
+
await store.removeDir(s);
|
|
816
|
+
await store.delModified(s);
|
|
817
|
+
await store.addDir(d);
|
|
818
|
+
await store.setModified(d, mod ?? now);
|
|
819
|
+
const prefix = rstripSlash3(s) + "/";
|
|
820
|
+
const dPrefix = rstripSlash3(d) + "/";
|
|
821
|
+
const files = await store.listFiles();
|
|
822
|
+
for (const key of files) {
|
|
823
|
+
if (key.startsWith(prefix)) {
|
|
824
|
+
const newKey = dPrefix + key.slice(prefix.length);
|
|
825
|
+
const data = await store.getFile(key);
|
|
826
|
+
if (data === null) continue;
|
|
827
|
+
await store.delFile(key);
|
|
828
|
+
await store.setFile(newKey, data);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
throw new Error(`file not found: ${s}`);
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
// src/commands/builtin/redis/mv.ts
|
|
837
|
+
function mvCommand(accessor, paths, _texts, opts) {
|
|
838
|
+
if (paths.length < 2) {
|
|
839
|
+
return Promise.resolve([
|
|
840
|
+
null,
|
|
841
|
+
new IOResult4({ exitCode: 1, stderr: new TextEncoder().encode("mv: missing operand\n") })
|
|
842
|
+
]);
|
|
843
|
+
}
|
|
844
|
+
return mvGeneric(
|
|
845
|
+
paths,
|
|
846
|
+
(src, target) => rename(accessor, src, target),
|
|
847
|
+
(p) => stat(accessor, p),
|
|
848
|
+
opts.flags.n === true,
|
|
849
|
+
opts.flags.v === true,
|
|
850
|
+
opts.index ?? void 0
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
var REDIS_MV = command32({
|
|
854
|
+
name: "mv",
|
|
855
|
+
resource: ResourceName35.REDIS,
|
|
856
|
+
spec: specOf32("mv"),
|
|
857
|
+
fn: mvCommand,
|
|
858
|
+
write: true
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
// src/commands/builtin/redis/nl.ts
|
|
862
|
+
import { ResourceName as ResourceName36, command as command33, specOf as specOf33, nlGeneric } from "@struktoai/mirage-core";
|
|
863
|
+
var REDIS_NL = command33({
|
|
864
|
+
name: "nl",
|
|
865
|
+
resource: ResourceName36.REDIS,
|
|
866
|
+
spec: specOf33("nl"),
|
|
867
|
+
fn: (accessor, paths, _texts, opts) => nlGeneric(paths, opts, (p) => stream(accessor, p))
|
|
868
|
+
});
|
|
869
|
+
|
|
870
|
+
// src/commands/builtin/redis/paste.ts
|
|
871
|
+
import { ResourceName as ResourceName37, command as command34, specOf as specOf34, pasteGeneric } from "@struktoai/mirage-core";
|
|
872
|
+
var REDIS_PASTE = command34({
|
|
873
|
+
name: "paste",
|
|
874
|
+
resource: ResourceName37.REDIS,
|
|
875
|
+
spec: specOf34("paste"),
|
|
876
|
+
fn: (accessor, paths, _texts, opts) => pasteGeneric(paths, opts, (p) => stream(accessor, p))
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
// src/commands/builtin/redis/patch.ts
|
|
880
|
+
import { ResourceName as ResourceName38, command as command35, specOf as specOf35, patchGeneric } from "@struktoai/mirage-core";
|
|
881
|
+
var REDIS_PATCH = command35({
|
|
882
|
+
name: "patch",
|
|
883
|
+
resource: ResourceName38.REDIS,
|
|
884
|
+
spec: specOf35("patch"),
|
|
885
|
+
fn: (accessor, paths, _texts, opts) => patchGeneric(
|
|
886
|
+
paths,
|
|
887
|
+
opts,
|
|
888
|
+
(p) => stream(accessor, p),
|
|
889
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
890
|
+
),
|
|
891
|
+
write: true
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
// src/commands/builtin/redis/readlink.ts
|
|
895
|
+
import {
|
|
896
|
+
ResourceName as ResourceName39,
|
|
897
|
+
command as command36,
|
|
898
|
+
readlinkGeneric,
|
|
899
|
+
specOf as specOf36
|
|
900
|
+
} from "@struktoai/mirage-core";
|
|
901
|
+
var REDIS_READLINK = command36({
|
|
902
|
+
name: "readlink",
|
|
903
|
+
resource: ResourceName39.REDIS,
|
|
904
|
+
spec: specOf36("readlink"),
|
|
905
|
+
fn: (_accessor, paths, texts, opts) => readlinkGeneric(paths, texts, opts)
|
|
906
|
+
});
|
|
907
|
+
|
|
908
|
+
// src/commands/builtin/redis/realpath.ts
|
|
909
|
+
import { ResourceName as ResourceName40, command as command37, realpathGeneric, specOf as specOf37 } from "@struktoai/mirage-core";
|
|
910
|
+
var REDIS_REALPATH = command37({
|
|
911
|
+
name: "realpath",
|
|
912
|
+
resource: ResourceName40.REDIS,
|
|
913
|
+
spec: specOf37("realpath"),
|
|
914
|
+
fn: (accessor, paths, texts, opts) => realpathGeneric(paths, texts, opts, (p) => stat(accessor, p))
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
// src/commands/builtin/redis/rev.ts
|
|
918
|
+
import { ResourceName as ResourceName41, command as command38, specOf as specOf38, revGeneric } from "@struktoai/mirage-core";
|
|
919
|
+
var REDIS_REV = command38({
|
|
920
|
+
name: "rev",
|
|
921
|
+
resource: ResourceName41.REDIS,
|
|
922
|
+
spec: specOf38("rev"),
|
|
923
|
+
fn: (accessor, paths, _texts, opts) => revGeneric(paths, opts, (p) => stream(accessor, p))
|
|
924
|
+
});
|
|
925
|
+
|
|
926
|
+
// src/commands/builtin/redis/rg.ts
|
|
927
|
+
import { ResourceName as ResourceName42, command as command39, rgGeneric, specOf as specOf39 } from "@struktoai/mirage-core";
|
|
928
|
+
var REDIS_RG = command39({
|
|
929
|
+
name: "rg",
|
|
930
|
+
resource: ResourceName42.REDIS,
|
|
931
|
+
spec: specOf39("rg"),
|
|
932
|
+
fn: (accessor, paths, texts, opts) => rgGeneric(
|
|
933
|
+
paths,
|
|
934
|
+
texts,
|
|
935
|
+
opts,
|
|
936
|
+
(p) => stat(accessor, p),
|
|
937
|
+
(p) => readdir(accessor, p),
|
|
938
|
+
(p) => stream(accessor, p)
|
|
939
|
+
)
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
// src/commands/builtin/redis/rm.ts
|
|
943
|
+
import {
|
|
944
|
+
FileType as FileType2,
|
|
945
|
+
IOResult as IOResult5,
|
|
946
|
+
ResourceName as ResourceName43,
|
|
947
|
+
command as command40,
|
|
948
|
+
specOf as specOf40
|
|
949
|
+
} from "@struktoai/mirage-core";
|
|
950
|
+
|
|
951
|
+
// src/core/redis/rmdir.ts
|
|
952
|
+
import { rstripSlash as rstripSlash4 } from "@struktoai/mirage-core";
|
|
953
|
+
async function rmdir(accessor, path) {
|
|
954
|
+
const p = norm(path.stripPrefix);
|
|
955
|
+
const store = accessor.store;
|
|
956
|
+
if (!await store.hasDir(p)) {
|
|
957
|
+
throw new Error(`not a directory: ${p}`);
|
|
958
|
+
}
|
|
959
|
+
const prefix = rstripSlash4(p) + "/";
|
|
960
|
+
const files = await store.listFiles();
|
|
961
|
+
const dirs = await store.listDirs();
|
|
962
|
+
const candidates = [...files, ...dirs];
|
|
963
|
+
for (const k of candidates) {
|
|
964
|
+
if (k !== p && k.startsWith(prefix)) {
|
|
965
|
+
throw new Error(`directory not empty: ${p}`);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
await store.removeDir(p);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
// src/core/redis/rm.ts
|
|
972
|
+
import { rstripSlash as rstripSlash5 } from "@struktoai/mirage-core";
|
|
973
|
+
async function rmR(accessor, path) {
|
|
974
|
+
const p = norm(path.stripPrefix);
|
|
975
|
+
const store = accessor.store;
|
|
976
|
+
const prefix = rstripSlash5(p) + "/";
|
|
977
|
+
const files = await store.listFiles();
|
|
978
|
+
for (const key of files) {
|
|
979
|
+
if (key === p || key.startsWith(prefix)) {
|
|
980
|
+
await store.delFile(key);
|
|
981
|
+
await store.delModified(key);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
const dirs = await store.listDirs();
|
|
985
|
+
for (const key of dirs) {
|
|
986
|
+
if (key === p || key.startsWith(prefix)) {
|
|
987
|
+
await store.removeDir(key);
|
|
988
|
+
await store.delModified(key);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// src/commands/builtin/redis/rm.ts
|
|
994
|
+
async function rmCommand(accessor, paths, texts, opts) {
|
|
995
|
+
if (paths.length === 0) {
|
|
996
|
+
return [
|
|
997
|
+
null,
|
|
998
|
+
new IOResult5({
|
|
999
|
+
exitCode: 1,
|
|
1000
|
+
stderr: new TextEncoder().encode("rm: missing operand\n")
|
|
1001
|
+
})
|
|
1002
|
+
];
|
|
1003
|
+
}
|
|
1004
|
+
const recursive = opts.flags.r === true || opts.flags.R === true;
|
|
1005
|
+
for (const p of paths) {
|
|
1006
|
+
let isDir = false;
|
|
1007
|
+
try {
|
|
1008
|
+
const st = await stat(accessor, p);
|
|
1009
|
+
isDir = st.type === FileType2.DIRECTORY;
|
|
1010
|
+
} catch {
|
|
1011
|
+
isDir = false;
|
|
1012
|
+
}
|
|
1013
|
+
if (isDir) {
|
|
1014
|
+
if (recursive) {
|
|
1015
|
+
await rmR(accessor, p);
|
|
1016
|
+
} else {
|
|
1017
|
+
await rmdir(accessor, p);
|
|
1018
|
+
}
|
|
1019
|
+
} else {
|
|
1020
|
+
await unlink(accessor, p);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return [null, new IOResult5()];
|
|
1024
|
+
}
|
|
1025
|
+
var REDIS_RM = command40({
|
|
1026
|
+
name: "rm",
|
|
1027
|
+
resource: ResourceName43.REDIS,
|
|
1028
|
+
spec: specOf40("rm"),
|
|
1029
|
+
fn: rmCommand,
|
|
1030
|
+
write: true
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1033
|
+
// src/commands/builtin/redis/sed.ts
|
|
1034
|
+
import { ResourceName as ResourceName44, command as command41, specOf as specOf41, sedGeneric } from "@struktoai/mirage-core";
|
|
1035
|
+
var REDIS_SED = command41({
|
|
1036
|
+
name: "sed",
|
|
1037
|
+
resource: ResourceName44.REDIS,
|
|
1038
|
+
spec: specOf41("sed"),
|
|
1039
|
+
fn: (accessor, paths, texts, opts) => sedGeneric(
|
|
1040
|
+
paths,
|
|
1041
|
+
texts,
|
|
1042
|
+
opts,
|
|
1043
|
+
(p) => stream(accessor, p),
|
|
1044
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
1045
|
+
)
|
|
1046
|
+
});
|
|
1047
|
+
|
|
1048
|
+
// src/commands/builtin/redis/sha256sum.ts
|
|
1049
|
+
import { ResourceName as ResourceName45, command as command42, sha256sumGeneric, specOf as specOf42 } from "@struktoai/mirage-core";
|
|
1050
|
+
var REDIS_SHA256SUM = command42({
|
|
1051
|
+
name: "sha256sum",
|
|
1052
|
+
resource: ResourceName45.REDIS,
|
|
1053
|
+
spec: specOf42("sha256sum"),
|
|
1054
|
+
fn: (accessor, paths, _texts, opts) => sha256sumGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
// src/commands/builtin/redis/shuf.ts
|
|
1058
|
+
import { ResourceName as ResourceName46, command as command43, specOf as specOf43, shufGeneric } from "@struktoai/mirage-core";
|
|
1059
|
+
var REDIS_SHUF = command43({
|
|
1060
|
+
name: "shuf",
|
|
1061
|
+
resource: ResourceName46.REDIS,
|
|
1062
|
+
spec: specOf43("shuf"),
|
|
1063
|
+
fn: (accessor, paths, texts, opts) => shufGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1064
|
+
});
|
|
1065
|
+
|
|
1066
|
+
// src/commands/builtin/redis/sort.ts
|
|
1067
|
+
import { ResourceName as ResourceName47, command as command44, specOf as specOf44, sortGeneric } from "@struktoai/mirage-core";
|
|
1068
|
+
var REDIS_SORT = command44({
|
|
1069
|
+
name: "sort",
|
|
1070
|
+
resource: ResourceName47.REDIS,
|
|
1071
|
+
spec: specOf44("sort"),
|
|
1072
|
+
fn: (accessor, paths, _texts, opts) => sortGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
// src/commands/builtin/redis/split.ts
|
|
1076
|
+
import { ResourceName as ResourceName48, command as command45, specOf as specOf45, splitGeneric } from "@struktoai/mirage-core";
|
|
1077
|
+
var REDIS_SPLIT = command45({
|
|
1078
|
+
name: "split",
|
|
1079
|
+
resource: ResourceName48.REDIS,
|
|
1080
|
+
spec: specOf45("split"),
|
|
1081
|
+
fn: (accessor, paths, _texts, opts) => splitGeneric(
|
|
1082
|
+
paths,
|
|
1083
|
+
opts,
|
|
1084
|
+
(p) => stream(accessor, p),
|
|
1085
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
1086
|
+
),
|
|
1087
|
+
write: true
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1090
|
+
// src/commands/builtin/redis/stat/stat.ts
|
|
1091
|
+
import {
|
|
1092
|
+
ResourceName as ResourceName49,
|
|
1093
|
+
command as command46,
|
|
1094
|
+
specOf as specOf46,
|
|
1095
|
+
statGeneric,
|
|
1096
|
+
statProvisionGeneric
|
|
1097
|
+
} from "@struktoai/mirage-core";
|
|
1098
|
+
var REDIS_STAT = command46({
|
|
1099
|
+
name: "stat",
|
|
1100
|
+
resource: ResourceName49.REDIS,
|
|
1101
|
+
spec: specOf46("stat"),
|
|
1102
|
+
fn: (accessor, paths, _texts, opts) => statGeneric(paths, opts, (p) => stat(accessor, p)),
|
|
1103
|
+
provision: statProvisionGeneric
|
|
1104
|
+
});
|
|
1105
|
+
|
|
1106
|
+
// src/commands/builtin/redis/strings.ts
|
|
1107
|
+
import { ResourceName as ResourceName50, command as command47, specOf as specOf47, stringsGeneric } from "@struktoai/mirage-core";
|
|
1108
|
+
var REDIS_STRINGS = command47({
|
|
1109
|
+
name: "strings",
|
|
1110
|
+
resource: ResourceName50.REDIS,
|
|
1111
|
+
spec: specOf47("strings"),
|
|
1112
|
+
fn: (accessor, paths, _texts, opts) => stringsGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
// src/commands/builtin/redis/tac.ts
|
|
1116
|
+
import { ResourceName as ResourceName51, command as command48, specOf as specOf48, tacGeneric } from "@struktoai/mirage-core";
|
|
1117
|
+
var REDIS_TAC = command48({
|
|
1118
|
+
name: "tac",
|
|
1119
|
+
resource: ResourceName51.REDIS,
|
|
1120
|
+
spec: specOf48("tac"),
|
|
1121
|
+
fn: (accessor, paths, _texts, opts) => tacGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1122
|
+
});
|
|
1123
|
+
|
|
1124
|
+
// src/commands/builtin/redis/tail/tail.ts
|
|
1125
|
+
import { ResourceName as ResourceName52, command as command49, headerAggregate as headerAggregate2, specOf as specOf49, tailGeneric } from "@struktoai/mirage-core";
|
|
1126
|
+
var REDIS_TAIL = command49({
|
|
1127
|
+
name: "tail",
|
|
1128
|
+
resource: ResourceName52.REDIS,
|
|
1129
|
+
spec: specOf49("tail"),
|
|
1130
|
+
fn: (accessor, paths, texts, opts) => tailGeneric(paths, texts, opts, (p) => stream(accessor, p)),
|
|
1131
|
+
aggregate: headerAggregate2
|
|
1132
|
+
});
|
|
1133
|
+
|
|
1134
|
+
// src/commands/builtin/redis/tar.ts
|
|
1135
|
+
import { ResourceName as ResourceName53, command as command50, specOf as specOf50, tarGeneric } from "@struktoai/mirage-core";
|
|
1136
|
+
var REDIS_TAR = command50({
|
|
1137
|
+
name: "tar",
|
|
1138
|
+
resource: ResourceName53.REDIS,
|
|
1139
|
+
spec: specOf50("tar"),
|
|
1140
|
+
fn: (accessor, paths, _texts, opts) => tarGeneric(
|
|
1141
|
+
paths,
|
|
1142
|
+
opts,
|
|
1143
|
+
(p) => stream(accessor, p),
|
|
1144
|
+
(p, data) => writeBytes(accessor, p, data),
|
|
1145
|
+
(p) => mkdir(accessor, p)
|
|
1146
|
+
),
|
|
1147
|
+
write: true
|
|
1148
|
+
});
|
|
1149
|
+
|
|
1150
|
+
// src/commands/builtin/redis/tee.ts
|
|
1151
|
+
import { ResourceName as ResourceName54, command as command51, specOf as specOf51, teeGeneric } from "@struktoai/mirage-core";
|
|
1152
|
+
var REDIS_TEE = command51({
|
|
1153
|
+
name: "tee",
|
|
1154
|
+
resource: ResourceName54.REDIS,
|
|
1155
|
+
spec: specOf51("tee"),
|
|
1156
|
+
fn: (accessor, paths, texts, opts) => teeGeneric(
|
|
1157
|
+
paths,
|
|
1158
|
+
texts,
|
|
1159
|
+
opts,
|
|
1160
|
+
(p) => stream(accessor, p),
|
|
1161
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
1162
|
+
),
|
|
1163
|
+
write: true
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
// src/commands/builtin/redis/touch.ts
|
|
1167
|
+
import {
|
|
1168
|
+
IOResult as IOResult6,
|
|
1169
|
+
ResourceName as ResourceName55,
|
|
1170
|
+
command as command52,
|
|
1171
|
+
specOf as specOf52
|
|
1172
|
+
} from "@struktoai/mirage-core";
|
|
1173
|
+
var ENC2 = new TextEncoder();
|
|
1174
|
+
async function touchCommand(accessor, paths, texts, opts) {
|
|
1175
|
+
if (paths.length === 0) {
|
|
1176
|
+
return [null, new IOResult6({ exitCode: 1, stderr: ENC2.encode("touch: missing operand\n") })];
|
|
1177
|
+
}
|
|
1178
|
+
const createOnly = opts.flags.c === true;
|
|
1179
|
+
for (const p of paths) {
|
|
1180
|
+
if (createOnly) continue;
|
|
1181
|
+
if (!await exists(accessor, p)) {
|
|
1182
|
+
await writeBytes(accessor, p, new Uint8Array(0));
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
return [null, new IOResult6()];
|
|
1186
|
+
}
|
|
1187
|
+
var REDIS_TOUCH = command52({
|
|
1188
|
+
name: "touch",
|
|
1189
|
+
resource: ResourceName55.REDIS,
|
|
1190
|
+
spec: specOf52("touch"),
|
|
1191
|
+
fn: touchCommand,
|
|
1192
|
+
write: true
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
// src/commands/builtin/redis/tr.ts
|
|
1196
|
+
import { ResourceName as ResourceName56, command as command53, specOf as specOf53, trGeneric } from "@struktoai/mirage-core";
|
|
1197
|
+
var REDIS_TR = command53({
|
|
1198
|
+
name: "tr",
|
|
1199
|
+
resource: ResourceName56.REDIS,
|
|
1200
|
+
spec: specOf53("tr"),
|
|
1201
|
+
fn: (accessor, paths, texts, opts) => trGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
// src/commands/builtin/redis/tree.ts
|
|
1205
|
+
import { ResourceName as ResourceName57, command as command54, specOf as specOf54, treeGeneric } from "@struktoai/mirage-core";
|
|
1206
|
+
var REDIS_TREE = command54({
|
|
1207
|
+
name: "tree",
|
|
1208
|
+
resource: ResourceName57.REDIS,
|
|
1209
|
+
spec: specOf54("tree"),
|
|
1210
|
+
fn: (accessor, paths, _texts, opts) => treeGeneric(
|
|
1211
|
+
paths,
|
|
1212
|
+
opts,
|
|
1213
|
+
(p) => readdir(accessor, p),
|
|
1214
|
+
(p) => stat(accessor, p)
|
|
1215
|
+
)
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
// src/commands/builtin/redis/tsort.ts
|
|
1219
|
+
import { ResourceName as ResourceName58, command as command55, specOf as specOf55, tsortGeneric } from "@struktoai/mirage-core";
|
|
1220
|
+
var REDIS_TSORT = command55({
|
|
1221
|
+
name: "tsort",
|
|
1222
|
+
resource: ResourceName58.REDIS,
|
|
1223
|
+
spec: specOf55("tsort"),
|
|
1224
|
+
fn: (accessor, paths, _texts, opts) => tsortGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
// src/commands/builtin/redis/unexpand.ts
|
|
1228
|
+
import { ResourceName as ResourceName59, command as command56, specOf as specOf56, unexpandGeneric } from "@struktoai/mirage-core";
|
|
1229
|
+
var REDIS_UNEXPAND = command56({
|
|
1230
|
+
name: "unexpand",
|
|
1231
|
+
resource: ResourceName59.REDIS,
|
|
1232
|
+
spec: specOf56("unexpand"),
|
|
1233
|
+
fn: (accessor, paths, _texts, opts) => unexpandGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
// src/commands/builtin/redis/uniq.ts
|
|
1237
|
+
import { ResourceName as ResourceName60, command as command57, specOf as specOf57, uniqGeneric } from "@struktoai/mirage-core";
|
|
1238
|
+
var REDIS_UNIQ = command57({
|
|
1239
|
+
name: "uniq",
|
|
1240
|
+
resource: ResourceName60.REDIS,
|
|
1241
|
+
spec: specOf57("uniq"),
|
|
1242
|
+
fn: (accessor, paths, _texts, opts) => uniqGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
// src/commands/builtin/redis/unzip.ts
|
|
1246
|
+
import { ResourceName as ResourceName61, command as command58, specOf as specOf58, unzipGeneric } from "@struktoai/mirage-core";
|
|
1247
|
+
var REDIS_UNZIP = command58({
|
|
1248
|
+
name: "unzip",
|
|
1249
|
+
resource: ResourceName61.REDIS,
|
|
1250
|
+
spec: specOf58("unzip"),
|
|
1251
|
+
fn: (accessor, paths, _texts, opts) => unzipGeneric(
|
|
1252
|
+
paths,
|
|
1253
|
+
opts,
|
|
1254
|
+
(p) => stream(accessor, p),
|
|
1255
|
+
(p, d) => writeBytes(accessor, p, d),
|
|
1256
|
+
(p, parents) => mkdir(accessor, p, parents)
|
|
1257
|
+
),
|
|
1258
|
+
write: true
|
|
1259
|
+
});
|
|
1260
|
+
|
|
1261
|
+
// src/commands/builtin/redis/wc/wc.ts
|
|
1262
|
+
import { ResourceName as ResourceName62, command as command59, specOf as specOf59, wcAggregate, wcGeneric } from "@struktoai/mirage-core";
|
|
1263
|
+
var REDIS_WC = command59({
|
|
1264
|
+
name: "wc",
|
|
1265
|
+
resource: ResourceName62.REDIS,
|
|
1266
|
+
spec: specOf59("wc"),
|
|
1267
|
+
fn: (accessor, paths, texts, opts) => wcGeneric(paths, texts, opts, (p) => stream(accessor, p)),
|
|
1268
|
+
aggregate: wcAggregate
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
// src/commands/builtin/redis/xxd.ts
|
|
1272
|
+
import { ResourceName as ResourceName63, command as command60, specOf as specOf60, xxdGeneric } from "@struktoai/mirage-core";
|
|
1273
|
+
var REDIS_XXD = command60({
|
|
1274
|
+
name: "xxd",
|
|
1275
|
+
resource: ResourceName63.REDIS,
|
|
1276
|
+
spec: specOf60("xxd"),
|
|
1277
|
+
fn: (accessor, paths, _texts, opts) => xxdGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1278
|
+
});
|
|
1279
|
+
|
|
1280
|
+
// src/commands/builtin/redis/zcat.ts
|
|
1281
|
+
import { ResourceName as ResourceName64, command as command61, specOf as specOf61, zcatGeneric } from "@struktoai/mirage-core";
|
|
1282
|
+
var REDIS_ZCAT = command61({
|
|
1283
|
+
name: "zcat",
|
|
1284
|
+
resource: ResourceName64.REDIS,
|
|
1285
|
+
spec: specOf61("zcat"),
|
|
1286
|
+
fn: (accessor, paths, _texts, opts) => zcatGeneric(paths, opts, (p) => stream(accessor, p))
|
|
1287
|
+
});
|
|
1288
|
+
|
|
1289
|
+
// src/commands/builtin/redis/zgrep.ts
|
|
1290
|
+
import { ResourceName as ResourceName65, command as command62, specOf as specOf62, zgrepGeneric } from "@struktoai/mirage-core";
|
|
1291
|
+
var REDIS_ZGREP = command62({
|
|
1292
|
+
name: "zgrep",
|
|
1293
|
+
resource: ResourceName65.REDIS,
|
|
1294
|
+
spec: specOf62("zgrep"),
|
|
1295
|
+
fn: (accessor, paths, texts, opts) => zgrepGeneric(paths, texts, opts, (p) => stream(accessor, p))
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
// src/commands/builtin/redis/zip_cmd.ts
|
|
1299
|
+
import { ResourceName as ResourceName66, command as command63, specOf as specOf63, zipGeneric } from "@struktoai/mirage-core";
|
|
1300
|
+
var REDIS_ZIP = command63({
|
|
1301
|
+
name: "zip",
|
|
1302
|
+
resource: ResourceName66.REDIS,
|
|
1303
|
+
spec: specOf63("zip"),
|
|
1304
|
+
fn: (accessor, paths, _texts, opts) => zipGeneric(
|
|
1305
|
+
paths,
|
|
1306
|
+
opts,
|
|
1307
|
+
(p) => stream(accessor, p),
|
|
1308
|
+
(p, d) => writeBytes(accessor, p, d)
|
|
1309
|
+
),
|
|
1310
|
+
write: true
|
|
1311
|
+
});
|
|
1312
|
+
|
|
1313
|
+
// src/commands/builtin/redis/index.ts
|
|
1314
|
+
var REDIS_COMMANDS = [
|
|
1315
|
+
...makeFiletypeCommands({
|
|
1316
|
+
resource: ResourceName67.REDIS,
|
|
1317
|
+
readBytes: read,
|
|
1318
|
+
statEntry: stat
|
|
1319
|
+
}),
|
|
1320
|
+
...REDIS_AWK,
|
|
1321
|
+
...REDIS_BASE64,
|
|
1322
|
+
...REDIS_BASENAME,
|
|
1323
|
+
...REDIS_CAT,
|
|
1324
|
+
...REDIS_CMP,
|
|
1325
|
+
...REDIS_COLUMN,
|
|
1326
|
+
...REDIS_COMM,
|
|
1327
|
+
...REDIS_CP,
|
|
1328
|
+
...REDIS_CSPLIT,
|
|
1329
|
+
...REDIS_CUT,
|
|
1330
|
+
...REDIS_DIFF,
|
|
1331
|
+
...REDIS_DIRNAME,
|
|
1332
|
+
...REDIS_DU,
|
|
1333
|
+
...REDIS_EXPAND,
|
|
1334
|
+
...REDIS_FILE,
|
|
1335
|
+
...REDIS_FIND,
|
|
1336
|
+
...REDIS_FMT,
|
|
1337
|
+
...REDIS_FOLD,
|
|
1338
|
+
...REDIS_GREP,
|
|
1339
|
+
...REDIS_GUNZIP,
|
|
1340
|
+
...REDIS_GZIP,
|
|
1341
|
+
...REDIS_HEAD,
|
|
1342
|
+
...REDIS_ICONV,
|
|
1343
|
+
...REDIS_JOIN,
|
|
1344
|
+
...REDIS_JQ,
|
|
1345
|
+
...REDIS_LN,
|
|
1346
|
+
...REDIS_LOOK,
|
|
1347
|
+
...REDIS_LS,
|
|
1348
|
+
...REDIS_MD5,
|
|
1349
|
+
...REDIS_MKDIR,
|
|
1350
|
+
...REDIS_MKTEMP,
|
|
1351
|
+
...REDIS_MV,
|
|
1352
|
+
...REDIS_NL,
|
|
1353
|
+
...REDIS_PASTE,
|
|
1354
|
+
...REDIS_PATCH,
|
|
1355
|
+
...REDIS_READLINK,
|
|
1356
|
+
...REDIS_REALPATH,
|
|
1357
|
+
...REDIS_REV,
|
|
1358
|
+
...REDIS_RG,
|
|
1359
|
+
...REDIS_RM,
|
|
1360
|
+
...REDIS_SED,
|
|
1361
|
+
...REDIS_SHA256SUM,
|
|
1362
|
+
...REDIS_SHUF,
|
|
1363
|
+
...REDIS_SORT,
|
|
1364
|
+
...REDIS_SPLIT,
|
|
1365
|
+
...REDIS_STAT,
|
|
1366
|
+
...REDIS_STRINGS,
|
|
1367
|
+
...REDIS_TAC,
|
|
1368
|
+
...REDIS_TAIL,
|
|
1369
|
+
...REDIS_TAR,
|
|
1370
|
+
...REDIS_TEE,
|
|
1371
|
+
...REDIS_TOUCH,
|
|
1372
|
+
...REDIS_TR,
|
|
1373
|
+
...REDIS_TREE,
|
|
1374
|
+
...REDIS_TSORT,
|
|
1375
|
+
...REDIS_UNEXPAND,
|
|
1376
|
+
...REDIS_UNIQ,
|
|
1377
|
+
...REDIS_UNZIP,
|
|
1378
|
+
...REDIS_WC,
|
|
1379
|
+
...REDIS_XXD,
|
|
1380
|
+
...REDIS_ZCAT,
|
|
1381
|
+
...REDIS_ZGREP,
|
|
1382
|
+
...REDIS_ZIP
|
|
1383
|
+
];
|
|
1384
|
+
|
|
1385
|
+
// src/accessor/redis.ts
|
|
1386
|
+
import { Accessor } from "@struktoai/mirage-core";
|
|
1387
|
+
var RedisAccessor = class extends Accessor {
|
|
1388
|
+
store;
|
|
1389
|
+
constructor(store) {
|
|
1390
|
+
super();
|
|
1391
|
+
this.store = store;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
// src/core/redis/append.ts
|
|
1396
|
+
import { record as record3, ResourceName as ResourceName68 } from "@struktoai/mirage-core";
|
|
1397
|
+
async function appendBytes(accessor, path, data) {
|
|
1398
|
+
const start = performance.now();
|
|
1399
|
+
const p = norm(path.stripPrefix);
|
|
1400
|
+
const store = accessor.store;
|
|
1401
|
+
const existing = await store.getFile(p);
|
|
1402
|
+
if (existing !== null) {
|
|
1403
|
+
const merged = new Uint8Array(existing.byteLength + data.byteLength);
|
|
1404
|
+
merged.set(existing, 0);
|
|
1405
|
+
merged.set(data, existing.byteLength);
|
|
1406
|
+
await store.setFile(p, merged);
|
|
1407
|
+
} else {
|
|
1408
|
+
await store.setFile(p, data);
|
|
1409
|
+
}
|
|
1410
|
+
await store.setModified(p, nowIso());
|
|
1411
|
+
record3("append", p, ResourceName68.REDIS, data.byteLength, start);
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
// src/core/redis/create.ts
|
|
1415
|
+
async function create(accessor, path) {
|
|
1416
|
+
const p = norm(path.stripPrefix);
|
|
1417
|
+
const store = accessor.store;
|
|
1418
|
+
await store.setFile(p, new Uint8Array(0));
|
|
1419
|
+
await store.setModified(p, nowIso());
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
// src/core/redis/glob.ts
|
|
1423
|
+
import { PathSpec } from "@struktoai/mirage-core";
|
|
1424
|
+
|
|
1425
|
+
// src/core/redis/constants.ts
|
|
1426
|
+
var SCOPE_ERROR = 5e4;
|
|
1427
|
+
|
|
1428
|
+
// src/core/redis/glob.ts
|
|
1429
|
+
import { fnmatch } from "@struktoai/mirage-core";
|
|
1430
|
+
import { gnuBasename as gnuBasename2 } from "@struktoai/mirage-core";
|
|
1431
|
+
async function resolveGlob(accessor, paths, index) {
|
|
1432
|
+
const result = [];
|
|
1433
|
+
for (const p of paths) {
|
|
1434
|
+
if (p.resolved) {
|
|
1435
|
+
result.push(p);
|
|
1436
|
+
} else if (p.pattern !== null) {
|
|
1437
|
+
const dirSpec = new PathSpec({
|
|
1438
|
+
original: p.directory,
|
|
1439
|
+
directory: p.directory,
|
|
1440
|
+
resolved: true,
|
|
1441
|
+
prefix: p.prefix
|
|
1442
|
+
});
|
|
1443
|
+
const entries = await readdir(accessor, dirSpec, index);
|
|
1444
|
+
const matched = [];
|
|
1445
|
+
for (const e of entries) {
|
|
1446
|
+
if (fnmatch(gnuBasename2(e), p.pattern)) {
|
|
1447
|
+
matched.push(
|
|
1448
|
+
new PathSpec({
|
|
1449
|
+
original: e,
|
|
1450
|
+
directory: p.directory,
|
|
1451
|
+
resolved: true,
|
|
1452
|
+
prefix: p.prefix
|
|
1453
|
+
})
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
if (matched.length > SCOPE_ERROR) matched.length = SCOPE_ERROR;
|
|
1458
|
+
result.push(...matched);
|
|
1459
|
+
} else {
|
|
1460
|
+
result.push(p);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
return result;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
// src/core/redis/truncate.ts
|
|
1467
|
+
async function truncate(accessor, path, length) {
|
|
1468
|
+
const p = norm(path.stripPrefix);
|
|
1469
|
+
const store = accessor.store;
|
|
1470
|
+
const existing = await store.getFile(p);
|
|
1471
|
+
const data = existing ?? new Uint8Array(0);
|
|
1472
|
+
const out = new Uint8Array(length);
|
|
1473
|
+
const copyLen = Math.min(data.byteLength, length);
|
|
1474
|
+
out.set(data.subarray(0, copyLen), 0);
|
|
1475
|
+
await store.setFile(p, out);
|
|
1476
|
+
await store.setModified(p, nowIso());
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
// src/ops/redis/append.ts
|
|
1480
|
+
import { ResourceName as ResourceName69 } from "@struktoai/mirage-core";
|
|
1481
|
+
var appendOp = {
|
|
1482
|
+
name: "append",
|
|
1483
|
+
resource: ResourceName69.REDIS,
|
|
1484
|
+
filetype: null,
|
|
1485
|
+
write: true,
|
|
1486
|
+
fn: (accessor, path, args) => {
|
|
1487
|
+
const data = args[0];
|
|
1488
|
+
if (!(data instanceof Uint8Array)) {
|
|
1489
|
+
throw new TypeError("append op requires a Uint8Array as the first arg");
|
|
1490
|
+
}
|
|
1491
|
+
return appendBytes(accessor, path, data);
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
// src/ops/redis/create.ts
|
|
1496
|
+
import { ResourceName as ResourceName70 } from "@struktoai/mirage-core";
|
|
1497
|
+
var createOp = {
|
|
1498
|
+
name: "create",
|
|
1499
|
+
resource: ResourceName70.REDIS,
|
|
1500
|
+
filetype: null,
|
|
1501
|
+
write: true,
|
|
1502
|
+
fn: (accessor, path) => {
|
|
1503
|
+
return create(accessor, path);
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
// src/ops/redis/mkdir.ts
|
|
1508
|
+
import { ResourceName as ResourceName71 } from "@struktoai/mirage-core";
|
|
1509
|
+
var mkdirOp = {
|
|
1510
|
+
name: "mkdir",
|
|
1511
|
+
resource: ResourceName71.REDIS,
|
|
1512
|
+
filetype: null,
|
|
1513
|
+
write: true,
|
|
1514
|
+
fn: (accessor, path, args) => {
|
|
1515
|
+
const parents = args[0];
|
|
1516
|
+
return mkdir(accessor, path, parents === true);
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
|
|
1520
|
+
// src/ops/redis/read.ts
|
|
1521
|
+
import { ResourceName as ResourceName72 } from "@struktoai/mirage-core";
|
|
1522
|
+
var readOp = {
|
|
1523
|
+
name: "read",
|
|
1524
|
+
resource: ResourceName72.REDIS,
|
|
1525
|
+
filetype: null,
|
|
1526
|
+
write: false,
|
|
1527
|
+
fn: (accessor, path) => {
|
|
1528
|
+
return read(accessor, path);
|
|
1529
|
+
}
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
// src/ops/redis/read_feather.ts
|
|
1533
|
+
import {
|
|
1534
|
+
featherCat,
|
|
1535
|
+
ResourceName as ResourceName73
|
|
1536
|
+
} from "@struktoai/mirage-core";
|
|
1537
|
+
var readFeatherOp = {
|
|
1538
|
+
name: "read",
|
|
1539
|
+
resource: ResourceName73.REDIS,
|
|
1540
|
+
filetype: ".feather",
|
|
1541
|
+
write: false,
|
|
1542
|
+
fn: async (accessor, path, _args, kwargs) => {
|
|
1543
|
+
const raw = await read(accessor, path, kwargs.index);
|
|
1544
|
+
return featherCat(raw);
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
|
|
1548
|
+
// src/ops/redis/read_hdf5.ts
|
|
1549
|
+
import {
|
|
1550
|
+
hdf5Cat,
|
|
1551
|
+
ResourceName as ResourceName74
|
|
1552
|
+
} from "@struktoai/mirage-core";
|
|
1553
|
+
var readHdf5Op = {
|
|
1554
|
+
name: "read",
|
|
1555
|
+
resource: ResourceName74.REDIS,
|
|
1556
|
+
filetype: ".hdf5",
|
|
1557
|
+
write: false,
|
|
1558
|
+
fn: async (accessor, path, _args, kwargs) => {
|
|
1559
|
+
const raw = await read(accessor, path, kwargs.index);
|
|
1560
|
+
return hdf5Cat(raw);
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
// src/ops/redis/read_parquet.ts
|
|
1565
|
+
import {
|
|
1566
|
+
parquetCat,
|
|
1567
|
+
ResourceName as ResourceName75
|
|
1568
|
+
} from "@struktoai/mirage-core";
|
|
1569
|
+
var readParquetOp = {
|
|
1570
|
+
name: "read",
|
|
1571
|
+
resource: ResourceName75.REDIS,
|
|
1572
|
+
filetype: ".parquet",
|
|
1573
|
+
write: false,
|
|
1574
|
+
fn: async (accessor, path, _args, kwargs) => {
|
|
1575
|
+
const raw = await read(accessor, path, kwargs.index);
|
|
1576
|
+
return parquetCat(raw);
|
|
1577
|
+
}
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
// src/ops/redis/readdir.ts
|
|
1581
|
+
import { ResourceName as ResourceName76 } from "@struktoai/mirage-core";
|
|
1582
|
+
var readdirOp = {
|
|
1583
|
+
name: "readdir",
|
|
1584
|
+
resource: ResourceName76.REDIS,
|
|
1585
|
+
filetype: null,
|
|
1586
|
+
write: false,
|
|
1587
|
+
fn: (accessor, path) => {
|
|
1588
|
+
return readdir(accessor, path);
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
// src/ops/redis/rename.ts
|
|
1593
|
+
import { ResourceName as ResourceName77 } from "@struktoai/mirage-core";
|
|
1594
|
+
var renameOp = {
|
|
1595
|
+
name: "rename",
|
|
1596
|
+
resource: ResourceName77.REDIS,
|
|
1597
|
+
filetype: null,
|
|
1598
|
+
write: true,
|
|
1599
|
+
fn: (accessor, path, args) => {
|
|
1600
|
+
const dst = args[0];
|
|
1601
|
+
if (dst === void 0 || dst === null || typeof dst !== "object" || !("original" in dst)) {
|
|
1602
|
+
throw new TypeError("rename op requires a PathSpec destination as the first arg");
|
|
1603
|
+
}
|
|
1604
|
+
return rename(accessor, path, dst);
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
// src/ops/redis/rmdir.ts
|
|
1609
|
+
import { ResourceName as ResourceName78 } from "@struktoai/mirage-core";
|
|
1610
|
+
var rmdirOp = {
|
|
1611
|
+
name: "rmdir",
|
|
1612
|
+
resource: ResourceName78.REDIS,
|
|
1613
|
+
filetype: null,
|
|
1614
|
+
write: true,
|
|
1615
|
+
fn: (accessor, path) => {
|
|
1616
|
+
return rmdir(accessor, path);
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
// src/ops/redis/stat.ts
|
|
1621
|
+
import { ResourceName as ResourceName79 } from "@struktoai/mirage-core";
|
|
1622
|
+
var statOp = {
|
|
1623
|
+
name: "stat",
|
|
1624
|
+
resource: ResourceName79.REDIS,
|
|
1625
|
+
filetype: null,
|
|
1626
|
+
write: false,
|
|
1627
|
+
fn: (accessor, path) => {
|
|
1628
|
+
return stat(accessor, path);
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
// src/ops/redis/truncate.ts
|
|
1633
|
+
import { ResourceName as ResourceName80 } from "@struktoai/mirage-core";
|
|
1634
|
+
var truncateOp = {
|
|
1635
|
+
name: "truncate",
|
|
1636
|
+
resource: ResourceName80.REDIS,
|
|
1637
|
+
filetype: null,
|
|
1638
|
+
write: true,
|
|
1639
|
+
fn: (accessor, path, args) => {
|
|
1640
|
+
const length = args[0];
|
|
1641
|
+
if (typeof length !== "number") {
|
|
1642
|
+
throw new TypeError("truncate op requires a number length as the first arg");
|
|
1643
|
+
}
|
|
1644
|
+
return truncate(accessor, path, length);
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
// src/ops/redis/unlink.ts
|
|
1649
|
+
import { ResourceName as ResourceName81 } from "@struktoai/mirage-core";
|
|
1650
|
+
var unlinkOp = {
|
|
1651
|
+
name: "unlink",
|
|
1652
|
+
resource: ResourceName81.REDIS,
|
|
1653
|
+
filetype: null,
|
|
1654
|
+
write: true,
|
|
1655
|
+
fn: (accessor, path) => {
|
|
1656
|
+
return unlink(accessor, path);
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
|
|
1660
|
+
// src/ops/redis/write.ts
|
|
1661
|
+
import { extractWriteData } from "@struktoai/mirage-core";
|
|
1662
|
+
import { ResourceName as ResourceName82 } from "@struktoai/mirage-core";
|
|
1663
|
+
var writeOp = {
|
|
1664
|
+
name: "write",
|
|
1665
|
+
resource: ResourceName82.REDIS,
|
|
1666
|
+
filetype: null,
|
|
1667
|
+
write: true,
|
|
1668
|
+
fn: (accessor, path, args) => {
|
|
1669
|
+
const data = extractWriteData(args);
|
|
1670
|
+
return writeBytes(accessor, path, data);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1674
|
+
// src/ops/redis/index.ts
|
|
1675
|
+
var REDIS_OPS = [
|
|
1676
|
+
appendOp,
|
|
1677
|
+
createOp,
|
|
1678
|
+
mkdirOp,
|
|
1679
|
+
readOp,
|
|
1680
|
+
readFeatherOp,
|
|
1681
|
+
readHdf5Op,
|
|
1682
|
+
readParquetOp,
|
|
1683
|
+
readdirOp,
|
|
1684
|
+
renameOp,
|
|
1685
|
+
rmdirOp,
|
|
1686
|
+
statOp,
|
|
1687
|
+
truncateOp,
|
|
1688
|
+
unlinkOp,
|
|
1689
|
+
writeOp
|
|
1690
|
+
];
|
|
1691
|
+
|
|
1692
|
+
// src/resource/redis/prompt.ts
|
|
1693
|
+
var REDIS_PROMPT = `Redis-backed persistent filesystem. Behaves like a standard filesystem.
|
|
1694
|
+
Standard commands: ls, cat, head, tail, grep, wc, find, tree, mkdir, touch, cp, mv, rm, tee.`;
|
|
1695
|
+
|
|
1696
|
+
// src/resource/redis/store.ts
|
|
1697
|
+
var RedisStore = class {
|
|
1698
|
+
url;
|
|
1699
|
+
keyPrefix;
|
|
1700
|
+
providedClient;
|
|
1701
|
+
clientPromise = null;
|
|
1702
|
+
constructor(options = {}) {
|
|
1703
|
+
this.url = options.url ?? "redis://localhost:6379/0";
|
|
1704
|
+
this.keyPrefix = options.keyPrefix ?? "mirage:fs:";
|
|
1705
|
+
this.providedClient = options.client ?? null;
|
|
1706
|
+
}
|
|
1707
|
+
fk(path) {
|
|
1708
|
+
return `${this.keyPrefix}file:${path}`;
|
|
1709
|
+
}
|
|
1710
|
+
dk() {
|
|
1711
|
+
return `${this.keyPrefix}dir`;
|
|
1712
|
+
}
|
|
1713
|
+
mk(path) {
|
|
1714
|
+
return `${this.keyPrefix}modified:${path}`;
|
|
1715
|
+
}
|
|
1716
|
+
async client() {
|
|
1717
|
+
if (this.providedClient !== null) return this.providedClient;
|
|
1718
|
+
this.clientPromise ??= (async () => {
|
|
1719
|
+
const mod = await loadOptionalPeer(
|
|
1720
|
+
() => import("redis"),
|
|
1721
|
+
{ feature: "RedisResource / RedisFileCacheStore", packageName: "redis" }
|
|
1722
|
+
);
|
|
1723
|
+
const c = mod.createClient({
|
|
1724
|
+
url: this.url,
|
|
1725
|
+
socket: { reconnectStrategy: false }
|
|
1726
|
+
});
|
|
1727
|
+
await c.connect();
|
|
1728
|
+
await c.sAdd(this.dk(), "/");
|
|
1729
|
+
return c;
|
|
1730
|
+
})();
|
|
1731
|
+
return this.clientPromise;
|
|
1732
|
+
}
|
|
1733
|
+
async getFile(path) {
|
|
1734
|
+
const c = await this.client();
|
|
1735
|
+
const typed = c;
|
|
1736
|
+
const mod = await import("redis");
|
|
1737
|
+
const blob = mod.RESP_TYPES.BLOB_STRING;
|
|
1738
|
+
const mapping = { [blob]: Buffer };
|
|
1739
|
+
const raw = await typed.withTypeMapping(mapping).get(this.fk(path));
|
|
1740
|
+
if (raw === null) return null;
|
|
1741
|
+
return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength);
|
|
1742
|
+
}
|
|
1743
|
+
async setFile(path, data) {
|
|
1744
|
+
const c = await this.client();
|
|
1745
|
+
await c.set(this.fk(path), Buffer.from(data.buffer, data.byteOffset, data.byteLength));
|
|
1746
|
+
}
|
|
1747
|
+
async delFile(path) {
|
|
1748
|
+
const c = await this.client();
|
|
1749
|
+
await c.del(this.fk(path));
|
|
1750
|
+
}
|
|
1751
|
+
async hasFile(path) {
|
|
1752
|
+
const c = await this.client();
|
|
1753
|
+
return await c.exists(this.fk(path)) > 0;
|
|
1754
|
+
}
|
|
1755
|
+
async listFiles(prefix = "") {
|
|
1756
|
+
const c = await this.client();
|
|
1757
|
+
const pattern = `${this.keyPrefix}file:${prefix}*`;
|
|
1758
|
+
const strip = `${this.keyPrefix}file:`.length;
|
|
1759
|
+
const result = [];
|
|
1760
|
+
for await (const k of c.scanIterator({ MATCH: pattern })) {
|
|
1761
|
+
const keys = Array.isArray(k) ? k : [k];
|
|
1762
|
+
for (const key of keys) result.push(key.slice(strip));
|
|
1763
|
+
}
|
|
1764
|
+
return result.sort();
|
|
1765
|
+
}
|
|
1766
|
+
async fileLen(path) {
|
|
1767
|
+
const c = await this.client();
|
|
1768
|
+
return c.strLen(this.fk(path));
|
|
1769
|
+
}
|
|
1770
|
+
async getRange(path, start, end) {
|
|
1771
|
+
const c = await this.client();
|
|
1772
|
+
const typed = c;
|
|
1773
|
+
const mod = await import("redis");
|
|
1774
|
+
const blob = mod.RESP_TYPES.BLOB_STRING;
|
|
1775
|
+
const mapping = { [blob]: Buffer };
|
|
1776
|
+
const raw = await typed.withTypeMapping(mapping).getRange(this.fk(path), start, end);
|
|
1777
|
+
return new Uint8Array(raw.buffer, raw.byteOffset, raw.byteLength);
|
|
1778
|
+
}
|
|
1779
|
+
async hasDir(path) {
|
|
1780
|
+
const c = await this.client();
|
|
1781
|
+
return await c.sIsMember(this.dk(), path) === 1;
|
|
1782
|
+
}
|
|
1783
|
+
async addDir(path) {
|
|
1784
|
+
const c = await this.client();
|
|
1785
|
+
await c.sAdd(this.dk(), path);
|
|
1786
|
+
}
|
|
1787
|
+
async removeDir(path) {
|
|
1788
|
+
const c = await this.client();
|
|
1789
|
+
await c.sRem(this.dk(), path);
|
|
1790
|
+
}
|
|
1791
|
+
async listDirs() {
|
|
1792
|
+
const c = await this.client();
|
|
1793
|
+
const members = await c.sMembers(this.dk());
|
|
1794
|
+
return new Set(members);
|
|
1795
|
+
}
|
|
1796
|
+
async getModified(path) {
|
|
1797
|
+
const c = await this.client();
|
|
1798
|
+
return c.get(this.mk(path));
|
|
1799
|
+
}
|
|
1800
|
+
async setModified(path, ts) {
|
|
1801
|
+
const c = await this.client();
|
|
1802
|
+
await c.set(this.mk(path), ts);
|
|
1803
|
+
}
|
|
1804
|
+
async delModified(path) {
|
|
1805
|
+
const c = await this.client();
|
|
1806
|
+
await c.del(this.mk(path));
|
|
1807
|
+
}
|
|
1808
|
+
async clear() {
|
|
1809
|
+
const c = await this.client();
|
|
1810
|
+
for (const pattern of [`${this.keyPrefix}file:*`, `${this.keyPrefix}modified:*`]) {
|
|
1811
|
+
const keys = [];
|
|
1812
|
+
for await (const k of c.scanIterator({ MATCH: pattern })) {
|
|
1813
|
+
if (Array.isArray(k)) keys.push(...k);
|
|
1814
|
+
else keys.push(k);
|
|
1815
|
+
}
|
|
1816
|
+
if (keys.length > 0) await c.del(keys);
|
|
1817
|
+
}
|
|
1818
|
+
await c.del(this.dk());
|
|
1819
|
+
}
|
|
1820
|
+
async close() {
|
|
1821
|
+
if (this.providedClient !== null) return;
|
|
1822
|
+
if (this.clientPromise === null) return;
|
|
1823
|
+
const c = await this.clientPromise;
|
|
1824
|
+
const typed = c;
|
|
1825
|
+
if (typeof typed.destroy === "function") typed.destroy();
|
|
1826
|
+
else if (c.isOpen) await c.quit();
|
|
1827
|
+
this.clientPromise = null;
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
|
|
1831
|
+
// src/resource/redis/redis.ts
|
|
1832
|
+
var RedisResource = class extends BaseResource {
|
|
1833
|
+
kind = ResourceName83.REDIS;
|
|
1834
|
+
isRemote = false;
|
|
1835
|
+
indexTtl = 0;
|
|
1836
|
+
prompt = REDIS_PROMPT;
|
|
1837
|
+
url;
|
|
1838
|
+
keyPrefix;
|
|
1839
|
+
store;
|
|
1840
|
+
accessor;
|
|
1841
|
+
opsMap = {
|
|
1842
|
+
read_bytes: read,
|
|
1843
|
+
write: writeBytes,
|
|
1844
|
+
readdir,
|
|
1845
|
+
stat,
|
|
1846
|
+
unlink,
|
|
1847
|
+
rmdir,
|
|
1848
|
+
copy,
|
|
1849
|
+
rename,
|
|
1850
|
+
mkdir,
|
|
1851
|
+
read_stream: stream,
|
|
1852
|
+
rm_recursive: rmR,
|
|
1853
|
+
du_total: du,
|
|
1854
|
+
du_all: duAll,
|
|
1855
|
+
create,
|
|
1856
|
+
truncate,
|
|
1857
|
+
exists,
|
|
1858
|
+
find_flat: find,
|
|
1859
|
+
append: appendBytes
|
|
1860
|
+
};
|
|
1861
|
+
constructor(options = {}) {
|
|
1862
|
+
super();
|
|
1863
|
+
this.url = options.url ?? "redis://localhost:6379/0";
|
|
1864
|
+
this.keyPrefix = options.keyPrefix ?? "mirage:fs:";
|
|
1865
|
+
this.store = new RedisStore({ url: this.url, keyPrefix: this.keyPrefix });
|
|
1866
|
+
this.accessor = new RedisAccessor(this.store);
|
|
1867
|
+
}
|
|
1868
|
+
async open() {
|
|
1869
|
+
await this.store.client();
|
|
1870
|
+
}
|
|
1871
|
+
close() {
|
|
1872
|
+
return this.store.close();
|
|
1873
|
+
}
|
|
1874
|
+
client() {
|
|
1875
|
+
return this.store.client();
|
|
1876
|
+
}
|
|
1877
|
+
module() {
|
|
1878
|
+
return import("redis");
|
|
1879
|
+
}
|
|
1880
|
+
ops() {
|
|
1881
|
+
return REDIS_OPS;
|
|
1882
|
+
}
|
|
1883
|
+
commands() {
|
|
1884
|
+
return REDIS_COMMANDS;
|
|
1885
|
+
}
|
|
1886
|
+
streamPath(p) {
|
|
1887
|
+
return stream(this.accessor, p);
|
|
1888
|
+
}
|
|
1889
|
+
readFile(p) {
|
|
1890
|
+
return read(this.accessor, p);
|
|
1891
|
+
}
|
|
1892
|
+
writeFile(p, data) {
|
|
1893
|
+
return writeBytes(this.accessor, p, data);
|
|
1894
|
+
}
|
|
1895
|
+
appendFile(p, data) {
|
|
1896
|
+
return appendBytes(this.accessor, p, data);
|
|
1897
|
+
}
|
|
1898
|
+
readdir(p) {
|
|
1899
|
+
return readdir(this.accessor, p, this.index);
|
|
1900
|
+
}
|
|
1901
|
+
stat(p) {
|
|
1902
|
+
return stat(this.accessor, p);
|
|
1903
|
+
}
|
|
1904
|
+
exists(p) {
|
|
1905
|
+
return exists(this.accessor, p);
|
|
1906
|
+
}
|
|
1907
|
+
mkdir(p, options) {
|
|
1908
|
+
return mkdir(this.accessor, p, options?.recursive === true);
|
|
1909
|
+
}
|
|
1910
|
+
rmdir(p) {
|
|
1911
|
+
return rmdir(this.accessor, p);
|
|
1912
|
+
}
|
|
1913
|
+
unlink(p) {
|
|
1914
|
+
return unlink(this.accessor, p);
|
|
1915
|
+
}
|
|
1916
|
+
rename(src, dst) {
|
|
1917
|
+
return rename(this.accessor, src, dst);
|
|
1918
|
+
}
|
|
1919
|
+
truncate(p, length) {
|
|
1920
|
+
return truncate(this.accessor, p, length);
|
|
1921
|
+
}
|
|
1922
|
+
copy(src, dst) {
|
|
1923
|
+
return copy(this.accessor, src, dst);
|
|
1924
|
+
}
|
|
1925
|
+
rmR(p) {
|
|
1926
|
+
return rmR(this.accessor, p);
|
|
1927
|
+
}
|
|
1928
|
+
du(p) {
|
|
1929
|
+
return du(this.accessor, p);
|
|
1930
|
+
}
|
|
1931
|
+
find(p, options = {}) {
|
|
1932
|
+
return find(this.accessor, p, options);
|
|
1933
|
+
}
|
|
1934
|
+
glob(paths, prefix = "") {
|
|
1935
|
+
const effective = prefix ? paths.map(
|
|
1936
|
+
(p) => p.prefix ? p : new PathSpec2({
|
|
1937
|
+
original: p.original,
|
|
1938
|
+
directory: p.directory,
|
|
1939
|
+
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
1940
|
+
resolved: p.resolved,
|
|
1941
|
+
prefix
|
|
1942
|
+
})
|
|
1943
|
+
) : paths;
|
|
1944
|
+
return resolveGlob(this.accessor, effective, this.index);
|
|
1945
|
+
}
|
|
1946
|
+
async getState() {
|
|
1947
|
+
const files = {};
|
|
1948
|
+
for (const key of await this.store.listFiles()) {
|
|
1949
|
+
const data = await this.store.getFile(key);
|
|
1950
|
+
if (data !== null) files[key] = data;
|
|
1951
|
+
}
|
|
1952
|
+
const dirs = [...await this.store.listDirs()].sort();
|
|
1953
|
+
return {
|
|
1954
|
+
type: this.kind,
|
|
1955
|
+
config: {
|
|
1956
|
+
url: REDACTED_SECRET,
|
|
1957
|
+
keyPrefix: this.keyPrefix
|
|
1958
|
+
},
|
|
1959
|
+
keyPrefix: this.keyPrefix,
|
|
1960
|
+
files,
|
|
1961
|
+
dirs
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
async loadState(state) {
|
|
1965
|
+
const c = await this.store.client();
|
|
1966
|
+
const pipe = c.multi();
|
|
1967
|
+
const dirKey = `${this.keyPrefix}dir`;
|
|
1968
|
+
for (const [path, data] of Object.entries(state.files)) {
|
|
1969
|
+
pipe.set(
|
|
1970
|
+
`${this.keyPrefix}file:${path}`,
|
|
1971
|
+
Buffer.from(data.buffer, data.byteOffset, data.byteLength)
|
|
1972
|
+
);
|
|
1973
|
+
}
|
|
1974
|
+
for (const dir of state.dirs) {
|
|
1975
|
+
pipe.sAdd(dirKey, dir);
|
|
1976
|
+
}
|
|
1977
|
+
await pipe.exec();
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
export {
|
|
1982
|
+
stat,
|
|
1983
|
+
REDIS_COMMANDS,
|
|
1984
|
+
RedisAccessor,
|
|
1985
|
+
REDIS_OPS,
|
|
1986
|
+
REDIS_PROMPT,
|
|
1987
|
+
RedisStore,
|
|
1988
|
+
RedisResource
|
|
1989
|
+
};
|
|
1990
|
+
//# sourceMappingURL=chunk-N72CAZEH.js.map
|