@trpc/server 11.0.0-rc.721 → 11.0.0-rc.729

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.
@@ -2,7 +2,7 @@ export { TRPCError,
2
2
  /**
3
3
  * @deprecated use `experimental_trpcMiddleware` instead
4
4
  */
5
- experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferProcedureBuilderResolverOptions, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferClientTypes as inferTRPCClientTypes, type AnyClientTypes as AnyTRPCClientTypes, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type RouterRecord as TRPCRouterRecord, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type ProcedureOptions as TRPCProcedureOptions, type CreateContextCallback, type MutationProcedure as TRPCMutationProcedure, type QueryProcedure as TRPCQueryProcedure, type SubscriptionProcedure as TRPCSubscriptionProcedure, type TRPCBuilder,
5
+ experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferProcedureBuilderResolverOptions, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferClientTypes as inferTRPCClientTypes, type AnyClientTypes as AnyTRPCClientTypes, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type RouterRecord as TRPCRouterRecord, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type ProcedureOptions as TRPCProcedureOptions, type CreateContextCallback, type MutationProcedure as TRPCMutationProcedure, type QueryProcedure as TRPCQueryProcedure, type SubscriptionProcedure as TRPCSubscriptionProcedure, type TRPCBuilder, StandardSchemaV1Error,
6
6
  /**
7
7
  * @deprecated use `tracked(id, data)` instead
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS;AACT;;GAEG;AACH,iCAAiC,EACjC,iCAAiC,IAAI,2BAA2B,EAChE,QAAQ,EAER,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,IAAI,mBAAmB,EACtC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oCAAoC,EACzC,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,IAAI,oBAAoB,EAC7C,KAAK,cAAc,IAAI,kBAAkB,EACzC,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,wBAAwB,IAAI,4BAA4B,EAC7D,KAAK,gBAAgB,IAAI,oBAAoB,EAC7C,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,cAAc,IAAI,kBAAkB,EACzC,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,WAAW;AAChB;;GAEG;AACH,GAAG,EACH,OAAO,EACP,KAAK,eAAe,EACpB,iBAAiB,GAClB,MAAM,mCAAmC,CAAC;AAE3C,YAAY;AACV;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,uBAAuB;AAEvB;;GAEG;AACH,IAAI;AAEJ;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,iBAAiB;AACjB;;GAEG;AACH,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO;AACL;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,aAAa,GACd,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IACxE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS;AACT;;GAEG;AACH,iCAAiC,EACjC,iCAAiC,IAAI,2BAA2B,EAChE,QAAQ,EAER,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,IAAI,mBAAmB,EACtC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,oCAAoC,EACzC,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,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,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 193415,
3
- "bundleOrigSize": 223705,
4
- "bundleReduction": 13.54,
2
+ "bundleSize": 194424,
3
+ "bundleOrigSize": 224908,
4
+ "bundleReduction": 13.55,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/unstable-core-do-not-import/http/resolveResponse.ts",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/unstable-core-do-not-import.ts"
16
16
  ],
17
- "percent": 10.86,
17
+ "percent": 10.81,
18
18
  "reduction": 0
19
19
  },
20
20
  {
@@ -30,7 +30,7 @@
30
30
  "dependents": [
31
31
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
32
32
  ],
33
- "percent": 10.41,
33
+ "percent": 10.36,
34
34
  "reduction": 0
35
35
  },
36
36
  {
@@ -47,7 +47,7 @@
47
47
  "/src/unstable-core-do-not-import.ts",
48
48
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
49
49
  ],
50
- "percent": 10.35,
50
+ "percent": 10.3,
51
51
  "reduction": 0
52
52
  },
53
53
  {
@@ -64,7 +64,7 @@
64
64
  "/src/unstable-core-do-not-import.ts",
65
65
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
66
66
  ],
67
- "percent": 6.53,
67
+ "percent": 6.49,
68
68
  "reduction": 0
69
69
  },
70
70
  {
@@ -77,7 +77,7 @@
77
77
  ],
78
78
  "removedExports": [],
79
79
  "dependents": [],
80
- "percent": 6.28,
80
+ "percent": 6.25,
81
81
  "reduction": 11.62
82
82
  },
83
83
  {
@@ -91,7 +91,7 @@
91
91
  "dependents": [
92
92
  "/src/unstable-core-do-not-import/stream/jsonl.ts"
93
93
  ],
94
- "percent": 4.2,
94
+ "percent": 4.18,
95
95
  "reduction": 0
96
96
  },
97
97
  {
@@ -106,7 +106,7 @@
106
106
  "/src/unstable-core-do-not-import.ts",
107
107
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
108
108
  ],
109
- "percent": 3.97,
109
+ "percent": 3.95,
110
110
  "reduction": 0
111
111
  },
112
112
  {
@@ -124,7 +124,7 @@
124
124
  "/src/unstable-core-do-not-import.ts",
125
125
  "/src/unstable-core-do-not-import/initTRPC.ts"
126
126
  ],
127
- "percent": 3.33,
127
+ "percent": 3.32,
128
128
  "reduction": 39.41
129
129
  },
130
130
  {
@@ -143,7 +143,7 @@
143
143
  "/src/unstable-core-do-not-import/stream/sse.ts",
144
144
  "/src/unstable-core-do-not-import/stream/utils/withPing.ts"
145
145
  ],
146
- "percent": 3.01,
146
+ "percent": 3,
147
147
  "reduction": 0
148
148
  },
149
149
  {
@@ -158,7 +158,7 @@
158
158
  "/src/unstable-core-do-not-import.ts",
159
159
  "/src/unstable-core-do-not-import/initTRPC.ts"
160
160
  ],
161
- "percent": 3,
161
+ "percent": 2.98,
162
162
  "reduction": 65.01
163
163
  },
164
164
  {
@@ -172,7 +172,7 @@
172
172
  "dependents": [
173
173
  "/src/adapters/aws-lambda/index.ts"
174
174
  ],
175
- "percent": 2.8,
175
+ "percent": 2.78,
176
176
  "reduction": 11.51
177
177
  },
178
178
  {
@@ -192,7 +192,7 @@
192
192
  "/src/observable/operators.ts",
193
193
  "/src/observable/behaviorSubject.ts"
194
194
  ],
195
- "percent": 2.5,
195
+ "percent": 2.49,
196
196
  "reduction": 0
197
197
  },
198
198
  {
@@ -207,7 +207,7 @@
207
207
  "dependents": [
208
208
  "/src/unstable-core-do-not-import/stream/sse.ts"
209
209
  ],
210
- "percent": 2.3,
210
+ "percent": 2.28,
211
211
  "reduction": 0
212
212
  },
213
213
  {
@@ -223,7 +223,7 @@
223
223
  "/src/adapters/node-http/index.ts",
224
224
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
225
225
  ],
226
- "percent": 2.03,
226
+ "percent": 2.02,
227
227
  "reduction": 17.53
228
228
  },
229
229
  {
@@ -241,7 +241,7 @@
241
241
  "dependents": [
242
242
  "/src/observable/index.ts"
243
243
  ],
244
- "percent": 2.02,
244
+ "percent": 2.01,
245
245
  "reduction": 1.66
246
246
  },
247
247
  {
@@ -255,7 +255,7 @@
255
255
  "dependents": [
256
256
  "/src/adapters/next-app-dir.ts"
257
257
  ],
258
- "percent": 1.68,
258
+ "percent": 1.67,
259
259
  "reduction": 22.52
260
260
  },
261
261
  {
@@ -270,7 +270,7 @@
270
270
  "dependents": [
271
271
  "/src/adapters/node-http/index.ts"
272
272
  ],
273
- "percent": 1.42,
273
+ "percent": 1.41,
274
274
  "reduction": 16.3
275
275
  },
276
276
  {
@@ -290,7 +290,7 @@
290
290
  "/src/unstable-core-do-not-import/initTRPC.ts",
291
291
  "/src/unstable-core-do-not-import/router.ts"
292
292
  ],
293
- "percent": 1.42,
293
+ "percent": 1.41,
294
294
  "reduction": 45.98
295
295
  },
296
296
  {
@@ -304,7 +304,7 @@
304
304
  "dependents": [
305
305
  "/src/unstable-core-do-not-import.ts"
306
306
  ],
307
- "percent": 1.38,
307
+ "percent": 1.37,
308
308
  "reduction": 40.81
309
309
  },
310
310
  {
@@ -324,7 +324,7 @@
324
324
  "/src/unstable-core-do-not-import/initTRPC.ts",
325
325
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
326
326
  ],
327
- "percent": 1.36,
327
+ "percent": 1.35,
328
328
  "reduction": 55.79
329
329
  },
330
330
  {
@@ -385,7 +385,7 @@
385
385
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
386
386
  "/src/unstable-core-do-not-import/stream/sse.ts"
387
387
  ],
388
- "percent": 1.22,
388
+ "percent": 1.21,
389
389
  "reduction": 0
390
390
  },
391
391
  {
@@ -401,7 +401,7 @@
401
401
  "/src/unstable-core-do-not-import.ts",
402
402
  "/src/unstable-core-do-not-import/router.ts"
403
403
  ],
404
- "percent": 1.21,
404
+ "percent": 1.2,
405
405
  "reduction": 0
406
406
  },
407
407
  {
@@ -415,7 +415,7 @@
415
415
  "dependents": [
416
416
  "/src/adapters/fetch/index.ts"
417
417
  ],
418
- "percent": 1.16,
418
+ "percent": 1.15,
419
419
  "reduction": 2.48
420
420
  },
421
421
  {
@@ -429,7 +429,7 @@
429
429
  "dependents": [
430
430
  "/src/adapters/next-app-dir/nextAppDirCaller.ts"
431
431
  ],
432
- "percent": 1.1,
432
+ "percent": 1.09,
433
433
  "reduction": 5.4
434
434
  },
435
435
  {
@@ -450,7 +450,7 @@
450
450
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
451
451
  "/src/unstable-core-do-not-import/error/getErrorShape.ts"
452
452
  ],
453
- "percent": 1.08,
453
+ "percent": 1.07,
454
454
  "reduction": 18.54
455
455
  },
456
456
  {
@@ -465,7 +465,7 @@
465
465
  "dependents": [
466
466
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
467
467
  ],
468
- "percent": 1.05,
468
+ "percent": 1.04,
469
469
  "reduction": 3.71
470
470
  },
471
471
  {
@@ -479,7 +479,7 @@
479
479
  "dependents": [
480
480
  "/src/adapters/fastify/index.ts"
481
481
  ],
482
- "percent": 0.92,
482
+ "percent": 0.91,
483
483
  "reduction": 30.2
484
484
  },
485
485
  {
@@ -499,7 +499,7 @@
499
499
  "/src/unstable-core-do-not-import/stream/utils/mergeAsyncIterables.ts",
500
500
  "/src/unstable-core-do-not-import/stream/utils/timerResource.ts"
501
501
  ],
502
- "percent": 0.91,
502
+ "percent": 0.9,
503
503
  "reduction": 1.46
504
504
  },
505
505
  {
@@ -527,6 +527,21 @@
527
527
  "percent": 0.83,
528
528
  "reduction": 17.81
529
529
  },
530
+ {
531
+ "id": "/src/unstable-core-do-not-import/parser.ts",
532
+ "size": 1610,
533
+ "origSize": 3501,
534
+ "renderedExports": [
535
+ "getParseFn"
536
+ ],
537
+ "removedExports": [],
538
+ "dependents": [
539
+ "/src/unstable-core-do-not-import.ts",
540
+ "/src/unstable-core-do-not-import/procedureBuilder.ts"
541
+ ],
542
+ "percent": 0.83,
543
+ "reduction": 54.01
544
+ },
530
545
  {
531
546
  "id": "/src/adapters/next.ts",
532
547
  "size": 1326,
@@ -536,7 +551,7 @@
536
551
  ],
537
552
  "removedExports": [],
538
553
  "dependents": [],
539
- "percent": 0.69,
554
+ "percent": 0.68,
540
555
  "reduction": 35.1
541
556
  },
542
557
  {
@@ -553,24 +568,9 @@
553
568
  "/src/adapters/next-app-dir/nextAppDirCaller.ts",
554
569
  "/src/adapters/next-app-dir/rethrowNextErrors.ts"
555
570
  ],
556
- "percent": 0.69,
571
+ "percent": 0.68,
557
572
  "reduction": 0
558
573
  },
559
- {
560
- "id": "/src/unstable-core-do-not-import/parser.ts",
561
- "size": 1297,
562
- "origSize": 2906,
563
- "renderedExports": [
564
- "getParseFn"
565
- ],
566
- "removedExports": [],
567
- "dependents": [
568
- "/src/unstable-core-do-not-import.ts",
569
- "/src/unstable-core-do-not-import/procedureBuilder.ts"
570
- ],
571
- "percent": 0.67,
572
- "reduction": 55.37
573
- },
574
574
  {
575
575
  "id": "/src/adapters/fastify/fastifyRequestHandler.ts",
576
576
  "size": 1146,
@@ -669,7 +669,7 @@
669
669
  ],
670
670
  "removedExports": [],
671
671
  "dependents": [],
672
- "percent": 0.4,
672
+ "percent": 0.39,
673
673
  "reduction": 56.66
674
674
  },
675
675
  {
@@ -684,6 +684,21 @@
684
684
  "percent": 0.39,
685
685
  "reduction": 66.61
686
686
  },
687
+ {
688
+ "id": "/src/vendor/standard-schema-v1/error.ts",
689
+ "size": 696,
690
+ "origSize": 507,
691
+ "renderedExports": [
692
+ "StandardSchemaV1Error"
693
+ ],
694
+ "removedExports": [],
695
+ "dependents": [
696
+ "/src/unstable-core-do-not-import.ts",
697
+ "/src/unstable-core-do-not-import/parser.ts"
698
+ ],
699
+ "percent": 0.36,
700
+ "reduction": 0
701
+ },
687
702
  {
688
703
  "id": "/src/unstable-core-do-not-import/stream/utils/readableStreamFrom.ts",
689
704
  "size": 651,
@@ -696,7 +711,7 @@
696
711
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
697
712
  "/src/unstable-core-do-not-import/stream/sse.ts"
698
713
  ],
699
- "percent": 0.34,
714
+ "percent": 0.33,
700
715
  "reduction": 1.36
701
716
  },
702
717
  {
@@ -859,9 +874,9 @@
859
874
  "reduction": 100
860
875
  },
861
876
  {
862
- "id": "/src/shared.ts",
877
+ "id": "/src/rpc.ts",
863
878
  "size": 0,
864
- "origSize": 653,
879
+ "origSize": 36,
865
880
  "renderedExports": [],
866
881
  "removedExports": [],
867
882
  "dependents": [],
@@ -869,9 +884,9 @@
869
884
  "reduction": 100
870
885
  },
871
886
  {
872
- "id": "/src/rpc.ts",
887
+ "id": "/src/shared.ts",
873
888
  "size": 0,
874
- "origSize": 36,
889
+ "origSize": 653,
875
890
  "renderedExports": [],
876
891
  "removedExports": [],
877
892
  "dependents": [],
@@ -881,16 +896,16 @@
881
896
  {
882
897
  "id": "/src/unstable-core-do-not-import.ts",
883
898
  "size": 0,
884
- "origSize": 2375,
899
+ "origSize": 2476,
885
900
  "renderedExports": [],
886
901
  "removedExports": [],
887
902
  "dependents": [
888
903
  "/src/adapters/express.ts",
889
- "/src/adapters/standalone.ts",
890
904
  "/src/adapters/next.ts",
905
+ "/src/adapters/standalone.ts",
891
906
  "/src/adapters/ws.ts",
892
- "/src/adapters/next-app-dir/nextAppDirCaller.ts",
893
907
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts",
908
+ "/src/adapters/next-app-dir/nextAppDirCaller.ts",
894
909
  "/src/adapters/node-http/writeResponse.ts"
895
910
  ],
896
911
  "percent": 0,
@@ -946,8 +961,8 @@
946
961
  "removedExports": [],
947
962
  "dependents": [
948
963
  "/src/adapters/express.ts",
949
- "/src/adapters/standalone.ts",
950
964
  "/src/adapters/next.ts",
965
+ "/src/adapters/standalone.ts",
951
966
  "/src/adapters/ws.ts",
952
967
  "/src/adapters/fastify/fastifyRequestHandler.ts"
953
968
  ],
@@ -955,5 +970,5 @@
955
970
  "reduction": 100
956
971
  }
957
972
  ],
958
- "moduleCount": 62
973
+ "moduleCount": 63
959
974
  }
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ var tracked = require('./unstable-core-do-not-import/stream/tracked.js');
9
9
  var transformer = require('./unstable-core-do-not-import/transformer.js');
10
10
  var initTRPC = require('./unstable-core-do-not-import/initTRPC.js');
11
11
  var middleware = require('./unstable-core-do-not-import/middleware.js');
12
+ var error = require('./vendor/standard-schema-v1/error.js');
12
13
  require('./unstable-core-do-not-import/rootConfig.js');
13
14
  var router = require('./unstable-core-do-not-import/router.js');
14
15
 
@@ -25,5 +26,6 @@ exports.transformTRPCResponse = transformer.transformTRPCResponse;
25
26
  exports.initTRPC = initTRPC.initTRPC;
26
27
  exports.experimental_standaloneMiddleware = middleware.experimental_standaloneMiddleware;
27
28
  exports.experimental_trpcMiddleware = middleware.experimental_standaloneMiddleware;
29
+ exports.StandardSchemaV1Error = error.StandardSchemaV1Error;
28
30
  exports.callProcedure = router.callProcedure;
29
31
  exports.callTRPCProcedure = router.callProcedure;
package/dist/index.mjs CHANGED
@@ -7,5 +7,6 @@ export { isTrackedEnvelope, sse, tracked } from './unstable-core-do-not-import/s
7
7
  export { transformTRPCResponse } from './unstable-core-do-not-import/transformer.mjs';
8
8
  export { initTRPC } from './unstable-core-do-not-import/initTRPC.mjs';
9
9
  export { experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware } from './unstable-core-do-not-import/middleware.mjs';
10
+ export { StandardSchemaV1Error } from './vendor/standard-schema-v1/error.mjs';
10
11
  import './unstable-core-do-not-import/rootConfig.mjs';
11
12
  export { callProcedure, callProcedure as callTRPCProcedure } from './unstable-core-do-not-import/router.mjs';
@@ -1,3 +1,4 @@
1
+ import { type StandardSchemaV1 } from '../vendor/standard-schema-v1/spec';
1
2
  export type ParserZodEsque<TInput, TParsedInput> = {
2
3
  _input: TInput;
3
4
  _output: TParsedInput;
@@ -14,6 +15,7 @@ export type ParserArkTypeEsque<TInput, TParsedInput> = {
14
15
  inferIn: TInput;
15
16
  infer: TParsedInput;
16
17
  };
18
+ export type ParserStandardSchemaEsque<TInput, TParsedInput> = StandardSchemaV1<TInput, TParsedInput>;
17
19
  export type ParserMyZodEsque<TInput> = {
18
20
  parse: (input: any) => TInput;
19
21
  };
@@ -28,7 +30,7 @@ export type ParserScaleEsque<TInput> = {
28
30
  assert(value: unknown): asserts value is TInput;
29
31
  };
30
32
  export type ParserWithoutInput<TInput> = ParserCustomValidatorEsque<TInput> | ParserMyZodEsque<TInput> | ParserScaleEsque<TInput> | ParserSuperstructEsque<TInput> | ParserYupEsque<TInput>;
31
- export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput> | ParserArkTypeEsque<TInput, TParsedInput>;
33
+ export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput> | ParserArkTypeEsque<TInput, TParsedInput> | ParserStandardSchemaEsque<TInput, TParsedInput>;
32
34
  export type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
33
35
  export type inferParser<TParser extends Parser> = TParser extends ParserWithInputOutput<infer $TIn, infer $TOut> ? {
34
36
  in: $TIn;
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/parser.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,cAAc,CAAC,MAAM,EAAE,YAAY,IAAI;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,MAAM,EAAE,YAAY,IAAI;IACrD,MAAM,EAAE;QACN,MAAM,CAAC,EAAE;YACP,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,YAAY,CAAC;SACtB,CAAC;KACH,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,MAAM,EAAE,YAAY,IAAI;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAA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,GACD,OAAO,SAAS,kBAAkB,CAAC,MAAM,MAAM,CAAC,GAC9C;IACE,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,GACD,KAAK,CAAC;AAEd,MAAM,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;AAExE,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAuDzE"}
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- // zod / typeschema
3
+ var error = require('../vendor/standard-schema-v1/error.js');
4
+
4
5
  function getParseFn(procedureParser) {
5
6
  const parser = procedureParser;
6
7
  if (typeof parser === 'function' && typeof parser.assert === 'function') {
@@ -36,6 +37,16 @@ function getParseFn(procedureParser) {
36
37
  return value;
37
38
  };
38
39
  }
40
+ if ('~standard' in parser) {
41
+ // StandardSchemaEsque
42
+ return async (value)=>{
43
+ const result = await parser['~standard'].validate(value);
44
+ if (result.issues) {
45
+ throw new error.StandardSchemaV1Error(result.issues);
46
+ }
47
+ return result.value;
48
+ };
49
+ }
39
50
  throw new Error('Could not find a validator fn');
40
51
  }
41
52
 
@@ -1,4 +1,5 @@
1
- // zod / typeschema
1
+ import { StandardSchemaV1Error } from '../vendor/standard-schema-v1/error.mjs';
2
+
2
3
  function getParseFn(procedureParser) {
3
4
  const parser = procedureParser;
4
5
  if (typeof parser === 'function' && typeof parser.assert === 'function') {
@@ -34,6 +35,16 @@ function getParseFn(procedureParser) {
34
35
  return value;
35
36
  };
36
37
  }
38
+ if ('~standard' in parser) {
39
+ // StandardSchemaEsque
40
+ return async (value)=>{
41
+ const result = await parser['~standard'].validate(value);
42
+ if (result.issues) {
43
+ throw new StandardSchemaV1Error(result.issues);
44
+ }
45
+ return result.value;
46
+ };
47
+ }
37
48
  throw new Error('Could not find a validator fn');
38
49
  }
39
50
 
@@ -40,4 +40,6 @@ export * from './unstable-core-do-not-import/stream/utils/disposable';
40
40
  export * from './unstable-core-do-not-import/transformer';
41
41
  export * from './unstable-core-do-not-import/types';
42
42
  export * from './unstable-core-do-not-import/utils';
43
+ export * from './vendor/standard-schema-v1/error';
44
+ export * from './vendor/standard-schema-v1/spec';
43
45
  //# sourceMappingURL=unstable-core-do-not-import.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unstable-core-do-not-import.d.ts","sourceRoot":"","sources":["../src/unstable-core-do-not-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC;AACnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uDAAuD,CAAC;AACtE,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,iDAAiD,CAAC;AAChE,cAAc,0DAA0D,CAAC;AACzE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"unstable-core-do-not-import.d.ts","sourceRoot":"","sources":["../src/unstable-core-do-not-import.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,mDAAmD,CAAC;AAClE,cAAc,oDAAoD,CAAC;AACnE,cAAc,mDAAmD,CAAC;AAClE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,uDAAuD,CAAC;AACtE,cAAc,qDAAqD,CAAC;AACpE,cAAc,sDAAsD,CAAC;AACrE,cAAc,iDAAiD,CAAC;AAChE,cAAc,0DAA0D,CAAC;AACzE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0CAA0C,CAAC;AACzD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,0CAA0C,CAAC;AACzD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC"}
@@ -27,6 +27,7 @@ var createDeferred = require('./unstable-core-do-not-import/stream/utils/createD
27
27
  var disposable = require('./unstable-core-do-not-import/stream/utils/disposable.js');
28
28
  var transformer = require('./unstable-core-do-not-import/transformer.js');
29
29
  var utils = require('./unstable-core-do-not-import/utils.js');
30
+ var error = require('./vendor/standard-schema-v1/error.js');
30
31
 
31
32
 
32
33
 
@@ -95,3 +96,4 @@ exports.omitPrototype = utils.omitPrototype;
95
96
  exports.run = utils.run;
96
97
  exports.sleep = utils.sleep;
97
98
  exports.unsetMarker = utils.unsetMarker;
99
+ exports.StandardSchemaV1Error = error.StandardSchemaV1Error;
@@ -25,3 +25,4 @@ export { createDeferred } from './unstable-core-do-not-import/stream/utils/creat
25
25
  export { makeAsyncResource, makeResource } from './unstable-core-do-not-import/stream/utils/disposable.mjs';
26
26
  export { defaultTransformer, getDataTransformer, transformResult, transformTRPCResponse } from './unstable-core-do-not-import/transformer.mjs';
27
27
  export { abortSignalsAnyPonyfill, assert, identity, isAsyncIterable, isFunction, isObject, mergeWithoutOverrides, noop, omitPrototype, run, sleep, unsetMarker } from './unstable-core-do-not-import/utils.mjs';
28
+ export { StandardSchemaV1Error } from './vendor/standard-schema-v1/error.mjs';
@@ -0,0 +1,13 @@
1
+ import type { StandardSchemaV1 } from "./spec";
2
+ /** A schema error with useful information. */
3
+ export declare class StandardSchemaV1Error extends Error {
4
+ /** The schema issues. */
5
+ readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
6
+ /**
7
+ * Creates a schema error with useful information.
8
+ *
9
+ * @param issues The schema issues.
10
+ */
11
+ constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>);
12
+ }
13
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/vendor/standard-schema-v1/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C,8CAA8C;AAE9C,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,yBAAyB;IACzB,SAAgB,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAE9D;;;;OAIG;gBACS,MAAM,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,CAAC;CAK1D"}
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ function _define_property(obj, key, value) {
4
+ if (key in obj) {
5
+ Object.defineProperty(obj, key, {
6
+ value: value,
7
+ enumerable: true,
8
+ configurable: true,
9
+ writable: true
10
+ });
11
+ } else {
12
+ obj[key] = value;
13
+ }
14
+ return obj;
15
+ }
16
+ /** A schema error with useful information. */ class StandardSchemaV1Error extends Error {
17
+ /**
18
+ * Creates a schema error with useful information.
19
+ *
20
+ * @param issues The schema issues.
21
+ */ constructor(issues){
22
+ super(issues[0]?.message), /** The schema issues. */ _define_property(this, "issues", void 0);
23
+ this.name = 'SchemaError';
24
+ this.issues = issues;
25
+ }
26
+ }
27
+
28
+ exports.StandardSchemaV1Error = StandardSchemaV1Error;
@@ -0,0 +1,26 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ /** A schema error with useful information. */ class StandardSchemaV1Error extends Error {
15
+ /**
16
+ * Creates a schema error with useful information.
17
+ *
18
+ * @param issues The schema issues.
19
+ */ constructor(issues){
20
+ super(issues[0]?.message), /** The schema issues. */ _define_property(this, "issues", void 0);
21
+ this.name = 'SchemaError';
22
+ this.issues = issues;
23
+ }
24
+ }
25
+
26
+ export { StandardSchemaV1Error };
@@ -0,0 +1,60 @@
1
+ /**
2
+ *
3
+ * @see https://github.com/standard-schema/standard-schema/blob/main/packages/spec/src/index.ts
4
+ */
5
+ /** The Standard Schema interface. */
6
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
7
+ /** The Standard Schema properties. */
8
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
9
+ }
10
+ export declare namespace StandardSchemaV1 {
11
+ /** The Standard Schema properties interface. */
12
+ interface Props<Input = unknown, Output = Input> {
13
+ /** The version number of the standard. */
14
+ readonly version: 1;
15
+ /** The vendor name of the schema library. */
16
+ readonly vendor: string;
17
+ /** Validates unknown input values. */
18
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
19
+ /** Inferred types associated with the schema. */
20
+ readonly types?: Types<Input, Output> | undefined;
21
+ }
22
+ /** The result interface of the validate function. */
23
+ type Result<Output> = SuccessResult<Output> | FailureResult;
24
+ /** The result interface if validation succeeds. */
25
+ interface SuccessResult<Output> {
26
+ /** The typed output value. */
27
+ readonly value: Output;
28
+ /** The non-existent issues. */
29
+ readonly issues?: undefined;
30
+ }
31
+ /** The result interface if validation fails. */
32
+ interface FailureResult {
33
+ /** The issues of failed validation. */
34
+ readonly issues: ReadonlyArray<Issue>;
35
+ }
36
+ /** The issue interface of the failure output. */
37
+ interface Issue {
38
+ /** The error message of the issue. */
39
+ readonly message: string;
40
+ /** The path of the issue, if any. */
41
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
42
+ }
43
+ /** The path segment interface of the issue. */
44
+ interface PathSegment {
45
+ /** The key representing a path segment. */
46
+ readonly key: PropertyKey;
47
+ }
48
+ /** The Standard Schema types interface. */
49
+ interface Types<Input = unknown, Output = Input> {
50
+ /** The input type of the schema. */
51
+ readonly input: Input;
52
+ /** The output type of the schema. */
53
+ readonly output: Output;
54
+ }
55
+ /** Infers the input type of a Standard Schema. */
56
+ type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
57
+ /** Infers the output type of a Standard Schema. */
58
+ type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
59
+ }
60
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../src/vendor/standard-schema-v1/spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,qCAAqC;AACrC,MAAM,WAAW,gBAAgB,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;IAC/D,sCAAsC;IACt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AA2C;QAC3C,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;KAC3B;IAED,2CAA2C;IAC3C,UAAiB,KAAK,CAAC,KAAK,GAAG,OAAO,EAAE,MAAM,GAAG,KAAK;QACpD,oCAAoC;QACpC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;QACtB,qCAAqC;QACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;KACzB;IAED,kDAAkD;IAClD,KAAY,UAAU,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACnE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,OAAO,CAAC,CAAC;IAEX,mDAAmD;IACnD,KAAY,WAAW,CAAC,MAAM,SAAS,gBAAgB,IAAI,WAAW,CACpE,MAAM,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAC7B,CAAC,QAAQ,CAAC,CAAC;CACb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.721+6ce3abe6b",
3
+ "version": "11.0.0-rc.729+a60413241",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -141,7 +141,7 @@
141
141
  "superstruct": "^2.0.0",
142
142
  "tsx": "^4.0.0",
143
143
  "typescript": "^5.7.2",
144
- "valibot": "^0.42.0",
144
+ "valibot": "1.0.0-beta.14",
145
145
  "ws": "^8.0.0",
146
146
  "yup": "^1.0.0",
147
147
  "zod": "^3.0.0"
@@ -152,5 +152,5 @@
152
152
  "peerDependencies": {
153
153
  "typescript": ">=5.7.2"
154
154
  },
155
- "gitHead": "6ce3abe6b1cf9f3efff0437498ad181778ade527"
155
+ "gitHead": "a60413241c05b258da0cbc7cbfb8b4097aeb3f72"
156
156
  }
@@ -37,6 +37,7 @@ export {
37
37
  type QueryProcedure as TRPCQueryProcedure,
38
38
  type SubscriptionProcedure as TRPCSubscriptionProcedure,
39
39
  type TRPCBuilder,
40
+ StandardSchemaV1Error,
40
41
  /**
41
42
  * @deprecated use `tracked(id, data)` instead
42
43
  */
@@ -1,3 +1,6 @@
1
+ import { StandardSchemaV1Error } from '../vendor/standard-schema-v1/error';
2
+ import { type StandardSchemaV1 } from '../vendor/standard-schema-v1/spec';
3
+
1
4
  // zod / typeschema
2
5
  export type ParserZodEsque<TInput, TParsedInput> = {
3
6
  _input: TInput;
@@ -18,6 +21,11 @@ export type ParserArkTypeEsque<TInput, TParsedInput> = {
18
21
  infer: TParsedInput;
19
22
  };
20
23
 
24
+ export type ParserStandardSchemaEsque<TInput, TParsedInput> = StandardSchemaV1<
25
+ TInput,
26
+ TParsedInput
27
+ >;
28
+
21
29
  export type ParserMyZodEsque<TInput> = {
22
30
  parse: (input: any) => TInput;
23
31
  };
@@ -48,7 +56,8 @@ export type ParserWithoutInput<TInput> =
48
56
  export type ParserWithInputOutput<TInput, TParsedInput> =
49
57
  | ParserZodEsque<TInput, TParsedInput>
50
58
  | ParserValibotEsque<TInput, TParsedInput>
51
- | ParserArkTypeEsque<TInput, TParsedInput>;
59
+ | ParserArkTypeEsque<TInput, TParsedInput>
60
+ | ParserStandardSchemaEsque<TInput, TParsedInput>;
52
61
 
53
62
  export type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
54
63
 
@@ -110,5 +119,16 @@ export function getParseFn<TType>(procedureParser: Parser): ParseFn<TType> {
110
119
  };
111
120
  }
112
121
 
122
+ if ('~standard' in parser) {
123
+ // StandardSchemaEsque
124
+ return async (value) => {
125
+ const result = await parser['~standard'].validate(value);
126
+ if (result.issues) {
127
+ throw new StandardSchemaV1Error(result.issues);
128
+ }
129
+ return result.value;
130
+ };
131
+ }
132
+
113
133
  throw new Error('Could not find a validator fn');
114
134
  }
@@ -40,3 +40,5 @@ export * from './unstable-core-do-not-import/stream/utils/disposable';
40
40
  export * from './unstable-core-do-not-import/transformer';
41
41
  export * from './unstable-core-do-not-import/types';
42
42
  export * from './unstable-core-do-not-import/utils';
43
+ export * from './vendor/standard-schema-v1/error';
44
+ export * from './vendor/standard-schema-v1/spec';
@@ -0,0 +1,19 @@
1
+ import type { StandardSchemaV1 } from "./spec";
2
+
3
+ /** A schema error with useful information. */
4
+
5
+ export class StandardSchemaV1Error extends Error {
6
+ /** The schema issues. */
7
+ public readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
8
+
9
+ /**
10
+ * Creates a schema error with useful information.
11
+ *
12
+ * @param issues The schema issues.
13
+ */
14
+ constructor(issues: ReadonlyArray<StandardSchemaV1.Issue>) {
15
+ super(issues[0]?.message);
16
+ this.name = 'SchemaError';
17
+ this.issues = issues;
18
+ }
19
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ *
3
+ * @see https://github.com/standard-schema/standard-schema/blob/main/packages/spec/src/index.ts
4
+ */
5
+
6
+ /* eslint-disable @typescript-eslint/no-namespace */
7
+ /* eslint-disable @typescript-eslint/naming-convention */
8
+
9
+ /** The Standard Schema interface. */
10
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
11
+ /** The Standard Schema properties. */
12
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
13
+ }
14
+
15
+ export declare namespace StandardSchemaV1 {
16
+ /** The Standard Schema properties interface. */
17
+ export interface Props<Input = unknown, Output = Input> {
18
+ /** The version number of the standard. */
19
+ readonly version: 1;
20
+ /** The vendor name of the schema library. */
21
+ readonly vendor: string;
22
+ /** Validates unknown input values. */
23
+ readonly validate: (
24
+ value: unknown,
25
+ ) => Result<Output> | Promise<Result<Output>>;
26
+ /** Inferred types associated with the schema. */
27
+ readonly types?: Types<Input, Output> | undefined;
28
+ }
29
+
30
+ /** The result interface of the validate function. */
31
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
32
+
33
+ /** The result interface if validation succeeds. */
34
+ export interface SuccessResult<Output> {
35
+ /** The typed output value. */
36
+ readonly value: Output;
37
+ /** The non-existent issues. */
38
+ readonly issues?: undefined;
39
+ }
40
+
41
+ /** The result interface if validation fails. */
42
+ export interface FailureResult {
43
+ /** The issues of failed validation. */
44
+ readonly issues: ReadonlyArray<Issue>;
45
+ }
46
+
47
+ /** The issue interface of the failure output. */
48
+ export interface Issue {
49
+ /** The error message of the issue. */
50
+ readonly message: string;
51
+ /** The path of the issue, if any. */
52
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
53
+ }
54
+
55
+ /** The path segment interface of the issue. */
56
+ export interface PathSegment {
57
+ /** The key representing a path segment. */
58
+ readonly key: PropertyKey;
59
+ }
60
+
61
+ /** The Standard Schema types interface. */
62
+ export interface Types<Input = unknown, Output = Input> {
63
+ /** The input type of the schema. */
64
+ readonly input: Input;
65
+ /** The output type of the schema. */
66
+ readonly output: Output;
67
+ }
68
+
69
+ /** Infers the input type of a Standard Schema. */
70
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<
71
+ Schema['~standard']['types']
72
+ >['input'];
73
+
74
+ /** Infers the output type of a Standard Schema. */
75
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<
76
+ Schema['~standard']['types']
77
+ >['output'];
78
+ }
79
+
80
+