@trpc/server 11.0.0-next-beta.283 → 11.0.0-next-beta.286

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.
@@ -2,7 +2,7 @@ export { TRPCError,
2
2
  /**
3
3
  * @deprecated use `experimental_trpcMiddleware` instead
4
4
  */
5
- experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type RouterRecord as TRPCRouterRecord, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type ProcedureOptions as TRPCProcedureOptions, } from '../../unstable-core-do-not-import';
5
+ experimental_standaloneMiddleware, experimental_standaloneMiddleware as experimental_trpcMiddleware, initTRPC, callProcedure as callTRPCProcedure, getTRPCErrorFromUnknown, transformTRPCResponse, createFlatProxy as createTRPCFlatProxy, type inferProcedureInput, type inferProcedureOutput, type inferProcedureBuilderResolverOptions, type inferRouterError, type inferRouterInputs, type inferRouterOutputs, type inferRouterContext, type inferTransformedProcedureOutput, type inferTransformedSubscriptionOutput, type AnyProcedure as AnyTRPCProcedure, type AnyRouter as AnyTRPCRouter, type AnyMiddlewareFunction as AnyTRPCMiddlewareFunction, type CombinedDataTransformer as TRPCCombinedDataTransformer, type ProcedureType as TRPCProcedureType, type AnyMutationProcedure as AnyTRPCMutationProcedure, type AnyQueryProcedure as AnyTRPCQueryProcedure, type RouterRecord as TRPCRouterRecord, type AnySubscriptionProcedure as AnyTRPCSubscriptionProcedure, type ProcedureOptions as TRPCProcedureOptions, } from '../../unstable-core-do-not-import';
6
6
  export type {
7
7
  /**
8
8
  * @deprecated use `AnyTRPCProcedure` instead
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/@trpc/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS;AACT;;GAEG;AACH,iCAAiC,EACjC,iCAAiC,IAAI,2BAA2B,EAChE,QAAQ,EAER,aAAa,IAAI,iBAAiB,EAClC,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,IAAI,mBAAmB,EACtC,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,iBAAiB,IAAI,qBAAqB,EAC/C,KAAK,YAAY,IAAI,gBAAgB,EACrC,KAAK,wBAAwB,IAAI,4BAA4B,EAC7D,KAAK,gBAAgB,IAAI,oBAAoB,GAC9C,MAAM,mCAAmC,CAAC;AAE3C,YAAY;AACV;;GAEG;AACH,YAAY;AACZ;;GAEG;AACH,SAAS;AACT;;GAEG;AACH,qBAAqB;AACrB;;GAEG;AACH,uBAAuB;AAEvB;;GAEG;AACH,IAAI;AAEJ;;GAEG;AACH,WAAW;AACX;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,iBAAiB;AACjB;;GAEG;AACH,wBAAwB,GACzB,M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ACX;;GAEG;AACH,aAAa;AACb;;GAEG;AACH,oBAAoB;AAEpB;;GAEG;AACH,iBAAiB;AACjB;;GAEG;AACH,wBAAwB,GACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO;AACL;;GAEG;AACH,aAAa;AAEb;;GAEG;AACH,aAAa,GACd,MAAM,mCAAmC,CAAC;AAE3C;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,IACxE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
- "bundleSize": 92285,
3
- "bundleOrigSize": 145552,
4
- "bundleReduction": 36.6,
2
+ "bundleSize": 92133,
3
+ "bundleOrigSize": 146326,
4
+ "bundleReduction": 37.04,
5
5
  "modules": [
6
6
  {
7
7
  "id": "/src/adapters/ws.ts",
@@ -14,7 +14,7 @@
14
14
  "dependents": [
15
15
  "/src/adapters/fastify/fastifyTRPCPlugin.ts"
16
16
  ],
17
- "percent": 10.8,
17
+ "percent": 10.82,
18
18
  "reduction": 0
19
19
  },
20
20
  {
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "removedExports": [],
28
28
  "dependents": [],
29
- "percent": 10.03,
29
+ "percent": 10.05,
30
30
  "reduction": 21.53
31
31
  },
32
32
  {
@@ -45,13 +45,13 @@
45
45
  "/src/unstable-core-do-not-import/http/resolveHTTPResponse.ts",
46
46
  "/src/unstable-core-do-not-import/initTRPC.ts"
47
47
  ],
48
- "percent": 6.54,
48
+ "percent": 6.56,
49
49
  "reduction": 38.32
50
50
  },
51
51
  {
52
52
  "id": "/src/unstable-core-do-not-import/procedureBuilder.ts",
53
53
  "size": 5602,
54
- "origSize": 11765,
54
+ "origSize": 12775,
55
55
  "renderedExports": [
56
56
  "unsetMarker",
57
57
  "createBuilder"
@@ -61,8 +61,8 @@
61
61
  "/src/unstable-core-do-not-import.ts",
62
62
  "/src/unstable-core-do-not-import/initTRPC.ts"
63
63
  ],
64
- "percent": 6.07,
65
- "reduction": 52.38
64
+ "percent": 6.08,
65
+ "reduction": 56.15
66
66
  },
67
67
  {
68
68
  "id": "/src/adapters/node-http/content-type/form-data/fileUploadHandler.ts",
@@ -77,7 +77,7 @@
77
77
  "dependents": [
78
78
  "/src/adapters/node-http/content-type/form-data/index.ts"
79
79
  ],
80
- "percent": 5.39,
80
+ "percent": 5.4,
81
81
  "reduction": 36.77
82
82
  },
83
83
  {
@@ -91,7 +91,7 @@
91
91
  ],
92
92
  "removedExports": [],
93
93
  "dependents": [],
94
- "percent": 4.79,
94
+ "percent": 4.8,
95
95
  "reduction": 32.71
96
96
  },
97
97
  {
@@ -119,7 +119,7 @@
119
119
  "dependents": [
120
120
  "/src/adapters/fetch/index.ts"
121
121
  ],
122
- "percent": 3.85,
122
+ "percent": 3.86,
123
123
  "reduction": 9.5
124
124
  },
125
125
  {
@@ -154,7 +154,7 @@
154
154
  "dependents": [
155
155
  "/src/adapters/aws-lambda/index.ts"
156
156
  ],
157
- "percent": 3.58,
157
+ "percent": 3.59,
158
158
  "reduction": 36.48
159
159
  },
160
160
  {
@@ -173,20 +173,6 @@
173
173
  "percent": 3.23,
174
174
  "reduction": 0
175
175
  },
176
- {
177
- "id": "/src/unstable-core-do-not-import/initTRPC.ts",
178
- "size": 2879,
179
- "origSize": 4716,
180
- "renderedExports": [
181
- "initTRPC"
182
- ],
183
- "removedExports": [],
184
- "dependents": [
185
- "/src/unstable-core-do-not-import.ts"
186
- ],
187
- "percent": 3.12,
188
- "reduction": 38.95
189
- },
190
176
  {
191
177
  "id": "/src/unstable-core-do-not-import/transformer.ts",
192
178
  "size": 2744,
@@ -204,9 +190,23 @@
204
190
  "/src/unstable-core-do-not-import/router.ts",
205
191
  "/src/unstable-core-do-not-import/initTRPC.ts"
206
192
  ],
207
- "percent": 2.97,
193
+ "percent": 2.98,
208
194
  "reduction": 45.94
209
195
  },
196
+ {
197
+ "id": "/src/unstable-core-do-not-import/initTRPC.ts",
198
+ "size": 2727,
199
+ "origSize": 4480,
200
+ "renderedExports": [
201
+ "initTRPC"
202
+ ],
203
+ "removedExports": [],
204
+ "dependents": [
205
+ "/src/unstable-core-do-not-import.ts"
206
+ ],
207
+ "percent": 2.96,
208
+ "reduction": 39.13
209
+ },
210
210
  {
211
211
  "id": "/src/adapters/fastify/fastifyRequestHandler.ts",
212
212
  "size": 2590,
@@ -239,7 +239,7 @@
239
239
  "/src/unstable-core-do-not-import/initTRPC.ts",
240
240
  "/src/unstable-core-do-not-import/procedureBuilder.ts"
241
241
  ],
242
- "percent": 2.79,
242
+ "percent": 2.8,
243
243
  "reduction": 55.95
244
244
  },
245
245
  {
@@ -251,7 +251,7 @@
251
251
  ],
252
252
  "removedExports": [],
253
253
  "dependents": [],
254
- "percent": 2.75,
254
+ "percent": 2.76,
255
255
  "reduction": 31.37
256
256
  },
257
257
  {
@@ -341,7 +341,7 @@
341
341
  "/src/unstable-core-do-not-import/router.ts",
342
342
  "/src/unstable-core-do-not-import/initTRPC.ts"
343
343
  ],
344
- "percent": 1.63,
344
+ "percent": 1.64,
345
345
  "reduction": 5.58
346
346
  },
347
347
  {
@@ -658,9 +658,9 @@
658
658
  "reduction": 100
659
659
  },
660
660
  {
661
- "id": "/src/unstable-core-do-not-import.ts",
661
+ "id": "/src/shared.ts",
662
662
  "size": 0,
663
- "origSize": 1552,
663
+ "origSize": 653,
664
664
  "renderedExports": [],
665
665
  "removedExports": [],
666
666
  "dependents": [],
@@ -668,9 +668,9 @@
668
668
  "reduction": 100
669
669
  },
670
670
  {
671
- "id": "/src/shared.ts",
671
+ "id": "/src/unstable-core-do-not-import.ts",
672
672
  "size": 0,
673
- "origSize": 653,
673
+ "origSize": 1552,
674
674
  "renderedExports": [],
675
675
  "removedExports": [],
676
676
  "dependents": [],
@@ -716,9 +716,9 @@
716
716
  "renderedExports": [],
717
717
  "removedExports": [],
718
718
  "dependents": [
719
+ "/src/adapters/express.ts",
719
720
  "/src/adapters/next.ts",
720
- "/src/adapters/standalone.ts",
721
- "/src/adapters/express.ts"
721
+ "/src/adapters/standalone.ts"
722
722
  ],
723
723
  "percent": 0,
724
724
  "reduction": 100
@@ -39,8 +39,8 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
39
39
  _config: RootConfig<{
40
40
  ctx: TContext;
41
41
  meta: TMeta;
42
- errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
43
- transformer: undefined extends TOptions["transformer"] ? false : true;
42
+ errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
43
+ transformer: undefined extends TOptions['transformer'] ? false : true;
44
44
  }>;
45
45
  /**
46
46
  * Builder object for creating procedures
@@ -60,14 +60,14 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
60
60
  <TInput extends import("./router").RouterRecord>(input: TInput): import("./router").BuiltRouter<{
61
61
  ctx: TContext;
62
62
  meta: TMeta;
63
- errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
64
- transformer: undefined extends TOptions["transformer"] ? false : true;
63
+ errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
64
+ transformer: undefined extends TOptions['transformer'] ? false : true;
65
65
  }, TInput>;
66
66
  <TInput_1 extends import("./router").CreateRouterOptions>(input: TInput_1): import("./router").BuiltRouter<{
67
67
  ctx: TContext;
68
68
  meta: TMeta;
69
- errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
70
- transformer: undefined extends TOptions["transformer"] ? false : true;
69
+ errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
70
+ transformer: undefined extends TOptions['transformer'] ? false : true;
71
71
  }, import("./router").DecorateCreateRouterOptions<TInput_1>>;
72
72
  };
73
73
  /**
@@ -82,13 +82,13 @@ declare class TRPCBuilder<TContext extends object, TMeta extends object> {
82
82
  createCallerFactory: <TRecord extends import("./router").RouterRecord>(router: import("./router").Router<{
83
83
  ctx: TContext;
84
84
  meta: TMeta;
85
- errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
86
- transformer: undefined extends TOptions["transformer"] ? false : true;
85
+ errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
86
+ transformer: undefined extends TOptions['transformer'] ? false : true;
87
87
  }, TRecord>) => import("./router").RouterCaller<{
88
88
  ctx: TContext;
89
89
  meta: TMeta;
90
- errorShape: undefined extends TOptions["errorFormatter"] ? DefaultErrorShape : inferErrorFormatterShape<TOptions["errorFormatter"]>;
91
- transformer: undefined extends TOptions["transformer"] ? false : true;
90
+ errorShape: undefined extends TOptions['errorFormatter'] ? DefaultErrorShape : inferErrorFormatterShape<TOptions['errorFormatter']>;
91
+ transformer: undefined extends TOptions['transformer'] ? false : true;
92
92
  }, TRecord>;
93
93
  };
94
94
  }
@@ -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,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ers#initialize-trpc
27
27
  */ create(opts) {
28
- const errorFormatter = opts?.errorFormatter ?? formatter.defaultFormatter;
29
- const transformer$1 = transformer.getDataTransformer(opts?.transformer ?? transformer.defaultTransformer);
30
28
  const config = {
31
- transformer: transformer$1,
32
- isDev: opts?.isDev ?? // eslint-disable-next-line @typescript-eslint/dot-notation
33
- globalThis.process?.env?.['NODE_ENV'] !== 'production',
29
+ transformer: transformer.getDataTransformer(opts?.transformer ?? transformer.defaultTransformer),
30
+ isDev: opts?.isDev ?? globalThis.process?.env?.NODE_ENV !== 'production',
34
31
  allowOutsideOfServer: opts?.allowOutsideOfServer ?? false,
35
- errorFormatter,
32
+ errorFormatter: opts?.errorFormatter ?? formatter.defaultFormatter,
36
33
  isServer: opts?.isServer ?? rootConfig.isServerDefault,
37
34
  /**
38
35
  * These are just types, they can't be used at runtime
@@ -23,14 +23,11 @@ class TRPCBuilder {
23
23
  * Create the root object
24
24
  * @link https://trpc.io/docs/v11/server/routers#initialize-trpc
25
25
  */ create(opts) {
26
- const errorFormatter = opts?.errorFormatter ?? defaultFormatter;
27
- const transformer = getDataTransformer(opts?.transformer ?? defaultTransformer);
28
26
  const config = {
29
- transformer,
30
- isDev: opts?.isDev ?? // eslint-disable-next-line @typescript-eslint/dot-notation
31
- globalThis.process?.env?.['NODE_ENV'] !== 'production',
27
+ transformer: getDataTransformer(opts?.transformer ?? defaultTransformer),
28
+ isDev: opts?.isDev ?? globalThis.process?.env?.NODE_ENV !== 'production',
32
29
  allowOutsideOfServer: opts?.allowOutsideOfServer ?? false,
33
- errorFormatter,
30
+ errorFormatter: opts?.errorFormatter ?? defaultFormatter,
34
31
  isServer: opts?.isServer ?? isServerDefault,
35
32
  /**
36
33
  * These are just types, they can't be used at runtime
@@ -21,20 +21,28 @@ type ProcedureBuilderDef<TMeta> = {
21
21
  };
22
22
  type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
23
23
  /**
24
- * Procedure resolver options
24
+ * Procedure resolver options (what the `.query()`, `.mutation()`, and `.subscription()` functions receive)
25
25
  * @internal
26
26
  */
27
- interface ResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
27
+ export interface ProcedureResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
28
28
  ctx: Simplify<Overwrite<TContext, TContextOverridesIn>>;
29
29
  input: TInputOut extends UnsetMarker ? undefined : TInputOut;
30
30
  }
31
31
  /**
32
32
  * A procedure resolver
33
33
  */
34
- type ProcedureResolver<TContext, _TMeta, TContextOverrides, TInputOut, TOutputParserIn, $Output> = (opts: {
35
- ctx: Simplify<Overwrite<TContext, TContextOverrides>>;
36
- input: TInputOut extends UnsetMarker ? undefined : TInputOut;
37
- }) => MaybePromise<DefaultValue<TOutputParserIn, $Output>>;
34
+ type ProcedureResolver<TContext, TMeta, TContextOverrides, TInputOut, TOutputParserIn, $Output> = (opts: ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut>) => MaybePromise<DefaultValue<TOutputParserIn, $Output>>;
35
+ export type AnyProcedureBuilder = ProcedureBuilder<any, any, any, any, any, any, any>;
36
+ /**
37
+ * Infer the context type from a procedure builder
38
+ * Useful to create common helper functions for different procedures
39
+ */
40
+ export type inferProcedureBuilderResolverOptions<TProcedureBuilder extends AnyProcedureBuilder> = TProcedureBuilder extends ProcedureBuilder<infer TContext, infer TMeta, infer TContextOverrides, infer _TInputIn, infer TInputOut, infer _TOutputIn, infer _TOutputOut> ? ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut extends UnsetMarker ? unknown : TInputOut extends object ? Simplify<TInputOut & {
41
+ /**
42
+ * Extra input params might have been added by a `.input()` further down the chain
43
+ */
44
+ [keyAddedByInputCallFurtherDown: string]: unknown;
45
+ }> : TInputOut> : never;
38
46
  export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn, TInputOut, TOutputIn, TOutputOut> {
39
47
  /**
40
48
  * Add an input parser to the procedure.
@@ -85,7 +93,7 @@ export interface ProcedureBuilder<TContext, TMeta, TContextOverrides, TInputIn,
85
93
  */
86
94
  _def: ProcedureBuilderDef<TMeta>;
87
95
  }
88
- type ProcedureBuilderResolver = (opts: ResolverOptions<any, any, any, any>) => Promise<unknown>;
96
+ type ProcedureBuilderResolver = (opts: ProcedureResolverOptions<any, any, any, any>) => Promise<unknown>;
89
97
  export declare function createBuilder<TContext, TMeta>(initDef?: Partial<AnyProcedureBuilderDef>): ProcedureBuilder<TContext, TMeta, object, UnsetMarker, UnsetMarker, UnsetMarker, UnsetMarker>;
90
98
  /**
91
99
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAKV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,KAAK,kBAAkB,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,SAAS,WAAW,GAC7D,KAAK,GACL,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAE5B,gBAAgB;AAChB,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,KAAK,WAAW,GAAG,OAAO,WAAW,CAAC;AACtC,KAAK,YAAY,CAAC,MAAM,EAAE,SAAS,IAAI,MAAM,SAAS,WAAW,GAC7D,SAAS,GACT,MAAM,CAAC;AAEX,KAAK,mBAAmB,CAAC,KAAK,IAAI;IAChC,SAAS,EAAE,IAA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,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,KACtC,OAAO,CAAC,OAAO,CAAC,CAAC;AAiBtB,wBAAgB,aAAa,CAAC,QAAQ,EAAE,KAAK,EAC3C,OAAO,GAAE,OAAO,CAAC,sBAAsB,CAAM,GAC5C,gBAAgB,CACjB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,CACZ,CAuEA;AAwBD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,OAAO,CAAC;IACb,WAAW,EAAE,aAAa,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;CACrB"}
1
+ {"version":3,"file":"procedureBuilder.d.ts","sourceRoot":"","sources":["../../src/unstable-core-do-not-import/procedureBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAEnB,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAKV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAGjB,KAAK,kBAAkB,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,SAAS,WAAW,GAC7D,KAAK,GACL,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;AAE5B,gBAAgB;AAChB,eAAO,MAAM,WAAW,eAAwB,CAAC;AACjD,KAAK,WAAW,GAAG,OAAO,WAAW,CAAC;AACtC,KAAK,YAAY,CAAC,MAAM,EA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11.0.0-next-beta.286+361675f0a",
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": "44a1b58a3f21dae230cf290a71d93614d469e63b"
160
+ "gitHead": "361675f0a5b3e7eaf8d6982a32dbfd0f0b40a5a5"
161
161
  }
@@ -13,6 +13,7 @@ export {
13
13
  createFlatProxy as createTRPCFlatProxy,
14
14
  type inferProcedureInput,
15
15
  type inferProcedureOutput,
16
+ type inferProcedureBuilderResolverOptions,
16
17
  type inferRouterError,
17
18
  type inferRouterInputs,
18
19
  type inferRouterOutputs,
@@ -68,33 +68,20 @@ class TRPCBuilder<TContext extends object, TMeta extends object> {
68
68
  | ValidateShape<TOptions, RuntimeConfigOptions<TContext, TMeta>>
69
69
  | undefined,
70
70
  ) {
71
- type $Transformer = undefined extends TOptions['transformer']
72
- ? false
73
- : true;
74
- type $ErrorShape = undefined extends TOptions['errorFormatter']
75
- ? DefaultErrorShape
76
- : inferErrorFormatterShape<TOptions['errorFormatter']>;
77
-
78
71
  type $Root = CreateRootTypes<{
79
72
  ctx: TContext;
80
73
  meta: TMeta;
81
- errorShape: $ErrorShape;
82
- transformer: $Transformer;
74
+ errorShape: undefined extends TOptions['errorFormatter']
75
+ ? DefaultErrorShape
76
+ : inferErrorFormatterShape<TOptions['errorFormatter']>;
77
+ transformer: undefined extends TOptions['transformer'] ? false : true;
83
78
  }>;
84
79
 
85
- const errorFormatter = opts?.errorFormatter ?? defaultFormatter;
86
- const transformer = getDataTransformer(
87
- opts?.transformer ?? defaultTransformer,
88
- );
89
-
90
80
  const config: RootConfig<$Root> = {
91
- transformer,
92
- isDev:
93
- opts?.isDev ??
94
- // eslint-disable-next-line @typescript-eslint/dot-notation
95
- globalThis.process?.env?.['NODE_ENV'] !== 'production',
81
+ transformer: getDataTransformer(opts?.transformer ?? defaultTransformer),
82
+ isDev: opts?.isDev ?? globalThis.process?.env?.NODE_ENV !== 'production',
96
83
  allowOutsideOfServer: opts?.allowOutsideOfServer ?? false,
97
- errorFormatter,
84
+ errorFormatter: opts?.errorFormatter ?? defaultFormatter,
98
85
  isServer: opts?.isServer ?? isServerDefault,
99
86
  /**
100
87
  * These are just types, they can't be used at runtime
@@ -58,10 +58,15 @@ type ProcedureBuilderDef<TMeta> = {
58
58
  type AnyProcedureBuilderDef = ProcedureBuilderDef<any>;
59
59
 
60
60
  /**
61
- * Procedure resolver options
61
+ * Procedure resolver options (what the `.query()`, `.mutation()`, and `.subscription()` functions receive)
62
62
  * @internal
63
63
  */
64
- interface ResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
64
+ export interface ProcedureResolverOptions<
65
+ TContext,
66
+ _TMeta,
67
+ TContextOverridesIn,
68
+ TInputOut,
69
+ > {
65
70
  ctx: Simplify<Overwrite<TContext, TContextOverridesIn>>;
66
71
  input: TInputOut extends UnsetMarker ? undefined : TInputOut;
67
72
  }
@@ -71,20 +76,64 @@ interface ResolverOptions<TContext, _TMeta, TContextOverridesIn, TInputOut> {
71
76
  */
72
77
  type ProcedureResolver<
73
78
  TContext,
74
- _TMeta,
79
+ TMeta,
75
80
  TContextOverrides,
76
81
  TInputOut,
77
82
  TOutputParserIn,
78
83
  $Output,
79
- > = (opts: {
80
- ctx: Simplify<Overwrite<TContext, TContextOverrides>>;
81
- input: TInputOut extends UnsetMarker ? undefined : TInputOut;
82
- }) => MaybePromise<
84
+ > = (
85
+ opts: ProcedureResolverOptions<TContext, TMeta, TContextOverrides, TInputOut>,
86
+ ) => MaybePromise<
83
87
  // If an output parser is defined, we need to return what the parser expects, otherwise we return the inferred type
84
88
  DefaultValue<TOutputParserIn, $Output>
85
89
  >;
86
90
 
87
91
  type AnyResolver = ProcedureResolver<any, any, any, any, any, any>;
92
+ export type AnyProcedureBuilder = ProcedureBuilder<
93
+ any,
94
+ any,
95
+ any,
96
+ any,
97
+ any,
98
+ any,
99
+ any
100
+ >;
101
+
102
+ /**
103
+ * Infer the context type from a procedure builder
104
+ * Useful to create common helper functions for different procedures
105
+ */
106
+ export type inferProcedureBuilderResolverOptions<
107
+ TProcedureBuilder extends AnyProcedureBuilder,
108
+ > = TProcedureBuilder extends ProcedureBuilder<
109
+ infer TContext,
110
+ infer TMeta,
111
+ infer TContextOverrides,
112
+ infer _TInputIn,
113
+ infer TInputOut,
114
+ infer _TOutputIn,
115
+ infer _TOutputOut
116
+ >
117
+ ? ProcedureResolverOptions<
118
+ TContext,
119
+ TMeta,
120
+ TContextOverrides,
121
+ TInputOut extends UnsetMarker
122
+ ? // if input is not set, we don't want to infer it as `undefined` since a procedure further down the chain might have set an input
123
+ unknown
124
+ : TInputOut extends object
125
+ ? Simplify<
126
+ TInputOut & {
127
+ /**
128
+ * Extra input params might have been added by a `.input()` further down the chain
129
+ */
130
+ [keyAddedByInputCallFurtherDown: string]: unknown;
131
+ }
132
+ >
133
+ : TInputOut
134
+ >
135
+ : never;
136
+
88
137
  export interface ProcedureBuilder<
89
138
  TContext,
90
139
  TMeta,
@@ -236,9 +285,8 @@ export interface ProcedureBuilder<
236
285
  _def: ProcedureBuilderDef<TMeta>;
237
286
  }
238
287
 
239
- type AnyProcedureBuilder = ProcedureBuilder<any, any, any, any, any, any, any>;
240
288
  type ProcedureBuilderResolver = (
241
- opts: ResolverOptions<any, any, any, any>,
289
+ opts: ProcedureResolverOptions<any, any, any, any>,
242
290
  ) => Promise<unknown>;
243
291
 
244
292
  function createNewBuilder(
@@ -274,16 +322,6 @@ export function createBuilder<TContext, TMeta>(
274
322
  ...initDef,
275
323
  };
276
324
 
277
- type AnyProcedureBuilder = ProcedureBuilder<
278
- any,
279
- any,
280
- any,
281
- any,
282
- any,
283
- any,
284
- any
285
- >;
286
-
287
325
  const builder: AnyProcedureBuilder = {
288
326
  _def,
289
327
  input(input) {