@farm.js/core 0.1.60 → 0.1.62

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 (265) hide show
  1. package/dist/{agent-mcp.d-C-2S9bnP.d.mts → agent-mcp.d-BKZ3UNbt.d.mts} +1 -1
  2. package/dist/{agent-mcp.d-SIoCUP1I.d.ts → agent-mcp.d-C1zr_nGS.d.ts} +1 -1
  3. package/dist/agent-runtime.cjs +3 -3
  4. package/dist/agent-runtime.d.mts +2 -2
  5. package/dist/agent-runtime.d.ts +2 -2
  6. package/dist/agent-runtime.mjs +2 -2
  7. package/dist/analyzer-2AHWJJR7.cjs +15 -0
  8. package/dist/analyzer-YESYU3GK.mjs +15 -0
  9. package/dist/api/route-manager.cjs +4 -4
  10. package/dist/api/route-manager.d.mts +4 -4
  11. package/dist/api/route-manager.d.ts +4 -4
  12. package/dist/api/route-manager.mjs +3 -3
  13. package/dist/api/runtime.cjs +3 -3
  14. package/dist/api/runtime.d.mts +3 -3
  15. package/dist/api/runtime.d.ts +3 -3
  16. package/dist/api/runtime.mjs +2 -2
  17. package/dist/api.cjs +5 -5
  18. package/dist/api.d.mts +4 -4
  19. package/dist/api.d.ts +4 -4
  20. package/dist/api.mjs +4 -4
  21. package/dist/{app-manifest.d-DrSAHskY.d.mts → app-manifest.d-BpvhfKRH.d.mts} +1 -1
  22. package/dist/{app-manifest.d-Tb3CJpL4.d.ts → app-manifest.d-ntch_bvA.d.ts} +1 -1
  23. package/dist/app-markdown.d.mts +3 -3
  24. package/dist/app-markdown.d.ts +3 -3
  25. package/dist/{app.d-CmWlYpZJ.d.ts → app.d-AE8_v3Db.d.ts} +4 -10
  26. package/dist/{app.d-D6QQM_kk.d.mts → app.d-CysWA_8v.d.mts} +4 -10
  27. package/dist/{chunk-FORSVMEJ.mjs → chunk-2CNKQC3G.mjs} +1 -1
  28. package/dist/{chunk-ZFUKPWFC.mjs → chunk-2JYBLE63.mjs} +416 -208
  29. package/dist/{chunk-QRX4JRBO.cjs → chunk-3CCAICF7.cjs} +5 -5
  30. package/dist/{chunk-ANHZ6SUL.mjs → chunk-3TXKFRSO.mjs} +1 -1
  31. package/dist/{chunk-BHJAYPYU.mjs → chunk-3UZVPO72.mjs} +1 -1
  32. package/dist/{chunk-6UUH4N4J.mjs → chunk-43V3ANPQ.mjs} +1 -1
  33. package/dist/chunk-4EBC7EMW.cjs +8 -0
  34. package/dist/{chunk-VZY7MAVS.cjs → chunk-4IHMHFQB.cjs} +27 -1
  35. package/dist/{chunk-FK25QSVC.cjs → chunk-4P5634G6.cjs} +2 -2
  36. package/dist/{chunk-4JTQPOKO.cjs → chunk-53ZCZ46B.cjs} +2 -2
  37. package/dist/{chunk-NQJDO7K7.cjs → chunk-545WJ5UG.cjs} +321 -37
  38. package/dist/{chunk-VU3MYZPO.mjs → chunk-5FE5YT2N.mjs} +26 -0
  39. package/dist/{chunk-A5BJKSZE.cjs → chunk-5IQ2ERQA.cjs} +2 -2
  40. package/dist/{chunk-SJRCWF4Z.mjs → chunk-5Y22WNTO.mjs} +2 -2
  41. package/dist/{chunk-U4BJKNIR.cjs → chunk-752XUZIM.cjs} +11 -6
  42. package/dist/{chunk-JBK7UJOI.cjs → chunk-AJB3DHN6.cjs} +2 -2
  43. package/dist/{chunk-YB44NKC2.cjs → chunk-AXVRUDMB.cjs} +2 -2
  44. package/dist/{chunk-LJVNMGE3.mjs → chunk-BM2LH2JM.mjs} +8 -3
  45. package/dist/{chunk-YI6FKTTN.cjs → chunk-BT4SEFLC.cjs} +261 -38
  46. package/dist/{chunk-LIFUPCXW.cjs → chunk-CFG4QERR.cjs} +13 -2
  47. package/dist/{chunk-3OWVWZ6R.cjs → chunk-CLFEQGET.cjs} +6 -6
  48. package/dist/{chunk-OZK2DS44.mjs → chunk-CROAFCMW.mjs} +1 -1
  49. package/dist/{chunk-2KTYMMWT.mjs → chunk-DPE53XWL.mjs} +1 -1
  50. package/dist/{chunk-3PX4AIXO.mjs → chunk-DQF3QLOH.mjs} +258 -35
  51. package/dist/{chunk-FSQMN2MQ.mjs → chunk-E46NXBNJ.mjs} +1 -1
  52. package/dist/{chunk-EGVC4LIG.mjs → chunk-E4RDMG3K.mjs} +1 -1
  53. package/dist/{chunk-X2CZTWQA.mjs → chunk-ECKQFEX2.mjs} +1 -1
  54. package/dist/{chunk-MTWXOEI4.cjs → chunk-EXXFSZOC.cjs} +246 -193
  55. package/dist/{chunk-UYSTTPYJ.cjs → chunk-GGNJAGGE.cjs} +643 -435
  56. package/dist/{chunk-XTG73QZA.cjs → chunk-GVOMPU3Y.cjs} +12 -8
  57. package/dist/{chunk-ZP32GNJQ.cjs → chunk-I32V5CZL.cjs} +14 -13
  58. package/dist/{chunk-37PYUEK5.mjs → chunk-IOF4KXMP.mjs} +7 -3
  59. package/dist/{chunk-ILMTRGBG.mjs → chunk-IQIKPKFP.mjs} +157 -45
  60. package/dist/{chunk-5JNUYGNF.cjs → chunk-IWRLV46X.cjs} +2 -2
  61. package/dist/{chunk-KPOMS5RO.cjs → chunk-J3GFOQOL.cjs} +3 -3
  62. package/dist/{chunk-NHD7BAKD.mjs → chunk-JCEFKP5M.mjs} +41 -25
  63. package/dist/{analyzer-LCSI3NSH.cjs → chunk-JEJQGZI7.cjs} +16 -13
  64. package/dist/{chunk-LB3DPQP6.cjs → chunk-JLDNXURZ.cjs} +23 -23
  65. package/dist/{chunk-VGG74PSU.cjs → chunk-L2JG337G.cjs} +2 -2
  66. package/dist/chunk-L4RTTTVE.mjs +8 -0
  67. package/dist/chunk-LEJDW34D.cjs +115 -0
  68. package/dist/{analyzer-22BEYV7S.mjs → chunk-LVWGURLD.mjs} +6 -3
  69. package/dist/{chunk-Z5A6CNV2.mjs → chunk-MK5E44WP.mjs} +1 -1
  70. package/dist/{chunk-T4EW7AAD.mjs → chunk-NKRZLQUK.mjs} +2 -2
  71. package/dist/{chunk-HPWB57PZ.mjs → chunk-NT3QDN2E.mjs} +1 -1
  72. package/dist/{chunk-T7I62A4C.mjs → chunk-OUWRNHTV.mjs} +81 -28
  73. package/dist/{chunk-GFT5AHAT.mjs → chunk-QDWMCFTH.mjs} +12 -1
  74. package/dist/{chunk-AER5I65K.mjs → chunk-QTD6EMN2.mjs} +1 -1
  75. package/dist/{chunk-UDJY2ZGY.cjs → chunk-RMUD75WT.cjs} +413 -301
  76. package/dist/chunk-RZNCMRD3.mjs +141 -0
  77. package/dist/{chunk-D7LTCK3U.mjs → chunk-SA7MLSP4.mjs} +11 -6
  78. package/dist/{chunk-2FRLSDBT.cjs → chunk-SM25ZC4S.cjs} +1 -1
  79. package/dist/{chunk-3YMLUNL2.cjs → chunk-SVXOCTQ2.cjs} +1 -1
  80. package/dist/{chunk-W2RZ73IU.cjs → chunk-SYXPWJ7N.cjs} +8 -8
  81. package/dist/{chunk-F6Y7ZAPQ.mjs → chunk-T46NNU4D.mjs} +6 -3
  82. package/dist/{chunk-IFHPDLIS.mjs → chunk-TGULJSHD.mjs} +5 -4
  83. package/dist/{chunk-JPIUGDK4.mjs → chunk-TZVUF5JJ.mjs} +1 -1
  84. package/dist/chunk-UWI3SJAK.cjs +141 -0
  85. package/dist/{chunk-JI5D7MXY.mjs → chunk-UYRI6U3P.mjs} +1 -1
  86. package/dist/{chunk-D2X5MUF5.cjs → chunk-V727H3RI.cjs} +47 -31
  87. package/dist/{chunk-ZMHAFH4R.mjs → chunk-VM7X5CKC.mjs} +2 -2
  88. package/dist/{chunk-VPTWKOCY.mjs → chunk-VWW4Q3BJ.mjs} +287 -6
  89. package/dist/{chunk-4P23B7DU.cjs → chunk-WKJQ2FJA.cjs} +3 -3
  90. package/dist/{chunk-HASX6DC7.cjs → chunk-WKPBIT5Q.cjs} +8 -8
  91. package/dist/{chunk-RAWWCDCT.cjs → chunk-WYAXRIYP.cjs} +3 -3
  92. package/dist/{chunk-3TL3AH25.cjs → chunk-X4K7TYN6.cjs} +12 -7
  93. package/dist/chunk-XCXHQBMM.mjs +115 -0
  94. package/dist/{chunk-DPJ66FSI.cjs → chunk-XX32BOMM.cjs} +7 -7
  95. package/dist/{chunk-2IAPKPEB.cjs → chunk-YN6BHOYY.cjs} +6 -6
  96. package/dist/{chunk-CBKRS3M4.cjs → chunk-Z7P2BTZ3.cjs} +7 -6
  97. package/dist/{chunk-SX7EECTS.mjs → chunk-ZBUAOGMY.mjs} +1 -1
  98. package/dist/{chunk-RPUJHJHE.mjs → chunk-ZFWYCVKS.mjs} +4 -3
  99. package/dist/{chunk-IFXSBJPN.cjs → chunk-ZVIEFTUA.cjs} +20 -17
  100. package/dist/{chunk-EXUONJYV.mjs → chunk-ZZI56IUY.mjs} +3 -3
  101. package/dist/{programmatic-routes-client.d-CLG2N1yH.d.ts → client-component.d-Bgt3x5Fu.d.ts} +18 -3
  102. package/dist/{programmatic-routes-client.d-CPbNqtIi.d.mts → client-component.d-BoqC2MLC.d.mts} +18 -3
  103. package/dist/{client-plugins.d-vXrbcfJ1.d.ts → client-plugins.d-BcqIy4au.d.ts} +1 -1
  104. package/dist/{client-plugins.d-CgQQ-EAv.d.mts → client-plugins.d-CWyYBxXf.d.mts} +1 -1
  105. package/dist/client-plugins.d.mts +2 -2
  106. package/dist/client-plugins.d.ts +2 -2
  107. package/dist/client.d.mts +7 -7
  108. package/dist/client.d.ts +7 -7
  109. package/dist/{config.d-DqZkLwef.d.ts → config.d-qt-mE8O5.d.mts} +6 -2
  110. package/dist/{config.d-DqZkLwef.d.mts → config.d-qt-mE8O5.d.ts} +6 -2
  111. package/dist/config.d.mts +2 -2
  112. package/dist/config.d.ts +2 -2
  113. package/dist/cron.cjs +12 -2
  114. package/dist/cron.d.mts +101 -3
  115. package/dist/cron.d.ts +101 -3
  116. package/dist/cron.mjs +11 -1
  117. package/dist/desktop.d.mts +3 -3
  118. package/dist/desktop.d.ts +3 -3
  119. package/dist/{devtools-KQZ6SRCJ.mjs → devtools-NUVXYG7I.mjs} +6 -6
  120. package/dist/{devtools-UF6JYHUN.cjs → devtools-SVRSGPNC.cjs} +8 -8
  121. package/dist/docs.cjs +9 -9
  122. package/dist/docs.d.mts +3 -3
  123. package/dist/docs.d.ts +3 -3
  124. package/dist/docs.mjs +8 -8
  125. package/dist/image/server.cjs +3 -3
  126. package/dist/image/server.mjs +2 -2
  127. package/dist/image/sharp.cjs +10 -10
  128. package/dist/image/sharp.mjs +2 -2
  129. package/dist/index.cjs +42 -27
  130. package/dist/{index.d-Dmfb7Kb_.d.mts → index.d-BDaiu2i5.d.mts} +1 -1
  131. package/dist/{index.d-DlCELfhf.d.ts → index.d-nAncqTXz.d.ts} +1 -1
  132. package/dist/index.d.mts +18 -18
  133. package/dist/index.d.ts +18 -18
  134. package/dist/index.mjs +42 -27
  135. package/dist/integrations.cjs +3 -3
  136. package/dist/integrations.d.mts +2 -2
  137. package/dist/integrations.d.ts +2 -2
  138. package/dist/integrations.mjs +2 -2
  139. package/dist/internal/app-markdown-runtime.d.mts +3 -3
  140. package/dist/internal/app-markdown-runtime.d.ts +3 -3
  141. package/dist/internal/build-runtime.cjs +27 -22
  142. package/dist/internal/build-runtime.d.mts +4 -4
  143. package/dist/internal/build-runtime.d.ts +4 -4
  144. package/dist/internal/build-runtime.mjs +26 -21
  145. package/dist/internal/cli-runtime.cjs +12 -11
  146. package/dist/internal/cli-runtime.mjs +11 -10
  147. package/dist/internal/client-error-overlay.cjs +4 -4
  148. package/dist/internal/client-error-overlay.mjs +1 -1
  149. package/dist/internal/client-runtime.d.mts +5 -5
  150. package/dist/internal/client-runtime.d.ts +5 -5
  151. package/dist/internal/compression-runtime.d.mts +2 -2
  152. package/dist/internal/compression-runtime.d.ts +2 -2
  153. package/dist/internal/config-runtime.cjs +8 -8
  154. package/dist/internal/config-runtime.d.mts +5 -5
  155. package/dist/internal/config-runtime.d.ts +5 -5
  156. package/dist/internal/config-runtime.mjs +7 -7
  157. package/dist/internal/form-actions.cjs +4 -4
  158. package/dist/internal/form-actions.mjs +3 -3
  159. package/dist/internal/infra-analytics-runtime.cjs +6 -6
  160. package/dist/internal/infra-analytics-runtime.mjs +4 -4
  161. package/dist/internal/metadata-image-runtime.cjs +3 -3
  162. package/dist/internal/metadata-image-runtime.mjs +2 -2
  163. package/dist/internal/native-server-fns.cjs +25 -0
  164. package/dist/internal/native-server-fns.d.mts +42 -0
  165. package/dist/internal/native-server-fns.d.ts +42 -0
  166. package/dist/internal/native-server-fns.mjs +25 -0
  167. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  168. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  169. package/dist/internal/production-node-env.cjs +2 -2
  170. package/dist/internal/production-node-env.mjs +1 -1
  171. package/dist/internal/production-runtime.cjs +16 -10
  172. package/dist/internal/production-runtime.d.mts +39 -12
  173. package/dist/internal/production-runtime.d.ts +39 -12
  174. package/dist/internal/production-runtime.mjs +15 -9
  175. package/dist/internal/react-cache.cjs +51 -0
  176. package/dist/internal/react-cache.d.mts +3 -0
  177. package/dist/internal/react-cache.d.ts +3 -0
  178. package/dist/internal/react-cache.mjs +51 -0
  179. package/dist/markdown.d.mts +2 -2
  180. package/dist/markdown.d.ts +2 -2
  181. package/dist/middleware.cjs +3 -3
  182. package/dist/middleware.d.mts +4 -4
  183. package/dist/middleware.d.ts +4 -4
  184. package/dist/middleware.mjs +2 -2
  185. package/dist/mobile.d.mts +10 -4
  186. package/dist/mobile.d.ts +10 -4
  187. package/dist/{modules-VHD7BELU.mjs → modules-KOKD4XS6.mjs} +2 -2
  188. package/dist/modules-QTP7WJPD.cjs +13 -0
  189. package/dist/native-server-fn-handler-GLRHAYWV.mjs +28 -0
  190. package/dist/native-server-fn-handler-J5MYRXN6.cjs +28 -0
  191. package/dist/native-specs-5OLED4MM.cjs +15 -0
  192. package/dist/{native-specs-BD7HOTMJ.mjs → native-specs-LDV6IZ4N.mjs} +1 -1
  193. package/dist/{native-tree-VWNW2MQ2.mjs → native-tree-AS5L3ID3.mjs} +2 -2
  194. package/dist/{native-tree-6G5O53O3.cjs → native-tree-Z2WYUJEV.cjs} +3 -3
  195. package/dist/native.cjs +1 -1
  196. package/dist/native.d.mts +5 -5
  197. package/dist/native.d.ts +5 -5
  198. package/dist/native.mjs +1 -1
  199. package/dist/{navigation-delegate.d-JXx40JzR.d.ts → navigation-delegate.d-BbUHRXxG.d.ts} +1 -1
  200. package/dist/{navigation-delegate.d-CnOTWOyi.d.mts → navigation-delegate.d-CSCm8ZxL.d.mts} +1 -1
  201. package/dist/navigation.d.mts +5 -5
  202. package/dist/navigation.d.ts +5 -5
  203. package/dist/{nitro-FLN6DRGJ.mjs → nitro-DD4QCA66.mjs} +5 -5
  204. package/dist/{nitro-HXAZZQKY.cjs → nitro-VRDX2H4M.cjs} +8 -8
  205. package/dist/plugin.cjs +19 -18
  206. package/dist/plugin.d.mts +5 -5
  207. package/dist/plugin.d.ts +5 -5
  208. package/dist/plugin.mjs +18 -17
  209. package/dist/{port-WOOQ3V56.mjs → port-UFUZL6RI.mjs} +2 -2
  210. package/dist/{port-C6GBH4C6.cjs → port-VTLHPZOI.cjs} +10 -10
  211. package/dist/{production-runtime.d-CP5s6RuY.d.mts → production-runtime.d-CcQiDko5.d.mts} +1 -1
  212. package/dist/{production-runtime.d-N-cE3pmy.d.ts → production-runtime.d-DgT24A0f.d.ts} +1 -1
  213. package/dist/{render-plan.d-DZ-qjjdG.d.mts → render-plan.d-BH9WF-JZ.d.mts} +1 -1
  214. package/dist/{render-plan.d-B9lAP3uX.d.ts → render-plan.d-CyrX6MDs.d.ts} +1 -1
  215. package/dist/renderer-client.d.mts +5 -5
  216. package/dist/renderer-client.d.ts +5 -5
  217. package/dist/{request.d-BiicaNxb.d.ts → request.d-BB8M8bcD.d.ts} +1 -1
  218. package/dist/{request.d-DV0oeUit.d.mts → request.d-CUrPnCW7.d.mts} +1 -1
  219. package/dist/request.d.mts +3 -3
  220. package/dist/request.d.ts +3 -3
  221. package/dist/{route-rendering.d-BrIKA51A.d.mts → route-rendering.d-CYxlzaFm.d.mts} +1 -1
  222. package/dist/{route-rendering.d-Iss0C7GR.d.ts → route-rendering.d-DYqZMIf4.d.ts} +1 -1
  223. package/dist/{router.d-mNTbOGV_.d.mts → router.d-7o24CD8u.d.mts} +1 -1
  224. package/dist/{router.d-DjGn_al7.d.ts → router.d-DaKo507j.d.ts} +1 -1
  225. package/dist/{routes.d-BKSjHuH9.d.ts → routes.d-BknKQcTu.d.ts} +7 -1
  226. package/dist/{routes.d-qd8Qf4LG.d.mts → routes.d-D1IrO9KK.d.mts} +7 -1
  227. package/dist/routes.d.mts +2 -2
  228. package/dist/routes.d.ts +2 -2
  229. package/dist/{rsc-pipeline-SVLBTY7H.cjs → rsc-pipeline-OF2I7PCX.cjs} +8 -8
  230. package/dist/{rsc-pipeline-WBLBDQXA.mjs → rsc-pipeline-RFLHDAKD.mjs} +7 -7
  231. package/dist/{runtime-DGUOWSMF.cjs → runtime-LBTK62AD.cjs} +70 -47
  232. package/dist/{runtime-HFZTVNFF.mjs → runtime-M6UJCSLA.mjs} +38 -15
  233. package/dist/{runtime.d-Bm_4hP5T.d.ts → runtime.d-CN73a-IL.d.ts} +1 -1
  234. package/dist/{runtime.d-BNVbojF1.d.mts → runtime.d-CcNuzhX6.d.mts} +1 -1
  235. package/dist/server-action-security.cjs +3 -3
  236. package/dist/server-action-security.mjs +2 -2
  237. package/dist/server-fn.cjs +4 -4
  238. package/dist/server-fn.mjs +3 -3
  239. package/dist/server-plugins.d.mts +3 -3
  240. package/dist/server-plugins.d.ts +3 -3
  241. package/dist/server-query.cjs +5 -5
  242. package/dist/server-query.mjs +4 -4
  243. package/dist/server.cjs +38 -37
  244. package/dist/server.d.mts +10 -10
  245. package/dist/server.d.ts +10 -10
  246. package/dist/server.mjs +23 -22
  247. package/dist/{spa-router.d-DHDoXxDE.d.mts → spa-router.d-CNi77LZm.d.mts} +2 -2
  248. package/dist/{spa-router.d-DAtnNoBe.d.ts → spa-router.d-Cvgf5QP4.d.ts} +2 -2
  249. package/dist/testing.cjs +6 -6
  250. package/dist/testing.d.mts +2 -2
  251. package/dist/testing.d.ts +2 -2
  252. package/dist/testing.mjs +4 -4
  253. package/dist/{utils.d-DwZ-KLSB.d.ts → utils.d-C3H-14_Y.d.ts} +1 -1
  254. package/dist/{utils.d-uKZcKJk4.d.mts → utils.d-D8VfzZYn.d.mts} +1 -1
  255. package/dist/version.cjs +2 -2
  256. package/dist/version.mjs +1 -1
  257. package/dist/vite.cjs +21 -18
  258. package/dist/vite.d.mts +5 -5
  259. package/dist/vite.d.ts +5 -5
  260. package/dist/vite.mjs +20 -17
  261. package/dist/workflows.cjs +3 -3
  262. package/dist/workflows.mjs +2 -2
  263. package/package.json +12 -2
  264. package/dist/modules-WT5D3AWY.cjs +0 -13
  265. package/dist/native-specs-IQQRJOOW.cjs +0 -15
@@ -59,19 +59,21 @@ import {
59
59
  } from "./chunk-VFXE6NWR.mjs";
60
60
  import {
61
61
  resolveWorkflowsConfig
62
- } from "./chunk-JPIUGDK4.mjs";
62
+ } from "./chunk-TZVUF5JJ.mjs";
63
63
  import {
64
+ FARM_CRON_NAME_SEGMENT_PATTERN,
65
+ normalizeCronExpression,
64
66
  resolveCronConfig
65
- } from "./chunk-3PX4AIXO.mjs";
67
+ } from "./chunk-DQF3QLOH.mjs";
66
68
  import {
67
69
  resolveServerActionsConfig
68
- } from "./chunk-FSQMN2MQ.mjs";
70
+ } from "./chunk-E46NXBNJ.mjs";
69
71
  import {
70
72
  resolveFarmThemeConfig
71
73
  } from "./chunk-YWPNIYUP.mjs";
72
74
  import {
73
75
  resolveIntegrationPlugins
74
- } from "./chunk-IFHPDLIS.mjs";
76
+ } from "./chunk-TGULJSHD.mjs";
75
77
  import {
76
78
  compileMiddlewareConfig
77
79
  } from "./chunk-EDPENAVO.mjs";
@@ -83,7 +85,7 @@ import {
83
85
  } from "./chunk-JSDV2NUN.mjs";
84
86
  import {
85
87
  resolveFarmServerConfig
86
- } from "./chunk-GFT5AHAT.mjs";
88
+ } from "./chunk-QDWMCFTH.mjs";
87
89
  import {
88
90
  resolveFarmAPIConfig
89
91
  } from "./chunk-W6QLRQ3V.mjs";
@@ -135,6 +137,274 @@ async function resolveFarmMCPPlugin(config, options) {
135
137
  return runtime.createFarmMCPPlugin(config);
136
138
  }
137
139
 
140
+ // src/cron-scan.ts
141
+ var LANGS = {
142
+ ts: "ts",
143
+ tsx: "tsx",
144
+ js: "jsx",
145
+ jsx: "jsx"
146
+ };
147
+ var parseAst;
148
+ async function loadParseAst() {
149
+ if (!parseAst) {
150
+ const { createRequire: createRequire3 } = await import("module");
151
+ parseAst = createRequire3(typeof __filename === "string" ? __filename : import.meta.url)(
152
+ "rolldown/parseAst"
153
+ ).parseAst;
154
+ }
155
+ return parseAst;
156
+ }
157
+ function unwrap(node) {
158
+ while (node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression" || node.type === "TSNonNullExpression" || node.type === "ParenthesizedExpression") {
159
+ node = node.expression;
160
+ }
161
+ return node;
162
+ }
163
+ function* walkNodes(value) {
164
+ if (!value || typeof value !== "object") return;
165
+ if (Array.isArray(value)) {
166
+ for (const item of value) yield* walkNodes(item);
167
+ return;
168
+ }
169
+ const node = value;
170
+ if (typeof node.type === "string") yield node;
171
+ for (const key of Object.keys(node)) {
172
+ if (key === "type" || key === "start" || key === "end" || key === "loc" || key === "range") {
173
+ continue;
174
+ }
175
+ yield* walkNodes(node[key]);
176
+ }
177
+ }
178
+ function notLiteral(file, key) {
179
+ throw new TypeError(
180
+ `The \`${key}\` option of cronRoute() in ${file} is not a literal. The build reads scheduling options from the source without running the module, so write \`${key}\` out literally or move the job to the \`cron\` config in farm.config.ts.`
181
+ );
182
+ }
183
+ function literalValue(node, file, key) {
184
+ if (!node) notLiteral(file, key);
185
+ switch (node.type) {
186
+ case "Literal":
187
+ if (node.regex || typeof node.value === "bigint") notLiteral(file, key);
188
+ return node.value;
189
+ case "TemplateLiteral":
190
+ if (node.expressions.length > 0) notLiteral(file, key);
191
+ return node.quasis[0]?.value?.cooked ?? notLiteral(file, key);
192
+ case "UnaryExpression":
193
+ if (node.operator === "-" && node.argument.type === "Literal" && typeof node.argument.value === "number") {
194
+ return -node.argument.value;
195
+ }
196
+ notLiteral(file, key);
197
+ break;
198
+ case "ArrayExpression": {
199
+ const items = [];
200
+ for (const element of node.elements) {
201
+ if (!element || element.type === "SpreadElement") notLiteral(file, key);
202
+ items.push(literalValue(unwrap(element), file, key));
203
+ }
204
+ return items;
205
+ }
206
+ case "ObjectExpression": {
207
+ const object = {};
208
+ for (const property of node.properties) {
209
+ if (property.type !== "Property" || property.computed || property.kind !== "init") {
210
+ notLiteral(file, key);
211
+ }
212
+ const propertyKey = property.key.type === "Identifier" ? property.key.name : property.key.value;
213
+ if (typeof propertyKey !== "string" || propertyKey === "__proto__") notLiteral(file, key);
214
+ object[propertyKey] = literalValue(unwrap(property.value), file, key);
215
+ }
216
+ return object;
217
+ }
218
+ case "TSAsExpression":
219
+ case "TSSatisfiesExpression":
220
+ case "TSNonNullExpression":
221
+ case "ParenthesizedExpression":
222
+ return literalValue(node.expression, file, key);
223
+ }
224
+ notLiteral(file, key);
225
+ }
226
+ function optionProperty(object, name) {
227
+ return object.properties.find(
228
+ (entry) => entry.type === "Property" && !entry.computed && (entry.key.name === name || entry.key.value === name)
229
+ )?.value;
230
+ }
231
+ function cronRouteLocalNames(program) {
232
+ const locals = /* @__PURE__ */ new Set();
233
+ for (const statement of program.body) {
234
+ if (statement.type !== "ImportDeclaration") continue;
235
+ for (const specifier of statement.specifiers) {
236
+ if (specifier.type !== "ImportSpecifier") continue;
237
+ const imported = specifier.imported?.name ?? specifier.imported?.value;
238
+ if (imported === "cronRoute") locals.add(specifier.local.name);
239
+ }
240
+ }
241
+ return locals;
242
+ }
243
+ function scannedJobFromOptions(optionsNode, file, routePath) {
244
+ const scheduleNode = optionProperty(optionsNode, "schedule");
245
+ if (!scheduleNode) return null;
246
+ if (optionsNode.properties.some((entry) => entry.type === "SpreadElement")) {
247
+ throw new TypeError(
248
+ `The cronRoute() options in ${file} spread another object next to \`schedule\`, so the build cannot read the job statically. Write every scheduling option literally in the call.`
249
+ );
250
+ }
251
+ const read = (key) => {
252
+ const node = optionProperty(optionsNode, key);
253
+ return node === void 0 ? void 0 : literalValue(unwrap(node), file, key);
254
+ };
255
+ const name = readScannedName(read("name"), file, routePath);
256
+ const schedule = readScannedSchedule(read("schedule"), file, name);
257
+ const description = read("description");
258
+ if (description !== void 0 && typeof description !== "string") {
259
+ throw new TypeError(
260
+ `The \`description\` option of cronRoute() in ${file} must be a string literal.`
261
+ );
262
+ }
263
+ const timeoutMs = read("timeoutMs");
264
+ if (timeoutMs !== void 0 && (typeof timeoutMs !== "number" || !Number.isFinite(timeoutMs) || timeoutMs <= 0)) {
265
+ throw new TypeError(
266
+ `The \`timeoutMs\` option of cronRoute() in ${file} must be a positive number literal in milliseconds.`
267
+ );
268
+ }
269
+ const enabled = read("enabled");
270
+ if (enabled !== void 0 && typeof enabled !== "boolean") {
271
+ throw new TypeError(
272
+ `The \`enabled\` option of cronRoute() in ${file} must be \`true\` or \`false\`.`
273
+ );
274
+ }
275
+ const input = read("input");
276
+ return {
277
+ name,
278
+ schedule,
279
+ path: routePath,
280
+ ...typeof description === "string" && description.trim() ? { description: description.trim() } : {},
281
+ ...input !== void 0 ? { input } : {},
282
+ ...timeoutMs !== void 0 ? { timeoutMs } : {},
283
+ filePath: file,
284
+ enabled: enabled !== false
285
+ };
286
+ }
287
+ function readScannedName(value, file, routePath) {
288
+ if (value === void 0) {
289
+ const defaultName = routePath === "/api" ? "" : routePath.slice("/api/".length);
290
+ if (!defaultName) {
291
+ throw new TypeError(
292
+ `The scheduled cronRoute() in ${file} sits at the \`/api\` root, which has no default job name. Set the \`name\` option.`
293
+ );
294
+ }
295
+ return defaultName;
296
+ }
297
+ if (typeof value !== "string" || value.length === 0) {
298
+ throw new TypeError(
299
+ `The \`name\` option of cronRoute() in ${file} must be a non-empty string literal.`
300
+ );
301
+ }
302
+ if (!value.split("/").every((segment) => FARM_CRON_NAME_SEGMENT_PATTERN.test(segment))) {
303
+ throw new TypeError(
304
+ `The \`name\` option ${JSON.stringify(value)} of cronRoute() in ${file} is invalid. Each "/"-separated segment must start with a letter or number and contain only letters, numbers, dots, underscores, or hyphens.`
305
+ );
306
+ }
307
+ return value;
308
+ }
309
+ function readScannedSchedule(value, file, name) {
310
+ const raw = Array.isArray(value) ? value : [value];
311
+ if (raw.length === 0) {
312
+ throw new TypeError(
313
+ `The \`schedule\` option of cronRoute() in ${file} must list at least one cron expression.`
314
+ );
315
+ }
316
+ try {
317
+ return [...new Set(raw.map((entry) => normalizeCronExpression(name, entry)))];
318
+ } catch (error) {
319
+ throw new TypeError(`${error.message} (from the cronRoute() options in ${file})`);
320
+ }
321
+ }
322
+ async function scanFarmCronRouteJobs(options) {
323
+ const [path4, fs] = await Promise.all([import("path"), import("fs/promises")]);
324
+ const apiDir = path4.join(options.root, options.srcDir || "src", "app", "api");
325
+ try {
326
+ if (!(await fs.stat(apiDir)).isDirectory()) return [];
327
+ } catch {
328
+ return [];
329
+ }
330
+ const { glob } = await import("tinyglobby");
331
+ const files = (await glob("**/route.{ts,tsx,js,jsx}", {
332
+ cwd: apiDir,
333
+ absolute: true,
334
+ expandDirectories: false
335
+ })).sort();
336
+ const jobs = [];
337
+ const byName = /* @__PURE__ */ new Map();
338
+ for (const file of files) {
339
+ const code = await fs.readFile(file, "utf8");
340
+ if (!code.includes("cronRoute")) continue;
341
+ const parse = await loadParseAst();
342
+ const lang = LANGS[path4.extname(file).slice(1)] ?? "tsx";
343
+ let program;
344
+ try {
345
+ program = parse(code, { lang });
346
+ } catch (error) {
347
+ throw new TypeError(
348
+ `The route file ${file} could not be parsed while reading its cronRoute() schedule: ${error.message}`
349
+ );
350
+ }
351
+ const locals = cronRouteLocalNames(program);
352
+ if (locals.size === 0) continue;
353
+ const relativeDir = path4.relative(apiDir, path4.dirname(file)).split(path4.sep).join("/");
354
+ const routePath = relativeDir === "" || relativeDir === "." ? "/api" : `/api/${relativeDir}`;
355
+ for (const node of walkNodes(program)) {
356
+ if (node.type !== "CallExpression" || node.callee?.type !== "Identifier" || !locals.has(node.callee.name)) {
357
+ continue;
358
+ }
359
+ const optionsArgument = node.arguments?.[1];
360
+ if (!optionsArgument || optionsArgument.type === "SpreadElement") continue;
361
+ const optionsNode = unwrap(optionsArgument);
362
+ if (optionsNode.type !== "ObjectExpression") continue;
363
+ const job = scannedJobFromOptions(optionsNode, file, routePath);
364
+ if (!job) continue;
365
+ if (/[[\]]/.test(routePath)) {
366
+ throw new TypeError(
367
+ `The scheduled cronRoute() in ${file} sits under a dynamic segment, and a scheduler cannot fill route params. Move the schedule to a static route.`
368
+ );
369
+ }
370
+ const existing = byName.get(job.name);
371
+ if (existing !== void 0) {
372
+ throw new TypeError(
373
+ `Farm cron job ${JSON.stringify(job.name)} is defined twice: in ${existing} and in ${file}. Rename or remove one of them.`
374
+ );
375
+ }
376
+ byName.set(job.name, file);
377
+ jobs.push(job);
378
+ }
379
+ }
380
+ return jobs;
381
+ }
382
+ function mergeFarmCronJobs(config, scanned) {
383
+ const configNames = new Set(config.jobs.map((job) => job.name));
384
+ const jobs = [...config.jobs];
385
+ for (const scannedJob of scanned) {
386
+ if (configNames.has(scannedJob.name)) {
387
+ throw new TypeError(
388
+ `Farm cron job ${JSON.stringify(scannedJob.name)} is defined twice: in the \`cron\` config in farm.config.ts and in ${scannedJob.filePath}. Rename or remove one of them.`
389
+ );
390
+ }
391
+ if (!scannedJob.enabled) continue;
392
+ const { filePath: _filePath, enabled: _enabled, ...job } = scannedJob;
393
+ jobs.push(job);
394
+ }
395
+ if (jobs.length === config.jobs.length) return config;
396
+ return { ...config, enabled: jobs.length > 0, jobs };
397
+ }
398
+ async function resolveProjectCronJobs(options) {
399
+ const resolved = resolveCronConfig(options.cron);
400
+ if (resolved === options.cron || options.cron === false) return resolved;
401
+ const scanned = await scanFarmCronRouteJobs({
402
+ root: options.root || process.cwd(),
403
+ srcDir: options.srcDir
404
+ });
405
+ return mergeFarmCronJobs(resolved, scanned);
406
+ }
407
+
138
408
  // src/config.ts
139
409
  import path3 from "path";
140
410
 
@@ -808,6 +1078,7 @@ async function resolveConfig(userConfig, mode) {
808
1078
  const env = resolveEnv(userConfig.env, process.env);
809
1079
  setEnv(env);
810
1080
  const api = await resolveFarmAPIConfig(userConfig.api, { root, mode, env });
1081
+ const cron = await resolveProjectCronJobs({ root, srcDir, cron: userConfig.cron });
811
1082
  const auth = resolveFarmAuthConfig(userConfig.auth);
812
1083
  const mcp = resolveFarmMCPConfig(userConfig.mcp);
813
1084
  if (auth.enabled && userConfig.integrations?.auth) {
@@ -835,6 +1106,12 @@ async function resolveConfig(userConfig, mode) {
835
1106
  basePath,
836
1107
  integrations: () => integrations
837
1108
  }) : null;
1109
+ let nativeServerFnAppDirs = [];
1110
+ const nativeServerFnPlugin = userConfig.mobile !== void 0 && userConfig.mobile !== null ? (await import("./native-server-fn-handler-GLRHAYWV.mjs")).createFarmNativeServerFnPlugin({
1111
+ resolve: (await import("./internal/native-server-fns.mjs")).createFarmDevNativeServerFnResolver(
1112
+ { root, srcDir, appDirs: () => nativeServerFnAppDirs }
1113
+ )
1114
+ }) : null;
838
1115
  const openapi = {
839
1116
  enabled: false,
840
1117
  route: "/docs/reference",
@@ -861,7 +1138,7 @@ async function resolveConfig(userConfig, mode) {
861
1138
  md,
862
1139
  mdx,
863
1140
  migrations: resolveMigrationsConfig(userConfig.migrations),
864
- cron: resolveCronConfig(userConfig.cron),
1141
+ cron,
865
1142
  workflows: resolveWorkflowsConfig(userConfig.workflows),
866
1143
  api,
867
1144
  observability: userConfig.observability ?? false,
@@ -888,6 +1165,7 @@ async function resolveConfig(userConfig, mode) {
888
1165
  ...userConfig.mobile !== void 0 ? { mobileClient: true } : {},
889
1166
  plugins: [
890
1167
  ...mobileSessionPlugin ? [mobileSessionPlugin] : [],
1168
+ ...nativeServerFnPlugin ? [nativeServerFnPlugin] : [],
891
1169
  ...resolveIntegrationPlugins(integrations),
892
1170
  ...nativeMCPPlugin ? [nativeMCPPlugin] : [],
893
1171
  ...userConfig.plugins || []
@@ -925,6 +1203,9 @@ async function resolveConfig(userConfig, mode) {
925
1203
  vite: typeof userConfig.vite === "function" ? userConfig.vite({}) : userConfig.vite || {}
926
1204
  };
927
1205
  assertPluginDependencies(resolved.plugins, resolved.integrations);
1206
+ if (nativeServerFnPlugin) {
1207
+ nativeServerFnAppDirs = (await import("./layers-T55SA47E.mjs")).getFarmAppDirectories(resolved);
1208
+ }
928
1209
  return resolved;
929
1210
  }
930
1211
  function formatConfigLoadError(error) {
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkDPJ66FSIcjs = require('./chunk-DPJ66FSI.cjs');
3
+ var _chunkXX32BOMMcjs = require('./chunk-XX32BOMM.cjs');
4
4
 
5
5
 
6
6
  var _chunkLT4VAF5Zcjs = require('./chunk-LT4VAF5Z.cjs');
@@ -273,7 +273,7 @@ function requestEvent(metadata, method, status, durationMs) {
273
273
  id: uuid(),
274
274
  requestId: metadata.id,
275
275
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
276
- route: routeTemplate(_chunkDPJ66FSIcjs.getFarmRouteLabel.call(void 0, metadata.route)),
276
+ route: routeTemplate(_chunkXX32BOMMcjs.getFarmRouteLabel.call(void 0, metadata.route)),
277
277
  agent: metadata.agent,
278
278
  kind: "request",
279
279
  method,
@@ -286,7 +286,7 @@ function toolEvent(metadata, event) {
286
286
  id: uuid(),
287
287
  requestId: metadata.id,
288
288
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
289
- route: routeTemplate(_chunkDPJ66FSIcjs.getFarmRouteLabel.call(void 0, metadata.route)),
289
+ route: routeTemplate(_chunkXX32BOMMcjs.getFarmRouteLabel.call(void 0, metadata.route)),
290
290
  agent: metadata.agent,
291
291
  kind: "mcp.tool",
292
292
  tool: event.tool,
@@ -4,13 +4,13 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk2IAPKPEBcjs = require('./chunk-2IAPKPEB.cjs');
7
+ var _chunkYN6BHOYYcjs = require('./chunk-YN6BHOYY.cjs');
8
8
 
9
9
 
10
10
  var _chunkMPU5DOXXcjs = require('./chunk-MPU5DOXX.cjs');
11
11
 
12
12
 
13
- var _chunkFK25QSVCcjs = require('./chunk-FK25QSVC.cjs');
13
+ var _chunk4P5634G6cjs = require('./chunk-4P5634G6.cjs');
14
14
 
15
15
 
16
16
 
@@ -32,7 +32,7 @@ function createServerQuery(options) {
32
32
  throw new TypeError("createServerQuery requires a key function");
33
33
  }
34
34
  const staleTime = normalizeServerQueryStaleTime(options.staleTime);
35
- const execute = _chunk2IAPKPEBcjs.createServerFn.call(void 0, {
35
+ const execute = _chunkYN6BHOYYcjs.createServerFn.call(void 0, {
36
36
  input: options.input,
37
37
  middleware: options.middleware,
38
38
  handler: async (context) => {
@@ -42,7 +42,7 @@ function createServerQuery(options) {
42
42
  const cacheKey = _chunkDXUXQP2Tcjs.createFarmCacheKey.call(void 0, ["route-data", routeKey]);
43
43
  const producer = async () => {
44
44
  const value = await options.handler(context);
45
- return _chunk2IAPKPEBcjs._parseServerFnSchema.call(void 0, options.output, value, "output", "createServerQuery");
45
+ return _chunkYN6BHOYYcjs._parseServerFnSchema.call(void 0, options.output, value, "output", "createServerQuery");
46
46
  };
47
47
  let data;
48
48
  let updatedAt;
@@ -67,7 +67,7 @@ function createServerQuery(options) {
67
67
  });
68
68
  const query = async (input) => {
69
69
  const result = await execute(input);
70
- return _chunkFK25QSVCcjs.getServerActionExecutionContext.call(void 0, ) ? result : result.data;
70
+ return _chunk4P5634G6cjs.getServerActionExecutionContext.call(void 0, ) ? result : result.data;
71
71
  };
72
72
  Object.defineProperties(query, {
73
73
  [FARM_SERVER_QUERY_SYMBOL]: {
@@ -87,10 +87,10 @@ function createServerQuery(options) {
87
87
  enumerable: false
88
88
  }
89
89
  });
90
- _chunk2IAPKPEBcjs._attachServerFunctionDescriptor.call(void 0,
90
+ _chunkYN6BHOYYcjs._attachServerFunctionDescriptor.call(void 0,
91
91
  query,
92
- _chunk2IAPKPEBcjs.createServerFunctionDescriptor.call(void 0, "query", options, async (value) => {
93
- const result = await _chunk2IAPKPEBcjs._runServerFunctionForCaller.call(void 0,
92
+ _chunkYN6BHOYYcjs.createServerFunctionDescriptor.call(void 0, "query", options, async (value) => {
93
+ const result = await _chunkYN6BHOYYcjs._runServerFunctionForCaller.call(void 0,
94
94
  execute,
95
95
  value
96
96
  );
@@ -20,7 +20,7 @@ var _chunkEVIWKPJVcjs = require('./chunk-EVIWKPJV.cjs');
20
20
  var _chunk2OF5RPVUcjs = require('./chunk-2OF5RPVU.cjs');
21
21
 
22
22
 
23
- var _chunkLIFUPCXWcjs = require('./chunk-LIFUPCXW.cjs');
23
+ var _chunkCFG4QERRcjs = require('./chunk-CFG4QERR.cjs');
24
24
 
25
25
 
26
26
  var _chunkA25FXJ7Dcjs = require('./chunk-A25FXJ7D.cjs');
@@ -240,7 +240,7 @@ function createHandledResponse(body, init, headers) {
240
240
  return new Response(body, { ...init, headers: responseHeaders });
241
241
  }
242
242
  function createWebMiddlewareContext(request, parent, trustProxy = false, clientAddress, toRoutePathname) {
243
- let currentRequest = _chunkLIFUPCXWcjs.withFarmRequestClientAddress.call(void 0, request, trustProxy, clientAddress);
243
+ let currentRequest = _chunkCFG4QERRcjs.withFarmRequestClientAddress.call(void 0, request, trustProxy, clientAddress);
244
244
  let handledResponse = null;
245
245
  const url = new URL(currentRequest.url);
246
246
  const data = _optionalChain([parent, 'optionalAccess', _3 => _3.data]) ? new Map(parent.data) : /* @__PURE__ */ new Map();
@@ -295,7 +295,7 @@ function createWebMiddlewareContext(request, parent, trustProxy = false, clientA
295
295
  rewrite(rewriteUrl) {
296
296
  ctx._rewriteUrl = rewriteUrl;
297
297
  const nextUrl = new URL(rewriteUrl, currentRequest.url);
298
- currentRequest = _chunkLIFUPCXWcjs.withFarmRequestClientAddress.call(void 0,
298
+ currentRequest = _chunkCFG4QERRcjs.withFarmRequestClientAddress.call(void 0,
299
299
  new Request(nextUrl, currentRequest),
300
300
  trustProxy,
301
301
  clientAddress
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkU4BJKNIRcjs = require('./chunk-U4BJKNIR.cjs');
4
+ var _chunk752XUZIMcjs = require('./chunk-752XUZIM.cjs');
5
5
 
6
6
 
7
7
  var _chunkSYW346ZNcjs = require('./chunk-SYW346ZN.cjs');
@@ -19,6 +19,9 @@ var _chunkGBMWLDCCcjs = require('./chunk-GBMWLDCC.cjs');
19
19
  var _chunkEZTKXD6Pcjs = require('./chunk-EZTKXD6P.cjs');
20
20
 
21
21
 
22
+ var _chunk4EBC7EMWcjs = require('./chunk-4EBC7EMW.cjs');
23
+
24
+
22
25
 
23
26
  var _chunkGSVJ3IIFcjs = require('./chunk-GSVJ3IIF.cjs');
24
27
 
@@ -799,7 +802,7 @@ async function generateFarmTypeArtifacts(options) {
799
802
  componentExtensions: options.componentExtensions,
800
803
  sourceRoots
801
804
  };
802
- unifiedSections.push(await _chunkU4BJKNIRcjs.createRouteTypeDeclarations.call(void 0, routeOptions, unifiedTypesPath));
805
+ unifiedSections.push(await _chunk752XUZIMcjs.createRouteTypeDeclarations.call(void 0, routeOptions, unifiedTypesPath));
803
806
  result.routeTypesPath = unifiedTypesPath;
804
807
  } else if (shouldGenerateRoutes) {
805
808
  const routeOptions = {
@@ -813,18 +816,20 @@ async function generateFarmTypeArtifacts(options) {
813
816
  };
814
817
  if (options.check) {
815
818
  const routeTypesPath = resolveGeneratedPath(root, srcDir, options.routeTypesOutFile);
816
- const content = await _chunkU4BJKNIRcjs.createRouteTypeDeclarations.call(void 0, routeOptions, routeTypesPath);
819
+ const content = await _chunk752XUZIMcjs.createRouteTypeDeclarations.call(void 0, routeOptions, routeTypesPath);
817
820
  checkGeneratedFile(routeTypesPath, content, result.stalePaths);
818
821
  result.routeTypesPath = routeTypesPath;
819
822
  } else {
820
- result.routeTypesPath = await _chunkU4BJKNIRcjs.generateRouteTypes.call(void 0, routeOptions);
823
+ result.routeTypesPath = await _chunk752XUZIMcjs.generateRouteTypes.call(void 0, routeOptions);
821
824
  }
822
825
  }
823
826
  if (shouldGenerateApi) {
824
827
  const generator = new (0, _chunkQISW423Scjs.APITypeGenerator)(appDirs);
825
828
  const apiRoutes = generator.scanAPIRoutes();
826
829
  const apiTypesPath = options.apiTypesOutFile ? _path.resolve.call(void 0, root, options.apiTypesOutFile) : _path.join.call(void 0, root, srcDir, "lib", "api.generated.ts");
827
- const pluginRoutes = _chunk5C7XMKQ4cjs.resolvePluginRoutes.call(void 0, options.plugins);
830
+ const pluginRoutes = _chunk5C7XMKQ4cjs.resolvePluginRoutes.call(void 0,
831
+ _optionalChain([options, 'access', _50 => _50.plugins, 'optionalAccess', _51 => _51.filter, 'call', _52 => _52((plugin) => plugin.name !== _chunk4EBC7EMWcjs.FARM_NATIVE_SERVER_FN_PLUGIN)])
832
+ );
828
833
  const configFiles = [
829
834
  ...(_nullishCoalesce(options.layers, () => ( []))).map((layer) => layer.configFile).filter((file) => Boolean(file)),
830
835
  options.configPath ? _path.resolve.call(void 0, root, options.configPath) : [
@@ -900,7 +905,7 @@ async function generateFarmTypeArtifacts(options) {
900
905
  });
901
906
  }
902
907
  }
903
- if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access', _50 => _50.i18nConfig, 'optionalAccess', _51 => _51.enabled]) && !options.i18nTypesOutFile) {
908
+ if (shouldRefreshUnifiedTypes && _optionalChain([options, 'access', _53 => _53.i18nConfig, 'optionalAccess', _54 => _54.enabled]) && !options.i18nTypesOutFile) {
904
909
  const { signatures } = await _chunkBBPDJGCUcjs.readFarmI18nCatalogs.call(void 0, options.i18nConfig);
905
910
  unifiedSections.push(renderFarmI18nTypes(options.i18nConfig.locales, signatures));
906
911
  result.i18nTypesPath = unifiedTypesPath;
@@ -928,7 +933,7 @@ async function generateFarmTypeArtifacts(options) {
928
933
  if (syncModelTypes) unifiedSections.push(syncModelTypes);
929
934
  }
930
935
  if (shouldRefreshUnifiedTypes && _fs.existsSync.call(void 0, _path.join.call(void 0, root, srcDir, "native"))) {
931
- const [{ scanFarmMobileAppModules }, { createFarmNativeModuleTypeDeclarations }] = await Promise.all([import("./modules-WT5D3AWY.cjs"), import("./native-specs-IQQRJOOW.cjs")]);
936
+ const [{ scanFarmMobileAppModules }, { createFarmNativeModuleTypeDeclarations }] = await Promise.all([import("./modules-QTP7WJPD.cjs"), import("./native-specs-5OLED4MM.cjs")]);
932
937
  const appModules = scanFarmMobileAppModules({ root, srcDir });
933
938
  const nativeTypes = appModules && createFarmNativeModuleTypeDeclarations(appModules.specs, { root });
934
939
  if (nativeTypes) unifiedSections.push(nativeTypes);
@@ -0,0 +1,115 @@
1
+ import {
2
+ _describeServerFunction,
3
+ _invokeServerFunction
4
+ } from "./chunk-QTD6EMN2.mjs";
5
+ import {
6
+ FARM_NATIVE_SERVER_FN_PATH,
7
+ FARM_NATIVE_SERVER_FN_PLUGIN
8
+ } from "./chunk-L4RTTTVE.mjs";
9
+ import {
10
+ DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT
11
+ } from "./chunk-E46NXBNJ.mjs";
12
+
13
+ // src/mobile/native-server-fn-handler.ts
14
+ var MOBILE_APP_HEADER = "x-farm-mobile";
15
+ var FETCH_METADATA = ["sec-fetch-site", "sec-fetch-mode", "sec-fetch-dest", "sec-fetch-user"];
16
+ var ID = /^[\w-]{1,64}$/;
17
+ var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
18
+ function hasUnsafeKey(value, depth = 0) {
19
+ if (depth > 64) return true;
20
+ if (Array.isArray(value)) return value.some((item) => hasUnsafeKey(item, depth + 1));
21
+ if (!value || typeof value !== "object") return false;
22
+ return Object.keys(value).some(
23
+ (key) => UNSAFE_KEYS.has(key) || hasUnsafeKey(value[key], depth + 1)
24
+ );
25
+ }
26
+ function json(status, body) {
27
+ return new Response(JSON.stringify(body), {
28
+ status,
29
+ headers: { "content-type": "application/json", "cache-control": "private, no-store" }
30
+ });
31
+ }
32
+ function refuse(status, code, message) {
33
+ return json(status, { error: { code, message } });
34
+ }
35
+ async function handleFarmNativeServerFnRequest(request, options, parsed) {
36
+ if (request.method !== "POST") {
37
+ return refuse(405, "method_not_allowed", "Call server functions with POST.");
38
+ }
39
+ const origin = request.headers.get("origin");
40
+ if (!request.headers.get(MOBILE_APP_HEADER) || FETCH_METADATA.some((name) => request.headers.has(name)) || origin !== null && origin !== new URL(request.url).origin) {
41
+ return refuse(403, "not_native", "Only the app's native screens call server functions here.");
42
+ }
43
+ const length = Number(request.headers.get("content-length") ?? "0");
44
+ if (length > DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT) {
45
+ return refuse(413, "body_too_large", "The call's input is too large.");
46
+ }
47
+ let call;
48
+ if (parsed !== void 0) call = parsed;
49
+ else {
50
+ const text = await request.text();
51
+ if (text.length > DEFAULT_SERVER_ACTION_BODY_SIZE_LIMIT) {
52
+ return refuse(413, "body_too_large", "The call's input is too large.");
53
+ }
54
+ try {
55
+ call = JSON.parse(text);
56
+ } catch {
57
+ return refuse(400, "invalid_body", 'Send { "id", "input" } as JSON.');
58
+ }
59
+ }
60
+ if (typeof call?.id !== "string" || !ID.test(call.id)) {
61
+ return refuse(400, "invalid_body", 'Send { "id", "input" } as JSON.');
62
+ }
63
+ if (hasUnsafeKey(call.input)) {
64
+ return refuse(400, "invalid_body", "The input has a key that is not allowed.");
65
+ }
66
+ const fn = await options.resolve(call.id);
67
+ if (fn === void 0 || _describeServerFunction(fn) === void 0) {
68
+ return refuse(
69
+ 404,
70
+ "unknown_function",
71
+ "No server function with this id is open to native screens."
72
+ );
73
+ }
74
+ const outcome = await _invokeServerFunction(fn, call.input, request);
75
+ if (outcome.ok) {
76
+ try {
77
+ return json(200, { data: outcome.data ?? null });
78
+ } catch (error) {
79
+ console.error("[Farm] A server function's result for a native screen is not JSON:", error);
80
+ return refuse(500, "server_error", "Server function failed");
81
+ }
82
+ }
83
+ switch (outcome.reason) {
84
+ case "input":
85
+ return refuse(
86
+ 400,
87
+ "invalid_input",
88
+ outcome.error instanceof Error ? outcome.error.message : "The input is invalid."
89
+ );
90
+ case "failure": {
91
+ const { code, status, message, data } = outcome.failure;
92
+ return json(status, { error: { code, status, message, data } });
93
+ }
94
+ case "redirect":
95
+ return json(200, { redirect: { url: outcome.url, status: outcome.status } });
96
+ default:
97
+ console.error("[Farm] A server function called from a native screen failed:", outcome.error);
98
+ return refuse(500, "server_error", "Server function failed");
99
+ }
100
+ }
101
+ function createFarmNativeServerFnPlugin(options) {
102
+ return {
103
+ name: FARM_NATIVE_SERVER_FN_PLUGIN,
104
+ routes: ({ route }) => [
105
+ route.post(FARM_NATIVE_SERVER_FN_PATH, {
106
+ handler: (request, { input }) => handleFarmNativeServerFnRequest(request, options, input.body)
107
+ })
108
+ ]
109
+ };
110
+ }
111
+
112
+ export {
113
+ handleFarmNativeServerFnRequest,
114
+ createFarmNativeServerFnPlugin
115
+ };