@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
@@ -48,27 +48,56 @@ declare function isJSONStreamResponse(response: {
48
48
  declare function readJSONStream<TItem>(response: Response): FarmAPIStream<TItem>;
49
49
  declare function isFarmAPIStream(value: unknown): value is FarmAPIStream<unknown>;
50
50
 
51
- type AnySchema = {
52
- _output?: any;
53
- _input?: any;
54
- parse?: (data: unknown) => any;
55
- };
51
+ /** Server-only schema contract shared by declarative routes and the API runtime. */
52
+ interface RouteSchema {
53
+ readonly _input?: unknown;
54
+ readonly _output?: unknown;
55
+ parse?: (value: unknown) => unknown;
56
+ parseAsync?: (value: unknown) => Promise<unknown>;
57
+ readonly "~standard"?: {
58
+ readonly types?: {
59
+ input: unknown;
60
+ output: unknown;
61
+ };
62
+ validate(value: unknown): unknown;
63
+ };
64
+ }
65
+ type RouteSchemaInput<T> = T extends {
66
+ _input: infer I;
67
+ } ? I : T extends {
68
+ "~standard": {
69
+ types?: {
70
+ input: infer I;
71
+ };
72
+ };
73
+ } ? I : unknown;
74
+ type RouteSchemaOutput<T> = T extends {
75
+ _output: infer O;
76
+ } ? O : T extends {
77
+ "~standard": {
78
+ types?: {
79
+ output: infer O;
80
+ };
81
+ };
82
+ } ? O : T extends {
83
+ parse: (...args: any[]) => infer O;
84
+ } ? Awaited<O> : unknown;
85
+
86
+ type AnySchema = RouteSchema;
56
87
  type MaybePromise<T> = T | Promise<T>;
57
88
  type Simplify<T> = {
58
89
  [TKey in keyof T]: T[TKey];
59
90
  } & {};
60
91
  type UnionToIntersection$1<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer TIntersection) => void ? TIntersection : never;
61
- type InferOutput<T> = T extends {
62
- _output: infer O;
63
- } ? O : T extends {
64
- parse: (data: unknown) => infer R;
65
- } ? R : unknown;
92
+ type InferOutput<T> = RouteSchemaOutput<T>;
66
93
  type InferInput<T> = T extends {
67
94
  _input: infer I;
68
95
  } ? I : T extends {
96
+ "~standard": unknown;
97
+ } ? RouteSchemaInput<T> : T extends {
69
98
  parse: (data: infer I) => unknown;
70
99
  } ? I : unknown;
71
- type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<InferOutput<T>> : InferOutput<T>;
100
+ type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<InferInput<T>> : InferInput<T>;
72
101
  type InferHeadersOutput<T> = [T] extends [never] ? Record<string, string> : T extends AnySchema ? InferOutput<T> : Record<string, string>;
73
102
  type EndpointErrorSchema = AnySchema & {
74
103
  parse: (data: unknown) => unknown;
@@ -165,11 +194,12 @@ type EndpointHandler<TBody extends AnySchema = never, TQuery extends AnySchema =
165
194
  /** @deprecated Use `error`. */
166
195
  fail: EndpointFail<TErrors>;
167
196
  }) => Promise<TResponse> | TResponse;
168
- type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody> = {
197
+ type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody, TQueryInput = TQuery> = {
169
198
  __types: {
170
199
  body: TBody;
171
200
  inputBody: TBodyInput;
172
201
  query: TQuery;
202
+ inputQuery: TQueryInput;
173
203
  headers: THeaders;
174
204
  response: TResponse;
175
205
  errors: TErrors;
@@ -177,10 +207,10 @@ type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Re
177
207
  __path?: string;
178
208
  __method?: string;
179
209
  } & ((options?: {
180
- body?: TBody;
181
- query?: TQuery;
210
+ body?: TBodyInput;
211
+ query?: TQueryInput;
182
212
  }) => Promise<TResponse>);
183
- type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>>;
213
+ type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>, InferInput<TQuery>>;
184
214
  type AnyEndpointOptions = EndpointOptions<AnySchema, AnySchema, AnySchema, readonly AnyEndpointMiddleware[], EndpointErrorDefinitions>;
185
215
  type EndpointBodyFromOptions<TOptions> = TOptions extends {
186
216
  body: infer TBody extends AnySchema;
@@ -265,41 +295,6 @@ declare function OPTIONS<T = any>(handler: EndpointHandler<never, never, never,
265
295
  declare function OPTIONS<const TOptions extends MethodlessEndpointOptions, TResponse = any>(options: TOptions, handler: ValidatedEndpointHandlerFromOptions<TOptions, TResponse>): CreatedEndpointFromOptions<TOptions, TResponse>;
266
296
  declare function OPTIONS<TBody extends AnySchema = never, TQuery extends AnySchema = never, THeaders extends AnySchema = never, TResponse = any>(options: Omit<EndpointOptions<TBody, TQuery, THeaders, readonly []>, "method">, handler: EndpointHandler<TBody, TQuery, THeaders, TResponse>): CreatedEndpoint<TBody, TQuery, THeaders, TResponse>;
267
297
 
268
- /** Server-only schema contract shared by declarative routes and the API runtime. */
269
- interface RouteSchema {
270
- readonly _input?: unknown;
271
- readonly _output?: unknown;
272
- parse?: (value: unknown) => unknown;
273
- parseAsync?: (value: unknown) => Promise<unknown>;
274
- readonly "~standard"?: {
275
- readonly types?: {
276
- input: unknown;
277
- output: unknown;
278
- };
279
- validate(value: unknown): unknown;
280
- };
281
- }
282
- type RouteSchemaInput<T> = T extends {
283
- _input: infer I;
284
- } ? I : T extends {
285
- "~standard": {
286
- types?: {
287
- input: infer I;
288
- };
289
- };
290
- } ? I : unknown;
291
- type RouteSchemaOutput<T> = T extends {
292
- _output: infer O;
293
- } ? O : T extends {
294
- "~standard": {
295
- types?: {
296
- output: infer O;
297
- };
298
- };
299
- } ? O : T extends {
300
- parse: (...args: any[]) => infer O;
301
- } ? Awaited<O> : unknown;
302
-
303
298
  type RouteMethod = "GET" | "HEAD" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
304
299
  type RoutePathParams<Path extends string> = Path extends `${infer Head}/${infer Tail}` ? RoutePathParams<Head> & RoutePathParams<Tail> : Path extends `[[...${infer Name}]]` ? {
305
300
  [K in Name]?: string[];
@@ -48,27 +48,56 @@ declare function isJSONStreamResponse(response: {
48
48
  declare function readJSONStream<TItem>(response: Response): FarmAPIStream<TItem>;
49
49
  declare function isFarmAPIStream(value: unknown): value is FarmAPIStream<unknown>;
50
50
 
51
- type AnySchema = {
52
- _output?: any;
53
- _input?: any;
54
- parse?: (data: unknown) => any;
55
- };
51
+ /** Server-only schema contract shared by declarative routes and the API runtime. */
52
+ interface RouteSchema {
53
+ readonly _input?: unknown;
54
+ readonly _output?: unknown;
55
+ parse?: (value: unknown) => unknown;
56
+ parseAsync?: (value: unknown) => Promise<unknown>;
57
+ readonly "~standard"?: {
58
+ readonly types?: {
59
+ input: unknown;
60
+ output: unknown;
61
+ };
62
+ validate(value: unknown): unknown;
63
+ };
64
+ }
65
+ type RouteSchemaInput<T> = T extends {
66
+ _input: infer I;
67
+ } ? I : T extends {
68
+ "~standard": {
69
+ types?: {
70
+ input: infer I;
71
+ };
72
+ };
73
+ } ? I : unknown;
74
+ type RouteSchemaOutput<T> = T extends {
75
+ _output: infer O;
76
+ } ? O : T extends {
77
+ "~standard": {
78
+ types?: {
79
+ output: infer O;
80
+ };
81
+ };
82
+ } ? O : T extends {
83
+ parse: (...args: any[]) => infer O;
84
+ } ? Awaited<O> : unknown;
85
+
86
+ type AnySchema = RouteSchema;
56
87
  type MaybePromise<T> = T | Promise<T>;
57
88
  type Simplify<T> = {
58
89
  [TKey in keyof T]: T[TKey];
59
90
  } & {};
60
91
  type UnionToIntersection$1<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer TIntersection) => void ? TIntersection : never;
61
- type InferOutput<T> = T extends {
62
- _output: infer O;
63
- } ? O : T extends {
64
- parse: (data: unknown) => infer R;
65
- } ? R : unknown;
92
+ type InferOutput<T> = RouteSchemaOutput<T>;
66
93
  type InferInput<T> = T extends {
67
94
  _input: infer I;
68
95
  } ? I : T extends {
96
+ "~standard": unknown;
97
+ } ? RouteSchemaInput<T> : T extends {
69
98
  parse: (data: infer I) => unknown;
70
99
  } ? I : unknown;
71
- type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<InferOutput<T>> : InferOutput<T>;
100
+ type InferBodyInput<T> = T extends MultipartSchema<AnySchema> ? TypedFormData<InferInput<T>> : InferInput<T>;
72
101
  type InferHeadersOutput<T> = [T] extends [never] ? Record<string, string> : T extends AnySchema ? InferOutput<T> : Record<string, string>;
73
102
  type EndpointErrorSchema = AnySchema & {
74
103
  parse: (data: unknown) => unknown;
@@ -165,11 +194,12 @@ type EndpointHandler<TBody extends AnySchema = never, TQuery extends AnySchema =
165
194
  /** @deprecated Use `error`. */
166
195
  fail: EndpointFail<TErrors>;
167
196
  }) => Promise<TResponse> | TResponse;
168
- type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody> = {
197
+ type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Record<string, string>, TErrors = never, TBodyInput = TBody, TQueryInput = TQuery> = {
169
198
  __types: {
170
199
  body: TBody;
171
200
  inputBody: TBodyInput;
172
201
  query: TQuery;
202
+ inputQuery: TQueryInput;
173
203
  headers: THeaders;
174
204
  response: TResponse;
175
205
  errors: TErrors;
@@ -177,10 +207,10 @@ type TypedEndpoint<TBody = never, TQuery = never, TResponse = any, THeaders = Re
177
207
  __path?: string;
178
208
  __method?: string;
179
209
  } & ((options?: {
180
- body?: TBody;
181
- query?: TQuery;
210
+ body?: TBodyInput;
211
+ query?: TQueryInput;
182
212
  }) => Promise<TResponse>);
183
- type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>>;
213
+ type CreatedEndpoint<TBody extends AnySchema, TQuery extends AnySchema, THeaders extends AnySchema, TResponse, TErrors extends EndpointErrorDefinitions = {}> = TypedEndpoint<InferOutput<TBody>, InferOutput<TQuery>, Awaited<TResponse>, InferHeadersOutput<THeaders>, EndpointErrorContracts<TErrors>, InferBodyInput<TBody>, InferInput<TQuery>>;
184
214
  type AnyEndpointOptions = EndpointOptions<AnySchema, AnySchema, AnySchema, readonly AnyEndpointMiddleware[], EndpointErrorDefinitions>;
185
215
  type EndpointBodyFromOptions<TOptions> = TOptions extends {
186
216
  body: infer TBody extends AnySchema;
@@ -265,41 +295,6 @@ declare function OPTIONS<T = any>(handler: EndpointHandler<never, never, never,
265
295
  declare function OPTIONS<const TOptions extends MethodlessEndpointOptions, TResponse = any>(options: TOptions, handler: ValidatedEndpointHandlerFromOptions<TOptions, TResponse>): CreatedEndpointFromOptions<TOptions, TResponse>;
266
296
  declare function OPTIONS<TBody extends AnySchema = never, TQuery extends AnySchema = never, THeaders extends AnySchema = never, TResponse = any>(options: Omit<EndpointOptions<TBody, TQuery, THeaders, readonly []>, "method">, handler: EndpointHandler<TBody, TQuery, THeaders, TResponse>): CreatedEndpoint<TBody, TQuery, THeaders, TResponse>;
267
297
 
268
- /** Server-only schema contract shared by declarative routes and the API runtime. */
269
- interface RouteSchema {
270
- readonly _input?: unknown;
271
- readonly _output?: unknown;
272
- parse?: (value: unknown) => unknown;
273
- parseAsync?: (value: unknown) => Promise<unknown>;
274
- readonly "~standard"?: {
275
- readonly types?: {
276
- input: unknown;
277
- output: unknown;
278
- };
279
- validate(value: unknown): unknown;
280
- };
281
- }
282
- type RouteSchemaInput<T> = T extends {
283
- _input: infer I;
284
- } ? I : T extends {
285
- "~standard": {
286
- types?: {
287
- input: infer I;
288
- };
289
- };
290
- } ? I : unknown;
291
- type RouteSchemaOutput<T> = T extends {
292
- _output: infer O;
293
- } ? O : T extends {
294
- "~standard": {
295
- types?: {
296
- output: infer O;
297
- };
298
- };
299
- } ? O : T extends {
300
- parse: (...args: any[]) => infer O;
301
- } ? Awaited<O> : unknown;
302
-
303
298
  type RouteMethod = "GET" | "HEAD" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
304
299
  type RoutePathParams<Path extends string> = Path extends `${infer Head}/${infer Tail}` ? RoutePathParams<Head> & RoutePathParams<Tail> : Path extends `[[...${infer Name}]]` ? {
305
300
  [K in Name]?: string[];
package/dist/routes.cjs CHANGED
@@ -113,7 +113,13 @@ function recordFarmEventTrace(event) {
113
113
  activeSpan.addEvent(event.type, toEventAttributes(event), event.timestamp);
114
114
  }
115
115
  const error = event.type === "request.error" ? void 0 : getEventError(event);
116
- if (error !== void 0) recordSpanError(activeSpan, error);
116
+ if (error !== void 0) {
117
+ if (event.type === "render.error") {
118
+ recordSpanException(activeSpan, error);
119
+ } else {
120
+ recordSpanError(activeSpan, error);
121
+ }
122
+ }
117
123
  }
118
124
  const completedTraceContext = recordCompletedEventSpan(event, activeContext);
119
125
  return traceContext ?? completedTraceContext;
@@ -210,12 +216,26 @@ function getCompletedSpanDescriptor(event) {
210
216
  }
211
217
  }
212
218
  __name(getCompletedSpanDescriptor, "getCompletedSpanDescriptor");
219
+ function hashFarmCacheKey(value) {
220
+ let hash = 2166136261;
221
+ for (let index = 0; index < value.length; index++) {
222
+ hash ^= value.charCodeAt(index);
223
+ hash = Math.imul(hash, 16777619);
224
+ }
225
+ return (hash >>> 0).toString(16).padStart(8, "0");
226
+ }
227
+ __name(hashFarmCacheKey, "hashFarmCacheKey");
213
228
  function toEventAttributes(event) {
214
229
  const attributes = {};
230
+ const redactKey = typeof event.type === "string" && event.type.startsWith("cache.");
215
231
  for (const [key, value] of Object.entries(event)) {
216
232
  if (key === "timestamp" || key === "level" || key === "error" || key === "traceId" || key === "spanId" || key === "traceSampled" || value === void 0) {
217
233
  continue;
218
234
  }
235
+ if (redactKey && key === "key" && typeof value === "string") {
236
+ attributes["farm.key_hash"] = hashFarmCacheKey(value);
237
+ continue;
238
+ }
219
239
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
220
240
  attributes[`farm.${key}`] = value;
221
241
  } else if (Array.isArray(value)) {
@@ -235,9 +255,14 @@ function getEventError(event) {
235
255
  return "error" in event ? event.error : void 0;
236
256
  }
237
257
  __name(getEventError, "getEventError");
238
- function recordSpanError(span, error) {
258
+ function recordSpanException(span, error) {
239
259
  const normalized = error instanceof Error ? error : new Error(String(error));
240
260
  span.recordException(normalized);
261
+ return normalized;
262
+ }
263
+ __name(recordSpanException, "recordSpanException");
264
+ function recordSpanError(span, error) {
265
+ const normalized = recordSpanException(span, error);
241
266
  span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: normalized.message });
242
267
  }
243
268
  __name(recordSpanError, "recordSpanError");
package/dist/routes.d.mts CHANGED
@@ -1,14 +1,15 @@
1
- import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-BvClItiL.mjs';
1
+ import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-B6-07YmP.mjs';
2
2
  import { ComponentType } from 'react';
3
3
  import { RouteDataCacheKey } from './cache.mjs';
4
4
  import { ServerFn } from './server-fn.mjs';
5
5
  import { FarmServerRendererRuntime } from './renderer.mjs';
6
6
  import './lifecycle-De0vQG45.mjs';
7
- import './route-Cq3aObmj.mjs';
7
+ import './route-CvEr4Uc9.mjs';
8
8
  import 'http';
9
9
  import './types-Cc8l9IqS.mjs';
10
10
  import 'db0';
11
11
  import 'unstorage';
12
+ import './integration-api-BT024nuJ.mjs';
12
13
  import '@farming-labs/orm';
13
14
  import './types-CKwggz9n.mjs';
14
15
  import '@farming-labs/docs';
package/dist/routes.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-B9Sq-iMg.js';
1
+ import { F as FarmRouteRuntimeConfig, L as LayoutProps, M as Metadata, b as FarmRouteRuntime, c as FarmRouteRegions, d as FarmRouteMaxDuration, e as FarmAppContext, f as PageProps, g as PluginContextProps, h as RouteModule, P as ParsedRoute } from './client-plugins-By6MVUX-.js';
2
2
  import { ComponentType } from 'react';
3
3
  import { RouteDataCacheKey } from './cache.js';
4
4
  import { ServerFn } from './server-fn.js';
5
5
  import { FarmServerRendererRuntime } from './renderer.js';
6
6
  import './lifecycle-De0vQG45.js';
7
- import './route-Y8lfz1wF.js';
7
+ import './route-4pd-EVtw.js';
8
8
  import 'http';
9
9
  import './types-Cc8l9IqS.js';
10
10
  import 'db0';
11
11
  import 'unstorage';
12
+ import './integration-api-BT024nuJ.js';
12
13
  import '@farming-labs/orm';
13
14
  import './types-CKwggz9n.js';
14
15
  import '@farming-labs/docs';
package/dist/routes.mjs CHANGED
@@ -19,14 +19,14 @@ import {
19
19
  redirect,
20
20
  routesBuilder,
21
21
  scanProgrammaticPagePaths
22
- } from "./chunk-Q3OX763A.mjs";
22
+ } from "./chunk-LXDASSTE.mjs";
23
23
  import "./chunk-QKVUNGAH.mjs";
24
24
  import "./chunk-XNWHZQ6A.mjs";
25
25
  import "./chunk-SXWF4QRU.mjs";
26
- import "./chunk-AXVJCMVF.mjs";
27
- import "./chunk-RBRLLZL5.mjs";
26
+ import "./chunk-2HDOV47R.mjs";
27
+ import "./chunk-34IAPZBG.mjs";
28
28
  import "./chunk-WZ5QFROO.mjs";
29
- import "./chunk-ZRBCBOEX.mjs";
29
+ import "./chunk-N2FY2QZ7.mjs";
30
30
  import "./chunk-DZU3EKQP.mjs";
31
31
  import "./chunk-CGILA3WO.mjs";
32
32
  export {
@@ -20,6 +20,7 @@ declare class FarmI18nRuntime {
20
20
  hasMessage(locale: string, key: string): boolean;
21
21
  getClientSnapshot(resolution: FarmLocaleResolution): FarmI18nClientSnapshot;
22
22
  private formatMessage;
23
+ private readOwnMessage;
23
24
  private resolveMessage;
24
25
  }
25
26
  declare function createFarmI18nRuntime(config: ResolvedFarmI18nConfig, catalogs?: FarmI18nCatalogs): FarmI18nRuntime;
@@ -20,6 +20,7 @@ declare class FarmI18nRuntime {
20
20
  hasMessage(locale: string, key: string): boolean;
21
21
  getClientSnapshot(resolution: FarmLocaleResolution): FarmI18nClientSnapshot;
22
22
  private formatMessage;
23
+ private readOwnMessage;
23
24
  private resolveMessage;
24
25
  }
25
26
  declare function createFarmI18nRuntime(config: ResolvedFarmI18nConfig, catalogs?: FarmI18nCatalogs): FarmI18nRuntime;
@@ -10,9 +10,9 @@ import {
10
10
  runWithServerActionRequest,
11
11
  sanitizeServerActionError,
12
12
  validateServerActionRequest
13
- } from "./chunk-VV24CC42.mjs";
13
+ } from "./chunk-35NPLKQJ.mjs";
14
14
  import "./chunk-ZHQMHJAV.mjs";
15
- import "./chunk-RBRLLZL5.mjs";
15
+ import "./chunk-34IAPZBG.mjs";
16
16
  import "./chunk-DZU3EKQP.mjs";
17
17
  import "./chunk-CGILA3WO.mjs";
18
18
  export {
@@ -55,6 +55,26 @@ function notifyClientObserver(observer, args, label = "Client lifecycle") {
55
55
  }
56
56
  __name(notifyClientObserver, "notifyClientObserver");
57
57
 
58
+ // src/mutation-retry.ts
59
+ async function invokeMutationWithRetry(invoke, retry, shouldContinue) {
60
+ const maxRetries = Math.max(0, retry?.count ?? 0);
61
+ let attempt = 0;
62
+ while (true) {
63
+ try {
64
+ return await invoke();
65
+ } catch (error) {
66
+ if (attempt >= maxRetries || !shouldContinue()) throw error;
67
+ attempt += 1;
68
+ const delay = typeof retry?.delay === "function" ? retry.delay(attempt) : retry?.delay ?? 0;
69
+ if (delay > 0) {
70
+ await new Promise((resolve) => setTimeout(resolve, delay));
71
+ if (!shouldContinue()) throw error;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ __name(invokeMutationWithRetry, "invokeMutationWithRetry");
77
+
58
78
  // src/server-fn-client.ts
59
79
  function useServerFn(serverFn, options = {}) {
60
80
  const { initialResult = null, resetOnSubmit = true } = options;
@@ -106,7 +126,12 @@ function useServerFn(serverFn, options = {}) {
106
126
  };
107
127
  });
108
128
  try {
109
- const result = await serverFn(input);
129
+ const result = await invokeMutationWithRetry(
130
+ () => serverFn(input),
131
+ options.retry,
132
+ // A reset disowns this submission; stop scheduling retries then.
133
+ () => requestId >= lastResetIdRef.current
134
+ );
110
135
  const isLatestRequest = requestId === requestIdRef.current;
111
136
  setActionState((current) => {
112
137
  if (requestId < lastResetIdRef.current) return current;
@@ -163,7 +188,14 @@ function useServerFn(serverFn, options = {}) {
163
188
  throw error;
164
189
  }
165
190
  },
166
- [options.optimistic, options.rollbackOnError, resetOnSubmit, serverFn, setActionState]
191
+ [
192
+ options.optimistic,
193
+ options.retry,
194
+ options.rollbackOnError,
195
+ resetOnSubmit,
196
+ serverFn,
197
+ setActionState
198
+ ]
167
199
  );
168
200
  const formAction = (0, import_react.useCallback)(
169
201
  async (formData) => {
@@ -1,7 +1,11 @@
1
1
  import { FormHTMLAttributes, ComponentType } from 'react';
2
2
  import { ServerFn } from './server-fn.mjs';
3
+ import { R as RetryOptions } from './client-DWoLZ3QU.mjs';
3
4
  import './cache.mjs';
4
5
  import './server-fn-error-DDh14a0V.mjs';
6
+ import './integration-api-BT024nuJ.mjs';
7
+ import './client-cache-CCK-fCe0.mjs';
8
+ import './route-CvEr4Uc9.mjs';
5
9
 
6
10
  type ServerFnActionStatus = "idle" | "pending" | "success" | "error";
7
11
  type ServerFnSubmit<TInput, TResult> = [unknown] extends [TInput] ? (input?: TInput | FormData) => Promise<TResult> : (input: TInput | FormData) => Promise<TResult>;
@@ -16,6 +20,8 @@ type UseServerFnOptions<TResult, TError extends Error = Error, TInput = unknown>
16
20
  throwOnFormError?: boolean;
17
21
  optimistic?: (context: ServerFnOptimisticContext<TInput, TResult>) => TResult | null | undefined;
18
22
  rollbackOnError?: boolean;
23
+ /** Retry failed submissions with the API client's retry shape. Defaults to no retries. */
24
+ retry?: RetryOptions;
19
25
  onSuccess?: (result: TResult) => void;
20
26
  onError?: (error: TError) => void;
21
27
  onSettled?: (result: TResult | null, error: TError | null) => void;
@@ -1,7 +1,11 @@
1
1
  import { FormHTMLAttributes, ComponentType } from 'react';
2
2
  import { ServerFn } from './server-fn.js';
3
+ import { R as RetryOptions } from './client-DuQuQC1h.js';
3
4
  import './cache.js';
4
5
  import './server-fn-error-DDh14a0V.js';
6
+ import './integration-api-BT024nuJ.js';
7
+ import './client-cache-BMxuFqwH.js';
8
+ import './route-4pd-EVtw.js';
5
9
 
6
10
  type ServerFnActionStatus = "idle" | "pending" | "success" | "error";
7
11
  type ServerFnSubmit<TInput, TResult> = [unknown] extends [TInput] ? (input?: TInput | FormData) => Promise<TResult> : (input: TInput | FormData) => Promise<TResult>;
@@ -16,6 +20,8 @@ type UseServerFnOptions<TResult, TError extends Error = Error, TInput = unknown>
16
20
  throwOnFormError?: boolean;
17
21
  optimistic?: (context: ServerFnOptimisticContext<TInput, TResult>) => TResult | null | undefined;
18
22
  rollbackOnError?: boolean;
23
+ /** Retry failed submissions with the API client's retry shape. Defaults to no retries. */
24
+ retry?: RetryOptions;
19
25
  onSuccess?: (result: TResult) => void;
20
26
  onError?: (error: TError) => void;
21
27
  onSettled?: (result: TResult | null, error: TError | null) => void;
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  useAction,
4
4
  useServerFn
5
- } from "./chunk-RAGSHKDC.mjs";
5
+ } from "./chunk-6EJHNHH4.mjs";
6
6
  import "./chunk-DU3PKDVQ.mjs";
7
7
  import "./chunk-CGILA3WO.mjs";
8
8
  export {
@@ -46,16 +46,29 @@ function getFarmCacheInvalidationState() {
46
46
  });
47
47
  }
48
48
  __name(getFarmCacheInvalidationState, "getFarmCacheInvalidationState");
49
+ function warnFarmCacheListenerError(scope, error) {
50
+ const detail = error instanceof Error ? error.stack ?? error.message : String(error);
51
+ console.warn(`[farm:cache] ${scope} listener failed: ${detail}`);
52
+ }
53
+ __name(warnFarmCacheListenerError, "warnFarmCacheListenerError");
49
54
  function notifyFarmCacheInvalidation(key) {
50
55
  if (typeof key !== "string" || key.length === 0) return;
51
56
  for (const listener of getFarmCacheInvalidationState().listeners) {
52
- listener(key);
57
+ try {
58
+ listener(key);
59
+ } catch (error) {
60
+ warnFarmCacheListenerError("invalidation", error);
61
+ }
53
62
  }
54
63
  }
55
64
  __name(notifyFarmCacheInvalidation, "notifyFarmCacheInvalidation");
56
65
  function notifyFarmCacheTask(task) {
57
66
  for (const listener of getFarmCacheInvalidationState().taskListeners) {
58
- listener(task);
67
+ try {
68
+ listener(task);
69
+ } catch (error) {
70
+ warnFarmCacheListenerError("task", error);
71
+ }
59
72
  }
60
73
  }
61
74
  __name(notifyFarmCacheTask, "notifyFarmCacheTask");
@@ -235,7 +248,13 @@ function recordFarmEventTrace(event) {
235
248
  activeSpan.addEvent(event.type, toEventAttributes(event), event.timestamp);
236
249
  }
237
250
  const error = event.type === "request.error" ? void 0 : getEventError(event);
238
- if (error !== void 0) recordSpanError(activeSpan, error);
251
+ if (error !== void 0) {
252
+ if (event.type === "render.error") {
253
+ recordSpanException(activeSpan, error);
254
+ } else {
255
+ recordSpanError(activeSpan, error);
256
+ }
257
+ }
239
258
  }
240
259
  const completedTraceContext = recordCompletedEventSpan(event, activeContext);
241
260
  return traceContext ?? completedTraceContext;
@@ -332,12 +351,26 @@ function getCompletedSpanDescriptor(event) {
332
351
  }
333
352
  }
334
353
  __name(getCompletedSpanDescriptor, "getCompletedSpanDescriptor");
354
+ function hashFarmCacheKey(value) {
355
+ let hash = 2166136261;
356
+ for (let index = 0; index < value.length; index++) {
357
+ hash ^= value.charCodeAt(index);
358
+ hash = Math.imul(hash, 16777619);
359
+ }
360
+ return (hash >>> 0).toString(16).padStart(8, "0");
361
+ }
362
+ __name(hashFarmCacheKey, "hashFarmCacheKey");
335
363
  function toEventAttributes(event) {
336
364
  const attributes = {};
365
+ const redactKey = typeof event.type === "string" && event.type.startsWith("cache.");
337
366
  for (const [key, value] of Object.entries(event)) {
338
367
  if (key === "timestamp" || key === "level" || key === "error" || key === "traceId" || key === "spanId" || key === "traceSampled" || value === void 0) {
339
368
  continue;
340
369
  }
370
+ if (redactKey && key === "key" && typeof value === "string") {
371
+ attributes["farm.key_hash"] = hashFarmCacheKey(value);
372
+ continue;
373
+ }
341
374
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
342
375
  attributes[`farm.${key}`] = value;
343
376
  } else if (Array.isArray(value)) {
@@ -357,9 +390,14 @@ function getEventError(event) {
357
390
  return "error" in event ? event.error : void 0;
358
391
  }
359
392
  __name(getEventError, "getEventError");
360
- function recordSpanError(span, error) {
393
+ function recordSpanException(span, error) {
361
394
  const normalized = error instanceof Error ? error : new Error(String(error));
362
395
  span.recordException(normalized);
396
+ return normalized;
397
+ }
398
+ __name(recordSpanException, "recordSpanException");
399
+ function recordSpanError(span, error) {
400
+ const normalized = recordSpanException(span, error);
363
401
  span.setStatus({ code: import_api.SpanStatusCode.ERROR, message: normalized.message });
364
402
  }
365
403
  __name(recordSpanError, "recordSpanError");
@@ -3,19 +3,19 @@ import {
3
3
  _parseServerFnSchema,
4
4
  createServerFn,
5
5
  createServerMiddleware
6
- } from "./chunk-RLGUZ3HS.mjs";
6
+ } from "./chunk-I3OOUWO5.mjs";
7
7
  import {
8
8
  FARM_SERVER_FN_FAILURE_SYMBOL,
9
9
  ServerActionError,
10
10
  ServerFnFailure,
11
11
  createServerFnTransportError,
12
12
  isServerFnFailure
13
- } from "./chunk-VV24CC42.mjs";
13
+ } from "./chunk-35NPLKQJ.mjs";
14
14
  import "./chunk-ZHQMHJAV.mjs";
15
- import "./chunk-AXVJCMVF.mjs";
16
- import "./chunk-RBRLLZL5.mjs";
15
+ import "./chunk-2HDOV47R.mjs";
16
+ import "./chunk-34IAPZBG.mjs";
17
17
  import "./chunk-WZ5QFROO.mjs";
18
- import "./chunk-ZRBCBOEX.mjs";
18
+ import "./chunk-N2FY2QZ7.mjs";
19
19
  import "./chunk-LM2YNO4U.mjs";
20
20
  import "./chunk-DZU3EKQP.mjs";
21
21
  import "./chunk-CGILA3WO.mjs";