@struktoai/mirage-node 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (447) hide show
  1. package/README.md +2 -1
  2. package/dist/aliyun-S62BR3TB.js +11 -0
  3. package/dist/append.lua +17 -0
  4. package/dist/backblaze-4EKSW63F.js +11 -0
  5. package/dist/box-ZPLZAGMK.js +8 -0
  6. package/dist/ceph-ALKLD3MO.js +11 -0
  7. package/dist/{chunk-VLRSOWHP.js → chunk-2A4YGVBM.js} +5 -14
  8. package/dist/chunk-2A4YGVBM.js.map +1 -0
  9. package/dist/chunk-2HCYLVGY.js +28 -0
  10. package/dist/chunk-2HCYLVGY.js.map +1 -0
  11. package/dist/chunk-2VPZAH5Q.js +20 -0
  12. package/dist/chunk-2VPZAH5Q.js.map +1 -0
  13. package/dist/{chunk-HCU3B6FW.js → chunk-3JZQ6VSZ.js} +5 -4
  14. package/dist/chunk-3JZQ6VSZ.js.map +1 -0
  15. package/dist/chunk-4IF4TGAI.js +11 -0
  16. package/dist/chunk-4IF4TGAI.js.map +1 -0
  17. package/dist/{chunk-L7FEZ7LU.js → chunk-5H6KNEPP.js} +4 -5
  18. package/dist/{chunk-L7FEZ7LU.js.map → chunk-5H6KNEPP.js.map} +1 -1
  19. package/dist/{chunk-25W4XQJZ.js → chunk-5K2MWDCE.js} +4 -5
  20. package/dist/{chunk-25W4XQJZ.js.map → chunk-5K2MWDCE.js.map} +1 -1
  21. package/dist/{chunk-L4GMDSMB.js → chunk-6SVXWRKX.js} +4 -5
  22. package/dist/{chunk-L4GMDSMB.js.map → chunk-6SVXWRKX.js.map} +1 -1
  23. package/dist/{chunk-H62XQZUM.js → chunk-6VOIUGAD.js} +22 -10
  24. package/dist/chunk-6VOIUGAD.js.map +1 -0
  25. package/dist/{chunk-SI4GMRXD.js → chunk-7JYHFXXC.js} +4 -8
  26. package/dist/chunk-7JYHFXXC.js.map +1 -0
  27. package/dist/chunk-7VQQFWV6.js +20 -0
  28. package/dist/chunk-7VQQFWV6.js.map +1 -0
  29. package/dist/chunk-7ZP6TPHX.js +87 -0
  30. package/dist/chunk-7ZP6TPHX.js.map +1 -0
  31. package/dist/{chunk-HWQPEBID.js → chunk-ADEXNSYU.js} +6 -12
  32. package/dist/chunk-ADEXNSYU.js.map +1 -0
  33. package/dist/chunk-AQSYAXL4.js +16 -0
  34. package/dist/chunk-AQSYAXL4.js.map +1 -0
  35. package/dist/{chunk-NJ42VNXG.js → chunk-ATLXMNKD.js} +8 -3
  36. package/dist/chunk-ATLXMNKD.js.map +1 -0
  37. package/dist/{chunk-CB76WPUS.js → chunk-BYCUGFRF.js} +5 -4
  38. package/dist/chunk-BYCUGFRF.js.map +1 -0
  39. package/dist/{chunk-4M73WHIE.js → chunk-BZTVYOES.js} +3 -3
  40. package/dist/{chunk-CQCTCW4S.js → chunk-CRC4YWXB.js} +28 -9
  41. package/dist/chunk-CRC4YWXB.js.map +1 -0
  42. package/dist/{chunk-C7TNKIK5.js → chunk-CTGXJHO5.js} +1 -1
  43. package/dist/chunk-CTGXJHO5.js.map +1 -0
  44. package/dist/{chunk-HSD24IP2.js → chunk-DCDBIXVZ.js} +7 -2
  45. package/dist/chunk-DCDBIXVZ.js.map +1 -0
  46. package/dist/{chunk-HEDE2377.js → chunk-DDAFNROK.js} +318 -322
  47. package/dist/chunk-DDAFNROK.js.map +1 -0
  48. package/dist/chunk-DQIEWEAW.js +85 -0
  49. package/dist/chunk-DQIEWEAW.js.map +1 -0
  50. package/dist/{chunk-2ERLWAGG.js → chunk-EBI4IHDC.js} +20 -11
  51. package/dist/chunk-EBI4IHDC.js.map +1 -0
  52. package/dist/{chunk-RHUEV4I7.js → chunk-EIUTZ6N7.js} +10 -24
  53. package/dist/chunk-EIUTZ6N7.js.map +1 -0
  54. package/dist/{chunk-IUXXZHY3.js → chunk-EJZG5VUF.js} +24 -12
  55. package/dist/chunk-EJZG5VUF.js.map +1 -0
  56. package/dist/{chunk-BWWU5T2D.js → chunk-ENW5BVYN.js} +3 -3
  57. package/dist/{chunk-F5NWRF32.js → chunk-ETIAW4YD.js} +3 -3
  58. package/dist/chunk-EUPXAYPB.js +20 -0
  59. package/dist/chunk-EUPXAYPB.js.map +1 -0
  60. package/dist/{chunk-EGZNOUMH.js → chunk-FA6YNU75.js} +4 -5
  61. package/dist/{chunk-EGZNOUMH.js.map → chunk-FA6YNU75.js.map} +1 -1
  62. package/dist/{chunk-XUUSWR4U.js → chunk-FFH6R5VQ.js} +7 -2
  63. package/dist/{chunk-XUUSWR4U.js.map → chunk-FFH6R5VQ.js.map} +1 -1
  64. package/dist/{chunk-JEBH5APX.js → chunk-GE6H2COM.js} +5 -13
  65. package/dist/chunk-GE6H2COM.js.map +1 -0
  66. package/dist/{chunk-TUNR4VUM.js → chunk-GMMQ3ZK4.js} +3 -3
  67. package/dist/{chunk-SAOQW6ZJ.js → chunk-GSGE3M5P.js} +5 -13
  68. package/dist/chunk-GSGE3M5P.js.map +1 -0
  69. package/dist/{chunk-DXU7NZPH.js → chunk-HCRYAFBI.js} +3 -3
  70. package/dist/{chunk-OSVZKYXS.js → chunk-HOPUP6LA.js} +192 -156
  71. package/dist/chunk-HOPUP6LA.js.map +1 -0
  72. package/dist/chunk-HS24BL6W.js +160 -0
  73. package/dist/chunk-HS24BL6W.js.map +1 -0
  74. package/dist/chunk-HVYVG5KQ.js +16 -0
  75. package/dist/chunk-HVYVG5KQ.js.map +1 -0
  76. package/dist/{chunk-XEMLYWHK.js → chunk-I7CPLZNW.js} +4 -5
  77. package/dist/{chunk-XEMLYWHK.js.map → chunk-I7CPLZNW.js.map} +1 -1
  78. package/dist/{chunk-AULFV3KY.js → chunk-IFUCGI4I.js} +7 -2
  79. package/dist/chunk-IFUCGI4I.js.map +1 -0
  80. package/dist/{chunk-HGIPWY5Y.js → chunk-IFYXSSKR.js} +6 -6
  81. package/dist/chunk-IFYXSSKR.js.map +1 -0
  82. package/dist/chunk-IXA4DQE4.js +20 -0
  83. package/dist/chunk-IXA4DQE4.js.map +1 -0
  84. package/dist/chunk-IZMKMD3O.js +11 -0
  85. package/dist/chunk-IZMKMD3O.js.map +1 -0
  86. package/dist/{chunk-4X6CLF4F.js → chunk-JJERW2BI.js} +4 -5
  87. package/dist/{chunk-4X6CLF4F.js.map → chunk-JJERW2BI.js.map} +1 -1
  88. package/dist/{chunk-M6E7VK4D.js → chunk-JQR4HVUX.js} +2 -5
  89. package/dist/chunk-JQR4HVUX.js.map +1 -0
  90. package/dist/{chunk-BWLUBJQG.js → chunk-JXOMDLFS.js} +6 -15
  91. package/dist/chunk-JXOMDLFS.js.map +1 -0
  92. package/dist/{chunk-5ZHNPNDD.js → chunk-KIX6N7NT.js} +198 -141
  93. package/dist/chunk-KIX6N7NT.js.map +1 -0
  94. package/dist/{chunk-XFSEADPC.js → chunk-L42UTDFK.js} +7 -2
  95. package/dist/chunk-L42UTDFK.js.map +1 -0
  96. package/dist/chunk-M2UF2JHJ.js +11 -0
  97. package/dist/chunk-M2UF2JHJ.js.map +1 -0
  98. package/dist/{chunk-LPLZLSMK.js → chunk-MONC734W.js} +7 -2
  99. package/dist/chunk-MONC734W.js.map +1 -0
  100. package/dist/{chunk-XADEMW6B.js → chunk-N72RLCMU.js} +4 -5
  101. package/dist/{chunk-XADEMW6B.js.map → chunk-N72RLCMU.js.map} +1 -1
  102. package/dist/{chunk-ZPB3SLPK.js → chunk-ND4IWJ4V.js} +7 -2
  103. package/dist/chunk-ND4IWJ4V.js.map +1 -0
  104. package/dist/{chunk-ZPZQXHW2.js → chunk-NZ3EKGW4.js} +260 -178
  105. package/dist/chunk-NZ3EKGW4.js.map +1 -0
  106. package/dist/{chunk-E3KXVEYI.js → chunk-OAE57MNL.js} +22 -10
  107. package/dist/chunk-OAE57MNL.js.map +1 -0
  108. package/dist/{chunk-JBDFYIN2.js → chunk-OHKGIQB4.js} +2 -5
  109. package/dist/chunk-OHKGIQB4.js.map +1 -0
  110. package/dist/{chunk-V7JVMG63.js → chunk-OXEQSPND.js} +3 -3
  111. package/dist/{chunk-YRJICL2Q.js → chunk-PKNE5J2B.js} +5 -13
  112. package/dist/chunk-PKNE5J2B.js.map +1 -0
  113. package/dist/chunk-PSXXEGYQ.js +16 -0
  114. package/dist/chunk-PSXXEGYQ.js.map +1 -0
  115. package/dist/{chunk-KAWDDS27.js → chunk-QAOVABCR.js} +7 -2
  116. package/dist/chunk-QAOVABCR.js.map +1 -0
  117. package/dist/{chunk-SYMNWNC3.js → chunk-QQ7FP4GD.js} +4 -5
  118. package/dist/{chunk-SYMNWNC3.js.map → chunk-QQ7FP4GD.js.map} +1 -1
  119. package/dist/{chunk-3JZN3GYO.js → chunk-QYLVMC6B.js} +2 -5
  120. package/dist/chunk-QYLVMC6B.js.map +1 -0
  121. package/dist/{chunk-CXQGMFI7.js → chunk-RX3XR65X.js} +4 -5
  122. package/dist/{chunk-CXQGMFI7.js.map → chunk-RX3XR65X.js.map} +1 -1
  123. package/dist/{chunk-MRXTUFBZ.js → chunk-RYQJJB4C.js} +1 -1
  124. package/dist/chunk-RYQJJB4C.js.map +1 -0
  125. package/dist/{chunk-5I7Q7RHW.js → chunk-TUF7TCN7.js} +4 -5
  126. package/dist/{chunk-5I7Q7RHW.js.map → chunk-TUF7TCN7.js.map} +1 -1
  127. package/dist/{chunk-NLXJMXVE.js → chunk-TUX36JY5.js} +4 -5
  128. package/dist/{chunk-NLXJMXVE.js.map → chunk-TUX36JY5.js.map} +1 -1
  129. package/dist/{chunk-4GYB7DGC.js → chunk-TWRQCQWU.js} +327 -558
  130. package/dist/chunk-TWRQCQWU.js.map +1 -0
  131. package/dist/chunk-U6DFQRG3.js +20 -0
  132. package/dist/chunk-U6DFQRG3.js.map +1 -0
  133. package/dist/chunk-VI5YTKNY.js +20 -0
  134. package/dist/chunk-VI5YTKNY.js.map +1 -0
  135. package/dist/{chunk-FRGTDZQT.js → chunk-VQDF2UH5.js} +19 -5
  136. package/dist/chunk-VQDF2UH5.js.map +1 -0
  137. package/dist/{chunk-W5ZLIQFR.js → chunk-WG5YS6TC.js} +308 -200
  138. package/dist/chunk-WG5YS6TC.js.map +1 -0
  139. package/dist/{chunk-ZM44MGC5.js → chunk-WMJJ4WGF.js} +4 -5
  140. package/dist/{chunk-ZM44MGC5.js.map → chunk-WMJJ4WGF.js.map} +1 -1
  141. package/dist/{chunk-5YRWF5RP.js → chunk-WY4FNH42.js} +6 -5
  142. package/dist/chunk-WY4FNH42.js.map +1 -0
  143. package/dist/{chunk-VBYIDRNU.js → chunk-XIG5BWWH.js} +19 -10
  144. package/dist/chunk-XIG5BWWH.js.map +1 -0
  145. package/dist/chunk-XJBC3OYX.js +11 -0
  146. package/dist/chunk-XJBC3OYX.js.map +1 -0
  147. package/dist/{chunk-ZMREYTHA.js → chunk-XPRDXWK7.js} +8 -8
  148. package/dist/chunk-XPRDXWK7.js.map +1 -0
  149. package/dist/chunk-YKRQSZS7.js +96 -0
  150. package/dist/chunk-YKRQSZS7.js.map +1 -0
  151. package/dist/{chunk-IEVLWEBO.js → chunk-YMBL3VJB.js} +9 -8
  152. package/dist/chunk-YMBL3VJB.js.map +1 -0
  153. package/dist/{chunk-CGGO5NKD.js → chunk-YUJBXFYK.js} +357 -346
  154. package/dist/chunk-YUJBXFYK.js.map +1 -0
  155. package/dist/{chunk-S4KVLPBR.js → chunk-YZ4ZJNOL.js} +22 -10
  156. package/dist/chunk-YZ4ZJNOL.js.map +1 -0
  157. package/dist/chunk-ZTHVEXIV.js +11 -0
  158. package/dist/chunk-ZTHVEXIV.js.map +1 -0
  159. package/dist/{chunk-VHED2STW.js → chunk-ZVSYUCYS.js} +2 -1
  160. package/dist/chunk-ZVSYUCYS.js.map +1 -0
  161. package/dist/{config-T2IUIU5C.js → config-2YBCHU2W.js} +2 -2
  162. package/dist/{config-M3Z47VYU.js → config-3YRGRW72.js} +3 -2
  163. package/dist/config-4GSOMUMF.js +9 -0
  164. package/dist/config-5YBUWFUP.js +9 -0
  165. package/dist/{config-2LASFFRD.js → config-5ZRKJTKG.js} +3 -2
  166. package/dist/{config-W7EVPJNK.js → config-A25LTL5W.js} +2 -2
  167. package/dist/{config-WKQ3FGTZ.js → config-CLU7JABG.js} +2 -2
  168. package/dist/{config-E22XAGYN.js → config-D2RF7L3N.js} +2 -2
  169. package/dist/{config-HQXNFQZS.js → config-E55TKM6K.js} +2 -2
  170. package/dist/config-ELDOFRJW.js +9 -0
  171. package/dist/{config-EX3ZJTZI.js → config-FPC3RBFD.js} +2 -2
  172. package/dist/config-FPM3LAW7.js +9 -0
  173. package/dist/{config-IPNWAJHH.js → config-G3F54CS4.js} +3 -2
  174. package/dist/{config-BBOLI7VE.js → config-G43HRUI3.js} +2 -2
  175. package/dist/{config-QO2XUME4.js → config-GG3WO5PB.js} +3 -2
  176. package/dist/{config-QWQGOXQ5.js → config-JUYBWAZE.js} +2 -2
  177. package/dist/{config-SPW6NESU.js → config-LJ5T6TVA.js} +2 -2
  178. package/dist/{config-WVILHDFV.js → config-MDSAE4O3.js} +2 -2
  179. package/dist/{config-MZM3IPFM.js → config-NRIOKK5T.js} +2 -2
  180. package/dist/{config-L7SBSH5L.js → config-OYK2BSJK.js} +2 -2
  181. package/dist/config-PB3KA2CE.js +9 -0
  182. package/dist/{config-54USUVSE.js → config-QY4IL3PH.js} +3 -2
  183. package/dist/{config-VKKZGC7V.js → config-R4LAOEDS.js} +2 -2
  184. package/dist/{config-FRK7ZL37.js → config-RIAAD6RW.js} +3 -2
  185. package/dist/{config-J2C53GOT.js → config-SYNEQAUB.js} +2 -2
  186. package/dist/{config-XU6D5C7E.js → config-TJKGYA2B.js} +3 -2
  187. package/dist/{config-DWSJL3NH.js → config-UURRGA7U.js} +4 -2
  188. package/dist/{config-BIBFLUIR.js → config-VPLHQXVE.js} +2 -2
  189. package/dist/config-WRACCRPN.js +9 -0
  190. package/dist/{config-OJ2BPESH.js → config-WVHKXEVE.js} +3 -2
  191. package/dist/{config-CPYFOUQO.js → config-XU7R36IE.js} +3 -2
  192. package/dist/{config-A2GQYJDB.js → config-Y2KOUYSS.js} +2 -2
  193. package/dist/databricks_volume-CNCPTZHS.js +7 -0
  194. package/dist/digitalocean-DJZOUB6Q.js +11 -0
  195. package/dist/discord-ETB2CADR.js +7 -0
  196. package/dist/disk-WEHSTK3F.js +7 -0
  197. package/dist/dropbox-XN6PGLNE.js +8 -0
  198. package/dist/email-OV7XCP3T.js +8 -0
  199. package/dist/gcal-P56MRCGU.js +8 -0
  200. package/dist/gcs-HFBIAE2C.js +10 -0
  201. package/dist/gdocs-LQ3UXP3J.js +8 -0
  202. package/dist/gdrive-N6UBYLON.js +8 -0
  203. package/dist/github-BPZREGPI.js +8 -0
  204. package/dist/github_ci-7A4LUIZ7.js +8 -0
  205. package/dist/{gmail-2TBT4CVH.js → gmail-YED2MF6H.js} +2 -2
  206. package/dist/gridfs-CPLQ4G62.js +9 -0
  207. package/dist/gsheets-4BNIJPQ6.js +8 -0
  208. package/dist/gslides-GDBYLO5A.js +8 -0
  209. package/dist/hf_buckets-FTJITQ3P.js +10 -0
  210. package/dist/hf_datasets-6GXVKQD7.js +10 -0
  211. package/dist/hf_models-PJPGZAC5.js +10 -0
  212. package/dist/hf_spaces-LFNFOLBF.js +10 -0
  213. package/dist/index.d.ts +897 -609
  214. package/dist/index.js +2371 -781
  215. package/dist/index.js.map +1 -1
  216. package/dist/jaeger-GCA6MJ6E.js +8 -0
  217. package/dist/lancedb-TJ5YSJY5.js +7 -0
  218. package/dist/langfuse-RUMTUMXS.js +8 -0
  219. package/dist/linear-BCE4KEAC.js +7 -0
  220. package/dist/minio-5SO6KBTK.js +11 -0
  221. package/dist/mongodb-7C5MBESV.js +7 -0
  222. package/dist/nextcloud-4O2LZVW2.js +9 -0
  223. package/dist/notion-RVKEAQ2M.js +7 -0
  224. package/dist/oci-OQXOIC62.js +10 -0
  225. package/dist/postgres-AV45GNRS.js +7 -0
  226. package/dist/qingstor-W277YA4K.js +11 -0
  227. package/dist/r2-FUA4IORE.js +10 -0
  228. package/dist/{redis-6D55Q2WB.js → redis-LPS357NF.js} +2 -2
  229. package/dist/s3-FPNWWIVM.js +8 -0
  230. package/dist/scaleway-BP3732U7.js +11 -0
  231. package/dist/seaweedfs-MC6HIEP4.js +11 -0
  232. package/dist/slack-JFGW7VLN.js +7 -0
  233. package/dist/ssh-UYPG42LM.js +8 -0
  234. package/dist/supabase-A3KUFMDC.js +10 -0
  235. package/dist/tencent-5464UQ2X.js +11 -0
  236. package/dist/trello-O2KB3FUO.js +8 -0
  237. package/dist/wasabi-2IKBIWNO.js +10 -0
  238. package/dist/wasabi-2IKBIWNO.js.map +1 -0
  239. package/package.json +15 -3
  240. package/dist/aliyun-PGI57A43.js +0 -10
  241. package/dist/backblaze-TSPL6Y56.js +0 -10
  242. package/dist/box-7XTZYDSO.js +0 -8
  243. package/dist/ceph-C265UI5T.js +0 -10
  244. package/dist/chunk-2ERLWAGG.js.map +0 -1
  245. package/dist/chunk-2QNPKPZZ.js +0 -59
  246. package/dist/chunk-2QNPKPZZ.js.map +0 -1
  247. package/dist/chunk-3ASOQTZB.js +0 -59
  248. package/dist/chunk-3ASOQTZB.js.map +0 -1
  249. package/dist/chunk-3JZN3GYO.js.map +0 -1
  250. package/dist/chunk-4GYB7DGC.js.map +0 -1
  251. package/dist/chunk-5YRWF5RP.js.map +0 -1
  252. package/dist/chunk-5ZHNPNDD.js.map +0 -1
  253. package/dist/chunk-AULFV3KY.js.map +0 -1
  254. package/dist/chunk-BWLUBJQG.js.map +0 -1
  255. package/dist/chunk-C7TNKIK5.js.map +0 -1
  256. package/dist/chunk-CB76WPUS.js.map +0 -1
  257. package/dist/chunk-CGGO5NKD.js.map +0 -1
  258. package/dist/chunk-CQCTCW4S.js.map +0 -1
  259. package/dist/chunk-D3U7VQCG.js +0 -25
  260. package/dist/chunk-D3U7VQCG.js.map +0 -1
  261. package/dist/chunk-E3KXVEYI.js.map +0 -1
  262. package/dist/chunk-EVK6HH6Z.js +0 -17
  263. package/dist/chunk-EVK6HH6Z.js.map +0 -1
  264. package/dist/chunk-FRGTDZQT.js.map +0 -1
  265. package/dist/chunk-GF75O2EN.js +0 -54
  266. package/dist/chunk-GF75O2EN.js.map +0 -1
  267. package/dist/chunk-GTAS3QVC.js +0 -25
  268. package/dist/chunk-GTAS3QVC.js.map +0 -1
  269. package/dist/chunk-H62XQZUM.js.map +0 -1
  270. package/dist/chunk-HCU3B6FW.js.map +0 -1
  271. package/dist/chunk-HEDE2377.js.map +0 -1
  272. package/dist/chunk-HGIPWY5Y.js.map +0 -1
  273. package/dist/chunk-HSD24IP2.js.map +0 -1
  274. package/dist/chunk-HWQPEBID.js.map +0 -1
  275. package/dist/chunk-IEHPTILN.js +0 -21
  276. package/dist/chunk-IEHPTILN.js.map +0 -1
  277. package/dist/chunk-IEVLWEBO.js.map +0 -1
  278. package/dist/chunk-IKJQOYI4.js +0 -26
  279. package/dist/chunk-IKJQOYI4.js.map +0 -1
  280. package/dist/chunk-IUXXZHY3.js.map +0 -1
  281. package/dist/chunk-JBDFYIN2.js.map +0 -1
  282. package/dist/chunk-JEBH5APX.js.map +0 -1
  283. package/dist/chunk-JHI2PHHD.js +0 -25
  284. package/dist/chunk-JHI2PHHD.js.map +0 -1
  285. package/dist/chunk-KAWDDS27.js.map +0 -1
  286. package/dist/chunk-KGC2OGXI.js +0 -27
  287. package/dist/chunk-KGC2OGXI.js.map +0 -1
  288. package/dist/chunk-LPLZLSMK.js.map +0 -1
  289. package/dist/chunk-M6E7VK4D.js.map +0 -1
  290. package/dist/chunk-MIQ3ECZM.js +0 -54
  291. package/dist/chunk-MIQ3ECZM.js.map +0 -1
  292. package/dist/chunk-MRXTUFBZ.js.map +0 -1
  293. package/dist/chunk-NJ42VNXG.js.map +0 -1
  294. package/dist/chunk-OSVZKYXS.js.map +0 -1
  295. package/dist/chunk-RHUEV4I7.js.map +0 -1
  296. package/dist/chunk-S4KVLPBR.js.map +0 -1
  297. package/dist/chunk-SAOQW6ZJ.js.map +0 -1
  298. package/dist/chunk-SI4GMRXD.js.map +0 -1
  299. package/dist/chunk-UAJYJP5C.js +0 -59
  300. package/dist/chunk-UAJYJP5C.js.map +0 -1
  301. package/dist/chunk-UYA3XL3J.js +0 -54
  302. package/dist/chunk-UYA3XL3J.js.map +0 -1
  303. package/dist/chunk-VBYIDRNU.js.map +0 -1
  304. package/dist/chunk-VHED2STW.js.map +0 -1
  305. package/dist/chunk-VIICUPWQ.js +0 -23
  306. package/dist/chunk-VIICUPWQ.js.map +0 -1
  307. package/dist/chunk-VLRSOWHP.js.map +0 -1
  308. package/dist/chunk-W5ZLIQFR.js.map +0 -1
  309. package/dist/chunk-WTSSEUOZ.js +0 -59
  310. package/dist/chunk-WTSSEUOZ.js.map +0 -1
  311. package/dist/chunk-WWP2STF5.js +0 -59
  312. package/dist/chunk-WWP2STF5.js.map +0 -1
  313. package/dist/chunk-XFSEADPC.js.map +0 -1
  314. package/dist/chunk-YBVMZ7SR.js +0 -59
  315. package/dist/chunk-YBVMZ7SR.js.map +0 -1
  316. package/dist/chunk-YRJICL2Q.js.map +0 -1
  317. package/dist/chunk-ZMREYTHA.js.map +0 -1
  318. package/dist/chunk-ZPB3SLPK.js.map +0 -1
  319. package/dist/chunk-ZPZQXHW2.js.map +0 -1
  320. package/dist/config-3WDIJPTG.js +0 -9
  321. package/dist/config-4QV4QYI5.js +0 -9
  322. package/dist/config-5ZXN2T2H.js +0 -9
  323. package/dist/config-EHE52ZTK.js +0 -9
  324. package/dist/config-HTXOOAOD.js +0 -9
  325. package/dist/config-K63RX6EU.js +0 -9
  326. package/dist/config-LEALEMKA.js +0 -9
  327. package/dist/config-RI7IEZUF.js +0 -9
  328. package/dist/databricks_volume-ETRDJVVQ.js +0 -7
  329. package/dist/digitalocean-QP72DR4J.js +0 -10
  330. package/dist/discord-BSN5RB3E.js +0 -8
  331. package/dist/disk-24NWTN2I.js +0 -7
  332. package/dist/dropbox-OSTZXSIE.js +0 -8
  333. package/dist/email-4ZFPSWIN.js +0 -8
  334. package/dist/gcs-PFWR6MIW.js +0 -10
  335. package/dist/gdocs-GPAZRQG5.js +0 -8
  336. package/dist/gdrive-XSX6A7B3.js +0 -8
  337. package/dist/github-EQ4NXUTA.js +0 -8
  338. package/dist/github_ci-QL5B2Q2N.js +0 -8
  339. package/dist/gridfs-KZRZ6SIB.js +0 -9
  340. package/dist/gsheets-N53WEXN2.js +0 -8
  341. package/dist/gslides-TATSARTH.js +0 -8
  342. package/dist/hf_buckets-BK7NGJWS.js +0 -10
  343. package/dist/hf_datasets-UQ5QGM4L.js +0 -10
  344. package/dist/hf_models-75LFCQCS.js +0 -10
  345. package/dist/hf_spaces-6T2KB3UC.js +0 -10
  346. package/dist/langfuse-AMQCQWNE.js +0 -8
  347. package/dist/linear-V3TXO6CV.js +0 -8
  348. package/dist/minio-IZRZY4C5.js +0 -10
  349. package/dist/mongodb-VMKPQCPX.js +0 -7
  350. package/dist/nextcloud-5RHQCGDO.js +0 -9
  351. package/dist/notion-6PPNTQFM.js +0 -8
  352. package/dist/oci-CKYBSFZJ.js +0 -10
  353. package/dist/postgres-WIQBVL5M.js +0 -7
  354. package/dist/qingstor-AP4IIPLY.js +0 -10
  355. package/dist/r2-C4XGEWQY.js +0 -10
  356. package/dist/s3-XQBI2CXN.js +0 -8
  357. package/dist/scaleway-SEZJVURB.js +0 -10
  358. package/dist/seaweedfs-3XYIAFU2.js +0 -10
  359. package/dist/slack-ZHXDJQY4.js +0 -8
  360. package/dist/ssh-X2MO7JOV.js +0 -8
  361. package/dist/supabase-BBM44UTM.js +0 -10
  362. package/dist/tencent-X72USLJ7.js +0 -10
  363. package/dist/trello-EER5NG7L.js +0 -8
  364. package/dist/wasabi-O4MVIUFG.js +0 -10
  365. /package/dist/{aliyun-PGI57A43.js.map → aliyun-S62BR3TB.js.map} +0 -0
  366. /package/dist/{backblaze-TSPL6Y56.js.map → backblaze-4EKSW63F.js.map} +0 -0
  367. /package/dist/{box-7XTZYDSO.js.map → box-ZPLZAGMK.js.map} +0 -0
  368. /package/dist/{ceph-C265UI5T.js.map → ceph-ALKLD3MO.js.map} +0 -0
  369. /package/dist/{chunk-4M73WHIE.js.map → chunk-BZTVYOES.js.map} +0 -0
  370. /package/dist/{chunk-BWWU5T2D.js.map → chunk-ENW5BVYN.js.map} +0 -0
  371. /package/dist/{chunk-F5NWRF32.js.map → chunk-ETIAW4YD.js.map} +0 -0
  372. /package/dist/{chunk-TUNR4VUM.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
  373. /package/dist/{chunk-DXU7NZPH.js.map → chunk-HCRYAFBI.js.map} +0 -0
  374. /package/dist/{chunk-V7JVMG63.js.map → chunk-OXEQSPND.js.map} +0 -0
  375. /package/dist/{config-2LASFFRD.js.map → config-2YBCHU2W.js.map} +0 -0
  376. /package/dist/{config-3WDIJPTG.js.map → config-3YRGRW72.js.map} +0 -0
  377. /package/dist/{config-4QV4QYI5.js.map → config-4GSOMUMF.js.map} +0 -0
  378. /package/dist/{config-54USUVSE.js.map → config-5YBUWFUP.js.map} +0 -0
  379. /package/dist/{config-5ZXN2T2H.js.map → config-5ZRKJTKG.js.map} +0 -0
  380. /package/dist/{config-A2GQYJDB.js.map → config-A25LTL5W.js.map} +0 -0
  381. /package/dist/{config-BBOLI7VE.js.map → config-CLU7JABG.js.map} +0 -0
  382. /package/dist/{config-BIBFLUIR.js.map → config-D2RF7L3N.js.map} +0 -0
  383. /package/dist/{config-CPYFOUQO.js.map → config-E55TKM6K.js.map} +0 -0
  384. /package/dist/{config-DWSJL3NH.js.map → config-ELDOFRJW.js.map} +0 -0
  385. /package/dist/{config-E22XAGYN.js.map → config-FPC3RBFD.js.map} +0 -0
  386. /package/dist/{config-EHE52ZTK.js.map → config-FPM3LAW7.js.map} +0 -0
  387. /package/dist/{config-EX3ZJTZI.js.map → config-G3F54CS4.js.map} +0 -0
  388. /package/dist/{config-FRK7ZL37.js.map → config-G43HRUI3.js.map} +0 -0
  389. /package/dist/{config-HQXNFQZS.js.map → config-GG3WO5PB.js.map} +0 -0
  390. /package/dist/{config-HTXOOAOD.js.map → config-JUYBWAZE.js.map} +0 -0
  391. /package/dist/{config-IPNWAJHH.js.map → config-LJ5T6TVA.js.map} +0 -0
  392. /package/dist/{config-J2C53GOT.js.map → config-MDSAE4O3.js.map} +0 -0
  393. /package/dist/{config-K63RX6EU.js.map → config-NRIOKK5T.js.map} +0 -0
  394. /package/dist/{config-L7SBSH5L.js.map → config-OYK2BSJK.js.map} +0 -0
  395. /package/dist/{config-LEALEMKA.js.map → config-PB3KA2CE.js.map} +0 -0
  396. /package/dist/{config-M3Z47VYU.js.map → config-QY4IL3PH.js.map} +0 -0
  397. /package/dist/{config-MZM3IPFM.js.map → config-R4LAOEDS.js.map} +0 -0
  398. /package/dist/{config-OJ2BPESH.js.map → config-RIAAD6RW.js.map} +0 -0
  399. /package/dist/{config-QO2XUME4.js.map → config-SYNEQAUB.js.map} +0 -0
  400. /package/dist/{config-QWQGOXQ5.js.map → config-TJKGYA2B.js.map} +0 -0
  401. /package/dist/{config-RI7IEZUF.js.map → config-UURRGA7U.js.map} +0 -0
  402. /package/dist/{config-SPW6NESU.js.map → config-VPLHQXVE.js.map} +0 -0
  403. /package/dist/{config-T2IUIU5C.js.map → config-WRACCRPN.js.map} +0 -0
  404. /package/dist/{config-VKKZGC7V.js.map → config-WVHKXEVE.js.map} +0 -0
  405. /package/dist/{config-W7EVPJNK.js.map → config-XU7R36IE.js.map} +0 -0
  406. /package/dist/{config-WKQ3FGTZ.js.map → config-Y2KOUYSS.js.map} +0 -0
  407. /package/dist/{config-WVILHDFV.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
  408. /package/dist/{config-XU6D5C7E.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
  409. /package/dist/{databricks_volume-ETRDJVVQ.js.map → discord-ETB2CADR.js.map} +0 -0
  410. /package/dist/{digitalocean-QP72DR4J.js.map → disk-WEHSTK3F.js.map} +0 -0
  411. /package/dist/{discord-BSN5RB3E.js.map → dropbox-XN6PGLNE.js.map} +0 -0
  412. /package/dist/{disk-24NWTN2I.js.map → email-OV7XCP3T.js.map} +0 -0
  413. /package/dist/{dropbox-OSTZXSIE.js.map → gcal-P56MRCGU.js.map} +0 -0
  414. /package/dist/{email-4ZFPSWIN.js.map → gcs-HFBIAE2C.js.map} +0 -0
  415. /package/dist/{gcs-PFWR6MIW.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
  416. /package/dist/{gdocs-GPAZRQG5.js.map → gdrive-N6UBYLON.js.map} +0 -0
  417. /package/dist/{gdrive-XSX6A7B3.js.map → github-BPZREGPI.js.map} +0 -0
  418. /package/dist/{github-EQ4NXUTA.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
  419. /package/dist/{github_ci-QL5B2Q2N.js.map → gmail-YED2MF6H.js.map} +0 -0
  420. /package/dist/{gmail-2TBT4CVH.js.map → gridfs-CPLQ4G62.js.map} +0 -0
  421. /package/dist/{gridfs-KZRZ6SIB.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
  422. /package/dist/{gsheets-N53WEXN2.js.map → gslides-GDBYLO5A.js.map} +0 -0
  423. /package/dist/{gslides-TATSARTH.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
  424. /package/dist/{hf_buckets-BK7NGJWS.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
  425. /package/dist/{hf_datasets-UQ5QGM4L.js.map → hf_models-PJPGZAC5.js.map} +0 -0
  426. /package/dist/{hf_models-75LFCQCS.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
  427. /package/dist/{hf_spaces-6T2KB3UC.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
  428. /package/dist/{langfuse-AMQCQWNE.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
  429. /package/dist/{linear-V3TXO6CV.js.map → langfuse-RUMTUMXS.js.map} +0 -0
  430. /package/dist/{minio-IZRZY4C5.js.map → linear-BCE4KEAC.js.map} +0 -0
  431. /package/dist/{mongodb-VMKPQCPX.js.map → minio-5SO6KBTK.js.map} +0 -0
  432. /package/dist/{nextcloud-5RHQCGDO.js.map → mongodb-7C5MBESV.js.map} +0 -0
  433. /package/dist/{notion-6PPNTQFM.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
  434. /package/dist/{oci-CKYBSFZJ.js.map → notion-RVKEAQ2M.js.map} +0 -0
  435. /package/dist/{postgres-WIQBVL5M.js.map → oci-OQXOIC62.js.map} +0 -0
  436. /package/dist/{qingstor-AP4IIPLY.js.map → postgres-AV45GNRS.js.map} +0 -0
  437. /package/dist/{r2-C4XGEWQY.js.map → qingstor-W277YA4K.js.map} +0 -0
  438. /package/dist/{redis-6D55Q2WB.js.map → r2-FUA4IORE.js.map} +0 -0
  439. /package/dist/{s3-XQBI2CXN.js.map → redis-LPS357NF.js.map} +0 -0
  440. /package/dist/{scaleway-SEZJVURB.js.map → s3-FPNWWIVM.js.map} +0 -0
  441. /package/dist/{seaweedfs-3XYIAFU2.js.map → scaleway-BP3732U7.js.map} +0 -0
  442. /package/dist/{slack-ZHXDJQY4.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
  443. /package/dist/{ssh-X2MO7JOV.js.map → slack-JFGW7VLN.js.map} +0 -0
  444. /package/dist/{supabase-BBM44UTM.js.map → ssh-UYPG42LM.js.map} +0 -0
  445. /package/dist/{tencent-X72USLJ7.js.map → supabase-A3KUFMDC.js.map} +0 -0
  446. /package/dist/{trello-EER5NG7L.js.map → tencent-5464UQ2X.js.map} +0 -0
  447. /package/dist/{wasabi-O4MVIUFG.js.map → trello-O2KB3FUO.js.map} +0 -0
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-OQKNDS66.js";
4
4
  import {
5
5
  redactConfig
6
- } from "./chunk-C7TNKIK5.js";
6
+ } from "./chunk-CTGXJHO5.js";
7
7
 
8
8
  // src/resource/gridfs/gridfs.ts
9
9
  import {
10
10
  BaseResource,
11
11
  PathSpec,
12
- ResourceName as ResourceName12,
12
+ ResourceName as ResourceName13,
13
13
  makeResolveGlob,
14
14
  mountKey,
15
15
  mountPrefixOf as mountPrefixOf4,
@@ -52,18 +52,20 @@ var GridFSAccessor = class extends Accessor {
52
52
 
53
53
  // src/commands/builtin/gridfs/index.ts
54
54
  import {
55
- ResourceName as ResourceName10,
56
- makeFiletypeCommands,
57
- makeGenericCommands
55
+ ResourceName as ResourceName11,
56
+ makeGenericCommands,
57
+ resolveGlobOf as resolveGlobOf6,
58
+ withDefaultProvisions
58
59
  } from "@struktoai/mirage-core";
59
60
 
60
- // src/core/gridfs/read.ts
61
- import {
62
- ResourceName,
63
- enoent,
64
- record,
65
- revisionFor
66
- } from "@struktoai/mirage-core";
61
+ // src/commands/builtin/gridfs/io.ts
62
+ import { rangeOf } from "@struktoai/mirage-core";
63
+
64
+ // src/core/gridfs/constants.ts
65
+ var SCOPE_ERROR = 5e3;
66
+
67
+ // src/core/gridfs/copy.ts
68
+ import { enoent, invalidateAfterWrite } from "@struktoai/mirage-core";
67
69
 
68
70
  // src/core/gridfs/_client.ts
69
71
  import { keyPrefix as kp, mountPrefixOf } from "@struktoai/mirage-core";
@@ -166,70 +168,101 @@ async function deleteAll(accessor, query) {
166
168
  }
167
169
  }
168
170
 
169
- // src/core/gridfs/read.ts
170
- async function resolveFileId(accessor, path, key) {
171
- const pinnedRevision = revisionFor(path.virtual);
172
- if (pinnedRevision !== null) {
173
- const mod = await loadGridFSModule();
174
- const objectIdCtor = mod.ObjectId;
175
- return new objectIdCtor(pinnedRevision);
176
- }
177
- const doc = await latestFile(accessor, key);
178
- if (doc === null) throw enoent(path);
179
- return doc._id;
180
- }
181
- async function downloadBytes(accessor, path, fileId, options = {}) {
171
+ // src/core/gridfs/copy.ts
172
+ async function copy(accessor, src, dst) {
173
+ const srcKey = gridfsKey(rawPathOf(src), accessor.config);
174
+ const dstKey = gridfsKey(rawPathOf(dst), accessor.config);
175
+ const doc = await latestFile(accessor, srcKey);
176
+ if (doc === null) throw enoent(src);
182
177
  const b = await bucket(accessor);
183
- const streamOptions = {};
184
- if (options.offset !== void 0 && options.offset !== 0) {
185
- streamOptions.start = options.offset;
186
- }
187
- if (options.size !== void 0) {
188
- streamOptions.end = (options.offset ?? 0) + options.size;
189
- }
190
- const readable = b.openDownloadStream(
191
- fileId,
192
- Object.keys(streamOptions).length > 0 ? streamOptions : void 0
193
- );
194
- const chunks = [];
195
- let total = 0;
196
- try {
197
- for await (const chunk of readable) {
198
- chunks.push(chunk);
199
- total += chunk.byteLength;
200
- }
201
- } catch (err) {
202
- if (err?.code === "ENOENT" || isNoFileError(err)) {
203
- throw enoent(path);
204
- }
205
- throw err;
206
- }
207
- const out = new Uint8Array(total);
208
- let offset = 0;
209
- for (const c of chunks) {
210
- out.set(c, offset);
211
- offset += c.byteLength;
212
- }
213
- return out;
178
+ const readable = b.openDownloadStream(doc._id);
179
+ const upload = b.openUploadStream(dstKey);
180
+ await new Promise((resolve, reject) => {
181
+ upload.on("error", reject);
182
+ readable.on("error", reject);
183
+ upload.on("finish", () => {
184
+ resolve();
185
+ });
186
+ readable.pipe(upload);
187
+ });
188
+ await invalidateAfterWrite(dst);
214
189
  }
215
- function isNoFileError(err) {
216
- if (err === null || typeof err !== "object") return false;
217
- const message = err.message ?? "";
218
- return message.includes("FileNotFound");
190
+
191
+ // src/core/gridfs/create.ts
192
+ import { ResourceName as ResourceName2, invalidateAfterWrite as invalidateAfterWrite3, record as record2 } from "@struktoai/mirage-core";
193
+
194
+ // src/core/gridfs/write.ts
195
+ import {
196
+ ResourceName,
197
+ invalidateAfterWrite as invalidateAfterWrite2,
198
+ invalidateAncestors,
199
+ record
200
+ } from "@struktoai/mirage-core";
201
+ async function uploadBytes(accessor, key, data) {
202
+ const b = await bucket(accessor);
203
+ const upload = b.openUploadStream(key);
204
+ await new Promise((resolve, reject) => {
205
+ upload.on("error", reject);
206
+ upload.on("finish", () => {
207
+ resolve();
208
+ });
209
+ upload.end(data);
210
+ });
219
211
  }
220
- async function read(accessor, path, _index, options = {}) {
221
- const virtual = path.virtual;
212
+ async function write(accessor, path, data) {
222
213
  const raw = rawPathOf(path);
223
214
  const key = gridfsKey(raw, accessor.config);
224
215
  const startMs = performance.now();
225
- const fileId = await resolveFileId(accessor, path, key);
226
- const bytes = await downloadBytes(accessor, path, fileId, options);
227
- const revision = fileId.toString();
228
- record("read", virtual, ResourceName.GRIDFS, bytes.byteLength, startMs, {
229
- fingerprint: revision,
230
- revision
231
- });
232
- return bytes;
216
+ await uploadBytes(accessor, key, data);
217
+ record("write", path.virtual, ResourceName.GRIDFS, data.byteLength, startMs);
218
+ await invalidateAfterWrite2(path);
219
+ await invalidateAncestors(path);
220
+ }
221
+
222
+ // src/core/gridfs/create.ts
223
+ async function create(accessor, path) {
224
+ const raw = rawPathOf(path);
225
+ const startMs = performance.now();
226
+ await uploadBytes(accessor, gridfsKey(raw, accessor.config), new Uint8Array(0));
227
+ record2("create", path.virtual, ResourceName2.GRIDFS, 0, startMs);
228
+ await invalidateAfterWrite3(path);
229
+ }
230
+
231
+ // src/core/gridfs/du/entries.ts
232
+ import { rstripSlash } from "@struktoai/mirage-core";
233
+
234
+ // src/core/gridfs/du/walk.ts
235
+ function duQuery(stem) {
236
+ if (stem === "") return {};
237
+ return {
238
+ $or: [{ filename: stem }, { filename: { $regex: `^${escapeRegex(stem + "/")}` } }]
239
+ };
240
+ }
241
+
242
+ // src/core/gridfs/du/entries.ts
243
+ async function entries(accessor, path) {
244
+ const raw = rawPathOf(path);
245
+ const stem = rstripSlash(gridfsKey(raw, accessor.config));
246
+ const entries2 = [];
247
+ let total = 0;
248
+ for await (const doc of iterLatest(accessor, duQuery(stem))) {
249
+ const entry = "/" + stripKeyPrefix(doc.filename, accessor.config);
250
+ entries2.push([entry, doc.length]);
251
+ total += doc.length;
252
+ }
253
+ return [entries2, total];
254
+ }
255
+
256
+ // src/core/gridfs/du/size.ts
257
+ import { rstripSlash as rstripSlash2 } from "@struktoai/mirage-core";
258
+ async function size(accessor, path) {
259
+ const raw = rawPathOf(path);
260
+ const stem = rstripSlash2(gridfsKey(raw, accessor.config));
261
+ let total = 0;
262
+ for await (const doc of iterLatest(accessor, duQuery(stem))) {
263
+ total += doc.length;
264
+ }
265
+ return total;
233
266
  }
234
267
 
235
268
  // src/core/gridfs/stat.ts
@@ -240,7 +273,7 @@ import {
240
273
  gnuBasename,
241
274
  guessType,
242
275
  mountPrefixOf as mountPrefixOf2,
243
- rstripSlash,
276
+ rstripSlash as rstripSlash3,
244
277
  stripSlash
245
278
  } from "@struktoai/mirage-core";
246
279
  async function stat(accessor, path, index) {
@@ -290,7 +323,7 @@ async function stat(accessor, path, index) {
290
323
  });
291
324
  }
292
325
  }
293
- const pfx = rstripSlash(key) + "/";
326
+ const pfx = rstripSlash3(key) + "/";
294
327
  const files = await filesColl(accessor);
295
328
  const probe = await files.findOne(
296
329
  { filename: { $regex: `^${escapeRegex(pfx)}` } },
@@ -302,102 +335,6 @@ async function stat(accessor, path, index) {
302
335
  throw enoent2(path);
303
336
  }
304
337
 
305
- // src/commands/builtin/gridfs/du.ts
306
- import {
307
- ResourceName as ResourceName4,
308
- command,
309
- duGeneric,
310
- metadataProvision,
311
- resolveGlobOf,
312
- specOf
313
- } from "@struktoai/mirage-core";
314
-
315
- // src/core/gridfs/du.ts
316
- import { rstripSlash as rstripSlash2 } from "@struktoai/mirage-core";
317
- function duQuery(stem) {
318
- if (stem === "") return {};
319
- return {
320
- $or: [{ filename: stem }, { filename: { $regex: `^${escapeRegex(stem + "/")}` } }]
321
- };
322
- }
323
- async function du(accessor, path) {
324
- const raw = rawPathOf(path);
325
- const stem = rstripSlash2(gridfsKey(raw, accessor.config));
326
- let total = 0;
327
- for await (const doc of iterLatest(accessor, duQuery(stem))) {
328
- total += doc.length;
329
- }
330
- return total;
331
- }
332
- async function duAll(accessor, path) {
333
- const raw = rawPathOf(path);
334
- const stem = rstripSlash2(gridfsKey(raw, accessor.config));
335
- const entries = [];
336
- let total = 0;
337
- for await (const doc of iterLatest(accessor, duQuery(stem))) {
338
- const entry = "/" + stripKeyPrefix(doc.filename, accessor.config);
339
- entries.push([entry, doc.length]);
340
- total += doc.length;
341
- }
342
- return [entries, total];
343
- }
344
-
345
- // src/core/gridfs/constants.ts
346
- var SCOPE_ERROR = 5e3;
347
-
348
- // src/core/gridfs/copy.ts
349
- import { enoent as enoent3, invalidateAfterWrite } from "@struktoai/mirage-core";
350
- async function copy(accessor, src, dst) {
351
- const srcKey = gridfsKey(rawPathOf(src), accessor.config);
352
- const dstKey = gridfsKey(rawPathOf(dst), accessor.config);
353
- const doc = await latestFile(accessor, srcKey);
354
- if (doc === null) throw enoent3(src);
355
- const b = await bucket(accessor);
356
- const readable = b.openDownloadStream(doc._id);
357
- const upload = b.openUploadStream(dstKey);
358
- await new Promise((resolve, reject) => {
359
- upload.on("error", reject);
360
- readable.on("error", reject);
361
- upload.on("finish", () => {
362
- resolve();
363
- });
364
- readable.pipe(upload);
365
- });
366
- await invalidateAfterWrite(dst);
367
- }
368
-
369
- // src/core/gridfs/create.ts
370
- import { invalidateAfterWrite as invalidateAfterWrite3 } from "@struktoai/mirage-core";
371
-
372
- // src/core/gridfs/write.ts
373
- import { ResourceName as ResourceName2, invalidateAfterWrite as invalidateAfterWrite2, record as record2 } from "@struktoai/mirage-core";
374
- async function uploadBytes(accessor, key, data) {
375
- const b = await bucket(accessor);
376
- const upload = b.openUploadStream(key);
377
- await new Promise((resolve, reject) => {
378
- upload.on("error", reject);
379
- upload.on("finish", () => {
380
- resolve();
381
- });
382
- upload.end(data);
383
- });
384
- }
385
- async function write(accessor, path, data) {
386
- const raw = rawPathOf(path);
387
- const key = gridfsKey(raw, accessor.config);
388
- const startMs = performance.now();
389
- await uploadBytes(accessor, key, data);
390
- record2("write", path.virtual, ResourceName2.GRIDFS, data.byteLength, startMs);
391
- await invalidateAfterWrite2(path);
392
- }
393
-
394
- // src/core/gridfs/create.ts
395
- async function create(accessor, path) {
396
- const raw = rawPathOf(path);
397
- await uploadBytes(accessor, gridfsKey(raw, accessor.config), new Uint8Array(0));
398
- await invalidateAfterWrite3(path);
399
- }
400
-
401
338
  // src/core/gridfs/exists.ts
402
339
  async function exists(accessor, path) {
403
340
  try {
@@ -414,8 +351,9 @@ import {
414
351
  buildTree,
415
352
  emitStartPath,
416
353
  keep,
417
- rstripSlash as rstripSlash3,
418
- startBasename
354
+ rstripSlash as rstripSlash4,
355
+ startBasename,
356
+ compareCodePoints
419
357
  } from "@struktoai/mirage-core";
420
358
  function globRegex(pattern) {
421
359
  if (pattern.includes("[") || pattern.includes("]")) return null;
@@ -465,10 +403,13 @@ async function find(accessor, path, options = {}) {
465
403
  const raw = rawPathOf(path);
466
404
  const startName = startBasename(path.virtual);
467
405
  const pfx = gridfsPrefix(raw, accessor.config);
406
+ const rootKey = rstripSlash4("/" + stripKeyPrefix(pfx, accessor.config)) || "/";
407
+ const baseDepth = rootKey === "/" ? 0 : (rootKey.match(/\//g) ?? []).length;
468
408
  const results = [];
409
+ const seenDirs = /* @__PURE__ */ new Set();
469
410
  const seen = { descendant: false, marker: false };
470
411
  const empty = options.empty === true;
471
- const pushdown = options.tree === void 0 && options.nameExclude === void 0 && options.orNames === void 0 && options.pathPattern === void 0 && !empty;
412
+ const pushdown = options.tree === void 0 && options.nameExclude === void 0 && options.orNames === void 0 && options.pathPattern === void 0 && !empty && options.type === "f";
472
413
  const tree = options.tree ?? buildTree({
473
414
  name: options.name,
474
415
  iname: options.iname,
@@ -487,30 +428,39 @@ async function find(accessor, path, options = {}) {
487
428
  continue;
488
429
  }
489
430
  seen.descendant = true;
490
- const relative = key.slice(pfx.length);
491
- const depth = (relative.match(/\//g) ?? []).length + 1;
492
- if (options.maxDepth !== null && options.maxDepth !== void 0 && depth > options.maxDepth) {
493
- continue;
494
- }
495
431
  const isDir = key.endsWith("/");
496
- const normKey = isDir ? key.slice(0, -1) : key;
497
- const entryName = normKey.split("/").pop() ?? "";
498
- const fullPath = rstripSlash3("/" + stripKeyPrefix(key, accessor.config)) || "/";
499
- const size = doc.length;
500
- const isEmpty = !empty ? null : isDir ? false : size === 0;
501
- if (!keep(
502
- { key: fullPath, name: entryName, kind: isDir ? "d" : "f", depth, isEmpty },
503
- tree,
504
- options.minDepth
505
- )) {
506
- continue;
432
+ const fullPath = rstripSlash4("/" + stripKeyPrefix(key, accessor.config)) || "/";
433
+ const size2 = doc.length;
434
+ if (isDir) {
435
+ if (seenDirs.has(fullPath)) continue;
436
+ seenDirs.add(fullPath);
507
437
  }
508
- if (options.minSize != null || options.maxSize != null) {
509
- const effective = isDir ? 0 : size;
510
- if (options.minSize != null && effective < options.minSize) continue;
511
- if (options.maxSize != null && effective > options.maxSize) continue;
438
+ const entries2 = [[fullPath, isDir ? "d" : "f"]];
439
+ let parent = fullPath.slice(0, fullPath.lastIndexOf("/")) || "/";
440
+ while (parent !== rootKey && parent !== "/") {
441
+ if (!seenDirs.has(parent)) {
442
+ seenDirs.add(parent);
443
+ entries2.push([parent, "d"]);
444
+ }
445
+ parent = parent.slice(0, parent.lastIndexOf("/")) || "/";
446
+ }
447
+ for (const [ep, kind] of entries2) {
448
+ const entryName = ep.split("/").pop() ?? "";
449
+ const depth = (ep.match(/\//g) ?? []).length - baseDepth;
450
+ if (options.maxDepth !== null && options.maxDepth !== void 0 && depth > options.maxDepth) {
451
+ continue;
452
+ }
453
+ const isEmpty = !empty ? null : kind === "d" ? false : size2 === 0;
454
+ if (!keep({ key: ep, name: entryName, kind, depth, isEmpty }, tree, options.minDepth)) {
455
+ continue;
456
+ }
457
+ if (options.minSize != null || options.maxSize != null) {
458
+ const effective = kind === "d" ? 0 : size2;
459
+ if (options.minSize != null && effective < options.minSize) continue;
460
+ if (options.maxSize != null && effective > options.maxSize) continue;
461
+ }
462
+ results.push(ep);
512
463
  }
513
- results.push(fullPath);
514
464
  }
515
465
  if (narrowed && !seen.descendant && !seen.marker) {
516
466
  const files = await filesColl(accessor);
@@ -520,11 +470,10 @@ async function find(accessor, path, options = {}) {
520
470
  );
521
471
  seen.descendant = probe !== null;
522
472
  }
523
- const rootKey = rstripSlash3("/" + stripKeyPrefix(pfx, accessor.config)) || "/";
524
473
  if (seen.descendant || seen.marker) {
525
474
  emitStartPath(results, rootKey, startName, {
526
475
  kind: "d",
527
- isEmpty: empty ? false : null,
476
+ isEmpty: empty ? !seen.descendant : null,
528
477
  exists: true,
529
478
  tree,
530
479
  maxDepth: options.maxDepth,
@@ -533,18 +482,90 @@ async function find(accessor, path, options = {}) {
533
482
  maxSize: options.maxSize
534
483
  });
535
484
  }
536
- return results.sort();
485
+ return [...new Set(results)].sort(compareCodePoints);
537
486
  }
538
487
 
539
488
  // src/core/gridfs/mkdir.ts
540
- import { invalidateAfterWrite as invalidateAfterWrite4, invalidateAncestors } from "@struktoai/mirage-core";
489
+ import { invalidateAfterWrite as invalidateAfterWrite4, invalidateAncestors as invalidateAncestors2 } from "@struktoai/mirage-core";
541
490
  async function mkdir(accessor, path, parents = false) {
542
491
  const raw = rawPathOf(path);
543
492
  const pfx = gridfsPrefix(raw, accessor.config);
544
493
  if (pfx === "") return;
545
494
  await uploadBytes(accessor, pfx, new Uint8Array(0));
546
495
  await invalidateAfterWrite4(path);
547
- if (parents) await invalidateAncestors(path);
496
+ if (parents) await invalidateAncestors2(path);
497
+ }
498
+
499
+ // src/core/gridfs/read.ts
500
+ import {
501
+ ResourceName as ResourceName3,
502
+ enoent as enoent3,
503
+ record as record3,
504
+ revisionFor
505
+ } from "@struktoai/mirage-core";
506
+ async function resolveFileId(accessor, path, key) {
507
+ const pinnedRevision = revisionFor(path.virtual);
508
+ if (pinnedRevision !== null) {
509
+ const mod = await loadGridFSModule();
510
+ const objectIdCtor = mod.ObjectId;
511
+ return new objectIdCtor(pinnedRevision);
512
+ }
513
+ const doc = await latestFile(accessor, key);
514
+ if (doc === null) throw enoent3(path);
515
+ return doc._id;
516
+ }
517
+ async function downloadBytes(accessor, path, fileId, options = {}) {
518
+ const b = await bucket(accessor);
519
+ const streamOptions = {};
520
+ if (options.offset !== void 0 && options.offset !== 0) {
521
+ streamOptions.start = options.offset;
522
+ }
523
+ if (options.size !== void 0) {
524
+ streamOptions.end = (options.offset ?? 0) + options.size;
525
+ }
526
+ const readable = b.openDownloadStream(
527
+ fileId,
528
+ Object.keys(streamOptions).length > 0 ? streamOptions : void 0
529
+ );
530
+ const chunks = [];
531
+ let total = 0;
532
+ try {
533
+ for await (const chunk of readable) {
534
+ chunks.push(chunk);
535
+ total += chunk.byteLength;
536
+ }
537
+ } catch (err) {
538
+ if (err?.code === "ENOENT" || isNoFileError(err)) {
539
+ throw enoent3(path);
540
+ }
541
+ throw err;
542
+ }
543
+ const out = new Uint8Array(total);
544
+ let offset = 0;
545
+ for (const c of chunks) {
546
+ out.set(c, offset);
547
+ offset += c.byteLength;
548
+ }
549
+ return out;
550
+ }
551
+ function isNoFileError(err) {
552
+ if (err === null || typeof err !== "object") return false;
553
+ const message = err.message ?? "";
554
+ return message.includes("FileNotFound");
555
+ }
556
+ async function read(accessor, path, _index, options = {}) {
557
+ const virtual = path.virtual;
558
+ const raw = rawPathOf(path);
559
+ const key = gridfsKey(raw, accessor.config);
560
+ const startMs = performance.now();
561
+ const fileId = await resolveFileId(accessor, path, key);
562
+ const bytes = await downloadBytes(accessor, path, fileId, options);
563
+ const revision = fileId.toString();
564
+ record3("read", virtual, ResourceName3.GRIDFS, bytes.byteLength, startMs, {
565
+ fingerprint: revision,
566
+ revision
567
+ });
568
+ return bytes;
548
569
  }
549
570
 
550
571
  // src/core/gridfs/readdir.ts
@@ -552,16 +573,17 @@ import {
552
573
  IndexEntry,
553
574
  ResourceType,
554
575
  mountPrefixOf as mountPrefixOf3,
555
- rstripSlash as rstripSlash4
576
+ rstripSlash as rstripSlash5,
577
+ compareCodePoints as compareCodePoints2
556
578
  } from "@struktoai/mirage-core";
557
579
  async function readdir(accessor, path, index) {
558
580
  const original = path.virtual;
559
581
  const prefix = mountPrefixOf3(path.virtual, path.resourcePath);
560
582
  const virtual = path.pattern !== null ? path.directory : original;
561
583
  const rawPath = prefix !== "" && virtual.startsWith(prefix) ? virtual.slice(prefix.length) || "/" : virtual;
562
- const virtualKey = rawPath === "/" ? "/" : rstripSlash4(rawPath) || "/";
584
+ const virtualKey = rawPath === "/" ? "/" : rstripSlash5(rawPath) || "/";
563
585
  const rawFullKey = prefix !== "" ? `${prefix}${virtualKey}` : virtualKey;
564
- const fullVirtualKey = rstripSlash4(rawFullKey) || "/";
586
+ const fullVirtualKey = rstripSlash5(rawFullKey) || "/";
565
587
  if (index !== void 0) {
566
588
  const listing = await index.listDir(fullVirtualKey);
567
589
  if (listing.entries !== void 0 && listing.entries !== null) {
@@ -593,13 +615,13 @@ async function readdir(accessor, path, index) {
593
615
  }
594
616
  }
595
617
  }
596
- names.sort();
618
+ names.sort(compareCodePoints2);
597
619
  if (names.length > SCOPE_ERROR) {
598
620
  console.warn(
599
621
  `gridfs readdir: ${fullVirtualKey} returned ${String(names.length)} entries (limit ${String(SCOPE_ERROR)})`
600
622
  );
601
623
  }
602
- const virtualEntries = names.map((e) => prefix !== "" ? `${prefix}${e}` : e).sort();
624
+ const virtualEntries = names.map((e) => prefix !== "" ? `${prefix}${e}` : e).sort(compareCodePoints2);
603
625
  if (index !== void 0) {
604
626
  const indexEntries = names.map((e) => {
605
627
  const name = e.split("/").pop() ?? "";
@@ -660,13 +682,13 @@ async function rmdir(accessor, path) {
660
682
  }
661
683
 
662
684
  // src/core/gridfs/stream.ts
663
- import { ResourceName as ResourceName3, enoent as enoent5, recordStream } from "@struktoai/mirage-core";
685
+ import { ResourceName as ResourceName4, enoent as enoent5, recordStream } from "@struktoai/mirage-core";
664
686
  var DEFAULT_CHUNK_SIZE = 8192;
665
687
  async function* stream(accessor, path) {
666
688
  const virtual = path.virtual;
667
689
  const raw = rawPathOf(path);
668
690
  const key = gridfsKey(raw, accessor.config);
669
- const rec = recordStream("read", virtual, ResourceName3.GRIDFS);
691
+ const rec = recordStream("read", virtual, ResourceName4.GRIDFS);
670
692
  const fileId = await resolveFileId(accessor, path, key);
671
693
  if (rec !== null) {
672
694
  const revision = fileId.toString();
@@ -698,15 +720,16 @@ async function* stream(accessor, path) {
698
720
  yield pending;
699
721
  }
700
722
  }
701
- async function rangeRead(accessor, path, offset, size) {
702
- return read(accessor, path, void 0, { offset, size });
723
+ async function rangeRead(accessor, path, start, end) {
724
+ return read(accessor, path, void 0, { offset: start, size: end - start });
703
725
  }
704
726
 
705
727
  // src/core/gridfs/truncate.ts
706
- import { invalidateAfterWrite as invalidateAfterWrite6 } from "@struktoai/mirage-core";
728
+ import { ResourceName as ResourceName5, invalidateAfterWrite as invalidateAfterWrite6, record as record4 } from "@struktoai/mirage-core";
707
729
  async function truncate(accessor, path, length) {
708
730
  const raw = rawPathOf(path);
709
731
  const key = gridfsKey(raw, accessor.config);
732
+ const startMs = performance.now();
710
733
  const doc = await latestFile(accessor, key);
711
734
  let data = doc === null ? new Uint8Array(0) : await downloadBytes(accessor, path, doc._id);
712
735
  if (data.byteLength > length) {
@@ -717,6 +740,7 @@ async function truncate(accessor, path, length) {
717
740
  data = padded;
718
741
  }
719
742
  await uploadBytes(accessor, key, data);
743
+ record4("truncate", path.virtual, ResourceName5.GRIDFS, 0, startMs);
720
744
  await invalidateAfterWrite6(path);
721
745
  }
722
746
 
@@ -733,6 +757,7 @@ async function unlink(accessor, path) {
733
757
  var GRIDFS_IO = {
734
758
  readdir,
735
759
  readBytes: read,
760
+ readRange: rangeOf(read),
736
761
  readStream: stream,
737
762
  stat,
738
763
  isMounted: () => true,
@@ -749,80 +774,77 @@ var GRIDFS_IO = {
749
774
  create,
750
775
  truncate,
751
776
  find,
752
- duTotal: du,
753
- duAll
777
+ du: { size, entries }
754
778
  };
755
779
 
756
- // src/commands/builtin/gridfs/du.ts
757
- var resolveGlob = resolveGlobOf(GRIDFS_IO);
758
- async function duCommand(accessor, paths, _texts, opts) {
759
- const resolved = paths.length > 0 ? await resolveGlob(accessor, paths, opts.index ?? void 0) : [];
760
- return duGeneric(
761
- resolved,
762
- opts,
763
- (p) => du(accessor, p),
764
- (p) => duAll(accessor, p)
765
- );
766
- }
767
- var GRIDFS_DU = command({
768
- name: "du",
769
- resource: ResourceName4.GRIDFS,
770
- spec: specOf("du"),
771
- fn: duCommand,
772
- provision: metadataProvision
773
- });
774
-
775
780
  // src/commands/builtin/gridfs/mkdir.ts
776
781
  import {
782
+ FlagView,
777
783
  IOResult,
778
- ResourceName as ResourceName5,
779
- command as command2,
780
- resolveGlobOf as resolveGlobOf2,
781
- specOf as specOf2,
782
- writeMetadataProvision
784
+ ResourceName as ResourceName6,
785
+ command,
786
+ resolveGlobOf,
787
+ specOf
783
788
  } from "@struktoai/mirage-core";
784
- var resolveGlob2 = resolveGlobOf2(GRIDFS_IO);
789
+ import { mkdirLinkRefusal } from "@struktoai/mirage-core";
790
+ var resolveGlob = resolveGlobOf(GRIDFS_IO);
785
791
  var ENC = new TextEncoder();
786
792
  async function mkdirCommand(accessor, paths, _texts, opts) {
787
793
  if (paths.length === 0) {
788
794
  return [null, new IOResult({ exitCode: 1, stderr: ENC.encode("mkdir: missing operand\n") })];
789
795
  }
790
- const resolved = await resolveGlob2(accessor, paths, opts.index ?? void 0);
791
- const verbose = opts.flags.v === true;
792
- const parents = opts.flags.p === true;
796
+ const resolved = await resolveGlob(accessor, paths, opts.index ?? void 0);
797
+ const fl = new FlagView(opts.flags, specOf("mkdir"));
798
+ const verbose = fl.asBool("verbose");
799
+ const parents = fl.asBool("parents");
793
800
  const lines = [];
794
801
  const writes = {};
802
+ const errors = [];
803
+ const links = opts.ns?.links ?? null;
795
804
  for (const path of resolved) {
805
+ const collision = await mkdirLinkRefusal(path, links, { parents });
806
+ if (collision.taken) {
807
+ if (collision.message !== null) errors.push(collision.message);
808
+ continue;
809
+ }
796
810
  await mkdir(accessor, path, parents);
797
811
  writes[path.mountPath] = new Uint8Array();
798
812
  if (verbose) lines.push(`mkdir: created directory '${path.virtual}'`);
799
813
  }
800
814
  const output = lines.length > 0 ? ENC.encode(lines.join("\n") + "\n") : null;
801
- return [output, new IOResult({ writes })];
815
+ const stderr = errors.length > 0 ? ENC.encode(errors.join("\n") + "\n") : void 0;
816
+ return [
817
+ output,
818
+ new IOResult({
819
+ writes,
820
+ exitCode: errors.length > 0 ? 1 : 0,
821
+ ...stderr !== void 0 ? { stderr } : {}
822
+ })
823
+ ];
802
824
  }
803
- var GRIDFS_MKDIR = command2({
825
+ var GRIDFS_MKDIR = command({
804
826
  name: "mkdir",
805
- resource: ResourceName5.GRIDFS,
806
- spec: specOf2("mkdir"),
827
+ resource: ResourceName6.GRIDFS,
828
+ spec: specOf("mkdir"),
807
829
  fn: mkdirCommand,
808
- write: true,
809
- provision: writeMetadataProvision
830
+ write: true
810
831
  });
811
832
 
812
833
  // src/commands/builtin/gridfs/rm.ts
813
834
  import {
814
835
  FileType as FileType2,
836
+ FlagView as FlagView2,
815
837
  IOResult as IOResult2,
816
- ResourceName as ResourceName6,
817
- command as command3,
838
+ ResourceName as ResourceName7,
839
+ command as command2,
818
840
  cpWalk,
819
841
  formatRecords,
820
842
  removalLines,
821
- resolveGlobOf as resolveGlobOf3,
822
- specOf as specOf3,
823
- writeMetadataProvision as writeMetadataProvision2
843
+ resolveGlobOf as resolveGlobOf2,
844
+ specOf as specOf2
824
845
  } from "@struktoai/mirage-core";
825
- var resolveGlob3 = resolveGlobOf3(GRIDFS_IO);
846
+ import { isSlashedLink, rmLinkRefusal } from "@struktoai/mirage-core";
847
+ var resolveGlob2 = resolveGlobOf2(GRIDFS_IO);
826
848
  var ENC2 = new TextEncoder();
827
849
  async function rmOne(accessor, path, opts, index) {
828
850
  const label = path.virtual;
@@ -864,15 +886,22 @@ async function rmCommand(accessor, paths, _texts, opts) {
864
886
  if (paths.length === 0) {
865
887
  return [null, new IOResult2({ exitCode: 1, stderr: ENC2.encode("rm: missing operand\n") })];
866
888
  }
867
- const resolved = await resolveGlob3(accessor, paths, opts.index ?? void 0);
868
- const recursive = opts.flags.r === true || opts.flags.R === true;
869
- const force = opts.flags.f === true;
870
- const removeDir = opts.flags.d === true;
871
- const verbose = opts.flags.v === true;
889
+ const resolved = await resolveGlob2(accessor, paths, opts.index ?? void 0);
890
+ const fl = new FlagView2(opts.flags, specOf2("rm"));
891
+ const recursive = fl.asBool("r") || fl.asBool("R");
892
+ const force = fl.asBool("f");
893
+ const removeDir = fl.asBool("d");
894
+ const verbose = fl.asBool("v");
872
895
  const verboseParts = [];
873
896
  const errors = [];
874
897
  const writes = {};
898
+ const links = opts.ns?.links ?? null;
875
899
  for (const p of resolved) {
900
+ if (isSlashedLink(p, links)) {
901
+ const refusal = await rmLinkRefusal(p, links, { recursive, force });
902
+ if (refusal !== null) errors.push(refusal);
903
+ continue;
904
+ }
876
905
  const [error, entryLines] = await rmOne(
877
906
  accessor,
878
907
  p,
@@ -897,106 +926,89 @@ async function rmCommand(accessor, paths, _texts, opts) {
897
926
  })
898
927
  ];
899
928
  }
900
- var GRIDFS_RM = command3({
929
+ var GRIDFS_RM = command2({
901
930
  name: "rm",
902
- resource: ResourceName6.GRIDFS,
903
- spec: specOf3("rm"),
931
+ resource: ResourceName7.GRIDFS,
932
+ spec: specOf2("rm"),
904
933
  fn: rmCommand,
905
- write: true,
906
- provision: writeMetadataProvision2
934
+ write: true
907
935
  });
908
936
 
909
937
  // src/commands/builtin/gridfs/stat.ts
910
938
  import {
911
- ResourceName as ResourceName7,
912
- command as command4,
913
- metadataProvision as metadataProvision2,
914
- resolveGlobOf as resolveGlobOf4,
915
- specOf as specOf4,
939
+ ResourceName as ResourceName8,
940
+ command as command3,
941
+ overlaidStat,
942
+ resolveGlobOf as resolveGlobOf3,
943
+ specOf as specOf3,
916
944
  statGeneric
917
945
  } from "@struktoai/mirage-core";
918
- var resolveGlob4 = resolveGlobOf4(GRIDFS_IO);
946
+ var resolveGlob3 = resolveGlobOf3(GRIDFS_IO);
919
947
  async function statCommand(accessor, paths, _texts, opts) {
920
- const resolved = paths.length > 0 ? await resolveGlob4(accessor, paths, opts.index ?? void 0) : [];
921
- return statGeneric(resolved, opts, (p) => stat(accessor, p, opts.index ?? void 0));
948
+ const resolved = paths.length > 0 ? await resolveGlob3(accessor, paths, opts.index ?? void 0) : [];
949
+ return statGeneric(
950
+ resolved,
951
+ opts,
952
+ overlaidStat((p) => stat(accessor, p, opts.index ?? void 0), opts.ns?.statOverlay)
953
+ );
922
954
  }
923
- var GRIDFS_STAT = command4({
955
+ var GRIDFS_STAT = command3({
924
956
  name: "stat",
925
- resource: ResourceName7.GRIDFS,
926
- spec: specOf4("stat"),
927
- fn: statCommand,
928
- provision: metadataProvision2
957
+ resource: ResourceName8.GRIDFS,
958
+ spec: specOf3("stat"),
959
+ fn: statCommand
929
960
  });
930
961
 
931
962
  // src/commands/builtin/gridfs/tee.ts
932
963
  import {
933
964
  IOResult as IOResult3,
934
- ResourceName as ResourceName8,
935
- command as command5,
936
- materialize,
937
- parseTeeFlags,
938
- readStdinAsync,
939
- resolveGlobOf as resolveGlobOf5,
940
- specOf as specOf5,
941
- writeOutput
965
+ ResourceName as ResourceName9,
966
+ command as command4,
967
+ resolveGlobOf as resolveGlobOf4,
968
+ specOf as specOf4,
969
+ teeGeneric
942
970
  } from "@struktoai/mirage-core";
943
- var resolveGlob5 = resolveGlobOf5(GRIDFS_IO);
971
+ var resolveGlob4 = resolveGlobOf4(GRIDFS_IO);
944
972
  var ENC3 = new TextEncoder();
945
973
  async function teeCommand(accessor, paths, texts, opts) {
946
974
  if (paths.length === 0) {
947
975
  return [null, new IOResult3({ exitCode: 1, stderr: ENC3.encode("tee: missing operand\n") })];
948
976
  }
949
- const parsed = parseTeeFlags(opts.flags);
950
- if (typeof parsed === "string") {
951
- return [null, new IOResult3({ exitCode: 1, stderr: ENC3.encode(parsed) })];
952
- }
953
- const resolved = await resolveGlob5(accessor, paths, opts.index ?? void 0);
954
- const first = resolved[0];
955
- if (first === void 0) return [null, new IOResult3()];
956
- const stdinData = await readStdinAsync(opts.stdin);
957
- const raw = stdinData ?? ENC3.encode(texts.join(" "));
958
- let writeData = raw;
959
- if (parsed.append) {
960
- let existingFound = false;
961
- try {
962
- existingFound = await exists(accessor, first);
963
- } catch {
964
- existingFound = false;
965
- }
966
- if (existingFound) {
967
- const existing = await materialize(stream(accessor, first));
968
- writeData = new Uint8Array(existing.byteLength + raw.byteLength);
969
- writeData.set(existing, 0);
970
- writeData.set(raw, existing.byteLength);
971
- }
972
- }
973
- return writeOutput((p, d) => write(accessor, p, d), first, writeData, raw);
977
+ const resolved = await resolveGlob4(accessor, paths, opts.index ?? void 0);
978
+ return teeGeneric(
979
+ resolved,
980
+ texts,
981
+ opts,
982
+ (p) => stream(accessor, p),
983
+ (p, d) => write(accessor, p, d)
984
+ );
974
985
  }
975
- var GRIDFS_TEE = command5({
986
+ var GRIDFS_TEE = command4({
976
987
  name: "tee",
977
- resource: ResourceName8.GRIDFS,
978
- spec: specOf5("tee"),
988
+ resource: ResourceName9.GRIDFS,
989
+ spec: specOf4("tee"),
979
990
  fn: teeCommand,
980
991
  write: true
981
992
  });
982
993
 
983
994
  // src/commands/builtin/gridfs/touch.ts
984
995
  import {
996
+ FlagView as FlagView3,
985
997
  IOResult as IOResult4,
986
- ResourceName as ResourceName9,
987
- command as command6,
988
- resolveGlobOf as resolveGlobOf6,
989
- specOf as specOf6,
990
- writeMetadataProvision as writeMetadataProvision3
998
+ ResourceName as ResourceName10,
999
+ command as command5,
1000
+ resolveGlobOf as resolveGlobOf5,
1001
+ specOf as specOf5
991
1002
  } from "@struktoai/mirage-core";
992
- var resolveGlob6 = resolveGlobOf6(GRIDFS_IO);
1003
+ var resolveGlob5 = resolveGlobOf5(GRIDFS_IO);
993
1004
  var ENC4 = new TextEncoder();
994
1005
  async function touchCommand(accessor, paths, _texts, opts) {
995
1006
  if (paths.length === 0) {
996
1007
  return [null, new IOResult4({ exitCode: 1, stderr: ENC4.encode("touch: missing operand\n") })];
997
1008
  }
998
- const resolved = await resolveGlob6(accessor, paths, opts.index ?? void 0);
999
- const createOnly = opts.flags.c === true;
1009
+ const resolved = await resolveGlob5(accessor, paths, opts.index ?? void 0);
1010
+ const fl = new FlagView3(opts.flags, specOf5("touch"));
1011
+ const createOnly = fl.asBool("c");
1000
1012
  const writes = {};
1001
1013
  for (const p of resolved) {
1002
1014
  if (createOnly) continue;
@@ -1007,54 +1019,51 @@ async function touchCommand(accessor, paths, _texts, opts) {
1007
1019
  }
1008
1020
  return [null, new IOResult4({ writes })];
1009
1021
  }
1010
- var GRIDFS_TOUCH = command6({
1022
+ var GRIDFS_TOUCH = command5({
1011
1023
  name: "touch",
1012
- resource: ResourceName9.GRIDFS,
1013
- spec: specOf6("touch"),
1024
+ resource: ResourceName10.GRIDFS,
1025
+ spec: specOf5("touch"),
1014
1026
  fn: touchCommand,
1015
- write: true,
1016
- provision: writeMetadataProvision3
1027
+ write: true
1017
1028
  });
1018
1029
 
1019
1030
  // src/commands/builtin/gridfs/index.ts
1020
- var GRIDFS_OVERRIDES = /* @__PURE__ */ new Set(["stat", "du", "rm", "mkdir", "tee", "touch"]);
1031
+ var GRIDFS_OVERRIDES = /* @__PURE__ */ new Set(["stat", "rm", "mkdir", "tee", "touch"]);
1021
1032
  var GRIDFS_COMMANDS = [
1022
- ...makeFiletypeCommands({
1023
- resource: ResourceName10.GRIDFS,
1024
- readBytes: read,
1025
- statEntry: stat
1026
- }),
1027
- ...makeGenericCommands(ResourceName10.GRIDFS, GRIDFS_IO, {
1033
+ ...makeGenericCommands(ResourceName11.GRIDFS, GRIDFS_IO, {
1028
1034
  overrides: GRIDFS_OVERRIDES
1029
1035
  }),
1030
- ...GRIDFS_STAT,
1031
- ...GRIDFS_DU,
1032
- ...GRIDFS_RM,
1033
- ...GRIDFS_MKDIR,
1034
- ...GRIDFS_TEE,
1035
- ...GRIDFS_TOUCH
1036
+ ...withDefaultProvisions(
1037
+ [...GRIDFS_STAT, ...GRIDFS_RM, ...GRIDFS_MKDIR, ...GRIDFS_TEE, ...GRIDFS_TOUCH],
1038
+ GRIDFS_IO.stat,
1039
+ resolveGlobOf6(GRIDFS_IO),
1040
+ GRIDFS_IO.readdir
1041
+ )
1036
1042
  ];
1037
1043
 
1038
1044
  // src/ops/gridfs/index.ts
1039
- import { ResourceName as ResourceName11, makeGenericOps } from "@struktoai/mirage-core";
1040
- var GRIDFS_OPS = makeGenericOps(ResourceName11.GRIDFS, GRIDFS_IO, {
1041
- filetypeRead: [".feather", ".hdf5", ".parquet"]
1042
- });
1045
+ import { ResourceName as ResourceName12, makeGenericOps } from "@struktoai/mirage-core";
1046
+ var GRIDFS_OPS = makeGenericOps(
1047
+ ResourceName12.GRIDFS,
1048
+ GRIDFS_IO,
1049
+ {}
1050
+ );
1043
1051
 
1044
1052
  // src/resource/gridfs/prompt.ts
1045
1053
  var GRIDFS_PROMPT = `{prefix}
1046
1054
  Remote MongoDB GridFS bucket. Maps GridFS filenames to virtual paths.
1047
1055
  IMPORTANT: This is a remote mount. Prefer targeted reads (grep, head) over full scans. Avoid cat on large files without piping to head/tail.
1048
1056
  find pushes -name/-type/-size filters into the fs.files query server-side, so find is cheap even on large buckets.
1049
- Supports: ls, cat, head, tail, grep, rg, wc, find, tree, jq, stat.
1050
- cat on .parquet/.orc/.feather returns a formatted table.`;
1057
+ Supports: ls, cat, head, tail, grep, rg, wc, find, tree, jq, stat.`;
1051
1058
 
1052
1059
  // src/resource/gridfs/gridfs.ts
1053
1060
  var globCore = makeResolveGlob(readdir, SCOPE_ERROR);
1054
1061
  var GridFSResource = class extends BaseResource {
1055
- kind = ResourceName12.GRIDFS;
1062
+ kind = ResourceName13.GRIDFS;
1056
1063
  cachesReads = true;
1057
1064
  supportsSnapshot = true;
1065
+ // byte store: stat() sizes every file from metadata
1066
+ sizesAlwaysKnown = true;
1058
1067
  indexTtl = 600;
1059
1068
  prompt = GRIDFS_PROMPT;
1060
1069
  config;
@@ -1072,8 +1081,8 @@ var GridFSResource = class extends BaseResource {
1072
1081
  read_stream: stream,
1073
1082
  range_read: rangeRead,
1074
1083
  rm_recursive: rmR,
1075
- du_total: du,
1076
- du_all: duAll,
1084
+ du_size: size,
1085
+ du_entries: entries,
1077
1086
  create,
1078
1087
  truncate,
1079
1088
  exists,
@@ -1096,6 +1105,7 @@ var GridFSResource = class extends BaseResource {
1096
1105
  }
1097
1106
  async close() {
1098
1107
  await this.accessor.close();
1108
+ await super.close();
1099
1109
  }
1100
1110
  commands() {
1101
1111
  return GRIDFS_COMMANDS;
@@ -1159,7 +1169,7 @@ var GridFSResource = class extends BaseResource {
1159
1169
  return rmR(this.accessor, p);
1160
1170
  }
1161
1171
  du(p) {
1162
- return du(this.accessor, p);
1172
+ return size(this.accessor, p);
1163
1173
  }
1164
1174
  find(p, options = {}) {
1165
1175
  return find(this.accessor, p, options);
@@ -1189,6 +1199,7 @@ var GridFSResource = class extends BaseResource {
1189
1199
 
1190
1200
  export {
1191
1201
  GridFSAccessor,
1202
+ GRIDFS_COMMANDS,
1192
1203
  GridFSResource
1193
1204
  };
1194
- //# sourceMappingURL=chunk-CGGO5NKD.js.map
1205
+ //# sourceMappingURL=chunk-YUJBXFYK.js.map