@farm.js/core 0.1.0-beta.21 → 0.1.0-beta.23
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/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/agent-runtime.d.mts +97 -0
- package/dist/agent-runtime.d.ts +97 -0
- package/dist/api/route-manager.d.mts +68 -0
- package/dist/api/route-manager.d.ts +68 -0
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api.cjs +22 -19
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.mts +50 -0
- package/dist/api.d.ts +50 -0
- package/dist/api.mjs +2 -1
- package/dist/app-CTFnOJaI.d.ts +308 -0
- package/dist/app-DA6ospIq.d.mts +308 -0
- package/dist/app-markdown.d.mts +25 -0
- package/dist/app-markdown.d.ts +25 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/{chunk-MIUW47JX.mjs → chunk-2PEJGY5V.mjs} +15 -20
- package/dist/chunk-2PEJGY5V.mjs.map +1 -0
- package/dist/{chunk-RIXKJPGI.mjs → chunk-42325TLU.mjs} +2 -2
- package/dist/chunk-4IVNW5QD.mjs +82 -0
- package/dist/chunk-4IVNW5QD.mjs.map +1 -0
- package/dist/{chunk-I3UWA2P2.mjs → chunk-5NOVWCFL.mjs} +2 -2
- package/dist/chunk-5NOVWCFL.mjs.map +1 -0
- package/dist/chunk-D42BNPZH.mjs +79 -0
- package/dist/chunk-D42BNPZH.mjs.map +1 -0
- package/dist/{chunk-LLPN5SEZ.mjs → chunk-DVPRBMU2.mjs} +2 -2
- package/dist/{chunk-VIC7NJ77.mjs → chunk-FJGTYLCO.mjs} +67 -20
- package/dist/chunk-FJGTYLCO.mjs.map +1 -0
- package/dist/chunk-GIELMNBG.mjs +15 -0
- package/dist/chunk-GIELMNBG.mjs.map +1 -0
- package/dist/chunk-GQVQESLY.mjs +25 -0
- package/dist/chunk-GQVQESLY.mjs.map +1 -0
- package/dist/chunk-H53KVQUU.mjs +48 -0
- package/dist/chunk-H53KVQUU.mjs.map +1 -0
- package/dist/chunk-HCGQYYHI.mjs +1 -0
- package/dist/chunk-HCGQYYHI.mjs.map +1 -0
- package/dist/{chunk-4EATUJFO.mjs → chunk-ICTGDDV4.mjs} +20 -22
- package/dist/chunk-ICTGDDV4.mjs.map +1 -0
- package/dist/{chunk-UCYWGN2P.mjs → chunk-OHNSROHS.mjs} +1 -1
- package/dist/{chunk-FRPWCMMG.mjs → chunk-SBWOTAX4.mjs} +63 -2
- package/dist/chunk-SBWOTAX4.mjs.map +1 -0
- package/dist/{chunk-FKKM7HVF.mjs → chunk-TX54PXAJ.mjs} +109 -58
- package/dist/chunk-TX54PXAJ.mjs.map +1 -0
- package/dist/{chunk-CEVMYGDL.mjs → chunk-YD5IRKVS.mjs} +13 -9
- package/dist/chunk-YD5IRKVS.mjs.map +1 -0
- package/dist/chunk-recovery-lnQFzcQP.d.mts +26 -0
- package/dist/chunk-recovery-lnQFzcQP.d.ts +26 -0
- package/dist/client-BT1mFQas.d.mts +447 -0
- package/dist/client-Nn0q4eO4.d.ts +447 -0
- package/dist/client-cache-CIlyBlmx.d.ts +6 -0
- package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
- package/dist/client-plugins-CCilIb_G.d.mts +2092 -0
- package/dist/client-plugins-DuuleQKk.d.ts +2092 -0
- package/dist/client-plugins.d.mts +25 -0
- package/dist/client-plugins.d.ts +25 -0
- package/dist/client.cjs +122 -35
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.mts +454 -0
- package/dist/client.d.ts +454 -0
- package/dist/client.mjs +13 -2
- package/dist/config.d.mts +32 -0
- package/dist/config.d.ts +32 -0
- package/dist/cron.d.mts +78 -0
- package/dist/cron.d.ts +78 -0
- package/dist/deferred.d.mts +42 -0
- package/dist/deferred.d.ts +42 -0
- package/dist/deployment.d.mts +36 -0
- package/dist/deployment.d.ts +36 -0
- package/dist/{devtools-52FYXIEK.mjs → devtools-326RBQCN.mjs} +7 -6
- package/dist/{devtools-52FYXIEK.mjs.map → devtools-326RBQCN.mjs.map} +1 -1
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.mts +80 -0
- package/dist/docs.d.ts +80 -0
- package/dist/docs.mjs +6 -5
- package/dist/env-types.d.mts +12 -0
- package/dist/env-types.d.ts +12 -0
- package/dist/env.d.mts +45 -0
- package/dist/env.d.ts +45 -0
- package/dist/environment/vite.d.mts +22 -0
- package/dist/environment/vite.d.ts +22 -0
- package/dist/environment.d.mts +18 -0
- package/dist/environment.d.ts +18 -0
- package/dist/font.d.mts +95 -0
- package/dist/font.d.ts +95 -0
- package/dist/headers.d.mts +22 -0
- package/dist/headers.d.ts +22 -0
- package/dist/i18n/client.d.mts +32 -0
- package/dist/i18n/client.d.ts +32 -0
- package/dist/i18n/index.d.mts +20 -0
- package/dist/i18n/index.d.ts +20 -0
- package/dist/i18n/server.d.mts +30 -0
- package/dist/i18n/server.d.ts +30 -0
- package/dist/image/server.d.mts +37 -0
- package/dist/image/server.d.ts +37 -0
- package/dist/image/sharp.d.mts +7 -0
- package/dist/image/sharp.d.ts +7 -0
- package/dist/image-config-Duob7wER.d.mts +50 -0
- package/dist/image-config-Duob7wER.d.ts +50 -0
- package/dist/image.d.mts +39 -0
- package/dist/image.d.ts +39 -0
- package/dist/index.cjs +496 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +480 -0
- package/dist/index.d.ts +480 -0
- package/dist/index.mjs +70 -52
- package/dist/index.mjs.map +1 -1
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integrations.d.mts +25 -0
- package/dist/integrations.d.ts +25 -0
- package/dist/internal/build-runtime.cjs +386 -83
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +42 -0
- package/dist/internal/build-runtime.d.ts +42 -0
- package/dist/internal/build-runtime.mjs +17 -13
- package/dist/internal/client-runtime.d.mts +17 -0
- package/dist/internal/client-runtime.d.ts +17 -0
- package/dist/internal/config-runtime.cjs +41 -0
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +42 -0
- package/dist/internal/config-runtime.d.ts +42 -0
- package/dist/internal/config-runtime.mjs +5 -4
- package/dist/internal/metadata-image-runtime.d.mts +25 -0
- package/dist/internal/metadata-image-runtime.d.ts +25 -0
- package/dist/internal/production-node-env.d.mts +12 -0
- package/dist/internal/production-node-env.d.ts +12 -0
- package/dist/internal/production-runtime.cjs +178 -0
- package/dist/internal/production-runtime.cjs.map +1 -1
- package/dist/internal/production-runtime.d.mts +80 -0
- package/dist/internal/production-runtime.d.ts +80 -0
- package/dist/internal/production-runtime.mjs +13 -1
- package/dist/internal/production-runtime.mjs.map +1 -1
- package/dist/island-CfGru1MO.d.mts +9 -0
- package/dist/island-CfGru1MO.d.ts +9 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/metadata-DyPRG0wX.d.ts +22 -0
- package/dist/metadata-_GHcAySx.d.mts +22 -0
- package/dist/middleware.cjs +17 -17
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.mts +172 -0
- package/dist/middleware.d.ts +172 -0
- package/dist/middleware.mjs +3 -2
- package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
- package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
- package/dist/navigation.d.mts +14 -0
- package/dist/navigation.d.ts +14 -0
- package/dist/observability.d.mts +335 -0
- package/dist/observability.d.ts +335 -0
- package/dist/params-BALtrRim.d.ts +15 -0
- package/dist/params-ry-lxqmy.d.mts +15 -0
- package/dist/plugin-BJDf43dc.d.mts +165 -0
- package/dist/plugin-BJDf43dc.d.ts +165 -0
- package/dist/plugin.cjs +261 -62
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +25 -0
- package/dist/plugin.d.ts +25 -0
- package/dist/plugin.mjs +13 -9
- package/dist/production-runtime-C4cO3esK.d.mts +81 -0
- package/dist/production-runtime-DrEy8kBO.d.ts +81 -0
- package/dist/query/client.d.mts +61 -0
- package/dist/query/client.d.ts +61 -0
- package/dist/query/index.d.mts +90 -0
- package/dist/query/index.d.ts +90 -0
- package/dist/query/parsers.d.mts +25 -0
- package/dist/query/parsers.d.ts +25 -0
- package/dist/query/server.d.mts +55 -0
- package/dist/query/server.d.ts +55 -0
- package/dist/request-B2PpOxYK.d.mts +6 -0
- package/dist/request-D40lt6aN.d.ts +6 -0
- package/dist/request.d.mts +26 -0
- package/dist/request.d.ts +26 -0
- package/dist/resolver-DJqjLMg_.d.mts +14 -0
- package/dist/resolver-IH4RmPEl.d.ts +14 -0
- package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
- package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
- package/dist/router.d.mts +36 -0
- package/dist/router.d.ts +36 -0
- package/dist/routes.d.mts +227 -0
- package/dist/routes.d.ts +227 -0
- package/dist/runtime-Bpp-c28k.d.ts +231 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-Q3u74Nbq.d.mts +231 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.d.mts +45 -0
- package/dist/server-action-security.d.ts +45 -0
- package/dist/server-fn-client.d.mts +33 -0
- package/dist/server-fn-client.d.ts +33 -0
- package/dist/server-fn-error-DDh14a0V.d.mts +26 -0
- package/dist/server-fn-error-DDh14a0V.d.ts +26 -0
- package/dist/server-fn.d.mts +121 -0
- package/dist/server-fn.d.ts +121 -0
- package/dist/server-plugins.d.mts +58 -0
- package/dist/server-plugins.d.ts +58 -0
- package/dist/server-query-client.d.mts +51 -0
- package/dist/server-query-client.d.ts +51 -0
- package/dist/server-query.d.mts +37 -0
- package/dist/server-query.d.ts +37 -0
- package/dist/server.cjs +285 -85
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +53 -0
- package/dist/server.d.ts +53 -0
- package/dist/server.mjs +26 -31
- package/dist/server.mjs.map +1 -1
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.d.mts +104 -0
- package/dist/testing.d.ts +104 -0
- package/dist/theme/client.cjs +115 -0
- package/dist/theme/client.cjs.map +1 -0
- package/dist/theme/client.d.mts +17 -0
- package/dist/theme/client.d.ts +17 -0
- package/dist/theme/client.mjs +16 -0
- package/dist/theme/client.mjs.map +1 -0
- package/dist/theme/index.cjs +71 -0
- package/dist/theme/index.cjs.map +1 -0
- package/dist/theme/index.d.mts +6 -0
- package/dist/theme/index.d.ts +6 -0
- package/dist/theme/index.mjs +9 -0
- package/dist/theme/index.mjs.map +1 -0
- package/dist/theme/server.cjs +191 -0
- package/dist/theme/server.cjs.map +1 -0
- package/dist/theme/server.d.mts +8 -0
- package/dist/theme/server.d.ts +8 -0
- package/dist/theme/server.mjs +18 -0
- package/dist/theme/server.mjs.map +1 -0
- package/dist/transport-BmbGTXA5.d.mts +49 -0
- package/dist/transport-BmbGTXA5.d.ts +49 -0
- package/dist/types-BMxWr97v.d.mts +81 -0
- package/dist/types-BMxWr97v.d.ts +81 -0
- package/dist/types-CsR8fpgF.d.mts +30 -0
- package/dist/types-CsR8fpgF.d.ts +30 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/types-DTzm4TCl.d.mts +78 -0
- package/dist/types-DTzm4TCl.d.ts +78 -0
- package/dist/utils-3sQgfkya.d.ts +23 -0
- package/dist/utils-Bop7bly-.d.mts +23 -0
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.mts +3 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.mjs +1 -1
- package/dist/vite.cjs +285 -64
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +25 -0
- package/dist/vite.d.ts +25 -0
- package/dist/vite.mjs +13 -9
- package/dist/workflows-CusFV6mn.d.mts +153 -0
- package/dist/workflows-CusFV6mn.d.ts +153 -0
- package/dist/workflows.d.mts +1 -0
- package/dist/workflows.d.ts +1 -0
- package/package.json +25 -1
- package/dist/chunk-4EATUJFO.mjs.map +0 -1
- package/dist/chunk-CEVMYGDL.mjs.map +0 -1
- package/dist/chunk-FKKM7HVF.mjs.map +0 -1
- package/dist/chunk-FRPWCMMG.mjs.map +0 -1
- package/dist/chunk-I3UWA2P2.mjs.map +0 -1
- package/dist/chunk-MIUW47JX.mjs.map +0 -1
- package/dist/chunk-VIC7NJ77.mjs.map +0 -1
- /package/dist/{chunk-RIXKJPGI.mjs.map → chunk-42325TLU.mjs.map} +0 -0
- /package/dist/{chunk-LLPN5SEZ.mjs.map → chunk-DVPRBMU2.mjs.map} +0 -0
- /package/dist/{chunk-UCYWGN2P.mjs.map → chunk-OHNSROHS.mjs.map} +0 -0
|
@@ -0,0 +1,2092 @@
|
|
|
1
|
+
import { n as FarmClientPlugin } from './plugin-BJDf43dc.mjs';
|
|
2
|
+
import React__default, { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
|
+
import { k as FarmStorageUserConfig } from './types-D1A6-XvH.mjs';
|
|
5
|
+
import { F as FarmIntegrationAPI, f as FarmIntegrationAPIMethod, e as FarmIntegrationAPIBodyFormat, a as FarmIntegrationAPIOperation, g as FarmIntegrationAPIResponseFormat, h as FarmIntegrationRouteOperationCarrier, I as InferIntegrationAPIFromRoutes } from './integration-api-CHT2OKAf.mjs';
|
|
6
|
+
import { OrmClient, SchemaDefinition, ModelDefinition, FieldBuilder, JsonValue, AnyModelDefinition, SchemaModels } from '@farming-labs/orm';
|
|
7
|
+
import { a as FarmDocsUserConfig, F as FarmDocsResolvedConfig } from './types-DTzm4TCl.mjs';
|
|
8
|
+
import { FarmMarkdownUserConfig, FarmMarkdownResolvedConfig } from './markdown.mjs';
|
|
9
|
+
import { FarmObservabilityUserConfig } from './observability.mjs';
|
|
10
|
+
import * as vite from 'vite';
|
|
11
|
+
import { ViteDevServer, UserConfig, Plugin } from 'vite';
|
|
12
|
+
import { g as FarmWorkflowsUserConfig, a as FarmServerConfig, F as FarmWorkflowsResolvedConfig, R as ResolvedFarmServerConfig } from './workflows-CusFV6mn.mjs';
|
|
13
|
+
import { FarmCronUserConfig, FarmCronResolvedConfig } from './cron.mjs';
|
|
14
|
+
import { FarmEnvConfig, ResolvedFarmEnv } from './env.mjs';
|
|
15
|
+
import { FarmServerActionsConfig, ResolvedFarmServerActionsConfig } from './server-action-security.mjs';
|
|
16
|
+
import { F as FarmImageConfig, R as ResolvedFarmImageConfig } from './image-config-Duob7wER.mjs';
|
|
17
|
+
import { k as FarmI18nUserConfig, R as ResolvedFarmI18nConfig } from './types-BMxWr97v.mjs';
|
|
18
|
+
import { FarmCacheUserConfig } from './cache.mjs';
|
|
19
|
+
import { R as ResolvedFarmThemeConfig, d as FarmThemeConfig } from './types-CsR8fpgF.mjs';
|
|
20
|
+
import { F as FarmRouteRuntimeConfig, a as FarmRouteRuntime, b as FarmRouteRegions, c as FarmRouteMaxDuration } from './route-runtime-DoOHzCAD.mjs';
|
|
21
|
+
import { FarmLayoutFonts } from './font.mjs';
|
|
22
|
+
|
|
23
|
+
type RuntimeClientFactory<TClient> = () => TClient | Promise<TClient>;
|
|
24
|
+
type FarmIntegrationOrmSchema = SchemaDefinition<Record<string, AnyModelDefinition>>;
|
|
25
|
+
type FarmIntegrationOrmClient<TSchema extends FarmIntegrationOrmSchema> = OrmClient<TSchema>;
|
|
26
|
+
type FarmIntegrationOrmFieldKind<TField extends FarmIntegrationSchemaField> = TField["type"] extends "id" | "uuid" ? "id" : TField["type"] extends "text" ? "string" : TField["type"] extends "number" ? "decimal" : Extract<TField["type"], "string" | "boolean" | "integer" | "datetime" | "json" | "enum">;
|
|
27
|
+
type FarmIntegrationOrmFieldNullable<TField extends FarmIntegrationSchemaField> = TField extends {
|
|
28
|
+
nullable: true;
|
|
29
|
+
} ? true : TField extends {
|
|
30
|
+
required: false;
|
|
31
|
+
} ? true : false;
|
|
32
|
+
type FarmIntegrationOrmEnumValue<TField extends FarmIntegrationSchemaField> = TField extends {
|
|
33
|
+
values: readonly (infer TValue extends string)[];
|
|
34
|
+
} ? TValue : string;
|
|
35
|
+
type FarmIntegrationOrmFieldValue<TField extends FarmIntegrationSchemaField> = TField["type"] extends "id" | "uuid" | "string" | "text" ? string : TField["type"] extends "boolean" ? boolean : TField["type"] extends "integer" ? number : TField["type"] extends "number" ? string : TField["type"] extends "datetime" ? Date : TField["type"] extends "json" ? JsonValue : TField["type"] extends "enum" ? FarmIntegrationOrmEnumValue<TField> : never;
|
|
36
|
+
type InferFarmIntegrationOrmField<TField extends FarmIntegrationSchemaField> = FieldBuilder<FarmIntegrationOrmFieldKind<TField>, FarmIntegrationOrmFieldNullable<TField>, FarmIntegrationOrmFieldValue<TField>>;
|
|
37
|
+
type InferFarmIntegrationOrmFields<TModel extends FarmIntegrationSchemaModel> = {
|
|
38
|
+
[TFieldKey in keyof TModel["fields"] & string]: InferFarmIntegrationOrmField<Extract<TModel["fields"][TFieldKey], FarmIntegrationSchemaField>>;
|
|
39
|
+
};
|
|
40
|
+
type InferFarmIntegrationOrmSchema<TSchema extends FarmIntegrationSchema> = SchemaDefinition<{
|
|
41
|
+
[TModelKey in keyof TSchema["models"] & string]: ModelDefinition<InferFarmIntegrationOrmFields<Extract<TSchema["models"][TModelKey], FarmIntegrationSchemaModel>>, {}>;
|
|
42
|
+
}>;
|
|
43
|
+
type InferFarmIntegrationOrmClient<TSchema extends FarmIntegrationSchema | undefined> = TSchema extends FarmIntegrationSchema ? OrmClient<InferFarmIntegrationOrmSchema<TSchema>> : never;
|
|
44
|
+
interface CreateIntegrationOrmOptions<TClient = unknown, TSchema extends FarmIntegrationSchema = FarmIntegrationSchema> {
|
|
45
|
+
schema: TSchema;
|
|
46
|
+
config?: Pick<FarmConfig, "storage">;
|
|
47
|
+
storage?: FarmStorageUserConfig;
|
|
48
|
+
client?: TClient | RuntimeClientFactory<TClient>;
|
|
49
|
+
}
|
|
50
|
+
declare function createIntegrationOrm<TClient = unknown, TSchema extends FarmIntegrationSchema = FarmIntegrationSchema>(options: CreateIntegrationOrmOptions<TClient, TSchema>): Promise<InferFarmIntegrationOrmClient<TSchema>>;
|
|
51
|
+
declare function resolveIntegrationOrmRuntimeClient<TClient = unknown>(options: Omit<CreateIntegrationOrmOptions<TClient>, "schema">): Promise<TClient | unknown | undefined>;
|
|
52
|
+
declare function farmIntegrationSchemaToOrmSchema(schema: FarmIntegrationSchema): Promise<FarmIntegrationOrmSchema>;
|
|
53
|
+
type IntegrationOrmModelNames<TSchema extends FarmIntegrationOrmSchema> = keyof SchemaModels<TSchema> & string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Farm.js Middleware System
|
|
57
|
+
*
|
|
58
|
+
* Type definitions for the middleware system
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Next function type for middleware chain
|
|
63
|
+
*/
|
|
64
|
+
type MiddlewareResult = void | Response;
|
|
65
|
+
type NextFunction = () => Promise<MiddlewareResult>;
|
|
66
|
+
type MiddlewareStoreKey<TValues extends Record<string, any>> = Extract<keyof TValues, string>;
|
|
67
|
+
/**
|
|
68
|
+
* A typed view over the request-scoped maps used by middleware.
|
|
69
|
+
*/
|
|
70
|
+
interface ReadonlyMiddlewareStore<TValues extends Record<string, any> = Record<string, any>> {
|
|
71
|
+
readonly size: number;
|
|
72
|
+
get<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): TValues[TKey] | undefined;
|
|
73
|
+
has<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): boolean;
|
|
74
|
+
entries(): IterableIterator<[MiddlewareStoreKey<TValues>, TValues[MiddlewareStoreKey<TValues>]]>;
|
|
75
|
+
keys(): IterableIterator<MiddlewareStoreKey<TValues>>;
|
|
76
|
+
values(): IterableIterator<TValues[MiddlewareStoreKey<TValues>]>;
|
|
77
|
+
forEach(callback: (value: TValues[MiddlewareStoreKey<TValues>], key: MiddlewareStoreKey<TValues>, store: ReadonlyMiddlewareStore<TValues>) => void, thisArg?: any): void;
|
|
78
|
+
[Symbol.iterator](): IterableIterator<[
|
|
79
|
+
MiddlewareStoreKey<TValues>,
|
|
80
|
+
TValues[MiddlewareStoreKey<TValues>]
|
|
81
|
+
]>;
|
|
82
|
+
}
|
|
83
|
+
interface MiddlewareStore<TValues extends Record<string, any> = Record<string, any>> extends ReadonlyMiddlewareStore<TValues> {
|
|
84
|
+
clear(): void;
|
|
85
|
+
delete<TKey extends MiddlewareStoreKey<TValues>>(key: TKey): boolean;
|
|
86
|
+
set<TKey extends MiddlewareStoreKey<TValues>>(key: TKey, value: TValues[TKey]): this;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Middleware function signature
|
|
90
|
+
*/
|
|
91
|
+
type MiddlewareFunction = (ctx: MiddlewareContext, next: NextFunction) => MiddlewareResult | Promise<MiddlewareResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Context passed to a named, request-first middleware export.
|
|
94
|
+
* `locals` and the get/set helpers stay on the server. `data` can be exposed
|
|
95
|
+
* through page props and should contain only serializable, client-safe values.
|
|
96
|
+
*/
|
|
97
|
+
interface RequestMiddlewareContext<TLocals extends Record<string, any> = Record<string, any>, TData extends Record<string, any> = Record<string, any>> {
|
|
98
|
+
readonly url: URL;
|
|
99
|
+
readonly pathname: string;
|
|
100
|
+
readonly searchParams: URLSearchParams;
|
|
101
|
+
readonly method: string;
|
|
102
|
+
readonly params: Record<string, string>;
|
|
103
|
+
readonly route: string;
|
|
104
|
+
readonly locals: MiddlewareStore<TLocals>;
|
|
105
|
+
readonly data: MiddlewareStore<TData>;
|
|
106
|
+
readonly headers: Map<string, string>;
|
|
107
|
+
readonly cookies: CookieJar;
|
|
108
|
+
get<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): TLocals[TKey] | undefined;
|
|
109
|
+
has<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): boolean;
|
|
110
|
+
set<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey, value: TLocals[TKey]): void;
|
|
111
|
+
delete<TKey extends MiddlewareStoreKey<TLocals>>(key: TKey): boolean;
|
|
112
|
+
redirect(url: string, status?: number): void;
|
|
113
|
+
rewrite(url: string): void;
|
|
114
|
+
json(data: any, status?: number): void;
|
|
115
|
+
text(content: string, status?: number): void;
|
|
116
|
+
html(content: string, status?: number): void;
|
|
117
|
+
}
|
|
118
|
+
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>;
|
|
119
|
+
/**
|
|
120
|
+
* Cookie options
|
|
121
|
+
*/
|
|
122
|
+
interface CookieOptions {
|
|
123
|
+
maxAge?: number;
|
|
124
|
+
expires?: Date;
|
|
125
|
+
path?: string;
|
|
126
|
+
domain?: string;
|
|
127
|
+
secure?: boolean;
|
|
128
|
+
httpOnly?: boolean;
|
|
129
|
+
sameSite?: "strict" | "lax" | "none";
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Cookie management interface
|
|
133
|
+
*/
|
|
134
|
+
interface CookieJar {
|
|
135
|
+
get(name: string): string | undefined;
|
|
136
|
+
set(name: string, value: string, options?: CookieOptions): void;
|
|
137
|
+
delete(name: string): void;
|
|
138
|
+
getAll(): Record<string, string>;
|
|
139
|
+
}
|
|
140
|
+
interface RateLimitIncrementResult {
|
|
141
|
+
count: number;
|
|
142
|
+
/** Unix epoch timestamp in milliseconds when the fixed window resets. */
|
|
143
|
+
resetAt: number;
|
|
144
|
+
}
|
|
145
|
+
interface RateLimitStorage {
|
|
146
|
+
/** Atomically increment a key and create or retain its fixed expiry window. */
|
|
147
|
+
increment(key: string, windowMs: number): Promise<RateLimitIncrementResult> | RateLimitIncrementResult;
|
|
148
|
+
/** Optional inspection support used by getRateLimitStatus(). */
|
|
149
|
+
get?(key: string): Promise<RateLimitIncrementResult | null> | RateLimitIncrementResult | null;
|
|
150
|
+
}
|
|
151
|
+
interface MemoryRateLimitStorageOptions {
|
|
152
|
+
/** Maximum number of active keys retained by this process. */
|
|
153
|
+
maxEntries?: number;
|
|
154
|
+
}
|
|
155
|
+
interface RateLimitConfig {
|
|
156
|
+
requests: number;
|
|
157
|
+
window: string;
|
|
158
|
+
keyGenerator?: (ctx: MiddlewareContext) => string;
|
|
159
|
+
onLimit?: (ctx: MiddlewareContext) => void | Response | Promise<void | Response>;
|
|
160
|
+
storage?: RateLimitStorage;
|
|
161
|
+
}
|
|
162
|
+
interface RateLimitStatus {
|
|
163
|
+
requests: number;
|
|
164
|
+
limit: number;
|
|
165
|
+
remaining: number;
|
|
166
|
+
resetIn: number | null;
|
|
167
|
+
resetAt: Date | null;
|
|
168
|
+
isLimited: boolean;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Middleware configuration
|
|
172
|
+
*/
|
|
173
|
+
type MiddlewareMatcher = string | RegExp | ((ctx: MiddlewareContext) => boolean);
|
|
174
|
+
interface MiddlewareConfig$1 {
|
|
175
|
+
matcher?: MiddlewareMatcher | MiddlewareMatcher[];
|
|
176
|
+
exclude?: (string | RegExp)[];
|
|
177
|
+
runtime?: "nodejs" | "edge";
|
|
178
|
+
}
|
|
179
|
+
interface MiddlewareConfigEntry extends MiddlewareConfig$1 {
|
|
180
|
+
handler?: MiddlewareFunction;
|
|
181
|
+
handlers?: MiddlewareFunction[];
|
|
182
|
+
}
|
|
183
|
+
type FarmMiddlewareConfig = MiddlewareConfig$1 | MiddlewareConfigEntry | MiddlewareConfigEntry[];
|
|
184
|
+
/**
|
|
185
|
+
* Middleware context - the main object passed to middleware functions
|
|
186
|
+
*/
|
|
187
|
+
interface MiddlewareContext {
|
|
188
|
+
request: IncomingMessage;
|
|
189
|
+
response: ServerResponse;
|
|
190
|
+
url: URL;
|
|
191
|
+
pathname: string;
|
|
192
|
+
searchParams: URLSearchParams;
|
|
193
|
+
method: string;
|
|
194
|
+
params: Record<string, string>;
|
|
195
|
+
route: string;
|
|
196
|
+
parent?: {
|
|
197
|
+
data: Map<string, any>;
|
|
198
|
+
locals?: Map<string, any>;
|
|
199
|
+
headers: Record<string, string>;
|
|
200
|
+
};
|
|
201
|
+
vite: {
|
|
202
|
+
isDev: boolean;
|
|
203
|
+
hmr: boolean;
|
|
204
|
+
server?: ViteDevServer;
|
|
205
|
+
};
|
|
206
|
+
data: Map<string, any>;
|
|
207
|
+
locals: Map<string, any>;
|
|
208
|
+
headers: Map<string, string>;
|
|
209
|
+
cookies: CookieJar;
|
|
210
|
+
_handled: boolean;
|
|
211
|
+
_redirectUrl?: string;
|
|
212
|
+
_rewriteUrl?: string;
|
|
213
|
+
redirect(url: string, status?: number): void;
|
|
214
|
+
rewrite(url: string): void;
|
|
215
|
+
json(data: any, status?: number): void;
|
|
216
|
+
text(content: string, status?: number): void;
|
|
217
|
+
html(content: string, status?: number): void;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Middleware chain interface
|
|
221
|
+
*/
|
|
222
|
+
interface MiddlewareChain {
|
|
223
|
+
use(fn: MiddlewareFunction): MiddlewareChain;
|
|
224
|
+
/**
|
|
225
|
+
* Conditionally run middleware based on a condition.
|
|
226
|
+
* Supports boolean values or functions that evaluate to boolean.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* .when(true, (ctx, next) => { ... }) // Always run
|
|
230
|
+
* .when((ctx) => ctx.data.get('flag'), (ctx, next) => { ... }) // Conditional
|
|
231
|
+
*/
|
|
232
|
+
when(condition: boolean | ((ctx: MiddlewareContext) => boolean), fn: MiddlewareFunction | ((chain: MiddlewareChain) => void)): MiddlewareChain;
|
|
233
|
+
rateLimit(config: RateLimitConfig): MiddlewareChain;
|
|
234
|
+
redirect(source: string, destination: string, permanent?: boolean): MiddlewareChain;
|
|
235
|
+
/**
|
|
236
|
+
* Rewrite the current route to a new destination.
|
|
237
|
+
* In route-specific middleware, this rewrites the middleware's route.
|
|
238
|
+
*
|
|
239
|
+
* @param destination - The destination path to rewrite to
|
|
240
|
+
* @param condition - Optional boolean or function that evaluates to boolean. If false, rewrite is skipped.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* // In /contact/middleware.ts
|
|
244
|
+
* .rewrite('/about') // Always rewrites /contact to /about
|
|
245
|
+
* .rewrite('/about', true) // Always rewrites
|
|
246
|
+
* .rewrite('/about', false) // Never rewrites
|
|
247
|
+
* .rewrite('/about', (ctx) => ctx.data.get('shouldRewrite')) // Conditional rewrite
|
|
248
|
+
*/
|
|
249
|
+
rewrite(destination: string, condition?: boolean | ((ctx: MiddlewareContext) => boolean)): MiddlewareChain;
|
|
250
|
+
build(): {
|
|
251
|
+
handlers: MiddlewareFunction[];
|
|
252
|
+
config?: MiddlewareConfig$1;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Middleware module export
|
|
257
|
+
*/
|
|
258
|
+
interface MiddlewareModule {
|
|
259
|
+
default?: MiddlewareChain | MiddlewareFunction;
|
|
260
|
+
middleware?: RequestMiddleware;
|
|
261
|
+
config?: MiddlewareConfig$1;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
type FarmMdxComponent = React__default.ComponentType<any> | keyof React__default.JSX.IntrinsicElements;
|
|
265
|
+
type FarmMdxComponents = Record<string, FarmMdxComponent>;
|
|
266
|
+
interface FarmMdxUserConfig {
|
|
267
|
+
/**
|
|
268
|
+
* Component map or module path that exports `components` or a default component map.
|
|
269
|
+
* Relative paths resolve from the project root.
|
|
270
|
+
*/
|
|
271
|
+
components?: string | FarmMdxComponents;
|
|
272
|
+
/**
|
|
273
|
+
* Serve source-authored markdown pages at `/route.md`.
|
|
274
|
+
* Enabled by default for `page.md` and `page.mdx`.
|
|
275
|
+
*/
|
|
276
|
+
markdownRoutes?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Class name used for the wrapper around rendered markdown content.
|
|
279
|
+
*/
|
|
280
|
+
className?: string;
|
|
281
|
+
}
|
|
282
|
+
interface FarmMdxResolvedConfig {
|
|
283
|
+
components?: string | FarmMdxComponents;
|
|
284
|
+
markdownRoutes: boolean;
|
|
285
|
+
className: string;
|
|
286
|
+
}
|
|
287
|
+
interface FarmMarkdownPageSource {
|
|
288
|
+
source: string;
|
|
289
|
+
filePath: string;
|
|
290
|
+
}
|
|
291
|
+
interface FarmMarkdownPageModuleInput extends FarmMarkdownPageSource {
|
|
292
|
+
components?: FarmMdxComponents;
|
|
293
|
+
config?: FarmMdxResolvedConfig;
|
|
294
|
+
}
|
|
295
|
+
declare function resolveMdxConfig(config: FarmMdxUserConfig | undefined): FarmMdxResolvedConfig;
|
|
296
|
+
declare function isFarmMarkdownPageFile(filePath: string): boolean;
|
|
297
|
+
declare function normalizeFarmMarkdownRoutePath(pathname: string): string;
|
|
298
|
+
declare function parseMarkdownFrontmatter(source: string): {
|
|
299
|
+
frontmatter: Record<string, string>;
|
|
300
|
+
body: string;
|
|
301
|
+
};
|
|
302
|
+
declare function titleFromMarkdown(body: string, fallback?: string): string | undefined;
|
|
303
|
+
declare function createMarkdownMetadata(source: string, filePath: string): (Metadata & Record<string, any>) | undefined;
|
|
304
|
+
declare function createFarmMarkdownRouteModule(input: FarmMarkdownPageModuleInput): RouteModule & {
|
|
305
|
+
source: string;
|
|
306
|
+
};
|
|
307
|
+
declare function createFarmMarkdownRouteModuleFromFile(filePath: string, options?: {
|
|
308
|
+
components?: FarmMdxComponents;
|
|
309
|
+
config?: FarmMdxResolvedConfig;
|
|
310
|
+
}): Promise<RouteModule<never> & {
|
|
311
|
+
source: string;
|
|
312
|
+
}>;
|
|
313
|
+
declare function loadFarmMdxComponents(config: FarmMdxResolvedConfig | undefined, options: {
|
|
314
|
+
root: string;
|
|
315
|
+
loadModule?: (modulePath: string) => Promise<unknown>;
|
|
316
|
+
}): Promise<FarmMdxComponents>;
|
|
317
|
+
declare function createFarmMarkdownSourceResponse(options: {
|
|
318
|
+
request: Request;
|
|
319
|
+
config?: FarmMdxResolvedConfig;
|
|
320
|
+
resolveSource: (pathname: string) => Promise<FarmMarkdownPageSource | null> | FarmMarkdownPageSource | null;
|
|
321
|
+
}): Promise<Response | null>;
|
|
322
|
+
|
|
323
|
+
type FarmRouteRuleRenderMode = "static" | "dynamic";
|
|
324
|
+
type FarmRouteRuleRedirect = string | {
|
|
325
|
+
to: string;
|
|
326
|
+
statusCode?: number;
|
|
327
|
+
permanent?: boolean;
|
|
328
|
+
};
|
|
329
|
+
type FarmRouteRuleCors = boolean | {
|
|
330
|
+
origin?: string;
|
|
331
|
+
methods?: string | readonly string[];
|
|
332
|
+
headers?: string | readonly string[];
|
|
333
|
+
};
|
|
334
|
+
interface FarmRouteRule extends FarmRouteRuntimeConfig {
|
|
335
|
+
prerender?: boolean;
|
|
336
|
+
render?: FarmRouteRuleRenderMode;
|
|
337
|
+
ssr?: boolean;
|
|
338
|
+
swr?: boolean | number;
|
|
339
|
+
isr?: boolean | number;
|
|
340
|
+
cors?: FarmRouteRuleCors;
|
|
341
|
+
headers?: Record<string, string>;
|
|
342
|
+
redirect?: FarmRouteRuleRedirect;
|
|
343
|
+
}
|
|
344
|
+
type FarmRouteRules = Record<string, FarmRouteRule>;
|
|
345
|
+
declare function normalizeRouteRules(routeRules: FarmRouteRules | undefined): FarmRouteRules;
|
|
346
|
+
declare function routeRulesToRedirects(routeRules: FarmRouteRules): RedirectConfig[];
|
|
347
|
+
declare function routeRulesToHeaders(routeRules: FarmRouteRules): HeaderConfig[];
|
|
348
|
+
declare function routeRulesToNitroRouteRules(routeRules: FarmRouteRules): Record<string, any>;
|
|
349
|
+
|
|
350
|
+
type FarmLayerEntry = string;
|
|
351
|
+
interface ResolvedFarmLayer {
|
|
352
|
+
/** The value used in `extends`. */
|
|
353
|
+
source: string;
|
|
354
|
+
/** Stable name used by the `#layers/<name>` alias. */
|
|
355
|
+
name: string;
|
|
356
|
+
/** Absolute layer package or directory root. */
|
|
357
|
+
root: string;
|
|
358
|
+
/** Source directory relative to the layer root. */
|
|
359
|
+
srcDir: string;
|
|
360
|
+
/** Resolved layer config file when one exists. */
|
|
361
|
+
configFile?: string;
|
|
362
|
+
}
|
|
363
|
+
interface FarmSourceRoot {
|
|
364
|
+
name: string;
|
|
365
|
+
root: string;
|
|
366
|
+
srcDir: string;
|
|
367
|
+
layer: boolean;
|
|
368
|
+
}
|
|
369
|
+
interface ResolveFarmLayersOptions {
|
|
370
|
+
root: string;
|
|
371
|
+
mode: "development" | "production";
|
|
372
|
+
}
|
|
373
|
+
interface FarmLayerResolution<TConfig extends Record<string, any>> {
|
|
374
|
+
config: TConfig & {
|
|
375
|
+
extends?: readonly FarmLayerEntry[];
|
|
376
|
+
layers: ResolvedFarmLayer[];
|
|
377
|
+
};
|
|
378
|
+
layers: ResolvedFarmLayer[];
|
|
379
|
+
}
|
|
380
|
+
declare function resolveFarmLayers<TConfig extends Record<string, any>>(projectConfig: TConfig, options: ResolveFarmLayersOptions): Promise<FarmLayerResolution<TConfig>>;
|
|
381
|
+
declare function getFarmSourceRoots(config: {
|
|
382
|
+
root?: string;
|
|
383
|
+
srcDir?: string;
|
|
384
|
+
layers?: readonly ResolvedFarmLayer[];
|
|
385
|
+
}): FarmSourceRoot[];
|
|
386
|
+
declare function getFarmAppDirectories(config: {
|
|
387
|
+
root?: string;
|
|
388
|
+
srcDir?: string;
|
|
389
|
+
layers?: readonly ResolvedFarmLayer[];
|
|
390
|
+
}): string[];
|
|
391
|
+
declare function getFarmLayerAliases(layers: readonly ResolvedFarmLayer[] | undefined): Record<string, string>;
|
|
392
|
+
declare function loadFarmConfigFile<TConfig = Record<string, any>>(configPath: string, options: {
|
|
393
|
+
root: string;
|
|
394
|
+
cacheRoot?: string;
|
|
395
|
+
}): Promise<TConfig>;
|
|
396
|
+
|
|
397
|
+
declare const DEFAULT_FARM_DEVTOOLS_SHORTCUT = "mod+shift+.";
|
|
398
|
+
declare const FARM_DEVTOOLS_PATH = "/__farm/devtools";
|
|
399
|
+
declare const FARM_DEVTOOLS_LAUNCH_PARAM = "__farm_devtools";
|
|
400
|
+
interface FarmDevtoolsConfig {
|
|
401
|
+
/** Enable the development-only DevTools UI and runtime endpoints. */
|
|
402
|
+
enabled?: boolean;
|
|
403
|
+
/** Keyboard shortcut used to toggle DevTools, or false to disable the shortcut. */
|
|
404
|
+
shortcut?: string | false;
|
|
405
|
+
}
|
|
406
|
+
type FarmDevtoolsUserConfig = boolean | FarmDevtoolsConfig;
|
|
407
|
+
interface ResolvedFarmDevtoolsConfig {
|
|
408
|
+
enabled: boolean;
|
|
409
|
+
shortcut: string | false;
|
|
410
|
+
}
|
|
411
|
+
declare function resolveFarmDevtoolsConfig(config: FarmDevtoolsUserConfig | ResolvedFarmDevtoolsConfig | undefined, mode?: "development" | "production"): ResolvedFarmDevtoolsConfig;
|
|
412
|
+
|
|
413
|
+
interface FarmAuthEmailAndPasswordConfig {
|
|
414
|
+
/** Require a verified email before creating a session. @default false */
|
|
415
|
+
requireEmailVerification?: boolean;
|
|
416
|
+
/** Smallest accepted password length. @default 8 */
|
|
417
|
+
minPasswordLength?: number;
|
|
418
|
+
/** Largest accepted password length. @default 128 */
|
|
419
|
+
maxPasswordLength?: number;
|
|
420
|
+
}
|
|
421
|
+
interface FarmAuthSessionConfig {
|
|
422
|
+
/** Session lifetime in seconds. @default 604800 */
|
|
423
|
+
expiresIn?: number;
|
|
424
|
+
/** Session refresh interval in seconds. @default 86400 */
|
|
425
|
+
updateAge?: number;
|
|
426
|
+
}
|
|
427
|
+
interface FarmAuthDatabaseConfig {
|
|
428
|
+
/**
|
|
429
|
+
* Postgres connection string. Defaults to DATABASE_URL.
|
|
430
|
+
* Local development falls back to SQLite when no URL is present.
|
|
431
|
+
*/
|
|
432
|
+
url?: string;
|
|
433
|
+
/** Local SQLite path. @default ".farm/auth.sqlite" */
|
|
434
|
+
path?: string;
|
|
435
|
+
/** Automatically update the auth schema in development. @default true */
|
|
436
|
+
migrateInDevelopment?: boolean;
|
|
437
|
+
}
|
|
438
|
+
interface FarmAuthConfig {
|
|
439
|
+
/** Set false to disable auth without removing its configuration. @default true */
|
|
440
|
+
enabled?: boolean;
|
|
441
|
+
/** Display name used by authentication emails and metadata. */
|
|
442
|
+
appName?: string;
|
|
443
|
+
/** Route prefix for the auth endpoints. @default "/api/auth" */
|
|
444
|
+
basePath?: string;
|
|
445
|
+
/**
|
|
446
|
+
* Email/password authentication. It is enabled by default; set false to
|
|
447
|
+
* disable it when adding another sign-in method.
|
|
448
|
+
*/
|
|
449
|
+
emailAndPassword?: boolean | FarmAuthEmailAndPasswordConfig;
|
|
450
|
+
session?: FarmAuthSessionConfig;
|
|
451
|
+
database?: FarmAuthDatabaseConfig;
|
|
452
|
+
}
|
|
453
|
+
type FarmAuthUserConfig = boolean | FarmAuthConfig;
|
|
454
|
+
interface ResolvedFarmAuthConfig {
|
|
455
|
+
enabled: boolean;
|
|
456
|
+
appName?: string;
|
|
457
|
+
basePath: string;
|
|
458
|
+
emailAndPassword: {
|
|
459
|
+
enabled: boolean;
|
|
460
|
+
requireEmailVerification: boolean;
|
|
461
|
+
minPasswordLength: number;
|
|
462
|
+
maxPasswordLength: number;
|
|
463
|
+
};
|
|
464
|
+
session: {
|
|
465
|
+
expiresIn: number;
|
|
466
|
+
updateAge: number;
|
|
467
|
+
};
|
|
468
|
+
database: {
|
|
469
|
+
url?: string;
|
|
470
|
+
path: string;
|
|
471
|
+
migrateInDevelopment: boolean;
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
type FarmPreloadMode = "warn" | "enforce";
|
|
476
|
+
interface FarmPreloadUserConfig {
|
|
477
|
+
/** Report excess hints or remove the lower-priority hints. @default "enforce" */
|
|
478
|
+
mode?: FarmPreloadMode;
|
|
479
|
+
/** Maximum image preload hints per document. @default 1 */
|
|
480
|
+
maxImages?: number;
|
|
481
|
+
/** Maximum font preload hints per document. @default 2 */
|
|
482
|
+
maxFonts?: number;
|
|
483
|
+
}
|
|
484
|
+
interface ResolvedFarmPreloadConfig {
|
|
485
|
+
mode: FarmPreloadMode;
|
|
486
|
+
maxImages: number;
|
|
487
|
+
maxFonts: number;
|
|
488
|
+
}
|
|
489
|
+
interface FarmPerformanceConfig {
|
|
490
|
+
preload?: FarmPreloadUserConfig;
|
|
491
|
+
}
|
|
492
|
+
interface ResolvedFarmPerformanceConfig {
|
|
493
|
+
preload: ResolvedFarmPreloadConfig;
|
|
494
|
+
}
|
|
495
|
+
type FarmPreloadKind = "image" | "font";
|
|
496
|
+
interface FarmPreloadBudgetWarning {
|
|
497
|
+
kind: FarmPreloadKind;
|
|
498
|
+
count: number;
|
|
499
|
+
budget: number;
|
|
500
|
+
removed: number;
|
|
501
|
+
}
|
|
502
|
+
interface FarmManagedPreloads {
|
|
503
|
+
value: string;
|
|
504
|
+
warnings: FarmPreloadBudgetWarning[];
|
|
505
|
+
}
|
|
506
|
+
interface FarmManagedDocumentPreloads {
|
|
507
|
+
html: string;
|
|
508
|
+
linkHeader: string;
|
|
509
|
+
warnings: FarmPreloadBudgetWarning[];
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Apply image and font budgets to HTML preload elements. High-priority image
|
|
513
|
+
* hints are retained before ordinary hints, making an explicitly preloaded LCP
|
|
514
|
+
* image the winner when a document contains too many React-generated hints.
|
|
515
|
+
*/
|
|
516
|
+
declare function manageFarmHtmlPreloads(html: string, config: ResolvedFarmPreloadConfig): FarmManagedPreloads;
|
|
517
|
+
/** Apply the same budgets to HTTP Link preload hints, including Farm fonts. */
|
|
518
|
+
declare function manageFarmLinkHeaderPreloads(value: string, config: ResolvedFarmPreloadConfig): FarmManagedPreloads;
|
|
519
|
+
/** Apply a single document budget across HTML and HTTP Link header hints. */
|
|
520
|
+
declare function manageFarmDocumentPreloads(html: string, linkHeader: string, config: ResolvedFarmPreloadConfig): FarmManagedDocumentPreloads;
|
|
521
|
+
/** Rate-limit identical route-and-budget warnings within a server process. */
|
|
522
|
+
declare function reportFarmPreloadWarnings(warnings: FarmPreloadBudgetWarning[], context?: string): void;
|
|
523
|
+
|
|
524
|
+
type FarmCspDirectiveValue = string | readonly string[] | boolean | null | undefined;
|
|
525
|
+
type FarmCspDirectives = Readonly<Record<string, FarmCspDirectiveValue>>;
|
|
526
|
+
interface FarmCspOptions {
|
|
527
|
+
/** A pre-serialized CSP value. Cannot be combined with directives. */
|
|
528
|
+
policy?: string;
|
|
529
|
+
/** CSP directives using camelCase or kebab-case names. */
|
|
530
|
+
directives?: FarmCspDirectives;
|
|
531
|
+
/** Emit Content-Security-Policy-Report-Only instead of enforcing the policy. */
|
|
532
|
+
reportOnly?: boolean;
|
|
533
|
+
}
|
|
534
|
+
type FarmCspConfig = string | FarmCspOptions;
|
|
535
|
+
interface FarmSecurityConfig {
|
|
536
|
+
/** App-wide Content Security Policy applied to pages, APIs, and static output. */
|
|
537
|
+
csp?: FarmCspConfig | false;
|
|
538
|
+
/** @deprecated Use csp. */
|
|
539
|
+
contentSecurityPolicy?: never;
|
|
540
|
+
}
|
|
541
|
+
interface ResolvedFarmCspConfig {
|
|
542
|
+
value: string;
|
|
543
|
+
reportOnly: boolean;
|
|
544
|
+
}
|
|
545
|
+
interface ResolvedFarmSecurityConfig {
|
|
546
|
+
csp: ResolvedFarmCspConfig | false;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
declare const FARM_RESOLVED_CUSTOM_CONTEXT: unique symbol;
|
|
550
|
+
|
|
551
|
+
interface RedirectConfig {
|
|
552
|
+
source: string;
|
|
553
|
+
destination: string;
|
|
554
|
+
permanent?: boolean;
|
|
555
|
+
statusCode?: number;
|
|
556
|
+
}
|
|
557
|
+
interface HeaderConfig {
|
|
558
|
+
source: string;
|
|
559
|
+
headers: Array<{
|
|
560
|
+
key: string;
|
|
561
|
+
value: string;
|
|
562
|
+
}>;
|
|
563
|
+
}
|
|
564
|
+
interface RewriteConfig {
|
|
565
|
+
source: string;
|
|
566
|
+
destination: string;
|
|
567
|
+
}
|
|
568
|
+
/** @deprecated Use FarmImageConfig. */
|
|
569
|
+
type ImageConfig = FarmImageConfig;
|
|
570
|
+
/** @deprecated Use FarmI18nUserConfig. */
|
|
571
|
+
type I18nConfig = FarmI18nUserConfig;
|
|
572
|
+
interface OpenAPIConfig {
|
|
573
|
+
enabled?: boolean;
|
|
574
|
+
route?: string;
|
|
575
|
+
title?: string;
|
|
576
|
+
description?: string;
|
|
577
|
+
version?: string;
|
|
578
|
+
servers?: Array<{
|
|
579
|
+
url: string;
|
|
580
|
+
description?: string;
|
|
581
|
+
}>;
|
|
582
|
+
contact?: {
|
|
583
|
+
name?: string;
|
|
584
|
+
email?: string;
|
|
585
|
+
url?: string;
|
|
586
|
+
};
|
|
587
|
+
license?: {
|
|
588
|
+
name: string;
|
|
589
|
+
url?: string;
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
type MiddlewareConfig = FarmMiddlewareConfig;
|
|
593
|
+
interface NotFoundConfig {
|
|
594
|
+
/** Path to a custom 404 page component (e.g., "./src/app/not-found.tsx") */
|
|
595
|
+
component?: string;
|
|
596
|
+
}
|
|
597
|
+
type FarmDeployTarget = "vercel" | "cloudflare" | "netlify" | "node" | string;
|
|
598
|
+
interface FarmDeployConfig {
|
|
599
|
+
/**
|
|
600
|
+
* Deployment platform. When present, Farm picks the matching Nitro preset and
|
|
601
|
+
* output directory unless explicitly overridden.
|
|
602
|
+
*/
|
|
603
|
+
target?: FarmDeployTarget;
|
|
604
|
+
/** Nitro preset override. Usually inferred from target. */
|
|
605
|
+
preset?: FarmConfig["preset"];
|
|
606
|
+
/** Deployable output directory, relative to project root unless absolute. */
|
|
607
|
+
outputDir?: string;
|
|
608
|
+
/** Alias for outputDir for terser config. */
|
|
609
|
+
output?: string;
|
|
610
|
+
/** Cloudflare Pages project name used by `farm deploy --cloudflare`. */
|
|
611
|
+
projectName?: string;
|
|
612
|
+
vercel?: {
|
|
613
|
+
outputDirectory?: string;
|
|
614
|
+
buildCommand?: string;
|
|
615
|
+
installCommand?: string;
|
|
616
|
+
framework?: string | null;
|
|
617
|
+
};
|
|
618
|
+
cloudflare?: {
|
|
619
|
+
outputDir?: string;
|
|
620
|
+
projectName?: string;
|
|
621
|
+
};
|
|
622
|
+
netlify?: {
|
|
623
|
+
outputDir?: string;
|
|
624
|
+
site?: string;
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
interface ResolvedFarmDeployConfig extends Omit<FarmDeployConfig, "output"> {
|
|
628
|
+
target?: FarmDeployTarget;
|
|
629
|
+
preset: FarmConfig["preset"];
|
|
630
|
+
outputDir: string;
|
|
631
|
+
}
|
|
632
|
+
interface FarmUserConfig extends Omit<FarmConfig, "vite" | "docs" | "env" | "layers"> {
|
|
633
|
+
/** Reusable Farm directories or installed packages, applied from left to right. */
|
|
634
|
+
extends?: readonly FarmLayerEntry[];
|
|
635
|
+
/** Global plugins. Integration-bound plugins must be contributed through an integration. */
|
|
636
|
+
plugins?: FarmPlugin<any, any, any, any, unknown, false>[];
|
|
637
|
+
integrations?: FarmIntegrationsUserConfig;
|
|
638
|
+
/**
|
|
639
|
+
* Farm-native authentication. `true` enables email/password auth with
|
|
640
|
+
* server helpers from `@farm.js/auth/server` and React APIs from
|
|
641
|
+
* `@farm.js/auth/client`.
|
|
642
|
+
*/
|
|
643
|
+
auth?: FarmAuthUserConfig;
|
|
644
|
+
/** Shared application data, route, ISR, and PPR cache. */
|
|
645
|
+
cache?: FarmCacheUserConfig;
|
|
646
|
+
migrations?: FarmMigrationsUserConfig;
|
|
647
|
+
/** Map portable cron schedules to ordinary GET API routes. */
|
|
648
|
+
cron?: FarmCronUserConfig | FarmCronResolvedConfig | false;
|
|
649
|
+
workflows?: FarmWorkflowsUserConfig | boolean;
|
|
650
|
+
preset?: FarmConfig["preset"];
|
|
651
|
+
deploy?: FarmDeployConfig;
|
|
652
|
+
docs?: FarmDocsUserConfig;
|
|
653
|
+
md?: FarmMarkdownUserConfig | boolean;
|
|
654
|
+
mdx?: FarmMdxUserConfig;
|
|
655
|
+
observability?: FarmObservabilityUserConfig;
|
|
656
|
+
trailingSlash?: boolean;
|
|
657
|
+
redirects?: () => Promise<RedirectConfig[]> | RedirectConfig[];
|
|
658
|
+
rewrites?: () => Promise<RewriteConfig[]> | RewriteConfig[];
|
|
659
|
+
headers?: () => Promise<HeaderConfig[]> | HeaderConfig[];
|
|
660
|
+
images?: ImageConfig;
|
|
661
|
+
publicDir?: string;
|
|
662
|
+
i18n?: FarmI18nUserConfig | false;
|
|
663
|
+
openapi?: OpenAPIConfig;
|
|
664
|
+
middleware?: FarmMiddlewareConfig;
|
|
665
|
+
routeRules?: FarmRouteRules;
|
|
666
|
+
context?: FarmConfig["context"];
|
|
667
|
+
/** Server ingress and trusted-proxy policy. */
|
|
668
|
+
server?: FarmServerConfig;
|
|
669
|
+
serverActions?: FarmServerActionsConfig;
|
|
670
|
+
/** Build identifier used to detect and recover from deployment version skew. */
|
|
671
|
+
deploymentId?: string;
|
|
672
|
+
notFound?: NotFoundConfig;
|
|
673
|
+
output?: "standalone" | "static" | "export";
|
|
674
|
+
distDir?: string;
|
|
675
|
+
generateBuildId?: () => string | Promise<string>;
|
|
676
|
+
compress?: boolean;
|
|
677
|
+
devIndicators?: {
|
|
678
|
+
buildActivity?: boolean;
|
|
679
|
+
buildActivityPosition?: "bottom-right" | "bottom-left" | "top-right" | "top-left";
|
|
680
|
+
};
|
|
681
|
+
serverRuntimeConfig?: Record<string, any>;
|
|
682
|
+
publicRuntimeConfig?: Record<string, any>;
|
|
683
|
+
env?: FarmEnvConfig<any, any>;
|
|
684
|
+
typescript?: {
|
|
685
|
+
tsconfigPath?: string;
|
|
686
|
+
ignoreBuildErrors?: boolean;
|
|
687
|
+
};
|
|
688
|
+
vite?: UserConfig | ((config: UserConfig) => UserConfig);
|
|
689
|
+
[key: string]: any;
|
|
690
|
+
}
|
|
691
|
+
interface ResolvedFarmConfig extends Required<Omit<FarmUserConfig, "extends" | "plugins" | "vite" | "deploy" | "docs" | "md" | "mdx" | "migrations" | "cron" | "workflows" | "env" | "server" | "serverActions" | "devtools" | "images" | "i18n" | "auth" | "performance" | "security" | "theme">> {
|
|
692
|
+
/** @internal Tracks whether `context` came from user/layer config instead of the default noop. */
|
|
693
|
+
[FARM_RESOLVED_CUSTOM_CONTEXT]?: boolean;
|
|
694
|
+
extends: readonly FarmLayerEntry[];
|
|
695
|
+
layers: ResolvedFarmLayer[];
|
|
696
|
+
plugins: FarmPlugin[];
|
|
697
|
+
vite: UserConfig;
|
|
698
|
+
deploy: ResolvedFarmDeployConfig;
|
|
699
|
+
docs: FarmDocsResolvedConfig;
|
|
700
|
+
md: FarmMarkdownResolvedConfig;
|
|
701
|
+
mdx: FarmMdxResolvedConfig;
|
|
702
|
+
migrations: ResolvedFarmMigrationsConfig;
|
|
703
|
+
cron: FarmCronResolvedConfig;
|
|
704
|
+
workflows: FarmWorkflowsResolvedConfig;
|
|
705
|
+
env: ResolvedFarmEnv;
|
|
706
|
+
server: ResolvedFarmServerConfig;
|
|
707
|
+
serverActions: ResolvedFarmServerActionsConfig;
|
|
708
|
+
devtools: ResolvedFarmDevtoolsConfig;
|
|
709
|
+
images: ResolvedFarmImageConfig;
|
|
710
|
+
i18n: ResolvedFarmI18nConfig;
|
|
711
|
+
auth: ResolvedFarmAuthConfig;
|
|
712
|
+
performance: ResolvedFarmPerformanceConfig;
|
|
713
|
+
security: ResolvedFarmSecurityConfig;
|
|
714
|
+
theme: ResolvedFarmThemeConfig;
|
|
715
|
+
routeRules: FarmRouteRules;
|
|
716
|
+
}
|
|
717
|
+
type FarmLayerConfig = Omit<FarmUserConfig, "root" | "outDir" | "distDir" | "deploy" | "output" | "preset" | "publicDir" | "generateBuildId" | "deploymentId">;
|
|
718
|
+
|
|
719
|
+
declare function normalizeDeployTarget(target?: FarmDeployTarget): FarmDeployTarget | undefined;
|
|
720
|
+
declare function getPresetForDeployTarget(target?: FarmDeployTarget): FarmConfig["preset"] | undefined;
|
|
721
|
+
declare function getDeployTargetForPreset(preset?: string): FarmDeployTarget | undefined;
|
|
722
|
+
declare function resolveDeployOutputPath(root: string, outputDir: string): string;
|
|
723
|
+
declare function resolveDeployConfig(config: Pick<FarmUserConfig, "deploy" | "preset" | "distDir">, overrides?: {
|
|
724
|
+
target?: FarmDeployTarget;
|
|
725
|
+
preset?: FarmConfig["preset"];
|
|
726
|
+
outputDir?: string;
|
|
727
|
+
}): ResolvedFarmDeployConfig;
|
|
728
|
+
declare function resolveMigrationsConfig(migrations: FarmMigrationsUserConfig | undefined): ResolvedFarmMigrationsConfig;
|
|
729
|
+
declare function resolveConfig(userConfig: FarmUserConfig, mode: "development" | "production"): Promise<ResolvedFarmConfig>;
|
|
730
|
+
declare function loadConfig(rootDir?: string, configPath?: string, mode?: string, loadEnvironment?: (typeof vite)["loadEnv"]): Promise<FarmUserConfig | undefined>;
|
|
731
|
+
|
|
732
|
+
interface FarmVitePluginOptions extends FarmConfig {
|
|
733
|
+
openapi?: FarmUserConfig["openapi"];
|
|
734
|
+
images?: FarmUserConfig["images"];
|
|
735
|
+
publicDir?: FarmUserConfig["publicDir"];
|
|
736
|
+
}
|
|
737
|
+
declare function farmI18nClientBridgePlugin(): Plugin;
|
|
738
|
+
interface FarmModuleAstNode {
|
|
739
|
+
type: string;
|
|
740
|
+
start: number;
|
|
741
|
+
end: number;
|
|
742
|
+
[key: string]: unknown;
|
|
743
|
+
}
|
|
744
|
+
declare function rewriteEarlySsrRelativeImports(options: {
|
|
745
|
+
code: string;
|
|
746
|
+
id: string;
|
|
747
|
+
root: string;
|
|
748
|
+
parse: (code: string) => FarmModuleAstNode;
|
|
749
|
+
}): string | null;
|
|
750
|
+
declare function farmPlugin(options?: FarmVitePluginOptions, initialPluginManager?: PluginManager): Plugin;
|
|
751
|
+
declare function defineConfig(config?: FarmVitePluginOptions): Promise<UserConfig>;
|
|
752
|
+
|
|
753
|
+
type MaybePromise$1<T> = T | Promise<T>;
|
|
754
|
+
declare const FARM_PLUGIN_INTEGRATION_INSTANCE: unique symbol;
|
|
755
|
+
declare const FARM_PLUGIN_INTEGRATION_BOUND: unique symbol;
|
|
756
|
+
interface FarmPluginIntegrationContext<TInstance = unknown> {
|
|
757
|
+
/** Key used to register the integration in farm.config.ts. */
|
|
758
|
+
readonly key: string;
|
|
759
|
+
readonly category: string;
|
|
760
|
+
readonly type: string;
|
|
761
|
+
readonly instance: TInstance;
|
|
762
|
+
readonly serverRuntime: boolean;
|
|
763
|
+
}
|
|
764
|
+
declare class FarmRuntimeShutdownError extends Error {
|
|
765
|
+
readonly errors: readonly unknown[];
|
|
766
|
+
constructor(message: string, errors: readonly unknown[]);
|
|
767
|
+
}
|
|
768
|
+
interface PluginRequestContext {
|
|
769
|
+
set: (target: FarmRequest | Request, key: string, value: any, options?: {
|
|
770
|
+
exposeToPage?: boolean;
|
|
771
|
+
}) => void;
|
|
772
|
+
get: <T = any>(target: FarmRequest | Request, key: string) => T | undefined;
|
|
773
|
+
has: (target: FarmRequest | Request, key: string) => boolean;
|
|
774
|
+
delete: (target: FarmRequest | Request, key: string) => boolean;
|
|
775
|
+
clear: (target: FarmRequest | Request) => void;
|
|
776
|
+
getAll: (target: FarmRequest | Request, options?: {
|
|
777
|
+
exposedOnly?: boolean;
|
|
778
|
+
}) => Map<string, any>;
|
|
779
|
+
}
|
|
780
|
+
interface FarmRequestStore {
|
|
781
|
+
set(key: string, value: unknown, options?: {
|
|
782
|
+
exposeToPage?: boolean;
|
|
783
|
+
}): void;
|
|
784
|
+
get<T = unknown>(key: string): T | undefined;
|
|
785
|
+
has(key: string): boolean;
|
|
786
|
+
delete(key: string): boolean;
|
|
787
|
+
clear(): void;
|
|
788
|
+
snapshot(options?: {
|
|
789
|
+
exposedOnly?: boolean;
|
|
790
|
+
}): Map<string, unknown>;
|
|
791
|
+
}
|
|
792
|
+
interface FarmPluginContext<TIntegrationInstance = unknown> {
|
|
793
|
+
config: FarmConfig;
|
|
794
|
+
viteServer?: ViteDevServer;
|
|
795
|
+
isDev: boolean;
|
|
796
|
+
isProd: boolean;
|
|
797
|
+
/** The owning integration when this plugin is contributed through `integration.plugins`. */
|
|
798
|
+
readonly integration?: Readonly<FarmPluginIntegrationContext<TIntegrationInstance>>;
|
|
799
|
+
/** Register resource cleanup that must run when the application runtime closes. */
|
|
800
|
+
lifecycle: FarmPluginLifecycle;
|
|
801
|
+
/** @deprecated Use `ctx.req` inside request hooks. */
|
|
802
|
+
requestContext: PluginRequestContext;
|
|
803
|
+
}
|
|
804
|
+
type FarmPluginHookContext<TContext, TIntegrationInstance, TIntegrationBound extends boolean> = TIntegrationBound extends true ? Omit<TContext, "integration"> & {
|
|
805
|
+
/** The owning integration bound by `definePlugin.forIntegration<T>()`. */
|
|
806
|
+
readonly integration: Readonly<FarmPluginIntegrationContext<TIntegrationInstance>>;
|
|
807
|
+
} : TContext;
|
|
808
|
+
interface FarmPluginLifecycle {
|
|
809
|
+
/**
|
|
810
|
+
* Register a database, storage, queue, or other resource disposer.
|
|
811
|
+
* Disposers run once in reverse registration order after plugin shutdown hooks.
|
|
812
|
+
*/
|
|
813
|
+
onShutdown(dispose: () => void | Promise<void>): () => void;
|
|
814
|
+
}
|
|
815
|
+
interface FarmRequestPluginContext<TIntegrationInstance = unknown> extends FarmPluginContext<TIntegrationInstance> {
|
|
816
|
+
/** Request-scoped values for the current hook invocation. */
|
|
817
|
+
readonly req: FarmRequestStore;
|
|
818
|
+
}
|
|
819
|
+
interface RouteDiscoveredPayload {
|
|
820
|
+
kind: "page" | "layout";
|
|
821
|
+
pattern: string;
|
|
822
|
+
modulePath: string;
|
|
823
|
+
}
|
|
824
|
+
interface RoutesGeneratedPayload {
|
|
825
|
+
routes: RouteDiscoveredPayload[];
|
|
826
|
+
pageCount: number;
|
|
827
|
+
layoutCount: number;
|
|
828
|
+
}
|
|
829
|
+
interface MiddlewareDiscoveredPayload {
|
|
830
|
+
path: string;
|
|
831
|
+
filePath: string;
|
|
832
|
+
handlerCount: number;
|
|
833
|
+
}
|
|
834
|
+
interface APIRouteDiscoveredPayload {
|
|
835
|
+
path: string;
|
|
836
|
+
filePath: string;
|
|
837
|
+
methods: string[];
|
|
838
|
+
}
|
|
839
|
+
interface RouteMatchPayload {
|
|
840
|
+
pathname: string;
|
|
841
|
+
method?: string;
|
|
842
|
+
}
|
|
843
|
+
interface RouteMatchResultPayload {
|
|
844
|
+
pathname: string;
|
|
845
|
+
matched: boolean;
|
|
846
|
+
routePattern: string | null;
|
|
847
|
+
params: Record<string, string>;
|
|
848
|
+
layoutPatterns: string[];
|
|
849
|
+
}
|
|
850
|
+
interface RenderLifecyclePayload {
|
|
851
|
+
pathname: string;
|
|
852
|
+
method: string;
|
|
853
|
+
routePattern: string | null;
|
|
854
|
+
params: Record<string, string>;
|
|
855
|
+
}
|
|
856
|
+
interface APIHandlerLifecyclePayload {
|
|
857
|
+
pathname: string;
|
|
858
|
+
method: string;
|
|
859
|
+
routePath?: string;
|
|
860
|
+
}
|
|
861
|
+
interface ErrorLifecyclePayload {
|
|
862
|
+
phase: string;
|
|
863
|
+
error: unknown;
|
|
864
|
+
meta?: Record<string, unknown>;
|
|
865
|
+
}
|
|
866
|
+
interface HMRUpdatePayload {
|
|
867
|
+
file: string;
|
|
868
|
+
modules: string[];
|
|
869
|
+
}
|
|
870
|
+
interface BundleLifecyclePayload {
|
|
871
|
+
root: string;
|
|
872
|
+
preset: string;
|
|
873
|
+
universal: boolean;
|
|
874
|
+
distDir: string;
|
|
875
|
+
outputDir?: string;
|
|
876
|
+
}
|
|
877
|
+
interface BundleResultPayload extends BundleLifecyclePayload {
|
|
878
|
+
success: boolean;
|
|
879
|
+
}
|
|
880
|
+
interface NitroBuildLifecyclePayload {
|
|
881
|
+
root: string;
|
|
882
|
+
preset: string;
|
|
883
|
+
distDir: string;
|
|
884
|
+
outputDir: string;
|
|
885
|
+
}
|
|
886
|
+
interface ShutdownPayload {
|
|
887
|
+
reason: string;
|
|
888
|
+
}
|
|
889
|
+
type FarmPluginRuntimeKind = "request" | "page" | "api" | "action" | "integration" | "docs" | "asset" | (string & {});
|
|
890
|
+
interface FarmPluginRouteRuntimePayload {
|
|
891
|
+
pathname: string;
|
|
892
|
+
pattern?: string | null;
|
|
893
|
+
params?: Record<string, string>;
|
|
894
|
+
}
|
|
895
|
+
interface FarmPluginSetupContext<TIntegrationInstance = unknown> extends FarmPluginContext<TIntegrationInstance> {
|
|
896
|
+
env: ResolvedFarmEnv;
|
|
897
|
+
}
|
|
898
|
+
interface FarmPluginStateContext<TState = unknown, TIntegrationInstance = unknown> extends FarmPluginContext<TIntegrationInstance> {
|
|
899
|
+
state: TState;
|
|
900
|
+
}
|
|
901
|
+
interface FarmPluginRuntimeBaseEvent<TState = unknown, TIntegrationInstance = unknown> extends FarmPluginStateContext<TState, TIntegrationInstance> {
|
|
902
|
+
request: Request;
|
|
903
|
+
/** Request-scoped values shared by plugin hooks. */
|
|
904
|
+
req: FarmRequestStore;
|
|
905
|
+
kind: FarmPluginRuntimeKind;
|
|
906
|
+
route?: FarmPluginRouteRuntimePayload;
|
|
907
|
+
signal: AbortSignal;
|
|
908
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
909
|
+
}
|
|
910
|
+
type FarmPluginRuntimeContextEvent<TState = unknown, TIntegrationInstance = unknown> = FarmPluginRuntimeBaseEvent<TState, TIntegrationInstance>;
|
|
911
|
+
interface FarmPluginRuntimeBeforeEvent<TState = unknown, TRequestContext extends object = Record<string, unknown>, TIntegrationInstance = unknown> extends FarmPluginRuntimeBaseEvent<TState, TIntegrationInstance> {
|
|
912
|
+
ctx: Readonly<TRequestContext>;
|
|
913
|
+
}
|
|
914
|
+
interface FarmPluginRuntimeAfterEvent<TState = unknown, TRequestContext extends object = Record<string, unknown>, TIntegrationInstance = unknown> extends FarmPluginRuntimeBeforeEvent<TState, TRequestContext, TIntegrationInstance> {
|
|
915
|
+
response: Response;
|
|
916
|
+
durationMs: number;
|
|
917
|
+
}
|
|
918
|
+
interface FarmPluginRuntimeErrorEvent<TState = unknown, TRequestContext extends object = Record<string, unknown>, TIntegrationInstance = unknown> extends FarmPluginRuntimeBeforeEvent<TState, TRequestContext, TIntegrationInstance> {
|
|
919
|
+
error: unknown;
|
|
920
|
+
durationMs: number;
|
|
921
|
+
}
|
|
922
|
+
type FarmPluginRuntimeStartEvent<TState = unknown, TIntegrationInstance = unknown> = FarmPluginStateContext<TState, TIntegrationInstance>;
|
|
923
|
+
interface FarmPluginRuntimeCloseEvent<TState = unknown, TIntegrationInstance = unknown> extends FarmPluginStateContext<TState, TIntegrationInstance>, ShutdownPayload {
|
|
924
|
+
}
|
|
925
|
+
type FarmPluginContextFor<TIntegrationInstance, TIntegrationBound extends boolean> = FarmPluginHookContext<FarmPluginContext<TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>;
|
|
926
|
+
type FarmRequestPluginContextFor<TIntegrationInstance, TIntegrationBound extends boolean> = FarmPluginHookContext<FarmRequestPluginContext<TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>;
|
|
927
|
+
type FarmPluginSetupContextFor<TIntegrationInstance, TIntegrationBound extends boolean> = FarmPluginHookContext<FarmPluginSetupContext<TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>;
|
|
928
|
+
type FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound extends boolean> = FarmPluginHookContext<FarmPluginStateContext<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>;
|
|
929
|
+
type FarmPluginRuntimeEventFor<TEvent, TIntegrationInstance, TIntegrationBound extends boolean> = FarmPluginHookContext<TEvent, TIntegrationInstance, TIntegrationBound>;
|
|
930
|
+
interface FarmPluginRuntimeHooks<TState = unknown, TRequestContext extends object = Record<string, unknown>, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
931
|
+
start?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeStartEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
932
|
+
context?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeContextEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<TRequestContext>;
|
|
933
|
+
before?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeBeforeEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<Request | Response | void>;
|
|
934
|
+
after?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeAfterEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<Response | void>;
|
|
935
|
+
error?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeErrorEvent<TState, TRequestContext, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
936
|
+
close?(event: FarmPluginRuntimeEventFor<FarmPluginRuntimeCloseEvent<TState, TIntegrationInstance>, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
937
|
+
}
|
|
938
|
+
interface FarmPluginRuntimeRequestOptions {
|
|
939
|
+
kind?: FarmPluginRuntimeKind;
|
|
940
|
+
route?: FarmPluginRouteRuntimePayload;
|
|
941
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
942
|
+
}
|
|
943
|
+
type FarmPluginRuntimeRequestHandler = (request: Request) => MaybePromise$1<Response>;
|
|
944
|
+
interface FarmPluginRuntimeSession {
|
|
945
|
+
request: Request;
|
|
946
|
+
response?: Response;
|
|
947
|
+
ctx: Readonly<Record<string, unknown>>;
|
|
948
|
+
startedAt: number;
|
|
949
|
+
options: FarmPluginRuntimeRequestOptions;
|
|
950
|
+
waitUntil(promise: Promise<unknown>): void;
|
|
951
|
+
}
|
|
952
|
+
type FarmPluginDiscoveredRoute = RouteDiscoveredPayload | ({
|
|
953
|
+
kind: "middleware";
|
|
954
|
+
} & MiddlewareDiscoveredPayload) | ({
|
|
955
|
+
kind: "api";
|
|
956
|
+
} & APIRouteDiscoveredPayload);
|
|
957
|
+
interface FarmPluginRouterHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
958
|
+
discovered?(route: FarmPluginDiscoveredRoute, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
959
|
+
generated?(routes: RoutesGeneratedPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
960
|
+
before?(route: RouteMatchPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
961
|
+
after?(result: RouteMatchResultPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
962
|
+
}
|
|
963
|
+
interface FarmPluginRenderHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
964
|
+
before?(render: RenderLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
965
|
+
html?(html: string, render: RenderLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<string | void>;
|
|
966
|
+
}
|
|
967
|
+
interface FarmPluginBuildHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
968
|
+
before?(bundle: BundleLifecyclePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
969
|
+
configure?(buildConfig: any, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<any>;
|
|
970
|
+
after?(result: BundleResultPayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
971
|
+
}
|
|
972
|
+
interface FarmPluginDevHooks<TState = unknown, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
973
|
+
server?(viteServer: ViteDevServer, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
974
|
+
update?(update: HMRUpdatePayload, context: FarmPluginStateContextFor<TState, TIntegrationInstance, TIntegrationBound>): MaybePromise$1<void>;
|
|
975
|
+
}
|
|
976
|
+
interface FarmPluginClientConfig<TState = unknown, TPublic = undefined> extends FarmClientPlugin<TState, TPublic> {
|
|
977
|
+
/** Explicitly public, JSON-safe data embedded in the browser bundle. */
|
|
978
|
+
public?: TPublic;
|
|
979
|
+
}
|
|
980
|
+
interface FarmPlugin<TState = any, TRequestContext extends object = Record<string, unknown>, TClientState = any, TClientPublic = any, TIntegrationInstance = unknown, TIntegrationBound extends boolean = false> {
|
|
981
|
+
name: string;
|
|
982
|
+
version?: string;
|
|
983
|
+
enforce?: "pre" | "post";
|
|
984
|
+
/** Transform Farm config before it is resolved. */
|
|
985
|
+
configure?: (config: FarmConfig, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => MaybePromise$1<FarmConfig | void>;
|
|
986
|
+
/** Initialize private plugin state once for this plugin manager. */
|
|
987
|
+
setup?: (context: FarmPluginSetupContextFor<TIntegrationInstance, TIntegrationBound>) => MaybePromise$1<TState>;
|
|
988
|
+
runtime?: FarmPluginRuntimeHooks<TState, TRequestContext, TIntegrationInstance, TIntegrationBound>;
|
|
989
|
+
router?: FarmPluginRouterHooks<TState, TIntegrationInstance, TIntegrationBound>;
|
|
990
|
+
render?: FarmPluginRenderHooks<TState, TIntegrationInstance, TIntegrationBound>;
|
|
991
|
+
build?: FarmPluginBuildHooks<TState, TIntegrationInstance, TIntegrationBound>;
|
|
992
|
+
dev?: FarmPluginDevHooks<TState, TIntegrationInstance, TIntegrationBound>;
|
|
993
|
+
/** Optional browser lifecycle for this logical plugin. */
|
|
994
|
+
client?: FarmPluginClientConfig<TClientState, TClientPublic>;
|
|
995
|
+
/** @internal Carries the expected integration instance type without runtime data. */
|
|
996
|
+
readonly [FARM_PLUGIN_INTEGRATION_INSTANCE]?: (instance: TIntegrationInstance) => void;
|
|
997
|
+
/** @internal Prevents integration-bound plugins from being registered globally. */
|
|
998
|
+
readonly [FARM_PLUGIN_INTEGRATION_BOUND]?: TIntegrationBound;
|
|
999
|
+
/** @deprecated Use `setup` instead. */
|
|
1000
|
+
init?: (context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1001
|
+
/** @deprecated Use `runtime.start` instead. */
|
|
1002
|
+
ready?: (context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1003
|
+
/** @deprecated Use `dev.server` instead. */
|
|
1004
|
+
devServerCreated?: (viteServer: ViteDevServer, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1005
|
+
/** @deprecated Use `configure` instead. */
|
|
1006
|
+
config?: (config: FarmConfig, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => FarmConfig | Promise<FarmConfig>;
|
|
1007
|
+
configResolved?: (config: FarmConfig, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1008
|
+
/** @deprecated Use `build.before` instead. */
|
|
1009
|
+
buildStart?: (context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1010
|
+
/** @deprecated Use `build.after` instead. */
|
|
1011
|
+
buildEnd?: (context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1012
|
+
/** @deprecated Use `router.discovered` instead. */
|
|
1013
|
+
routeDiscovered?: (route: RouteDiscoveredPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1014
|
+
/** @deprecated Use `router.generated` instead. */
|
|
1015
|
+
routesGenerated?: (routes: RoutesGeneratedPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1016
|
+
/** @deprecated Use `router.discovered` instead. */
|
|
1017
|
+
middlewareDiscovered?: (middleware: MiddlewareDiscoveredPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1018
|
+
/** @deprecated Use `router.discovered` instead. */
|
|
1019
|
+
apiRouteDiscovered?: (route: APIRouteDiscoveredPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1020
|
+
/** @deprecated Use `router.before` instead. */
|
|
1021
|
+
beforeRouteMatch?: (route: RouteMatchPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1022
|
+
/** @deprecated Use `router.after` instead. */
|
|
1023
|
+
afterRouteMatch?: (result: RouteMatchResultPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1024
|
+
/** @deprecated Use `render.before` instead. */
|
|
1025
|
+
beforeRender?: (render: RenderLifecyclePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1026
|
+
/** @deprecated Use `render.html` instead. */
|
|
1027
|
+
afterRender?: (html: string, render: RenderLifecyclePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => string | Promise<string> | void | Promise<void>;
|
|
1028
|
+
/** @deprecated Use `runtime.before` instead. */
|
|
1029
|
+
beforeApiHandler?: (request: Request, api: APIHandlerLifecyclePayload, context: FarmRequestPluginContextFor<TIntegrationInstance, TIntegrationBound>) => Request | Promise<Request> | void | Promise<void>;
|
|
1030
|
+
/** @deprecated Use `runtime.after` instead. */
|
|
1031
|
+
afterApiHandler?: (response: Response, api: APIHandlerLifecyclePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => Response | Promise<Response> | void | Promise<void>;
|
|
1032
|
+
onError?: (error: ErrorLifecyclePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1033
|
+
/** @deprecated Use `dev.update` instead. */
|
|
1034
|
+
hmrUpdate?: (update: HMRUpdatePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1035
|
+
/** @deprecated Use `build.before` instead. */
|
|
1036
|
+
beforeBundle?: (bundle: BundleLifecyclePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1037
|
+
/** @deprecated Use `build.after` instead. */
|
|
1038
|
+
afterBundle?: (result: BundleResultPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1039
|
+
/** @deprecated Use `build.configure` instead. */
|
|
1040
|
+
beforeNitroBuild?: (nitroConfig: any, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => any | Promise<any>;
|
|
1041
|
+
afterNitroBuild?: (payload: NitroBuildLifecyclePayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1042
|
+
/** @deprecated Use `runtime.close` instead. */
|
|
1043
|
+
shutdown?: (payload: ShutdownPayload, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1044
|
+
/** @deprecated Use the Web Request based `runtime.before` hook instead. */
|
|
1045
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmRequestPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1046
|
+
/** @deprecated Use the Web Response based `runtime.after` hook instead. */
|
|
1047
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmRequestPluginContextFor<TIntegrationInstance, TIntegrationBound>) => void | Promise<void>;
|
|
1048
|
+
/** @deprecated Use `render.html` instead. */
|
|
1049
|
+
transformHTML?: (html: string, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => string | Promise<string>;
|
|
1050
|
+
/** @deprecated Use `render.before` or `render.html` instead. */
|
|
1051
|
+
transformPage?: (component: any, context: FarmPluginContextFor<TIntegrationInstance, TIntegrationBound>) => any | Promise<any>;
|
|
1052
|
+
}
|
|
1053
|
+
declare class PluginManager {
|
|
1054
|
+
private plugins;
|
|
1055
|
+
private hookPresence;
|
|
1056
|
+
private runtimeHookPresence;
|
|
1057
|
+
private context;
|
|
1058
|
+
private pluginStates;
|
|
1059
|
+
private setupComplete;
|
|
1060
|
+
private initialized;
|
|
1061
|
+
private runtimeReady;
|
|
1062
|
+
private runtimeClosed;
|
|
1063
|
+
private runtimeStartPromise?;
|
|
1064
|
+
private runtimeClosePromise?;
|
|
1065
|
+
private runtimeShutdownHooksRunning;
|
|
1066
|
+
private runtimeDisposers;
|
|
1067
|
+
private runtimeRequestContexts;
|
|
1068
|
+
private failedRuntimeSessions;
|
|
1069
|
+
constructor(context: Omit<FarmPluginContext, "requestContext" | "lifecycle">);
|
|
1070
|
+
private createPluginHookContext;
|
|
1071
|
+
private createRequestHookContext;
|
|
1072
|
+
private copyRequestStore;
|
|
1073
|
+
private copyRuntimeRequestContext;
|
|
1074
|
+
private createRuntimeBaseEvent;
|
|
1075
|
+
private createRuntimeRequestContext;
|
|
1076
|
+
private runRuntimeErrorHooks;
|
|
1077
|
+
private createStateHookContext;
|
|
1078
|
+
private getPluginHooks;
|
|
1079
|
+
private getHookContext;
|
|
1080
|
+
addPlugin(plugin: FarmPlugin): void;
|
|
1081
|
+
addPlugins(plugins: FarmPlugin[]): void;
|
|
1082
|
+
getPlugins(): FarmPlugin[];
|
|
1083
|
+
getSortedPlugins(): FarmPlugin[];
|
|
1084
|
+
hasHook(hookName: keyof FarmPlugin): boolean;
|
|
1085
|
+
hasRuntimeHook(hookName: "context" | "before" | "after" | "error"): boolean;
|
|
1086
|
+
hasRuntimeRequestHooks(): boolean;
|
|
1087
|
+
copyRequestContext(source: FarmRequest | Request, target: FarmRequest | Request): void;
|
|
1088
|
+
setupPlugins(): Promise<void>;
|
|
1089
|
+
startRuntime(): Promise<void>;
|
|
1090
|
+
closeRuntime(reason?: string): Promise<void>;
|
|
1091
|
+
beginRuntimeRequest(request: Request, options?: FarmPluginRuntimeRequestOptions): Promise<FarmPluginRuntimeSession>;
|
|
1092
|
+
endRuntimeRequest(session: FarmPluginRuntimeSession, initialResponse: Response): Promise<Response>;
|
|
1093
|
+
failRuntimeRequest(session: FarmPluginRuntimeSession, error: unknown): Promise<void>;
|
|
1094
|
+
runRuntimeRequest(request: Request, handler: FarmPluginRuntimeRequestHandler, options?: FarmPluginRuntimeRequestOptions): Promise<Response>;
|
|
1095
|
+
runHook<K extends keyof FarmPlugin>(hookName: K, ...args: any[]): Promise<any>;
|
|
1096
|
+
runHookSerial<K extends keyof FarmPlugin>(hookName: K, initialValue: any, ...args: any[]): Promise<any>;
|
|
1097
|
+
runHookParallel<K extends keyof FarmPlugin>(hookName: K, ...args: any[]): Promise<boolean>;
|
|
1098
|
+
/** @internal Runs hooks for only the plugins selected by the runtime adapter. */
|
|
1099
|
+
runHookParallelFiltered<K extends keyof FarmPlugin>(hookName: K, include: (plugin: FarmPlugin) => boolean, ...args: any[]): Promise<boolean>;
|
|
1100
|
+
updateContext(updates: Partial<FarmPluginContext>): void;
|
|
1101
|
+
}
|
|
1102
|
+
declare function definePlugin<TState = undefined, TRequestContext extends object = Record<string, never>, TClientState = unknown, TClientPublic = undefined, TIntegrationInstance = unknown>(plugin: FarmPlugin<TState, TRequestContext, TClientState, TClientPublic, TIntegrationInstance, false>): FarmPlugin<TState, TRequestContext, TClientState, TClientPublic, TIntegrationInstance, false>;
|
|
1103
|
+
declare namespace definePlugin {
|
|
1104
|
+
/** Bind an integration instance type while preserving inference for plugin state and context. */
|
|
1105
|
+
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>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
type FarmIntegrationCategory = "auth" | "payment" | "monitoring" | "logging" | (string & {});
|
|
1109
|
+
/** @deprecated Use FarmIntegrationCategory instead. */
|
|
1110
|
+
type FarmIntegrationSlot = FarmIntegrationCategory;
|
|
1111
|
+
type FarmIntegrationRouteParamValue = string | string[];
|
|
1112
|
+
type FarmIntegrationRouteParams = Record<string, FarmIntegrationRouteParamValue>;
|
|
1113
|
+
type FarmIntegrationRouteMethod = FarmIntegrationAPIMethod | Lowercase<FarmIntegrationAPIMethod> | "ALL" | "all";
|
|
1114
|
+
type FarmIntegrationRouteInputSource = "body" | "query";
|
|
1115
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
1116
|
+
type FarmIntegrationValidationPathSegment = PropertyKey | {
|
|
1117
|
+
readonly key: PropertyKey;
|
|
1118
|
+
};
|
|
1119
|
+
interface FarmIntegrationRouteInput<TBody = unknown, TQuery = unknown> {
|
|
1120
|
+
body?: TBody;
|
|
1121
|
+
query?: TQuery;
|
|
1122
|
+
}
|
|
1123
|
+
interface FarmIntegrationValidationIssue {
|
|
1124
|
+
source: FarmIntegrationRouteInputSource;
|
|
1125
|
+
path?: readonly (string | number)[];
|
|
1126
|
+
code?: string;
|
|
1127
|
+
message: string;
|
|
1128
|
+
}
|
|
1129
|
+
interface FarmIntegrationValidationErrorLike {
|
|
1130
|
+
issues?: readonly {
|
|
1131
|
+
path?: readonly FarmIntegrationValidationPathSegment[];
|
|
1132
|
+
code?: string;
|
|
1133
|
+
message?: string;
|
|
1134
|
+
}[];
|
|
1135
|
+
message?: string;
|
|
1136
|
+
}
|
|
1137
|
+
type FarmIntegrationValidationResult<TValue> = {
|
|
1138
|
+
success: true;
|
|
1139
|
+
data: TValue;
|
|
1140
|
+
} | {
|
|
1141
|
+
success: false;
|
|
1142
|
+
error: FarmIntegrationValidationErrorLike;
|
|
1143
|
+
};
|
|
1144
|
+
type FarmIntegrationStandardValidationResult<TValue> = {
|
|
1145
|
+
value: TValue;
|
|
1146
|
+
} | {
|
|
1147
|
+
issues: readonly {
|
|
1148
|
+
path?: readonly FarmIntegrationValidationPathSegment[];
|
|
1149
|
+
code?: string;
|
|
1150
|
+
message: string;
|
|
1151
|
+
}[];
|
|
1152
|
+
};
|
|
1153
|
+
interface FarmIntegrationInputSchema<TValue = unknown> {
|
|
1154
|
+
_output?: TValue;
|
|
1155
|
+
parse?(value: unknown): MaybePromise<TValue>;
|
|
1156
|
+
safeParse?(value: unknown): MaybePromise<FarmIntegrationValidationResult<TValue>>;
|
|
1157
|
+
safeParseAsync?(value: unknown): Promise<FarmIntegrationValidationResult<TValue>>;
|
|
1158
|
+
"~standard"?: {
|
|
1159
|
+
validate(value: unknown): MaybePromise<FarmIntegrationStandardValidationResult<TValue>>;
|
|
1160
|
+
types?: {
|
|
1161
|
+
output: TValue;
|
|
1162
|
+
};
|
|
1163
|
+
};
|
|
1164
|
+
}
|
|
1165
|
+
interface FarmIntegrationRouteInputSchemas<TBody = unknown, TQuery = unknown> {
|
|
1166
|
+
body?: FarmIntegrationInputSchema<TBody>;
|
|
1167
|
+
query?: FarmIntegrationInputSchema<TQuery>;
|
|
1168
|
+
}
|
|
1169
|
+
/** @deprecated Use `FarmRequestStore` and access it through `ctx.req`. */
|
|
1170
|
+
type FarmIntegrationRequestContextStore = FarmRequestStore;
|
|
1171
|
+
declare const FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY = "farm.integration.internalDispatch";
|
|
1172
|
+
type FarmIntegrationRouteDb<TSchema extends FarmIntegrationSchema | undefined> = InferFarmIntegrationOrmClient<TSchema>;
|
|
1173
|
+
interface FarmIntegrationRouteStorageArgs<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1174
|
+
getClient(): Promise<unknown | undefined>;
|
|
1175
|
+
getOrm(): Promise<FarmIntegrationRouteDb<TSchema>>;
|
|
1176
|
+
}
|
|
1177
|
+
interface FarmIntegrationRouteArgs<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1178
|
+
db: FarmIntegrationRouteDb<TSchema>;
|
|
1179
|
+
getDb(): Promise<FarmIntegrationRouteDb<TSchema>>;
|
|
1180
|
+
storage: FarmIntegrationRouteStorageArgs<TSchema>;
|
|
1181
|
+
}
|
|
1182
|
+
interface FarmIntegrationConfigContext<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1183
|
+
key: string;
|
|
1184
|
+
integration: FarmIntegration<TSchema, any>;
|
|
1185
|
+
appConfig: FarmPluginContext["config"];
|
|
1186
|
+
/** Alias for appConfig. */
|
|
1187
|
+
config: FarmPluginContext["config"];
|
|
1188
|
+
args: FarmIntegrationRouteArgs<TSchema>;
|
|
1189
|
+
env: Record<string, string | undefined>;
|
|
1190
|
+
isDev: boolean;
|
|
1191
|
+
isProd: boolean;
|
|
1192
|
+
}
|
|
1193
|
+
interface FarmIntegrationConfigDefinition<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1194
|
+
schema?: FarmIntegrationInputSchema<TConfig>;
|
|
1195
|
+
env?: Record<string, string | readonly string[]>;
|
|
1196
|
+
defaults?: Partial<TConfig> | ((context: FarmIntegrationConfigContext<TSchema>) => MaybePromise<Partial<TConfig>>);
|
|
1197
|
+
input?: Partial<TConfig> | ((context: FarmIntegrationConfigContext<TSchema>) => MaybePromise<Partial<TConfig>>);
|
|
1198
|
+
resolve?(context: FarmIntegrationConfigContext<TSchema>): MaybePromise<TConfig | Partial<TConfig> | undefined>;
|
|
1199
|
+
}
|
|
1200
|
+
type FarmIntegrationConfigInput<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = FarmIntegrationInputSchema<TConfig> | FarmIntegrationConfigDefinition<TConfig, TSchema>;
|
|
1201
|
+
type FarmIntegrationLifecycleLogLevel = "info" | "warn" | "error";
|
|
1202
|
+
interface FarmIntegrationLifecycleLogger {
|
|
1203
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
1204
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
1205
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
1206
|
+
}
|
|
1207
|
+
interface FarmIntegrationLifecycleContext<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationConfigContext<TSchema> {
|
|
1208
|
+
integration: FarmIntegration<TSchema, TConfig>;
|
|
1209
|
+
integrationConfig: TConfig;
|
|
1210
|
+
log: FarmIntegrationLifecycleLogger;
|
|
1211
|
+
reason?: string;
|
|
1212
|
+
cleanup(callback?: () => MaybePromise<void>): Promise<void>;
|
|
1213
|
+
}
|
|
1214
|
+
type FarmIntegrationLifecycleHook<TConfig = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = (context: FarmIntegrationLifecycleContext<TConfig, TSchema>) => MaybePromise<void>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Small per-call integration metadata. Values received over HTTP are
|
|
1217
|
+
* client-controlled and should be validated before authorization decisions.
|
|
1218
|
+
*/
|
|
1219
|
+
type FarmIntegrationData = Record<string, unknown>;
|
|
1220
|
+
interface FarmIntegrationHandlerContext<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1221
|
+
request: Request;
|
|
1222
|
+
requestId: string;
|
|
1223
|
+
url: URL;
|
|
1224
|
+
pathname: string;
|
|
1225
|
+
method: string;
|
|
1226
|
+
params: FarmIntegrationRouteParams;
|
|
1227
|
+
input: FarmIntegrationRouteInput<TBody, TQuery>;
|
|
1228
|
+
args: FarmIntegrationRouteArgs<TSchema>;
|
|
1229
|
+
data: FarmIntegrationData;
|
|
1230
|
+
integration: {
|
|
1231
|
+
category: FarmIntegrationCategory;
|
|
1232
|
+
/** @deprecated Use category instead. */
|
|
1233
|
+
slot: FarmIntegrationCategory;
|
|
1234
|
+
type: string;
|
|
1235
|
+
instance: unknown;
|
|
1236
|
+
};
|
|
1237
|
+
route: {
|
|
1238
|
+
kind: "route" | "middleware";
|
|
1239
|
+
path: string;
|
|
1240
|
+
methods: readonly string[];
|
|
1241
|
+
};
|
|
1242
|
+
req: FarmRequestStore;
|
|
1243
|
+
/** @deprecated Use `req` instead. */
|
|
1244
|
+
requestContext: FarmRequestStore;
|
|
1245
|
+
config: FarmPluginContext["config"];
|
|
1246
|
+
isDev: boolean;
|
|
1247
|
+
isProd: boolean;
|
|
1248
|
+
}
|
|
1249
|
+
interface FarmIntegrationRouteHookContext<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationHandlerContext<TBody, TQuery, TSchema> {
|
|
1250
|
+
response?: Response;
|
|
1251
|
+
}
|
|
1252
|
+
type FarmIntegrationRouteHook<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = {
|
|
1253
|
+
bivarianceHack(request: Request, context: FarmIntegrationRouteHookContext<TBody, TQuery, TSchema>): Promise<Response | void> | Response | void;
|
|
1254
|
+
}["bivarianceHack"];
|
|
1255
|
+
interface FarmIntegrationRoute<TBody = unknown, TQuery = unknown, TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1256
|
+
path: string;
|
|
1257
|
+
method?: FarmIntegrationRouteMethod;
|
|
1258
|
+
methods?: readonly FarmIntegrationRouteMethod[];
|
|
1259
|
+
middleware?: readonly FarmIntegrationRouteMiddleware<TSchema>[];
|
|
1260
|
+
before?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
1261
|
+
after?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
1262
|
+
rawBody?: boolean;
|
|
1263
|
+
bodyFormat?: FarmIntegrationAPIBodyFormat;
|
|
1264
|
+
body?: FarmIntegrationInputSchema<TBody>;
|
|
1265
|
+
query?: FarmIntegrationInputSchema<TQuery>;
|
|
1266
|
+
input?: FarmIntegrationRouteInputSchemas<TBody, TQuery>;
|
|
1267
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<TBody, TQuery, TSchema>): Promise<Response> | Response;
|
|
1268
|
+
}
|
|
1269
|
+
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> {
|
|
1270
|
+
path: TPath;
|
|
1271
|
+
method: TMethod;
|
|
1272
|
+
__operation: FarmIntegrationAPIOperation<TBody, TQuery, TResponse, TServer, TMethod>;
|
|
1273
|
+
}
|
|
1274
|
+
interface FarmIntegrationRouteMiddleware<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1275
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<unknown, unknown, TSchema>): Promise<Response | void> | Response | void;
|
|
1276
|
+
}
|
|
1277
|
+
interface FarmIntegrationMiddleware<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1278
|
+
matcher?: string | string[];
|
|
1279
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<unknown, unknown, TSchema>): Promise<Response | void> | Response | void;
|
|
1280
|
+
}
|
|
1281
|
+
interface FarmIntegrationProviderProps {
|
|
1282
|
+
children: ReactNode;
|
|
1283
|
+
}
|
|
1284
|
+
interface FarmIntegrationProvider {
|
|
1285
|
+
name: string;
|
|
1286
|
+
type: string;
|
|
1287
|
+
props?: Record<string, unknown>;
|
|
1288
|
+
component?: ComponentType<FarmIntegrationProviderProps>;
|
|
1289
|
+
}
|
|
1290
|
+
interface FarmIntegrationDocumentNavigation {
|
|
1291
|
+
matcher: string | readonly string[];
|
|
1292
|
+
}
|
|
1293
|
+
type FarmIntegrationSchemaFieldType = "id" | "uuid" | "string" | "text" | "boolean" | "integer" | "number" | "datetime" | "json" | "enum";
|
|
1294
|
+
interface FarmIntegrationSchemaReference {
|
|
1295
|
+
model: string;
|
|
1296
|
+
field: string;
|
|
1297
|
+
relation?: "belongsTo" | "hasOne" | "hasMany";
|
|
1298
|
+
onDelete?: "cascade" | "restrict" | "setNull" | "noAction";
|
|
1299
|
+
enforced?: "db" | "app" | "none";
|
|
1300
|
+
}
|
|
1301
|
+
interface FarmIntegrationSchemaField {
|
|
1302
|
+
type: FarmIntegrationSchemaFieldType;
|
|
1303
|
+
name?: string;
|
|
1304
|
+
description?: string;
|
|
1305
|
+
required?: boolean;
|
|
1306
|
+
nullable?: boolean;
|
|
1307
|
+
primaryKey?: boolean;
|
|
1308
|
+
unique?: boolean;
|
|
1309
|
+
index?: boolean;
|
|
1310
|
+
list?: boolean;
|
|
1311
|
+
default?: unknown;
|
|
1312
|
+
values?: readonly string[];
|
|
1313
|
+
reference?: FarmIntegrationSchemaReference;
|
|
1314
|
+
meta?: Record<string, unknown>;
|
|
1315
|
+
}
|
|
1316
|
+
interface FarmIntegrationSchemaConstraint {
|
|
1317
|
+
type: "unique" | "index";
|
|
1318
|
+
fields: readonly string[];
|
|
1319
|
+
name?: string;
|
|
1320
|
+
meta?: Record<string, unknown>;
|
|
1321
|
+
}
|
|
1322
|
+
interface FarmIntegrationSchemaModel {
|
|
1323
|
+
name?: string;
|
|
1324
|
+
description?: string;
|
|
1325
|
+
fields: Record<string, FarmIntegrationSchemaField>;
|
|
1326
|
+
constraints?: readonly FarmIntegrationSchemaConstraint[];
|
|
1327
|
+
meta?: Record<string, unknown>;
|
|
1328
|
+
}
|
|
1329
|
+
interface FarmIntegrationSchemaModelExtension {
|
|
1330
|
+
name?: string;
|
|
1331
|
+
description?: string;
|
|
1332
|
+
fields?: Record<string, FarmIntegrationSchemaField>;
|
|
1333
|
+
constraints?: readonly FarmIntegrationSchemaConstraint[];
|
|
1334
|
+
meta?: Record<string, unknown>;
|
|
1335
|
+
}
|
|
1336
|
+
interface FarmIntegrationSchemaModelOverride {
|
|
1337
|
+
name?: string;
|
|
1338
|
+
description?: string;
|
|
1339
|
+
fields?: Record<string, Partial<FarmIntegrationSchemaField>>;
|
|
1340
|
+
constraints?: readonly FarmIntegrationSchemaConstraint[];
|
|
1341
|
+
meta?: Record<string, unknown>;
|
|
1342
|
+
}
|
|
1343
|
+
interface FarmIntegrationSchema {
|
|
1344
|
+
models: Record<string, FarmIntegrationSchemaModel>;
|
|
1345
|
+
meta?: Record<string, unknown>;
|
|
1346
|
+
extend?: Record<string, FarmIntegrationSchemaModelExtension>;
|
|
1347
|
+
override?: Record<string, FarmIntegrationSchemaModelOverride>;
|
|
1348
|
+
}
|
|
1349
|
+
declare function defineIntegrationSchema<TSchema extends FarmIntegrationSchema>(schema: TSchema): TSchema;
|
|
1350
|
+
type FarmIntegrationLogPhase = "registered" | "validate" | "setup" | "ready" | "dispose" | "request:start" | "request:end" | "request:error";
|
|
1351
|
+
interface FarmIntegrationLogEvent {
|
|
1352
|
+
category: FarmIntegrationCategory;
|
|
1353
|
+
/** @deprecated Use category instead. */
|
|
1354
|
+
slot: FarmIntegrationCategory;
|
|
1355
|
+
type: string;
|
|
1356
|
+
phase: FarmIntegrationLogPhase;
|
|
1357
|
+
route?: {
|
|
1358
|
+
kind: "route" | "middleware";
|
|
1359
|
+
path: string;
|
|
1360
|
+
methods: readonly string[];
|
|
1361
|
+
};
|
|
1362
|
+
requestId?: string;
|
|
1363
|
+
request?: Request;
|
|
1364
|
+
response?: Response;
|
|
1365
|
+
error?: unknown;
|
|
1366
|
+
durationMs?: number;
|
|
1367
|
+
level?: FarmIntegrationLifecycleLogLevel;
|
|
1368
|
+
message?: string;
|
|
1369
|
+
meta?: Record<string, unknown>;
|
|
1370
|
+
context: Map<string, unknown>;
|
|
1371
|
+
}
|
|
1372
|
+
type FarmIntegrationLogger = (event: FarmIntegrationLogEvent) => void | Promise<void>;
|
|
1373
|
+
interface FarmIntegrationPluginOwner {
|
|
1374
|
+
key: string;
|
|
1375
|
+
category: FarmIntegrationCategory;
|
|
1376
|
+
type: string;
|
|
1377
|
+
source: "lifecycle" | "contribution";
|
|
1378
|
+
serverRuntime: boolean;
|
|
1379
|
+
}
|
|
1380
|
+
/** A normal plugin or an integration-bound plugin compatible with the shared instance. */
|
|
1381
|
+
type FarmIntegrationContributedPlugin<TInstance = unknown> = FarmPlugin<any, any, any, any, unknown, false> | FarmPlugin<any, any, any, any, TInstance, true>;
|
|
1382
|
+
interface FarmIntegration<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined, TConfig = unknown, TInstance = unknown> {
|
|
1383
|
+
readonly kind: "farm-integration";
|
|
1384
|
+
category: FarmIntegrationCategory;
|
|
1385
|
+
/** @deprecated Use category instead. */
|
|
1386
|
+
slot?: FarmIntegrationCategory;
|
|
1387
|
+
type: string;
|
|
1388
|
+
instance: TInstance;
|
|
1389
|
+
/** Set to false when a platform adapter owns this integration's production routes. */
|
|
1390
|
+
serverRuntime?: boolean;
|
|
1391
|
+
api?: FarmIntegrationAPI;
|
|
1392
|
+
schema?: TSchema;
|
|
1393
|
+
config?: FarmIntegrationConfigInput<TConfig, TSchema>;
|
|
1394
|
+
validate?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
1395
|
+
setup?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
1396
|
+
ready?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
1397
|
+
dispose?: FarmIntegrationLifecycleHook<TConfig, TSchema>;
|
|
1398
|
+
log?: FarmIntegrationLogger;
|
|
1399
|
+
routes?: readonly FarmIntegrationRoute<any, any, TSchema>[];
|
|
1400
|
+
endpoints?: FarmIntegrationEndpoints<TSchema>;
|
|
1401
|
+
middleware?: readonly FarmIntegrationMiddleware<TSchema>[];
|
|
1402
|
+
providers?: readonly FarmIntegrationProvider[];
|
|
1403
|
+
documentNavigations?: readonly FarmIntegrationDocumentNavigation[];
|
|
1404
|
+
/** Additional Farm plugins owned and configured by this integration. */
|
|
1405
|
+
plugins?: readonly FarmIntegrationContributedPlugin<NoInfer<TInstance>>[];
|
|
1406
|
+
}
|
|
1407
|
+
type FarmIntegrationsUserConfig = Record<string, FarmIntegration<any, any, any> | undefined>;
|
|
1408
|
+
/** @internal Identifies plugins owned by platform-managed integrations. */
|
|
1409
|
+
declare function getFarmIntegrationPluginServerRuntime(plugin: FarmPlugin): boolean | undefined;
|
|
1410
|
+
/** Returns the integration that contributed a normalized plugin, when applicable. */
|
|
1411
|
+
declare function getFarmIntegrationPluginOwner(plugin: FarmPlugin): Readonly<FarmIntegrationPluginOwner> | undefined;
|
|
1412
|
+
type IntegrationRouteBuilderOptions<TBody, TQuery, TServer extends boolean, TSchema extends FarmIntegrationSchema | undefined> = {
|
|
1413
|
+
middleware?: readonly FarmIntegrationRouteMiddleware<TSchema>[];
|
|
1414
|
+
before?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
1415
|
+
after?: readonly FarmIntegrationRouteHook<TBody, TQuery, TSchema>[];
|
|
1416
|
+
rawBody?: boolean;
|
|
1417
|
+
headers?: Record<string, string>;
|
|
1418
|
+
credentials?: RequestCredentials;
|
|
1419
|
+
bodyFormat?: FarmIntegrationAPIBodyFormat;
|
|
1420
|
+
responseFormat?: FarmIntegrationAPIResponseFormat;
|
|
1421
|
+
isServer?: TServer;
|
|
1422
|
+
body?: FarmIntegrationInputSchema<TBody>;
|
|
1423
|
+
query?: FarmIntegrationInputSchema<TQuery>;
|
|
1424
|
+
input?: FarmIntegrationRouteInputSchemas<TBody, TQuery>;
|
|
1425
|
+
handler(request: Request, context: FarmIntegrationHandlerContext<TBody, TQuery, TSchema>): Promise<Response> | Response;
|
|
1426
|
+
};
|
|
1427
|
+
interface FarmIntegrationRouteFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1428
|
+
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>;
|
|
1429
|
+
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>;
|
|
1430
|
+
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>;
|
|
1431
|
+
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>;
|
|
1432
|
+
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>;
|
|
1433
|
+
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>;
|
|
1434
|
+
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>;
|
|
1435
|
+
}
|
|
1436
|
+
interface FarmIntegrationRoutesFactoryContext<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> {
|
|
1437
|
+
route: FarmIntegrationRouteFactory<TSchema>;
|
|
1438
|
+
integrationRoute: FarmIntegrationRouteFactory<TSchema>;
|
|
1439
|
+
}
|
|
1440
|
+
type FarmIntegrationRoutesFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = (context: FarmIntegrationRoutesFactoryContext<TSchema>) => readonly FarmIntegrationRoute<any, any, TSchema>[];
|
|
1441
|
+
type FarmIntegrationEndpointValue<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = FarmIntegrationRoute<any, any, TSchema> | readonly FarmIntegrationEndpointValue<TSchema>[] | {
|
|
1442
|
+
readonly [key: string]: FarmIntegrationEndpointValue<TSchema> | undefined;
|
|
1443
|
+
};
|
|
1444
|
+
type FarmIntegrationEndpoints<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = {
|
|
1445
|
+
readonly [key: string]: FarmIntegrationEndpointValue<TSchema> | undefined;
|
|
1446
|
+
};
|
|
1447
|
+
interface FarmIntegrationEndpointsFactoryContext<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> extends FarmIntegrationRoutesFactoryContext<TSchema> {
|
|
1448
|
+
endpoint: FarmIntegrationRouteFactory<TSchema>;
|
|
1449
|
+
}
|
|
1450
|
+
type FarmIntegrationEndpointsFactory<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = (context: FarmIntegrationEndpointsFactoryContext<TSchema>) => FarmIntegrationEndpoints<TSchema>;
|
|
1451
|
+
declare function createIntegrationRoute<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined>(_schema?: TSchema): FarmIntegrationRouteFactory<TSchema>;
|
|
1452
|
+
declare const integrationRoute: FarmIntegrationRouteFactory<undefined>;
|
|
1453
|
+
type RegisteredIntegrationRuntime = {
|
|
1454
|
+
integration: FarmIntegration;
|
|
1455
|
+
config: FarmPluginContext["config"];
|
|
1456
|
+
isDev: boolean;
|
|
1457
|
+
isProd: boolean;
|
|
1458
|
+
};
|
|
1459
|
+
type FarmIntegrationRoutesInput<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = readonly FarmIntegrationRoute<any, any, TSchema>[] | FarmIntegrationRoutesFactory<TSchema>;
|
|
1460
|
+
type FarmIntegrationEndpointsInput<TSchema extends FarmIntegrationSchema | undefined = FarmIntegrationSchema | undefined> = FarmIntegrationEndpoints<TSchema> | FarmIntegrationEndpointsFactory<TSchema>;
|
|
1461
|
+
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"> & {
|
|
1462
|
+
instance: TInstance;
|
|
1463
|
+
config?: FarmIntegrationConfigInput<TConfig, TSchema>;
|
|
1464
|
+
routes?: FarmIntegrationRoutesInput<TSchema>;
|
|
1465
|
+
endpoints?: FarmIntegrationEndpointsInput<TSchema>;
|
|
1466
|
+
plugins?: readonly FarmIntegrationContributedPlugin<NoInfer<TInstance>>[];
|
|
1467
|
+
} & ({
|
|
1468
|
+
category: FarmIntegrationCategory;
|
|
1469
|
+
slot?: FarmIntegrationCategory;
|
|
1470
|
+
} | {
|
|
1471
|
+
category?: FarmIntegrationCategory;
|
|
1472
|
+
slot: FarmIntegrationCategory;
|
|
1473
|
+
});
|
|
1474
|
+
type FarmIntegrationCategoryInput = {
|
|
1475
|
+
category: FarmIntegrationCategory;
|
|
1476
|
+
slot?: FarmIntegrationCategory;
|
|
1477
|
+
} | {
|
|
1478
|
+
category?: FarmIntegrationCategory;
|
|
1479
|
+
slot: FarmIntegrationCategory;
|
|
1480
|
+
};
|
|
1481
|
+
type FarmIntegrationShapeForInference = FarmIntegrationCategoryInput & {
|
|
1482
|
+
api?: FarmIntegrationAPI;
|
|
1483
|
+
schema?: FarmIntegrationSchema;
|
|
1484
|
+
config?: unknown;
|
|
1485
|
+
routes?: unknown;
|
|
1486
|
+
endpoints?: unknown;
|
|
1487
|
+
};
|
|
1488
|
+
type ExtractIntegrationSchema<TIntegration> = TIntegration extends {
|
|
1489
|
+
schema: infer TSchema extends FarmIntegrationSchema;
|
|
1490
|
+
} ? TSchema : undefined;
|
|
1491
|
+
type ResolveIntegrationRoutesInput<TRoutes, TSchema extends FarmIntegrationSchema | undefined> = TRoutes extends FarmIntegrationRoutesFactory<TSchema> ? ReturnType<TRoutes> : TRoutes;
|
|
1492
|
+
type ResolveIntegrationEndpointsInput<TEndpoints, TSchema extends FarmIntegrationSchema | undefined> = TEndpoints extends FarmIntegrationEndpointsFactory<TSchema> ? ReturnType<TEndpoints> : TEndpoints;
|
|
1493
|
+
type ExtractIntegrationRoutesFromRoutesInput<TRoutes, TSchema extends FarmIntegrationSchema | undefined> = ResolveIntegrationRoutesInput<TRoutes, TSchema> extends readonly (infer TRoute)[] ? TRoute : never;
|
|
1494
|
+
type ExtractIntegrationRoutesFromEndpointValue<TValue> = TValue extends FarmIntegrationRouteOperationCarrier<string, any> ? TValue : TValue extends readonly (infer TItem)[] ? ExtractIntegrationRoutesFromEndpointValue<TItem> : TValue extends object ? ExtractIntegrationRoutesFromEndpointValue<TValue[keyof TValue]> : never;
|
|
1495
|
+
type ExtractIntegrationRoutesFromEndpointsInput<TEndpoints, TSchema extends FarmIntegrationSchema | undefined> = ExtractIntegrationRoutesFromEndpointValue<ResolveIntegrationEndpointsInput<TEndpoints, TSchema>>;
|
|
1496
|
+
type ExtractIntegrationRouteUnion<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = (TIntegration extends {
|
|
1497
|
+
routes: infer TRoutes;
|
|
1498
|
+
} ? ExtractIntegrationRoutesFromRoutesInput<TRoutes, TSchema> : never) | (TIntegration extends {
|
|
1499
|
+
endpoints: infer TEndpoints;
|
|
1500
|
+
} ? ExtractIntegrationRoutesFromEndpointsInput<TEndpoints, TSchema> : never);
|
|
1501
|
+
type ExtractDefinedIntegrationRoutes<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = [ExtractIntegrationRouteUnion<TIntegration, TSchema>] extends [never] ? undefined : readonly ExtractIntegrationRouteUnion<TIntegration, TSchema>[];
|
|
1502
|
+
type ExtractDefinedIntegrationEndpoints<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = TIntegration extends {
|
|
1503
|
+
endpoints: infer TEndpoints;
|
|
1504
|
+
} ? ResolveIntegrationEndpointsInput<TEndpoints, TSchema> : undefined;
|
|
1505
|
+
type ExtractIntegrationAPIRoutes<TIntegration, TSchema extends FarmIntegrationSchema | undefined> = Extract<ExtractIntegrationRouteUnion<TIntegration, TSchema>, FarmIntegrationRouteOperationCarrier<string, any>>;
|
|
1506
|
+
type ExtractIntegrationCategory<TIntegration extends FarmIntegrationCategoryInput> = TIntegration extends {
|
|
1507
|
+
category: infer TCategory extends FarmIntegrationCategory;
|
|
1508
|
+
} ? TCategory : TIntegration extends {
|
|
1509
|
+
slot: infer TSlot extends FarmIntegrationCategory;
|
|
1510
|
+
} ? TSlot : FarmIntegrationCategory;
|
|
1511
|
+
type ExtractDerivedIntegrationAPI<TIntegration extends FarmIntegrationShapeForInference, TSchema extends FarmIntegrationSchema | undefined = ExtractIntegrationSchema<TIntegration>> = TIntegration extends {
|
|
1512
|
+
api: infer TAPI extends FarmIntegrationAPI;
|
|
1513
|
+
} ? TAPI : [ExtractIntegrationAPIRoutes<TIntegration, TSchema>] extends [never] ? FarmIntegrationAPI | undefined : InferIntegrationAPIFromRoutes<readonly ExtractIntegrationAPIRoutes<TIntegration, TSchema>[]>;
|
|
1514
|
+
type DefinedIntegration<TIntegration extends FarmIntegrationShapeForInference, TSchema extends FarmIntegrationSchema | undefined = ExtractIntegrationSchema<TIntegration>> = Omit<TIntegration, "kind" | "category" | "slot" | "api" | "routes" | "endpoints"> & {
|
|
1515
|
+
readonly kind: "farm-integration";
|
|
1516
|
+
category: ExtractIntegrationCategory<TIntegration>;
|
|
1517
|
+
slot: ExtractIntegrationCategory<TIntegration>;
|
|
1518
|
+
routes: ExtractDefinedIntegrationRoutes<TIntegration, TSchema>;
|
|
1519
|
+
endpoints: ExtractDefinedIntegrationEndpoints<TIntegration, TSchema>;
|
|
1520
|
+
api: ExtractDerivedIntegrationAPI<TIntegration, TSchema>;
|
|
1521
|
+
};
|
|
1522
|
+
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>;
|
|
1523
|
+
declare function isFarmIntegration(value: unknown): value is FarmIntegration;
|
|
1524
|
+
declare function resolveIntegrationPlugins(integrations: FarmIntegrationsUserConfig | undefined): FarmPlugin[];
|
|
1525
|
+
declare function getIntegrationProviders(integrations: FarmIntegrationsUserConfig | undefined): Array<Pick<FarmIntegrationProvider, "name" | "type" | "props">>;
|
|
1526
|
+
declare function getIntegrationDocumentNavigationMatchers(integrations: FarmIntegrationsUserConfig | undefined): string[];
|
|
1527
|
+
declare function getIntegrationSchemas(integrations: FarmIntegrationsUserConfig | undefined): Record<string, FarmIntegrationSchema>;
|
|
1528
|
+
declare function getRegisteredIntegrationRuntime(key: string): RegisteredIntegrationRuntime | undefined;
|
|
1529
|
+
declare function getRegisteredIntegrations(): Record<string, FarmIntegration>;
|
|
1530
|
+
declare function getRegisteredIntegrationSchemas(): Record<string, FarmIntegrationSchema>;
|
|
1531
|
+
declare function matchIntegrationRoute(integrations: FarmIntegrationsUserConfig | undefined, input: {
|
|
1532
|
+
pathname: string;
|
|
1533
|
+
method?: string;
|
|
1534
|
+
}): {
|
|
1535
|
+
key: string;
|
|
1536
|
+
integration: FarmIntegration;
|
|
1537
|
+
route: {
|
|
1538
|
+
path: string;
|
|
1539
|
+
methods: readonly string[];
|
|
1540
|
+
};
|
|
1541
|
+
params: FarmIntegrationRouteParams;
|
|
1542
|
+
} | null;
|
|
1543
|
+
declare function matchRegisteredIntegrationRoute(input: {
|
|
1544
|
+
pathname: string;
|
|
1545
|
+
method?: string;
|
|
1546
|
+
}): {
|
|
1547
|
+
key: string;
|
|
1548
|
+
integration: FarmIntegration;
|
|
1549
|
+
route: {
|
|
1550
|
+
path: string;
|
|
1551
|
+
methods: readonly string[];
|
|
1552
|
+
};
|
|
1553
|
+
params: FarmIntegrationRouteParams;
|
|
1554
|
+
} | null;
|
|
1555
|
+
declare function getRegisteredIntegrationAPIManifest(): Record<string, FarmIntegrationAPI>;
|
|
1556
|
+
declare function dispatchIntegrationRequest(runtime: RegisteredIntegrationRuntime, request: Request, options?: {
|
|
1557
|
+
currentRequest?: Request;
|
|
1558
|
+
data?: FarmIntegrationData;
|
|
1559
|
+
internal?: boolean;
|
|
1560
|
+
}): Promise<Response | null>;
|
|
1561
|
+
|
|
1562
|
+
declare global {
|
|
1563
|
+
namespace FarmJS {
|
|
1564
|
+
/** @internal Application route patterns registered by generated types. */
|
|
1565
|
+
interface RouteRegistry {
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
/** All generated route module patterns for the current application. */
|
|
1570
|
+
type AppRoutePattern = FarmJS.RouteRegistry extends {
|
|
1571
|
+
pattern: infer TPattern extends string;
|
|
1572
|
+
} ? TPattern : string;
|
|
1573
|
+
type FarmRoutePropsDefault = never;
|
|
1574
|
+
type FarmRoutePropsTarget = AppRoutePattern;
|
|
1575
|
+
type StripPageRouteSuffix<TRoute extends string> = TRoute extends `${infer TPath}?${string}` ? StripPageRouteSuffix<TPath> : TRoute extends `${infer TPath}#${string}` ? StripPageRouteSuffix<TPath> : TRoute;
|
|
1576
|
+
type SimplifyPageRouteParams<TValue> = {
|
|
1577
|
+
[TKey in keyof TValue]: TValue[TKey];
|
|
1578
|
+
} & {};
|
|
1579
|
+
type PageRouteSegmentParams<TSegment extends string> = TSegment extends `[[...${infer TParam}]]` ? {
|
|
1580
|
+
[TKey in TParam]?: string;
|
|
1581
|
+
} : TSegment extends `[...${infer TParam}]` ? {
|
|
1582
|
+
[TKey in TParam]: string;
|
|
1583
|
+
} : TSegment extends `[${infer TParam}]` ? {
|
|
1584
|
+
[TKey in TParam]: string;
|
|
1585
|
+
} : {};
|
|
1586
|
+
type ExtractPageRouteParams<TRoute extends string> = TRoute extends `${infer TSegment}/${infer TRest}` ? PageRouteSegmentParams<TSegment> & ExtractPageRouteParams<TRest> : PageRouteSegmentParams<TRoute>;
|
|
1587
|
+
/** Infer the decoded params received by a page from a route pattern. */
|
|
1588
|
+
type PageRouteParams<TRoute extends string> = string extends TRoute ? Record<string, string> : TRoute extends string ? SimplifyPageRouteParams<ExtractPageRouteParams<StripPageRouteSuffix<TRoute>>> : never;
|
|
1589
|
+
type ResolvePageRouteParams<TRoute extends FarmRoutePropsTarget> = [TRoute] extends [never] ? Record<string, string> : TRoute extends string ? PageRouteParams<TRoute> : Record<string, string>;
|
|
1590
|
+
type NitroPreset = "node-server" | "vercel" | "cloudflare" | "cloudflare-pages" | "netlify" | "netlify-edge" | "bun" | "deno" | "azure" | "aws-lambda" | "firebase" | "custom" | "self-host" | "farm" | string;
|
|
1591
|
+
type FarmMigrationCommand = string | {
|
|
1592
|
+
/** Shell command to run for this migration step. */
|
|
1593
|
+
command: string;
|
|
1594
|
+
/** Optional label printed by the CLI before running the command. */
|
|
1595
|
+
name?: string;
|
|
1596
|
+
/** Working directory for this command, relative to the project root unless absolute. */
|
|
1597
|
+
cwd?: string;
|
|
1598
|
+
/** Additional environment variables for this command. */
|
|
1599
|
+
env?: Record<string, string | undefined>;
|
|
1600
|
+
/** Skip this command without removing it from config. */
|
|
1601
|
+
skip?: boolean;
|
|
1602
|
+
};
|
|
1603
|
+
interface FarmMigrationsConfig {
|
|
1604
|
+
/** One-shot commands that create or update app/integration schemas. */
|
|
1605
|
+
commands?: FarmMigrationCommand[];
|
|
1606
|
+
}
|
|
1607
|
+
type FarmMigrationsUserConfig = FarmMigrationsConfig | FarmMigrationCommand[];
|
|
1608
|
+
interface ResolvedFarmMigrationsConfig {
|
|
1609
|
+
commands: FarmMigrationCommand[];
|
|
1610
|
+
}
|
|
1611
|
+
interface FarmContextFactoryInput {
|
|
1612
|
+
request: Request;
|
|
1613
|
+
rawRequest?: FarmRequest;
|
|
1614
|
+
params: Record<string, string>;
|
|
1615
|
+
search: Record<string, string | string[] | undefined>;
|
|
1616
|
+
path: string;
|
|
1617
|
+
}
|
|
1618
|
+
type FarmContextFactory<TContext = unknown> = (input: FarmContextFactoryInput) => TContext | Promise<TContext>;
|
|
1619
|
+
interface FarmAppContext {
|
|
1620
|
+
}
|
|
1621
|
+
interface FarmConfig {
|
|
1622
|
+
root?: string;
|
|
1623
|
+
/** App source directory. @default "src" */
|
|
1624
|
+
srcDir?: string;
|
|
1625
|
+
extends?: readonly FarmLayerEntry[];
|
|
1626
|
+
/** Resolved layer graph. Populated by config resolution. */
|
|
1627
|
+
layers?: readonly ResolvedFarmLayer[];
|
|
1628
|
+
outDir?: string;
|
|
1629
|
+
basePath?: string;
|
|
1630
|
+
preset?: NitroPreset;
|
|
1631
|
+
deploy?: {
|
|
1632
|
+
target?: "vercel" | "cloudflare" | "netlify" | "node" | string;
|
|
1633
|
+
preset?: NitroPreset;
|
|
1634
|
+
outputDir?: string;
|
|
1635
|
+
output?: string;
|
|
1636
|
+
projectName?: string;
|
|
1637
|
+
vercel?: {
|
|
1638
|
+
outputDirectory?: string;
|
|
1639
|
+
buildCommand?: string;
|
|
1640
|
+
installCommand?: string;
|
|
1641
|
+
framework?: string | null;
|
|
1642
|
+
};
|
|
1643
|
+
cloudflare?: {
|
|
1644
|
+
outputDir?: string;
|
|
1645
|
+
projectName?: string;
|
|
1646
|
+
};
|
|
1647
|
+
netlify?: {
|
|
1648
|
+
outputDir?: string;
|
|
1649
|
+
site?: string;
|
|
1650
|
+
};
|
|
1651
|
+
};
|
|
1652
|
+
storage?: FarmStorageUserConfig;
|
|
1653
|
+
/** Shared application data, route, ISR, and PPR cache. */
|
|
1654
|
+
cache?: FarmCacheUserConfig;
|
|
1655
|
+
integrations?: FarmIntegrationsUserConfig;
|
|
1656
|
+
/** Farm-native authentication. `true` enables email/password auth. */
|
|
1657
|
+
auth?: FarmAuthUserConfig | ResolvedFarmAuthConfig;
|
|
1658
|
+
plugins?: FarmPlugin[];
|
|
1659
|
+
migrations?: FarmMigrationsUserConfig;
|
|
1660
|
+
/** Map portable cron schedules to ordinary GET API routes. */
|
|
1661
|
+
cron?: FarmCronUserConfig | FarmCronResolvedConfig | false;
|
|
1662
|
+
workflows?: FarmWorkflowsUserConfig | boolean;
|
|
1663
|
+
env?: FarmEnvConfig<any, any> | ResolvedFarmEnv;
|
|
1664
|
+
middleware?: FarmMiddlewareConfig;
|
|
1665
|
+
routeRules?: FarmRouteRules;
|
|
1666
|
+
context?: FarmContextFactory<any>;
|
|
1667
|
+
/** Server ingress and trusted-proxy policy. */
|
|
1668
|
+
server?: FarmServerConfig;
|
|
1669
|
+
serverActions?: FarmServerActionsConfig;
|
|
1670
|
+
/** App-wide HTTP security policy. */
|
|
1671
|
+
security?: FarmSecurityConfig | ResolvedFarmSecurityConfig;
|
|
1672
|
+
images?: FarmImageConfig;
|
|
1673
|
+
/** Browser resource scheduling and preload budgets. */
|
|
1674
|
+
performance?: FarmPerformanceConfig;
|
|
1675
|
+
/** Built-in light, dark, and system color-mode runtime. */
|
|
1676
|
+
theme?: FarmThemeConfig | ResolvedFarmThemeConfig | false;
|
|
1677
|
+
i18n?: FarmI18nUserConfig | ResolvedFarmI18nConfig | false;
|
|
1678
|
+
/** Build identifier used to detect stale clients during rolling deployments. */
|
|
1679
|
+
deploymentId?: string;
|
|
1680
|
+
docs?: FarmDocsUserConfig | FarmDocsResolvedConfig;
|
|
1681
|
+
md?: FarmMarkdownUserConfig | FarmMarkdownResolvedConfig | boolean;
|
|
1682
|
+
mdx?: FarmMdxUserConfig | FarmMdxResolvedConfig;
|
|
1683
|
+
observability?: FarmObservabilityUserConfig;
|
|
1684
|
+
/** Development-only runtime inspector. Enabled by default during `farm dev`. */
|
|
1685
|
+
devtools?: FarmDevtoolsUserConfig;
|
|
1686
|
+
/**
|
|
1687
|
+
* When true, Link href is not strictly typed (accepts any string).
|
|
1688
|
+
* Use when you want to skip route-type errors on Link or don't use generated route types.
|
|
1689
|
+
*/
|
|
1690
|
+
suppressLintOnLink?: boolean;
|
|
1691
|
+
experimental?: {
|
|
1692
|
+
serverComponents?: boolean;
|
|
1693
|
+
serverActions?: boolean;
|
|
1694
|
+
/**
|
|
1695
|
+
* Automatically optimize eligible server-only host-element subtrees with
|
|
1696
|
+
* the native Strata renderer. Unsupported trees keep normal React
|
|
1697
|
+
* rendering; no application boundary component is required.
|
|
1698
|
+
*
|
|
1699
|
+
* @experimental
|
|
1700
|
+
* @default false
|
|
1701
|
+
*/
|
|
1702
|
+
optimizedBoundary?: boolean;
|
|
1703
|
+
};
|
|
1704
|
+
vite?: any;
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* Middleware data available in page components
|
|
1708
|
+
*/
|
|
1709
|
+
interface MiddlewareProps {
|
|
1710
|
+
/**
|
|
1711
|
+
* Map containing all data set by middleware via ctx.data.set()
|
|
1712
|
+
*
|
|
1713
|
+
* @example
|
|
1714
|
+
* ```tsx
|
|
1715
|
+
* // In middleware.ts
|
|
1716
|
+
* ctx.data.set('user', { id: 1, name: 'John' });
|
|
1717
|
+
*
|
|
1718
|
+
* // In page.tsx
|
|
1719
|
+
* const user = props.middleware?.data.get('user');
|
|
1720
|
+
* ```
|
|
1721
|
+
*/
|
|
1722
|
+
data: Map<string, any>;
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Plugin context data available in server page components.
|
|
1726
|
+
* Only values explicitly exposed by plugins are included.
|
|
1727
|
+
*/
|
|
1728
|
+
interface PluginContextProps {
|
|
1729
|
+
data: Map<string, any>;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Page component props
|
|
1733
|
+
*
|
|
1734
|
+
* @param params - Dynamic route parameters (e.g., { id: '123' } for /users/[id])
|
|
1735
|
+
* @param searchParams - URL search/query parameters
|
|
1736
|
+
* @param path - Current pathname
|
|
1737
|
+
* @param middleware - Data set by middleware.ts (optional, available if middleware exists)
|
|
1738
|
+
* @param context - Data explicitly exposed by plugins for this request (optional)
|
|
1739
|
+
*/
|
|
1740
|
+
interface PageProps<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> {
|
|
1741
|
+
params: ResolvePageRouteParams<TRoute>;
|
|
1742
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
1743
|
+
path: string;
|
|
1744
|
+
/**
|
|
1745
|
+
* Data from middleware.ts in the same directory or parent directories
|
|
1746
|
+
* Access data via props.middleware?.data.get('key')
|
|
1747
|
+
*
|
|
1748
|
+
* @example
|
|
1749
|
+
* ```tsx
|
|
1750
|
+
* export default function Page(props: PageProps) {
|
|
1751
|
+
* const user = props.middleware?.data.get('user');
|
|
1752
|
+
* const stats = props.middleware?.data.get('dashboardStats');
|
|
1753
|
+
*
|
|
1754
|
+
* return <div>Welcome {user?.name}</div>;
|
|
1755
|
+
* }
|
|
1756
|
+
* ```
|
|
1757
|
+
*/
|
|
1758
|
+
middleware?: MiddlewareProps;
|
|
1759
|
+
/**
|
|
1760
|
+
* Request-scoped plugin context values explicitly exposed by plugins.
|
|
1761
|
+
* Access data via props.context?.data.get('key').
|
|
1762
|
+
*/
|
|
1763
|
+
context?: PluginContextProps;
|
|
1764
|
+
}
|
|
1765
|
+
interface LoadingProps<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> {
|
|
1766
|
+
params: ResolvePageRouteParams<TRoute>;
|
|
1767
|
+
searchParams: Promise<Record<string, string | string[] | undefined>>;
|
|
1768
|
+
search?: Record<string, string | string[] | undefined>;
|
|
1769
|
+
path: string;
|
|
1770
|
+
middleware?: MiddlewareProps;
|
|
1771
|
+
context?: PluginContextProps;
|
|
1772
|
+
}
|
|
1773
|
+
interface ErrorProps<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> extends LoadingProps<TRoute> {
|
|
1774
|
+
error: unknown;
|
|
1775
|
+
reset: () => void;
|
|
1776
|
+
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Helper type to create typed page props with specific middleware data shape
|
|
1779
|
+
*
|
|
1780
|
+
* @example
|
|
1781
|
+
* ```tsx
|
|
1782
|
+
* interface MyMiddlewareData {
|
|
1783
|
+
* user: { id: number; name: string };
|
|
1784
|
+
* stats: { views: number };
|
|
1785
|
+
* }
|
|
1786
|
+
*
|
|
1787
|
+
* type MyPageProps = PagePropsWithMiddleware<MyMiddlewareData>;
|
|
1788
|
+
*
|
|
1789
|
+
* export default function Page(props: MyPageProps) {
|
|
1790
|
+
* const user = props.middleware?.data.get('user'); // Fully typed!
|
|
1791
|
+
* const stats = props.middleware?.data.get('stats'); // Fully typed!
|
|
1792
|
+
*
|
|
1793
|
+
* return <div>Welcome {user?.name}</div>;
|
|
1794
|
+
* }
|
|
1795
|
+
* ```
|
|
1796
|
+
*/
|
|
1797
|
+
type PagePropsWithMiddleware<T extends Record<string, any>, TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = PageProps<TRoute> & {
|
|
1798
|
+
middleware: {
|
|
1799
|
+
data: Map<keyof T, T[keyof T]>;
|
|
1800
|
+
};
|
|
1801
|
+
};
|
|
1802
|
+
interface LayoutProps<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> {
|
|
1803
|
+
children: ReactNode;
|
|
1804
|
+
params: ResolvePageRouteParams<TRoute>;
|
|
1805
|
+
}
|
|
1806
|
+
/** Props passed to a route's `generateMetadata` function. */
|
|
1807
|
+
type MetadataProps<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = PageProps<TRoute>;
|
|
1808
|
+
/** Props passed to a layout's `generateMetadata` function. */
|
|
1809
|
+
interface LayoutMetadataProps<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> {
|
|
1810
|
+
params: ResolvePageRouteParams<TRoute>;
|
|
1811
|
+
}
|
|
1812
|
+
type Page<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = ComponentType<PageProps<TRoute>>;
|
|
1813
|
+
type Layout<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = ComponentType<LayoutProps<TRoute>>;
|
|
1814
|
+
type Loading<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = ComponentType<LoadingProps<TRoute>>;
|
|
1815
|
+
type ErrorBoundary<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = ComponentType<ErrorProps<TRoute>>;
|
|
1816
|
+
/**
|
|
1817
|
+
* Route module exports for pages
|
|
1818
|
+
*
|
|
1819
|
+
* SSR is the default - pages render on each request
|
|
1820
|
+
* SSG is opt-in via `export const ssg = true`, Next-compatible route
|
|
1821
|
+
* config exports, or a top-of-file rendering directive.
|
|
1822
|
+
*
|
|
1823
|
+
* @example SSR Page (default):
|
|
1824
|
+
* ```tsx
|
|
1825
|
+
* export default async function Page() {
|
|
1826
|
+
* const data = await fetchData();
|
|
1827
|
+
* return <div>{data.title}</div>;
|
|
1828
|
+
* }
|
|
1829
|
+
* ```
|
|
1830
|
+
*
|
|
1831
|
+
* @example SSG Page:
|
|
1832
|
+
* ```tsx
|
|
1833
|
+
* export const ssg = true;
|
|
1834
|
+
*
|
|
1835
|
+
* export default function AboutPage() {
|
|
1836
|
+
* return <h1>About Us</h1>;
|
|
1837
|
+
* }
|
|
1838
|
+
* ```
|
|
1839
|
+
*
|
|
1840
|
+
* @example SSG with Revalidation (ISR):
|
|
1841
|
+
* ```tsx
|
|
1842
|
+
* export const ssg = true;
|
|
1843
|
+
* export const revalidate = 60; // Regenerate every 60 seconds
|
|
1844
|
+
*
|
|
1845
|
+
* export default async function ProductsPage() {
|
|
1846
|
+
* const products = await fetchProducts();
|
|
1847
|
+
* return <ProductList products={products} />;
|
|
1848
|
+
* }
|
|
1849
|
+
* ```
|
|
1850
|
+
*
|
|
1851
|
+
* @example Dynamic SSG Route:
|
|
1852
|
+
* ```tsx
|
|
1853
|
+
* export const ssg = true;
|
|
1854
|
+
*
|
|
1855
|
+
* export async function getStaticPaths() {
|
|
1856
|
+
* const posts = await fetchPosts();
|
|
1857
|
+
* return posts.map(post => ({ slug: post.slug }));
|
|
1858
|
+
* }
|
|
1859
|
+
*
|
|
1860
|
+
* export default async function BlogPost({ params }) {
|
|
1861
|
+
* const post = await fetchPost(params.slug);
|
|
1862
|
+
* return <article>{post.title}</article>;
|
|
1863
|
+
* }
|
|
1864
|
+
* ```
|
|
1865
|
+
*
|
|
1866
|
+
* @example Next-compatible Route Config:
|
|
1867
|
+
* ```tsx
|
|
1868
|
+
* export const dynamic = "force-static";
|
|
1869
|
+
* export const revalidate = 60;
|
|
1870
|
+
*
|
|
1871
|
+
* export default function DocsPage() {
|
|
1872
|
+
* return <h1>Docs</h1>;
|
|
1873
|
+
* }
|
|
1874
|
+
* ```
|
|
1875
|
+
*
|
|
1876
|
+
* @example Directive Route Config:
|
|
1877
|
+
* ```tsx
|
|
1878
|
+
* "use ssg; 60";
|
|
1879
|
+
*
|
|
1880
|
+
* export default function DocsPage() {
|
|
1881
|
+
* return <h1>Docs</h1>;
|
|
1882
|
+
* }
|
|
1883
|
+
* ```
|
|
1884
|
+
*/
|
|
1885
|
+
interface RouteModule<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> {
|
|
1886
|
+
default?: Page<TRoute>;
|
|
1887
|
+
/** Execution runtime for this route. Layout values are inherited unless overridden. */
|
|
1888
|
+
runtime?: FarmRouteRuntime;
|
|
1889
|
+
/** Provider-specific execution regions, or "auto" to clear an inherited value. */
|
|
1890
|
+
regions?: FarmRouteRegions;
|
|
1891
|
+
/** Maximum execution time in seconds, or "auto" to use the provider default. */
|
|
1892
|
+
maxDuration?: FarmRouteMaxDuration;
|
|
1893
|
+
/**
|
|
1894
|
+
* Mark this page for Static Site Generation (SSG)
|
|
1895
|
+
* When true, the page will be pre-rendered at build time
|
|
1896
|
+
*/
|
|
1897
|
+
ssg?: boolean;
|
|
1898
|
+
/**
|
|
1899
|
+
* Revalidate interval in seconds for Incremental Static Regeneration (ISR)
|
|
1900
|
+
* Only applicable when ssg = true
|
|
1901
|
+
*/
|
|
1902
|
+
revalidate?: number | false;
|
|
1903
|
+
/**
|
|
1904
|
+
* Next.js-compatible rendering mode.
|
|
1905
|
+
* - force-static/error: pre-render at build time
|
|
1906
|
+
* - force-dynamic: render on each request
|
|
1907
|
+
*/
|
|
1908
|
+
dynamic?: "auto" | "force-static" | "force-dynamic" | "error";
|
|
1909
|
+
/**
|
|
1910
|
+
* Opt into Partial Prerendering/static-shell caching for this route.
|
|
1911
|
+
* Compatible with Farm's `ppr` export and Next.js `experimental_ppr`.
|
|
1912
|
+
*/
|
|
1913
|
+
ppr?: boolean;
|
|
1914
|
+
experimental_ppr?: boolean;
|
|
1915
|
+
/**
|
|
1916
|
+
* Return all paths to pre-render for dynamic SSG routes
|
|
1917
|
+
* Required for dynamic routes (e.g., [slug]) when ssg = true
|
|
1918
|
+
*/
|
|
1919
|
+
getStaticPaths?: GenerateStaticParams<TRoute>;
|
|
1920
|
+
/**
|
|
1921
|
+
* @deprecated Use getStaticPaths instead
|
|
1922
|
+
*/
|
|
1923
|
+
generateStaticParams?: GenerateStaticParams<TRoute>;
|
|
1924
|
+
metadata?: Metadata & Record<string, any>;
|
|
1925
|
+
generateMetadata?: (props: MetadataProps<TRoute>) => Promise<Metadata> | Metadata;
|
|
1926
|
+
}
|
|
1927
|
+
/** A value accepted for one static route parameter. */
|
|
1928
|
+
type StaticPathPrimitive = string | number | boolean;
|
|
1929
|
+
/**
|
|
1930
|
+
* Parameters returned by `getStaticPaths` or `generateStaticParams`.
|
|
1931
|
+
* Arrays create individual URL segments for catch-all route parameters.
|
|
1932
|
+
*/
|
|
1933
|
+
type StaticPathParams = Record<string, StaticPathPrimitive | readonly StaticPathPrimitive[]>;
|
|
1934
|
+
type StaticRouteSegmentParams<TSegment extends string> = TSegment extends `[[...${infer TParam}]]` ? {
|
|
1935
|
+
[TKey in TParam]?: readonly StaticPathPrimitive[];
|
|
1936
|
+
} : TSegment extends `[...${infer TParam}]` ? {
|
|
1937
|
+
[TKey in TParam]: readonly StaticPathPrimitive[];
|
|
1938
|
+
} : TSegment extends `[${infer TParam}]` ? {
|
|
1939
|
+
[TKey in TParam]: StaticPathPrimitive;
|
|
1940
|
+
} : {};
|
|
1941
|
+
type ExtractStaticRouteParams<TRoute extends string> = TRoute extends `${infer TSegment}/${infer TRest}` ? StaticRouteSegmentParams<TSegment> & ExtractStaticRouteParams<TRest> : StaticRouteSegmentParams<TRoute>;
|
|
1942
|
+
/** Infer the values accepted from `getStaticPaths` for a route pattern. */
|
|
1943
|
+
type StaticRouteParams<TRoute extends string> = string extends TRoute ? StaticPathParams : TRoute extends string ? SimplifyPageRouteParams<ExtractStaticRouteParams<StripPageRouteSuffix<TRoute>>> : never;
|
|
1944
|
+
type ResolveStaticRouteParams<TRoute extends FarmRoutePropsTarget> = [TRoute] extends [never] ? StaticPathParams : TRoute extends string ? StaticRouteParams<TRoute> : StaticPathParams;
|
|
1945
|
+
/** A route-aware `getStaticPaths` or `generateStaticParams` function. */
|
|
1946
|
+
type GenerateStaticParams<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> = () => Array<ResolveStaticRouteParams<TRoute>> | Promise<Array<ResolveStaticRouteParams<TRoute>>>;
|
|
1947
|
+
interface LayoutModule<TRoute extends FarmRoutePropsTarget = FarmRoutePropsDefault> {
|
|
1948
|
+
default: Layout<TRoute>;
|
|
1949
|
+
/** Semantic fonts inherited by framework-owned surfaces for this route. */
|
|
1950
|
+
fonts?: FarmLayoutFonts;
|
|
1951
|
+
runtime?: FarmRouteRuntime;
|
|
1952
|
+
regions?: FarmRouteRegions;
|
|
1953
|
+
maxDuration?: FarmRouteMaxDuration;
|
|
1954
|
+
metadata?: Metadata & Record<string, any>;
|
|
1955
|
+
generateMetadata?: (props: LayoutMetadataProps<TRoute>) => Promise<Metadata> | Metadata;
|
|
1956
|
+
}
|
|
1957
|
+
interface Metadata {
|
|
1958
|
+
metadataBase?: string | URL;
|
|
1959
|
+
title?: string | {
|
|
1960
|
+
default?: string;
|
|
1961
|
+
template?: string;
|
|
1962
|
+
};
|
|
1963
|
+
description?: string;
|
|
1964
|
+
keywords?: string | string[];
|
|
1965
|
+
author?: string;
|
|
1966
|
+
authors?: Array<{
|
|
1967
|
+
name: string;
|
|
1968
|
+
url?: string;
|
|
1969
|
+
}>;
|
|
1970
|
+
creator?: string;
|
|
1971
|
+
publisher?: string;
|
|
1972
|
+
robots?: string | {
|
|
1973
|
+
index?: boolean;
|
|
1974
|
+
follow?: boolean;
|
|
1975
|
+
};
|
|
1976
|
+
openGraph?: {
|
|
1977
|
+
title?: string;
|
|
1978
|
+
description?: string;
|
|
1979
|
+
url?: string;
|
|
1980
|
+
siteName?: string;
|
|
1981
|
+
images?: string | {
|
|
1982
|
+
url: string;
|
|
1983
|
+
width?: number;
|
|
1984
|
+
height?: number;
|
|
1985
|
+
alt?: string;
|
|
1986
|
+
type?: string;
|
|
1987
|
+
} | Array<{
|
|
1988
|
+
url: string;
|
|
1989
|
+
width?: number;
|
|
1990
|
+
height?: number;
|
|
1991
|
+
alt?: string;
|
|
1992
|
+
type?: string;
|
|
1993
|
+
}>;
|
|
1994
|
+
image?: string;
|
|
1995
|
+
type?: string;
|
|
1996
|
+
locale?: string;
|
|
1997
|
+
};
|
|
1998
|
+
twitter?: {
|
|
1999
|
+
card?: "summary" | "summary_large_image" | "app" | "player";
|
|
2000
|
+
site?: string;
|
|
2001
|
+
creator?: string;
|
|
2002
|
+
title?: string;
|
|
2003
|
+
description?: string;
|
|
2004
|
+
images?: string | {
|
|
2005
|
+
url: string;
|
|
2006
|
+
width?: number;
|
|
2007
|
+
height?: number;
|
|
2008
|
+
alt?: string;
|
|
2009
|
+
type?: string;
|
|
2010
|
+
} | Array<string | {
|
|
2011
|
+
url: string;
|
|
2012
|
+
width?: number;
|
|
2013
|
+
height?: number;
|
|
2014
|
+
alt?: string;
|
|
2015
|
+
type?: string;
|
|
2016
|
+
}>;
|
|
2017
|
+
};
|
|
2018
|
+
alternates?: {
|
|
2019
|
+
canonical?: string;
|
|
2020
|
+
languages?: Record<string, string>;
|
|
2021
|
+
};
|
|
2022
|
+
icons?: string | {
|
|
2023
|
+
icon?: string | Array<string | {
|
|
2024
|
+
url: string;
|
|
2025
|
+
sizes?: string;
|
|
2026
|
+
type?: string;
|
|
2027
|
+
}>;
|
|
2028
|
+
shortcut?: string | Array<string | {
|
|
2029
|
+
url: string;
|
|
2030
|
+
sizes?: string;
|
|
2031
|
+
type?: string;
|
|
2032
|
+
}>;
|
|
2033
|
+
apple?: string | Array<string | {
|
|
2034
|
+
url: string;
|
|
2035
|
+
sizes?: string;
|
|
2036
|
+
type?: string;
|
|
2037
|
+
}>;
|
|
2038
|
+
};
|
|
2039
|
+
manifest?: string;
|
|
2040
|
+
}
|
|
2041
|
+
interface FarmRequest extends IncomingMessage {
|
|
2042
|
+
params?: Record<string, string>;
|
|
2043
|
+
query?: Record<string, string | string[]>;
|
|
2044
|
+
body?: any;
|
|
2045
|
+
}
|
|
2046
|
+
interface FarmResponse extends ServerResponse {
|
|
2047
|
+
json: (data: any) => void;
|
|
2048
|
+
status: (code: number) => FarmResponse;
|
|
2049
|
+
redirect: (url: string, status?: number) => void;
|
|
2050
|
+
}
|
|
2051
|
+
type ServerAction = (...args: any[]) => Promise<any>;
|
|
2052
|
+
interface RouteSegment {
|
|
2053
|
+
segment: string;
|
|
2054
|
+
isDynamic: boolean;
|
|
2055
|
+
isOptional: boolean;
|
|
2056
|
+
isCatchAll: boolean;
|
|
2057
|
+
}
|
|
2058
|
+
interface ParsedRoute {
|
|
2059
|
+
segments: RouteSegment[];
|
|
2060
|
+
filePath: string;
|
|
2061
|
+
type: "page" | "layout" | "loading" | "error" | "not-found";
|
|
2062
|
+
}
|
|
2063
|
+
interface BuildOptions {
|
|
2064
|
+
mode: "development" | "production";
|
|
2065
|
+
ssr: boolean;
|
|
2066
|
+
minify: boolean;
|
|
2067
|
+
sourcemap: boolean;
|
|
2068
|
+
}
|
|
2069
|
+
/**
|
|
2070
|
+
* Represents a page to be pre-rendered at build time (SSG)
|
|
2071
|
+
*/
|
|
2072
|
+
interface SSGPage {
|
|
2073
|
+
/** The URL path for this page */
|
|
2074
|
+
urlPath: string;
|
|
2075
|
+
/** The file path to the page module */
|
|
2076
|
+
filePath: string;
|
|
2077
|
+
/** Route parameters for dynamic routes */
|
|
2078
|
+
params: Record<string, string>;
|
|
2079
|
+
/** Revalidation interval in seconds (ISR) */
|
|
2080
|
+
revalidate?: number;
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Result of SSG page collection
|
|
2084
|
+
*/
|
|
2085
|
+
interface SSGCollectionResult {
|
|
2086
|
+
/** Pages to pre-render at build time */
|
|
2087
|
+
ssg: SSGPage[];
|
|
2088
|
+
/** Routes that will be server-rendered on each request */
|
|
2089
|
+
ssr: string[];
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
export { type FarmPlugin as $, type AppRoutePattern as A, type RouteSegment as B, type ParsedRoute as C, type BuildOptions as D, type ErrorProps as E, type FarmConfig as F, type GenerateStaticParams as G, type SSGPage as H, type SSGCollectionResult as I, type FarmLayerEntry as J, type ResolvedFarmLayer as K, type LoadingProps as L, type MiddlewareProps as M, type NitroPreset as N, type FarmSourceRoot as O, type PageRouteParams as P, type ResolveFarmLayersOptions as Q, type ResolvedFarmMigrationsConfig as R, type StaticPathPrimitive as S, type FarmLayerResolution as T, resolveFarmLayers as U, getFarmSourceRoots as V, getFarmAppDirectories as W, getFarmLayerAliases as X, loadFarmConfigFile as Y, type FarmUserConfig as Z, type BundleResultPayload as _, type FarmMigrationCommand as a, type FarmPluginRouterHooks as a$, type FarmIntegration as a0, type ReadonlyMiddlewareStore as a1, type FarmMiddlewareConfig as a2, type MiddlewareModule as a3, type FarmMdxResolvedConfig as a4, type ResolvedFarmDevtoolsConfig as a5, type ResolvedFarmAuthConfig as a6, type ResolvedFarmPerformanceConfig as a7, type ResolvedFarmSecurityConfig as a8, manageFarmDocumentPreloads as a9, type FarmAuthConfig as aA, type FarmAuthDatabaseConfig as aB, type FarmAuthEmailAndPasswordConfig as aC, type FarmAuthSessionConfig as aD, type FarmAuthUserConfig as aE, type PluginRequestContext as aF, type FarmPluginContext as aG, type FarmPluginIntegrationContext as aH, type FarmPluginLifecycle as aI, type FarmRequestPluginContext as aJ, type FarmRequestStore as aK, type FarmPluginRuntimeKind as aL, type FarmPluginRouteRuntimePayload as aM, type FarmPluginSetupContext as aN, type FarmPluginStateContext as aO, type FarmPluginRuntimeBaseEvent as aP, type FarmPluginRuntimeContextEvent as aQ, type FarmPluginRuntimeBeforeEvent as aR, type FarmPluginRuntimeAfterEvent as aS, type FarmPluginRuntimeErrorEvent as aT, type FarmPluginRuntimeStartEvent as aU, type FarmPluginRuntimeCloseEvent as aV, type FarmPluginRuntimeHooks as aW, type FarmPluginRuntimeRequestOptions as aX, type FarmPluginRuntimeRequestHandler as aY, type FarmPluginRuntimeSession as aZ, type FarmPluginDiscoveredRoute as a_, manageFarmHtmlPreloads as aa, manageFarmLinkHeaderPreloads as ab, reportFarmPreloadWarnings as ac, type OpenAPIConfig as ad, definePlugin as ae, FarmRuntimeShutdownError as af, PluginManager as ag, resolveConfig as ah, loadConfig as ai, resolveDeployConfig as aj, resolveMigrationsConfig as ak, resolveDeployOutputPath as al, normalizeDeployTarget as am, getDeployTargetForPreset as an, getPresetForDeployTarget as ao, type FarmLayerConfig as ap, type FarmPerformanceConfig as aq, type FarmPreloadMode as ar, type FarmPreloadUserConfig as as, type ResolvedFarmPreloadConfig as at, type FarmCspConfig as au, type FarmCspDirectives as av, type FarmCspDirectiveValue as aw, type FarmCspOptions as ax, type FarmSecurityConfig as ay, type ResolvedFarmCspConfig as az, type FarmMigrationsConfig as b, type FarmIntegrationDocumentNavigation as b$, type FarmPluginRenderHooks as b0, type FarmPluginBuildHooks as b1, type FarmPluginDevHooks as b2, type FarmPluginClientConfig as b3, type RouteDiscoveredPayload as b4, type RoutesGeneratedPayload as b5, type MiddlewareDiscoveredPayload as b6, type APIRouteDiscoveredPayload as b7, type RouteMatchPayload as b8, type RouteMatchResultPayload as b9, type FarmIntegrationValidationErrorLike as bA, type FarmIntegrationValidationResult as bB, type FarmIntegrationStandardValidationResult as bC, type FarmIntegrationInputSchema as bD, type FarmIntegrationRouteInputSchemas as bE, type FarmIntegrationRequestContextStore as bF, FARM_INTEGRATION_INTERNAL_DISPATCH_CONTEXT_KEY as bG, type FarmIntegrationRouteDb as bH, type FarmIntegrationRouteStorageArgs as bI, type FarmIntegrationRouteArgs as bJ, type FarmIntegrationConfigContext as bK, type FarmIntegrationConfigDefinition as bL, type FarmIntegrationConfigInput as bM, type FarmIntegrationLifecycleLogLevel as bN, type FarmIntegrationLifecycleLogger as bO, type FarmIntegrationLifecycleContext as bP, type FarmIntegrationLifecycleHook as bQ, type FarmIntegrationData as bR, type FarmIntegrationHandlerContext as bS, type FarmIntegrationRouteHookContext as bT, type FarmIntegrationRouteHook as bU, type FarmIntegrationRoute as bV, type FarmTypedIntegrationRoute as bW, type FarmIntegrationRouteMiddleware as bX, type FarmIntegrationMiddleware as bY, type FarmIntegrationProviderProps as bZ, type FarmIntegrationProvider as b_, type RenderLifecyclePayload as ba, type APIHandlerLifecyclePayload as bb, type ErrorLifecyclePayload as bc, type HMRUpdatePayload as bd, type BundleLifecyclePayload as be, type NitroBuildLifecyclePayload as bf, type ShutdownPayload as bg, type ResolvedFarmConfig as bh, type RedirectConfig as bi, type HeaderConfig as bj, type RewriteConfig as bk, type ImageConfig as bl, type I18nConfig as bm, type MiddlewareConfig as bn, type FarmDeployConfig as bo, type ResolvedFarmDeployConfig as bp, type FarmDeployTarget as bq, type FarmIntegrationCategory as br, type FarmIntegrationSlot as bs, type FarmIntegrationRouteParamValue as bt, type FarmIntegrationRouteParams as bu, type FarmIntegrationRouteMethod as bv, type FarmIntegrationRouteInputSource as bw, type FarmIntegrationValidationPathSegment as bx, type FarmIntegrationRouteInput as by, type FarmIntegrationValidationIssue as bz, type FarmMigrationsUserConfig as c, type MemoryRateLimitStorageOptions as c$, type FarmIntegrationSchemaFieldType as c0, type FarmIntegrationSchemaReference as c1, type FarmIntegrationSchemaField as c2, type FarmIntegrationSchemaConstraint as c3, type FarmIntegrationSchemaModel as c4, type FarmIntegrationSchemaModelExtension as c5, type FarmIntegrationSchemaModelOverride as c6, type FarmIntegrationSchema as c7, defineIntegrationSchema as c8, type FarmIntegrationLogPhase as c9, matchIntegrationRoute as cA, matchRegisteredIntegrationRoute as cB, getRegisteredIntegrationAPIManifest as cC, dispatchIntegrationRequest as cD, type FarmIntegrationOrmSchema as cE, type FarmIntegrationOrmClient as cF, type InferFarmIntegrationOrmField as cG, type InferFarmIntegrationOrmFields as cH, type InferFarmIntegrationOrmSchema as cI, type InferFarmIntegrationOrmClient as cJ, type CreateIntegrationOrmOptions as cK, createIntegrationOrm as cL, resolveIntegrationOrmRuntimeClient as cM, farmIntegrationSchemaToOrmSchema as cN, type IntegrationOrmModelNames as cO, type MiddlewareContext as cP, type MiddlewareFunction as cQ, type RequestMiddleware as cR, type RequestMiddlewareContext as cS, type MiddlewareStore as cT, type MiddlewareChain as cU, type CookieJar as cV, type CookieOptions as cW, type RateLimitConfig as cX, type RateLimitIncrementResult as cY, type RateLimitStorage as cZ, type RateLimitStatus as c_, type FarmIntegrationLogEvent as ca, type FarmIntegrationLogger as cb, type FarmIntegrationPluginOwner as cc, type FarmIntegrationContributedPlugin as cd, type FarmIntegrationsUserConfig as ce, getFarmIntegrationPluginServerRuntime as cf, getFarmIntegrationPluginOwner as cg, type FarmIntegrationRouteFactory as ch, type FarmIntegrationRoutesFactoryContext as ci, type FarmIntegrationRoutesFactory as cj, type FarmIntegrationEndpointValue as ck, type FarmIntegrationEndpoints as cl, type FarmIntegrationEndpointsFactoryContext as cm, type FarmIntegrationEndpointsFactory as cn, createIntegrationRoute as co, integrationRoute as cp, type DefinedIntegration as cq, defineIntegration as cr, isFarmIntegration as cs, resolveIntegrationPlugins as ct, getIntegrationProviders as cu, getIntegrationDocumentNavigationMatchers as cv, getIntegrationSchemas as cw, getRegisteredIntegrationRuntime as cx, getRegisteredIntegrations as cy, getRegisteredIntegrationSchemas as cz, defineConfig as d, type NextFunction as d0, type MiddlewareResult as d1, type FarmRouteRuleRenderMode as d2, type FarmRouteRuleRedirect as d3, type FarmRouteRuleCors as d4, type FarmRouteRule as d5, type FarmRouteRules as d6, normalizeRouteRules as d7, routeRulesToRedirects as d8, routeRulesToHeaders as d9, routeRulesToNitroRouteRules as da, type FarmMdxComponent as db, type FarmMdxComponents as dc, type FarmMdxUserConfig as dd, type FarmMarkdownPageSource as de, type FarmMarkdownPageModuleInput as df, resolveMdxConfig as dg, isFarmMarkdownPageFile as dh, normalizeFarmMarkdownRoutePath as di, parseMarkdownFrontmatter as dj, titleFromMarkdown as dk, createMarkdownMetadata as dl, createFarmMarkdownRouteModule as dm, createFarmMarkdownRouteModuleFromFile as dn, loadFarmMdxComponents as dp, createFarmMarkdownSourceResponse as dq, DEFAULT_FARM_DEVTOOLS_SHORTCUT as dr, FARM_DEVTOOLS_PATH as ds, FARM_DEVTOOLS_LAUNCH_PARAM as dt, type FarmDevtoolsConfig as du, type FarmDevtoolsUserConfig as dv, resolveFarmDevtoolsConfig as dw, type MiddlewareConfig$1 as dx, farmI18nClientBridgePlugin as dy, rewriteEarlySsrRelativeImports as dz, type FarmContextFactoryInput as e, farmPlugin as f, type FarmContextFactory as g, type FarmAppContext as h, type PluginContextProps as i, type PageProps as j, type PagePropsWithMiddleware as k, type LayoutProps as l, type MetadataProps as m, type LayoutMetadataProps as n, type Page as o, type Layout as p, type Loading as q, type ErrorBoundary as r, type RouteModule as s, type StaticPathParams as t, type StaticRouteParams as u, type LayoutModule as v, type Metadata as w, type FarmRequest as x, type FarmResponse as y, type ServerAction as z };
|