@trpc/server 11.0.0-next.322 → 11.0.0-next.323
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 +36 -35
- package/dist/unstable-core-do-not-import/http/index.d.ts +5 -1
- package/dist/unstable-core-do-not-import/http/index.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/types.d.ts +7 -10
- package/dist/unstable-core-do-not-import/http/types.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +2 -2
- package/dist/unstable-core-do-not-import/procedure.d.ts +11 -0
- package/dist/unstable-core-do-not-import/procedure.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/router.d.ts +9 -3
- package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/router.js +18 -23
- package/dist/unstable-core-do-not-import/router.mjs +20 -25
- package/dist/unstable-core-do-not-import/utils.d.ts +3 -0
- package/dist/unstable-core-do-not-import/utils.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/utils.js +4 -0
- package/dist/unstable-core-do-not-import/utils.mjs +4 -1
- package/dist/unstable-core-do-not-import.js +1 -0
- package/dist/unstable-core-do-not-import.mjs +1 -1
- package/package.json +2 -2
- package/src/unstable-core-do-not-import/http/index.ts +5 -1
- package/src/unstable-core-do-not-import/http/types.ts +9 -10
- package/src/unstable-core-do-not-import/procedure.ts +12 -0
- package/src/unstable-core-do-not-import/router.ts +45 -32
- package/src/unstable-core-do-not-import/utils.ts +5 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"bundleSize":
|
|
3
|
-
"bundleOrigSize":
|
|
4
|
-
"bundleReduction": 38.
|
|
2
|
+
"bundleSize": 92876,
|
|
3
|
+
"bundleOrigSize": 150623,
|
|
4
|
+
"bundleReduction": 38.34,
|
|
5
5
|
"modules": [
|
|
6
6
|
{
|
|
7
7
|
"id": "/src/adapters/ws.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"dependents": [
|
|
16
16
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
17
17
|
],
|
|
18
|
-
"percent": 10.
|
|
18
|
+
"percent": 10.95,
|
|
19
19
|
"reduction": 0
|
|
20
20
|
},
|
|
21
21
|
{
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"removedExports": [],
|
|
29
29
|
"dependents": [],
|
|
30
|
-
"percent": 10.
|
|
30
|
+
"percent": 10.2,
|
|
31
31
|
"reduction": 20.86
|
|
32
32
|
},
|
|
33
33
|
{
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"/src/unstable-core-do-not-import.ts",
|
|
44
44
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
45
45
|
],
|
|
46
|
-
"percent": 6.
|
|
46
|
+
"percent": 6.69,
|
|
47
47
|
"reduction": 60.6
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"id": "/src/unstable-core-do-not-import/router.ts",
|
|
51
|
-
"size":
|
|
52
|
-
"origSize":
|
|
51
|
+
"size": 5831,
|
|
52
|
+
"origSize": 9972,
|
|
53
53
|
"renderedExports": [
|
|
54
54
|
"createRouterFactory",
|
|
55
55
|
"callProcedure",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
|
|
63
63
|
"/src/unstable-core-do-not-import/initTRPC.ts"
|
|
64
64
|
],
|
|
65
|
-
"percent": 6.
|
|
66
|
-
"reduction":
|
|
65
|
+
"percent": 6.28,
|
|
66
|
+
"reduction": 41.53
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
"id": "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"dependents": [
|
|
79
79
|
"/src/adapters/node-http/content-type/form-data/index.ts"
|
|
80
80
|
],
|
|
81
|
-
"percent": 5.
|
|
81
|
+
"percent": 5.36,
|
|
82
82
|
"reduction": 38
|
|
83
83
|
},
|
|
84
84
|
{
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
],
|
|
93
93
|
"removedExports": [],
|
|
94
94
|
"dependents": [],
|
|
95
|
-
"percent": 4.
|
|
95
|
+
"percent": 4.76,
|
|
96
96
|
"reduction": 32.71
|
|
97
97
|
},
|
|
98
98
|
{
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"/src/observable/index.ts",
|
|
157
157
|
"/src/observable/operators.ts"
|
|
158
158
|
],
|
|
159
|
-
"percent": 3.
|
|
159
|
+
"percent": 3.37,
|
|
160
160
|
"reduction": 0.67
|
|
161
161
|
},
|
|
162
162
|
{
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"dependents": [
|
|
171
171
|
"/src/unstable-core-do-not-import.ts"
|
|
172
172
|
],
|
|
173
|
-
"percent": 3.
|
|
173
|
+
"percent": 3.02,
|
|
174
174
|
"reduction": 40.26
|
|
175
175
|
},
|
|
176
176
|
{
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"dependents": [
|
|
187
187
|
"/src/observable/index.ts"
|
|
188
188
|
],
|
|
189
|
-
"percent": 2.
|
|
189
|
+
"percent": 2.97,
|
|
190
190
|
"reduction": 0
|
|
191
191
|
},
|
|
192
192
|
{
|
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
"/src/unstable-core-do-not-import/initTRPC.ts",
|
|
227
227
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
228
228
|
],
|
|
229
|
-
"percent": 2.
|
|
229
|
+
"percent": 2.83,
|
|
230
230
|
"reduction": 55.5
|
|
231
231
|
},
|
|
232
232
|
{
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"/src/adapters/fastify/index.ts",
|
|
242
242
|
"/src/adapters/fastify/fastifyTRPCPlugin.ts"
|
|
243
243
|
],
|
|
244
|
-
"percent": 2.
|
|
244
|
+
"percent": 2.67,
|
|
245
245
|
"reduction": 36.53
|
|
246
246
|
},
|
|
247
247
|
{
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
"/src/unstable-core-do-not-import/middleware.ts",
|
|
275
275
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
276
276
|
],
|
|
277
|
-
"percent": 1.
|
|
277
|
+
"percent": 1.87,
|
|
278
278
|
"reduction": 19.47
|
|
279
279
|
},
|
|
280
280
|
{
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
"dependents": [
|
|
289
289
|
"/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts"
|
|
290
290
|
],
|
|
291
|
-
"percent": 1.
|
|
291
|
+
"percent": 1.77,
|
|
292
292
|
"reduction": 34.79
|
|
293
293
|
},
|
|
294
294
|
{
|
|
@@ -420,11 +420,12 @@
|
|
|
420
420
|
},
|
|
421
421
|
{
|
|
422
422
|
"id": "/src/unstable-core-do-not-import/utils.ts",
|
|
423
|
-
"size":
|
|
424
|
-
"origSize":
|
|
423
|
+
"size": 880,
|
|
424
|
+
"origSize": 1151,
|
|
425
425
|
"renderedExports": [
|
|
426
426
|
"mergeWithoutOverrides",
|
|
427
427
|
"isObject",
|
|
428
|
+
"isFunction",
|
|
428
429
|
"omitPrototype"
|
|
429
430
|
],
|
|
430
431
|
"removedExports": [],
|
|
@@ -437,8 +438,8 @@
|
|
|
437
438
|
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts",
|
|
438
439
|
"/src/unstable-core-do-not-import/procedureBuilder.ts"
|
|
439
440
|
],
|
|
440
|
-
"percent": 0.
|
|
441
|
-
"reduction":
|
|
441
|
+
"percent": 0.95,
|
|
442
|
+
"reduction": 23.54
|
|
442
443
|
},
|
|
443
444
|
{
|
|
444
445
|
"id": "/src/adapters/node-http/content-type/form-data/uploadHandler.ts",
|
|
@@ -538,7 +539,7 @@
|
|
|
538
539
|
],
|
|
539
540
|
"removedExports": [],
|
|
540
541
|
"dependents": [],
|
|
541
|
-
"percent": 0.
|
|
542
|
+
"percent": 0.37,
|
|
542
543
|
"reduction": 71.37
|
|
543
544
|
},
|
|
544
545
|
{
|
|
@@ -599,7 +600,7 @@
|
|
|
599
600
|
{
|
|
600
601
|
"id": "/src/unstable-core-do-not-import/procedure.ts",
|
|
601
602
|
"size": 75,
|
|
602
|
-
"origSize":
|
|
603
|
+
"origSize": 2390,
|
|
603
604
|
"renderedExports": [
|
|
604
605
|
"procedureTypes"
|
|
605
606
|
],
|
|
@@ -609,7 +610,7 @@
|
|
|
609
610
|
"/src/unstable-core-do-not-import/rpc/parseTRPCMessage.ts"
|
|
610
611
|
],
|
|
611
612
|
"percent": 0.08,
|
|
612
|
-
"reduction": 96.
|
|
613
|
+
"reduction": 96.86
|
|
613
614
|
},
|
|
614
615
|
{
|
|
615
616
|
"id": "/src/unstable-core-do-not-import/error/formatter.ts",
|
|
@@ -658,9 +659,9 @@
|
|
|
658
659
|
"reduction": 100
|
|
659
660
|
},
|
|
660
661
|
{
|
|
661
|
-
"id": "/src/
|
|
662
|
+
"id": "/src/unstable-core-do-not-import.ts",
|
|
662
663
|
"size": 0,
|
|
663
|
-
"origSize":
|
|
664
|
+
"origSize": 1552,
|
|
664
665
|
"renderedExports": [],
|
|
665
666
|
"removedExports": [],
|
|
666
667
|
"dependents": [],
|
|
@@ -668,9 +669,9 @@
|
|
|
668
669
|
"reduction": 100
|
|
669
670
|
},
|
|
670
671
|
{
|
|
671
|
-
"id": "/src/
|
|
672
|
+
"id": "/src/shared.ts",
|
|
672
673
|
"size": 0,
|
|
673
|
-
"origSize":
|
|
674
|
+
"origSize": 653,
|
|
674
675
|
"renderedExports": [],
|
|
675
676
|
"removedExports": [],
|
|
676
677
|
"dependents": [],
|
|
@@ -690,9 +691,9 @@
|
|
|
690
691
|
"reduction": 100
|
|
691
692
|
},
|
|
692
693
|
{
|
|
693
|
-
"id": "/src/adapters/
|
|
694
|
+
"id": "/src/adapters/fastify/index.ts",
|
|
694
695
|
"size": 0,
|
|
695
|
-
"origSize":
|
|
696
|
+
"origSize": 78,
|
|
696
697
|
"renderedExports": [],
|
|
697
698
|
"removedExports": [],
|
|
698
699
|
"dependents": [],
|
|
@@ -700,9 +701,9 @@
|
|
|
700
701
|
"reduction": 100
|
|
701
702
|
},
|
|
702
703
|
{
|
|
703
|
-
"id": "/src/adapters/
|
|
704
|
+
"id": "/src/adapters/fetch/index.ts",
|
|
704
705
|
"size": 0,
|
|
705
|
-
"origSize":
|
|
706
|
+
"origSize": 64,
|
|
706
707
|
"renderedExports": [],
|
|
707
708
|
"removedExports": [],
|
|
708
709
|
"dependents": [],
|
|
@@ -716,8 +717,8 @@
|
|
|
716
717
|
"renderedExports": [],
|
|
717
718
|
"removedExports": [],
|
|
718
719
|
"dependents": [
|
|
719
|
-
"/src/adapters/next.ts",
|
|
720
720
|
"/src/adapters/express.ts",
|
|
721
|
+
"/src/adapters/next.ts",
|
|
721
722
|
"/src/adapters/standalone.ts"
|
|
722
723
|
],
|
|
723
724
|
"percent": 0,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export { getHTTPStatusCode, getHTTPStatusCodeFromError, } from './getHTTPStatusCode';
|
|
2
2
|
export { resolveHTTPResponse } from './resolveHTTPResponse';
|
|
3
|
-
export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPHeaders, HTTPRequest, HTTPResponse,
|
|
3
|
+
export type { BaseHandlerOptions, HTTPBaseHandlerOptions, HTTPHeaders, HTTPRequest, HTTPResponse,
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use `HTTPErrorHandler` instead
|
|
6
|
+
*/
|
|
7
|
+
HTTPErrorHandler as OnErrorFunction, HTTPErrorHandler, ProcedureCall, ResolveHTTPRequestOptionsContextFn, ResponseChunk, ResponseMeta, ResponseMetaFn, TRPCRequestInfo, } from './types';
|
|
4
8
|
export { getBatchStreamFormatter } from './batchStreamFormatter';
|
|
5
9
|
export type { BaseContentTypeHandler, BodyResult } from './contentType';
|
|
6
10
|
export { getJsonContentTypeInputs } from './contentType';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,YAAY;AACZ;;GAEG;AACH,gBAAgB,IAAI,eAAe,EACnC,gBAAgB,EAChB,aAAa,EACb,kCAAkC,EAClC,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,YAAY,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TRPCError } from '../error/TRPCError';
|
|
2
|
-
import type { ProcedureType } from '../procedure';
|
|
2
|
+
import type { ErrorHandlerOptions, ProcedureType } from '../procedure';
|
|
3
3
|
import type { AnyRouter, inferRouterContext, inferRouterError } from '../router';
|
|
4
4
|
import type { TRPCResponse } from '../rpc';
|
|
5
5
|
import type { Dict } from '../types';
|
|
@@ -71,23 +71,19 @@ export type TRPCRequestInfo = {
|
|
|
71
71
|
export type ResolveHTTPRequestOptionsContextFn<TRouter extends AnyRouter> = (opts: {
|
|
72
72
|
info: TRPCRequestInfo;
|
|
73
73
|
}) => Promise<inferRouterContext<TRouter>>;
|
|
74
|
+
interface HTTPErrorHandlerOptions<TRouter extends AnyRouter, TRequest> extends ErrorHandlerOptions<inferRouterContext<TRouter>> {
|
|
75
|
+
req: TRequest;
|
|
76
|
+
}
|
|
74
77
|
/**
|
|
75
78
|
* @internal
|
|
76
79
|
*/
|
|
77
|
-
export type
|
|
78
|
-
error: TRPCError;
|
|
79
|
-
type: ProcedureType | 'unknown';
|
|
80
|
-
path: string | undefined;
|
|
81
|
-
req: TRequest;
|
|
82
|
-
input: unknown;
|
|
83
|
-
ctx: inferRouterContext<TRouter> | undefined;
|
|
84
|
-
}) => void;
|
|
80
|
+
export type HTTPErrorHandler<TRouter extends AnyRouter, TRequest> = (opts: HTTPErrorHandlerOptions<TRouter, TRequest>) => void;
|
|
85
81
|
/**
|
|
86
82
|
* Base interface for any response handler
|
|
87
83
|
* @internal
|
|
88
84
|
*/
|
|
89
85
|
export interface BaseHandlerOptions<TRouter extends AnyRouter, TRequest> {
|
|
90
|
-
onError?:
|
|
86
|
+
onError?: HTTPErrorHandler<TRouter, TRequest>;
|
|
91
87
|
/**
|
|
92
88
|
* @deprecated use `allowBatching` instead, this will be removed in v12
|
|
93
89
|
*/
|
|
@@ -109,4 +105,5 @@ export interface BaseHandlerOptions<TRouter extends AnyRouter, TRequest> {
|
|
|
109
105
|
*/
|
|
110
106
|
allowBatching?: boolean;
|
|
111
107
|
}
|
|
108
|
+
export {};
|
|
112
109
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MA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AM,WAAW,kBAAkB,CAAC,OAAO,SAAS,SAAS,EAAE,QAAQ;IACrE,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT;;WAEG;QACH,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -80,12 +80,12 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
|
|
|
80
80
|
* Create a server-side caller for a router
|
|
81
81
|
* @link https://trpc.io/docs/v11/server/server-side-calls
|
|
82
82
|
*/
|
|
83
|
-
createCallerFactory: <TRecord extends import("./router").RouterRecord>(router: import("./router").Router<{
|
|
83
|
+
createCallerFactory: <TRecord extends import("./router").RouterRecord>(router: Pick<import("./router").Router<{
|
|
84
84
|
ctx: TContext;
|
|
85
85
|
meta: TMeta;
|
|
86
86
|
errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
|
|
87
87
|
transformer: undefined extends TOptions['transformer'] ? false : true;
|
|
88
|
-
}, TRecord>) => import("./router").RouterCaller<{
|
|
88
|
+
}, TRecord>, "_def">) => import("./router").RouterCaller<{
|
|
89
89
|
ctx: TContext;
|
|
90
90
|
meta: TMeta;
|
|
91
91
|
errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TRPCError } from './error/TRPCError';
|
|
1
2
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
2
3
|
export declare const procedureTypes: readonly ["query", "mutation", "subscription"];
|
|
3
4
|
/**
|
|
@@ -54,5 +55,15 @@ export type AnyProcedure = Procedure<ProcedureType, any>;
|
|
|
54
55
|
export type inferProcedureInput<TProcedure extends AnyProcedure> = undefined extends inferProcedureParams<TProcedure>['_input_in'] ? void | inferProcedureParams<TProcedure>['_input_in'] : inferProcedureParams<TProcedure>['_input_in'];
|
|
55
56
|
export type inferProcedureParams<TProcedure> = TProcedure extends AnyProcedure ? TProcedure['_def'] : never;
|
|
56
57
|
export type inferProcedureOutput<TProcedure> = inferProcedureParams<TProcedure>['_output_out'];
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export interface ErrorHandlerOptions<TContext> {
|
|
62
|
+
error: TRPCError;
|
|
63
|
+
type: ProcedureType | 'unknown';
|
|
64
|
+
path: string | undefined;
|
|
65
|
+
input: unknown;
|
|
66
|
+
ctx: TContext | undefined;
|
|
67
|
+
}
|
|
57
68
|
export {};
|
|
58
69
|
//# sourceMappingURL=procedure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedure.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,eAAO,MAAM,cAAc,gDAAiD,CAAC;AAC7E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5D,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,IAAI,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS,C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K,CAAC;AACV,MAAM,MAAM,oBAAoB,CAAC,UAAU,IACzC,oBAAoB,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,QAAQ;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Observable } from '../observable';
|
|
2
2
|
import { TRPCError } from './error/TRPCError';
|
|
3
|
-
import type { AnyProcedure, inferProcedureInput } from './procedure';
|
|
3
|
+
import type { AnyProcedure, ErrorHandlerOptions, inferProcedureInput } from './procedure';
|
|
4
4
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
5
5
|
import type { AnyRootTypes, RootConfig } from './rootConfig';
|
|
6
6
|
import type { MaybePromise } from './types';
|
|
@@ -14,6 +14,10 @@ type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedure
|
|
|
14
14
|
export type DecorateRouterRecord<TRecord extends RouterRecord> = {
|
|
15
15
|
[TKey in keyof TRecord]: TRecord[TKey] extends AnyProcedure ? DecorateProcedure<TRecord[TKey]> : TRecord[TKey] extends RouterRecord ? DecorateRouterRecord<TRecord[TKey]> : never;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export type RouterCallerErrorHandler<TContext> = (opts: ErrorHandlerOptions<TContext>) => void;
|
|
17
21
|
/**
|
|
18
22
|
* @internal
|
|
19
23
|
*/
|
|
@@ -23,7 +27,9 @@ export type RouterCaller<TRoot extends AnyRootTypes, TRecord extends RouterRecor
|
|
|
23
27
|
* If passing a function, we recommend it's a cached function
|
|
24
28
|
* e.g. wrapped in `React.cache` to avoid unnecessary computations
|
|
25
29
|
*/
|
|
26
|
-
ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>)
|
|
30
|
+
ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>), options?: {
|
|
31
|
+
onError?: RouterCallerErrorHandler<TRoot['ctx']>;
|
|
32
|
+
}) => DecorateRouterRecord<TRecord>;
|
|
27
33
|
export interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
|
|
28
34
|
_def: {
|
|
29
35
|
_config: RootConfig<TRoot>;
|
|
@@ -64,7 +70,7 @@ export declare function callProcedure(opts: ProcedureCallOptions & {
|
|
|
64
70
|
procedures: RouterRecord;
|
|
65
71
|
allowMethodOverride?: boolean;
|
|
66
72
|
}): Promise<any>;
|
|
67
|
-
export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <TRecord extends RouterRecord>(router: Router<TRoot, TRecord>) => RouterCaller<TRoot, TRecord>;
|
|
73
|
+
export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <TRecord extends RouterRecord>(router: Pick<Router<TRoot, TRecord>, '_def'>) => RouterCaller<TRoot, TRecord>;
|
|
68
74
|
/** @internal */
|
|
69
75
|
type MergeRouters<TRouters extends AnyRouter[], TRoot extends AnyRootTypes = TRouters[0]['_def']['_config']['$types'], TRecord extends RouterRecord = {}> = TRouters extends [
|
|
70
76
|
infer Head extends AnyRouter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAA2B,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACv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YAAY,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,GAC3D,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAEhC,wBAAgB,YAAY,CAAC,QAAQ,SAAS,SAAS,EAAE,EACvD,GAAG,UAAU,EAAE,CAAC,GAAG,QAAQ,CAAC,GAC3B,YAAY,CAAC,QAAQ,CAAC,CAoDxB"}
|
|
@@ -77,19 +77,9 @@ const emptyRouter = {
|
|
|
77
77
|
return {
|
|
78
78
|
...record,
|
|
79
79
|
_def,
|
|
80
|
-
createCaller (
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const procedure = _def.procedures[fullPath];
|
|
84
|
-
return procedure({
|
|
85
|
-
path: fullPath,
|
|
86
|
-
getRawInput: async ()=>args[0],
|
|
87
|
-
ctx,
|
|
88
|
-
type: procedure._def.type
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
return proxy;
|
|
92
|
-
}
|
|
80
|
+
createCaller: createCallerFactory()({
|
|
81
|
+
_def
|
|
82
|
+
})
|
|
93
83
|
};
|
|
94
84
|
}
|
|
95
85
|
return createRouterInner;
|
|
@@ -113,24 +103,29 @@ function isProcedure(procedureOrRouter) {
|
|
|
113
103
|
function createCallerFactory() {
|
|
114
104
|
return function createCallerInner(router) {
|
|
115
105
|
const _def = router._def;
|
|
116
|
-
return function createCaller(
|
|
117
|
-
const proxy = createProxy.createRecursiveProxy(({ path , args })=>{
|
|
106
|
+
return function createCaller(ctxOrCallback, options) {
|
|
107
|
+
const proxy = createProxy.createRecursiveProxy(async ({ path , args })=>{
|
|
118
108
|
const fullPath = path.join('.');
|
|
119
109
|
const procedure = _def.procedures[fullPath];
|
|
120
|
-
|
|
110
|
+
let ctx = undefined;
|
|
111
|
+
try {
|
|
112
|
+
ctx = utils.isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
|
|
113
|
+
return await procedure({
|
|
121
114
|
path: fullPath,
|
|
122
115
|
getRawInput: async ()=>args[0],
|
|
123
116
|
ctx,
|
|
124
117
|
type: procedure._def.type
|
|
125
118
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
119
|
+
} catch (cause) {
|
|
120
|
+
options?.onError?.({
|
|
121
|
+
ctx,
|
|
122
|
+
error: TRPCError.getTRPCErrorFromUnknown(cause),
|
|
123
|
+
input: args[0],
|
|
124
|
+
path: fullPath,
|
|
125
|
+
type: procedure._def.type
|
|
126
|
+
});
|
|
127
|
+
throw cause;
|
|
132
128
|
}
|
|
133
|
-
return callProc(maybeContext);
|
|
134
129
|
});
|
|
135
130
|
return proxy;
|
|
136
131
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRecursiveProxy } from './createProxy.mjs';
|
|
2
2
|
import { defaultFormatter } from './error/formatter.mjs';
|
|
3
|
-
import { TRPCError } from './error/TRPCError.mjs';
|
|
3
|
+
import { TRPCError, getTRPCErrorFromUnknown } from './error/TRPCError.mjs';
|
|
4
4
|
import { defaultTransformer } from './transformer.mjs';
|
|
5
|
-
import { mergeWithoutOverrides, omitPrototype } from './utils.mjs';
|
|
5
|
+
import { mergeWithoutOverrides, omitPrototype, isFunction } from './utils.mjs';
|
|
6
6
|
|
|
7
7
|
function isRouter(procedureOrRouter) {
|
|
8
8
|
return procedureOrRouter._def && 'router' in procedureOrRouter._def;
|
|
@@ -75,19 +75,9 @@ const emptyRouter = {
|
|
|
75
75
|
return {
|
|
76
76
|
...record,
|
|
77
77
|
_def,
|
|
78
|
-
createCaller (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const procedure = _def.procedures[fullPath];
|
|
82
|
-
return procedure({
|
|
83
|
-
path: fullPath,
|
|
84
|
-
getRawInput: async ()=>args[0],
|
|
85
|
-
ctx,
|
|
86
|
-
type: procedure._def.type
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
return proxy;
|
|
90
|
-
}
|
|
78
|
+
createCaller: createCallerFactory()({
|
|
79
|
+
_def
|
|
80
|
+
})
|
|
91
81
|
};
|
|
92
82
|
}
|
|
93
83
|
return createRouterInner;
|
|
@@ -111,24 +101,29 @@ function isProcedure(procedureOrRouter) {
|
|
|
111
101
|
function createCallerFactory() {
|
|
112
102
|
return function createCallerInner(router) {
|
|
113
103
|
const _def = router._def;
|
|
114
|
-
return function createCaller(
|
|
115
|
-
const proxy = createRecursiveProxy(({ path , args })=>{
|
|
104
|
+
return function createCaller(ctxOrCallback, options) {
|
|
105
|
+
const proxy = createRecursiveProxy(async ({ path , args })=>{
|
|
116
106
|
const fullPath = path.join('.');
|
|
117
107
|
const procedure = _def.procedures[fullPath];
|
|
118
|
-
|
|
108
|
+
let ctx = undefined;
|
|
109
|
+
try {
|
|
110
|
+
ctx = isFunction(ctxOrCallback) ? await Promise.resolve(ctxOrCallback()) : ctxOrCallback;
|
|
111
|
+
return await procedure({
|
|
119
112
|
path: fullPath,
|
|
120
113
|
getRawInput: async ()=>args[0],
|
|
121
114
|
ctx,
|
|
122
115
|
type: procedure._def.type
|
|
123
116
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
117
|
+
} catch (cause) {
|
|
118
|
+
options?.onError?.({
|
|
119
|
+
ctx,
|
|
120
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
121
|
+
input: args[0],
|
|
122
|
+
path: fullPath,
|
|
123
|
+
type: procedure._def.type
|
|
124
|
+
});
|
|
125
|
+
throw cause;
|
|
130
126
|
}
|
|
131
|
-
return callProc(maybeContext);
|
|
132
127
|
});
|
|
133
128
|
return proxy;
|
|
134
129
|
};
|
|
@@ -8,9 +8,12 @@ export declare function mergeWithoutOverrides<TType extends Record<string, unkno
|
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
11
|
+
type AnyFn = (...args: any[]) => unknown;
|
|
12
|
+
export declare function isFunction(fn: unknown): fn is AnyFn;
|
|
11
13
|
/**
|
|
12
14
|
* Create an object without inheriting anything from `Object.prototype`
|
|
13
15
|
* @internal
|
|
14
16
|
*/
|
|
15
17
|
export declare function omitPrototype<TObj extends Record<string, unknown>>(obj: TObj): TObj;
|
|
18
|
+
export {};
|
|
16
19
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GACxB,KAAK,CAYP;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,GAAG,EAAE,IAAI,GACR,IAAI,CAEN"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzE,IAAI,EAAE,KAAK,EACX,GAAG,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,GACxB,KAAK,CAYP;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,KAAK,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AACzC,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,KAAK,CAEnD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,GAAG,EAAE,IAAI,GACR,IAAI,CAEN"}
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
*/ function isObject(value) {
|
|
22
22
|
return !!value && !Array.isArray(value) && typeof value === 'object';
|
|
23
23
|
}
|
|
24
|
+
function isFunction(fn) {
|
|
25
|
+
return typeof fn === 'function';
|
|
26
|
+
}
|
|
24
27
|
/**
|
|
25
28
|
* Create an object without inheriting anything from `Object.prototype`
|
|
26
29
|
* @internal
|
|
@@ -28,6 +31,7 @@
|
|
|
28
31
|
return Object.assign(Object.create(null), obj);
|
|
29
32
|
}
|
|
30
33
|
|
|
34
|
+
exports.isFunction = isFunction;
|
|
31
35
|
exports.isObject = isObject;
|
|
32
36
|
exports.mergeWithoutOverrides = mergeWithoutOverrides;
|
|
33
37
|
exports.omitPrototype = omitPrototype;
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
*/ function isObject(value) {
|
|
20
20
|
return !!value && !Array.isArray(value) && typeof value === 'object';
|
|
21
21
|
}
|
|
22
|
+
function isFunction(fn) {
|
|
23
|
+
return typeof fn === 'function';
|
|
24
|
+
}
|
|
22
25
|
/**
|
|
23
26
|
* Create an object without inheriting anything from `Object.prototype`
|
|
24
27
|
* @internal
|
|
@@ -26,4 +29,4 @@
|
|
|
26
29
|
return Object.assign(Object.create(null), obj);
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
export { isObject, mergeWithoutOverrides, omitPrototype };
|
|
32
|
+
export { isFunction, isObject, mergeWithoutOverrides, omitPrototype };
|
|
@@ -60,6 +60,7 @@ exports.getDataTransformer = transformer.getDataTransformer;
|
|
|
60
60
|
exports.transformResult = transformer.transformResult;
|
|
61
61
|
exports.transformTRPCResponse = transformer.transformTRPCResponse;
|
|
62
62
|
exports.ERROR_SYMBOL = types.ERROR_SYMBOL;
|
|
63
|
+
exports.isFunction = utils.isFunction;
|
|
63
64
|
exports.isObject = utils.isObject;
|
|
64
65
|
exports.mergeWithoutOverrides = utils.mergeWithoutOverrides;
|
|
65
66
|
exports.omitPrototype = utils.omitPrototype;
|
|
@@ -18,4 +18,4 @@ export { TRPC_ERROR_CODES_BY_KEY, TRPC_ERROR_CODES_BY_NUMBER } from './unstable-
|
|
|
18
18
|
export { parseTRPCMessage } from './unstable-core-do-not-import/rpc/parseTRPCMessage.mjs';
|
|
19
19
|
export { defaultTransformer, getDataTransformer, transformResult, transformTRPCResponse } from './unstable-core-do-not-import/transformer.mjs';
|
|
20
20
|
export { ERROR_SYMBOL } from './unstable-core-do-not-import/types.mjs';
|
|
21
|
-
export { isObject, mergeWithoutOverrides, omitPrototype } from './unstable-core-do-not-import/utils.mjs';
|
|
21
|
+
export { isFunction, isObject, mergeWithoutOverrides, omitPrototype } from './unstable-core-do-not-import/utils.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-next.
|
|
3
|
+
"version": "11.0.0-next.323+681d94abe",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -156,5 +156,5 @@
|
|
|
156
156
|
"funding": [
|
|
157
157
|
"https://trpc.io/sponsor"
|
|
158
158
|
],
|
|
159
|
-
"gitHead": "
|
|
159
|
+
"gitHead": "681d94abee8d7dcc90c77cb44c6ca54897be2079"
|
|
160
160
|
}
|
|
@@ -9,7 +9,11 @@ export type {
|
|
|
9
9
|
HTTPHeaders,
|
|
10
10
|
HTTPRequest,
|
|
11
11
|
HTTPResponse,
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `HTTPErrorHandler` instead
|
|
14
|
+
*/
|
|
15
|
+
HTTPErrorHandler as OnErrorFunction,
|
|
16
|
+
HTTPErrorHandler,
|
|
13
17
|
ProcedureCall,
|
|
14
18
|
ResolveHTTPRequestOptionsContextFn,
|
|
15
19
|
ResponseChunk,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TRPCError } from '../error/TRPCError';
|
|
2
|
-
import type { ProcedureType } from '../procedure';
|
|
2
|
+
import type { ErrorHandlerOptions, ProcedureType } from '../procedure';
|
|
3
3
|
import type {
|
|
4
4
|
AnyRouter,
|
|
5
5
|
inferRouterContext,
|
|
@@ -86,24 +86,23 @@ export type TRPCRequestInfo = {
|
|
|
86
86
|
export type ResolveHTTPRequestOptionsContextFn<TRouter extends AnyRouter> =
|
|
87
87
|
(opts: { info: TRPCRequestInfo }) => Promise<inferRouterContext<TRouter>>;
|
|
88
88
|
|
|
89
|
+
interface HTTPErrorHandlerOptions<TRouter extends AnyRouter, TRequest>
|
|
90
|
+
extends ErrorHandlerOptions<inferRouterContext<TRouter>> {
|
|
91
|
+
req: TRequest;
|
|
92
|
+
}
|
|
89
93
|
/**
|
|
90
94
|
* @internal
|
|
91
95
|
*/
|
|
92
|
-
export type
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
path: string | undefined;
|
|
96
|
-
req: TRequest;
|
|
97
|
-
input: unknown;
|
|
98
|
-
ctx: inferRouterContext<TRouter> | undefined;
|
|
99
|
-
}) => void;
|
|
96
|
+
export type HTTPErrorHandler<TRouter extends AnyRouter, TRequest> = (
|
|
97
|
+
opts: HTTPErrorHandlerOptions<TRouter, TRequest>,
|
|
98
|
+
) => void;
|
|
100
99
|
|
|
101
100
|
/**
|
|
102
101
|
* Base interface for any response handler
|
|
103
102
|
* @internal
|
|
104
103
|
*/
|
|
105
104
|
export interface BaseHandlerOptions<TRouter extends AnyRouter, TRequest> {
|
|
106
|
-
onError?:
|
|
105
|
+
onError?: HTTPErrorHandler<TRouter, TRequest>;
|
|
107
106
|
/**
|
|
108
107
|
* @deprecated use `allowBatching` instead, this will be removed in v12
|
|
109
108
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TRPCError } from './error/TRPCError';
|
|
1
2
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
2
3
|
|
|
3
4
|
export const procedureTypes = ['query', 'mutation', 'subscription'] as const;
|
|
@@ -80,3 +81,14 @@ export type inferProcedureParams<TProcedure> = TProcedure extends AnyProcedure
|
|
|
80
81
|
: never;
|
|
81
82
|
export type inferProcedureOutput<TProcedure> =
|
|
82
83
|
inferProcedureParams<TProcedure>['_output_out'];
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
export interface ErrorHandlerOptions<TContext> {
|
|
89
|
+
error: TRPCError;
|
|
90
|
+
type: ProcedureType | 'unknown';
|
|
91
|
+
path: string | undefined;
|
|
92
|
+
input: unknown;
|
|
93
|
+
ctx: TContext | undefined;
|
|
94
|
+
}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { Observable } from '../observable';
|
|
2
2
|
import { createRecursiveProxy } from './createProxy';
|
|
3
3
|
import { defaultFormatter } from './error/formatter';
|
|
4
|
-
import { TRPCError } from './error/TRPCError';
|
|
5
|
-
import type {
|
|
4
|
+
import { getTRPCErrorFromUnknown, TRPCError } from './error/TRPCError';
|
|
5
|
+
import type {
|
|
6
|
+
AnyProcedure,
|
|
7
|
+
ErrorHandlerOptions,
|
|
8
|
+
inferProcedureInput,
|
|
9
|
+
} from './procedure';
|
|
6
10
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
7
11
|
import type { AnyRootTypes, RootConfig } from './rootConfig';
|
|
8
12
|
import { defaultTransformer } from './transformer';
|
|
9
13
|
import type { MaybePromise, ValueOf } from './types';
|
|
10
|
-
import { mergeWithoutOverrides, omitPrototype } from './utils';
|
|
14
|
+
import { isFunction, mergeWithoutOverrides, omitPrototype } from './utils';
|
|
11
15
|
|
|
12
16
|
export interface RouterRecord {
|
|
13
17
|
[key: string]: AnyProcedure | RouterRecord;
|
|
@@ -32,6 +36,14 @@ export type DecorateRouterRecord<TRecord extends RouterRecord> = {
|
|
|
32
36
|
: never;
|
|
33
37
|
};
|
|
34
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export type RouterCallerErrorHandler<TContext> = (
|
|
44
|
+
opts: ErrorHandlerOptions<TContext>,
|
|
45
|
+
) => void;
|
|
46
|
+
|
|
35
47
|
/**
|
|
36
48
|
* @internal
|
|
37
49
|
*/
|
|
@@ -45,6 +57,9 @@ export type RouterCaller<
|
|
|
45
57
|
* e.g. wrapped in `React.cache` to avoid unnecessary computations
|
|
46
58
|
*/
|
|
47
59
|
ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>),
|
|
60
|
+
options?: {
|
|
61
|
+
onError?: RouterCallerErrorHandler<TRoot['ctx']>;
|
|
62
|
+
},
|
|
48
63
|
) => DecorateRouterRecord<TRecord>;
|
|
49
64
|
|
|
50
65
|
export interface Router<
|
|
@@ -191,21 +206,9 @@ export function createRouterFactory<TRoot extends AnyRootTypes>(
|
|
|
191
206
|
return {
|
|
192
207
|
...record,
|
|
193
208
|
_def,
|
|
194
|
-
createCaller
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const procedure = _def.procedures[fullPath] as AnyProcedure;
|
|
198
|
-
|
|
199
|
-
return procedure({
|
|
200
|
-
path: fullPath,
|
|
201
|
-
getRawInput: async () => args[0],
|
|
202
|
-
ctx,
|
|
203
|
-
type: procedure._def.type,
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
return proxy as ReturnType<RouterCaller<any, any>>;
|
|
208
|
-
},
|
|
209
|
+
createCaller: createCallerFactory<TRoot>()({
|
|
210
|
+
_def,
|
|
211
|
+
}),
|
|
209
212
|
};
|
|
210
213
|
}
|
|
211
214
|
|
|
@@ -244,34 +247,44 @@ export function callProcedure(
|
|
|
244
247
|
|
|
245
248
|
export function createCallerFactory<TRoot extends AnyRootTypes>() {
|
|
246
249
|
return function createCallerInner<TRecord extends RouterRecord>(
|
|
247
|
-
router: Router<TRoot, TRecord>,
|
|
250
|
+
router: Pick<Router<TRoot, TRecord>, '_def'>,
|
|
248
251
|
): RouterCaller<TRoot, TRecord> {
|
|
249
252
|
const _def = router._def;
|
|
250
253
|
type Context = TRoot['ctx'];
|
|
251
254
|
|
|
252
|
-
return function createCaller(
|
|
253
|
-
|
|
255
|
+
return function createCaller(
|
|
256
|
+
ctxOrCallback,
|
|
257
|
+
options?: {
|
|
258
|
+
onError?: RouterCallerErrorHandler<Context>;
|
|
259
|
+
},
|
|
260
|
+
) {
|
|
261
|
+
const proxy = createRecursiveProxy(async ({ path, args }) => {
|
|
254
262
|
const fullPath = path.join('.');
|
|
255
263
|
|
|
256
264
|
const procedure = _def.procedures[fullPath] as AnyProcedure;
|
|
257
265
|
|
|
258
|
-
|
|
259
|
-
|
|
266
|
+
let ctx: Context | undefined = undefined;
|
|
267
|
+
try {
|
|
268
|
+
ctx = isFunction(ctxOrCallback)
|
|
269
|
+
? await Promise.resolve(ctxOrCallback())
|
|
270
|
+
: ctxOrCallback;
|
|
271
|
+
|
|
272
|
+
return await procedure({
|
|
260
273
|
path: fullPath,
|
|
261
274
|
getRawInput: async () => args[0],
|
|
262
275
|
ctx,
|
|
263
276
|
type: procedure._def.type,
|
|
264
277
|
});
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
278
|
+
} catch (cause) {
|
|
279
|
+
options?.onError?.({
|
|
280
|
+
ctx,
|
|
281
|
+
error: getTRPCErrorFromUnknown(cause),
|
|
282
|
+
input: args[0],
|
|
283
|
+
path: fullPath,
|
|
284
|
+
type: procedure._def.type,
|
|
285
|
+
});
|
|
286
|
+
throw cause;
|
|
272
287
|
}
|
|
273
|
-
|
|
274
|
-
return callProc(maybeContext);
|
|
275
288
|
});
|
|
276
289
|
|
|
277
290
|
return proxy as ReturnType<RouterCaller<any, any>>;
|
|
@@ -27,6 +27,11 @@ export function isObject(value: unknown): value is Record<string, unknown> {
|
|
|
27
27
|
return !!value && !Array.isArray(value) && typeof value === 'object';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
type AnyFn = (...args: any[]) => unknown;
|
|
31
|
+
export function isFunction(fn: unknown): fn is AnyFn {
|
|
32
|
+
return typeof fn === 'function';
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
/**
|
|
31
36
|
* Create an object without inheriting anything from `Object.prototype`
|
|
32
37
|
* @internal
|