@farm.js/core 0.1.0-beta.96 → 0.1.0-beta.97

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 (311) hide show
  1. package/dist/after.cjs +1 -1
  2. package/dist/after.mjs +1 -1
  3. package/dist/agent-runtime.d.mts +3 -2
  4. package/dist/agent-runtime.d.ts +3 -2
  5. package/dist/api/route-manager.cjs +43 -4
  6. package/dist/api/route-manager.d.mts +4 -3
  7. package/dist/api/route-manager.d.ts +4 -3
  8. package/dist/api/route-manager.mjs +6 -6
  9. package/dist/api/runtime.cjs +43 -4
  10. package/dist/api/runtime.d.mts +1 -1
  11. package/dist/api/runtime.d.ts +1 -1
  12. package/dist/api/runtime.mjs +4 -4
  13. package/dist/api.cjs +239 -70
  14. package/dist/api.d.mts +7 -6
  15. package/dist/api.d.ts +7 -6
  16. package/dist/api.mjs +17 -11
  17. package/dist/{app-CIIEvA4r.d.ts → app-CIOx3LvY.d.ts} +4 -4
  18. package/dist/{app-O4AEC1OH.d.mts → app-DBd6437H.d.mts} +4 -4
  19. package/dist/app-markdown.d.mts +4 -3
  20. package/dist/app-markdown.d.ts +4 -3
  21. package/dist/cache.cjs +42 -4
  22. package/dist/cache.d.mts +68 -1
  23. package/dist/cache.d.ts +68 -1
  24. package/dist/cache.mjs +3 -3
  25. package/dist/{chunk-AXVJCMVF.mjs → chunk-2HDOV47R.mjs} +3 -3
  26. package/dist/chunk-2HDOV47R.mjs.map +1 -0
  27. package/dist/{chunk-RBRLLZL5.mjs → chunk-34IAPZBG.mjs} +16 -3
  28. package/dist/chunk-34IAPZBG.mjs.map +1 -0
  29. package/dist/{chunk-VV24CC42.mjs → chunk-35NPLKQJ.mjs} +2 -2
  30. package/dist/{chunk-MM46HTX6.mjs → chunk-3TWQERDE.mjs} +4 -3
  31. package/dist/chunk-3TWQERDE.mjs.map +1 -0
  32. package/dist/{chunk-RWYRFCLG.mjs → chunk-4X57GXQA.mjs} +2 -2
  33. package/dist/{chunk-3I55IGXU.mjs → chunk-52BR7LTX.mjs} +14 -15
  34. package/dist/chunk-52BR7LTX.mjs.map +1 -0
  35. package/dist/{chunk-RAGSHKDC.mjs → chunk-6EJHNHH4.mjs} +38 -3
  36. package/dist/chunk-6EJHNHH4.mjs.map +1 -0
  37. package/dist/{chunk-ZFNK77WN.mjs → chunk-6JNGOC37.mjs} +2 -2
  38. package/dist/{after.cjs.map → chunk-6JNGOC37.mjs.map} +1 -1
  39. package/dist/{chunk-MOW47IF5.mjs → chunk-6UYVU46O.mjs} +2 -2
  40. package/dist/{chunk-7MABZJIM.mjs → chunk-7PYVLJ4J.mjs} +1 -1
  41. package/dist/chunk-7PYVLJ4J.mjs.map +1 -0
  42. package/dist/{chunk-54XSGLKT.mjs → chunk-D7F7YZ7L.mjs} +93 -67
  43. package/dist/chunk-D7F7YZ7L.mjs.map +1 -0
  44. package/dist/{chunk-SCFX4UTD.mjs → chunk-EHTUKVSW.mjs} +1 -1
  45. package/dist/chunk-EHTUKVSW.mjs.map +1 -0
  46. package/dist/{chunk-LZTGDH3H.mjs → chunk-EPDIF432.mjs} +424 -10
  47. package/dist/chunk-EPDIF432.mjs.map +1 -0
  48. package/dist/{chunk-GZHKWHCH.mjs → chunk-FP5Q67FO.mjs} +167 -96
  49. package/dist/chunk-FP5Q67FO.mjs.map +1 -0
  50. package/dist/{chunk-HHZAOTQD.mjs → chunk-GJ7W6LNK.mjs} +7 -6
  51. package/dist/chunk-GJ7W6LNK.mjs.map +1 -0
  52. package/dist/{chunk-RLGUZ3HS.mjs → chunk-I3OOUWO5.mjs} +3 -3
  53. package/dist/{chunk-LKKMI7JG.mjs → chunk-IZBX2TEU.mjs} +153 -68
  54. package/dist/chunk-IZBX2TEU.mjs.map +1 -0
  55. package/dist/{chunk-74QPONAN.mjs → chunk-J3MPQ4MQ.mjs} +2 -2
  56. package/dist/{chunk-74QPONAN.mjs.map → chunk-J3MPQ4MQ.mjs.map} +1 -1
  57. package/dist/{chunk-ODJGAWDH.mjs → chunk-JV7JUD7Q.mjs} +4 -4
  58. package/dist/{chunk-Q3OX763A.mjs → chunk-LXDASSTE.mjs} +2 -2
  59. package/dist/{chunk-ZRBCBOEX.mjs → chunk-N2FY2QZ7.mjs} +28 -3
  60. package/dist/chunk-N2FY2QZ7.mjs.map +1 -0
  61. package/dist/{chunk-MRVJCLYQ.mjs → chunk-PSQ7N4XP.mjs} +4 -2
  62. package/dist/chunk-PSQ7N4XP.mjs.map +1 -0
  63. package/dist/{chunk-HVG3HLQZ.mjs → chunk-Q7WGOOAI.mjs} +3 -3
  64. package/dist/{chunk-WTYAPO5I.mjs → chunk-RCNWMEBT.mjs} +3 -2
  65. package/dist/{chunk-WTYAPO5I.mjs.map → chunk-RCNWMEBT.mjs.map} +1 -1
  66. package/dist/{chunk-3INDBMUU.mjs → chunk-TGDIACZT.mjs} +2 -2
  67. package/dist/{chunk-WB75GIX2.mjs → chunk-TQTB33JS.mjs} +14 -3
  68. package/dist/chunk-TQTB33JS.mjs.map +1 -0
  69. package/dist/{chunk-WMAYETRD.mjs → chunk-TT3E2JOF.mjs} +3 -3
  70. package/dist/{chunk-FVAM43KI.mjs → chunk-UMUWR5XA.mjs} +2 -2
  71. package/dist/{chunk-VOUJW4FL.mjs → chunk-WD2EBM3I.mjs} +70 -15
  72. package/dist/chunk-WD2EBM3I.mjs.map +1 -0
  73. package/dist/{chunk-ZPG6SNHH.mjs → chunk-WMJGA32P.mjs} +47 -5
  74. package/dist/chunk-WMJGA32P.mjs.map +1 -0
  75. package/dist/{chunk-TKQCJMY7.mjs → chunk-X4SFHKFH.mjs} +7 -4
  76. package/dist/{chunk-TKQCJMY7.mjs.map → chunk-X4SFHKFH.mjs.map} +1 -1
  77. package/dist/{chunk-Q7GPJZCO.mjs → chunk-YIBV77KZ.mjs} +26 -7
  78. package/dist/chunk-YIBV77KZ.mjs.map +1 -0
  79. package/dist/client/lifecycle.mjs +2 -2
  80. package/dist/{client-mcMC334J.d.mts → client-DWoLZ3QU.d.mts} +52 -5
  81. package/dist/{client-d5ONQ-Pd.d.ts → client-DuQuQC1h.d.ts} +52 -5
  82. package/dist/client-cache-BMxuFqwH.d.ts +18 -0
  83. package/dist/client-cache-CCK-fCe0.d.mts +18 -0
  84. package/dist/{client-plugins-BvClItiL.d.mts → client-plugins-B6-07YmP.d.mts} +52 -99
  85. package/dist/{client-plugins-B9Sq-iMg.d.ts → client-plugins-By6MVUX-.d.ts} +52 -99
  86. package/dist/client-plugins.cjs +1 -1
  87. package/dist/client-plugins.d.mts +3 -2
  88. package/dist/client-plugins.d.ts +3 -2
  89. package/dist/client-plugins.mjs +2 -2
  90. package/dist/client.cjs +757 -104
  91. package/dist/client.d.mts +124 -16
  92. package/dist/client.d.ts +124 -16
  93. package/dist/client.mjs +28 -14
  94. package/dist/config.d.mts +3 -2
  95. package/dist/config.d.ts +3 -2
  96. package/dist/{devtools-S52RRRMN.mjs → devtools-XWZX6CCL.mjs} +5 -5
  97. package/dist/{devtools-client-EOVDBPOI.mjs → devtools-client-Z7QQA3Q2.mjs} +2 -2
  98. package/dist/{devtools-ui-NJKFORTG.mjs → devtools-ui-2HG5M4EL.mjs} +3 -1
  99. package/dist/devtools-ui-2HG5M4EL.mjs.map +1 -0
  100. package/dist/docs.cjs +24 -5
  101. package/dist/docs.mjs +5 -5
  102. package/dist/i18n/server.cjs +13 -2
  103. package/dist/i18n/server.d.mts +2 -2
  104. package/dist/i18n/server.d.ts +2 -2
  105. package/dist/i18n/server.mjs +1 -1
  106. package/dist/index.cjs +1578 -772
  107. package/dist/index.d.mts +28 -20
  108. package/dist/index.d.ts +28 -20
  109. package/dist/index.mjs +53 -33
  110. package/dist/index.mjs.map +1 -1
  111. package/dist/integration-api-BT024nuJ.d.mts +97 -0
  112. package/dist/integration-api-BT024nuJ.d.ts +97 -0
  113. package/dist/integrations.d.mts +3 -2
  114. package/dist/integrations.d.ts +3 -2
  115. package/dist/internal/build-runtime.cjs +710 -532
  116. package/dist/internal/build-runtime.d.mts +5 -4
  117. package/dist/internal/build-runtime.d.ts +5 -4
  118. package/dist/internal/build-runtime.mjs +15 -15
  119. package/dist/internal/client-runtime.cjs +1 -1
  120. package/dist/internal/client-runtime.mjs +2 -2
  121. package/dist/internal/config-runtime.cjs +4 -1
  122. package/dist/internal/config-runtime.d.mts +4 -3
  123. package/dist/internal/config-runtime.d.ts +4 -3
  124. package/dist/internal/config-runtime.mjs +4 -4
  125. package/dist/internal/product-telemetry-runtime.cjs +1 -1
  126. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  127. package/dist/internal/production-runtime.cjs +29 -3
  128. package/dist/internal/production-runtime.d.mts +8 -7
  129. package/dist/internal/production-runtime.d.ts +8 -7
  130. package/dist/internal/production-runtime.mjs +5 -5
  131. package/dist/{metadata-route-yV4U6X8h.d.ts → metadata-route-8_V3UonT.d.ts} +1 -1
  132. package/dist/{metadata-route-p4K1l92V.d.mts → metadata-route-CWP_HjGU.d.mts} +1 -1
  133. package/dist/middleware.cjs +28 -2
  134. package/dist/middleware.d.mts +5 -4
  135. package/dist/middleware.d.ts +5 -4
  136. package/dist/middleware.mjs +4 -4
  137. package/dist/navigation.cjs +3 -1
  138. package/dist/navigation.mjs +3 -3
  139. package/dist/observability.cjs +27 -2
  140. package/dist/observability.mjs +1 -1
  141. package/dist/plugin.cjs +474 -334
  142. package/dist/plugin.d.mts +3 -2
  143. package/dist/plugin.d.ts +3 -2
  144. package/dist/plugin.mjs +12 -12
  145. package/dist/{production-runtime-IkB0Qj4i.d.mts → production-runtime-BGRH1dKG.d.mts} +1 -1
  146. package/dist/{production-runtime-0JTch4_d.d.ts → production-runtime-CdmzsDax.d.ts} +1 -1
  147. package/dist/query/client.cjs +11 -3
  148. package/dist/query/client.mjs +12 -4
  149. package/dist/query/client.mjs.map +1 -1
  150. package/dist/{render-plan-Dc8CjNI7.d.ts → render-plan-0GeHiGVZ.d.ts} +1 -1
  151. package/dist/{render-plan-CU31j-Jk.d.mts → render-plan-DLxJYAA5.d.mts} +1 -1
  152. package/dist/renderer-client.cjs +140 -26
  153. package/dist/renderer-client.d.mts +7 -6
  154. package/dist/renderer-client.d.ts +7 -6
  155. package/dist/renderer-client.mjs +16 -19
  156. package/dist/renderer-client.mjs.map +1 -1
  157. package/dist/{request-BXa1KY8i.d.mts → request-BCNXSXLh.d.mts} +1 -1
  158. package/dist/{request-CUUBujZt.d.ts → request-BstWbZ6O.d.ts} +1 -1
  159. package/dist/request.d.mts +4 -3
  160. package/dist/request.d.ts +4 -3
  161. package/dist/{route-Y8lfz1wF.d.ts → route-4pd-EVtw.d.ts} +45 -50
  162. package/dist/{route-Cq3aObmj.d.mts → route-CvEr4Uc9.d.mts} +45 -50
  163. package/dist/routes.cjs +27 -2
  164. package/dist/routes.d.mts +3 -2
  165. package/dist/routes.d.ts +3 -2
  166. package/dist/routes.mjs +4 -4
  167. package/dist/{runtime-j1S3sDTh.d.ts → runtime-BgDQzBiu.d.ts} +1 -0
  168. package/dist/{runtime-DDwvDtS4.d.mts → runtime-CV2UCV-5.d.mts} +1 -0
  169. package/dist/server-action-security.mjs +2 -2
  170. package/dist/server-fn-client.cjs +34 -2
  171. package/dist/server-fn-client.d.mts +6 -0
  172. package/dist/server-fn-client.d.ts +6 -0
  173. package/dist/server-fn-client.mjs +1 -1
  174. package/dist/server-fn.cjs +42 -4
  175. package/dist/server-fn.mjs +5 -5
  176. package/dist/server-plugins.d.mts +4 -3
  177. package/dist/server-plugins.d.ts +4 -3
  178. package/dist/server-query-client.cjs +146 -27
  179. package/dist/server-query-client.d.mts +3 -3
  180. package/dist/server-query-client.d.ts +3 -3
  181. package/dist/server-query-client.mjs +7 -7
  182. package/dist/{server-query-runtime-3zAj77yv.d.ts → server-query-runtime-DXRNhX_3.d.ts} +2 -0
  183. package/dist/{server-query-runtime-B50KAcj5.d.mts → server-query-runtime-aP52iuL5.d.mts} +2 -0
  184. package/dist/server-query.cjs +44 -5
  185. package/dist/server-query.d.mts +4 -0
  186. package/dist/server-query.d.ts +4 -0
  187. package/dist/server-query.mjs +7 -7
  188. package/dist/server.cjs +499 -355
  189. package/dist/server.d.mts +11 -10
  190. package/dist/server.d.ts +11 -10
  191. package/dist/server.mjs +16 -16
  192. package/dist/{spa-router-CyLkwst6.d.mts → spa-router-BeyAVSc6.d.mts} +1 -1
  193. package/dist/{spa-router-BkqGXaV_.d.ts → spa-router-COgu4txb.d.ts} +1 -1
  194. package/dist/testing.cjs +27 -2
  195. package/dist/testing.d.mts +3 -2
  196. package/dist/testing.d.ts +3 -2
  197. package/dist/testing.mjs +8 -8
  198. package/dist/{utils-NKR6SoNv.d.mts → utils-DL2VwDQl.d.mts} +1 -1
  199. package/dist/{utils-B2OHrb9F.d.ts → utils-DkU2c_1B.d.ts} +1 -1
  200. package/dist/version.cjs +1 -1
  201. package/dist/version.mjs +1 -1
  202. package/dist/vite.cjs +482 -338
  203. package/dist/vite.d.mts +3 -2
  204. package/dist/vite.d.ts +3 -2
  205. package/dist/vite.mjs +16 -12
  206. package/package.json +17 -17
  207. package/types/client.d.ts +87 -1
  208. package/dist/agent-runtime.cjs.map +0 -1
  209. package/dist/api/route-manager.cjs.map +0 -1
  210. package/dist/api/runtime.cjs.map +0 -1
  211. package/dist/api.cjs.map +0 -1
  212. package/dist/app-markdown.cjs.map +0 -1
  213. package/dist/cache.cjs.map +0 -1
  214. package/dist/chunk-3I55IGXU.mjs.map +0 -1
  215. package/dist/chunk-54XSGLKT.mjs.map +0 -1
  216. package/dist/chunk-7MABZJIM.mjs.map +0 -1
  217. package/dist/chunk-AXVJCMVF.mjs.map +0 -1
  218. package/dist/chunk-GZHKWHCH.mjs.map +0 -1
  219. package/dist/chunk-HHZAOTQD.mjs.map +0 -1
  220. package/dist/chunk-LKKMI7JG.mjs.map +0 -1
  221. package/dist/chunk-LZTGDH3H.mjs.map +0 -1
  222. package/dist/chunk-MM46HTX6.mjs.map +0 -1
  223. package/dist/chunk-MRVJCLYQ.mjs.map +0 -1
  224. package/dist/chunk-Q7GPJZCO.mjs.map +0 -1
  225. package/dist/chunk-RAGSHKDC.mjs.map +0 -1
  226. package/dist/chunk-RBRLLZL5.mjs.map +0 -1
  227. package/dist/chunk-SCFX4UTD.mjs.map +0 -1
  228. package/dist/chunk-VOUJW4FL.mjs.map +0 -1
  229. package/dist/chunk-WB75GIX2.mjs.map +0 -1
  230. package/dist/chunk-ZFNK77WN.mjs.map +0 -1
  231. package/dist/chunk-ZPG6SNHH.mjs.map +0 -1
  232. package/dist/chunk-ZRBCBOEX.mjs.map +0 -1
  233. package/dist/client/lifecycle.cjs.map +0 -1
  234. package/dist/client-cache-CopR_MaI.d.mts +0 -6
  235. package/dist/client-cache-Djy_TlE8.d.ts +0 -6
  236. package/dist/client-plugins.cjs.map +0 -1
  237. package/dist/client.cjs.map +0 -1
  238. package/dist/config.cjs.map +0 -1
  239. package/dist/cron.cjs.map +0 -1
  240. package/dist/deferred.cjs.map +0 -1
  241. package/dist/deployment.cjs.map +0 -1
  242. package/dist/devtools-ui-NJKFORTG.mjs.map +0 -1
  243. package/dist/docs.cjs.map +0 -1
  244. package/dist/env-types.cjs.map +0 -1
  245. package/dist/env.cjs.map +0 -1
  246. package/dist/environment/vite.cjs.map +0 -1
  247. package/dist/environment.cjs.map +0 -1
  248. package/dist/font.cjs.map +0 -1
  249. package/dist/headers.cjs.map +0 -1
  250. package/dist/i18n/client.cjs.map +0 -1
  251. package/dist/i18n/index.cjs.map +0 -1
  252. package/dist/i18n/server.cjs.map +0 -1
  253. package/dist/image/server.cjs.map +0 -1
  254. package/dist/image/sharp.cjs.map +0 -1
  255. package/dist/image.cjs.map +0 -1
  256. package/dist/index.cjs.map +0 -1
  257. package/dist/instrumentation.cjs.map +0 -1
  258. package/dist/integrations.cjs.map +0 -1
  259. package/dist/internal/build-runtime.cjs.map +0 -1
  260. package/dist/internal/client-runtime.cjs.map +0 -1
  261. package/dist/internal/config-runtime.cjs.map +0 -1
  262. package/dist/internal/isolated-boundary.cjs.map +0 -1
  263. package/dist/internal/metadata-image-runtime.cjs.map +0 -1
  264. package/dist/internal/product-telemetry-runtime.cjs.map +0 -1
  265. package/dist/internal/production-node-env.cjs.map +0 -1
  266. package/dist/internal/production-runtime.cjs.map +0 -1
  267. package/dist/markdown.cjs.map +0 -1
  268. package/dist/middleware.cjs.map +0 -1
  269. package/dist/navigation.cjs.map +0 -1
  270. package/dist/observability.cjs.map +0 -1
  271. package/dist/plugin.cjs.map +0 -1
  272. package/dist/query/client.cjs.map +0 -1
  273. package/dist/query/index.cjs.map +0 -1
  274. package/dist/query/parsers.cjs.map +0 -1
  275. package/dist/query/server.cjs.map +0 -1
  276. package/dist/renderer/react/client.cjs.map +0 -1
  277. package/dist/renderer/react/server.cjs.map +0 -1
  278. package/dist/renderer/react/vite.cjs.map +0 -1
  279. package/dist/renderer-client.cjs.map +0 -1
  280. package/dist/renderer.cjs.map +0 -1
  281. package/dist/request.cjs.map +0 -1
  282. package/dist/router.cjs.map +0 -1
  283. package/dist/routes.cjs.map +0 -1
  284. package/dist/server-action-security.cjs.map +0 -1
  285. package/dist/server-fn-client.cjs.map +0 -1
  286. package/dist/server-fn.cjs.map +0 -1
  287. package/dist/server-plugins.cjs.map +0 -1
  288. package/dist/server-query-client.cjs.map +0 -1
  289. package/dist/server-query.cjs.map +0 -1
  290. package/dist/server.cjs.map +0 -1
  291. package/dist/storage.cjs.map +0 -1
  292. package/dist/testing.cjs.map +0 -1
  293. package/dist/theme/client.cjs.map +0 -1
  294. package/dist/theme/index.cjs.map +0 -1
  295. package/dist/theme/runtime.cjs.map +0 -1
  296. package/dist/theme/server.cjs.map +0 -1
  297. package/dist/version.cjs.map +0 -1
  298. package/dist/vite.cjs.map +0 -1
  299. package/dist/workflows.cjs.map +0 -1
  300. /package/dist/{chunk-VV24CC42.mjs.map → chunk-35NPLKQJ.mjs.map} +0 -0
  301. /package/dist/{chunk-RWYRFCLG.mjs.map → chunk-4X57GXQA.mjs.map} +0 -0
  302. /package/dist/{chunk-MOW47IF5.mjs.map → chunk-6UYVU46O.mjs.map} +0 -0
  303. /package/dist/{chunk-RLGUZ3HS.mjs.map → chunk-I3OOUWO5.mjs.map} +0 -0
  304. /package/dist/{chunk-ODJGAWDH.mjs.map → chunk-JV7JUD7Q.mjs.map} +0 -0
  305. /package/dist/{chunk-Q3OX763A.mjs.map → chunk-LXDASSTE.mjs.map} +0 -0
  306. /package/dist/{chunk-HVG3HLQZ.mjs.map → chunk-Q7WGOOAI.mjs.map} +0 -0
  307. /package/dist/{chunk-3INDBMUU.mjs.map → chunk-TGDIACZT.mjs.map} +0 -0
  308. /package/dist/{chunk-WMAYETRD.mjs.map → chunk-TT3E2JOF.mjs.map} +0 -0
  309. /package/dist/{chunk-FVAM43KI.mjs.map → chunk-UMUWR5XA.mjs.map} +0 -0
  310. /package/dist/{devtools-S52RRRMN.mjs.map → devtools-XWZX6CCL.mjs.map} +0 -0
  311. /package/dist/{devtools-client-EOVDBPOI.mjs.map → devtools-client-Z7QQA3Q2.mjs.map} +0 -0
@@ -1,8 +1,8 @@
1
- import { bz as RedirectConfig, Y as FarmRequest, Z as FarmResponse, aX as FarmPluginContext, a as FarmPlugin, bA as HeaderConfig, bB as RewriteConfig } from './client-plugins-BvClItiL.mjs';
2
- export { aZ as FarmPluginLifecycle, a_ as FarmRequestPluginContext, a$ as FarmRequestStore } from './client-plugins-BvClItiL.mjs';
1
+ import { bx as RedirectConfig, Y as FarmRequest, Z as FarmResponse, aV as FarmPluginContext, a as FarmPlugin, by as HeaderConfig, bz as RewriteConfig } from './client-plugins-B6-07YmP.mjs';
2
+ export { aX as FarmPluginLifecycle, aY as FarmRequestPluginContext, aZ as FarmRequestStore } from './client-plugins-B6-07YmP.mjs';
3
3
  import { R as ResolvedFarmI18nConfig } from './types-CnH8DOqo.mjs';
4
4
  import './lifecycle-De0vQG45.mjs';
5
- import './route-Cq3aObmj.mjs';
5
+ import './route-CvEr4Uc9.mjs';
6
6
  import './cache.mjs';
7
7
  import './renderer.mjs';
8
8
  import 'http';
@@ -10,6 +10,7 @@ import './types-Cc8l9IqS.mjs';
10
10
  import 'db0';
11
11
  import 'unstorage';
12
12
  import 'react';
13
+ import './integration-api-BT024nuJ.mjs';
13
14
  import '@farming-labs/orm';
14
15
  import './types-CKwggz9n.mjs';
15
16
  import '@farming-labs/docs';
@@ -1,8 +1,8 @@
1
- import { bz as RedirectConfig, Y as FarmRequest, Z as FarmResponse, aX as FarmPluginContext, a as FarmPlugin, bA as HeaderConfig, bB as RewriteConfig } from './client-plugins-B9Sq-iMg.js';
2
- export { aZ as FarmPluginLifecycle, a_ as FarmRequestPluginContext, a$ as FarmRequestStore } from './client-plugins-B9Sq-iMg.js';
1
+ import { bx as RedirectConfig, Y as FarmRequest, Z as FarmResponse, aV as FarmPluginContext, a as FarmPlugin, by as HeaderConfig, bz as RewriteConfig } from './client-plugins-By6MVUX-.js';
2
+ export { aX as FarmPluginLifecycle, aY as FarmRequestPluginContext, aZ as FarmRequestStore } from './client-plugins-By6MVUX-.js';
3
3
  import { R as ResolvedFarmI18nConfig } from './types-CnH8DOqo.js';
4
4
  import './lifecycle-De0vQG45.js';
5
- import './route-Y8lfz1wF.js';
5
+ import './route-4pd-EVtw.js';
6
6
  import './cache.js';
7
7
  import './renderer.js';
8
8
  import 'http';
@@ -10,6 +10,7 @@ import './types-Cc8l9IqS.js';
10
10
  import 'db0';
11
11
  import 'unstorage';
12
12
  import 'react';
13
+ import './integration-api-BT024nuJ.js';
13
14
  import '@farming-labs/orm';
14
15
  import './types-CKwggz9n.js';
15
16
  import '@farming-labs/docs';
@@ -101,7 +101,13 @@ function recordFarmEventTrace(event) {
101
101
  activeSpan.addEvent(event.type, toEventAttributes(event), event.timestamp);
102
102
  }
103
103
  const error = event.type === "request.error" ? void 0 : getEventError(event);
104
- if (error !== void 0) recordSpanError(activeSpan, error);
104
+ if (error !== void 0) {
105
+ if (event.type === "render.error") {
106
+ recordSpanException(activeSpan, error);
107
+ } else {
108
+ recordSpanError(activeSpan, error);
109
+ }
110
+ }
105
111
  }
106
112
  const completedTraceContext = recordCompletedEventSpan(event, activeContext);
107
113
  return traceContext ?? completedTraceContext;
@@ -198,12 +204,26 @@ function getCompletedSpanDescriptor(event) {
198
204
  }
199
205
  }
200
206
  __name(getCompletedSpanDescriptor, "getCompletedSpanDescriptor");
207
+ function hashFarmCacheKey(value) {
208
+ let hash = 2166136261;
209
+ for (let index = 0; index < value.length; index++) {
210
+ hash ^= value.charCodeAt(index);
211
+ hash = Math.imul(hash, 16777619);
212
+ }
213
+ return (hash >>> 0).toString(16).padStart(8, "0");
214
+ }
215
+ __name(hashFarmCacheKey, "hashFarmCacheKey");
201
216
  function toEventAttributes(event) {
202
217
  const attributes = {};
218
+ const redactKey = typeof event.type === "string" && event.type.startsWith("cache.");
203
219
  for (const [key, value] of Object.entries(event)) {
204
220
  if (key === "timestamp" || key === "level" || key === "error" || key === "traceId" || key === "spanId" || key === "traceSampled" || value === void 0) {
205
221
  continue;
206
222
  }
223
+ if (redactKey && key === "key" && typeof value === "string") {
224
+ attributes["farm.key_hash"] = hashFarmCacheKey(value);
225
+ continue;
226
+ }
207
227
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
208
228
  attributes[`farm.${key}`] = value;
209
229
  } else if (Array.isArray(value)) {
@@ -223,9 +243,14 @@ function getEventError(event) {
223
243
  return "error" in event ? event.error : void 0;
224
244
  }
225
245
  __name(getEventError, "getEventError");
226
- function recordSpanError(span, error) {
246
+ function recordSpanException(span, error) {
227
247
  const normalized = error instanceof Error ? error : new Error(String(error));
228
248
  span.recordException(normalized);
249
+ return normalized;
250
+ }
251
+ __name(recordSpanException, "recordSpanException");
252
+ function recordSpanError(span, error) {
253
+ const normalized = recordSpanException(span, error);
229
254
  span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: normalized.message });
230
255
  }
231
256
  __name(recordSpanError, "recordSpanError");
@@ -1077,6 +1102,7 @@ function subscribeWeakCache(reference) {
1077
1102
  return dispose;
1078
1103
  }
1079
1104
  __name(subscribeWeakCache, "subscribeWeakCache");
1105
+ var DEFAULT_GC_SWEEP_INTERVAL_MS = 3e4;
1080
1106
  var _FarmClientDataCache = class _FarmClientDataCache {
1081
1107
  constructor(options = {}) {
1082
1108
  this.entries = /* @__PURE__ */ new Map();
@@ -1084,6 +1110,7 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1084
1110
  this.invalidatedAt = /* @__PURE__ */ new Map();
1085
1111
  this.listeners = /* @__PURE__ */ new Map();
1086
1112
  this.inflight = /* @__PURE__ */ new Map();
1113
+ this.gcSweepIntervalMs = options.gcSweepIntervalMs ?? DEFAULT_GC_SWEEP_INTERVAL_MS;
1087
1114
  if (options.subscribeToInvalidation !== false) {
1088
1115
  if (typeof WeakRef === "function") {
1089
1116
  const reference = new WeakRef(this);
@@ -1100,6 +1127,10 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1100
1127
  get size() {
1101
1128
  return this.entries.size;
1102
1129
  }
1130
+ /** @internal Attach or detach the persistence engine's observation sink. */
1131
+ attachPersistence(sink) {
1132
+ this.persistence = sink;
1133
+ }
1103
1134
  resolveKey(key) {
1104
1135
  let resolved = key;
1105
1136
  const seen = /* @__PURE__ */ new Set();
@@ -1115,6 +1146,7 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1115
1146
  if (!entry) return void 0;
1116
1147
  if (entry.gcAt !== void 0 && now >= entry.gcAt) {
1117
1148
  this.entries.delete(resolved);
1149
+ this.persistence?.onDelete(resolved);
1118
1150
  this.emit(resolved);
1119
1151
  return void 0;
1120
1152
  }
@@ -1128,6 +1160,8 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1128
1160
  this.invalidatedAt.delete(resolved);
1129
1161
  }
1130
1162
  this.entries.set(resolved, nextEntry);
1163
+ if (nextEntry.gcAt !== void 0) this.scheduleGcSweep();
1164
+ this.persistence?.onSet(resolved, nextEntry);
1131
1165
  this.emit(resolved);
1132
1166
  return this;
1133
1167
  }
@@ -1135,6 +1169,7 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1135
1169
  const resolved = this.resolveKey(key);
1136
1170
  const deleted = this.entries.delete(resolved);
1137
1171
  this.inflight.delete(resolved);
1172
+ if (deleted) this.persistence?.onDelete(resolved);
1138
1173
  this.emit(resolved);
1139
1174
  return deleted;
1140
1175
  }
@@ -1144,11 +1179,16 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1144
1179
  this.aliases.clear();
1145
1180
  this.invalidatedAt.clear();
1146
1181
  this.inflight.clear();
1182
+ this.persistence?.onClear();
1147
1183
  for (const key of keys) this.emit(key);
1148
1184
  }
1149
1185
  dispose() {
1150
1186
  this.unsubscribeInvalidation?.();
1151
1187
  this.unsubscribeInvalidation = void 0;
1188
+ if (this.gcTimer !== void 0) {
1189
+ clearTimeout(this.gcTimer);
1190
+ this.gcTimer = void 0;
1191
+ }
1152
1192
  this.clear();
1153
1193
  }
1154
1194
  isStale(key, now = Date.now()) {
@@ -1177,8 +1217,9 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1177
1217
  const resolvedInvalidatedAt = this.invalidatedAt.get(resolved);
1178
1218
  if (aliasEntry && !this.entries.has(resolved)) {
1179
1219
  this.entries.set(resolved, aliasEntry);
1220
+ this.persistence?.onSet(resolved, aliasEntry);
1180
1221
  }
1181
- this.entries.delete(alias);
1222
+ if (this.entries.delete(alias)) this.persistence?.onDelete(alias);
1182
1223
  this.invalidatedAt.delete(alias);
1183
1224
  const invalidatedAt = [aliasInvalidatedAt, resolvedInvalidatedAt].reduce(
1184
1225
  (latest, value) => value === void 0 ? latest : latest === void 0 ? value : Math.max(latest, value),
@@ -1218,7 +1259,9 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1218
1259
  listeners.add(listener);
1219
1260
  return () => {
1220
1261
  listeners.delete(listener);
1221
- if (listeners.size === 0) this.listeners.delete(key);
1262
+ if (listeners.size === 0 && this.listeners.get(key) === listeners) {
1263
+ this.listeners.delete(key);
1264
+ }
1222
1265
  };
1223
1266
  }
1224
1267
  getInflight(key) {
@@ -1230,6 +1273,30 @@ var _FarmClientDataCache = class _FarmClientDataCache {
1230
1273
  deleteInflight(key) {
1231
1274
  this.inflight.delete(this.resolveKey(key));
1232
1275
  }
1276
+ scheduleGcSweep() {
1277
+ if (this.gcSweepIntervalMs === false || this.gcTimer !== void 0) return;
1278
+ const timer = setTimeout(() => {
1279
+ this.gcTimer = void 0;
1280
+ this.sweepExpiredEntries();
1281
+ }, this.gcSweepIntervalMs);
1282
+ timer.unref?.();
1283
+ this.gcTimer = timer;
1284
+ }
1285
+ sweepExpiredEntries(now = Date.now()) {
1286
+ const watched = /* @__PURE__ */ new Set();
1287
+ for (const key of this.listeners.keys()) watched.add(this.resolveKey(key));
1288
+ let remaining = false;
1289
+ for (const [key, entry] of this.entries) {
1290
+ if (entry.gcAt === void 0) continue;
1291
+ if (now < entry.gcAt || entry.fetching || this.inflight.has(key) || watched.has(key)) {
1292
+ remaining = true;
1293
+ continue;
1294
+ }
1295
+ this.entries.delete(key);
1296
+ this.persistence?.onDelete(key);
1297
+ }
1298
+ if (remaining) this.scheduleGcSweep();
1299
+ }
1233
1300
  emit(key, event) {
1234
1301
  this.notifyListeners(key, event);
1235
1302
  for (const [alias, target] of this.aliases) {
@@ -1254,6 +1321,21 @@ function getFarmClientDataCache() {
1254
1321
  }
1255
1322
  __name(getFarmClientDataCache, "getFarmClientDataCache");
1256
1323
 
1324
+ // src/client-revalidation.ts
1325
+ function attachRevalidationListeners(refresh, options = {}) {
1326
+ if (typeof window === "undefined") return () => {
1327
+ };
1328
+ const onFocus = options.refetchOnWindowFocus === false ? void 0 : refresh;
1329
+ const onOnline = options.refetchOnReconnect === false ? void 0 : refresh;
1330
+ if (onFocus) window.addEventListener("focus", onFocus);
1331
+ if (onOnline) window.addEventListener("online", onOnline);
1332
+ return () => {
1333
+ if (onFocus) window.removeEventListener("focus", onFocus);
1334
+ if (onOnline) window.removeEventListener("online", onOnline);
1335
+ };
1336
+ }
1337
+ __name(attachRevalidationListeners, "attachRevalidationListeners");
1338
+
1257
1339
  // src/server-query-protocol.ts
1258
1340
  var FARM_SERVER_QUERY_RESULT_VERSION = 1;
1259
1341
  function isFarmServerQueryResult(value) {
@@ -1270,9 +1352,30 @@ var serverQueryClientState = serverQueryClientGlobal[FARM_SERVER_QUERY_CLIENT_ST
1270
1352
  functionIds: /* @__PURE__ */ new WeakMap(),
1271
1353
  nextFunctionId: 0,
1272
1354
  active: [],
1273
- latestOwners: /* @__PURE__ */ new Map()
1355
+ latestOwners: /* @__PURE__ */ new Map(),
1356
+ owners: /* @__PURE__ */ new Set()
1274
1357
  });
1275
1358
  serverQueryClientState.latestOwners ?? (serverQueryClientState.latestOwners = /* @__PURE__ */ new Map());
1359
+ serverQueryClientState.owners ?? (serverQueryClientState.owners = /* @__PURE__ */ new Set());
1360
+ function isServerQueryOwnerSuperseded(owner, key) {
1361
+ const cache = getFarmClientDataCache();
1362
+ const resolved = cache.resolveKey(key);
1363
+ for (const superseded of owner.supersededKeys ?? []) {
1364
+ if (cache.resolveKey(superseded) === resolved) return true;
1365
+ }
1366
+ return false;
1367
+ }
1368
+ __name(isServerQueryOwnerSuperseded, "isServerQueryOwnerSuperseded");
1369
+ function claimServerQueryKey(owner, key) {
1370
+ if (isServerQueryOwnerSuperseded(owner, key)) return false;
1371
+ const resolved = getFarmClientDataCache().resolveKey(key);
1372
+ for (const older of serverQueryClientState.owners) {
1373
+ if (older === owner) break;
1374
+ older.supersededKeys.add(resolved);
1375
+ }
1376
+ return true;
1377
+ }
1378
+ __name(claimServerQueryKey, "claimServerQueryKey");
1276
1379
  var RAW_SERVER_QUERY_SYMBOL = /* @__PURE__ */ Symbol.for("farm.server-query");
1277
1380
  function assertNotRawServerQueryInBrowser(query) {
1278
1381
  if (typeof window === "undefined" || typeof document === "undefined") return;
@@ -1306,6 +1409,10 @@ function completeFarmServerQueryAction(invocation, value) {
1306
1409
  if (invocation.provisionalKey) {
1307
1410
  cache.alias(invocation.provisionalKey, metadata.key);
1308
1411
  }
1412
+ const owner = invocation.owner;
1413
+ if (owner && serverQueryClientState.owners.has(owner) && !claimServerQueryKey(owner, metadata.key)) {
1414
+ return value.data;
1415
+ }
1309
1416
  const invalidated = invocation.owner?.invalidations?.has(
1310
1417
  metadata.key
1311
1418
  );
@@ -1315,16 +1422,21 @@ function completeFarmServerQueryAction(invocation, value) {
1315
1422
  staleAt: invalidated ? 0 : metadata.staleTime === false ? Number.POSITIVE_INFINITY : metadata.updatedAt + metadata.staleTime,
1316
1423
  status: "success",
1317
1424
  error: null,
1318
- fetching: false
1425
+ fetching: false,
1426
+ persist: metadata.persist === true ? true : void 0
1319
1427
  });
1320
1428
  return value.data;
1321
1429
  }
1322
1430
  __name(completeFarmServerQueryAction, "completeFarmServerQueryAction");
1323
1431
  function shouldApplyFarmServerQueryActionResult(invocation) {
1324
1432
  if (!invocation.provisionalKey || !invocation.owner) return true;
1325
- return serverQueryClientState.latestOwners.get(invocation.provisionalKey) === invocation.owner;
1433
+ return isCurrentServerQueryOwner(invocation.provisionalKey, invocation.owner);
1326
1434
  }
1327
1435
  __name(shouldApplyFarmServerQueryActionResult, "shouldApplyFarmServerQueryActionResult");
1436
+ function isCurrentServerQueryOwner(provisionalKey, owner) {
1437
+ return serverQueryClientState.latestOwners.get(provisionalKey) === owner && !isServerQueryOwnerSuperseded(owner, provisionalKey);
1438
+ }
1439
+ __name(isCurrentServerQueryOwner, "isCurrentServerQueryOwner");
1328
1440
  function createServerQueryCallKey(query, input) {
1329
1441
  let id = serverQueryClientState.functionIds.get(query);
1330
1442
  if (!id) {
@@ -1340,12 +1452,14 @@ async function fetchServerQuery(query, input, options = {}) {
1340
1452
  const entry = cache.get(provisionalKey);
1341
1453
  const stale = cache.isStale(provisionalKey);
1342
1454
  const inflight = cache.getInflight(provisionalKey);
1343
- if (inflight && !options.force) return inflight;
1344
- if (!options.force && entry && !stale && entry.status !== "error") return entry.data;
1345
- if (!options.force && entry && stale && entry.status !== "pending" && entry.status !== "error" && (options.swr ?? true)) {
1346
- void executeServerQuery(query, input, provisionalKey, options).catch(() => void 0);
1455
+ if (!options.force && entry && stale && (entry.status !== "pending" || entry.updatedAt !== 0) && entry.status !== "error" && (options.swr ?? true)) {
1456
+ if (!inflight) {
1457
+ void executeServerQuery(query, input, provisionalKey, options).catch(() => void 0);
1458
+ }
1347
1459
  return entry.data;
1348
1460
  }
1461
+ if (inflight && !options.force) return inflight;
1462
+ if (!options.force && entry && !stale && entry.status !== "error") return entry.data;
1349
1463
  return executeServerQuery(query, input, provisionalKey, options);
1350
1464
  }
1351
1465
  __name(fetchServerQuery, "fetchServerQuery");
@@ -1358,8 +1472,13 @@ async function executeServerQuery(query, input, provisionalKey, options) {
1358
1472
  const cache = getFarmClientDataCache();
1359
1473
  const inflight = cache.getInflight(provisionalKey);
1360
1474
  if (inflight && !options.force) return inflight;
1361
- const owner = { invalidations: trackFarmClientCacheInvalidations(cache) };
1475
+ const owner = {
1476
+ invalidations: trackFarmClientCacheInvalidations(cache),
1477
+ supersededKeys: /* @__PURE__ */ new Set()
1478
+ };
1362
1479
  serverQueryClientState.latestOwners.set(provisionalKey, owner);
1480
+ serverQueryClientState.owners.add(owner);
1481
+ claimServerQueryKey(owner, provisionalKey);
1363
1482
  const previous = cache.get(provisionalKey);
1364
1483
  cache.set(provisionalKey, {
1365
1484
  data: previous?.data,
@@ -1384,7 +1503,7 @@ async function executeServerQuery(query, input, provisionalKey, options) {
1384
1503
  }
1385
1504
  const data = await pending;
1386
1505
  const transported = cache.get(provisionalKey);
1387
- if (serverQueryClientState.latestOwners.get(provisionalKey) === owner && (!transported || transported.fetching)) {
1506
+ if (isCurrentServerQueryOwner(provisionalKey, owner) && (!transported || transported.fetching)) {
1388
1507
  const updatedAt = Date.now();
1389
1508
  cache.set(provisionalKey, {
1390
1509
  data,
@@ -1398,7 +1517,7 @@ async function executeServerQuery(query, input, provisionalKey, options) {
1398
1517
  return data;
1399
1518
  } catch (cause) {
1400
1519
  const error = normalizeServerQueryError(cause);
1401
- if (serverQueryClientState.latestOwners.get(provisionalKey) === owner) {
1520
+ if (isCurrentServerQueryOwner(provisionalKey, owner)) {
1402
1521
  const current = cache.get(provisionalKey);
1403
1522
  cache.set(provisionalKey, {
1404
1523
  data: current?.data,
@@ -1413,8 +1532,10 @@ async function executeServerQuery(query, input, provisionalKey, options) {
1413
1532
  }
1414
1533
  throw error;
1415
1534
  } finally {
1416
- const invalidated = serverQueryClientState.latestOwners.get(provisionalKey) === owner && owner.invalidations.has(provisionalKey);
1535
+ const invalidated = isCurrentServerQueryOwner(provisionalKey, owner) && owner.invalidations.has(provisionalKey);
1417
1536
  owner.invalidations.dispose();
1537
+ serverQueryClientState.owners.delete(owner);
1538
+ owner.supersededKeys.clear();
1418
1539
  if (cache.getInflight(provisionalKey) === promise) {
1419
1540
  cache.deleteInflight(provisionalKey);
1420
1541
  }
@@ -1480,18 +1601,16 @@ function useServerQuery(query, input, options = {}) {
1480
1601
  }
1481
1602
  }, [cache, entry, key, options.enabled, run]);
1482
1603
  (0, import_react.useEffect)(() => {
1483
- if (options.enabled === false || typeof window === "undefined") return;
1484
- const refreshIfStale = /* @__PURE__ */ __name(() => {
1485
- if (cache.isStale(key)) void run().catch(() => void 0);
1486
- }, "refreshIfStale");
1487
- const onFocus = options.refetchOnWindowFocus === false ? void 0 : refreshIfStale;
1488
- const onOnline = options.refetchOnReconnect === false ? void 0 : refreshIfStale;
1489
- if (onFocus) window.addEventListener("focus", onFocus);
1490
- if (onOnline) window.addEventListener("online", onOnline);
1491
- return () => {
1492
- if (onFocus) window.removeEventListener("focus", onFocus);
1493
- if (onOnline) window.removeEventListener("online", onOnline);
1494
- };
1604
+ if (options.enabled === false) return;
1605
+ return attachRevalidationListeners(
1606
+ () => {
1607
+ if (cache.isStale(key)) void run().catch(() => void 0);
1608
+ },
1609
+ {
1610
+ refetchOnWindowFocus: options.refetchOnWindowFocus,
1611
+ refetchOnReconnect: options.refetchOnReconnect
1612
+ }
1613
+ );
1495
1614
  }, [cache, key, options.enabled, options.refetchOnReconnect, options.refetchOnWindowFocus, run]);
1496
1615
  const status = entry?.status ?? (entry ? "success" : "idle");
1497
1616
  const fetching = entry?.fetching ?? false;
@@ -1,7 +1,7 @@
1
- import { F as FarmClientCacheStatus } from './client-cache-CopR_MaI.mjs';
1
+ import { F as FarmClientCacheStatus } from './client-cache-CCK-fCe0.mjs';
2
2
  import { ServerQuery } from './server-query.mjs';
3
- import { S as ServerQueryFetchOptions } from './server-query-runtime-B50KAcj5.mjs';
4
- export { F as FarmServerQueryActionInvocation, b as beginFarmServerQueryAction, c as completeFarmServerQueryAction, f as fetchServerQuery, p as prefetchServerQuery, s as shouldApplyFarmServerQueryActionResult } from './server-query-runtime-B50KAcj5.mjs';
3
+ import { S as ServerQueryFetchOptions } from './server-query-runtime-aP52iuL5.mjs';
4
+ export { F as FarmServerQueryActionInvocation, b as beginFarmServerQueryAction, c as completeFarmServerQueryAction, f as fetchServerQuery, p as prefetchServerQuery, s as shouldApplyFarmServerQueryActionResult } from './server-query-runtime-aP52iuL5.mjs';
5
5
  import './cache.mjs';
6
6
  import './server-fn.mjs';
7
7
  import './server-fn-error-DDh14a0V.mjs';
@@ -1,7 +1,7 @@
1
- import { F as FarmClientCacheStatus } from './client-cache-Djy_TlE8.js';
1
+ import { F as FarmClientCacheStatus } from './client-cache-BMxuFqwH.js';
2
2
  import { ServerQuery } from './server-query.js';
3
- import { S as ServerQueryFetchOptions } from './server-query-runtime-3zAj77yv.js';
4
- export { F as FarmServerQueryActionInvocation, b as beginFarmServerQueryAction, c as completeFarmServerQueryAction, f as fetchServerQuery, p as prefetchServerQuery, s as shouldApplyFarmServerQueryActionResult } from './server-query-runtime-3zAj77yv.js';
3
+ import { S as ServerQueryFetchOptions } from './server-query-runtime-DXRNhX_3.js';
4
+ export { F as FarmServerQueryActionInvocation, b as beginFarmServerQueryAction, c as completeFarmServerQueryAction, f as fetchServerQuery, p as prefetchServerQuery, s as shouldApplyFarmServerQueryActionResult } from './server-query-runtime-DXRNhX_3.js';
5
5
  import './cache.js';
6
6
  import './server-fn.js';
7
7
  import './server-fn-error-DDh14a0V.js';
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import {
3
3
  useServerQuery
4
- } from "./chunk-3I55IGXU.mjs";
4
+ } from "./chunk-52BR7LTX.mjs";
5
5
  import {
6
6
  beginFarmServerQueryAction,
7
7
  completeFarmServerQueryAction,
8
8
  fetchServerQuery,
9
9
  prefetchServerQuery,
10
10
  shouldApplyFarmServerQueryActionResult
11
- } from "./chunk-VOUJW4FL.mjs";
12
- import "./chunk-ZPG6SNHH.mjs";
13
- import "./chunk-SCFX4UTD.mjs";
14
- import "./chunk-AXVJCMVF.mjs";
15
- import "./chunk-RBRLLZL5.mjs";
11
+ } from "./chunk-WD2EBM3I.mjs";
12
+ import "./chunk-WMJGA32P.mjs";
13
+ import "./chunk-EHTUKVSW.mjs";
14
+ import "./chunk-2HDOV47R.mjs";
15
+ import "./chunk-34IAPZBG.mjs";
16
16
  import "./chunk-WZ5QFROO.mjs";
17
- import "./chunk-ZRBCBOEX.mjs";
17
+ import "./chunk-N2FY2QZ7.mjs";
18
18
  import "./chunk-CGILA3WO.mjs";
19
19
  export {
20
20
  beginFarmServerQueryAction,
@@ -7,6 +7,8 @@ type FarmServerQueryResult<TData> = {
7
7
  key: string;
8
8
  staleTime: number | false;
9
9
  updatedAt: number;
10
+ /** Declared by the query; allows the client persistence adapter to store the entry. */
11
+ persist?: boolean;
10
12
  };
11
13
  data: TData;
12
14
  };
@@ -7,6 +7,8 @@ type FarmServerQueryResult<TData> = {
7
7
  key: string;
8
8
  staleTime: number | false;
9
9
  updatedAt: number;
10
+ /** Declared by the query; allows the client persistence adapter to store the entry. */
11
+ persist?: boolean;
10
12
  };
11
13
  data: TData;
12
14
  };
@@ -95,7 +95,13 @@ function recordFarmEventTrace(event) {
95
95
  activeSpan.addEvent(event.type, toEventAttributes(event), event.timestamp);
96
96
  }
97
97
  const error = event.type === "request.error" ? void 0 : getEventError(event);
98
- if (error !== void 0) recordSpanError(activeSpan, error);
98
+ if (error !== void 0) {
99
+ if (event.type === "render.error") {
100
+ recordSpanException(activeSpan, error);
101
+ } else {
102
+ recordSpanError(activeSpan, error);
103
+ }
104
+ }
99
105
  }
100
106
  const completedTraceContext = recordCompletedEventSpan(event, activeContext);
101
107
  return traceContext ?? completedTraceContext;
@@ -192,12 +198,26 @@ function getCompletedSpanDescriptor(event) {
192
198
  }
193
199
  }
194
200
  __name(getCompletedSpanDescriptor, "getCompletedSpanDescriptor");
201
+ function hashFarmCacheKey(value) {
202
+ let hash = 2166136261;
203
+ for (let index = 0; index < value.length; index++) {
204
+ hash ^= value.charCodeAt(index);
205
+ hash = Math.imul(hash, 16777619);
206
+ }
207
+ return (hash >>> 0).toString(16).padStart(8, "0");
208
+ }
209
+ __name(hashFarmCacheKey, "hashFarmCacheKey");
195
210
  function toEventAttributes(event) {
196
211
  const attributes = {};
212
+ const redactKey = typeof event.type === "string" && event.type.startsWith("cache.");
197
213
  for (const [key, value] of Object.entries(event)) {
198
214
  if (key === "timestamp" || key === "level" || key === "error" || key === "traceId" || key === "spanId" || key === "traceSampled" || value === void 0) {
199
215
  continue;
200
216
  }
217
+ if (redactKey && key === "key" && typeof value === "string") {
218
+ attributes["farm.key_hash"] = hashFarmCacheKey(value);
219
+ continue;
220
+ }
201
221
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
202
222
  attributes[`farm.${key}`] = value;
203
223
  } else if (Array.isArray(value)) {
@@ -217,9 +237,14 @@ function getEventError(event) {
217
237
  return "error" in event ? event.error : void 0;
218
238
  }
219
239
  __name(getEventError, "getEventError");
220
- function recordSpanError(span, error) {
240
+ function recordSpanException(span, error) {
221
241
  const normalized = error instanceof Error ? error : new Error(String(error));
222
242
  span.recordException(normalized);
243
+ return normalized;
244
+ }
245
+ __name(recordSpanException, "recordSpanException");
246
+ function recordSpanError(span, error) {
247
+ const normalized = recordSpanException(span, error);
223
248
  span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: normalized.message });
224
249
  }
225
250
  __name(recordSpanError, "recordSpanError");
@@ -378,16 +403,29 @@ function getFarmCacheInvalidationState() {
378
403
  });
379
404
  }
380
405
  __name(getFarmCacheInvalidationState, "getFarmCacheInvalidationState");
406
+ function warnFarmCacheListenerError(scope, error) {
407
+ const detail = error instanceof Error ? error.stack ?? error.message : String(error);
408
+ console.warn(`[farm:cache] ${scope} listener failed: ${detail}`);
409
+ }
410
+ __name(warnFarmCacheListenerError, "warnFarmCacheListenerError");
381
411
  function notifyFarmCacheInvalidation(key) {
382
412
  if (typeof key !== "string" || key.length === 0) return;
383
413
  for (const listener of getFarmCacheInvalidationState().listeners) {
384
- listener(key);
414
+ try {
415
+ listener(key);
416
+ } catch (error) {
417
+ warnFarmCacheListenerError("invalidation", error);
418
+ }
385
419
  }
386
420
  }
387
421
  __name(notifyFarmCacheInvalidation, "notifyFarmCacheInvalidation");
388
422
  function notifyFarmCacheTask(task) {
389
423
  for (const listener of getFarmCacheInvalidationState().taskListeners) {
390
- listener(task);
424
+ try {
425
+ listener(task);
426
+ } catch (error) {
427
+ warnFarmCacheListenerError("task", error);
428
+ }
391
429
  }
392
430
  }
393
431
  __name(notifyFarmCacheTask, "notifyFarmCacheTask");
@@ -1507,7 +1545,8 @@ function createServerQuery(options) {
1507
1545
  return createFarmServerQueryResult(data, {
1508
1546
  key: clientKey,
1509
1547
  staleTime,
1510
- updatedAt
1548
+ updatedAt,
1549
+ ...options.persist === true ? { persist: true } : {}
1511
1550
  });
1512
1551
  }, "handler")
1513
1552
  });
@@ -12,6 +12,8 @@ type ServerQueryOptions<TSchema extends ServerFnSchema | undefined, TResult, TMi
12
12
  key: ServerQueryKey<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
13
13
  /** Milliseconds, a duration string such as "30s", or false for no expiry. */
14
14
  staleTime?: ServerQueryStaleTime;
15
+ /** Allow the configured client cache persistence adapter to store results on the device. */
16
+ persist?: boolean;
15
17
  handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>>;
16
18
  };
17
19
  type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
@@ -21,6 +23,8 @@ type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, T
21
23
  key: ServerQueryKey<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
22
24
  /** Milliseconds, a duration string such as "30s", or false for no expiry. */
23
25
  staleTime?: ServerQueryStaleTime;
26
+ /** Allow the configured client cache persistence adapter to store results on the device. */
27
+ persist?: boolean;
24
28
  handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>>;
25
29
  };
26
30
  type ServerQuery<TInput, TResult> = ([unknown] extends [TInput] ? (input?: TInput) => Promise<TResult> : (input: TInput) => Promise<TResult>) & {
@@ -12,6 +12,8 @@ type ServerQueryOptions<TSchema extends ServerFnSchema | undefined, TResult, TMi
12
12
  key: ServerQueryKey<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
13
13
  /** Milliseconds, a duration string such as "30s", or false for no expiry. */
14
14
  staleTime?: ServerQueryStaleTime;
15
+ /** Allow the configured client cache persistence adapter to store results on the device. */
16
+ persist?: boolean;
15
17
  handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>>;
16
18
  };
17
19
  type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
@@ -21,6 +23,8 @@ type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, T
21
23
  key: ServerQueryKey<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
22
24
  /** Milliseconds, a duration string such as "30s", or false for no expiry. */
23
25
  staleTime?: ServerQueryStaleTime;
26
+ /** Allow the configured client cache persistence adapter to store results on the device. */
27
+ persist?: boolean;
24
28
  handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>>;
25
29
  };
26
30
  type ServerQuery<TInput, TResult> = ([unknown] extends [TInput] ? (input?: TInput) => Promise<TResult> : (input: TInput) => Promise<TResult>) & {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  FARM_SERVER_QUERY_SYMBOL,
3
3
  createServerQuery
4
- } from "./chunk-HHZAOTQD.mjs";
5
- import "./chunk-RLGUZ3HS.mjs";
6
- import "./chunk-SCFX4UTD.mjs";
7
- import "./chunk-VV24CC42.mjs";
4
+ } from "./chunk-GJ7W6LNK.mjs";
5
+ import "./chunk-I3OOUWO5.mjs";
6
+ import "./chunk-EHTUKVSW.mjs";
7
+ import "./chunk-35NPLKQJ.mjs";
8
8
  import "./chunk-ZHQMHJAV.mjs";
9
- import "./chunk-AXVJCMVF.mjs";
10
- import "./chunk-RBRLLZL5.mjs";
9
+ import "./chunk-2HDOV47R.mjs";
10
+ import "./chunk-34IAPZBG.mjs";
11
11
  import "./chunk-WZ5QFROO.mjs";
12
- import "./chunk-ZRBCBOEX.mjs";
12
+ import "./chunk-N2FY2QZ7.mjs";
13
13
  import "./chunk-LM2YNO4U.mjs";
14
14
  import "./chunk-DZU3EKQP.mjs";
15
15
  import "./chunk-CGILA3WO.mjs";