@farm.js/core 0.1.0-beta.10 → 0.1.0-beta.11

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.
Files changed (184) hide show
  1. package/dist/after.d.mts +25 -0
  2. package/dist/after.d.ts +25 -0
  3. package/dist/agent-runtime.d.mts +94 -0
  4. package/dist/agent-runtime.d.ts +94 -0
  5. package/dist/api/route-manager.d.mts +66 -0
  6. package/dist/api/route-manager.d.ts +66 -0
  7. package/dist/api/runtime.d.mts +3 -0
  8. package/dist/api/runtime.d.ts +3 -0
  9. package/dist/api.d.mts +48 -0
  10. package/dist/api.d.ts +48 -0
  11. package/dist/app-BNE2FoZ4.d.mts +302 -0
  12. package/dist/app-DRGUmJ3s.d.ts +302 -0
  13. package/dist/app-markdown.d.mts +22 -0
  14. package/dist/app-markdown.d.ts +22 -0
  15. package/dist/cache.d.mts +192 -0
  16. package/dist/cache.d.ts +192 -0
  17. package/dist/{chunk-DTOWEQRV.mjs → chunk-4677KXB7.mjs} +2 -2
  18. package/dist/{chunk-3QDB3IA6.mjs → chunk-5EVQFRL2.mjs} +2 -2
  19. package/dist/{chunk-3QDB3IA6.mjs.map → chunk-5EVQFRL2.mjs.map} +1 -1
  20. package/dist/{chunk-E2AI2CW7.mjs → chunk-77BOAQHI.mjs} +4 -3
  21. package/dist/chunk-77BOAQHI.mjs.map +1 -0
  22. package/dist/client-BT1mFQas.d.mts +447 -0
  23. package/dist/client-Nn0q4eO4.d.ts +447 -0
  24. package/dist/client-cache-CIlyBlmx.d.ts +6 -0
  25. package/dist/client-cache-D-EZ7XVW.d.mts +6 -0
  26. package/dist/client-plugins-Bc5jHcNr.d.ts +1927 -0
  27. package/dist/client-plugins-jsk-ZLzJ.d.mts +1927 -0
  28. package/dist/client-plugins.d.mts +22 -0
  29. package/dist/client-plugins.d.ts +22 -0
  30. package/dist/client.d.mts +447 -0
  31. package/dist/client.d.ts +447 -0
  32. package/dist/config.d.mts +29 -0
  33. package/dist/config.d.ts +29 -0
  34. package/dist/cron.d.mts +78 -0
  35. package/dist/cron.d.ts +78 -0
  36. package/dist/deferred.d.mts +42 -0
  37. package/dist/deferred.d.ts +42 -0
  38. package/dist/deployment.d.mts +34 -0
  39. package/dist/deployment.d.ts +34 -0
  40. package/dist/docs.d.mts +69 -0
  41. package/dist/docs.d.ts +69 -0
  42. package/dist/env-types.d.mts +12 -0
  43. package/dist/env-types.d.ts +12 -0
  44. package/dist/env.d.mts +45 -0
  45. package/dist/env.d.ts +45 -0
  46. package/dist/environment/vite.d.mts +22 -0
  47. package/dist/environment/vite.d.ts +22 -0
  48. package/dist/environment.d.mts +18 -0
  49. package/dist/environment.d.ts +18 -0
  50. package/dist/font.d.mts +70 -0
  51. package/dist/font.d.ts +70 -0
  52. package/dist/headers.d.mts +22 -0
  53. package/dist/headers.d.ts +22 -0
  54. package/dist/i18n/client.d.mts +32 -0
  55. package/dist/i18n/client.d.ts +32 -0
  56. package/dist/i18n/index.d.mts +20 -0
  57. package/dist/i18n/index.d.ts +20 -0
  58. package/dist/i18n/server.d.mts +30 -0
  59. package/dist/i18n/server.d.ts +30 -0
  60. package/dist/image/server.d.mts +37 -0
  61. package/dist/image/server.d.ts +37 -0
  62. package/dist/image/sharp.d.mts +7 -0
  63. package/dist/image/sharp.d.ts +7 -0
  64. package/dist/image-config-Duob7wER.d.mts +50 -0
  65. package/dist/image-config-Duob7wER.d.ts +50 -0
  66. package/dist/image.d.mts +39 -0
  67. package/dist/image.d.ts +39 -0
  68. package/dist/index.cjs +3 -2
  69. package/dist/index.cjs.map +1 -1
  70. package/dist/index.d.mts +455 -0
  71. package/dist/index.d.ts +455 -0
  72. package/dist/index.mjs +3 -3
  73. package/dist/integration-api-CHT2OKAf.d.mts +93 -0
  74. package/dist/integration-api-CHT2OKAf.d.ts +93 -0
  75. package/dist/integrations.d.mts +22 -0
  76. package/dist/integrations.d.ts +22 -0
  77. package/dist/internal/build-runtime.cjs +3 -2
  78. package/dist/internal/build-runtime.cjs.map +1 -1
  79. package/dist/internal/build-runtime.d.mts +39 -0
  80. package/dist/internal/build-runtime.d.ts +39 -0
  81. package/dist/internal/build-runtime.mjs +3 -3
  82. package/dist/internal/client-runtime.d.mts +2 -0
  83. package/dist/internal/client-runtime.d.ts +2 -0
  84. package/dist/internal/config-runtime.d.mts +39 -0
  85. package/dist/internal/config-runtime.d.ts +39 -0
  86. package/dist/internal/production-node-env.d.mts +12 -0
  87. package/dist/internal/production-node-env.d.ts +12 -0
  88. package/dist/internal/production-runtime.d.mts +41 -0
  89. package/dist/internal/production-runtime.d.ts +41 -0
  90. package/dist/markdown.d.mts +60 -0
  91. package/dist/markdown.d.ts +60 -0
  92. package/dist/metadata-7ffpT3jr.d.mts +22 -0
  93. package/dist/metadata-JHn-8eht.d.ts +22 -0
  94. package/dist/middleware.d.mts +164 -0
  95. package/dist/middleware.d.ts +164 -0
  96. package/dist/navigation-errors-Dvwpzaer.d.mts +13 -0
  97. package/dist/navigation-errors-Dvwpzaer.d.ts +13 -0
  98. package/dist/navigation.d.mts +14 -0
  99. package/dist/navigation.d.ts +14 -0
  100. package/dist/observability.d.mts +335 -0
  101. package/dist/observability.d.ts +335 -0
  102. package/dist/params-BALtrRim.d.ts +15 -0
  103. package/dist/params-ry-lxqmy.d.mts +15 -0
  104. package/dist/plugin-BJDf43dc.d.mts +165 -0
  105. package/dist/plugin-BJDf43dc.d.ts +165 -0
  106. package/dist/plugin.cjs +2 -1
  107. package/dist/plugin.cjs.map +1 -1
  108. package/dist/plugin.d.mts +22 -0
  109. package/dist/plugin.d.ts +22 -0
  110. package/dist/plugin.mjs +2 -2
  111. package/dist/production-runtime-9KG7GuvW.d.ts +79 -0
  112. package/dist/production-runtime-B-fweKts.d.mts +79 -0
  113. package/dist/production-runtime-C_B79w2P.d.mts +28 -0
  114. package/dist/production-runtime-DDEM1D2q.d.ts +28 -0
  115. package/dist/query/client.d.mts +61 -0
  116. package/dist/query/client.d.ts +61 -0
  117. package/dist/query/index.d.mts +90 -0
  118. package/dist/query/index.d.ts +90 -0
  119. package/dist/query/parsers.d.mts +25 -0
  120. package/dist/query/parsers.d.ts +25 -0
  121. package/dist/query/server.d.mts +55 -0
  122. package/dist/query/server.d.ts +55 -0
  123. package/dist/request-Dsq4kGW0.d.mts +6 -0
  124. package/dist/request-udtobOLv.d.ts +6 -0
  125. package/dist/request.d.mts +2 -0
  126. package/dist/request.d.ts +2 -0
  127. package/dist/resolver-DJqjLMg_.d.mts +14 -0
  128. package/dist/resolver-IH4RmPEl.d.ts +14 -0
  129. package/dist/route-runtime-DoOHzCAD.d.mts +38 -0
  130. package/dist/route-runtime-DoOHzCAD.d.ts +38 -0
  131. package/dist/router.d.mts +36 -0
  132. package/dist/router.d.ts +36 -0
  133. package/dist/routes.d.mts +224 -0
  134. package/dist/routes.d.ts +224 -0
  135. package/dist/runtime-9nQjVM7X.d.mts +206 -0
  136. package/dist/runtime-Cxpq6xZN.d.mts +27 -0
  137. package/dist/runtime-DgeS2skB.d.ts +206 -0
  138. package/dist/runtime-bv63eUiO.d.ts +27 -0
  139. package/dist/server-action-security.d.mts +43 -0
  140. package/dist/server-action-security.d.ts +43 -0
  141. package/dist/server-fn-client.d.mts +32 -0
  142. package/dist/server-fn-client.d.ts +32 -0
  143. package/dist/server-fn.d.mts +93 -0
  144. package/dist/server-fn.d.ts +93 -0
  145. package/dist/server-plugins.d.mts +55 -0
  146. package/dist/server-plugins.d.ts +55 -0
  147. package/dist/server-query-client.d.mts +50 -0
  148. package/dist/server-query-client.d.ts +50 -0
  149. package/dist/server-query.d.mts +36 -0
  150. package/dist/server-query.d.ts +36 -0
  151. package/dist/server.cjs +3 -2
  152. package/dist/server.cjs.map +1 -1
  153. package/dist/server.d.mts +48 -0
  154. package/dist/server.d.ts +48 -0
  155. package/dist/server.mjs +2 -2
  156. package/dist/storage.d.mts +52 -0
  157. package/dist/storage.d.ts +52 -0
  158. package/dist/testing.d.mts +101 -0
  159. package/dist/testing.d.ts +101 -0
  160. package/dist/transport-BmbGTXA5.d.mts +49 -0
  161. package/dist/transport-BmbGTXA5.d.ts +49 -0
  162. package/dist/types-BMxWr97v.d.mts +81 -0
  163. package/dist/types-BMxWr97v.d.ts +81 -0
  164. package/dist/types-C9N-nk5R.d.mts +53 -0
  165. package/dist/types-C9N-nk5R.d.ts +53 -0
  166. package/dist/types-D1A6-XvH.d.mts +73 -0
  167. package/dist/types-D1A6-XvH.d.ts +73 -0
  168. package/dist/utils-CA0z0c-2.d.ts +23 -0
  169. package/dist/utils-mYVkSOt2.d.mts +23 -0
  170. package/dist/version.cjs +1 -1
  171. package/dist/version.cjs.map +1 -1
  172. package/dist/version.d.mts +3 -0
  173. package/dist/version.d.ts +3 -0
  174. package/dist/version.mjs +1 -1
  175. package/dist/vite.cjs +3 -2
  176. package/dist/vite.cjs.map +1 -1
  177. package/dist/vite.d.mts +22 -0
  178. package/dist/vite.d.ts +22 -0
  179. package/dist/vite.mjs +2 -2
  180. package/dist/workflows.d.mts +110 -0
  181. package/dist/workflows.d.ts +110 -0
  182. package/package.json +1 -1
  183. package/dist/chunk-E2AI2CW7.mjs.map +0 -1
  184. /package/dist/{chunk-DTOWEQRV.mjs.map → chunk-4677KXB7.mjs.map} +0 -0
@@ -0,0 +1,25 @@
1
+ import { ServerResponse, IncomingMessage } from 'node:http';
2
+
3
+ type AfterCallback = () => void | Promise<void>;
4
+ /** Runtime hooks supplied by a deployment adapter. */
5
+ interface FarmAfterPlatformContext {
6
+ /** Keep a serverless invocation alive until the scheduled work settles. */
7
+ waitUntil?: (promise: Promise<void>) => void;
8
+ /** Register a callback that runs once the response has finished. */
9
+ onResponseFinished?: (callback: () => void) => void;
10
+ }
11
+ /**
12
+ * Schedule non-blocking work for after the current response finishes.
13
+ *
14
+ * Callbacks run in registration order. A callback failure is reported without
15
+ * changing the response or preventing later callbacks from running.
16
+ */
17
+ declare function after(callback: AfterCallback): void;
18
+ /** @internal Run a Web Request handler inside Farm's post-response lifecycle. */
19
+ declare function _runWithAfterRequest(request: Request, handler: () => Response | Promise<Response>, context?: FarmAfterPlatformContext): Promise<Response>;
20
+ /** @internal Run a Node response handler inside Farm's post-response lifecycle. */
21
+ declare function _runWithAfterNodeResponse<T>(response: ServerResponse, handler: () => T | Promise<T>, context?: Pick<FarmAfterPlatformContext, "waitUntil">): Promise<T>;
22
+ /** @internal Add Farm's post-response lifecycle to a Node middleware. */
23
+ declare function _withAfterNodeMiddleware(handler: (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => void | Promise<void>): (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => Promise<void>;
24
+
25
+ export { type AfterCallback, type FarmAfterPlatformContext, _runWithAfterNodeResponse, _runWithAfterRequest, _withAfterNodeMiddleware, after };
@@ -0,0 +1,25 @@
1
+ import { ServerResponse, IncomingMessage } from 'node:http';
2
+
3
+ type AfterCallback = () => void | Promise<void>;
4
+ /** Runtime hooks supplied by a deployment adapter. */
5
+ interface FarmAfterPlatformContext {
6
+ /** Keep a serverless invocation alive until the scheduled work settles. */
7
+ waitUntil?: (promise: Promise<void>) => void;
8
+ /** Register a callback that runs once the response has finished. */
9
+ onResponseFinished?: (callback: () => void) => void;
10
+ }
11
+ /**
12
+ * Schedule non-blocking work for after the current response finishes.
13
+ *
14
+ * Callbacks run in registration order. A callback failure is reported without
15
+ * changing the response or preventing later callbacks from running.
16
+ */
17
+ declare function after(callback: AfterCallback): void;
18
+ /** @internal Run a Web Request handler inside Farm's post-response lifecycle. */
19
+ declare function _runWithAfterRequest(request: Request, handler: () => Response | Promise<Response>, context?: FarmAfterPlatformContext): Promise<Response>;
20
+ /** @internal Run a Node response handler inside Farm's post-response lifecycle. */
21
+ declare function _runWithAfterNodeResponse<T>(response: ServerResponse, handler: () => T | Promise<T>, context?: Pick<FarmAfterPlatformContext, "waitUntil">): Promise<T>;
22
+ /** @internal Add Farm's post-response lifecycle to a Node middleware. */
23
+ declare function _withAfterNodeMiddleware(handler: (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => void | Promise<void>): (request: IncomingMessage, response: ServerResponse, next: (error?: unknown) => void) => Promise<void>;
24
+
25
+ export { type AfterCallback, type FarmAfterPlatformContext, _runWithAfterNodeResponse, _runWithAfterRequest, _withAfterNodeMiddleware, after };
@@ -0,0 +1,94 @@
1
+ import { ChildProcess } from 'node:child_process';
2
+ import { U as BundleResultPayload, V as FarmPlugin, W as FarmIntegration } from './client-plugins-jsk-ZLzJ.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-C9N-nk5R.mjs';
12
+ import '@farming-labs/docs';
13
+ import './markdown.mjs';
14
+ import './observability.mjs';
15
+ import 'vite';
16
+ import './workflows.mjs';
17
+ import './cron.mjs';
18
+ import './env.mjs';
19
+ import './server-action-security.mjs';
20
+ import './image-config-Duob7wER.mjs';
21
+ import './types-BMxWr97v.mjs';
22
+ import './cache.mjs';
23
+ import './route-runtime-DoOHzCAD.mjs';
24
+
25
+ interface FarmAgentRuntimeInstance {
26
+ readonly provider: string;
27
+ readonly routePrefix: string;
28
+ readonly routePrefixes: readonly string[];
29
+ getOrigin(): string | undefined;
30
+ }
31
+ interface FarmManagedAgentRuntime {
32
+ readonly origin: string;
33
+ readonly process?: ChildProcess;
34
+ stop(): Promise<void>;
35
+ }
36
+ interface FarmAgentRuntimeStartContext {
37
+ readonly root: string;
38
+ readonly log: {
39
+ info(message: string, meta?: Record<string, unknown>): void;
40
+ warn(message: string, meta?: Record<string, unknown>): void;
41
+ error(message: string, meta?: Record<string, unknown>): void;
42
+ };
43
+ }
44
+ interface FarmAgentRuntimeBuildContext extends BundleResultPayload {
45
+ readonly provider: string;
46
+ readonly routePrefix: string;
47
+ readonly routePrefixes: readonly string[];
48
+ }
49
+ interface FarmAgentRuntimeIntegrationOptions {
50
+ provider: string;
51
+ routePrefix: string;
52
+ /** Whether Farm's production server must dispatch this runtime's proxy routes. */
53
+ serverRuntime?: boolean;
54
+ additionalRoutePrefixes?: readonly string[];
55
+ origin?: string;
56
+ originEnv?: string | readonly string[];
57
+ webSockets?: boolean;
58
+ startDev?(context: FarmAgentRuntimeStartContext): Promise<FarmManagedAgentRuntime>;
59
+ afterBuild?(context: FarmAgentRuntimeBuildContext): Promise<void> | void;
60
+ plugins?: readonly FarmPlugin[];
61
+ instance?: Record<string, unknown>;
62
+ }
63
+ interface FarmManagedProcessOptions {
64
+ command: string;
65
+ args?: readonly string[];
66
+ cwd: string;
67
+ env?: Record<string, string | undefined>;
68
+ label: string;
69
+ origin?: string;
70
+ resolveOrigin?(output: string): string | undefined;
71
+ healthPath?: string;
72
+ timeoutMs?: number;
73
+ stopTimeoutMs?: number;
74
+ onOutput?(line: string, stream: "stdout" | "stderr"): void;
75
+ }
76
+ interface FarmAgentProxyOptions {
77
+ fetch?: typeof globalThis.fetch;
78
+ }
79
+ declare function createAgentRuntimeIntegration(options: FarmAgentRuntimeIntegrationOptions): FarmIntegration;
80
+ declare function applyAgentRuntimeViteProxy(config: {
81
+ vite?: Record<string, any>;
82
+ }, input: {
83
+ origin: string;
84
+ routePrefix: string;
85
+ webSockets?: boolean;
86
+ }): void;
87
+ declare function proxyAgentRuntimeRequest(request: Request, origin: string, options?: FarmAgentProxyOptions): Promise<Response>;
88
+ declare function startManagedAgentRuntime(options: FarmManagedProcessOptions): Promise<FarmManagedAgentRuntime>;
89
+ declare function findAvailableAgentRuntimePort(host?: string): Promise<number>;
90
+ declare function resolveProjectPackageBin(projectRoot: string, packageName: string, binName?: string): Promise<string>;
91
+ declare function normalizeAgentOrigin(value: string): string;
92
+ declare function normalizeAgentRoutePrefix(value: string): string;
93
+
94
+ 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,94 @@
1
+ import { ChildProcess } from 'node:child_process';
2
+ import { U as BundleResultPayload, V as FarmPlugin, W as FarmIntegration } from './client-plugins-Bc5jHcNr.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-C9N-nk5R.js';
12
+ import '@farming-labs/docs';
13
+ import './markdown.js';
14
+ import './observability.js';
15
+ import 'vite';
16
+ import './workflows.js';
17
+ import './cron.js';
18
+ import './env.js';
19
+ import './server-action-security.js';
20
+ import './image-config-Duob7wER.js';
21
+ import './types-BMxWr97v.js';
22
+ import './cache.js';
23
+ import './route-runtime-DoOHzCAD.js';
24
+
25
+ interface FarmAgentRuntimeInstance {
26
+ readonly provider: string;
27
+ readonly routePrefix: string;
28
+ readonly routePrefixes: readonly string[];
29
+ getOrigin(): string | undefined;
30
+ }
31
+ interface FarmManagedAgentRuntime {
32
+ readonly origin: string;
33
+ readonly process?: ChildProcess;
34
+ stop(): Promise<void>;
35
+ }
36
+ interface FarmAgentRuntimeStartContext {
37
+ readonly root: string;
38
+ readonly log: {
39
+ info(message: string, meta?: Record<string, unknown>): void;
40
+ warn(message: string, meta?: Record<string, unknown>): void;
41
+ error(message: string, meta?: Record<string, unknown>): void;
42
+ };
43
+ }
44
+ interface FarmAgentRuntimeBuildContext extends BundleResultPayload {
45
+ readonly provider: string;
46
+ readonly routePrefix: string;
47
+ readonly routePrefixes: readonly string[];
48
+ }
49
+ interface FarmAgentRuntimeIntegrationOptions {
50
+ provider: string;
51
+ routePrefix: string;
52
+ /** Whether Farm's production server must dispatch this runtime's proxy routes. */
53
+ serverRuntime?: boolean;
54
+ additionalRoutePrefixes?: readonly string[];
55
+ origin?: string;
56
+ originEnv?: string | readonly string[];
57
+ webSockets?: boolean;
58
+ startDev?(context: FarmAgentRuntimeStartContext): Promise<FarmManagedAgentRuntime>;
59
+ afterBuild?(context: FarmAgentRuntimeBuildContext): Promise<void> | void;
60
+ plugins?: readonly FarmPlugin[];
61
+ instance?: Record<string, unknown>;
62
+ }
63
+ interface FarmManagedProcessOptions {
64
+ command: string;
65
+ args?: readonly string[];
66
+ cwd: string;
67
+ env?: Record<string, string | undefined>;
68
+ label: string;
69
+ origin?: string;
70
+ resolveOrigin?(output: string): string | undefined;
71
+ healthPath?: string;
72
+ timeoutMs?: number;
73
+ stopTimeoutMs?: number;
74
+ onOutput?(line: string, stream: "stdout" | "stderr"): void;
75
+ }
76
+ interface FarmAgentProxyOptions {
77
+ fetch?: typeof globalThis.fetch;
78
+ }
79
+ declare function createAgentRuntimeIntegration(options: FarmAgentRuntimeIntegrationOptions): FarmIntegration;
80
+ declare function applyAgentRuntimeViteProxy(config: {
81
+ vite?: Record<string, any>;
82
+ }, input: {
83
+ origin: string;
84
+ routePrefix: string;
85
+ webSockets?: boolean;
86
+ }): void;
87
+ declare function proxyAgentRuntimeRequest(request: Request, origin: string, options?: FarmAgentProxyOptions): Promise<Response>;
88
+ declare function startManagedAgentRuntime(options: FarmManagedProcessOptions): Promise<FarmManagedAgentRuntime>;
89
+ declare function findAvailableAgentRuntimePort(host?: string): Promise<number>;
90
+ declare function resolveProjectPackageBin(projectRoot: string, packageName: string, binName?: string): Promise<string>;
91
+ declare function normalizeAgentOrigin(value: string): string;
92
+ declare function normalizeAgentRoutePrefix(value: string): string;
93
+
94
+ 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,66 @@
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-9nQjVM7X.mjs';
6
+ export { c as APIRouteParamValue, b as APIRouteParams, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-9nQjVM7X.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
+ }
21
+ declare const API_ROUTE_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
22
+ declare class APIRouteManager {
23
+ private routes;
24
+ private viteServer?;
25
+ private appDirs;
26
+ private throwOnLoadError;
27
+ private i18n?;
28
+ constructor(appDir: string | readonly string[], viteServer?: ViteDevServer, options?: APIRouteManagerOptions);
29
+ /**
30
+ * Discover route.ts files in /app/api and explicit endpoints in root routes.ts
31
+ */
32
+ discoverRoutes(): Promise<void>;
33
+ /**
34
+ * Recursively find all route.ts files
35
+ */
36
+ private findRouteFiles;
37
+ /**
38
+ * Load a route.ts file and extract HTTP method exports
39
+ */
40
+ private loadRoute;
41
+ /**
42
+ * Load explicit-path endpoints from src/routes.ts-style files.
43
+ */
44
+ private loadRootRoutes;
45
+ private loadProgrammaticApiRoutes;
46
+ private handleLoadError;
47
+ private findRootRoutesFile;
48
+ private loadModule;
49
+ private addEndpoint;
50
+ private addProgrammaticApiRoute;
51
+ /**
52
+ * Get the handler that directly invokes endpoint handlers
53
+ */
54
+ getHandler(): ((req: Request) => Promise<Response>) | null;
55
+ /**
56
+ * Check if a path is an API route
57
+ */
58
+ isAPIRoute(pathname: string): boolean;
59
+ matchRoute(pathname: string): APIRouteMatch<APIRoute> | null;
60
+ /**
61
+ * Get all routes for client type generation
62
+ */
63
+ getRoutes(): Map<string, APIRoute>;
64
+ }
65
+
66
+ export { type APIRoute, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
@@ -0,0 +1,66 @@
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-DgeS2skB.js';
6
+ export { c as APIRouteParamValue, b as APIRouteParams, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-DgeS2skB.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
+ }
21
+ declare const API_ROUTE_METHODS: readonly ["GET", "HEAD", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
22
+ declare class APIRouteManager {
23
+ private routes;
24
+ private viteServer?;
25
+ private appDirs;
26
+ private throwOnLoadError;
27
+ private i18n?;
28
+ constructor(appDir: string | readonly string[], viteServer?: ViteDevServer, options?: APIRouteManagerOptions);
29
+ /**
30
+ * Discover route.ts files in /app/api and explicit endpoints in root routes.ts
31
+ */
32
+ discoverRoutes(): Promise<void>;
33
+ /**
34
+ * Recursively find all route.ts files
35
+ */
36
+ private findRouteFiles;
37
+ /**
38
+ * Load a route.ts file and extract HTTP method exports
39
+ */
40
+ private loadRoute;
41
+ /**
42
+ * Load explicit-path endpoints from src/routes.ts-style files.
43
+ */
44
+ private loadRootRoutes;
45
+ private loadProgrammaticApiRoutes;
46
+ private handleLoadError;
47
+ private findRootRoutesFile;
48
+ private loadModule;
49
+ private addEndpoint;
50
+ private addProgrammaticApiRoute;
51
+ /**
52
+ * Get the handler that directly invokes endpoint handlers
53
+ */
54
+ getHandler(): ((req: Request) => Promise<Response>) | null;
55
+ /**
56
+ * Check if a path is an API route
57
+ */
58
+ isAPIRoute(pathname: string): boolean;
59
+ matchRoute(pathname: string): APIRouteMatch<APIRoute> | null;
60
+ /**
61
+ * Get all routes for client type generation
62
+ */
63
+ getRoutes(): Map<string, APIRoute>;
64
+ }
65
+
66
+ 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, z as createEndpointFailureResponse, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-9nQjVM7X.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, z as createEndpointFailureResponse, i as invokeAPIRouteEndpoint, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from '../runtime-DgeS2skB.js';
2
+ import '../cache.js';
3
+ import '../transport-BmbGTXA5.js';
package/dist/api.d.mts ADDED
@@ -0,0 +1,48 @@
1
+ export { A as APIRouteMatch, c as APIRouteParamValue, b as APIRouteParams, q as AnyEndpointMiddleware, D as DELETE, e as EndpointErrorContracts, E as EndpointErrorDefinition, d as EndpointErrorDefinitions, f as EndpointFail, g as EndpointFailure, v as EndpointHandler, s as EndpointInvalidationContext, r as EndpointInvalidationTarget, t as EndpointInvalidations, p as EndpointMiddleware, l as EndpointMiddlewareContext, o as EndpointMiddlewareResult, u as EndpointOptions, j as EndpointParamValue, k as EndpointParams, G as GET, H as HEAD, I as InferEndpointMiddlewareContext, O as OPTIONS, y as PATCH, P as POST, x as PUT, T as TypedEndpoint, w as createEndpoint, i as invokeAPIRouteEndpoint, h as isEndpointFailure, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from './runtime-9nQjVM7X.mjs';
2
+ export { APIRoute, APIRouteManager, APIRouteManagerOptions, API_ROUTE_METHODS } from './api/route-manager.mjs';
3
+ export { r as APIClient, h as APIClientError, b as APIClientOptions, i as APIClientSystemError, c as APIClientWithoutIntegrationsOptions, g as APIResult, A as APIRouteRefMetadata, C as CacheKey, l as CacheOptions, k as CachePolicy, p as ClientOptions, a as FARM_API_ROUTE_META_SYMBOL, F as FARM_API_ROUTE_REF_SYMBOL, n as InvalidateOptions, I as InvalidateTarget, o as OptimisticOptions, O as OptimisticUpdate, R as RequestEvent, j as ResponseEvent, m as RetryOptions, q as RouteAPIClient, s as ServerAPIClient, S as ServerAPIClientOptions, d as ServerAPIClientWithoutIntegrationsOptions, f as StatusEvent, e as StatusPhase, t as createAPIClient, w as createServerAPIClient, v as getAPIRouteRefMetadata, u as isAPIRouteRef } from './client-BT1mFQas.mjs';
4
+ export { F as FarmAPIStream, c as FarmStreamResponse, a as MultipartField, M as MultipartSchema, b as MultipartValues, T as TypedFormData, e as isFarmAPIStream, d as isJSONStreamResponse, i as isMultipartSchema, j as jsonStream, m as multipart, r as readJSONStream, t as toFormData } from './transport-BmbGTXA5.mjs';
5
+ import { Plugin } from 'vite';
6
+ import './cache.mjs';
7
+ import './route-runtime-DoOHzCAD.mjs';
8
+ import './types-BMxWr97v.mjs';
9
+ import './runtime-Cxpq6xZN.mjs';
10
+ import './resolver-DJqjLMg_.mjs';
11
+ import './integration-api-CHT2OKAf.mjs';
12
+ import './client-cache-D-EZ7XVW.mjs';
13
+
14
+ /**
15
+ * Farm.js API Routes Vite Plugin
16
+ *
17
+ * Standalone API route support that works with any Vite setup.
18
+ * Discovers and handles route.ts files in the api directory.
19
+ * Also supports root routes.ts for custom route definitions.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { farmApiPlugin } from '@farm.js/core'
24
+ *
25
+ * export default defineConfig({
26
+ * plugins: [farmApiPlugin({ srcDir: 'src' })],
27
+ * })
28
+ * ```
29
+ */
30
+
31
+ interface FarmApiPluginOptions {
32
+ /** Source directory containing the api folder (default: 'src') */
33
+ srcDir?: string;
34
+ /** Enable debug logging */
35
+ debug?: boolean;
36
+ }
37
+ interface ApiRoute {
38
+ path: string;
39
+ filePath: string;
40
+ methods: string[];
41
+ endpoints: Record<string, any>;
42
+ }
43
+ /**
44
+ * Farm.js API Routes Vite Plugin
45
+ */
46
+ declare function farmApiPlugin(options?: FarmApiPluginOptions): Plugin;
47
+
48
+ export { type ApiRoute, type FarmApiPluginOptions, farmApiPlugin };
package/dist/api.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ export { A as APIRouteMatch, c as APIRouteParamValue, b as APIRouteParams, q as AnyEndpointMiddleware, D as DELETE, e as EndpointErrorContracts, E as EndpointErrorDefinition, d as EndpointErrorDefinitions, f as EndpointFail, g as EndpointFailure, v as EndpointHandler, s as EndpointInvalidationContext, r as EndpointInvalidationTarget, t as EndpointInvalidations, p as EndpointMiddleware, l as EndpointMiddlewareContext, o as EndpointMiddlewareResult, u as EndpointOptions, j as EndpointParamValue, k as EndpointParams, G as GET, H as HEAD, I as InferEndpointMiddlewareContext, O as OPTIONS, y as PATCH, P as POST, x as PUT, T as TypedEndpoint, w as createEndpoint, i as invokeAPIRouteEndpoint, h as isEndpointFailure, a as isWebResponse, m as matchAPIRoute, n as normalizeRouteResponse } from './runtime-DgeS2skB.js';
2
+ export { APIRoute, APIRouteManager, APIRouteManagerOptions, API_ROUTE_METHODS } from './api/route-manager.js';
3
+ export { r as APIClient, h as APIClientError, b as APIClientOptions, i as APIClientSystemError, c as APIClientWithoutIntegrationsOptions, g as APIResult, A as APIRouteRefMetadata, C as CacheKey, l as CacheOptions, k as CachePolicy, p as ClientOptions, a as FARM_API_ROUTE_META_SYMBOL, F as FARM_API_ROUTE_REF_SYMBOL, n as InvalidateOptions, I as InvalidateTarget, o as OptimisticOptions, O as OptimisticUpdate, R as RequestEvent, j as ResponseEvent, m as RetryOptions, q as RouteAPIClient, s as ServerAPIClient, S as ServerAPIClientOptions, d as ServerAPIClientWithoutIntegrationsOptions, f as StatusEvent, e as StatusPhase, t as createAPIClient, w as createServerAPIClient, v as getAPIRouteRefMetadata, u as isAPIRouteRef } from './client-Nn0q4eO4.js';
4
+ export { F as FarmAPIStream, c as FarmStreamResponse, a as MultipartField, M as MultipartSchema, b as MultipartValues, T as TypedFormData, e as isFarmAPIStream, d as isJSONStreamResponse, i as isMultipartSchema, j as jsonStream, m as multipart, r as readJSONStream, t as toFormData } from './transport-BmbGTXA5.js';
5
+ import { Plugin } from 'vite';
6
+ import './cache.js';
7
+ import './route-runtime-DoOHzCAD.js';
8
+ import './types-BMxWr97v.js';
9
+ import './runtime-bv63eUiO.js';
10
+ import './resolver-IH4RmPEl.js';
11
+ import './integration-api-CHT2OKAf.js';
12
+ import './client-cache-CIlyBlmx.js';
13
+
14
+ /**
15
+ * Farm.js API Routes Vite Plugin
16
+ *
17
+ * Standalone API route support that works with any Vite setup.
18
+ * Discovers and handles route.ts files in the api directory.
19
+ * Also supports root routes.ts for custom route definitions.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * import { farmApiPlugin } from '@farm.js/core'
24
+ *
25
+ * export default defineConfig({
26
+ * plugins: [farmApiPlugin({ srcDir: 'src' })],
27
+ * })
28
+ * ```
29
+ */
30
+
31
+ interface FarmApiPluginOptions {
32
+ /** Source directory containing the api folder (default: 'src') */
33
+ srcDir?: string;
34
+ /** Enable debug logging */
35
+ debug?: boolean;
36
+ }
37
+ interface ApiRoute {
38
+ path: string;
39
+ filePath: string;
40
+ methods: string[];
41
+ endpoints: Record<string, any>;
42
+ }
43
+ /**
44
+ * Farm.js API Routes Vite Plugin
45
+ */
46
+ declare function farmApiPlugin(options?: FarmApiPluginOptions): Plugin;
47
+
48
+ export { type ApiRoute, type FarmApiPluginOptions, farmApiPlugin };