@tanstack/start-server-core 1.132.0-alpha.8 → 1.132.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.
Files changed (38) hide show
  1. package/dist/esm/createStartHandler.d.ts +3 -6
  2. package/dist/esm/createStartHandler.js +261 -220
  3. package/dist/esm/createStartHandler.js.map +1 -1
  4. package/dist/esm/index.d.ts +1 -3
  5. package/dist/esm/index.js +0 -4
  6. package/dist/esm/index.js.map +1 -1
  7. package/dist/esm/loadVirtualModule.js +0 -2
  8. package/dist/esm/loadVirtualModule.js.map +1 -1
  9. package/dist/esm/request-handler.d.ts +19 -0
  10. package/dist/esm/request-response.d.ts +2 -2
  11. package/dist/esm/request-response.js +5 -2
  12. package/dist/esm/request-response.js.map +1 -1
  13. package/dist/esm/serializer/ServerFunctionSerializationAdapter.js +1 -1
  14. package/dist/esm/serializer/ServerFunctionSerializationAdapter.js.map +1 -1
  15. package/dist/esm/server-functions-handler.d.ts +2 -1
  16. package/dist/esm/server-functions-handler.js +16 -13
  17. package/dist/esm/server-functions-handler.js.map +1 -1
  18. package/dist/esm/virtual-modules.d.ts +0 -2
  19. package/dist/esm/virtual-modules.js +0 -1
  20. package/dist/esm/virtual-modules.js.map +1 -1
  21. package/package.json +7 -7
  22. package/src/createStartHandler.ts +353 -326
  23. package/src/index.tsx +2 -42
  24. package/src/loadVirtualModule.ts +0 -2
  25. package/src/request-handler.ts +31 -0
  26. package/src/request-response.ts +8 -5
  27. package/src/serializer/ServerFunctionSerializationAdapter.ts +1 -1
  28. package/src/server-functions-handler.ts +21 -16
  29. package/src/tanstack-start.d.ts +0 -2
  30. package/src/virtual-modules.ts +0 -2
  31. package/dist/esm/serializer/getSerovalPlugins.d.ts +0 -3
  32. package/dist/esm/serializer/getSerovalPlugins.js +0 -13
  33. package/dist/esm/serializer/getSerovalPlugins.js.map +0 -1
  34. package/dist/esm/serverRoute.d.ts +0 -124
  35. package/dist/esm/serverRoute.js +0 -103
  36. package/dist/esm/serverRoute.js.map +0 -1
  37. package/src/serializer/getSerovalPlugins.ts +0 -10
  38. package/src/serverRoute.ts +0 -736
@@ -1,736 +0,0 @@
1
- import { joinPaths, rootRouteId, trimPathLeft } from '@tanstack/router-core'
2
- import type {
3
- Assign,
4
- Constrain,
5
- Expand,
6
- ResolveParams,
7
- RouteConstraints,
8
- TrimPathRight,
9
- } from '@tanstack/router-core'
10
- import type {
11
- AnyRequestMiddleware,
12
- AssignAllServerContext,
13
- } from '@tanstack/start-client-core'
14
-
15
- export function createServerFileRoute<
16
- TFilePath extends keyof ServerFileRoutesByPath,
17
- TParentRoute extends
18
- AnyServerRouteWithTypes = ServerFileRoutesByPath[TFilePath]['parentRoute'],
19
- TId extends RouteConstraints['TId'] = ServerFileRoutesByPath[TFilePath]['id'],
20
- TPath extends
21
- RouteConstraints['TPath'] = ServerFileRoutesByPath[TFilePath]['path'],
22
- TFullPath extends
23
- RouteConstraints['TFullPath'] = ServerFileRoutesByPath[TFilePath]['fullPath'],
24
- TChildren = ServerFileRoutesByPath[TFilePath]['children'],
25
- >(_: TFilePath): ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren> {
26
- return createServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>(
27
- undefined,
28
- )
29
- }
30
-
31
- export interface ServerFileRoutesByPath {}
32
-
33
- export interface ServerRouteOptions<
34
- TParentRoute extends AnyServerRouteWithTypes,
35
- TId extends RouteConstraints['TId'],
36
- TPath extends RouteConstraints['TPath'],
37
- TFullPath extends RouteConstraints['TFullPath'],
38
- TMiddlewares,
39
- > {
40
- id: TId
41
- path: TPath
42
- pathname: TFullPath
43
- originalIndex: number
44
- getParentRoute?: () => TParentRoute
45
- middleware?: Constrain<TMiddlewares, ReadonlyArray<AnyRequestMiddleware>>
46
- methods?: Record<
47
- string,
48
- | ServerRouteMethodHandlerFn<
49
- TParentRoute,
50
- TFullPath,
51
- TMiddlewares,
52
- any,
53
- any
54
- >
55
- | {
56
- _options: ServerRouteMethodBuilderOptions<
57
- TParentRoute,
58
- TFullPath,
59
- TMiddlewares,
60
- unknown,
61
- unknown
62
- >
63
- }
64
- >
65
- caseSensitive?: boolean
66
- }
67
-
68
- export type ServerRouteManifest = {
69
- middleware: boolean
70
- methods: Record<string, { middleware: boolean }>
71
- }
72
-
73
- export function createServerRoute<
74
- TParentRoute extends AnyServerRouteWithTypes,
75
- TId extends RouteConstraints['TId'],
76
- TPath extends RouteConstraints['TPath'],
77
- TFullPath extends RouteConstraints['TFullPath'],
78
- TChildren,
79
- >(
80
- __?: never,
81
- __opts?: Partial<
82
- ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, undefined>
83
- >,
84
- ): ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren> {
85
- const options = __opts || {}
86
-
87
- const route: ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren> = {
88
- isRoot: false as any,
89
- path: '' as TPath,
90
- id: '' as TId,
91
- fullPath: '' as TFullPath,
92
- to: '' as TrimPathRight<TFullPath>,
93
- options: options as ServerRouteOptions<
94
- TParentRoute,
95
- TId,
96
- TPath,
97
- TFullPath,
98
- any
99
- >,
100
- parentRoute: undefined as unknown as TParentRoute,
101
- _types: {} as ServerRouteTypes<
102
- TParentRoute,
103
- TId,
104
- TPath,
105
- TFullPath,
106
- undefined,
107
- undefined
108
- >,
109
- // children: undefined as TChildren,
110
- middleware: (middlewares) =>
111
- createServerRoute(undefined, {
112
- ...options,
113
- middleware: middlewares,
114
- }) as never,
115
- methods: (methodsOrGetMethods) => {
116
- const methods = (() => {
117
- if (typeof methodsOrGetMethods === 'function') {
118
- return methodsOrGetMethods(createMethodBuilder())
119
- }
120
-
121
- return methodsOrGetMethods
122
- })()
123
-
124
- return createServerRoute(undefined, {
125
- ...__opts,
126
- methods: methods as never,
127
- }) as never
128
- },
129
- update: (opts) =>
130
- createServerRoute(undefined, {
131
- ...options,
132
- ...opts,
133
- }),
134
- init: (opts: { originalIndex: number }): void => {
135
- options.originalIndex = opts.originalIndex
136
-
137
- const isRoot = !options.path && !options.id
138
-
139
- route.parentRoute = options.getParentRoute?.() as TParentRoute
140
-
141
- if (isRoot) {
142
- route.path = rootRouteId as TPath
143
- } else if (!(route.parentRoute as any)) {
144
- throw new Error(
145
- `Child Route instances must pass a 'getParentRoute: () => ParentRoute' option that returns a ServerRoute instance.`,
146
- )
147
- }
148
-
149
- let path: undefined | string = isRoot ? rootRouteId : options.path
150
-
151
- // If the path is anything other than an index path, trim it up
152
- if (path && path !== '/') {
153
- path = trimPathLeft(path)
154
- }
155
-
156
- const customId = options.id || path
157
-
158
- // Strip the parentId prefix from the first level of children
159
- let id = isRoot
160
- ? rootRouteId
161
- : joinPaths([
162
- route.parentRoute.id === rootRouteId ? '' : route.parentRoute.id,
163
- customId,
164
- ])
165
-
166
- if (path === rootRouteId) {
167
- path = '/'
168
- }
169
-
170
- if (id !== rootRouteId) {
171
- id = joinPaths(['/', id])
172
- }
173
-
174
- const fullPath =
175
- id === rootRouteId ? '/' : joinPaths([route.parentRoute.fullPath, path])
176
-
177
- route.path = path as TPath
178
- route.id = id as TId
179
- route.fullPath = fullPath as TFullPath
180
- route.to = fullPath as TrimPathRight<TFullPath>
181
- route.isRoot = isRoot as any
182
- },
183
-
184
- _addFileChildren: (children) => {
185
- if (Array.isArray(children)) {
186
- route.children = children as TChildren
187
- }
188
-
189
- if (typeof children === 'object' && children !== null) {
190
- route.children = Object.values(children) as TChildren
191
- }
192
-
193
- return route
194
- },
195
-
196
- _addFileTypes: <TFileTypes>() => route,
197
- }
198
-
199
- return route
200
- }
201
-
202
- // TODO this needs to be restricted to only allow middleware, no methods
203
- // TODO we also need to restrict pathless server routes to only allow middleware
204
- export const createServerRootRoute = createServerRoute
205
-
206
- export type ServerRouteAddFileChildrenFn<
207
- in out TParentRoute extends AnyServerRouteWithTypes,
208
- in out TId extends RouteConstraints['TId'],
209
- in out TPath extends RouteConstraints['TPath'],
210
- in out TFullPath extends RouteConstraints['TFullPath'],
211
- in out TMiddlewares,
212
- in out TMethods,
213
- in out TChildren,
214
- > = (
215
- children: TChildren,
216
- ) => ServerRouteWithTypes<
217
- TParentRoute,
218
- TId,
219
- TPath,
220
- TFullPath,
221
- TMiddlewares,
222
- TMethods,
223
- TChildren
224
- >
225
-
226
- const createMethodBuilder = <
227
- TParentRoute extends AnyServerRouteWithTypes,
228
- TFullPath extends string,
229
- TMiddlewares,
230
- >(
231
- __opts?: ServerRouteMethodBuilderOptions<
232
- TParentRoute,
233
- TFullPath,
234
- TMiddlewares,
235
- unknown,
236
- unknown
237
- >,
238
- ): ServerRouteMethodBuilder<TParentRoute, TFullPath, TMiddlewares> => {
239
- return {
240
- _options: (__opts || {}) as never,
241
- _types: {} as never,
242
- middleware: (middlewares) =>
243
- createMethodBuilder({
244
- ...__opts,
245
- middlewares,
246
- }) as never,
247
- handler: (handler) =>
248
- createMethodBuilder({
249
- ...__opts,
250
- handler: handler as never,
251
- }) as never,
252
- }
253
- }
254
-
255
- export interface ServerRouteMethodBuilderOptions<
256
- TParentRoute extends AnyServerRouteWithTypes,
257
- TFullPath extends string,
258
- TMiddlewares,
259
- TMethodMiddlewares,
260
- TResponse,
261
- > {
262
- handler?: ServerRouteMethodHandlerFn<
263
- TParentRoute,
264
- TFullPath,
265
- TMiddlewares,
266
- TMethodMiddlewares,
267
- TResponse
268
- >
269
- middlewares?: Constrain<
270
- TMethodMiddlewares,
271
- ReadonlyArray<AnyRequestMiddleware>
272
- >
273
- }
274
-
275
- export type CreateServerFileRoute<
276
- TParentRoute extends AnyServerRouteWithTypes,
277
- TId extends RouteConstraints['TId'],
278
- TPath extends RouteConstraints['TPath'],
279
- TFullPath extends RouteConstraints['TFullPath'],
280
- TChildren,
281
- > = () => ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>
282
-
283
- export type AnyServerRouteWithTypes = ServerRouteWithTypes<
284
- any,
285
- any,
286
- any,
287
- any,
288
- any,
289
- any,
290
- any
291
- >
292
-
293
- export interface ServerRouteWithTypes<
294
- TParentRoute extends AnyServerRouteWithTypes,
295
- TId extends RouteConstraints['TId'],
296
- TPath extends RouteConstraints['TPath'],
297
- TFullPath extends RouteConstraints['TFullPath'],
298
- TMiddlewares,
299
- TMethods,
300
- TChildren,
301
- > {
302
- _types: ServerRouteTypes<
303
- TParentRoute,
304
- TId,
305
- TPath,
306
- TFullPath,
307
- TMiddlewares,
308
- TMethods
309
- >
310
- isRoot: TParentRoute extends AnyServerRouteWithTypes ? true : false
311
- path: TPath
312
- id: TId
313
- fullPath: TFullPath
314
- to: TrimPathRight<TFullPath>
315
- parentRoute: TParentRoute
316
- children?: TChildren
317
- options: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, TMiddlewares>
318
- update: (
319
- opts: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, undefined>,
320
- ) => ServerRoute<TParentRoute, TId, TPath, TFullPath, TChildren>
321
- init: (opts: { originalIndex: number }) => void
322
- _addFileChildren: ServerRouteAddFileChildrenFn<
323
- TParentRoute,
324
- TId,
325
- TPath,
326
- TFullPath,
327
- TMiddlewares,
328
- TMethods,
329
- TChildren
330
- >
331
- _addFileTypes: () => ServerRouteWithTypes<
332
- TParentRoute,
333
- TId,
334
- TPath,
335
- TFullPath,
336
- TMiddlewares,
337
- TMethods,
338
- TChildren
339
- >
340
- }
341
-
342
- export interface ServerRouteTypes<
343
- TParentRoute extends AnyServerRouteWithTypes,
344
- TId extends RouteConstraints['TId'],
345
- TPath extends RouteConstraints['TPath'],
346
- TFullPath extends RouteConstraints['TFullPath'],
347
- TMiddlewares,
348
- TMethods,
349
- > {
350
- isRoot: TParentRoute extends AnyServerRouteWithTypes ? true : false
351
- id: TId
352
- path: TPath
353
- fullPath: TFullPath
354
- middlewares: TMiddlewares
355
- methods: TMethods
356
- parentRoute: TParentRoute
357
- allContext: ResolveAllServerContext<TParentRoute, TMiddlewares>
358
- }
359
-
360
- export type ResolveAllServerContext<
361
- TParentRoute extends AnyServerRouteWithTypes,
362
- TMiddlewares,
363
- > = unknown extends TParentRoute
364
- ? AssignAllServerContext<TMiddlewares>
365
- : Assign<
366
- TParentRoute['_types']['allContext'],
367
- AssignAllServerContext<TMiddlewares>
368
- >
369
-
370
- export type AnyServerRoute = AnyServerRouteWithTypes
371
-
372
- export interface ServerRoute<
373
- TParentRoute extends AnyServerRouteWithTypes,
374
- TId extends RouteConstraints['TId'],
375
- TPath extends RouteConstraints['TPath'],
376
- TFullPath extends RouteConstraints['TFullPath'],
377
- TChildren,
378
- > extends ServerRouteWithTypes<
379
- TParentRoute,
380
- TId,
381
- TPath,
382
- TFullPath,
383
- undefined,
384
- undefined,
385
- TChildren
386
- >,
387
- ServerRouteMiddleware<TParentRoute, TId, TPath, TFullPath, TChildren>,
388
- ServerRouteMethods<
389
- TParentRoute,
390
- TId,
391
- TPath,
392
- TFullPath,
393
- undefined,
394
- TChildren
395
- > {}
396
-
397
- export interface ServerRouteMiddleware<
398
- TParentRoute extends AnyServerRouteWithTypes,
399
- TId extends RouteConstraints['TId'],
400
- TPath extends RouteConstraints['TPath'],
401
- TFullPath extends RouteConstraints['TFullPath'],
402
- TChildren,
403
- > {
404
- middleware: <const TNewMiddleware>(
405
- middleware: Constrain<TNewMiddleware, ReadonlyArray<AnyRequestMiddleware>>,
406
- ) => ServerRouteAfterMiddleware<
407
- TParentRoute,
408
- TId,
409
- TPath,
410
- TFullPath,
411
- TNewMiddleware,
412
- TChildren
413
- >
414
- }
415
-
416
- export interface ServerRouteAfterMiddleware<
417
- TParentRoute extends AnyServerRouteWithTypes,
418
- TId extends RouteConstraints['TId'],
419
- TPath extends RouteConstraints['TPath'],
420
- TFullPath extends RouteConstraints['TFullPath'],
421
- TMiddlewares,
422
- TChildren,
423
- > extends ServerRouteWithTypes<
424
- TParentRoute,
425
- TId,
426
- TPath,
427
- TFullPath,
428
- TMiddlewares,
429
- undefined,
430
- TChildren
431
- >,
432
- ServerRouteMethods<
433
- TParentRoute,
434
- TId,
435
- TPath,
436
- TFullPath,
437
- TMiddlewares,
438
- TChildren
439
- > {}
440
-
441
- export interface ServerRouteMethods<
442
- TParentRoute extends AnyServerRouteWithTypes,
443
- TId extends RouteConstraints['TId'],
444
- TPath extends RouteConstraints['TPath'],
445
- TFullPath extends RouteConstraints['TFullPath'],
446
- TMiddlewares,
447
- TChildren,
448
- > {
449
- methods: <const TMethods>(
450
- methodsOrGetMethods: Constrain<
451
- TMethods,
452
- ServerRouteMethodsOptions<TParentRoute, TFullPath, TMiddlewares>
453
- >,
454
- ) => ServerRouteAfterMethods<
455
- TParentRoute,
456
- TId,
457
- TPath,
458
- TFullPath,
459
- TMiddlewares,
460
- TMethods,
461
- TChildren
462
- >
463
- }
464
-
465
- export type ServerRouteMethodsOptions<
466
- TParentRoute extends AnyServerRouteWithTypes,
467
- TFullPath extends string,
468
- TMiddlewares,
469
- > =
470
- | ServerRouteMethodsRecord<TParentRoute, TFullPath, TMiddlewares>
471
- | ((
472
- api: ServerRouteMethodBuilder<TParentRoute, TFullPath, TMiddlewares>,
473
- ) => ServerRouteMethodsRecord<TParentRoute, TFullPath, TMiddlewares>)
474
-
475
- export interface ServerRouteMethodsRecord<
476
- TParentRoute extends AnyServerRouteWithTypes,
477
- TFullPath extends string,
478
- TMiddlewares,
479
- > {
480
- GET?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
481
- POST?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
482
- PUT?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
483
- PATCH?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
484
- DELETE?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
485
- OPTIONS?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
486
- HEAD?: ServerRouteMethodRecordValue<TParentRoute, TFullPath, TMiddlewares>
487
- }
488
-
489
- export type ServerRouteMethodRecordValue<
490
- TParentRoute extends AnyServerRouteWithTypes,
491
- TFullPath extends string,
492
- TMiddlewares,
493
- > =
494
- | ServerRouteMethodHandlerFn<
495
- TParentRoute,
496
- TFullPath,
497
- TMiddlewares,
498
- undefined,
499
- any
500
- >
501
- | AnyRouteMethodsBuilder
502
-
503
- export type ServerRouteVerb = (typeof ServerRouteVerbs)[number]
504
-
505
- export const ServerRouteVerbs = [
506
- 'GET',
507
- 'POST',
508
- 'PUT',
509
- 'PATCH',
510
- 'DELETE',
511
- 'OPTIONS',
512
- 'HEAD',
513
- ] as const
514
-
515
- export type ServerRouteMethodHandlerFn<
516
- TParentRoute extends AnyServerRouteWithTypes,
517
- TFullPath extends string,
518
- TMiddlewares,
519
- TMethodMiddlewares,
520
- TResponse,
521
- > = (
522
- ctx: ServerRouteMethodHandlerCtx<
523
- TParentRoute,
524
- TFullPath,
525
- TMiddlewares,
526
- TMethodMiddlewares
527
- >,
528
- ) => TResponse | Promise<TResponse>
529
-
530
- export interface ServerRouteMethodHandlerCtx<
531
- in out TParentRoute extends AnyServerRouteWithTypes,
532
- in out TFullPath extends string,
533
- in out TMiddlewares,
534
- in out TMethodMiddlewares,
535
- > {
536
- context: Expand<
537
- AssignAllMethodContext<TParentRoute, TMiddlewares, TMethodMiddlewares>
538
- >
539
- request: Request
540
- params: Expand<ResolveParams<TFullPath>>
541
- pathname: TFullPath
542
- }
543
-
544
- export type MergeMethodMiddlewares<TMiddlewares, TMethodMiddlewares> =
545
- TMiddlewares extends ReadonlyArray<any>
546
- ? TMethodMiddlewares extends ReadonlyArray<any>
547
- ? readonly [...TMiddlewares, ...TMethodMiddlewares]
548
- : TMiddlewares
549
- : TMethodMiddlewares
550
-
551
- export type AssignAllMethodContext<
552
- TParentRoute extends AnyServerRouteWithTypes,
553
- TMiddlewares,
554
- TMethodMiddlewares,
555
- > = ResolveAllServerContext<
556
- TParentRoute,
557
- MergeMethodMiddlewares<TMiddlewares, TMethodMiddlewares>
558
- >
559
-
560
- export type AnyRouteMethodsBuilder = ServerRouteMethodBuilderWithTypes<
561
- any,
562
- any,
563
- any,
564
- any,
565
- any
566
- >
567
-
568
- export interface ServerRouteMethodBuilder<
569
- TParentRoute extends AnyServerRouteWithTypes,
570
- TFullPath extends string,
571
- TMiddlewares,
572
- > extends ServerRouteMethodBuilderWithTypes<
573
- TParentRoute,
574
- TFullPath,
575
- TMiddlewares,
576
- undefined,
577
- undefined
578
- >,
579
- ServerRouteMethodBuilderMiddleware<TParentRoute, TFullPath, TMiddlewares>,
580
- ServerRouteMethodBuilderHandler<
581
- TParentRoute,
582
- TFullPath,
583
- TMiddlewares,
584
- undefined
585
- > {}
586
-
587
- export interface ServerRouteMethodBuilderWithTypes<
588
- TParentRoute extends AnyServerRouteWithTypes,
589
- TFullPath extends string,
590
- TMiddlewares,
591
- TMethodMiddlewares,
592
- TResponse,
593
- > {
594
- _options: ServerRouteMethodBuilderOptions<
595
- TParentRoute,
596
- TFullPath,
597
- TMiddlewares,
598
- TMethodMiddlewares,
599
- TResponse
600
- >
601
- _types: ServerRouteMethodBuilderTypes<
602
- TFullPath,
603
- TMiddlewares,
604
- TMethodMiddlewares,
605
- TResponse
606
- >
607
- }
608
-
609
- export interface ServerRouteMethodBuilderTypes<
610
- in out TFullPath extends string,
611
- in out TMiddlewares,
612
- in out TMethodMiddlewares,
613
- in out TResponse,
614
- > {
615
- middlewares: TMiddlewares
616
- methodMiddleware: TMethodMiddlewares
617
- fullPath: TFullPath
618
- response: TResponse
619
- }
620
-
621
- export interface ServerRouteMethodBuilderMiddleware<
622
- TParentRoute extends AnyServerRouteWithTypes,
623
- TFullPath extends string,
624
- TMiddlewares,
625
- > {
626
- middleware: <const TNewMethodMiddlewares>(
627
- middleware: Constrain<
628
- TNewMethodMiddlewares,
629
- ReadonlyArray<AnyRequestMiddleware>
630
- >,
631
- ) => ServerRouteMethodBuilderAfterMiddleware<
632
- TParentRoute,
633
- TFullPath,
634
- TMiddlewares,
635
- TNewMethodMiddlewares
636
- >
637
- }
638
-
639
- export interface ServerRouteMethodBuilderAfterMiddleware<
640
- TParentRoute extends AnyServerRouteWithTypes,
641
- TFullPath extends string,
642
- TMiddlewares,
643
- TMethodMiddlewares,
644
- > extends ServerRouteMethodBuilderWithTypes<
645
- TParentRoute,
646
- TFullPath,
647
- TMiddlewares,
648
- TMethodMiddlewares,
649
- undefined
650
- >,
651
- ServerRouteMethodBuilderHandler<
652
- TParentRoute,
653
- TFullPath,
654
- TMiddlewares,
655
- TMethodMiddlewares
656
- > {}
657
-
658
- export interface ServerRouteMethodBuilderHandler<
659
- TParentRoute extends AnyServerRouteWithTypes,
660
- TFullPath extends string,
661
- TMiddlewares,
662
- TMethodMiddlewares,
663
- > {
664
- handler: <TResponse>(
665
- handler: ServerRouteMethodHandlerFn<
666
- TParentRoute,
667
- TFullPath,
668
- TMiddlewares,
669
- TMethodMiddlewares,
670
- TResponse
671
- >,
672
- ) => ServerRouteMethodBuilderAfterHandler<
673
- TParentRoute,
674
- TFullPath,
675
- TMiddlewares,
676
- TMethodMiddlewares,
677
- TResponse
678
- >
679
- }
680
-
681
- export interface ServerRouteMethodBuilderAfterHandler<
682
- TParentRoute extends AnyServerRouteWithTypes,
683
- TFullPath extends string,
684
- TMiddlewares,
685
- TMethodMiddlewares,
686
- TResponse,
687
- > extends ServerRouteMethodBuilderWithTypes<
688
- TParentRoute,
689
- TFullPath,
690
- TMiddlewares,
691
- TMethodMiddlewares,
692
- TResponse
693
- > {
694
- opts: ServerRouteMethod<
695
- TParentRoute,
696
- TFullPath,
697
- TMiddlewares,
698
- TMethodMiddlewares
699
- >
700
- }
701
-
702
- export interface ServerRouteMethod<
703
- TParentRoute extends AnyServerRouteWithTypes,
704
- TFullPath extends string,
705
- TMiddlewares,
706
- TMethodMiddlewares,
707
- > {
708
- middleware?: Constrain<TMiddlewares, Array<AnyRequestMiddleware>>
709
- handler?: ServerRouteMethodHandlerFn<
710
- TParentRoute,
711
- TFullPath,
712
- TMiddlewares,
713
- TMethodMiddlewares,
714
- undefined
715
- >
716
- }
717
-
718
- export interface ServerRouteAfterMethods<
719
- TParentRoute extends AnyServerRouteWithTypes,
720
- TId extends RouteConstraints['TId'],
721
- TPath extends RouteConstraints['TPath'],
722
- TFullPath extends RouteConstraints['TFullPath'],
723
- TMiddlewares,
724
- TMethods,
725
- TChildren,
726
- > extends ServerRouteWithTypes<
727
- TParentRoute,
728
- TId,
729
- TPath,
730
- TFullPath,
731
- TMiddlewares,
732
- TMethods,
733
- TChildren
734
- > {
735
- options: ServerRouteOptions<TParentRoute, TId, TPath, TFullPath, TMiddlewares>
736
- }