@trpc/server 11.0.0-rc.489 → 11.0.0-rc.490

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.
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 135619,
3
- "bundleOrigSize": 184479,
4
- "bundleReduction": 26.49,
2
+ "bundleSize": 135882,
3
+ "bundleOrigSize": 184879,
4
+ "bundleReduction": 26.5,
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": 13.17,
17
+ "percent": 13.15,
18
18
  "reduction": 0
19
19
  },
20
20
  {
@@ -31,7 +31,7 @@
31
31
  "/src/unstable-core-do-not-import.ts",
32
32
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
33
33
  ],
34
- "percent": 12.95,
34
+ "percent": 12.93,
35
35
  "reduction": 4.31
36
36
  },
37
37
  {
@@ -47,7 +47,7 @@
47
47
  "dependents": [
48
48
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
49
49
  ],
50
- "percent": 11.6,
50
+ "percent": 11.58,
51
51
  "reduction": 0
52
52
  },
53
53
  {
@@ -62,7 +62,7 @@
62
62
  "/src/unstable-core-do-not-import.ts",
63
63
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
64
64
  ],
65
- "percent": 5.67,
65
+ "percent": 5.66,
66
66
  "reduction": 0
67
67
  },
68
68
  {
@@ -80,7 +80,7 @@
80
80
  "/src/unstable-core-do-not-import.ts",
81
81
  "/src/unstable-core-do-not-import/initTRPC.ts"
82
82
  ],
83
- "percent": 4.71,
83
+ "percent": 4.7,
84
84
  "reduction": 39.77
85
85
  },
86
86
  {
@@ -112,7 +112,7 @@
112
112
  "/src/unstable-core-do-not-import.ts",
113
113
  "/src/unstable-core-do-not-import/http/resolveResponse.ts"
114
114
  ],
115
- "percent": 4.36,
115
+ "percent": 4.35,
116
116
  "reduction": 15.22
117
117
  },
118
118
  {
@@ -126,7 +126,7 @@
126
126
  "dependents": [
127
127
  "/src/adapters/aws-lambda/index.ts"
128
128
  ],
129
- "percent": 4,
129
+ "percent": 3.99,
130
130
  "reduction": 11.38
131
131
  },
132
132
  {
@@ -206,9 +206,9 @@
206
206
  "removedExports": [],
207
207
  "dependents": [
208
208
  "/src/unstable-core-do-not-import.ts",
209
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
209
210
  "/src/unstable-core-do-not-import/initTRPC.ts",
210
- "/src/unstable-core-do-not-import/router.ts",
211
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
211
+ "/src/unstable-core-do-not-import/router.ts"
212
212
  ],
213
213
  "percent": 2.02,
214
214
  "reduction": 45.94
@@ -244,7 +244,7 @@
244
244
  "/src/unstable-core-do-not-import/initTRPC.ts",
245
245
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
246
246
  ],
247
- "percent": 1.94,
247
+ "percent": 1.93,
248
248
  "reduction": 55.5
249
249
  },
250
250
  {
@@ -260,7 +260,7 @@
260
260
  "/src/unstable-core-do-not-import.ts",
261
261
  "/src/unstable-core-do-not-import/router.ts"
262
262
  ],
263
- "percent": 1.72,
263
+ "percent": 1.71,
264
264
  "reduction": 0
265
265
  },
266
266
  {
@@ -289,7 +289,7 @@
289
289
  "/src/adapters/node-http/index.ts",
290
290
  "/src/adapters/node-http/nodeHTTPRequestHandler.ts"
291
291
  ],
292
- "percent": 1.62,
292
+ "percent": 1.61,
293
293
  "reduction": 13.79
294
294
  },
295
295
  {
@@ -332,10 +332,10 @@
332
332
  "removedExports": [],
333
333
  "dependents": [
334
334
  "/src/unstable-core-do-not-import.ts",
335
- "/src/unstable-core-do-not-import/middleware.ts",
336
- "/src/unstable-core-do-not-import/router.ts",
337
335
  "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
338
336
  "/src/unstable-core-do-not-import/http/resolveResponse.ts",
337
+ "/src/unstable-core-do-not-import/middleware.ts",
338
+ "/src/unstable-core-do-not-import/router.ts",
339
339
  "/src/unstable-core-do-not-import/http/contentType.ts",
340
340
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
341
341
  "/src/unstable-core-do-not-import/stream/jsonl.ts",
@@ -392,12 +392,27 @@
392
392
  "removedExports": [],
393
393
  "dependents": [
394
394
  "/src/unstable-core-do-not-import.ts",
395
- "/src/unstable-core-do-not-import/error/getErrorShape.ts",
396
- "/src/unstable-core-do-not-import/http/resolveResponse.ts"
395
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
396
+ "/src/unstable-core-do-not-import/error/getErrorShape.ts"
397
397
  ],
398
- "percent": 1.01,
398
+ "percent": 1,
399
399
  "reduction": 17.52
400
400
  },
401
+ {
402
+ "id": "/src/unstable-core-do-not-import/parser.ts",
403
+ "size": 1297,
404
+ "origSize": 2896,
405
+ "renderedExports": [
406
+ "getParseFn"
407
+ ],
408
+ "removedExports": [],
409
+ "dependents": [
410
+ "/src/unstable-core-do-not-import.ts",
411
+ "/src/unstable-core-do-not-import/procedureBuilder.ts"
412
+ ],
413
+ "percent": 0.95,
414
+ "reduction": 55.21
415
+ },
401
416
  {
402
417
  "id": "/src/unstable-core-do-not-import/utils.ts",
403
418
  "size": 1199,
@@ -414,13 +429,13 @@
414
429
  "removedExports": [],
415
430
  "dependents": [
416
431
  "/src/unstable-core-do-not-import.ts",
432
+ "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
433
+ "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
434
+ "/src/unstable-core-do-not-import/http/resolveResponse.ts",
417
435
  "/src/unstable-core-do-not-import/error/TRPCError.ts",
418
436
  "/src/unstable-core-do-not-import/transformer.ts",
419
437
  "/src/unstable-core-do-not-import/middleware.ts",
420
438
  "/src/unstable-core-do-not-import/router.ts",
421
- "/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts",
422
- "/src/unstable-core-do-not-import/http/parseConnectionParams.ts",
423
- "/src/unstable-core-do-not-import/http/resolveResponse.ts",
424
439
  "/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
425
440
  "/src/unstable-core-do-not-import/http/contentType.ts",
426
441
  "/src/unstable-core-do-not-import/procedureBuilder.ts",
@@ -475,21 +490,6 @@
475
490
  "percent": 0.78,
476
491
  "reduction": 0
477
492
  },
478
- {
479
- "id": "/src/unstable-core-do-not-import/parser.ts",
480
- "size": 1034,
481
- "origSize": 2496,
482
- "renderedExports": [
483
- "getParseFn"
484
- ],
485
- "removedExports": [],
486
- "dependents": [
487
- "/src/unstable-core-do-not-import.ts",
488
- "/src/unstable-core-do-not-import/procedureBuilder.ts"
489
- ],
490
- "percent": 0.76,
491
- "reduction": 58.57
492
- },
493
493
  {
494
494
  "id": "/src/adapters/next-app-dir/redirect.ts",
495
495
  "size": 987,
@@ -727,24 +727,24 @@
727
727
  "reduction": 93.8
728
728
  },
729
729
  {
730
- "id": "/src/index.ts",
730
+ "id": "/src/http.ts",
731
731
  "size": 0,
732
- "origSize": 32,
732
+ "origSize": 37,
733
733
  "renderedExports": [],
734
734
  "removedExports": [],
735
- "dependents": [],
735
+ "dependents": [
736
+ "/src/adapters/ws.ts"
737
+ ],
736
738
  "percent": 0,
737
739
  "reduction": 100
738
740
  },
739
741
  {
740
- "id": "/src/http.ts",
742
+ "id": "/src/index.ts",
741
743
  "size": 0,
742
- "origSize": 37,
744
+ "origSize": 32,
743
745
  "renderedExports": [],
744
746
  "removedExports": [],
745
- "dependents": [
746
- "/src/adapters/ws.ts"
747
- ],
747
+ "dependents": [],
748
748
  "percent": 0,
749
749
  "reduction": 100
750
750
  },
@@ -10,6 +10,10 @@ export type ParserValibotEsque<TInput, TParsedInput> = {
10
10
  };
11
11
  };
12
12
  };
13
+ export type ParserArkTypeEsque<TInput, TParsedInput> = {
14
+ inferIn: TInput;
15
+ infer: TParsedInput;
16
+ };
13
17
  export type ParserMyZodEsque<TInput> = {
14
18
  parse: (input: any) => TInput;
15
19
  };
@@ -24,7 +28,7 @@ export type ParserScaleEsque<TInput> = {
24
28
  assert(value: unknown): asserts value is TInput;
25
29
  };
26
30
  export type ParserWithoutInput<TInput> = ParserCustomValidatorEsque<TInput> | ParserMyZodEsque<TInput> | ParserScaleEsque<TInput> | ParserSuperstructEsque<TInput> | ParserYupEsque<TInput>;
27
- export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput>;
31
+ export type ParserWithInputOutput<TInput, TParsedInput> = ParserZodEsque<TInput, TParsedInput> | ParserValibotEsque<TInput, TParsedInput> | ParserArkTypeEsque<TInput, TParsedInput>;
28
32
  export type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
29
33
  export type inferParser<TParser extends Parser> = TParser extends ParserWithInputOutput<infer $TIn, infer $TOut> ? {
30
34
  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,gBAAgB,CAAC,MAAM,IAAI;IACrC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,sBAAsB,CAAC,MAAM,IAAI;IAC3C,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,MAAM,IAAI,CA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kBAAkB,CAAC,MAAM,IACjC,0BAA0B,CAAC,MAAM,CAAC,GAClC,gBAAgB,CAAC,MAAM,CAAC,GACxB,gBAAgB,CAAC,MAAM,CAAC,GACxB,sBAAsB,CAAC,MAAM,CAAC,GAC9B,cAAc,CAAC,MAAM,CAAC,CAAC;AAE3B,MAAM,MAAM,qBAAqB,CAAC,MAAM,EAAE,YAAY,IAClD,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,GACpC,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,GACxC,kBAAkB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAE7C,MAAM,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAE/E,MAAM,MAAM,WAAW,CAAC,OAAO,SAAS,MAAM,IAC5C,OAAO,SAAS,qBAAqB,CAAC,MAAM,IAAI,EAAE,MAAM,KAAK,CAAC,GAC1D;IACE,EAAE,EAAE,IAAI,CAAC;IACT,GAAG,EAAE,KAAK,CAAC;CACZ,GACD,OAAO,SAAS,kBAAkB,CAAC,MAAM,MAAM,CAAC,GAChD;IACE,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;CACb,GACD,KAAK,CAAC;AAEZ,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,CA4CzE"}
@@ -3,6 +3,10 @@
3
3
  // zod / typeschema
4
4
  function getParseFn(procedureParser) {
5
5
  const parser = procedureParser;
6
+ if (typeof parser === 'function' && typeof parser.assert === 'function') {
7
+ // ParserArkTypeEsque - arktype schemas shouldn't be called as a function because they return a union type instead of throwing
8
+ return parser.assert.bind(parser);
9
+ }
6
10
  if (typeof parser === 'function') {
7
11
  // ParserValibotEsque (>= v0.31.0)
8
12
  // ParserCustomValidatorEsque
@@ -1,6 +1,10 @@
1
1
  // zod / typeschema
2
2
  function getParseFn(procedureParser) {
3
3
  const parser = procedureParser;
4
+ if (typeof parser === 'function' && typeof parser.assert === 'function') {
5
+ // ParserArkTypeEsque - arktype schemas shouldn't be called as a function because they return a union type instead of throwing
6
+ return parser.assert.bind(parser);
7
+ }
4
8
  if (typeof parser === 'function') {
5
9
  // ParserValibotEsque (>= v0.31.0)
6
10
  // ParserCustomValidatorEsque
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-rc.489+6b483e375",
3
+ "version": "11.0.0-rc.490+b6a851870",
4
4
  "description": "The tRPC server library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -149,5 +149,5 @@
149
149
  "funding": [
150
150
  "https://trpc.io/sponsor"
151
151
  ],
152
- "gitHead": "6b483e3752e666c3fb200f0234c1c8d10c89620e"
152
+ "gitHead": "b6a8518701f86b52d8b75e4a40e3567cc73ceb5d"
153
153
  }
@@ -13,6 +13,11 @@ export type ParserValibotEsque<TInput, TParsedInput> = {
13
13
  };
14
14
  };
15
15
 
16
+ export type ParserArkTypeEsque<TInput, TParsedInput> = {
17
+ inferIn: TInput;
18
+ infer: TParsedInput;
19
+ };
20
+
16
21
  export type ParserMyZodEsque<TInput> = {
17
22
  parse: (input: any) => TInput;
18
23
  };
@@ -42,7 +47,8 @@ export type ParserWithoutInput<TInput> =
42
47
 
43
48
  export type ParserWithInputOutput<TInput, TParsedInput> =
44
49
  | ParserZodEsque<TInput, TParsedInput>
45
- | ParserValibotEsque<TInput, TParsedInput>;
50
+ | ParserValibotEsque<TInput, TParsedInput>
51
+ | ParserArkTypeEsque<TInput, TParsedInput>;
46
52
 
47
53
  export type Parser = ParserWithInputOutput<any, any> | ParserWithoutInput<any>;
48
54
 
@@ -64,6 +70,11 @@ export type ParseFn<TType> = (value: unknown) => Promise<TType> | TType;
64
70
  export function getParseFn<TType>(procedureParser: Parser): ParseFn<TType> {
65
71
  const parser = procedureParser as any;
66
72
 
73
+ if (typeof parser === 'function' && typeof parser.assert === 'function') {
74
+ // ParserArkTypeEsque - arktype schemas shouldn't be called as a function because they return a union type instead of throwing
75
+ return parser.assert.bind(parser);
76
+ }
77
+
67
78
  if (typeof parser === 'function') {
68
79
  // ParserValibotEsque (>= v0.31.0)
69
80
  // ParserCustomValidatorEsque