@analogjs/router 2.8.0-beta.9 → 2.8.0
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/fesm2022/analogjs-router-debug.page-MFY2u07E.mjs +119 -0
- package/fesm2022/analogjs-router-debug.page-MFY2u07E.mjs.map +1 -0
- package/fesm2022/analogjs-router-i18n.mjs +82 -219
- package/fesm2022/analogjs-router-i18n.mjs.map +1 -1
- package/fesm2022/analogjs-router-routes-L2tt-0ms.mjs +263 -0
- package/fesm2022/analogjs-router-routes-L2tt-0ms.mjs.map +1 -0
- package/fesm2022/analogjs-router-server-actions.mjs +228 -463
- package/fesm2022/analogjs-router-server-actions.mjs.map +1 -1
- package/fesm2022/analogjs-router-server.mjs +608 -838
- package/fesm2022/analogjs-router-server.mjs.map +1 -1
- package/fesm2022/analogjs-router-tanstack-query-server.mjs +35 -85
- package/fesm2022/analogjs-router-tanstack-query-server.mjs.map +1 -1
- package/fesm2022/analogjs-router-tanstack-query.mjs +79 -127
- package/fesm2022/analogjs-router-tanstack-query.mjs.map +1 -1
- package/fesm2022/analogjs-router-tokens.mjs +14 -19
- package/fesm2022/analogjs-router-tokens.mjs.map +1 -1
- package/fesm2022/analogjs-router.mjs +882 -1324
- package/fesm2022/analogjs-router.mjs.map +1 -1
- package/package.json +2 -2
- package/types/analogjs-router-i18n.d.ts +55 -24
- package/types/analogjs-router-server-actions.d.ts +98 -107
- package/types/analogjs-router-server.d.ts +76 -116
- package/types/analogjs-router-tanstack-query-server.d.ts +33 -37
- package/types/analogjs-router-tanstack-query.d.ts +19 -24
- package/types/analogjs-router-tokens.d.ts +26 -22
- package/types/analogjs-router.d.ts +528 -348
- package/fesm2022/analogjs-router-debug.page-COcFkgRu.mjs +0 -91
- package/fesm2022/analogjs-router-debug.page-COcFkgRu.mjs.map +0 -1
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import { EnvironmentProviders } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { $Fetch } from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare function provideServerAnalogQuery(): EnvironmentProviders;
|
|
9
|
-
|
|
1
|
+
import { EnvironmentProviders } from "@angular/core";
|
|
2
|
+
import { DehydratedState, QueryClient } from "@tanstack/angular-query-experimental";
|
|
3
|
+
import { H3Event, H3EventContext } from "h3";
|
|
4
|
+
import { $Fetch } from "nitropack";
|
|
5
|
+
import { PageLoadContext, StandardSchemaV1 } from "@analogjs/router/server/actions";
|
|
6
|
+
import { ANALOG_QUERIES_KEY } from "@analogjs/router/tanstack-query";
|
|
7
|
+
export declare function provideServerAnalogQuery(): EnvironmentProviders;
|
|
10
8
|
type OptionalSchema = StandardSchemaV1 | undefined;
|
|
11
9
|
interface PageLoadQueriesResult<TData> {
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
__analogQueries: DehydratedState;
|
|
11
|
+
data: TData;
|
|
14
12
|
}
|
|
15
13
|
interface DefinePageLoadQueriesOptions<TParamsSchema extends OptionalSchema, TQuerySchema extends OptionalSchema, TData> {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
14
|
+
params?: TParamsSchema;
|
|
15
|
+
query?: TQuerySchema;
|
|
16
|
+
/**
|
|
17
|
+
* Optional QueryClient factory. Defaults to `new QueryClient()`.
|
|
18
|
+
* Override to set `defaultOptions` (e.g. `queries: { staleTime: Infinity }`).
|
|
19
|
+
*/
|
|
20
|
+
client?: () => QueryClient;
|
|
21
|
+
/**
|
|
22
|
+
* Handler receives the standard PageLoadContext plus a per-request
|
|
23
|
+
* QueryClient. Use `client.prefetchQuery` / `ensureQueryData` /
|
|
24
|
+
* `prefetchInfiniteQuery` to warm the cache; the dehydrated client
|
|
25
|
+
* is returned as `__analogQueries` on the load result. Anything you
|
|
26
|
+
* return from the handler becomes `data` on the same result.
|
|
27
|
+
*/
|
|
28
|
+
handler: (ctx: PageLoadContext<TParamsSchema, TQuerySchema> & {
|
|
29
|
+
client: QueryClient;
|
|
30
|
+
}) => Promise<TData> | TData;
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* Page load helper that prefetches TanStack Query queries inside the
|
|
@@ -58,13 +56,11 @@ interface DefinePageLoadQueriesOptions<TParamsSchema extends OptionalSchema, TQu
|
|
|
58
56
|
* });
|
|
59
57
|
* ```
|
|
60
58
|
*/
|
|
61
|
-
declare function definePageLoadQueries<TParamsSchema extends OptionalSchema = undefined, TQuerySchema extends OptionalSchema = undefined, TData = void>(options: DefinePageLoadQueriesOptions<TParamsSchema, TQuerySchema, TData>): (ctx: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
59
|
+
export declare function definePageLoadQueries<TParamsSchema extends OptionalSchema = undefined, TQuerySchema extends OptionalSchema = undefined, TData = void>(options: DefinePageLoadQueriesOptions<TParamsSchema, TQuerySchema, TData>): (ctx: {
|
|
60
|
+
params: H3EventContext['params'];
|
|
61
|
+
req: H3Event['node']['req'];
|
|
62
|
+
res: H3Event['node']['res'];
|
|
63
|
+
fetch: $Fetch;
|
|
64
|
+
event: H3Event;
|
|
67
65
|
}) => Promise<PageLoadQueriesResult<TData> | Response>;
|
|
68
|
-
|
|
69
|
-
export { definePageLoadQueries, provideServerAnalogQuery };
|
|
70
|
-
export type { DefinePageLoadQueriesOptions, PageLoadQueriesResult };
|
|
66
|
+
export { ANALOG_QUERIES_KEY, type DefinePageLoadQueriesOptions, type PageLoadQueriesResult };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { HttpClient } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { EnvironmentProviders, StateKey } from "@angular/core";
|
|
2
|
+
import { CreateInfiniteQueryOptions, CreateMutationOptions, CreateQueryOptions, DefaultError, DehydratedState, InfiniteData, QueryKey } from "@tanstack/angular-query-experimental";
|
|
3
|
+
import { HttpClient } from "@angular/common/http";
|
|
4
|
+
import { InferRouteBody, InferRouteQuery, InferRouteResult, ServerRouteHandler } from "@analogjs/router/server/actions";
|
|
6
5
|
/**
|
|
7
6
|
* Route-data key under `ActivatedRoute.data['load']` that holds the
|
|
8
7
|
* `DehydratedState` produced by `definePageLoadQueries`. The Router-
|
|
@@ -11,23 +10,19 @@ import { ServerRouteHandler, InferRouteResult, InferRouteQuery, InferRouteBody }
|
|
|
11
10
|
* `QueryClient`, so component-issued queries hit a warm cache on
|
|
12
11
|
* first render.
|
|
13
12
|
*/
|
|
14
|
-
declare const ANALOG_QUERIES_KEY: '__analogQueries';
|
|
15
|
-
|
|
16
|
-
declare
|
|
17
|
-
declare function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
queryKey: TQueryKey;
|
|
21
|
-
query?: InferRouteQuery<TRoute>;
|
|
13
|
+
export declare const ANALOG_QUERIES_KEY: '__analogQueries';
|
|
14
|
+
export declare const ANALOG_QUERY_STATE_KEY: StateKey<DehydratedState>;
|
|
15
|
+
export declare function provideAnalogQuery(): EnvironmentProviders;
|
|
16
|
+
export declare function serverQueryOptions<TRoute extends ServerRouteHandler<any, any, any>, TError = DefaultError, TData = InferRouteResult<TRoute>, TQueryKey extends QueryKey = QueryKey>(http: HttpClient, url: string, options: {
|
|
17
|
+
queryKey: TQueryKey;
|
|
18
|
+
query?: InferRouteQuery<TRoute>;
|
|
22
19
|
} & Omit<CreateQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey>, 'queryKey' | 'queryFn'>): CreateQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey>;
|
|
23
|
-
declare function serverMutationOptions<TRoute extends ServerRouteHandler<any, any, any>, TError = DefaultError, TOnMutateResult = unknown>(http: HttpClient, url: string, options?: Omit<CreateMutationOptions<InferRouteResult<TRoute>, TError, InferRouteBody<TRoute>, TOnMutateResult>, 'mutationFn'>): CreateMutationOptions<InferRouteResult<TRoute>, TError, InferRouteBody<TRoute>, TOnMutateResult>;
|
|
24
|
-
declare function serverInfiniteQueryOptions<TRoute extends ServerRouteHandler<any, any, any>, TError = DefaultError, TData = InfiniteData<InferRouteResult<TRoute>>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(http: HttpClient, url: string, options: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} & Omit<CreateInfiniteQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey, TPageParam>, 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'>): CreateInfiniteQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey, TPageParam>;
|
|
32
|
-
|
|
33
|
-
export { ANALOG_QUERIES_KEY, ANALOG_QUERY_STATE_KEY, provideAnalogQuery, serverInfiniteQueryOptions, serverMutationOptions, serverQueryOptions };
|
|
20
|
+
export declare function serverMutationOptions<TRoute extends ServerRouteHandler<any, any, any>, TError = DefaultError, TOnMutateResult = unknown>(http: HttpClient, url: string, options?: Omit<CreateMutationOptions<InferRouteResult<TRoute>, TError, InferRouteBody<TRoute>, TOnMutateResult>, 'mutationFn'>): CreateMutationOptions<InferRouteResult<TRoute>, TError, InferRouteBody<TRoute>, TOnMutateResult>;
|
|
21
|
+
export declare function serverInfiniteQueryOptions<TRoute extends ServerRouteHandler<any, any, any>, TError = DefaultError, TData = InfiniteData<InferRouteResult<TRoute>>, TQueryKey extends QueryKey = QueryKey, TPageParam = unknown>(http: HttpClient, url: string, options: {
|
|
22
|
+
queryKey: TQueryKey;
|
|
23
|
+
query: (context: {
|
|
24
|
+
pageParam: TPageParam;
|
|
25
|
+
}) => InferRouteQuery<TRoute>;
|
|
26
|
+
initialPageParam: TPageParam;
|
|
27
|
+
getNextPageParam: (lastPage: InferRouteResult<TRoute>, allPages: InferRouteResult<TRoute>[]) => TPageParam | undefined | null;
|
|
28
|
+
} & Omit<CreateInfiniteQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey, TPageParam>, 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'>): CreateInfiniteQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey, TPageParam>;
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import { InjectionToken } from
|
|
2
|
-
import { IncomingMessage, ServerResponse as ServerResponse$1 } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
originalUrl: string;
|
|
1
|
+
import { InjectionToken } from "@angular/core";
|
|
2
|
+
import { IncomingMessage, ServerResponse as ServerResponse$1 } from "node:http";
|
|
3
|
+
export type ServerRequest = IncomingMessage & {
|
|
4
|
+
originalUrl: string;
|
|
6
5
|
};
|
|
7
|
-
type ServerResponse = ServerResponse$1;
|
|
8
|
-
type ServerContext = {
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
export type ServerResponse = ServerResponse$1;
|
|
7
|
+
export type ServerContext = {
|
|
8
|
+
req: ServerRequest;
|
|
9
|
+
res: ServerResponse;
|
|
10
|
+
/** Trusted route policy supplied by the SSR host. */
|
|
11
|
+
streaming?: boolean;
|
|
12
|
+
/** Aborted when the host request is cancelled. */
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
/** Keeps an edge request alive until stream cleanup completes. */
|
|
15
|
+
waitUntil?: (task: Promise<void>) => void;
|
|
16
|
+
/** Finish failed progressive HTTP documents with a generic error view. */
|
|
17
|
+
renderErrorsAsHtml?: boolean;
|
|
11
18
|
};
|
|
12
|
-
declare const REQUEST: InjectionToken<ServerRequest>;
|
|
13
|
-
declare const RESPONSE: InjectionToken<ServerResponse>;
|
|
14
|
-
declare const BASE_URL: InjectionToken<string>;
|
|
15
|
-
declare const API_PREFIX: InjectionToken<string>;
|
|
16
|
-
declare const LOCALE: InjectionToken<string>;
|
|
17
|
-
declare function injectRequest(): ServerRequest | null;
|
|
18
|
-
declare function injectResponse(): ServerResponse | null;
|
|
19
|
-
declare function injectBaseURL(): string | null;
|
|
20
|
-
declare function injectAPIPrefix(): string;
|
|
21
|
-
declare function injectLocale(): string | null;
|
|
22
|
-
|
|
23
|
-
export { API_PREFIX, BASE_URL, LOCALE, REQUEST, RESPONSE, injectAPIPrefix, injectBaseURL, injectLocale, injectRequest, injectResponse };
|
|
24
|
-
export type { ServerContext, ServerRequest, ServerResponse };
|
|
19
|
+
export declare const REQUEST: InjectionToken<ServerRequest>;
|
|
20
|
+
export declare const RESPONSE: InjectionToken<ServerResponse>;
|
|
21
|
+
export declare const BASE_URL: InjectionToken<string>;
|
|
22
|
+
export declare const API_PREFIX: InjectionToken<string>;
|
|
23
|
+
export declare const LOCALE: InjectionToken<string>;
|
|
24
|
+
export declare function injectRequest(): ServerRequest | null;
|
|
25
|
+
export declare function injectResponse(): ServerResponse | null;
|
|
26
|
+
export declare function injectBaseURL(): string | null;
|
|
27
|
+
export declare function injectAPIPrefix(): string;
|
|
28
|
+
export declare function injectLocale(): string | null;
|