@farm.js/core 0.1.30 → 0.1.34

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 (286) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-runtime.cjs +69 -14
  3. package/dist/agent-runtime.d.mts +1 -1
  4. package/dist/agent-runtime.d.ts +1 -1
  5. package/dist/agent-runtime.mjs +58 -3
  6. package/dist/api/route-manager.cjs +16 -13
  7. package/dist/api/route-manager.d.mts +1 -1
  8. package/dist/api/route-manager.d.ts +1 -1
  9. package/dist/api/route-manager.mjs +15 -12
  10. package/dist/api/runtime.cjs +9 -7
  11. package/dist/api/runtime.d.mts +1 -1
  12. package/dist/api/runtime.d.ts +1 -1
  13. package/dist/api/runtime.mjs +8 -6
  14. package/dist/api.cjs +19 -16
  15. package/dist/api.d.mts +2 -2
  16. package/dist/api.d.ts +2 -2
  17. package/dist/api.mjs +18 -15
  18. package/dist/{app-sUJ3jnTZ.d.ts → app-DgotYGbq.d.ts} +3 -3
  19. package/dist/app-markdown.cjs +8 -6
  20. package/dist/app-markdown.d.mts +3 -3
  21. package/dist/app-markdown.d.ts +3 -3
  22. package/dist/app-markdown.mjs +7 -5
  23. package/dist/{app-DAuUTIZf.d.mts → app-q4rmZlXK.d.mts} +3 -3
  24. package/dist/cache.cjs +2 -2
  25. package/dist/cache.d.mts +10 -1
  26. package/dist/cache.d.ts +10 -1
  27. package/dist/cache.mjs +1 -1
  28. package/dist/{chunk-YZTASLPQ.cjs → chunk-27ZWSI3W.cjs} +2 -2
  29. package/dist/{chunk-WBIH66JK.mjs → chunk-2ELDTQRN.mjs} +5 -2
  30. package/dist/{chunk-K7CELQLK.cjs → chunk-2F2ER724.cjs} +54 -29
  31. package/dist/{chunk-NRVGEI5I.mjs → chunk-2NNMOPDN.mjs} +4 -210
  32. package/dist/chunk-2NQQ5H5G.cjs +86 -0
  33. package/dist/{chunk-HPQC2LHF.cjs → chunk-36MK5YCW.cjs} +342 -163
  34. package/dist/chunk-3BU22U3M.cjs +237 -0
  35. package/dist/{chunk-MM5D6VLP.mjs → chunk-3KZS4SUS.mjs} +33 -14
  36. package/dist/chunk-3SDFA7UF.cjs +701 -0
  37. package/dist/{chunk-4IEPYMHF.mjs → chunk-3UEVPCGW.mjs} +1 -1
  38. package/dist/{chunk-6G3ZZ2IE.mjs → chunk-3VSKDFAT.mjs} +1 -1
  39. package/dist/{chunk-5HGR3W6O.mjs → chunk-5SJWVY6R.mjs} +8 -0
  40. package/dist/{chunk-X7WVQMIB.mjs → chunk-657WJNRY.mjs} +10 -4
  41. package/dist/{chunk-MKMBQSNQ.mjs → chunk-6VVL3MHY.mjs} +3 -3
  42. package/dist/{chunk-QZRVZSPN.cjs → chunk-77GNHH2Z.cjs} +3 -3
  43. package/dist/{chunk-KZLND3D2.cjs → chunk-7BT4H4P7.cjs} +7 -5
  44. package/dist/{chunk-A777V5WU.cjs → chunk-7M52YUMY.cjs} +2 -2
  45. package/dist/{chunk-VUMAE7NC.mjs → chunk-7Y6ZNFPX.mjs} +81 -30
  46. package/dist/{chunk-ZDILFMWN.cjs → chunk-A5FGU2WU.cjs} +74 -23
  47. package/dist/{chunk-BZ3CHOFX.mjs → chunk-AGC75XAE.mjs} +37 -1
  48. package/dist/{chunk-4ZQQL4IU.mjs → chunk-AHGECQEW.mjs} +1 -1
  49. package/dist/{chunk-RG3ZOTG5.cjs → chunk-AI7QMY7O.cjs} +10 -3
  50. package/dist/{chunk-O3DTUAX2.mjs → chunk-AQZFOP7S.mjs} +6 -77
  51. package/dist/{chunk-WNLBF77X.cjs → chunk-ATK2R4CH.cjs} +14 -12
  52. package/dist/{chunk-SORB3MAR.cjs → chunk-AWC4VUZL.cjs} +17 -17
  53. package/dist/{chunk-YMCXWPWK.mjs → chunk-BCMSYSN2.mjs} +4 -1
  54. package/dist/{chunk-BZAGKCKB.cjs → chunk-BTAG7LI7.cjs} +2 -2
  55. package/dist/{chunk-I6XDAKWQ.mjs → chunk-BTHHUD7Q.mjs} +14 -0
  56. package/dist/chunk-C4SPBWFM.cjs +26 -0
  57. package/dist/{chunk-JATSG2ZO.mjs → chunk-CLJYVZAD.mjs} +4 -2
  58. package/dist/{chunk-J3LOGE4T.cjs → chunk-DQQOKWYA.cjs} +5 -5
  59. package/dist/{chunk-JLRDISQL.cjs → chunk-DZ4DTRJ5.cjs} +7 -7
  60. package/dist/chunk-E5GNDG5F.mjs +701 -0
  61. package/dist/{chunk-E76XC6ZG.mjs → chunk-EZDQRNQ7.mjs} +2 -2
  62. package/dist/{chunk-TOVMYGYW.mjs → chunk-F2SE2VDO.mjs} +1 -1
  63. package/dist/{chunk-BSPQVJ4A.mjs → chunk-FDR64H6B.mjs} +13 -0
  64. package/dist/{chunk-5OVTOKGH.cjs → chunk-FFFW3OQ7.cjs} +2 -2
  65. package/dist/{chunk-D4JE5NNV.cjs → chunk-FNO7A7CM.cjs} +5 -5
  66. package/dist/chunk-FZ6YYU2W.mjs +65 -0
  67. package/dist/{chunk-PZNCMPJF.cjs → chunk-G26MUMKL.cjs} +14 -8
  68. package/dist/{chunk-IXUY2F5U.mjs → chunk-GCXWJJKH.mjs} +4 -7
  69. package/dist/{chunk-JLCQGPXE.mjs → chunk-GNSDTTWZ.mjs} +50 -61
  70. package/dist/{chunk-D234YWNA.mjs → chunk-GOABMOX3.mjs} +151 -3
  71. package/dist/{chunk-HBTUGXHS.cjs → chunk-HLJ6MBUZ.cjs} +7 -4
  72. package/dist/{chunk-GZYH4OER.mjs → chunk-HR5KPHC2.mjs} +1 -1
  73. package/dist/{chunk-ZCU4NZ3M.cjs → chunk-IE7XCHH3.cjs} +4 -4
  74. package/dist/{chunk-I26CZYPV.cjs → chunk-IHNIDL6H.cjs} +50 -7
  75. package/dist/{chunk-2FQHH5SC.mjs → chunk-IHNMMXHV.mjs} +49 -24
  76. package/dist/{chunk-VHJGDMCG.cjs → chunk-IWZKTWHZ.cjs} +2 -2
  77. package/dist/{chunk-DGXN3L4D.mjs → chunk-JDPAKVS4.mjs} +4 -4
  78. package/dist/chunk-JG6DJF5A.mjs +238 -0
  79. package/dist/{chunk-5TISYEQF.mjs → chunk-JM5XPKWH.mjs} +10 -3
  80. package/dist/{chunk-BJJATPEC.mjs → chunk-KN7K4VQN.mjs} +1 -1
  81. package/dist/{chunk-WPYFSQKK.cjs → chunk-KNBBQHO2.cjs} +15 -1
  82. package/dist/{chunk-XWAWFQFS.cjs → chunk-KXWRO25S.cjs} +7 -4
  83. package/dist/{chunk-QG5HNS7P.mjs → chunk-LHODW25H.mjs} +2 -2
  84. package/dist/{chunk-BXFWA23T.mjs → chunk-LMJ7VRHZ.mjs} +3 -3
  85. package/dist/{chunk-IVLUJUT4.mjs → chunk-LR5QSC2P.mjs} +388 -209
  86. package/dist/chunk-LSKZMJMP.cjs +65 -0
  87. package/dist/{chunk-2N5PX3LS.mjs → chunk-LYV44OIR.mjs} +7 -1
  88. package/dist/{chunk-5MKEDGLD.cjs → chunk-M64YUMA4.cjs} +11 -6
  89. package/dist/{chunk-EXLKRR4U.cjs → chunk-MIDIZJZC.cjs} +12 -12
  90. package/dist/{chunk-ES4B2IXW.cjs → chunk-MOKLYNHV.cjs} +2 -2
  91. package/dist/{chunk-IV6CQY7O.mjs → chunk-MSSFIQGM.mjs} +63 -13
  92. package/dist/{chunk-KH7BN726.cjs → chunk-N4UOK6ZI.cjs} +8 -2
  93. package/dist/{chunk-YMUE7L3D.mjs → chunk-NGVORZVZ.mjs} +1 -1
  94. package/dist/{chunk-JNGIWIY6.mjs → chunk-NPC7VWJE.mjs} +2 -2
  95. package/dist/{chunk-ILWLPEVO.mjs → chunk-NRSN7G7E.mjs} +2 -2
  96. package/dist/{chunk-PQD2AI3B.mjs → chunk-O27L4YAA.mjs} +1 -1
  97. package/dist/{chunk-X5TXZFMN.cjs → chunk-ODBZYBAB.cjs} +1 -1
  98. package/dist/{chunk-NPPL5YDT.cjs → chunk-P64MIF5B.cjs} +154 -6
  99. package/dist/{chunk-JFHKNFEO.cjs → chunk-PQDFUSXD.cjs} +14 -14
  100. package/dist/{chunk-F6XEGFHO.mjs → chunk-PXKIEXZD.mjs} +10 -0
  101. package/dist/{chunk-S5GDHOE4.mjs → chunk-PZNL3WEG.mjs} +48 -5
  102. package/dist/{chunk-FV45CKBC.mjs → chunk-QCFBDFRS.mjs} +1 -1
  103. package/dist/{chunk-75BRBIFP.cjs → chunk-QCVE2OCI.cjs} +5 -8
  104. package/dist/{chunk-6ZCMSZ5U.mjs → chunk-QE6VAKLT.mjs} +1 -1
  105. package/dist/{chunk-75DYEVXI.cjs → chunk-QGYRXFU2.cjs} +9 -9
  106. package/dist/{chunk-CTV2TTNP.cjs → chunk-QJ3J6MZT.cjs} +16 -87
  107. package/dist/{chunk-O6XNAMBV.mjs → chunk-QLQ32WC4.mjs} +8 -3
  108. package/dist/{chunk-GIWC4CFJ.cjs → chunk-SJVKK4JE.cjs} +839 -420
  109. package/dist/{chunk-3FCFQP5V.cjs → chunk-TA5G2HWD.cjs} +21 -21
  110. package/dist/{chunk-Z5HIWVDP.cjs → chunk-TDFPACVX.cjs} +62 -73
  111. package/dist/{chunk-ND224OE2.cjs → chunk-TKSCR644.cjs} +34 -15
  112. package/dist/{chunk-2UABTL3Y.mjs → chunk-U4PTAHW3.mjs} +64 -13
  113. package/dist/{chunk-ZHVYQL3H.cjs → chunk-U74I55WB.cjs} +86 -35
  114. package/dist/chunk-UBO4SGH4.mjs +86 -0
  115. package/dist/{chunk-IQXFRNY2.cjs → chunk-UFDAAQFX.cjs} +2 -2
  116. package/dist/{chunk-NXG66MR7.cjs → chunk-UX5S4JEO.cjs} +40 -4
  117. package/dist/{chunk-5ZSWG4UX.cjs → chunk-UXFQ3UDA.cjs} +14 -1
  118. package/dist/{chunk-L4DVIHOC.mjs → chunk-VCCUOMQN.mjs} +1 -1
  119. package/dist/{chunk-4V7GIE2U.mjs → chunk-VHANUNEG.mjs} +2 -2
  120. package/dist/{chunk-FXUUWYAX.cjs → chunk-VKNHTSAP.cjs} +10 -0
  121. package/dist/{chunk-2AKFKCHA.mjs → chunk-W7LF2J2S.mjs} +1 -1
  122. package/dist/{chunk-MNUGPHLN.mjs → chunk-WNNYOOIB.mjs} +5 -3
  123. package/dist/{chunk-K6V52QMI.mjs → chunk-X242HVD5.mjs} +1 -1
  124. package/dist/{chunk-UJ2C4ICS.cjs → chunk-XJXBIP67.cjs} +4 -4
  125. package/dist/{chunk-S4K74WI4.mjs → chunk-XV5DJTBX.mjs} +539 -121
  126. package/dist/{chunk-6CNX6Q3K.cjs → chunk-XXJU7FCC.cjs} +9 -5
  127. package/dist/{chunk-DYEJQTDN.cjs → chunk-YSCV4SJF.cjs} +4 -4
  128. package/dist/{chunk-2SDO73HK.cjs → chunk-YWN746US.cjs} +64 -14
  129. package/dist/chunk-Z2HLU4IX.cjs +238 -0
  130. package/dist/{chunk-Q5JFU33Q.cjs → chunk-Z2YLTERK.cjs} +4 -4
  131. package/dist/{chunk-XLTV4VOG.cjs → chunk-ZHPHJPQP.cjs} +4 -4
  132. package/dist/{chunk-7CXKSRKL.mjs → chunk-ZKP7C2B6.mjs} +4 -4
  133. package/dist/{chunk-ATXI6LGT.mjs → chunk-ZUSJDQ2Q.mjs} +8 -4
  134. package/dist/{client-plugins-BX2ptm4H.d.mts → client-plugins-CLObcuCq.d.mts} +26 -2
  135. package/dist/{client-plugins-BmxM5KW_.d.ts → client-plugins-DZjHC4Mi.d.ts} +26 -2
  136. package/dist/client-plugins.d.mts +1 -1
  137. package/dist/client-plugins.d.ts +1 -1
  138. package/dist/client.cjs +8 -8
  139. package/dist/client.d.mts +5 -5
  140. package/dist/client.d.ts +5 -5
  141. package/dist/client.mjs +7 -7
  142. package/dist/config.d.mts +1 -1
  143. package/dist/config.d.ts +1 -1
  144. package/dist/{devtools-GGVPZHJX.cjs → devtools-HU6Y2MNV.cjs} +11 -9
  145. package/dist/{devtools-THVNPI2M.mjs → devtools-RNXCTS4R.mjs} +10 -8
  146. package/dist/docs.cjs +13 -11
  147. package/dist/docs.d.mts +5 -0
  148. package/dist/docs.d.ts +5 -0
  149. package/dist/docs.mjs +12 -10
  150. package/dist/environment/vite.cjs +2 -2
  151. package/dist/environment/vite.mjs +1 -1
  152. package/dist/headers.cjs +4 -4
  153. package/dist/headers.mjs +3 -3
  154. package/dist/i18n/client.cjs +14 -13
  155. package/dist/i18n/client.mjs +5 -4
  156. package/dist/i18n/index.cjs +3 -2
  157. package/dist/i18n/index.mjs +2 -1
  158. package/dist/i18n/server.cjs +6 -5
  159. package/dist/i18n/server.mjs +5 -4
  160. package/dist/image/server.cjs +2 -2
  161. package/dist/image/server.mjs +1 -1
  162. package/dist/image/sharp.cjs +9 -9
  163. package/dist/image/sharp.mjs +1 -1
  164. package/dist/index.cjs +67 -55
  165. package/dist/index.d.mts +14 -14
  166. package/dist/index.d.ts +14 -14
  167. package/dist/index.mjs +70 -58
  168. package/dist/integrations.cjs +6 -3
  169. package/dist/integrations.d.mts +1 -1
  170. package/dist/integrations.d.ts +1 -1
  171. package/dist/integrations.mjs +7 -4
  172. package/dist/internal/app-markdown-runtime.cjs +7 -5
  173. package/dist/internal/app-markdown-runtime.d.mts +14 -3
  174. package/dist/internal/app-markdown-runtime.d.ts +14 -3
  175. package/dist/internal/app-markdown-runtime.mjs +6 -4
  176. package/dist/internal/build-runtime.cjs +38 -35
  177. package/dist/internal/build-runtime.d.mts +3 -3
  178. package/dist/internal/build-runtime.d.ts +3 -3
  179. package/dist/internal/build-runtime.mjs +37 -34
  180. package/dist/internal/cli-runtime.cjs +20 -17
  181. package/dist/internal/cli-runtime.mjs +19 -16
  182. package/dist/internal/client-error-overlay.cjs +4 -4
  183. package/dist/internal/client-error-overlay.mjs +1 -1
  184. package/dist/internal/client-runtime.cjs +4 -2
  185. package/dist/internal/client-runtime.d.mts +9 -1
  186. package/dist/internal/client-runtime.d.ts +9 -1
  187. package/dist/internal/client-runtime.mjs +3 -1
  188. package/dist/internal/compression-runtime.d.mts +1 -1
  189. package/dist/internal/compression-runtime.d.ts +1 -1
  190. package/dist/internal/config-runtime.cjs +11 -9
  191. package/dist/internal/config-runtime.d.mts +2 -2
  192. package/dist/internal/config-runtime.d.ts +2 -2
  193. package/dist/internal/config-runtime.mjs +10 -8
  194. package/dist/internal/infra-analytics-runtime.cjs +4 -4
  195. package/dist/internal/infra-analytics-runtime.mjs +2 -2
  196. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  197. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  198. package/dist/internal/production-runtime.cjs +20 -14
  199. package/dist/internal/production-runtime.d.mts +115 -8
  200. package/dist/internal/production-runtime.d.ts +115 -8
  201. package/dist/internal/production-runtime.mjs +19 -13
  202. package/dist/internal/request-cookies.cjs +4 -2
  203. package/dist/internal/request-cookies.d.mts +9 -1
  204. package/dist/internal/request-cookies.d.ts +9 -1
  205. package/dist/internal/request-cookies.mjs +3 -1
  206. package/dist/markdown.cjs +4 -4
  207. package/dist/markdown.d.mts +1 -1
  208. package/dist/markdown.d.ts +1 -1
  209. package/dist/markdown.mjs +3 -3
  210. package/dist/{metadata-DsEaK7mQ.d.mts → metadata-2HSU2i_w.d.mts} +1 -1
  211. package/dist/{metadata-fwZ3gfG6.d.ts → metadata-Cjs8JMRM.d.ts} +1 -1
  212. package/dist/middleware.cjs +18 -8
  213. package/dist/middleware.d.mts +24 -5
  214. package/dist/middleware.d.ts +24 -5
  215. package/dist/middleware.mjs +18 -8
  216. package/dist/navigation.cjs +6 -6
  217. package/dist/navigation.d.mts +4 -4
  218. package/dist/navigation.d.ts +4 -4
  219. package/dist/navigation.mjs +5 -5
  220. package/dist/{nitro-NAKCRVHX.mjs → nitro-4XGPNIK4.mjs} +3 -3
  221. package/dist/{nitro-VYDZGYFY.cjs → nitro-HSAQFXSS.cjs} +4 -4
  222. package/dist/plugin.cjs +33 -30
  223. package/dist/plugin.d.mts +1 -1
  224. package/dist/plugin.d.ts +1 -1
  225. package/dist/plugin.mjs +32 -29
  226. package/dist/{production-runtime-DNkpFnmg.d.ts → production-runtime-BU5ETAK9.d.ts} +8 -1
  227. package/dist/{production-runtime-Baqgwtvc.d.mts → production-runtime-CysZl3EV.d.mts} +8 -1
  228. package/dist/query/client.cjs +7 -7
  229. package/dist/query/client.mjs +3 -3
  230. package/dist/{render-plan-DhwQnmmX.d.mts → render-plan-CKr4ltOd.d.mts} +1 -1
  231. package/dist/{render-plan-rkIK9wd9.d.ts → render-plan-D72O1qm4.d.ts} +1 -1
  232. package/dist/renderer-client.cjs +39 -19
  233. package/dist/renderer-client.d.mts +3 -3
  234. package/dist/renderer-client.d.ts +3 -3
  235. package/dist/renderer-client.mjs +28 -8
  236. package/dist/{request-CFy1BltJ.d.mts → request-Be83WafN.d.mts} +7 -2
  237. package/dist/{request-BcY4RYPC.d.ts → request-DbyOYI2j.d.ts} +7 -2
  238. package/dist/request.cjs +2 -2
  239. package/dist/request.d.mts +2 -2
  240. package/dist/request.d.ts +2 -2
  241. package/dist/request.mjs +1 -1
  242. package/dist/{route-rendering-BkS0TBlB.d.mts → route-rendering-BG56SzvJ.d.mts} +1 -1
  243. package/dist/{route-rendering-D4XpMjam.d.ts → route-rendering-CtVMpV-k.d.ts} +1 -1
  244. package/dist/{router-C4zPlC3V.d.mts → router-ALUvm8gC.d.mts} +1 -1
  245. package/dist/{router-Cq7BcZxg.d.ts → router-D94-SDlW.d.ts} +1 -1
  246. package/dist/routes.cjs +3 -3
  247. package/dist/routes.d.mts +1 -1
  248. package/dist/routes.d.ts +1 -1
  249. package/dist/routes.mjs +2 -2
  250. package/dist/server-fn.cjs +3 -3
  251. package/dist/server-fn.mjs +2 -2
  252. package/dist/server-plugins.cjs +4 -4
  253. package/dist/server-plugins.d.mts +2 -2
  254. package/dist/server-plugins.d.ts +2 -2
  255. package/dist/server-plugins.mjs +3 -3
  256. package/dist/server-query-client.cjs +3 -3
  257. package/dist/server-query-client.mjs +2 -2
  258. package/dist/server-query.cjs +4 -4
  259. package/dist/server-query.mjs +3 -3
  260. package/dist/server.cjs +60 -57
  261. package/dist/server.d.mts +7 -7
  262. package/dist/server.d.ts +7 -7
  263. package/dist/server.mjs +37 -34
  264. package/dist/{spa-router-B1HI3X9k.d.ts → spa-router-CxK3USIz.d.ts} +2 -2
  265. package/dist/{spa-router-DzPZH-AO.d.mts → spa-router-DbxNRKOB.d.mts} +2 -2
  266. package/dist/testing.cjs +19 -17
  267. package/dist/testing.d.mts +1 -1
  268. package/dist/testing.d.ts +1 -1
  269. package/dist/testing.mjs +16 -14
  270. package/dist/theme/server.cjs +4 -3
  271. package/dist/theme/server.mjs +3 -2
  272. package/dist/{utils-DMD1Hzta.d.ts → utils-311Y8eoK.d.ts} +1 -1
  273. package/dist/{utils-CEBktlBG.d.mts → utils-4wVRcpOw.d.mts} +1 -1
  274. package/dist/version.cjs +2 -2
  275. package/dist/version.mjs +1 -1
  276. package/dist/vite.cjs +33 -30
  277. package/dist/vite.d.mts +1 -1
  278. package/dist/vite.d.ts +1 -1
  279. package/dist/vite.mjs +32 -29
  280. package/package.json +2 -2
  281. package/dist/chunk-22GUSVNJ.cjs +0 -351
  282. package/dist/chunk-SWN467MP.cjs +0 -18
  283. package/dist/chunk-XGC343EY.cjs +0 -443
  284. package/dist/chunk-ZSH2Y4LN.mjs +0 -351
  285. /package/dist/{chunk-SUIBNSNO.cjs → chunk-SJNMVDDF.cjs} +0 -0
  286. /package/dist/{chunk-LNZ7JZUS.mjs → chunk-UDNPLXW7.mjs} +0 -0
@@ -0,0 +1,65 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+
6
+ var _chunkSVRTJOUFcjs = require('./chunk-SVRTJOUF.cjs');
7
+
8
+
9
+ var _chunkS3JO3N4Hcjs = require('./chunk-S3JO3N4H.cjs');
10
+
11
+ // src/integration-request-security.ts
12
+ function resolveIntegrationAllowedOrigins(values, label) {
13
+ return Object.freeze((_nullishCoalesce(values, () => ( []))).map((value) => _chunkSVRTJOUFcjs.normalizeAllowedOriginPattern.call(void 0, value, label)));
14
+ }
15
+ _chunkS3JO3N4Hcjs.__name.call(void 0, resolveIntegrationAllowedOrigins, "resolveIntegrationAllowedOrigins");
16
+ function validateIntegrationRequestOrigin(request, policy = {}) {
17
+ const allowedOrigins = _nullishCoalesce(policy.allowedOrigins, () => ( []));
18
+ const requireOriginMetadata = _nullishCoalesce(policy.requireOriginMetadata, () => ( true));
19
+ const fetchSite = _optionalChain([request, 'access', _ => _.headers, 'access', _2 => _2.get, 'call', _3 => _3("sec-fetch-site"), 'optionalAccess', _4 => _4.trim, 'call', _5 => _5(), 'access', _6 => _6.toLowerCase, 'call', _7 => _7()]);
20
+ const source = _chunkSVRTJOUFcjs.getRequestSourceOrigin.call(void 0, request);
21
+ if (!source.ok) {
22
+ return { ok: false, reason: source.reason };
23
+ }
24
+ if (source.origin === null) {
25
+ if (fetchSite === "same-origin") {
26
+ return { ok: true };
27
+ }
28
+ if (requireOriginMetadata) {
29
+ return { ok: false, reason: fetchSite === "cross-site" ? "cross-site" : "missing-origin" };
30
+ }
31
+ return fetchSite === "cross-site" ? { ok: false, reason: "cross-site" } : { ok: true };
32
+ }
33
+ const requestUrl = new URL(request.url);
34
+ const matchesConfiguredOrigin = allowedOrigins.some(
35
+ (pattern) => _chunkSVRTJOUFcjs.matchesAllowedOrigin.call(void 0, source.origin, pattern)
36
+ );
37
+ const matchesRequest = source.origin === requestUrl.origin || _chunkSVRTJOUFcjs.matchesHostHeader.call(void 0, source.origin, request);
38
+ if (!matchesRequest && !matchesConfiguredOrigin) {
39
+ return { ok: false, reason: "cross-site" };
40
+ }
41
+ if (fetchSite === "cross-site" && !matchesConfiguredOrigin) {
42
+ return { ok: false, reason: "cross-site" };
43
+ }
44
+ return { ok: true };
45
+ }
46
+ _chunkS3JO3N4Hcjs.__name.call(void 0, validateIntegrationRequestOrigin, "validateIntegrationRequestOrigin");
47
+ function describeIntegrationOriginRejection(reason) {
48
+ switch (reason) {
49
+ case "missing-origin":
50
+ return "Request is missing same-origin metadata.";
51
+ case "opaque-origin":
52
+ return "Opaque origins are not allowed.";
53
+ case "invalid-origin":
54
+ return "Invalid request origin.";
55
+ case "cross-site":
56
+ return "Cross-site request was rejected.";
57
+ }
58
+ }
59
+ _chunkS3JO3N4Hcjs.__name.call(void 0, describeIntegrationOriginRejection, "describeIntegrationOriginRejection");
60
+
61
+
62
+
63
+
64
+
65
+ exports.resolveIntegrationAllowedOrigins = resolveIntegrationAllowedOrigins; exports.validateIntegrationRequestOrigin = validateIntegrationRequestOrigin; exports.describeIntegrationOriginRejection = describeIntegrationOriginRejection;
@@ -59,8 +59,12 @@ function claimServerQueryKey(owner, key) {
59
59
  }
60
60
  __name(claimServerQueryKey, "claimServerQueryKey");
61
61
  var RAW_SERVER_QUERY_SYMBOL = /* @__PURE__ */ Symbol.for("farm.server-query");
62
+ function isFarmServerQueryBrowserRuntime() {
63
+ return typeof window !== "undefined" && typeof document !== "undefined";
64
+ }
65
+ __name(isFarmServerQueryBrowserRuntime, "isFarmServerQueryBrowserRuntime");
62
66
  function assertNotRawServerQueryInBrowser(query) {
63
- if (typeof window === "undefined" || typeof document === "undefined") return;
67
+ if (!isFarmServerQueryBrowserRuntime()) return;
64
68
  if (!query?.[RAW_SERVER_QUERY_SYMBOL]) return;
65
69
  throw new Error(
66
70
  [
@@ -129,6 +133,7 @@ function createServerQueryCallKey(query, input) {
129
133
  }
130
134
  __name(createServerQueryCallKey, "createServerQueryCallKey");
131
135
  async function fetchServerQuery(query, input, options = {}) {
136
+ if (!isFarmServerQueryBrowserRuntime()) return query(input);
132
137
  const cache = getFarmClientDataCache();
133
138
  const provisionalKey = createServerQueryCallKey(query, input);
134
139
  const entry = cache.get(provisionalKey);
@@ -241,6 +246,7 @@ __name(normalizeServerQueryError, "normalizeServerQueryError");
241
246
 
242
247
  export {
243
248
  attachRevalidationListeners,
249
+ isFarmServerQueryBrowserRuntime,
244
250
  beginFarmServerQueryAction,
245
251
  completeFarmServerQueryAction,
246
252
  shouldApplyFarmServerQueryActionResult,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkWPYFSQKKcjs = require('./chunk-WPYFSQKK.cjs');
4
+ var _chunkKNBBQHO2cjs = require('./chunk-KNBBQHO2.cjs');
5
5
 
6
6
 
7
7
  var _chunkG7HXGLECcjs = require('./chunk-G7HXGLEC.cjs');
@@ -16,8 +16,12 @@ function catalogs() {
16
16
  return _nullishCoalesce(state[CATALOGS], () => ( (state[CATALOGS] = /* @__PURE__ */ new Map())));
17
17
  }
18
18
  _chunkS3JO3N4Hcjs.__name.call(void 0, catalogs, "catalogs");
19
- function _publishFarmMCPCatalog(server, tools) {
20
- const entry = { server, tools };
19
+ function _listFarmMCPCatalogs() {
20
+ return [...catalogs().values()];
21
+ }
22
+ _chunkS3JO3N4Hcjs.__name.call(void 0, _listFarmMCPCatalogs, "_listFarmMCPCatalogs");
23
+ function _publishFarmMCPCatalog(server, tools, details) {
24
+ const entry = { server, tools, ...details ? { details } : {} };
21
25
  catalogs().set(server.path, entry);
22
26
  return () => {
23
27
  if (catalogs().get(server.path) === entry) catalogs().delete(server.path);
@@ -34,12 +38,12 @@ function _findFarmMCPEndpointTool(method, pathname, serverBasePath) {
34
38
  }
35
39
  }
36
40
  if (routes.size === 0) continue;
37
- const canonical = serverBasePath ? _chunkWPYFSQKKcjs.resolveFarmAPICanonicalPathname.call(void 0, pathname, serverBasePath) : pathname;
41
+ const canonical = serverBasePath ? _chunkKNBBQHO2cjs.resolveFarmAPICanonicalPathname.call(void 0, pathname, serverBasePath) : pathname;
38
42
  const match = _chunkG7HXGLECcjs.matchAPIRoute.call(void 0, routes, canonical);
39
43
  if (match) {
40
44
  return {
41
45
  name: match.route.name,
42
- endpoint: _chunkWPYFSQKKcjs.resolveFarmAPIServerRoutePath.call(void 0, server.path, serverBasePath)
46
+ endpoint: _chunkKNBBQHO2cjs.resolveFarmAPIServerRoutePath.call(void 0, server.path, serverBasePath)
43
47
  };
44
48
  }
45
49
  }
@@ -50,4 +54,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, _findFarmMCPEndpointTool, "_findFarmMCPEnd
50
54
 
51
55
 
52
56
 
53
- exports._publishFarmMCPCatalog = _publishFarmMCPCatalog; exports._findFarmMCPEndpointTool = _findFarmMCPEndpointTool;
57
+
58
+ exports._listFarmMCPCatalogs = _listFarmMCPCatalogs; exports._publishFarmMCPCatalog = _publishFarmMCPCatalog; exports._findFarmMCPEndpointTool = _findFarmMCPEndpointTool;
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkSUIBNSNOcjs = require('./chunk-SUIBNSNO.cjs');
3
+ var _chunkSJNMVDDFcjs = require('./chunk-SJNMVDDF.cjs');
4
4
 
5
5
 
6
6
  var _chunk2CQ74SP6cjs = require('./chunk-2CQ74SP6.cjs');
7
7
 
8
8
 
9
- var _chunkUJ2C4ICScjs = require('./chunk-UJ2C4ICS.cjs');
9
+ var _chunkXJXBIP67cjs = require('./chunk-XJXBIP67.cjs');
10
10
 
11
11
 
12
12
  var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
@@ -17,7 +17,7 @@ var _chunkLYLEZIG3cjs = require('./chunk-LYLEZIG3.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkPZNCMPJFcjs = require('./chunk-PZNCMPJF.cjs');
20
+ var _chunkG26MUMKLcjs = require('./chunk-G26MUMKL.cjs');
21
21
 
22
22
 
23
23
  var _chunkWMAPPDMMcjs = require('./chunk-WMAPPDMM.cjs');
@@ -93,7 +93,7 @@ var _APIRouteManager = class _APIRouteManager {
93
93
  await this.loadProgrammaticApiRoutes(appDir);
94
94
  }
95
95
  this.routes = new Map(
96
- _chunkPZNCMPJFcjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
96
+ _chunkG26MUMKLcjs.mergePluginAPIRoutes.call(void 0, [...this.routes.values()], this.plugins, void 0, {
97
97
  bodySizeLimit: this.bodySizeLimit
98
98
  }).map((route) => [route.path, route])
99
99
  );
@@ -140,7 +140,7 @@ var _APIRouteManager = class _APIRouteManager {
140
140
  const routeModule = await this.loadModule(filePath);
141
141
  const endpoints = {};
142
142
  const availableMethods = [];
143
- for (const method of _chunkPZNCMPJFcjs.API_ROUTE_METHODS) {
143
+ for (const method of _chunkG26MUMKLcjs.API_ROUTE_METHODS) {
144
144
  if (routeModule[method]) {
145
145
  endpoints[method] = routeModule[method];
146
146
  availableMethods.push(method);
@@ -210,7 +210,7 @@ var _APIRouteManager = class _APIRouteManager {
210
210
  async loadProgrammaticApiRoutes(appDir) {
211
211
  const candidateRoots = [path.dirname(appDir), appDir];
212
212
  const routeFiles = Array.from(
213
- new Set(candidateRoots.flatMap((srcRoot) => _chunkSUIBNSNOcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot)))
213
+ new Set(candidateRoots.flatMap((srcRoot) => _chunkSJNMVDDFcjs.findProgrammaticRouteFilesInDir.call(void 0, srcRoot)))
214
214
  );
215
215
  if (routeFiles.length === 0) return;
216
216
  const { getProgrammaticRouteManifest } = await import("./routes.cjs");
@@ -322,7 +322,7 @@ var _APIRouteManager = class _APIRouteManager {
322
322
  const url = new URL(request.url);
323
323
  const pathname = url.pathname;
324
324
  const method = request.method.toUpperCase();
325
- const match = _chunkPZNCMPJFcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
325
+ const match = _chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
326
326
  if (!match) {
327
327
  return new Response(JSON.stringify({ error: "Not Found" }), {
328
328
  status: 404,
@@ -330,19 +330,19 @@ var _APIRouteManager = class _APIRouteManager {
330
330
  });
331
331
  }
332
332
  const { route, params } = match;
333
- const endpoint = _chunkPZNCMPJFcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
333
+ const endpoint = _chunkG26MUMKLcjs.resolveAPIRouteEndpoint.call(void 0, route, method);
334
334
  if (!endpoint) {
335
335
  return new Response(JSON.stringify({ error: "Method Not Allowed" }), {
336
336
  status: 405,
337
337
  headers: {
338
- Allow: _chunkPZNCMPJFcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
338
+ Allow: _chunkG26MUMKLcjs.getAllowedAPIRouteMethods.call(void 0, route).join(", "),
339
339
  "Content-Type": "application/json"
340
340
  }
341
341
  });
342
342
  }
343
343
  const invoke = /* @__PURE__ */ _chunkS3JO3N4Hcjs.__name.call(void 0, async () => {
344
344
  try {
345
- return await _chunkPZNCMPJFcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
345
+ return await _chunkG26MUMKLcjs.invokeAPIRouteEndpoint.call(void 0, endpoint, request, params, this.bodySizeLimit);
346
346
  } catch (error) {
347
347
  if (options.throwOnError) throw error;
348
348
  console.error(`[API Error] ${pathname}:`, error);
@@ -352,7 +352,7 @@ var _APIRouteManager = class _APIRouteManager {
352
352
  });
353
353
  }
354
354
  }, "invoke");
355
- return _optionalChain([this, 'access', _10 => _10.i18n, 'optionalAccess', _11 => _11.config, 'access', _12 => _12.enabled]) ? _chunkUJ2C4ICScjs._runWithFarmI18nRequest.call(void 0, this.i18n, request, invoke, {
355
+ return _optionalChain([this, 'access', _10 => _10.i18n, 'optionalAccess', _11 => _11.config, 'access', _12 => _12.enabled]) ? _chunkXJXBIP67cjs._runWithFarmI18nRequest.call(void 0, this.i18n, request, invoke, {
356
356
  redirect: false
357
357
  }) : invoke();
358
358
  };
@@ -364,7 +364,7 @@ var _APIRouteManager = class _APIRouteManager {
364
364
  return Boolean(this.matchRoute(pathname));
365
365
  }
366
366
  matchRoute(pathname) {
367
- return _chunkPZNCMPJFcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
367
+ return _chunkG26MUMKLcjs.matchAPIRouteAtBasePath.call(void 0, this.routes, pathname, this.basePath);
368
368
  }
369
369
  /**
370
370
  * Get all routes for client type generation
@@ -7,7 +7,7 @@
7
7
  var _chunkT5CERMEHcjs = require('./chunk-T5CERMEH.cjs');
8
8
 
9
9
 
10
- var _chunk2SDO73HKcjs = require('./chunk-2SDO73HK.cjs');
10
+ var _chunkYWN746UScjs = require('./chunk-YWN746US.cjs');
11
11
 
12
12
 
13
13
  var _chunkOX6O6WVAcjs = require('./chunk-OX6O6WVA.cjs');
@@ -139,7 +139,7 @@ function createServerFn(options) {
139
139
  context: resolvedContext,
140
140
  result: parsedResult
141
141
  }) : options.invalidates;
142
- await _chunk2SDO73HKcjs.applyFarmCacheInvalidationTargets.call(void 0, declaration);
142
+ await _chunkYWN746UScjs.applyFarmCacheInvalidationTargets.call(void 0, declaration);
143
143
  }
144
144
  return parsedResult;
145
145
  }, "run");
@@ -150,16 +150,21 @@ function storageCacheAdapter(storage, options = {}) {
150
150
  throw new TypeError("storageCacheAdapter expects a compatible storage client.");
151
151
  }
152
152
  const base = normalizeCacheNamespace(options.base || "farm-cache");
153
- const entryKey = /* @__PURE__ */ __name((key) => `${base}:entry:${key}`, "entryKey");
154
- const tagKey = /* @__PURE__ */ __name((tag) => `${base}:tag:${tag}`, "tagKey");
153
+ const entryKey = /* @__PURE__ */ __name(async (key) => `${base}:entry:${await encodeStorageKeySegment(key)}`, "entryKey");
154
+ const tagKey = /* @__PURE__ */ __name(async (tag) => `${base}:tag:${await encodeStorageKeySegment(tag)}`, "tagKey");
155
155
  return {
156
156
  name: "storage",
157
- get: /* @__PURE__ */ __name((key) => storage.getItem(entryKey(key)), "get"),
157
+ get: /* @__PURE__ */ __name(async (key) => storage.getItem(await entryKey(key)), "get"),
158
158
  set: /* @__PURE__ */ __name(async (key, entry) => {
159
- await storage.setItem(entryKey(key), entry);
159
+ const ttlMs = getFarmCacheEntryTtlMs(entry);
160
+ if (ttlMs === void 0) {
161
+ await storage.setItem(await entryKey(key), entry);
162
+ } else {
163
+ await storage.setItem(await entryKey(key), entry, { ttl: Math.ceil(ttlMs / 1e3) });
164
+ }
160
165
  }, "set"),
161
166
  delete: /* @__PURE__ */ __name(async (key) => {
162
- await storage.removeItem(entryKey(key));
167
+ await storage.removeItem(await entryKey(key));
163
168
  }, "delete"),
164
169
  clear: storage.clear ? async () => {
165
170
  await storage.clear(base);
@@ -167,7 +172,7 @@ function storageCacheAdapter(storage, options = {}) {
167
172
  getTagVersions: /* @__PURE__ */ __name(async (tags) => {
168
173
  const versions = await Promise.all(
169
174
  tags.map(async (tag) => {
170
- const value = await storage.getItem(tagKey(tag));
175
+ const value = await storage.getItem(await tagKey(tag));
171
176
  return [tag, normalizeAdapterVersion(value)];
172
177
  })
173
178
  );
@@ -176,7 +181,7 @@ function storageCacheAdapter(storage, options = {}) {
176
181
  invalidateTags: /* @__PURE__ */ __name(async (tags) => {
177
182
  await Promise.all(
178
183
  tags.map(async (tag) => {
179
- const key = tagKey(tag);
184
+ const key = await tagKey(tag);
180
185
  const current = normalizeAdapterVersion(await storage.getItem(key));
181
186
  await storage.setItem(key, Math.max(Date.now(), current + 1));
182
187
  })
@@ -185,6 +190,35 @@ function storageCacheAdapter(storage, options = {}) {
185
190
  };
186
191
  }
187
192
  __name(storageCacheAdapter, "storageCacheAdapter");
193
+ var MAX_STORAGE_KEY_SEGMENT_LENGTH = 200;
194
+ async function encodeStorageKeySegment(value) {
195
+ let encoded;
196
+ try {
197
+ encoded = encodeURIComponent(value);
198
+ } catch {
199
+ }
200
+ if (encoded !== void 0 && encoded.length <= MAX_STORAGE_KEY_SEGMENT_LENGTH) return encoded;
201
+ const digest = await crypto.subtle.digest(
202
+ "SHA-256",
203
+ new TextEncoder().encode(JSON.stringify(value))
204
+ );
205
+ let hex = "";
206
+ for (const byte of new Uint8Array(digest)) hex += byte.toString(16).padStart(2, "0");
207
+ return `sha256:${hex}`;
208
+ }
209
+ __name(encodeStorageKeySegment, "encodeStorageKeySegment");
210
+ var MIN_STALE_RETENTION_MS = 6e4;
211
+ function getFarmCacheEntryExpiresAt(createdAt, revalidate, now = Date.now()) {
212
+ if (typeof revalidate !== "number") return void 0;
213
+ const revalidateMs = revalidate * 1e3;
214
+ return Math.max(createdAt + revalidateMs, now) + Math.max(revalidateMs, MIN_STALE_RETENTION_MS);
215
+ }
216
+ __name(getFarmCacheEntryExpiresAt, "getFarmCacheEntryExpiresAt");
217
+ function getFarmCacheEntryTtlMs(entry, now = Date.now()) {
218
+ if (typeof entry.expiresAt !== "number" || !Number.isFinite(entry.expiresAt)) return void 0;
219
+ return Math.max(1, Math.ceil(entry.expiresAt - now));
220
+ }
221
+ __name(getFarmCacheEntryTtlMs, "getFarmCacheEntryTtlMs");
188
222
  var _FarmDataCache = class _FarmDataCache {
189
223
  constructor(config = {}) {
190
224
  this.entries = /* @__PURE__ */ new Map();
@@ -287,11 +321,20 @@ var _FarmDataCache = class _FarmDataCache {
287
321
  const namespace = this.namespace;
288
322
  const entry = await adapter.get(`${namespace}:entry:${key}`);
289
323
  if (generation !== this.generation) return void 0;
290
- if (!entry) {
291
- emitFarmEvent({ type: "cache.miss", key });
324
+ if (!entry || isForeignAdapterEntry(entry, key)) {
325
+ emitFarmEvent({ type: "cache.miss", key, ...entry ? { reason: "key-mismatch" } : {} });
292
326
  return void 0;
293
327
  }
294
328
  assertFarmCacheEntry(entry, key);
329
+ if (typeof entry.expiresAt === "number" && entry.expiresAt <= (options.now ?? Date.now())) {
330
+ emitFarmEvent({ type: "cache.miss", key, reason: "expired" });
331
+ try {
332
+ await adapter.delete(`${namespace}:entry:${key}`);
333
+ } catch (error) {
334
+ emitFarmEvent({ type: "cache.error", key, operation: "delete", error });
335
+ }
336
+ return void 0;
337
+ }
295
338
  const stale = await this.isAdapterEntryStale(entry, options.now, adapter, namespace);
296
339
  if (generation !== this.generation) return void 0;
297
340
  if (stale) {
@@ -352,14 +395,17 @@ var _FarmDataCache = class _FarmDataCache {
352
395
  const revalidate = normalizeRevalidate(options.revalidate);
353
396
  const tags = normalizeCacheOptionsTags(options);
354
397
  const capturedVersions = tagVersions ?? await this.getAdapterTagVersions(Array.from(tags.values()));
398
+ const createdAt = options.createdAt ?? Date.now();
399
+ const expiresAt = getFarmCacheEntryExpiresAt(createdAt, revalidate);
355
400
  const entry = {
356
401
  key,
357
402
  value,
358
403
  tags: Array.from(tags),
359
404
  tagVersions: capturedVersions,
360
- createdAt: options.createdAt ?? Date.now(),
405
+ createdAt,
361
406
  createdVersion: createdVersion ?? ++this.version,
362
- revalidate
407
+ revalidate,
408
+ ...expiresAt === void 0 ? {} : { expiresAt }
363
409
  };
364
410
  if (this.local) {
365
411
  this.hydrateLocalEntry(entry);
@@ -561,8 +607,8 @@ var _FarmDataCache = class _FarmDataCache {
561
607
  if (generation !== this.generation) return void 0;
562
608
  const entry = await adapter.get(`${namespace}:entry:${key}`);
563
609
  if (generation !== this.generation) return void 0;
564
- if (!entry) {
565
- emitFarmEvent({ type: "cache.miss", key });
610
+ if (!entry || isForeignAdapterEntry(entry, key)) {
611
+ emitFarmEvent({ type: "cache.miss", key, ...entry ? { reason: "key-mismatch" } : {} });
566
612
  continue;
567
613
  }
568
614
  assertFarmCacheEntry(entry, key);
@@ -908,6 +954,10 @@ function normalizeCacheOptionsTags(options) {
908
954
  return tags;
909
955
  }
910
956
  __name(normalizeCacheOptionsTags, "normalizeCacheOptionsTags");
957
+ function isForeignAdapterEntry(entry, expectedKey) {
958
+ return typeof entry === "object" && entry !== null && typeof entry.key === "string" && entry.key !== expectedKey;
959
+ }
960
+ __name(isForeignAdapterEntry, "isForeignAdapterEntry");
911
961
  function assertFarmCacheEntry(entry, expectedKey) {
912
962
  if (!entry || typeof entry !== "object" || entry.key !== expectedKey || !Array.isArray(entry.tags) || typeof entry.createdAt !== "number") {
913
963
  throw new TypeError(
@@ -59,8 +59,12 @@ function claimServerQueryKey(owner, key) {
59
59
  }
60
60
  _chunkS3JO3N4Hcjs.__name.call(void 0, claimServerQueryKey, "claimServerQueryKey");
61
61
  var RAW_SERVER_QUERY_SYMBOL = /* @__PURE__ */ Symbol.for("farm.server-query");
62
+ function isFarmServerQueryBrowserRuntime() {
63
+ return typeof window !== "undefined" && typeof document !== "undefined";
64
+ }
65
+ _chunkS3JO3N4Hcjs.__name.call(void 0, isFarmServerQueryBrowserRuntime, "isFarmServerQueryBrowserRuntime");
62
66
  function assertNotRawServerQueryInBrowser(query) {
63
- if (typeof window === "undefined" || typeof document === "undefined") return;
67
+ if (!isFarmServerQueryBrowserRuntime()) return;
64
68
  if (!_optionalChain([query, 'optionalAccess', _ => _[RAW_SERVER_QUERY_SYMBOL]])) return;
65
69
  throw new Error(
66
70
  [
@@ -129,6 +133,7 @@ function createServerQueryCallKey(query, input) {
129
133
  }
130
134
  _chunkS3JO3N4Hcjs.__name.call(void 0, createServerQueryCallKey, "createServerQueryCallKey");
131
135
  async function fetchServerQuery(query, input, options = {}) {
136
+ if (!isFarmServerQueryBrowserRuntime()) return query(input);
132
137
  const cache = _chunk63H6BKXGcjs.getFarmClientDataCache.call(void 0, );
133
138
  const provisionalKey = createServerQueryCallKey(query, input);
134
139
  const entry = cache.get(provisionalKey);
@@ -247,4 +252,5 @@ _chunkS3JO3N4Hcjs.__name.call(void 0, normalizeServerQueryError, "normalizeServe
247
252
 
248
253
 
249
254
 
250
- exports.attachRevalidationListeners = attachRevalidationListeners; exports.beginFarmServerQueryAction = beginFarmServerQueryAction; exports.completeFarmServerQueryAction = completeFarmServerQueryAction; exports.shouldApplyFarmServerQueryActionResult = shouldApplyFarmServerQueryActionResult; exports.createServerQueryCallKey = createServerQueryCallKey; exports.fetchServerQuery = fetchServerQuery; exports.prefetchServerQuery = prefetchServerQuery;
255
+
256
+ exports.attachRevalidationListeners = attachRevalidationListeners; exports.isFarmServerQueryBrowserRuntime = isFarmServerQueryBrowserRuntime; exports.beginFarmServerQueryAction = beginFarmServerQueryAction; exports.completeFarmServerQueryAction = completeFarmServerQueryAction; exports.shouldApplyFarmServerQueryActionResult = shouldApplyFarmServerQueryActionResult; exports.createServerQueryCallKey = createServerQueryCallKey; exports.fetchServerQuery = fetchServerQuery; exports.prefetchServerQuery = prefetchServerQuery;
@@ -2,7 +2,7 @@ import {
2
2
  getFarmMarkdownMirrorPath,
3
3
  isFarmMarkdownMirrorExposed,
4
4
  matchesFarmMarkdownRoutePattern
5
- } from "./chunk-ATXI6LGT.mjs";
5
+ } from "./chunk-ZUSJDQ2Q.mjs";
6
6
  import {
7
7
  FARM_INTERNAL_READ_HEADER
8
8
  } from "./chunk-MVL2RAJW.mjs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  readFarmI18nCatalogs
3
- } from "./chunk-FV45CKBC.mjs";
3
+ } from "./chunk-QCFBDFRS.mjs";
4
4
  import {
5
5
  resolveFarmLocaleRequest
6
- } from "./chunk-IXUY2F5U.mjs";
6
+ } from "./chunk-GCXWJJKH.mjs";
7
7
  import {
8
8
  _setFarmI18nSnapshotResolver
9
9
  } from "./chunk-C4NCTZLM.mjs";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  parseRequestCookieHeader
3
- } from "./chunk-5TISYEQF.mjs";
3
+ } from "./chunk-JM5XPKWH.mjs";
4
4
  import {
5
5
  getCurrentRequest
6
- } from "./chunk-BSPQVJ4A.mjs";
6
+ } from "./chunk-FDR64H6B.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "./chunk-LPEX4YW6.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-TVGP4BBZ.mjs";
16
16
  import {
17
17
  farmAcceptQuality
18
- } from "./chunk-ATXI6LGT.mjs";
18
+ } from "./chunk-ZUSJDQ2Q.mjs";
19
19
  import {
20
20
  matchesFarmIfNoneMatch
21
21
  } from "./chunk-XF7Q24PF.mjs";
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var version = "0.1.30";
2
+ var version = "0.1.34";
3
3
 
4
4
  // src/version.ts
5
5
  var FARM_VERSION = version;