@trpc/server 11.0.0-rc.487 → 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.
- package/dist/bundle-analysis.json +47 -47
- package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/resolveResponse.js +3 -0
- package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +3 -0
- package/dist/unstable-core-do-not-import/parser.d.ts +5 -1
- package/dist/unstable-core-do-not-import/parser.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/parser.js +4 -0
- package/dist/unstable-core-do-not-import/parser.mjs +4 -0
- package/package.json +2 -2
- package/src/unstable-core-do-not-import/http/resolveResponse.ts +4 -0
- package/src/unstable-core-do-not-import/parser.ts +12 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 26.
|
|
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",
|
|
8
|
-
"size":
|
|
9
|
-
"origSize":
|
|
8
|
+
"size": 17866,
|
|
9
|
+
"origSize": 16731,
|
|
10
10
|
"renderedExports": [
|
|
11
11
|
"resolveResponse"
|
|
12
12
|
],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"dependents": [
|
|
15
15
|
"/src/unstable-core-do-not-import.ts"
|
|
16
16
|
],
|
|
17
|
-
"percent": 13.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
83
|
+
"percent": 4.7,
|
|
84
84
|
"reduction": 39.77
|
|
85
85
|
},
|
|
86
86
|
{
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"/src/unstable-core-do-not-import.ts",
|
|
96
96
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
97
97
|
],
|
|
98
|
-
"percent": 4.
|
|
98
|
+
"percent": 4.66,
|
|
99
99
|
"reduction": 60.09
|
|
100
100
|
},
|
|
101
101
|
{
|
|
@@ -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.
|
|
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":
|
|
129
|
+
"percent": 3.99,
|
|
130
130
|
"reduction": 11.38
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
147
147
|
"/src/observable/operators.ts"
|
|
148
148
|
],
|
|
149
|
-
"percent": 3.
|
|
149
|
+
"percent": 3.03,
|
|
150
150
|
"reduction": 0
|
|
151
151
|
},
|
|
152
152
|
{
|
|
@@ -224,7 +224,7 @@
|
|
|
224
224
|
"dependents": [
|
|
225
225
|
"/src/unstable-core-do-not-import.ts"
|
|
226
226
|
],
|
|
227
|
-
"percent":
|
|
227
|
+
"percent": 1.99,
|
|
228
228
|
"reduction": 40.91
|
|
229
229
|
},
|
|
230
230
|
{
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
292
|
+
"percent": 1.61,
|
|
293
293
|
"reduction": 13.79
|
|
294
294
|
},
|
|
295
295
|
{
|
|
@@ -395,9 +395,24 @@
|
|
|
395
395
|
"/src/unstable-core-do-not-import/http/resolveResponse.ts",
|
|
396
396
|
"/src/unstable-core-do-not-import/error/getErrorShape.ts"
|
|
397
397
|
],
|
|
398
|
-
"percent": 1
|
|
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,
|
|
@@ -442,7 +457,7 @@
|
|
|
442
457
|
"/src/adapters/fastify/index.ts",
|
|
443
458
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
444
459
|
],
|
|
445
|
-
"percent": 0.
|
|
460
|
+
"percent": 0.83,
|
|
446
461
|
"reduction": 47.59
|
|
447
462
|
},
|
|
448
463
|
{
|
|
@@ -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,
|
|
@@ -522,7 +522,7 @@
|
|
|
522
522
|
"/src/unstable-core-do-not-import/stream/sse.ts",
|
|
523
523
|
"/src/unstable-core-do-not-import/stream/utils/createReadableStream.ts"
|
|
524
524
|
],
|
|
525
|
-
"percent": 0.
|
|
525
|
+
"percent": 0.72,
|
|
526
526
|
"reduction": 15.69
|
|
527
527
|
},
|
|
528
528
|
{
|
|
@@ -723,7 +723,7 @@
|
|
|
723
723
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
724
724
|
"/src/unstable-core-do-not-import/router.ts"
|
|
725
725
|
],
|
|
726
|
-
"percent": 0.
|
|
726
|
+
"percent": 0.04,
|
|
727
727
|
"reduction": 93.8
|
|
728
728
|
},
|
|
729
729
|
{
|
|
@@ -759,25 +759,25 @@
|
|
|
759
759
|
"reduction": 100
|
|
760
760
|
},
|
|
761
761
|
{
|
|
762
|
-
"id": "/src/
|
|
762
|
+
"id": "/src/shared.ts",
|
|
763
763
|
"size": 0,
|
|
764
|
-
"origSize":
|
|
764
|
+
"origSize": 653,
|
|
765
765
|
"renderedExports": [],
|
|
766
766
|
"removedExports": [],
|
|
767
|
-
"dependents": [
|
|
768
|
-
"/src/adapters/ws.ts",
|
|
769
|
-
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
770
|
-
],
|
|
767
|
+
"dependents": [],
|
|
771
768
|
"percent": 0,
|
|
772
769
|
"reduction": 100
|
|
773
770
|
},
|
|
774
771
|
{
|
|
775
|
-
"id": "/src/
|
|
772
|
+
"id": "/src/unstable-core-do-not-import.ts",
|
|
776
773
|
"size": 0,
|
|
777
|
-
"origSize":
|
|
774
|
+
"origSize": 2306,
|
|
778
775
|
"renderedExports": [],
|
|
779
776
|
"removedExports": [],
|
|
780
|
-
"dependents": [
|
|
777
|
+
"dependents": [
|
|
778
|
+
"/src/adapters/ws.ts",
|
|
779
|
+
"/src/adapters/next-app-dir/nextAppDirCaller.ts"
|
|
780
|
+
],
|
|
781
781
|
"percent": 0,
|
|
782
782
|
"reduction": 100
|
|
783
783
|
},
|
|
@@ -831,8 +831,8 @@
|
|
|
831
831
|
"removedExports": [],
|
|
832
832
|
"dependents": [
|
|
833
833
|
"/src/adapters/express.ts",
|
|
834
|
-
"/src/adapters/standalone.ts",
|
|
835
834
|
"/src/adapters/next.ts",
|
|
835
|
+
"/src/adapters/standalone.ts",
|
|
836
836
|
"/src/adapters/fastify/fastifyRequestHandler.ts"
|
|
837
837
|
],
|
|
838
838
|
"percent": 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CAianB"}
|
|
@@ -276,6 +276,9 @@ async function resolveResponse(opts) {
|
|
|
276
276
|
message: 'Missing experimental flag "sseSubscriptions"'
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
+
if (error) {
|
|
280
|
+
throw error;
|
|
281
|
+
}
|
|
279
282
|
if (!observable.isObservable(data) && !utils.isAsyncIterable(data)) {
|
|
280
283
|
throw new TRPCError.TRPCError({
|
|
281
284
|
message: `Subscription ${call.path} did not return an observable or a AsyncGenerator`,
|
|
@@ -274,6 +274,9 @@ async function resolveResponse(opts) {
|
|
|
274
274
|
message: 'Missing experimental flag "sseSubscriptions"'
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
|
+
if (error) {
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
277
280
|
if (!isObservable(data) && !isAsyncIterable(data)) {
|
|
278
281
|
throw new TRPCError({
|
|
279
282
|
message: `Subscription ${call.path} did not return an observable or a AsyncGenerator`,
|
|
@@ -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,E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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.
|
|
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": "
|
|
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
|