@struktoai/mirage-node 0.0.3 → 0.0.5-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (465) 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/cas.lua +15 -0
  7. package/dist/ceph-ALKLD3MO.js +11 -0
  8. package/dist/{chunk-QCZ2XUKH.js → chunk-2A4YGVBM.js} +16 -23
  9. package/dist/chunk-2A4YGVBM.js.map +1 -0
  10. package/dist/chunk-2HCYLVGY.js +28 -0
  11. package/dist/chunk-2HCYLVGY.js.map +1 -0
  12. package/dist/chunk-2VPZAH5Q.js +20 -0
  13. package/dist/chunk-2VPZAH5Q.js.map +1 -0
  14. package/dist/{chunk-UT2OPSN4.js → chunk-3JZQ6VSZ.js} +5 -5
  15. package/dist/chunk-3JZQ6VSZ.js.map +1 -0
  16. package/dist/chunk-4IF4TGAI.js +11 -0
  17. package/dist/chunk-4IF4TGAI.js.map +1 -0
  18. package/dist/{chunk-47AVIIOT.js → chunk-5H6KNEPP.js} +4 -5
  19. package/dist/{chunk-47AVIIOT.js.map → chunk-5H6KNEPP.js.map} +1 -1
  20. package/dist/{chunk-I5THIMPP.js → chunk-5K2MWDCE.js} +6 -7
  21. package/dist/{chunk-I5THIMPP.js.map → chunk-5K2MWDCE.js.map} +1 -1
  22. package/dist/{chunk-3WIO7NBR.js → chunk-6SVXWRKX.js} +4 -5
  23. package/dist/{chunk-3WIO7NBR.js.map → chunk-6SVXWRKX.js.map} +1 -1
  24. package/dist/{chunk-RQK5UPMP.js → chunk-6VOIUGAD.js} +25 -12
  25. package/dist/chunk-6VOIUGAD.js.map +1 -0
  26. package/dist/{chunk-NOHWIBRX.js → chunk-7JYHFXXC.js} +15 -20
  27. package/dist/chunk-7JYHFXXC.js.map +1 -0
  28. package/dist/chunk-7VQQFWV6.js +20 -0
  29. package/dist/chunk-7VQQFWV6.js.map +1 -0
  30. package/dist/chunk-7ZP6TPHX.js +87 -0
  31. package/dist/chunk-7ZP6TPHX.js.map +1 -0
  32. package/dist/{chunk-SWCDFEUK.js → chunk-ADEXNSYU.js} +20 -22
  33. package/dist/chunk-ADEXNSYU.js.map +1 -0
  34. package/dist/chunk-AQSYAXL4.js +16 -0
  35. package/dist/chunk-AQSYAXL4.js.map +1 -0
  36. package/dist/{chunk-RO5IQEDQ.js → chunk-ATLXMNKD.js} +8 -4
  37. package/dist/chunk-ATLXMNKD.js.map +1 -0
  38. package/dist/{chunk-MPCCRRE6.js → chunk-BYCUGFRF.js} +16 -16
  39. package/dist/chunk-BYCUGFRF.js.map +1 -0
  40. package/dist/{chunk-HJJMP6IX.js → chunk-BZTVYOES.js} +3 -3
  41. package/dist/{chunk-B2ZOKNN4.js → chunk-CRC4YWXB.js} +27 -9
  42. package/dist/chunk-CRC4YWXB.js.map +1 -0
  43. package/dist/chunk-CTGXJHO5.js +39 -0
  44. package/dist/chunk-CTGXJHO5.js.map +1 -0
  45. package/dist/{chunk-Q2IAILVC.js → chunk-DCDBIXVZ.js} +14 -5
  46. package/dist/chunk-DCDBIXVZ.js.map +1 -0
  47. package/dist/chunk-DDAFNROK.js +750 -0
  48. package/dist/chunk-DDAFNROK.js.map +1 -0
  49. package/dist/chunk-DQIEWEAW.js +85 -0
  50. package/dist/chunk-DQIEWEAW.js.map +1 -0
  51. package/dist/{chunk-QGRDPSAH.js → chunk-EBI4IHDC.js} +23 -12
  52. package/dist/chunk-EBI4IHDC.js.map +1 -0
  53. package/dist/{chunk-JAGJTM3Q.js → chunk-EIUTZ6N7.js} +19 -34
  54. package/dist/chunk-EIUTZ6N7.js.map +1 -0
  55. package/dist/{chunk-TA3WMOMU.js → chunk-EJZG5VUF.js} +38 -32
  56. package/dist/chunk-EJZG5VUF.js.map +1 -0
  57. package/dist/{chunk-X5HF2OFP.js → chunk-ENW5BVYN.js} +3 -3
  58. package/dist/{chunk-HGCRXJGP.js → chunk-ETIAW4YD.js} +3 -3
  59. package/dist/chunk-EUPXAYPB.js +20 -0
  60. package/dist/chunk-EUPXAYPB.js.map +1 -0
  61. package/dist/{chunk-YAHRT6MB.js → chunk-FA6YNU75.js} +4 -5
  62. package/dist/{chunk-YAHRT6MB.js.map → chunk-FA6YNU75.js.map} +1 -1
  63. package/dist/{chunk-TWGVQLG2.js → chunk-FFH6R5VQ.js} +7 -3
  64. package/dist/chunk-FFH6R5VQ.js.map +1 -0
  65. package/dist/{chunk-JCC4CU2I.js → chunk-GE6H2COM.js} +15 -23
  66. package/dist/chunk-GE6H2COM.js.map +1 -0
  67. package/dist/{chunk-DM4GSE26.js → chunk-GMMQ3ZK4.js} +3 -3
  68. package/dist/{chunk-ZEGAMJO2.js → chunk-GSGE3M5P.js} +15 -23
  69. package/dist/chunk-GSGE3M5P.js.map +1 -0
  70. package/dist/{chunk-GCFYZSVR.js → chunk-H64SB6VO.js} +32 -13
  71. package/dist/chunk-H64SB6VO.js.map +1 -0
  72. package/dist/{chunk-N5FSLVKO.js → chunk-HCRYAFBI.js} +3 -3
  73. package/dist/{chunk-IDYHQQOH.js → chunk-HOPUP6LA.js} +358 -471
  74. package/dist/chunk-HOPUP6LA.js.map +1 -0
  75. package/dist/chunk-HS24BL6W.js +160 -0
  76. package/dist/chunk-HS24BL6W.js.map +1 -0
  77. package/dist/chunk-HVYVG5KQ.js +16 -0
  78. package/dist/chunk-HVYVG5KQ.js.map +1 -0
  79. package/dist/{chunk-FQ33BYFR.js → chunk-I7CPLZNW.js} +4 -5
  80. package/dist/{chunk-FQ33BYFR.js.map → chunk-I7CPLZNW.js.map} +1 -1
  81. package/dist/{chunk-VGLHY6BK.js → chunk-IFUCGI4I.js} +7 -3
  82. package/dist/chunk-IFUCGI4I.js.map +1 -0
  83. package/dist/{chunk-RNQN2FOU.js → chunk-IFYXSSKR.js} +24 -13
  84. package/dist/chunk-IFYXSSKR.js.map +1 -0
  85. package/dist/chunk-IXA4DQE4.js +20 -0
  86. package/dist/chunk-IXA4DQE4.js.map +1 -0
  87. package/dist/chunk-IZMKMD3O.js +11 -0
  88. package/dist/chunk-IZMKMD3O.js.map +1 -0
  89. package/dist/{chunk-7CW3BMPH.js → chunk-JJERW2BI.js} +4 -5
  90. package/dist/{chunk-7CW3BMPH.js.map → chunk-JJERW2BI.js.map} +1 -1
  91. package/dist/{chunk-EM4J5EQS.js → chunk-JQR4HVUX.js} +13 -16
  92. package/dist/chunk-JQR4HVUX.js.map +1 -0
  93. package/dist/{chunk-VWKUT4CW.js → chunk-JXOMDLFS.js} +21 -26
  94. package/dist/chunk-JXOMDLFS.js.map +1 -0
  95. package/dist/chunk-KIX6N7NT.js +1001 -0
  96. package/dist/chunk-KIX6N7NT.js.map +1 -0
  97. package/dist/{chunk-OZAEWZZ3.js → chunk-L42UTDFK.js} +12 -3
  98. package/dist/chunk-L42UTDFK.js.map +1 -0
  99. package/dist/{chunk-54NTYJEO.js → chunk-LPDLPRPS.js} +1 -3
  100. package/dist/{chunk-54NTYJEO.js.map → chunk-LPDLPRPS.js.map} +1 -1
  101. package/dist/chunk-M2UF2JHJ.js +11 -0
  102. package/dist/chunk-M2UF2JHJ.js.map +1 -0
  103. package/dist/{chunk-UGK4TAVK.js → chunk-MONC734W.js} +7 -3
  104. package/dist/chunk-MONC734W.js.map +1 -0
  105. package/dist/{chunk-IK2L4EN3.js → chunk-N72RLCMU.js} +4 -5
  106. package/dist/{chunk-IK2L4EN3.js.map → chunk-N72RLCMU.js.map} +1 -1
  107. package/dist/{chunk-H3I2KZIY.js → chunk-ND4IWJ4V.js} +7 -3
  108. package/dist/chunk-ND4IWJ4V.js.map +1 -0
  109. package/dist/chunk-NZ3EKGW4.js +1312 -0
  110. package/dist/chunk-NZ3EKGW4.js.map +1 -0
  111. package/dist/{chunk-XGJ2QERC.js → chunk-OAE57MNL.js} +27 -11
  112. package/dist/chunk-OAE57MNL.js.map +1 -0
  113. package/dist/{chunk-EZQ5HBAC.js → chunk-OHKGIQB4.js} +12 -16
  114. package/dist/chunk-OHKGIQB4.js.map +1 -0
  115. package/dist/{chunk-E2ISWXLB.js → chunk-OQKNDS66.js} +1 -1
  116. package/dist/{chunk-E2ISWXLB.js.map → chunk-OQKNDS66.js.map} +1 -1
  117. package/dist/{chunk-UINQOUZR.js → chunk-OXEQSPND.js} +3 -3
  118. package/dist/{chunk-A7IVFIOP.js → chunk-PKNE5J2B.js} +15 -23
  119. package/dist/chunk-PKNE5J2B.js.map +1 -0
  120. package/dist/chunk-PSXXEGYQ.js +16 -0
  121. package/dist/chunk-PSXXEGYQ.js.map +1 -0
  122. package/dist/{chunk-EGB7V74Z.js → chunk-QAOVABCR.js} +7 -4
  123. package/dist/chunk-QAOVABCR.js.map +1 -0
  124. package/dist/{chunk-X3G37FXT.js → chunk-QQ7FP4GD.js} +4 -5
  125. package/dist/{chunk-X3G37FXT.js.map → chunk-QQ7FP4GD.js.map} +1 -1
  126. package/dist/{chunk-WAR4Q2NM.js → chunk-QYLVMC6B.js} +13 -15
  127. package/dist/chunk-QYLVMC6B.js.map +1 -0
  128. package/dist/{chunk-KPULTUOK.js → chunk-RX3XR65X.js} +4 -5
  129. package/dist/{chunk-KPULTUOK.js.map → chunk-RX3XR65X.js.map} +1 -1
  130. package/dist/chunk-RYQJJB4C.js +30 -0
  131. package/dist/chunk-RYQJJB4C.js.map +1 -0
  132. package/dist/{chunk-QQBJC2FQ.js → chunk-TUF7TCN7.js} +4 -5
  133. package/dist/{chunk-QQBJC2FQ.js.map → chunk-TUF7TCN7.js.map} +1 -1
  134. package/dist/{chunk-AUHSTJJ3.js → chunk-TUX36JY5.js} +4 -5
  135. package/dist/{chunk-AUHSTJJ3.js.map → chunk-TUX36JY5.js.map} +1 -1
  136. package/dist/chunk-TWRQCQWU.js +1153 -0
  137. package/dist/chunk-TWRQCQWU.js.map +1 -0
  138. package/dist/chunk-U6DFQRG3.js +20 -0
  139. package/dist/chunk-U6DFQRG3.js.map +1 -0
  140. package/dist/chunk-VI5YTKNY.js +20 -0
  141. package/dist/chunk-VI5YTKNY.js.map +1 -0
  142. package/dist/chunk-WG5YS6TC.js +872 -0
  143. package/dist/chunk-WG5YS6TC.js.map +1 -0
  144. package/dist/{chunk-ZGSER5TG.js → chunk-WMJJ4WGF.js} +4 -5
  145. package/dist/{chunk-ZGSER5TG.js.map → chunk-WMJJ4WGF.js.map} +1 -1
  146. package/dist/{chunk-LV2G7VHL.js → chunk-WY4FNH42.js} +21 -18
  147. package/dist/chunk-WY4FNH42.js.map +1 -0
  148. package/dist/{chunk-LAJJPLEV.js → chunk-XIG5BWWH.js} +25 -12
  149. package/dist/chunk-XIG5BWWH.js.map +1 -0
  150. package/dist/chunk-XJBC3OYX.js +11 -0
  151. package/dist/chunk-XJBC3OYX.js.map +1 -0
  152. package/dist/{chunk-G2WCEUQL.js → chunk-XPRDXWK7.js} +21 -20
  153. package/dist/chunk-XPRDXWK7.js.map +1 -0
  154. package/dist/chunk-YKRQSZS7.js +96 -0
  155. package/dist/chunk-YKRQSZS7.js.map +1 -0
  156. package/dist/{chunk-M5FVUIYP.js → chunk-YMBL3VJB.js} +21 -19
  157. package/dist/chunk-YMBL3VJB.js.map +1 -0
  158. package/dist/chunk-YUJBXFYK.js +1205 -0
  159. package/dist/chunk-YUJBXFYK.js.map +1 -0
  160. package/dist/{chunk-JALIYI6M.js → chunk-YZ4ZJNOL.js} +28 -11
  161. package/dist/chunk-YZ4ZJNOL.js.map +1 -0
  162. package/dist/chunk-ZTHVEXIV.js +11 -0
  163. package/dist/chunk-ZTHVEXIV.js.map +1 -0
  164. package/dist/{chunk-GS5AUKUO.js → chunk-ZVSYUCYS.js} +11 -7
  165. package/dist/chunk-ZVSYUCYS.js.map +1 -0
  166. package/dist/{config-QAA646XB.js → config-2YBCHU2W.js} +2 -4
  167. package/dist/{config-IVY5EQQ2.js → config-3YRGRW72.js} +3 -4
  168. package/dist/config-4GSOMUMF.js +9 -0
  169. package/dist/config-5YBUWFUP.js +9 -0
  170. package/dist/{config-34LHOGLM.js → config-5ZRKJTKG.js} +3 -4
  171. package/dist/config-A25LTL5W.js +11 -0
  172. package/dist/config-CLU7JABG.js +9 -0
  173. package/dist/config-D2RF7L3N.js +9 -0
  174. package/dist/{config-LHFFXVYI.js → config-E55TKM6K.js} +2 -4
  175. package/dist/config-ELDOFRJW.js +9 -0
  176. package/dist/{config-GE4W4ZJC.js → config-FPC3RBFD.js} +2 -4
  177. package/dist/config-FPM3LAW7.js +9 -0
  178. package/dist/{config-HKRMKD76.js → config-G3F54CS4.js} +3 -4
  179. package/dist/config-G43HRUI3.js +9 -0
  180. package/dist/{config-WDAZFXYD.js → config-GG3WO5PB.js} +3 -4
  181. package/dist/config-JUYBWAZE.js +9 -0
  182. package/dist/{config-CVZ2AGCO.js → config-LJ5T6TVA.js} +2 -6
  183. package/dist/config-MDSAE4O3.js +11 -0
  184. package/dist/{config-EIHSP5DZ.js → config-NRIOKK5T.js} +2 -4
  185. package/dist/config-OYK2BSJK.js +9 -0
  186. package/dist/config-PB3KA2CE.js +9 -0
  187. package/dist/{config-ZFJYQZCH.js → config-QY4IL3PH.js} +3 -4
  188. package/dist/config-R4LAOEDS.js +9 -0
  189. package/dist/{config-QNMKWJ4M.js → config-RIAAD6RW.js} +3 -4
  190. package/dist/config-SYNEQAUB.js +9 -0
  191. package/dist/{config-Q45Y46YT.js → config-TJKGYA2B.js} +3 -4
  192. package/dist/{config-NV5WXP64.js → config-UU27ALAA.js} +2 -4
  193. package/dist/{config-3IVQJBNW.js → config-UURRGA7U.js} +2 -2
  194. package/dist/{config-VM526IKB.js → config-VPLHQXVE.js} +2 -4
  195. package/dist/config-WRACCRPN.js +9 -0
  196. package/dist/{config-GHRUKEQ6.js → config-WVHKXEVE.js} +3 -4
  197. package/dist/{config-EO23EY62.js → config-XU7R36IE.js} +3 -4
  198. package/dist/config-Y2KOUYSS.js +9 -0
  199. package/dist/databricks_volume-CNCPTZHS.js +7 -0
  200. package/dist/digitalocean-DJZOUB6Q.js +11 -0
  201. package/dist/discord-ETB2CADR.js +7 -0
  202. package/dist/disk-WEHSTK3F.js +7 -0
  203. package/dist/dropbox-XN6PGLNE.js +8 -0
  204. package/dist/email-OV7XCP3T.js +8 -0
  205. package/dist/gcal-P56MRCGU.js +8 -0
  206. package/dist/gcs-HFBIAE2C.js +10 -0
  207. package/dist/gdocs-LQ3UXP3J.js +8 -0
  208. package/dist/gdrive-N6UBYLON.js +8 -0
  209. package/dist/github-BPZREGPI.js +8 -0
  210. package/dist/github_ci-7A4LUIZ7.js +8 -0
  211. package/dist/gmail-YED2MF6H.js +8 -0
  212. package/dist/gridfs-CPLQ4G62.js +9 -0
  213. package/dist/gsheets-4BNIJPQ6.js +8 -0
  214. package/dist/gslides-GDBYLO5A.js +8 -0
  215. package/dist/hf_buckets-FTJITQ3P.js +10 -0
  216. package/dist/hf_datasets-6GXVKQD7.js +10 -0
  217. package/dist/hf_models-PJPGZAC5.js +10 -0
  218. package/dist/hf_spaces-LFNFOLBF.js +10 -0
  219. package/dist/index.d.ts +1311 -569
  220. package/dist/index.js +3359 -964
  221. package/dist/index.js.map +1 -1
  222. package/dist/jaeger-GCA6MJ6E.js +8 -0
  223. package/dist/lancedb-TJ5YSJY5.js +7 -0
  224. package/dist/langfuse-RUMTUMXS.js +8 -0
  225. package/dist/linear-BCE4KEAC.js +7 -0
  226. package/dist/minio-5SO6KBTK.js +11 -0
  227. package/dist/mongodb-L5CMN2EE.js +7 -0
  228. package/dist/nextcloud-4O2LZVW2.js +9 -0
  229. package/dist/notion-RVKEAQ2M.js +7 -0
  230. package/dist/oci-OQXOIC62.js +10 -0
  231. package/dist/postgres-AV45GNRS.js +7 -0
  232. package/dist/qingstor-W277YA4K.js +11 -0
  233. package/dist/r2-FUA4IORE.js +10 -0
  234. package/dist/redis-LPS357NF.js +8 -0
  235. package/dist/s3-FPNWWIVM.js +8 -0
  236. package/dist/scaleway-BP3732U7.js +11 -0
  237. package/dist/seaweedfs-MC6HIEP4.js +11 -0
  238. package/dist/slack-JFGW7VLN.js +7 -0
  239. package/dist/ssh-UYPG42LM.js +8 -0
  240. package/dist/ssh-UYPG42LM.js.map +1 -0
  241. package/dist/supabase-A3KUFMDC.js +10 -0
  242. package/dist/supabase-A3KUFMDC.js.map +1 -0
  243. package/dist/tencent-5464UQ2X.js +11 -0
  244. package/dist/tencent-5464UQ2X.js.map +1 -0
  245. package/dist/trello-O2KB3FUO.js +8 -0
  246. package/dist/trello-O2KB3FUO.js.map +1 -0
  247. package/dist/wasabi-2IKBIWNO.js +10 -0
  248. package/dist/wasabi-2IKBIWNO.js.map +1 -0
  249. package/package.json +17 -3
  250. package/dist/aliyun-JMJ3PFYY.js +0 -10
  251. package/dist/backblaze-TDFD23QO.js +0 -10
  252. package/dist/box-GQ2U2R6R.js +0 -8
  253. package/dist/ceph-S2VOYO6G.js +0 -10
  254. package/dist/chunk-2CC5VW7K.js +0 -52
  255. package/dist/chunk-2CC5VW7K.js.map +0 -1
  256. package/dist/chunk-A7IVFIOP.js.map +0 -1
  257. package/dist/chunk-B2ZOKNN4.js.map +0 -1
  258. package/dist/chunk-DNBAMB5J.js +0 -18
  259. package/dist/chunk-DNBAMB5J.js.map +0 -1
  260. package/dist/chunk-DP2PP5V2.js +0 -26
  261. package/dist/chunk-DP2PP5V2.js.map +0 -1
  262. package/dist/chunk-DYXEITK3.js +0 -52
  263. package/dist/chunk-DYXEITK3.js.map +0 -1
  264. package/dist/chunk-EGB7V74Z.js.map +0 -1
  265. package/dist/chunk-EM4J5EQS.js.map +0 -1
  266. package/dist/chunk-EZQ5HBAC.js.map +0 -1
  267. package/dist/chunk-G2WCEUQL.js.map +0 -1
  268. package/dist/chunk-GCFYZSVR.js.map +0 -1
  269. package/dist/chunk-GS5AUKUO.js.map +0 -1
  270. package/dist/chunk-H3BST2LI.js +0 -26
  271. package/dist/chunk-H3BST2LI.js.map +0 -1
  272. package/dist/chunk-H3I2KZIY.js.map +0 -1
  273. package/dist/chunk-IDYHQQOH.js.map +0 -1
  274. package/dist/chunk-JAGJTM3Q.js.map +0 -1
  275. package/dist/chunk-JALIYI6M.js.map +0 -1
  276. package/dist/chunk-JCC4CU2I.js.map +0 -1
  277. package/dist/chunk-JZT4QGIP.js +0 -24
  278. package/dist/chunk-JZT4QGIP.js.map +0 -1
  279. package/dist/chunk-LAJJPLEV.js.map +0 -1
  280. package/dist/chunk-LV2G7VHL.js.map +0 -1
  281. package/dist/chunk-LW25LMIH.js +0 -26
  282. package/dist/chunk-LW25LMIH.js.map +0 -1
  283. package/dist/chunk-M5FVUIYP.js.map +0 -1
  284. package/dist/chunk-MPCCRRE6.js.map +0 -1
  285. package/dist/chunk-NJMGCT63.js +0 -54
  286. package/dist/chunk-NJMGCT63.js.map +0 -1
  287. package/dist/chunk-NOHWIBRX.js.map +0 -1
  288. package/dist/chunk-OHROA3FQ.js +0 -54
  289. package/dist/chunk-OHROA3FQ.js.map +0 -1
  290. package/dist/chunk-OPYQ5KIO.js +0 -52
  291. package/dist/chunk-OPYQ5KIO.js.map +0 -1
  292. package/dist/chunk-OZAEWZZ3.js.map +0 -1
  293. package/dist/chunk-Q2IAILVC.js.map +0 -1
  294. package/dist/chunk-QCZ2XUKH.js.map +0 -1
  295. package/dist/chunk-QGRDPSAH.js.map +0 -1
  296. package/dist/chunk-RNQN2FOU.js.map +0 -1
  297. package/dist/chunk-RO5IQEDQ.js.map +0 -1
  298. package/dist/chunk-RQK5UPMP.js.map +0 -1
  299. package/dist/chunk-S5OVP467.js +0 -1795
  300. package/dist/chunk-S5OVP467.js.map +0 -1
  301. package/dist/chunk-SFUCUARB.js +0 -21
  302. package/dist/chunk-SFUCUARB.js.map +0 -1
  303. package/dist/chunk-SWCDFEUK.js.map +0 -1
  304. package/dist/chunk-TA3WMOMU.js.map +0 -1
  305. package/dist/chunk-TURD42QO.js +0 -1782
  306. package/dist/chunk-TURD42QO.js.map +0 -1
  307. package/dist/chunk-TWGVQLG2.js.map +0 -1
  308. package/dist/chunk-U6QSXTUS.js +0 -7
  309. package/dist/chunk-U6QSXTUS.js.map +0 -1
  310. package/dist/chunk-UGK4TAVK.js.map +0 -1
  311. package/dist/chunk-UT2OPSN4.js.map +0 -1
  312. package/dist/chunk-VGLHY6BK.js.map +0 -1
  313. package/dist/chunk-VWKUT4CW.js.map +0 -1
  314. package/dist/chunk-W7FLHT65.js +0 -26
  315. package/dist/chunk-W7FLHT65.js.map +0 -1
  316. package/dist/chunk-WAR4Q2NM.js.map +0 -1
  317. package/dist/chunk-WHFUWWI6.js +0 -2097
  318. package/dist/chunk-WHFUWWI6.js.map +0 -1
  319. package/dist/chunk-XGJ2QERC.js.map +0 -1
  320. package/dist/chunk-XHCBHYN4.js +0 -54
  321. package/dist/chunk-XHCBHYN4.js.map +0 -1
  322. package/dist/chunk-XLQI4IT2.js +0 -54
  323. package/dist/chunk-XLQI4IT2.js.map +0 -1
  324. package/dist/chunk-XWVDS66D.js +0 -963
  325. package/dist/chunk-XWVDS66D.js.map +0 -1
  326. package/dist/chunk-YGZMVNN5.js +0 -54
  327. package/dist/chunk-YGZMVNN5.js.map +0 -1
  328. package/dist/chunk-YUK3X3B4.js +0 -27
  329. package/dist/chunk-YUK3X3B4.js.map +0 -1
  330. package/dist/chunk-ZEGAMJO2.js.map +0 -1
  331. package/dist/chunk-ZNWVJ6UW.js +0 -54
  332. package/dist/chunk-ZNWVJ6UW.js.map +0 -1
  333. package/dist/config-3BBWD5AB.js +0 -11
  334. package/dist/config-4UDVSUQJ.js +0 -11
  335. package/dist/config-CMDBAPDH.js +0 -11
  336. package/dist/config-D3RLSPNF.js +0 -11
  337. package/dist/config-DG65OEG3.js +0 -11
  338. package/dist/config-GCQK6NJY.js +0 -11
  339. package/dist/config-GVH27UPE.js +0 -11
  340. package/dist/config-HXVYIXP5.js +0 -11
  341. package/dist/config-IDZMEW73.js +0 -11
  342. package/dist/config-IJJXGLBQ.js +0 -11
  343. package/dist/config-KJOLGVB2.js +0 -11
  344. package/dist/config-KMVCVBYN.js +0 -15
  345. package/dist/config-KYTRXAB2.js +0 -15
  346. package/dist/config-OT2TQQCN.js +0 -11
  347. package/dist/config-QWCY3LBQ.js +0 -11
  348. package/dist/config-ZV6G2ZEC.js +0 -11
  349. package/dist/databricks_volume-7XOUYSTY.js +0 -7
  350. package/dist/digitalocean-3CQ4CPPZ.js +0 -10
  351. package/dist/discord-BG7OSRJG.js +0 -8
  352. package/dist/disk-XVLBCVKE.js +0 -8
  353. package/dist/dropbox-74GYLV3R.js +0 -8
  354. package/dist/email-5IZ7OBQ4.js +0 -8
  355. package/dist/gcs-EMEYU2XT.js +0 -10
  356. package/dist/gdocs-R67TDPON.js +0 -8
  357. package/dist/gdrive-PRN2ALRK.js +0 -8
  358. package/dist/github-DV7E6OFV.js +0 -8
  359. package/dist/github_ci-Q554V5PA.js +0 -8
  360. package/dist/gmail-OLN2LT4O.js +0 -8
  361. package/dist/gsheets-H4RYMQJ5.js +0 -8
  362. package/dist/gslides-YLCHKJOM.js +0 -8
  363. package/dist/hf_buckets-DTKXKKFF.js +0 -10
  364. package/dist/hf_datasets-55C4APKR.js +0 -10
  365. package/dist/hf_models-RO5JR36V.js +0 -10
  366. package/dist/hf_spaces-ZVZ3EDRX.js +0 -10
  367. package/dist/langfuse-ACASJZ7O.js +0 -8
  368. package/dist/linear-IC37LZV7.js +0 -8
  369. package/dist/minio-HZ576XFQ.js +0 -10
  370. package/dist/mongodb-JVR62OIO.js +0 -7
  371. package/dist/notion-HKRPQMJS.js +0 -8
  372. package/dist/oci-ZLVECXTW.js +0 -10
  373. package/dist/postgres-P36Z2YN4.js +0 -7
  374. package/dist/qingstor-YLP6K3L4.js +0 -10
  375. package/dist/r2-RPK25ANI.js +0 -10
  376. package/dist/redis-V5ULXULL.js +0 -8
  377. package/dist/s3-4OIOCAAT.js +0 -8
  378. package/dist/scaleway-CCWCLUHB.js +0 -10
  379. package/dist/seaweedfs-QSWKF2FN.js +0 -10
  380. package/dist/slack-YPS7PII3.js +0 -8
  381. package/dist/ssh-YFP3SMTJ.js +0 -9
  382. package/dist/supabase-6CFTOKGZ.js +0 -10
  383. package/dist/tencent-IWZZOSQ4.js +0 -10
  384. package/dist/trello-XYKWZD6P.js +0 -8
  385. package/dist/wasabi-6Z4DC5S5.js +0 -10
  386. /package/dist/{aliyun-JMJ3PFYY.js.map → aliyun-S62BR3TB.js.map} +0 -0
  387. /package/dist/{backblaze-TDFD23QO.js.map → backblaze-4EKSW63F.js.map} +0 -0
  388. /package/dist/{box-GQ2U2R6R.js.map → box-ZPLZAGMK.js.map} +0 -0
  389. /package/dist/{ceph-S2VOYO6G.js.map → ceph-ALKLD3MO.js.map} +0 -0
  390. /package/dist/{chunk-HJJMP6IX.js.map → chunk-BZTVYOES.js.map} +0 -0
  391. /package/dist/{chunk-X5HF2OFP.js.map → chunk-ENW5BVYN.js.map} +0 -0
  392. /package/dist/{chunk-HGCRXJGP.js.map → chunk-ETIAW4YD.js.map} +0 -0
  393. /package/dist/{chunk-DM4GSE26.js.map → chunk-GMMQ3ZK4.js.map} +0 -0
  394. /package/dist/{chunk-N5FSLVKO.js.map → chunk-HCRYAFBI.js.map} +0 -0
  395. /package/dist/{chunk-UINQOUZR.js.map → chunk-OXEQSPND.js.map} +0 -0
  396. /package/dist/{config-34LHOGLM.js.map → config-2YBCHU2W.js.map} +0 -0
  397. /package/dist/{config-3BBWD5AB.js.map → config-3YRGRW72.js.map} +0 -0
  398. /package/dist/{config-3IVQJBNW.js.map → config-4GSOMUMF.js.map} +0 -0
  399. /package/dist/{config-4UDVSUQJ.js.map → config-5YBUWFUP.js.map} +0 -0
  400. /package/dist/{config-CMDBAPDH.js.map → config-5ZRKJTKG.js.map} +0 -0
  401. /package/dist/{config-CVZ2AGCO.js.map → config-A25LTL5W.js.map} +0 -0
  402. /package/dist/{config-D3RLSPNF.js.map → config-CLU7JABG.js.map} +0 -0
  403. /package/dist/{config-DG65OEG3.js.map → config-D2RF7L3N.js.map} +0 -0
  404. /package/dist/{config-EIHSP5DZ.js.map → config-E55TKM6K.js.map} +0 -0
  405. /package/dist/{config-EO23EY62.js.map → config-ELDOFRJW.js.map} +0 -0
  406. /package/dist/{config-GCQK6NJY.js.map → config-FPC3RBFD.js.map} +0 -0
  407. /package/dist/{config-GE4W4ZJC.js.map → config-FPM3LAW7.js.map} +0 -0
  408. /package/dist/{config-GHRUKEQ6.js.map → config-G3F54CS4.js.map} +0 -0
  409. /package/dist/{config-GVH27UPE.js.map → config-G43HRUI3.js.map} +0 -0
  410. /package/dist/{config-HKRMKD76.js.map → config-GG3WO5PB.js.map} +0 -0
  411. /package/dist/{config-HXVYIXP5.js.map → config-JUYBWAZE.js.map} +0 -0
  412. /package/dist/{config-IDZMEW73.js.map → config-LJ5T6TVA.js.map} +0 -0
  413. /package/dist/{config-IJJXGLBQ.js.map → config-MDSAE4O3.js.map} +0 -0
  414. /package/dist/{config-IVY5EQQ2.js.map → config-NRIOKK5T.js.map} +0 -0
  415. /package/dist/{config-KJOLGVB2.js.map → config-OYK2BSJK.js.map} +0 -0
  416. /package/dist/{config-KMVCVBYN.js.map → config-PB3KA2CE.js.map} +0 -0
  417. /package/dist/{config-KYTRXAB2.js.map → config-QY4IL3PH.js.map} +0 -0
  418. /package/dist/{config-LHFFXVYI.js.map → config-R4LAOEDS.js.map} +0 -0
  419. /package/dist/{config-NV5WXP64.js.map → config-RIAAD6RW.js.map} +0 -0
  420. /package/dist/{config-OT2TQQCN.js.map → config-SYNEQAUB.js.map} +0 -0
  421. /package/dist/{config-Q45Y46YT.js.map → config-TJKGYA2B.js.map} +0 -0
  422. /package/dist/{config-QAA646XB.js.map → config-UU27ALAA.js.map} +0 -0
  423. /package/dist/{config-QNMKWJ4M.js.map → config-UURRGA7U.js.map} +0 -0
  424. /package/dist/{config-QWCY3LBQ.js.map → config-VPLHQXVE.js.map} +0 -0
  425. /package/dist/{config-VM526IKB.js.map → config-WRACCRPN.js.map} +0 -0
  426. /package/dist/{config-WDAZFXYD.js.map → config-WVHKXEVE.js.map} +0 -0
  427. /package/dist/{config-ZFJYQZCH.js.map → config-XU7R36IE.js.map} +0 -0
  428. /package/dist/{config-ZV6G2ZEC.js.map → config-Y2KOUYSS.js.map} +0 -0
  429. /package/dist/{databricks_volume-7XOUYSTY.js.map → databricks_volume-CNCPTZHS.js.map} +0 -0
  430. /package/dist/{digitalocean-3CQ4CPPZ.js.map → digitalocean-DJZOUB6Q.js.map} +0 -0
  431. /package/dist/{discord-BG7OSRJG.js.map → discord-ETB2CADR.js.map} +0 -0
  432. /package/dist/{disk-XVLBCVKE.js.map → disk-WEHSTK3F.js.map} +0 -0
  433. /package/dist/{dropbox-74GYLV3R.js.map → dropbox-XN6PGLNE.js.map} +0 -0
  434. /package/dist/{email-5IZ7OBQ4.js.map → email-OV7XCP3T.js.map} +0 -0
  435. /package/dist/{gcs-EMEYU2XT.js.map → gcal-P56MRCGU.js.map} +0 -0
  436. /package/dist/{gdocs-R67TDPON.js.map → gcs-HFBIAE2C.js.map} +0 -0
  437. /package/dist/{gdrive-PRN2ALRK.js.map → gdocs-LQ3UXP3J.js.map} +0 -0
  438. /package/dist/{github-DV7E6OFV.js.map → gdrive-N6UBYLON.js.map} +0 -0
  439. /package/dist/{github_ci-Q554V5PA.js.map → github-BPZREGPI.js.map} +0 -0
  440. /package/dist/{gmail-OLN2LT4O.js.map → github_ci-7A4LUIZ7.js.map} +0 -0
  441. /package/dist/{gsheets-H4RYMQJ5.js.map → gmail-YED2MF6H.js.map} +0 -0
  442. /package/dist/{gslides-YLCHKJOM.js.map → gridfs-CPLQ4G62.js.map} +0 -0
  443. /package/dist/{hf_buckets-DTKXKKFF.js.map → gsheets-4BNIJPQ6.js.map} +0 -0
  444. /package/dist/{hf_datasets-55C4APKR.js.map → gslides-GDBYLO5A.js.map} +0 -0
  445. /package/dist/{hf_models-RO5JR36V.js.map → hf_buckets-FTJITQ3P.js.map} +0 -0
  446. /package/dist/{hf_spaces-ZVZ3EDRX.js.map → hf_datasets-6GXVKQD7.js.map} +0 -0
  447. /package/dist/{langfuse-ACASJZ7O.js.map → hf_models-PJPGZAC5.js.map} +0 -0
  448. /package/dist/{linear-IC37LZV7.js.map → hf_spaces-LFNFOLBF.js.map} +0 -0
  449. /package/dist/{minio-HZ576XFQ.js.map → jaeger-GCA6MJ6E.js.map} +0 -0
  450. /package/dist/{mongodb-JVR62OIO.js.map → lancedb-TJ5YSJY5.js.map} +0 -0
  451. /package/dist/{notion-HKRPQMJS.js.map → langfuse-RUMTUMXS.js.map} +0 -0
  452. /package/dist/{oci-ZLVECXTW.js.map → linear-BCE4KEAC.js.map} +0 -0
  453. /package/dist/{postgres-P36Z2YN4.js.map → minio-5SO6KBTK.js.map} +0 -0
  454. /package/dist/{qingstor-YLP6K3L4.js.map → mongodb-L5CMN2EE.js.map} +0 -0
  455. /package/dist/{r2-RPK25ANI.js.map → nextcloud-4O2LZVW2.js.map} +0 -0
  456. /package/dist/{redis-V5ULXULL.js.map → notion-RVKEAQ2M.js.map} +0 -0
  457. /package/dist/{s3-4OIOCAAT.js.map → oci-OQXOIC62.js.map} +0 -0
  458. /package/dist/{scaleway-CCWCLUHB.js.map → postgres-AV45GNRS.js.map} +0 -0
  459. /package/dist/{seaweedfs-QSWKF2FN.js.map → qingstor-W277YA4K.js.map} +0 -0
  460. /package/dist/{slack-YPS7PII3.js.map → r2-FUA4IORE.js.map} +0 -0
  461. /package/dist/{ssh-YFP3SMTJ.js.map → redis-LPS357NF.js.map} +0 -0
  462. /package/dist/{supabase-6CFTOKGZ.js.map → s3-FPNWWIVM.js.map} +0 -0
  463. /package/dist/{tencent-IWZZOSQ4.js.map → scaleway-BP3732U7.js.map} +0 -0
  464. /package/dist/{trello-XYKWZD6P.js.map → seaweedfs-MC6HIEP4.js.map} +0 -0
  465. /package/dist/{wasabi-6Z4DC5S5.js.map → slack-JFGW7VLN.js.map} +0 -0
@@ -0,0 +1,1312 @@
1
+ import {
2
+ redactNextcloudConfig
3
+ } from "./chunk-RYQJJB4C.js";
4
+ import {
5
+ loadOptionalPeer
6
+ } from "./chunk-OQKNDS66.js";
7
+
8
+ // src/resource/nextcloud/nextcloud.ts
9
+ import {
10
+ BaseResource,
11
+ makeResolveGlob,
12
+ mountKey,
13
+ mountPrefixOf as mountPrefixOf5,
14
+ PathSpec,
15
+ ResourceName as ResourceName8
16
+ } from "@struktoai/mirage-core";
17
+
18
+ // src/accessor/nextcloud.ts
19
+ import { Accessor, ResourceName } from "@struktoai/mirage-core";
20
+ var NextcloudAccessor = class extends Accessor {
21
+ constructor(config) {
22
+ super();
23
+ this.config = config;
24
+ }
25
+ config;
26
+ resourceName = ResourceName.NEXTCLOUD;
27
+ operatorPromise = null;
28
+ operator() {
29
+ this.operatorPromise ??= this.createOperator();
30
+ return this.operatorPromise;
31
+ }
32
+ async createOperator() {
33
+ const mod = await loadOptionalPeer(
34
+ () => import("opendal"),
35
+ { feature: "Nextcloud resources", packageName: "opendal" }
36
+ );
37
+ const options = { endpoint: this.config.url };
38
+ if (this.config.username !== void 0) options.username = this.config.username;
39
+ if (this.config.password !== void 0) options.password = this.config.password;
40
+ return new mod.Operator("webdav", options);
41
+ }
42
+ };
43
+
44
+ // src/commands/builtin/nextcloud/index.ts
45
+ import { makeGenericCommands, ResourceName as ResourceName6 } from "@struktoai/mirage-core";
46
+
47
+ // src/commands/builtin/nextcloud/io.ts
48
+ import { rangeOf } from "@struktoai/mirage-core";
49
+
50
+ // src/core/nextcloud/constants.ts
51
+ var SCOPE_ERROR = 5e3;
52
+ var DEFAULT_CHUNK_SIZE = 8192;
53
+
54
+ // src/core/nextcloud/copy.ts
55
+ import { enoent, invalidateAfterWrite } from "@struktoai/mirage-core";
56
+
57
+ // src/core/nextcloud/util.ts
58
+ import { lstripSlash, mountPrefixOf } from "@struktoai/mirage-core";
59
+ function rawPathOf(path) {
60
+ const prefix = mountPrefixOf(path.virtual, path.resourcePath);
61
+ return prefix !== "" && path.virtual.startsWith(prefix) ? path.virtual.slice(prefix.length) || "/" : path.virtual;
62
+ }
63
+ function nextcloudKey(path) {
64
+ return lstripSlash(rawPathOf(path));
65
+ }
66
+ function isNotFound(error) {
67
+ return error instanceof Error && error.message.startsWith("NotFound");
68
+ }
69
+
70
+ // src/core/nextcloud/copy.ts
71
+ async function copy(accessor, source, destination) {
72
+ const op = await accessor.operator();
73
+ try {
74
+ await op.copy(nextcloudKey(source), nextcloudKey(destination));
75
+ } catch (error) {
76
+ if (isNotFound(error)) throw enoent(source);
77
+ throw error;
78
+ }
79
+ await invalidateAfterWrite(destination);
80
+ }
81
+
82
+ // src/core/nextcloud/write.ts
83
+ import {
84
+ enoent as enoent2,
85
+ invalidateAfterWrite as invalidateAfterWrite2,
86
+ record,
87
+ ResourceName as ResourceName2
88
+ } from "@struktoai/mirage-core";
89
+ async function write(accessor, path, data, _index) {
90
+ const startMs = performance.now();
91
+ try {
92
+ const op = await accessor.operator();
93
+ await op.write(nextcloudKey(path), Buffer.from(data));
94
+ } catch (error) {
95
+ if (isNotFound(error)) throw enoent2(path);
96
+ throw error;
97
+ }
98
+ record("write", path.virtual, ResourceName2.NEXTCLOUD, data.byteLength, startMs);
99
+ await invalidateAfterWrite2(path);
100
+ }
101
+
102
+ // src/core/nextcloud/create.ts
103
+ function create(accessor, path, index) {
104
+ return write(accessor, path, new Uint8Array(), index);
105
+ }
106
+
107
+ // src/core/nextcloud/du/entries.ts
108
+ import { FileType as FileType2, lstripSlash as lstripSlash2, stripSlash as stripSlash2 } from "@struktoai/mirage-core";
109
+
110
+ // src/core/nextcloud/du/walk.ts
111
+ import "@struktoai/mirage-core";
112
+
113
+ // src/core/nextcloud/stat.ts
114
+ import {
115
+ enoent as enoent3,
116
+ FileStat,
117
+ FileType,
118
+ guessType,
119
+ mountPrefixOf as mountPrefixOf2,
120
+ ResourceType,
121
+ stripSlash
122
+ } from "@struktoai/mirage-core";
123
+ async function stat(accessor, path, index) {
124
+ const prefix = mountPrefixOf2(path.virtual, path.resourcePath);
125
+ const raw = rawPathOf(path);
126
+ const key = stripSlash(raw);
127
+ if (key === "") return new FileStat({ name: "/", type: FileType.DIRECTORY });
128
+ const virtualKey = prefix !== "" ? `${prefix}/${key}` : `/${key}`;
129
+ if (index !== void 0) {
130
+ const lookup = await index.get(virtualKey);
131
+ if (lookup.entry !== void 0 && lookup.entry !== null) {
132
+ const entry = lookup.entry;
133
+ if (entry.resourceType === ResourceType.FOLDER) {
134
+ return new FileStat({
135
+ name: entry.name,
136
+ type: FileType.DIRECTORY,
137
+ modified: entry.remoteTime || null
138
+ });
139
+ }
140
+ return new FileStat({
141
+ name: entry.name,
142
+ size: entry.size ?? null,
143
+ modified: entry.remoteTime || null,
144
+ type: guessType(entry.name)
145
+ });
146
+ }
147
+ const parent = virtualKey.slice(0, virtualKey.lastIndexOf("/")) || "/";
148
+ const listing = await index.listDir(parent);
149
+ if (listing.entries !== void 0 && listing.entries !== null) throw enoent3(path);
150
+ }
151
+ const op = await accessor.operator();
152
+ let metadata = null;
153
+ try {
154
+ metadata = await op.stat(key);
155
+ } catch (error) {
156
+ if (!isNotFound(error)) throw error;
157
+ }
158
+ if (metadata !== null && !metadata.isDirectory()) return fileStat(key, raw, metadata);
159
+ try {
160
+ const directory = await op.stat(`${key}/`);
161
+ if (directory.isDirectory()) {
162
+ return new FileStat({
163
+ name: key.split("/").pop() ?? "/",
164
+ type: FileType.DIRECTORY,
165
+ modified: directory.lastModified
166
+ });
167
+ }
168
+ } catch (error) {
169
+ if (!isNotFound(error)) throw error;
170
+ }
171
+ throw enoent3(path);
172
+ }
173
+ function fileStat(key, raw, metadata) {
174
+ const etag = metadata.etag;
175
+ return new FileStat({
176
+ name: key.split("/").pop() ?? key,
177
+ size: metadata.contentLength !== null ? Number(metadata.contentLength) : null,
178
+ modified: metadata.lastModified,
179
+ type: guessType(raw),
180
+ fingerprint: etag,
181
+ extra: etag !== null && etag !== "" ? { etag } : {}
182
+ });
183
+ }
184
+
185
+ // src/core/nextcloud/du/walk.ts
186
+ async function statOrNull(accessor, path) {
187
+ try {
188
+ return await stat(accessor, path);
189
+ } catch (error) {
190
+ if (error?.code === "ENOENT") return null;
191
+ throw error;
192
+ }
193
+ }
194
+
195
+ // src/core/nextcloud/du/entries.ts
196
+ import { compareCodePoints } from "@struktoai/mirage-core";
197
+ async function entries(accessor, path) {
198
+ const info = await statOrNull(accessor, path);
199
+ if (info !== null && info.type !== FileType2.DIRECTORY) return [[], info.size ?? 0];
200
+ const prefix = stripSlash2(rawPathOf(path));
201
+ const scanPath = prefix !== "" ? `${prefix}/` : "/";
202
+ const op = await accessor.operator();
203
+ const found = [];
204
+ let total = 0;
205
+ try {
206
+ for (const entry of await op.list(scanPath, { recursive: true })) {
207
+ const key = entry.path();
208
+ const metadata = entry.metadata();
209
+ if (key === "" || key.endsWith("/") || metadata.isDirectory()) continue;
210
+ const size2 = metadata.contentLength !== null ? Number(metadata.contentLength) : 0;
211
+ found.push([`/${lstripSlash2(key)}`, size2]);
212
+ total += size2;
213
+ }
214
+ } catch (error) {
215
+ if (!isNotFound(error)) throw error;
216
+ }
217
+ found.sort(([left], [right]) => compareCodePoints(left, right));
218
+ return [found, total];
219
+ }
220
+
221
+ // src/core/nextcloud/du/size.ts
222
+ import { FileType as FileType3, stripSlash as stripSlash3 } from "@struktoai/mirage-core";
223
+ async function size(accessor, path) {
224
+ const info = await statOrNull(accessor, path);
225
+ if (info !== null && info.type !== FileType3.DIRECTORY) return info.size ?? 0;
226
+ const prefix = stripSlash3(rawPathOf(path));
227
+ const scanPath = prefix !== "" ? `${prefix}/` : "/";
228
+ const op = await accessor.operator();
229
+ let total = 0;
230
+ try {
231
+ for (const entry of await op.list(scanPath, { recursive: true })) {
232
+ const metadata = entry.metadata();
233
+ if (entry.path().endsWith("/") || metadata.isDirectory()) continue;
234
+ total += metadata.contentLength !== null ? Number(metadata.contentLength) : 0;
235
+ }
236
+ } catch (error) {
237
+ if (isNotFound(error)) return 0;
238
+ throw error;
239
+ }
240
+ return total;
241
+ }
242
+
243
+ // src/core/nextcloud/exists.ts
244
+ async function exists(accessor, path) {
245
+ try {
246
+ await stat(accessor, path);
247
+ return true;
248
+ } catch (error) {
249
+ if (error?.code === "ENOENT") return false;
250
+ throw error;
251
+ }
252
+ }
253
+
254
+ // src/core/nextcloud/find.ts
255
+ import {
256
+ keep,
257
+ optionsTree,
258
+ rstripSlash as rstripSlash3,
259
+ startBasename,
260
+ stripSlash as stripSlash5,
261
+ treeHasEmpty,
262
+ compareCodePoints as compareCodePoints2
263
+ } from "@struktoai/mirage-core";
264
+
265
+ // src/core/nextcloud/search/types.ts
266
+ var Namespace = {
267
+ DAV: "DAV:",
268
+ OWNCLOUD: "http://owncloud.org/ns",
269
+ SEARCHDAV: "https://github.com/icewind1991/SearchDAV/ns"
270
+ };
271
+ var Comparison = {
272
+ EQUAL: "eq",
273
+ GREATER_THAN_OR_EQUAL: "gte",
274
+ LESS_THAN_OR_EQUAL: "lte",
275
+ LIKE: "like"
276
+ };
277
+ var BooleanOperation = {
278
+ AND: "and",
279
+ OR: "or"
280
+ };
281
+
282
+ // src/core/nextcloud/search/constants.ts
283
+ var DISPLAY_NAME = {
284
+ namespace: Namespace.DAV,
285
+ prefix: "d",
286
+ name: "displayname"
287
+ };
288
+ var RESOURCE_TYPE = {
289
+ namespace: Namespace.DAV,
290
+ prefix: "d",
291
+ name: "resourcetype"
292
+ };
293
+ var CONTENT_LENGTH = {
294
+ namespace: Namespace.DAV,
295
+ prefix: "d",
296
+ name: "getcontentlength"
297
+ };
298
+ var LAST_MODIFIED = {
299
+ namespace: Namespace.DAV,
300
+ prefix: "d",
301
+ name: "getlastmodified"
302
+ };
303
+ var SIZE = {
304
+ namespace: Namespace.OWNCLOUD,
305
+ prefix: "oc",
306
+ name: "size"
307
+ };
308
+ var SELECT_PROPERTIES = [DISPLAY_NAME, RESOURCE_TYPE, CONTENT_LENGTH, LAST_MODIFIED, SIZE];
309
+ var ORDER_PROPERTIES = [DISPLAY_NAME, LAST_MODIFIED, SIZE];
310
+ var SEARCH_METHOD = "SEARCH";
311
+ var SEARCH_ENDPOINT_PATH = "/remote.php/dav/";
312
+ var SEARCH_DEPTH = "infinity";
313
+ var SEARCH_PAGE_SIZE = 100;
314
+ var SEARCH_HEADERS = {
315
+ Accept: "application/xml",
316
+ "Content-Type": "text/xml; charset=utf-8"
317
+ };
318
+ var UNAVAILABLE_STATUS_CODES = /* @__PURE__ */ new Set([404, 405, 501]);
319
+
320
+ // src/core/nextcloud/search/target.ts
321
+ import { rstripSlash, stripSlash as stripSlash4 } from "@struktoai/mirage-core";
322
+ function decodePath(path) {
323
+ try {
324
+ return decodeURIComponent(path);
325
+ } catch (error) {
326
+ throw new Error(`invalid percent-encoding in Nextcloud path: ${path}`, { cause: error });
327
+ }
328
+ }
329
+ function searchTarget(url) {
330
+ const parsed = new URL(url);
331
+ const marker = parsed.pathname.indexOf(SEARCH_ENDPOINT_PATH);
332
+ if (marker < 0) return null;
333
+ const davEnd = marker + SEARCH_ENDPOINT_PATH.length;
334
+ const relative = stripSlash4(parsed.pathname.slice(davEnd));
335
+ const parts = relative === "" ? [] : relative.split("/");
336
+ if (parts.length < 2 || parts[0] !== "files") return null;
337
+ const endpoint = new URL(parsed.toString());
338
+ endpoint.pathname = parsed.pathname.slice(0, davEnd);
339
+ endpoint.search = "";
340
+ endpoint.hash = "";
341
+ return {
342
+ endpoint: endpoint.toString(),
343
+ resourceScope: decodePath(`/${parts.join("/")}`)
344
+ };
345
+ }
346
+ function scopePath(target, path) {
347
+ const relative = stripSlash4(rawPathOf(path));
348
+ return relative === "" ? target.resourceScope : `${rstripSlash(target.resourceScope)}/${relative}`;
349
+ }
350
+ function stripScope(path, scope) {
351
+ if (path === scope) return "";
352
+ const prefix = `${rstripSlash(scope)}/`;
353
+ return path.startsWith(prefix) ? path.slice(prefix.length) : null;
354
+ }
355
+ function relativePath(href, target) {
356
+ const hrefPath = rstripSlash(decodePath(new URL(href, target.endpoint).pathname));
357
+ const resourceScope = rstripSlash(target.resourceScope);
358
+ let relative = stripScope(hrefPath, resourceScope);
359
+ if (relative === null) {
360
+ const davRoot = rstripSlash(decodePath(new URL(target.endpoint).pathname));
361
+ relative = stripScope(hrefPath, `${davRoot}${resourceScope}`);
362
+ }
363
+ if (relative === null) {
364
+ throw new Error(`Nextcloud Files Search returned an out-of-scope href: ${href}`);
365
+ }
366
+ return relative !== "" ? `/${relative}` : "/";
367
+ }
368
+
369
+ // src/core/nextcloud/search/query.ts
370
+ function escapeXml(value) {
371
+ return String(value).replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
372
+ }
373
+ function propertyTag(field) {
374
+ return `<${field.prefix}:${field.name}/>`;
375
+ }
376
+ function property(field) {
377
+ return `<d:prop>${propertyTag(field)}</d:prop>`;
378
+ }
379
+ function comparison(operation, field, value) {
380
+ return `<d:${operation}>${property(field)}<d:literal>${escapeXml(value)}</d:literal></d:${operation}>`;
381
+ }
382
+ function isCollection() {
383
+ return "<d:is-collection/>";
384
+ }
385
+ function negate(condition) {
386
+ return `<d:not>${condition}</d:not>`;
387
+ }
388
+ function combine(operation, conditions) {
389
+ const [only] = conditions;
390
+ if (only !== void 0 && conditions.length === 1) return only;
391
+ return `<d:${operation}>${conditions.join("")}</d:${operation}>`;
392
+ }
393
+ function globToLike(pattern) {
394
+ let translated = "";
395
+ for (const character of pattern) {
396
+ if (character === "*") translated += "%";
397
+ else if (character === "?") translated += "_";
398
+ else if (character === "\\") translated += "%";
399
+ else translated += character;
400
+ }
401
+ return translated;
402
+ }
403
+ function nameOperation(node) {
404
+ const wildcard = node.pattern.includes("*") || node.pattern.includes("?");
405
+ return wildcard || node.icase ? Comparison.LIKE : Comparison.EQUAL;
406
+ }
407
+ function nameCondition(node) {
408
+ const operation = nameOperation(node);
409
+ const value = operation === Comparison.LIKE ? globToLike(node.pattern) : node.pattern;
410
+ return comparison(operation, DISPLAY_NAME, value);
411
+ }
412
+ function compilePredicate(node) {
413
+ switch (node.op) {
414
+ case "true":
415
+ return { condition: null, negatable: false };
416
+ case "name": {
417
+ if (node.pattern.includes("[") || node.pattern.includes("\\")) return null;
418
+ return {
419
+ condition: nameCondition(node),
420
+ negatable: nameOperation(node) === Comparison.EQUAL
421
+ };
422
+ }
423
+ case "type":
424
+ if (node.kind === "d") return { condition: isCollection(), negatable: true };
425
+ if (node.kind === "f") return { condition: negate(isCollection()), negatable: false };
426
+ return null;
427
+ case "not": {
428
+ const compiled = compilePredicate(node.kid);
429
+ if (compiled?.condition == null) return null;
430
+ if (!compiled.negatable) return null;
431
+ return { condition: negate(compiled.condition), negatable: false };
432
+ }
433
+ case "and":
434
+ case "or": {
435
+ const conditions = [];
436
+ let negatable = false;
437
+ for (const kid of node.kids) {
438
+ const compiled = compilePredicate(kid);
439
+ if (compiled === null) return null;
440
+ if (compiled.condition === null) {
441
+ if (node.op === "or") return null;
442
+ continue;
443
+ }
444
+ conditions.push(compiled.condition);
445
+ negatable = compiled.negatable;
446
+ }
447
+ if (conditions.length === 0)
448
+ return node.op === "and" ? { condition: null, negatable: false } : null;
449
+ const operation = node.op === "and" ? BooleanOperation.AND : BooleanOperation.OR;
450
+ return {
451
+ condition: combine(operation, conditions),
452
+ negatable: conditions.length === 1 && negatable
453
+ };
454
+ }
455
+ case "path":
456
+ case "empty":
457
+ return null;
458
+ }
459
+ }
460
+ function sizeCondition(query) {
461
+ const size2 = query.size;
462
+ if (size2 === void 0) return null;
463
+ const conditions = [];
464
+ if (size2.lower !== null && size2.lower === size2.upper) {
465
+ conditions.push(comparison(Comparison.EQUAL, SIZE, size2.lower));
466
+ } else {
467
+ if (size2.lower !== null) {
468
+ conditions.push(comparison(Comparison.GREATER_THAN_OR_EQUAL, SIZE, size2.lower));
469
+ }
470
+ if (size2.upper !== null) {
471
+ conditions.push(comparison(Comparison.LESS_THAN_OR_EQUAL, SIZE, size2.upper));
472
+ }
473
+ }
474
+ if (conditions.length === 0) return null;
475
+ const fileBounds = combine(BooleanOperation.AND, [negate(isCollection()), ...conditions]);
476
+ const includesZero = (size2.lower === null || size2.lower <= 0) && (size2.upper === null || size2.upper >= 0);
477
+ return includesZero ? combine(BooleanOperation.OR, [isCollection(), fileBounds]) : fileBounds;
478
+ }
479
+ function whereCondition(query) {
480
+ const compiled = compilePredicate(query.tree);
481
+ if (compiled === null) return null;
482
+ const conditions = [];
483
+ if (compiled.condition !== null) conditions.push(compiled.condition);
484
+ const size2 = sizeCondition(query);
485
+ if (size2 !== null) conditions.push(size2);
486
+ if (query.modified?.lower != null) {
487
+ conditions.push(
488
+ comparison(Comparison.GREATER_THAN_OR_EQUAL, LAST_MODIFIED, Math.floor(query.modified.lower))
489
+ );
490
+ }
491
+ if (query.modified?.upper != null) {
492
+ conditions.push(
493
+ comparison(Comparison.LESS_THAN_OR_EQUAL, LAST_MODIFIED, Math.ceil(query.modified.upper))
494
+ );
495
+ }
496
+ return conditions.length > 0 ? combine(BooleanOperation.AND, conditions) : null;
497
+ }
498
+ function supportsQuery(query) {
499
+ return whereCondition(query) !== null;
500
+ }
501
+ function order(field) {
502
+ return `<d:order>${property(field)}<d:ascending/></d:order>`;
503
+ }
504
+ function requestBody(target, path, query, offset) {
505
+ const condition = whereCondition(query);
506
+ if (condition === null) throw new Error("Nextcloud Files Search requires a supported query");
507
+ const selected = SELECT_PROPERTIES.map(propertyTag).join("");
508
+ const ordered = ORDER_PROPERTIES.map(order).join("");
509
+ return `<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="${Namespace.DAV}" xmlns:oc="${Namespace.OWNCLOUD}" xmlns:sd="${Namespace.SEARCHDAV}"><d:basicsearch><d:select><d:prop>${selected}</d:prop></d:select><d:from><d:scope><d:href>${escapeXml(scopePath(target, path))}</d:href><d:depth>${SEARCH_DEPTH}</d:depth></d:scope></d:from><d:where>${condition}</d:where><d:orderby>${ordered}</d:orderby><d:limit><d:nresults>${String(SEARCH_PAGE_SIZE)}</d:nresults><sd:firstresult>${String(offset)}</sd:firstresult></d:limit></d:basicsearch></d:searchrequest>`;
510
+ }
511
+
512
+ // src/core/nextcloud/search/response.ts
513
+ import { XMLParser } from "fast-xml-parser";
514
+ import { SyntaxValidator } from "fast-xml-validator";
515
+ import { rstripSlash as rstripSlash2 } from "@struktoai/mirage-core";
516
+ var parser = new XMLParser({
517
+ ignoreAttributes: false,
518
+ removeNSPrefix: true,
519
+ parseTagValue: false,
520
+ trimValues: false
521
+ });
522
+ function isRecord(value) {
523
+ return value !== null && typeof value === "object" && !Array.isArray(value);
524
+ }
525
+ function records(value) {
526
+ if (Array.isArray(value)) return value.filter(isRecord);
527
+ return isRecord(value) ? [value] : [];
528
+ }
529
+ function stringValue(value) {
530
+ if (typeof value === "string" || typeof value === "number") return String(value);
531
+ return null;
532
+ }
533
+ function successfulProperties(response) {
534
+ const properties = [];
535
+ for (const propstat of records(response.propstat)) {
536
+ const status = stringValue(propstat.status) ?? "";
537
+ const fields = status.split(/\s+/);
538
+ if (fields[1] === "200" && isRecord(propstat.prop)) properties.push(propstat.prop);
539
+ }
540
+ if (properties.length === 0) {
541
+ throw new Error("Nextcloud Files Search result has no successful properties");
542
+ }
543
+ return properties;
544
+ }
545
+ function findText(properties, field) {
546
+ for (const propertySet of properties) {
547
+ const value = stringValue(propertySet[field.name]);
548
+ if (value !== null) return value;
549
+ }
550
+ return null;
551
+ }
552
+ function hasCollection(properties) {
553
+ return properties.some((propertySet) => {
554
+ const resourceType = propertySet[RESOURCE_TYPE.name];
555
+ return isRecord(resourceType) && "collection" in resourceType;
556
+ });
557
+ }
558
+ function modifiedTimestamp(value) {
559
+ if (value === null) return null;
560
+ const milliseconds = Date.parse(value);
561
+ if (Number.isNaN(milliseconds)) {
562
+ throw new Error(`invalid Nextcloud Files Search timestamp: ${value}`);
563
+ }
564
+ return milliseconds / 1e3;
565
+ }
566
+ function entrySize(properties) {
567
+ const value = findText(properties, SIZE) ?? findText(properties, CONTENT_LENGTH);
568
+ if (value === null) return null;
569
+ const size2 = Number(value);
570
+ if (!Number.isInteger(size2)) throw new Error(`invalid Nextcloud Files Search size: ${value}`);
571
+ return size2;
572
+ }
573
+ function parseResponse(response, target) {
574
+ const href = stringValue(response.href);
575
+ if (href === null) throw new Error("Nextcloud Files Search result is missing href");
576
+ const properties = successfulProperties(response);
577
+ const key = relativePath(href, target);
578
+ return {
579
+ key,
580
+ name: findText(properties, DISPLAY_NAME) ?? rstripSlash2(key).split("/").pop() ?? "",
581
+ kind: hasCollection(properties) ? "d" : "f",
582
+ size: entrySize(properties),
583
+ modified: modifiedTimestamp(findText(properties, LAST_MODIFIED))
584
+ };
585
+ }
586
+ function validateXml(content) {
587
+ try {
588
+ const validation = SyntaxValidator.validate(content);
589
+ if (validation !== true) throw new Error(validation.err.msg);
590
+ } catch (error) {
591
+ const message = error instanceof Error ? error.message : String(error);
592
+ throw new Error(`invalid Nextcloud Files Search XML: ${message}`, { cause: error });
593
+ }
594
+ }
595
+ function parsePage(content, target) {
596
+ validateXml(content);
597
+ const parsed = parser.parse(content);
598
+ if (!isRecord(parsed) || !("multistatus" in parsed)) {
599
+ throw new Error("invalid Nextcloud Files Search response");
600
+ }
601
+ const multistatus = parsed.multistatus;
602
+ if (multistatus === "") return [];
603
+ if (!isRecord(multistatus)) throw new Error("invalid Nextcloud Files Search response");
604
+ return records(multistatus.response).map((response) => parseResponse(response, target));
605
+ }
606
+
607
+ // src/core/nextcloud/search/client.ts
608
+ function authorization(accessor) {
609
+ const username = accessor.config.username;
610
+ if (username === void 0 || username === "") return null;
611
+ return `Basic ${Buffer.from(`${username}:${accessor.config.password ?? ""}`).toString("base64")}`;
612
+ }
613
+ async function searchFiles(accessor, path, query) {
614
+ if (!supportsQuery(query)) return null;
615
+ const target = searchTarget(accessor.config.url);
616
+ if (target === null) return null;
617
+ const headers = { ...SEARCH_HEADERS };
618
+ const auth = authorization(accessor);
619
+ if (auth !== null) headers.Authorization = auth;
620
+ const entries2 = /* @__PURE__ */ new Map();
621
+ let offset = 0;
622
+ for (; ; ) {
623
+ const response = await fetch(target.endpoint, {
624
+ method: SEARCH_METHOD,
625
+ headers,
626
+ body: requestBody(target, path, query, offset),
627
+ signal: AbortSignal.timeout((accessor.config.timeout ?? 30) * 1e3)
628
+ });
629
+ if (UNAVAILABLE_STATUS_CODES.has(response.status)) return null;
630
+ if (!response.ok) {
631
+ throw new Error(`Nextcloud Files Search returned HTTP ${String(response.status)}`);
632
+ }
633
+ if (response.status !== 207) {
634
+ throw new Error(
635
+ `Nextcloud Files Search returned HTTP ${String(response.status)}, expected 207`
636
+ );
637
+ }
638
+ const page = parsePage(await response.text(), target);
639
+ const previousSize = entries2.size;
640
+ for (const entry of page) if (!entries2.has(entry.key)) entries2.set(entry.key, entry);
641
+ if (page.length > 0 && entries2.size === previousSize) return null;
642
+ if (page.length < SEARCH_PAGE_SIZE) break;
643
+ offset += page.length;
644
+ }
645
+ return [...entries2.values()];
646
+ }
647
+
648
+ // src/core/nextcloud/find.ts
649
+ function findScope(path) {
650
+ const relative = stripSlash5(rawPathOf(path));
651
+ return {
652
+ baseKey: relative !== "" ? `/${relative}` : "/",
653
+ scanKey: relative !== "" ? `${relative}/` : "/",
654
+ startName: startBasename(path.virtual)
655
+ };
656
+ }
657
+ function constrained(bounds) {
658
+ return bounds.lower !== null || bounds.upper !== null;
659
+ }
660
+ function contains(bounds, value) {
661
+ if (bounds.lower !== null && value < bounds.lower) return false;
662
+ if (bounds.upper !== null && value > bounds.upper) return false;
663
+ return true;
664
+ }
665
+ function scopeContains(scope, key) {
666
+ if (scope.baseKey === "/") return key.startsWith("/");
667
+ return key === scope.baseKey || key.startsWith(`${scope.baseKey}/`);
668
+ }
669
+ function depth(scope, key) {
670
+ if (key === scope.baseKey) return 0;
671
+ const baseDepth = scope.baseKey === "/" ? 0 : (scope.baseKey.match(/\//g) ?? []).length;
672
+ return (key.match(/\//g) ?? []).length - baseDepth;
673
+ }
674
+ function parentKeys(scope, key) {
675
+ const keys = [];
676
+ let parent = key.slice(0, key.lastIndexOf("/")) || "/";
677
+ while (scopeContains(scope, parent)) {
678
+ keys.push(parent);
679
+ if (parent === scope.baseKey) break;
680
+ parent = parent.slice(0, parent.lastIndexOf("/")) || "/";
681
+ }
682
+ return keys;
683
+ }
684
+ function basename(key) {
685
+ return rstripSlash3(key).split("/").pop() ?? "";
686
+ }
687
+ function modifiedTimestamp2(metadata) {
688
+ if (metadata.lastModified === null) return null;
689
+ const milliseconds = Date.parse(metadata.lastModified);
690
+ return Number.isNaN(milliseconds) ? null : milliseconds / 1e3;
691
+ }
692
+ function candidateFromMetadata(key, name, metadata) {
693
+ const isDirectory = metadata.isDirectory();
694
+ return {
695
+ key,
696
+ name,
697
+ kind: isDirectory ? "d" : "f",
698
+ size: isDirectory ? 0 : metadata.contentLength !== null ? Number(metadata.contentLength) : null,
699
+ modified: modifiedTimestamp2(metadata),
700
+ isEmpty: null
701
+ };
702
+ }
703
+ function candidateFromSearch(entry) {
704
+ return { ...entry, isEmpty: null };
705
+ }
706
+ async function statCandidate(accessor, key, name) {
707
+ if (key === "/") {
708
+ return { key, name, kind: "d", size: 0, modified: null, isEmpty: null };
709
+ }
710
+ const op = await accessor.operator();
711
+ const relative = stripSlash5(key);
712
+ let metadata;
713
+ try {
714
+ metadata = await op.stat(relative);
715
+ } catch (error) {
716
+ if (!isNotFound(error)) throw error;
717
+ try {
718
+ metadata = await op.stat(`${relative}/`);
719
+ } catch (directoryError) {
720
+ if (isNotFound(directoryError)) return null;
721
+ throw directoryError;
722
+ }
723
+ }
724
+ return candidateFromMetadata(key, name, metadata);
725
+ }
726
+ function matches(candidate, scope, criteria) {
727
+ if (!scopeContains(scope, candidate.key)) {
728
+ throw new Error(`Nextcloud Files Search returned an out-of-scope path: ${candidate.key}`);
729
+ }
730
+ const candidateDepth = depth(scope, candidate.key);
731
+ if (criteria.maxDepth !== null && candidateDepth > criteria.maxDepth) return false;
732
+ const entry = {
733
+ key: candidate.key,
734
+ name: candidate.name,
735
+ kind: candidate.kind,
736
+ depth: candidateDepth,
737
+ isEmpty: candidate.isEmpty
738
+ };
739
+ if (!keep(entry, criteria.predicate, criteria.minDepth)) return false;
740
+ if (constrained(criteria.size)) {
741
+ const size2 = candidate.kind === "d" ? 0 : candidate.size ?? 0;
742
+ if (!contains(criteria.size, size2)) return false;
743
+ }
744
+ if (constrained(criteria.modified)) {
745
+ if (candidate.modified === null || !contains(criteria.modified, candidate.modified))
746
+ return false;
747
+ }
748
+ return true;
749
+ }
750
+ function matchingKeys(candidates, scope, criteria) {
751
+ return [...candidates.values()].filter((candidate) => matches(candidate, scope, criteria)).map((candidate) => candidate.key).sort(compareCodePoints2);
752
+ }
753
+ function searchQuery(criteria) {
754
+ return {
755
+ tree: criteria.predicate,
756
+ size: criteria.size,
757
+ modified: criteria.modified
758
+ };
759
+ }
760
+ async function findWithSearch(accessor, path, scope, criteria) {
761
+ if (criteria.maxDepth === 0 && !treeHasEmpty(criteria.predicate)) {
762
+ const start2 = await statCandidate(accessor, scope.baseKey, scope.startName);
763
+ if (start2 === null) return [];
764
+ return matchingKeys(/* @__PURE__ */ new Map([[scope.baseKey, start2]]), scope, criteria);
765
+ }
766
+ const query = searchQuery(criteria);
767
+ if (!supportsQuery(query)) return null;
768
+ const start = await statCandidate(accessor, scope.baseKey, scope.startName);
769
+ if (start === null) return [];
770
+ if (start.kind !== "d") return null;
771
+ const candidates = /* @__PURE__ */ new Map([[scope.baseKey, start]]);
772
+ if (criteria.maxDepth !== 0) {
773
+ const found = await searchFiles(accessor, path, query);
774
+ if (found === null) return null;
775
+ for (const entry of found) {
776
+ if (!candidates.has(entry.key)) candidates.set(entry.key, candidateFromSearch(entry));
777
+ }
778
+ }
779
+ return matchingKeys(candidates, scope, criteria);
780
+ }
781
+ function scanKey(rawKey) {
782
+ return `/${stripSlash5(rawKey)}`;
783
+ }
784
+ function directoryCandidate(key) {
785
+ return { key, name: basename(key), kind: "d", size: 0, modified: null, isEmpty: null };
786
+ }
787
+ async function collectScanCandidates(accessor, scope) {
788
+ const candidates = /* @__PURE__ */ new Map();
789
+ const nonemptyDirectories = /* @__PURE__ */ new Set();
790
+ const op = await accessor.operator();
791
+ let entries2;
792
+ try {
793
+ entries2 = await op.list(scope.scanKey, { recursive: true });
794
+ } catch (error) {
795
+ if (isNotFound(error)) return { candidates, nonemptyDirectories };
796
+ throw error;
797
+ }
798
+ for (const entry of entries2) {
799
+ const rawKey = entry.path();
800
+ if (rawKey === "") continue;
801
+ const key = scanKey(rawKey);
802
+ candidates.set(key, candidateFromMetadata(key, basename(key), entry.metadata()));
803
+ for (const parent of parentKeys(scope, key)) {
804
+ nonemptyDirectories.add(parent);
805
+ if (!candidates.has(parent)) candidates.set(parent, directoryCandidate(parent));
806
+ }
807
+ }
808
+ return { candidates, nonemptyDirectories };
809
+ }
810
+ function emptyState(candidate, nonemptyDirectories) {
811
+ return candidate.kind === "d" ? !nonemptyDirectories.has(candidate.key) : (candidate.size ?? 0) === 0;
812
+ }
813
+ async function hydrateScanCandidate(accessor, candidate, nonemptyDirectories, criteria) {
814
+ let hydrated = candidate;
815
+ if (constrained(criteria.modified) && candidate.kind === "d" && candidate.modified === null) {
816
+ hydrated = await statCandidate(accessor, candidate.key, candidate.name) ?? candidate;
817
+ }
818
+ return { ...hydrated, isEmpty: emptyState(hydrated, nonemptyDirectories) };
819
+ }
820
+ async function findWithScan(accessor, scope, criteria) {
821
+ const { candidates, nonemptyDirectories } = await collectScanCandidates(accessor, scope);
822
+ const start = await statCandidate(accessor, scope.baseKey, scope.startName);
823
+ if (start === null) return [];
824
+ candidates.set(scope.baseKey, start);
825
+ const hydrated = /* @__PURE__ */ new Map();
826
+ for (const candidate of candidates.values()) {
827
+ const entry = await hydrateScanCandidate(accessor, candidate, nonemptyDirectories, criteria);
828
+ hydrated.set(entry.key, entry);
829
+ }
830
+ return matchingKeys(hydrated, scope, criteria);
831
+ }
832
+ async function find(accessor, path, options = {}) {
833
+ const scope = findScope(path);
834
+ const criteria = {
835
+ predicate: optionsTree(options),
836
+ size: { lower: options.minSize ?? null, upper: options.maxSize ?? null },
837
+ modified: { lower: options.mtimeMin ?? null, upper: options.mtimeMax ?? null },
838
+ minDepth: options.minDepth ?? null,
839
+ maxDepth: options.maxDepth ?? null
840
+ };
841
+ const searchResults = await findWithSearch(accessor, path, scope, criteria);
842
+ return searchResults ?? findWithScan(accessor, scope, criteria);
843
+ }
844
+
845
+ // src/core/nextcloud/mkdir.ts
846
+ import {
847
+ invalidateAfterWrite as invalidateAfterWrite3,
848
+ invalidateAncestors,
849
+ rstripSlash as rstripSlash4
850
+ } from "@struktoai/mirage-core";
851
+ async function mkdir(accessor, path, parents = false) {
852
+ const key = `${rstripSlash4(nextcloudKey(path))}/`;
853
+ const op = await accessor.operator();
854
+ await op.createDir(key);
855
+ await invalidateAfterWrite3(path);
856
+ if (parents) await invalidateAncestors(path);
857
+ }
858
+
859
+ // src/core/nextcloud/read.ts
860
+ import {
861
+ enoent as enoent4,
862
+ record as record2,
863
+ ResourceName as ResourceName3
864
+ } from "@struktoai/mirage-core";
865
+ async function read(accessor, path, _index, options = {}) {
866
+ const op = await accessor.operator();
867
+ const readOptions = {};
868
+ if (options.offset !== void 0 && options.offset > 0) {
869
+ readOptions.offset = BigInt(options.offset);
870
+ }
871
+ if (options.size !== void 0) {
872
+ readOptions.offset ??= 0n;
873
+ readOptions.size = BigInt(options.size);
874
+ }
875
+ const startMs = performance.now();
876
+ try {
877
+ const data = readOptions.offset !== void 0 || readOptions.size !== void 0 ? await op.read(nextcloudKey(path), readOptions) : await op.read(nextcloudKey(path));
878
+ const bytes = new Uint8Array(data);
879
+ record2("read", path.virtual, ResourceName3.NEXTCLOUD, bytes.byteLength, startMs);
880
+ return bytes;
881
+ } catch (error) {
882
+ if (isNotFound(error)) throw enoent4(path);
883
+ throw error;
884
+ }
885
+ }
886
+
887
+ // src/core/nextcloud/readdir.ts
888
+ import {
889
+ enotdir,
890
+ enoent as enoent5,
891
+ IndexEntry,
892
+ mountPrefixOf as mountPrefixOf3,
893
+ ResourceType as ResourceType2,
894
+ rstripSlash as rstripSlash5,
895
+ stripSlash as stripSlash6,
896
+ compareCodePoints as compareCodePoints3
897
+ } from "@struktoai/mirage-core";
898
+ async function readdir(accessor, path, index) {
899
+ const prefix = mountPrefixOf3(path.virtual, path.resourcePath);
900
+ let target = path.pattern !== null ? path.directory : path.virtual;
901
+ if (prefix !== "" && target.startsWith(prefix)) {
902
+ const rest = target.slice(prefix.length);
903
+ if (prefix.endsWith("/") || rest === "" || rest.startsWith("/")) target = rest || "/";
904
+ }
905
+ const virtualKey = rstripSlash5(prefix !== "" ? `${prefix}${target}` : target) || "/";
906
+ if (index !== void 0) {
907
+ const listing = await index.listDir(virtualKey);
908
+ if (listing.entries !== void 0 && listing.entries !== null) return listing.entries;
909
+ }
910
+ const stripped = stripSlash6(target);
911
+ const listPath = stripped !== "" ? `${stripped}/` : "/";
912
+ const op = await accessor.operator();
913
+ let entries2;
914
+ try {
915
+ entries2 = await op.list(listPath);
916
+ } catch (error) {
917
+ if (isNotFound(error)) throw enoent5(path);
918
+ throw error;
919
+ }
920
+ const names = [];
921
+ const directories = /* @__PURE__ */ new Set();
922
+ const metadata = /* @__PURE__ */ new Map();
923
+ for (const entry of entries2) {
924
+ const relative = entry.path();
925
+ if (relative === "" || relative === listPath) continue;
926
+ const info = entry.metadata();
927
+ const isDirectory = relative.endsWith("/") || info.isDirectory();
928
+ const key = `/${rstripSlash5(relative)}`;
929
+ names.push(key);
930
+ if (isDirectory) directories.add(key);
931
+ metadata.set(key, {
932
+ size: info.contentLength !== null ? Number(info.contentLength) : null,
933
+ modified: info.lastModified ?? ""
934
+ });
935
+ }
936
+ for (const [key, info] of metadata) {
937
+ if (directories.has(key) || info.size !== null) continue;
938
+ const md = await op.stat(stripSlash6(key));
939
+ info.size = md.contentLength !== null ? Number(md.contentLength) : null;
940
+ if (info.modified === "" && md.lastModified !== null) info.modified = md.lastModified;
941
+ }
942
+ const targetKey = `/${stripSlash6(target)}`;
943
+ if (names.length === 1 && names[0] === targetKey && !directories.has(targetKey)) {
944
+ throw enotdir(path);
945
+ }
946
+ names.sort(compareCodePoints3);
947
+ if (names.length > SCOPE_ERROR) {
948
+ console.warn(
949
+ `nextcloud readdir: ${virtualKey} returned ${String(names.length)} entries (limit ${String(SCOPE_ERROR)})`
950
+ );
951
+ }
952
+ if (index !== void 0) {
953
+ await index.setDir(
954
+ virtualKey,
955
+ names.map((key) => {
956
+ const name = key.split("/").pop() ?? key;
957
+ const info = metadata.get(key);
958
+ return [
959
+ name,
960
+ new IndexEntry({
961
+ id: key,
962
+ name,
963
+ resourceType: directories.has(key) ? ResourceType2.FOLDER : ResourceType2.FILE,
964
+ size: directories.has(key) ? null : info?.size ?? null,
965
+ remoteTime: info?.modified ?? ""
966
+ })
967
+ ];
968
+ })
969
+ );
970
+ }
971
+ return names.map((key) => prefix !== "" ? `${prefix}${key}` : key).sort(compareCodePoints3);
972
+ }
973
+
974
+ // src/core/nextcloud/rename.ts
975
+ import {
976
+ enoent as enoent6,
977
+ invalidateAfterUnlink,
978
+ invalidateAfterWrite as invalidateAfterWrite4
979
+ } from "@struktoai/mirage-core";
980
+ async function rename(accessor, source, destination) {
981
+ const op = await accessor.operator();
982
+ try {
983
+ await op.rename(nextcloudKey(source), nextcloudKey(destination));
984
+ } catch (error) {
985
+ if (isNotFound(error)) throw enoent6(source);
986
+ throw error;
987
+ }
988
+ await invalidateAfterWrite4(destination);
989
+ await invalidateAfterUnlink(source);
990
+ }
991
+
992
+ // src/core/nextcloud/rm.ts
993
+ import { enoent as enoent7, invalidateAfterUnlink as invalidateAfterUnlink2, rstripSlash as rstripSlash6 } from "@struktoai/mirage-core";
994
+ async function rmR(accessor, path) {
995
+ const key = `${rstripSlash6(nextcloudKey(path))}/`;
996
+ const op = await accessor.operator();
997
+ try {
998
+ await op.removeAll(key);
999
+ } catch (error) {
1000
+ if (isNotFound(error)) throw enoent7(path);
1001
+ throw error;
1002
+ }
1003
+ await invalidateAfterUnlink2(path);
1004
+ }
1005
+
1006
+ // src/core/nextcloud/rmdir.ts
1007
+ import { enoent as enoent8, invalidateAfterUnlink as invalidateAfterUnlink3, rstripSlash as rstripSlash7 } from "@struktoai/mirage-core";
1008
+ async function rmdir(accessor, path) {
1009
+ const key = `${rstripSlash7(nextcloudKey(path))}/`;
1010
+ const op = await accessor.operator();
1011
+ try {
1012
+ await op.delete(key);
1013
+ } catch (error) {
1014
+ if (isNotFound(error)) throw enoent8(path);
1015
+ throw error;
1016
+ }
1017
+ await invalidateAfterUnlink3(path);
1018
+ }
1019
+
1020
+ // src/core/nextcloud/stream.ts
1021
+ import { enoent as enoent9, recordStream } from "@struktoai/mirage-core";
1022
+ function rangeRead(accessor, path, start, end) {
1023
+ return read(accessor, path, void 0, { offset: start, size: end - start });
1024
+ }
1025
+ async function* stream(accessor, path, _index, chunkSize = DEFAULT_CHUNK_SIZE) {
1026
+ const op = await accessor.operator();
1027
+ const rec = recordStream("read", path.virtual, accessor.resourceName);
1028
+ let reader;
1029
+ try {
1030
+ reader = await op.reader(nextcloudKey(path));
1031
+ } catch (error) {
1032
+ if (isNotFound(error)) throw enoent9(path);
1033
+ throw error;
1034
+ }
1035
+ const buffer = Buffer.alloc(chunkSize);
1036
+ for (; ; ) {
1037
+ const size2 = Number(await reader.read(buffer));
1038
+ if (size2 <= 0) break;
1039
+ const chunk = new Uint8Array(buffer.subarray(0, size2));
1040
+ if (rec !== null) rec.bytes += chunk.byteLength;
1041
+ yield chunk;
1042
+ }
1043
+ }
1044
+
1045
+ // src/core/nextcloud/truncate.ts
1046
+ import { ResourceName as ResourceName4, invalidateAfterWrite as invalidateAfterWrite5, record as record3 } from "@struktoai/mirage-core";
1047
+ async function truncate(accessor, path, length) {
1048
+ const start = performance.now();
1049
+ const op = await accessor.operator();
1050
+ const key = nextcloudKey(path);
1051
+ let current;
1052
+ try {
1053
+ current = await op.read(key);
1054
+ } catch (error) {
1055
+ if (!isNotFound(error)) throw error;
1056
+ current = Buffer.alloc(0);
1057
+ }
1058
+ const next = Buffer.alloc(length);
1059
+ current.copy(next, 0, 0, Math.min(current.byteLength, length));
1060
+ await op.write(key, next);
1061
+ record3("truncate", path.virtual, ResourceName4.NEXTCLOUD, 0, start);
1062
+ await invalidateAfterWrite5(path);
1063
+ }
1064
+
1065
+ // src/core/nextcloud/unlink.ts
1066
+ import {
1067
+ enoent as enoent10,
1068
+ invalidateAfterUnlink as invalidateAfterUnlink4,
1069
+ record as record4,
1070
+ ResourceName as ResourceName5
1071
+ } from "@struktoai/mirage-core";
1072
+ async function unlink(accessor, path) {
1073
+ const op = await accessor.operator();
1074
+ const startMs = performance.now();
1075
+ try {
1076
+ await op.delete(nextcloudKey(path));
1077
+ } catch (error) {
1078
+ if (isNotFound(error)) throw enoent10(path);
1079
+ throw error;
1080
+ }
1081
+ record4("unlink", path.virtual, ResourceName5.NEXTCLOUD, 0, startMs);
1082
+ await invalidateAfterUnlink4(path);
1083
+ }
1084
+
1085
+ // src/commands/builtin/nextcloud/io.ts
1086
+ var NEXTCLOUD_IO = {
1087
+ maxGlobMatches: SCOPE_ERROR,
1088
+ readdir,
1089
+ readBytes: read,
1090
+ readRange: rangeOf(read),
1091
+ readStream: stream,
1092
+ stat,
1093
+ isMounted: () => true,
1094
+ local: false,
1095
+ write,
1096
+ exists,
1097
+ mkdir,
1098
+ unlink,
1099
+ rmdir,
1100
+ rmR,
1101
+ rename,
1102
+ copy,
1103
+ create,
1104
+ truncate,
1105
+ find,
1106
+ du: { size, entries }
1107
+ };
1108
+
1109
+ // src/commands/builtin/nextcloud/index.ts
1110
+ var NEXTCLOUD_COMMANDS = [
1111
+ ...makeGenericCommands(ResourceName6.NEXTCLOUD, NEXTCLOUD_IO)
1112
+ ];
1113
+
1114
+ // src/core/nextcloud/watch.ts
1115
+ import {
1116
+ ListingDeltaHook,
1117
+ mountPrefixOf as mountPrefixOf4,
1118
+ statFingerprint,
1119
+ stripSlash as stripSlash7
1120
+ } from "@struktoai/mirage-core";
1121
+ var NextcloudWalk = class {
1122
+ accessor;
1123
+ constructor(accessor) {
1124
+ this.accessor = accessor;
1125
+ }
1126
+ async *walk(root) {
1127
+ const prefix = mountPrefixOf4(root.virtual, root.resourcePath);
1128
+ const base = stripSlash7(root.resourcePath);
1129
+ const listPath = base !== "" ? `${base}/` : "/";
1130
+ const operator = await this.accessor.operator();
1131
+ let entries2;
1132
+ try {
1133
+ entries2 = await operator.list(listPath, { recursive: true });
1134
+ } catch (error) {
1135
+ if (isNotFound(error)) return;
1136
+ throw error;
1137
+ }
1138
+ for (const entry of entries2) {
1139
+ const relative = entry.path();
1140
+ if (relative === "" || relative === listPath) continue;
1141
+ const metadata = entry.metadata();
1142
+ const isDir = relative.endsWith("/") || metadata.isDirectory();
1143
+ const resourcePath = stripSlash7(relative);
1144
+ const virtual = prefix !== "" ? `${prefix}/${resourcePath}` : `/${resourcePath}`;
1145
+ if (isDir) {
1146
+ yield { virtual, isDir: true, fingerprint: null };
1147
+ continue;
1148
+ }
1149
+ const modified = metadata.lastModified;
1150
+ const size2 = metadata.contentLength === null ? null : Number(metadata.contentLength);
1151
+ yield {
1152
+ virtual,
1153
+ isDir: false,
1154
+ fingerprint: statFingerprint(metadata.etag, modified, size2),
1155
+ size: size2,
1156
+ modified
1157
+ };
1158
+ }
1159
+ }
1160
+ };
1161
+ function buildDeltaHook(accessor) {
1162
+ const walk = new NextcloudWalk(accessor);
1163
+ return new ListingDeltaHook(walk.walk.bind(walk));
1164
+ }
1165
+
1166
+ // src/ops/nextcloud/index.ts
1167
+ import { makeGenericOps, ResourceName as ResourceName7 } from "@struktoai/mirage-core";
1168
+ var NEXTCLOUD_OPS = makeGenericOps(
1169
+ ResourceName7.NEXTCLOUD,
1170
+ NEXTCLOUD_IO
1171
+ );
1172
+
1173
+ // src/resource/nextcloud/prompt.ts
1174
+ var NEXTCLOUD_PROMPT = "You have access to files stored in Nextcloud.";
1175
+
1176
+ // src/resource/nextcloud/nextcloud.ts
1177
+ var resolveGlobCore = makeResolveGlob(readdir, SCOPE_ERROR);
1178
+ var NextcloudResource = class extends BaseResource {
1179
+ constructor(config) {
1180
+ super();
1181
+ this.config = config;
1182
+ this.accessor = new NextcloudAccessor(config);
1183
+ }
1184
+ config;
1185
+ kind = ResourceName8.NEXTCLOUD;
1186
+ cachesReads = true;
1187
+ // WebDAV PROPFIND carries getcontentlength for every file; readdir
1188
+ // backfills any lister-omitted size with one stat per affected file.
1189
+ sizesAlwaysKnown = true;
1190
+ supportsSnapshot = true;
1191
+ prompt = NEXTCLOUD_PROMPT;
1192
+ accessor;
1193
+ opsMap = {
1194
+ read_bytes: read,
1195
+ write,
1196
+ readdir,
1197
+ stat,
1198
+ unlink,
1199
+ rmdir,
1200
+ copy,
1201
+ rename,
1202
+ mkdir,
1203
+ read_stream: stream,
1204
+ range_read: rangeRead,
1205
+ rm_recursive: rmR,
1206
+ du_size: size,
1207
+ du_entries: entries,
1208
+ create,
1209
+ truncate,
1210
+ exists,
1211
+ find_flat: find
1212
+ };
1213
+ open() {
1214
+ return Promise.resolve();
1215
+ }
1216
+ commands() {
1217
+ return NEXTCLOUD_COMMANDS;
1218
+ }
1219
+ ops() {
1220
+ return NEXTCLOUD_OPS;
1221
+ }
1222
+ streamPath(path) {
1223
+ return stream(this.accessor, path, this.index);
1224
+ }
1225
+ readFile(path) {
1226
+ return read(this.accessor, path, this.index);
1227
+ }
1228
+ writeFile(path, data) {
1229
+ return write(this.accessor, path, data, this.index);
1230
+ }
1231
+ async appendFile(path, data) {
1232
+ let existing;
1233
+ try {
1234
+ existing = await read(this.accessor, path, this.index);
1235
+ } catch (error) {
1236
+ if (error?.code !== "ENOENT") throw error;
1237
+ existing = new Uint8Array();
1238
+ }
1239
+ const merged = new Uint8Array(existing.byteLength + data.byteLength);
1240
+ merged.set(existing);
1241
+ merged.set(data, existing.byteLength);
1242
+ await write(this.accessor, path, merged, this.index);
1243
+ }
1244
+ readdir(path) {
1245
+ return readdir(this.accessor, path, this.index);
1246
+ }
1247
+ stat(path) {
1248
+ return stat(this.accessor, path, this.index);
1249
+ }
1250
+ exists(path) {
1251
+ return exists(this.accessor, path);
1252
+ }
1253
+ mkdir(path) {
1254
+ return mkdir(this.accessor, path);
1255
+ }
1256
+ rmdir(path) {
1257
+ return rmdir(this.accessor, path);
1258
+ }
1259
+ unlink(path) {
1260
+ return unlink(this.accessor, path);
1261
+ }
1262
+ rename(source, destination) {
1263
+ return rename(this.accessor, source, destination);
1264
+ }
1265
+ truncate(path, length) {
1266
+ return truncate(this.accessor, path, length);
1267
+ }
1268
+ copy(source, destination) {
1269
+ return copy(this.accessor, source, destination);
1270
+ }
1271
+ rmR(path) {
1272
+ return rmR(this.accessor, path);
1273
+ }
1274
+ du(path) {
1275
+ return size(this.accessor, path);
1276
+ }
1277
+ find(path, options = {}) {
1278
+ return find(this.accessor, path, options);
1279
+ }
1280
+ glob(paths, prefix = "") {
1281
+ const effective = prefix ? paths.map(
1282
+ (path) => mountPrefixOf5(path.virtual, path.resourcePath) ? path : new PathSpec({
1283
+ virtual: path.virtual,
1284
+ directory: path.directory,
1285
+ ...path.pattern !== null ? { pattern: path.pattern } : {},
1286
+ resolved: path.resolved,
1287
+ resourcePath: mountKey(path.virtual, prefix)
1288
+ })
1289
+ ) : paths;
1290
+ return resolveGlobCore(this.accessor, effective, this.index);
1291
+ }
1292
+ deltaHook() {
1293
+ return buildDeltaHook(this.accessor);
1294
+ }
1295
+ getState() {
1296
+ return Promise.resolve({ type: this.kind, config: redactNextcloudConfig(this.config) });
1297
+ }
1298
+ loadState(_state) {
1299
+ return Promise.resolve();
1300
+ }
1301
+ };
1302
+
1303
+ export {
1304
+ NextcloudAccessor,
1305
+ NEXTCLOUD_COMMANDS,
1306
+ NextcloudWalk,
1307
+ buildDeltaHook,
1308
+ NEXTCLOUD_OPS,
1309
+ NEXTCLOUD_PROMPT,
1310
+ NextcloudResource
1311
+ };
1312
+ //# sourceMappingURL=chunk-NZ3EKGW4.js.map