@tanstack/start-client-core 1.132.48 → 1.133.2
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/esm/serverRoute.d.ts +25 -25
- package/package.json +17 -2
- package/src/serverRoute.ts +63 -28
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AnyContext, AnyRoute, Assign, Constrain, Expand,
|
|
1
|
+
import { AnyContext, AnyRoute, Assign, Constrain, Expand, ResolveAllParamsFromParent, UnionToIntersection } from '@tanstack/router-core';
|
|
2
2
|
import { AnyRequestMiddleware, AssignAllServerRequestContext } from './createMiddleware.js';
|
|
3
3
|
declare module '@tanstack/router-core' {
|
|
4
4
|
interface FilebaseRouteOptionsInterface<TRegister, TParentRoute extends AnyRoute = AnyRoute, TId extends string = string, TPath extends string = string, TSearchValidator = undefined, TParams = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TRouterContext = {}, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TRemountDepsFn = AnyContext, TSSR = unknown, TServerMiddlewares = unknown, THandlers = undefined> {
|
|
5
|
-
server?: RouteServerOptions<TRegister,
|
|
5
|
+
server?: RouteServerOptions<TRegister, TParentRoute, TPath, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers>;
|
|
6
6
|
}
|
|
7
7
|
interface RouteTypes<in out TRegister, in out TParentRoute extends AnyRoute, in out TPath extends string, in out TFullPath extends string, in out TCustomId extends string, in out TId extends string, in out TSearchValidator, in out TParams, in out TRouterContext, in out TRouteContextFn, in out TBeforeLoadFn, in out TLoaderDeps, in out TLoaderFn, in out TChildren, in out TFileRouteTypes, in out TSSR, in out TServerMiddlewares, in out THandlers> {
|
|
8
8
|
middleware: TServerMiddlewares;
|
|
@@ -15,46 +15,46 @@ declare module '@tanstack/router-core' {
|
|
|
15
15
|
serverContext?: Expand<Assign<ResolveAllServerContext<TRegister, TParentRoute, TServerMiddlewares>, ExtractHandlersContext<THandlers>>>;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
type ExtractHandlersContext<THandlers> = THandlers extends (...args: any) => CustomHandlerFunctionsRecord<any, any, any, any, any, infer TServerContext> ? UnionToIntersection<TServerContext> : THandlers extends Record<string, RouteMethodHandler<any, any, any, any, any, infer TServerContext>> ? UnionToIntersection<TServerContext> : undefined;
|
|
19
|
-
export interface RouteServerOptions<TRegister, TParentRoute extends AnyRoute,
|
|
18
|
+
type ExtractHandlersContext<THandlers> = THandlers extends (...args: any) => CustomHandlerFunctionsRecord<any, any, any, any, any, any, infer TServerContext> ? UnionToIntersection<TServerContext> : THandlers extends Record<string, RouteMethodHandler<any, any, any, any, any, any, infer TServerContext>> ? UnionToIntersection<TServerContext> : undefined;
|
|
19
|
+
export interface RouteServerOptions<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TLoaderDeps, TLoaderFn, TRouterContext, TRouteContextFn, TBeforeLoadFn, TServerMiddlewares, THandlers> {
|
|
20
20
|
middleware?: Constrain<TServerMiddlewares, ReadonlyArray<AnyRequestMiddleware>>;
|
|
21
|
-
handlers?: Constrain<THandlers, Partial<Record<RouteMethod, RouteMethodHandlerFn<TRegister, TParentRoute,
|
|
21
|
+
handlers?: Constrain<THandlers, Partial<Record<RouteMethod, RouteMethodHandlerFn<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, any, any>>> | ((opts: HandlersFnOpts<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares>) => CustomHandlerFunctionsRecord<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, any, any>)>;
|
|
22
22
|
}
|
|
23
23
|
declare const createHandlersSymbol: unique symbol;
|
|
24
|
-
type CustomHandlerFunctionsRecord<TRegister, TParentRoute extends AnyRoute,
|
|
24
|
+
type CustomHandlerFunctionsRecord<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares, TMethodMiddlewares, TServerContext> = {
|
|
25
25
|
[createHandlersSymbol]: true;
|
|
26
|
-
} & Partial<Record<RouteMethod, RouteMethodHandler<TRegister, TParentRoute,
|
|
27
|
-
export interface HandlersFnOpts<TRegister, TParentRoute extends AnyRoute,
|
|
28
|
-
createHandlers: CreateHandlersFn<TRegister, TParentRoute,
|
|
26
|
+
} & Partial<Record<RouteMethod, RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodMiddlewares, TServerContext>>>;
|
|
27
|
+
export interface HandlersFnOpts<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares> {
|
|
28
|
+
createHandlers: CreateHandlersFn<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares>;
|
|
29
29
|
}
|
|
30
|
-
export type CreateHandlersFn<TRegister, TParentRoute extends AnyRoute,
|
|
31
|
-
export interface CreateMethodFnOpts<TRegister, TParentRoute extends AnyRoute,
|
|
32
|
-
ALL?: RouteMethodHandler<TRegister, TParentRoute,
|
|
33
|
-
GET?: RouteMethodHandler<TRegister, TParentRoute,
|
|
34
|
-
POST?: RouteMethodHandler<TRegister, TParentRoute,
|
|
35
|
-
PUT?: RouteMethodHandler<TRegister, TParentRoute,
|
|
36
|
-
PATCH?: RouteMethodHandler<TRegister, TParentRoute,
|
|
37
|
-
DELETE?: RouteMethodHandler<TRegister, TParentRoute,
|
|
38
|
-
OPTIONS?: RouteMethodHandler<TRegister, TParentRoute,
|
|
39
|
-
HEAD?: RouteMethodHandler<TRegister, TParentRoute,
|
|
30
|
+
export type CreateHandlersFn<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares> = <const TMethodAllMiddlewares, const TMethodGetMiddlewares, const TMethodPostMiddlewares, const TMethodPutMiddlewares, const TMethodPatchMiddlewares, const TMethodDeleteMiddlewares, const TMethodOptionsMiddlewares, const TMethodHeadMiddlewares, TServerContext>(opts: CreateMethodFnOpts<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodAllMiddlewares, TMethodGetMiddlewares, TMethodPostMiddlewares, TMethodPutMiddlewares, TMethodPatchMiddlewares, TMethodDeleteMiddlewares, TMethodOptionsMiddlewares, TMethodHeadMiddlewares, TServerContext>) => CustomHandlerFunctionsRecord<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, any, TServerContext>;
|
|
31
|
+
export interface CreateMethodFnOpts<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares, TMethodAllMiddlewares, TMethodGetMiddlewares, TMethodPostMiddlewares, TMethodPutMiddlewares, TMethodPatchMiddlewares, TMethodDeleteMiddlewares, TMethodOptionsMiddlewares, TMethodHeadMiddlewares, TServerContext> {
|
|
32
|
+
ALL?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodAllMiddlewares, TServerContext>;
|
|
33
|
+
GET?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodGetMiddlewares, TServerContext>;
|
|
34
|
+
POST?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodPostMiddlewares, TServerContext>;
|
|
35
|
+
PUT?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodPutMiddlewares, TServerContext>;
|
|
36
|
+
PATCH?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodPatchMiddlewares, TServerContext>;
|
|
37
|
+
DELETE?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodDeleteMiddlewares, TServerContext>;
|
|
38
|
+
OPTIONS?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodOptionsMiddlewares, TServerContext>;
|
|
39
|
+
HEAD?: RouteMethodHandler<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodHeadMiddlewares, TServerContext>;
|
|
40
40
|
}
|
|
41
|
-
export type RouteMethodHandler<TRegister, TParentRoute extends AnyRoute,
|
|
42
|
-
export interface RouteMethodBuilderOptions<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TServerMiddlewares, TMethodMiddlewares, TResponse> {
|
|
43
|
-
handler?: RouteMethodHandlerFn<TRegister, TParentRoute, TFullPath, TServerMiddlewares, TMethodMiddlewares, TResponse>;
|
|
41
|
+
export type RouteMethodHandler<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares, TMethodMiddlewares, TServerContext> = RouteMethodHandlerFn<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodMiddlewares, TServerContext> | RouteMethodBuilderOptions<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodMiddlewares, TServerContext>;
|
|
42
|
+
export interface RouteMethodBuilderOptions<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares, TMethodMiddlewares, TResponse> {
|
|
43
|
+
handler?: RouteMethodHandlerFn<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodMiddlewares, TResponse>;
|
|
44
44
|
middleware?: Constrain<TMethodMiddlewares, ReadonlyArray<AnyRequestMiddleware>>;
|
|
45
45
|
}
|
|
46
46
|
export type ResolveAllServerContext<TRegister, TParentRoute extends AnyRoute, TServerMiddlewares> = unknown extends TParentRoute ? AssignAllServerRequestContext<TRegister, TServerMiddlewares, {}> : Assign<TParentRoute['types']['allServerContext'], AssignAllServerRequestContext<TRegister, TServerMiddlewares, {}>>;
|
|
47
47
|
export type RouteMethod = 'ALL' | 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
48
|
-
export type RouteMethodHandlerFn<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TServerMiddlewares, TMethodMiddlewares, TServerContext> = (ctx: RouteMethodHandlerCtx<TRegister, TParentRoute, TFullPath, TServerMiddlewares, TMethodMiddlewares>) => RouteMethodResult<TServerContext> | Promise<RouteMethodResult<TServerContext>>;
|
|
48
|
+
export type RouteMethodHandlerFn<TRegister, TParentRoute extends AnyRoute, TFullPath extends string, TParams, TServerMiddlewares, TMethodMiddlewares, TServerContext> = (ctx: RouteMethodHandlerCtx<TRegister, TParentRoute, TFullPath, TParams, TServerMiddlewares, TMethodMiddlewares>) => RouteMethodResult<TServerContext> | Promise<RouteMethodResult<TServerContext>>;
|
|
49
49
|
export type RouteMethodResult<TContext> = Response | undefined | RouteMethodNextResult<TContext>;
|
|
50
50
|
export type RouteMethodNextResult<TContext> = {
|
|
51
51
|
isNext: true;
|
|
52
52
|
context: TContext;
|
|
53
53
|
};
|
|
54
|
-
export interface RouteMethodHandlerCtx<in out TRegister, in out TParentRoute extends AnyRoute, in out TFullPath extends string, in out TServerMiddlewares, in out TMethodMiddlewares> {
|
|
54
|
+
export interface RouteMethodHandlerCtx<in out TRegister, in out TParentRoute extends AnyRoute, in out TFullPath extends string, in out TParams, in out TServerMiddlewares, in out TMethodMiddlewares> {
|
|
55
55
|
context: Expand<AssignAllMethodContext<TRegister, TParentRoute, TServerMiddlewares, TMethodMiddlewares>>;
|
|
56
56
|
request: Request;
|
|
57
|
-
params: Expand<
|
|
57
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>;
|
|
58
58
|
pathname: TFullPath;
|
|
59
59
|
next: <TContext = undefined>(options?: {
|
|
60
60
|
context?: TContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/start-client-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.133.2",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,5 +69,20 @@
|
|
|
69
69
|
"@tanstack/router-core": "1.132.47",
|
|
70
70
|
"@tanstack/start-storage-context": "1.132.48"
|
|
71
71
|
},
|
|
72
|
-
"scripts": {
|
|
72
|
+
"scripts": {
|
|
73
|
+
"clean": "rimraf ./dist && rimraf ./coverage",
|
|
74
|
+
"test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
|
|
75
|
+
"test:unit": "vitest",
|
|
76
|
+
"test:unit:dev": "vitest --watch",
|
|
77
|
+
"test:eslint": "eslint ./src",
|
|
78
|
+
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
|
|
79
|
+
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
|
|
80
|
+
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
|
|
81
|
+
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
|
|
82
|
+
"test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
|
|
83
|
+
"test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
|
|
84
|
+
"test:types:ts59": "tsc",
|
|
85
|
+
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
|
|
86
|
+
"build": "vite build"
|
|
87
|
+
}
|
|
73
88
|
}
|
package/src/serverRoute.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
Assign,
|
|
5
5
|
Constrain,
|
|
6
6
|
Expand,
|
|
7
|
-
|
|
7
|
+
ResolveAllParamsFromParent,
|
|
8
8
|
UnionToIntersection,
|
|
9
9
|
} from '@tanstack/router-core'
|
|
10
10
|
import type {
|
|
@@ -32,7 +32,7 @@ declare module '@tanstack/router-core' {
|
|
|
32
32
|
> {
|
|
33
33
|
server?: RouteServerOptions<
|
|
34
34
|
TRegister,
|
|
35
|
-
|
|
35
|
+
TParentRoute,
|
|
36
36
|
TPath,
|
|
37
37
|
TParams,
|
|
38
38
|
TLoaderDeps,
|
|
@@ -114,11 +114,19 @@ declare module '@tanstack/router-core' {
|
|
|
114
114
|
|
|
115
115
|
type ExtractHandlersContext<THandlers> = THandlers extends (
|
|
116
116
|
...args: any
|
|
117
|
-
) => CustomHandlerFunctionsRecord<
|
|
117
|
+
) => CustomHandlerFunctionsRecord<
|
|
118
|
+
any,
|
|
119
|
+
any,
|
|
120
|
+
any,
|
|
121
|
+
any,
|
|
122
|
+
any,
|
|
123
|
+
any,
|
|
124
|
+
infer TServerContext
|
|
125
|
+
>
|
|
118
126
|
? UnionToIntersection<TServerContext>
|
|
119
127
|
: THandlers extends Record<
|
|
120
128
|
string,
|
|
121
|
-
RouteMethodHandler<any, any, any, any, any, infer TServerContext>
|
|
129
|
+
RouteMethodHandler<any, any, any, any, any, any, infer TServerContext>
|
|
122
130
|
>
|
|
123
131
|
? UnionToIntersection<TServerContext>
|
|
124
132
|
: undefined
|
|
@@ -126,7 +134,7 @@ type ExtractHandlersContext<THandlers> = THandlers extends (
|
|
|
126
134
|
export interface RouteServerOptions<
|
|
127
135
|
TRegister,
|
|
128
136
|
TParentRoute extends AnyRoute,
|
|
129
|
-
|
|
137
|
+
TFullPath extends string,
|
|
130
138
|
TParams,
|
|
131
139
|
TLoaderDeps,
|
|
132
140
|
TLoaderFn,
|
|
@@ -149,7 +157,8 @@ export interface RouteServerOptions<
|
|
|
149
157
|
RouteMethodHandlerFn<
|
|
150
158
|
TRegister,
|
|
151
159
|
TParentRoute,
|
|
152
|
-
|
|
160
|
+
TFullPath,
|
|
161
|
+
TParams,
|
|
153
162
|
TServerMiddlewares,
|
|
154
163
|
any,
|
|
155
164
|
any
|
|
@@ -160,13 +169,15 @@ export interface RouteServerOptions<
|
|
|
160
169
|
opts: HandlersFnOpts<
|
|
161
170
|
TRegister,
|
|
162
171
|
TParentRoute,
|
|
163
|
-
|
|
172
|
+
TFullPath,
|
|
173
|
+
TParams,
|
|
164
174
|
TServerMiddlewares
|
|
165
175
|
>,
|
|
166
176
|
) => CustomHandlerFunctionsRecord<
|
|
167
177
|
TRegister,
|
|
168
178
|
TParentRoute,
|
|
169
|
-
|
|
179
|
+
TFullPath,
|
|
180
|
+
TParams,
|
|
170
181
|
TServerMiddlewares,
|
|
171
182
|
any,
|
|
172
183
|
any
|
|
@@ -179,7 +190,8 @@ declare const createHandlersSymbol: unique symbol
|
|
|
179
190
|
type CustomHandlerFunctionsRecord<
|
|
180
191
|
TRegister,
|
|
181
192
|
TParentRoute extends AnyRoute,
|
|
182
|
-
|
|
193
|
+
TFullPath extends string,
|
|
194
|
+
TParams,
|
|
183
195
|
TServerMiddlewares,
|
|
184
196
|
TMethodMiddlewares,
|
|
185
197
|
TServerContext,
|
|
@@ -191,7 +203,8 @@ type CustomHandlerFunctionsRecord<
|
|
|
191
203
|
RouteMethodHandler<
|
|
192
204
|
TRegister,
|
|
193
205
|
TParentRoute,
|
|
194
|
-
|
|
206
|
+
TFullPath,
|
|
207
|
+
TParams,
|
|
195
208
|
TServerMiddlewares,
|
|
196
209
|
TMethodMiddlewares,
|
|
197
210
|
TServerContext
|
|
@@ -202,13 +215,15 @@ type CustomHandlerFunctionsRecord<
|
|
|
202
215
|
export interface HandlersFnOpts<
|
|
203
216
|
TRegister,
|
|
204
217
|
TParentRoute extends AnyRoute,
|
|
205
|
-
|
|
218
|
+
TFullPath extends string,
|
|
219
|
+
TParams,
|
|
206
220
|
TServerMiddlewares,
|
|
207
221
|
> {
|
|
208
222
|
createHandlers: CreateHandlersFn<
|
|
209
223
|
TRegister,
|
|
210
224
|
TParentRoute,
|
|
211
|
-
|
|
225
|
+
TFullPath,
|
|
226
|
+
TParams,
|
|
212
227
|
TServerMiddlewares
|
|
213
228
|
>
|
|
214
229
|
}
|
|
@@ -216,7 +231,8 @@ export interface HandlersFnOpts<
|
|
|
216
231
|
export type CreateHandlersFn<
|
|
217
232
|
TRegister,
|
|
218
233
|
TParentRoute extends AnyRoute,
|
|
219
|
-
|
|
234
|
+
TFullPath extends string,
|
|
235
|
+
TParams,
|
|
220
236
|
TServerMiddlewares,
|
|
221
237
|
> = <
|
|
222
238
|
const TMethodAllMiddlewares,
|
|
@@ -232,7 +248,8 @@ export type CreateHandlersFn<
|
|
|
232
248
|
opts: CreateMethodFnOpts<
|
|
233
249
|
TRegister,
|
|
234
250
|
TParentRoute,
|
|
235
|
-
|
|
251
|
+
TFullPath,
|
|
252
|
+
TParams,
|
|
236
253
|
TServerMiddlewares,
|
|
237
254
|
TMethodAllMiddlewares,
|
|
238
255
|
TMethodGetMiddlewares,
|
|
@@ -247,7 +264,8 @@ export type CreateHandlersFn<
|
|
|
247
264
|
) => CustomHandlerFunctionsRecord<
|
|
248
265
|
TRegister,
|
|
249
266
|
TParentRoute,
|
|
250
|
-
|
|
267
|
+
TFullPath,
|
|
268
|
+
TParams,
|
|
251
269
|
TServerMiddlewares,
|
|
252
270
|
any,
|
|
253
271
|
TServerContext
|
|
@@ -256,7 +274,8 @@ export type CreateHandlersFn<
|
|
|
256
274
|
export interface CreateMethodFnOpts<
|
|
257
275
|
TRegister,
|
|
258
276
|
TParentRoute extends AnyRoute,
|
|
259
|
-
|
|
277
|
+
TFullPath extends string,
|
|
278
|
+
TParams,
|
|
260
279
|
TServerMiddlewares,
|
|
261
280
|
TMethodAllMiddlewares,
|
|
262
281
|
TMethodGetMiddlewares,
|
|
@@ -271,7 +290,8 @@ export interface CreateMethodFnOpts<
|
|
|
271
290
|
ALL?: RouteMethodHandler<
|
|
272
291
|
TRegister,
|
|
273
292
|
TParentRoute,
|
|
274
|
-
|
|
293
|
+
TFullPath,
|
|
294
|
+
TParams,
|
|
275
295
|
TServerMiddlewares,
|
|
276
296
|
TMethodAllMiddlewares,
|
|
277
297
|
TServerContext
|
|
@@ -279,7 +299,8 @@ export interface CreateMethodFnOpts<
|
|
|
279
299
|
GET?: RouteMethodHandler<
|
|
280
300
|
TRegister,
|
|
281
301
|
TParentRoute,
|
|
282
|
-
|
|
302
|
+
TFullPath,
|
|
303
|
+
TParams,
|
|
283
304
|
TServerMiddlewares,
|
|
284
305
|
TMethodGetMiddlewares,
|
|
285
306
|
TServerContext
|
|
@@ -287,7 +308,8 @@ export interface CreateMethodFnOpts<
|
|
|
287
308
|
POST?: RouteMethodHandler<
|
|
288
309
|
TRegister,
|
|
289
310
|
TParentRoute,
|
|
290
|
-
|
|
311
|
+
TFullPath,
|
|
312
|
+
TParams,
|
|
291
313
|
TServerMiddlewares,
|
|
292
314
|
TMethodPostMiddlewares,
|
|
293
315
|
TServerContext
|
|
@@ -295,7 +317,8 @@ export interface CreateMethodFnOpts<
|
|
|
295
317
|
PUT?: RouteMethodHandler<
|
|
296
318
|
TRegister,
|
|
297
319
|
TParentRoute,
|
|
298
|
-
|
|
320
|
+
TFullPath,
|
|
321
|
+
TParams,
|
|
299
322
|
TServerMiddlewares,
|
|
300
323
|
TMethodPutMiddlewares,
|
|
301
324
|
TServerContext
|
|
@@ -303,7 +326,8 @@ export interface CreateMethodFnOpts<
|
|
|
303
326
|
PATCH?: RouteMethodHandler<
|
|
304
327
|
TRegister,
|
|
305
328
|
TParentRoute,
|
|
306
|
-
|
|
329
|
+
TFullPath,
|
|
330
|
+
TParams,
|
|
307
331
|
TServerMiddlewares,
|
|
308
332
|
TMethodPatchMiddlewares,
|
|
309
333
|
TServerContext
|
|
@@ -311,7 +335,8 @@ export interface CreateMethodFnOpts<
|
|
|
311
335
|
DELETE?: RouteMethodHandler<
|
|
312
336
|
TRegister,
|
|
313
337
|
TParentRoute,
|
|
314
|
-
|
|
338
|
+
TFullPath,
|
|
339
|
+
TParams,
|
|
315
340
|
TServerMiddlewares,
|
|
316
341
|
TMethodDeleteMiddlewares,
|
|
317
342
|
TServerContext
|
|
@@ -319,7 +344,8 @@ export interface CreateMethodFnOpts<
|
|
|
319
344
|
OPTIONS?: RouteMethodHandler<
|
|
320
345
|
TRegister,
|
|
321
346
|
TParentRoute,
|
|
322
|
-
|
|
347
|
+
TFullPath,
|
|
348
|
+
TParams,
|
|
323
349
|
TServerMiddlewares,
|
|
324
350
|
TMethodOptionsMiddlewares,
|
|
325
351
|
TServerContext
|
|
@@ -327,7 +353,8 @@ export interface CreateMethodFnOpts<
|
|
|
327
353
|
HEAD?: RouteMethodHandler<
|
|
328
354
|
TRegister,
|
|
329
355
|
TParentRoute,
|
|
330
|
-
|
|
356
|
+
TFullPath,
|
|
357
|
+
TParams,
|
|
331
358
|
TServerMiddlewares,
|
|
332
359
|
TMethodHeadMiddlewares,
|
|
333
360
|
TServerContext
|
|
@@ -337,7 +364,8 @@ export interface CreateMethodFnOpts<
|
|
|
337
364
|
export type RouteMethodHandler<
|
|
338
365
|
TRegister,
|
|
339
366
|
TParentRoute extends AnyRoute,
|
|
340
|
-
|
|
367
|
+
TFullPath extends string,
|
|
368
|
+
TParams,
|
|
341
369
|
TServerMiddlewares,
|
|
342
370
|
TMethodMiddlewares,
|
|
343
371
|
TServerContext,
|
|
@@ -345,7 +373,8 @@ export type RouteMethodHandler<
|
|
|
345
373
|
| RouteMethodHandlerFn<
|
|
346
374
|
TRegister,
|
|
347
375
|
TParentRoute,
|
|
348
|
-
|
|
376
|
+
TFullPath,
|
|
377
|
+
TParams,
|
|
349
378
|
TServerMiddlewares,
|
|
350
379
|
TMethodMiddlewares,
|
|
351
380
|
TServerContext
|
|
@@ -353,7 +382,8 @@ export type RouteMethodHandler<
|
|
|
353
382
|
| RouteMethodBuilderOptions<
|
|
354
383
|
TRegister,
|
|
355
384
|
TParentRoute,
|
|
356
|
-
|
|
385
|
+
TFullPath,
|
|
386
|
+
TParams,
|
|
357
387
|
TServerMiddlewares,
|
|
358
388
|
TMethodMiddlewares,
|
|
359
389
|
TServerContext
|
|
@@ -363,6 +393,7 @@ export interface RouteMethodBuilderOptions<
|
|
|
363
393
|
TRegister,
|
|
364
394
|
TParentRoute extends AnyRoute,
|
|
365
395
|
TFullPath extends string,
|
|
396
|
+
TParams,
|
|
366
397
|
TServerMiddlewares,
|
|
367
398
|
TMethodMiddlewares,
|
|
368
399
|
TResponse,
|
|
@@ -371,6 +402,7 @@ export interface RouteMethodBuilderOptions<
|
|
|
371
402
|
TRegister,
|
|
372
403
|
TParentRoute,
|
|
373
404
|
TFullPath,
|
|
405
|
+
TParams,
|
|
374
406
|
TServerMiddlewares,
|
|
375
407
|
TMethodMiddlewares,
|
|
376
408
|
TResponse
|
|
@@ -406,6 +438,7 @@ export type RouteMethodHandlerFn<
|
|
|
406
438
|
TRegister,
|
|
407
439
|
TParentRoute extends AnyRoute,
|
|
408
440
|
TFullPath extends string,
|
|
441
|
+
TParams,
|
|
409
442
|
TServerMiddlewares,
|
|
410
443
|
TMethodMiddlewares,
|
|
411
444
|
TServerContext,
|
|
@@ -414,6 +447,7 @@ export type RouteMethodHandlerFn<
|
|
|
414
447
|
TRegister,
|
|
415
448
|
TParentRoute,
|
|
416
449
|
TFullPath,
|
|
450
|
+
TParams,
|
|
417
451
|
TServerMiddlewares,
|
|
418
452
|
TMethodMiddlewares
|
|
419
453
|
>,
|
|
@@ -435,6 +469,7 @@ export interface RouteMethodHandlerCtx<
|
|
|
435
469
|
in out TRegister,
|
|
436
470
|
in out TParentRoute extends AnyRoute,
|
|
437
471
|
in out TFullPath extends string,
|
|
472
|
+
in out TParams,
|
|
438
473
|
in out TServerMiddlewares,
|
|
439
474
|
in out TMethodMiddlewares,
|
|
440
475
|
> {
|
|
@@ -447,7 +482,7 @@ export interface RouteMethodHandlerCtx<
|
|
|
447
482
|
>
|
|
448
483
|
>
|
|
449
484
|
request: Request
|
|
450
|
-
params: Expand<
|
|
485
|
+
params: Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>
|
|
451
486
|
pathname: TFullPath
|
|
452
487
|
next: <TContext = undefined>(options?: {
|
|
453
488
|
context?: TContext
|