@farm.js/core 0.1.0-beta.20 → 0.1.0-beta.22
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.cjs.map +1 -1
- package/dist/agent-runtime.d.mts +96 -0
- package/dist/agent-runtime.d.ts +96 -0
- package/dist/agent-runtime.mjs +1 -1
- 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-BB8GCH1g.d.ts +306 -0
- package/dist/app-DwsTpyNZ.d.mts +306 -0
- package/dist/app-markdown.d.mts +24 -0
- package/dist/app-markdown.d.ts +24 -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-UNDUIGWC.mjs → chunk-A53LP5QG.mjs} +2 -2
- package/dist/chunk-A53LP5QG.mjs.map +1 -0
- package/dist/{chunk-7BX7NEA7.mjs → chunk-CEVMYGDL.mjs} +2 -2
- package/dist/chunk-CEVMYGDL.mjs.map +1 -0
- package/dist/{chunk-ZYDQS2TT.mjs → chunk-CRN3AH35.mjs} +1 -1
- package/dist/chunk-CRN3AH35.mjs.map +1 -0
- package/dist/{chunk-4KTN2BLF.mjs → chunk-DAUR3WUZ.mjs} +2 -2
- package/dist/{chunk-4KTN2BLF.mjs.map → chunk-DAUR3WUZ.mjs.map} +1 -1
- package/dist/chunk-GIELMNBG.mjs +15 -0
- package/dist/chunk-GIELMNBG.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-5VHPEW6N.mjs → chunk-LLPN5SEZ.mjs} +2 -2
- package/dist/{chunk-TMZEK265.mjs → chunk-XBKXKJX5.mjs} +32 -37
- package/dist/chunk-XBKXKJX5.mjs.map +1 -0
- package/dist/{chunk-ZRMJY4G2.mjs → chunk-ZP73P4VR.mjs} +12 -10
- package/dist/{chunk-ZRMJY4G2.mjs.map → chunk-ZP73P4VR.mjs.map} +1 -1
- 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-CbRum1fj.d.ts +2088 -0
- package/dist/client-plugins-QQntVkrv.d.mts +2088 -0
- package/dist/client-plugins.d.mts +24 -0
- package/dist/client-plugins.d.ts +24 -0
- package/dist/client.d.mts +452 -0
- package/dist/client.d.ts +452 -0
- package/dist/config.d.mts +31 -0
- package/dist/config.d.ts +31 -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-4RDGBT72.mjs → devtools-52FYXIEK.mjs} +3 -3
- 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 +3 -3
- 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 +72 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +477 -0
- package/dist/index.d.ts +477 -0
- package/dist/index.mjs +11 -10
- 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.cjs.map +1 -1
- package/dist/integrations.d.mts +24 -0
- package/dist/integrations.d.ts +24 -0
- package/dist/integrations.mjs +1 -1
- package/dist/internal/build-runtime.cjs +56 -54
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +41 -0
- package/dist/internal/build-runtime.d.ts +41 -0
- package/dist/internal/build-runtime.mjs +9 -8
- package/dist/internal/client-runtime.d.mts +17 -0
- package/dist/internal/client-runtime.d.ts +17 -0
- package/dist/internal/config-runtime.cjs.map +1 -1
- package/dist/internal/config-runtime.d.mts +41 -0
- package/dist/internal/config-runtime.d.ts +41 -0
- package/dist/internal/config-runtime.mjs +2 -2
- 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.d.mts +66 -0
- package/dist/internal/production-runtime.d.ts +66 -0
- 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-B5jBJHq1.d.ts +22 -0
- package/dist/metadata-BxOJ4FJl.d.mts +22 -0
- package/dist/middleware.cjs +17 -17
- package/dist/middleware.cjs.map +1 -1
- package/dist/middleware.d.mts +171 -0
- package/dist/middleware.d.ts +171 -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 +42 -48
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +24 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.mjs +6 -5
- package/dist/production-runtime-Bxua86uR.d.mts +81 -0
- package/dist/production-runtime-CZqXjRVi.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-7V0GaZK_.d.mts +6 -0
- package/dist/request-B5XYBv5a.d.ts +6 -0
- package/dist/request.d.mts +25 -0
- package/dist/request.d.ts +25 -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 +226 -0
- package/dist/routes.d.ts +226 -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 +57 -0
- package/dist/server-plugins.d.ts +57 -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 +45 -67
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +51 -0
- package/dist/server.d.ts +51 -0
- package/dist/server.mjs +11 -25
- 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 +103 -0
- package/dist/testing.d.ts +103 -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-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-s9pN0Yep.d.mts +23 -0
- package/dist/utils-xTFxzu47.d.ts +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 +44 -50
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +24 -0
- package/dist/vite.d.ts +24 -0
- package/dist/vite.mjs +5 -4
- 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 +1 -1
- package/dist/chunk-4EATUJFO.mjs.map +0 -1
- package/dist/chunk-7BX7NEA7.mjs.map +0 -1
- package/dist/chunk-MIUW47JX.mjs.map +0 -1
- package/dist/chunk-TMZEK265.mjs.map +0 -1
- package/dist/chunk-UNDUIGWC.mjs.map +0 -1
- package/dist/chunk-ZYDQS2TT.mjs.map +0 -1
- /package/dist/{chunk-RIXKJPGI.mjs.map → chunk-42325TLU.mjs.map} +0 -0
- /package/dist/{chunk-5VHPEW6N.mjs.map → chunk-LLPN5SEZ.mjs.map} +0 -0
- /package/dist/{devtools-4RDGBT72.mjs.map → devtools-52FYXIEK.mjs.map} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
import { _ as BundleResultPayload, $ as FarmPlugin, a0 as FarmIntegration } from './client-plugins-QQntVkrv.mjs';
|
|
3
|
+
import './plugin-BJDf43dc.mjs';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'http';
|
|
6
|
+
import './types-D1A6-XvH.mjs';
|
|
7
|
+
import 'db0';
|
|
8
|
+
import 'unstorage';
|
|
9
|
+
import './integration-api-CHT2OKAf.mjs';
|
|
10
|
+
import '@farming-labs/orm';
|
|
11
|
+
import './types-DTzm4TCl.mjs';
|
|
12
|
+
import '@farming-labs/docs';
|
|
13
|
+
import './markdown.mjs';
|
|
14
|
+
import './observability.mjs';
|
|
15
|
+
import 'vite';
|
|
16
|
+
import './workflows-CusFV6mn.mjs';
|
|
17
|
+
import './cron.mjs';
|
|
18
|
+
import './env.mjs';
|
|
19
|
+
import './server-action-security.mjs';
|
|
20
|
+
import './server-fn-error-DDh14a0V.mjs';
|
|
21
|
+
import './image-config-Duob7wER.mjs';
|
|
22
|
+
import './types-BMxWr97v.mjs';
|
|
23
|
+
import './cache.mjs';
|
|
24
|
+
import './route-runtime-DoOHzCAD.mjs';
|
|
25
|
+
import './font.mjs';
|
|
26
|
+
|
|
27
|
+
interface FarmAgentRuntimeInstance {
|
|
28
|
+
readonly provider: string;
|
|
29
|
+
readonly routePrefix: string;
|
|
30
|
+
readonly routePrefixes: readonly string[];
|
|
31
|
+
getOrigin(): string | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface FarmManagedAgentRuntime {
|
|
34
|
+
readonly origin: string;
|
|
35
|
+
readonly process?: ChildProcess;
|
|
36
|
+
stop(): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
interface FarmAgentRuntimeStartContext {
|
|
39
|
+
readonly root: string;
|
|
40
|
+
readonly log: {
|
|
41
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
42
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
43
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface FarmAgentRuntimeBuildContext extends BundleResultPayload {
|
|
47
|
+
readonly provider: string;
|
|
48
|
+
readonly routePrefix: string;
|
|
49
|
+
readonly routePrefixes: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
interface FarmAgentRuntimeIntegrationOptions {
|
|
52
|
+
provider: string;
|
|
53
|
+
routePrefix: string;
|
|
54
|
+
/** Whether Farm's production server must dispatch this runtime's proxy routes. */
|
|
55
|
+
serverRuntime?: boolean;
|
|
56
|
+
additionalRoutePrefixes?: readonly string[];
|
|
57
|
+
origin?: string;
|
|
58
|
+
originEnv?: string | readonly string[];
|
|
59
|
+
webSockets?: boolean;
|
|
60
|
+
startDev?(context: FarmAgentRuntimeStartContext): Promise<FarmManagedAgentRuntime>;
|
|
61
|
+
afterBuild?(context: FarmAgentRuntimeBuildContext): Promise<void> | void;
|
|
62
|
+
plugins?: readonly FarmPlugin[];
|
|
63
|
+
instance?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface FarmManagedProcessOptions {
|
|
66
|
+
command: string;
|
|
67
|
+
args?: readonly string[];
|
|
68
|
+
cwd: string;
|
|
69
|
+
env?: Record<string, string | undefined>;
|
|
70
|
+
label: string;
|
|
71
|
+
origin?: string;
|
|
72
|
+
resolveOrigin?(output: string): string | undefined;
|
|
73
|
+
healthPath?: string;
|
|
74
|
+
timeoutMs?: number;
|
|
75
|
+
stopTimeoutMs?: number;
|
|
76
|
+
onOutput?(line: string, stream: "stdout" | "stderr"): void;
|
|
77
|
+
}
|
|
78
|
+
interface FarmAgentProxyOptions {
|
|
79
|
+
fetch?: typeof globalThis.fetch;
|
|
80
|
+
}
|
|
81
|
+
declare function createAgentRuntimeIntegration(options: FarmAgentRuntimeIntegrationOptions): FarmIntegration;
|
|
82
|
+
declare function applyAgentRuntimeViteProxy(config: {
|
|
83
|
+
vite?: Record<string, any>;
|
|
84
|
+
}, input: {
|
|
85
|
+
origin: string;
|
|
86
|
+
routePrefix: string;
|
|
87
|
+
webSockets?: boolean;
|
|
88
|
+
}): void;
|
|
89
|
+
declare function proxyAgentRuntimeRequest(request: Request, origin: string, options?: FarmAgentProxyOptions): Promise<Response>;
|
|
90
|
+
declare function startManagedAgentRuntime(options: FarmManagedProcessOptions): Promise<FarmManagedAgentRuntime>;
|
|
91
|
+
declare function findAvailableAgentRuntimePort(host?: string): Promise<number>;
|
|
92
|
+
declare function resolveProjectPackageBin(projectRoot: string, packageName: string, binName?: string): Promise<string>;
|
|
93
|
+
declare function normalizeAgentOrigin(value: string): string;
|
|
94
|
+
declare function normalizeAgentRoutePrefix(value: string): string;
|
|
95
|
+
|
|
96
|
+
export { type FarmAgentProxyOptions, type FarmAgentRuntimeBuildContext, type FarmAgentRuntimeInstance, type FarmAgentRuntimeIntegrationOptions, type FarmAgentRuntimeStartContext, type FarmManagedAgentRuntime, type FarmManagedProcessOptions, applyAgentRuntimeViteProxy, createAgentRuntimeIntegration, findAvailableAgentRuntimePort, normalizeAgentOrigin, normalizeAgentRoutePrefix, proxyAgentRuntimeRequest, resolveProjectPackageBin, startManagedAgentRuntime };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { ChildProcess } from 'node:child_process';
|
|
2
|
+
import { _ as BundleResultPayload, $ as FarmPlugin, a0 as FarmIntegration } from './client-plugins-CbRum1fj.js';
|
|
3
|
+
import './plugin-BJDf43dc.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'http';
|
|
6
|
+
import './types-D1A6-XvH.js';
|
|
7
|
+
import 'db0';
|
|
8
|
+
import 'unstorage';
|
|
9
|
+
import './integration-api-CHT2OKAf.js';
|
|
10
|
+
import '@farming-labs/orm';
|
|
11
|
+
import './types-DTzm4TCl.js';
|
|
12
|
+
import '@farming-labs/docs';
|
|
13
|
+
import './markdown.js';
|
|
14
|
+
import './observability.js';
|
|
15
|
+
import 'vite';
|
|
16
|
+
import './workflows-CusFV6mn.js';
|
|
17
|
+
import './cron.js';
|
|
18
|
+
import './env.js';
|
|
19
|
+
import './server-action-security.js';
|
|
20
|
+
import './server-fn-error-DDh14a0V.js';
|
|
21
|
+
import './image-config-Duob7wER.js';
|
|
22
|
+
import './types-BMxWr97v.js';
|
|
23
|
+
import './cache.js';
|
|
24
|
+
import './route-runtime-DoOHzCAD.js';
|
|
25
|
+
import './font.js';
|
|
26
|
+
|
|
27
|
+
interface FarmAgentRuntimeInstance {
|
|
28
|
+
readonly provider: string;
|
|
29
|
+
readonly routePrefix: string;
|
|
30
|
+
readonly routePrefixes: readonly string[];
|
|
31
|
+
getOrigin(): string | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface FarmManagedAgentRuntime {
|
|
34
|
+
readonly origin: string;
|
|
35
|
+
readonly process?: ChildProcess;
|
|
36
|
+
stop(): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
interface FarmAgentRuntimeStartContext {
|
|
39
|
+
readonly root: string;
|
|
40
|
+
readonly log: {
|
|
41
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
42
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
43
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface FarmAgentRuntimeBuildContext extends BundleResultPayload {
|
|
47
|
+
readonly provider: string;
|
|
48
|
+
readonly routePrefix: string;
|
|
49
|
+
readonly routePrefixes: readonly string[];
|
|
50
|
+
}
|
|
51
|
+
interface FarmAgentRuntimeIntegrationOptions {
|
|
52
|
+
provider: string;
|
|
53
|
+
routePrefix: string;
|
|
54
|
+
/** Whether Farm's production server must dispatch this runtime's proxy routes. */
|
|
55
|
+
serverRuntime?: boolean;
|
|
56
|
+
additionalRoutePrefixes?: readonly string[];
|
|
57
|
+
origin?: string;
|
|
58
|
+
originEnv?: string | readonly string[];
|
|
59
|
+
webSockets?: boolean;
|
|
60
|
+
startDev?(context: FarmAgentRuntimeStartContext): Promise<FarmManagedAgentRuntime>;
|
|
61
|
+
afterBuild?(context: FarmAgentRuntimeBuildContext): Promise<void> | void;
|
|
62
|
+
plugins?: readonly FarmPlugin[];
|
|
63
|
+
instance?: Record<string, unknown>;
|
|
64
|
+
}
|
|
65
|
+
interface FarmManagedProcessOptions {
|
|
66
|
+
command: string;
|
|
67
|
+
args?: readonly string[];
|
|
68
|
+
cwd: string;
|
|
69
|
+
env?: Record<string, string | undefined>;
|
|
70
|
+
label: string;
|
|
71
|
+
origin?: string;
|
|
72
|
+
resolveOrigin?(output: string): string | undefined;
|
|
73
|
+
healthPath?: string;
|
|
74
|
+
timeoutMs?: number;
|
|
75
|
+
stopTimeoutMs?: number;
|
|
76
|
+
onOutput?(line: string, stream: "stdout" | "stderr"): void;
|
|
77
|
+
}
|
|
78
|
+
interface FarmAgentProxyOptions {
|
|
79
|
+
fetch?: typeof globalThis.fetch;
|
|
80
|
+
}
|
|
81
|
+
declare function createAgentRuntimeIntegration(options: FarmAgentRuntimeIntegrationOptions): FarmIntegration;
|
|
82
|
+
declare function applyAgentRuntimeViteProxy(config: {
|
|
83
|
+
vite?: Record<string, any>;
|
|
84
|
+
}, input: {
|
|
85
|
+
origin: string;
|
|
86
|
+
routePrefix: string;
|
|
87
|
+
webSockets?: boolean;
|
|
88
|
+
}): void;
|
|
89
|
+
declare function proxyAgentRuntimeRequest(request: Request, origin: string, options?: FarmAgentProxyOptions): Promise<Response>;
|
|
90
|
+
declare function startManagedAgentRuntime(options: FarmManagedProcessOptions): Promise<FarmManagedAgentRuntime>;
|
|
91
|
+
declare function findAvailableAgentRuntimePort(host?: string): Promise<number>;
|
|
92
|
+
declare function resolveProjectPackageBin(projectRoot: string, packageName: string, binName?: string): Promise<string>;
|
|
93
|
+
declare function normalizeAgentOrigin(value: string): string;
|
|
94
|
+
declare function normalizeAgentRoutePrefix(value: string): string;
|
|
95
|
+
|
|
96
|
+
export { type FarmAgentProxyOptions, type FarmAgentRuntimeBuildContext, type FarmAgentRuntimeInstance, type FarmAgentRuntimeIntegrationOptions, type FarmAgentRuntimeStartContext, type FarmManagedAgentRuntime, type FarmManagedProcessOptions, applyAgentRuntimeViteProxy, createAgentRuntimeIntegration, findAvailableAgentRuntimePort, normalizeAgentOrigin, normalizeAgentRoutePrefix, proxyAgentRuntimeRequest, resolveProjectPackageBin, startManagedAgentRuntime };
|
package/dist/agent-runtime.mjs
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { F as FarmRouteRuntimeConfig } from '../route-runtime-DoOHzCAD.mjs';
|
|
3
|
+
import '../types-BMxWr97v.mjs';
|
|
4
|
+
import { F as FarmI18nRuntime } from '../runtime-Cxpq6xZN.mjs';
|
|
5
|
+
import { A as APIRouteMatch } from '../runtime-Q3u74Nbq.mjs';
|
|
6
|
+
export { c as APIRouteParamValue, b as APIRouteParams, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-Q3u74Nbq.mjs';
|
|
7
|
+
import '../resolver-DJqjLMg_.mjs';
|
|
8
|
+
import '../cache.mjs';
|
|
9
|
+
import '../transport-BmbGTXA5.mjs';
|
|
10
|
+
|
|
11
|
+
interface APIRoute extends FarmRouteRuntimeConfig {
|
|
12
|
+
path: string;
|
|
13
|
+
filePath: string;
|
|
14
|
+
methods: string[];
|
|
15
|
+
endpoints: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
interface APIRouteManagerOptions {
|
|
18
|
+
throwOnLoadError?: boolean;
|
|
19
|
+
i18n?: FarmI18nRuntime;
|
|
20
|
+
bodySizeLimit?: number;
|
|
21
|
+
}
|
|
22
|
+
declare const API_ROUTE_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
|
|
23
|
+
declare class APIRouteManager {
|
|
24
|
+
private routes;
|
|
25
|
+
private viteServer?;
|
|
26
|
+
private appDirs;
|
|
27
|
+
private throwOnLoadError;
|
|
28
|
+
private i18n?;
|
|
29
|
+
private bodySizeLimit?;
|
|
30
|
+
constructor(appDir: string | readonly string[], viteServer?: ViteDevServer, options?: APIRouteManagerOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Discover route.ts files in /app/api and explicit endpoints in root routes.ts
|
|
33
|
+
*/
|
|
34
|
+
discoverRoutes(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Recursively find all route.ts files
|
|
37
|
+
*/
|
|
38
|
+
private findRouteFiles;
|
|
39
|
+
/**
|
|
40
|
+
* Load a route.ts file and extract HTTP method exports
|
|
41
|
+
*/
|
|
42
|
+
private loadRoute;
|
|
43
|
+
/**
|
|
44
|
+
* Load explicit-path endpoints from src/routes.ts-style files.
|
|
45
|
+
*/
|
|
46
|
+
private loadRootRoutes;
|
|
47
|
+
private loadProgrammaticApiRoutes;
|
|
48
|
+
private handleLoadError;
|
|
49
|
+
private findRootRoutesFile;
|
|
50
|
+
private loadModule;
|
|
51
|
+
private addEndpoint;
|
|
52
|
+
private addProgrammaticApiRoute;
|
|
53
|
+
/**
|
|
54
|
+
* Get the handler that directly invokes endpoint handlers
|
|
55
|
+
*/
|
|
56
|
+
getHandler(): ((req: Request) => Promise<Response>) | null;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a path is an API route
|
|
59
|
+
*/
|
|
60
|
+
isAPIRoute(pathname: string): boolean;
|
|
61
|
+
matchRoute(pathname: string): APIRouteMatch<APIRoute> | null;
|
|
62
|
+
/**
|
|
63
|
+
* Get all routes for client type generation
|
|
64
|
+
*/
|
|
65
|
+
getRoutes(): Map<string, APIRoute>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { type APIRoute, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { F as FarmRouteRuntimeConfig } from '../route-runtime-DoOHzCAD.js';
|
|
3
|
+
import '../types-BMxWr97v.js';
|
|
4
|
+
import { F as FarmI18nRuntime } from '../runtime-bv63eUiO.js';
|
|
5
|
+
import { A as APIRouteMatch } from '../runtime-Bpp-c28k.js';
|
|
6
|
+
export { c as APIRouteParamValue, b as APIRouteParams, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-Bpp-c28k.js';
|
|
7
|
+
import '../resolver-IH4RmPEl.js';
|
|
8
|
+
import '../cache.js';
|
|
9
|
+
import '../transport-BmbGTXA5.js';
|
|
10
|
+
|
|
11
|
+
interface APIRoute extends FarmRouteRuntimeConfig {
|
|
12
|
+
path: string;
|
|
13
|
+
filePath: string;
|
|
14
|
+
methods: string[];
|
|
15
|
+
endpoints: Record<string, any>;
|
|
16
|
+
}
|
|
17
|
+
interface APIRouteManagerOptions {
|
|
18
|
+
throwOnLoadError?: boolean;
|
|
19
|
+
i18n?: FarmI18nRuntime;
|
|
20
|
+
bodySizeLimit?: number;
|
|
21
|
+
}
|
|
22
|
+
declare const API_ROUTE_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
|
|
23
|
+
declare class APIRouteManager {
|
|
24
|
+
private routes;
|
|
25
|
+
private viteServer?;
|
|
26
|
+
private appDirs;
|
|
27
|
+
private throwOnLoadError;
|
|
28
|
+
private i18n?;
|
|
29
|
+
private bodySizeLimit?;
|
|
30
|
+
constructor(appDir: string | readonly string[], viteServer?: ViteDevServer, options?: APIRouteManagerOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Discover route.ts files in /app/api and explicit endpoints in root routes.ts
|
|
33
|
+
*/
|
|
34
|
+
discoverRoutes(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Recursively find all route.ts files
|
|
37
|
+
*/
|
|
38
|
+
private findRouteFiles;
|
|
39
|
+
/**
|
|
40
|
+
* Load a route.ts file and extract HTTP method exports
|
|
41
|
+
*/
|
|
42
|
+
private loadRoute;
|
|
43
|
+
/**
|
|
44
|
+
* Load explicit-path endpoints from src/routes.ts-style files.
|
|
45
|
+
*/
|
|
46
|
+
private loadRootRoutes;
|
|
47
|
+
private loadProgrammaticApiRoutes;
|
|
48
|
+
private handleLoadError;
|
|
49
|
+
private findRootRoutesFile;
|
|
50
|
+
private loadModule;
|
|
51
|
+
private addEndpoint;
|
|
52
|
+
private addProgrammaticApiRoute;
|
|
53
|
+
/**
|
|
54
|
+
* Get the handler that directly invokes endpoint handlers
|
|
55
|
+
*/
|
|
56
|
+
getHandler(): ((req: Request) => Promise<Response>) | null;
|
|
57
|
+
/**
|
|
58
|
+
* Check if a path is an API route
|
|
59
|
+
*/
|
|
60
|
+
isAPIRoute(pathname: string): boolean;
|
|
61
|
+
matchRoute(pathname: string): APIRouteMatch<APIRoute> | null;
|
|
62
|
+
/**
|
|
63
|
+
* Get all routes for client type generation
|
|
64
|
+
*/
|
|
65
|
+
getRoutes(): Map<string, APIRoute>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { type APIRoute, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { A as APIRouteMatch, c as APIRouteParamValue, b as APIRouteParams, C as createEndpointFailureResponse, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-Q3u74Nbq.mjs';
|
|
2
|
+
import '../cache.mjs';
|
|
3
|
+
import '../transport-BmbGTXA5.mjs';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { A as APIRouteMatch, c as APIRouteParamValue, b as APIRouteParams, C as createEndpointFailureResponse, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-Bpp-c28k.js';
|
|
2
|
+
import '../cache.js';
|
|
3
|
+
import '../transport-BmbGTXA5.js';
|
package/dist/api.cjs
CHANGED
|
@@ -3955,6 +3955,13 @@ function _withAfterNodeMiddleware(handler) {
|
|
|
3955
3955
|
}
|
|
3956
3956
|
__name(_withAfterNodeMiddleware, "_withAfterNodeMiddleware");
|
|
3957
3957
|
|
|
3958
|
+
// src/cli-colors.ts
|
|
3959
|
+
var import_picocolors = __toESM(require("picocolors"));
|
|
3960
|
+
function createCliColors(interactive = process.stdout.isTTY === true) {
|
|
3961
|
+
return import_picocolors.default.createColors(interactive);
|
|
3962
|
+
}
|
|
3963
|
+
__name(createCliColors, "createCliColors");
|
|
3964
|
+
|
|
3958
3965
|
// src/api/vite-plugin.ts
|
|
3959
3966
|
function farmApiPlugin(options = {}) {
|
|
3960
3967
|
const srcDir = options.srcDir ?? "src";
|
|
@@ -3969,25 +3976,21 @@ function farmApiPlugin(options = {}) {
|
|
|
3969
3976
|
const log = /* @__PURE__ */ __name((_message) => {
|
|
3970
3977
|
}, "log");
|
|
3971
3978
|
const logResponse = /* @__PURE__ */ __name((method, urlPath, status, duration) => {
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
console.log(logMsg);
|
|
3988
|
-
} catch {
|
|
3989
|
-
console.log(`[FARM] [API] [${method}] ${urlPath} - ${status} (${duration}ms)`);
|
|
3990
|
-
}
|
|
3979
|
+
const pc = createCliColors();
|
|
3980
|
+
let statusColor = pc.green;
|
|
3981
|
+
if (status >= 500) statusColor = pc.red;
|
|
3982
|
+
else if (status >= 400) statusColor = pc.yellow;
|
|
3983
|
+
else if (status >= 300) statusColor = pc.cyan;
|
|
3984
|
+
const logMsg = [
|
|
3985
|
+
pc.dim("[") + pc.bold(pc.blue("FARM")) + pc.dim("]"),
|
|
3986
|
+
pc.dim("[") + pc.bold(pc.cyan("API")) + pc.dim("]"),
|
|
3987
|
+
pc.dim("[") + pc.bold(pc.white(method.padEnd(3))) + pc.dim("]"),
|
|
3988
|
+
pc.gray(urlPath),
|
|
3989
|
+
pc.dim("-"),
|
|
3990
|
+
statusColor(status.toString()),
|
|
3991
|
+
pc.dim(`(${duration}ms)`)
|
|
3992
|
+
].join(" ");
|
|
3993
|
+
console.log(logMsg);
|
|
3991
3994
|
}, "logResponse");
|
|
3992
3995
|
const addEndpoint = /* @__PURE__ */ __name((routePath, filePath, method, endpoint) => {
|
|
3993
3996
|
const normalizedMethod = method.toUpperCase();
|