interface FarmNodeAbortRequest { aborted?: boolean; once(event: "aborted", listener: () => void): unknown; off(event: "aborted", listener: () => void): unknown; } interface FarmNodeAbortResponse { writableEnded: boolean; once(event: "close" | "finish", listener: () => void): unknown; off(event: "close" | "finish", listener: () => void): unknown; } /** Share disconnect semantics between development and production Node requests. */ declare function createFarmNodeRequestAbortSignal(req: FarmNodeAbortRequest, res: FarmNodeAbortResponse): AbortSignal; type FarmServerDuration = number | `${number}${"ms" | "s" | "m" | "h"}`; interface FarmServerHealthConfig { /** Liveness endpoint. It remains healthy while a production process drains. */ livenessPath?: string; /** Readiness endpoint. It returns 503 until startup completes and while draining. */ readinessPath?: string; } interface ResolvedFarmServerHealthConfig { enabled: boolean; livenessPath: string; readinessPath: string; } interface FarmServerConfig { /** Maximum request body size for API routes, integrations, workflows, and uploads. */ bodySizeLimit?: number | string; /** Trust proxy-provided client address and request authority headers. Enable only behind a trusted proxy. */ trustProxy?: boolean; /** Maximum time for a Node client to send complete request headers. */ headersTimeout?: FarmServerDuration; /** Maximum time for a Node client to send the complete request. */ requestTimeout?: FarmServerDuration; /** How long an idle Node keep-alive connection remains open after a response. */ keepAliveTimeout?: FarmServerDuration; /** Maximum time the Node adapter drains traffic before forcing shutdown. */ gracefulShutdownTimeout?: FarmServerDuration; /** Production liveness and readiness endpoints. Set to false to disable them. */ health?: false | FarmServerHealthConfig; } interface ResolvedFarmServerConfig { bodySizeLimit: number; trustProxy: boolean; headersTimeout: number; requestTimeout: number; keepAliveTimeout: number; gracefulShutdownTimeout: number; health: ResolvedFarmServerHealthConfig; } /** Apply the weak entity-tag comparison required by If-None-Match. */ declare function matchesFarmIfNoneMatch(value: string | readonly string[] | null | undefined, etag: string): boolean; declare function resolveFarmServerConfig(config: FarmServerConfig | ResolvedFarmServerConfig | undefined): ResolvedFarmServerConfig; declare function bufferFarmRequestBody(request: Request, limit: number): Promise; declare function readFarmRequestBody(request: Request, limit: number): Promise; declare function readNodeRequestBody(request: { headers: Record; on(event: "data", listener: (chunk: unknown) => void): unknown; on(event: "end", listener: () => void): unknown; on(event: "error", listener: (error: Error) => void): unknown; removeListener?(event: string, listener: (...args: any[]) => void): unknown; resume?(): unknown; }, limit: number): Promise; declare function createFarmRequestBodyErrorResponse(error: unknown): Response | null; type FarmWorkflowSchedule = string | string[]; interface FarmWorkflowsUserConfig { /** Enable or disable Farm workflow discovery. Enabled by default. */ enabled?: boolean; /** Directory or directories to scan for workflow modules. */ dir?: string | string[]; /** Alias for dir. */ dirs?: string[]; /** HTTP route used for manual and URL-based cron invocation. */ route?: string; /** Environment variable that stores the optional runner secret. */ secretEnv?: string; /** Inline runner secret. Prefer secretEnv for deployed apps. */ secret?: string; /** * Serve the workflow route without a secret in a deployed runtime. * Defaults to false: without a secret the route is public, so production * requests are rejected unless this is explicitly enabled. */ allowUnsecured?: boolean; } interface FarmWorkflowsResolvedConfig { enabled: boolean; dirs: string[]; route: string; secretEnv: string; secret?: string; allowUnsecured?: boolean; } interface FarmWorkflowLogger { info: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; error: (...args: unknown[]) => void; } interface FarmWorkflowRunContext { id: string; name: string; payload: TPayload; scheduledTime?: number | string; request?: Request; event?: unknown; env: Record; data: Map; log: FarmWorkflowLogger; } interface FarmWorkflowDefinition { kind?: "farm-workflow"; id?: string; description?: string; schedule?: FarmWorkflowSchedule; timezone?: string; run: (ctx: FarmWorkflowRunContext) => TResult | Promise; } interface FarmCronDefinition extends FarmWorkflowDefinition { schedule: FarmWorkflowSchedule; } interface FarmDiscoveredWorkflow { id: string; filePath: string; description?: string; schedule: string[]; timezone?: string; routePath: string; } interface PreparedFarmWorkflows { workflows: FarmDiscoveredWorkflow[]; tasks: Record; scheduledTasks: Record; handlerPath?: string; manifestPath?: string; } interface FarmWorkflowHTTPHandlerOptions { workflows: FarmDiscoveredWorkflow[]; config: FarmWorkflowsResolvedConfig; loadModule: (workflow: FarmDiscoveredWorkflow) => Promise>; server?: FarmServerConfig | ResolvedFarmServerConfig; } declare const DEFAULT_FARM_WORKFLOW_DIRS: string[]; declare const DEFAULT_FARM_WORKFLOW_ROUTE = "/api/_farm/workflows"; declare const DEFAULT_FARM_WORKFLOW_SECRET_ENV = "CRON_SECRET"; declare function defineWorkflow(definition: FarmWorkflowDefinition): FarmWorkflowDefinition; declare function defineTask(definition: FarmWorkflowDefinition): FarmWorkflowDefinition; /** * @deprecated Configure `cron` in `farm.config.ts` and point it at an API route. */ declare function defineCron(definition: FarmCronDefinition): FarmCronDefinition; declare function resolveWorkflowsConfig(workflows: FarmWorkflowsUserConfig | boolean | undefined): FarmWorkflowsResolvedConfig; declare function discoverFarmWorkflows(config: { root?: string; workflows?: FarmWorkflowsResolvedConfig | FarmWorkflowsUserConfig | boolean; }, options?: { loadModule?: (filePath: string) => Promise>; }): Promise; declare function createFarmWorkflowRequestHandler(options: FarmWorkflowHTTPHandlerOptions): (request: Request) => Promise; declare function runFarmWorkflowModule(module: Record, context: { id: string; name?: string; payload?: unknown; scheduledTime?: number | string; request?: Request; event?: unknown; env?: Record; }): Promise; declare function prepareFarmWorkflowsForNitro(config: { root?: string; distDir?: string; workflows?: FarmWorkflowsResolvedConfig | FarmWorkflowsUserConfig | boolean; server?: FarmServerConfig | ResolvedFarmServerConfig; }): Promise; declare function createFarmWorkflowVercelCrons(workflows: FarmDiscoveredWorkflow[]): Array<{ path: string; schedule: string; }>; declare function applyFarmWorkflowVercelCrons(vercelConfig: Record, workflows: FarmDiscoveredWorkflow[]): Record; export { createFarmWorkflowRequestHandler as A, runFarmWorkflowModule as B, prepareFarmWorkflowsForNitro as C, DEFAULT_FARM_WORKFLOW_DIRS as D, createFarmWorkflowVercelCrons as E, type FarmWorkflowsResolvedConfig as F, applyFarmWorkflowVercelCrons as G, type PreparedFarmWorkflows as P, type ResolvedFarmServerConfig as R, type FarmServerConfig as a, bufferFarmRequestBody as b, createFarmNodeRequestAbortSignal as c, createFarmRequestBodyErrorResponse as d, readNodeRequestBody as e, resolveFarmServerConfig as f, type FarmServerDuration as g, type FarmServerHealthConfig as h, type ResolvedFarmServerHealthConfig as i, type FarmWorkflowsUserConfig as j, type FarmWorkflowSchedule as k, type FarmWorkflowLogger as l, matchesFarmIfNoneMatch as m, type FarmWorkflowRunContext as n, type FarmWorkflowDefinition as o, type FarmCronDefinition as p, type FarmDiscoveredWorkflow as q, readFarmRequestBody as r, type FarmWorkflowHTTPHandlerOptions as s, DEFAULT_FARM_WORKFLOW_ROUTE as t, DEFAULT_FARM_WORKFLOW_SECRET_ENV as u, defineWorkflow as v, defineTask as w, defineCron as x, resolveWorkflowsConfig as y, discoverFarmWorkflows as z };