@farm.js/core 0.1.15 → 0.1.17
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.
- package/dist/agent-runtime.d.mts +5 -2
- package/dist/agent-runtime.d.ts +5 -2
- package/dist/api/client.cjs +62 -28
- package/dist/api/client.d.mts +3 -2
- package/dist/api/client.d.ts +3 -2
- package/dist/api/client.mjs +3 -3
- package/dist/api/route-manager.cjs +69 -32
- package/dist/api/route-manager.d.mts +5 -2
- package/dist/api/route-manager.d.ts +5 -2
- package/dist/api/route-manager.mjs +5 -5
- package/dist/api/runtime.cjs +65 -29
- package/dist/api/runtime.d.mts +3 -2
- package/dist/api/runtime.d.ts +3 -2
- package/dist/api/runtime.mjs +6 -3
- package/dist/{api-client-C8d7BZNp.d.mts → api-client-Cx54IR5g.d.mts} +2 -1
- package/dist/{api-client-BWrEbxfO.d.ts → api-client-DykpaKcY.d.ts} +2 -1
- package/dist/api.cjs +106 -33
- package/dist/api.d.mts +7 -4
- package/dist/api.d.ts +7 -4
- package/dist/api.mjs +8 -8
- package/dist/{app-wIYse61b.d.ts → app-BHY_10Lm.d.ts} +3 -3
- package/dist/{app-B3nVSjen.d.mts → app-BMk0do23.d.mts} +3 -3
- package/dist/app-markdown.d.mts +6 -3
- package/dist/app-markdown.d.ts +6 -3
- package/dist/app-markdown.mjs +3 -3
- package/dist/cache.cjs +62 -28
- package/dist/cache.d.mts +11 -1
- package/dist/cache.d.ts +11 -1
- package/dist/cache.mjs +1 -1
- package/dist/{chunk-FOGLGRDS.mjs → chunk-4OOBRCJX.mjs} +122 -8
- package/dist/{chunk-JRF3C33L.mjs → chunk-56DAX2BE.mjs} +172 -53
- package/dist/{chunk-B76DT5Y6.mjs → chunk-57J3Y7Y3.mjs} +1 -1
- package/dist/{chunk-MOQNHLTS.mjs → chunk-5QOEPUYE.mjs} +5 -2
- package/dist/{chunk-HKLRP3BN.mjs → chunk-5SPPCN5J.mjs} +1 -1
- package/dist/{chunk-LUC2FAGW.mjs → chunk-6VQIKZZO.mjs} +1 -1
- package/dist/{chunk-7ZWL7XOU.mjs → chunk-76DG3LF3.mjs} +1 -1
- package/dist/{chunk-EWDK36MM.mjs → chunk-A72YEUZ3.mjs} +1 -1
- package/dist/{chunk-ZHOIQC6U.mjs → chunk-ATERBVHQ.mjs} +2 -2
- package/dist/{chunk-27JNCYEK.mjs → chunk-EN7WTEAY.mjs} +2 -2
- package/dist/{chunk-IGO2HEV7.mjs → chunk-F6SJAKFJ.mjs} +62 -28
- package/dist/{chunk-GSDIZACQ.mjs → chunk-FG5H2VCJ.mjs} +2 -2
- package/dist/{chunk-LZK5CXDW.mjs → chunk-KLSSO6YD.mjs} +2 -2
- package/dist/{chunk-KUO3GBPK.mjs → chunk-L6V3P73N.mjs} +1 -1
- package/dist/{chunk-FBHGHMOA.mjs → chunk-MVIWBEJF.mjs} +37 -27
- package/dist/{chunk-KTGFMHET.mjs → chunk-N6UROPT7.mjs} +1 -1
- package/dist/{chunk-NDD2YVGU.mjs → chunk-NRVGEI5I.mjs} +10 -3
- package/dist/{chunk-GNTPTTLA.mjs → chunk-QGVJVSNX.mjs} +5 -5
- package/dist/{chunk-6SCB2MXB.mjs → chunk-SXHV42UQ.mjs} +16 -1
- package/dist/{chunk-OWTIOHON.mjs → chunk-SYGGPS4A.mjs} +2 -2
- package/dist/{chunk-NC333MFA.mjs → chunk-TSWW5BVH.mjs} +7 -4
- package/dist/{chunk-LK6FGAQR.mjs → chunk-UDBJCUPA.mjs} +7 -4
- package/dist/{chunk-NJ47VORC.mjs → chunk-UTBVHYS3.mjs} +2 -2
- package/dist/{chunk-76MNRHTS.mjs → chunk-UUYF3CHN.mjs} +2 -2
- package/dist/{chunk-S3QW3BIS.mjs → chunk-WD4YXVLV.mjs} +99 -6
- package/dist/{chunk-W7IVHTOP.mjs → chunk-WD5PNSOB.mjs} +16 -3
- package/dist/{chunk-DPZUDPVJ.mjs → chunk-XP777LRD.mjs} +1 -1
- package/dist/{chunk-KATQ6I56.mjs → chunk-XWAYMDLB.mjs} +1 -1
- package/dist/{chunk-UE75PB52.mjs → chunk-YD4J4XCI.mjs} +1 -1
- package/dist/{chunk-Q3MDL7TM.mjs → chunk-ZCNJKLA2.mjs} +30 -11
- package/dist/{client-plugins-CslwYp3E.d.ts → client-plugins-C089bQhN.d.ts} +16 -4
- package/dist/{client-plugins-C1EgdoJM.d.mts → client-plugins-JXXmZliS.d.mts} +16 -4
- package/dist/client-plugins.d.mts +5 -2
- package/dist/client-plugins.d.ts +5 -2
- package/dist/client.cjs +62 -28
- package/dist/client.d.mts +8 -7
- package/dist/client.d.ts +8 -7
- package/dist/client.mjs +6 -6
- package/dist/config.d.mts +5 -2
- package/dist/config.d.ts +5 -2
- package/dist/cron.mjs +2 -2
- package/dist/{devtools-PCGEBRSC.mjs → devtools-UFVTMQX5.mjs} +7 -7
- package/dist/docs.cjs +83 -4
- package/dist/docs.mjs +9 -9
- package/dist/{route-CHBaW55F.d.ts → endpoint-1zA994xL.d.ts} +3 -128
- package/dist/{route-C6UClI1z.d.mts → endpoint-DAc96i93.d.mts} +3 -128
- package/dist/env.cjs +135 -8
- package/dist/env.d.mts +22 -2
- package/dist/env.d.ts +22 -2
- package/dist/env.mjs +4 -1
- package/dist/index.cjs +516 -105
- package/dist/index.d.mts +16 -15
- package/dist/index.d.ts +16 -15
- package/dist/index.mjs +46 -34
- package/dist/integrations.d.mts +5 -2
- package/dist/integrations.d.ts +5 -2
- package/dist/internal/app-markdown-runtime.d.mts +5 -2
- package/dist/internal/app-markdown-runtime.d.ts +5 -2
- package/dist/internal/app-markdown-runtime.mjs +2 -2
- package/dist/internal/build-runtime.cjs +600 -284
- package/dist/internal/build-runtime.d.mts +7 -4
- package/dist/internal/build-runtime.d.ts +7 -4
- package/dist/internal/build-runtime.mjs +23 -23
- package/dist/internal/cli-runtime.cjs +143 -33
- package/dist/internal/cli-runtime.mjs +13 -13
- package/dist/internal/client-error-overlay.cjs +1 -1
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +5 -2
- package/dist/internal/compression-runtime.d.ts +5 -2
- package/dist/internal/config-runtime.cjs +80 -4
- package/dist/internal/config-runtime.d.mts +6 -3
- package/dist/internal/config-runtime.d.ts +6 -3
- package/dist/internal/config-runtime.mjs +7 -7
- package/dist/internal/product-telemetry-runtime.cjs +1 -1
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +101 -41
- package/dist/internal/production-runtime.d.mts +11 -8
- package/dist/internal/production-runtime.d.ts +11 -8
- package/dist/internal/production-runtime.mjs +6 -6
- package/dist/markdown.cjs +16 -1
- package/dist/markdown.mjs +1 -1
- package/dist/{metadata-BsUcOEXg.d.ts → metadata-BcNJP4fq.d.ts} +1 -1
- package/dist/{metadata-B1bxCPUY.d.mts → metadata-C1Z9vLbb.d.mts} +1 -1
- package/dist/middleware.cjs +10 -3
- package/dist/middleware.d.mts +7 -4
- package/dist/middleware.d.ts +7 -4
- package/dist/middleware.mjs +4 -4
- package/dist/{nitro-ICBP5APY.mjs → nitro-CVZ36JM5.mjs} +8 -5
- package/dist/plugin.cjs +358 -106
- package/dist/plugin.d.mts +5 -2
- package/dist/plugin.d.ts +5 -2
- package/dist/plugin.mjs +19 -19
- package/dist/{production-runtime-BDllolVh.d.mts → production-runtime-jcrTlRTb.d.mts} +1 -1
- package/dist/{production-runtime-CsNn2-zx.d.ts → production-runtime-oKmC0WU-.d.ts} +1 -1
- package/dist/{render-plan-CNUlzylR.d.mts → render-plan-BLIfc4jt.d.mts} +1 -1
- package/dist/{render-plan-EG4hNFjy.d.ts → render-plan-DOB9cV-h.d.ts} +1 -1
- package/dist/renderer-client.cjs +62 -28
- package/dist/renderer-client.d.mts +5 -4
- package/dist/renderer-client.d.ts +5 -4
- package/dist/renderer-client.mjs +3 -3
- package/dist/{request-Blh_f7Z3.d.mts → request-Cr53NRHr.d.mts} +1 -1
- package/dist/{request-DsVSQVfD.d.ts → request-Dt2gNuQD.d.ts} +1 -1
- package/dist/request.d.mts +6 -3
- package/dist/request.d.ts +6 -3
- package/dist/route-B0XrsrFk.d.mts +128 -0
- package/dist/route-DOEpbyWZ.d.ts +128 -0
- package/dist/{route-rendering-hUETRCbM.d.ts → route-rendering-CWYd8Mv1.d.ts} +1 -1
- package/dist/{route-rendering-LT4XSoQK.d.mts → route-rendering-CeFBEAoZ.d.mts} +1 -1
- package/dist/routes.cjs +68 -31
- package/dist/routes.d.mts +5 -3
- package/dist/routes.d.ts +5 -3
- package/dist/routes.mjs +2 -2
- package/dist/server-fn-client.d.mts +3 -2
- package/dist/server-fn-client.d.ts +3 -2
- package/dist/server-fn.cjs +212 -32
- package/dist/server-fn.d.mts +72 -1
- package/dist/server-fn.d.ts +72 -1
- package/dist/server-fn.mjs +13 -2
- package/dist/server-plugins.d.mts +6 -3
- package/dist/server-plugins.d.ts +6 -3
- package/dist/server-query-client.cjs +62 -28
- package/dist/server-query-client.d.mts +1 -0
- package/dist/server-query-client.d.ts +1 -0
- package/dist/server-query-client.mjs +4 -4
- package/dist/server-query.cjs +131 -32
- package/dist/server-query.d.mts +6 -1
- package/dist/server-query.d.ts +6 -1
- package/dist/server-query.mjs +4 -3
- package/dist/server.cjs +393 -84
- package/dist/server.d.mts +9 -8
- package/dist/server.d.ts +9 -8
- package/dist/server.mjs +22 -22
- package/dist/{spa-router-csKR9Ebj.d.mts → spa-router-CQWiYGxS.d.mts} +2 -2
- package/dist/{spa-router-Y_2FSJQK.d.ts → spa-router-Wjiw-8hB.d.ts} +2 -2
- package/dist/testing.cjs +73 -32
- package/dist/testing.d.mts +5 -3
- package/dist/testing.d.ts +5 -3
- package/dist/testing.mjs +11 -7
- package/dist/{utils-jISOE9SD.d.ts → utils-B0XJmG_b.d.ts} +1 -1
- package/dist/{utils-DR2wfZAn.d.mts → utils-uUxF0K0P.d.mts} +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +500 -252
- package/dist/vite.d.mts +5 -2
- package/dist/vite.d.ts +5 -2
- package/dist/vite.mjs +19 -19
- package/dist/workflows.mjs +2 -2
- package/package.json +2 -2
- package/dist/{chunk-VO5SCWF5.mjs → chunk-BNGS6KJ6.mjs} +0 -0
- package/dist/{chunk-MUUZJLCI.mjs → chunk-EGJDUF4Q.mjs} +3 -3
- package/dist/{chunk-4L7SZOHZ.mjs → chunk-YHOCRI4H.mjs} +3 -3
package/dist/plugin.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { i as PluginLocalAPI, h as PluginLocalAPIEndpoint, g as PluginRoutes, P as PluginRoutesFactory, d as RouteDefinition, R as RouteMethod } from './route-B0XrsrFk.mjs';
|
|
2
|
+
export { d as EndpointMCPMetadata, b as EndpointMCPOptions, f as EndpointOpenAPIMetadata, R as RouteSchema } from './endpoint-DAc96i93.mjs';
|
|
3
|
+
export { ca as APIHandlerLifecyclePayload, c6 as APIRouteDiscoveredPayload, cd as BundleLifecyclePayload, B as BundleResultPayload, cb as ErrorLifecyclePayload, fb as FARM_NODE_RESPONSE_END_PENDING, a as FarmPlugin, c0 as FarmPluginBuildHooks, c2 as FarmPluginClientConfig, d as FarmPluginContext, aV as FarmPluginDatabase, aW as FarmPluginDefinition, c1 as FarmPluginDevHooks, bZ as FarmPluginDiscoveredRoute, bE as FarmPluginIntegrationContext, bF as FarmPluginLifecycle, b$ as FarmPluginRenderHooks, bJ as FarmPluginRouteRuntimePayload, b_ as FarmPluginRouterHooks, bR as FarmPluginRuntimeAfterEvent, bM as FarmPluginRuntimeBaseEvent, bQ as FarmPluginRuntimeBeforeEvent, bU as FarmPluginRuntimeCloseEvent, bN as FarmPluginRuntimeContextEvent, bO as FarmPluginRuntimeEndpoint, bP as FarmPluginRuntimeEndpointEvent, bS as FarmPluginRuntimeErrorEvent, bV as FarmPluginRuntimeHooks, bI as FarmPluginRuntimeKind, bX as FarmPluginRuntimeRequestHandler, bW as FarmPluginRuntimeRequestOptions, bY as FarmPluginRuntimeSession, bT as FarmPluginRuntimeStartEvent, bK as FarmPluginSetupContext, bL as FarmPluginStateContext, bG as FarmRequestPluginContext, bH as FarmRequestStore, aT as FarmRuntimeShutdownError, cc as HMRUpdatePayload, c5 as MiddlewareDiscoveredPayload, ce as NitroBuildLifecyclePayload, aU as PluginManager, bD as PluginRequestContext, c9 as RenderLifecyclePayload, c3 as RouteDiscoveredPayload, c7 as RouteMatchPayload, c8 as RouteMatchResultPayload, c4 as RoutesGeneratedPayload, cf as ShutdownPayload, aS as definePlugin, x as farmPlugin } from './client-plugins-JXXmZliS.mjs';
|
|
3
4
|
import 'vite';
|
|
4
5
|
import './lifecycle-DK06VuKP.mjs';
|
|
5
6
|
import './env.mjs';
|
|
@@ -27,6 +28,8 @@ import './server-fn-error-DDh14a0V.mjs';
|
|
|
27
28
|
import 'esbuild';
|
|
28
29
|
import './image-config-Duob7wER.mjs';
|
|
29
30
|
import './types-Z0aotQ8w.mjs';
|
|
31
|
+
import './server-fn.mjs';
|
|
32
|
+
import './server-query.mjs';
|
|
30
33
|
import './types-DQnyD3VD.mjs';
|
|
31
34
|
import './font.mjs';
|
|
32
35
|
import './after.mjs';
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { i as PluginLocalAPI, h as PluginLocalAPIEndpoint, g as PluginRoutes, P as PluginRoutesFactory, d as RouteDefinition, R as RouteMethod } from './route-DOEpbyWZ.js';
|
|
2
|
+
export { d as EndpointMCPMetadata, b as EndpointMCPOptions, f as EndpointOpenAPIMetadata, R as RouteSchema } from './endpoint-1zA994xL.js';
|
|
3
|
+
export { ca as APIHandlerLifecyclePayload, c6 as APIRouteDiscoveredPayload, cd as BundleLifecyclePayload, B as BundleResultPayload, cb as ErrorLifecyclePayload, fb as FARM_NODE_RESPONSE_END_PENDING, a as FarmPlugin, c0 as FarmPluginBuildHooks, c2 as FarmPluginClientConfig, d as FarmPluginContext, aV as FarmPluginDatabase, aW as FarmPluginDefinition, c1 as FarmPluginDevHooks, bZ as FarmPluginDiscoveredRoute, bE as FarmPluginIntegrationContext, bF as FarmPluginLifecycle, b$ as FarmPluginRenderHooks, bJ as FarmPluginRouteRuntimePayload, b_ as FarmPluginRouterHooks, bR as FarmPluginRuntimeAfterEvent, bM as FarmPluginRuntimeBaseEvent, bQ as FarmPluginRuntimeBeforeEvent, bU as FarmPluginRuntimeCloseEvent, bN as FarmPluginRuntimeContextEvent, bO as FarmPluginRuntimeEndpoint, bP as FarmPluginRuntimeEndpointEvent, bS as FarmPluginRuntimeErrorEvent, bV as FarmPluginRuntimeHooks, bI as FarmPluginRuntimeKind, bX as FarmPluginRuntimeRequestHandler, bW as FarmPluginRuntimeRequestOptions, bY as FarmPluginRuntimeSession, bT as FarmPluginRuntimeStartEvent, bK as FarmPluginSetupContext, bL as FarmPluginStateContext, bG as FarmRequestPluginContext, bH as FarmRequestStore, aT as FarmRuntimeShutdownError, cc as HMRUpdatePayload, c5 as MiddlewareDiscoveredPayload, ce as NitroBuildLifecyclePayload, aU as PluginManager, bD as PluginRequestContext, c9 as RenderLifecyclePayload, c3 as RouteDiscoveredPayload, c7 as RouteMatchPayload, c8 as RouteMatchResultPayload, c4 as RoutesGeneratedPayload, cf as ShutdownPayload, aS as definePlugin, x as farmPlugin } from './client-plugins-C089bQhN.js';
|
|
3
4
|
import 'vite';
|
|
4
5
|
import './lifecycle-DK06VuKP.js';
|
|
5
6
|
import './env.js';
|
|
@@ -27,6 +28,8 @@ import './server-fn-error-DDh14a0V.js';
|
|
|
27
28
|
import 'esbuild';
|
|
28
29
|
import './image-config-Duob7wER.js';
|
|
29
30
|
import './types-Z0aotQ8w.js';
|
|
31
|
+
import './server-fn.js';
|
|
32
|
+
import './server-query.js';
|
|
30
33
|
import './types-DQnyD3VD.js';
|
|
31
34
|
import './font.js';
|
|
32
35
|
import './after.js';
|
package/dist/plugin.mjs
CHANGED
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
PluginManager,
|
|
5
5
|
definePlugin,
|
|
6
6
|
farmPlugin
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-56DAX2BE.mjs";
|
|
8
|
+
import "./chunk-EN7WTEAY.mjs";
|
|
9
9
|
import "./chunk-DHDVMXYK.mjs";
|
|
10
10
|
import "./chunk-ZMSZZXOR.mjs";
|
|
11
11
|
import "./chunk-3NM6SRI6.mjs";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-76DG3LF3.mjs";
|
|
13
13
|
import "./chunk-DAO7JGTS.mjs";
|
|
14
14
|
import "./chunk-BOYNDCZL.mjs";
|
|
15
15
|
import "./chunk-HLCDYJY7.mjs";
|
|
@@ -27,37 +27,37 @@ import "./chunk-JBSVKMC5.mjs";
|
|
|
27
27
|
import "./chunk-7WPA7GBZ.mjs";
|
|
28
28
|
import "./chunk-IILNZK5G.mjs";
|
|
29
29
|
import "./chunk-OLYK7EAK.mjs";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-ZCNJKLA2.mjs";
|
|
31
31
|
import "./chunk-G2KY33I6.mjs";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-YHOCRI4H.mjs";
|
|
33
33
|
import "./chunk-QCFFHV5H.mjs";
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
36
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-4OOBRCJX.mjs";
|
|
35
|
+
import "./chunk-XWAYMDLB.mjs";
|
|
36
|
+
import "./chunk-6VQIKZZO.mjs";
|
|
37
37
|
import "./chunk-FA2W42OV.mjs";
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-ONUEYC6N.mjs";
|
|
38
|
+
import "./chunk-SXHV42UQ.mjs";
|
|
39
|
+
import "./chunk-EGJDUF4Q.mjs";
|
|
41
40
|
import "./chunk-2UC36WAC.mjs";
|
|
41
|
+
import "./chunk-ONUEYC6N.mjs";
|
|
42
42
|
import "./chunk-UWPLULNK.mjs";
|
|
43
43
|
import "./chunk-AELACLOB.mjs";
|
|
44
44
|
import "./chunk-SEJ5N6SL.mjs";
|
|
45
45
|
import "./chunk-JLCQGPXE.mjs";
|
|
46
46
|
import "./chunk-FP2INE7H.mjs";
|
|
47
47
|
import "./chunk-44SYJEG3.mjs";
|
|
48
|
-
import "./chunk-
|
|
49
|
-
import "./chunk-
|
|
48
|
+
import "./chunk-57J3Y7Y3.mjs";
|
|
49
|
+
import "./chunk-NRVGEI5I.mjs";
|
|
50
50
|
import "./chunk-5TISYEQF.mjs";
|
|
51
51
|
import "./chunk-R3DS7A2T.mjs";
|
|
52
52
|
import "./chunk-IOEH4VWN.mjs";
|
|
53
|
-
import "./chunk-
|
|
54
|
-
import "./chunk-
|
|
53
|
+
import "./chunk-ATERBVHQ.mjs";
|
|
54
|
+
import "./chunk-BNGS6KJ6.mjs";
|
|
55
55
|
import "./chunk-CU625VAY.mjs";
|
|
56
56
|
import "./chunk-JNGIWIY6.mjs";
|
|
57
57
|
import "./chunk-FV45CKBC.mjs";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-XP777LRD.mjs";
|
|
59
59
|
import "./chunk-I6XDAKWQ.mjs";
|
|
60
|
-
import "./chunk-
|
|
60
|
+
import "./chunk-SYGGPS4A.mjs";
|
|
61
61
|
import "./chunk-W3B4PKAW.mjs";
|
|
62
62
|
import "./chunk-5WI2S4CO.mjs";
|
|
63
63
|
import "./chunk-EA5K5BKU.mjs";
|
|
@@ -69,7 +69,7 @@ import "./chunk-YMCXWPWK.mjs";
|
|
|
69
69
|
import "./chunk-KI3MESHB.mjs";
|
|
70
70
|
import "./chunk-QVKYGNVM.mjs";
|
|
71
71
|
import "./chunk-Z2RZJZIZ.mjs";
|
|
72
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-YD4J4XCI.mjs";
|
|
73
73
|
import "./chunk-54UPOYFS.mjs";
|
|
74
74
|
import "./chunk-WNSDDRNU.mjs";
|
|
75
75
|
import "./chunk-JPLUGGRV.mjs";
|
|
@@ -82,7 +82,7 @@ import "./chunk-YS3TRKCG.mjs";
|
|
|
82
82
|
import "./chunk-SKNL7VA2.mjs";
|
|
83
83
|
import "./chunk-2A3EQHXX.mjs";
|
|
84
84
|
import "./chunk-JNZ4TDWM.mjs";
|
|
85
|
-
import "./chunk-
|
|
85
|
+
import "./chunk-F6SJAKFJ.mjs";
|
|
86
86
|
import "./chunk-4SIYUGRY.mjs";
|
|
87
87
|
import "./chunk-C4NCTZLM.mjs";
|
|
88
88
|
import "./chunk-FUZEBRP3.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aj as ReadonlyMiddlewareStore, ak as FarmMiddlewareConfig, al as MiddlewareModule, am as MiddlewareConfig, an as MiddlewareContext } from './client-plugins-
|
|
1
|
+
import { aj as ReadonlyMiddlewareStore, ak as FarmMiddlewareConfig, al as MiddlewareModule, am as MiddlewareConfig, an as MiddlewareContext } from './client-plugins-JXXmZliS.mjs';
|
|
2
2
|
import { R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.mjs';
|
|
3
3
|
import { R as ResolvedFarmServerConfig } from './workflows-CR9ex-gz.mjs';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aj as ReadonlyMiddlewareStore, ak as FarmMiddlewareConfig, al as MiddlewareModule, am as MiddlewareConfig, an as MiddlewareContext } from './client-plugins-
|
|
1
|
+
import { aj as ReadonlyMiddlewareStore, ak as FarmMiddlewareConfig, al as MiddlewareModule, am as MiddlewareConfig, an as MiddlewareContext } from './client-plugins-C089bQhN.js';
|
|
2
2
|
import { R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.js';
|
|
3
3
|
import { R as ResolvedFarmServerConfig } from './workflows-CR9ex-gz.js';
|
|
4
4
|
|
package/dist/renderer-client.cjs
CHANGED
|
@@ -2805,6 +2805,8 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2805
2805
|
constructor(config = {}) {
|
|
2806
2806
|
this.entries = /* @__PURE__ */ new Map();
|
|
2807
2807
|
this.inflight = /* @__PURE__ */ new Map();
|
|
2808
|
+
/** Local entries by tag, so tag counts and pruning never scan unrelated entries. */
|
|
2809
|
+
this.entriesByTag = /* @__PURE__ */ new Map();
|
|
2808
2810
|
this.invalidatedTagVersions = /* @__PURE__ */ new Map();
|
|
2809
2811
|
this.activeGenerations = /* @__PURE__ */ new Set();
|
|
2810
2812
|
this.version = 0;
|
|
@@ -2823,6 +2825,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2823
2825
|
configure(config = {}) {
|
|
2824
2826
|
this.generation++;
|
|
2825
2827
|
this.entries.clear();
|
|
2828
|
+
this.entriesByTag.clear();
|
|
2826
2829
|
this.inflight.clear();
|
|
2827
2830
|
this.invalidatedTagVersions.clear();
|
|
2828
2831
|
this.activeGenerations.clear();
|
|
@@ -2989,14 +2992,12 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
2989
2992
|
return entry;
|
|
2990
2993
|
}
|
|
2991
2994
|
delete(key) {
|
|
2992
|
-
const deleted = this.
|
|
2993
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
2995
|
+
const deleted = this.deleteLocalEntry(key);
|
|
2994
2996
|
emitFarmEvent({ type: "cache.delete", key, deleted });
|
|
2995
2997
|
return deleted;
|
|
2996
2998
|
}
|
|
2997
2999
|
async deleteAsync(key) {
|
|
2998
|
-
const deleted = this.
|
|
2999
|
-
if (deleted) this.pruneInvalidatedTagVersions();
|
|
3000
|
+
const deleted = this.deleteLocalEntry(key);
|
|
3000
3001
|
if (this.adapter) {
|
|
3001
3002
|
await this.adapter.delete(this.createAdapterKey(key));
|
|
3002
3003
|
}
|
|
@@ -3007,6 +3008,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
3007
3008
|
const count = this.entries.size;
|
|
3008
3009
|
this.generation++;
|
|
3009
3010
|
this.entries.clear();
|
|
3011
|
+
this.entriesByTag.clear();
|
|
3010
3012
|
this.inflight.clear();
|
|
3011
3013
|
this.invalidatedTagVersions.clear();
|
|
3012
3014
|
this.activeGenerations.clear();
|
|
@@ -3092,23 +3094,32 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
3092
3094
|
return cached.value;
|
|
3093
3095
|
}
|
|
3094
3096
|
const inflight = this.inflight.get(key);
|
|
3095
|
-
if (inflight) {
|
|
3097
|
+
if (inflight && !this.wasInvalidatedSince(inflight.tags, inflight.startVersion)) {
|
|
3096
3098
|
emitFarmEvent({ type: "cache.dedupe", key });
|
|
3097
|
-
return inflight;
|
|
3099
|
+
return inflight.promise;
|
|
3098
3100
|
}
|
|
3099
3101
|
const tags = Array.from(normalizeCacheOptionsTags(options));
|
|
3100
3102
|
const generation = this.generation;
|
|
3103
|
+
const startVersion = this.version;
|
|
3101
3104
|
const promise = this.fillCacheEntry(key, producer, options, tags, generation).catch((error) => {
|
|
3102
3105
|
emitFarmEvent({ type: "cache.error", key, operation: "set", error });
|
|
3103
3106
|
throw error;
|
|
3104
3107
|
}).finally(() => {
|
|
3105
|
-
if (this.inflight.get(key) === promise) {
|
|
3108
|
+
if (this.inflight.get(key)?.promise === promise) {
|
|
3106
3109
|
this.inflight.delete(key);
|
|
3107
3110
|
}
|
|
3108
3111
|
});
|
|
3109
|
-
this.inflight.set(key, promise);
|
|
3112
|
+
this.inflight.set(key, { promise, tags, startVersion });
|
|
3110
3113
|
return promise;
|
|
3111
3114
|
}
|
|
3115
|
+
/** A fill that started before one of its tags was invalidated cannot satisfy later readers. */
|
|
3116
|
+
wasInvalidatedSince(tags, version) {
|
|
3117
|
+
for (const tag of tags) {
|
|
3118
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
3119
|
+
if (invalidatedVersion !== void 0 && invalidatedVersion > version) return true;
|
|
3120
|
+
}
|
|
3121
|
+
return false;
|
|
3122
|
+
}
|
|
3112
3123
|
async fillCacheEntry(key, producer, options, tags, generation) {
|
|
3113
3124
|
const adapter = this.adapter;
|
|
3114
3125
|
const namespace = this.namespace;
|
|
@@ -3149,7 +3160,7 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
3149
3160
|
return value;
|
|
3150
3161
|
} finally {
|
|
3151
3162
|
this.activeGenerations.delete(activeGeneration);
|
|
3152
|
-
this.pruneInvalidatedTagVersions();
|
|
3163
|
+
this.pruneInvalidatedTagVersions(activeGeneration.tags);
|
|
3153
3164
|
if (leaseToken && adapter?.releaseLease) {
|
|
3154
3165
|
try {
|
|
3155
3166
|
await adapter.releaseLease(leaseKey, leaseToken);
|
|
@@ -3194,18 +3205,9 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
3194
3205
|
}
|
|
3195
3206
|
return void 0;
|
|
3196
3207
|
}
|
|
3197
|
-
countEntriesForTag(tag) {
|
|
3198
|
-
let count = 0;
|
|
3199
|
-
for (const entry of this.entries.values()) {
|
|
3200
|
-
if (entry.tags.has(tag)) {
|
|
3201
|
-
count++;
|
|
3202
|
-
}
|
|
3203
|
-
}
|
|
3204
|
-
return count;
|
|
3205
|
-
}
|
|
3206
3208
|
countEntriesForTags(tags) {
|
|
3207
3209
|
let count = 0;
|
|
3208
|
-
for (const entry of this.
|
|
3210
|
+
for (const entry of this.entriesByTag.get(tags[0]) ?? []) {
|
|
3209
3211
|
if (tags.every((tag) => entry.tags.has(tag))) {
|
|
3210
3212
|
count++;
|
|
3211
3213
|
}
|
|
@@ -3213,10 +3215,10 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
3213
3215
|
return count;
|
|
3214
3216
|
}
|
|
3215
3217
|
invalidateTag(normalizedTag) {
|
|
3216
|
-
const count = this.
|
|
3218
|
+
const count = this.entriesByTag.get(normalizedTag)?.size ?? 0;
|
|
3217
3219
|
this.invalidatedTagVersions.delete(normalizedTag);
|
|
3218
3220
|
this.invalidatedTagVersions.set(normalizedTag, ++this.version);
|
|
3219
|
-
this.pruneInvalidatedTagVersions();
|
|
3221
|
+
this.pruneInvalidatedTagVersions([normalizedTag]);
|
|
3220
3222
|
return count;
|
|
3221
3223
|
}
|
|
3222
3224
|
toPublicEntry(entry) {
|
|
@@ -3246,19 +3248,51 @@ var _FarmDataCache = class _FarmDataCache {
|
|
|
3246
3248
|
this.entries.set(key, entry);
|
|
3247
3249
|
}
|
|
3248
3250
|
storeLocalEntry(entry) {
|
|
3249
|
-
|
|
3251
|
+
const removed = [];
|
|
3252
|
+
const replaced = this.detachLocalEntry(entry.key);
|
|
3253
|
+
if (replaced) removed.push(replaced);
|
|
3250
3254
|
this.entries.set(entry.key, entry);
|
|
3255
|
+
for (const tag of entry.tags) {
|
|
3256
|
+
let tagged = this.entriesByTag.get(tag);
|
|
3257
|
+
if (!tagged) this.entriesByTag.set(tag, tagged = /* @__PURE__ */ new Set());
|
|
3258
|
+
tagged.add(entry);
|
|
3259
|
+
}
|
|
3251
3260
|
while (this.entries.size > this.maxEntries) {
|
|
3252
3261
|
const oldestKey = this.entries.keys().next().value;
|
|
3253
3262
|
if (oldestKey === void 0) break;
|
|
3254
|
-
this.
|
|
3263
|
+
removed.push(this.detachLocalEntry(oldestKey));
|
|
3255
3264
|
}
|
|
3256
|
-
this.pruneInvalidatedTagVersions();
|
|
3265
|
+
for (const removedEntry of removed) this.pruneInvalidatedTagVersions(removedEntry.tags);
|
|
3257
3266
|
}
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3267
|
+
deleteLocalEntry(key) {
|
|
3268
|
+
const entry = this.detachLocalEntry(key);
|
|
3269
|
+
if (!entry) return false;
|
|
3270
|
+
this.pruneInvalidatedTagVersions(entry.tags);
|
|
3271
|
+
return true;
|
|
3272
|
+
}
|
|
3273
|
+
detachLocalEntry(key) {
|
|
3274
|
+
const entry = this.entries.get(key);
|
|
3275
|
+
if (!entry) return void 0;
|
|
3276
|
+
this.entries.delete(key);
|
|
3277
|
+
for (const tag of entry.tags) {
|
|
3278
|
+
const tagged = this.entriesByTag.get(tag);
|
|
3279
|
+
if (!tagged) continue;
|
|
3280
|
+
tagged.delete(entry);
|
|
3281
|
+
if (tagged.size === 0) this.entriesByTag.delete(tag);
|
|
3282
|
+
}
|
|
3283
|
+
return entry;
|
|
3284
|
+
}
|
|
3285
|
+
/**
|
|
3286
|
+
* Drop invalidation versions that no local entry or active fill can be stale against.
|
|
3287
|
+
* Callers pass only the tags whose dependents just changed, so the cost is bounded by
|
|
3288
|
+
* the entries sharing those tags rather than by the whole cache.
|
|
3289
|
+
*/
|
|
3290
|
+
pruneInvalidatedTagVersions(tags) {
|
|
3291
|
+
tags: for (const tag of tags) {
|
|
3292
|
+
const invalidatedVersion = this.invalidatedTagVersions.get(tag);
|
|
3293
|
+
if (invalidatedVersion === void 0) continue;
|
|
3294
|
+
for (const entry of this.entriesByTag.get(tag) ?? []) {
|
|
3295
|
+
if (entry.createdVersion < invalidatedVersion) continue tags;
|
|
3262
3296
|
}
|
|
3263
3297
|
for (const generation of this.activeGenerations) {
|
|
3264
3298
|
if (generation.tags.has(tag) && generation.createdVersion < invalidatedVersion)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { FarmRouterRouteInput } from './router.mjs';
|
|
2
|
-
import { F as FarmNavigationState, a as FarmNavigateOptions } from './spa-router-
|
|
2
|
+
import { F as FarmNavigationState, a as FarmNavigateOptions } from './spa-router-CQWiYGxS.mjs';
|
|
3
3
|
import { F as FarmClientCacheStatus } from './client-cache-di_Nasxa.mjs';
|
|
4
4
|
import { ServerFn } from './server-fn.mjs';
|
|
5
5
|
import { ServerQuery } from './server-query.mjs';
|
|
6
6
|
import { S as ServerQueryFetchOptions } from './server-query-runtime-aP52iuL5.mjs';
|
|
7
7
|
import { F as FarmThemeSnapshot, a as FarmThemePreference } from './types-DQnyD3VD.mjs';
|
|
8
8
|
import { F as FarmI18nClientSnapshot, a as FarmTranslator, b as FarmI18nLocale } from './types-Z0aotQ8w.mjs';
|
|
9
|
-
import './client-plugins-
|
|
9
|
+
import './client-plugins-JXXmZliS.mjs';
|
|
10
10
|
import './lifecycle-DK06VuKP.mjs';
|
|
11
|
-
import './route-
|
|
11
|
+
import './route-B0XrsrFk.mjs';
|
|
12
|
+
import './endpoint-DAc96i93.mjs';
|
|
12
13
|
import './cache.mjs';
|
|
13
14
|
import './renderer.mjs';
|
|
14
15
|
import './deployment.mjs';
|
|
@@ -38,7 +39,7 @@ import './font.mjs';
|
|
|
38
39
|
import './after.mjs';
|
|
39
40
|
import 'node:http';
|
|
40
41
|
import './island-CfGru1MO.mjs';
|
|
41
|
-
import './render-plan-
|
|
42
|
+
import './render-plan-BLIfc4jt.mjs';
|
|
42
43
|
|
|
43
44
|
interface FarmClientStore<TSnapshot> {
|
|
44
45
|
getSnapshot(): TSnapshot;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { FarmRouterRouteInput } from './router.js';
|
|
2
|
-
import { F as FarmNavigationState, a as FarmNavigateOptions } from './spa-router-
|
|
2
|
+
import { F as FarmNavigationState, a as FarmNavigateOptions } from './spa-router-Wjiw-8hB.js';
|
|
3
3
|
import { F as FarmClientCacheStatus } from './client-cache-Deoqq-nM.js';
|
|
4
4
|
import { ServerFn } from './server-fn.js';
|
|
5
5
|
import { ServerQuery } from './server-query.js';
|
|
6
6
|
import { S as ServerQueryFetchOptions } from './server-query-runtime-DXRNhX_3.js';
|
|
7
7
|
import { F as FarmThemeSnapshot, a as FarmThemePreference } from './types-DQnyD3VD.js';
|
|
8
8
|
import { F as FarmI18nClientSnapshot, a as FarmTranslator, b as FarmI18nLocale } from './types-Z0aotQ8w.js';
|
|
9
|
-
import './client-plugins-
|
|
9
|
+
import './client-plugins-C089bQhN.js';
|
|
10
10
|
import './lifecycle-DK06VuKP.js';
|
|
11
|
-
import './route-
|
|
11
|
+
import './route-DOEpbyWZ.js';
|
|
12
|
+
import './endpoint-1zA994xL.js';
|
|
12
13
|
import './cache.js';
|
|
13
14
|
import './renderer.js';
|
|
14
15
|
import './deployment.js';
|
|
@@ -38,7 +39,7 @@ import './font.js';
|
|
|
38
39
|
import './after.js';
|
|
39
40
|
import 'node:http';
|
|
40
41
|
import './island-CfGru1MO.js';
|
|
41
|
-
import './render-plan-
|
|
42
|
+
import './render-plan-DOB9cV-h.js';
|
|
42
43
|
|
|
43
44
|
interface FarmClientStore<TSnapshot> {
|
|
44
45
|
getSnapshot(): TSnapshot;
|
package/dist/renderer-client.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
attachRevalidationListeners,
|
|
7
7
|
createServerQueryCallKey,
|
|
8
8
|
fetchServerQuery
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UUYF3CHN.mjs";
|
|
10
10
|
import {
|
|
11
11
|
getTheme,
|
|
12
12
|
setTheme,
|
|
@@ -30,7 +30,7 @@ import "./chunk-2PQNJXFM.mjs";
|
|
|
30
30
|
import "./chunk-5HGR3W6O.mjs";
|
|
31
31
|
import {
|
|
32
32
|
getFarmClientDataCache
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-5SPPCN5J.mjs";
|
|
34
34
|
import "./chunk-QVYLBY73.mjs";
|
|
35
35
|
import "./chunk-KGB5UXJJ.mjs";
|
|
36
36
|
import {
|
|
@@ -40,7 +40,7 @@ import "./chunk-YS3TRKCG.mjs";
|
|
|
40
40
|
import "./chunk-SKNL7VA2.mjs";
|
|
41
41
|
import "./chunk-2A3EQHXX.mjs";
|
|
42
42
|
import "./chunk-JNZ4TDWM.mjs";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-F6SJAKFJ.mjs";
|
|
44
44
|
import "./chunk-4SIYUGRY.mjs";
|
|
45
45
|
import "./chunk-C4NCTZLM.mjs";
|
|
46
46
|
import "./chunk-FUZEBRP3.mjs";
|
package/dist/request.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { g as getCurrentRequest } from './request-
|
|
2
|
-
import './client-plugins-
|
|
1
|
+
export { g as getCurrentRequest } from './request-Cr53NRHr.mjs';
|
|
2
|
+
import './client-plugins-JXXmZliS.mjs';
|
|
3
3
|
import './lifecycle-DK06VuKP.mjs';
|
|
4
|
-
import './route-
|
|
4
|
+
import './route-B0XrsrFk.mjs';
|
|
5
|
+
import './endpoint-DAc96i93.mjs';
|
|
5
6
|
import './cache.mjs';
|
|
6
7
|
import './renderer.mjs';
|
|
7
8
|
import './deployment.mjs';
|
|
@@ -28,6 +29,8 @@ import './server-fn-error-DDh14a0V.mjs';
|
|
|
28
29
|
import 'esbuild';
|
|
29
30
|
import './image-config-Duob7wER.mjs';
|
|
30
31
|
import './types-Z0aotQ8w.mjs';
|
|
32
|
+
import './server-fn.mjs';
|
|
33
|
+
import './server-query.mjs';
|
|
31
34
|
import './types-DQnyD3VD.mjs';
|
|
32
35
|
import './font.mjs';
|
|
33
36
|
import './after.mjs';
|
package/dist/request.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { g as getCurrentRequest } from './request-
|
|
2
|
-
import './client-plugins-
|
|
1
|
+
export { g as getCurrentRequest } from './request-Dt2gNuQD.js';
|
|
2
|
+
import './client-plugins-C089bQhN.js';
|
|
3
3
|
import './lifecycle-DK06VuKP.js';
|
|
4
|
-
import './route-
|
|
4
|
+
import './route-DOEpbyWZ.js';
|
|
5
|
+
import './endpoint-1zA994xL.js';
|
|
5
6
|
import './cache.js';
|
|
6
7
|
import './renderer.js';
|
|
7
8
|
import './deployment.js';
|
|
@@ -28,6 +29,8 @@ import './server-fn-error-DDh14a0V.js';
|
|
|
28
29
|
import 'esbuild';
|
|
29
30
|
import './image-config-Duob7wER.js';
|
|
30
31
|
import './types-Z0aotQ8w.js';
|
|
32
|
+
import './server-fn.js';
|
|
33
|
+
import './server-query.js';
|
|
31
34
|
import './types-DQnyD3VD.js';
|
|
32
35
|
import './font.js';
|
|
33
36
|
import './after.js';
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { E as EndpointMiddlewareResult, R as RouteSchema, a as RouteSchemaOutput, b as EndpointMCPOptions, A as AnyEndpointMiddleware, I as InferEndpointMiddlewareContext, T as TypedEndpoint, c as RouteSchemaInput } from './endpoint-DAc96i93.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<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<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
|
+
|
|
128
|
+
export { type PluginRoutesFactory as P, type RouteMethod as R, type RoutePathParams as a, type RouteInputSchemas as b, type RouteJSON as c, type RouteDefinition as d, type RouteOptions as e, type RouteFactory as f, type PluginRoutes as g, type PluginLocalAPIEndpoint as h, type PluginLocalAPI as i, createRouteFactory as j, type PluginAPIRouter as k, resolvePluginRoutes as r };
|