@farm.js/core 0.1.26 → 0.1.28

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 (231) hide show
  1. package/dist/agent-runtime.d.mts +8 -9
  2. package/dist/agent-runtime.d.ts +8 -9
  3. package/dist/api/client.cjs +5 -7
  4. package/dist/api/client.d.mts +5 -5
  5. package/dist/api/client.d.ts +5 -5
  6. package/dist/api/client.mjs +4 -6
  7. package/dist/api/route-manager.cjs +12 -10
  8. package/dist/api/route-manager.d.mts +7 -8
  9. package/dist/api/route-manager.d.ts +7 -8
  10. package/dist/api/route-manager.mjs +11 -9
  11. package/dist/api/runtime.cjs +15 -8
  12. package/dist/api/runtime.d.mts +36 -3
  13. package/dist/api/runtime.d.ts +36 -3
  14. package/dist/api/runtime.mjs +14 -7
  15. package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
  16. package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
  17. package/dist/api.cjs +16 -14
  18. package/dist/api.d.mts +9 -10
  19. package/dist/api.d.ts +9 -10
  20. package/dist/api.mjs +16 -14
  21. package/dist/{app-29vG5tmY.d.mts → app-DSSq6wiN.d.mts} +3 -4
  22. package/dist/{app-Cx71s_PT.d.ts → app-M8nVWvNU.d.ts} +3 -4
  23. package/dist/app-markdown.cjs +10 -4
  24. package/dist/app-markdown.d.mts +9 -10
  25. package/dist/app-markdown.d.ts +9 -10
  26. package/dist/app-markdown.mjs +9 -3
  27. package/dist/cache-invalidation-BD0z_lfu.d.mts +4 -0
  28. package/dist/cache-invalidation-BD0z_lfu.d.ts +4 -0
  29. package/dist/cache.cjs +6 -4
  30. package/dist/cache.d.mts +11 -6
  31. package/dist/cache.d.ts +11 -6
  32. package/dist/cache.mjs +7 -5
  33. package/dist/{chunk-OFKG57MZ.mjs → chunk-2CNBR3EB.mjs} +2 -2
  34. package/dist/{chunk-JM5GQL4H.mjs → chunk-2DLN6HG4.mjs} +1 -1
  35. package/dist/{chunk-UUYF3CHN.mjs → chunk-2N5PX3LS.mjs} +2 -2
  36. package/dist/{chunk-H6G5INWM.cjs → chunk-2SDO73HK.cjs} +14 -156
  37. package/dist/{chunk-3TQWUUNP.cjs → chunk-3LUF2PE2.cjs} +10 -5
  38. package/dist/{chunk-SYGGPS4A.mjs → chunk-4IEPYMHF.mjs} +3 -3
  39. package/dist/{chunk-WD5PNSOB.mjs → chunk-4V7GIE2U.mjs} +6 -4
  40. package/dist/{chunk-2CT6XUNO.cjs → chunk-55ZY4ZA7.cjs} +4 -4
  41. package/dist/chunk-5MKEDGLD.cjs +53 -0
  42. package/dist/{chunk-I7PUUDGY.cjs → chunk-63H6BKXG.cjs} +2 -2
  43. package/dist/{chunk-FG5H2VCJ.mjs → chunk-6ZCMSZ5U.mjs} +2 -2
  44. package/dist/{chunk-ZMN3H73H.cjs → chunk-75DYEVXI.cjs} +13 -11
  45. package/dist/{chunk-QJ4D3UKJ.cjs → chunk-A672WZEG.cjs} +4 -4
  46. package/dist/{chunk-IXTFU4PL.cjs → chunk-BJPBQNIE.cjs} +14 -14
  47. package/dist/{chunk-QGG336NI.mjs → chunk-BXFWA23T.mjs} +2 -2
  48. package/dist/chunk-CNOQY6Z7.mjs +156 -0
  49. package/dist/{chunk-DW34V5SM.cjs → chunk-CTV2TTNP.cjs} +4 -4
  50. package/dist/{chunk-OAVTUMJP.cjs → chunk-D4JE5NNV.cjs} +12 -12
  51. package/dist/{chunk-KLSSO6YD.mjs → chunk-E76XC6ZG.mjs} +2 -2
  52. package/dist/{chunk-G3HRIVEY.cjs → chunk-ES4B2IXW.cjs} +2 -2
  53. package/dist/{chunk-W2HZKYES.cjs → chunk-EWZ3XHKQ.cjs} +2 -2
  54. package/dist/{chunk-BD2U4ZL6.cjs → chunk-EXLKRR4U.cjs} +10 -10
  55. package/dist/{chunk-SZ4LYNUX.cjs → chunk-F52CDFJM.cjs} +89 -83
  56. package/dist/{chunk-ARXCHQLX.mjs → chunk-FB3H4INL.mjs} +4 -4
  57. package/dist/{chunk-QPPQHB6X.mjs → chunk-FVCSLZWT.mjs} +19 -13
  58. package/dist/{chunk-WD4YXVLV.mjs → chunk-GZYH4OER.mjs} +1 -1
  59. package/dist/{chunk-DX4VKYAJ.cjs → chunk-I26CZYPV.cjs} +6 -4
  60. package/dist/{chunk-3TQG7CGC.cjs → chunk-ID6OVSLH.cjs} +164 -129
  61. package/dist/{chunk-F6SJAKFJ.mjs → chunk-IV6CQY7O.mjs} +12 -154
  62. package/dist/{chunk-6D242YGO.mjs → chunk-JATSG2ZO.mjs} +1 -1
  63. package/dist/{chunk-U74A3P2P.cjs → chunk-JLRDISQL.cjs} +7 -7
  64. package/dist/{chunk-H7CJRJ4L.cjs → chunk-JUFRXDTK.cjs} +18 -18
  65. package/dist/{chunk-OOIL3BWR.mjs → chunk-K3YEZLSY.mjs} +65 -8
  66. package/dist/{chunk-Y4YWHNKU.cjs → chunk-KH7BN726.cjs} +9 -9
  67. package/dist/{chunk-WFPRVVF2.cjs → chunk-KOQ555NR.cjs} +22 -14
  68. package/dist/{chunk-VZWO3XVL.mjs → chunk-KXGDXYUC.mjs} +3 -3
  69. package/dist/{chunk-3IL5UC5I.cjs → chunk-KZLND3D2.cjs} +2 -2
  70. package/dist/{chunk-QLXEYIAW.cjs → chunk-MH24QDVJ.cjs} +13 -13
  71. package/dist/{chunk-TKDY6AJP.mjs → chunk-MKMBQSNQ.mjs} +1 -1
  72. package/dist/{chunk-OCE65DDM.mjs → chunk-MNUGPHLN.mjs} +1 -1
  73. package/dist/{chunk-74RZNRY6.mjs → chunk-NVBS5WSZ.mjs} +1 -1
  74. package/dist/chunk-NYJMY3JA.cjs +156 -0
  75. package/dist/{chunk-VVJCWBIE.mjs → chunk-O3DTUAX2.mjs} +2 -2
  76. package/dist/chunk-O6XNAMBV.mjs +53 -0
  77. package/dist/{chunk-YAOX43YI.cjs → chunk-PZNCMPJF.cjs} +5 -5
  78. package/dist/{chunk-YMUH2BLR.mjs → chunk-PZPDGOU5.mjs} +14 -6
  79. package/dist/{chunk-52SH7TKB.mjs → chunk-QG5HNS7P.mjs} +2 -2
  80. package/dist/{chunk-CEYUWDWA.mjs → chunk-QZCT2CQ4.mjs} +10 -5
  81. package/dist/{chunk-RAI7NULA.mjs → chunk-REGFZJEJ.mjs} +1 -1
  82. package/dist/{chunk-QMV4QELL.mjs → chunk-S5GDHOE4.mjs} +4 -2
  83. package/dist/{chunk-CRQPYWLK.cjs → chunk-SORB3MAR.cjs} +14 -14
  84. package/dist/{chunk-DU2CASV6.mjs → chunk-T7HQ3I4C.mjs} +1 -1
  85. package/dist/{chunk-RCYINC4A.cjs → chunk-TII23GJC.cjs} +3 -3
  86. package/dist/{chunk-PPIW3MH6.mjs → chunk-UX2DD2VK.mjs} +1 -1
  87. package/dist/{chunk-I4J452B7.cjs → chunk-VHJGDMCG.cjs} +3 -3
  88. package/dist/{chunk-3WSWXPYM.cjs → chunk-VQXDC5UV.cjs} +4 -4
  89. package/dist/{chunk-B6ZCT36X.cjs → chunk-WNLBF77X.cjs} +4 -4
  90. package/dist/{chunk-GDUYXFIS.mjs → chunk-X7WVQMIB.mjs} +4 -4
  91. package/dist/{chunk-5SPPCN5J.mjs → chunk-XNPDONUH.mjs} +1 -1
  92. package/dist/{chunk-QIH2HD6H.cjs → chunk-XSPGWQWA.cjs} +86 -29
  93. package/dist/{chunk-ALIFMS4A.cjs → chunk-Y7GW7J46.cjs} +1 -1
  94. package/dist/{chunk-L6V3P73N.mjs → chunk-YDQZGSDS.mjs} +5 -5
  95. package/dist/{chunk-C3VRMB6H.cjs → chunk-ZCU4NZ3M.cjs} +6 -6
  96. package/dist/{chunk-UXQXGB5A.mjs → chunk-ZRIE4KMG.mjs} +63 -28
  97. package/dist/{client-plugins-B8RPJnot.d.mts → client-plugins-CgYNY7jF.d.mts} +1656 -1477
  98. package/dist/{client-plugins-bPBf4haK.d.ts → client-plugins-Fl9Og3yB.d.ts} +1656 -1477
  99. package/dist/client-plugins.d.mts +8 -9
  100. package/dist/client-plugins.d.ts +8 -9
  101. package/dist/client.cjs +12 -13
  102. package/dist/client.d.mts +10 -11
  103. package/dist/client.d.ts +10 -11
  104. package/dist/client.mjs +11 -12
  105. package/dist/config.d.mts +8 -9
  106. package/dist/config.d.ts +8 -9
  107. package/dist/{devtools-5D4ZDRPR.mjs → devtools-3E7ZANMZ.mjs} +7 -4
  108. package/dist/{devtools-QZJEUOJW.cjs → devtools-5AREISIA.cjs} +8 -5
  109. package/dist/docs.cjs +10 -7
  110. package/dist/docs.mjs +9 -6
  111. package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
  112. package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
  113. package/dist/index.cjs +58 -55
  114. package/dist/index.d.mts +17 -18
  115. package/dist/index.d.ts +17 -18
  116. package/dist/index.mjs +69 -66
  117. package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
  118. package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
  119. package/dist/integrations.d.mts +8 -9
  120. package/dist/integrations.d.ts +8 -9
  121. package/dist/internal/app-markdown-runtime.cjs +9 -3
  122. package/dist/internal/app-markdown-runtime.d.mts +9 -9
  123. package/dist/internal/app-markdown-runtime.d.ts +9 -9
  124. package/dist/internal/app-markdown-runtime.mjs +8 -2
  125. package/dist/internal/build-runtime.cjs +26 -24
  126. package/dist/internal/build-runtime.d.mts +10 -11
  127. package/dist/internal/build-runtime.d.ts +10 -11
  128. package/dist/internal/build-runtime.mjs +25 -23
  129. package/dist/internal/cli-runtime.cjs +16 -12
  130. package/dist/internal/cli-runtime.mjs +15 -11
  131. package/dist/internal/client-error-overlay.cjs +4 -4
  132. package/dist/internal/client-error-overlay.mjs +1 -1
  133. package/dist/internal/client-runtime.cjs +5 -1
  134. package/dist/internal/client-runtime.d.mts +1 -0
  135. package/dist/internal/client-runtime.d.ts +1 -0
  136. package/dist/internal/client-runtime.mjs +4 -0
  137. package/dist/internal/compression-runtime.d.mts +8 -9
  138. package/dist/internal/compression-runtime.d.ts +8 -9
  139. package/dist/internal/config-runtime.cjs +8 -5
  140. package/dist/internal/config-runtime.d.mts +9 -10
  141. package/dist/internal/config-runtime.d.ts +9 -10
  142. package/dist/internal/config-runtime.mjs +7 -4
  143. package/dist/internal/product-telemetry-runtime.cjs +2 -2
  144. package/dist/internal/product-telemetry-runtime.mjs +1 -1
  145. package/dist/internal/production-runtime.cjs +20 -16
  146. package/dist/internal/production-runtime.d.mts +13 -14
  147. package/dist/internal/production-runtime.d.ts +13 -14
  148. package/dist/internal/production-runtime.mjs +20 -16
  149. package/dist/markdown.cjs +8 -2
  150. package/dist/markdown.d.mts +36 -153
  151. package/dist/markdown.d.ts +36 -153
  152. package/dist/markdown.mjs +7 -1
  153. package/dist/{metadata-C3na4CBj.d.mts → metadata-B0X-qtcQ.d.mts} +1 -1
  154. package/dist/{metadata-CzBP4Mfp.d.ts → metadata-BdDKgd7K.d.ts} +1 -1
  155. package/dist/middleware.cjs +4 -4
  156. package/dist/middleware.d.mts +9 -10
  157. package/dist/middleware.d.ts +9 -10
  158. package/dist/middleware.mjs +3 -3
  159. package/dist/navigation.cjs +5 -5
  160. package/dist/navigation.d.mts +10 -11
  161. package/dist/navigation.d.ts +10 -11
  162. package/dist/navigation.mjs +4 -4
  163. package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
  164. package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
  165. package/dist/plugin.cjs +26 -21
  166. package/dist/plugin.d.mts +9 -10
  167. package/dist/plugin.d.ts +9 -10
  168. package/dist/plugin.mjs +26 -21
  169. package/dist/{production-runtime-DP94hPGe.d.mts → production-runtime-BjgFgDIg.d.mts} +1 -1
  170. package/dist/{production-runtime-CYg4wM4E.d.ts → production-runtime-Dx_qMA3t.d.ts} +1 -1
  171. package/dist/query/client.cjs +6 -6
  172. package/dist/query/client.mjs +2 -2
  173. package/dist/{render-plan-Bl6Fzg5z.d.ts → render-plan-B41EWmBb.d.ts} +1 -1
  174. package/dist/{render-plan-CKAJg0jC.d.mts → render-plan-_1TAWODt.d.mts} +1 -1
  175. package/dist/renderer-client.cjs +13 -14
  176. package/dist/renderer-client.d.mts +6 -7
  177. package/dist/renderer-client.d.ts +6 -7
  178. package/dist/renderer-client.mjs +6 -7
  179. package/dist/{request-CrBCcPZZ.d.mts → request-BhE4luLv.d.mts} +1 -1
  180. package/dist/{request-CR-Bp1Px.d.ts → request-Dbf3G0zM.d.ts} +1 -1
  181. package/dist/request.d.mts +9 -10
  182. package/dist/request.d.ts +9 -10
  183. package/dist/{route-rendering-CZH5FegB.d.ts → route-rendering-Z7PveTZE.d.ts} +1 -1
  184. package/dist/{route-rendering-C1NAHo-C.d.mts → route-rendering-zzfx_GHf.d.mts} +1 -1
  185. package/dist/{router-B57eDJ3u.d.mts → router-BatNMsa1.d.mts} +1 -1
  186. package/dist/{router-Cg_kD3Bd.d.ts → router-DtNRhQl3.d.ts} +1 -1
  187. package/dist/routes.cjs +6 -5
  188. package/dist/routes.d.mts +6 -7
  189. package/dist/routes.d.ts +6 -7
  190. package/dist/routes.mjs +5 -4
  191. package/dist/server-fn-client.d.mts +4 -4
  192. package/dist/server-fn-client.d.ts +4 -4
  193. package/dist/server-fn.cjs +6 -5
  194. package/dist/server-fn.d.mts +2 -1
  195. package/dist/server-fn.d.ts +2 -1
  196. package/dist/server-fn.mjs +5 -4
  197. package/dist/server-plugins.d.mts +8 -9
  198. package/dist/server-plugins.d.ts +8 -9
  199. package/dist/server-query-client.cjs +5 -7
  200. package/dist/server-query-client.d.mts +2 -1
  201. package/dist/server-query-client.d.ts +2 -1
  202. package/dist/server-query-client.mjs +4 -6
  203. package/dist/server-query.cjs +7 -6
  204. package/dist/server-query.d.mts +2 -1
  205. package/dist/server-query.d.ts +2 -1
  206. package/dist/server-query.mjs +6 -5
  207. package/dist/server.cjs +235 -131
  208. package/dist/server.d.mts +14 -15
  209. package/dist/server.d.ts +14 -15
  210. package/dist/server.mjs +222 -118
  211. package/dist/{spa-router-BstQUO6Q.d.ts → spa-router-BE3bwU-J.d.ts} +2 -2
  212. package/dist/{spa-router-DTdbuinx.d.mts → spa-router-DQOnHZVj.d.mts} +2 -2
  213. package/dist/testing.cjs +17 -15
  214. package/dist/testing.d.mts +7 -8
  215. package/dist/testing.d.ts +7 -8
  216. package/dist/testing.mjs +14 -12
  217. package/dist/{utils-CS3ZLnEJ.d.mts → utils-DLK1ERNl.d.mts} +1 -1
  218. package/dist/{utils-D3rdsIvM.d.ts → utils-u7ZBSWAK.d.ts} +1 -1
  219. package/dist/version.cjs +2 -2
  220. package/dist/version.mjs +1 -1
  221. package/dist/vite.cjs +22 -20
  222. package/dist/vite.d.mts +8 -9
  223. package/dist/vite.d.ts +8 -9
  224. package/dist/vite.mjs +21 -19
  225. package/package.json +1 -1
  226. package/dist/route-B0XrsrFk.d.mts +0 -128
  227. package/dist/route-DOEpbyWZ.d.ts +0 -128
  228. package/dist/{chunk-YOYF2E4U.mjs → chunk-LNZ7JZUS.mjs} +0 -0
  229. package/dist/{chunk-N4RLRSWW.cjs → chunk-SUIBNSNO.cjs} +0 -0
  230. package/dist/{chunk-TIKNUAU7.mjs → chunk-VUMAE7NC.mjs} +3 -3
  231. package/dist/{chunk-WM6HL7E7.cjs → chunk-ZHVYQL3H.cjs} +2 -2
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-S67OYZU7.mjs";
7
7
  import {
8
8
  build
9
- } from "./chunk-QPPQHB6X.mjs";
9
+ } from "./chunk-FVCSLZWT.mjs";
10
10
  import "./chunk-S3FNNQHR.mjs";
11
11
  import "./chunk-655RLQQL.mjs";
12
12
  import {
@@ -27,7 +27,7 @@ import {
27
27
  createFarmDocsAdapterHandler,
28
28
  hasFarmDocsRuntimeAdapter,
29
29
  isFarmDocsAPIRequest
30
- } from "./chunk-OFKG57MZ.mjs";
30
+ } from "./chunk-2CNBR3EB.mjs";
31
31
  import {
32
32
  createFarmDocsHandler,
33
33
  discoverFarmDocsPages,
@@ -36,13 +36,13 @@ import {
36
36
  isFarmDocsRequest,
37
37
  loadFarmDocsPage,
38
38
  resolveFarmDocsContentDir
39
- } from "./chunk-DU2CASV6.mjs";
39
+ } from "./chunk-T7HQ3I4C.mjs";
40
40
  import "./chunk-UP4CW6WP.mjs";
41
41
  import "./chunk-TFQG7TBC.mjs";
42
42
  import {
43
43
  usePathname,
44
44
  useSearchParams
45
- } from "./chunk-52SH7TKB.mjs";
45
+ } from "./chunk-QG5HNS7P.mjs";
46
46
  import {
47
47
  cookies,
48
48
  headers
@@ -63,7 +63,7 @@ import {
63
63
  parseProgrammaticRoutePath,
64
64
  routesBuilder,
65
65
  scanProgrammaticPagePaths
66
- } from "./chunk-QMV4QELL.mjs";
66
+ } from "./chunk-S5GDHOE4.mjs";
67
67
  import "./chunk-UCNPVBE7.mjs";
68
68
  import {
69
69
  loadRouteParams,
@@ -89,7 +89,7 @@ import {
89
89
  memoryRateLimitStorage,
90
90
  middleware,
91
91
  unwrapMiddleware
92
- } from "./chunk-OCE65DDM.mjs";
92
+ } from "./chunk-MNUGPHLN.mjs";
93
93
  import {
94
94
  applyProductionMiddlewareHeaders,
95
95
  createProductionMiddlewareRunner,
@@ -97,7 +97,7 @@ import {
97
97
  } from "./chunk-N6UROPT7.mjs";
98
98
  import {
99
99
  farmApiPlugin
100
- } from "./chunk-VZWO3XVL.mjs";
100
+ } from "./chunk-KXGDXYUC.mjs";
101
101
  import "./chunk-MM5D6VLP.mjs";
102
102
  import {
103
103
  FarmEnvironmentError,
@@ -108,7 +108,7 @@ import {
108
108
  import {
109
109
  FARM_SERVER_QUERY_SYMBOL,
110
110
  createServerQuery
111
- } from "./chunk-WD5PNSOB.mjs";
111
+ } from "./chunk-4V7GIE2U.mjs";
112
112
  import {
113
113
  FARM_SERVER_FN_SYMBOL,
114
114
  _attachServerFunctionDescriptor,
@@ -119,7 +119,7 @@ import {
119
119
  createServerFn,
120
120
  createServerFunctionDescriptor,
121
121
  createServerMiddleware
122
- } from "./chunk-WD4YXVLV.mjs";
122
+ } from "./chunk-GZYH4OER.mjs";
123
123
  import "./chunk-2VQKKQ6D.mjs";
124
124
  import {
125
125
  getDeployTargetForPreset,
@@ -130,7 +130,7 @@ import {
130
130
  resolveDeployConfig,
131
131
  resolveDeployOutputPath,
132
132
  resolveMigrationsConfig
133
- } from "./chunk-YMUH2BLR.mjs";
133
+ } from "./chunk-PZPDGOU5.mjs";
134
134
  import {
135
135
  defineConfig,
136
136
  defineFarmConfig
@@ -153,7 +153,7 @@ import {
153
153
  storageClientCacheAdapter,
154
154
  useFetcher,
155
155
  useMutation
156
- } from "./chunk-KLSSO6YD.mjs";
156
+ } from "./chunk-E76XC6ZG.mjs";
157
157
  import {
158
158
  installChunkErrorRecovery,
159
159
  isChunkLoadError
@@ -164,14 +164,14 @@ import {
164
164
  } from "./chunk-SHB3GYXI.mjs";
165
165
  import {
166
166
  useServerQuery
167
- } from "./chunk-FG5H2VCJ.mjs";
167
+ } from "./chunk-6ZCMSZ5U.mjs";
168
168
  import {
169
169
  useBlocker,
170
170
  useNavigation,
171
171
  usePageState,
172
172
  useRouter,
173
173
  useScrollRestoration
174
- } from "./chunk-TKDY6AJP.mjs";
174
+ } from "./chunk-MKMBQSNQ.mjs";
175
175
  import {
176
176
  useTheme
177
177
  } from "./chunk-BJIYRUGQ.mjs";
@@ -197,7 +197,7 @@ import {
197
197
  isAPIRouteRef,
198
198
  resolveServerFnInvalidateTargets,
199
199
  settleServerFnOptimisticUpdates
200
- } from "./chunk-L6V3P73N.mjs";
200
+ } from "./chunk-YDQZGSDS.mjs";
201
201
  import "./chunk-72AK62H5.mjs";
202
202
  import {
203
203
  beginFarmServerQueryAction,
@@ -205,7 +205,7 @@ import {
205
205
  fetchServerQuery,
206
206
  prefetchServerQuery,
207
207
  shouldApplyFarmServerQueryActionResult
208
- } from "./chunk-UUYF3CHN.mjs";
208
+ } from "./chunk-2N5PX3LS.mjs";
209
209
  import {
210
210
  getTheme,
211
211
  setTheme,
@@ -226,14 +226,14 @@ import {
226
226
  pushState,
227
227
  readPageState,
228
228
  replaceState
229
- } from "./chunk-6D242YGO.mjs";
229
+ } from "./chunk-JATSG2ZO.mjs";
230
230
  import "./chunk-TOVMYGYW.mjs";
231
231
  import "./chunk-2PQNJXFM.mjs";
232
232
  import "./chunk-5HGR3W6O.mjs";
233
233
  import {
234
234
  getFarmClientDataCache,
235
235
  normalizeFarmClientCacheKey
236
- } from "./chunk-5SPPCN5J.mjs";
236
+ } from "./chunk-XNPDONUH.mjs";
237
237
  import "./chunk-QVYLBY73.mjs";
238
238
  import "./chunk-KGB5UXJJ.mjs";
239
239
  import {
@@ -246,7 +246,7 @@ import {
246
246
  PluginManager,
247
247
  createFarmApp,
248
248
  definePlugin
249
- } from "./chunk-UXQXGB5A.mjs";
249
+ } from "./chunk-ZRIE4KMG.mjs";
250
250
  import {
251
251
  analyzeStaticRouteCandidate,
252
252
  collectSSGPages,
@@ -265,7 +265,7 @@ import {
265
265
  parseRouteRenderingDirective,
266
266
  resolveRouteRenderingConfig,
267
267
  resolveRouteRenderingConfigFromFile
268
- } from "./chunk-VVJCWBIE.mjs";
268
+ } from "./chunk-O3DTUAX2.mjs";
269
269
  import {
270
270
  FARM_SCHEMA_STATE_TABLE,
271
271
  FARM_SCHEMA_STEPS_TABLE,
@@ -305,7 +305,7 @@ import {
305
305
  import {
306
306
  APITypeGenerator
307
307
  } from "./chunk-F3VB7ONA.mjs";
308
- import "./chunk-ARXCHQLX.mjs";
308
+ import "./chunk-FB3H4INL.mjs";
309
309
  import "./chunk-DAO7JGTS.mjs";
310
310
  import "./chunk-BOYNDCZL.mjs";
311
311
  import "./chunk-YQVSHTMR.mjs";
@@ -353,7 +353,7 @@ import {
353
353
  REACT_RENDERER,
354
354
  defineRenderer
355
355
  } from "./chunk-DAATZTKJ.mjs";
356
- import "./chunk-RAI7NULA.mjs";
356
+ import "./chunk-REGFZJEJ.mjs";
357
357
  import "./chunk-G2KY33I6.mjs";
358
358
  import {
359
359
  DEFAULT_FARM_CRON_SECRET_ENV,
@@ -401,7 +401,7 @@ import {
401
401
  import {
402
402
  createFarmMarkdownRouteModuleFromFile,
403
403
  loadFarmMdxComponents
404
- } from "./chunk-74RZNRY6.mjs";
404
+ } from "./chunk-NVBS5WSZ.mjs";
405
405
  import {
406
406
  createFarmMarkdownRouteModule,
407
407
  createFarmMarkdownSourceResponse,
@@ -410,7 +410,7 @@ import {
410
410
  normalizeFarmMarkdownRoutePath,
411
411
  parseMarkdownFrontmatter,
412
412
  titleFromMarkdown
413
- } from "./chunk-JM5GQL4H.mjs";
413
+ } from "./chunk-2DLN6HG4.mjs";
414
414
  import {
415
415
  resolveFarmMdxComponentsModulePath,
416
416
  resolveMdxConfig
@@ -431,7 +431,7 @@ import {
431
431
  requestAcceptsMarkdown,
432
432
  resolveMarkdownConfig,
433
433
  resolveMarkdownMirrorTarget
434
- } from "./chunk-OOIL3BWR.mjs";
434
+ } from "./chunk-K3YEZLSY.mjs";
435
435
  import {
436
436
  classifyFarmAgent
437
437
  } from "./chunk-MVL2RAJW.mjs";
@@ -520,7 +520,7 @@ import {
520
520
  import {
521
521
  MiddlewareManager,
522
522
  createContext
523
- } from "./chunk-TIKNUAU7.mjs";
523
+ } from "./chunk-VUMAE7NC.mjs";
524
524
  import {
525
525
  _runWithMiddlewareContext,
526
526
  _runWithMiddlewareData,
@@ -539,8 +539,8 @@ import {
539
539
  import {
540
540
  APIRouteConflictError,
541
541
  APIRouteManager
542
- } from "./chunk-QGG336NI.mjs";
543
- import "./chunk-YOYF2E4U.mjs";
542
+ } from "./chunk-BXFWA23T.mjs";
543
+ import "./chunk-LNZ7JZUS.mjs";
544
544
  import "./chunk-CU625VAY.mjs";
545
545
  import "./chunk-JNGIWIY6.mjs";
546
546
  import "./chunk-FV45CKBC.mjs";
@@ -552,7 +552,7 @@ import {
552
552
  isWebResponse,
553
553
  normalizeRouteResponse,
554
554
  resolveAPIRouteEndpoint
555
- } from "./chunk-GDUYXFIS.mjs";
555
+ } from "./chunk-X7WVQMIB.mjs";
556
556
  import {
557
557
  DELETE,
558
558
  EndpointFailure,
@@ -567,12 +567,13 @@ import {
567
567
  createRouteFactory,
568
568
  isEndpointFailure,
569
569
  resolvePluginRoutes
570
- } from "./chunk-SYGGPS4A.mjs";
570
+ } from "./chunk-4IEPYMHF.mjs";
571
571
  import "./chunk-W3B4PKAW.mjs";
572
+ import "./chunk-5WI2S4CO.mjs";
573
+ import "./chunk-O6XNAMBV.mjs";
572
574
  import {
573
575
  resolveFarmAPIServerBasePath
574
576
  } from "./chunk-I6XDAKWQ.mjs";
575
- import "./chunk-5WI2S4CO.mjs";
576
577
  import "./chunk-EA5K5BKU.mjs";
577
578
  import {
578
579
  createFarmRouteRuntimeKey,
@@ -584,6 +585,24 @@ import {
584
585
  resolveFarmRouteRuleRuntimeConfig,
585
586
  resolveFarmRouteRuntimeConfig
586
587
  } from "./chunk-2J7W2WND.mjs";
588
+ import {
589
+ FarmDataCache,
590
+ applyFarmCacheInvalidationTargets,
591
+ configureFarmCache,
592
+ createFarmCacheInvalidationStream,
593
+ createPathCacheTag,
594
+ createRouteDataCacheTag,
595
+ defineCacheKey,
596
+ getFarmDataCache,
597
+ invalidate,
598
+ invalidateRouteData,
599
+ normalizeRevalidatePath,
600
+ revalidatePath,
601
+ revalidateTag,
602
+ storageCacheAdapter,
603
+ unstable_cache,
604
+ updateTag
605
+ } from "./chunk-IV6CQY7O.mjs";
587
606
  import "./chunk-XF7Q24PF.mjs";
588
607
  import "./chunk-I2BHUNBU.mjs";
589
608
  import "./chunk-43FMW62B.mjs";
@@ -606,8 +625,20 @@ import {
606
625
  toViteModuleId
607
626
  } from "./chunk-KI3MESHB.mjs";
608
627
  import "./chunk-QVKYGNVM.mjs";
628
+ import {
629
+ configureFarmObservability,
630
+ configureFarmTracing,
631
+ emitFarmEvent,
632
+ getFarmTraceContext,
633
+ normalizeFarmObservabilityConfig,
634
+ normalizeFarmTracingConfig,
635
+ onFarmEvent,
636
+ resetFarmObservability,
637
+ runWithFarmRequestSpan,
638
+ runWithFarmSpan
639
+ } from "./chunk-FUZEBRP3.mjs";
609
640
  import "./chunk-Z2RZJZIZ.mjs";
610
- import "./chunk-PPIW3MH6.mjs";
641
+ import "./chunk-UX2DD2VK.mjs";
611
642
  import "./chunk-54UPOYFS.mjs";
612
643
  import "./chunk-WNSDDRNU.mjs";
613
644
  import {
@@ -617,9 +648,6 @@ import {
617
648
  endpoint
618
649
  } from "./chunk-JPLUGGRV.mjs";
619
650
  import "./chunk-G4MWPDSE.mjs";
620
- import {
621
- matchAPIRoute
622
- } from "./chunk-O7BH5O46.mjs";
623
651
  import {
624
652
  isFarmAPIStream,
625
653
  isJSONStreamResponse,
@@ -629,6 +657,9 @@ import {
629
657
  readJSONStream,
630
658
  toFormData
631
659
  } from "./chunk-EMLAPBEM.mjs";
660
+ import {
661
+ matchAPIRoute
662
+ } from "./chunk-O7BH5O46.mjs";
632
663
  import {
633
664
  DEFAULT_FARM_API_BASE_PATH,
634
665
  getFarmAPIBaseURL,
@@ -638,7 +669,7 @@ import {
638
669
  resolveFarmAPIRequestURL
639
670
  } from "./chunk-7LTCDQRS.mjs";
640
671
  import "./chunk-IXUY2F5U.mjs";
641
- import "./chunk-CEYUWDWA.mjs";
672
+ import "./chunk-QZCT2CQ4.mjs";
642
673
  import "./chunk-SKNL7VA2.mjs";
643
674
  import {
644
675
  FARM_DEPLOYMENT_COOKIE,
@@ -672,42 +703,14 @@ import {
672
703
  reviveDeferredData,
673
704
  snapshotDeferredData
674
705
  } from "./chunk-JNZ4TDWM.mjs";
706
+ import "./chunk-C4NCTZLM.mjs";
675
707
  import {
676
- FarmDataCache,
677
- applyFarmCacheInvalidationTargets,
678
- configureFarmCache,
679
- createFarmCacheInvalidationStream,
680
708
  createFarmCacheKey,
681
- createPathCacheTag,
682
- createRouteDataCacheKey,
683
- createRouteDataCacheTag,
684
- defineCacheKey,
685
- getFarmDataCache,
686
- invalidate,
687
- invalidateRouteData,
688
- normalizeRevalidatePath,
689
- revalidatePath,
690
- revalidateTag,
691
- storageCacheAdapter,
692
- unstable_cache,
693
- updateTag
694
- } from "./chunk-F6SJAKFJ.mjs";
709
+ createRouteDataCacheKey
710
+ } from "./chunk-CNOQY6Z7.mjs";
695
711
  import {
696
712
  applyFarmCacheInvalidations
697
713
  } from "./chunk-4SIYUGRY.mjs";
698
- import "./chunk-C4NCTZLM.mjs";
699
- import {
700
- configureFarmObservability,
701
- configureFarmTracing,
702
- emitFarmEvent,
703
- getFarmTraceContext,
704
- normalizeFarmObservabilityConfig,
705
- normalizeFarmTracingConfig,
706
- onFarmEvent,
707
- resetFarmObservability,
708
- runWithFarmRequestSpan,
709
- runWithFarmSpan
710
- } from "./chunk-FUZEBRP3.mjs";
711
714
  import {
712
715
  createEnvPlugin,
713
716
  createHeadersPlugin,
@@ -1,3 +1,130 @@
1
+ import { a as EndpointMiddlewareResult, R as RouteSchema, b as RouteSchemaOutput, c as EndpointMCPOptions, A as AnyEndpointMiddleware, I as InferEndpointMiddlewareContext, T as TypedEndpoint, d as RouteSchemaInput } from './endpoint-CCHFqyTE.mjs';
2
+
3
+ type RouteMethod = "GET" | "HEAD" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
4
+ type RoutePathParams<Path extends string> = Path extends `${infer Head}/${infer Tail}` ? RoutePathParams<Head> & RoutePathParams<Tail> : Path extends `[[...${infer Name}]]` ? {
5
+ [K in Name]?: string[];
6
+ } : Path extends `[...${infer Name}]` ? {
7
+ [K in Name]: string[];
8
+ } : Path extends `[${infer Name}]` ? {
9
+ [K in Name]: string;
10
+ } : {};
11
+ interface RouteInputSchemas {
12
+ body?: RouteSchema;
13
+ query?: RouteSchema;
14
+ params?: RouteSchema;
15
+ headers?: RouteSchema;
16
+ }
17
+ type Input<I, K extends PropertyKey> = K extends keyof I ? RouteSchemaInput<I[K]> : never;
18
+ type Output<I, K extends PropertyKey, Fallback = unknown> = K extends keyof I ? RouteSchemaOutput<I[K]> : Fallback;
19
+ /** JSON responses have wire types, not server-side instances such as Date. */
20
+ type RouteJSON<T> = T extends Response ? unknown : T extends {
21
+ toJSON(): infer J;
22
+ } ? RouteJSON<J> : T extends bigint | symbol | ((...args: any[]) => any) ? never : T extends readonly (infer V)[] ? RouteJSON<V>[] : T extends object ? {
23
+ [K in keyof T]: RouteJSON<T[K]>;
24
+ } : T;
25
+ type RouteDefinition<P extends string = string, M extends RouteMethod = RouteMethod, E = any> = {
26
+ readonly path: P;
27
+ readonly method: M;
28
+ readonly endpoint: E;
29
+ };
30
+ type RouteEndpoint<P extends string, I extends RouteInputSchemas, R> = TypedEndpoint<Output<I, "body">, Input<I, "query">, RouteJSON<R>, Input<I, "headers">, never, Input<I, "body">> & {
31
+ __types: {
32
+ params: RoutePathParams<P>;
33
+ inputHeaders: Input<I, "headers">;
34
+ };
35
+ };
36
+ type TrimStart<P extends string> = P extends `/${infer Rest}` ? TrimStart<Rest> : P;
37
+ type Join<P extends string, C extends string> = C extends "" ? P : `${P}/${TrimStart<C>}`;
38
+ type ParamsCheck<P extends string, I extends RouteInputSchemas> = I extends {
39
+ params: infer S;
40
+ } ? Exclude<keyof RoutePathParams<P>, keyof RouteSchemaOutput<S>> extends never ? Exclude<keyof RouteSchemaOutput<S>, keyof RoutePathParams<P>> extends never ? unknown : {
41
+ __error_unknown_route_params: never;
42
+ } : {
43
+ __error_missing_route_params: never;
44
+ } : unknown;
45
+ type RouteMiddlewareResults = readonly (EndpointMiddlewareResult | Promise<EndpointMiddlewareResult>)[];
46
+ type RouteMiddlewares<Results extends readonly unknown[]> = {
47
+ readonly [K in keyof Results]: (context: Parameters<AnyEndpointMiddleware>[0]) => Results[K];
48
+ };
49
+ type RouteOptions<P extends string, I extends RouteInputSchemas, O extends RouteSchema | undefined, R, MiddlewareResults extends RouteMiddlewareResults = RouteMiddlewareResults> = {
50
+ input?: I & ParamsCheck<P, I>;
51
+ /** Validate plain JSON handler results. Raw Response/stream results are never buffered. */
52
+ output?: O;
53
+ /** Opt this app-owned endpoint into an installed MCP transport. */
54
+ mcp?: EndpointMCPOptions;
55
+ middleware?: RouteMiddlewares<MiddlewareResults>;
56
+ handler(request: Request, context: {
57
+ input: {
58
+ body: Output<I, "body">;
59
+ query: Output<I, "query", Record<string, string | string[]>>;
60
+ headers: Output<I, "headers", Record<string, string>>;
61
+ params: Output<I, "params", RoutePathParams<P>>;
62
+ };
63
+ params: Output<I, "params", RoutePathParams<P>>;
64
+ context: Readonly<InferEndpointMiddlewareContext<RouteMiddlewares<MiddlewareResults>>>;
65
+ }): R | Promise<R>;
66
+ };
67
+ type RouteBuilder<P extends string, M extends RouteMethod> = <const C extends string, const MiddlewareResults extends RouteMiddlewareResults, const I extends RouteInputSchemas = {}, O extends RouteSchema | undefined = undefined, R = unknown>(path: C, options: RouteOptions<Join<P, C>, I, O, R, MiddlewareResults>) => RouteDefinition<Join<P, C>, M, RouteEndpoint<Join<P, C>, I, Extract<Awaited<R>, Response> extends never ? O extends RouteSchema ? RouteSchemaOutput<O> : Awaited<R> : unknown>>;
68
+ type RouteFactory<P extends string = ""> = {
69
+ [M in Lowercase<RouteMethod>]: RouteBuilder<P, Uppercase<M> & RouteMethod>;
70
+ } & {
71
+ /** Return a new builder; never mutate the parent scope. */
72
+ scope<const C extends string>(path: C): RouteFactory<Join<P, C>>;
73
+ };
74
+ type PluginRoutes = readonly RouteDefinition[];
75
+ interface PluginLocalAPIEndpoint {
76
+ readonly path: string;
77
+ readonly method: RouteMethod;
78
+ readonly input: Readonly<RouteInputSchemas>;
79
+ readonly output?: RouteSchema;
80
+ readonly mcp?: EndpointMCPOptions;
81
+ invoke(request: Request, params?: Readonly<Record<string, string | string[]>>): Promise<Response>;
82
+ }
83
+ /**
84
+ * Read-only access to app-owned API endpoints while plugin routes are mounted.
85
+ * Plugin routes are intentionally excluded so a plugin cannot recurse through
86
+ * itself or depend on plugin registration order.
87
+ */
88
+ interface PluginLocalAPI {
89
+ /** False during type-only route discovery, where app endpoint modules are unavailable. */
90
+ readonly available: boolean;
91
+ get(method: RouteMethod, path: string): PluginLocalAPIEndpoint | undefined;
92
+ /** Enumerate app-owned endpoints. Plugin routes are excluded. */
93
+ list(): readonly PluginLocalAPIEndpoint[];
94
+ }
95
+ type PluginRoutesFactory<R extends PluginRoutes = PluginRoutes> = (context: {
96
+ route: RouteFactory;
97
+ api: PluginLocalAPI;
98
+ }) => R;
99
+ declare function createRouteFactory(): RouteFactory;
100
+ type UnionToIntersection$1<U> = (U extends unknown ? (v: U) => void : never) extends (v: infer I) => void ? I : never;
101
+ type RouteTree<P extends string, M extends string, E> = P extends `${infer Head}/${infer Tail}` ? {
102
+ [K in Head]: RouteTree<Tail, M, E>;
103
+ } : P extends "" ? {
104
+ [K in Lowercase<M>]: E;
105
+ } : {
106
+ [K in P]: {
107
+ [Method in Lowercase<M>]: E;
108
+ };
109
+ };
110
+ type HasMethodSegment<P extends string> = P extends `${infer H}/${infer T}` ? H extends Lowercase<RouteMethod> ? true : HasMethodSegment<T> : P extends Lowercase<RouteMethod> ? true : false;
111
+ type DefinitionTree<D> = D extends RouteDefinition<infer P, infer M, infer E> ? string extends P ? {} : (P extends `/api/integrations${string}` ? true : HasMethodSegment<P>) extends true ? {
112
+ [K in P extends `/api/${infer C}` ? `/${C}` : "/"]: {
113
+ [Method in Lowercase<M>]: E;
114
+ };
115
+ } : RouteTree<P extends `/api/${infer C}` ? C : "", M, E> : {};
116
+ type PluginAPIRouter<C> = C extends {
117
+ plugins: readonly (infer P)[];
118
+ } ? UnionToIntersection$1<P extends {
119
+ routes?: PluginRoutesFactory<infer R>;
120
+ } ? DefinitionTree<R[number]> : {}> : {};
121
+ declare function resolvePluginRoutes(plugins?: readonly {
122
+ name: string;
123
+ routes?: PluginRoutesFactory;
124
+ }[], context?: {
125
+ api?: PluginLocalAPI;
126
+ }): PluginRoutes;
127
+
1
128
  type FarmIntegrationAPIMethod = "GET" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
2
129
  type FarmIntegrationAPIBodyFormat = "json" | "form" | "none";
3
130
  type FarmIntegrationAPIResponseFormat = "json" | "text" | "response";
@@ -94,4 +221,4 @@ declare const endpoint: {
94
221
  };
95
222
  };
96
223
 
97
- export { type FarmIntegrationAPI as F, type InferIntegrationAPIFromRoutes as I, api as a, defineIntegrationAPIOperation as b, type FarmIntegrationAPIBodyFormat as c, defineIntegrationAPI as d, type FarmIntegrationAPIMethod as e, type FarmIntegrationAPIOperation as f, type FarmIntegrationAPIResponseFormat as g, type FarmIntegrationRouteOperationCarrier as h, endpoint as i };
224
+ export { type FarmIntegrationAPI as F, type InferIntegrationAPIFromRoutes as I, type PluginRoutesFactory as P, type RouteMethod as R, api as a, defineIntegrationAPIOperation as b, type FarmIntegrationAPIBodyFormat as c, defineIntegrationAPI as d, type FarmIntegrationAPIMethod as e, type FarmIntegrationAPIOperation as f, type FarmIntegrationAPIResponseFormat as g, type FarmIntegrationRouteOperationCarrier as h, endpoint as i, type RoutePathParams as j, type RouteInputSchemas as k, type RouteJSON as l, type RouteDefinition as m, type RouteOptions as n, type RouteFactory as o, type PluginRoutes as p, type PluginLocalAPIEndpoint as q, type PluginLocalAPI as r, createRouteFactory as s, type PluginAPIRouter as t, resolvePluginRoutes as u };
@@ -1,3 +1,130 @@
1
+ import { a as EndpointMiddlewareResult, R as RouteSchema, b as RouteSchemaOutput, c as EndpointMCPOptions, A as AnyEndpointMiddleware, I as InferEndpointMiddlewareContext, T as TypedEndpoint, d as RouteSchemaInput } from './endpoint-CA-TNX60.js';
2
+
3
+ type RouteMethod = "GET" | "HEAD" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
4
+ type RoutePathParams<Path extends string> = Path extends `${infer Head}/${infer Tail}` ? RoutePathParams<Head> & RoutePathParams<Tail> : Path extends `[[...${infer Name}]]` ? {
5
+ [K in Name]?: string[];
6
+ } : Path extends `[...${infer Name}]` ? {
7
+ [K in Name]: string[];
8
+ } : Path extends `[${infer Name}]` ? {
9
+ [K in Name]: string;
10
+ } : {};
11
+ interface RouteInputSchemas {
12
+ body?: RouteSchema;
13
+ query?: RouteSchema;
14
+ params?: RouteSchema;
15
+ headers?: RouteSchema;
16
+ }
17
+ type Input<I, K extends PropertyKey> = K extends keyof I ? RouteSchemaInput<I[K]> : never;
18
+ type Output<I, K extends PropertyKey, Fallback = unknown> = K extends keyof I ? RouteSchemaOutput<I[K]> : Fallback;
19
+ /** JSON responses have wire types, not server-side instances such as Date. */
20
+ type RouteJSON<T> = T extends Response ? unknown : T extends {
21
+ toJSON(): infer J;
22
+ } ? RouteJSON<J> : T extends bigint | symbol | ((...args: any[]) => any) ? never : T extends readonly (infer V)[] ? RouteJSON<V>[] : T extends object ? {
23
+ [K in keyof T]: RouteJSON<T[K]>;
24
+ } : T;
25
+ type RouteDefinition<P extends string = string, M extends RouteMethod = RouteMethod, E = any> = {
26
+ readonly path: P;
27
+ readonly method: M;
28
+ readonly endpoint: E;
29
+ };
30
+ type RouteEndpoint<P extends string, I extends RouteInputSchemas, R> = TypedEndpoint<Output<I, "body">, Input<I, "query">, RouteJSON<R>, Input<I, "headers">, never, Input<I, "body">> & {
31
+ __types: {
32
+ params: RoutePathParams<P>;
33
+ inputHeaders: Input<I, "headers">;
34
+ };
35
+ };
36
+ type TrimStart<P extends string> = P extends `/${infer Rest}` ? TrimStart<Rest> : P;
37
+ type Join<P extends string, C extends string> = C extends "" ? P : `${P}/${TrimStart<C>}`;
38
+ type ParamsCheck<P extends string, I extends RouteInputSchemas> = I extends {
39
+ params: infer S;
40
+ } ? Exclude<keyof RoutePathParams<P>, keyof RouteSchemaOutput<S>> extends never ? Exclude<keyof RouteSchemaOutput<S>, keyof RoutePathParams<P>> extends never ? unknown : {
41
+ __error_unknown_route_params: never;
42
+ } : {
43
+ __error_missing_route_params: never;
44
+ } : unknown;
45
+ type RouteMiddlewareResults = readonly (EndpointMiddlewareResult | Promise<EndpointMiddlewareResult>)[];
46
+ type RouteMiddlewares<Results extends readonly unknown[]> = {
47
+ readonly [K in keyof Results]: (context: Parameters<AnyEndpointMiddleware>[0]) => Results[K];
48
+ };
49
+ type RouteOptions<P extends string, I extends RouteInputSchemas, O extends RouteSchema | undefined, R, MiddlewareResults extends RouteMiddlewareResults = RouteMiddlewareResults> = {
50
+ input?: I & ParamsCheck<P, I>;
51
+ /** Validate plain JSON handler results. Raw Response/stream results are never buffered. */
52
+ output?: O;
53
+ /** Opt this app-owned endpoint into an installed MCP transport. */
54
+ mcp?: EndpointMCPOptions;
55
+ middleware?: RouteMiddlewares<MiddlewareResults>;
56
+ handler(request: Request, context: {
57
+ input: {
58
+ body: Output<I, "body">;
59
+ query: Output<I, "query", Record<string, string | string[]>>;
60
+ headers: Output<I, "headers", Record<string, string>>;
61
+ params: Output<I, "params", RoutePathParams<P>>;
62
+ };
63
+ params: Output<I, "params", RoutePathParams<P>>;
64
+ context: Readonly<InferEndpointMiddlewareContext<RouteMiddlewares<MiddlewareResults>>>;
65
+ }): R | Promise<R>;
66
+ };
67
+ type RouteBuilder<P extends string, M extends RouteMethod> = <const C extends string, const MiddlewareResults extends RouteMiddlewareResults, const I extends RouteInputSchemas = {}, O extends RouteSchema | undefined = undefined, R = unknown>(path: C, options: RouteOptions<Join<P, C>, I, O, R, MiddlewareResults>) => RouteDefinition<Join<P, C>, M, RouteEndpoint<Join<P, C>, I, Extract<Awaited<R>, Response> extends never ? O extends RouteSchema ? RouteSchemaOutput<O> : Awaited<R> : unknown>>;
68
+ type RouteFactory<P extends string = ""> = {
69
+ [M in Lowercase<RouteMethod>]: RouteBuilder<P, Uppercase<M> & RouteMethod>;
70
+ } & {
71
+ /** Return a new builder; never mutate the parent scope. */
72
+ scope<const C extends string>(path: C): RouteFactory<Join<P, C>>;
73
+ };
74
+ type PluginRoutes = readonly RouteDefinition[];
75
+ interface PluginLocalAPIEndpoint {
76
+ readonly path: string;
77
+ readonly method: RouteMethod;
78
+ readonly input: Readonly<RouteInputSchemas>;
79
+ readonly output?: RouteSchema;
80
+ readonly mcp?: EndpointMCPOptions;
81
+ invoke(request: Request, params?: Readonly<Record<string, string | string[]>>): Promise<Response>;
82
+ }
83
+ /**
84
+ * Read-only access to app-owned API endpoints while plugin routes are mounted.
85
+ * Plugin routes are intentionally excluded so a plugin cannot recurse through
86
+ * itself or depend on plugin registration order.
87
+ */
88
+ interface PluginLocalAPI {
89
+ /** False during type-only route discovery, where app endpoint modules are unavailable. */
90
+ readonly available: boolean;
91
+ get(method: RouteMethod, path: string): PluginLocalAPIEndpoint | undefined;
92
+ /** Enumerate app-owned endpoints. Plugin routes are excluded. */
93
+ list(): readonly PluginLocalAPIEndpoint[];
94
+ }
95
+ type PluginRoutesFactory<R extends PluginRoutes = PluginRoutes> = (context: {
96
+ route: RouteFactory;
97
+ api: PluginLocalAPI;
98
+ }) => R;
99
+ declare function createRouteFactory(): RouteFactory;
100
+ type UnionToIntersection$1<U> = (U extends unknown ? (v: U) => void : never) extends (v: infer I) => void ? I : never;
101
+ type RouteTree<P extends string, M extends string, E> = P extends `${infer Head}/${infer Tail}` ? {
102
+ [K in Head]: RouteTree<Tail, M, E>;
103
+ } : P extends "" ? {
104
+ [K in Lowercase<M>]: E;
105
+ } : {
106
+ [K in P]: {
107
+ [Method in Lowercase<M>]: E;
108
+ };
109
+ };
110
+ type HasMethodSegment<P extends string> = P extends `${infer H}/${infer T}` ? H extends Lowercase<RouteMethod> ? true : HasMethodSegment<T> : P extends Lowercase<RouteMethod> ? true : false;
111
+ type DefinitionTree<D> = D extends RouteDefinition<infer P, infer M, infer E> ? string extends P ? {} : (P extends `/api/integrations${string}` ? true : HasMethodSegment<P>) extends true ? {
112
+ [K in P extends `/api/${infer C}` ? `/${C}` : "/"]: {
113
+ [Method in Lowercase<M>]: E;
114
+ };
115
+ } : RouteTree<P extends `/api/${infer C}` ? C : "", M, E> : {};
116
+ type PluginAPIRouter<C> = C extends {
117
+ plugins: readonly (infer P)[];
118
+ } ? UnionToIntersection$1<P extends {
119
+ routes?: PluginRoutesFactory<infer R>;
120
+ } ? DefinitionTree<R[number]> : {}> : {};
121
+ declare function resolvePluginRoutes(plugins?: readonly {
122
+ name: string;
123
+ routes?: PluginRoutesFactory;
124
+ }[], context?: {
125
+ api?: PluginLocalAPI;
126
+ }): PluginRoutes;
127
+
1
128
  type FarmIntegrationAPIMethod = "GET" | "QUERY" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS" | "HEAD";
2
129
  type FarmIntegrationAPIBodyFormat = "json" | "form" | "none";
3
130
  type FarmIntegrationAPIResponseFormat = "json" | "text" | "response";
@@ -94,4 +221,4 @@ declare const endpoint: {
94
221
  };
95
222
  };
96
223
 
97
- export { type FarmIntegrationAPI as F, type InferIntegrationAPIFromRoutes as I, api as a, defineIntegrationAPIOperation as b, type FarmIntegrationAPIBodyFormat as c, defineIntegrationAPI as d, type FarmIntegrationAPIMethod as e, type FarmIntegrationAPIOperation as f, type FarmIntegrationAPIResponseFormat as g, type FarmIntegrationRouteOperationCarrier as h, endpoint as i };
224
+ export { type FarmIntegrationAPI as F, type InferIntegrationAPIFromRoutes as I, type PluginRoutesFactory as P, type RouteMethod as R, api as a, defineIntegrationAPIOperation as b, type FarmIntegrationAPIBodyFormat as c, defineIntegrationAPI as d, type FarmIntegrationAPIMethod as e, type FarmIntegrationAPIOperation as f, type FarmIntegrationAPIResponseFormat as g, type FarmIntegrationRouteOperationCarrier as h, endpoint as i, type RoutePathParams as j, type RouteInputSchemas as k, type RouteJSON as l, type RouteDefinition as m, type RouteOptions as n, type RouteFactory as o, type PluginRoutes as p, type PluginLocalAPIEndpoint as q, type PluginLocalAPI as r, createRouteFactory as s, type PluginAPIRouter as t, resolvePluginRoutes as u };