@struktoai/mirage-node 0.0.3 → 0.0.4

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