@orpc/server 2.0.0-beta.24 → 2.0.0-beta.26

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/aws-lambda/index.d.mts +1 -12
  2. package/dist/adapters/aws-lambda/index.d.ts +1 -12
  3. package/dist/adapters/aws-lambda/index.mjs +2 -9
  4. package/dist/adapters/crossws/index.d.mts +1 -1
  5. package/dist/adapters/crossws/index.d.ts +1 -1
  6. package/dist/adapters/crossws/index.mjs +1 -1
  7. package/dist/adapters/fastify/index.d.mts +1 -12
  8. package/dist/adapters/fastify/index.d.ts +1 -12
  9. package/dist/adapters/fastify/index.mjs +2 -9
  10. package/dist/adapters/fetch/index.d.mts +1 -12
  11. package/dist/adapters/fetch/index.d.ts +1 -12
  12. package/dist/adapters/fetch/index.mjs +2 -9
  13. package/dist/adapters/message-port/index.d.mts +1 -1
  14. package/dist/adapters/message-port/index.d.ts +1 -1
  15. package/dist/adapters/message-port/index.mjs +1 -1
  16. package/dist/adapters/node/index.d.mts +1 -12
  17. package/dist/adapters/node/index.d.ts +1 -12
  18. package/dist/adapters/node/index.mjs +2 -9
  19. package/dist/adapters/standard/index.d.mts +1 -1
  20. package/dist/adapters/standard/index.d.ts +1 -1
  21. package/dist/adapters/standard/index.mjs +1 -1
  22. package/dist/adapters/websocket/index.d.mts +1 -1
  23. package/dist/adapters/websocket/index.d.ts +1 -1
  24. package/dist/adapters/websocket/index.mjs +1 -1
  25. package/dist/index.d.mts +260 -0
  26. package/dist/index.d.ts +260 -0
  27. package/dist/index.mjs +73 -0
  28. package/dist/plugins/index.d.mts +49 -11
  29. package/dist/plugins/index.d.ts +49 -11
  30. package/dist/plugins/index.mjs +75 -3
  31. package/dist/shared/{server.BUvC0G_8.d.ts → server.C2n16pp0.d.ts} +24 -2
  32. package/dist/shared/{server.DEGjTAPW.mjs → server.Cbv46U7N.mjs} +19 -3
  33. package/dist/shared/{server.zySQaS-n.d.mts → server.CkNnZ5F-.d.mts} +24 -2
  34. package/package.json +5 -4
  35. package/dist/shared/server.D_QauotT.mjs +0 -30
package/dist/index.d.mts CHANGED
@@ -55,67 +55,327 @@ type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
55
55
  */
56
56
  declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
57
57
 
58
+ /**
59
+ * The builder variant returned after `.use` is called.
60
+ * `.$context` and `.$config` are no longer available once middleware is applied.
61
+ *
62
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
63
+ */
58
64
  interface BuilderWithMiddlewares<TInitialContext extends Context, TInjectedContext extends Context, TErrorMap extends ErrorMap> {
59
65
  '~orpc': BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
66
+ /**
67
+ * Applies metadata plugins to procedures built from this builder.
68
+ *
69
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
70
+ */
60
71
  'meta'(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithMiddlewares<TInitialContext, TInjectedContext, TErrorMap>;
72
+ /**
73
+ * Defines typesafe errors that procedures built from this builder can throw
74
+ * via the `errors` utility in handlers and middleware.
75
+ *
76
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
77
+ */
61
78
  'errors'<T extends ErrorMap>(errors: T): BuilderWithMiddlewares<TInitialContext, TInjectedContext, MergedErrorMap<TErrorMap, T>>;
79
+ /**
80
+ * Applies a middleware that runs before the handler of every procedure
81
+ * built from this builder.
82
+ *
83
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
84
+ */
62
85
  'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, MergedErrorMap<$ErrorMap, TErrorMap>>;
86
+ /**
87
+ * Creates a standalone middleware that can be composed and applied to any
88
+ * compatible builder or procedure with `.use`.
89
+ *
90
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
91
+ */
63
92
  'middleware'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $Input, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $Output = any>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, $Input, $Output, TErrorMap>): DecoratedMiddleware<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, $Input, $Output, TErrorMap>;
93
+ /**
94
+ * Defines the input schema used to validate and type the procedure input.
95
+ *
96
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
97
+ */
64
98
  'input'<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, T, TErrorMap>;
99
+ /**
100
+ * Defines the output schema used to validate and type the procedure output.
101
+ *
102
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
103
+ */
65
104
  'output'<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, T, TErrorMap>;
105
+ /**
106
+ * Defines the function that implements the procedure and completes the
107
+ * chain, returning a callable procedure.
108
+ *
109
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
110
+ */
66
111
  'handler'<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<Exclude<T, AnyORPCError>>, TErrorMap, Extract<T, AnyORPCError>>;
112
+ /**
113
+ * Applies the builder's middleware, errors, and metadata to every procedure
114
+ * in the given router.
115
+ *
116
+ * @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
117
+ */
67
118
  'router'<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(router: T): AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>;
119
+ /**
120
+ * Like `.router`, but loads the router lazily on first access, which helps
121
+ * reduce startup time for large applications.
122
+ *
123
+ * @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
124
+ */
68
125
  'lazy'<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(loader: () => Promise<{
69
126
  default: T;
70
127
  }>): Lazy<AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>>;
71
128
  }
129
+ /**
130
+ * The builder variant returned after `.input` is called.
131
+ * Only procedure-level methods remain available once an input schema is defined.
132
+ *
133
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
134
+ */
72
135
  interface BuilderWithInput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TErrorMap extends ErrorMap> {
73
136
  '~orpc': BuilderDefinition<TInputSchema, InitialOutputSchema, TErrorMap>;
137
+ /**
138
+ * Applies metadata plugins to procedures built from this builder.
139
+ *
140
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
141
+ */
74
142
  'meta'(...plugins: MetaPlugin<TInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, TErrorMap>;
143
+ /**
144
+ * Defines typesafe errors that procedures built from this builder can throw
145
+ * via the `errors` utility in handlers and middleware.
146
+ *
147
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
148
+ */
75
149
  'errors'<T extends ErrorMap>(errors: T): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, MergedErrorMap<TErrorMap, T>>;
150
+ /**
151
+ * Applies a middleware that runs before the handler and can access the
152
+ * validated input.
153
+ *
154
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
155
+ */
76
156
  'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithInput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TInputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
157
+ /**
158
+ * Adds an additional input schema, merged with the previously defined one.
159
+ *
160
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
161
+ */
77
162
  'input'<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TErrorMap>;
163
+ /**
164
+ * Defines the output schema used to validate and type the procedure output.
165
+ *
166
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
167
+ */
78
168
  'output'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, T, TErrorMap>;
169
+ /**
170
+ * Defines the function that implements the procedure and completes the
171
+ * chain, returning a callable procedure.
172
+ *
173
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
174
+ */
79
175
  'handler'<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<Exclude<T, AnyORPCError>>, TErrorMap, Extract<T, AnyORPCError>>;
80
176
  }
177
+ /**
178
+ * The builder variant returned after `.output` is called.
179
+ * Only procedure-level methods remain available once an output schema is defined.
180
+ *
181
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
182
+ */
81
183
  interface BuilderWithOutput<TInitialContext extends Context, TInjectedContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
82
184
  '~orpc': BuilderDefinition<InitialInputSchema, TOutputSchema, TErrorMap>;
185
+ /**
186
+ * Applies metadata plugins to procedures built from this builder.
187
+ *
188
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
189
+ */
83
190
  'meta'(...plugins: MetaPlugin<InitialInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, TErrorMap>;
191
+ /**
192
+ * Defines typesafe errors that procedures built from this builder can throw
193
+ * via the `errors` utility in handlers and middleware.
194
+ *
195
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
196
+ */
84
197
  'errors'<T extends ErrorMap>(errors: T): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
198
+ /**
199
+ * Applies a middleware that runs before the handler and can access the
200
+ * typed output.
201
+ *
202
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
203
+ */
85
204
  'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<TOutputSchema>, $ErrorMap>): BuilderWithOutput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TOutputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
205
+ /**
206
+ * Defines the input schema used to validate and type the procedure input.
207
+ *
208
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
209
+ */
86
210
  'input'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, T, TOutputSchema, TErrorMap>;
211
+ /**
212
+ * Adds an additional output schema, merged with the previously defined one.
213
+ *
214
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
215
+ */
87
216
  'output'<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, MergedSchema<T, TOutputSchema>, TErrorMap>;
217
+ /**
218
+ * Defines the function that implements the procedure and completes the
219
+ * chain, returning a callable procedure.
220
+ *
221
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
222
+ */
88
223
  'handler'<T extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap, Extract<T, AnyORPCError>>;
89
224
  }
225
+ /**
226
+ * The builder variant returned after both `.input` and `.output` are called.
227
+ * Only procedure-level methods remain available.
228
+ *
229
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
230
+ */
90
231
  interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
91
232
  '~orpc': BuilderDefinition<TInputSchema, TOutputSchema, TErrorMap>;
233
+ /**
234
+ * Applies metadata plugins to procedures built from this builder.
235
+ *
236
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
237
+ */
92
238
  'meta'(...plugins: MetaPlugin<TInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
239
+ /**
240
+ * Defines typesafe errors that procedures built from this builder can throw
241
+ * via the `errors` utility in handlers and middleware.
242
+ *
243
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
244
+ */
93
245
  'errors'<T extends ErrorMap>(errors: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
246
+ /**
247
+ * Applies a middleware that runs before the handler and can access the
248
+ * validated input and typed output.
249
+ *
250
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
251
+ */
94
252
  'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, $ErrorMap>): BuilderWithInputOutput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TInputSchema, TOutputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
253
+ /**
254
+ * Adds an additional input schema, merged with the previously defined one.
255
+ *
256
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
257
+ */
95
258
  'input'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TOutputSchema, TErrorMap>;
259
+ /**
260
+ * Adds an additional output schema, merged with the previously defined one.
261
+ *
262
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
263
+ */
96
264
  'output'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, MergedSchema<T, TOutputSchema>, TErrorMap>;
265
+ /**
266
+ * Defines the function that implements the procedure and completes the
267
+ * chain, returning a callable procedure.
268
+ *
269
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
270
+ */
97
271
  'handler'<T extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, Extract<T, AnyORPCError>>;
98
272
  }
99
273
 
274
+ /**
275
+ * The initial context type used when `.$context` is not called.
276
+ * Augment this interface with `declare module '@orpc/server'` to define
277
+ * a default initial context type globally.
278
+ *
279
+ * @see {@link https://orpc.dev/docs/context#default-initial-context | Context - Default Initial Context}
280
+ */
100
281
  interface DefaultInitialContext {
101
282
  }
102
283
  interface BuilderDefinition<TInputSchema extends AnySchema, TInjectedContext extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TInjectedContext, TErrorMap>, ProcedureConfig {
103
284
  orderedMiddlewares: OrderedMiddleware[];
104
285
  }
286
+ /**
287
+ * The procedure builder behind `os`. Chain its methods to gradually define
288
+ * context, middleware, errors, schemas, and finally a handler or router.
289
+ *
290
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
291
+ */
105
292
  declare class Builder<TInitialContext extends Context, TErrorMap extends ErrorMap> {
106
293
  '~orpc': BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
294
+ /**
295
+ * Private constructor to prevent direct instantiation.
296
+ * Use the static `create` method to initialize a new instance with a safe initial definition.
297
+ */
107
298
  private constructor();
299
+ /**
300
+ * Creates a fresh builder with an empty definition.
301
+ * Prefer the exported `os` instance over calling this directly.
302
+ *
303
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
304
+ */
108
305
  static create<T extends Context = DefaultInitialContext>(): Builder<T & object, Record<never, never>>;
306
+ /**
307
+ * Declares the initial context type that must be provided when executing
308
+ * procedures built from this builder.
309
+ *
310
+ * @see {@link https://orpc.dev/docs/context#initial-context | Context - Initial Context}
311
+ */
109
312
  $context<T extends Context = DefaultInitialContext>(): Builder<T & object, TErrorMap>;
313
+ /**
314
+ * Overrides the procedure configuration, such as disabling runtime
315
+ * input/output validation.
316
+ *
317
+ * @see {@link https://orpc.dev/docs/advanced/validation-customization | Validation Customization}
318
+ */
110
319
  $config(config: ProcedureConfig): Builder<TInitialContext, TErrorMap>;
320
+ /**
321
+ * Applies metadata plugins to procedures built from this builder.
322
+ *
323
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
324
+ */
111
325
  meta(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): Builder<TInitialContext, TErrorMap>;
326
+ /**
327
+ * Defines typesafe errors that procedures built from this builder can throw
328
+ * via the `errors` utility in handlers and middleware.
329
+ *
330
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
331
+ */
112
332
  errors<U extends ErrorMap>(errors: U): Builder<TInitialContext, MergedErrorMap<TErrorMap, U>>;
333
+ /**
334
+ * Applies a middleware that runs before the handler of every procedure
335
+ * built from this builder.
336
+ *
337
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
338
+ */
113
339
  use<$OutContext extends IntersectPick<TInitialContext, $OutContext>, $InContext extends Context = TInitialContext, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | TInitialContext, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, object, $InContext>, $OutContext, MergedErrorMap<$ErrorMap, TErrorMap>>;
340
+ /**
341
+ * Creates a standalone middleware that can be composed and applied to any
342
+ * compatible builder or procedure with `.use`.
343
+ *
344
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
345
+ */
114
346
  middleware<$OutContext extends IntersectPick<TInitialContext, $OutContext>, $Input, $Output = any>(middleware: Middleware<TInitialContext, $OutContext, $Input, $Output, TErrorMap>): DecoratedMiddleware<TInitialContext, $OutContext, $Input, $Output, TErrorMap>;
347
+ /**
348
+ * Defines the input schema used to validate and type the procedure input.
349
+ *
350
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
351
+ */
115
352
  input<$ extends AnySchema>(schema: $): BuilderWithInput<TInitialContext, object, $, TErrorMap>;
353
+ /**
354
+ * Defines the output schema used to validate and type the procedure output.
355
+ *
356
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
357
+ */
116
358
  output<$ extends AnySchema>(schema: $): BuilderWithOutput<TInitialContext, object, $, TErrorMap>;
359
+ /**
360
+ * Defines the function that implements the procedure and completes the
361
+ * chain, returning a callable procedure.
362
+ *
363
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
364
+ */
117
365
  handler<T>(handler: ProcedureHandler<TInitialContext, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<Exclude<T, AnyORPCError>>, TErrorMap, Extract<T, AnyORPCError>>;
366
+ /**
367
+ * Applies the builder's middleware, errors, and metadata to every procedure
368
+ * in the given router.
369
+ *
370
+ * @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
371
+ */
118
372
  router<T extends AnyRouter>(router: T): AugmentedRouter<T, TErrorMap>;
373
+ /**
374
+ * Like `.router`, but loads the router lazily on first access, which helps
375
+ * reduce startup time for large applications.
376
+ *
377
+ * @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
378
+ */
119
379
  lazy<T extends AnyRouter>(loader: () => Promise<{
120
380
  default: T;
121
381
  }>): Lazy<AugmentedRouter<T, TErrorMap>>;