@analogjs/router 2.8.0-beta.10 → 2.8.0-beta.12
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 +772 -1312
- 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 +268 -265
- package/fesm2022/analogjs-router-debug.page-COcFkgRu.mjs +0 -91
- package/fesm2022/analogjs-router-debug.page-COcFkgRu.mjs.map +0 -1
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { $Fetch } from
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { HttpRequest, HttpHandlerFn } from '@angular/common/http';
|
|
11
|
-
import { StandardSchemaV1 as StandardSchemaV1$1 } from '@analogjs/router/server/actions';
|
|
12
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { EnvironmentProviders, InjectionToken, Injector, InputSignal, OnChanges, ResourceRef, Signal, Type } from "@angular/core";
|
|
3
|
+
import * as i1 from "@angular/router";
|
|
4
|
+
import { ActivatedRoute, ActivatedRouteSnapshot, CanActivateChildFn, CanActivateFn, CanDeactivateFn, CanMatchFn, DeprecatedGuard, NavigationBehaviorOptions, ResolveFn, Route, Router, RouterFeatures, Routes } from "@angular/router";
|
|
5
|
+
import { H3Event, H3EventContext } from "h3";
|
|
6
|
+
import { $Fetch } from "nitropack";
|
|
7
|
+
import { Observable } from "rxjs";
|
|
8
|
+
import { HttpHandlerFn, HttpRequest } from "@angular/common/http";
|
|
9
|
+
import { StandardSchemaV1 as StandardSchemaV1$1 } from "@analogjs/router/server/actions";
|
|
13
10
|
type RouteOmitted = 'component' | 'loadComponent' | 'loadChildren' | 'path' | 'pathMatch';
|
|
14
11
|
type RestrictedRoute = Omit<Route, RouteOmitted>;
|
|
15
12
|
/**
|
|
@@ -40,75 +37,81 @@ type RestrictedRoute = Omit<Route, RouteOmitted>;
|
|
|
40
37
|
* @param route
|
|
41
38
|
* @returns
|
|
42
39
|
*/
|
|
43
|
-
declare const defineRouteMeta: (route: RestrictedRoute) => RestrictedRoute;
|
|
40
|
+
export declare const defineRouteMeta: (route: RestrictedRoute) => RestrictedRoute;
|
|
44
41
|
/**
|
|
45
42
|
* Returns the instance of Angular Router
|
|
46
43
|
*
|
|
47
44
|
* @returns The router
|
|
48
45
|
*/
|
|
49
|
-
declare const injectRouter: () => Router;
|
|
46
|
+
export declare const injectRouter: () => Router;
|
|
50
47
|
/**
|
|
51
48
|
* Returns the instance of the Activate Route for the component
|
|
52
49
|
*
|
|
53
50
|
* @returns The activated route
|
|
54
51
|
*/
|
|
55
|
-
declare const injectActivatedRoute: () => ActivatedRoute;
|
|
56
|
-
|
|
52
|
+
export declare const injectActivatedRoute: () => ActivatedRoute;
|
|
53
|
+
declare const ROUTE_META_TAGS_KEY: unique symbol;
|
|
57
54
|
declare const CHARSET_KEY = "charset";
|
|
58
55
|
declare const HTTP_EQUIV_KEY = "httpEquiv";
|
|
59
56
|
declare const NAME_KEY = "name";
|
|
60
57
|
declare const PROPERTY_KEY = "property";
|
|
61
58
|
declare const CONTENT_KEY = "content";
|
|
62
59
|
declare const ITEMPROP_KEY = "itemprop";
|
|
63
|
-
type MetaTag = (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>) | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>) | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>) | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>) | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);
|
|
60
|
+
export type MetaTag = (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>) | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>) | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>) | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>) | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);
|
|
64
61
|
type CharsetMetaTag = {
|
|
65
|
-
|
|
62
|
+
[CHARSET_KEY]: string;
|
|
66
63
|
};
|
|
67
64
|
type HttpEquivMetaTag = {
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
[HTTP_EQUIV_KEY]: string;
|
|
66
|
+
[CONTENT_KEY]: string;
|
|
70
67
|
};
|
|
71
68
|
type NameMetaTag = {
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
[NAME_KEY]: string;
|
|
70
|
+
[CONTENT_KEY]: string;
|
|
74
71
|
};
|
|
75
72
|
type PropertyMetaTag = {
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
[PROPERTY_KEY]: string;
|
|
74
|
+
[CONTENT_KEY]: string;
|
|
78
75
|
};
|
|
79
76
|
type ItempropMetaTag = {
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
[ITEMPROP_KEY]: string;
|
|
78
|
+
[CONTENT_KEY]: string;
|
|
82
79
|
};
|
|
83
80
|
type MetaTagKey = typeof CHARSET_KEY | typeof HTTP_EQUIV_KEY | typeof NAME_KEY | typeof PROPERTY_KEY | typeof ITEMPROP_KEY;
|
|
84
|
-
type ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {
|
|
85
|
-
|
|
86
|
-
};
|
|
87
|
-
|
|
81
|
+
type ExcludeRestMetaTagKeys<Key extends MetaTagKey> = { [K in Exclude<MetaTagKey, Key>]?: never; };
|
|
82
|
+
declare function updateMetaTagsOnRouteChange(): void;
|
|
88
83
|
type OmittedRouteProps = 'path' | 'matcher' | 'component' | 'loadComponent' | 'children' | 'loadChildren' | 'canLoad' | 'outlet';
|
|
84
|
+
type RouteConfig = Omit<Route, OmittedRouteProps>;
|
|
89
85
|
interface DefaultRouteMeta extends Omit<Route, OmittedRouteProps | keyof RedirectRouteMeta> {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
canActivate?: CanActivateFn[] | DeprecatedGuard[];
|
|
87
|
+
canActivateChild?: CanActivateChildFn[];
|
|
88
|
+
canDeactivate?: CanDeactivateFn<unknown>[];
|
|
89
|
+
canMatch?: CanMatchFn[];
|
|
90
|
+
resolve?: {
|
|
91
|
+
[key: string | symbol]: ResolveFn<unknown>;
|
|
92
|
+
};
|
|
93
|
+
title?: string | ResolveFn<string>;
|
|
94
|
+
meta?: MetaTag[] | ResolveFn<MetaTag[]>;
|
|
99
95
|
}
|
|
100
96
|
interface RedirectRouteMeta {
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
redirectTo: string;
|
|
98
|
+
pathMatch?: Route['pathMatch'];
|
|
103
99
|
}
|
|
104
|
-
type RouteMeta = (DefaultRouteMeta & {
|
|
105
|
-
|
|
100
|
+
export type RouteMeta = (DefaultRouteMeta & {
|
|
101
|
+
redirectTo?: never;
|
|
106
102
|
}) | RedirectRouteMeta;
|
|
107
103
|
type RouteExport = {
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
default: Type<unknown>;
|
|
105
|
+
routeMeta?: RouteMeta | ReturnType<typeof defineRouteMeta>;
|
|
110
106
|
};
|
|
111
|
-
|
|
107
|
+
/**
|
|
108
|
+
* This variable reference is replaced with a glob of all page routes.
|
|
109
|
+
*/
|
|
110
|
+
declare let ANALOG_ROUTE_FILES: {};
|
|
111
|
+
/**
|
|
112
|
+
* This variable reference is replaced with a glob of all content routes.
|
|
113
|
+
*/
|
|
114
|
+
declare let ANALOG_CONTENT_ROUTE_FILES: {};
|
|
112
115
|
type Files = Record<string, () => Promise<RouteExport | string>>;
|
|
113
116
|
/**
|
|
114
117
|
* A function used to parse list of files and create configuration of routes.
|
|
@@ -116,9 +119,8 @@ type Files = Record<string, () => Promise<RouteExport | string>>;
|
|
|
116
119
|
* @param files
|
|
117
120
|
* @returns Array of routes
|
|
118
121
|
*/
|
|
119
|
-
declare function createRoutes(files: Files, debug?: boolean): Route[];
|
|
120
|
-
declare const routes: Route[];
|
|
121
|
-
|
|
122
|
+
export declare function createRoutes(files: Files, debug?: boolean): Route[];
|
|
123
|
+
export declare const routes: Route[];
|
|
122
124
|
/**
|
|
123
125
|
* Sets up providers for the Angular router, and registers
|
|
124
126
|
* file-based routes. Additional features can be provided
|
|
@@ -127,36 +129,32 @@ declare const routes: Route[];
|
|
|
127
129
|
* @param features
|
|
128
130
|
* @returns Providers and features to configure the router with routes
|
|
129
131
|
*/
|
|
130
|
-
declare function provideFileRouter(...features: RouterFeatures[]): EnvironmentProviders;
|
|
132
|
+
export declare function provideFileRouter(...features: RouterFeatures[]): EnvironmentProviders;
|
|
131
133
|
/**
|
|
132
134
|
* Provides extra custom routes in addition to the routes
|
|
133
135
|
* discovered from the filesystem-based routing. These routes are
|
|
134
136
|
* inserted before the filesystem-based routes, and take priority in
|
|
135
137
|
* route matching.
|
|
136
138
|
*/
|
|
137
|
-
declare function withExtraRoutes(routes: Routes): RouterFeatures;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
event: H3Event;
|
|
139
|
+
export declare function withExtraRoutes(routes: Routes): RouterFeatures;
|
|
140
|
+
export type PageServerLoad = {
|
|
141
|
+
params: H3EventContext['params'];
|
|
142
|
+
req: H3Event['node']['req'];
|
|
143
|
+
res: H3Event['node']['res'];
|
|
144
|
+
fetch: $Fetch;
|
|
145
|
+
event: H3Event;
|
|
145
146
|
};
|
|
146
|
-
type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<any>> = Awaited<ReturnType<A>>;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
injector?: Injector;
|
|
147
|
+
export type LoadResult<A extends (pageServerLoad: PageServerLoad) => Promise<any>> = Awaited<ReturnType<A>>;
|
|
148
|
+
export declare function injectLoad<T extends (pageServerLoad: PageServerLoad) => Promise<any>>(options?: {
|
|
149
|
+
injector?: Injector;
|
|
150
150
|
}): Observable<Awaited<ReturnType<T>>>;
|
|
151
|
-
|
|
152
151
|
/**
|
|
153
152
|
* Get server load resolver data for the route
|
|
154
153
|
*
|
|
155
154
|
* @param route Provides the route to get server load resolver
|
|
156
155
|
* @returns Returns server load resolver data for the route
|
|
157
156
|
*/
|
|
158
|
-
declare function getLoadResolver<T>(route: ActivatedRouteSnapshot): Promise<T>;
|
|
159
|
-
|
|
157
|
+
export declare function getLoadResolver<T>(route: ActivatedRouteSnapshot): Promise<T>;
|
|
160
158
|
/**
|
|
161
159
|
* Interceptor that is server-aware when making HttpClient requests.
|
|
162
160
|
* Server-side requests use the full URL
|
|
@@ -167,145 +165,149 @@ declare function getLoadResolver<T>(route: ActivatedRouteSnapshot): Promise<T>;
|
|
|
167
165
|
* @param next HttpHandlerFn
|
|
168
166
|
* @returns
|
|
169
167
|
*/
|
|
170
|
-
declare function requestContextInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): rxjs.Observable<
|
|
171
|
-
|
|
172
|
-
declare function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL;
|
|
173
|
-
|
|
168
|
+
export declare function requestContextInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): import("rxjs").Observable<import("@angular/common/http").HttpEvent<unknown>>;
|
|
169
|
+
export declare function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL;
|
|
174
170
|
type FormActionState = 'submitting' | 'error' | 'redirect' | 'success' | 'navigate';
|
|
175
|
-
declare class FormAction {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
171
|
+
export declare class FormAction {
|
|
172
|
+
action: import("@angular/core").InputSignal<string>;
|
|
173
|
+
enhanceForm: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
174
|
+
onSuccess: import("@angular/core").OutputEmitterRef<unknown>;
|
|
175
|
+
onError: import("@angular/core").OutputEmitterRef<unknown>;
|
|
176
|
+
state: import("@angular/core").OutputEmitterRef<FormActionState>;
|
|
177
|
+
private currentState;
|
|
178
|
+
private injector;
|
|
179
|
+
private router;
|
|
180
|
+
private route;
|
|
181
|
+
private path;
|
|
182
|
+
constructor();
|
|
183
|
+
submitted($event: any): void;
|
|
184
|
+
private _handleGet;
|
|
185
|
+
private _handlePost;
|
|
186
|
+
private _getPath;
|
|
187
|
+
private _handleEnhancedGet;
|
|
188
|
+
private _handleEnhancedPost;
|
|
189
|
+
private _emitState;
|
|
190
|
+
private _navigateTo;
|
|
191
|
+
private _isJSON;
|
|
192
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FormAction, never>;
|
|
193
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FormAction, "form[action],form[method],form[enhanceForm]", never, {
|
|
194
|
+
"action": {
|
|
195
|
+
"alias": "action";
|
|
196
|
+
"required": false;
|
|
197
|
+
"isSignal": true;
|
|
198
|
+
};
|
|
199
|
+
"enhanceForm": {
|
|
200
|
+
"alias": "enhanceForm";
|
|
201
|
+
"required": false;
|
|
202
|
+
"isSignal": true;
|
|
203
|
+
};
|
|
204
|
+
}, {
|
|
205
|
+
"onSuccess": "onSuccess";
|
|
206
|
+
"onError": "onError";
|
|
207
|
+
"state": "state";
|
|
208
|
+
}, never, never, true, never>;
|
|
198
209
|
}
|
|
199
|
-
|
|
200
210
|
type ValidationFieldErrors = Record<string, string[]>;
|
|
201
|
-
declare function issuePathToFieldName(path: ReadonlyArray<string | number | symbol | {
|
|
202
|
-
|
|
211
|
+
export declare function issuePathToFieldName(path: ReadonlyArray<string | number | symbol | {
|
|
212
|
+
key: string | number | symbol;
|
|
203
213
|
}>): string;
|
|
204
|
-
declare function issuesToFieldErrors(issues: ReadonlyArray<StandardSchemaV1$1.Issue>): ValidationFieldErrors;
|
|
205
|
-
declare function issuesToFormErrors(issues: ReadonlyArray<StandardSchemaV1$1.Issue>): string[];
|
|
206
|
-
|
|
214
|
+
export declare function issuesToFieldErrors(issues: ReadonlyArray<StandardSchemaV1$1.Issue>): ValidationFieldErrors;
|
|
215
|
+
export declare function issuesToFormErrors(issues: ReadonlyArray<StandardSchemaV1$1.Issue>): string[];
|
|
216
|
+
declare const DEBUG_ROUTES: InjectionToken<(Route & DebugRoute)[]>;
|
|
207
217
|
type DebugRoute = {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
218
|
+
path: string;
|
|
219
|
+
filename: string;
|
|
220
|
+
isLayout: boolean;
|
|
221
|
+
children?: DebugRoute[];
|
|
212
222
|
};
|
|
213
|
-
declare function injectDebugRoutes(): (Route & DebugRoute)[];
|
|
214
|
-
|
|
223
|
+
export declare function injectDebugRoutes(): (Route & DebugRoute)[];
|
|
224
|
+
declare namespace debug_page_d_exports {
|
|
225
|
+
export { DebugRoutesComponent as default };
|
|
226
|
+
}
|
|
215
227
|
type CollectedRoute = {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
228
|
+
path: string;
|
|
229
|
+
filename: string;
|
|
230
|
+
file: string;
|
|
231
|
+
isLayout: boolean;
|
|
220
232
|
};
|
|
221
233
|
declare class DebugRoutesComponent {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
234
|
+
collectedRoutes: CollectedRoute[];
|
|
235
|
+
debugRoutes: (import("@angular/router").Route & DebugRoute)[];
|
|
236
|
+
ngOnInit(): void;
|
|
237
|
+
traverseRoutes(routes: DebugRoute[], parent?: string): void;
|
|
238
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DebugRoutesComponent, never>;
|
|
239
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DebugRoutesComponent, "analogjs-debug-routes-page", never, {}, {}, never, never, true, never>;
|
|
228
240
|
}
|
|
229
|
-
|
|
230
|
-
declare namespace __debug_page {
|
|
231
|
-
export {
|
|
232
|
-
DebugRoutesComponent as default,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
|
|
236
241
|
/**
|
|
237
242
|
* Provides routes that provide additional
|
|
238
243
|
* pages for displaying and debugging
|
|
239
244
|
* routes.
|
|
240
245
|
*/
|
|
241
|
-
declare function withDebugRoutes(): {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}[];
|
|
249
|
-
multi: boolean;
|
|
246
|
+
export declare function withDebugRoutes(): {
|
|
247
|
+
ɵkind: number;
|
|
248
|
+
ɵproviders: {
|
|
249
|
+
provide: import("@angular/core").InjectionToken<import("@angular/router").Route[][]>;
|
|
250
|
+
useValue: {
|
|
251
|
+
path: string;
|
|
252
|
+
loadComponent: () => Promise<typeof debug_page_d_exports>;
|
|
250
253
|
}[];
|
|
254
|
+
multi: boolean;
|
|
255
|
+
}[];
|
|
251
256
|
};
|
|
252
|
-
|
|
253
257
|
/** Minimal Standard Schema shape (valibot/zod/arktype conform). */
|
|
254
258
|
interface StandardSchemaV1<In = unknown> {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
259
|
+
readonly '~standard': {
|
|
260
|
+
readonly version: 1;
|
|
261
|
+
readonly vendor: string;
|
|
262
|
+
validate: (value: unknown) => {
|
|
263
|
+
value: In;
|
|
264
|
+
issues?: undefined;
|
|
265
|
+
} | {
|
|
266
|
+
issues: ReadonlyArray<{
|
|
267
|
+
message: string;
|
|
268
|
+
}>;
|
|
269
|
+
} | Promise<{
|
|
270
|
+
value: In;
|
|
271
|
+
issues?: undefined;
|
|
272
|
+
} | {
|
|
273
|
+
issues: ReadonlyArray<{
|
|
274
|
+
message: string;
|
|
275
|
+
}>;
|
|
276
|
+
}>;
|
|
277
|
+
};
|
|
274
278
|
}
|
|
275
279
|
type ServerFnMethod = 'GET' | 'POST';
|
|
276
280
|
interface ServerFnConfig<In> {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
281
|
+
/**
|
|
282
|
+
* Opaque route id `/_analog/fn/<id>`. **Build-injected, not author-supplied:**
|
|
283
|
+
* the Analog transform derives `hash(fileId + exportName)` and stamps it into
|
|
284
|
+
* both the server registration and the client proxy, so authors never choose a
|
|
285
|
+
* route. Absent at runtime means the transform did not run — `serverFn` throws.
|
|
286
|
+
*/
|
|
287
|
+
id?: string;
|
|
288
|
+
/** Defaults to 'POST' when `input` is present, otherwise 'GET'. */
|
|
289
|
+
method?: ServerFnMethod;
|
|
290
|
+
input?: StandardSchemaV1<In>;
|
|
287
291
|
}
|
|
288
292
|
/**
|
|
289
293
|
* Interceptor-accumulated context, delivered to the handler as its second
|
|
290
294
|
* argument. Apps extend this by declaration merging.
|
|
291
295
|
*/
|
|
292
|
-
interface ServerFnContext {
|
|
293
|
-
}
|
|
296
|
+
interface ServerFnContext {}
|
|
294
297
|
/** A server function reference: callable type on both sides; real impl only on the server. */
|
|
295
298
|
type ServerFn<In, Out> = ((input: In) => Promise<Out>) & {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
readonly __serverFn: true;
|
|
300
|
+
readonly id: string;
|
|
301
|
+
readonly url: string;
|
|
302
|
+
readonly method: ServerFnMethod;
|
|
300
303
|
};
|
|
301
304
|
type ServerFnHandler<In, Out> = (input: In, context: ServerFnContext) => Promise<Out> | Out;
|
|
302
305
|
interface ServerFnDef {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
306
|
+
id: string;
|
|
307
|
+
method: ServerFnMethod;
|
|
308
|
+
config: ServerFnConfig<unknown>;
|
|
309
|
+
handler: ServerFnHandler<unknown, unknown>;
|
|
307
310
|
}
|
|
308
|
-
|
|
309
311
|
/**
|
|
310
312
|
* Client transport for server functions. In the browser it goes through Angular
|
|
311
313
|
* `HttpClient`, so client `HttpInterceptorFn`s apply. During SSR the dispatcher
|
|
@@ -313,23 +315,23 @@ interface ServerFnDef {
|
|
|
313
315
|
* handler runs in-process in the current request injector. Lives in the client
|
|
314
316
|
* entry (client-safe).
|
|
315
317
|
*/
|
|
316
|
-
declare class ServerFnClient {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
318
|
+
export declare class ServerFnClient {
|
|
319
|
+
private readonly http;
|
|
320
|
+
private readonly transferState;
|
|
321
|
+
private readonly injector;
|
|
322
|
+
private readonly dispatcher;
|
|
323
|
+
/** True while rendering on the server (the in-process dispatcher is provided). */
|
|
324
|
+
get isServer(): boolean;
|
|
325
|
+
call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out>;
|
|
326
|
+
/** Key a read's value for TransferState hydration (fn id + input). */
|
|
327
|
+
stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown): import("@angular/core").StateKey<Out>;
|
|
328
|
+
readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined;
|
|
329
|
+
writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void;
|
|
330
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ServerFnClient, never>;
|
|
331
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
330
332
|
}
|
|
331
333
|
/** No-op provider hook; ServerFnClient is `providedIn: 'root'`. */
|
|
332
|
-
declare function provideServerFnClient(): readonly [];
|
|
334
|
+
export declare function provideServerFnClient(): readonly [];
|
|
333
335
|
/**
|
|
334
336
|
* Reactive read of a server function as an Angular `resource()`.
|
|
335
337
|
*
|
|
@@ -338,25 +340,24 @@ declare function provideServerFnClient(): readonly [];
|
|
|
338
340
|
* the resource idle until inputs are ready, the standard resource pattern). For
|
|
339
341
|
* imperative calls (mutations, event handlers) use `injectServerFnMutation`.
|
|
340
342
|
*/
|
|
341
|
-
declare function injectServerFn<Out>(fn: ServerFn<void, Out>): ResourceRef<Out | undefined>;
|
|
342
|
-
declare function injectServerFn<In, Out>(fn: ServerFn<In, Out>, args: () => In | undefined): ResourceRef<Out | undefined>;
|
|
343
|
+
export declare function injectServerFn<Out>(fn: ServerFn<void, Out>): ResourceRef<Out | undefined>;
|
|
344
|
+
export declare function injectServerFn<In, Out>(fn: ServerFn<In, Out>, args: () => In | undefined): ResourceRef<Out | undefined>;
|
|
343
345
|
/**
|
|
344
346
|
* Imperative binding of a server function: returns a callable that dispatches
|
|
345
347
|
* the call through `HttpClient` (so client interceptors apply) and resolves the
|
|
346
348
|
* result. Use for mutations and event-driven calls; use `injectServerFn` for
|
|
347
349
|
* reactive reads.
|
|
348
350
|
*/
|
|
349
|
-
declare function injectServerFnMutation<In, Out>(fn: ServerFn<In, Out>): (input: In) => Promise<Out>;
|
|
350
|
-
|
|
351
|
+
export declare function injectServerFnMutation<In, Out>(fn: ServerFn<In, Out>): (input: In) => Promise<Out>;
|
|
351
352
|
interface ServerFnRefConfig {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
353
|
+
id?: string;
|
|
354
|
+
method?: ServerFnMethod;
|
|
355
|
+
/**
|
|
356
|
+
* Only its presence matters here: when `method` is omitted, a config with an
|
|
357
|
+
* `input` schema defaults to `POST`, otherwise `GET`. The schema itself is
|
|
358
|
+
* never used to build the ref — validation happens server-side.
|
|
359
|
+
*/
|
|
360
|
+
input?: unknown;
|
|
360
361
|
}
|
|
361
362
|
/**
|
|
362
363
|
* Builds a server-function reference: the client-safe `{ __serverFn, id, url,
|
|
@@ -370,8 +371,7 @@ interface ServerFnRefConfig {
|
|
|
370
371
|
* The returned value is callable-typed but throws if invoked directly — it is
|
|
371
372
|
* always dispatched via `injectServerFn`/`ServerFnClient`, never called.
|
|
372
373
|
*/
|
|
373
|
-
declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): ServerFn<In, Out>;
|
|
374
|
-
|
|
374
|
+
export declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): ServerFn<In, Out>;
|
|
375
375
|
/**
|
|
376
376
|
* In-process transport for a server function call.
|
|
377
377
|
*
|
|
@@ -392,8 +392,7 @@ declare function createServerFnRef<In, Out>(config: ServerFnRefConfig): ServerFn
|
|
|
392
392
|
* be surprising and unportable.
|
|
393
393
|
*/
|
|
394
394
|
type ServerFnDispatcher = <In, Out>(fn: ServerFn<In, Out>, input: In, injector: Injector) => Promise<Out>;
|
|
395
|
-
declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
|
|
396
|
-
|
|
395
|
+
export declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
|
|
397
396
|
/**
|
|
398
397
|
* Typed route path utilities for Analog.
|
|
399
398
|
*
|
|
@@ -410,8 +409,7 @@ declare const SERVER_FN_DISPATCHER: InjectionToken<ServerFnDispatcher>;
|
|
|
410
409
|
* This interface is augmented by generated code in `src/routeTree.gen.d.ts`.
|
|
411
410
|
* Without the generated declaration, typed helpers reject route paths.
|
|
412
411
|
*/
|
|
413
|
-
interface AnalogRouteTable {
|
|
414
|
-
}
|
|
412
|
+
interface AnalogRouteTable {}
|
|
415
413
|
/**
|
|
416
414
|
* Union of all valid route paths.
|
|
417
415
|
*
|
|
@@ -423,61 +421,55 @@ type AnalogRoutePath = Extract<keyof AnalogRouteTable, string>;
|
|
|
423
421
|
* Options for building a route URL.
|
|
424
422
|
*/
|
|
425
423
|
interface RoutePathOptionsBase {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
424
|
+
params?: Record<string, string | number | (string | number)[] | undefined>;
|
|
425
|
+
query?: Record<string, string | string[] | undefined>;
|
|
426
|
+
hash?: string;
|
|
429
427
|
}
|
|
430
428
|
/** Raw parameter types from the generated route table. */
|
|
431
429
|
type RouteParamsOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
432
|
-
|
|
430
|
+
params: infer Params;
|
|
433
431
|
} ? Params : Record<string, unknown> : Record<string, unknown>;
|
|
434
432
|
/**
|
|
435
433
|
* Extracts the raw output type for route query params.
|
|
436
434
|
*/
|
|
437
435
|
type RouteQueryOutput<P extends string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
438
|
-
|
|
436
|
+
query: infer O;
|
|
439
437
|
} ? O : Record<string, string | string[] | undefined> : Record<string, string | string[] | undefined>;
|
|
440
|
-
type RequiredRouteParamKeys<Params> = Params extends Record<string, never> ? never : {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
type HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [
|
|
444
|
-
never
|
|
445
|
-
] ? false : true;
|
|
446
|
-
type RouteParamsInput<Params> = {
|
|
447
|
-
[K in keyof Params]: Exclude<Params[K], undefined> extends string[] ? undefined extends Params[K] ? (string | number)[] : [string | number, ...(string | number)[]] : Exclude<Params[K], undefined> extends string ? string | number : Params[K];
|
|
448
|
-
};
|
|
438
|
+
type RequiredRouteParamKeys<Params> = Params extends Record<string, never> ? never : { [K in keyof Params]-?: Record<string, never> extends Pick<Params, K> ? never : K; }[keyof Params];
|
|
439
|
+
type HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [never] ? false : true;
|
|
440
|
+
type RouteParamsInput<Params> = { [K in keyof Params]: Exclude<Params[K], undefined> extends string[] ? undefined extends Params[K] ? (string | number)[] : [string | number, ...(string | number)[]] : Exclude<Params[K], undefined> extends string ? string | number : Params[K]; };
|
|
449
441
|
/**
|
|
450
442
|
* Typed options that infer params from the route table when available.
|
|
451
443
|
*/
|
|
452
444
|
type RoutePathOptions<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
453
|
-
|
|
445
|
+
params: infer Params;
|
|
454
446
|
} ? Params extends Record<string, never> ? {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
447
|
+
params?: never;
|
|
448
|
+
query?: RouteQueryOutput<P>;
|
|
449
|
+
hash?: string;
|
|
458
450
|
} : HasRequiredRouteParams<Params> extends true ? {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
451
|
+
params: RouteParamsInput<Params>;
|
|
452
|
+
query?: RouteQueryOutput<P>;
|
|
453
|
+
hash?: string;
|
|
462
454
|
} : {
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
455
|
+
params?: RouteParamsInput<Params>;
|
|
456
|
+
query?: RouteQueryOutput<P>;
|
|
457
|
+
hash?: string;
|
|
466
458
|
} : RoutePathOptionsBase : RoutePathOptionsBase;
|
|
467
459
|
/**
|
|
468
460
|
* Conditional args: require options when the route has params.
|
|
469
461
|
*/
|
|
470
462
|
type RoutePathArgs<P extends string = string> = P extends keyof AnalogRouteTable ? AnalogRouteTable[P] extends {
|
|
471
|
-
|
|
463
|
+
params: infer Params;
|
|
472
464
|
} ? Params extends Record<string, never> ? [options?: RoutePathOptions<P>] : HasRequiredRouteParams<Params> extends true ? [options: RoutePathOptions<P>] : [options?: RoutePathOptions<P>] : [options?: RoutePathOptionsBase] : [options?: RoutePathOptionsBase];
|
|
473
465
|
/**
|
|
474
466
|
* Result of `toRoute()` — contains properties that map directly
|
|
475
467
|
* to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.
|
|
476
468
|
*/
|
|
477
469
|
interface RouteLinkResult {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
470
|
+
path: string[];
|
|
471
|
+
queryParams: Record<string, string | string[]> | null;
|
|
472
|
+
fragment: string | undefined;
|
|
481
473
|
}
|
|
482
474
|
/**
|
|
483
475
|
* Builds a typed route link object from a route path pattern and options.
|
|
@@ -505,32 +497,46 @@ interface RouteLinkResult {
|
|
|
505
497
|
* <a [routerLink]="link.path" [queryParams]="link.queryParams" [fragment]="link.fragment">
|
|
506
498
|
* ```
|
|
507
499
|
*/
|
|
508
|
-
declare function toRoute<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): RouteLinkResult;
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
500
|
+
export declare function toRoute<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): RouteLinkResult;
|
|
501
|
+
/**
|
|
502
|
+
* Internal: builds a `RouteLinkResult` from path and options.
|
|
503
|
+
* Exported for direct use in tests (avoids generic constraints).
|
|
504
|
+
*/
|
|
505
|
+
declare function buildRouteLink(path: string, options?: RoutePathOptionsBase): RouteLinkResult;
|
|
506
|
+
/** Internal URL serialization for programmatic navigation. */
|
|
507
|
+
declare function buildUrl(path: string, options?: RoutePathOptionsBase): string;
|
|
508
|
+
type LinkToDestination = { [P in AnalogRoutePath]: {
|
|
509
|
+
path: P;
|
|
510
|
+
} & RoutePathOptions<P>; }[AnalogRoutePath];
|
|
511
|
+
type StaticRoutePath = { [P in AnalogRoutePath]: RouteParamsOutput<P> extends Record<string, never> ? P : never; }[AnalogRoutePath];
|
|
512
|
+
export declare class LinkTo implements OnChanges {
|
|
513
|
+
readonly linkTo: InputSignal<StaticRoutePath | LinkToDestination | null | undefined>;
|
|
514
|
+
private readonly routerLink;
|
|
515
|
+
ngOnChanges(): void;
|
|
516
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LinkTo, never>;
|
|
517
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LinkTo, "[linkTo]", never, {
|
|
518
|
+
"linkTo": {
|
|
519
|
+
"alias": "linkTo";
|
|
520
|
+
"required": true;
|
|
521
|
+
"isSignal": true;
|
|
522
|
+
};
|
|
523
|
+
}, {}, never, never, true, [{
|
|
524
|
+
directive: typeof i1.RouterLink;
|
|
525
|
+
inputs: {
|
|
526
|
+
"target": "target";
|
|
527
|
+
"queryParamsHandling": "queryParamsHandling";
|
|
528
|
+
"preserveFragment": "preserveFragment";
|
|
529
|
+
"skipLocationChange": "skipLocationChange";
|
|
530
|
+
"replaceUrl": "replaceUrl";
|
|
531
|
+
"state": "state";
|
|
532
|
+
};
|
|
533
|
+
outputs: {};
|
|
534
|
+
}]>;
|
|
524
535
|
}
|
|
525
|
-
|
|
526
|
-
type NavigateWithExtrasArgs<P extends AnalogRoutePath> = [
|
|
527
|
-
] extends RoutePathArgs<P> ? [extras: NavigationBehaviorOptions] | [
|
|
528
|
-
options: RoutePathArgs<P>[0] | undefined,
|
|
529
|
-
extras: NavigationBehaviorOptions
|
|
530
|
-
] : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];
|
|
536
|
+
type NavigateWithExtrasArgs<P extends AnalogRoutePath> = [] extends RoutePathArgs<P> ? [extras: NavigationBehaviorOptions] | [options: RoutePathArgs<P>[0] | undefined, extras: NavigationBehaviorOptions] : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];
|
|
531
537
|
type TypedNavigate = {
|
|
532
|
-
|
|
533
|
-
|
|
538
|
+
<P extends AnalogRoutePath>(path: P, ...args: RoutePathArgs<P>): Promise<boolean>;
|
|
539
|
+
<P extends AnalogRoutePath>(path: P, ...args: NavigateWithExtrasArgs<P>): Promise<boolean>;
|
|
534
540
|
};
|
|
535
541
|
/**
|
|
536
542
|
* Injects a typed navigate function.
|
|
@@ -546,16 +552,13 @@ type TypedNavigate = {
|
|
|
546
552
|
* navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });
|
|
547
553
|
* ```
|
|
548
554
|
*/
|
|
549
|
-
declare function injectNavigate(): TypedNavigate;
|
|
550
|
-
|
|
555
|
+
export declare function injectNavigate(): TypedNavigate;
|
|
551
556
|
/** Read raw route params; catch-all segments are returned as arrays. */
|
|
552
|
-
declare function injectParams<P extends AnalogRoutePath>(_from: P, options?: {
|
|
553
|
-
|
|
557
|
+
export declare function injectParams<P extends AnalogRoutePath>(_from: P, options?: {
|
|
558
|
+
injector?: Injector;
|
|
554
559
|
}): Signal<RouteParamsOutput<P>>;
|
|
555
560
|
/** Read raw query params as a signal. No schema coercion is performed. */
|
|
556
|
-
declare function injectQuery<P extends AnalogRoutePath>(_from: P, options?: {
|
|
557
|
-
|
|
561
|
+
export declare function injectQuery<P extends AnalogRoutePath>(_from: P, options?: {
|
|
562
|
+
injector?: Injector;
|
|
558
563
|
}): Signal<RouteQueryOutput<P>>;
|
|
559
|
-
|
|
560
|
-
export { FormAction, LinkTo, SERVER_FN_DISPATCHER, ServerFnClient, createRoutes, createServerFnRef, defineRouteMeta, getLoadResolver, injectActivatedRoute, injectDebugRoutes, injectLoad, injectNavigate, injectParams, injectQuery, injectRouteEndpointURL, injectRouter, injectServerFn, injectServerFnMutation, issuePathToFieldName, issuesToFieldErrors, issuesToFormErrors, provideFileRouter, provideServerFnClient, requestContextInterceptor, routes, toRoute, withDebugRoutes, withExtraRoutes };
|
|
561
|
-
export type { AnalogRoutePath, AnalogRouteTable, Files, FormActionState, LoadResult, MetaTag, PageServerLoad, RouteExport, RouteMeta, RoutePathOptions, ServerFn, ServerFnConfig, ServerFnContext, ServerFnDef, ServerFnDispatcher, ServerFnHandler, ServerFnMethod, ServerFnRefConfig, StandardSchemaV1, ValidationFieldErrors };
|
|
564
|
+
export type { AnalogRoutePath, AnalogRouteTable, Files, FormActionState, RouteExport, RoutePathOptions, ServerFn, ServerFnConfig, ServerFnContext, ServerFnDef, ServerFnDispatcher, ServerFnHandler, ServerFnMethod, ServerFnRefConfig, StandardSchemaV1, ValidationFieldErrors };
|