@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.
- package/dist/after.d.mts +25 -0
- package/dist/after.d.ts +25 -0
- package/dist/agent-runtime.d.mts +94 -0
- package/dist/agent-runtime.d.ts +94 -0
- package/dist/api/route-manager.d.mts +66 -0
- package/dist/api/route-manager.d.ts +66 -0
- package/dist/api/runtime.d.mts +3 -0
- package/dist/api/runtime.d.ts +3 -0
- package/dist/api.d.mts +48 -0
- package/dist/api.d.ts +48 -0
- package/dist/app-BNE2FoZ4.d.mts +302 -0
- package/dist/app-DRGUmJ3s.d.ts +302 -0
- package/dist/app-markdown.d.mts +22 -0
- package/dist/app-markdown.d.ts +22 -0
- package/dist/cache.d.mts +192 -0
- package/dist/cache.d.ts +192 -0
- package/dist/{chunk-DTOWEQRV.mjs → chunk-4677KXB7.mjs} +2 -2
- package/dist/{chunk-3QDB3IA6.mjs → chunk-5EVQFRL2.mjs} +2 -2
- package/dist/{chunk-3QDB3IA6.mjs.map → chunk-5EVQFRL2.mjs.map} +1 -1
- package/dist/{chunk-E2AI2CW7.mjs → chunk-77BOAQHI.mjs} +4 -3
- package/dist/chunk-77BOAQHI.mjs.map +1 -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-Bc5jHcNr.d.ts +1927 -0
- package/dist/client-plugins-jsk-ZLzJ.d.mts +1927 -0
- package/dist/client-plugins.d.mts +22 -0
- package/dist/client-plugins.d.ts +22 -0
- package/dist/client.d.mts +447 -0
- package/dist/client.d.ts +447 -0
- package/dist/config.d.mts +29 -0
- package/dist/config.d.ts +29 -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 +34 -0
- package/dist/deployment.d.ts +34 -0
- package/dist/docs.d.mts +69 -0
- package/dist/docs.d.ts +69 -0
- 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 +70 -0
- package/dist/font.d.ts +70 -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 +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +455 -0
- package/dist/index.d.ts +455 -0
- package/dist/index.mjs +3 -3
- package/dist/integration-api-CHT2OKAf.d.mts +93 -0
- package/dist/integration-api-CHT2OKAf.d.ts +93 -0
- package/dist/integrations.d.mts +22 -0
- package/dist/integrations.d.ts +22 -0
- package/dist/internal/build-runtime.cjs +3 -2
- package/dist/internal/build-runtime.cjs.map +1 -1
- package/dist/internal/build-runtime.d.mts +39 -0
- package/dist/internal/build-runtime.d.ts +39 -0
- package/dist/internal/build-runtime.mjs +3 -3
- package/dist/internal/client-runtime.d.mts +2 -0
- package/dist/internal/client-runtime.d.ts +2 -0
- package/dist/internal/config-runtime.d.mts +39 -0
- package/dist/internal/config-runtime.d.ts +39 -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 +41 -0
- package/dist/internal/production-runtime.d.ts +41 -0
- package/dist/markdown.d.mts +60 -0
- package/dist/markdown.d.ts +60 -0
- package/dist/metadata-7ffpT3jr.d.mts +22 -0
- package/dist/metadata-JHn-8eht.d.ts +22 -0
- package/dist/middleware.d.mts +164 -0
- package/dist/middleware.d.ts +164 -0
- 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 +2 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.mts +22 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/plugin.mjs +2 -2
- package/dist/production-runtime-9KG7GuvW.d.ts +79 -0
- package/dist/production-runtime-B-fweKts.d.mts +79 -0
- package/dist/production-runtime-C_B79w2P.d.mts +28 -0
- package/dist/production-runtime-DDEM1D2q.d.ts +28 -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-Dsq4kGW0.d.mts +6 -0
- package/dist/request-udtobOLv.d.ts +6 -0
- package/dist/request.d.mts +2 -0
- package/dist/request.d.ts +2 -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 +224 -0
- package/dist/routes.d.ts +224 -0
- package/dist/runtime-9nQjVM7X.d.mts +206 -0
- package/dist/runtime-Cxpq6xZN.d.mts +27 -0
- package/dist/runtime-DgeS2skB.d.ts +206 -0
- package/dist/runtime-bv63eUiO.d.ts +27 -0
- package/dist/server-action-security.d.mts +43 -0
- package/dist/server-action-security.d.ts +43 -0
- package/dist/server-fn-client.d.mts +32 -0
- package/dist/server-fn-client.d.ts +32 -0
- package/dist/server-fn.d.mts +93 -0
- package/dist/server-fn.d.ts +93 -0
- package/dist/server-plugins.d.mts +55 -0
- package/dist/server-plugins.d.ts +55 -0
- package/dist/server-query-client.d.mts +50 -0
- package/dist/server-query-client.d.ts +50 -0
- package/dist/server-query.d.mts +36 -0
- package/dist/server-query.d.ts +36 -0
- package/dist/server.cjs +3 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +48 -0
- package/dist/server.d.ts +48 -0
- package/dist/server.mjs +2 -2
- package/dist/storage.d.mts +52 -0
- package/dist/storage.d.ts +52 -0
- package/dist/testing.d.mts +101 -0
- package/dist/testing.d.ts +101 -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-C9N-nk5R.d.mts +53 -0
- package/dist/types-C9N-nk5R.d.ts +53 -0
- package/dist/types-D1A6-XvH.d.mts +73 -0
- package/dist/types-D1A6-XvH.d.ts +73 -0
- package/dist/utils-CA0z0c-2.d.ts +23 -0
- package/dist/utils-mYVkSOt2.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 +3 -2
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -0
- package/dist/vite.mjs +2 -2
- package/dist/workflows.d.mts +110 -0
- package/dist/workflows.d.ts +110 -0
- package/package.json +1 -1
- package/dist/chunk-E2AI2CW7.mjs.map +0 -1
- /package/dist/{chunk-DTOWEQRV.mjs.map → chunk-4677KXB7.mjs.map} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { aV as RedirectConfig, t as FarmRequest, u as FarmResponse, aj as FarmPluginContext, V as FarmPlugin, aW as HeaderConfig, aX as RewriteConfig } from './client-plugins-jsk-ZLzJ.mjs';
|
|
2
|
+
export { ak as FarmRequestPluginContext, al as FarmRequestStore } 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
|
+
declare function createRedirectsPlugin(redirects: RedirectConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
26
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
27
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
28
|
+
}): FarmPlugin;
|
|
29
|
+
|
|
30
|
+
declare function createHeadersPlugin(headers: HeaderConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
31
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
32
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
33
|
+
}): FarmPlugin;
|
|
34
|
+
|
|
35
|
+
declare function createRewritesPlugin(rewrites: RewriteConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
36
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
37
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
38
|
+
}): FarmPlugin;
|
|
39
|
+
|
|
40
|
+
declare function createEnvPlugin(env: Record<string, string>, { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
41
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
42
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
43
|
+
}): FarmPlugin;
|
|
44
|
+
|
|
45
|
+
declare function createCompressionPlugin({ beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
46
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
47
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
48
|
+
}): FarmPlugin;
|
|
49
|
+
|
|
50
|
+
declare function createLoggerPlugin({ beforeRequest, afterResponse, }?: {
|
|
51
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
52
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
53
|
+
}): FarmPlugin;
|
|
54
|
+
|
|
55
|
+
export { FarmPlugin, FarmPluginContext, HeaderConfig, RedirectConfig, RewriteConfig, createCompressionPlugin, createEnvPlugin, createHeadersPlugin, createLoggerPlugin, createRedirectsPlugin, createRewritesPlugin };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { aV as RedirectConfig, t as FarmRequest, u as FarmResponse, aj as FarmPluginContext, V as FarmPlugin, aW as HeaderConfig, aX as RewriteConfig } from './client-plugins-Bc5jHcNr.js';
|
|
2
|
+
export { ak as FarmRequestPluginContext, al as FarmRequestStore } 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
|
+
declare function createRedirectsPlugin(redirects: RedirectConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
26
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
27
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
28
|
+
}): FarmPlugin;
|
|
29
|
+
|
|
30
|
+
declare function createHeadersPlugin(headers: HeaderConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
31
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
32
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
33
|
+
}): FarmPlugin;
|
|
34
|
+
|
|
35
|
+
declare function createRewritesPlugin(rewrites: RewriteConfig[], { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
36
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
37
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
38
|
+
}): FarmPlugin;
|
|
39
|
+
|
|
40
|
+
declare function createEnvPlugin(env: Record<string, string>, { beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
41
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
42
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
43
|
+
}): FarmPlugin;
|
|
44
|
+
|
|
45
|
+
declare function createCompressionPlugin({ beforeRequest: overrideBeforeRequest, afterResponse: overrideAfterResponse, }?: {
|
|
46
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
47
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
48
|
+
}): FarmPlugin;
|
|
49
|
+
|
|
50
|
+
declare function createLoggerPlugin({ beforeRequest, afterResponse, }?: {
|
|
51
|
+
beforeRequest?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
52
|
+
afterResponse?: (req: FarmRequest, res: FarmResponse, context: FarmPluginContext) => void | Promise<void>;
|
|
53
|
+
}): FarmPlugin;
|
|
54
|
+
|
|
55
|
+
export { FarmPlugin, FarmPluginContext, HeaderConfig, RedirectConfig, RewriteConfig, createCompressionPlugin, createEnvPlugin, createHeadersPlugin, createLoggerPlugin, createRedirectsPlugin, createRewritesPlugin };
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
|
|
6
|
+
declare const FARM_SERVER_QUERY_RESULT_VERSION: 1;
|
|
7
|
+
type FarmServerQueryResult<TData> = {
|
|
8
|
+
__farmServerQuery: {
|
|
9
|
+
version: typeof FARM_SERVER_QUERY_RESULT_VERSION;
|
|
10
|
+
key: string;
|
|
11
|
+
staleTime: number | false;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
};
|
|
14
|
+
data: TData;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type ServerQueryFetchOptions = {
|
|
18
|
+
/** Used only when a non-Farm transport returns plain data. Farm transports use the declaration. */
|
|
19
|
+
staleTime?: number | false;
|
|
20
|
+
/** Return stale data immediately while refreshing it in the background. Default true. */
|
|
21
|
+
swr?: boolean;
|
|
22
|
+
/** Always wait for a new result. */
|
|
23
|
+
force?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type UseServerQueryOptions = ServerQueryFetchOptions & {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
refetchOnWindowFocus?: boolean;
|
|
28
|
+
refetchOnReconnect?: boolean;
|
|
29
|
+
};
|
|
30
|
+
type UseServerQueryResult<TData> = {
|
|
31
|
+
data: TData | undefined;
|
|
32
|
+
error: Error | null;
|
|
33
|
+
status: FarmClientCacheStatus;
|
|
34
|
+
pending: boolean;
|
|
35
|
+
fetching: boolean;
|
|
36
|
+
stale: boolean;
|
|
37
|
+
refetch: () => Promise<TData>;
|
|
38
|
+
};
|
|
39
|
+
type FarmServerQueryActionInvocation = {
|
|
40
|
+
actionId: string;
|
|
41
|
+
args: readonly unknown[];
|
|
42
|
+
provisionalKey?: string;
|
|
43
|
+
};
|
|
44
|
+
declare function beginFarmServerQueryAction(actionId: string, args: readonly unknown[]): FarmServerQueryActionInvocation;
|
|
45
|
+
declare function completeFarmServerQueryAction<TData>(invocation: FarmServerQueryActionInvocation, value: TData | FarmServerQueryResult<TData>): TData;
|
|
46
|
+
declare function fetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: ServerQueryFetchOptions): Promise<TData>;
|
|
47
|
+
declare function prefetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: Omit<ServerQueryFetchOptions, "force">): Promise<TData>;
|
|
48
|
+
declare function useServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: UseServerQueryOptions): UseServerQueryResult<TData>;
|
|
49
|
+
|
|
50
|
+
export { type FarmServerQueryActionInvocation, type ServerQueryFetchOptions, type UseServerQueryOptions, type UseServerQueryResult, beginFarmServerQueryAction, completeFarmServerQueryAction, fetchServerQuery, prefetchServerQuery, useServerQuery };
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
|
|
6
|
+
declare const FARM_SERVER_QUERY_RESULT_VERSION: 1;
|
|
7
|
+
type FarmServerQueryResult<TData> = {
|
|
8
|
+
__farmServerQuery: {
|
|
9
|
+
version: typeof FARM_SERVER_QUERY_RESULT_VERSION;
|
|
10
|
+
key: string;
|
|
11
|
+
staleTime: number | false;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
};
|
|
14
|
+
data: TData;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type ServerQueryFetchOptions = {
|
|
18
|
+
/** Used only when a non-Farm transport returns plain data. Farm transports use the declaration. */
|
|
19
|
+
staleTime?: number | false;
|
|
20
|
+
/** Return stale data immediately while refreshing it in the background. Default true. */
|
|
21
|
+
swr?: boolean;
|
|
22
|
+
/** Always wait for a new result. */
|
|
23
|
+
force?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type UseServerQueryOptions = ServerQueryFetchOptions & {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
refetchOnWindowFocus?: boolean;
|
|
28
|
+
refetchOnReconnect?: boolean;
|
|
29
|
+
};
|
|
30
|
+
type UseServerQueryResult<TData> = {
|
|
31
|
+
data: TData | undefined;
|
|
32
|
+
error: Error | null;
|
|
33
|
+
status: FarmClientCacheStatus;
|
|
34
|
+
pending: boolean;
|
|
35
|
+
fetching: boolean;
|
|
36
|
+
stale: boolean;
|
|
37
|
+
refetch: () => Promise<TData>;
|
|
38
|
+
};
|
|
39
|
+
type FarmServerQueryActionInvocation = {
|
|
40
|
+
actionId: string;
|
|
41
|
+
args: readonly unknown[];
|
|
42
|
+
provisionalKey?: string;
|
|
43
|
+
};
|
|
44
|
+
declare function beginFarmServerQueryAction(actionId: string, args: readonly unknown[]): FarmServerQueryActionInvocation;
|
|
45
|
+
declare function completeFarmServerQueryAction<TData>(invocation: FarmServerQueryActionInvocation, value: TData | FarmServerQueryResult<TData>): TData;
|
|
46
|
+
declare function fetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: ServerQueryFetchOptions): Promise<TData>;
|
|
47
|
+
declare function prefetchServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: Omit<ServerQueryFetchOptions, "force">): Promise<TData>;
|
|
48
|
+
declare function useServerQuery<TInput, TData>(query: ServerQuery<TInput, TData>, input: TInput, options?: UseServerQueryOptions): UseServerQueryResult<TData>;
|
|
49
|
+
|
|
50
|
+
export { type FarmServerQueryActionInvocation, type ServerQueryFetchOptions, type UseServerQueryOptions, type UseServerQueryResult, beginFarmServerQueryAction, completeFarmServerQueryAction, fetchServerQuery, prefetchServerQuery, useServerQuery };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RouteDataCacheKey } from './cache.mjs';
|
|
2
|
+
import { ServerFnContext, ServerFnSchema, AnyServerFnMiddleware, InferServerFnSchemaOutput, ServerFnMiddlewareContext, ServerFnHandler, InferServerFnSchemaInput } from './server-fn.mjs';
|
|
3
|
+
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
type ServerQueryStaleTime = number | false | `${number}${"ms" | "s" | "m" | "h"}`;
|
|
6
|
+
type ServerQueryKey<TInput, TContext extends object = {}> = (context: ServerFnContext<TInput, TContext>) => MaybePromise<RouteDataCacheKey>;
|
|
7
|
+
type ServerQueryOptions<TSchema extends ServerFnSchema | undefined, TResult, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
8
|
+
input?: TSchema;
|
|
9
|
+
output?: undefined;
|
|
10
|
+
middleware?: TMiddlewares;
|
|
11
|
+
key: ServerQueryKey<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
12
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
13
|
+
staleTime?: ServerQueryStaleTime;
|
|
14
|
+
handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
15
|
+
};
|
|
16
|
+
type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
17
|
+
input?: TInputSchema;
|
|
18
|
+
output: TOutputSchema;
|
|
19
|
+
middleware?: TMiddlewares;
|
|
20
|
+
key: ServerQueryKey<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
21
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
22
|
+
staleTime?: ServerQueryStaleTime;
|
|
23
|
+
handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
24
|
+
};
|
|
25
|
+
type ServerQuery<TInput, TResult> = ([unknown] extends [TInput] ? (input?: TInput) => Promise<TResult> : (input: TInput) => Promise<TResult>) & {
|
|
26
|
+
readonly __farmServerQuery: true;
|
|
27
|
+
readonly __farmServerQueryInput?: unknown;
|
|
28
|
+
readonly __farmServerQueryOutput?: unknown;
|
|
29
|
+
};
|
|
30
|
+
declare const FARM_SERVER_QUERY_SYMBOL: unique symbol;
|
|
31
|
+
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>>>;
|
|
32
|
+
declare function createServerQuery<TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOutputOptions<undefined, TOutputSchema, TMiddlewares>): ServerQuery<unknown, Awaited<InferServerFnSchemaOutput<TOutputSchema>>>;
|
|
33
|
+
declare function createServerQuery<TSchema extends ServerFnSchema, TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<TSchema, TResult, TMiddlewares>): ServerQuery<InferServerFnSchemaInput<TSchema>, Awaited<TResult>>;
|
|
34
|
+
declare function createServerQuery<TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<undefined, TResult, TMiddlewares>): ServerQuery<unknown, Awaited<TResult>>;
|
|
35
|
+
|
|
36
|
+
export { FARM_SERVER_QUERY_SYMBOL, type ServerQuery, type ServerQueryKey, type ServerQueryOptions, type ServerQueryOutputOptions, type ServerQueryStaleTime, createServerQuery };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RouteDataCacheKey } from './cache.js';
|
|
2
|
+
import { ServerFnContext, ServerFnSchema, AnyServerFnMiddleware, InferServerFnSchemaOutput, ServerFnMiddlewareContext, ServerFnHandler, InferServerFnSchemaInput } from './server-fn.js';
|
|
3
|
+
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
type ServerQueryStaleTime = number | false | `${number}${"ms" | "s" | "m" | "h"}`;
|
|
6
|
+
type ServerQueryKey<TInput, TContext extends object = {}> = (context: ServerFnContext<TInput, TContext>) => MaybePromise<RouteDataCacheKey>;
|
|
7
|
+
type ServerQueryOptions<TSchema extends ServerFnSchema | undefined, TResult, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
8
|
+
input?: TSchema;
|
|
9
|
+
output?: undefined;
|
|
10
|
+
middleware?: TMiddlewares;
|
|
11
|
+
key: ServerQueryKey<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
12
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
13
|
+
staleTime?: ServerQueryStaleTime;
|
|
14
|
+
handler: ServerFnHandler<TSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TSchema> : unknown, TResult, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
15
|
+
};
|
|
16
|
+
type ServerQueryOutputOptions<TInputSchema extends ServerFnSchema | undefined, TOutputSchema extends ServerFnSchema, TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []> = {
|
|
17
|
+
input?: TInputSchema;
|
|
18
|
+
output: TOutputSchema;
|
|
19
|
+
middleware?: TMiddlewares;
|
|
20
|
+
key: ServerQueryKey<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
21
|
+
/** Milliseconds, a duration string such as "30s", or false for no expiry. */
|
|
22
|
+
staleTime?: ServerQueryStaleTime;
|
|
23
|
+
handler: ServerFnHandler<TInputSchema extends ServerFnSchema ? InferServerFnSchemaOutput<TInputSchema> : unknown, unknown, ServerFnMiddlewareContext<TMiddlewares>>;
|
|
24
|
+
};
|
|
25
|
+
type ServerQuery<TInput, TResult> = ([unknown] extends [TInput] ? (input?: TInput) => Promise<TResult> : (input: TInput) => Promise<TResult>) & {
|
|
26
|
+
readonly __farmServerQuery: true;
|
|
27
|
+
readonly __farmServerQueryInput?: unknown;
|
|
28
|
+
readonly __farmServerQueryOutput?: unknown;
|
|
29
|
+
};
|
|
30
|
+
declare const FARM_SERVER_QUERY_SYMBOL: unique symbol;
|
|
31
|
+
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>>>;
|
|
32
|
+
declare function createServerQuery<TOutputSchema extends ServerFnSchema, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOutputOptions<undefined, TOutputSchema, TMiddlewares>): ServerQuery<unknown, Awaited<InferServerFnSchemaOutput<TOutputSchema>>>;
|
|
33
|
+
declare function createServerQuery<TSchema extends ServerFnSchema, TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<TSchema, TResult, TMiddlewares>): ServerQuery<InferServerFnSchemaInput<TSchema>, Awaited<TResult>>;
|
|
34
|
+
declare function createServerQuery<TResult, const TMiddlewares extends readonly AnyServerFnMiddleware[] = readonly []>(options: ServerQueryOptions<undefined, TResult, TMiddlewares>): ServerQuery<unknown, Awaited<TResult>>;
|
|
35
|
+
|
|
36
|
+
export { FARM_SERVER_QUERY_SYMBOL, type ServerQuery, type ServerQueryKey, type ServerQueryOptions, type ServerQueryOutputOptions, type ServerQueryStaleTime, createServerQuery };
|
package/dist/server.cjs
CHANGED
|
@@ -17644,7 +17644,8 @@ __name(transformFarmFontCalls, "transformFarmFontCalls");
|
|
|
17644
17644
|
function renderFarmFontDevHead(root) {
|
|
17645
17645
|
const registry = registries.get(normalizeRoot(root));
|
|
17646
17646
|
if (!registry || registry.production || registry.size === 0) return "";
|
|
17647
|
-
return registry.renderPreloadTags(false)
|
|
17647
|
+
return `${registry.renderPreloadTags(false)}
|
|
17648
|
+
<link rel="stylesheet" href="/@farm/fonts.css">`;
|
|
17648
17649
|
}
|
|
17649
17650
|
__name(renderFarmFontDevHead, "renderFarmFontDevHead");
|
|
17650
17651
|
var _FarmFontRegistry = class _FarmFontRegistry {
|
|
@@ -22711,7 +22712,7 @@ function transformError(id, message) {
|
|
|
22711
22712
|
__name(transformError, "transformError");
|
|
22712
22713
|
|
|
22713
22714
|
// package.json
|
|
22714
|
-
var version = "0.1.0-beta.
|
|
22715
|
+
var version = "0.1.0-beta.11";
|
|
22715
22716
|
|
|
22716
22717
|
// src/version.ts
|
|
22717
22718
|
var FARM_VERSION = version;
|