@temporary-name/server 1.9.3-alpha.4275e976ddda4d8be107c2cfde9899bdea9a337d → 1.9.3-alpha.50b729ba628b987e14f5bd1004e5a04590fd4b4e

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 (33) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +12 -6
  2. package/dist/adapters/aws-lambda/index.d.ts +12 -6
  3. package/dist/adapters/aws-lambda/index.mjs +12 -4
  4. package/dist/adapters/fetch/index.d.mts +12 -6
  5. package/dist/adapters/fetch/index.d.ts +12 -6
  6. package/dist/adapters/fetch/index.mjs +12 -11
  7. package/dist/adapters/node/index.d.mts +12 -6
  8. package/dist/adapters/node/index.d.ts +12 -6
  9. package/dist/adapters/node/index.mjs +12 -11
  10. package/dist/adapters/standard/index.d.mts +23 -13
  11. package/dist/adapters/standard/index.d.ts +23 -13
  12. package/dist/adapters/standard/index.mjs +8 -100
  13. package/dist/index.d.mts +44 -368
  14. package/dist/index.d.ts +44 -368
  15. package/dist/index.mjs +108 -152
  16. package/dist/openapi/index.d.mts +220 -0
  17. package/dist/openapi/index.d.ts +220 -0
  18. package/dist/openapi/index.mjs +776 -0
  19. package/dist/plugins/index.d.mts +2 -2
  20. package/dist/plugins/index.d.ts +2 -2
  21. package/dist/shared/server.BEHw7Eyx.mjs +247 -0
  22. package/dist/shared/server.BVxcyR6X.mjs +287 -0
  23. package/dist/shared/{server.Btxrgkj5.d.ts → server.Bk5r0-2R.d.ts} +7 -24
  24. package/dist/shared/server.Bs6ka_UE.d.mts +23 -0
  25. package/dist/shared/{server.C1YnHvvf.d.ts → server.CZNLCQBm.d.mts} +3 -3
  26. package/dist/shared/{server.C1YnHvvf.d.mts → server.CZNLCQBm.d.ts} +3 -3
  27. package/dist/shared/{server.Bo94xDTv.d.mts → server.CbLTWfgn.d.mts} +7 -24
  28. package/dist/shared/server.D2UFMrxf.d.ts +23 -0
  29. package/dist/shared/{server.BEQrAa3A.mjs → server.DcfsPloY.mjs} +16 -21
  30. package/package.json +19 -13
  31. package/dist/shared/server.D6K9uoPI.mjs +0 -35
  32. package/dist/shared/server.DZ5BIITo.mjs +0 -9
  33. package/dist/shared/server.X0YaZxSJ.mjs +0 -13
package/dist/index.d.ts CHANGED
@@ -1,53 +1,13 @@
1
- import { AnySchema, ErrorMap, Meta, MergedErrorMap, Route, InferSchemaOutput, InferSchemaInput, EnhanceRouteOptions, AnyContractRouter, AnyContractProcedure, Schema, ContractRouter, ContractProcedureDef, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, ErrorFromErrorMap } from '@temporary-name/contract';
2
- export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@temporary-name/contract';
3
- import { IntersectPick, ClientContext, MaybeOptionalOptions, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
1
+ import { AnySchema, ErrorMap, Meta, EnhanceRouteOptions, MergedErrorMap, AnyContractRouter, AnyContractProcedure, ContractProcedure, Route, InferSchemaOutput, InferSchemaInput, ContractRouter, ContractProcedureDef, Schema, InferContractRouterErrorMap, InferContractRouterMeta, ErrorFromErrorMap } from '@temporary-name/contract';
2
+ export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
3
+ import { ClientContext, MaybeOptionalOptions, IntersectPick, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
4
4
  export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
5
- import { C as Context, b as Procedure, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, e as MapInputMiddleware, f as CreateProcedureClientOptions, g as ProcedureClient, h as AnyMiddleware, L as Lazyable, A as AnyRouter, i as Lazy, a as AnyProcedure, j as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.C1YnHvvf.js';
6
- export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, P as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.C1YnHvvf.js';
5
+ import { SchemaClass } from '@temporary-name/zod';
6
+ import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, A as AnyMiddleware, L as Lazyable, c as AnyRouter, d as Lazy, e as AnyProcedure, M as MergedInitialContext, f as Middleware, O as ORPCErrorConstructorMap, g as MergedCurrentContext, h as ProcedureHandler, R as Router, i as MapInputMiddleware, I as InferRouterInitialContext } from './shared/server.CZNLCQBm.js';
7
+ export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.CZNLCQBm.js';
7
8
  export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
8
9
 
9
10
  declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
10
- /**
11
- * Adds type-safe custom errors.
12
- * The provided errors are spared-merged with any existing errors.
13
- *
14
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
15
- */
16
- errors<U extends ErrorMap>(errors: U): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
17
- /**
18
- * Sets or updates the metadata.
19
- * The provided metadata is spared-merged with any existing metadata.
20
- *
21
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
22
- */
23
- meta(meta: TMeta): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
24
- /**
25
- * Sets or updates the route definition.
26
- * The provided route is spared-merged with any existing route.
27
- * This option is typically relevant when integrating with OpenAPI.
28
- *
29
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
30
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
31
- */
32
- route(route: Route): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
33
- /**
34
- * Uses a middleware to modify the context or improve the pipeline.
35
- *
36
- * @info Supports both normal middleware and inline middleware implementations.
37
- * @info Pass second argument to map the input.
38
- * @note The current context must be satisfy middleware dependent-context
39
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
40
- */
41
- use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
42
- /**
43
- * Uses a middleware to modify the context or improve the pipeline.
44
- *
45
- * @info Supports both normal middleware and inline middleware implementations.
46
- * @info Pass second argument to map the input.
47
- * @note The current context must be satisfy middleware dependent-context
48
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
49
- */
50
- use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): DecoratedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
51
11
  /**
52
12
  * Make this procedure callable (works like a function while still being a procedure).
53
13
  *
@@ -93,159 +53,48 @@ type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
93
53
  };
94
54
  declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
95
55
 
96
- interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
97
- /**
98
- * This property holds the defined options.
99
- */
100
- '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
101
- /**
102
- * Adds type-safe custom errors.
103
- * The provided errors are spared-merged with any existing errors.
104
- *
105
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
106
- */
107
- 'errors'<U extends ErrorMap>(errors: U): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
108
- /**
109
- * Uses a middleware to modify the context or improve the pipeline.
110
- *
111
- * @info Supports both normal middleware and inline middleware implementations.
112
- * @note The current context must be satisfy middleware dependent-context
113
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
114
- */
115
- 'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
116
- /**
117
- * Sets or updates the metadata.
118
- * The provided metadata is spared-merged with any existing metadata.
119
- *
120
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
121
- */
122
- 'meta'(meta: TMeta): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
123
- /**
124
- * Sets or updates the route definition.
125
- * The provided route is spared-merged with any existing route.
126
- * This option is typically relevant when integrating with OpenAPI.
127
- *
128
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
129
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
130
- */
131
- 'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
132
- /**
133
- * Defines the input validation schema.
134
- *
135
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
136
- */
137
- 'input'<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
138
- /**
139
- * Defines the output validation schema.
140
- *
141
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
142
- */
143
- 'output'<USchema extends AnySchema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
144
- /**
145
- * Defines the handler of the procedure.
146
- *
147
- * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
148
- */
149
- 'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, Schema<UFuncOutput, UFuncOutput>, TErrorMap, TMeta>;
150
- /**
151
- * Prefixes all procedures in the router.
152
- * The provided prefix is post-appended to any existing router prefix.
153
- *
154
- * @note This option does not affect procedures that do not define a path in their route definition.
155
- *
156
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
157
- */
158
- 'prefix'(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
159
- /**
160
- * Adds tags to all procedures in the router.
161
- * This helpful when you want to group procedures together in the OpenAPI specification.
162
- *
163
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
164
- */
165
- 'tag'(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
166
- /**
167
- * Applies all of the previously defined options to the specified router.
168
- *
169
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
170
- */
171
- 'router'<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
172
- /**
173
- * Create a lazy router
174
- * And applies all of the previously defined options to the specified router.
175
- *
176
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
177
- */
178
- 'lazyRoute'<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
179
- default: U;
180
- }>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, TErrorMap>;
181
- }
182
- interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
56
+ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
57
+ z: SchemaClass;
183
58
  /**
184
59
  * This property holds the defined options.
185
60
  */
186
- '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
61
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
62
+ constructor(def: BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>);
187
63
  /**
188
- * Adds type-safe custom errors.
189
- * The provided errors are spared-merged with any existing errors.
64
+ * Adds type-safe custom errors to the contract.
65
+ * The provided errors are spared-merged with any existing errors in the contract.
190
66
  *
191
67
  * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
192
68
  */
193
- 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
194
- /**
195
- * Uses a middleware to modify the context or improve the pipeline.
196
- *
197
- * @info Supports both normal middleware and inline middleware implementations.
198
- * @note The current context must be satisfy middleware dependent-context
199
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
200
- */
201
- 'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
69
+ errors<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
202
70
  /**
203
- * Sets or updates the metadata.
204
- * The provided metadata is spared-merged with any existing metadata.
71
+ * Sets or updates the metadata for the contract.
72
+ * The provided metadata is spared-merged with any existing metadata in the contract.
205
73
  *
206
74
  * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
207
75
  */
208
- 'meta'(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
76
+ meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
209
77
  /**
210
- * Sets or updates the route definition.
211
- * The provided route is spared-merged with any existing route.
78
+ * Sets or updates the route definition for the contract.
79
+ * The provided route is spared-merged with any existing route in the contract.
212
80
  * This option is typically relevant when integrating with OpenAPI.
213
81
  *
214
82
  * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
215
83
  * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
216
84
  */
217
- 'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
85
+ route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
218
86
  /**
219
87
  * Defines the input validation schema.
220
88
  *
221
89
  * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
222
90
  */
223
- 'input'<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
91
+ input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
224
92
  /**
225
93
  * Defines the output validation schema.
226
94
  *
227
95
  * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
228
96
  */
229
- 'output'<USchema extends AnySchema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
230
- /**
231
- * Defines the handler of the procedure.
232
- *
233
- * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
234
- */
235
- 'handler'<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, Schema<UFuncOutput, UFuncOutput>, TErrorMap, TMeta>;
236
- }
237
- interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
238
- /**
239
- * This property holds the defined options.
240
- */
241
- '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
242
- /**
243
- * Adds type-safe custom errors.
244
- * The provided errors are spared-merged with any existing errors.
245
- *
246
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
247
- */
248
- 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
97
+ output<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
249
98
  /**
250
99
  * Uses a middleware to modify the context or improve the pipeline.
251
100
  *
@@ -253,109 +102,18 @@ interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentCo
253
102
  * @note The current context must be satisfy middleware dependent-context
254
103
  * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
255
104
  */
256
- 'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilderWithOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
257
- /**
258
- * Sets or updates the metadata.
259
- * The provided metadata is spared-merged with any existing metadata.
260
- *
261
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
262
- */
263
- 'meta'(meta: TMeta): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
264
- /**
265
- * Sets or updates the route definition.
266
- * The provided route is spared-merged with any existing route.
267
- * This option is typically relevant when integrating with OpenAPI.
268
- *
269
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
270
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
271
- */
272
- 'route'(route: Route): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
273
- /**
274
- * Defines the input validation schema.
275
- *
276
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
277
- */
278
- 'input'<USchema extends AnySchema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
279
- /**
280
- * Defines the handler of the procedure.
281
- *
282
- * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
283
- */
284
- 'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
285
- }
286
- interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
287
- /**
288
- * This property holds the defined options.
289
- */
290
- '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
291
- /**
292
- * Adds type-safe custom errors.
293
- * The provided errors are spared-merged with any existing errors.
294
- *
295
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
296
- */
297
- 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
298
- /**
299
- * Uses a middleware to modify the context or improve the pipeline.
300
- *
301
- * @info Supports both normal middleware and inline middleware implementations.
302
- * @info Pass second argument to map the input.
303
- * @note The current context must be satisfy middleware dependent-context
304
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
305
- */
306
- 'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilderWithInputOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
307
- /**
308
- * Uses a middleware to modify the context or improve the pipeline.
309
- *
310
- * @info Supports both normal middleware and inline middleware implementations.
311
- * @info Pass second argument to map the input.
312
- * @note The current context must be satisfy middleware dependent-context
313
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
314
- */
315
- 'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): ProcedureBuilderWithInputOutput<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
316
- /**
317
- * Sets or updates the metadata.
318
- * The provided metadata is spared-merged with any existing metadata.
319
- *
320
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
321
- */
322
- 'meta'(meta: TMeta): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
323
- /**
324
- * Sets or updates the route definition.
325
- * The provided route is spared-merged with any existing route.
326
- * This option is typically relevant when integrating with OpenAPI.
327
- *
328
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
329
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
330
- */
331
- 'route'(route: Route): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
105
+ use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
106
+ useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
107
+ isGateEnabled: typeof isGateEnabled;
108
+ }>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TInferredGateName>;
332
109
  /**
333
110
  * Defines the handler of the procedure.
334
111
  *
335
112
  * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
336
113
  */
337
- 'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
114
+ handler(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
338
115
  }
339
- interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
340
- /**
341
- * This property holds the defined options.
342
- */
343
- '~orpc': EnhanceRouterOptions<TErrorMap>;
344
- /**
345
- * Adds type-safe custom errors.
346
- * The provided errors are spared-merged with any existing errors.
347
- *
348
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
349
- */
350
- 'errors'<U extends ErrorMap>(errors: U): RouterBuilder<TInitialContext, TCurrentContext, MergedErrorMap<TErrorMap, U>, TMeta>;
351
- /**
352
- * Uses a middleware to modify the context or improve the pipeline.
353
- *
354
- * @info Supports both normal middleware and inline middleware implementations.
355
- * @note The current context must be satisfy middleware dependent-context
356
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
357
- */
358
- 'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): RouterBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TErrorMap, TMeta>;
116
+ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName> {
359
117
  /**
360
118
  * Prefixes all procedures in the router.
361
119
  * The provided prefix is post-appended to any existing router prefix.
@@ -364,30 +122,36 @@ interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends
364
122
  *
365
123
  * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
366
124
  */
367
- 'prefix'(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
125
+ prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
368
126
  /**
369
127
  * Adds tags to all procedures in the router.
370
128
  * This helpful when you want to group procedures together in the OpenAPI specification.
371
129
  *
372
130
  * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
373
131
  */
374
- 'tag'(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
132
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
375
133
  /**
376
134
  * Applies all of the previously defined options to the specified router.
377
135
  *
378
136
  * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
379
137
  */
380
- 'router'<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
138
+ router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
381
139
  /**
382
140
  * Create a lazy router
383
141
  * And applies all of the previously defined options to the specified router.
384
142
  *
385
143
  * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
386
144
  */
387
- 'lazyRoute'<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
145
+ lazyRoute<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
388
146
  default: U;
389
147
  }>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, TErrorMap>;
390
148
  }
149
+ interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router' | 'lazyRoute'> {
150
+ /**
151
+ * This property holds the defined options.
152
+ */
153
+ '~orpc': EnhanceRouterOptions<TErrorMap>;
154
+ }
391
155
 
392
156
  interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> extends Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta> {
393
157
  /**
@@ -411,23 +175,18 @@ interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Co
411
175
  }
412
176
  declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta>(middleware: Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>): DecoratedMiddleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>;
413
177
 
414
- interface BuilderDef<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
178
+ interface BuilderDef<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
415
179
  middlewares: readonly AnyMiddleware[];
416
180
  inputValidationIndex: number;
417
181
  outputValidationIndex: number;
418
182
  }
419
- declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> {
420
- /**
421
- * This property holds the defined options.
422
- */
423
- '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
424
- constructor(def: BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>);
183
+ declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName> {
425
184
  /**
426
185
  * Set or override the initial context.
427
186
  *
428
187
  * @see {@link https://orpc.unnoq.com/docs/context Context Docs}
429
188
  */
430
- $context<U extends Context>(): Builder<U & Record<never, never>, U, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
189
+ $context<U extends Context>(): Builder<U, U, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
431
190
  /**
432
191
  * Creates a middleware.
433
192
  *
@@ -435,89 +194,6 @@ declare class Builder<TInitialContext extends Context, TCurrentContext extends C
435
194
  */
436
195
  middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
437
196
  middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, TMeta>;
438
- /**
439
- * Adds type-safe custom errors.
440
- * The provided errors are spared-merged with any existing errors.
441
- *
442
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
443
- */
444
- errors<U extends ErrorMap>(errors: U): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
445
- /**
446
- * Uses a middleware to modify the context or improve the pipeline.
447
- *
448
- * @info Supports both normal middleware and inline middleware implementations.
449
- * @note The current context must be satisfy middleware dependent-context
450
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
451
- */
452
- use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
453
- useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
454
- isGateEnabled: typeof isGateEnabled;
455
- }>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TInferredGateName>;
456
- /**
457
- * Sets or updates the metadata.
458
- * The provided metadata is spared-merged with any existing metadata.
459
- *
460
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
461
- */
462
- meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
463
- /**
464
- * Sets or updates the route definition.
465
- * The provided route is spared-merged with any existing route.
466
- * This option is typically relevant when integrating with OpenAPI.
467
- *
468
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
469
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
470
- */
471
- route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
472
- /**
473
- * Defines the input validation schema.
474
- *
475
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
476
- */
477
- input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
478
- /**
479
- * Defines the output validation schema.
480
- *
481
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
482
- */
483
- output<USchema extends AnySchema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
484
- /**
485
- * Defines the handler of the procedure.
486
- *
487
- * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
488
- */
489
- handler<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, Schema<UFuncOutput, UFuncOutput>, TErrorMap, TMeta>;
490
- /**
491
- * Prefixes all procedures in the router.
492
- * The provided prefix is post-appended to any existing router prefix.
493
- *
494
- * @note This option does not affect procedures that do not define a path in their route definition.
495
- *
496
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
497
- */
498
- prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
499
- /**
500
- * Adds tags to all procedures in the router.
501
- * This helpful when you want to group procedures together in the OpenAPI specification.
502
- *
503
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
504
- */
505
- tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
506
- /**
507
- * Applies all of the previously defined options to the specified router.
508
- *
509
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
510
- */
511
- router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
512
- /**
513
- * Create a lazy router
514
- * And applies all of the previously defined options to the specified router.
515
- *
516
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
517
- */
518
- lazyRoute<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
519
- default: U;
520
- }>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, TErrorMap>;
521
197
  }
522
198
  type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>, Schema<unknown, unknown>, Schema<unknown, unknown>, Record<never, never>, TMeta, never>;
523
199
  interface ApiBuilderOpts<TMeta extends Meta> {
@@ -559,7 +235,7 @@ interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext
559
235
  * Like `ProcedureBuilderWithoutHandler`, but removed all method that can change the contract.
560
236
  */
561
237
  interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
562
- '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, string>;
238
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
563
239
  /**
564
240
  * Uses a middleware to modify the context or improve the pipeline.
565
241
  *
@@ -661,7 +337,7 @@ type Implementer<TContract extends AnyContractRouter, TInitialContext extends Co
661
337
  *
662
338
  * @see {@link https://orpc.unnoq.com/docs/context Context Docs}
663
339
  */
664
- $context<U extends Context>(): Implementer<TContract, U & Record<never, never>, U>;
340
+ $context<U extends Context>(): Implementer<TContract, U, U>;
665
341
  } & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
666
342
  declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T): Implementer<T, TContext, TContext>;
667
343
 
@@ -701,5 +377,5 @@ declare function createRouterClient<T extends AnyRouter, TClientContext extends
701
377
  declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
702
378
  declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
703
379
 
704
- export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
705
- export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, BuilderWithMiddlewares, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureBuilder, ProcedureBuilderWithInputOutput, ProcedureBuilderWithOutput, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProcedureCallbackOptions, TraverseContractProceduresOptions, UnlaziedRouter };
380
+ export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
381
+ export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProcedureCallbackOptions, TraverseContractProceduresOptions, UnlaziedRouter };