@farm.js/core 0.1.26 → 0.1.27
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 +7 -9
- package/dist/agent-runtime.d.ts +7 -9
- package/dist/api/client.cjs +3 -3
- package/dist/api/client.d.mts +4 -5
- package/dist/api/client.d.ts +4 -5
- package/dist/api/client.mjs +2 -2
- package/dist/api/route-manager.cjs +6 -5
- package/dist/api/route-manager.d.mts +6 -8
- package/dist/api/route-manager.d.ts +6 -8
- package/dist/api/route-manager.mjs +5 -4
- package/dist/api/runtime.cjs +10 -4
- package/dist/api/runtime.d.mts +35 -3
- package/dist/api/runtime.d.ts +35 -3
- package/dist/api/runtime.mjs +9 -3
- package/dist/{api-client-Cx54IR5g.d.mts → api-client-BjMmY8OD.d.mts} +2 -3
- package/dist/{api-client-DykpaKcY.d.ts → api-client-CyFtZFJ4.d.ts} +2 -3
- package/dist/api.cjs +9 -8
- package/dist/api.d.mts +8 -10
- package/dist/api.d.ts +8 -10
- package/dist/api.mjs +9 -8
- package/dist/{app-29vG5tmY.d.mts → app-BfzZdjgX.d.mts} +3 -4
- package/dist/{app-Cx71s_PT.d.ts → app-CXK7Prrt.d.ts} +3 -4
- package/dist/app-markdown.cjs +10 -4
- package/dist/app-markdown.d.mts +8 -10
- package/dist/app-markdown.d.ts +8 -10
- package/dist/app-markdown.mjs +9 -3
- package/dist/{chunk-74RZNRY6.mjs → chunk-3PTVHMLD.mjs} +1 -1
- package/dist/{chunk-OFKG57MZ.mjs → chunk-4FHDV7VM.mjs} +2 -2
- package/dist/{chunk-KLSSO6YD.mjs → chunk-4UNKCNSL.mjs} +1 -1
- package/dist/chunk-5MKEDGLD.cjs +53 -0
- package/dist/{chunk-2CT6XUNO.cjs → chunk-DQMTHWPI.cjs} +4 -4
- package/dist/{chunk-ALIFMS4A.cjs → chunk-FOT7LZEO.cjs} +1 -1
- package/dist/{chunk-DU2CASV6.mjs → chunk-FPW4W3VW.mjs} +1 -1
- package/dist/{chunk-RCYINC4A.cjs → chunk-HF5SIACK.cjs} +3 -3
- package/dist/{chunk-ARXCHQLX.mjs → chunk-HG237IEY.mjs} +4 -4
- package/dist/{chunk-BD2U4ZL6.cjs → chunk-JQGDQO2I.cjs} +8 -8
- package/dist/{chunk-RAI7NULA.mjs → chunk-JT25KHDI.mjs} +1 -1
- package/dist/{chunk-WFPRVVF2.cjs → chunk-KAERLFD3.cjs} +16 -11
- package/dist/{chunk-H7CJRJ4L.cjs → chunk-LAHZ7LZA.cjs} +16 -16
- package/dist/{chunk-JM5GQL4H.mjs → chunk-MBFURXAC.mjs} +1 -1
- package/dist/{chunk-QLXEYIAW.cjs → chunk-NPFGGBM5.cjs} +13 -13
- package/dist/{chunk-VZWO3XVL.mjs → chunk-O2LV5XDG.mjs} +2 -2
- package/dist/chunk-O6XNAMBV.mjs +53 -0
- package/dist/{chunk-UXQXGB5A.mjs → chunk-OGHTEYXS.mjs} +11 -10
- package/dist/{chunk-OOIL3BWR.mjs → chunk-POXI72VV.mjs} +12 -0
- package/dist/{chunk-QGG336NI.mjs → chunk-Q4BHBO6V.mjs} +1 -1
- package/dist/{chunk-3WSWXPYM.cjs → chunk-QI7WQSMI.cjs} +4 -4
- package/dist/{chunk-PPIW3MH6.mjs → chunk-QQQNJS2E.mjs} +1 -1
- package/dist/{chunk-W2HZKYES.cjs → chunk-TDWFCC2T.cjs} +2 -2
- package/dist/{chunk-3TQG7CGC.cjs → chunk-UNSKL6BI.cjs} +78 -77
- package/dist/{chunk-QPPQHB6X.mjs → chunk-UWTQTZFN.mjs} +17 -11
- package/dist/{chunk-YMUH2BLR.mjs → chunk-WIVTGKLY.mjs} +7 -2
- package/dist/{chunk-QJ4D3UKJ.cjs → chunk-WJKVTJJR.cjs} +4 -4
- package/dist/{chunk-OAVTUMJP.cjs → chunk-YXM74XOW.cjs} +9 -9
- package/dist/{chunk-SZ4LYNUX.cjs → chunk-YZBV7733.cjs} +82 -76
- package/dist/{chunk-QIH2HD6H.cjs → chunk-ZSO5GWGD.cjs} +33 -21
- package/dist/{client-plugins-B8RPJnot.d.mts → client-plugins-1GS4zubE.d.mts} +1799 -1623
- package/dist/{client-plugins-bPBf4haK.d.ts → client-plugins-B1Za6F5x.d.ts} +1799 -1623
- package/dist/client-plugins.d.mts +7 -9
- package/dist/client-plugins.d.ts +7 -9
- package/dist/client.cjs +4 -4
- package/dist/client.d.mts +9 -11
- package/dist/client.d.ts +9 -11
- package/dist/client.mjs +3 -3
- package/dist/config.d.mts +7 -9
- package/dist/config.d.ts +7 -9
- package/dist/{devtools-5D4ZDRPR.mjs → devtools-6RN6KHTW.mjs} +6 -3
- package/dist/{devtools-QZJEUOJW.cjs → devtools-CQJ3H6MX.cjs} +7 -4
- package/dist/docs.cjs +9 -6
- package/dist/docs.mjs +8 -5
- package/dist/{endpoint-1zA994xL.d.ts → endpoint-CA-TNX60.d.ts} +1 -1
- package/dist/{endpoint-DAc96i93.d.mts → endpoint-CCHFqyTE.d.mts} +1 -1
- package/dist/index.cjs +21 -20
- package/dist/index.d.mts +15 -17
- package/dist/index.d.ts +15 -17
- package/dist/index.mjs +21 -20
- package/dist/{integration-api-BbaiokCC.d.ts → integration-api-0y4FXJpC.d.mts} +128 -1
- package/dist/{integration-api-BbaiokCC.d.mts → integration-api-BPJo5oXb.d.ts} +128 -1
- package/dist/integrations.d.mts +7 -9
- package/dist/integrations.d.ts +7 -9
- package/dist/internal/app-markdown-runtime.cjs +9 -3
- package/dist/internal/app-markdown-runtime.d.mts +8 -9
- package/dist/internal/app-markdown-runtime.d.ts +8 -9
- package/dist/internal/app-markdown-runtime.mjs +8 -2
- package/dist/internal/build-runtime.cjs +17 -16
- package/dist/internal/build-runtime.d.mts +9 -11
- package/dist/internal/build-runtime.d.ts +9 -11
- package/dist/internal/build-runtime.mjs +16 -15
- package/dist/internal/cli-runtime.cjs +8 -5
- package/dist/internal/cli-runtime.mjs +7 -4
- package/dist/internal/client-error-overlay.cjs +4 -4
- package/dist/internal/client-error-overlay.mjs +1 -1
- package/dist/internal/compression-runtime.d.mts +7 -9
- package/dist/internal/compression-runtime.d.ts +7 -9
- package/dist/internal/config-runtime.cjs +7 -4
- package/dist/internal/config-runtime.d.mts +8 -10
- package/dist/internal/config-runtime.d.ts +8 -10
- package/dist/internal/config-runtime.mjs +6 -3
- package/dist/internal/product-telemetry-runtime.cjs +2 -2
- package/dist/internal/product-telemetry-runtime.mjs +1 -1
- package/dist/internal/production-runtime.cjs +7 -5
- package/dist/internal/production-runtime.d.mts +12 -14
- package/dist/internal/production-runtime.d.ts +12 -14
- package/dist/internal/production-runtime.mjs +6 -4
- package/dist/markdown.cjs +8 -2
- package/dist/markdown.d.mts +35 -153
- package/dist/markdown.d.ts +35 -153
- package/dist/markdown.mjs +7 -1
- package/dist/{metadata-CzBP4Mfp.d.ts → metadata-7LKgQEWF.d.ts} +1 -1
- package/dist/{metadata-C3na4CBj.d.mts → metadata-B9mCxKgp.d.mts} +1 -1
- package/dist/middleware.d.mts +8 -10
- package/dist/middleware.d.ts +8 -10
- package/dist/navigation.d.mts +9 -11
- package/dist/navigation.d.ts +9 -11
- package/dist/{nitro-ZKLGOTVY.mjs → nitro-NAKCRVHX.mjs} +4 -3
- package/dist/{nitro-KQDU7CFE.cjs → nitro-VYDZGYFY.cjs} +4 -3
- package/dist/plugin.cjs +13 -12
- package/dist/plugin.d.mts +8 -10
- package/dist/plugin.d.ts +8 -10
- package/dist/plugin.mjs +12 -11
- package/dist/{production-runtime-CYg4wM4E.d.ts → production-runtime-B3xnY6fI.d.ts} +1 -1
- package/dist/{production-runtime-DP94hPGe.d.mts → production-runtime-DramhI0c.d.mts} +1 -1
- package/dist/{render-plan-Bl6Fzg5z.d.ts → render-plan-CpW32tOL.d.ts} +1 -1
- package/dist/{render-plan-CKAJg0jC.d.mts → render-plan-CtQB-zHS.d.mts} +1 -1
- package/dist/renderer-client.d.mts +5 -7
- package/dist/renderer-client.d.ts +5 -7
- package/dist/{request-CR-Bp1Px.d.ts → request-BVGGeQv4.d.ts} +1 -1
- package/dist/{request-CrBCcPZZ.d.mts → request-DlLVBKe3.d.mts} +1 -1
- package/dist/request.d.mts +8 -10
- package/dist/request.d.ts +8 -10
- package/dist/{route-rendering-CZH5FegB.d.ts → route-rendering-BdEldajn.d.ts} +1 -1
- package/dist/{route-rendering-C1NAHo-C.d.mts → route-rendering-DChYLNdh.d.mts} +1 -1
- package/dist/{router-Cg_kD3Bd.d.ts → router-D0Az-1Nu.d.ts} +1 -1
- package/dist/{router-B57eDJ3u.d.mts → router-D5htHn_M.d.mts} +1 -1
- package/dist/routes.d.mts +5 -7
- package/dist/routes.d.ts +5 -7
- package/dist/server-fn-client.d.mts +3 -4
- package/dist/server-fn-client.d.ts +3 -4
- package/dist/server-fn.d.mts +1 -1
- package/dist/server-fn.d.ts +1 -1
- package/dist/server-plugins.d.mts +7 -9
- package/dist/server-plugins.d.ts +7 -9
- package/dist/server-query-client.d.mts +1 -1
- package/dist/server-query-client.d.ts +1 -1
- package/dist/server-query.d.mts +1 -1
- package/dist/server-query.d.ts +1 -1
- package/dist/server.cjs +198 -104
- package/dist/server.d.mts +12 -14
- package/dist/server.d.ts +12 -14
- package/dist/server.mjs +184 -90
- package/dist/{spa-router-DTdbuinx.d.mts → spa-router-DVfSJZ5o.d.mts} +2 -2
- package/dist/{spa-router-BstQUO6Q.d.ts → spa-router-DmwP_7QL.d.ts} +2 -2
- package/dist/testing.cjs +6 -5
- package/dist/testing.d.mts +6 -8
- package/dist/testing.d.ts +6 -8
- package/dist/testing.mjs +5 -4
- package/dist/{utils-CS3ZLnEJ.d.mts → utils-B_Rmr0-n.d.mts} +1 -1
- package/dist/{utils-D3rdsIvM.d.ts → utils-Dv0OuLtF.d.ts} +1 -1
- package/dist/version.cjs +2 -2
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +13 -12
- package/dist/vite.d.mts +7 -9
- package/dist/vite.d.ts +7 -9
- package/dist/vite.mjs +12 -11
- package/package.json +1 -1
- package/dist/route-B0XrsrFk.d.mts +0 -128
- package/dist/route-DOEpbyWZ.d.ts +0 -128
- package/dist/{chunk-GDUYXFIS.mjs → chunk-6EG7U4NF.mjs} +3 -3
- package/dist/{chunk-YAOX43YI.cjs → chunk-C7OUJ6JI.cjs} +2 -2
- package/dist/{chunk-IXTFU4PL.cjs → chunk-NL3ZSMZB.cjs} +2 -2
- package/dist/{chunk-L6V3P73N.mjs → chunk-UOXGA6TO.mjs} +4 -4
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { n as FarmClientPlugin } from './lifecycle-DK06VuKP.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import { T as TypedEndpoint,
|
|
2
|
+
import { F as FarmIntegrationAPI, e as FarmIntegrationAPIMethod, c as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes, p as PluginRoutes, P as PluginRoutesFactory, R as RouteMethod } from './integration-api-0y4FXJpC.mjs';
|
|
3
|
+
import { Y as OpenAPISecurityMode, T as TypedEndpoint, E as EndpointMCPMetadata, R as RouteSchema, b as RouteSchemaOutput, d as RouteSchemaInput } from './endpoint-CCHFqyTE.mjs';
|
|
4
4
|
import { FarmRenderer } from './renderer.mjs';
|
|
5
5
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
6
|
-
import {
|
|
6
|
+
import { ServerFn } from './server-fn.mjs';
|
|
7
|
+
import { ServerQuery } from './server-query.mjs';
|
|
8
|
+
import { g as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.mjs';
|
|
7
9
|
import { d as FarmStorageUserConfig } from './types-Cc8l9IqS.mjs';
|
|
8
10
|
import { FarmSchemaField, FarmSchema, FarmSchemaModel, FarmSchemaReference, FarmSchemaFieldType, FarmSchemaConstraint, FarmSchemaModelExtension, FarmSchemaModelOverride, defineSchema, FarmSchemaConfig } from './schema.mjs';
|
|
9
11
|
import React__default, { ComponentType, ReactNode } from 'react';
|
|
10
|
-
import { F as FarmIntegrationAPI, e as FarmIntegrationAPIMethod, c as FarmIntegrationAPIBodyFormat, f as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes } from './integration-api-BbaiokCC.mjs';
|
|
11
12
|
import { OrmClient, SchemaDefinition, ModelDefinition, FieldBuilder, JsonValue, AnyModelDefinition, SchemaModels } from '@farming-labs/orm';
|
|
12
13
|
import { a as FarmDocsUserConfig, F as FarmDocsResolvedConfig } from './types-DFbjpjXX.mjs';
|
|
13
14
|
import { L as FarmObservabilityUserConfig } from './observability-BupkiN0m.mjs';
|
|
@@ -20,377 +21,260 @@ import { FarmServerActionsConfig, ResolvedFarmServerActionsConfig } from './serv
|
|
|
20
21
|
import * as rolldown_utils from 'rolldown/utils';
|
|
21
22
|
import { Plugin } from 'rolldown';
|
|
22
23
|
import { F as FarmImageConfig, R as ResolvedFarmImageConfig } from './image-config-Duob7wER.mjs';
|
|
23
|
-
import { g as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-Z0aotQ8w.mjs';
|
|
24
24
|
import { FarmCacheUserConfig } from './cache.mjs';
|
|
25
|
-
import { ServerFn } from './server-fn.mjs';
|
|
26
|
-
import { ServerQuery } from './server-query.mjs';
|
|
27
25
|
import { R as ResolvedFarmThemeConfig, d as FarmThemeConfig } from './types-DQnyD3VD.mjs';
|
|
28
26
|
import { FarmLayoutFonts } from './font.mjs';
|
|
29
27
|
import { _withAfterNodeMiddleware } from './after.mjs';
|
|
30
28
|
import { F as FarmIslandStrategy } from './island-CfGru1MO.mjs';
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
description?: string;
|
|
36
|
-
}
|
|
37
|
-
interface FarmLlmsTxtSection {
|
|
38
|
-
title: string;
|
|
39
|
-
links: FarmLlmsTxtLink[];
|
|
40
|
-
}
|
|
41
|
-
interface FarmLlmsTxt {
|
|
42
|
-
/** Site or project name, rendered as the `# H1`. Required by the format. */
|
|
43
|
-
title: string;
|
|
44
|
-
/** One-sentence summary, rendered as a `> blockquote`. */
|
|
45
|
-
summary?: string;
|
|
46
|
-
/** Free-form Markdown placed after the summary. */
|
|
47
|
-
details?: string;
|
|
48
|
-
/** `## H2` sections of links. A section titled "Optional" marks skippable links. */
|
|
49
|
-
sections?: FarmLlmsTxtSection[];
|
|
30
|
+
/** @internal The environment registry is owned and closed by Vite. */
|
|
31
|
+
interface FarmDevModuleServer {
|
|
32
|
+
environments: Record<string, unknown>;
|
|
50
33
|
}
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
/** The page's route path, such as `/docs/install`. */
|
|
54
|
-
path: string;
|
|
34
|
+
/** @internal Distinguishes an unsupported runtime from a module evaluation error. */
|
|
35
|
+
declare class FarmDevEnvironmentError extends Error {
|
|
55
36
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
37
|
+
/** @internal Load in the selected environment without sharing SSR/RSC module state. */
|
|
38
|
+
declare function loadFarmDevModule<T = Record<string, any>>(server: FarmDevModuleServer, id: string, environmentName?: "ssr" | "rsc"): Promise<T>;
|
|
39
|
+
|
|
40
|
+
type ResolvedSchemaField = FarmSchemaField & {
|
|
41
|
+
name: string;
|
|
42
|
+
};
|
|
43
|
+
type ResolvedSchemaModel = Omit<FarmSchemaModel, "fields"> & {
|
|
44
|
+
name: string;
|
|
45
|
+
fields: Record<string, ResolvedSchemaField>;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Resolve a schema's extensions, overrides, and name mappings.
|
|
49
|
+
*
|
|
50
|
+
* Table and column names fall back to the schema's own keys, which is what the
|
|
51
|
+
* runtime ORM uses. Any other default would generate artifacts describing
|
|
52
|
+
* tables the app cannot actually read.
|
|
53
|
+
*/
|
|
54
|
+
declare function resolveSchemaModels(ownerKey: string, schema: FarmSchema): Record<string, ResolvedSchemaModel>;
|
|
55
|
+
|
|
56
|
+
type FarmSqlDialect = "postgres" | "mysql" | "sqlite";
|
|
57
|
+
type CollectedSchemaModel = {
|
|
58
|
+
/** Namespace that owns the model: an integration key or a plugin name. */
|
|
59
|
+
ownerKey: string;
|
|
60
|
+
modelKey: string;
|
|
61
|
+
modelName: string;
|
|
62
|
+
exportName: string;
|
|
63
|
+
prismaModelName: string;
|
|
64
|
+
model: ResolvedSchemaModel;
|
|
72
65
|
/**
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
66
|
+
* Real table and column for references to models this owner describes but
|
|
67
|
+
* does not create (external, or outside its `models`), keyed by field. Only
|
|
68
|
+
* shown in comments: Farm never creates a foreign key to them.
|
|
76
69
|
*/
|
|
77
|
-
|
|
70
|
+
referenceTargets?: Record<string, {
|
|
71
|
+
table: string;
|
|
72
|
+
column: string;
|
|
73
|
+
}>;
|
|
78
74
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
75
|
+
* References to tables other owners create that may carry a real foreign
|
|
76
|
+
* key, keyed by field. Set by migrate after checking the database; only a
|
|
77
|
+
* table created now gets one inline.
|
|
82
78
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
exclude: string[];
|
|
92
|
-
full: boolean;
|
|
93
|
-
revalidate?: number;
|
|
94
|
-
}
|
|
95
|
-
interface FarmLlmsTxtPageSource {
|
|
96
|
-
pattern: string;
|
|
97
|
-
metadata?: unknown;
|
|
98
|
-
}
|
|
99
|
-
declare function collectFarmLlmsTxtPages(sources: Iterable<FarmLlmsTxtPageSource>, options: {
|
|
100
|
-
origin: string;
|
|
101
|
-
basePath?: string;
|
|
102
|
-
markdown?: FarmMarkdownResolvedConfig;
|
|
103
|
-
include?: string[];
|
|
104
|
-
exclude?: string[];
|
|
105
|
-
}): FarmLlmsTxtPage[];
|
|
106
|
-
declare function createFarmDefaultLlmsTxt(options: {
|
|
107
|
-
origin: string;
|
|
108
|
-
pages: FarmLlmsTxtPage[];
|
|
109
|
-
config: ResolvedFarmLlmsTxtConfig;
|
|
110
|
-
rootMetadata?: unknown;
|
|
111
|
-
}): FarmLlmsTxt;
|
|
79
|
+
foreignKeys?: Record<string, {
|
|
80
|
+
table: string;
|
|
81
|
+
column: string;
|
|
82
|
+
onDelete: NonNullable<FarmSchemaReference["onDelete"]>;
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
85
|
+
/** `table.column` a field's reference points at, using real names when known. */
|
|
86
|
+
declare function describeSchemaReference(model: CollectedSchemaModel, fieldKey: string): string;
|
|
112
87
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
88
|
+
* Flatten owners' schemas into one list, rejecting two models that would
|
|
89
|
+
* resolve to the same table.
|
|
90
|
+
*
|
|
91
|
+
* `only` narrows an owner to the models it actually controls; an owner handed a
|
|
92
|
+
* schema it shares with the rest of the app should not claim all of it.
|
|
116
93
|
*/
|
|
117
|
-
declare function
|
|
94
|
+
declare function collectSchemaModels(entries: ReadonlyArray<readonly [string, FarmSchema, (readonly string[])?]>): CollectedSchemaModel[];
|
|
95
|
+
type FarmSqlStatement = {
|
|
96
|
+
kind: "table" | "index" | "column";
|
|
97
|
+
/** The object this statement creates, for drift reporting. */
|
|
98
|
+
target: string;
|
|
99
|
+
sql: string;
|
|
100
|
+
};
|
|
118
101
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
102
|
+
* Emit create statements for a set of models.
|
|
103
|
+
*
|
|
104
|
+
* Everything here is derivable from the schema: nothing is inferred from a live
|
|
105
|
+
* database, so the output is stable and reviewable before it is applied.
|
|
122
106
|
*/
|
|
123
|
-
declare function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
107
|
+
declare function generateSqlStatements(models: readonly CollectedSchemaModel[], dialect: FarmSqlDialect): FarmSqlStatement[];
|
|
108
|
+
/** Render models as a standalone `.sql` file. */
|
|
109
|
+
declare function renderSqlSchemaFile(models: readonly CollectedSchemaModel[], dialect: FarmSqlDialect): string;
|
|
110
|
+
declare function getSqlColumnType(field: ResolvedSchemaField, dialect: FarmSqlDialect): "BOOLEAN" | "INTEGER" | "DOUBLE PRECISION" | "TIMESTAMPTZ" | "JSONB" | "TEXT" | "INT" | "DOUBLE" | "DATETIME" | "JSON" | "VARCHAR(255)" | "REAL";
|
|
111
|
+
declare function getSqlDefaultExpression(field: ResolvedSchemaField, dialect: FarmSqlDialect): string | null;
|
|
112
|
+
declare function isNullableField(field: ResolvedSchemaField): boolean;
|
|
113
|
+
declare function quoteSqlIdentifier(dialect: FarmSqlDialect, value: string): string;
|
|
114
|
+
declare function toSnakeCase(value: string): string;
|
|
115
|
+
declare function toPascalCase(value: string): string;
|
|
116
|
+
declare function toCamelCase(value: string): string;
|
|
117
|
+
declare function escapeSqlString(value: string, dialect?: FarmSqlDialect): string;
|
|
118
|
+
|
|
132
119
|
/**
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* not reused, so the next request tries that page again.
|
|
120
|
+
* An ordered change a plugin release makes to its own tables that Farm will
|
|
121
|
+
* not infer: a rename looks exactly like a removal plus an addition. Each step
|
|
122
|
+
* runs once per database, in the order listed.
|
|
123
|
+
*
|
|
124
|
+
* Names are the plugin's own: `model` and `to` are keys in the current
|
|
125
|
+
* schema, so the app's renames apply; `from` is the old name in the database.
|
|
140
126
|
*/
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
127
|
+
type FarmSchemaMigrationStep = {
|
|
128
|
+
id: string;
|
|
129
|
+
description?: string;
|
|
130
|
+
} & ({
|
|
131
|
+
renameColumn: {
|
|
132
|
+
model: string;
|
|
133
|
+
from: string;
|
|
134
|
+
to: string;
|
|
135
|
+
};
|
|
136
|
+
} | {
|
|
137
|
+
renameTable: {
|
|
138
|
+
from: string;
|
|
139
|
+
to: string;
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Deletes data, so it runs only with `--allow-destructive`, and only on a
|
|
144
|
+
* column or table Farm recorded this plugin creating.
|
|
145
|
+
*/
|
|
146
|
+
| {
|
|
147
|
+
dropColumn: {
|
|
148
|
+
model: string;
|
|
149
|
+
column: string;
|
|
150
|
+
};
|
|
151
|
+
} | {
|
|
152
|
+
dropTable: {
|
|
153
|
+
table: string;
|
|
154
|
+
};
|
|
155
|
+
} | {
|
|
156
|
+
/** Per dialect; a dialect without SQL cannot run the step. */
|
|
157
|
+
sql: Partial<Record<FarmSqlDialect, string | readonly string[]>>;
|
|
158
|
+
/**
|
|
159
|
+
* Custom SQL runs after this release's new tables and columns exist, so
|
|
160
|
+
* a backfill can fill them. Set `before` to run it with the renames.
|
|
161
|
+
*/
|
|
162
|
+
before?: boolean;
|
|
163
|
+
});
|
|
148
164
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
allow?: string | string[];
|
|
165
|
-
disallow?: string | string[];
|
|
166
|
-
crawlDelay?: number;
|
|
167
|
-
}
|
|
168
|
-
interface Robots {
|
|
169
|
-
rules: RobotsRule | RobotsRule[];
|
|
170
|
-
sitemap?: string | string[];
|
|
171
|
-
host?: string;
|
|
172
|
-
}
|
|
173
|
-
interface ManifestIcon {
|
|
174
|
-
src: string;
|
|
175
|
-
sizes?: string;
|
|
176
|
-
type?: string;
|
|
177
|
-
purpose?: string;
|
|
178
|
-
}
|
|
179
|
-
interface Manifest {
|
|
180
|
-
name?: string;
|
|
181
|
-
short_name?: string;
|
|
182
|
-
description?: string;
|
|
183
|
-
id?: string;
|
|
184
|
-
start_url?: string;
|
|
185
|
-
scope?: string;
|
|
186
|
-
display?: "fullscreen" | "standalone" | "minimal-ui" | "browser" | string;
|
|
187
|
-
orientation?: string;
|
|
188
|
-
background_color?: string;
|
|
189
|
-
theme_color?: string;
|
|
190
|
-
lang?: string;
|
|
191
|
-
dir?: "ltr" | "rtl" | "auto";
|
|
192
|
-
categories?: string[];
|
|
193
|
-
icons?: ManifestIcon[];
|
|
194
|
-
[key: string]: unknown;
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* The object an `llms.ts` metadata route returns, rendered as llms.txt. An
|
|
198
|
-
* `llms.ts` can also return the complete file as a string, or a `Response`.
|
|
199
|
-
*/
|
|
200
|
-
type LlmsTxt = FarmLlmsTxt;
|
|
201
|
-
type LlmsTxtSection = FarmLlmsTxtSection;
|
|
202
|
-
type LlmsTxtLink = FarmLlmsTxtLink;
|
|
203
|
-
/** A static page of the app, usable directly as an llms.txt link. */
|
|
204
|
-
type LlmsTxtPage = FarmLlmsTxtPage;
|
|
205
|
-
/** What an `llms.ts` default-export function receives. */
|
|
206
|
-
interface LlmsTxtContext extends MetadataRouteContext {
|
|
207
|
-
/** The app's static pages, linking to their Markdown mirrors when exposed. */
|
|
208
|
-
pages: LlmsTxtPage[];
|
|
209
|
-
/** The llms.txt that `agent.llmsTxt` would serve, to extend instead of replace. */
|
|
210
|
-
defaults: LlmsTxt;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* What an `llms-full.ts` default-export function receives. Returning an
|
|
214
|
-
* `LlmsTxt` object inlines each same-origin link's Markdown; returning a string
|
|
215
|
-
* serves it as the complete file.
|
|
216
|
-
*/
|
|
217
|
-
interface LlmsFullTxtContext extends LlmsTxtContext {
|
|
218
|
-
/** A page's Markdown mirror, read without the request's cookies; `null` if unavailable. */
|
|
219
|
-
markdown(url: string): Promise<string | null>;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
interface MetadataRouteContext {
|
|
223
|
-
request: Request;
|
|
224
|
-
params: Record<string, string>;
|
|
225
|
-
searchParams: URLSearchParams;
|
|
226
|
-
/** The concrete route-segment path that owns the metadata file. */
|
|
227
|
-
path: string;
|
|
165
|
+
/**
|
|
166
|
+
* Typed, validated plugin options.
|
|
167
|
+
*
|
|
168
|
+
* A plugin factory takes one options object. Describing it with a Standard
|
|
169
|
+
* Schema (Zod, Valibot, ArkType, ...) gives the call site its input type for
|
|
170
|
+
* autocomplete, gives the plugin the parsed type with defaults applied, and
|
|
171
|
+
* rejects bad options while the config loads instead of deep inside a hook.
|
|
172
|
+
*/
|
|
173
|
+
type MaybePromise$2<T> = T | Promise<T>;
|
|
174
|
+
type FarmPluginOptionsIssuePathSegment = PropertyKey | {
|
|
175
|
+
readonly key: PropertyKey;
|
|
176
|
+
};
|
|
177
|
+
interface FarmPluginOptionsIssue {
|
|
178
|
+
readonly message: string;
|
|
179
|
+
readonly path?: ReadonlyArray<FarmPluginOptionsIssuePathSegment> | undefined;
|
|
228
180
|
}
|
|
229
|
-
|
|
230
|
-
|
|
181
|
+
type FarmPluginOptionsResult<TOutput> = {
|
|
182
|
+
readonly value: TOutput;
|
|
183
|
+
readonly issues?: undefined;
|
|
184
|
+
} | {
|
|
185
|
+
readonly issues: ReadonlyArray<FarmPluginOptionsIssue>;
|
|
186
|
+
};
|
|
187
|
+
/** The part of the Standard Schema interface plugin options need. */
|
|
188
|
+
interface FarmPluginOptionsSchema<TInput = unknown, TOutput = TInput> {
|
|
189
|
+
readonly "~standard": {
|
|
190
|
+
readonly version: 1;
|
|
191
|
+
readonly vendor: string;
|
|
192
|
+
readonly validate: (value: unknown) => MaybePromise$2<FarmPluginOptionsResult<TOutput>>;
|
|
193
|
+
readonly types?: {
|
|
194
|
+
readonly input: TInput;
|
|
195
|
+
readonly output: TOutput;
|
|
196
|
+
} | undefined;
|
|
197
|
+
};
|
|
231
198
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
199
|
+
/** What the app passes to the plugin factory. */
|
|
200
|
+
type InferPluginOptionsInput<TSchema> = TSchema extends FarmPluginOptionsSchema<infer TInput, any> ? TInput : never;
|
|
201
|
+
/** What the plugin receives, after parsing and defaults. */
|
|
202
|
+
type InferPluginOptionsOutput<TSchema> = TSchema extends FarmPluginOptionsSchema<any, infer TOutput> ? TOutput : never;
|
|
203
|
+
/**
|
|
204
|
+
* The factory a plugin exports. Options can be left out when every option is
|
|
205
|
+
* optional, so `plugin()` and `plugin({})` mean the same thing.
|
|
206
|
+
*/
|
|
207
|
+
type FarmPluginFactory<TInput, TPlugin> = {} extends TInput ? (options?: TInput) => TPlugin : (options: TInput) => TPlugin;
|
|
208
|
+
/** Thrown when an app passes options its plugin's schema rejects. */
|
|
209
|
+
declare class FarmPluginOptionsError extends TypeError {
|
|
210
|
+
readonly issues: ReadonlyArray<FarmPluginOptionsIssue>;
|
|
211
|
+
constructor(issues: ReadonlyArray<FarmPluginOptionsIssue>);
|
|
236
212
|
}
|
|
237
|
-
/** @internal */
|
|
238
|
-
declare function createFarmMetadataRouteResponse(kind: ApplicationMetadataRouteKind, value: unknown, routeModule?: FarmMetadataRouteModule, options?: FarmMetadataRouteResponseOptions): Response;
|
|
239
213
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
*/
|
|
248
|
-
search?: FarmCrawlerPolicy;
|
|
249
|
-
/**
|
|
250
|
-
* AI training crawlers such as GPTBot, ClaudeBot, Google-Extended, and CCBot.
|
|
251
|
-
* Left unset, they follow the `User-agent: *` rules.
|
|
252
|
-
*/
|
|
253
|
-
training?: FarmCrawlerPolicy;
|
|
254
|
-
/**
|
|
255
|
-
* More robots.txt groups, written after the generated ones. Crawlers combine
|
|
256
|
-
* groups that name the same agent. A rule for `*` replaces the default
|
|
257
|
-
* `User-agent: *` / `Allow: /` group.
|
|
258
|
-
*/
|
|
259
|
-
rules?: MetadataRoute.RobotsRule[];
|
|
260
|
-
/**
|
|
261
|
-
* Absolute sitemap URLs. Defaults to the app's `sitemap.ts` route, resolved
|
|
262
|
-
* against the root layout's `metadataBase`; with neither, no `Sitemap:` line.
|
|
263
|
-
*/
|
|
264
|
-
sitemap?: string | string[];
|
|
214
|
+
interface ResolvedClientCacheAdapterEntry {
|
|
215
|
+
/** Absolute adapter module path with forward slashes, ready for codegen. */
|
|
216
|
+
importPath: string;
|
|
217
|
+
options: {
|
|
218
|
+
version?: string;
|
|
219
|
+
flushDelayMs?: number;
|
|
220
|
+
};
|
|
265
221
|
}
|
|
266
|
-
interface
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
training?: FarmCrawlerPolicy;
|
|
270
|
-
rules: MetadataRoute.RobotsRule[];
|
|
271
|
-
sitemap?: string[];
|
|
222
|
+
interface ClientCachePersistenceEntryCode {
|
|
223
|
+
imports: string;
|
|
224
|
+
init: string;
|
|
272
225
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
226
|
+
/**
|
|
227
|
+
* Resolve `cache.client.adapter` from configuration to an absolute module
|
|
228
|
+
* path for the generated client entries. Fails the build with an actionable
|
|
229
|
+
* error when the option is set but the module cannot be found.
|
|
230
|
+
*/
|
|
231
|
+
declare function resolveFarmClientCacheAdapterEntry(root: string, cache: FarmCacheUserConfig | undefined): ResolvedClientCacheAdapterEntry | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* Code fragments for the generated client entries: an import of the user's
|
|
234
|
+
* adapter module and an init call that runs before hydration starts. Empty
|
|
235
|
+
* strings when persistence is not configured, so entries stay unchanged.
|
|
236
|
+
*/
|
|
237
|
+
declare function generateClientCachePersistenceCode(entry: ResolvedClientCacheAdapterEntry | undefined): ClientCachePersistenceEntryCode;
|
|
238
|
+
|
|
239
|
+
type FarmRedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
240
|
+
interface FarmRedirectSignal {
|
|
241
|
+
url: string;
|
|
242
|
+
status: FarmRedirectStatus;
|
|
280
243
|
}
|
|
281
|
-
|
|
282
|
-
declare function
|
|
244
|
+
declare function redirect(url: string, status?: FarmRedirectStatus): never;
|
|
245
|
+
declare function permanentRedirect(url: string): never;
|
|
246
|
+
declare function notFound(): never;
|
|
247
|
+
declare function isFarmRedirectError(error: unknown): boolean;
|
|
248
|
+
declare function getFarmRedirectError(error: unknown): FarmRedirectSignal | null;
|
|
249
|
+
declare function isFarmNotFoundError(error: unknown): boolean;
|
|
283
250
|
|
|
284
251
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
252
|
+
* Integration auth routes accept ordinary form posts, which browsers send
|
|
253
|
+
* cross-site without a CORS preflight. Without an origin check, a third-party
|
|
254
|
+
* page can submit credentials to an app's own sign-in route and plant an
|
|
255
|
+
* attacker-controlled session in the victim's browser (login CSRF), or drive a
|
|
256
|
+
* forced sign-out. This mirrors the server-action origin contract so both
|
|
257
|
+
* entry points reject the same requests.
|
|
289
258
|
*/
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
259
|
+
type IntegrationOriginRejection = "missing-origin" | "opaque-origin" | "invalid-origin" | "cross-site";
|
|
260
|
+
type IntegrationOriginResult = {
|
|
261
|
+
ok: true;
|
|
262
|
+
} | {
|
|
263
|
+
ok: false;
|
|
264
|
+
reason: IntegrationOriginRejection;
|
|
265
|
+
};
|
|
266
|
+
interface IntegrationOriginPolicy {
|
|
267
|
+
/** Extra trusted origins, using the `serverActions.allowedOrigins` pattern syntax. */
|
|
268
|
+
allowedOrigins?: readonly string[];
|
|
293
269
|
/**
|
|
294
|
-
*
|
|
295
|
-
* project, `"SoftwareApplication"` for a product, `"WebSite"`, `"Person"`.
|
|
270
|
+
* Whether a request carrying no origin metadata at all must be rejected.
|
|
296
271
|
*
|
|
297
|
-
*
|
|
272
|
+
* Form posts always carry an Origin header in supported browsers, so
|
|
273
|
+
* state-changing POSTs default to rejecting (`true`). Top-level GET
|
|
274
|
+
* navigations legitimately arrive with no Origin and no Referer — a typed
|
|
275
|
+
* URL or a bookmark — so GET callers pass `false` to avoid breaking them.
|
|
298
276
|
*/
|
|
299
|
-
|
|
300
|
-
/** Entity name. Defaults to the site's Open Graph site name or page title. */
|
|
301
|
-
name?: string;
|
|
302
|
-
/** Canonical URL for the entity. Defaults to the configured `metadataBase`. */
|
|
303
|
-
url?: string;
|
|
304
|
-
/** Short description. Defaults to the page/site metadata description. */
|
|
305
|
-
description?: string;
|
|
306
|
-
/** Logo URL. */
|
|
307
|
-
logo?: string;
|
|
308
|
-
/** URLs that also represent this entity (social profiles, repos) — schema.org `sameAs`. */
|
|
309
|
-
sameAs?: string[];
|
|
310
|
-
/** Additional schema.org properties merged into the emitted object. */
|
|
311
|
-
properties?: Record<string, unknown>;
|
|
312
|
-
}
|
|
313
|
-
interface FarmAgentUserConfig {
|
|
314
|
-
/**
|
|
315
|
-
* Emit schema.org JSON-LD in the document head so agents and crawlers can
|
|
316
|
-
* resolve the site's identity. `true` emits an `Organization` built from the
|
|
317
|
-
* site's metadata; an object customizes the type and fields.
|
|
318
|
-
*
|
|
319
|
-
* @default false
|
|
320
|
-
*/
|
|
321
|
-
jsonLd?: boolean | FarmAgentJsonLd;
|
|
322
|
-
/**
|
|
323
|
-
* On a preview deployment, send `X-Robots-Tag: noindex, nofollow` with every
|
|
324
|
-
* response from Farm's server. Previews are detected from `FARM_PREVIEW`,
|
|
325
|
-
* `VERCEL_ENV=preview`, Netlify's deploy-preview and branch-deploy contexts,
|
|
326
|
-
* and Render pull request previews. Production is unaffected.
|
|
327
|
-
*
|
|
328
|
-
* @default false
|
|
329
|
-
*/
|
|
330
|
-
noindexPreviews?: boolean;
|
|
331
|
-
/**
|
|
332
|
-
* Serve `/llms.txt` (https://llmstxt.org): a Markdown index of the app's static
|
|
333
|
-
* pages, linking to their Markdown mirrors. `true` builds it from page metadata;
|
|
334
|
-
* an object sets the title, summary, details, and which routes to list. A
|
|
335
|
-
* `src/app/llms.ts` metadata route replaces the generated file.
|
|
336
|
-
*
|
|
337
|
-
* @default false
|
|
338
|
-
*/
|
|
339
|
-
llmsTxt?: boolean | FarmLlmsTxtUserConfig;
|
|
340
|
-
/**
|
|
341
|
-
* Serve a generated `/robots.txt` that allows or blocks AI search agents
|
|
342
|
-
* (`search`) and AI training crawlers (`training`), plus your own `rules`.
|
|
343
|
-
* `true` serves only `User-agent: *` / `Allow: /` and the sitemap. A
|
|
344
|
-
* `public/robots.txt` or `src/app/robots.ts` replaces the generated file.
|
|
345
|
-
*
|
|
346
|
-
* @default false
|
|
347
|
-
*/
|
|
348
|
-
crawlers?: boolean | FarmAgentCrawlers;
|
|
349
|
-
/**
|
|
350
|
-
* Serve `/.well-known/api-catalog` (RFC 9727): a Linkset listing the app's
|
|
351
|
-
* OpenAPI description and reference (when `openapi` is enabled) and its MCP
|
|
352
|
-
* endpoint (when the top-level `mcp` is enabled), so agents can find them
|
|
353
|
-
* from the origin alone.
|
|
354
|
-
*
|
|
355
|
-
* @default false
|
|
356
|
-
*/
|
|
357
|
-
apiCatalog?: boolean;
|
|
358
|
-
}
|
|
359
|
-
interface ResolvedFarmAgentConfig {
|
|
360
|
-
jsonLd: FarmAgentJsonLd | false;
|
|
361
|
-
noindexPreviews: boolean;
|
|
362
|
-
llmsTxt: ResolvedFarmLlmsTxtConfig;
|
|
363
|
-
crawlers: ResolvedFarmAgentCrawlers;
|
|
364
|
-
apiCatalog: boolean;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Integration auth routes accept ordinary form posts, which browsers send
|
|
369
|
-
* cross-site without a CORS preflight. Without an origin check, a third-party
|
|
370
|
-
* page can submit credentials to an app's own sign-in route and plant an
|
|
371
|
-
* attacker-controlled session in the victim's browser (login CSRF), or drive a
|
|
372
|
-
* forced sign-out. This mirrors the server-action origin contract so both
|
|
373
|
-
* entry points reject the same requests.
|
|
374
|
-
*/
|
|
375
|
-
type IntegrationOriginRejection = "missing-origin" | "opaque-origin" | "invalid-origin" | "cross-site";
|
|
376
|
-
type IntegrationOriginResult = {
|
|
377
|
-
ok: true;
|
|
378
|
-
} | {
|
|
379
|
-
ok: false;
|
|
380
|
-
reason: IntegrationOriginRejection;
|
|
381
|
-
};
|
|
382
|
-
interface IntegrationOriginPolicy {
|
|
383
|
-
/** Extra trusted origins, using the `serverActions.allowedOrigins` pattern syntax. */
|
|
384
|
-
allowedOrigins?: readonly string[];
|
|
385
|
-
/**
|
|
386
|
-
* Whether a request carrying no origin metadata at all must be rejected.
|
|
387
|
-
*
|
|
388
|
-
* Form posts always carry an Origin header in supported browsers, so
|
|
389
|
-
* state-changing POSTs default to rejecting (`true`). Top-level GET
|
|
390
|
-
* navigations legitimately arrive with no Origin and no Referer — a typed
|
|
391
|
-
* URL or a bookmark — so GET callers pass `false` to avoid breaking them.
|
|
392
|
-
*/
|
|
393
|
-
requireOriginMetadata?: boolean;
|
|
277
|
+
requireOriginMetadata?: boolean;
|
|
394
278
|
}
|
|
395
279
|
/**
|
|
396
280
|
* Resolve configured origin patterns once, at integration construction, so an
|
|
@@ -455,900 +339,976 @@ declare function resolveIntegrationOrmRuntimeClient<TClient = unknown>(options:
|
|
|
455
339
|
declare function farmIntegrationSchemaToOrmSchema(schema: FarmIntegrationSchema): Promise<FarmIntegrationOrmSchema>;
|
|
456
340
|
type IntegrationOrmModelNames<TSchema extends FarmIntegrationOrmSchema> = keyof SchemaModels<TSchema> & string;
|
|
457
341
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
342
|
+
type FarmIntegrationCategory = "auth" | "payment" | "monitoring" | "logging" | (string & {});
|
|
343
|
+
/** @deprecated Use FarmIntegrationCategory instead. */
|
|
344
|
+
type FarmIntegrationSlot = FarmIntegrationCategory;
|
|
345
|
+
type FarmIntegrationRouteParamValue = string | string[];
|
|
346
|
+
type FarmIntegrationRouteParams = Record<string, FarmIntegrationRouteParamValue>;
|
|
347
|
+
type FarmIntegrationRouteMethod = FarmIntegrationAPIMethod | Lowercase<FarmIntegrationAPIMethod> | "ALL" | "all";
|
|
348
|
+
type FarmIntegrationRouteInputSource = "body" | "query";
|
|
349
|
+
type MaybePromise$1<T> = T | Promise<T>;
|
|
350
|
+
type FarmIntegrationValidationPathSegment = PropertyKey | {
|
|
351
|
+
readonly key: PropertyKey;
|
|
352
|
+
};
|
|
353
|
+
interface FarmIntegrationRouteInput<TBody = unknown, TQuery = unknown> {
|
|
354
|
+
body?: TBody;
|
|
355
|
+
query?: TQuery;
|
|
461
356
|
}
|
|
462
|
-
|
|
463
|
-
|
|
357
|
+
interface FarmIntegrationValidationIssue {
|
|
358
|
+
source: FarmIntegrationRouteInputSource;
|
|
359
|
+
path?: readonly (string | number)[];
|
|
360
|
+
code?: string;
|
|
361
|
+
message: string;
|
|
464
362
|
}
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
* runtime ORM uses. Any other default would generate artifacts describing
|
|
480
|
-
* tables the app cannot actually read.
|
|
481
|
-
*/
|
|
482
|
-
declare function resolveSchemaModels(ownerKey: string, schema: FarmSchema): Record<string, ResolvedSchemaModel>;
|
|
483
|
-
|
|
484
|
-
type FarmSqlDialect = "postgres" | "mysql" | "sqlite";
|
|
485
|
-
type CollectedSchemaModel = {
|
|
486
|
-
/** Namespace that owns the model: an integration key or a plugin name. */
|
|
487
|
-
ownerKey: string;
|
|
488
|
-
modelKey: string;
|
|
489
|
-
modelName: string;
|
|
490
|
-
exportName: string;
|
|
491
|
-
prismaModelName: string;
|
|
492
|
-
model: ResolvedSchemaModel;
|
|
493
|
-
/**
|
|
494
|
-
* Real table and column for references to models this owner describes but
|
|
495
|
-
* does not create (external, or outside its `models`), keyed by field. Only
|
|
496
|
-
* shown in comments: Farm never creates a foreign key to them.
|
|
497
|
-
*/
|
|
498
|
-
referenceTargets?: Record<string, {
|
|
499
|
-
table: string;
|
|
500
|
-
column: string;
|
|
501
|
-
}>;
|
|
502
|
-
/**
|
|
503
|
-
* References to tables other owners create that may carry a real foreign
|
|
504
|
-
* key, keyed by field. Set by migrate after checking the database; only a
|
|
505
|
-
* table created now gets one inline.
|
|
506
|
-
*/
|
|
507
|
-
foreignKeys?: Record<string, {
|
|
508
|
-
table: string;
|
|
509
|
-
column: string;
|
|
510
|
-
onDelete: NonNullable<FarmSchemaReference["onDelete"]>;
|
|
511
|
-
}>;
|
|
512
|
-
};
|
|
513
|
-
/** `table.column` a field's reference points at, using real names when known. */
|
|
514
|
-
declare function describeSchemaReference(model: CollectedSchemaModel, fieldKey: string): string;
|
|
515
|
-
/**
|
|
516
|
-
* Flatten owners' schemas into one list, rejecting two models that would
|
|
517
|
-
* resolve to the same table.
|
|
518
|
-
*
|
|
519
|
-
* `only` narrows an owner to the models it actually controls; an owner handed a
|
|
520
|
-
* schema it shares with the rest of the app should not claim all of it.
|
|
521
|
-
*/
|
|
522
|
-
declare function collectSchemaModels(entries: ReadonlyArray<readonly [string, FarmSchema, (readonly string[])?]>): CollectedSchemaModel[];
|
|
523
|
-
type FarmSqlStatement = {
|
|
524
|
-
kind: "table" | "index" | "column";
|
|
525
|
-
/** The object this statement creates, for drift reporting. */
|
|
526
|
-
target: string;
|
|
527
|
-
sql: string;
|
|
363
|
+
interface FarmIntegrationValidationErrorLike {
|
|
364
|
+
issues?: readonly {
|
|
365
|
+
path?: readonly FarmIntegrationValidationPathSegment[];
|
|
366
|
+
code?: string;
|
|
367
|
+
message?: string;
|
|
368
|
+
}[];
|
|
369
|
+
message?: string;
|
|
370
|
+
}
|
|
371
|
+
type FarmIntegrationValidationResult<TValue> = {
|
|
372
|
+
success: true;
|
|
373
|
+
data: TValue;
|
|
374
|
+
} | {
|
|
375
|
+
success: false;
|
|
376
|
+
error: FarmIntegrationValidationErrorLike;
|
|
528
377
|
};
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
*
|
|
532
|
-
* Everything here is derivable from the schema: nothing is inferred from a live
|
|
533
|
-
* database, so the output is stable and reviewable before it is applied.
|
|
534
|
-
*/
|
|
535
|
-
declare function generateSqlStatements(models: readonly CollectedSchemaModel[], dialect: FarmSqlDialect): FarmSqlStatement[];
|
|
536
|
-
/** Render models as a standalone `.sql` file. */
|
|
537
|
-
declare function renderSqlSchemaFile(models: readonly CollectedSchemaModel[], dialect: FarmSqlDialect): string;
|
|
538
|
-
declare function getSqlColumnType(field: ResolvedSchemaField, dialect: FarmSqlDialect): "BOOLEAN" | "INTEGER" | "DOUBLE PRECISION" | "TIMESTAMPTZ" | "JSONB" | "TEXT" | "INT" | "DOUBLE" | "DATETIME" | "JSON" | "VARCHAR(255)" | "REAL";
|
|
539
|
-
declare function getSqlDefaultExpression(field: ResolvedSchemaField, dialect: FarmSqlDialect): string | null;
|
|
540
|
-
declare function isNullableField(field: ResolvedSchemaField): boolean;
|
|
541
|
-
declare function quoteSqlIdentifier(dialect: FarmSqlDialect, value: string): string;
|
|
542
|
-
declare function toSnakeCase(value: string): string;
|
|
543
|
-
declare function toPascalCase(value: string): string;
|
|
544
|
-
declare function toCamelCase(value: string): string;
|
|
545
|
-
declare function escapeSqlString(value: string, dialect?: FarmSqlDialect): string;
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* An ordered change a plugin release makes to its own tables that Farm will
|
|
549
|
-
* not infer: a rename looks exactly like a removal plus an addition. Each step
|
|
550
|
-
* runs once per database, in the order listed.
|
|
551
|
-
*
|
|
552
|
-
* Names are the plugin's own: `model` and `to` are keys in the current
|
|
553
|
-
* schema, so the app's renames apply; `from` is the old name in the database.
|
|
554
|
-
*/
|
|
555
|
-
type FarmSchemaMigrationStep = {
|
|
556
|
-
id: string;
|
|
557
|
-
description?: string;
|
|
558
|
-
} & ({
|
|
559
|
-
renameColumn: {
|
|
560
|
-
model: string;
|
|
561
|
-
from: string;
|
|
562
|
-
to: string;
|
|
563
|
-
};
|
|
378
|
+
type FarmIntegrationStandardValidationResult<TValue> = {
|
|
379
|
+
value: TValue;
|
|
564
380
|
} | {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
381
|
+
issues: readonly {
|
|
382
|
+
path?: readonly FarmIntegrationValidationPathSegment[];
|
|
383
|
+
code?: string;
|
|
384
|
+
message: string;
|
|
385
|
+
}[];
|
|
386
|
+
};
|
|
387
|
+
interface FarmIntegrationInputSchema<TValue = unknown> {
|
|
388
|
+
_output?: TValue;
|
|
389
|
+
parse?(value: unknown): MaybePromise$1<TValue>;
|
|
390
|
+
safeParse?(value: unknown): MaybePromise$1<FarmIntegrationValidationResult<TValue>>;
|
|
391
|
+
safeParseAsync?(value: unknown): Promise<FarmIntegrationValidationResult<TValue>>;
|
|
392
|
+
"~standard"?: {
|
|
393
|
+
validate(value: unknown): MaybePromise$1<FarmIntegrationStandardValidationResult<TValue>>;
|
|
394
|
+
types?: {
|
|
395
|
+
output: TValue;
|
|
396
|
+
};
|
|
568
397
|
};
|
|
569
398
|
}
|
|
399
|
+
interface FarmIntegrationRouteInputSchemas<TBody = unknown, TQuery = unknown> {
|
|
400
|
+
body?: FarmIntegrationInputSchema<TBody>;
|
|
401
|
+
query?: FarmIntegrationInputSchema<TQuery>;
|
|
402
|
+
}
|
|
403
|
+
/** @deprecated Use `FarmRequestStore` and access it through `ctx.req`. */
|
|
404
|
+
type FarmIntegrationRequestContextStore = FarmRequestStore;
|
|
405
|
+
declare const FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = "farm.integration.internalDispatch";
|
|
570
406
|
/**
|
|
571
|
-
*
|
|
572
|
-
*
|
|
407
|
+
* Request-context key under which an integration middleware can hand
|
|
408
|
+
* `Set-Cookie` values to the runtime when it returns `void` (i.e. lets the
|
|
409
|
+
* request continue to the downstream route/page handler). The runtime reads
|
|
410
|
+
* this key back after a `void` middleware return and forwards the cookies onto
|
|
411
|
+
* the response it ultimately sends, so a server-side session refresh (or any
|
|
412
|
+
* other cookie rotation) reaches the browser instead of being dropped.
|
|
573
413
|
*/
|
|
574
|
-
|
|
575
|
-
dropColumn: {
|
|
576
|
-
model: string;
|
|
577
|
-
column: string;
|
|
578
|
-
};
|
|
579
|
-
} | {
|
|
580
|
-
dropTable: {
|
|
581
|
-
table: string;
|
|
582
|
-
};
|
|
583
|
-
} | {
|
|
584
|
-
/** Per dialect; a dialect without SQL cannot run the step. */
|
|
585
|
-
sql: Partial<Record<FarmSqlDialect, string | readonly string[]>>;
|
|
586
|
-
/**
|
|
587
|
-
* Custom SQL runs after this release's new tables and columns exist, so
|
|
588
|
-
* a backfill can fill them. Set `before` to run it with the renames.
|
|
589
|
-
*/
|
|
590
|
-
before?: boolean;
|
|
591
|
-
});
|
|
592
|
-
|
|
414
|
+
declare const FARM_INTEGRATION_SET_COOKIES_KEY = "farm:integration:set-cookies";
|
|
593
415
|
/**
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
*
|
|
416
|
+
* Forward `Set-Cookie` values from an integration middleware that returns
|
|
417
|
+
* `void` (the authenticated/passthrough branch) to the runtime, so they are
|
|
418
|
+
* merged onto the response the runtime sends for the matched route. This is
|
|
419
|
+
* the passthrough counterpart to appending `Set-Cookie` to a `Response` the
|
|
420
|
+
* middleware returns directly (e.g. a failure redirect): both paths can rotate
|
|
421
|
+
* auth cookies, and both must be able to reach the browser.
|
|
600
422
|
*/
|
|
601
|
-
|
|
602
|
-
type
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
readonly message: string;
|
|
607
|
-
readonly path?: ReadonlyArray<FarmPluginOptionsIssuePathSegment> | undefined;
|
|
423
|
+
declare function forwardIntegrationSetCookies(context: Pick<FarmIntegrationHandlerContext, "req">, cookies: string[]): void;
|
|
424
|
+
type FarmIntegrationRouteDb<TSchema extends FarmIntegrationSchema | undefined> = InferFarmIntegrationOrmClient<TSchema>;
|
|
425
|
+
interface FarmIntegrationRouteStorageArgs<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
426
|
+
getClient(): Promise<unknown | undefined>;
|
|
427
|
+
getOrm(): Promise<FarmIntegrationRouteDb<TSchema>>;
|
|
608
428
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
readonly issues: ReadonlyArray<FarmPluginOptionsIssue>;
|
|
614
|
-
};
|
|
615
|
-
/** The part of the Standard Schema interface plugin options need. */
|
|
616
|
-
interface FarmPluginOptionsSchema<TInput = unknown, TOutput = TInput> {
|
|
617
|
-
readonly "~standard": {
|
|
618
|
-
readonly version: 1;
|
|
619
|
-
readonly vendor: string;
|
|
620
|
-
readonly validate: (value: unknown) => MaybePromise$2<FarmPluginOptionsResult<TOutput>>;
|
|
621
|
-
readonly types?: {
|
|
622
|
-
readonly input: TInput;
|
|
623
|
-
readonly output: TOutput;
|
|
624
|
-
} | undefined;
|
|
625
|
-
};
|
|
429
|
+
interface FarmIntegrationRouteArgs<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
430
|
+
db: FarmIntegrationRouteDb<TSchema>;
|
|
431
|
+
getDb(): Promise<FarmIntegrationRouteDb<TSchema>>;
|
|
432
|
+
storage: FarmIntegrationRouteStorageArgs<TSchema>;
|
|
626
433
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
declare class FarmPluginOptionsError extends TypeError {
|
|
638
|
-
readonly issues: ReadonlyArray<FarmPluginOptionsIssue>;
|
|
639
|
-
constructor(issues: ReadonlyArray<FarmPluginOptionsIssue>);
|
|
434
|
+
interface FarmIntegrationConfigContext<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
435
|
+
key: string;
|
|
436
|
+
integration: FarmIntegration<TSchema, any>;
|
|
437
|
+
appConfig: FarmPluginContext["config"];
|
|
438
|
+
/** Alias for appConfig. */
|
|
439
|
+
config: FarmPluginContext["config"];
|
|
440
|
+
args: FarmIntegrationRouteArgs<TSchema>;
|
|
441
|
+
env: Record<string, string | undefined>;
|
|
442
|
+
isDev: boolean;
|
|
443
|
+
isProd: boolean;
|
|
640
444
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
flushDelayMs?: number;
|
|
648
|
-
};
|
|
445
|
+
interface FarmIntegrationConfigDefinition<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
446
|
+
schema?: FarmIntegrationInputSchema<TConfig>;
|
|
447
|
+
env?: Record<string, string | readonly string[]>;
|
|
448
|
+
defaults?: Partial<TConfig> | ((context: FarmIntegrationConfigContext<TSchema>) => MaybePromise$1<Partial<TConfig>>);
|
|
449
|
+
input?: Partial<TConfig> | ((context: FarmIntegrationConfigContext<TSchema>) => MaybePromise$1<Partial<TConfig>>);
|
|
450
|
+
resolve?(context: FarmIntegrationConfigContext<TSchema>): MaybePromise$1<TConfig | Partial<TConfig> | undefined>;
|
|
649
451
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
452
|
+
type FarmIntegrationConfigInput<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = FarmIntegrationInputSchema<TConfig> | FarmIntegrationConfigDefinition<TConfig, TSchema>;
|
|
453
|
+
type FarmIntegrationLifecycleLogLevel = "info" | "warn" | "error";
|
|
454
|
+
interface FarmIntegrationLifecycleLogger {
|
|
455
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
456
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
457
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
653
458
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
/**
|
|
661
|
-
* Code fragments for the generated client entries: an import of the user's
|
|
662
|
-
* adapter module and an init call that runs before hydration starts. Empty
|
|
663
|
-
* strings when persistence is not configured, so entries stay unchanged.
|
|
664
|
-
*/
|
|
665
|
-
declare function generateClientCachePersistenceCode(entry: ResolvedClientCacheAdapterEntry | undefined): ClientCachePersistenceEntryCode;
|
|
666
|
-
|
|
667
|
-
type FarmRedirectStatus = 301 | 302 | 303 | 307 | 308;
|
|
668
|
-
interface FarmRedirectSignal {
|
|
669
|
-
url: string;
|
|
670
|
-
status: FarmRedirectStatus;
|
|
459
|
+
interface FarmIntegrationLifecycleContext<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationConfigContext<TSchema> {
|
|
460
|
+
integration: FarmIntegration<TSchema, TConfig>;
|
|
461
|
+
integrationConfig: TConfig;
|
|
462
|
+
log: FarmIntegrationLifecycleLogger;
|
|
463
|
+
reason?: string;
|
|
464
|
+
cleanup(callback?: () => MaybePromise$1<void>): Promise<void>;
|
|
671
465
|
}
|
|
672
|
-
|
|
673
|
-
declare function permanentRedirect(url: string): never;
|
|
674
|
-
declare function notFound(): never;
|
|
675
|
-
declare function isFarmRedirectError(error: unknown): boolean;
|
|
676
|
-
declare function getFarmRedirectError(error: unknown): FarmRedirectSignal | null;
|
|
677
|
-
declare function isFarmNotFoundError(error: unknown): boolean;
|
|
678
|
-
|
|
679
|
-
/**
|
|
680
|
-
* Farm.js Middleware System
|
|
681
|
-
*
|
|
682
|
-
* Type definitions for the middleware system
|
|
683
|
-
*/
|
|
684
|
-
|
|
685
|
-
/**
|
|
686
|
-
* Next function type for middleware chain
|
|
687
|
-
*/
|
|
688
|
-
type MiddlewareResult = void | Response;
|
|
689
|
-
type NextFunction = () => Promise<MiddlewareResult>;
|
|
690
|
-
type MiddlewareStoreKey<TValues extends Record<string, any>> = Extract<keyof TValues, string>;
|
|
466
|
+
type FarmIntegrationLifecycleHook<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = (context: FarmIntegrationLifecycleContext<TConfig, TSchema>) => MaybePromise$1<void>;
|
|
691
467
|
/**
|
|
692
|
-
*
|
|
468
|
+
* Small per-call integration metadata. Values received over HTTP are
|
|
469
|
+
* client-controlled and should be validated before authorization decisions.
|
|
693
470
|
*/
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
471
|
+
type FarmIntegrationData = Record<string, unknown>;
|
|
472
|
+
interface FarmIntegrationHandlerContext<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
473
|
+
request: Request;
|
|
474
|
+
requestId: string;
|
|
475
|
+
url: URL;
|
|
476
|
+
pathname: string;
|
|
477
|
+
method: string;
|
|
478
|
+
params: FarmIntegrationRouteParams;
|
|
479
|
+
input: FarmIntegrationRouteInput<TBody, TQuery>;
|
|
480
|
+
args: FarmIntegrationRouteArgs<TSchema>;
|
|
481
|
+
data: FarmIntegrationData;
|
|
482
|
+
integration: {
|
|
483
|
+
category: FarmIntegrationCategory;
|
|
484
|
+
/** @deprecated Use category instead. */
|
|
485
|
+
slot: FarmIntegrationCategory;
|
|
486
|
+
type: string;
|
|
487
|
+
instance: unknown;
|
|
488
|
+
};
|
|
489
|
+
route: {
|
|
490
|
+
kind: "route" | "middleware";
|
|
491
|
+
path: string;
|
|
492
|
+
methods: readonly string[];
|
|
493
|
+
};
|
|
494
|
+
req: FarmRequestStore;
|
|
495
|
+
/** @deprecated Use `req` instead. */
|
|
496
|
+
requestContext: FarmRequestStore;
|
|
497
|
+
config: FarmPluginContext["config"];
|
|
498
|
+
isDev: boolean;
|
|
499
|
+
isProd: boolean;
|
|
706
500
|
}
|
|
707
|
-
interface
|
|
708
|
-
|
|
709
|
-
delete<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): boolean;
|
|
710
|
-
set<TKey extends MiddlewareStoreKey<TValues>>(key: TKey, value: TValues[TKey]): this;
|
|
501
|
+
interface FarmIntegrationRouteHookContext<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationHandlerContext<TBody, TQuery, TSchema> {
|
|
502
|
+
response?: Response;
|
|
711
503
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
readonly locals: MiddlewareStore<TLocals>;
|
|
729
|
-
readonly data: MiddlewareStore<TData>;
|
|
730
|
-
readonly headers: Map<string, string>;
|
|
731
|
-
readonly cookies: CookieJar;
|
|
732
|
-
get<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): TLocals[TKey] | undefined;
|
|
733
|
-
has<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): boolean;
|
|
734
|
-
set<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey, value: TLocals[TKey]): void;
|
|
735
|
-
delete<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): boolean;
|
|
736
|
-
redirect(url: string, status?: number): void;
|
|
737
|
-
rewrite(url: string): void;
|
|
738
|
-
json(data: any, status?: number): void;
|
|
739
|
-
text(content: string, status?: number): void;
|
|
740
|
-
html(content: string, status?: number): void;
|
|
504
|
+
type FarmIntegrationRouteHook<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = {
|
|
505
|
+
bivarianceHack(request: Request, context: FarmIntegrationRouteHookContext<TBody, TQuery, TSchema>): Promise<Response | void> | Response | void;
|
|
506
|
+
}["bivarianceHack"];
|
|
507
|
+
interface FarmIntegrationRoute<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
508
|
+
path: string;
|
|
509
|
+
method?: FarmIntegrationRouteMethod;
|
|
510
|
+
methods?: readonly FarmIntegrationRouteMethod[];
|
|
511
|
+
middleware?: readonly FarmIntegrationRouteMiddleware<TSchema>[];
|
|
512
|
+
before?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
513
|
+
after?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
514
|
+
rawBody?: boolean;
|
|
515
|
+
bodyFormat?: FarmIntegrationAPIBodyFormat;
|
|
516
|
+
body?: FarmIntegrationInputSchema<TBody>;
|
|
517
|
+
query?: FarmIntegrationInputSchema<TQuery>;
|
|
518
|
+
input?: FarmIntegrationRouteInputSchemas<TBody, TQuery>;
|
|
519
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<TBody, TQuery, TSchema>): Promise<Response> | Response;
|
|
741
520
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
interface CookieOptions {
|
|
747
|
-
maxAge?: number;
|
|
748
|
-
expires?: Date;
|
|
749
|
-
path?: string;
|
|
750
|
-
domain?: string;
|
|
751
|
-
secure?: boolean;
|
|
752
|
-
httpOnly?: boolean;
|
|
753
|
-
sameSite?: "strict" | "lax" | "none";
|
|
521
|
+
interface FarmTypedIntegrationRoute<TPath extends string = string, TBody = never, TQuery = never, TResponse = unknown, TServer extends boolean = false, TMethod extends FarmIntegrationAPIMethod = FarmIntegrationAPIMethod, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationRoute<TBody, TQuery, TSchema> {
|
|
522
|
+
path: TPath;
|
|
523
|
+
method: TMethod;
|
|
524
|
+
__operation: FarmIntegrationAPIOperation<TBody, TQuery, TResponse, TServer, TMethod>;
|
|
754
525
|
}
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
*/
|
|
758
|
-
interface CookieJar {
|
|
759
|
-
get(name: string): string | undefined;
|
|
760
|
-
set(name: string, value: string, options?: CookieOptions): void;
|
|
761
|
-
/**
|
|
762
|
-
* Remove a cookie. Pass the `path`/`domain` it was set with; a tombstone only
|
|
763
|
-
* matches a cookie with the same scope.
|
|
764
|
-
*/
|
|
765
|
-
delete(name: string, options?: CookieOptions): void;
|
|
766
|
-
getAll(): Record<string, string>;
|
|
526
|
+
interface FarmIntegrationRouteMiddleware<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
527
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<unknown, unknown, TSchema>): Promise<Response | void> | Response | void;
|
|
767
528
|
}
|
|
768
|
-
interface
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
resetAt: number;
|
|
529
|
+
interface FarmIntegrationMiddleware<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
530
|
+
matcher?: string | string[];
|
|
531
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<unknown, unknown, TSchema>): Promise<Response | void> | Response | void;
|
|
772
532
|
}
|
|
773
|
-
interface
|
|
774
|
-
|
|
775
|
-
increment(key: string, windowMs: number): Promise<RateLimitIncrementResult> | RateLimitIncrementResult;
|
|
776
|
-
/** Optional inspection support used by getRateLimitStatus(). */
|
|
777
|
-
get?(key: string): Promise<RateLimitIncrementResult | null> | RateLimitIncrementResult | null;
|
|
533
|
+
interface FarmIntegrationProviderProps {
|
|
534
|
+
children: ReactNode;
|
|
778
535
|
}
|
|
779
|
-
interface
|
|
780
|
-
/**
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
requests: number;
|
|
785
|
-
window: string;
|
|
786
|
-
keyGenerator?: (ctx: MiddlewareContext) => string;
|
|
787
|
-
onLimit?: (ctx: MiddlewareContext) => void | Response | Promise<void | Response>;
|
|
788
|
-
storage?: RateLimitStorage;
|
|
789
|
-
}
|
|
790
|
-
interface RateLimitStatus {
|
|
791
|
-
requests: number;
|
|
792
|
-
limit: number;
|
|
793
|
-
remaining: number;
|
|
794
|
-
resetIn: number | null;
|
|
795
|
-
resetAt: Date | null;
|
|
796
|
-
isLimited: boolean;
|
|
536
|
+
interface FarmIntegrationProviderComponentReference {
|
|
537
|
+
/** Client-safe module specifier using `@/`, a path relative to the app root, or a package. */
|
|
538
|
+
module: string;
|
|
539
|
+
/** Named export to use. Defaults to the module's default export. */
|
|
540
|
+
export?: string;
|
|
797
541
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
542
|
+
interface FarmIntegrationProvider {
|
|
543
|
+
name: string;
|
|
544
|
+
type: string;
|
|
545
|
+
props?: Record<string, unknown>;
|
|
546
|
+
/**
|
|
547
|
+
* The provider can be instantiated independently around each isolated
|
|
548
|
+
* client root without relying on context or state owned by the route root.
|
|
549
|
+
* Providers are treated as route-wide unless they explicitly opt in.
|
|
550
|
+
*/
|
|
551
|
+
supportsIsolatedHydration?: boolean;
|
|
552
|
+
component?: ComponentType<FarmIntegrationProviderProps> | FarmIntegrationProviderComponentReference;
|
|
806
553
|
}
|
|
807
|
-
interface
|
|
808
|
-
|
|
809
|
-
handlers?: MiddlewareFunction[];
|
|
554
|
+
interface FarmIntegrationDocumentNavigation {
|
|
555
|
+
matcher: string | readonly string[];
|
|
810
556
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
557
|
+
/** @deprecated Use `FarmSchemaFieldType`. */
|
|
558
|
+
type FarmIntegrationSchemaFieldType = FarmSchemaFieldType;
|
|
559
|
+
/** @deprecated Use `FarmSchemaReference`. */
|
|
560
|
+
type FarmIntegrationSchemaReference = FarmSchemaReference;
|
|
561
|
+
/** @deprecated Use `FarmSchemaField`. */
|
|
562
|
+
type FarmIntegrationSchemaField = FarmSchemaField;
|
|
563
|
+
/** @deprecated Use `FarmSchemaConstraint`. */
|
|
564
|
+
type FarmIntegrationSchemaConstraint = FarmSchemaConstraint;
|
|
565
|
+
/** @deprecated Use `FarmSchemaModel`. */
|
|
566
|
+
type FarmIntegrationSchemaModel = FarmSchemaModel;
|
|
567
|
+
/** @deprecated Use `FarmSchemaModelExtension`. */
|
|
568
|
+
type FarmIntegrationSchemaModelExtension = FarmSchemaModelExtension;
|
|
569
|
+
/** @deprecated Use `FarmSchemaModelOverride`. */
|
|
570
|
+
type FarmIntegrationSchemaModelOverride = FarmSchemaModelOverride;
|
|
571
|
+
/** @deprecated Use `FarmSchema`. */
|
|
572
|
+
type FarmIntegrationSchema = FarmSchema;
|
|
573
|
+
/** @deprecated Use `defineSchema`. This is an exact alias, not a wrapper. */
|
|
574
|
+
declare const defineIntegrationSchema: typeof defineSchema;
|
|
575
|
+
type FarmIntegrationLogPhase = "registered" | "validate" | "setup" | "ready" | "dispose" | "request:start" | "request:end" | "request:error";
|
|
576
|
+
interface FarmIntegrationLogEvent {
|
|
577
|
+
category: FarmIntegrationCategory;
|
|
578
|
+
/** @deprecated Use category instead. */
|
|
579
|
+
slot: FarmIntegrationCategory;
|
|
580
|
+
type: string;
|
|
581
|
+
phase: FarmIntegrationLogPhase;
|
|
582
|
+
route?: {
|
|
583
|
+
kind: "route" | "middleware";
|
|
584
|
+
path: string;
|
|
585
|
+
methods: readonly string[];
|
|
833
586
|
};
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
json(data: any, status?: number): void;
|
|
844
|
-
text(content: string, status?: number): void;
|
|
845
|
-
html(content: string, status?: number): void;
|
|
587
|
+
requestId?: string;
|
|
588
|
+
request?: Request;
|
|
589
|
+
response?: Response;
|
|
590
|
+
error?: unknown;
|
|
591
|
+
durationMs?: number;
|
|
592
|
+
level?: FarmIntegrationLifecycleLogLevel;
|
|
593
|
+
message?: string;
|
|
594
|
+
meta?: Record<string, unknown>;
|
|
595
|
+
context: Map<string, unknown>;
|
|
846
596
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
* Supports boolean values or functions that evaluate to boolean.
|
|
855
|
-
*
|
|
856
|
-
* @example
|
|
857
|
-
* .when(true, (ctx, next) => { ... }) // Always run
|
|
858
|
-
* .when((ctx) => ctx.data.get('flag'), (ctx, next) => { ... }) // Conditional
|
|
859
|
-
*/
|
|
860
|
-
when(condition: boolean | ((ctx: MiddlewareContext) => boolean), fn: MiddlewareFunction | ((chain: MiddlewareChain) => void)): MiddlewareChain;
|
|
861
|
-
rateLimit(config: RateLimitConfig): MiddlewareChain;
|
|
862
|
-
redirect(source: string, destination: string, permanent?: boolean): MiddlewareChain;
|
|
863
|
-
/**
|
|
864
|
-
* Rewrite the current route to a new destination.
|
|
865
|
-
* In route-specific middleware, this rewrites the middleware's route.
|
|
866
|
-
*
|
|
867
|
-
* @param destination - The destination path to rewrite to
|
|
868
|
-
* @param condition - Optional boolean or function that evaluates to boolean. If false, rewrite is skipped.
|
|
869
|
-
*
|
|
870
|
-
* @example
|
|
871
|
-
* // In /contact/middleware.ts
|
|
872
|
-
* .rewrite('/about') // Always rewrites /contact to /about
|
|
873
|
-
* .rewrite('/about', true) // Always rewrites
|
|
874
|
-
* .rewrite('/about', false) // Never rewrites
|
|
875
|
-
* .rewrite('/about', (ctx) => ctx.data.get('shouldRewrite')) // Conditional rewrite
|
|
876
|
-
*/
|
|
877
|
-
rewrite(destination: string, condition?: boolean | ((ctx: MiddlewareContext) => boolean)): MiddlewareChain;
|
|
878
|
-
build(): {
|
|
879
|
-
handlers: MiddlewareFunction[];
|
|
880
|
-
config?: MiddlewareConfig$1;
|
|
881
|
-
};
|
|
597
|
+
type FarmIntegrationLogger = (event: FarmIntegrationLogEvent) => void | Promise<void>;
|
|
598
|
+
interface FarmIntegrationPluginOwner {
|
|
599
|
+
key: string;
|
|
600
|
+
category: FarmIntegrationCategory;
|
|
601
|
+
type: string;
|
|
602
|
+
source: "lifecycle" | "contribution";
|
|
603
|
+
serverRuntime: boolean;
|
|
882
604
|
}
|
|
883
|
-
/**
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
605
|
+
/** A normal plugin or an integration-bound plugin compatible with the shared instance. */
|
|
606
|
+
type FarmIntegrationContributedPlugin<TInstance = unknown> = FarmPlugin<any, any, any, any, unknown, false> | FarmPlugin<any, any, any, any, TInstance, true>;
|
|
607
|
+
interface FarmIntegration<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined, TConfig = unknown, TInstance = unknown> {
|
|
608
|
+
readonly kind: "farm-integration";
|
|
609
|
+
category: FarmIntegrationCategory;
|
|
610
|
+
/** @deprecated Use category instead. */
|
|
611
|
+
slot?: FarmIntegrationCategory;
|
|
612
|
+
type: string;
|
|
613
|
+
instance: TInstance;
|
|
614
|
+
/** Set to false when a platform adapter owns this integration's production routes. */
|
|
615
|
+
serverRuntime?: boolean;
|
|
616
|
+
api?: FarmIntegrationAPI;
|
|
617
|
+
schema?: TSchema;
|
|
618
|
+
config?: FarmIntegrationConfigInput<TConfig, TSchema>;
|
|
619
|
+
validate?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
620
|
+
setup?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
621
|
+
ready?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
622
|
+
dispose?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
623
|
+
log?: FarmIntegrationLogger;
|
|
624
|
+
routes?: readonly FarmIntegrationRoute<any, any, TSchema>[];
|
|
625
|
+
endpoints?: FarmIntegrationEndpoints<TSchema>;
|
|
626
|
+
middleware?: readonly FarmIntegrationMiddleware<TSchema>[];
|
|
627
|
+
providers?: readonly FarmIntegrationProvider[];
|
|
628
|
+
documentNavigations?: readonly FarmIntegrationDocumentNavigation[];
|
|
629
|
+
/** Additional Farm plugins owned and configured by this integration. */
|
|
630
|
+
plugins?: readonly FarmIntegrationContributedPlugin<NoInfer<TInstance>>[];
|
|
890
631
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
632
|
+
type FarmIntegrationsUserConfig = Record<string, FarmIntegration<any, any, any> | undefined>;
|
|
633
|
+
/** @internal Identifies plugins owned by platform-managed integrations. */
|
|
634
|
+
declare function getFarmIntegrationPluginServerRuntime(plugin: FarmPlugin): boolean | undefined;
|
|
635
|
+
/** Returns the integration that contributed a normalized plugin, when applicable. */
|
|
636
|
+
declare function getFarmIntegrationPluginOwner(plugin: FarmPlugin): Readonly<FarmIntegrationPluginOwner> | undefined;
|
|
637
|
+
type IntegrationRouteBuilderOptions<TBody, TQuery, TServer extends boolean, TSchema extends FarmIntegrationSchema | undefined> = {
|
|
638
|
+
middleware?: readonly FarmIntegrationRouteMiddleware<TSchema>[];
|
|
639
|
+
before?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
640
|
+
after?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
641
|
+
rawBody?: boolean;
|
|
642
|
+
headers?: Record<string, string>;
|
|
643
|
+
credentials?: RequestCredentials;
|
|
644
|
+
bodyFormat?: FarmIntegrationAPIBodyFormat;
|
|
645
|
+
responseFormat?: FarmIntegrationAPIResponseFormat;
|
|
646
|
+
isServer?: TServer;
|
|
647
|
+
body?: FarmIntegrationInputSchema<TBody>;
|
|
648
|
+
query?: FarmIntegrationInputSchema<TQuery>;
|
|
649
|
+
input?: FarmIntegrationRouteInputSchemas<TBody, TQuery>;
|
|
650
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<TBody, TQuery, TSchema>): Promise<Response> | Response;
|
|
651
|
+
};
|
|
652
|
+
interface FarmIntegrationRouteFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
653
|
+
get<TPath extends string, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: Omit<IntegrationRouteBuilderOptions<never, TQuery, TServer, TSchema>, "bodyFormat">): FarmTypedIntegrationRoute<TPath, never, TQuery, TResponse, TServer, "GET", TSchema>;
|
|
654
|
+
post<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "POST", TSchema>;
|
|
655
|
+
query<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "QUERY", TSchema>;
|
|
656
|
+
put<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "PUT", TSchema>;
|
|
657
|
+
patch<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "PATCH", TSchema>;
|
|
658
|
+
delete<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "DELETE", TSchema>;
|
|
659
|
+
options<TPath extends string, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: Omit<IntegrationRouteBuilderOptions<never, TQuery, TServer, TSchema>, "bodyFormat">): FarmTypedIntegrationRoute<TPath, never, TQuery, TResponse, TServer, "OPTIONS", TSchema>;
|
|
660
|
+
head<TPath extends string, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: Omit<IntegrationRouteBuilderOptions<never, TQuery, TServer, TSchema>, "bodyFormat">): FarmTypedIntegrationRoute<TPath, never, TQuery, TResponse, TServer, "HEAD", TSchema>;
|
|
907
661
|
}
|
|
908
|
-
interface
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
className: string;
|
|
662
|
+
interface FarmIntegrationRoutesFactoryContext<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
663
|
+
route: FarmIntegrationRouteFactory<TSchema>;
|
|
664
|
+
integrationRoute: FarmIntegrationRouteFactory<TSchema>;
|
|
912
665
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
* the components are an inline object, which cannot be analyzed for client components.
|
|
917
|
-
*/
|
|
918
|
-
declare function resolveFarmMdxComponentsModulePath(config: FarmMdxResolvedConfig | undefined, root: string): string | undefined;
|
|
919
|
-
|
|
920
|
-
type FarmRouteRuntime = "auto" | "node" | "edge";
|
|
921
|
-
type FarmRouteRegions = "auto" | readonly string[];
|
|
922
|
-
type FarmRouteMaxDuration = "auto" | number;
|
|
923
|
-
/** Portable execution controls shared by file, programmatic, and config routes. */
|
|
924
|
-
interface FarmRouteRuntimeConfig {
|
|
925
|
-
runtime?: FarmRouteRuntime;
|
|
926
|
-
regions?: FarmRouteRegions;
|
|
927
|
-
maxDuration?: FarmRouteMaxDuration;
|
|
928
|
-
}
|
|
929
|
-
interface ResolvedFarmRouteRuntimeConfig {
|
|
930
|
-
runtime: FarmRouteRuntime;
|
|
931
|
-
regions?: string[];
|
|
932
|
-
maxDuration?: number;
|
|
933
|
-
}
|
|
934
|
-
type FarmRouteRuntimeEntryKind = "page" | "api" | "metadata" | "rule";
|
|
935
|
-
type FarmRouteRenderingMode = "static" | "dynamic";
|
|
936
|
-
interface FarmRouteRuntimeManifestEntry extends ResolvedFarmRouteRuntimeConfig {
|
|
937
|
-
kind: FarmRouteRuntimeEntryKind;
|
|
938
|
-
pattern: string;
|
|
939
|
-
rendering: FarmRouteRenderingMode;
|
|
940
|
-
source?: string;
|
|
941
|
-
}
|
|
942
|
-
interface FarmRouteRuntimeManifest {
|
|
943
|
-
version: 1;
|
|
944
|
-
routes: FarmRouteRuntimeManifestEntry[];
|
|
945
|
-
}
|
|
946
|
-
declare function normalizeFarmRouteRuntimeConfig(value: FarmRouteRuntimeConfig | null | undefined, source?: string): FarmRouteRuntimeConfig;
|
|
947
|
-
/** Merge from lowest to highest precedence. Explicit "auto" values reset inherited hints. */
|
|
948
|
-
declare function mergeFarmRouteRuntimeConfigs(...configs: Array<FarmRouteRuntimeConfig | null | undefined>): FarmRouteRuntimeConfig;
|
|
949
|
-
declare function resolveFarmRouteRuntimeConfig(config: FarmRouteRuntimeConfig | null | undefined, source?: string): ResolvedFarmRouteRuntimeConfig;
|
|
950
|
-
declare function hasFarmRouteRuntimeControls(config: FarmRouteRuntimeConfig | null | undefined): boolean;
|
|
951
|
-
declare function getFarmRouteRuntimeConfig(value: unknown): FarmRouteRuntimeConfig;
|
|
952
|
-
declare function createFarmRouteRuntimeKey(config: ResolvedFarmRouteRuntimeConfig): string;
|
|
953
|
-
/** Resolve matching route rules from broadest to most specific. */
|
|
954
|
-
declare function resolveFarmRouteRuleRuntimeConfig(pathname: string, routeRules: Record<string, FarmRouteRuntimeConfig> | null | undefined): FarmRouteRuntimeConfig;
|
|
955
|
-
declare function farmRouteRuleMatches(pattern: string, pathname: string): boolean;
|
|
956
|
-
|
|
957
|
-
type FarmRouteRuleRenderMode = "static" | "dynamic";
|
|
958
|
-
type FarmRouteRuleRedirect = string | {
|
|
959
|
-
to: string;
|
|
960
|
-
statusCode?: FarmRedirectStatus;
|
|
961
|
-
permanent?: boolean;
|
|
666
|
+
type FarmIntegrationRoutesFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = (context: FarmIntegrationRoutesFactoryContext<TSchema>) => readonly FarmIntegrationRoute<any, any, TSchema>[];
|
|
667
|
+
type FarmIntegrationEndpointValue<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = FarmIntegrationRoute<any, any, TSchema> | readonly FarmIntegrationEndpointValue<TSchema>[] | {
|
|
668
|
+
readonly [key: string]: FarmIntegrationEndpointValue<TSchema> | undefined;
|
|
962
669
|
};
|
|
963
|
-
type
|
|
964
|
-
|
|
965
|
-
methods?: string | readonly string[];
|
|
966
|
-
headers?: string | readonly string[];
|
|
670
|
+
type FarmIntegrationEndpoints<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = {
|
|
671
|
+
readonly [key: string]: FarmIntegrationEndpointValue<TSchema> | undefined;
|
|
967
672
|
};
|
|
968
|
-
interface
|
|
969
|
-
|
|
970
|
-
render?: FarmRouteRuleRenderMode;
|
|
971
|
-
ssr?: boolean;
|
|
972
|
-
swr?: boolean | number;
|
|
973
|
-
isr?: boolean | number;
|
|
974
|
-
cors?: FarmRouteRuleCors;
|
|
975
|
-
headers?: Record<string, string>;
|
|
976
|
-
redirect?: FarmRouteRuleRedirect;
|
|
977
|
-
}
|
|
978
|
-
type FarmRouteRules = Record<string, FarmRouteRule>;
|
|
979
|
-
declare function normalizeRouteRules(routeRules: FarmRouteRules | undefined): FarmRouteRules;
|
|
980
|
-
declare function routeRulesToRedirects(routeRules: FarmRouteRules): RedirectConfig[];
|
|
981
|
-
declare function routeRulesToHeaders(routeRules: FarmRouteRules): HeaderConfig[];
|
|
982
|
-
declare function routeRulesToNitroRouteRules(routeRules: FarmRouteRules): Record<string, any>;
|
|
983
|
-
|
|
984
|
-
type OxcTransform = (typeof rolldown_utils)["transform"];
|
|
985
|
-
type FarmLayerEntry = string;
|
|
986
|
-
interface ResolvedFarmLayer {
|
|
987
|
-
/** The value used in `extends`. */
|
|
988
|
-
source: string;
|
|
989
|
-
/** Stable name used by the `#layers/<name>` alias. */
|
|
990
|
-
name: string;
|
|
991
|
-
/** Absolute layer package or directory root. */
|
|
992
|
-
root: string;
|
|
993
|
-
/** Source directory relative to the layer root. */
|
|
994
|
-
srcDir: string;
|
|
995
|
-
/** Resolved layer config file when one exists. */
|
|
996
|
-
configFile?: string;
|
|
997
|
-
}
|
|
998
|
-
interface FarmSourceRoot {
|
|
999
|
-
name: string;
|
|
1000
|
-
root: string;
|
|
1001
|
-
srcDir: string;
|
|
1002
|
-
layer: boolean;
|
|
1003
|
-
}
|
|
1004
|
-
interface ResolveFarmLayersOptions {
|
|
1005
|
-
root: string;
|
|
1006
|
-
mode: "development" | "production";
|
|
673
|
+
interface FarmIntegrationEndpointsFactoryContext<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationRoutesFactoryContext<TSchema> {
|
|
674
|
+
endpoint: FarmIntegrationRouteFactory<TSchema>;
|
|
1007
675
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
676
|
+
type FarmIntegrationEndpointsFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = (context: FarmIntegrationEndpointsFactoryContext<TSchema>) => FarmIntegrationEndpoints<TSchema>;
|
|
677
|
+
declare function createIntegrationRoute<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined>(_schema?: TSchema): FarmIntegrationRouteFactory<TSchema>;
|
|
678
|
+
declare const integrationRoute: FarmIntegrationRouteFactory<undefined>;
|
|
679
|
+
type RegisteredIntegrationRuntime = {
|
|
680
|
+
integration: FarmIntegration;
|
|
681
|
+
config: FarmPluginContext["config"];
|
|
682
|
+
isDev: boolean;
|
|
683
|
+
isProd: boolean;
|
|
684
|
+
};
|
|
685
|
+
type FarmIntegrationRoutesInput<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = readonly FarmIntegrationRoute<any, any, TSchema>[] | FarmIntegrationRoutesFactory<TSchema>;
|
|
686
|
+
type FarmIntegrationEndpointsInput<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = FarmIntegrationEndpoints<TSchema> | FarmIntegrationEndpointsFactory<TSchema>;
|
|
687
|
+
type FarmIntegrationInput<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined, TConfig = unknown, TInstance = unknown> = Omit<FarmIntegration<TSchema, TConfig, TInstance>, "kind" | "category" | "slot" | "instance" | "config" | "routes" | "endpoints" | "plugins"> & {
|
|
688
|
+
instance: TInstance;
|
|
689
|
+
config?: FarmIntegrationConfigInput<TConfig, TSchema>;
|
|
690
|
+
routes?: FarmIntegrationRoutesInput<TSchema>;
|
|
691
|
+
endpoints?: FarmIntegrationEndpointsInput<TSchema>;
|
|
692
|
+
plugins?: readonly FarmIntegrationContributedPlugin<NoInfer<TInstance>>[];
|
|
693
|
+
} & ({
|
|
694
|
+
category: FarmIntegrationCategory;
|
|
695
|
+
slot?: FarmIntegrationCategory;
|
|
696
|
+
} | {
|
|
697
|
+
category?: FarmIntegrationCategory;
|
|
698
|
+
slot: FarmIntegrationCategory;
|
|
699
|
+
});
|
|
700
|
+
type FarmIntegrationCategoryInput = {
|
|
701
|
+
category: FarmIntegrationCategory;
|
|
702
|
+
slot?: FarmIntegrationCategory;
|
|
703
|
+
} | {
|
|
704
|
+
category?: FarmIntegrationCategory;
|
|
705
|
+
slot: FarmIntegrationCategory;
|
|
706
|
+
};
|
|
707
|
+
type FarmIntegrationShapeForInference = FarmIntegrationCategoryInput & {
|
|
708
|
+
api?: FarmIntegrationAPI;
|
|
709
|
+
schema?: FarmIntegrationSchema;
|
|
710
|
+
config?: unknown;
|
|
711
|
+
routes?: unknown;
|
|
712
|
+
endpoints?: unknown;
|
|
713
|
+
};
|
|
714
|
+
type ExtractIntegrationSchema<TIntegration> = TIntegration extends {
|
|
715
|
+
schema: infer TSchema extends FarmIntegrationSchema;
|
|
716
|
+
} ? TSchema : undefined;
|
|
717
|
+
type ResolveIntegrationRoutesInput<TRoutes, TSchema extends FarmIntegrationSchema | undefined> = TRoutes extends FarmIntegrationRoutesFactory<TSchema> ? ReturnType<TRoutes> : TRoutes;
|
|
718
|
+
type ResolveIntegrationEndpointsInput<TEndpoints, TSchema extends FarmIntegrationSchema | undefined> = TEndpoints extends FarmIntegrationEndpointsFactory<TSchema> ? ReturnType<TEndpoints> : TEndpoints;
|
|
719
|
+
type ExtractIntegrationRoutesFromRoutesInput<TRoutes, TSchema extends FarmIntegrationSchema | undefined> = ResolveIntegrationRoutesInput<TRoutes, TSchema> extends readonly (infer TRoute)[] ? TRoute : never;
|
|
720
|
+
type ExtractIntegrationRoutesFromEndpointValue<TValue> = TValue extends FarmIntegrationRouteOperationCarrier<string, any> ? TValue : TValue extends readonly (infer TItem)[] ? ExtractIntegrationRoutesFromEndpointValue<TItem> : TValue extends object ? ExtractIntegrationRoutesFromEndpointValue<TValue[keyof TValue]> : never;
|
|
721
|
+
type ExtractIntegrationRoutesFromEndpointsInput<TEndpoints, TSchema extends FarmIntegrationSchema | undefined> = ExtractIntegrationRoutesFromEndpointValue<ResolveIntegrationEndpointsInput<TEndpoints, TSchema>>;
|
|
722
|
+
type ExtractIntegrationRouteUnion<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = (TIntegration extends {
|
|
723
|
+
routes: infer TRoutes;
|
|
724
|
+
} ? ExtractIntegrationRoutesFromRoutesInput<TRoutes, TSchema> : never) | (TIntegration extends {
|
|
725
|
+
endpoints: infer TEndpoints;
|
|
726
|
+
} ? ExtractIntegrationRoutesFromEndpointsInput<TEndpoints, TSchema> : never);
|
|
727
|
+
type ExtractDefinedIntegrationRoutes<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = [ExtractIntegrationRouteUnion<TIntegration, TSchema>] extends [never] ? undefined : readonly ExtractIntegrationRouteUnion<TIntegration, TSchema>[];
|
|
728
|
+
type ExtractDefinedIntegrationEndpoints<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = TIntegration extends {
|
|
729
|
+
endpoints: infer TEndpoints;
|
|
730
|
+
} ? ResolveIntegrationEndpointsInput<TEndpoints, TSchema> : undefined;
|
|
731
|
+
type ExtractIntegrationAPIRoutes<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = Extract<ExtractIntegrationRouteUnion<TIntegration, TSchema>, FarmIntegrationRouteOperationCarrier<string, any>>;
|
|
732
|
+
type ExtractIntegrationCategory<TIntegration extends FarmIntegrationCategoryInput> = TIntegration extends {
|
|
733
|
+
category: infer TCategory extends FarmIntegrationCategory;
|
|
734
|
+
} ? TCategory : TIntegration extends {
|
|
735
|
+
slot: infer TSlot extends FarmIntegrationCategory;
|
|
736
|
+
} ? TSlot : FarmIntegrationCategory;
|
|
737
|
+
type ExtractDerivedIntegrationAPI<TIntegration extends FarmIntegrationShapeForInference, TSchema extends FarmIntegrationSchema | undefined = ExtractIntegrationSchema<TIntegration>> = TIntegration extends {
|
|
738
|
+
api: infer TAPI extends FarmIntegrationAPI;
|
|
739
|
+
} ? TAPI : [ExtractIntegrationAPIRoutes<TIntegration, TSchema>] extends [never] ? FarmIntegrationAPI | undefined : InferIntegrationAPIFromRoutes<readonly ExtractIntegrationAPIRoutes<TIntegration, TSchema>[]>;
|
|
740
|
+
type DefinedIntegration<TIntegration extends FarmIntegrationShapeForInference, TSchema extends FarmIntegrationSchema | undefined = ExtractIntegrationSchema<TIntegration>> = Omit<TIntegration, "kind" | "category" | "slot" | "api" | "routes" | "endpoints"> & {
|
|
741
|
+
readonly kind: "farm-integration";
|
|
742
|
+
category: ExtractIntegrationCategory<TIntegration>;
|
|
743
|
+
slot: ExtractIntegrationCategory<TIntegration>;
|
|
744
|
+
routes: ExtractDefinedIntegrationRoutes<TIntegration, TSchema>;
|
|
745
|
+
endpoints: ExtractDefinedIntegrationEndpoints<TIntegration, TSchema>;
|
|
746
|
+
api: ExtractDerivedIntegrationAPI<TIntegration, TSchema>;
|
|
747
|
+
};
|
|
748
|
+
declare function defineIntegration<const TSchema extends FarmIntegrationSchema | undefined, const TConfig, TIntegration extends FarmIntegrationInput<TSchema, TConfig, any>>(integration: TIntegration & FarmIntegrationInput<TSchema, TConfig, NoInfer<TIntegration["instance"]>>): DefinedIntegration<TIntegration, TSchema>;
|
|
749
|
+
declare function isFarmIntegration(value: unknown): value is FarmIntegration;
|
|
750
|
+
declare function resolveIntegrationPlugins(integrations: FarmIntegrationsUserConfig | undefined): FarmPlugin[];
|
|
751
|
+
declare function getIntegrationProviders(integrations: FarmIntegrationsUserConfig | undefined): FarmIntegrationProvider[];
|
|
752
|
+
declare function isFarmIntegrationProviderComponentReference(value: FarmIntegrationProvider["component"]): value is FarmIntegrationProviderComponentReference;
|
|
753
|
+
declare function getIntegrationDocumentNavigationMatchers(integrations: FarmIntegrationsUserConfig | undefined): string[];
|
|
754
|
+
declare function getIntegrationSchemas(integrations: FarmIntegrationsUserConfig | undefined): Record<string, FarmIntegrationSchema>;
|
|
755
|
+
declare function getRegisteredIntegrationRuntime(key: string): RegisteredIntegrationRuntime | undefined;
|
|
756
|
+
declare function getRegisteredIntegrations(): Record<string, FarmIntegration>;
|
|
757
|
+
declare function getRegisteredIntegrationSchemas(): Record<string, FarmIntegrationSchema>;
|
|
758
|
+
declare function matchIntegrationRoute(integrations: FarmIntegrationsUserConfig | undefined, input: {
|
|
759
|
+
pathname: string;
|
|
760
|
+
method?: string;
|
|
761
|
+
}): {
|
|
762
|
+
key: string;
|
|
763
|
+
integration: FarmIntegration;
|
|
764
|
+
route: {
|
|
765
|
+
path: string;
|
|
766
|
+
methods: readonly string[];
|
|
1012
767
|
};
|
|
1013
|
-
|
|
1014
|
-
}
|
|
1015
|
-
declare function
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
declare function
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
768
|
+
params: FarmIntegrationRouteParams;
|
|
769
|
+
} | null;
|
|
770
|
+
declare function matchRegisteredIntegrationRoute(input: {
|
|
771
|
+
pathname: string;
|
|
772
|
+
method?: string;
|
|
773
|
+
}): {
|
|
774
|
+
key: string;
|
|
775
|
+
integration: FarmIntegration;
|
|
776
|
+
route: {
|
|
777
|
+
path: string;
|
|
778
|
+
methods: readonly string[];
|
|
779
|
+
};
|
|
780
|
+
params: FarmIntegrationRouteParams;
|
|
781
|
+
} | null;
|
|
782
|
+
declare function getRegisteredIntegrationAPIManifest(): Record<string, FarmIntegrationAPI>;
|
|
783
|
+
declare function dispatchIntegrationRequest(runtime: RegisteredIntegrationRuntime, request: Request, options?: {
|
|
784
|
+
currentRequest?: Request;
|
|
785
|
+
data?: FarmIntegrationData;
|
|
786
|
+
internal?: boolean;
|
|
787
|
+
/**
|
|
788
|
+
* Receives `Set-Cookie` values that a middleware forwarded via
|
|
789
|
+
* forwardIntegrationSetCookies while returning `void`, when this dispatch
|
|
790
|
+
* ends without a Response of its own. The request continues downstream, so
|
|
791
|
+
* the caller owns merging them onto whatever response it finally produces.
|
|
792
|
+
* Only called on the `null` return path: a Response returned from here has
|
|
793
|
+
* already had the forwarded cookies appended.
|
|
794
|
+
*/
|
|
795
|
+
onForwardedCookies?: (cookies: string[]) => void;
|
|
796
|
+
}): Promise<Response | null>;
|
|
1038
797
|
/**
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
798
|
+
* Run every configured integration's middleware and routes for one request.
|
|
799
|
+
*
|
|
800
|
+
* Integration middleware is not route scoped: it is the mechanism behind
|
|
801
|
+
* `protectedRoutes` guards and provider session refresh, so it has to run for
|
|
802
|
+
* ordinary page and API requests that match no integration route at all. That
|
|
803
|
+
* makes this, not `matchIntegrationRoute`, the correct entry point for a
|
|
804
|
+
* runtime dispatching integrations for every request.
|
|
805
|
+
*
|
|
806
|
+
* The first integration that produces a Response short-circuits the rest.
|
|
807
|
+
* `Set-Cookie` values forwarded by middleware that returned `void` are
|
|
808
|
+
* collected: they ride the short-circuiting Response when there is one, and are
|
|
809
|
+
* otherwise handed back so the caller can merge them onto the downstream
|
|
810
|
+
* response.
|
|
1042
811
|
*/
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}
|
|
1049
|
-
type FarmDevtoolsUserConfig = boolean | FarmDevtoolsConfig;
|
|
1050
|
-
interface ResolvedFarmDevtoolsConfig {
|
|
1051
|
-
enabled: boolean;
|
|
1052
|
-
shortcut: string | false;
|
|
1053
|
-
}
|
|
1054
|
-
declare function resolveFarmDevtoolsConfig(config: FarmDevtoolsUserConfig | ResolvedFarmDevtoolsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevtoolsConfig;
|
|
812
|
+
declare function dispatchIntegrationRequests(integrations: FarmIntegrationsUserConfig | undefined, runtime: Omit<RegisteredIntegrationRuntime, "integration">, request: Request, options?: {
|
|
813
|
+
currentRequest?: Request;
|
|
814
|
+
}): Promise<{
|
|
815
|
+
response: Response | null;
|
|
816
|
+
setCookies: string[];
|
|
817
|
+
}>;
|
|
1055
818
|
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
buildActivityPosition?: FarmBuildActivityPosition;
|
|
1062
|
-
}
|
|
1063
|
-
interface ResolvedFarmDevIndicatorsConfig {
|
|
1064
|
-
buildActivity: boolean;
|
|
1065
|
-
buildActivityPosition: FarmBuildActivityPosition;
|
|
1066
|
-
}
|
|
1067
|
-
declare function resolveFarmDevIndicatorsConfig(config: FarmDevIndicatorsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevIndicatorsConfig;
|
|
1068
|
-
declare function generateFarmDevIndicatorsClientRuntime(config: ResolvedFarmDevIndicatorsConfig): string;
|
|
819
|
+
/**
|
|
820
|
+
* Farm.js Middleware System
|
|
821
|
+
*
|
|
822
|
+
* Type definitions for the middleware system
|
|
823
|
+
*/
|
|
1069
824
|
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
825
|
+
/**
|
|
826
|
+
* Next function type for middleware chain
|
|
827
|
+
*/
|
|
828
|
+
type MiddlewareResult = void | Response;
|
|
829
|
+
type NextFunction = () => Promise<MiddlewareResult>;
|
|
830
|
+
type MiddlewareStoreKey<TValues extends Record<string, any>> = Extract<keyof TValues, string>;
|
|
831
|
+
/**
|
|
832
|
+
* A typed view over the request-scoped maps used by middleware.
|
|
833
|
+
*/
|
|
834
|
+
interface ReadonlyMiddlewareStore<TValues extends Record<string, any> = Record<string, any>> {
|
|
835
|
+
readonly size: number;
|
|
836
|
+
get<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): TValues[TKey] | undefined;
|
|
837
|
+
has<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): boolean;
|
|
838
|
+
entries(): IterableIterator<[MiddlewareStoreKey<TValues>, TValues[MiddlewareStoreKey<TValues>]]>;
|
|
839
|
+
keys(): IterableIterator<MiddlewareStoreKey<TValues>>;
|
|
840
|
+
values(): IterableIterator<TValues[MiddlewareStoreKey<TValues>]>;
|
|
841
|
+
forEach(callback: (value: TValues[MiddlewareStoreKey<TValues>], key: MiddlewareStoreKey<TValues>, store: ReadonlyMiddlewareStore<TValues>) => void, thisArg?: any): void;
|
|
842
|
+
[Symbol.iterator](): IterableIterator<[
|
|
843
|
+
MiddlewareStoreKey<TValues>,
|
|
844
|
+
TValues[MiddlewareStoreKey<TValues>]
|
|
845
|
+
]>;
|
|
1077
846
|
}
|
|
1078
|
-
interface
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
updateAge?: number;
|
|
847
|
+
interface MiddlewareStore<TValues extends Record<string, any> = Record<string, any>> extends ReadonlyMiddlewareStore<TValues> {
|
|
848
|
+
clear(): void;
|
|
849
|
+
delete<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): boolean;
|
|
850
|
+
set<TKey extends MiddlewareStoreKey<TValues>>(key: TKey, value: TValues[TKey]): this;
|
|
1083
851
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
852
|
+
/**
|
|
853
|
+
* Middleware function signature
|
|
854
|
+
*/
|
|
855
|
+
type MiddlewareFunction = (ctx: MiddlewareContext, next: NextFunction) => MiddlewareResult | Promise<MiddlewareResult>;
|
|
856
|
+
/**
|
|
857
|
+
* Context passed to a named, request-first middleware export.
|
|
858
|
+
* `locals` and the get/set helpers stay on the server. `data` can be exposed
|
|
859
|
+
* through page props and should contain only serializable, client-safe values.
|
|
860
|
+
*/
|
|
861
|
+
interface RequestMiddlewareContext<TLocals extends Record<string, any> = Record<string, any>, TData extends Record<string, any> = Record<string, any>> {
|
|
862
|
+
readonly url: URL;
|
|
863
|
+
readonly pathname: string;
|
|
864
|
+
readonly searchParams: URLSearchParams;
|
|
865
|
+
readonly method: string;
|
|
866
|
+
readonly params: Record<string, string>;
|
|
867
|
+
readonly route: string;
|
|
868
|
+
readonly locals: MiddlewareStore<TLocals>;
|
|
869
|
+
readonly data: MiddlewareStore<TData>;
|
|
870
|
+
readonly headers: Map<string, string>;
|
|
871
|
+
readonly cookies: CookieJar;
|
|
872
|
+
get<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): TLocals[TKey] | undefined;
|
|
873
|
+
has<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): boolean;
|
|
874
|
+
set<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey, value: TLocals[TKey]): void;
|
|
875
|
+
delete<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): boolean;
|
|
876
|
+
redirect(url: string, status?: number): void;
|
|
877
|
+
rewrite(url: string): void;
|
|
878
|
+
json(data: any, status?: number): void;
|
|
879
|
+
text(content: string, status?: number): void;
|
|
880
|
+
html(content: string, status?: number): void;
|
|
881
|
+
}
|
|
882
|
+
type RequestMiddleware<TLocals extends Record<string, any> = Record<string, any>, TData extends Record<string, any> = Record<string, any>> = (request: Request, context: RequestMiddlewareContext<TLocals, TData>) => MiddlewareResult | Promise<MiddlewareResult>;
|
|
883
|
+
/**
|
|
884
|
+
* Cookie options
|
|
885
|
+
*/
|
|
886
|
+
interface CookieOptions {
|
|
887
|
+
maxAge?: number;
|
|
888
|
+
expires?: Date;
|
|
1091
889
|
path?: string;
|
|
1092
|
-
|
|
1093
|
-
|
|
890
|
+
domain?: string;
|
|
891
|
+
secure?: boolean;
|
|
892
|
+
httpOnly?: boolean;
|
|
893
|
+
sameSite?: "strict" | "lax" | "none";
|
|
1094
894
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
basePath?: string;
|
|
895
|
+
/**
|
|
896
|
+
* Cookie management interface
|
|
897
|
+
*/
|
|
898
|
+
interface CookieJar {
|
|
899
|
+
get(name: string): string | undefined;
|
|
900
|
+
set(name: string, value: string, options?: CookieOptions): void;
|
|
1102
901
|
/**
|
|
1103
|
-
*
|
|
1104
|
-
*
|
|
902
|
+
* Remove a cookie. Pass the `path`/`domain` it was set with; a tombstone only
|
|
903
|
+
* matches a cookie with the same scope.
|
|
1105
904
|
*/
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
database?: FarmAuthDatabaseConfig;
|
|
905
|
+
delete(name: string, options?: CookieOptions): void;
|
|
906
|
+
getAll(): Record<string, string>;
|
|
1109
907
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
basePath: string;
|
|
1115
|
-
emailAndPassword: {
|
|
1116
|
-
enabled: boolean;
|
|
1117
|
-
requireEmailVerification: boolean;
|
|
1118
|
-
minPasswordLength: number;
|
|
1119
|
-
maxPasswordLength: number;
|
|
1120
|
-
};
|
|
1121
|
-
session: {
|
|
1122
|
-
expiresIn: number;
|
|
1123
|
-
updateAge: number;
|
|
1124
|
-
};
|
|
1125
|
-
database: {
|
|
1126
|
-
url?: string;
|
|
1127
|
-
path: string;
|
|
1128
|
-
migrateInDevelopment: boolean;
|
|
1129
|
-
};
|
|
908
|
+
interface RateLimitIncrementResult {
|
|
909
|
+
count: number;
|
|
910
|
+
/** Unix epoch timestamp in milliseconds when the fixed window resets. */
|
|
911
|
+
resetAt: number;
|
|
1130
912
|
}
|
|
1131
|
-
|
|
1132
|
-
/**
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
readonly authorization: Readonly<FarmMCPAuthorization>;
|
|
1137
|
-
readonly request: Request;
|
|
1138
|
-
/** Observe this signal in cancellable work. Cancellation cannot undo side effects. */
|
|
1139
|
-
readonly signal: AbortSignal;
|
|
913
|
+
interface RateLimitStorage {
|
|
914
|
+
/** Atomically increment a key and create or retain its fixed expiry window. */
|
|
915
|
+
increment(key: string, windowMs: number): Promise<RateLimitIncrementResult> | RateLimitIncrementResult;
|
|
916
|
+
/** Optional inspection support used by getRateLimitStatus(). */
|
|
917
|
+
get?(key: string): Promise<RateLimitIncrementResult | null> | RateLimitIncrementResult | null;
|
|
1140
918
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
919
|
+
interface MemoryRateLimitStorageOptions {
|
|
920
|
+
/** Maximum number of active keys retained by this process. */
|
|
921
|
+
maxEntries?: number;
|
|
922
|
+
}
|
|
923
|
+
interface RateLimitConfig {
|
|
924
|
+
requests: number;
|
|
925
|
+
window: string;
|
|
926
|
+
keyGenerator?: (ctx: MiddlewareContext) => string;
|
|
927
|
+
onLimit?: (ctx: MiddlewareContext) => void | Response | Promise<void | Response>;
|
|
928
|
+
storage?: RateLimitStorage;
|
|
929
|
+
}
|
|
930
|
+
interface RateLimitStatus {
|
|
931
|
+
requests: number;
|
|
932
|
+
limit: number;
|
|
933
|
+
remaining: number;
|
|
934
|
+
resetIn: number | null;
|
|
935
|
+
resetAt: Date | null;
|
|
936
|
+
isLimited: boolean;
|
|
1151
937
|
}
|
|
1152
938
|
/**
|
|
1153
|
-
*
|
|
1154
|
-
* input schema, middleware and output schema, with the MCP request as its request.
|
|
939
|
+
* Middleware configuration
|
|
1155
940
|
*/
|
|
1156
|
-
type
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
} & ({
|
|
1166
|
-
readonly kind: "endpoint";
|
|
1167
|
-
readonly method: RouteMethod;
|
|
1168
|
-
readonly path: string;
|
|
1169
|
-
} | {
|
|
1170
|
-
readonly kind: "standalone";
|
|
1171
|
-
readonly method?: never;
|
|
1172
|
-
readonly path?: never;
|
|
1173
|
-
} | {
|
|
1174
|
-
readonly kind: "serverFunction";
|
|
1175
|
-
readonly method?: never;
|
|
1176
|
-
readonly path?: never;
|
|
1177
|
-
});
|
|
1178
|
-
/** What a resource's `read` receives: the URI asked for, its template variables, and the caller. */
|
|
1179
|
-
interface FarmMCPResourceContext extends FarmMCPExecuteContext {
|
|
1180
|
-
readonly uri: URL;
|
|
1181
|
-
/** Values matched by `uriTemplate`; empty for a fixed `uri`. */
|
|
1182
|
-
readonly variables: Readonly<Record<string, string | string[]>>;
|
|
941
|
+
type MiddlewareMatcher = string | RegExp | ((ctx: MiddlewareContext) => boolean);
|
|
942
|
+
interface MiddlewareConfig$1 {
|
|
943
|
+
matcher?: MiddlewareMatcher | MiddlewareMatcher[];
|
|
944
|
+
exclude?: (string | RegExp)[];
|
|
945
|
+
runtime?: "nodejs" | "edge";
|
|
946
|
+
}
|
|
947
|
+
interface MiddlewareConfigEntry extends MiddlewareConfig$1 {
|
|
948
|
+
handler?: MiddlewareFunction;
|
|
949
|
+
handlers?: MiddlewareFunction[];
|
|
1183
950
|
}
|
|
951
|
+
type FarmMiddlewareConfig = MiddlewareConfig$1 | MiddlewareConfigEntry | MiddlewareConfigEntry[];
|
|
1184
952
|
/**
|
|
1185
|
-
*
|
|
1186
|
-
* text with its own type, JSON data, or binary data.
|
|
953
|
+
* Middleware context - the main object passed to middleware functions
|
|
1187
954
|
*/
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
955
|
+
interface MiddlewareContext {
|
|
956
|
+
request: IncomingMessage;
|
|
957
|
+
response: ServerResponse;
|
|
958
|
+
url: URL;
|
|
959
|
+
pathname: string;
|
|
960
|
+
searchParams: URLSearchParams;
|
|
961
|
+
method: string;
|
|
962
|
+
params: Record<string, string>;
|
|
963
|
+
route: string;
|
|
964
|
+
parent?: {
|
|
965
|
+
data: Map<string, any>;
|
|
966
|
+
locals?: Map<string, any>;
|
|
967
|
+
headers: Record<string, string>;
|
|
968
|
+
};
|
|
969
|
+
vite: {
|
|
970
|
+
isDev: boolean;
|
|
971
|
+
hmr: boolean;
|
|
972
|
+
server?: ViteDevServer;
|
|
973
|
+
};
|
|
974
|
+
data: Map<string, any>;
|
|
975
|
+
locals: Map<string, any>;
|
|
976
|
+
headers: Map<string, string>;
|
|
977
|
+
cookies: CookieJar;
|
|
978
|
+
_handled: boolean;
|
|
979
|
+
_redirectUrl?: string;
|
|
980
|
+
_rewriteUrl?: string;
|
|
981
|
+
redirect(url: string, status?: number): void;
|
|
982
|
+
rewrite(url: string): void;
|
|
983
|
+
json(data: any, status?: number): void;
|
|
984
|
+
text(content: string, status?: number): void;
|
|
985
|
+
html(content: string, status?: number): void;
|
|
1204
986
|
}
|
|
1205
987
|
/**
|
|
1206
|
-
*
|
|
1207
|
-
* `uri` or at every URI matching an RFC 6570 `uriTemplate`.
|
|
988
|
+
* Middleware chain interface
|
|
1208
989
|
*/
|
|
1209
|
-
interface
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
990
|
+
interface MiddlewareChain {
|
|
991
|
+
use(fn: MiddlewareFunction): MiddlewareChain;
|
|
992
|
+
/**
|
|
993
|
+
* Conditionally run middleware based on a condition.
|
|
994
|
+
* Supports boolean values or functions that evaluate to boolean.
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* .when(true, (ctx, next) => { ... }) // Always run
|
|
998
|
+
* .when((ctx) => ctx.data.get('flag'), (ctx, next) => { ... }) // Conditional
|
|
999
|
+
*/
|
|
1000
|
+
when(condition: boolean | ((ctx: MiddlewareContext) => boolean), fn: MiddlewareFunction | ((chain: MiddlewareChain) => void)): MiddlewareChain;
|
|
1001
|
+
rateLimit(config: RateLimitConfig): MiddlewareChain;
|
|
1002
|
+
redirect(source: string, destination: string, permanent?: boolean): MiddlewareChain;
|
|
1003
|
+
/**
|
|
1004
|
+
* Rewrite the current route to a new destination.
|
|
1005
|
+
* In route-specific middleware, this rewrites the middleware's route.
|
|
1006
|
+
*
|
|
1007
|
+
* @param destination - The destination path to rewrite to
|
|
1008
|
+
* @param condition - Optional boolean or function that evaluates to boolean. If false, rewrite is skipped.
|
|
1009
|
+
*
|
|
1010
|
+
* @example
|
|
1011
|
+
* // In /contact/middleware.ts
|
|
1012
|
+
* .rewrite('/about') // Always rewrites /contact to /about
|
|
1013
|
+
* .rewrite('/about', true) // Always rewrites
|
|
1014
|
+
* .rewrite('/about', false) // Never rewrites
|
|
1015
|
+
* .rewrite('/about', (ctx) => ctx.data.get('shouldRewrite')) // Conditional rewrite
|
|
1016
|
+
*/
|
|
1017
|
+
rewrite(destination: string, condition?: boolean | ((ctx: MiddlewareContext) => boolean)): MiddlewareChain;
|
|
1018
|
+
build(): {
|
|
1019
|
+
handlers: MiddlewareFunction[];
|
|
1020
|
+
config?: MiddlewareConfig$1;
|
|
1021
|
+
};
|
|
1227
1022
|
}
|
|
1228
1023
|
/**
|
|
1229
|
-
*
|
|
1230
|
-
* user. Arguments arrive as strings, as MCP sends them, and are validated by
|
|
1231
|
-
* `arguments` before `render` runs.
|
|
1024
|
+
* Middleware module export
|
|
1232
1025
|
*/
|
|
1233
|
-
interface
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
description?: string;
|
|
1238
|
-
/** An object schema of string arguments. */
|
|
1239
|
-
arguments?: Schema;
|
|
1240
|
-
/** Return the prompt text, sent as one user message, or a list of messages. */
|
|
1241
|
-
render(args: Schema extends RouteSchema ? RouteSchemaOutput<Schema> : Record<string, never>, context: FarmMCPExecuteContext): string | readonly FarmMCPPromptMessage[] | Promise<string | readonly FarmMCPPromptMessage[]>;
|
|
1242
|
-
}
|
|
1243
|
-
interface FarmMCPServer {
|
|
1244
|
-
readonly name: string;
|
|
1245
|
-
readonly version: string;
|
|
1246
|
-
readonly path: `/api/${string}`;
|
|
1247
|
-
}
|
|
1248
|
-
interface FarmMCPAuthorization extends Record<string, unknown> {
|
|
1249
|
-
/** Stable application principal identifier. Never written to a response or log by Farm. */
|
|
1250
|
-
subject: string;
|
|
1251
|
-
scopes?: string[];
|
|
1252
|
-
/** Allowed tool names for this request. Omit for all configured tools; [] denies all tools. */
|
|
1253
|
-
tools?: readonly string[];
|
|
1254
|
-
/** Allowed resource names. Omit for all configured resources; [] denies all resources. */
|
|
1255
|
-
resources?: readonly string[];
|
|
1256
|
-
/** Allowed prompt names. Omit for all configured prompts; [] denies all prompts. */
|
|
1257
|
-
prompts?: readonly string[];
|
|
1258
|
-
}
|
|
1259
|
-
interface FarmMCPAuthorizeContext {
|
|
1260
|
-
request: Request;
|
|
1261
|
-
/** Untrusted requested name for a tools/call; authorization runs separately for every JSON-RPC batch item. */
|
|
1262
|
-
tool?: string;
|
|
1263
|
-
/** Untrusted requested URI for a resources/read. */
|
|
1264
|
-
resource?: string;
|
|
1265
|
-
/** Untrusted requested name for a prompts/get. */
|
|
1266
|
-
prompt?: string;
|
|
1267
|
-
/** Complete configured catalog, before applying this caller's permissions. */
|
|
1268
|
-
tools: readonly FarmMCPTool[];
|
|
1269
|
-
/** Resolved transport identity, for policies shared by multiple MCP endpoints. */
|
|
1270
|
-
server: FarmMCPServer;
|
|
1026
|
+
interface MiddlewareModule {
|
|
1027
|
+
default?: MiddlewareChain | MiddlewareFunction;
|
|
1028
|
+
middleware?: RequestMiddleware;
|
|
1029
|
+
config?: MiddlewareConfig$1;
|
|
1271
1030
|
}
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
path?: `/api/${string}`;
|
|
1277
|
-
/** MCP server identity. @default "farm-api" */
|
|
1278
|
-
name?: string;
|
|
1279
|
-
/** MCP server version. @default "1.0.0" */
|
|
1280
|
-
version?: string;
|
|
1281
|
-
/** Explicit endpoint/standalone tool allowlist. Omit to discover route-owned MCP metadata. */
|
|
1282
|
-
tools?: readonly FarmMCPToolDefinition[];
|
|
1283
|
-
/** Read-only context for agents, from `defineResource()`. */
|
|
1284
|
-
resources?: readonly FarmMCPResource[];
|
|
1285
|
-
/** Reusable prompt templates, from `definePrompt()`. */
|
|
1286
|
-
prompts?: readonly FarmMCPPrompt<any>[];
|
|
1287
|
-
/** Authorize every MCP request. Returning false responds with 401 before protocol handling. */
|
|
1288
|
-
authorize?: (context: FarmMCPAuthorizeContext) => FarmMCPAuthorization | false | Promise<FarmMCPAuthorization | false>;
|
|
1289
|
-
/** Deliberate escape hatch for public servers. Authentication is required by default. */
|
|
1290
|
-
allowUnauthenticated?: boolean;
|
|
1031
|
+
|
|
1032
|
+
type FarmMdxComponent = React__default.ComponentType<any> | keyof React__default.JSX.IntrinsicElements;
|
|
1033
|
+
type FarmMdxComponents = Record<string, FarmMdxComponent>;
|
|
1034
|
+
interface FarmMdxUserConfig {
|
|
1291
1035
|
/**
|
|
1292
|
-
*
|
|
1293
|
-
*
|
|
1294
|
-
* Farm serves at `/.well-known/oauth-protected-resource/<endpoint path>`.
|
|
1295
|
-
* Validating tokens stays in `authorize`.
|
|
1036
|
+
* Component map or module path that exports `components` or a default component map.
|
|
1037
|
+
* Relative paths resolve from the project root.
|
|
1296
1038
|
*/
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
resourceName?: string;
|
|
1039
|
+
components?: string | FarmMdxComponents;
|
|
1040
|
+
/**
|
|
1041
|
+
* Serve source-authored markdown pages at `/route.md`.
|
|
1042
|
+
* Enabled by default for `page.md` and `page.mdx`.
|
|
1043
|
+
*/
|
|
1044
|
+
markdownRoutes?: boolean;
|
|
1045
|
+
/** Class name used for the wrapper around rendered markdown content. */
|
|
1046
|
+
className?: string;
|
|
1306
1047
|
}
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1048
|
+
interface FarmMdxResolvedConfig {
|
|
1049
|
+
components?: string | FarmMdxComponents;
|
|
1050
|
+
markdownRoutes: boolean;
|
|
1051
|
+
className: string;
|
|
1310
1052
|
}
|
|
1053
|
+
declare function resolveMdxConfig(config: FarmMdxUserConfig | undefined): FarmMdxResolvedConfig;
|
|
1054
|
+
/**
|
|
1055
|
+
* The MDX components module a Markdown page renders from, as an absolute path. Undefined when
|
|
1056
|
+
* the components are an inline object, which cannot be analyzed for client components.
|
|
1057
|
+
*/
|
|
1058
|
+
declare function resolveFarmMdxComponentsModulePath(config: FarmMdxResolvedConfig | undefined, root: string): string | undefined;
|
|
1311
1059
|
|
|
1312
|
-
type
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
}
|
|
1321
|
-
interface ResolvedFarmPreloadConfig {
|
|
1322
|
-
mode: FarmPreloadMode;
|
|
1323
|
-
maxImages: number;
|
|
1324
|
-
maxFonts: number;
|
|
1325
|
-
}
|
|
1326
|
-
interface FarmPerformanceConfig {
|
|
1327
|
-
preload?: FarmPreloadUserConfig;
|
|
1328
|
-
}
|
|
1329
|
-
interface ResolvedFarmPerformanceConfig {
|
|
1330
|
-
preload: ResolvedFarmPreloadConfig;
|
|
1060
|
+
type FarmRouteRuntime = "auto" | "node" | "edge";
|
|
1061
|
+
type FarmRouteRegions = "auto" | readonly string[];
|
|
1062
|
+
type FarmRouteMaxDuration = "auto" | number;
|
|
1063
|
+
/** Portable execution controls shared by file, programmatic, and config routes. */
|
|
1064
|
+
interface FarmRouteRuntimeConfig {
|
|
1065
|
+
runtime?: FarmRouteRuntime;
|
|
1066
|
+
regions?: FarmRouteRegions;
|
|
1067
|
+
maxDuration?: FarmRouteMaxDuration;
|
|
1331
1068
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
budget: number;
|
|
1337
|
-
removed: number;
|
|
1069
|
+
interface ResolvedFarmRouteRuntimeConfig {
|
|
1070
|
+
runtime: FarmRouteRuntime;
|
|
1071
|
+
regions?: string[];
|
|
1072
|
+
maxDuration?: number;
|
|
1338
1073
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1074
|
+
type FarmRouteRuntimeEntryKind = "page" | "api" | "metadata" | "rule";
|
|
1075
|
+
type FarmRouteRenderingMode = "static" | "dynamic";
|
|
1076
|
+
interface FarmRouteRuntimeManifestEntry extends ResolvedFarmRouteRuntimeConfig {
|
|
1077
|
+
kind: FarmRouteRuntimeEntryKind;
|
|
1078
|
+
pattern: string;
|
|
1079
|
+
rendering: FarmRouteRenderingMode;
|
|
1080
|
+
source?: string;
|
|
1342
1081
|
}
|
|
1343
|
-
interface
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
warnings: FarmPreloadBudgetWarning[];
|
|
1082
|
+
interface FarmRouteRuntimeManifest {
|
|
1083
|
+
version: 1;
|
|
1084
|
+
routes: FarmRouteRuntimeManifestEntry[];
|
|
1347
1085
|
}
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1086
|
+
declare function normalizeFarmRouteRuntimeConfig(value: FarmRouteRuntimeConfig | null | undefined, source?: string): FarmRouteRuntimeConfig;
|
|
1087
|
+
/** Merge from lowest to highest precedence. Explicit "auto" values reset inherited hints. */
|
|
1088
|
+
declare function mergeFarmRouteRuntimeConfigs(...configs: Array<FarmRouteRuntimeConfig | null | undefined>): FarmRouteRuntimeConfig;
|
|
1089
|
+
declare function resolveFarmRouteRuntimeConfig(config: FarmRouteRuntimeConfig | null | undefined, source?: string): ResolvedFarmRouteRuntimeConfig;
|
|
1090
|
+
declare function hasFarmRouteRuntimeControls(config: FarmRouteRuntimeConfig | null | undefined): boolean;
|
|
1091
|
+
declare function getFarmRouteRuntimeConfig(value: unknown): FarmRouteRuntimeConfig;
|
|
1092
|
+
declare function createFarmRouteRuntimeKey(config: ResolvedFarmRouteRuntimeConfig): string;
|
|
1093
|
+
/** Resolve matching route rules from broadest to most specific. */
|
|
1094
|
+
declare function resolveFarmRouteRuleRuntimeConfig(pathname: string, routeRules: Record<string, FarmRouteRuntimeConfig> | null | undefined): FarmRouteRuntimeConfig;
|
|
1095
|
+
declare function farmRouteRuleMatches(pattern: string, pathname: string): boolean;
|
|
1096
|
+
|
|
1097
|
+
type FarmRouteRuleRenderMode = "static" | "dynamic";
|
|
1098
|
+
type FarmRouteRuleRedirect = string | {
|
|
1099
|
+
to: string;
|
|
1100
|
+
statusCode?: FarmRedirectStatus;
|
|
1101
|
+
permanent?: boolean;
|
|
1102
|
+
};
|
|
1103
|
+
type FarmRouteRuleCors = boolean | {
|
|
1104
|
+
origin?: string;
|
|
1105
|
+
methods?: string | readonly string[];
|
|
1106
|
+
headers?: string | readonly string[];
|
|
1107
|
+
};
|
|
1108
|
+
interface FarmRouteRule extends FarmRouteRuntimeConfig {
|
|
1109
|
+
prerender?: boolean;
|
|
1110
|
+
render?: FarmRouteRuleRenderMode;
|
|
1111
|
+
ssr?: boolean;
|
|
1112
|
+
swr?: boolean | number;
|
|
1113
|
+
isr?: boolean | number;
|
|
1114
|
+
cors?: FarmRouteRuleCors;
|
|
1115
|
+
headers?: Record<string, string>;
|
|
1116
|
+
redirect?: FarmRouteRuleRedirect;
|
|
1117
|
+
}
|
|
1118
|
+
type FarmRouteRules = Record<string, FarmRouteRule>;
|
|
1119
|
+
declare function normalizeRouteRules(routeRules: FarmRouteRules | undefined): FarmRouteRules;
|
|
1120
|
+
declare function routeRulesToRedirects(routeRules: FarmRouteRules): RedirectConfig[];
|
|
1121
|
+
declare function routeRulesToHeaders(routeRules: FarmRouteRules): HeaderConfig[];
|
|
1122
|
+
declare function routeRulesToNitroRouteRules(routeRules: FarmRouteRules): Record<string, any>;
|
|
1123
|
+
|
|
1124
|
+
type OxcTransform = (typeof rolldown_utils)["transform"];
|
|
1125
|
+
type FarmLayerEntry = string;
|
|
1126
|
+
interface ResolvedFarmLayer {
|
|
1127
|
+
/** The value used in `extends`. */
|
|
1128
|
+
source: string;
|
|
1129
|
+
/** Stable name used by the `#layers/<name>` alias. */
|
|
1130
|
+
name: string;
|
|
1131
|
+
/** Absolute layer package or directory root. */
|
|
1132
|
+
root: string;
|
|
1133
|
+
/** Source directory relative to the layer root. */
|
|
1134
|
+
srcDir: string;
|
|
1135
|
+
/** Resolved layer config file when one exists. */
|
|
1136
|
+
configFile?: string;
|
|
1137
|
+
}
|
|
1138
|
+
interface FarmSourceRoot {
|
|
1139
|
+
name: string;
|
|
1140
|
+
root: string;
|
|
1141
|
+
srcDir: string;
|
|
1142
|
+
layer: boolean;
|
|
1143
|
+
}
|
|
1144
|
+
interface ResolveFarmLayersOptions {
|
|
1145
|
+
root: string;
|
|
1146
|
+
mode: "development" | "production";
|
|
1147
|
+
}
|
|
1148
|
+
interface FarmLayerResolution<TConfig extends Record<string, any>> {
|
|
1149
|
+
config: TConfig & {
|
|
1150
|
+
extends?: readonly FarmLayerEntry[];
|
|
1151
|
+
layers: ResolvedFarmLayer[];
|
|
1152
|
+
};
|
|
1153
|
+
layers: ResolvedFarmLayer[];
|
|
1154
|
+
}
|
|
1155
|
+
declare function resolveFarmLayers<TConfig extends Record<string, any>>(projectConfig: TConfig, options: ResolveFarmLayersOptions): Promise<FarmLayerResolution<TConfig>>;
|
|
1156
|
+
declare function getFarmSourceRoots(config: {
|
|
1157
|
+
root?: string;
|
|
1158
|
+
srcDir?: string;
|
|
1159
|
+
layers?: readonly ResolvedFarmLayer[];
|
|
1160
|
+
}): FarmSourceRoot[];
|
|
1161
|
+
declare function getFarmAppDirectories(config: {
|
|
1162
|
+
root?: string;
|
|
1163
|
+
srcDir?: string;
|
|
1164
|
+
layers?: readonly ResolvedFarmLayer[];
|
|
1165
|
+
}): string[];
|
|
1166
|
+
declare function getFarmLayerAliases(layers: readonly ResolvedFarmLayer[] | undefined): Record<string, string>;
|
|
1167
|
+
declare function createFarmConfigResolutionPlugin(options: {
|
|
1168
|
+
transform: OxcTransform;
|
|
1169
|
+
}): Plugin;
|
|
1170
|
+
declare function loadFarmConfigFile<TConfig = Record<string, any>>(configPath: string, options: {
|
|
1171
|
+
root: string;
|
|
1172
|
+
cacheRoot?: string;
|
|
1173
|
+
}): Promise<TConfig>;
|
|
1174
|
+
|
|
1175
|
+
declare const DEFAULT_FARM_DEVTOOLS_SHORTCUT = "mod+shift+.";
|
|
1176
|
+
declare const FARM_DEVTOOLS_PATH = "/__farm/devtools";
|
|
1177
|
+
declare const FARM_DEVTOOLS_LAUNCH_PARAM = "__farm_devtools";
|
|
1178
|
+
/**
|
|
1179
|
+
* Configuration for the built-in DevTools dashboard. The dashboard is deprecated in favor
|
|
1180
|
+
* of the `@farm.js/devtools` plugin, which reuses this configuration for enablement and
|
|
1181
|
+
* the keyboard shortcut. Both options keep working while the built-in UI remains available.
|
|
1182
|
+
*/
|
|
1183
|
+
interface FarmDevtoolsConfig {
|
|
1184
|
+
/** Enable the development-only DevTools UI and runtime endpoints. */
|
|
1185
|
+
enabled?: boolean;
|
|
1186
|
+
/** Keyboard shortcut used to toggle DevTools, or false to disable the shortcut. */
|
|
1187
|
+
shortcut?: string | false;
|
|
1188
|
+
}
|
|
1189
|
+
type FarmDevtoolsUserConfig = boolean | FarmDevtoolsConfig;
|
|
1190
|
+
interface ResolvedFarmDevtoolsConfig {
|
|
1191
|
+
enabled: boolean;
|
|
1192
|
+
shortcut: string | false;
|
|
1193
|
+
}
|
|
1194
|
+
declare function resolveFarmDevtoolsConfig(config: FarmDevtoolsUserConfig | ResolvedFarmDevtoolsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevtoolsConfig;
|
|
1195
|
+
|
|
1196
|
+
type FarmBuildActivityPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
1197
|
+
interface FarmDevIndicatorsConfig {
|
|
1198
|
+
/** Show build and HMR activity in the browser during development. */
|
|
1199
|
+
buildActivity?: boolean;
|
|
1200
|
+
/** Corner used by the build activity indicator. */
|
|
1201
|
+
buildActivityPosition?: FarmBuildActivityPosition;
|
|
1202
|
+
}
|
|
1203
|
+
interface ResolvedFarmDevIndicatorsConfig {
|
|
1204
|
+
buildActivity: boolean;
|
|
1205
|
+
buildActivityPosition: FarmBuildActivityPosition;
|
|
1206
|
+
}
|
|
1207
|
+
declare function resolveFarmDevIndicatorsConfig(config: FarmDevIndicatorsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevIndicatorsConfig;
|
|
1208
|
+
declare function generateFarmDevIndicatorsClientRuntime(config: ResolvedFarmDevIndicatorsConfig): string;
|
|
1209
|
+
|
|
1210
|
+
interface FarmAuthEmailAndPasswordConfig {
|
|
1211
|
+
/** Require a verified email before creating a session. @default false */
|
|
1212
|
+
requireEmailVerification?: boolean;
|
|
1213
|
+
/** Smallest accepted password length. @default 8 */
|
|
1214
|
+
minPasswordLength?: number;
|
|
1215
|
+
/** Largest accepted password length. @default 128 */
|
|
1216
|
+
maxPasswordLength?: number;
|
|
1217
|
+
}
|
|
1218
|
+
interface FarmAuthSessionConfig {
|
|
1219
|
+
/** Session lifetime in seconds. @default 604800 */
|
|
1220
|
+
expiresIn?: number;
|
|
1221
|
+
/** Session refresh interval in seconds. @default 86400 */
|
|
1222
|
+
updateAge?: number;
|
|
1223
|
+
}
|
|
1224
|
+
interface FarmAuthDatabaseConfig {
|
|
1225
|
+
/**
|
|
1226
|
+
* Postgres connection string. Defaults to DATABASE_URL.
|
|
1227
|
+
* Local development falls back to SQLite when no URL is present.
|
|
1228
|
+
*/
|
|
1229
|
+
url?: string;
|
|
1230
|
+
/** Local SQLite path. @default ".farm/auth.sqlite" */
|
|
1231
|
+
path?: string;
|
|
1232
|
+
/** Automatically update the auth schema in development. @default true */
|
|
1233
|
+
migrateInDevelopment?: boolean;
|
|
1234
|
+
}
|
|
1235
|
+
interface FarmAuthConfig {
|
|
1236
|
+
/** Set false to disable auth without removing its configuration. @default true */
|
|
1237
|
+
enabled?: boolean;
|
|
1238
|
+
/** Display name used by authentication emails and metadata. */
|
|
1239
|
+
appName?: string;
|
|
1240
|
+
/** Route prefix for the auth endpoints. @default "/api/auth" */
|
|
1241
|
+
basePath?: string;
|
|
1242
|
+
/**
|
|
1243
|
+
* Email/password authentication. It is enabled by default; set false to
|
|
1244
|
+
* disable it when adding another sign-in method.
|
|
1245
|
+
*/
|
|
1246
|
+
emailAndPassword?: boolean | FarmAuthEmailAndPasswordConfig;
|
|
1247
|
+
session?: FarmAuthSessionConfig;
|
|
1248
|
+
database?: FarmAuthDatabaseConfig;
|
|
1249
|
+
}
|
|
1250
|
+
type FarmAuthUserConfig = boolean | FarmAuthConfig;
|
|
1251
|
+
interface ResolvedFarmAuthConfig {
|
|
1252
|
+
enabled: boolean;
|
|
1253
|
+
appName?: string;
|
|
1254
|
+
basePath: string;
|
|
1255
|
+
emailAndPassword: {
|
|
1256
|
+
enabled: boolean;
|
|
1257
|
+
requireEmailVerification: boolean;
|
|
1258
|
+
minPasswordLength: number;
|
|
1259
|
+
maxPasswordLength: number;
|
|
1260
|
+
};
|
|
1261
|
+
session: {
|
|
1262
|
+
expiresIn: number;
|
|
1263
|
+
updateAge: number;
|
|
1264
|
+
};
|
|
1265
|
+
database: {
|
|
1266
|
+
url?: string;
|
|
1267
|
+
path: string;
|
|
1268
|
+
migrateInDevelopment: boolean;
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
type FarmPreloadMode = "warn" | "enforce";
|
|
1273
|
+
interface FarmPreloadUserConfig {
|
|
1274
|
+
/** Report excess hints or remove the lower-priority hints. @default "enforce" */
|
|
1275
|
+
mode?: FarmPreloadMode;
|
|
1276
|
+
/** Maximum image preload hints per document. @default 1 */
|
|
1277
|
+
maxImages?: number;
|
|
1278
|
+
/** Maximum font preload hints per document. @default 2 */
|
|
1279
|
+
maxFonts?: number;
|
|
1280
|
+
}
|
|
1281
|
+
interface ResolvedFarmPreloadConfig {
|
|
1282
|
+
mode: FarmPreloadMode;
|
|
1283
|
+
maxImages: number;
|
|
1284
|
+
maxFonts: number;
|
|
1285
|
+
}
|
|
1286
|
+
interface FarmPerformanceConfig {
|
|
1287
|
+
preload?: FarmPreloadUserConfig;
|
|
1288
|
+
}
|
|
1289
|
+
interface ResolvedFarmPerformanceConfig {
|
|
1290
|
+
preload: ResolvedFarmPreloadConfig;
|
|
1291
|
+
}
|
|
1292
|
+
type FarmPreloadKind = "image" | "font";
|
|
1293
|
+
interface FarmPreloadBudgetWarning {
|
|
1294
|
+
kind: FarmPreloadKind;
|
|
1295
|
+
count: number;
|
|
1296
|
+
budget: number;
|
|
1297
|
+
removed: number;
|
|
1298
|
+
}
|
|
1299
|
+
interface FarmManagedPreloads {
|
|
1300
|
+
value: string;
|
|
1301
|
+
warnings: FarmPreloadBudgetWarning[];
|
|
1302
|
+
}
|
|
1303
|
+
interface FarmManagedDocumentPreloads {
|
|
1304
|
+
html: string;
|
|
1305
|
+
linkHeader: string;
|
|
1306
|
+
warnings: FarmPreloadBudgetWarning[];
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* Apply image and font budgets to HTML preload elements. High-priority image
|
|
1310
|
+
* hints are retained before ordinary hints, making an explicitly preloaded LCP
|
|
1311
|
+
* image the winner when a document contains too many React-generated hints.
|
|
1352
1312
|
*/
|
|
1353
1313
|
declare function manageFarmHtmlPreloads(html: string, config: ResolvedFarmPreloadConfig): FarmManagedPreloads;
|
|
1354
1314
|
/** Apply the same budgets to HTTP Link preload hints, including Farm fonts. */
|
|
@@ -1678,7 +1638,7 @@ declare function shouldEmitFarmClientRootHmr(renderer?: FarmRenderer): boolean;
|
|
|
1678
1638
|
declare function farmPlugin(options?: FarmVitePluginOptions, initialPluginManager?: PluginManager): Plugin$1;
|
|
1679
1639
|
declare function defineConfig(config?: FarmVitePluginOptions): Promise<UserConfig>;
|
|
1680
1640
|
|
|
1681
|
-
type MaybePromise
|
|
1641
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
1682
1642
|
/** @internal Marks a Node response whose intercepted end is awaiting response hooks. */
|
|
1683
1643
|
declare const FARM_NODE_RESPONSE_END_PENDING: unique symbol;
|
|
1684
1644
|
declare const FARM_PLUGIN_INTEGRATION_INSTANCE: unique symbol;
|
|
@@ -1845,7 +1805,7 @@ interface FarmPluginRuntimeEndpointEvent<TState = unknown, TIntegrationInstance
|
|
|
1845
1805
|
interface FarmPluginRuntimeEndpoint<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
1846
1806
|
/** Exact application-relative pathname, before Farm's configured basePath. */
|
|
1847
1807
|
path: string;
|
|
1848
|
-
handler(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeEndpointEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1808
|
+
handler(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeEndpointEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<Response>;
|
|
1849
1809
|
}
|
|
1850
1810
|
interface FarmPluginRuntimeBeforeEvent<TState = unknown, TRequestContext extends object = Record<string, unknown>, TIntegrationInstance = unknown> extends FarmPluginRuntimeBaseEvent<TState, TIntegrationInstance> {
|
|
1851
1811
|
ctx: Readonly<TRequestContext>;
|
|
@@ -1869,19 +1829,19 @@ type FarmPluginRuntimeEventFor<TEvent, TIntegrationInstance, TIntegrationBound e
|
|
|
1869
1829
|
interface FarmPluginRuntimeHooks<TState = unknown, TRequestContext extends object = Record<string, unknown>, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
1870
1830
|
/** Exact request endpoints owned by this plugin. */
|
|
1871
1831
|
endpoints?: readonly FarmPluginRuntimeEndpoint<TState, TIntegrationInstance, TIntegrationBound>[];
|
|
1872
|
-
start?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeStartEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1873
|
-
context?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeContextEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1874
|
-
before?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeBeforeEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1875
|
-
after?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeAfterEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1876
|
-
error?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeErrorEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1877
|
-
close?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeCloseEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1832
|
+
start?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeStartEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1833
|
+
context?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeContextEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<TRequestContext>;
|
|
1834
|
+
before?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeBeforeEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<Request | Response | void>;
|
|
1835
|
+
after?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeAfterEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<Response | void>;
|
|
1836
|
+
error?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeErrorEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1837
|
+
close?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeCloseEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1878
1838
|
}
|
|
1879
1839
|
interface FarmPluginRuntimeRequestOptions {
|
|
1880
1840
|
kind?: FarmPluginRuntimeKind;
|
|
1881
1841
|
route?: FarmPluginRouteRuntimePayload;
|
|
1882
1842
|
waitUntil?: (promise: Promise<unknown>) => void;
|
|
1883
1843
|
}
|
|
1884
|
-
type FarmPluginRuntimeRequestHandler = (request: Request) => MaybePromise
|
|
1844
|
+
type FarmPluginRuntimeRequestHandler = (request: Request) => MaybePromise<Response>;
|
|
1885
1845
|
interface FarmPluginRuntimeSession {
|
|
1886
1846
|
request: Request;
|
|
1887
1847
|
response?: Response;
|
|
@@ -1896,23 +1856,23 @@ type FarmPluginDiscoveredRoute = RouteDiscoveredPayload | ({
|
|
|
1896
1856
|
kind: "api";
|
|
1897
1857
|
} & APIRouteDiscoveredPayload);
|
|
1898
1858
|
interface FarmPluginRouterHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
1899
|
-
discovered?(route: FarmPluginDiscoveredRoute, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1900
|
-
generated?(routes: RoutesGeneratedPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1901
|
-
before?(route: RouteMatchPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1902
|
-
after?(result: RouteMatchResultPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1859
|
+
discovered?(route: FarmPluginDiscoveredRoute, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1860
|
+
generated?(routes: RoutesGeneratedPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1861
|
+
before?(route: RouteMatchPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1862
|
+
after?(result: RouteMatchResultPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1903
1863
|
}
|
|
1904
1864
|
interface FarmPluginRenderHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
1905
|
-
before?(render: RenderLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1906
|
-
html?(html: string, render: RenderLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1865
|
+
before?(render: RenderLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1866
|
+
html?(html: string, render: RenderLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<string | void>;
|
|
1907
1867
|
}
|
|
1908
1868
|
interface FarmPluginBuildHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
1909
|
-
before?(bundle: BundleLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1910
|
-
configure?(buildConfig: any, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1911
|
-
after?(result: BundleResultPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1869
|
+
before?(bundle: BundleLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1870
|
+
configure?(buildConfig: any, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<any>;
|
|
1871
|
+
after?(result: BundleResultPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1912
1872
|
}
|
|
1913
1873
|
interface FarmPluginDevHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
1914
|
-
server?(viteServer: ViteDevServer, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1915
|
-
update?(update: HMRUpdatePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise
|
|
1874
|
+
server?(viteServer: ViteDevServer, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1875
|
+
update?(update: HMRUpdatePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise<void>;
|
|
1916
1876
|
}
|
|
1917
1877
|
interface FarmPluginClientConfig<TState = unknown, TPublic = undefined> extends FarmClientPlugin<TState, TPublic> {
|
|
1918
1878
|
/** Explicitly public, JSON-safe data embedded in the browser bundle. */
|
|
@@ -1925,9 +1885,9 @@ interface FarmPlugin<TState = any, TRequestContext extends object = Record<strin
|
|
|
1925
1885
|
/** Declarative API routes, mounted through the normal dev and production API pipeline. */
|
|
1926
1886
|
routes?: PluginRoutesFactory<TRoutes>;
|
|
1927
1887
|
/** Transform Farm config before the development or production pipeline is created. */
|
|
1928
|
-
configure?: (config: FarmConfig, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => MaybePromise
|
|
1888
|
+
configure?: (config: FarmConfig, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => MaybePromise<FarmConfig | void>;
|
|
1929
1889
|
/** Initialize private plugin state once for this plugin manager. */
|
|
1930
|
-
setup?: (context: FarmPluginSetupContextFor<TIntegrationInstance, TIntegrationBound>) => MaybePromise
|
|
1890
|
+
setup?: (context: FarmPluginSetupContextFor<TIntegrationInstance, TIntegrationBound>) => MaybePromise<TState>;
|
|
1931
1891
|
runtime?: FarmPluginRuntimeHooks<TState, TRequestContext, TIntegrationInstance, TIntegrationBound>;
|
|
1932
1892
|
router?: FarmPluginRouterHooks<TState, TIntegrationInstance, TIntegrationBound>;
|
|
1933
1893
|
render?: FarmPluginRenderHooks<TState, TIntegrationInstance, TIntegrationBound>;
|
|
@@ -2087,9 +2047,9 @@ type FarmPluginDefinition<TState = undefined, TRequestContext extends object = R
|
|
|
2087
2047
|
*/
|
|
2088
2048
|
options?: TSchema;
|
|
2089
2049
|
/** Transform Farm config before the development or production pipeline is created. */
|
|
2090
|
-
configure?: (config: FarmConfig, context: WithPluginOptions<FarmPluginContextFor<TIntegrationInstance, false>, TSchema>) => MaybePromise
|
|
2050
|
+
configure?: (config: FarmConfig, context: WithPluginOptions<FarmPluginContextFor<TIntegrationInstance, false>, TSchema>) => MaybePromise<FarmConfig | void>;
|
|
2091
2051
|
/** Initialize private plugin state once for this plugin manager. */
|
|
2092
|
-
setup?: (context: WithPluginOptions<FarmPluginSetupContextFor<TIntegrationInstance, false>, TSchema>) => MaybePromise
|
|
2052
|
+
setup?: (context: WithPluginOptions<FarmPluginSetupContextFor<TIntegrationInstance, false>, TSchema>) => MaybePromise<TState>;
|
|
2093
2053
|
};
|
|
2094
2054
|
type DefinedPlugin<TState, TRequestContext extends object, TClientState, TClientPublic, TIntegrationInstance, TRoutes extends PluginRoutes, TSchema> = FarmPlugin<ResolvedPluginState<TState, TSchema>, TRequestContext, TClientState, TClientPublic, TIntegrationInstance, false, TRoutes>;
|
|
2095
2055
|
/** The database a plugin's `schema` tables live in, when not `storage.client`. */
|
|
@@ -2128,482 +2088,698 @@ declare namespace definePlugin {
|
|
|
2128
2088
|
function forIntegration<TIntegrationInstance>(): <TState = undefined, TRequestContext extends object = Record<string, never>, TClientState = unknown, TClientPublic = undefined>(plugin: FarmPlugin<TState, TRequestContext, TClientState, TClientPublic, TIntegrationInstance, true>) => FarmPlugin<TState, TRequestContext, TClientState, TClientPublic, TIntegrationInstance, true>;
|
|
2129
2089
|
}
|
|
2130
2090
|
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
type FarmIntegrationValidationPathSegment = PropertyKey | {
|
|
2140
|
-
readonly key: PropertyKey;
|
|
2141
|
-
};
|
|
2142
|
-
interface FarmIntegrationRouteInput<TBody = unknown, TQuery = unknown> {
|
|
2143
|
-
body?: TBody;
|
|
2144
|
-
query?: TQuery;
|
|
2145
|
-
}
|
|
2146
|
-
interface FarmIntegrationValidationIssue {
|
|
2147
|
-
source: FarmIntegrationRouteInputSource;
|
|
2148
|
-
path?: readonly (string | number)[];
|
|
2149
|
-
code?: string;
|
|
2150
|
-
message: string;
|
|
2091
|
+
/** A server-only endpoint reference. Config references must declare an explicit /api path. */
|
|
2092
|
+
type FarmMCPEndpoint = TypedEndpoint<any, any, any, any, any, any, any, any>;
|
|
2093
|
+
interface FarmMCPExecuteContext {
|
|
2094
|
+
/** The principal returned by authorize, or { subject: "anonymous" } for public servers. */
|
|
2095
|
+
readonly authorization: Readonly<FarmMCPAuthorization>;
|
|
2096
|
+
readonly request: Request;
|
|
2097
|
+
/** Observe this signal in cancellable work. Cancellation cannot undo side effects. */
|
|
2098
|
+
readonly signal: AbortSignal;
|
|
2151
2099
|
}
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2100
|
+
/** A server-only tool with no corresponding HTTP endpoint. */
|
|
2101
|
+
interface FarmMCPStandaloneTool<Schema extends RouteSchema = RouteSchema, Result = unknown, OutputSchema extends RouteSchema | undefined = undefined> extends EndpointMCPMetadata {
|
|
2102
|
+
name: string;
|
|
2103
|
+
/** Must describe an object and support input JSON Schema conversion. */
|
|
2104
|
+
inputSchema: Schema;
|
|
2105
|
+
/** Validate/transform returned data and advertise its output shape inside MCP's result envelope. */
|
|
2106
|
+
outputSchema?: OutputSchema;
|
|
2107
|
+
/** Return JSON-serializable data, not a Response or an MCP protocol envelope. */
|
|
2108
|
+
execute(input: RouteSchemaOutput<Schema>, context: FarmMCPExecuteContext): OutputSchema extends RouteSchema ? NoInfer<RouteSchemaInput<OutputSchema>> | Promise<NoInfer<RouteSchemaInput<OutputSchema>>> : Result | Promise<Result>;
|
|
2109
|
+
endpoint?: never;
|
|
2159
2110
|
}
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2111
|
+
/**
|
|
2112
|
+
* A createServerFn or createServerQuery function with `mcp` metadata. It runs through its own
|
|
2113
|
+
* input schema, middleware and output schema, with the MCP request as its request.
|
|
2114
|
+
*/
|
|
2115
|
+
type FarmMCPServerFunction = ServerFn<any, any, any> | ServerQuery<any, any>;
|
|
2116
|
+
/** Compose endpoint references, server functions and standalone tools. */
|
|
2117
|
+
type FarmMCPToolDefinition = FarmMCPEndpoint | FarmMCPServerFunction | (EndpointMCPMetadata & {
|
|
2118
|
+
endpoint: FarmMCPEndpoint;
|
|
2119
|
+
execute?: never;
|
|
2120
|
+
}) | FarmMCPStandaloneTool<any, unknown, any>;
|
|
2121
|
+
/** Resolved tool identity, without handlers, validators, or a way to bypass authorization. */
|
|
2122
|
+
type FarmMCPTool = Readonly<EndpointMCPMetadata> & {
|
|
2123
|
+
readonly name: string;
|
|
2124
|
+
} & ({
|
|
2125
|
+
readonly kind: "endpoint";
|
|
2126
|
+
readonly method: RouteMethod;
|
|
2127
|
+
readonly path: string;
|
|
2163
2128
|
} | {
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
type FarmIntegrationStandardValidationResult<TValue> = {
|
|
2168
|
-
value: TValue;
|
|
2129
|
+
readonly kind: "standalone";
|
|
2130
|
+
readonly method?: never;
|
|
2131
|
+
readonly path?: never;
|
|
2169
2132
|
} | {
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
safeParse?(value: unknown): MaybePromise<FarmIntegrationValidationResult<TValue>>;
|
|
2180
|
-
safeParseAsync?(value: unknown): Promise<FarmIntegrationValidationResult<TValue>>;
|
|
2181
|
-
"~standard"?: {
|
|
2182
|
-
validate(value: unknown): MaybePromise<FarmIntegrationStandardValidationResult<TValue>>;
|
|
2183
|
-
types?: {
|
|
2184
|
-
output: TValue;
|
|
2185
|
-
};
|
|
2186
|
-
};
|
|
2133
|
+
readonly kind: "serverFunction";
|
|
2134
|
+
readonly method?: never;
|
|
2135
|
+
readonly path?: never;
|
|
2136
|
+
});
|
|
2137
|
+
/** What a resource's `read` receives: the URI asked for, its template variables, and the caller. */
|
|
2138
|
+
interface FarmMCPResourceContext extends FarmMCPExecuteContext {
|
|
2139
|
+
readonly uri: URL;
|
|
2140
|
+
/** Values matched by `uriTemplate`; empty for a fixed `uri`. */
|
|
2141
|
+
readonly variables: Readonly<Record<string, string | string[]>>;
|
|
2187
2142
|
}
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2143
|
+
/**
|
|
2144
|
+
* One piece of resource content: a string (sent as `mimeType`, or text/plain),
|
|
2145
|
+
* text with its own type, JSON data, or binary data.
|
|
2146
|
+
*/
|
|
2147
|
+
type FarmMCPResourceContent = string | {
|
|
2148
|
+
text: string;
|
|
2149
|
+
mimeType?: string;
|
|
2150
|
+
} | {
|
|
2151
|
+
json: unknown;
|
|
2152
|
+
} | {
|
|
2153
|
+
blob: Uint8Array | ArrayBuffer;
|
|
2154
|
+
mimeType?: string;
|
|
2155
|
+
};
|
|
2156
|
+
/** One concrete URI a templated resource lists. */
|
|
2157
|
+
interface FarmMCPResourceListing {
|
|
2158
|
+
uri: string;
|
|
2159
|
+
name?: string;
|
|
2160
|
+
title?: string;
|
|
2161
|
+
description?: string;
|
|
2162
|
+
mimeType?: string;
|
|
2191
2163
|
}
|
|
2192
|
-
/** @deprecated Use `FarmRequestStore` and access it through `ctx.req`. */
|
|
2193
|
-
type FarmIntegrationRequestContextStore = FarmRequestStore;
|
|
2194
|
-
declare const FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = "farm.integration.internalDispatch";
|
|
2195
2164
|
/**
|
|
2196
|
-
*
|
|
2197
|
-
* `
|
|
2198
|
-
* request continue to the downstream route/page handler). The runtime reads
|
|
2199
|
-
* this key back after a `void` middleware return and forwards the cookies onto
|
|
2200
|
-
* the response it ultimately sends, so a server-side session refresh (or any
|
|
2201
|
-
* other cookie rotation) reaches the browser instead of being dropped.
|
|
2165
|
+
* A server-only MCP resource: read-only context an agent can load, at a fixed
|
|
2166
|
+
* `uri` or at every URI matching an RFC 6570 `uriTemplate`.
|
|
2202
2167
|
*/
|
|
2203
|
-
|
|
2168
|
+
interface FarmMCPResource {
|
|
2169
|
+
/** Stable name, used in authorization and in `authorize`'s `resources` allowlist. */
|
|
2170
|
+
name: string;
|
|
2171
|
+
title?: string;
|
|
2172
|
+
description?: string;
|
|
2173
|
+
mimeType?: string;
|
|
2174
|
+
/** A fixed absolute URI, such as `docs://handbook`. Set this or `uriTemplate`. */
|
|
2175
|
+
uri?: string;
|
|
2176
|
+
/** An RFC 6570 template, such as `notes://{id}`. Set this or `uri`. */
|
|
2177
|
+
uriTemplate?: string;
|
|
2178
|
+
/** For a template: the concrete resources to list. Omit to list none. */
|
|
2179
|
+
list?(context: FarmMCPExecuteContext): readonly FarmMCPResourceListing[] | Promise<readonly FarmMCPResourceListing[]>;
|
|
2180
|
+
/** Return the content, or null when the URI names nothing. */
|
|
2181
|
+
read(context: FarmMCPResourceContext): FarmMCPResourceContent | readonly FarmMCPResourceContent[] | null | Promise<FarmMCPResourceContent | readonly FarmMCPResourceContent[] | null>;
|
|
2182
|
+
}
|
|
2183
|
+
interface FarmMCPPromptMessage {
|
|
2184
|
+
role: "user" | "assistant";
|
|
2185
|
+
text: string;
|
|
2186
|
+
}
|
|
2204
2187
|
/**
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2207
|
-
*
|
|
2208
|
-
* the passthrough counterpart to appending `Set-Cookie` to a `Response` the
|
|
2209
|
-
* middleware returns directly (e.g. a failure redirect): both paths can rotate
|
|
2210
|
-
* auth cookies, and both must be able to reach the browser.
|
|
2188
|
+
* A server-only MCP prompt: a reusable message template a client offers its
|
|
2189
|
+
* user. Arguments arrive as strings, as MCP sends them, and are validated by
|
|
2190
|
+
* `arguments` before `render` runs.
|
|
2211
2191
|
*/
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2192
|
+
interface FarmMCPPrompt<Schema extends RouteSchema | undefined = RouteSchema | undefined> {
|
|
2193
|
+
/** Stable name: 1-128 letters, numbers, dots, underscores, or hyphens. */
|
|
2194
|
+
name: string;
|
|
2195
|
+
title?: string;
|
|
2196
|
+
description?: string;
|
|
2197
|
+
/** An object schema of string arguments. */
|
|
2198
|
+
arguments?: Schema;
|
|
2199
|
+
/** Return the prompt text, sent as one user message, or a list of messages. */
|
|
2200
|
+
render(args: Schema extends RouteSchema ? RouteSchemaOutput<Schema> : Record<string, never>, context: FarmMCPExecuteContext): string | readonly FarmMCPPromptMessage[] | Promise<string | readonly FarmMCPPromptMessage[]>;
|
|
2217
2201
|
}
|
|
2218
|
-
interface
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2202
|
+
interface FarmMCPServer {
|
|
2203
|
+
readonly name: string;
|
|
2204
|
+
readonly version: string;
|
|
2205
|
+
readonly path: `/api/${string}`;
|
|
2222
2206
|
}
|
|
2223
|
-
interface
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
/**
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2207
|
+
interface FarmMCPAuthorization extends Record<string, unknown> {
|
|
2208
|
+
/** Stable application principal identifier. Never written to a response or log by Farm. */
|
|
2209
|
+
subject: string;
|
|
2210
|
+
scopes?: string[];
|
|
2211
|
+
/** Allowed tool names for this request. Omit for all configured tools; [] denies all tools. */
|
|
2212
|
+
tools?: readonly string[];
|
|
2213
|
+
/** Allowed resource names. Omit for all configured resources; [] denies all resources. */
|
|
2214
|
+
resources?: readonly string[];
|
|
2215
|
+
/** Allowed prompt names. Omit for all configured prompts; [] denies all prompts. */
|
|
2216
|
+
prompts?: readonly string[];
|
|
2233
2217
|
}
|
|
2234
|
-
interface
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2218
|
+
interface FarmMCPAuthorizeContext {
|
|
2219
|
+
request: Request;
|
|
2220
|
+
/** Untrusted requested name for a tools/call; authorization runs separately for every JSON-RPC batch item. */
|
|
2221
|
+
tool?: string;
|
|
2222
|
+
/** Untrusted requested URI for a resources/read. */
|
|
2223
|
+
resource?: string;
|
|
2224
|
+
/** Untrusted requested name for a prompts/get. */
|
|
2225
|
+
prompt?: string;
|
|
2226
|
+
/** Complete configured catalog, before applying this caller's permissions. */
|
|
2227
|
+
tools: readonly FarmMCPTool[];
|
|
2228
|
+
/** Resolved transport identity, for policies shared by multiple MCP endpoints. */
|
|
2229
|
+
server: FarmMCPServer;
|
|
2240
2230
|
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2231
|
+
interface FarmMCPConfig {
|
|
2232
|
+
/** Set false to disable MCP without removing its configuration. @default true */
|
|
2233
|
+
enabled?: boolean;
|
|
2234
|
+
/** Canonical Farm API path for the Streamable HTTP endpoint. @default "/api/mcp" */
|
|
2235
|
+
path?: `/api/${string}`;
|
|
2236
|
+
/** MCP server identity. @default "farm-api" */
|
|
2237
|
+
name?: string;
|
|
2238
|
+
/** MCP server version. @default "1.0.0" */
|
|
2239
|
+
version?: string;
|
|
2240
|
+
/** Explicit endpoint/standalone tool allowlist. Omit to discover route-owned MCP metadata. */
|
|
2241
|
+
tools?: readonly FarmMCPToolDefinition[];
|
|
2242
|
+
/** Read-only context for agents, from `defineResource()`. */
|
|
2243
|
+
resources?: readonly FarmMCPResource[];
|
|
2244
|
+
/** Reusable prompt templates, from `definePrompt()`. */
|
|
2245
|
+
prompts?: readonly FarmMCPPrompt<any>[];
|
|
2246
|
+
/** Authorize every MCP request. Returning false responds with 401 before protocol handling. */
|
|
2247
|
+
authorize?: (context: FarmMCPAuthorizeContext) => FarmMCPAuthorization | false | Promise<FarmMCPAuthorization | false>;
|
|
2248
|
+
/** Deliberate escape hatch for public servers. Authentication is required by default. */
|
|
2249
|
+
allowUnauthenticated?: boolean;
|
|
2250
|
+
/**
|
|
2251
|
+
* OAuth discovery for MCP clients. When set, a rejected request's 401 points at
|
|
2252
|
+
* RFC 9728 Protected Resource Metadata naming these authorization servers, which
|
|
2253
|
+
* Farm serves at `/.well-known/oauth-protected-resource/<endpoint path>`.
|
|
2254
|
+
* Validating tokens stays in `authorize`.
|
|
2255
|
+
*/
|
|
2256
|
+
oauth?: FarmMCPOAuthConfig;
|
|
2247
2257
|
}
|
|
2248
|
-
interface
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2258
|
+
interface FarmMCPOAuthConfig {
|
|
2259
|
+
/** Issuer URLs of the OAuth authorization servers that issue tokens for this endpoint. */
|
|
2260
|
+
authorizationServers: readonly string[];
|
|
2261
|
+
/** Scopes clients may request, advertised as `scopes_supported` and in the 401 challenge. */
|
|
2262
|
+
scopes?: readonly string[];
|
|
2263
|
+
/** Human-readable name for consent screens. @default the MCP server name */
|
|
2264
|
+
resourceName?: string;
|
|
2254
2265
|
}
|
|
2255
|
-
type
|
|
2266
|
+
type FarmMCPUserConfig = FarmMCPConfig | false;
|
|
2267
|
+
interface ResolvedFarmMCPConfig extends FarmMCPConfig {
|
|
2268
|
+
enabled: boolean;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2256
2271
|
/**
|
|
2257
|
-
*
|
|
2258
|
-
*
|
|
2272
|
+
* @internal Publishes one MCP server's tools, replacing an earlier catalog for
|
|
2273
|
+
* the same endpoint. Returns a function that removes it.
|
|
2259
2274
|
*/
|
|
2260
|
-
|
|
2261
|
-
interface
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
method: string;
|
|
2267
|
-
params: FarmIntegrationRouteParams;
|
|
2268
|
-
input: FarmIntegrationRouteInput<TBody, TQuery>;
|
|
2269
|
-
args: FarmIntegrationRouteArgs<TSchema>;
|
|
2270
|
-
data: FarmIntegrationData;
|
|
2271
|
-
integration: {
|
|
2272
|
-
category: FarmIntegrationCategory;
|
|
2273
|
-
/** @deprecated Use category instead. */
|
|
2274
|
-
slot: FarmIntegrationCategory;
|
|
2275
|
-
type: string;
|
|
2276
|
-
instance: unknown;
|
|
2277
|
-
};
|
|
2278
|
-
route: {
|
|
2279
|
-
kind: "route" | "middleware";
|
|
2280
|
-
path: string;
|
|
2281
|
-
methods: readonly string[];
|
|
2282
|
-
};
|
|
2283
|
-
req: FarmRequestStore;
|
|
2284
|
-
/** @deprecated Use `req` instead. */
|
|
2285
|
-
requestContext: FarmRequestStore;
|
|
2286
|
-
config: FarmPluginContext["config"];
|
|
2287
|
-
isDev: boolean;
|
|
2288
|
-
isProd: boolean;
|
|
2275
|
+
declare function _publishFarmMCPCatalog(server: FarmMCPServer, tools: readonly FarmMCPTool[]): () => void;
|
|
2276
|
+
interface FarmMCPEndpointTool {
|
|
2277
|
+
/** The MCP tool name. */
|
|
2278
|
+
name: string;
|
|
2279
|
+
/** The public path of the MCP endpoint that serves the tool. */
|
|
2280
|
+
endpoint: string;
|
|
2289
2281
|
}
|
|
2290
|
-
|
|
2291
|
-
|
|
2282
|
+
/**
|
|
2283
|
+
* @internal Finds the MCP tool that runs the API endpoint a request to
|
|
2284
|
+
* `method pathname` reaches, if a published catalog exposes one.
|
|
2285
|
+
* `serverBasePath` is the app's public API path, which maps to `/api`.
|
|
2286
|
+
*/
|
|
2287
|
+
declare function _findFarmMCPEndpointTool(method: string, pathname: string, serverBasePath?: string): FarmMCPEndpointTool | undefined;
|
|
2288
|
+
|
|
2289
|
+
/** Content type for Markdown responses, including agent-facing error bodies. */
|
|
2290
|
+
declare const FARM_MARKDOWN_CONTENT_TYPE = "text/markdown; charset=utf-8";
|
|
2291
|
+
declare function farmRequestWantsMarkdown(pathname: string, accept: string | null | undefined): boolean;
|
|
2292
|
+
declare function createFarmMarkdownErrorBody(status: number, pathname: string, homeHref?: string): string;
|
|
2293
|
+
type FarmMarkdownRouteInput = string | {
|
|
2294
|
+
route: string;
|
|
2295
|
+
title?: string;
|
|
2296
|
+
cache?: number | false;
|
|
2297
|
+
};
|
|
2298
|
+
interface FarmMarkdownUserConfig {
|
|
2299
|
+
/**
|
|
2300
|
+
* Enable generated markdown representations for React pages.
|
|
2301
|
+
* @default true
|
|
2302
|
+
*/
|
|
2303
|
+
enabled?: boolean;
|
|
2304
|
+
/**
|
|
2305
|
+
* Routes that may expose generated markdown. Every page is exposed by default.
|
|
2306
|
+
*/
|
|
2307
|
+
expose?: boolean | FarmMarkdownRouteInput[];
|
|
2308
|
+
/** @deprecated Use `expose`. */
|
|
2309
|
+
routes?: FarmMarkdownRouteInput[];
|
|
2310
|
+
cache?: number | false;
|
|
2311
|
+
includeMetadata?: boolean;
|
|
2292
2312
|
}
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
path: string;
|
|
2298
|
-
method?: FarmIntegrationRouteMethod;
|
|
2299
|
-
methods?: readonly FarmIntegrationRouteMethod[];
|
|
2300
|
-
middleware?: readonly FarmIntegrationRouteMiddleware<TSchema>[];
|
|
2301
|
-
before?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
2302
|
-
after?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
2303
|
-
rawBody?: boolean;
|
|
2304
|
-
bodyFormat?: FarmIntegrationAPIBodyFormat;
|
|
2305
|
-
body?: FarmIntegrationInputSchema<TBody>;
|
|
2306
|
-
query?: FarmIntegrationInputSchema<TQuery>;
|
|
2307
|
-
input?: FarmIntegrationRouteInputSchemas<TBody, TQuery>;
|
|
2308
|
-
handler(request: Request, context: FarmIntegrationHandlerContext<TBody, TQuery, TSchema>): Promise<Response> | Response;
|
|
2313
|
+
interface FarmMarkdownResolvedRoute {
|
|
2314
|
+
route: string;
|
|
2315
|
+
title?: string;
|
|
2316
|
+
cache?: number | false;
|
|
2309
2317
|
}
|
|
2310
|
-
interface
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2318
|
+
interface FarmMarkdownResolvedConfig {
|
|
2319
|
+
enabled: boolean;
|
|
2320
|
+
expose: true | FarmMarkdownResolvedRoute[];
|
|
2321
|
+
cache: number | false;
|
|
2322
|
+
includeMetadata: boolean;
|
|
2314
2323
|
}
|
|
2315
|
-
interface
|
|
2316
|
-
|
|
2324
|
+
interface FarmMarkdownMirrorTarget {
|
|
2325
|
+
pathname: string;
|
|
2326
|
+
route: FarmMarkdownResolvedRoute | null;
|
|
2317
2327
|
}
|
|
2318
|
-
interface
|
|
2319
|
-
|
|
2320
|
-
handler(request: Request, context: FarmIntegrationHandlerContext<unknown, unknown, TSchema>): Promise<Response | void> | Response | void;
|
|
2328
|
+
interface ResolveMarkdownMirrorTargetOptions {
|
|
2329
|
+
accept?: string | null;
|
|
2321
2330
|
}
|
|
2322
|
-
interface
|
|
2323
|
-
|
|
2331
|
+
interface CreateMarkdownMirrorResponseOptions {
|
|
2332
|
+
request: Request;
|
|
2333
|
+
/** @internal Reuse a parse only while its href still matches this request. */
|
|
2334
|
+
requestUrl?: URL;
|
|
2335
|
+
config?: FarmMarkdownResolvedConfig;
|
|
2336
|
+
routeExists?: (pathname: string) => boolean;
|
|
2337
|
+
renderPage: (request: Request) => Response | Promise<Response>;
|
|
2338
|
+
/** The app's public API path, so a form posting to an API route can be matched to its MCP tool. */
|
|
2339
|
+
apiServerBasePath?: string;
|
|
2340
|
+
}
|
|
2341
|
+
interface ApplyMarkdownNegotiationHeadersOptions {
|
|
2342
|
+
config?: FarmMarkdownResolvedConfig;
|
|
2343
|
+
pathname: string;
|
|
2324
2344
|
}
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2345
|
+
declare function resolveMarkdownConfig(config: FarmMarkdownUserConfig | boolean | undefined): FarmMarkdownResolvedConfig;
|
|
2346
|
+
declare function resolveMarkdownMirrorTarget(config: FarmMarkdownResolvedConfig | undefined, pathname: string, options?: ResolveMarkdownMirrorTargetOptions): FarmMarkdownMirrorTarget | null;
|
|
2347
|
+
declare function createMarkdownMirrorResponse(options: CreateMarkdownMirrorResponseOptions): Promise<Response | null>;
|
|
2348
|
+
declare function applyMarkdownNegotiationHeaders(response: Response, options: ApplyMarkdownNegotiationHeadersOptions): Response;
|
|
2349
|
+
declare function htmlToMarkdown(html: string, options?: {
|
|
2350
|
+
title?: string;
|
|
2351
|
+
sourcePath?: string;
|
|
2352
|
+
includeMetadata?: boolean;
|
|
2353
|
+
/** Where the page's forms are described, listed when the page has any. */
|
|
2354
|
+
actionsPath?: string;
|
|
2355
|
+
}): string;
|
|
2356
|
+
/**
|
|
2357
|
+
* Quality value an `Accept` header assigns a media type, or 0 when the client
|
|
2358
|
+
* will not take it.
|
|
2359
|
+
*
|
|
2360
|
+
* `q=0` means "not acceptable" per RFC 9110, so it has to be distinguished from
|
|
2361
|
+
* an absent entry rather than treated as a match. Wildcards are opt-in: a client
|
|
2362
|
+
* sending `*/*` will take anything, which says nothing about whether it would
|
|
2363
|
+
* rather have Markdown than HTML, so callers negotiating between two concrete
|
|
2364
|
+
* types should ask for exact entries only.
|
|
2365
|
+
*/
|
|
2366
|
+
declare function farmAcceptQuality(accept: string | null | undefined, mediaType: string, options?: {
|
|
2367
|
+
wildcards?: boolean;
|
|
2368
|
+
}): number;
|
|
2369
|
+
declare function requestAcceptsMarkdown(accept: string | null | undefined): boolean;
|
|
2370
|
+
/** @internal The `.md` URL that serves a page's Markdown mirror. */
|
|
2371
|
+
declare function getFarmMarkdownMirrorPath(pathname: string): string;
|
|
2372
|
+
/**
|
|
2373
|
+
* @internal The `.md` URL to advertise for the HTML page at `pathname`, or
|
|
2374
|
+
* null when it has no Markdown mirror. Both the `Link` response header and the
|
|
2375
|
+
* `<link rel="alternate">` in the document head come from this.
|
|
2376
|
+
*/
|
|
2377
|
+
declare function getFarmMarkdownAlternatePath(config: FarmMarkdownResolvedConfig | undefined, pathname: string): string | null;
|
|
2378
|
+
/** @internal Whether `pathname` has a Markdown mirror under `config`. */
|
|
2379
|
+
declare function isFarmMarkdownMirrorExposed(config: FarmMarkdownResolvedConfig | undefined, pathname: string): boolean;
|
|
2380
|
+
/** @internal Matches a page pathname against a route pattern such as `/docs/[...slug]`. */
|
|
2381
|
+
declare function matchesFarmMarkdownRoutePattern(pattern: string, pathname: string): boolean;
|
|
2382
|
+
interface FarmPageFormOption {
|
|
2383
|
+
value: string;
|
|
2384
|
+
label?: string;
|
|
2385
|
+
selected?: true;
|
|
2330
2386
|
}
|
|
2331
|
-
interface
|
|
2387
|
+
interface FarmPageFormField {
|
|
2332
2388
|
name: string;
|
|
2389
|
+
/** The input type, or `select`, `textarea`, `radio`, or `checkbox` for a group. */
|
|
2333
2390
|
type: string;
|
|
2334
|
-
|
|
2391
|
+
label?: string;
|
|
2392
|
+
required?: true;
|
|
2393
|
+
multiple?: true;
|
|
2394
|
+
/** A preset value: always present for hidden fields. */
|
|
2395
|
+
value?: string;
|
|
2396
|
+
checked?: true;
|
|
2397
|
+
/** Choices of a select, or of radio buttons and checkboxes sharing a name. */
|
|
2398
|
+
options?: FarmPageFormOption[];
|
|
2399
|
+
placeholder?: string;
|
|
2400
|
+
pattern?: string;
|
|
2401
|
+
min?: string;
|
|
2402
|
+
max?: string;
|
|
2403
|
+
step?: string;
|
|
2404
|
+
minLength?: number;
|
|
2405
|
+
maxLength?: number;
|
|
2406
|
+
accept?: string;
|
|
2407
|
+
}
|
|
2408
|
+
interface FarmPageFormSubmit {
|
|
2409
|
+
label: string;
|
|
2410
|
+
name?: string;
|
|
2411
|
+
value?: string;
|
|
2412
|
+
/** Set when the button submits somewhere other than its form (`formaction`). */
|
|
2413
|
+
action?: string;
|
|
2414
|
+
method?: string;
|
|
2415
|
+
}
|
|
2416
|
+
interface FarmPageFormAction {
|
|
2417
|
+
type: "form";
|
|
2418
|
+
name?: string;
|
|
2419
|
+
method: "GET" | "POST";
|
|
2335
2420
|
/**
|
|
2336
|
-
*
|
|
2337
|
-
*
|
|
2338
|
-
* Providers are treated as route-wide unless they explicitly opt in.
|
|
2421
|
+
* Where the form submits: a root-relative URL on the page's origin, or an
|
|
2422
|
+
* absolute URL elsewhere. Absent when the form only submits with JavaScript.
|
|
2339
2423
|
*/
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
/**
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
type FarmIntegrationSchemaReference = FarmSchemaReference;
|
|
2350
|
-
/** @deprecated Use `FarmSchemaField`. */
|
|
2351
|
-
type FarmIntegrationSchemaField = FarmSchemaField;
|
|
2352
|
-
/** @deprecated Use `FarmSchemaConstraint`. */
|
|
2353
|
-
type FarmIntegrationSchemaConstraint = FarmSchemaConstraint;
|
|
2354
|
-
/** @deprecated Use `FarmSchemaModel`. */
|
|
2355
|
-
type FarmIntegrationSchemaModel = FarmSchemaModel;
|
|
2356
|
-
/** @deprecated Use `FarmSchemaModelExtension`. */
|
|
2357
|
-
type FarmIntegrationSchemaModelExtension = FarmSchemaModelExtension;
|
|
2358
|
-
/** @deprecated Use `FarmSchemaModelOverride`. */
|
|
2359
|
-
type FarmIntegrationSchemaModelOverride = FarmSchemaModelOverride;
|
|
2360
|
-
/** @deprecated Use `FarmSchema`. */
|
|
2361
|
-
type FarmIntegrationSchema = FarmSchema;
|
|
2362
|
-
/** @deprecated Use `defineSchema`. This is an exact alias, not a wrapper. */
|
|
2363
|
-
declare const defineIntegrationSchema: typeof defineSchema;
|
|
2364
|
-
type FarmIntegrationLogPhase = "registered" | "validate" | "setup" | "ready" | "dispose" | "request:start" | "request:end" | "request:error";
|
|
2365
|
-
interface FarmIntegrationLogEvent {
|
|
2366
|
-
category: FarmIntegrationCategory;
|
|
2367
|
-
/** @deprecated Use category instead. */
|
|
2368
|
-
slot: FarmIntegrationCategory;
|
|
2369
|
-
type: string;
|
|
2370
|
-
phase: FarmIntegrationLogPhase;
|
|
2371
|
-
route?: {
|
|
2372
|
-
kind: "route" | "middleware";
|
|
2373
|
-
path: string;
|
|
2374
|
-
methods: readonly string[];
|
|
2424
|
+
action?: string;
|
|
2425
|
+
/** Present for POST forms. */
|
|
2426
|
+
enctype?: string;
|
|
2427
|
+
requiresJavaScript?: true;
|
|
2428
|
+
fields: FarmPageFormField[];
|
|
2429
|
+
submit: FarmPageFormSubmit[];
|
|
2430
|
+
/** A React server action form: the id React put in its hidden `$ACTION_` fields. */
|
|
2431
|
+
serverAction?: {
|
|
2432
|
+
id: string;
|
|
2375
2433
|
};
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
message?: string;
|
|
2383
|
-
meta?: Record<string, unknown>;
|
|
2384
|
-
context: Map<string, unknown>;
|
|
2434
|
+
/**
|
|
2435
|
+
* The MCP tool that runs the same API endpoint, when `@farm.js/mcp` exposes
|
|
2436
|
+
* it: the tool `name` and the MCP `endpoint` to call it at. The caller's
|
|
2437
|
+
* `authorize` policy still decides whether that tool is available to it.
|
|
2438
|
+
*/
|
|
2439
|
+
tool?: FarmMCPEndpointTool;
|
|
2385
2440
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2441
|
+
/**
|
|
2442
|
+
* Describes the forms in the part of the page the mirror reads, so an agent can
|
|
2443
|
+
* see what it can submit: where, how, and with which fields. Controls that are
|
|
2444
|
+
* disabled are left out, since a browser would not submit them; hidden fields
|
|
2445
|
+
* keep their values, so a submission without JavaScript can be replayed.
|
|
2446
|
+
*/
|
|
2447
|
+
declare function extractFarmPageActions(html: string, pageUrl: URL): FarmPageFormAction[];
|
|
2448
|
+
|
|
2449
|
+
interface FarmLlmsTxtLink {
|
|
2450
|
+
title: string;
|
|
2451
|
+
url: string;
|
|
2452
|
+
description?: string;
|
|
2393
2453
|
}
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
readonly kind: "farm-integration";
|
|
2398
|
-
category: FarmIntegrationCategory;
|
|
2399
|
-
/** @deprecated Use category instead. */
|
|
2400
|
-
slot?: FarmIntegrationCategory;
|
|
2401
|
-
type: string;
|
|
2402
|
-
instance: TInstance;
|
|
2403
|
-
/** Set to false when a platform adapter owns this integration's production routes. */
|
|
2404
|
-
serverRuntime?: boolean;
|
|
2405
|
-
api?: FarmIntegrationAPI;
|
|
2406
|
-
schema?: TSchema;
|
|
2407
|
-
config?: FarmIntegrationConfigInput<TConfig, TSchema>;
|
|
2408
|
-
validate?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
2409
|
-
setup?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
2410
|
-
ready?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
2411
|
-
dispose?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
2412
|
-
log?: FarmIntegrationLogger;
|
|
2413
|
-
routes?: readonly FarmIntegrationRoute<any, any, TSchema>[];
|
|
2414
|
-
endpoints?: FarmIntegrationEndpoints<TSchema>;
|
|
2415
|
-
middleware?: readonly FarmIntegrationMiddleware<TSchema>[];
|
|
2416
|
-
providers?: readonly FarmIntegrationProvider[];
|
|
2417
|
-
documentNavigations?: readonly FarmIntegrationDocumentNavigation[];
|
|
2418
|
-
/** Additional Farm plugins owned and configured by this integration. */
|
|
2419
|
-
plugins?: readonly FarmIntegrationContributedPlugin<NoInfer<TInstance>>[];
|
|
2454
|
+
interface FarmLlmsTxtSection {
|
|
2455
|
+
title: string;
|
|
2456
|
+
links: FarmLlmsTxtLink[];
|
|
2420
2457
|
}
|
|
2421
|
-
|
|
2422
|
-
/**
|
|
2423
|
-
|
|
2424
|
-
/**
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
rawBody?: boolean;
|
|
2431
|
-
headers?: Record<string, string>;
|
|
2432
|
-
credentials?: RequestCredentials;
|
|
2433
|
-
bodyFormat?: FarmIntegrationAPIBodyFormat;
|
|
2434
|
-
responseFormat?: FarmIntegrationAPIResponseFormat;
|
|
2435
|
-
isServer?: TServer;
|
|
2436
|
-
body?: FarmIntegrationInputSchema<TBody>;
|
|
2437
|
-
query?: FarmIntegrationInputSchema<TQuery>;
|
|
2438
|
-
input?: FarmIntegrationRouteInputSchemas<TBody, TQuery>;
|
|
2439
|
-
handler(request: Request, context: FarmIntegrationHandlerContext<TBody, TQuery, TSchema>): Promise<Response> | Response;
|
|
2440
|
-
};
|
|
2441
|
-
interface FarmIntegrationRouteFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
2442
|
-
get<TPath extends string, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: Omit<IntegrationRouteBuilderOptions<never, TQuery, TServer, TSchema>, "bodyFormat">): FarmTypedIntegrationRoute<TPath, never, TQuery, TResponse, TServer, "GET", TSchema>;
|
|
2443
|
-
post<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "POST", TSchema>;
|
|
2444
|
-
query<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "QUERY", TSchema>;
|
|
2445
|
-
put<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "PUT", TSchema>;
|
|
2446
|
-
patch<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "PATCH", TSchema>;
|
|
2447
|
-
delete<TPath extends string, TBody = never, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: IntegrationRouteBuilderOptions<TBody, TQuery, TServer, TSchema>): FarmTypedIntegrationRoute<TPath, TBody, TQuery, TResponse, TServer, "DELETE", TSchema>;
|
|
2448
|
-
options<TPath extends string, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: Omit<IntegrationRouteBuilderOptions<never, TQuery, TServer, TSchema>, "bodyFormat">): FarmTypedIntegrationRoute<TPath, never, TQuery, TResponse, TServer, "OPTIONS", TSchema>;
|
|
2449
|
-
head<TPath extends string, TResponse = unknown, TQuery = never, TServer extends boolean = false>(path: TPath, input: Omit<IntegrationRouteBuilderOptions<never, TQuery, TServer, TSchema>, "bodyFormat">): FarmTypedIntegrationRoute<TPath, never, TQuery, TResponse, TServer, "HEAD", TSchema>;
|
|
2458
|
+
interface FarmLlmsTxt {
|
|
2459
|
+
/** Site or project name, rendered as the `# H1`. Required by the format. */
|
|
2460
|
+
title: string;
|
|
2461
|
+
/** One-sentence summary, rendered as a `> blockquote`. */
|
|
2462
|
+
summary?: string;
|
|
2463
|
+
/** Free-form Markdown placed after the summary. */
|
|
2464
|
+
details?: string;
|
|
2465
|
+
/** `## H2` sections of links. A section titled "Optional" marks skippable links. */
|
|
2466
|
+
sections?: FarmLlmsTxtSection[];
|
|
2450
2467
|
}
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2468
|
+
/** A static page of the app, ready to use as an llms.txt link. */
|
|
2469
|
+
interface FarmLlmsTxtPage extends FarmLlmsTxtLink {
|
|
2470
|
+
/** The page's route path, such as `/docs/install`. */
|
|
2471
|
+
path: string;
|
|
2454
2472
|
}
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2473
|
+
interface FarmLlmsTxtUserConfig {
|
|
2474
|
+
/** Set to `false` to turn llms.txt off while keeping these options. */
|
|
2475
|
+
enabled?: boolean;
|
|
2476
|
+
/** Site name for the `# H1`. Defaults to the root layout's metadata title. */
|
|
2477
|
+
title?: string;
|
|
2478
|
+
/** Summary for the `> blockquote`. Defaults to the root layout's metadata description. */
|
|
2479
|
+
summary?: string;
|
|
2480
|
+
/** Markdown placed after the summary. */
|
|
2481
|
+
details?: string;
|
|
2482
|
+
/**
|
|
2483
|
+
* Route patterns to list, using the same syntax as `md.expose`
|
|
2484
|
+
* (`/docs/[...slug]`). Defaults to every static page.
|
|
2485
|
+
*/
|
|
2486
|
+
include?: string[];
|
|
2487
|
+
/** Route patterns to leave out, such as `/admin/[...path]`. */
|
|
2488
|
+
exclude?: string[];
|
|
2489
|
+
/**
|
|
2490
|
+
* Also serve `/llms-full.txt`, the index with each page's Markdown mirror inlined.
|
|
2491
|
+
*
|
|
2492
|
+
* @default true
|
|
2493
|
+
*/
|
|
2494
|
+
full?: boolean;
|
|
2495
|
+
/**
|
|
2496
|
+
* Seconds a CDN may cache the generated files, and the production server may
|
|
2497
|
+
* reuse an llms-full.txt render, which renders every listed page. Defaults to
|
|
2498
|
+
* no caching; concurrent llms-full.txt requests still share one render.
|
|
2499
|
+
*/
|
|
2500
|
+
revalidate?: number;
|
|
2464
2501
|
}
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
}
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
type
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
}
|
|
2559
|
-
|
|
2560
|
-
|
|
2502
|
+
interface ResolvedFarmLlmsTxtConfig {
|
|
2503
|
+
enabled: boolean;
|
|
2504
|
+
title?: string;
|
|
2505
|
+
summary?: string;
|
|
2506
|
+
details?: string;
|
|
2507
|
+
include: string[];
|
|
2508
|
+
exclude: string[];
|
|
2509
|
+
full: boolean;
|
|
2510
|
+
revalidate?: number;
|
|
2511
|
+
}
|
|
2512
|
+
interface FarmLlmsTxtPageSource {
|
|
2513
|
+
pattern: string;
|
|
2514
|
+
metadata?: unknown;
|
|
2515
|
+
}
|
|
2516
|
+
declare function collectFarmLlmsTxtPages(sources: Iterable<FarmLlmsTxtPageSource>, options: {
|
|
2517
|
+
origin: string;
|
|
2518
|
+
basePath?: string;
|
|
2519
|
+
markdown?: FarmMarkdownResolvedConfig;
|
|
2520
|
+
include?: string[];
|
|
2521
|
+
exclude?: string[];
|
|
2522
|
+
}): FarmLlmsTxtPage[];
|
|
2523
|
+
declare function createFarmDefaultLlmsTxt(options: {
|
|
2524
|
+
origin: string;
|
|
2525
|
+
pages: FarmLlmsTxtPage[];
|
|
2526
|
+
config: ResolvedFarmLlmsTxtConfig;
|
|
2527
|
+
rootMetadata?: unknown;
|
|
2528
|
+
}): FarmLlmsTxt;
|
|
2529
|
+
/**
|
|
2530
|
+
* Reads a page's Markdown the way an agent would: a fresh `.md` request with no
|
|
2531
|
+
* cookies or credentials, so a page behind auth answers 401 and is left out of
|
|
2532
|
+
* a file that CDNs may cache, instead of leaking into it.
|
|
2533
|
+
*/
|
|
2534
|
+
declare function createFarmLlmsMarkdownReader(fetchMarkdown: (request: Request) => Promise<Response>): (url: string) => Promise<string | null>;
|
|
2535
|
+
/**
|
|
2536
|
+
* Renders llms-full.txt: the llms.txt header, then one block per linked page with
|
|
2537
|
+
* its Markdown inlined, in the layout the docs engine uses. A string passes
|
|
2538
|
+
* through unchanged. Only same-origin links are fetched.
|
|
2539
|
+
*/
|
|
2540
|
+
declare function renderFarmLlmsFullTxt(value: unknown, options: {
|
|
2541
|
+
origin: string;
|
|
2542
|
+
readMarkdown: (url: string) => Promise<string | null>;
|
|
2543
|
+
concurrency?: number;
|
|
2544
|
+
/** Milliseconds to wait for one page's Markdown before leaving it out. */
|
|
2545
|
+
pageTimeout?: number;
|
|
2546
|
+
/** Called when a page is left out because it did not answer in time. */
|
|
2547
|
+
onIncomplete?: () => void;
|
|
2548
|
+
}): Promise<string>;
|
|
2549
|
+
/**
|
|
2550
|
+
* Shares llms-full.txt renders, which read every listed page. Requests for the
|
|
2551
|
+
* same origin while a render runs, or within `revalidate` seconds after it, get
|
|
2552
|
+
* that result; renders run one at a time, so a burst of requests, even with
|
|
2553
|
+
* varied Host headers, cannot multiply page renders. The content is the same for
|
|
2554
|
+
* every caller: pages are read with fresh requests that carry no credentials.
|
|
2555
|
+
* A render that calls `incomplete()`, because a page timed out, is answered but
|
|
2556
|
+
* not reused, so the next request tries that page again.
|
|
2557
|
+
*/
|
|
2558
|
+
declare function createFarmLlmsFullRenderer(options?: {
|
|
2559
|
+
revalidate?: number;
|
|
2560
|
+
now?: () => number;
|
|
2561
|
+
maxEntries?: number;
|
|
2562
|
+
}): (origin: string, render: (shared: {
|
|
2563
|
+
incomplete: () => void;
|
|
2564
|
+
}) => Promise<string>, onSettled?: (complete: boolean) => void) => Promise<string>;
|
|
2565
|
+
|
|
2566
|
+
type ApplicationMetadataRouteKind = "sitemap" | "robots" | "manifest" | "llms" | "llms-full";
|
|
2567
|
+
declare namespace MetadataRoute {
|
|
2568
|
+
type SitemapChangeFrequency = "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never";
|
|
2569
|
+
interface SitemapEntry {
|
|
2570
|
+
url: string;
|
|
2571
|
+
lastModified?: string | Date;
|
|
2572
|
+
changeFrequency?: SitemapChangeFrequency;
|
|
2573
|
+
priority?: number;
|
|
2574
|
+
alternates?: {
|
|
2575
|
+
languages?: Record<string, string>;
|
|
2576
|
+
};
|
|
2577
|
+
}
|
|
2578
|
+
type Sitemap = SitemapEntry[];
|
|
2579
|
+
interface RobotsRule {
|
|
2580
|
+
userAgent: string | string[];
|
|
2581
|
+
allow?: string | string[];
|
|
2582
|
+
disallow?: string | string[];
|
|
2583
|
+
crawlDelay?: number;
|
|
2584
|
+
}
|
|
2585
|
+
interface Robots {
|
|
2586
|
+
rules: RobotsRule | RobotsRule[];
|
|
2587
|
+
sitemap?: string | string[];
|
|
2588
|
+
host?: string;
|
|
2589
|
+
}
|
|
2590
|
+
interface ManifestIcon {
|
|
2591
|
+
src: string;
|
|
2592
|
+
sizes?: string;
|
|
2593
|
+
type?: string;
|
|
2594
|
+
purpose?: string;
|
|
2595
|
+
}
|
|
2596
|
+
interface Manifest {
|
|
2597
|
+
name?: string;
|
|
2598
|
+
short_name?: string;
|
|
2599
|
+
description?: string;
|
|
2600
|
+
id?: string;
|
|
2601
|
+
start_url?: string;
|
|
2602
|
+
scope?: string;
|
|
2603
|
+
display?: "fullscreen" | "standalone" | "minimal-ui" | "browser" | string;
|
|
2604
|
+
orientation?: string;
|
|
2605
|
+
background_color?: string;
|
|
2606
|
+
theme_color?: string;
|
|
2607
|
+
lang?: string;
|
|
2608
|
+
dir?: "ltr" | "rtl" | "auto";
|
|
2609
|
+
categories?: string[];
|
|
2610
|
+
icons?: ManifestIcon[];
|
|
2611
|
+
[key: string]: unknown;
|
|
2612
|
+
}
|
|
2613
|
+
/**
|
|
2614
|
+
* The object an `llms.ts` metadata route returns, rendered as llms.txt. An
|
|
2615
|
+
* `llms.ts` can also return the complete file as a string, or a `Response`.
|
|
2616
|
+
*/
|
|
2617
|
+
type LlmsTxt = FarmLlmsTxt;
|
|
2618
|
+
type LlmsTxtSection = FarmLlmsTxtSection;
|
|
2619
|
+
type LlmsTxtLink = FarmLlmsTxtLink;
|
|
2620
|
+
/** A static page of the app, usable directly as an llms.txt link. */
|
|
2621
|
+
type LlmsTxtPage = FarmLlmsTxtPage;
|
|
2622
|
+
/** What an `llms.ts` default-export function receives. */
|
|
2623
|
+
interface LlmsTxtContext extends MetadataRouteContext {
|
|
2624
|
+
/** The app's static pages, linking to their Markdown mirrors when exposed. */
|
|
2625
|
+
pages: LlmsTxtPage[];
|
|
2626
|
+
/** The llms.txt that `agent.llmsTxt` would serve, to extend instead of replace. */
|
|
2627
|
+
defaults: LlmsTxt;
|
|
2628
|
+
}
|
|
2629
|
+
/**
|
|
2630
|
+
* What an `llms-full.ts` default-export function receives. Returning an
|
|
2631
|
+
* `LlmsTxt` object inlines each same-origin link's Markdown; returning a string
|
|
2632
|
+
* serves it as the complete file.
|
|
2633
|
+
*/
|
|
2634
|
+
interface LlmsFullTxtContext extends LlmsTxtContext {
|
|
2635
|
+
/** A page's Markdown mirror, read without the request's cookies; `null` if unavailable. */
|
|
2636
|
+
markdown(url: string): Promise<string | null>;
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
interface MetadataRouteContext {
|
|
2640
|
+
request: Request;
|
|
2641
|
+
params: Record<string, string>;
|
|
2642
|
+
searchParams: URLSearchParams;
|
|
2643
|
+
/** The concrete route-segment path that owns the metadata file. */
|
|
2644
|
+
path: string;
|
|
2645
|
+
}
|
|
2646
|
+
interface FarmMetadataRouteModule {
|
|
2647
|
+
revalidate?: number | false;
|
|
2648
|
+
}
|
|
2649
|
+
interface FarmMetadataRouteResponseOptions {
|
|
2561
2650
|
method?: string;
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
declare function dispatchIntegrationRequest(runtime: RegisteredIntegrationRuntime, request: Request, options?: {
|
|
2573
|
-
currentRequest?: Request;
|
|
2574
|
-
data?: FarmIntegrationData;
|
|
2575
|
-
internal?: boolean;
|
|
2651
|
+
/** The request being answered, so llms.txt reads can be reported as agent traffic. */
|
|
2652
|
+
request?: Request;
|
|
2653
|
+
}
|
|
2654
|
+
/** @internal */
|
|
2655
|
+
declare function createFarmMetadataRouteResponse(kind: ApplicationMetadataRouteKind, value: unknown, routeModule?: FarmMetadataRouteModule, options?: FarmMetadataRouteResponseOptions): Response;
|
|
2656
|
+
|
|
2657
|
+
type FarmCrawlerPolicy = "allow" | "block";
|
|
2658
|
+
interface FarmAgentCrawlers {
|
|
2659
|
+
/** Set to `false` to stop serving the generated robots.txt while keeping these options. */
|
|
2660
|
+
enabled?: boolean;
|
|
2576
2661
|
/**
|
|
2577
|
-
*
|
|
2578
|
-
*
|
|
2579
|
-
* ends without a Response of its own. The request continues downstream, so
|
|
2580
|
-
* the caller owns merging them onto whatever response it finally produces.
|
|
2581
|
-
* Only called on the `null` return path: a Response returned from here has
|
|
2582
|
-
* already had the forwarded cookies appended.
|
|
2662
|
+
* AI search and user-triggered agents such as OAI-SearchBot, Claude-SearchBot,
|
|
2663
|
+
* and PerplexityBot. Left unset, they follow the `User-agent: *` rules.
|
|
2583
2664
|
*/
|
|
2584
|
-
|
|
2585
|
-
|
|
2665
|
+
search?: FarmCrawlerPolicy;
|
|
2666
|
+
/**
|
|
2667
|
+
* AI training crawlers such as GPTBot, ClaudeBot, Google-Extended, and CCBot.
|
|
2668
|
+
* Left unset, they follow the `User-agent: *` rules.
|
|
2669
|
+
*/
|
|
2670
|
+
training?: FarmCrawlerPolicy;
|
|
2671
|
+
/**
|
|
2672
|
+
* More robots.txt groups, written after the generated ones. Crawlers combine
|
|
2673
|
+
* groups that name the same agent. A rule for `*` replaces the default
|
|
2674
|
+
* `User-agent: *` / `Allow: /` group.
|
|
2675
|
+
*/
|
|
2676
|
+
rules?: MetadataRoute.RobotsRule[];
|
|
2677
|
+
/**
|
|
2678
|
+
* Absolute sitemap URLs. Defaults to the app's `sitemap.ts` route, resolved
|
|
2679
|
+
* against the root layout's `metadataBase`; with neither, no `Sitemap:` line.
|
|
2680
|
+
*/
|
|
2681
|
+
sitemap?: string | string[];
|
|
2682
|
+
}
|
|
2683
|
+
interface ResolvedFarmAgentCrawlers {
|
|
2684
|
+
enabled: boolean;
|
|
2685
|
+
search?: FarmCrawlerPolicy;
|
|
2686
|
+
training?: FarmCrawlerPolicy;
|
|
2687
|
+
rules: MetadataRoute.RobotsRule[];
|
|
2688
|
+
sitemap?: string[];
|
|
2689
|
+
}
|
|
2690
|
+
interface FarmAgentRobotsOptions {
|
|
2691
|
+
crawlers: ResolvedFarmAgentCrawlers;
|
|
2692
|
+
/** The app's root sitemap route, such as `/sitemap.xml`, when it has one. */
|
|
2693
|
+
sitemapPath?: string;
|
|
2694
|
+
/** The root layout's `metadataBase`, which makes the sitemap URL absolute. */
|
|
2695
|
+
metadataBase?: unknown;
|
|
2696
|
+
basePath?: string;
|
|
2697
|
+
}
|
|
2698
|
+
/** The robots.txt `agent.crawlers` serves. */
|
|
2699
|
+
declare function createFarmAgentRobots(options: FarmAgentRobotsOptions): MetadataRoute.Robots;
|
|
2700
|
+
|
|
2586
2701
|
/**
|
|
2587
|
-
*
|
|
2588
|
-
*
|
|
2589
|
-
*
|
|
2590
|
-
*
|
|
2591
|
-
* ordinary page and API requests that match no integration route at all. That
|
|
2592
|
-
* makes this, not `matchIntegrationRoute`, the correct entry point for a
|
|
2593
|
-
* runtime dispatching integrations for every request.
|
|
2594
|
-
*
|
|
2595
|
-
* The first integration that produces a Response short-circuits the rest.
|
|
2596
|
-
* `Set-Cookie` values forwarded by middleware that returned `void` are
|
|
2597
|
-
* collected: they ride the short-circuiting Response when there is one, and are
|
|
2598
|
-
* otherwise handed back so the caller can merge them onto the downstream
|
|
2599
|
-
* response.
|
|
2702
|
+
* Agent-readiness configuration: opt-in primitives that make a Farm site easier
|
|
2703
|
+
* for AI agents and crawlers to discover, resolve, and use. Off by default so
|
|
2704
|
+
* sites that do not want agent exposure (internal tools, private dashboards) are
|
|
2705
|
+
* unaffected.
|
|
2600
2706
|
*/
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2707
|
+
|
|
2708
|
+
/** schema.org JSON-LD emitted in the document head to identify the site. */
|
|
2709
|
+
interface FarmAgentJsonLd {
|
|
2710
|
+
/**
|
|
2711
|
+
* schema.org `@type`. Common values: `"Organization"` for a company or
|
|
2712
|
+
* project, `"SoftwareApplication"` for a product, `"WebSite"`, `"Person"`.
|
|
2713
|
+
*
|
|
2714
|
+
* @default "Organization"
|
|
2715
|
+
*/
|
|
2716
|
+
type?: string;
|
|
2717
|
+
/** Entity name. Defaults to the site's Open Graph site name or page title. */
|
|
2718
|
+
name?: string;
|
|
2719
|
+
/** Canonical URL for the entity. Defaults to the configured `metadataBase`. */
|
|
2720
|
+
url?: string;
|
|
2721
|
+
/** Short description. Defaults to the page/site metadata description. */
|
|
2722
|
+
description?: string;
|
|
2723
|
+
/** Logo URL. */
|
|
2724
|
+
logo?: string;
|
|
2725
|
+
/** URLs that also represent this entity (social profiles, repos) — schema.org `sameAs`. */
|
|
2726
|
+
sameAs?: string[];
|
|
2727
|
+
/** Additional schema.org properties merged into the emitted object. */
|
|
2728
|
+
properties?: Record<string, unknown>;
|
|
2729
|
+
}
|
|
2730
|
+
interface FarmAgentUserConfig {
|
|
2731
|
+
/**
|
|
2732
|
+
* Emit schema.org JSON-LD in the document head so agents and crawlers can
|
|
2733
|
+
* resolve the site's identity. `true` emits an `Organization` built from the
|
|
2734
|
+
* site's metadata; an object customizes the type and fields.
|
|
2735
|
+
*
|
|
2736
|
+
* @default false
|
|
2737
|
+
*/
|
|
2738
|
+
jsonLd?: boolean | FarmAgentJsonLd;
|
|
2739
|
+
/**
|
|
2740
|
+
* On a preview deployment, send `X-Robots-Tag: noindex, nofollow` with every
|
|
2741
|
+
* response from Farm's server. Previews are detected from `FARM_PREVIEW`,
|
|
2742
|
+
* `VERCEL_ENV=preview`, Netlify's deploy-preview and branch-deploy contexts,
|
|
2743
|
+
* and Render pull request previews. Production is unaffected.
|
|
2744
|
+
*
|
|
2745
|
+
* @default false
|
|
2746
|
+
*/
|
|
2747
|
+
noindexPreviews?: boolean;
|
|
2748
|
+
/**
|
|
2749
|
+
* Serve `/llms.txt` (https://llmstxt.org): a Markdown index of the app's static
|
|
2750
|
+
* pages, linking to their Markdown mirrors. `true` builds it from page metadata;
|
|
2751
|
+
* an object sets the title, summary, details, and which routes to list. A
|
|
2752
|
+
* `src/app/llms.ts` metadata route replaces the generated file.
|
|
2753
|
+
*
|
|
2754
|
+
* @default false
|
|
2755
|
+
*/
|
|
2756
|
+
llmsTxt?: boolean | FarmLlmsTxtUserConfig;
|
|
2757
|
+
/**
|
|
2758
|
+
* Serve a generated `/robots.txt` that allows or blocks AI search agents
|
|
2759
|
+
* (`search`) and AI training crawlers (`training`), plus your own `rules`.
|
|
2760
|
+
* `true` serves only `User-agent: *` / `Allow: /` and the sitemap. A
|
|
2761
|
+
* `public/robots.txt` or `src/app/robots.ts` replaces the generated file.
|
|
2762
|
+
*
|
|
2763
|
+
* @default false
|
|
2764
|
+
*/
|
|
2765
|
+
crawlers?: boolean | FarmAgentCrawlers;
|
|
2766
|
+
/**
|
|
2767
|
+
* Serve `/.well-known/api-catalog` (RFC 9727): a Linkset listing the app's
|
|
2768
|
+
* OpenAPI description and reference (when `openapi` is enabled) and its MCP
|
|
2769
|
+
* endpoint (when the top-level `mcp` is enabled), so agents can find them
|
|
2770
|
+
* from the origin alone.
|
|
2771
|
+
*
|
|
2772
|
+
* @default false
|
|
2773
|
+
*/
|
|
2774
|
+
apiCatalog?: boolean;
|
|
2775
|
+
}
|
|
2776
|
+
interface ResolvedFarmAgentConfig {
|
|
2777
|
+
jsonLd: FarmAgentJsonLd | false;
|
|
2778
|
+
noindexPreviews: boolean;
|
|
2779
|
+
llmsTxt: ResolvedFarmLlmsTxtConfig;
|
|
2780
|
+
crawlers: ResolvedFarmAgentCrawlers;
|
|
2781
|
+
apiCatalog: boolean;
|
|
2782
|
+
}
|
|
2607
2783
|
|
|
2608
2784
|
declare global {
|
|
2609
2785
|
namespace FarmJS {
|
|
@@ -3260,4 +3436,4 @@ interface MetadataRobots extends MetadataRobotsDirectives {
|
|
|
3260
3436
|
googleBot?: string | MetadataRobotsDirectives;
|
|
3261
3437
|
}
|
|
3262
3438
|
|
|
3263
|
-
export { type LayoutMetadataProps as $, type FarmAgentJsonLd as A, type FarmContextFactory as B, type MiddlewareProps as C, type BundleResultPayload as D, type FarmIntegration as E, type FarmRouteRuntimeConfig as F, type FarmConfig as G, farmPlugin as H, defineConfig as I, type FarmComponentType as J, type AppRoutePattern as K, type LayoutProps as L, type Metadata as M, type PageRouteParams as N, type NitroPreset as O, type ParsedRoute as P, type FarmMigrationCommand as Q, type RouteSegment as R, type FarmMigrationsConfig as S, type FarmMigrationsUserConfig as T, type ResolvedFarmMigrationsConfig as U, type FarmContextFactoryInput as V, type FarmIsolatedClientHydrationMode as W, type LoadingProps as X, type ErrorProps as Y, type PagePropsWithMiddleware as Z, type MetadataProps as _, type FarmPlugin as a, definePlugin as a$, type Page as a0, type Layout as a1, type Loading as a2, type ErrorBoundary as a3, type StaticPathPrimitive as a4, type StaticPathParams as a5, type StaticRouteParams as a6, type GenerateStaticParams as a7, type LayoutModule as a8, type MetadataJsonLd as a9, type ResolvedFarmDevIndicatorsConfig as aA, type ResolvedFarmAuthConfig as aB, type ResolvedFarmPerformanceConfig as aC, type ResolvedFarmSecurityConfig as aD, type APIRequestRuntime as aE, createFarmMetadataRouteResponse as aF, createFarmAgentRobots as aG, collectFarmLlmsTxtPages as aH, createFarmDefaultLlmsTxt as aI, createFarmLlmsMarkdownReader as aJ, renderFarmLlmsFullTxt as aK, createFarmLlmsFullRenderer as aL, manageFarmDocumentPreloads as aM, manageFarmHtmlPreloads as aN, manageFarmLinkHeaderPreloads as aO, reportFarmPreloadWarnings as aP, applyFarmCspNonceToResponse as aQ, resolveFarmSecurityConfig as aR, type ResolvedSchemaField as aS, type FarmSqlDialect as aT, type FarmSqlStatement as aU, type CollectedSchemaModel as aV, type FarmSchemaMigrationStep as aW, type OpenAPIConfig as aX, type FarmAgentUserConfig as aY, type FarmAgentCrawlers as aZ, type FarmCrawlerPolicy as a_, type ServerAction as aa, type BuildOptions as ab, type SSGPage as ac, type SSGCollectionResult as ad, type MetadataRobotsDirectives as ae, type MetadataRobots as af, type FarmLayerEntry as ag, type ResolvedFarmLayer as ah, type FarmSourceRoot as ai, type ResolveFarmLayersOptions as aj, type FarmLayerResolution as ak, resolveFarmLayers as al, getFarmSourceRoots as am, getFarmAppDirectories as an, getFarmLayerAliases as ao, createFarmConfigResolutionPlugin as ap, loadFarmConfigFile as aq, type ReadonlyMiddlewareStore as ar, type FarmMiddlewareConfig as as, type MiddlewareModule as at, type MiddlewareConfig$1 as au, type MiddlewareContext as av, type ResolvedFarmRouteRuntimeConfig as aw, type ApplicationMetadataRouteKind as ax, type ResolvedFarmAPIConfig as ay, type ResolvedFarmDevtoolsConfig as az, isFarmRedirectError as b, type FarmPluginStateContext as b$, FarmRuntimeShutdownError as b0, PluginManager as b1, type FarmPluginDatabase as b2, type FarmPluginDefinition as b3, FarmPluginOptionsError as b4, type FarmPluginFactory as b5, type FarmPluginOptionsIssue as b6, type FarmPluginOptionsSchema as b7, type InferPluginOptionsInput as b8, type InferPluginOptionsOutput as b9, type FarmMCPAuthorization as bA, type FarmMCPEndpoint as bB, type FarmMCPServerFunction as bC, type FarmMCPToolDefinition as bD, type FarmMCPStandaloneTool as bE, type FarmMCPExecuteContext as bF, type FarmMCPTool as bG, type FarmMCPServer as bH, type FarmMCPAuthorizeContext as bI, type FarmMCPConfig as bJ, type FarmMCPOAuthConfig as bK, type FarmMCPPrompt as bL, type FarmMCPPromptMessage as bM, type FarmMCPResource as bN, type FarmMCPResourceContent as bO, type FarmMCPResourceContext as bP, type FarmMCPResourceListing as bQ, type FarmMCPUserConfig as bR, type ResolvedFarmMCPConfig as bS, type PluginRequestContext as bT, type FarmPluginIntegrationContext as bU, type FarmPluginLifecycle as bV, type FarmRequestPluginContext as bW, type FarmRequestStore as bX, type FarmPluginRuntimeKind as bY, type FarmPluginRouteRuntimePayload as bZ, type FarmPluginSetupContext as b_, resolveConfig as ba, loadConfig as bb, resolveDeployConfig as bc, resolveMigrationsConfig as bd, resolveDeployOutputPath as be, normalizeDeployTarget as bf, getDeployTargetForPreset as bg, getPresetForDeployTarget as bh, type FarmLayerConfig as bi, type FarmPerformanceConfig as bj, type FarmPreloadMode as bk, type FarmPreloadUserConfig as bl, type ResolvedFarmPreloadConfig as bm, type FarmCspConfig as bn, type FarmCspDirectives as bo, type FarmCspDirectiveValue as bp, type FarmCspOptions as bq, type FarmSecurityConfig as br, type ResolvedFarmCspConfig as bs, MetadataRoute as bt, type MetadataRouteContext as bu, type FarmAuthConfig as bv, type FarmAuthDatabaseConfig as bw, type FarmAuthEmailAndPasswordConfig as bx, type FarmAuthSessionConfig as by, type FarmAuthUserConfig as bz, type FarmRedirectSignal as c, type FarmIntegrationRouteInput as c$, type FarmPluginRuntimeBaseEvent as c0, type FarmPluginRuntimeContextEvent as c1, type FarmPluginRuntimeEndpoint as c2, type FarmPluginRuntimeEndpointEvent as c3, type FarmPluginRuntimeBeforeEvent as c4, type FarmPluginRuntimeAfterEvent as c5, type FarmPluginRuntimeErrorEvent as c6, type FarmPluginRuntimeStartEvent as c7, type FarmPluginRuntimeCloseEvent as c8, type FarmPluginRuntimeHooks as c9, type ImageConfig as cA, type I18nConfig as cB, type MiddlewareConfig as cC, type FarmDeployConfig as cD, type ResolvedFarmDeployConfig as cE, type FarmDeployTarget as cF, describeSchemaReference as cG, collectSchemaModels as cH, generateSqlStatements as cI, renderSqlSchemaFile as cJ, getSqlColumnType as cK, getSqlDefaultExpression as cL, isNullableField as cM, quoteSqlIdentifier as cN, toSnakeCase as cO, toPascalCase as cP, toCamelCase as cQ, escapeSqlString as cR, resolveSchemaModels as cS, type ResolvedSchemaModel as cT, type FarmIntegrationCategory as cU, type FarmIntegrationSlot as cV, type FarmIntegrationRouteParamValue as cW, type FarmIntegrationRouteParams as cX, type FarmIntegrationRouteMethod as cY, type FarmIntegrationRouteInputSource as cZ, type FarmIntegrationValidationPathSegment as c_, type FarmPluginRuntimeRequestOptions as ca, type FarmPluginRuntimeRequestHandler as cb, type FarmPluginRuntimeSession as cc, type FarmPluginDiscoveredRoute as cd, type FarmPluginRouterHooks as ce, type FarmPluginRenderHooks as cf, type FarmPluginBuildHooks as cg, type FarmPluginDevHooks as ch, type FarmPluginClientConfig as ci, type RouteDiscoveredPayload as cj, type RoutesGeneratedPayload as ck, type MiddlewareDiscoveredPayload as cl, type APIRouteDiscoveredPayload as cm, type RouteMatchPayload as cn, type RouteMatchResultPayload as co, type RenderLifecyclePayload as cp, type APIHandlerLifecyclePayload as cq, type ErrorLifecyclePayload as cr, type HMRUpdatePayload as cs, type BundleLifecyclePayload as ct, type NitroBuildLifecyclePayload as cu, type ShutdownPayload as cv, type ResolvedFarmConfig as cw, type RedirectConfig as cx, type HeaderConfig as cy, type RewriteConfig as cz, type FarmRedirectStatus as d, getIntegrationProviders as d$, type FarmIntegrationValidationIssue as d0, type FarmIntegrationValidationErrorLike as d1, type FarmIntegrationValidationResult as d2, type FarmIntegrationStandardValidationResult as d3, type FarmIntegrationInputSchema as d4, type FarmIntegrationRouteInputSchemas as d5, type FarmIntegrationRequestContextStore as d6, FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY as d7, FARM_INTEGRATION_SET_COOKIES_KEY as d8, forwardIntegrationSetCookies as d9, type FarmIntegrationSchemaConstraint as dA, type FarmIntegrationSchemaModel as dB, type FarmIntegrationSchemaModelExtension as dC, type FarmIntegrationSchemaModelOverride as dD, type FarmIntegrationSchema as dE, defineIntegrationSchema as dF, type FarmIntegrationLogPhase as dG, type FarmIntegrationLogEvent as dH, type FarmIntegrationLogger as dI, type FarmIntegrationPluginOwner as dJ, type FarmIntegrationContributedPlugin as dK, type FarmIntegrationsUserConfig as dL, getFarmIntegrationPluginServerRuntime as dM, getFarmIntegrationPluginOwner as dN, type FarmIntegrationRouteFactory as dO, type FarmIntegrationRoutesFactoryContext as dP, type FarmIntegrationRoutesFactory as dQ, type FarmIntegrationEndpointValue as dR, type FarmIntegrationEndpoints as dS, type FarmIntegrationEndpointsFactoryContext as dT, type FarmIntegrationEndpointsFactory as dU, createIntegrationRoute as dV, integrationRoute as dW, type DefinedIntegration as dX, defineIntegration as dY, isFarmIntegration as dZ, resolveIntegrationPlugins as d_, type FarmIntegrationRouteDb as da, type FarmIntegrationRouteStorageArgs as db, type FarmIntegrationRouteArgs as dc, type FarmIntegrationConfigContext as dd, type FarmIntegrationConfigDefinition as de, type FarmIntegrationConfigInput as df, type FarmIntegrationLifecycleLogLevel as dg, type FarmIntegrationLifecycleLogger as dh, type FarmIntegrationLifecycleContext as di, type FarmIntegrationLifecycleHook as dj, type FarmIntegrationData as dk, type FarmIntegrationHandlerContext as dl, type FarmIntegrationRouteHookContext as dm, type FarmIntegrationRouteHook as dn, type FarmIntegrationRoute as dp, type FarmTypedIntegrationRoute as dq, type FarmIntegrationRouteMiddleware as dr, type FarmIntegrationMiddleware as ds, type FarmIntegrationProviderProps as dt, type FarmIntegrationProviderComponentReference as du, type FarmIntegrationProvider as dv, type FarmIntegrationDocumentNavigation as dw, type FarmIntegrationSchemaFieldType as dx, type FarmIntegrationSchemaReference as dy, type FarmIntegrationSchemaField as dz, type FarmRequest as e, type FarmRouteRuntimeManifest as e$, isFarmIntegrationProviderComponentReference as e0, getIntegrationDocumentNavigationMatchers as e1, getIntegrationSchemas as e2, getRegisteredIntegrationRuntime as e3, getRegisteredIntegrations as e4, getRegisteredIntegrationSchemas as e5, matchIntegrationRoute as e6, matchRegisteredIntegrationRoute as e7, getRegisteredIntegrationAPIManifest as e8, dispatchIntegrationRequest as e9, resolveFarmAPIRequestURL as eA, type MiddlewareFunction as eB, type RequestMiddleware as eC, type RequestMiddlewareContext as eD, type MiddlewareStore as eE, type MiddlewareChain as eF, type CookieJar as eG, type CookieOptions as eH, type RateLimitConfig as eI, type RateLimitIncrementResult as eJ, type RateLimitStorage as eK, type RateLimitStatus as eL, type MemoryRateLimitStorageOptions as eM, type NextFunction as eN, type MiddlewareResult as eO, type FarmRouteRuleRenderMode as eP, type FarmRouteRuleRedirect as eQ, type FarmRouteRuleCors as eR, type FarmRouteRule as eS, type FarmRouteRules as eT, normalizeRouteRules as eU, routeRulesToRedirects as eV, routeRulesToHeaders as eW, routeRulesToNitroRouteRules as eX, type FarmRouteRuntimeEntryKind as eY, type FarmRouteRenderingMode as eZ, type FarmRouteRuntimeManifestEntry as e_, dispatchIntegrationRequests as ea, describeIntegrationOriginRejection as eb, resolveIntegrationAllowedOrigins as ec, validateIntegrationRequestOrigin as ed, type IntegrationOriginPolicy as ee, type IntegrationOriginRejection as ef, type IntegrationOriginResult as eg, type FarmIntegrationOrmSchema as eh, type FarmIntegrationOrmClient as ei, type InferFarmIntegrationOrmField as ej, type InferFarmIntegrationOrmFields as ek, type InferFarmIntegrationOrmSchema as el, type InferFarmIntegrationOrmClient as em, type CreateIntegrationOrmOptions as en, createIntegrationOrm as eo, resolveIntegrationOrmRuntimeClient as ep, farmIntegrationSchemaToOrmSchema as eq, type IntegrationOrmModelNames as er, DEFAULT_FARM_API_BASE_PATH as es, type FarmAPIConfigResolverContext as et, type FarmAPIConfigValue as eu, type FarmAPIConfig as ev, resolveFarmAPIConfig as ew, normalizeFarmAPIConfig as ex, normalizeFarmAPIBasePath as ey, getFarmAPIBaseURL as ez, type FarmResponse as f, normalizeFarmRouteRuntimeConfig as f0, mergeFarmRouteRuntimeConfigs as f1, resolveFarmRouteRuntimeConfig as f2, hasFarmRouteRuntimeControls as f3, getFarmRouteRuntimeConfig as f4, createFarmRouteRuntimeKey as f5, resolveFarmRouteRuleRuntimeConfig as f6, farmRouteRuleMatches as f7, DEFAULT_FARM_DEVTOOLS_SHORTCUT as f8, FARM_DEVTOOLS_PATH as f9, FARM_DEVTOOLS_LAUNCH_PARAM as fa, type FarmDevtoolsConfig as fb, type FarmDevtoolsUserConfig as fc, resolveFarmDevtoolsConfig as fd, type FarmBuildActivityPosition as fe, type FarmDevIndicatorsConfig as ff, resolveFarmDevIndicatorsConfig as fg, generateFarmDevIndicatorsClientRuntime as fh, farmI18nClientBridgePlugin as fi, farmServerOnlyEntriesPlugin as fj, withFarmRequestTracing as fk, rewriteEarlySsrRelativeImports as fl, transformIsolatedClientBoundaryModule as fm, shouldEmitFarmClientRootHmr as fn, generateClientCachePersistenceCode as fo, resolveFarmClientCacheAdapterEntry as fp, type ClientCachePersistenceEntryCode as fq, FARM_NODE_RESPONSE_END_PENDING as fr, loadFarmDevModule as fs, FarmDevEnvironmentError as ft, type FarmDevModuleServer as fu, getFarmRedirectError as g, type FarmPluginContext as h, isFarmNotFoundError as i, type FarmRouteRuntime as j, type FarmRouteRegions as k, type FarmRouteMaxDuration as l, type FarmAppContext as m, notFound as n, type PageProps as o, permanentRedirect as p, type PluginContextProps as q, redirect as r, type RouteModule as s, type FarmMdxComponents as t, type FarmMdxResolvedConfig as u, resolveFarmMdxComponentsModulePath as v, resolveMdxConfig as w, type FarmMdxComponent as x, type FarmMdxUserConfig as y, type FarmUserConfig as z };
|
|
3439
|
+
export { type ErrorProps as $, createFarmMarkdownErrorBody as A, farmRequestWantsMarkdown as B, type FarmUserConfig as C, type FarmAgentJsonLd as D, type FarmContextFactory as E, type FarmRouteRuntimeConfig as F, type MiddlewareProps as G, type BundleResultPayload as H, type FarmIntegration as I, type FarmConfig as J, farmPlugin as K, type LayoutProps as L, type Metadata as M, defineConfig as N, type FarmComponentType as O, type ParsedRoute as P, type AppRoutePattern as Q, type RouteSegment as R, type PageRouteParams as S, type NitroPreset as T, type FarmMigrationCommand as U, type FarmMigrationsConfig as V, type FarmMigrationsUserConfig as W, type ResolvedFarmMigrationsConfig as X, type FarmContextFactoryInput as Y, type FarmIsolatedClientHydrationMode as Z, type LoadingProps as _, type FarmPlugin as a, type CollectedSchemaModel as a$, type PagePropsWithMiddleware as a0, type MetadataProps as a1, type LayoutMetadataProps as a2, type Page as a3, type Layout as a4, type Loading as a5, type ErrorBoundary as a6, type StaticPathPrimitive as a7, type StaticPathParams as a8, type StaticRouteParams as a9, _publishFarmMCPCatalog as aA, type ResolvedFarmRouteRuntimeConfig as aB, type ApplicationMetadataRouteKind as aC, type ResolvedFarmAPIConfig as aD, type FarmMarkdownResolvedConfig as aE, type ResolvedFarmDevtoolsConfig as aF, type ResolvedFarmDevIndicatorsConfig as aG, type ResolvedFarmAuthConfig as aH, type ResolvedFarmPerformanceConfig as aI, type ResolvedFarmSecurityConfig as aJ, type APIRequestRuntime as aK, createFarmMetadataRouteResponse as aL, createFarmAgentRobots as aM, collectFarmLlmsTxtPages as aN, createFarmDefaultLlmsTxt as aO, createFarmLlmsMarkdownReader as aP, renderFarmLlmsFullTxt as aQ, createFarmLlmsFullRenderer as aR, manageFarmDocumentPreloads as aS, manageFarmHtmlPreloads as aT, manageFarmLinkHeaderPreloads as aU, reportFarmPreloadWarnings as aV, applyFarmCspNonceToResponse as aW, resolveFarmSecurityConfig as aX, type ResolvedSchemaField as aY, type FarmSqlDialect as aZ, type FarmSqlStatement as a_, type GenerateStaticParams as aa, type LayoutModule as ab, type MetadataJsonLd as ac, type ServerAction as ad, type BuildOptions as ae, type SSGPage as af, type SSGCollectionResult as ag, type MetadataRobotsDirectives as ah, type MetadataRobots as ai, type FarmLayerEntry as aj, type ResolvedFarmLayer as ak, type FarmSourceRoot as al, type ResolveFarmLayersOptions as am, type FarmLayerResolution as an, resolveFarmLayers as ao, getFarmSourceRoots as ap, getFarmAppDirectories as aq, getFarmLayerAliases as ar, createFarmConfigResolutionPlugin as as, loadFarmConfigFile as at, type ReadonlyMiddlewareStore as au, type FarmMiddlewareConfig as av, type MiddlewareModule as aw, type MiddlewareConfig$1 as ax, type MiddlewareContext as ay, _findFarmMCPEndpointTool as az, isFarmRedirectError as b, type FarmPluginIntegrationContext as b$, type FarmSchemaMigrationStep as b0, type OpenAPIConfig as b1, type FarmAgentUserConfig as b2, type FarmAgentCrawlers as b3, type FarmCrawlerPolicy as b4, definePlugin as b5, FarmRuntimeShutdownError as b6, PluginManager as b7, type FarmPluginDatabase as b8, type FarmPluginDefinition as b9, type MetadataRouteContext as bA, type FarmMCPEndpointTool as bB, type FarmAuthConfig as bC, type FarmAuthDatabaseConfig as bD, type FarmAuthEmailAndPasswordConfig as bE, type FarmAuthSessionConfig as bF, type FarmAuthUserConfig as bG, type FarmMCPAuthorization as bH, type FarmMCPEndpoint as bI, type FarmMCPServerFunction as bJ, type FarmMCPToolDefinition as bK, type FarmMCPStandaloneTool as bL, type FarmMCPExecuteContext as bM, type FarmMCPTool as bN, type FarmMCPServer as bO, type FarmMCPAuthorizeContext as bP, type FarmMCPConfig as bQ, type FarmMCPOAuthConfig as bR, type FarmMCPPrompt as bS, type FarmMCPPromptMessage as bT, type FarmMCPResource as bU, type FarmMCPResourceContent as bV, type FarmMCPResourceContext as bW, type FarmMCPResourceListing as bX, type FarmMCPUserConfig as bY, type ResolvedFarmMCPConfig as bZ, type PluginRequestContext as b_, FarmPluginOptionsError as ba, type FarmPluginFactory as bb, type FarmPluginOptionsIssue as bc, type FarmPluginOptionsSchema as bd, type InferPluginOptionsInput as be, type InferPluginOptionsOutput as bf, resolveConfig as bg, loadConfig as bh, resolveDeployConfig as bi, resolveMigrationsConfig as bj, resolveDeployOutputPath as bk, normalizeDeployTarget as bl, getDeployTargetForPreset as bm, getPresetForDeployTarget as bn, type FarmLayerConfig as bo, type FarmPerformanceConfig as bp, type FarmPreloadMode as bq, type FarmPreloadUserConfig as br, type ResolvedFarmPreloadConfig as bs, type FarmCspConfig as bt, type FarmCspDirectives as bu, type FarmCspDirectiveValue as bv, type FarmCspOptions as bw, type FarmSecurityConfig as bx, type ResolvedFarmCspConfig as by, MetadataRoute as bz, type FarmRedirectSignal as c, type ResolvedSchemaModel as c$, type FarmPluginLifecycle as c0, type FarmRequestPluginContext as c1, type FarmRequestStore as c2, type FarmPluginRuntimeKind as c3, type FarmPluginRouteRuntimePayload as c4, type FarmPluginSetupContext as c5, type FarmPluginStateContext as c6, type FarmPluginRuntimeBaseEvent as c7, type FarmPluginRuntimeContextEvent as c8, type FarmPluginRuntimeEndpoint as c9, type BundleLifecyclePayload as cA, type NitroBuildLifecyclePayload as cB, type ShutdownPayload as cC, type ResolvedFarmConfig as cD, type RedirectConfig as cE, type HeaderConfig as cF, type RewriteConfig as cG, type ImageConfig as cH, type I18nConfig as cI, type MiddlewareConfig as cJ, type FarmDeployConfig as cK, type ResolvedFarmDeployConfig as cL, type FarmDeployTarget as cM, type FarmMarkdownUserConfig as cN, describeSchemaReference as cO, collectSchemaModels as cP, generateSqlStatements as cQ, renderSqlSchemaFile as cR, getSqlColumnType as cS, getSqlDefaultExpression as cT, isNullableField as cU, quoteSqlIdentifier as cV, toSnakeCase as cW, toPascalCase as cX, toCamelCase as cY, escapeSqlString as cZ, resolveSchemaModels as c_, type FarmPluginRuntimeEndpointEvent as ca, type FarmPluginRuntimeBeforeEvent as cb, type FarmPluginRuntimeAfterEvent as cc, type FarmPluginRuntimeErrorEvent as cd, type FarmPluginRuntimeStartEvent as ce, type FarmPluginRuntimeCloseEvent as cf, type FarmPluginRuntimeHooks as cg, type FarmPluginRuntimeRequestOptions as ch, type FarmPluginRuntimeRequestHandler as ci, type FarmPluginRuntimeSession as cj, type FarmPluginDiscoveredRoute as ck, type FarmPluginRouterHooks as cl, type FarmPluginRenderHooks as cm, type FarmPluginBuildHooks as cn, type FarmPluginDevHooks as co, type FarmPluginClientConfig as cp, type RouteDiscoveredPayload as cq, type RoutesGeneratedPayload as cr, type MiddlewareDiscoveredPayload as cs, type APIRouteDiscoveredPayload as ct, type RouteMatchPayload as cu, type RouteMatchResultPayload as cv, type RenderLifecyclePayload as cw, type APIHandlerLifecyclePayload as cx, type ErrorLifecyclePayload as cy, type HMRUpdatePayload as cz, type FarmRedirectStatus as d, type FarmIntegrationEndpointsFactoryContext as d$, type FarmIntegrationCategory as d0, type FarmIntegrationSlot as d1, type FarmIntegrationRouteParamValue as d2, type FarmIntegrationRouteParams as d3, type FarmIntegrationRouteMethod as d4, type FarmIntegrationRouteInputSource as d5, type FarmIntegrationValidationPathSegment as d6, type FarmIntegrationRouteInput as d7, type FarmIntegrationValidationIssue as d8, type FarmIntegrationValidationErrorLike as d9, type FarmIntegrationMiddleware as dA, type FarmIntegrationProviderProps as dB, type FarmIntegrationProviderComponentReference as dC, type FarmIntegrationProvider as dD, type FarmIntegrationDocumentNavigation as dE, type FarmIntegrationSchemaFieldType as dF, type FarmIntegrationSchemaReference as dG, type FarmIntegrationSchemaField as dH, type FarmIntegrationSchemaConstraint as dI, type FarmIntegrationSchemaModel as dJ, type FarmIntegrationSchemaModelExtension as dK, type FarmIntegrationSchemaModelOverride as dL, type FarmIntegrationSchema as dM, defineIntegrationSchema as dN, type FarmIntegrationLogPhase as dO, type FarmIntegrationLogEvent as dP, type FarmIntegrationLogger as dQ, type FarmIntegrationPluginOwner as dR, type FarmIntegrationContributedPlugin as dS, type FarmIntegrationsUserConfig as dT, getFarmIntegrationPluginServerRuntime as dU, getFarmIntegrationPluginOwner as dV, type FarmIntegrationRouteFactory as dW, type FarmIntegrationRoutesFactoryContext as dX, type FarmIntegrationRoutesFactory as dY, type FarmIntegrationEndpointValue as dZ, type FarmIntegrationEndpoints as d_, type FarmIntegrationValidationResult as da, type FarmIntegrationStandardValidationResult as db, type FarmIntegrationInputSchema as dc, type FarmIntegrationRouteInputSchemas as dd, type FarmIntegrationRequestContextStore as de, FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY as df, FARM_INTEGRATION_SET_COOKIES_KEY as dg, forwardIntegrationSetCookies as dh, type FarmIntegrationRouteDb as di, type FarmIntegrationRouteStorageArgs as dj, type FarmIntegrationRouteArgs as dk, type FarmIntegrationConfigContext as dl, type FarmIntegrationConfigDefinition as dm, type FarmIntegrationConfigInput as dn, type FarmIntegrationLifecycleLogLevel as dp, type FarmIntegrationLifecycleLogger as dq, type FarmIntegrationLifecycleContext as dr, type FarmIntegrationLifecycleHook as ds, type FarmIntegrationData as dt, type FarmIntegrationHandlerContext as du, type FarmIntegrationRouteHookContext as dv, type FarmIntegrationRouteHook as dw, type FarmIntegrationRoute as dx, type FarmTypedIntegrationRoute as dy, type FarmIntegrationRouteMiddleware as dz, type FarmRequest as e, type FarmRouteRules as e$, type FarmIntegrationEndpointsFactory as e0, createIntegrationRoute as e1, integrationRoute as e2, type DefinedIntegration as e3, defineIntegration as e4, isFarmIntegration as e5, resolveIntegrationPlugins as e6, getIntegrationProviders as e7, isFarmIntegrationProviderComponentReference as e8, getIntegrationDocumentNavigationMatchers as e9, DEFAULT_FARM_API_BASE_PATH as eA, type FarmAPIConfigResolverContext as eB, type FarmAPIConfigValue as eC, type FarmAPIConfig as eD, resolveFarmAPIConfig as eE, normalizeFarmAPIConfig as eF, normalizeFarmAPIBasePath as eG, getFarmAPIBaseURL as eH, resolveFarmAPIRequestURL as eI, type MiddlewareFunction as eJ, type RequestMiddleware as eK, type RequestMiddlewareContext as eL, type MiddlewareStore as eM, type MiddlewareChain as eN, type CookieJar as eO, type CookieOptions as eP, type RateLimitConfig as eQ, type RateLimitIncrementResult as eR, type RateLimitStorage as eS, type RateLimitStatus as eT, type MemoryRateLimitStorageOptions as eU, type NextFunction as eV, type MiddlewareResult as eW, type FarmRouteRuleRenderMode as eX, type FarmRouteRuleRedirect as eY, type FarmRouteRuleCors as eZ, type FarmRouteRule as e_, getIntegrationSchemas as ea, getRegisteredIntegrationRuntime as eb, getRegisteredIntegrations as ec, getRegisteredIntegrationSchemas as ed, matchIntegrationRoute as ee, matchRegisteredIntegrationRoute as ef, getRegisteredIntegrationAPIManifest as eg, dispatchIntegrationRequest as eh, dispatchIntegrationRequests as ei, describeIntegrationOriginRejection as ej, resolveIntegrationAllowedOrigins as ek, validateIntegrationRequestOrigin as el, type IntegrationOriginPolicy as em, type IntegrationOriginRejection as en, type IntegrationOriginResult as eo, type FarmIntegrationOrmSchema as ep, type FarmIntegrationOrmClient as eq, type InferFarmIntegrationOrmField as er, type InferFarmIntegrationOrmFields as es, type InferFarmIntegrationOrmSchema as et, type InferFarmIntegrationOrmClient as eu, type CreateIntegrationOrmOptions as ev, createIntegrationOrm as ew, resolveIntegrationOrmRuntimeClient as ex, farmIntegrationSchemaToOrmSchema as ey, type IntegrationOrmModelNames as ez, type FarmResponse as f, normalizeRouteRules as f0, routeRulesToRedirects as f1, routeRulesToHeaders as f2, routeRulesToNitroRouteRules as f3, type FarmRouteRuntimeEntryKind as f4, type FarmRouteRenderingMode as f5, type FarmRouteRuntimeManifestEntry as f6, type FarmRouteRuntimeManifest as f7, normalizeFarmRouteRuntimeConfig as f8, mergeFarmRouteRuntimeConfigs as f9, type FarmPageFormAction as fA, extractFarmPageActions as fB, DEFAULT_FARM_DEVTOOLS_SHORTCUT as fC, FARM_DEVTOOLS_PATH as fD, FARM_DEVTOOLS_LAUNCH_PARAM as fE, type FarmDevtoolsConfig as fF, type FarmDevtoolsUserConfig as fG, resolveFarmDevtoolsConfig as fH, type FarmBuildActivityPosition as fI, type FarmDevIndicatorsConfig as fJ, resolveFarmDevIndicatorsConfig as fK, generateFarmDevIndicatorsClientRuntime as fL, farmI18nClientBridgePlugin as fM, farmServerOnlyEntriesPlugin as fN, withFarmRequestTracing as fO, rewriteEarlySsrRelativeImports as fP, transformIsolatedClientBoundaryModule as fQ, shouldEmitFarmClientRootHmr as fR, generateClientCachePersistenceCode as fS, resolveFarmClientCacheAdapterEntry as fT, type ClientCachePersistenceEntryCode as fU, FARM_NODE_RESPONSE_END_PENDING as fV, loadFarmDevModule as fW, FarmDevEnvironmentError as fX, type FarmDevModuleServer as fY, resolveFarmRouteRuntimeConfig as fa, hasFarmRouteRuntimeControls as fb, getFarmRouteRuntimeConfig as fc, createFarmRouteRuntimeKey as fd, resolveFarmRouteRuleRuntimeConfig as fe, farmRouteRuleMatches as ff, type FarmMarkdownRouteInput as fg, type FarmMarkdownResolvedRoute as fh, type FarmMarkdownMirrorTarget as fi, type ResolveMarkdownMirrorTargetOptions as fj, type CreateMarkdownMirrorResponseOptions as fk, type ApplyMarkdownNegotiationHeadersOptions as fl, resolveMarkdownConfig as fm, resolveMarkdownMirrorTarget as fn, createMarkdownMirrorResponse as fo, applyMarkdownNegotiationHeaders as fp, htmlToMarkdown as fq, farmAcceptQuality as fr, requestAcceptsMarkdown as fs, getFarmMarkdownMirrorPath as ft, getFarmMarkdownAlternatePath as fu, isFarmMarkdownMirrorExposed as fv, matchesFarmMarkdownRoutePattern as fw, type FarmPageFormOption as fx, type FarmPageFormField as fy, type FarmPageFormSubmit as fz, getFarmRedirectError as g, type FarmPluginContext as h, isFarmNotFoundError as i, type FarmRouteRuntime as j, type FarmRouteRegions as k, type FarmRouteMaxDuration as l, type FarmAppContext as m, notFound as n, type PageProps as o, permanentRedirect as p, type PluginContextProps as q, redirect as r, type RouteModule as s, type FarmMdxComponents as t, type FarmMdxResolvedConfig as u, resolveFarmMdxComponentsModulePath as v, resolveMdxConfig as w, type FarmMdxComponent as x, type FarmMdxUserConfig as y, FARM_MARKDOWN_CONTENT_TYPE as z };
|