@analogjs/router 3.0.0-alpha.4 → 3.0.0-alpha.40
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/content/package.json +4 -0
- package/fesm2022/analogjs-router-content.mjs +63 -0
- package/fesm2022/analogjs-router-content.mjs.map +1 -0
- package/fesm2022/analogjs-router-server-actions.mjs +309 -1
- package/fesm2022/analogjs-router-server-actions.mjs.map +1 -0
- package/fesm2022/analogjs-router-server.mjs +60 -3
- package/fesm2022/analogjs-router-server.mjs.map +1 -0
- package/fesm2022/analogjs-router-tanstack-query-server.mjs +22 -0
- package/fesm2022/analogjs-router-tanstack-query-server.mjs.map +1 -0
- package/fesm2022/analogjs-router-tanstack-query.mjs +39 -0
- package/fesm2022/analogjs-router-tanstack-query.mjs.map +1 -0
- package/fesm2022/analogjs-router-tokens.mjs +7 -2
- package/fesm2022/analogjs-router-tokens.mjs.map +1 -0
- package/fesm2022/analogjs-router.mjs +711 -61
- package/fesm2022/analogjs-router.mjs.map +1 -0
- package/fesm2022/debug.page.mjs +53 -31
- package/fesm2022/debug.page.mjs.map +1 -0
- package/fesm2022/provide-analog-query.mjs +23 -0
- package/fesm2022/provide-analog-query.mjs.map +1 -0
- package/fesm2022/route-files.mjs +361 -0
- package/fesm2022/route-files.mjs.map +1 -0
- package/fesm2022/routes.mjs +5 -278
- package/fesm2022/routes.mjs.map +1 -0
- package/package.json +71 -25
- package/tanstack-query/package.json +4 -0
- package/tanstack-query/server/package.json +4 -0
- package/types/content/src/index.d.ts +4 -0
- package/types/content/src/lib/debug/routes.d.ts +10 -0
- package/types/{src → content/src}/lib/markdown-helpers.d.ts +1 -1
- package/types/content/src/lib/routes.d.ts +8 -0
- package/types/content/src/lib/with-content-routes.d.ts +2 -0
- package/types/server/actions/src/define-action.d.ts +54 -0
- package/types/server/actions/src/define-api-route.d.ts +57 -0
- package/types/server/actions/src/define-page-load.d.ts +55 -0
- package/types/server/actions/src/define-server-route.d.ts +68 -0
- package/types/server/actions/src/index.d.ts +9 -1
- package/types/server/actions/src/parse-request-data.d.ts +9 -0
- package/types/server/actions/src/validate.d.ts +8 -0
- package/types/server/src/provide-server-context.d.ts +15 -1
- package/types/server/src/render.d.ts +1 -1
- package/types/server/src/server-component-render.d.ts +1 -1
- package/types/src/index.d.ts +17 -5
- package/types/src/lib/cache-key.d.ts +1 -1
- package/types/src/lib/cookie-interceptor.d.ts +1 -1
- package/types/src/lib/debug/debug.page.d.ts +4 -2
- package/types/src/lib/define-route.d.ts +6 -1
- package/types/src/lib/endpoints.d.ts +1 -1
- package/types/src/lib/experimental.d.ts +140 -0
- package/types/src/lib/form-action.directive.d.ts +12 -5
- package/types/src/lib/i18n/provide-i18n.d.ts +92 -0
- package/types/src/lib/inject-load.d.ts +5 -2
- package/types/src/lib/inject-navigate.d.ts +23 -0
- package/types/src/lib/inject-route-context.d.ts +32 -0
- package/types/src/lib/inject-typed-params.d.ts +63 -0
- package/types/src/lib/json-ld.d.ts +32 -0
- package/types/src/lib/meta-tags.d.ts +3 -1
- package/types/src/lib/models.d.ts +3 -0
- package/types/src/lib/provide-file-router-base.d.ts +4 -0
- package/types/src/lib/provide-file-router.d.ts +2 -8
- package/types/src/lib/route-builder.d.ts +5 -0
- package/types/src/lib/route-files.d.ts +18 -0
- package/types/src/lib/route-path.d.ts +124 -0
- package/types/src/lib/route-types.d.ts +2 -1
- package/types/src/lib/routes.d.ts +2 -10
- package/types/src/lib/validation-errors.d.ts +7 -0
- package/types/tanstack-query/server/src/index.d.ts +1 -0
- package/types/tanstack-query/src/index.d.ts +2 -0
- package/types/tanstack-query/src/provide-analog-query.d.ts +4 -0
- package/types/tanstack-query/src/provide-server-analog-query.d.ts +2 -0
- package/types/tanstack-query/src/server-query.d.ts +16 -0
- package/types/tokens/src/index.d.ts +2 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Router } from '@angular/router';
|
|
2
|
+
import type { Graph, Thing, WithContext } from 'schema-dts';
|
|
3
|
+
export type JsonLdObject = Record<string, unknown>;
|
|
4
|
+
export declare function isJsonLdObject(value: unknown): value is JsonLdObject;
|
|
5
|
+
export declare function normalizeJsonLd(value: unknown): JsonLdObject[];
|
|
6
|
+
export type JsonLd = JsonLdObject | JsonLdObject[];
|
|
7
|
+
/**
|
|
8
|
+
* Typed JSON-LD document based on `schema-dts`.
|
|
9
|
+
*
|
|
10
|
+
* Accepts single Schema.org nodes (`WithContext<Thing>`),
|
|
11
|
+
* `@graph`-based documents (`Graph`), or arrays of nodes.
|
|
12
|
+
*
|
|
13
|
+
* This is the canonical JSON-LD type for route authoring surfaces
|
|
14
|
+
* (`routeMeta.jsonLd`, `routeJsonLd`, generated manifest).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import type { WebPage, WithContext } from 'schema-dts';
|
|
19
|
+
*
|
|
20
|
+
* export const routeMeta = {
|
|
21
|
+
* jsonLd: {
|
|
22
|
+
* '@context': 'https://schema.org',
|
|
23
|
+
* '@type': 'WebPage',
|
|
24
|
+
* name: 'Products',
|
|
25
|
+
* } satisfies WithContext<WebPage>,
|
|
26
|
+
* };
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export type AnalogJsonLdDocument = WithContext<Thing> | Graph | WithContext<Thing>[];
|
|
30
|
+
export declare const ROUTE_JSON_LD_KEY: unique symbol;
|
|
31
|
+
export declare function updateJsonLdOnRouteChange(router?: Router, document?: Document | null): void;
|
|
32
|
+
export declare function serializeJsonLd(entry: JsonLdObject): string | null;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Meta } from '@angular/platform-browser';
|
|
2
|
+
import { Router } from '@angular/router';
|
|
1
3
|
export declare const ROUTE_META_TAGS_KEY: unique symbol;
|
|
2
4
|
declare const CHARSET_KEY = "charset";
|
|
3
5
|
declare const HTTP_EQUIV_KEY = "httpEquiv";
|
|
@@ -29,5 +31,5 @@ type MetaTagKey = typeof CHARSET_KEY | typeof HTTP_EQUIV_KEY | typeof NAME_KEY |
|
|
|
29
31
|
type ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {
|
|
30
32
|
[K in Exclude<MetaTagKey, Key>]?: never;
|
|
31
33
|
};
|
|
32
|
-
export declare function updateMetaTagsOnRouteChange(): void;
|
|
34
|
+
export declare function updateMetaTagsOnRouteChange(router?: Router, metaService?: Meta): void;
|
|
33
35
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
2
|
import { CanActivateChildFn, CanActivateFn, CanDeactivateFn, CanMatchFn, DeprecatedGuard, ResolveFn, Route } from '@angular/router';
|
|
3
3
|
import { defineRouteMeta } from './define-route';
|
|
4
|
+
import { AnalogJsonLdDocument } from './json-ld';
|
|
4
5
|
import { MetaTag } from './meta-tags';
|
|
5
6
|
type OmittedRouteProps = 'path' | 'matcher' | 'component' | 'loadComponent' | 'children' | 'loadChildren' | 'canLoad' | 'outlet';
|
|
6
7
|
export type RouteConfig = Omit<Route, OmittedRouteProps>;
|
|
@@ -14,6 +15,7 @@ export interface DefaultRouteMeta extends Omit<Route, OmittedRouteProps | keyof
|
|
|
14
15
|
};
|
|
15
16
|
title?: string | ResolveFn<string>;
|
|
16
17
|
meta?: MetaTag[] | ResolveFn<MetaTag[]>;
|
|
18
|
+
jsonLd?: AnalogJsonLdDocument | ResolveFn<AnalogJsonLdDocument | undefined>;
|
|
17
19
|
}
|
|
18
20
|
export interface RedirectRouteMeta {
|
|
19
21
|
redirectTo: string;
|
|
@@ -25,5 +27,6 @@ export type RouteMeta = (DefaultRouteMeta & {
|
|
|
25
27
|
export type RouteExport = {
|
|
26
28
|
default: Type<unknown>;
|
|
27
29
|
routeMeta?: RouteMeta | ReturnType<typeof defineRouteMeta>;
|
|
30
|
+
routeJsonLd?: AnalogJsonLdDocument | ResolveFn<AnalogJsonLdDocument | undefined>;
|
|
28
31
|
};
|
|
29
32
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { RouterFeatures, Routes } from '@angular/router';
|
|
3
|
+
export declare function provideFileRouterWithRoutes(...features: RouterFeatures[]): EnvironmentProviders;
|
|
4
|
+
export declare function withExtraRoutes(routes: Routes): RouterFeatures;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnvironmentProviders } from '@angular/core';
|
|
2
|
-
import { RouterFeatures
|
|
2
|
+
import { RouterFeatures } from '@angular/router';
|
|
3
3
|
/**
|
|
4
4
|
* Sets up providers for the Angular router, and registers
|
|
5
5
|
* file-based routes. Additional features can be provided
|
|
@@ -9,10 +9,4 @@ import { RouterFeatures, Routes } from '@angular/router';
|
|
|
9
9
|
* @returns Providers and features to configure the router with routes
|
|
10
10
|
*/
|
|
11
11
|
export declare function provideFileRouter(...features: RouterFeatures[]): EnvironmentProviders;
|
|
12
|
-
|
|
13
|
-
* Provides extra custom routes in addition to the routes
|
|
14
|
-
* discovered from the filesystem-based routing. These routes are
|
|
15
|
-
* inserted before the filesystem-based routes, and take priority in
|
|
16
|
-
* route matching.
|
|
17
|
-
*/
|
|
18
|
-
export declare function withExtraRoutes(routes: Routes): RouterFeatures;
|
|
12
|
+
export { withExtraRoutes } from './provide-file-router-base';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Route } from '@angular/router';
|
|
2
|
+
import type { RouteExport } from './models';
|
|
3
|
+
export type RouteModuleFactory = () => Promise<RouteExport>;
|
|
4
|
+
export type RouteModuleResolver<TFile> = (filename: string, fileLoader: () => Promise<TFile>) => RouteModuleFactory;
|
|
5
|
+
export declare function createRoutes<TFile>(files: Record<string, () => Promise<TFile>>, resolveModule: RouteModuleResolver<TFile>, debug?: boolean): Route[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import type { RouteExport } from './models';
|
|
3
|
+
export type Files = Record<string, () => Promise<RouteExport>>;
|
|
4
|
+
/**
|
|
5
|
+
* This variable reference is replaced with a glob of all page routes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ANALOG_ROUTE_FILES: {};
|
|
8
|
+
export interface ExtraRouteFileSource {
|
|
9
|
+
files: Record<string, () => Promise<unknown>>;
|
|
10
|
+
resolveModule: (filename: string, fileLoader: () => Promise<unknown>) => () => Promise<RouteExport>;
|
|
11
|
+
}
|
|
12
|
+
export declare const ANALOG_EXTRA_ROUTE_FILE_SOURCES: InjectionToken<ExtraRouteFileSource[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Replaced at build time by the Vite router plugin with the number of
|
|
15
|
+
* discovered content route files. Used in dev mode to warn when content
|
|
16
|
+
* files exist but `withContentRoutes()` is not configured.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ANALOG_CONTENT_FILE_COUNT = 0;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed route path utilities for Analog.
|
|
3
|
+
*
|
|
4
|
+
* This module provides:
|
|
5
|
+
* - The `AnalogRouteTable` base interface (augmented by generated code)
|
|
6
|
+
* - The `AnalogRoutePath` union type
|
|
7
|
+
* - The `routePath()` URL builder function
|
|
8
|
+
*
|
|
9
|
+
* No Angular dependencies — can be used in any context.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Base interface for the typed route table.
|
|
13
|
+
*
|
|
14
|
+
* This interface is augmented by generated code in `src/routeTree.gen.ts`.
|
|
15
|
+
* When no routes are generated, it is empty and `AnalogRoutePath` falls
|
|
16
|
+
* back to `string`.
|
|
17
|
+
*/
|
|
18
|
+
export interface AnalogRouteTable {
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Union of all valid route paths.
|
|
22
|
+
*
|
|
23
|
+
* When routes are generated, this is a string literal union.
|
|
24
|
+
* When no routes are generated, this falls back to `string`.
|
|
25
|
+
*/
|
|
26
|
+
export type AnalogRoutePath = keyof AnalogRouteTable extends never ? string : Extract<keyof AnalogRouteTable, string>;
|
|
27
|
+
/**
|
|
28
|
+
* Options for building a route URL.
|
|
29
|
+
*/
|
|
30
|
+
export interface RoutePathOptionsBase {
|
|
31
|
+
params?: Record<string, string | string[] | undefined>;
|
|
32
|
+
query?: Record<string, string | string[] | undefined>;
|
|
33
|
+
hash?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Extracts the validated output type for route params.
|
|
37
|
+
*
|
|
38
|
+
* When a route exports `routeParamsSchema`, this resolves to the schema's
|
|
39
|
+
* output type (e.g., `{ id: number }` after coercion).
|
|
40
|
+
* When no schema exists, this is the same as the navigation param type.
|
|
41
|
+
*/
|
|
42
|
+
export type RouteParamsOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
43
|
+
paramsOutput: infer O;
|
|
44
|
+
} ? O : AnalogRouteTable[P] extends {
|
|
45
|
+
params: infer Params;
|
|
46
|
+
} ? Params : Record<string, unknown> : Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Extracts the validated output type for route query params.
|
|
49
|
+
*/
|
|
50
|
+
export type RouteQueryOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
51
|
+
queryOutput: infer O;
|
|
52
|
+
} ? O : Record<string, string | string[] | undefined> : Record<string, string | string[] | undefined>;
|
|
53
|
+
type RequiredRouteParamKeys<Params> = Params extends Record<string, never> ? never : {
|
|
54
|
+
[K in keyof Params]-?: Record<string, never> extends Pick<Params, K> ? never : K;
|
|
55
|
+
}[keyof Params];
|
|
56
|
+
type HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [
|
|
57
|
+
never
|
|
58
|
+
] ? false : true;
|
|
59
|
+
/**
|
|
60
|
+
* Typed options that infer params from the route table when available.
|
|
61
|
+
*/
|
|
62
|
+
export type RoutePathOptions<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
63
|
+
params: infer Params;
|
|
64
|
+
} ? Params extends Record<string, never> ? {
|
|
65
|
+
query?: RouteQueryOutput<P>;
|
|
66
|
+
hash?: string;
|
|
67
|
+
} : HasRequiredRouteParams<Params> extends true ? {
|
|
68
|
+
params: Params;
|
|
69
|
+
query?: RouteQueryOutput<P>;
|
|
70
|
+
hash?: string;
|
|
71
|
+
} : {
|
|
72
|
+
params?: Params;
|
|
73
|
+
query?: RouteQueryOutput<P>;
|
|
74
|
+
hash?: string;
|
|
75
|
+
} : RoutePathOptionsBase : RoutePathOptionsBase;
|
|
76
|
+
/**
|
|
77
|
+
* Conditional args: require options when the route has params.
|
|
78
|
+
*/
|
|
79
|
+
export type RoutePathArgs<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
80
|
+
params: infer Params;
|
|
81
|
+
} ? Params extends Record<string, never> ? [options?: RoutePathOptions<P>] : HasRequiredRouteParams<Params> extends true ? [options: RoutePathOptions<P>] : [options?: RoutePathOptions<P>] : [options?: RoutePathOptionsBase] : [options?: RoutePathOptionsBase];
|
|
82
|
+
/**
|
|
83
|
+
* Result of `routePath()` — contains properties that map directly
|
|
84
|
+
* to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.
|
|
85
|
+
*/
|
|
86
|
+
export interface RouteLinkResult {
|
|
87
|
+
path: string;
|
|
88
|
+
queryParams: Record<string, string | string[]> | null;
|
|
89
|
+
fragment: string | undefined;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Builds a typed route link object from a route path pattern and options.
|
|
93
|
+
*
|
|
94
|
+
* The returned object separates path, query params, and fragment for
|
|
95
|
+
* direct use with Angular's routerLink directive inputs.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* routePath('/about')
|
|
99
|
+
* // → { path: '/about', queryParams: null, fragment: undefined }
|
|
100
|
+
*
|
|
101
|
+
* routePath('/users/[id]', { params: { id: '42' } })
|
|
102
|
+
* // → { path: '/users/42', queryParams: null, fragment: undefined }
|
|
103
|
+
*
|
|
104
|
+
* routePath('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })
|
|
105
|
+
* // → { path: '/users/42', queryParams: { tab: 'settings' }, fragment: 'bio' }
|
|
106
|
+
*
|
|
107
|
+
* @example Template usage
|
|
108
|
+
* ```html
|
|
109
|
+
* @let link = routePath('/users/[id]', { params: { id: userId } });
|
|
110
|
+
* <a [routerLink]="link.path" [queryParams]="link.queryParams" [fragment]="link.fragment">
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
export declare function routePath<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): RouteLinkResult;
|
|
114
|
+
/**
|
|
115
|
+
* Internal: builds a `RouteLinkResult` from path and options.
|
|
116
|
+
* Exported for direct use in tests (avoids generic constraints).
|
|
117
|
+
*/
|
|
118
|
+
export declare function buildRouteLink(path: string, options?: RoutePathOptionsBase): RouteLinkResult;
|
|
119
|
+
/**
|
|
120
|
+
* Internal URL builder. Separated from `routePath` so it can be
|
|
121
|
+
* used without generic constraints (e.g., in `injectNavigate`).
|
|
122
|
+
*/
|
|
123
|
+
export declare function buildUrl(path: string, options?: RoutePathOptionsBase): string;
|
|
124
|
+
export {};
|
|
@@ -8,4 +8,5 @@ export type PageServerLoad = {
|
|
|
8
8
|
fetch: $Fetch;
|
|
9
9
|
event: H3Event;
|
|
10
10
|
};
|
|
11
|
-
export type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<
|
|
11
|
+
export type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<unknown>> = Awaited<ReturnType<A>>;
|
|
12
|
+
export type LoadDataResult<A extends (pageServerLoad: PageServerLoad) => Promise<unknown>> = Exclude<LoadResult<A>, Response>;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import type { Route } from '@angular/router';
|
|
2
|
-
import type
|
|
3
|
-
/**
|
|
4
|
-
* This variable reference is replaced with a glob of all page routes.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ANALOG_ROUTE_FILES: {};
|
|
7
|
-
/**
|
|
8
|
-
* This variable reference is replaced with a glob of all content routes.
|
|
9
|
-
*/
|
|
10
|
-
export declare const ANALOG_CONTENT_ROUTE_FILES: {};
|
|
11
|
-
export type Files = Record<string, () => Promise<RouteExport | string>>;
|
|
2
|
+
import { type Files } from './route-files';
|
|
12
3
|
/**
|
|
13
4
|
* A function used to parse list of files and create configuration of routes.
|
|
14
5
|
*
|
|
@@ -16,4 +7,5 @@ export type Files = Record<string, () => Promise<RouteExport | string>>;
|
|
|
16
7
|
* @returns Array of routes
|
|
17
8
|
*/
|
|
18
9
|
export declare function createRoutes(files: Files, debug?: boolean): Route[];
|
|
10
|
+
export { ANALOG_ROUTE_FILES } from './route-files';
|
|
19
11
|
export declare const routes: Route[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
|
+
export type ValidationFieldErrors = Record<string, string[]>;
|
|
3
|
+
export declare function issuePathToFieldName(path: ReadonlyArray<string | number | symbol | {
|
|
4
|
+
key: string | number | symbol;
|
|
5
|
+
}>): string;
|
|
6
|
+
export declare function issuesToFieldErrors(issues: ReadonlyArray<StandardSchemaV1.Issue>): ValidationFieldErrors;
|
|
7
|
+
export declare function issuesToFormErrors(issues: ReadonlyArray<StandardSchemaV1.Issue>): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { provideServerAnalogQuery } from '../../src/provide-server-analog-query';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EnvironmentProviders, StateKey } from '@angular/core';
|
|
2
|
+
import type { DehydratedState } from '@tanstack/angular-query-experimental';
|
|
3
|
+
export declare const ANALOG_QUERY_STATE_KEY: StateKey<DehydratedState>;
|
|
4
|
+
export declare function provideAnalogQuery(): EnvironmentProviders;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HttpClient } from '@angular/common/http';
|
|
2
|
+
import type { CreateQueryOptions, CreateMutationOptions, CreateInfiniteQueryOptions, DefaultError, InfiniteData, QueryKey } from '@tanstack/angular-query-experimental';
|
|
3
|
+
import type { ServerRouteHandler, InferRouteQuery, InferRouteBody, InferRouteResult } from '../../server/actions/src/index.js';
|
|
4
|
+
export declare function serverQueryOptions<TRoute extends ServerRouteHandler<any, any, any>, TError = DefaultError, TData = InferRouteResult<TRoute>, TQueryKey extends QueryKey = QueryKey>(http: HttpClient, url: string, options: {
|
|
5
|
+
queryKey: TQueryKey;
|
|
6
|
+
query?: InferRouteQuery<TRoute>;
|
|
7
|
+
} & Omit<CreateQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey>, 'queryKey' | 'queryFn'>): CreateQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey>;
|
|
8
|
+
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>;
|
|
9
|
+
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: {
|
|
10
|
+
queryKey: TQueryKey;
|
|
11
|
+
query: (context: {
|
|
12
|
+
pageParam: TPageParam;
|
|
13
|
+
}) => InferRouteQuery<TRoute>;
|
|
14
|
+
initialPageParam: TPageParam;
|
|
15
|
+
getNextPageParam: (lastPage: InferRouteResult<TRoute>, allPages: InferRouteResult<TRoute>[]) => TPageParam | undefined | null;
|
|
16
|
+
} & Omit<CreateInfiniteQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey, TPageParam>, 'queryKey' | 'queryFn' | 'initialPageParam' | 'getNextPageParam'>): CreateInfiniteQueryOptions<InferRouteResult<TRoute>, TError, TData, TQueryKey, TPageParam>;
|
|
@@ -21,3 +21,5 @@ export declare function injectResponse(): ServerResponse | null;
|
|
|
21
21
|
export declare function injectBaseURL(): string | null;
|
|
22
22
|
export declare function injectInternalServerFetch(): ServerInternalFetch | null;
|
|
23
23
|
export declare function injectAPIPrefix(): string;
|
|
24
|
+
export declare const LOCALE: InjectionToken<string>;
|
|
25
|
+
export declare function injectLocale(): string | null;
|