@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,121 @@
|
|
|
1
|
+
import { FarmCacheInvalidationTarget } from './cache.js';
|
|
2
|
+
import { S as ServerFnFailure, a as ServerActionError } from './server-fn-error-DDh14a0V.js';
|
|
3
|
+
export { F as FARM_SERVER_FN_FAILURE_SYMBOL, b as SerializedServerFnFailure, c as createServerFnTransportError, i as isServerFnFailure } from './server-fn-error-DDh14a0V.js';
|
|
4
|
+
|
|
5
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
6
|
+
type ServerFnSchema = {
|
|
7
|
+
_input?: any;
|
|
8
|
+
_output?: any;
|
|
9
|
+
parse?: (data: unknown) => any;
|
|
10
|
+
parseAsync?: (data: unknown) => Promise<any>;
|
|
11
|
+
safeParse?: (data: unknown) => any;
|
|
12
|
+
safeParseAsync?: (data: unknown) => Promise<any>;
|
|
13
|
+
};
|
|
14
|
+
type InferServerFnSchemaInput<T> = T extends {
|
|
15
|
+
_input: infer I;
|
|
16
|
+
} ? I : unknown;
|
|
17
|
+
type InferServerFnSchemaOutput<T> = T extends {
|
|
18
|
+
_output: infer O;
|
|
19
|
+
} ? O : T extends {
|
|
20
|
+
parse: (data: unknown) => infer R;
|
|
21
|
+
} ? R : unknown;
|
|
22
|
+
type ServerFnErrorSchema = ServerFnSchema & ({
|
|
23
|
+
parse: (data: unknown) => unknown;
|
|
24
|
+
} | {
|
|
25
|
+
safeParse: (data: unknown) => unknown;
|
|
26
|
+
});
|
|
27
|
+
type ServerFnErrorDefinition<TSchema extends ServerFnErrorSchema = ServerFnErrorSchema, TStatus extends number = number> = {
|
|
28
|
+
status: TStatus;
|
|
29
|
+
/** Schema for the public error payload exposed to callers. */
|
|
30
|
+
data: TSchema;
|
|
31
|
+
/** Public message safe to expose to callers. */
|
|
32
|
+
message?: string;
|
|
33
|
+
};
|
|
34
|
+
type ServerFnErrorDefinitions = Record<string, ServerFnErrorDefinition<ServerFnErrorSchema, number>>;
|
|
35
|
+
type ServerFnDeclaredError<TErrors extends ServerFnErrorDefinitions> = {
|
|
36
|
+
[TCode in keyof TErrors]: ServerFnFailure<TCode & string, InferServerFnSchemaOutput<TErrors[TCode]["data"]>, TErrors[TCode]["status"]>;
|
|
37
|
+
}[keyof TErrors];
|
|
38
|
+
type ServerFnError<TErrors extends ServerFnErrorDefinitions> = keyof TErrors extends never ? Error : ServerActionError | ServerFnDeclaredError<TErrors>;
|
|
39
|
+
type ServerFnErrorHandler<TErrors extends ServerFnErrorDefinitions> = <TCode extends keyof TErrors & string>(code: TCode, data: InferServerFnSchemaInput<TErrors[TCode]["data"]>) => never;
|
|
40
|
+
type ServerFnFormInput = FormData;
|
|
41
|
+
type Simplify<T> = {
|
|
42
|
+
[TKey in keyof T]: T[TKey];
|
|
43
|
+
} & {};
|
|
44
|
+
type AssignContext<TCurrent extends object, TNext extends object> = Simplify<Omit<TCurrent, keyof TNext> & TNext>;
|
|
45
|
+
type MiddlewareContext<TMiddleware> = TMiddleware extends ServerFnMiddleware<infer TContext> ? TContext : {};
|
|
46
|
+
type ServerFnMiddlewareContext<TMiddlewares extends readonly AnyServerFnMiddleware[], TContext extends object = {}> = TMiddlewares extends readonly [infer TMiddleware, ...infer TRest] ? TMiddleware extends AnyServerFnMiddleware ? TRest extends readonly AnyServerFnMiddleware[] ? ServerFnMiddlewareContext<TRest, AssignContext<TContext, MiddlewareContext<TMiddleware>>> : TContext : TContext : number extends TMiddlewares["length"] ? Simplify<TContext & MiddlewareContext<TMiddlewares[number]>> : Simplify<TContext>;
|
|
47
|
+
declare const SERVER_FN_MIDDLEWARE_CONTEXT: unique symbol;
|
|
48
|
+
type ServerFnMiddlewareContinuation<TContext extends object = {}> = {
|
|
49
|
+
readonly [SERVER_FN_MIDDLEWARE_CONTEXT]: TContext;
|
|
50
|
+
};
|
|
51
|
+
type ServerFnMiddlewareNext = <TContext extends object = {}>(options?: {
|
|
52
|
+
context?: TContext;
|
|
53
|
+
}) => Promise<ServerFnMiddlewareContinuation<TContext>>;
|
|
54
|
+
type ServerFnContext<TInput, TContext extends object = {}> = {
|
|
55
|
+
input: TInput;
|
|
56
|
+
rawInput: unknown;
|
|
57
|
+
formData?: FormData;
|
|
58
|
+
/** The action request when invoked across the network. Undefined for direct server calls. */
|
|
59
|
+
request?: Request;
|
|
60
|
+
/** Aborts when the underlying action request is cancelled. */
|
|
61
|
+
signal: AbortSignal;
|
|
62
|
+
/** Context produced by this server function's middleware chain. */
|
|
63
|
+
context: Readonly<TContext>;
|
|
64
|
+
};
|
|
65
|
+
type ServerFnHandlerContext<TInput, TContext extends object = {}, TErrors extends ServerFnErrorDefinitions = {}> = ServerFnContext<TInput, TContext> & {
|
|
66
|
+
/** Return a declared, validated error from this server function. */
|
|
67
|
+
error: ServerFnErrorHandler<TErrors>;
|
|
68
|
+
};
|
|
69
|
+
type ServerFnHandler<TInput, TResult, TContext extends object = {}, TErrors extends ServerFnErrorDefinitions = {}> = (ctx: ServerFnHandlerContext<TInput, TContext, TErrors>) => MaybePromise<TResult>;
|
|
70
|
+
type ServerFnInvalidationContext<TInput, TResult, TContext extends object = {}> = ServerFnContext<TInput, TContext> & {
|
|
71
|
+
/** Parsed value returned by the successful server function. */
|
|
72
|
+
result: TResult;
|
|
73
|
+
};
|
|
74
|
+
type ServerFnInvalidations<TInput, TResult, TContext extends object = {}> = readonly FarmCacheInvalidationTarget[] | ((context: ServerFnInvalidationContext<TInput, TResult, TContext>) => readonly FarmCacheInvalidationTarget[] | Promise<readonly FarmCacheInvalidationTarget[]>);
|
|
75
|
+
type ServerFnMiddlewareHandlerContext<TContext extends object = {}> = ServerFnContext<unknown, TContext> & {
|
|
76
|
+
next: ServerFnMiddlewareNext;
|
|
77
|
+
};
|
|
78
|
+
type ServerFnMiddlewareHandler<TContext extends object = {}, TProvidedContext extends object = {}> = (ctx: ServerFnMiddlewareHandlerContext<TContext>) => MaybePromise<ServerFnMiddlewareContinuation<TProvidedContext>>;
|
|
79
|
+
type ServerFnMiddleware<TContext extends object = {}> = {
|
|
80
|
+
readonly __farmServerFnMiddleware: true;
|
|
81
|
+
readonly __farmServerFnMiddlewareContext?: TContext;
|
|
82
|
+
readonly middleware: readonly AnyServerFnMiddleware[];
|
|
83
|
+
readonly handler: ServerFnMiddlewareHandler<any, any>;
|
|
84
|
+
};
|
|
85
|
+
type AnyServerFnMiddleware = ServerFnMiddleware<any>;
|
|
86
|
+
type ServerFnMiddlewareOptions<TMiddlewares extends readonly AnyServerFnMiddleware[], TProvidedContext extends object> = {
|
|
87
|
+
middleware?: TMiddlewares;
|
|
88
|
+
handler: ServerFnMiddlewareHandler<ServerFnMiddlewareContext<TMiddlewares>, TProvidedContext>;
|
|
89
|
+
};
|
|
90
|
+
type ServerFnOptions<TSchema extends ServerFnSchema | undefined, TResult, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], TErrors extends ServerFnErrorDefinitions = {}> = {
|
|
91
|
+
input?: TSchema;
|
|
92
|
+
output?: undefined;
|
|
93
|
+
middleware?: TMiddlewares;
|
|
94
|
+
errors?: TErrors;
|
|
95
|
+
invalidates?: ServerFnInvalidations<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, Awaited<TResult>, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
96
|
+
handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>, TErrors>;
|
|
97
|
+
};
|
|
98
|
+
type ServerFnOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], TErrors extends ServerFnErrorDefinitions = {}> = {
|
|
99
|
+
input?: TInputSchema;
|
|
100
|
+
output: TOutputSchema;
|
|
101
|
+
middleware?: TMiddlewares;
|
|
102
|
+
errors?: TErrors;
|
|
103
|
+
invalidates?: ServerFnInvalidations<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, Awaited<InferServerFnSchemaOutput<TOutputSchema>>, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
104
|
+
handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>, TErrors>;
|
|
105
|
+
};
|
|
106
|
+
type ServerFn<TInput, TResult, TError extends Error = Error> = ([unknown] extends [TInput] ? (input?: TInput | FormData) => Promise<TResult> : (input: TInput | FormData) => Promise<TResult>) & {
|
|
107
|
+
readonly __farmServerFn: true;
|
|
108
|
+
readonly __farmServerFnInput?: unknown;
|
|
109
|
+
readonly __farmServerFnOutput?: unknown;
|
|
110
|
+
readonly __farmServerFnError: TError;
|
|
111
|
+
};
|
|
112
|
+
type InferServerFnError<TServerFn> = TServerFn extends ServerFn<any, any, infer TError> ? TError : Error;
|
|
113
|
+
declare const FARM_SERVER_FN_SYMBOL: unique symbol;
|
|
114
|
+
declare function createServerMiddleware<const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], TProvidedContext extends object = {}>(options: ServerFnMiddlewareOptions<TMiddlewares, TProvidedContext>): ServerFnMiddleware<AssignContext<ServerFnMiddlewareContext<TMiddlewares>, TProvidedContext>>;
|
|
115
|
+
declare function createServerFn<TInputSchema extends ServerFnSchema, TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], const TErrors extends ServerFnErrorDefinitions = {}>(options: ServerFnOutputOptions<TInputSchema, TOutputSchema, TMiddlewares, TErrors>): ServerFn<InferServerFnSchemaInput<TInputSchema>, Awaited<InferServerFnSchemaOutput<TOutputSchema>>, ServerFnError<TErrors>>;
|
|
116
|
+
declare function createServerFn<TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], const TErrors extends ServerFnErrorDefinitions = {}>(options: ServerFnOutputOptions<undefined, TOutputSchema, TMiddlewares, TErrors>): ServerFn<unknown, Awaited<InferServerFnSchemaOutput<TOutputSchema>>, ServerFnError<TErrors>>;
|
|
117
|
+
declare function createServerFn<TSchema extends ServerFnSchema, TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], const TErrors extends ServerFnErrorDefinitions = {}>(options: ServerFnOptions<TSchema, TResult, TMiddlewares, TErrors>): ServerFn<InferServerFnSchemaInput<TSchema>, Awaited<TResult>, ServerFnError<TErrors>>;
|
|
118
|
+
declare function createServerFn<TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly [], const TErrors extends ServerFnErrorDefinitions = {}>(options: ServerFnOptions<undefined, TResult, TMiddlewares, TErrors>): ServerFn<unknown, Awaited<TResult>, ServerFnError<TErrors>>;
|
|
119
|
+
declare function _parseServerFnSchema(schema: ServerFnSchema | undefined, value: unknown, contract: "input" | "output", owner?: string): Promise<any>;
|
|
120
|
+
|
|
121
|
+
export { type AnyServerFnMiddleware, FARM_SERVER_FN_SYMBOL, type InferServerFnError, type InferServerFnSchemaInput, type InferServerFnSchemaOutput, ServerActionError, type ServerFn, type ServerFnContext, type ServerFnDeclaredError, type ServerFnError, type ServerFnErrorDefinition, type ServerFnErrorDefinitions, type ServerFnErrorHandler, type ServerFnErrorSchema, ServerFnFailure, type ServerFnFormInput, type ServerFnHandler, type ServerFnHandlerContext, type ServerFnInvalidationContext, type ServerFnInvalidations, type ServerFnMiddleware, type ServerFnMiddlewareContext, type ServerFnMiddlewareContinuation, type ServerFnMiddlewareHandler, type ServerFnMiddlewareHandlerContext, type ServerFnMiddlewareNext, type ServerFnMiddlewareOptions, type ServerFnOptions, type ServerFnOutputOptions, type ServerFnSchema, _parseServerFnSchema, createServerFn, createServerMiddleware };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { bi as RedirectConfig, x as FarmRequest, y as FarmResponse, aG as FarmPluginContext, $ as FarmPlugin, bj as HeaderConfig, bk as RewriteConfig } from './client-plugins-CCilIb_G.mjs';
|
|
2
|
+
export { aI as FarmPluginLifecycle, aJ as FarmRequestPluginContext, aK as FarmRequestStore } from './client-plugins-CCilIb_G.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 './types-CsR8fpgF.mjs';
|
|
25
|
+
import './route-runtime-DoOHzCAD.mjs';
|
|
26
|
+
import './font.mjs';
|
|
27
|
+
|
|
28
|
+
declare function createRedirectsPlugin(redirects: RedirectConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
29
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
30
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
31
|
+
}): FarmPlugin;
|
|
32
|
+
|
|
33
|
+
declare function createHeadersPlugin(headers: HeaderConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
34
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
35
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
36
|
+
}): FarmPlugin;
|
|
37
|
+
|
|
38
|
+
declare function createRewritesPlugin(rewrites: RewriteConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
39
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
40
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
41
|
+
}): FarmPlugin;
|
|
42
|
+
|
|
43
|
+
declare function createEnvPlugin(env: Record<string, string>, { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
44
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
45
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
46
|
+
}): FarmPlugin;
|
|
47
|
+
|
|
48
|
+
declare function createCompressionPlugin({ beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
49
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
50
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
51
|
+
}): FarmPlugin;
|
|
52
|
+
|
|
53
|
+
declare function createLoggerPlugin({ beforeRequest, afterResponse, }?: {
|
|
54
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
55
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
56
|
+
}): FarmPlugin;
|
|
57
|
+
|
|
58
|
+
export { FarmPlugin, FarmPluginContext, HeaderConfig, RedirectConfig, RewriteConfig, createCompressionPlugin, createEnvPlugin, createHeadersPlugin, createLoggerPlugin, createRedirectsPlugin, createRewritesPlugin };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { bi as RedirectConfig, x as FarmRequest, y as FarmResponse, aG as FarmPluginContext, $ as FarmPlugin, bj as HeaderConfig, bk as RewriteConfig } from './client-plugins-DuuleQKk.js';
|
|
2
|
+
export { aI as FarmPluginLifecycle, aJ as FarmRequestPluginContext, aK as FarmRequestStore } from './client-plugins-DuuleQKk.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 './types-CsR8fpgF.js';
|
|
25
|
+
import './route-runtime-DoOHzCAD.js';
|
|
26
|
+
import './font.js';
|
|
27
|
+
|
|
28
|
+
declare function createRedirectsPlugin(redirects: RedirectConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
29
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
30
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
31
|
+
}): FarmPlugin;
|
|
32
|
+
|
|
33
|
+
declare function createHeadersPlugin(headers: HeaderConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
34
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
35
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
36
|
+
}): FarmPlugin;
|
|
37
|
+
|
|
38
|
+
declare function createRewritesPlugin(rewrites: RewriteConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
39
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
40
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
41
|
+
}): FarmPlugin;
|
|
42
|
+
|
|
43
|
+
declare function createEnvPlugin(env: Record<string, string>, { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
44
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
45
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
46
|
+
}): FarmPlugin;
|
|
47
|
+
|
|
48
|
+
declare function createCompressionPlugin({ beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
49
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
50
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
51
|
+
}): FarmPlugin;
|
|
52
|
+
|
|
53
|
+
declare function createLoggerPlugin({ beforeRequest, afterResponse, }?: {
|
|
54
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
55
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
56
|
+
}): FarmPlugin;
|
|
57
|
+
|
|
58
|
+
export { FarmPlugin, FarmPluginContext, HeaderConfig, RedirectConfig, RewriteConfig, createCompressionPlugin, createEnvPlugin, createHeadersPlugin, createLoggerPlugin, createRedirectsPlugin, createRewritesPlugin };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { a as FarmClientCacheStatus } from './client-cache-D-EZ7XVW.mjs';
|
|
2
|
+
import { ServerQuery } from './server-query.mjs';
|
|
3
|
+
import './cache.mjs';
|
|
4
|
+
import './server-fn.mjs';
|
|
5
|
+
import './server-fn-error-DDh14a0V.mjs';
|
|
6
|
+
|
|
7
|
+
declare const FARM_SERVER_QUERY_RESULT_VERSION: 1;
|
|
8
|
+
type FarmServerQueryResult<TData> = {
|
|
9
|
+
__farmServerQuery: {
|
|
10
|
+
version: typeof FARM_SERVER_QUERY_RESULT_VERSION;
|
|
11
|
+
key: string;
|
|
12
|
+
staleTime: number | false;
|
|
13
|
+
updatedAt: number;
|
|
14
|
+
};
|
|
15
|
+
data: TData;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ServerQueryFetchOptions = {
|
|
19
|
+
/** Used only when a non-Farm transport returns plain data. Farm transports use the declaration. */
|
|
20
|
+
staleTime?: number | false;
|
|
21
|
+
/** Return stale data immediately while refreshing it in the background. Default true. */
|
|
22
|
+
swr?: boolean;
|
|
23
|
+
/** Always wait for a new result. */
|
|
24
|
+
force?: boolean;
|
|
25
|
+
};
|
|
26
|
+
type UseServerQueryOptions = ServerQueryFetchOptions & {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
refetchOnWindowFocus?: boolean;
|
|
29
|
+
refetchOnReconnect?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type UseServerQueryResult<TData> = {
|
|
32
|
+
data: TData | undefined;
|
|
33
|
+
error: Error | null;
|
|
34
|
+
status: FarmClientCacheStatus;
|
|
35
|
+
pending: boolean;
|
|
36
|
+
fetching: boolean;
|
|
37
|
+
stale: boolean;
|
|
38
|
+
refetch: () => Promise<TData>;
|
|
39
|
+
};
|
|
40
|
+
type FarmServerQueryActionInvocation = {
|
|
41
|
+
actionId: string;
|
|
42
|
+
args: readonly unknown[];
|
|
43
|
+
provisionalKey?: string;
|
|
44
|
+
};
|
|
45
|
+
declare function beginFarmServerQueryAction(actionId: string, args: readonly unknown[]): FarmServerQueryActionInvocation;
|
|
46
|
+
declare function completeFarmServerQueryAction<TData>(invocation: FarmServerQueryActionInvocation, value: TData | FarmServerQueryResult<TData>): TData;
|
|
47
|
+
declare function fetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: ServerQueryFetchOptions): Promise<TData>;
|
|
48
|
+
declare function prefetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: Omit<ServerQueryFetchOptions, "force">): Promise<TData>;
|
|
49
|
+
declare function useServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: UseServerQueryOptions): UseServerQueryResult<TData>;
|
|
50
|
+
|
|
51
|
+
export { type FarmServerQueryActionInvocation, type ServerQueryFetchOptions, type UseServerQueryOptions, type UseServerQueryResult, beginFarmServerQueryAction, completeFarmServerQueryAction, fetchServerQuery, prefetchServerQuery, useServerQuery };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { a as FarmClientCacheStatus } from './client-cache-CIlyBlmx.js';
|
|
2
|
+
import { ServerQuery } from './server-query.js';
|
|
3
|
+
import './cache.js';
|
|
4
|
+
import './server-fn.js';
|
|
5
|
+
import './server-fn-error-DDh14a0V.js';
|
|
6
|
+
|
|
7
|
+
declare const FARM_SERVER_QUERY_RESULT_VERSION: 1;
|
|
8
|
+
type FarmServerQueryResult<TData> = {
|
|
9
|
+
__farmServerQuery: {
|
|
10
|
+
version: typeof FARM_SERVER_QUERY_RESULT_VERSION;
|
|
11
|
+
key: string;
|
|
12
|
+
staleTime: number | false;
|
|
13
|
+
updatedAt: number;
|
|
14
|
+
};
|
|
15
|
+
data: TData;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type ServerQueryFetchOptions = {
|
|
19
|
+
/** Used only when a non-Farm transport returns plain data. Farm transports use the declaration. */
|
|
20
|
+
staleTime?: number | false;
|
|
21
|
+
/** Return stale data immediately while refreshing it in the background. Default true. */
|
|
22
|
+
swr?: boolean;
|
|
23
|
+
/** Always wait for a new result. */
|
|
24
|
+
force?: boolean;
|
|
25
|
+
};
|
|
26
|
+
type UseServerQueryOptions = ServerQueryFetchOptions & {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
refetchOnWindowFocus?: boolean;
|
|
29
|
+
refetchOnReconnect?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type UseServerQueryResult<TData> = {
|
|
32
|
+
data: TData | undefined;
|
|
33
|
+
error: Error | null;
|
|
34
|
+
status: FarmClientCacheStatus;
|
|
35
|
+
pending: boolean;
|
|
36
|
+
fetching: boolean;
|
|
37
|
+
stale: boolean;
|
|
38
|
+
refetch: () => Promise<TData>;
|
|
39
|
+
};
|
|
40
|
+
type FarmServerQueryActionInvocation = {
|
|
41
|
+
actionId: string;
|
|
42
|
+
args: readonly unknown[];
|
|
43
|
+
provisionalKey?: string;
|
|
44
|
+
};
|
|
45
|
+
declare function beginFarmServerQueryAction(actionId: string, args: readonly unknown[]): FarmServerQueryActionInvocation;
|
|
46
|
+
declare function completeFarmServerQueryAction<TData>(invocation: FarmServerQueryActionInvocation, value: TData | FarmServerQueryResult<TData>): TData;
|
|
47
|
+
declare function fetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: ServerQueryFetchOptions): Promise<TData>;
|
|
48
|
+
declare function prefetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: Omit<ServerQueryFetchOptions, "force">): Promise<TData>;
|
|
49
|
+
declare function useServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: UseServerQueryOptions): UseServerQueryResult<TData>;
|
|
50
|
+
|
|
51
|
+
export { type FarmServerQueryActionInvocation, type ServerQueryFetchOptions, type UseServerQueryOptions, type UseServerQueryResult, beginFarmServerQueryAction, completeFarmServerQueryAction, fetchServerQuery, prefetchServerQuery, useServerQuery };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RouteDataCacheKey } from './cache.mjs';
|
|
2
|
+
import { ServerFnContext, ServerFnSchema, AnyServerFnMiddleware, InferServerFnSchemaOutput, ServerFnMiddlewareContext, ServerFnHandler, InferServerFnSchemaInput } from './server-fn.mjs';
|
|
3
|
+
import './server-fn-error-DDh14a0V.mjs';
|
|
4
|
+
|
|
5
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
6
|
+
type ServerQueryStaleTime = number | false | `${number}${"ms" | "s" | "m" | "h"}`;
|
|
7
|
+
type ServerQueryKey<TInput, TContext extends object = {}> = (context: ServerFnContext<TInput, TContext>) => MaybePromise<RouteDataCacheKey>;
|
|
8
|
+
type ServerQueryOptions<TSchema extends ServerFnSchema | undefined, TResult, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
9
|
+
input?: TSchema;
|
|
10
|
+
output?: undefined;
|
|
11
|
+
middleware?: TMiddlewares;
|
|
12
|
+
key: ServerQueryKey<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
13
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
14
|
+
staleTime?: ServerQueryStaleTime;
|
|
15
|
+
handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
16
|
+
};
|
|
17
|
+
type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
18
|
+
input?: TInputSchema;
|
|
19
|
+
output: TOutputSchema;
|
|
20
|
+
middleware?: TMiddlewares;
|
|
21
|
+
key: ServerQueryKey<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
22
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
23
|
+
staleTime?: ServerQueryStaleTime;
|
|
24
|
+
handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
25
|
+
};
|
|
26
|
+
type ServerQuery<TInput, TResult> = ([unknown] extends [TInput] ? (input?: TInput) => Promise<TResult> : (input: TInput) => Promise<TResult>) & {
|
|
27
|
+
readonly __farmServerQuery: true;
|
|
28
|
+
readonly __farmServerQueryInput?: unknown;
|
|
29
|
+
readonly __farmServerQueryOutput?: unknown;
|
|
30
|
+
};
|
|
31
|
+
declare const FARM_SERVER_QUERY_SYMBOL: unique symbol;
|
|
32
|
+
declare function createServerQuery<TInputSchema extends ServerFnSchema, TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOutputOptions<TInputSchema, TOutputSchema, TMiddlewares>): ServerQuery<InferServerFnSchemaInput<TInputSchema>, Awaited<InferServerFnSchemaOutput<TOutputSchema>>>;
|
|
33
|
+
declare function createServerQuery<TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOutputOptions<undefined, TOutputSchema, TMiddlewares>): ServerQuery<unknown, Awaited<InferServerFnSchemaOutput<TOutputSchema>>>;
|
|
34
|
+
declare function createServerQuery<TSchema extends ServerFnSchema, TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<TSchema, TResult, TMiddlewares>): ServerQuery<InferServerFnSchemaInput<TSchema>, Awaited<TResult>>;
|
|
35
|
+
declare function createServerQuery<TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<undefined, TResult, TMiddlewares>): ServerQuery<unknown, Awaited<TResult>>;
|
|
36
|
+
|
|
37
|
+
export { FARM_SERVER_QUERY_SYMBOL, type ServerQuery, type ServerQueryKey, type ServerQueryOptions, type ServerQueryOutputOptions, type ServerQueryStaleTime, createServerQuery };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RouteDataCacheKey } from './cache.js';
|
|
2
|
+
import { ServerFnContext, ServerFnSchema, AnyServerFnMiddleware, InferServerFnSchemaOutput, ServerFnMiddlewareContext, ServerFnHandler, InferServerFnSchemaInput } from './server-fn.js';
|
|
3
|
+
import './server-fn-error-DDh14a0V.js';
|
|
4
|
+
|
|
5
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
6
|
+
type ServerQueryStaleTime = number | false | `${number}${"ms" | "s" | "m" | "h"}`;
|
|
7
|
+
type ServerQueryKey<TInput, TContext extends object = {}> = (context: ServerFnContext<TInput, TContext>) => MaybePromise<RouteDataCacheKey>;
|
|
8
|
+
type ServerQueryOptions<TSchema extends ServerFnSchema | undefined, TResult, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
9
|
+
input?: TSchema;
|
|
10
|
+
output?: undefined;
|
|
11
|
+
middleware?: TMiddlewares;
|
|
12
|
+
key: ServerQueryKey<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
13
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
14
|
+
staleTime?: ServerQueryStaleTime;
|
|
15
|
+
handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
16
|
+
};
|
|
17
|
+
type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
18
|
+
input?: TInputSchema;
|
|
19
|
+
output: TOutputSchema;
|
|
20
|
+
middleware?: TMiddlewares;
|
|
21
|
+
key: ServerQueryKey<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
22
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
23
|
+
staleTime?: ServerQueryStaleTime;
|
|
24
|
+
handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
25
|
+
};
|
|
26
|
+
type ServerQuery<TInput, TResult> = ([unknown] extends [TInput] ? (input?: TInput) => Promise<TResult> : (input: TInput) => Promise<TResult>) & {
|
|
27
|
+
readonly __farmServerQuery: true;
|
|
28
|
+
readonly __farmServerQueryInput?: unknown;
|
|
29
|
+
readonly __farmServerQueryOutput?: unknown;
|
|
30
|
+
};
|
|
31
|
+
declare const FARM_SERVER_QUERY_SYMBOL: unique symbol;
|
|
32
|
+
declare function createServerQuery<TInputSchema extends ServerFnSchema, TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOutputOptions<TInputSchema, TOutputSchema, TMiddlewares>): ServerQuery<InferServerFnSchemaInput<TInputSchema>, Awaited<InferServerFnSchemaOutput<TOutputSchema>>>;
|
|
33
|
+
declare function createServerQuery<TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOutputOptions<undefined, TOutputSchema, TMiddlewares>): ServerQuery<unknown, Awaited<InferServerFnSchemaOutput<TOutputSchema>>>;
|
|
34
|
+
declare function createServerQuery<TSchema extends ServerFnSchema, TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<TSchema, TResult, TMiddlewares>): ServerQuery<InferServerFnSchemaInput<TSchema>, Awaited<TResult>>;
|
|
35
|
+
declare function createServerQuery<TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<undefined, TResult, TMiddlewares>): ServerQuery<unknown, Awaited<TResult>>;
|
|
36
|
+
|
|
37
|
+
export { FARM_SERVER_QUERY_SYMBOL, type ServerQuery, type ServerQueryKey, type ServerQueryOptions, type ServerQueryOutputOptions, type ServerQueryStaleTime, createServerQuery };
|