@benjavicente/start-client-core 1.167.9 → 1.168.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.
Files changed (51) hide show
  1. package/dist/esm/client/hydrateStart.js +4 -2
  2. package/dist/esm/client/hydrateStart.js.map +1 -1
  3. package/dist/esm/client-rpc/serverFnFetcher.d.ts +21 -0
  4. package/dist/esm/client-rpc/serverFnFetcher.js +94 -71
  5. package/dist/esm/client-rpc/serverFnFetcher.js.map +1 -1
  6. package/dist/esm/createCsrfMiddleware.d.ts +46 -0
  7. package/dist/esm/createCsrfMiddleware.js +63 -0
  8. package/dist/esm/createCsrfMiddleware.js.map +1 -0
  9. package/dist/esm/createMiddleware.d.ts +4 -0
  10. package/dist/esm/createMiddleware.js.map +1 -1
  11. package/dist/esm/createServerFn.d.ts +44 -31
  12. package/dist/esm/createServerFn.js +1 -1
  13. package/dist/esm/createServerFn.js.map +1 -1
  14. package/dist/esm/fake-entries/plugin-adapters.d.ts +3 -0
  15. package/dist/esm/fake-entries/plugin-adapters.js +7 -0
  16. package/dist/esm/fake-entries/plugin-adapters.js.map +1 -0
  17. package/dist/esm/fake-entries/router.d.ts +1 -0
  18. package/dist/esm/fake-entries/router.js +6 -0
  19. package/dist/esm/fake-entries/router.js.map +1 -0
  20. package/dist/esm/{fake-start-entry.d.ts → fake-entries/start.d.ts} +0 -1
  21. package/dist/esm/fake-entries/start.js +6 -0
  22. package/dist/esm/fake-entries/start.js.map +1 -0
  23. package/dist/esm/getDefaultSerovalPlugins.d.ts +2 -1
  24. package/dist/esm/getDefaultSerovalPlugins.js.map +1 -1
  25. package/dist/esm/index.d.ts +4 -1
  26. package/dist/esm/index.js +3 -1
  27. package/dist/esm/tests/createCsrfMiddleware.test.d.ts +1 -0
  28. package/package.json +9 -10
  29. package/skills/start-core/SKILL.md +11 -7
  30. package/skills/start-core/auth-server-primitives/SKILL.md +410 -0
  31. package/skills/start-core/deployment/SKILL.md +9 -0
  32. package/skills/start-core/execution-model/SKILL.md +68 -19
  33. package/skills/start-core/middleware/SKILL.md +42 -9
  34. package/skills/start-core/server-functions/SKILL.md +115 -17
  35. package/src/client/hydrateStart.ts +12 -6
  36. package/src/client-rpc/serverFnFetcher.ts +132 -103
  37. package/src/createCsrfMiddleware.ts +197 -0
  38. package/src/createMiddleware.ts +4 -0
  39. package/src/createServerFn.ts +192 -63
  40. package/src/fake-entries/plugin-adapters.ts +4 -0
  41. package/src/fake-entries/router.ts +1 -0
  42. package/src/{fake-start-entry.ts → fake-entries/start.ts} +0 -1
  43. package/src/getDefaultSerovalPlugins.ts +2 -1
  44. package/src/index.tsx +16 -0
  45. package/src/start-entry.d.ts +9 -2
  46. package/src/tests/createCsrfMiddleware.test.ts +290 -0
  47. package/src/tests/createServerFn.test-d.ts +152 -2
  48. package/src/tests/createServerMiddleware.test-d.ts +16 -3
  49. package/bin/intent.js +0 -25
  50. package/dist/esm/fake-start-entry.js +0 -7
  51. package/dist/esm/fake-start-entry.js.map +0 -1
@@ -32,23 +32,47 @@ import type {
32
32
 
33
33
  type TODO = any
34
34
 
35
+ export type ServerFnStrict = boolean | { input?: boolean; output?: boolean }
36
+
37
+ export interface ServerFnOptions<
38
+ TMethod extends Method = Method,
39
+ TStrict extends ServerFnStrict = true,
40
+ > {
41
+ method?: TMethod
42
+ strict?: TStrict
43
+ }
44
+
45
+ export type ServerFnStrictInput<TStrict extends ServerFnStrict> =
46
+ TStrict extends false
47
+ ? false
48
+ : TStrict extends { input: infer TInput extends boolean }
49
+ ? TInput
50
+ : true
51
+
52
+ export type ServerFnStrictOutput<TStrict extends ServerFnStrict> =
53
+ TStrict extends false
54
+ ? false
55
+ : TStrict extends { output: infer TOutput extends boolean }
56
+ ? TOutput
57
+ : true
58
+
35
59
  export type CreateServerFn<TRegister> = <
36
60
  TMethod extends Method,
61
+ TStrict extends ServerFnStrict = true,
37
62
  TResponse = unknown,
38
63
  TMiddlewares = undefined,
39
64
  TInputValidator = undefined,
40
65
  >(
41
- options?: {
42
- method?: TMethod
43
- },
66
+ options?: ServerFnOptions<TMethod, TStrict>,
44
67
  __opts?: ServerFnBaseOptions<
45
68
  TRegister,
46
69
  TMethod,
47
70
  TResponse,
48
71
  TMiddlewares,
49
- TInputValidator
72
+ TInputValidator,
73
+ TStrict
50
74
  >,
51
- ) => ServerFnBuilder<TRegister, TMethod>
75
+ ) => ServerFnBuilder<TRegister, TMethod, TStrict>
52
76
 
53
77
  export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
54
78
  const resolvedOptions = (__opts || options || {}) as ServerFnBaseOptions<
@@ -56,6 +80,7 @@ export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
56
80
  any,
57
81
  any,
58
82
  any,
83
+ any,
59
84
  any
60
85
  >
61
86
 
@@ -63,7 +88,7 @@ export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
63
88
  resolvedOptions.method = 'GET' as Method
64
89
  }
65
90
 
66
- const res: ServerFnBuilder<Register, Method> = {
91
+ const res: ServerFnBuilder<Register, Method, ServerFnStrict> = {
67
92
  options: resolvedOptions,
68
93
  middleware: (middleware) => {
69
94
  // multiple calls to `middleware()` merge the middlewares with the previously supplied ones
@@ -152,7 +177,6 @@ export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
152
177
  const startContext = getStartContextServerOnly()
153
178
  const serverContextAfterGlobalMiddlewares =
154
179
  startContext.contextAfterGlobalMiddlewares
155
- // Use safeObjectMerge for opts.context which comes from client
156
180
  const ctx = {
157
181
  ...extractedFn,
158
182
  ...opts,
@@ -160,10 +184,10 @@ export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
160
184
  // (which has id, name, filename) rather than the partial one from SSR/client
161
185
  // callers (which only has id)
162
186
  serverFnMeta: extractedFn.serverFnMeta,
163
- // Use safeObjectMerge for opts.context which comes from client
187
+ // Merge client context first so trusted server middleware context wins.
164
188
  context: safeObjectMerge(
165
- serverContextAfterGlobalMiddlewares,
166
189
  opts.context,
190
+ serverContextAfterGlobalMiddlewares,
167
191
  ),
168
192
  request: startContext.request,
169
193
  }
@@ -184,8 +208,8 @@ export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
184
208
  },
185
209
  ) as any
186
210
  },
187
- } as ServerFnBuilder<Register, Method>
188
- const fun = (options?: { method?: Method }) => {
211
+ } as ServerFnBuilder<Register, Method, ServerFnStrict>
212
+ const fun = (options?: ServerFnOptions<Method, ServerFnStrict>) => {
189
213
  const newOptions = {
190
214
  ...resolvedOptions,
191
215
  ...options,
@@ -381,7 +405,13 @@ export interface RequiredFetcher<
381
405
  ): Promise<Awaited<TResponse>>
382
406
  }
383
407
 
384
- export type CustomFetch = typeof globalThis.fetch
408
+ // Ideally, this type should just be `export type CustomFetch = typeof globalThis.fetch`, but that conflicts with the type overrides the `bun-types` package - a dependency of unplugin.
409
+ // Relevant bun issues:
410
+ // - https://github.com/oven-sh/bun/issues/23500
411
+ // - https://github.com/oven-sh/bun/issues/23741
412
+ export type CustomFetch = typeof fetch extends (...args: infer A) => infer R
413
+ ? (...args: A) => R
414
+ : never
385
415
 
386
416
  export type FetcherBaseOptions = {
387
417
  headers?: HeadersInit
@@ -409,12 +439,18 @@ export type RscStream<T> = {
409
439
 
410
440
  export type Method = 'GET' | 'POST'
411
441
 
412
- export type ServerFnReturnType<TRegister, TResponse> =
413
- TResponse extends PromiseLike<infer U>
414
- ? Promise<ServerFnReturnType<TRegister, U>>
415
- : TResponse extends Response
416
- ? TResponse
417
- : ValidateSerializableInput<TRegister, TResponse>
442
+ export type ServerFnReturnType<
443
+ TRegister,
444
+ TResponse,
445
+ TStrict extends ServerFnStrict = true,
446
+ > =
447
+ ServerFnStrictOutput<TStrict> extends false
448
+ ? TResponse
449
+ : TResponse extends PromiseLike<infer U>
450
+ ? Promise<ServerFnReturnType<TRegister, U, TStrict>>
451
+ : TResponse extends Response
452
+ ? TResponse
453
+ : ValidateSerializableInput<TRegister, TResponse>
418
454
 
419
455
  export type ServerFn<
420
456
  TRegister,
@@ -422,9 +458,10 @@ export type ServerFn<
422
458
  TMiddlewares,
423
459
  TInputValidator,
424
460
  TResponse,
461
+ TStrict extends ServerFnStrict = true,
425
462
  > = (
426
463
  ctx: ServerFnCtx<TRegister, TMethod, TMiddlewares, TInputValidator>,
427
- ) => ServerFnReturnType<TRegister, TResponse>
464
+ ) => ServerFnReturnType<TRegister, TResponse, TStrict>
428
465
 
429
466
  export interface ServerFnCtx<
430
467
  TRegister,
@@ -452,20 +489,28 @@ export type ServerFnBaseOptions<
452
489
  TResponse = unknown,
453
490
  TMiddlewares = unknown,
454
491
  TInputValidator = unknown,
492
+ TStrict extends ServerFnStrict = true,
455
493
  > = {
456
494
  method: TMethod
495
+ strict?: TStrict
457
496
  middleware?: Constrain<
458
497
  TMiddlewares,
459
498
  ReadonlyArray<AnyFunctionMiddleware | AnyRequestMiddleware>
460
499
  >
461
- inputValidator?: ConstrainValidator<TRegister, TMethod, TInputValidator>
500
+ inputValidator?: ConstrainValidator<
501
+ TRegister,
502
+ TMethod,
503
+ TInputValidator,
504
+ TStrict
505
+ >
462
506
  extractedFn?: CompiledFetcherFn<TRegister, TResponse>
463
507
  serverFn?: ServerFn<
464
508
  TRegister,
465
509
  TMethod,
466
510
  TMiddlewares,
467
511
  TInputValidator,
468
- TResponse
512
+ TResponse,
513
+ TStrict
469
514
  >
470
515
  }
471
516
 
@@ -473,27 +518,33 @@ export type ValidateValidatorInput<
473
518
  TRegister,
474
519
  TMethod extends Method,
475
520
  TInputValidator,
476
- > = TMethod extends 'POST'
477
- ? ResolveValidatorInput<TInputValidator> extends FormData
521
+ TStrict extends ServerFnStrict = true,
522
+ > =
523
+ ServerFnStrictInput<TStrict> extends false
478
524
  ? ResolveValidatorInput<TInputValidator>
479
- : ValidateSerializable<
480
- ResolveValidatorInput<TInputValidator>,
481
- RegisteredSerializableInput<TRegister>
482
- >
483
- : ValidateSerializable<
484
- ResolveValidatorInput<TInputValidator>,
485
- RegisteredSerializableInput<TRegister>
486
- >
525
+ : TMethod extends 'POST'
526
+ ? ResolveValidatorInput<TInputValidator> extends FormData
527
+ ? ResolveValidatorInput<TInputValidator>
528
+ : ValidateSerializable<
529
+ ResolveValidatorInput<TInputValidator>,
530
+ RegisteredSerializableInput<TRegister>
531
+ >
532
+ : ValidateSerializable<
533
+ ResolveValidatorInput<TInputValidator>,
534
+ RegisteredSerializableInput<TRegister>
535
+ >
487
536
 
488
537
  export type ValidateValidator<
489
538
  TRegister,
490
539
  TMethod extends Method,
491
540
  TInputValidator,
541
+ TStrict extends ServerFnStrict = true,
492
542
  > =
493
543
  ValidateValidatorInput<
494
544
  TRegister,
495
545
  TMethod,
496
- TInputValidator
546
+ TInputValidator,
547
+ TStrict
497
548
  > extends infer TInput
498
549
  ? Validator<TInput, any>
499
550
  : never
@@ -502,17 +553,19 @@ export type ConstrainValidator<
502
553
  TRegister,
503
554
  TMethod extends Method,
504
555
  TInputValidator,
556
+ TStrict extends ServerFnStrict = true,
505
557
  > =
506
558
  | (unknown extends TInputValidator
507
559
  ? TInputValidator
508
560
  : ResolveValidatorInput<TInputValidator> extends ValidateValidator<
509
561
  TRegister,
510
562
  TMethod,
511
- TInputValidator
563
+ TInputValidator,
564
+ TStrict
512
565
  >
513
566
  ? TInputValidator
514
567
  : never)
515
- | ValidateValidator<TRegister, TMethod, TInputValidator>
568
+ | ValidateValidator<TRegister, TMethod, TInputValidator, TStrict>
516
569
 
517
570
  export type AppendMiddlewares<TMiddlewares, TNewMiddlewares> =
518
571
  TMiddlewares extends ReadonlyArray<any>
@@ -526,6 +579,7 @@ export interface ServerFnMiddleware<
526
579
  TMethod extends Method,
527
580
  TMiddlewares,
528
581
  TInputValidator,
582
+ TStrict extends ServerFnStrict,
529
583
  > {
530
584
  middleware: <const TNewMiddlewares>(
531
585
  middlewares: Constrain<
@@ -536,7 +590,8 @@ export interface ServerFnMiddleware<
536
590
  TRegister,
537
591
  TMethod,
538
592
  AppendMiddlewares<TMiddlewares, TNewMiddlewares>,
539
- TInputValidator
593
+ TInputValidator,
594
+ TStrict
540
595
  >
541
596
  }
542
597
 
@@ -545,6 +600,7 @@ export interface ServerFnAfterMiddleware<
545
600
  TMethod extends Method,
546
601
  TMiddlewares,
547
602
  TInputValidator,
603
+ TStrict extends ServerFnStrict,
548
604
  >
549
605
  extends
550
606
  ServerFnWithTypes<
@@ -552,33 +608,59 @@ export interface ServerFnAfterMiddleware<
552
608
  TMethod,
553
609
  TMiddlewares,
554
610
  TInputValidator,
555
- undefined
611
+ undefined,
612
+ TStrict
556
613
  >,
557
- ServerFnMiddleware<TRegister, TMethod, TMiddlewares, undefined>,
558
- ServerFnValidator<TRegister, TMethod, TMiddlewares>,
559
- ServerFnHandler<TRegister, TMethod, TMiddlewares, TInputValidator> {
560
- <TNewMethod extends Method = TMethod>(options?: {
561
- method?: TNewMethod
562
- }): ServerFnAfterMiddleware<
614
+ ServerFnMiddleware<TRegister, TMethod, TMiddlewares, undefined, TStrict>,
615
+ ServerFnValidator<TRegister, TMethod, TMiddlewares, TStrict>,
616
+ ServerFnHandler<
617
+ TRegister,
618
+ TMethod,
619
+ TMiddlewares,
620
+ TInputValidator,
621
+ TStrict
622
+ > {
623
+ <
624
+ TNewMethod extends Method = TMethod,
625
+ TNewStrict extends ServerFnStrict = TStrict,
626
+ >(
627
+ options?: ServerFnOptions<TNewMethod, TNewStrict>,
628
+ ): ServerFnAfterMiddleware<
563
629
  TRegister,
564
630
  TNewMethod,
565
631
  TMiddlewares,
566
- TInputValidator
632
+ TInputValidator,
633
+ TNewStrict
567
634
  >
568
635
  }
569
636
 
570
- export type ValidatorFn<TRegister, TMethod extends Method, TMiddlewares> = <
637
+ export type ValidatorFn<
638
+ TRegister,
639
+ TMethod extends Method,
640
+ TMiddlewares,
641
+ TStrict extends ServerFnStrict,
642
+ > = <TInputValidator>(
643
+ inputValidator: ConstrainValidator<
644
+ TRegister,
645
+ TMethod,
646
+ TInputValidator,
647
+ TStrict
648
+ >,
649
+ ) => ServerFnAfterValidator<
650
+ TRegister,
651
+ TMethod,
652
+ TMiddlewares,
571
653
  TInputValidator,
572
- >(
573
- inputValidator: ConstrainValidator<TRegister, TMethod, TInputValidator>,
574
- ) => ServerFnAfterValidator<TRegister, TMethod, TMiddlewares, TInputValidator>
654
+ TStrict
655
+ >
575
656
 
576
657
  export interface ServerFnValidator<
577
658
  TRegister,
578
659
  TMethod extends Method,
579
660
  TMiddlewares,
661
+ TStrict extends ServerFnStrict,
580
662
  > {
581
- inputValidator: ValidatorFn<TRegister, TMethod, TMiddlewares>
663
+ inputValidator: ValidatorFn<TRegister, TMethod, TMiddlewares, TStrict>
582
664
  }
583
665
 
584
666
  export interface ServerFnAfterValidator<
@@ -586,6 +668,7 @@ export interface ServerFnAfterValidator<
586
668
  TMethod extends Method,
587
669
  TMiddlewares,
588
670
  TInputValidator,
671
+ TStrict extends ServerFnStrict,
589
672
  >
590
673
  extends
591
674
  ServerFnWithTypes<
@@ -593,16 +676,30 @@ export interface ServerFnAfterValidator<
593
676
  TMethod,
594
677
  TMiddlewares,
595
678
  TInputValidator,
596
- undefined
679
+ undefined,
680
+ TStrict
681
+ >,
682
+ ServerFnMiddleware<
683
+ TRegister,
684
+ TMethod,
685
+ TMiddlewares,
686
+ TInputValidator,
687
+ TStrict
597
688
  >,
598
- ServerFnMiddleware<TRegister, TMethod, TMiddlewares, TInputValidator>,
599
- ServerFnHandler<TRegister, TMethod, TMiddlewares, TInputValidator> {}
689
+ ServerFnHandler<
690
+ TRegister,
691
+ TMethod,
692
+ TMiddlewares,
693
+ TInputValidator,
694
+ TStrict
695
+ > {}
600
696
 
601
697
  export interface ServerFnAfterTyper<
602
698
  TRegister,
603
699
  TMethod extends Method,
604
700
  TMiddlewares,
605
701
  TInputValidator,
702
+ TStrict extends ServerFnStrict,
606
703
  >
607
704
  extends
608
705
  ServerFnWithTypes<
@@ -610,9 +707,16 @@ export interface ServerFnAfterTyper<
610
707
  TMethod,
611
708
  TMiddlewares,
612
709
  TInputValidator,
613
- undefined
710
+ undefined,
711
+ TStrict
614
712
  >,
615
- ServerFnHandler<TRegister, TMethod, TMiddlewares, TInputValidator> {}
713
+ ServerFnHandler<
714
+ TRegister,
715
+ TMethod,
716
+ TMiddlewares,
717
+ TInputValidator,
718
+ TStrict
719
+ > {}
616
720
 
617
721
  // Handler
618
722
  export interface ServerFnHandler<
@@ -620,6 +724,7 @@ export interface ServerFnHandler<
620
724
  TMethod extends Method,
621
725
  TMiddlewares,
622
726
  TInputValidator,
727
+ TStrict extends ServerFnStrict,
623
728
  > {
624
729
  handler: <TNewResponse>(
625
730
  fn?: ServerFn<
@@ -627,23 +732,42 @@ export interface ServerFnHandler<
627
732
  TMethod,
628
733
  TMiddlewares,
629
734
  TInputValidator,
630
- TNewResponse
735
+ TNewResponse,
736
+ TStrict
631
737
  >,
632
738
  ) => Fetcher<TMiddlewares, TInputValidator, TNewResponse>
633
739
  }
634
740
 
635
- export interface ServerFnBuilder<TRegister, TMethod extends Method = 'GET'>
741
+ export interface ServerFnBuilder<
742
+ TRegister,
743
+ TMethod extends Method = 'GET',
744
+ TStrict extends ServerFnStrict = true,
745
+ >
636
746
  extends
637
- ServerFnWithTypes<TRegister, TMethod, undefined, undefined, undefined>,
638
- ServerFnMiddleware<TRegister, TMethod, undefined, undefined>,
639
- ServerFnValidator<TRegister, TMethod, undefined>,
640
- ServerFnHandler<TRegister, TMethod, undefined, undefined> {
747
+ ServerFnWithTypes<
748
+ TRegister,
749
+ TMethod,
750
+ undefined,
751
+ undefined,
752
+ undefined,
753
+ TStrict
754
+ >,
755
+ ServerFnMiddleware<TRegister, TMethod, undefined, undefined, TStrict>,
756
+ ServerFnValidator<TRegister, TMethod, undefined, TStrict>,
757
+ ServerFnHandler<TRegister, TMethod, undefined, undefined, TStrict> {
758
+ <
759
+ TNewMethod extends Method = TMethod,
760
+ TNewStrict extends ServerFnStrict = TStrict,
761
+ >(
762
+ options?: ServerFnOptions<TNewMethod, TNewStrict>,
763
+ ): ServerFnBuilder<TRegister, TNewMethod, TNewStrict>
641
764
  options: ServerFnBaseOptions<
642
765
  TRegister,
643
766
  TMethod,
644
767
  unknown,
645
768
  undefined,
646
- undefined
769
+ undefined,
770
+ TStrict
647
771
  >
648
772
  }
649
773
 
@@ -653,25 +777,28 @@ export interface ServerFnWithTypes<
653
777
  in out TMiddlewares,
654
778
  in out TInputValidator,
655
779
  in out TResponse,
780
+ in out TStrict extends ServerFnStrict,
656
781
  > {
657
782
  '~types': ServerFnTypes<
658
783
  TRegister,
659
784
  TMethod,
660
785
  TMiddlewares,
661
786
  TInputValidator,
662
- TResponse
787
+ TResponse,
788
+ TStrict
663
789
  >
664
790
  options: ServerFnBaseOptions<
665
791
  TRegister,
666
792
  TMethod,
667
793
  unknown,
668
794
  undefined,
669
- undefined
795
+ undefined,
796
+ TStrict
670
797
  >
671
798
  [TSS_SERVER_FUNCTION_FACTORY]: true
672
799
  }
673
800
 
674
- export type AnyServerFn = ServerFnWithTypes<any, any, any, any, any>
801
+ export type AnyServerFn = ServerFnWithTypes<any, any, any, any, any, any>
675
802
 
676
803
  export interface ServerFnTypes<
677
804
  in out TRegister,
@@ -679,8 +806,10 @@ export interface ServerFnTypes<
679
806
  in out TMiddlewares,
680
807
  in out TInputValidator,
681
808
  in out TResponse,
809
+ in out TStrict extends ServerFnStrict,
682
810
  > {
683
811
  method: TMethod
812
+ strict: TStrict
684
813
  middlewares: TMiddlewares
685
814
  inputValidator: TInputValidator
686
815
  response: TResponse
@@ -0,0 +1,4 @@
1
+ import type { AnySerializationAdapter } from '@benjavicente/router-core'
2
+
3
+ export const pluginSerializationAdapters: Array<AnySerializationAdapter> = []
4
+ export const hasPluginAdapters = false
@@ -0,0 +1 @@
1
+ export function getRouter() {}
@@ -1,2 +1 @@
1
1
  export const startInstance = undefined
2
- export const getRouter = () => {}
@@ -4,8 +4,9 @@ import {
4
4
  } from '@benjavicente/router-core'
5
5
  import { getStartOptions } from './getStartOptions'
6
6
  import type { AnySerializationAdapter } from '@benjavicente/router-core'
7
+ import type { Plugin } from 'seroval'
7
8
 
8
- export function getDefaultSerovalPlugins() {
9
+ export function getDefaultSerovalPlugins(): Array<Plugin<any, any>> {
9
10
  const start = getStartOptions()
10
11
  const adapters = start?.serializationAdapters as
11
12
  | Array<AnySerializationAdapter>
package/src/index.tsx CHANGED
@@ -65,6 +65,10 @@ export type {
65
65
  FetcherBaseOptions,
66
66
  ServerFn,
67
67
  ServerFnCtx,
68
+ ServerFnOptions,
69
+ ServerFnStrict,
70
+ ServerFnStrictInput,
71
+ ServerFnStrictOutput,
68
72
  MiddlewareFn,
69
73
  ServerFnMiddlewareOptions,
70
74
  ServerFnMiddlewareResult,
@@ -80,6 +84,17 @@ export {
80
84
  flattenMiddlewares,
81
85
  executeMiddleware,
82
86
  } from './createServerFn'
87
+ export {
88
+ createCsrfMiddleware,
89
+ csrfSymbol,
90
+ getCsrfRequestValidationResult,
91
+ isCsrfRequestAllowed,
92
+ } from './createCsrfMiddleware'
93
+ export type {
94
+ CsrfMatcher,
95
+ CsrfMiddlewareOptions,
96
+ CsrfSecFetchSite,
97
+ } from './createCsrfMiddleware'
83
98
 
84
99
  export {
85
100
  TSS_FORMDATA_CONTEXT,
@@ -117,3 +132,4 @@ export { getRouterInstance } from './getRouterInstance'
117
132
  export { getDefaultSerovalPlugins } from './getDefaultSerovalPlugins'
118
133
  export { getGlobalStartContext } from './getGlobalStartContext'
119
134
  export { safeObjectMerge, createNullProtoObject } from './safeObjectMerge'
135
+ export { trackPostProcessPromise } from './client-rpc/serverFnFetcher'
@@ -1,11 +1,18 @@
1
1
  declare module '#tanstack-start-entry' {
2
- import type { StartEntry } from '@benjavicente/start-client-core'
2
+ import type { StartEntry } from './startEntry'
3
3
 
4
4
  export const startInstance: StartEntry['startInstance']
5
5
  }
6
6
 
7
7
  declare module '#tanstack-router-entry' {
8
- import type { RouterEntry } from '@benjavicente/start-client-core'
8
+ import type { RouterEntry } from './startEntry'
9
9
 
10
10
  export const getRouter: RouterEntry['getRouter']
11
11
  }
12
+
13
+ declare module '#tanstack-start-plugin-adapters' {
14
+ import type { AnySerializationAdapter } from '@benjavicente/router-core'
15
+
16
+ export const pluginSerializationAdapters: Array<AnySerializationAdapter>
17
+ export const hasPluginAdapters: boolean
18
+ }