@trpc/server 11.0.0-next-beta.241 → 11.0.0-next-beta.248
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/@trpc/server/index.d.ts +1 -5
- package/dist/@trpc/server/index.d.ts.map +1 -1
- package/dist/adapters/node-http/content-type/form-data/index.js +2 -2
- package/dist/adapters/node-http/content-type/form-data/index.mjs +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
- package/dist/adapters/node-http/nodeHTTPRequestHandler.js +2 -0
- package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +2 -0
- package/dist/adapters/node-http/types.d.ts +3 -3
- package/dist/adapters/node-http/types.d.ts.map +1 -1
- package/dist/bundle-analysis.json +71 -129
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +2 -2
- package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +2 -2
- package/dist/unstable-core-do-not-import/index.d.ts +1 -1
- package/dist/unstable-core-do-not-import/index.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/initTRPC.d.ts +21 -8
- package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/router.d.ts +39 -47
- package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/router.js +39 -22
- package/dist/unstable-core-do-not-import/router.mjs +40 -23
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts +1 -2
- package/dist/unstable-core-do-not-import/rpc/codes.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +1 -1
- package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -1
- package/dist/unstable-core-do-not-import/transformer.d.ts +1 -1
- package/dist/unstable-core-do-not-import/types.d.ts +1 -0
- package/dist/unstable-core-do-not-import/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/@trpc/server/index.ts +1 -5
- package/src/adapters/node-http/nodeHTTPRequestHandler.ts +4 -2
- package/src/adapters/node-http/types.ts +3 -3
- package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +6 -3
- package/src/unstable-core-do-not-import/index.ts +0 -4
- package/src/unstable-core-do-not-import/router.ts +123 -118
- package/src/unstable-core-do-not-import/rpc/codes.ts +1 -1
- package/src/unstable-core-do-not-import/rpc/envelopes.ts +1 -3
- package/src/unstable-core-do-not-import/types.ts +1 -0
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.js +0 -203
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/index.mjs +0 -201
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.js +0 -167
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/search.mjs +0 -163
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.js +0 -35
- package/dist/node_modules/.pnpm/@web3-storage_multipart-parser@1.0.0/node_modules/@web3-storage/multipart-parser/esm/src/utils.mjs +0 -30
|
@@ -29,8 +29,8 @@ function getHTTPStatusCode(json) {
|
|
|
29
29
|
const httpStatuses = new Set(arr.map((res)=>{
|
|
30
30
|
if ('error' in res) {
|
|
31
31
|
const data = res.error.data;
|
|
32
|
-
if (typeof data
|
|
33
|
-
return data
|
|
32
|
+
if (typeof data.httpStatus === 'number') {
|
|
33
|
+
return data.httpStatus;
|
|
34
34
|
}
|
|
35
35
|
const code = codes.TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
36
36
|
return getStatusCodeFromKey(code);
|
|
@@ -27,8 +27,8 @@ function getHTTPStatusCode(json) {
|
|
|
27
27
|
const httpStatuses = new Set(arr.map((res)=>{
|
|
28
28
|
if ('error' in res) {
|
|
29
29
|
const data = res.error.data;
|
|
30
|
-
if (typeof data
|
|
31
|
-
return data
|
|
30
|
+
if (typeof data.httpStatus === 'number') {
|
|
31
|
+
return data.httpStatus;
|
|
32
32
|
}
|
|
33
33
|
const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
|
|
34
34
|
return getStatusCodeFromKey(code);
|
|
@@ -20,7 +20,7 @@ export type { AnyMutationProcedure, AnyProcedure, AnyQueryProcedure, AnySubscrip
|
|
|
20
20
|
export { createBuilder, unsetMarker } from './procedureBuilder';
|
|
21
21
|
export type { ProcedureBuilder } from './procedureBuilder';
|
|
22
22
|
export * from './rootConfig';
|
|
23
|
-
export type { AnyRouter,
|
|
23
|
+
export type { AnyRouter, Router, RouterCaller, createRouterFactory, inferRouterContext, inferRouterError, inferRouterInputs, inferRouterMeta, inferRouterOutputs, } from './router';
|
|
24
24
|
export * from './TRPCInferrable';
|
|
25
25
|
export * from './router';
|
|
26
26
|
export { transformResult, transformTRPCResponse } from './transformer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iCAAiC,EACjC,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,cAAc,cAAc,CAAC;AAC7B,YAAY,EACV,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,iCAAiC,EACjC,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EACV,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,cAAc,cAAc,CAAC;AAC7B,YAAY,EACV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACvE,YAAY,EACV,uBAAuB,EACvB,6BAA6B,EAC7B,eAAe,EACf,sBAAsB,GACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGtE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D,YAAY,EACV,WAAW,EACX,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,QAAQ,EACR,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,SAAS,GACV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,cAAc,kBAAkB,CAAC;AACjC;;GAEG;AACH,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
|
|
@@ -56,12 +56,20 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
|
|
|
56
56
|
* Create a router
|
|
57
57
|
* @link https://trpc.io/docs/v11/server/routers
|
|
58
58
|
*/
|
|
59
|
-
router:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
router: {
|
|
60
|
+
<TInput extends import("./router").RouterRecord>(input: TInput): import("./router").BuiltRouter<{
|
|
61
|
+
ctx: TContext;
|
|
62
|
+
meta: TMeta;
|
|
63
|
+
errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
|
|
64
|
+
transformer: undefined extends TOptions["transformer"] ? false : true;
|
|
65
|
+
}, TInput>;
|
|
66
|
+
<TInput_1 extends import("./router").CreateRouterOptions>(input: TInput_1): import("./router").BuiltRouter<{
|
|
67
|
+
ctx: TContext;
|
|
68
|
+
meta: TMeta;
|
|
69
|
+
errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
|
|
70
|
+
transformer: undefined extends TOptions["transformer"] ? false : true;
|
|
71
|
+
}, import("./router").DecorateCreateRouterOptions<TInput_1>>;
|
|
72
|
+
};
|
|
65
73
|
/**
|
|
66
74
|
* Merge Routers
|
|
67
75
|
* @link https://trpc.io/docs/v11/server/merging-routers
|
|
@@ -71,12 +79,17 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
|
|
|
71
79
|
* Create a server-side caller for a router
|
|
72
80
|
* @link https://trpc.io/docs/v11/server/server-side-calls
|
|
73
81
|
*/
|
|
74
|
-
createCallerFactory: <
|
|
82
|
+
createCallerFactory: <TRecord extends import("./router").RouterRecord>(router: import("./router").Router<{
|
|
83
|
+
ctx: TContext;
|
|
84
|
+
meta: TMeta;
|
|
85
|
+
errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
|
|
86
|
+
transformer: undefined extends TOptions["transformer"] ? false : true;
|
|
87
|
+
}, TRecord>) => import("./router").RouterCaller<{
|
|
75
88
|
ctx: TContext;
|
|
76
89
|
meta: TMeta;
|
|
77
90
|
errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
|
|
78
91
|
transformer: undefined extends TOptions["transformer"] ? false : true;
|
|
79
|
-
},
|
|
92
|
+
}, TRecord>;
|
|
80
93
|
};
|
|
81
94
|
}
|
|
82
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initTRPC.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/initTRPC.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAmB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAGL,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAErD,KAAK,wBAAwB,CAAC,KAAK,IAAI,KAAK,SAAS,cAAc,CACjE,GAAG,EACH,MAAM,MAAM,CACb,GACG,MAAM,GACN,iBAAiB,CAAC;AACtB,UAAU,oBAAoB,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,CAC1E,SAAQ,OAAO,CACb,IAAI,CACF,UAAU,CAAC;IACT,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE,GAAG,CAAC;CAClB,CAAC,EACF,QAAQ,GAAG,aAAa,CACzB,CACF;IACD;;;OAGG;IACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC;AAED,cAAM,WAAW,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM;IAC7D;;;OAGG;IACH,OAAO,CAAC,WAAW,SAAS,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ACH,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC;AAED,cAAM,WAAW,CAAC,QAAQ,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM;IAC7D;;;OAGG;IACH,OAAO,CAAC,WAAW,SAAS,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;IAIrE;;;OAGG;IACH,IAAI,CAAC,QAAQ,SAAS,MAAM;IAI5B;;;OAGG;IACH,MAAM,CAAC,QAAQ,SAAS,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,EAC3D,IAAI,CAAC,EACD,aAAa,CAAC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,GAC9D,SAAS;QAoDX;;;WAGG;;iBA7CE,QAAQ;kBACP,KAAK;;;;QA8CX;;;WAGG;;QAIH;;;WAGG;;QAEH;;;WAGG;;;qBA9DE,QAAQ;sBACP,KAAK;;;;;qBADN,QAAQ;sBACP,KAAK;;;;;QA+DX;;;WAGG;;QAEH;;;WAGG;;iBAxEE,QAAQ;kBACP,KAAK;;;;iBADN,QAAQ;kBACP,KAAK;;;;;CA2EhB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,6BAAoB,CAAC"}
|
|
@@ -2,84 +2,76 @@ import type { AnyProcedure, inferProcedureInput, inferTransformedProcedureOutput
|
|
|
2
2
|
import type { ProcedureCallOptions } from './procedureBuilder';
|
|
3
3
|
import type { AnyRootTypes, RootConfig } from './rootConfig';
|
|
4
4
|
import type { MaybePromise } from './types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export interface ProcedureRouterRecord {
|
|
8
|
-
[key: string]: AnyProcedure | AnyRouter;
|
|
5
|
+
export interface RouterRecord {
|
|
6
|
+
[key: string]: AnyProcedure | RouterRecord;
|
|
9
7
|
}
|
|
10
|
-
export interface RouterDef<TRoot extends AnyRootTypes, TRecord extends ProcedureRouterRecord> {
|
|
11
|
-
_config: RootConfig<TRoot>;
|
|
12
|
-
router: true;
|
|
13
|
-
procedure?: never;
|
|
14
|
-
procedures: TRecord;
|
|
15
|
-
record: TRecord;
|
|
16
|
-
}
|
|
17
|
-
export type AnyRouterDef = RouterDef<any, any>;
|
|
18
8
|
type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedureInput<TProcedure>) => Promise<TProcedure['_def']['_output_out']>;
|
|
19
9
|
/**
|
|
20
10
|
* @internal
|
|
21
11
|
*/
|
|
22
|
-
type
|
|
23
|
-
[TKey in keyof
|
|
12
|
+
export type DecorateRouterRecord<TRecord extends RouterRecord> = {
|
|
13
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends AnyProcedure ? DecorateProcedure<TRecord[TKey]> : TRecord[TKey] extends RouterRecord ? DecorateRouterRecord<TRecord[TKey]> : never;
|
|
24
14
|
};
|
|
25
15
|
/**
|
|
26
16
|
* @internal
|
|
27
17
|
*/
|
|
28
|
-
export type RouterCaller<
|
|
18
|
+
export type RouterCaller<TRoot extends AnyRootTypes, TRecord extends RouterRecord> = (
|
|
29
19
|
/**
|
|
30
20
|
* @note
|
|
31
21
|
* If passing a function, we recommend it's a cached function
|
|
32
22
|
* e.g. wrapped in `React.cache` to avoid unnecessary computations
|
|
33
23
|
*/
|
|
34
|
-
ctx:
|
|
35
|
-
export interface Router<
|
|
36
|
-
_def:
|
|
24
|
+
ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>)) => DecorateRouterRecord<TRecord>;
|
|
25
|
+
export interface Router<TRoot extends AnyRootTypes, TRecord extends RouterRecord> {
|
|
26
|
+
_def: {
|
|
27
|
+
_config: RootConfig<TRoot>;
|
|
28
|
+
router: true;
|
|
29
|
+
procedure?: never;
|
|
30
|
+
procedures: TRecord;
|
|
31
|
+
record: TRecord;
|
|
32
|
+
};
|
|
37
33
|
/**
|
|
38
34
|
* @deprecated use `t.createCallerFactory(router)` instead
|
|
39
35
|
* @link https://trpc.io/docs/v11/server/server-side-calls
|
|
40
36
|
*/
|
|
41
|
-
createCaller: RouterCaller<
|
|
37
|
+
createCaller: RouterCaller<TRoot, TRecord>;
|
|
42
38
|
}
|
|
43
|
-
export type
|
|
44
|
-
type
|
|
45
|
-
type
|
|
46
|
-
export type inferRouterContext<TRouter extends AnyRouter> =
|
|
47
|
-
export type inferRouterError<TRouter extends AnyRouter> =
|
|
48
|
-
export type inferRouterMeta<TRouter extends AnyRouter> =
|
|
49
|
-
type GetInferenceHelpers<TType extends 'input' | 'output',
|
|
50
|
-
[TKey in keyof
|
|
39
|
+
export type BuiltRouter<TRoot extends AnyRootTypes, TDef extends RouterRecord> = Router<TRoot, TDef> & TDef;
|
|
40
|
+
export type AnyRouter = Router<any, any>;
|
|
41
|
+
export type inferRouterRootTypes<TRouter extends AnyRouter> = TRouter['_def']['_config']['$types'];
|
|
42
|
+
export type inferRouterContext<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['ctx'];
|
|
43
|
+
export type inferRouterError<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['errorShape'];
|
|
44
|
+
export type inferRouterMeta<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['meta'];
|
|
45
|
+
export type GetInferenceHelpers<TType extends 'input' | 'output', TRoot extends AnyRootTypes, TRecord extends RouterRecord> = {
|
|
46
|
+
[TKey in keyof TRecord]: TRecord[TKey] extends infer $Value ? $Value extends RouterRecord ? GetInferenceHelpers<TType, TRoot, $Value> : $Value extends AnyProcedure ? TType extends 'input' ? inferProcedureInput<$Value> : inferTransformedProcedureOutput<TRoot, $Value> : never : never;
|
|
47
|
+
};
|
|
48
|
+
export type inferRouterInputs<TRouter extends AnyRouter> = GetInferenceHelpers<'input', TRouter['_def']['_config']['$types'], TRouter['_def']['record']>;
|
|
49
|
+
export type inferRouterOutputs<TRouter extends AnyRouter> = GetInferenceHelpers<'output', TRouter['_def']['_config']['$types'], TRouter['_def']['record']>;
|
|
50
|
+
export type CreateRouterOptions = {
|
|
51
|
+
[key: string]: AnyProcedure | AnyRouter | CreateRouterOptions;
|
|
52
|
+
};
|
|
53
|
+
export type DecorateCreateRouterOptions<TRouterOptions extends CreateRouterOptions> = {
|
|
54
|
+
[K in keyof TRouterOptions]: TRouterOptions[K] extends infer $Value ? $Value extends AnyProcedure ? $Value : $Value extends Router<any, infer TRecord> ? TRecord : $Value extends CreateRouterOptions ? DecorateCreateRouterOptions<$Value> : never : never;
|
|
51
55
|
};
|
|
52
|
-
export type inferRouterInputs<TRouter extends AnyRouter> = GetInferenceHelpers<'input', TRouter>;
|
|
53
|
-
export type inferRouterOutputs<TRouter extends AnyRouter> = GetInferenceHelpers<'output', TRouter>;
|
|
54
|
-
/**
|
|
55
|
-
* @internal
|
|
56
|
-
*/
|
|
57
|
-
export type CreateRouterInner<TRoot extends AnyRootTypes, TProcRouterRecord extends ProcedureRouterRecord> = Router<RouterDef<TRoot, TProcRouterRecord>> &
|
|
58
|
-
/**
|
|
59
|
-
* This adds ability to call procedures directly but is primarily used for quick access in type inference
|
|
60
|
-
*/
|
|
61
|
-
TProcRouterRecord;
|
|
62
56
|
/**
|
|
63
57
|
* @internal
|
|
64
58
|
*/
|
|
65
|
-
export declare function createRouterFactory<TRoot extends AnyRootTypes>(config: RootConfig<TRoot>):
|
|
59
|
+
export declare function createRouterFactory<TRoot extends AnyRootTypes>(config: RootConfig<TRoot>): {
|
|
60
|
+
<TInput extends RouterRecord>(input: TInput): BuiltRouter<TRoot, TInput>;
|
|
61
|
+
<TInput_1 extends CreateRouterOptions>(input: TInput_1): BuiltRouter<TRoot, DecorateCreateRouterOptions<TInput_1>>;
|
|
62
|
+
};
|
|
66
63
|
/**
|
|
67
64
|
* @internal
|
|
68
65
|
*/
|
|
69
66
|
export declare function callProcedure(opts: ProcedureCallOptions & {
|
|
70
|
-
procedures:
|
|
67
|
+
procedures: RouterRecord;
|
|
71
68
|
}): Promise<unknown>;
|
|
72
|
-
export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <
|
|
69
|
+
export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <TRecord extends RouterRecord>(router: Router<TRoot, TRecord>) => RouterCaller<TRoot, TRecord>;
|
|
73
70
|
/** @internal */
|
|
74
|
-
type MergeRouters<TRouters extends AnyRouter[],
|
|
71
|
+
type MergeRouters<TRouters extends AnyRouter[], TRoot extends AnyRootTypes = TRouters[0]['_def']['_config']['$types'], TRecord extends RouterRecord = {}> = TRouters extends [
|
|
75
72
|
infer Head extends AnyRouter,
|
|
76
73
|
...infer Tail extends AnyRouter[]
|
|
77
|
-
] ? MergeRouters<Tail,
|
|
78
|
-
_config: TRouterDef['_config'];
|
|
79
|
-
router: true;
|
|
80
|
-
procedures: Head['_def']['procedures'] & TRouterDef['procedures'];
|
|
81
|
-
record: Head['_def']['record'] & TRouterDef['record'];
|
|
82
|
-
}> : Router<TRouterDef> & TRouterDef['record'];
|
|
74
|
+
] ? MergeRouters<Tail, TRoot, Head['_def']['record'] & TRecord> : BuiltRouter<TRoot, TRecord>;
|
|
83
75
|
export declare function mergeRouters<TRouters extends AnyRouter[]>(...routerList: [...TRouters]): MergeRouters<TRouters>;
|
|
84
76
|
export {};
|
|
85
77
|
//# sourceMappingURL=router.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,+BAA+B,EAChC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/router.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,+BAA+B,EAChC,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AK,SAAS,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAErE,OAAO,SAAS,YAAY,GAAG,EAAE,IAC/B,QAAQ,SAAS;IACnB,MAAM,IAAI,SAAS,SAAS;IAC5B,GAAG,MAAM,IAAI,SAAS,SAAS,EAAE;CAClC,GACG,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"}
|
|
@@ -7,7 +7,7 @@ var transformer = require('./transformer.js');
|
|
|
7
7
|
var utils = require('./utils.js');
|
|
8
8
|
|
|
9
9
|
function isRouter(procedureOrRouter) {
|
|
10
|
-
return 'router' in procedureOrRouter._def;
|
|
10
|
+
return procedureOrRouter._def && 'router' in procedureOrRouter._def;
|
|
11
11
|
}
|
|
12
12
|
const emptyRouter = {
|
|
13
13
|
_ctx: null,
|
|
@@ -30,35 +30,52 @@ const emptyRouter = {
|
|
|
30
30
|
/**
|
|
31
31
|
* @internal
|
|
32
32
|
*/ function createRouterFactory(config) {
|
|
33
|
-
|
|
34
|
-
const reservedWordsUsed = new Set(Object.keys(
|
|
33
|
+
function createRouterInner(input) {
|
|
34
|
+
const reservedWordsUsed = new Set(Object.keys(input).filter((v)=>reservedWords.includes(v)));
|
|
35
35
|
if (reservedWordsUsed.size > 0) {
|
|
36
36
|
throw new Error('Reserved words used in `router({})` call: ' + Array.from(reservedWordsUsed).join(', '));
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (isRouter(
|
|
43
|
-
|
|
38
|
+
const procedures = utils.omitPrototype({});
|
|
39
|
+
function step(from, path = []) {
|
|
40
|
+
const aggregate = utils.omitPrototype({});
|
|
41
|
+
for (const [key, item] of Object.entries(from ?? {})){
|
|
42
|
+
if (isRouter(item)) {
|
|
43
|
+
aggregate[key] = step(item._def.record, [
|
|
44
|
+
...path,
|
|
45
|
+
key
|
|
46
|
+
]);
|
|
44
47
|
continue;
|
|
45
48
|
}
|
|
46
|
-
if (
|
|
49
|
+
if (!isProcedure(item)) {
|
|
50
|
+
// RouterRecord
|
|
51
|
+
aggregate[key] = step(item, [
|
|
52
|
+
...path,
|
|
53
|
+
key
|
|
54
|
+
]);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const newPath = [
|
|
58
|
+
...path,
|
|
59
|
+
key
|
|
60
|
+
].join('.');
|
|
61
|
+
if (procedures[newPath]) {
|
|
47
62
|
throw new Error(`Duplicate key: ${newPath}`);
|
|
48
63
|
}
|
|
49
|
-
|
|
64
|
+
procedures[newPath] = item;
|
|
65
|
+
aggregate[key] = item;
|
|
50
66
|
}
|
|
67
|
+
return aggregate;
|
|
51
68
|
}
|
|
52
|
-
|
|
69
|
+
const record = step(input);
|
|
53
70
|
const _def = {
|
|
54
71
|
_config: config,
|
|
55
72
|
router: true,
|
|
56
|
-
procedures
|
|
73
|
+
procedures,
|
|
57
74
|
...emptyRouter,
|
|
58
|
-
record
|
|
75
|
+
record
|
|
59
76
|
};
|
|
60
|
-
|
|
61
|
-
...
|
|
77
|
+
return {
|
|
78
|
+
...record,
|
|
62
79
|
_def,
|
|
63
80
|
createCaller (ctx) {
|
|
64
81
|
const proxy = createProxy.createRecursiveProxy(({ path , args })=>{
|
|
@@ -74,11 +91,11 @@ const emptyRouter = {
|
|
|
74
91
|
return proxy;
|
|
75
92
|
}
|
|
76
93
|
};
|
|
77
|
-
|
|
78
|
-
|
|
94
|
+
}
|
|
95
|
+
return createRouterInner;
|
|
79
96
|
}
|
|
80
97
|
function isProcedure(procedureOrRouter) {
|
|
81
|
-
return
|
|
98
|
+
return typeof procedureOrRouter === 'function';
|
|
82
99
|
}
|
|
83
100
|
/**
|
|
84
101
|
* @internal
|
|
@@ -142,9 +159,9 @@ function mergeRouters(...routerList) {
|
|
|
142
159
|
const router = createRouterFactory({
|
|
143
160
|
errorFormatter,
|
|
144
161
|
transformer: transformer$1,
|
|
145
|
-
isDev: routerList.
|
|
146
|
-
allowOutsideOfServer: routerList.
|
|
147
|
-
isServer: routerList.
|
|
162
|
+
isDev: routerList.every((r)=>r._def._config.isDev),
|
|
163
|
+
allowOutsideOfServer: routerList.every((r)=>r._def._config.allowOutsideOfServer),
|
|
164
|
+
isServer: routerList.every((r)=>r._def._config.isServer),
|
|
148
165
|
$types: routerList[0]?._def._config.$types
|
|
149
166
|
})(record);
|
|
150
167
|
return router;
|
|
@@ -2,10 +2,10 @@ import { createRecursiveProxy } from './createProxy.mjs';
|
|
|
2
2
|
import { defaultFormatter } from './error/formatter.mjs';
|
|
3
3
|
import { TRPCError } from './error/TRPCError.mjs';
|
|
4
4
|
import { defaultTransformer } from './transformer.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { mergeWithoutOverrides, omitPrototype } from './utils.mjs';
|
|
6
6
|
|
|
7
7
|
function isRouter(procedureOrRouter) {
|
|
8
|
-
return 'router' in procedureOrRouter._def;
|
|
8
|
+
return procedureOrRouter._def && 'router' in procedureOrRouter._def;
|
|
9
9
|
}
|
|
10
10
|
const emptyRouter = {
|
|
11
11
|
_ctx: null,
|
|
@@ -28,35 +28,52 @@ const emptyRouter = {
|
|
|
28
28
|
/**
|
|
29
29
|
* @internal
|
|
30
30
|
*/ function createRouterFactory(config) {
|
|
31
|
-
|
|
32
|
-
const reservedWordsUsed = new Set(Object.keys(
|
|
31
|
+
function createRouterInner(input) {
|
|
32
|
+
const reservedWordsUsed = new Set(Object.keys(input).filter((v)=>reservedWords.includes(v)));
|
|
33
33
|
if (reservedWordsUsed.size > 0) {
|
|
34
34
|
throw new Error('Reserved words used in `router({})` call: ' + Array.from(reservedWordsUsed).join(', '));
|
|
35
35
|
}
|
|
36
|
-
const
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (isRouter(
|
|
41
|
-
|
|
36
|
+
const procedures = omitPrototype({});
|
|
37
|
+
function step(from, path = []) {
|
|
38
|
+
const aggregate = omitPrototype({});
|
|
39
|
+
for (const [key, item] of Object.entries(from ?? {})){
|
|
40
|
+
if (isRouter(item)) {
|
|
41
|
+
aggregate[key] = step(item._def.record, [
|
|
42
|
+
...path,
|
|
43
|
+
key
|
|
44
|
+
]);
|
|
42
45
|
continue;
|
|
43
46
|
}
|
|
44
|
-
if (
|
|
47
|
+
if (!isProcedure(item)) {
|
|
48
|
+
// RouterRecord
|
|
49
|
+
aggregate[key] = step(item, [
|
|
50
|
+
...path,
|
|
51
|
+
key
|
|
52
|
+
]);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const newPath = [
|
|
56
|
+
...path,
|
|
57
|
+
key
|
|
58
|
+
].join('.');
|
|
59
|
+
if (procedures[newPath]) {
|
|
45
60
|
throw new Error(`Duplicate key: ${newPath}`);
|
|
46
61
|
}
|
|
47
|
-
|
|
62
|
+
procedures[newPath] = item;
|
|
63
|
+
aggregate[key] = item;
|
|
48
64
|
}
|
|
65
|
+
return aggregate;
|
|
49
66
|
}
|
|
50
|
-
|
|
67
|
+
const record = step(input);
|
|
51
68
|
const _def = {
|
|
52
69
|
_config: config,
|
|
53
70
|
router: true,
|
|
54
|
-
procedures
|
|
71
|
+
procedures,
|
|
55
72
|
...emptyRouter,
|
|
56
|
-
record
|
|
73
|
+
record
|
|
57
74
|
};
|
|
58
|
-
|
|
59
|
-
...
|
|
75
|
+
return {
|
|
76
|
+
...record,
|
|
60
77
|
_def,
|
|
61
78
|
createCaller (ctx) {
|
|
62
79
|
const proxy = createRecursiveProxy(({ path , args })=>{
|
|
@@ -72,11 +89,11 @@ const emptyRouter = {
|
|
|
72
89
|
return proxy;
|
|
73
90
|
}
|
|
74
91
|
};
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
}
|
|
93
|
+
return createRouterInner;
|
|
77
94
|
}
|
|
78
95
|
function isProcedure(procedureOrRouter) {
|
|
79
|
-
return
|
|
96
|
+
return typeof procedureOrRouter === 'function';
|
|
80
97
|
}
|
|
81
98
|
/**
|
|
82
99
|
* @internal
|
|
@@ -140,9 +157,9 @@ function mergeRouters(...routerList) {
|
|
|
140
157
|
const router = createRouterFactory({
|
|
141
158
|
errorFormatter,
|
|
142
159
|
transformer,
|
|
143
|
-
isDev: routerList.
|
|
144
|
-
allowOutsideOfServer: routerList.
|
|
145
|
-
isServer: routerList.
|
|
160
|
+
isDev: routerList.every((r)=>r._def._config.isDev),
|
|
161
|
+
allowOutsideOfServer: routerList.every((r)=>r._def._config.allowOutsideOfServer),
|
|
162
|
+
isServer: routerList.every((r)=>r._def._config.isServer),
|
|
146
163
|
$types: routerList[0]?._def._config.$types
|
|
147
164
|
})(record);
|
|
148
165
|
return router;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ValueOf } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* JSON-RPC 2.0 Error codes
|
|
3
4
|
*
|
|
@@ -44,8 +45,6 @@ export declare const TRPC_ERROR_CODES_BY_NUMBER: {
|
|
|
44
45
|
[-32029]: "TOO_MANY_REQUESTS";
|
|
45
46
|
[-32099]: "CLIENT_CLOSED_REQUEST";
|
|
46
47
|
};
|
|
47
|
-
type ValueOf<TObj> = TObj[keyof TObj];
|
|
48
48
|
export type TRPC_ERROR_CODE_NUMBER = ValueOf<typeof TRPC_ERROR_CODES_BY_KEY>;
|
|
49
49
|
export type TRPC_ERROR_CODE_KEY = keyof typeof TRPC_ERROR_CODES_BY_KEY;
|
|
50
|
-
export {};
|
|
51
50
|
//# sourceMappingURL=codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/codes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/codes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKxC;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;IAClC;;;OAGG;;IAEH;;OAEG;;;;;;;;;;;;;;;CAmBK,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;CAAkC,CAAC;AAE1E,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAC7E,MAAM,MAAM,mBAAmB,GAAG,MAAM,OAAO,uBAAuB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { TRPC_ERROR_CODE_NUMBER } from './codes';
|
|
|
3
3
|
/**
|
|
4
4
|
* Error response
|
|
5
5
|
*/
|
|
6
|
-
export interface TRPCErrorShape<TData extends
|
|
6
|
+
export interface TRPCErrorShape<TData extends object = object> {
|
|
7
7
|
code: TRPC_ERROR_CODE_NUMBER;
|
|
8
8
|
message: string;
|
|
9
9
|
data: TData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelopes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/envelopes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,cAAc,
|
|
1
|
+
{"version":3,"file":"envelopes.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/rpc/envelopes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MA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CAC7B,iBAAiB,CAAC,MAAM,CAAC,GACzB,iBAAiB,CAAC,KAAK,CAAC,CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,yBACf,SAAQ,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC;IACzC,EAAE,EAAE,QAAQ,CAAC,SAAS,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,yBAAyB,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,yBAAyB,CACnC,OAAO,GAAG,OAAO,EACjB,MAAM,SAAS,cAAc,GAAG,cAAc,IAC5C,yBAAyB,GAAG,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -63,7 +63,7 @@ export declare const defaultTransformer: CombinedDataTransformer;
|
|
|
63
63
|
/**
|
|
64
64
|
* Takes a unserialized `TRPCResponse` and serializes it with the router's transformers
|
|
65
65
|
**/
|
|
66
|
-
export declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): import("./rpc").TRPCErrorResponse<import("./rpc").TRPCErrorShape<
|
|
66
|
+
export declare function transformTRPCResponse<TResponse extends TRPCResponse | TRPCResponse[] | TRPCResponseMessage | TRPCResponseMessage[]>(config: RootConfig<AnyRootTypes>, itemOrItems: TResponse): import("./rpc").TRPCErrorResponse<import("./rpc").TRPCErrorShape<object>> | import("./rpc").TRPCSuccessResponse<unknown> | ({
|
|
67
67
|
id: import("./rpc").JSONRPC2.RequestId;
|
|
68
68
|
} & TRPCResultMessage<unknown>) | (TRPCResponse | TRPCResponseMessage)[];
|
|
69
69
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,KAAK,CAAC,KA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C,QAAQ,SAAS,MAAM,IAAI,QAAQ,GAAG;IAC1D,CAAC,EAAE,OAAO,YAAY,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trpc/server",
|
|
3
|
-
"version": "11.0.0-next-beta.
|
|
3
|
+
"version": "11.0.0-next-beta.248+05798dd78",
|
|
4
4
|
"description": "The tRPC server library",
|
|
5
5
|
"author": "KATT",
|
|
6
6
|
"license": "MIT",
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"funding": [
|
|
158
158
|
"https://trpc.io/sponsor"
|
|
159
159
|
],
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "05798dd78fd304612172fcccb622559954a0f578"
|
|
161
161
|
}
|
|
@@ -26,7 +26,7 @@ export {
|
|
|
26
26
|
type ProcedureType as TRPCProcedureType,
|
|
27
27
|
type AnyMutationProcedure as AnyTRPCMutationProcedure,
|
|
28
28
|
type AnyQueryProcedure as AnyTRPCQueryProcedure,
|
|
29
|
-
type
|
|
29
|
+
type RouterRecord as TRPCRouterRecord,
|
|
30
30
|
type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure,
|
|
31
31
|
type ProcedureOptions as TRPCProcedureOptions,
|
|
32
32
|
} from '../../unstable-core-do-not-import';
|
|
@@ -71,10 +71,6 @@ export type {
|
|
|
71
71
|
* @deprecated use `AnyTRPCQueryProcedure` instead
|
|
72
72
|
*/
|
|
73
73
|
AnyQueryProcedure,
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated use `TRPCProcedureRouterRecord` instead
|
|
76
|
-
*/
|
|
77
|
-
ProcedureRouterRecord,
|
|
78
74
|
/**
|
|
79
75
|
* @deprecated use `AnyTRPCSubscriptionProcedure` instead
|
|
80
76
|
*/
|
|
@@ -69,7 +69,8 @@ export async function nodeHTTPRequestHandler<
|
|
|
69
69
|
const contentTypeHandler =
|
|
70
70
|
contentTypeHandlers.find((handler) =>
|
|
71
71
|
handler.isMatch({
|
|
72
|
-
|
|
72
|
+
// FIXME: no typecasting should be needed here
|
|
73
|
+
...(opts as any),
|
|
73
74
|
query,
|
|
74
75
|
}),
|
|
75
76
|
) ??
|
|
@@ -77,7 +78,8 @@ export async function nodeHTTPRequestHandler<
|
|
|
77
78
|
jsonContentTypeHandler;
|
|
78
79
|
|
|
79
80
|
const bodyResult = await contentTypeHandler.getBody({
|
|
80
|
-
|
|
81
|
+
// FIXME: no typecasting should be needed here
|
|
82
|
+
...(opts as any),
|
|
81
83
|
query,
|
|
82
84
|
});
|
|
83
85
|
|