@trpc/server 11.0.0-next-beta.240 → 11.0.0-next-beta.242

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.
Files changed (35) hide show
  1. package/dist/adapters/node-http/nodeHTTPRequestHandler.d.ts.map +1 -1
  2. package/dist/adapters/node-http/nodeHTTPRequestHandler.js +2 -0
  3. package/dist/adapters/node-http/nodeHTTPRequestHandler.mjs +2 -0
  4. package/dist/adapters/node-http/types.d.ts +3 -3
  5. package/dist/adapters/node-http/types.d.ts.map +1 -1
  6. package/dist/bundle-analysis.json +36 -36
  7. package/dist/unstable-core-do-not-import/error/formatter.d.ts +7 -2
  8. package/dist/unstable-core-do-not-import/error/formatter.d.ts.map +1 -1
  9. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.d.ts.map +1 -1
  10. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.js +2 -2
  11. package/dist/unstable-core-do-not-import/http/getHTTPStatusCode.mjs +2 -2
  12. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.d.ts.map +1 -1
  13. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.js +43 -51
  14. package/dist/unstable-core-do-not-import/http/resolveHTTPResponse.mjs +39 -47
  15. package/dist/unstable-core-do-not-import/index.d.ts +1 -1
  16. package/dist/unstable-core-do-not-import/index.d.ts.map +1 -1
  17. package/dist/unstable-core-do-not-import/initTRPC.d.ts +14 -8
  18. package/dist/unstable-core-do-not-import/initTRPC.d.ts.map +1 -1
  19. package/dist/unstable-core-do-not-import/router.d.ts +23 -38
  20. package/dist/unstable-core-do-not-import/router.d.ts.map +1 -1
  21. package/dist/unstable-core-do-not-import/router.js +3 -3
  22. package/dist/unstable-core-do-not-import/router.mjs +3 -3
  23. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts +1 -1
  24. package/dist/unstable-core-do-not-import/rpc/envelopes.d.ts.map +1 -1
  25. package/dist/unstable-core-do-not-import/transformer.d.ts +1 -1
  26. package/package.json +2 -2
  27. package/src/adapters/node-http/nodeHTTPRequestHandler.ts +4 -2
  28. package/src/adapters/node-http/types.ts +3 -3
  29. package/src/unstable-core-do-not-import/error/formatter.ts +7 -7
  30. package/src/unstable-core-do-not-import/http/getHTTPStatusCode.ts +6 -3
  31. package/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts +45 -51
  32. package/src/unstable-core-do-not-import/index.ts +0 -2
  33. package/src/unstable-core-do-not-import/initTRPC.ts +10 -8
  34. package/src/unstable-core-do-not-import/router.ts +53 -78
  35. package/src/unstable-core-do-not-import/rpc/envelopes.ts +1 -3
@@ -1,8 +1,9 @@
1
- import { type DefaultErrorShape, type ErrorFormatter, type ErrorFormatterShape } from './error/formatter';
1
+ import { type DefaultErrorShape, type ErrorFormatter } from './error/formatter';
2
2
  import { type RootConfig } from './rootConfig';
3
3
  import { mergeRouters } from './router';
4
4
  import type { DataTransformerOptions } from './transformer';
5
- import type { PickFirstDefined, Unwrap, ValidateShape } from './types';
5
+ import type { Unwrap, ValidateShape } from './types';
6
+ type inferErrorFormatterShape<TType> = TType extends ErrorFormatter<any, infer TShape> ? TShape : DefaultErrorShape;
6
7
  interface RuntimeConfigOptions<TContext extends object, TMeta extends object> extends Partial<Omit<RootConfig<{
7
8
  ctx: TContext;
8
9
  meta: TMeta;
@@ -38,7 +39,7 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
38
39
  _config: RootConfig<{
39
40
  ctx: TContext;
40
41
  meta: TMeta;
41
- errorShape: ErrorFormatterShape<PickFirstDefined<TOptions["errorFormatter"], ErrorFormatter<TContext, DefaultErrorShape>>>;
42
+ errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
42
43
  transformer: undefined extends TOptions["transformer"] ? false : true;
43
44
  }>;
44
45
  /**
@@ -55,10 +56,10 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
55
56
  * Create a router
56
57
  * @link https://trpc.io/docs/v11/server/routers
57
58
  */
58
- router: <TProcRouterRecord extends import("./router").ProcedureRouterRecord>(procedures: TProcRouterRecord) => import("./router").CreateRouterInner<{
59
+ router: <TProcRouterRecord extends import("./router").ProcedureRouterRecord>(procedures: TProcRouterRecord) => import("./router").BuiltRouter<{
59
60
  ctx: TContext;
60
61
  meta: TMeta;
61
- errorShape: ErrorFormatterShape<PickFirstDefined<TOptions["errorFormatter"], ErrorFormatter<TContext, DefaultErrorShape>>>;
62
+ errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
62
63
  transformer: undefined extends TOptions["transformer"] ? false : true;
63
64
  }, TProcRouterRecord>;
64
65
  /**
@@ -70,12 +71,17 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
70
71
  * Create a server-side caller for a router
71
72
  * @link https://trpc.io/docs/v11/server/server-side-calls
72
73
  */
73
- createCallerFactory: <TRouter extends import("./router").Router<import("./router").RouterDef<{
74
+ createCallerFactory: <TRecord extends import("./router").ProcedureRouterRecord>(router: import("./router").Router<{
74
75
  ctx: TContext;
75
76
  meta: TMeta;
76
- errorShape: ErrorFormatterShape<PickFirstDefined<TOptions["errorFormatter"], ErrorFormatter<TContext, DefaultErrorShape>>>;
77
+ errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
77
78
  transformer: undefined extends TOptions["transformer"] ? false : true;
78
- }, any>>>(router: TRouter) => import("./router").RouterCaller<TRouter["_def"]>;
79
+ }, TRecord>) => import("./router").RouterCaller<{
80
+ ctx: TContext;
81
+ meta: TMeta;
82
+ errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
83
+ transformer: undefined extends TOptions["transformer"] ? false : true;
84
+ }, TRecord>;
79
85
  };
80
86
  }
81
87
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"initTRPC.d.ts","sourceRoot":"","s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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;;iBA9DE,QAAQ;kBACP,KAAK;;;;QA+DX;;;WAGG;;QAEH;;;WAGG;;iBAxEE,QAAQ;kBACP,KAAK;;;;iBADN,QAAQ;kBACP,KAAK;;;;;CA2EhB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,6BAAoB,CAAC"}
@@ -7,46 +7,44 @@ export type ProcedureRecord = Record<string, AnyProcedure>;
7
7
  export interface ProcedureRouterRecord {
8
8
  [key: string]: AnyProcedure | AnyRouter;
9
9
  }
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
10
  type DecorateProcedure<TProcedure extends AnyProcedure> = (input: inferProcedureInput<TProcedure>) => Promise<TProcedure['_def']['_output_out']>;
19
11
  /**
20
12
  * @internal
21
13
  */
22
- type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord> = {
14
+ export type DecoratedProcedureRecord<TProcedures extends ProcedureRouterRecord> = {
23
15
  [TKey in keyof TProcedures]: TProcedures[TKey] extends AnyRouter ? DecoratedProcedureRecord<TProcedures[TKey]['_def']['record']> : TProcedures[TKey] extends AnyProcedure ? DecorateProcedure<TProcedures[TKey]> : never;
24
16
  };
25
17
  /**
26
18
  * @internal
27
19
  */
28
- export type RouterCaller<TDef extends AnyRouterDef> = (
20
+ export type RouterCaller<TRoot extends AnyRootTypes, TRecord extends ProcedureRouterRecord> = (
29
21
  /**
30
22
  * @note
31
23
  * If passing a function, we recommend it's a cached function
32
24
  * e.g. wrapped in `React.cache` to avoid unnecessary computations
33
25
  */
34
- ctx: TDef['_config']['$types']['ctx'] | (() => MaybePromise<TDef['_config']['$types']['ctx']>)) => DecoratedProcedureRecord<TDef['record']>;
35
- export interface Router<TDef extends AnyRouterDef> {
36
- _def: TDef;
26
+ ctx: TRoot['ctx'] | (() => MaybePromise<TRoot['ctx']>)) => DecoratedProcedureRecord<TRecord>;
27
+ export interface Router<TRoot extends AnyRootTypes, TRecord extends ProcedureRouterRecord> {
28
+ _def: {
29
+ _config: RootConfig<TRoot>;
30
+ router: true;
31
+ procedure?: never;
32
+ procedures: TRecord;
33
+ record: TRecord;
34
+ };
37
35
  /**
38
36
  * @deprecated use `t.createCallerFactory(router)` instead
39
37
  * @link https://trpc.io/docs/v11/server/server-side-calls
40
38
  */
41
- createCaller: RouterCaller<TDef>;
39
+ createCaller: RouterCaller<TRoot, TRecord>;
42
40
  }
43
- export type AnyRouter = Router<AnyRouterDef>;
44
- type inferRouterDef<TRouter extends AnyRouter> = TRouter extends Router<infer TParams> ? TParams extends AnyRouterDef ? TParams : never : never;
45
- type inferRouterConfig<TRouter extends AnyRouter> = inferRouterDef<TRouter>['_config'];
46
- export type inferRouterContext<TRouter extends AnyRouter> = inferRouterConfig<TRouter>['$types']['ctx'];
47
- export type inferRouterError<TRouter extends AnyRouter> = inferRouterConfig<TRouter>['$types']['errorShape'];
48
- export type inferRouterMeta<TRouter extends AnyRouter> = inferRouterConfig<TRouter>['$types']['meta'];
49
- type GetInferenceHelpers<TType extends 'input' | 'output', TRouter extends AnyRouter> = {
41
+ export type BuiltRouter<TRoot extends AnyRootTypes, TRecord extends ProcedureRouterRecord> = Router<TRoot, TRecord> & TRecord;
42
+ export type AnyRouter = Router<any, any>;
43
+ export type inferRouterRootTypes<TRouter extends AnyRouter> = TRouter['_def']['_config']['$types'];
44
+ export type inferRouterContext<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['ctx'];
45
+ export type inferRouterError<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['errorShape'];
46
+ export type inferRouterMeta<TRouter extends AnyRouter> = inferRouterRootTypes<TRouter>['meta'];
47
+ export type GetInferenceHelpers<TType extends 'input' | 'output', TRouter extends AnyRouter> = {
50
48
  [TKey in keyof TRouter['_def']['record']]: TRouter['_def']['record'][TKey] extends infer TRouterOrProcedure ? TRouterOrProcedure extends AnyRouter ? GetInferenceHelpers<TType, TRouterOrProcedure> : TRouterOrProcedure extends AnyProcedure ? TType extends 'input' ? inferProcedureInput<TRouterOrProcedure> : inferTransformedProcedureOutput<TRouter, TRouterOrProcedure> : never : never;
51
49
  };
52
50
  export type inferRouterInputs<TRouter extends AnyRouter> = GetInferenceHelpers<'input', TRouter>;
@@ -54,32 +52,19 @@ export type inferRouterOutputs<TRouter extends AnyRouter> = GetInferenceHelpers<
54
52
  /**
55
53
  * @internal
56
54
  */
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
- /**
63
- * @internal
64
- */
65
- export declare function createRouterFactory<TRoot extends AnyRootTypes>(config: RootConfig<TRoot>): <TProcRouterRecord extends ProcedureRouterRecord>(procedures: TProcRouterRecord) => CreateRouterInner<TRoot, TProcRouterRecord>;
55
+ export declare function createRouterFactory<TRoot extends AnyRootTypes>(config: RootConfig<TRoot>): <TProcRouterRecord extends ProcedureRouterRecord>(procedures: TProcRouterRecord) => BuiltRouter<TRoot, TProcRouterRecord>;
66
56
  /**
67
57
  * @internal
68
58
  */
69
59
  export declare function callProcedure(opts: ProcedureCallOptions & {
70
60
  procedures: ProcedureRouterRecord;
71
61
  }): Promise<unknown>;
72
- export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <TRouter extends Router<RouterDef<TRoot, any>>>(router: TRouter) => RouterCaller<TRouter["_def"]>;
62
+ export declare function createCallerFactory<TRoot extends AnyRootTypes>(): <TRecord extends ProcedureRouterRecord>(router: Router<TRoot, TRecord>) => RouterCaller<TRoot, TRecord>;
73
63
  /** @internal */
74
- type MergeRouters<TRouters extends AnyRouter[], TRouterDef extends AnyRouterDef = RouterDef<TRouters[0]['_def']['_config']['$types'], {}>> = TRouters extends [
64
+ type MergeRouters<TRouters extends AnyRouter[], TRoot extends AnyRootTypes = TRouters[0]['_def']['_config']['$types'], TRecord extends ProcedureRouterRecord = {}> = TRouters extends [
75
65
  infer Head extends AnyRouter,
76
66
  ...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'];
67
+ ] ? MergeRouters<Tail, TRoot, Head['_def']['record'] & TRecord> : BuiltRouter<TRoot, TRecord>;
83
68
  export declare function mergeRouters<TRouters extends AnyRouter[]>(...routerList: [...TRouters]): MergeRouters<TRouters>;
84
69
  export {};
85
70
  //# 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,EAAE,MAAM,SAAS,CAAC;AAG5C,iBAAiB;AACjB,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAA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AAChB,KAAK,YAAY,CACf,QAAQ,SAAS,SAAS,EAAE,EAC5B,KAAK,SAAS,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,EAErE,OAAO,SAAS,qBAAqB,GAAG,EAAE,IACxC,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"}
@@ -142,9 +142,9 @@ function mergeRouters(...routerList) {
142
142
  const router = createRouterFactory({
143
143
  errorFormatter,
144
144
  transformer: transformer$1,
145
- isDev: routerList.some((r)=>r._def._config.isDev),
146
- allowOutsideOfServer: routerList.some((r)=>r._def._config.allowOutsideOfServer),
147
- isServer: routerList.some((r)=>r._def._config.isServer),
145
+ isDev: routerList.every((r)=>r._def._config.isDev),
146
+ allowOutsideOfServer: routerList.every((r)=>r._def._config.allowOutsideOfServer),
147
+ isServer: routerList.every((r)=>r._def._config.isServer),
148
148
  $types: routerList[0]?._def._config.$types
149
149
  })(record);
150
150
  return router;
@@ -140,9 +140,9 @@ function mergeRouters(...routerList) {
140
140
  const router = createRouterFactory({
141
141
  errorFormatter,
142
142
  transformer,
143
- isDev: routerList.some((r)=>r._def._config.isDev),
144
- allowOutsideOfServer: routerList.some((r)=>r._def._config.allowOutsideOfServer),
145
- isServer: routerList.some((r)=>r._def._config.isServer),
143
+ isDev: routerList.every((r)=>r._def._config.isDev),
144
+ allowOutsideOfServer: routerList.every((r)=>r._def._config.allowOutsideOfServer),
145
+ isServer: routerList.every((r)=>r._def._config.isServer),
146
146
  $types: routerList[0]?._def._config.$types
147
147
  })(record);
148
148
  return router;
@@ -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 Record<string, unknown> = Record<string, unknown>> {
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,CAC7B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE/D,IAAI,EAAE,sBAAsB,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,KAAK,CAAC;CACb;AAED;;GAEG;AACH,yBAAiB,QAAQ,CAAC;IACxB,KAAY,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAE/C;;OAEG;IACH,UAAiB,YAAY;QAC3B,EAAE,CAAC,EAAE,SAAS,CAAC;QACf,OAAO,CAAC,EAAE,KAAK,CAAC;KACjB;IAED,UAAiB,WAAW,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,CAC1D,SAAQ,YAAY;QACpB,MAAM,EAAE,OAAO,CAAC;KACjB;IAED,UAAiB,OAAO,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAAE,OAAO,GAAG,OAAO,CACzE,SAAQ,WAAW,CAAC,OAAO,CAAC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AC7B,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<Record<string, unknown>>> | import("./rpc").TRPCSuccessResponse<unknown> | ({
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 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/server",
3
- "version": "11.0.0-next-beta.240+1ef5fe131",
3
+ "version": "11.0.0-next-beta.242+4377b3cf6",
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": "1ef5fe131658bf73429ab43f6f3ba697d7919b09"
160
+ "gitHead": "4377b3cf6370c6af33064a7ae7c34299c8c00fa1"
161
161
  }
@@ -69,7 +69,8 @@ export async function nodeHTTPRequestHandler<
69
69
  const contentTypeHandler =
70
70
  contentTypeHandlers.find((handler) =>
71
71
  handler.isMatch({
72
- ...opts,
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
- ...opts,
81
+ // FIXME: no typecasting should be needed here
82
+ ...(opts as any),
81
83
  query,
82
84
  });
83
85
 
@@ -7,7 +7,7 @@
7
7
  * import type { HTTPBaseHandlerOptions } from '@trpc/server/http'
8
8
  * ```
9
9
  */
10
- import type { IncomingMessage, ServerResponse } from 'http';
10
+ import type * as http from 'http';
11
11
  // @trpc/server
12
12
  import type { AnyRouter, inferRouterContext } from '../../@trpc/server';
13
13
  // @trpc/server/http
@@ -23,11 +23,11 @@ interface ParsedQs {
23
23
  [key: string]: ParsedQs | ParsedQs[] | string[] | string | undefined;
24
24
  }
25
25
 
26
- export type NodeHTTPRequest = IncomingMessage & {
26
+ export type NodeHTTPRequest = http.IncomingMessage & {
27
27
  query?: ParsedQs;
28
28
  body?: unknown;
29
29
  };
30
- export type NodeHTTPResponse = ServerResponse & {
30
+ export type NodeHTTPResponse = http.ServerResponse & {
31
31
  /**
32
32
  * Force the partially-compressed response to be flushed to the client.
33
33
  *
@@ -9,7 +9,7 @@ import type { TRPCError } from './TRPCError';
9
9
  /**
10
10
  * @internal
11
11
  */
12
- export type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (args: {
12
+ export type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (opts: {
13
13
  error: TRPCError;
14
14
  type: ProcedureType | 'unknown';
15
15
  path: string | undefined;
@@ -18,19 +18,19 @@ export type ErrorFormatter<TContext, TShape extends TRPCErrorShape> = (args: {
18
18
  shape: DefaultErrorShape;
19
19
  }) => TShape;
20
20
 
21
- export type ErrorFormatterShape<TType> = TType extends ErrorFormatter<
22
- any,
23
- infer TShape
24
- >
25
- ? TShape
26
- : DefaultErrorShape;
27
21
  /**
28
22
  * @internal
29
23
  */
30
24
  export type DefaultErrorData = {
31
25
  code: TRPC_ERROR_CODE_KEY;
32
26
  httpStatus: number;
27
+ /**
28
+ * Path to the procedure that threw the error
29
+ */
33
30
  path?: string;
31
+ /**
32
+ * Stack trace of the error (only in development)
33
+ */
34
34
  stack?: string;
35
35
  };
36
36
 
@@ -1,3 +1,4 @@
1
+ import type { DefaultErrorData } from '../error/formatter';
1
2
  import type { TRPCError } from '../error/TRPCError';
2
3
  import type { TRPC_ERROR_CODES_BY_KEY, TRPCResponse } from '../rpc';
3
4
  import { TRPC_ERROR_CODES_BY_NUMBER } from '../rpc';
@@ -32,9 +33,11 @@ export function getHTTPStatusCode(json: TRPCResponse | TRPCResponse[]) {
32
33
  const httpStatuses = new Set(
33
34
  arr.map((res) => {
34
35
  if ('error' in res) {
35
- const data = res.error.data;
36
- if (typeof data['httpStatus'] === 'number') {
37
- return data['httpStatus'];
36
+ const data = res.error.data as
37
+ | Record<string, unknown>
38
+ | DefaultErrorData;
39
+ if (typeof data.httpStatus === 'number') {
40
+ return data.httpStatus;
38
41
  }
39
42
  const code = TRPC_ERROR_CODES_BY_NUMBER[res.error.code];
40
43
  return getStatusCodeFromKey(code);
@@ -132,51 +132,6 @@ function initResponse<
132
132
  };
133
133
  }
134
134
 
135
- async function inputToProcedureCall<
136
- TRouter extends AnyRouter,
137
- TRequest extends HTTPRequest,
138
- >(procedureOpts: {
139
- opts: Pick<
140
- ResolveHTTPRequestOptions<TRouter, TRequest>,
141
- 'onError' | 'req' | 'router'
142
- >;
143
- ctx: inferRouterContext<TRouter> | undefined;
144
- type: 'mutation' | 'query';
145
- input: unknown;
146
- path: string;
147
- }): Promise<TRPCResponse<unknown, inferRouterError<TRouter>>> {
148
- const { opts, ctx, type, input, path } = procedureOpts;
149
- try {
150
- const data = await callProcedure({
151
- procedures: opts.router._def.procedures,
152
- path,
153
- getRawInput: async () => input,
154
- ctx,
155
- type,
156
- });
157
- return {
158
- result: {
159
- data,
160
- },
161
- };
162
- } catch (cause) {
163
- const error = getTRPCErrorFromUnknown(cause);
164
-
165
- opts.onError?.({ error, path, input, ctx, type: type, req: opts.req });
166
-
167
- return {
168
- error: getErrorShape({
169
- config: opts.router._def._config,
170
- error,
171
- type,
172
- path,
173
- input,
174
- ctx,
175
- }),
176
- };
177
- }
178
- }
179
-
180
135
  function caughtErrorToData<
181
136
  TRouter extends AnyRouter,
182
137
  TRequest extends HTTPRequest,
@@ -331,9 +286,51 @@ export async function resolveHTTPResponse<
331
286
  })),
332
287
  };
333
288
  ctx = await opts.createContext({ info });
334
- const promises = paths.map((path, index) =>
335
- inputToProcedureCall({ opts, ctx, type, input: inputs[index], path }),
336
- );
289
+
290
+ const errors: TRPCError[] = [];
291
+
292
+ const promises: Promise<
293
+ TRPCResponse<unknown, inferRouterError<TRouter>>
294
+ >[] = paths.map(async (path, index) => {
295
+ const input = inputs[index];
296
+ try {
297
+ const data = await callProcedure({
298
+ procedures: opts.router._def.procedures,
299
+ path,
300
+ getRawInput: async () => input,
301
+ ctx,
302
+ type,
303
+ });
304
+ return {
305
+ result: {
306
+ data,
307
+ },
308
+ };
309
+ } catch (cause) {
310
+ const error = getTRPCErrorFromUnknown(cause);
311
+ errors.push(error);
312
+
313
+ opts.onError?.({
314
+ error,
315
+ path,
316
+ input,
317
+ ctx,
318
+ type: type,
319
+ req: opts.req,
320
+ });
321
+
322
+ return {
323
+ error: getErrorShape({
324
+ config: opts.router._def._config,
325
+ error,
326
+ type,
327
+ path,
328
+ input,
329
+ ctx,
330
+ }),
331
+ };
332
+ }
333
+ });
337
334
 
338
335
  if (!isStreamCall) {
339
336
  /**
@@ -344,9 +341,6 @@ export async function resolveHTTPResponse<
344
341
  */
345
342
 
346
343
  const untransformedJSON = await Promise.all(promises);
347
- const errors = untransformedJSON.flatMap((response) =>
348
- 'error' in response ? [response.error] : [],
349
- );
350
344
 
351
345
  const headResponse = initResponse({
352
346
  ctx,
@@ -52,8 +52,6 @@ export type { ProcedureBuilder } from './procedureBuilder';
52
52
  export * from './rootConfig';
53
53
  export type {
54
54
  AnyRouter,
55
- AnyRouterDef,
56
- CreateRouterInner,
57
55
  ProcedureRecord,
58
56
  ProcedureRouterRecord,
59
57
  Router,
@@ -3,7 +3,6 @@ import {
3
3
  defaultFormatter,
4
4
  type DefaultErrorShape,
5
5
  type ErrorFormatter,
6
- type ErrorFormatterShape,
7
6
  } from './error/formatter';
8
7
  import { createMiddlewareFactory } from './middleware';
9
8
  import { createBuilder } from './procedureBuilder';
@@ -16,8 +15,14 @@ import {
16
15
  } from './router';
17
16
  import type { DataTransformerOptions } from './transformer';
18
17
  import { defaultTransformer, getDataTransformer } from './transformer';
19
- import type { PickFirstDefined, Unwrap, ValidateShape } from './types';
18
+ import type { Unwrap, ValidateShape } from './types';
20
19
 
20
+ type inferErrorFormatterShape<TType> = TType extends ErrorFormatter<
21
+ any,
22
+ infer TShape
23
+ >
24
+ ? TShape
25
+ : DefaultErrorShape;
21
26
  interface RuntimeConfigOptions<TContext extends object, TMeta extends object>
22
27
  extends Partial<
23
28
  Omit<
@@ -66,12 +71,9 @@ class TRPCBuilder<TContext extends object, TMeta extends object> {
66
71
  type $Transformer = undefined extends TOptions['transformer']
67
72
  ? false
68
73
  : true;
69
- type $ErrorShape = ErrorFormatterShape<
70
- PickFirstDefined<
71
- TOptions['errorFormatter'],
72
- ErrorFormatter<TContext, DefaultErrorShape>
73
- >
74
- >;
74
+ type $ErrorShape = undefined extends TOptions['errorFormatter']
75
+ ? DefaultErrorShape
76
+ : inferErrorFormatterShape<TOptions['errorFormatter']>;
75
77
 
76
78
  type $Root = CreateRootTypes<{
77
79
  ctx: TContext;