@temporary-name/server 1.9.3-alpha.50b729ba628b987e14f5bd1004e5a04590fd4b4e → 1.9.3-alpha.52ad782be6ff2aac22845e524cd6454f857fb89b

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 (28) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +3 -3
  2. package/dist/adapters/aws-lambda/index.d.ts +3 -3
  3. package/dist/adapters/aws-lambda/index.mjs +3 -3
  4. package/dist/adapters/fetch/index.d.mts +3 -3
  5. package/dist/adapters/fetch/index.d.ts +3 -3
  6. package/dist/adapters/fetch/index.mjs +3 -3
  7. package/dist/adapters/node/index.d.mts +3 -3
  8. package/dist/adapters/node/index.d.ts +3 -3
  9. package/dist/adapters/node/index.mjs +3 -3
  10. package/dist/adapters/standard/index.d.mts +4 -4
  11. package/dist/adapters/standard/index.d.ts +4 -4
  12. package/dist/adapters/standard/index.mjs +3 -3
  13. package/dist/index.d.mts +46 -96
  14. package/dist/index.d.ts +46 -96
  15. package/dist/index.mjs +15 -215
  16. package/dist/openapi/index.mjs +30 -64
  17. package/dist/plugins/index.d.mts +2 -2
  18. package/dist/plugins/index.d.ts +2 -2
  19. package/dist/shared/{server.Bs6ka_UE.d.mts → server.B-pKBQ0r.d.mts} +2 -2
  20. package/dist/shared/{server.D2UFMrxf.d.ts → server.BQV-lt_s.d.ts} +2 -2
  21. package/dist/shared/{server.DcfsPloY.mjs → server.BdGbIyq8.mjs} +211 -17
  22. package/dist/shared/{server.Bk5r0-2R.d.ts → server.DAzElr6Q.d.ts} +1 -1
  23. package/dist/shared/{server.CZNLCQBm.d.mts → server.Do2Whl-h.d.mts} +114 -71
  24. package/dist/shared/{server.CZNLCQBm.d.ts → server.Do2Whl-h.d.ts} +114 -71
  25. package/dist/shared/{server.CbLTWfgn.d.mts → server.KIlJQ8K_.d.mts} +1 -1
  26. package/dist/shared/{server.BEHw7Eyx.mjs → server.Kxw442A9.mjs} +1 -1
  27. package/dist/shared/{server.BVxcyR6X.mjs → server.SmOM3Fae.mjs} +17 -42
  28. package/package.json +10 -10
@@ -1,5 +1,5 @@
1
- import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@temporary-name/contract';
2
- import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, HTTPPath, Promisable, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
1
+ import { ErrorMap, ErrorMapItem, InferSchemaInput, Schemas, Meta, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferSchemaOutput, EnhanceRouteOptions, MergedErrorMap, AnyContractProcedure, ContractRouter, AnySchema, ErrorFromErrorMap } from '@temporary-name/contract';
2
+ import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, Promisable, HTTPPath, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
3
3
 
4
4
  type Context = Record<PropertyKey, any>;
5
5
  type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
@@ -13,38 +13,11 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
13
13
  };
14
14
  declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
15
15
 
16
- declare const LAZY_SYMBOL: unique symbol;
17
- interface LazyMeta {
18
- prefix?: HTTPPath;
19
- }
20
- interface Lazy<T> {
21
- [LAZY_SYMBOL]: {
22
- loader: () => Promise<{
23
- default: T;
24
- }>;
25
- meta: LazyMeta;
26
- };
27
- }
28
- type Lazyable<T> = T | Lazy<T>;
29
- /**
30
- * Creates a lazy-loaded item.
31
- *
32
- * @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
33
- */
34
- declare function lazy<T>(loader: () => Promise<{
35
- default: T;
36
- }>, meta?: LazyMeta): Lazy<T>;
37
- declare function isLazy(item: unknown): item is Lazy<any>;
38
- declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
39
- declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
40
- default: T extends Lazy<infer U> ? U : T;
41
- }>;
42
-
43
16
  interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
44
17
  context: TCurrentContext;
45
18
  input: TInput;
46
19
  path: readonly string[];
47
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
20
+ procedure: Procedure<Context, Context, Schemas, ErrorMap, TMeta>;
48
21
  signal?: AbortSignal;
49
22
  lastEventId: string | undefined;
50
23
  errors: TErrorConstructorMap;
@@ -52,7 +25,7 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
52
25
  interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
53
26
  (opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
54
27
  }
55
- interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
28
+ interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta> {
56
29
  __initialContext?: (type: TInitialContext) => unknown;
57
30
  middlewares: readonly AnyMiddleware[];
58
31
  inputValidationIndex: number;
@@ -64,14 +37,14 @@ interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends
64
37
  *
65
38
  * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
66
39
  */
67
- declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
40
+ declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> {
68
41
  /**
69
42
  * This property holds the defined options.
70
43
  */
71
- '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
72
- constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
44
+ '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
45
+ constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>);
73
46
  }
74
- type AnyProcedure = Procedure<any, any, AnySchema, AnySchema, any, any>;
47
+ type AnyProcedure = Procedure<any, any, Schemas, any, any>;
75
48
  declare function isProcedure(item: unknown): item is AnyProcedure;
76
49
 
77
50
  type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
@@ -92,7 +65,7 @@ interface MiddlewareOutputFn<TOutput> {
92
65
  interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
93
66
  context: TInContext;
94
67
  path: readonly string[];
95
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
68
+ procedure: Procedure<Context, Context, Schemas, ErrorMap, TMeta>;
96
69
  signal?: AbortSignal;
97
70
  lastEventId: string | undefined;
98
71
  next: MiddlewareNextFn<TOutput>;
@@ -112,41 +85,13 @@ interface MapInputMiddleware<TInput, TMappedInput> {
112
85
  }
113
86
  declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
114
87
 
115
- type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
116
- interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
117
- context: TInitialContext;
118
- input: unknown;
119
- errors: ORPCErrorConstructorMap<TErrorMap>;
120
- path: readonly string[];
121
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
122
- signal?: AbortSignal;
123
- lastEventId: string | undefined;
124
- }
125
- type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
126
- /**
127
- * This is helpful for logging and analytics.
128
- */
129
- path?: readonly string[];
130
- interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
131
- } & (Record<never, never> extends TInitialContext ? {
132
- context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
133
- } : {
134
- context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
135
- });
136
- /**
137
- * Create Server-side client from a procedure.
138
- *
139
- * @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
140
- */
141
- declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
142
-
143
88
  /**
144
89
  * Represents a router, which defines a hierarchical structure of procedures.
145
90
  *
146
91
  * @info A procedure is a router too.
147
92
  * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#contract-router Contract Router Docs}
148
93
  */
149
- type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
94
+ type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer USchemas, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, USchemas, UErrorMap, UMeta> : {
150
95
  [K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
151
96
  };
152
97
  type AnyRouter = Router<any, any>;
@@ -157,7 +102,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infe
157
102
  * @info A procedure is a router too.
158
103
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
159
104
  */
160
- type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
105
+ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any> ? UInitialContext : {
161
106
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
162
107
  };
163
108
  /**
@@ -166,7 +111,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
166
111
  * @info A procedure is a router too.
167
112
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
168
113
  */
169
- type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
114
+ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any> ? UCurrentContext : {
170
115
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
171
116
  };
172
117
  /**
@@ -175,7 +120,7 @@ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any,
175
120
  * @info A procedure is a router too.
176
121
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
177
122
  */
178
- type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
123
+ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer USchemas, any, any> ? InferSchemaInput<USchemas['inputSchema']> : {
179
124
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
180
125
  };
181
126
  /**
@@ -184,9 +129,107 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
184
129
  * @info A procedure is a router too.
185
130
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
186
131
  */
187
- type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
132
+ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, infer USchemas, any, any> ? InferSchemaOutput<USchemas['outputSchema']> : {
188
133
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
189
134
  };
190
135
 
191
- export { isProcedure as D, createProcedureClient as F, Procedure as P, createORPCErrorConstructorMap as l, mergeCurrentContext as m, LAZY_SYMBOL as n, lazy as p, isLazy as q, getLazyMeta as r, unlazy as u, middlewareOutputFn as y };
192
- export type { AnyMiddleware as A, ProcedureDef as B, Context as C, ProcedureClientInterceptorOptions as E, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, MergedInitialContext as M, ORPCErrorConstructorMap as O, Router as R, CreateProcedureClientOptions as a, ProcedureClient as b, AnyRouter as c, Lazy as d, AnyProcedure as e, Middleware as f, MergedCurrentContext as g, ProcedureHandler as h, MapInputMiddleware as i, ORPCErrorConstructorMapItemOptions as j, ORPCErrorConstructorMapItem as k, LazyMeta as o, MiddlewareResult as s, MiddlewareNextFnOptions as t, MiddlewareNextFn as v, MiddlewareOutputFn as w, MiddlewareOptions as x, ProcedureHandlerOptions as z };
136
+ declare function getRouter<T extends Lazyable<AnyRouter | undefined>>(router: T, path: readonly string[]): T extends Lazy<any> ? Lazy<AnyRouter | undefined> : Lazyable<AnyRouter | undefined>;
137
+ type AccessibleLazyRouter<T extends Lazyable<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : T extends AnyProcedure | undefined ? Lazy<T> : Lazy<T> & {
138
+ [K in keyof T]: T[K] extends Lazyable<AnyRouter> ? AccessibleLazyRouter<T[K]> : never;
139
+ };
140
+ declare function createAccessibleLazyRouter<T extends Lazy<AnyRouter | undefined>>(lazied: T): AccessibleLazyRouter<T>;
141
+ type EnhancedRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap> = T extends Lazy<infer U extends AnyRouter> ? AccessibleLazyRouter<EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>> : T extends (Procedure<infer UInitialContext, infer UCurrentContext, infer USchemas, infer UErrorMap, infer UMeta>) ? Procedure<MergedInitialContext<TInitialContext, UInitialContext, TCurrentContext>, UCurrentContext, USchemas, MergedErrorMap<TErrorMap, UErrorMap>, UMeta> : {
142
+ [K in keyof T]: T[K] extends Lazyable<AnyRouter> ? EnhancedRouter<T[K], TInitialContext, TCurrentContext, TErrorMap> : never;
143
+ };
144
+ interface EnhanceRouterOptions<TErrorMap extends ErrorMap> extends EnhanceRouteOptions {
145
+ middlewares: readonly AnyMiddleware[];
146
+ errorMap: TErrorMap;
147
+ dedupeLeadingMiddlewares: boolean;
148
+ }
149
+ declare function enhanceRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap>(router: T, options: EnhanceRouterOptions<TErrorMap>): EnhancedRouter<T, TInitialContext, TCurrentContext, TErrorMap>;
150
+ interface TraverseContractProceduresOptions {
151
+ router: AnyContractRouter | AnyRouter;
152
+ path: readonly string[];
153
+ }
154
+ interface TraverseContractProcedureCallbackOptions {
155
+ contract: AnyContractProcedure | AnyProcedure;
156
+ path: readonly string[];
157
+ }
158
+ /**
159
+ * @deprecated Use `TraverseContractProcedureCallbackOptions` instead.
160
+ */
161
+ type ContractProcedureCallbackOptions = TraverseContractProcedureCallbackOptions;
162
+ interface LazyTraverseContractProceduresOptions {
163
+ router: Lazy<AnyRouter>;
164
+ path: readonly string[];
165
+ }
166
+ declare function traverseContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void, lazyOptions?: LazyTraverseContractProceduresOptions[]): LazyTraverseContractProceduresOptions[];
167
+ declare function resolveContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void): Promise<void>;
168
+ type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
169
+ [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? UnlaziedRouter<U> : never;
170
+ };
171
+ declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
172
+
173
+ declare const LAZY_SYMBOL: unique symbol;
174
+ interface LazyMeta {
175
+ prefix?: HTTPPath;
176
+ }
177
+ interface Lazy<T> {
178
+ [LAZY_SYMBOL]: {
179
+ loader: () => Promise<{
180
+ default: T;
181
+ }>;
182
+ meta: LazyMeta;
183
+ };
184
+ }
185
+ type Lazyable<T> = T | Lazy<T>;
186
+ /**
187
+ * @internal
188
+ */
189
+ declare function lazyInternal<T>(loader: () => Promise<{
190
+ default: T;
191
+ }>, meta?: LazyMeta): Lazy<T>;
192
+ /**
193
+ * Creates a lazy-loaded item.
194
+ *
195
+ * @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
196
+ */
197
+ declare function lazy<T extends Router<ContractRouter<{}>, any>>(prefix: HTTPPath, loader: () => Promise<{
198
+ default: T;
199
+ }>): EnhancedRouter<Lazy<T>, {}, {}, {}>;
200
+ declare function isLazy(item: unknown): item is Lazy<any>;
201
+ declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
202
+ declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
203
+ default: T extends Lazy<infer U> ? U : T;
204
+ }>;
205
+
206
+ type ProcedureClient<TClientContext extends ClientContext, TSchemas extends Schemas, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TSchemas['inputSchema']>, InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
207
+ interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
208
+ context: TInitialContext;
209
+ input: unknown;
210
+ errors: ORPCErrorConstructorMap<TErrorMap>;
211
+ path: readonly string[];
212
+ procedure: Procedure<Context, Context, Schemas, ErrorMap, TMeta>;
213
+ signal?: AbortSignal;
214
+ lastEventId: string | undefined;
215
+ }
216
+ type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema | undefined, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
217
+ /**
218
+ * This is helpful for logging and analytics.
219
+ */
220
+ path?: readonly string[];
221
+ interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
222
+ } & (Record<never, never> extends TInitialContext ? {
223
+ context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
224
+ } : {
225
+ context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
226
+ });
227
+ /**
228
+ * Create Server-side client from a procedure.
229
+ *
230
+ * @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
231
+ */
232
+ declare function createProcedureClient<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TSchemas, TErrorMap>;
233
+
234
+ export { traverseContractProcedures as $, middlewareOutputFn as B, isProcedure as G, createProcedureClient as J, Procedure as P, getRouter as T, createAccessibleLazyRouter as V, enhanceRouter as W, resolveContractProcedures as a0, unlazyRouter as a2, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazyInternal as q, lazy as r, isLazy as s, getLazyMeta as t, unlazy as u };
235
+ export type { AnyMiddleware as A, Context as C, ProcedureHandlerOptions as D, EnhanceRouterOptions as E, ProcedureDef as F, ProcedureClientInterceptorOptions as H, InferRouterInitialContext as I, InferRouterInitialContexts as K, Lazy as L, Middleware as M, InferRouterCurrentContexts as N, ORPCErrorConstructorMap as O, InferRouterInputs as Q, Router as R, InferRouterOutputs as S, AccessibleLazyRouter as U, TraverseContractProceduresOptions as X, TraverseContractProcedureCallbackOptions as Y, ContractProcedureCallbackOptions as Z, LazyTraverseContractProceduresOptions as _, CreateProcedureClientOptions as a, UnlaziedRouter as a1, ProcedureClient as b, MergedInitialContext as c, MergedCurrentContext as d, ProcedureHandler as e, EnhancedRouter as f, MapInputMiddleware as g, AnyProcedure as h, Lazyable as i, AnyRouter as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as v, MiddlewareNextFnOptions as w, MiddlewareNextFn as x, MiddlewareOutputFn as y, MiddlewareOptions as z };
@@ -1,5 +1,5 @@
1
- import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@temporary-name/contract';
2
- import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, HTTPPath, Promisable, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
1
+ import { ErrorMap, ErrorMapItem, InferSchemaInput, Schemas, Meta, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferSchemaOutput, EnhanceRouteOptions, MergedErrorMap, AnyContractProcedure, ContractRouter, AnySchema, ErrorFromErrorMap } from '@temporary-name/contract';
2
+ import { ORPCErrorCode, MaybeOptionalOptions, ORPCErrorOptions, ORPCError, Promisable, HTTPPath, ClientContext, Interceptor, PromiseWithError, Value, Client } from '@temporary-name/shared';
3
3
 
4
4
  type Context = Record<PropertyKey, any>;
5
5
  type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
@@ -13,38 +13,11 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
13
13
  };
14
14
  declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
15
15
 
16
- declare const LAZY_SYMBOL: unique symbol;
17
- interface LazyMeta {
18
- prefix?: HTTPPath;
19
- }
20
- interface Lazy<T> {
21
- [LAZY_SYMBOL]: {
22
- loader: () => Promise<{
23
- default: T;
24
- }>;
25
- meta: LazyMeta;
26
- };
27
- }
28
- type Lazyable<T> = T | Lazy<T>;
29
- /**
30
- * Creates a lazy-loaded item.
31
- *
32
- * @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
33
- */
34
- declare function lazy<T>(loader: () => Promise<{
35
- default: T;
36
- }>, meta?: LazyMeta): Lazy<T>;
37
- declare function isLazy(item: unknown): item is Lazy<any>;
38
- declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
39
- declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
40
- default: T extends Lazy<infer U> ? U : T;
41
- }>;
42
-
43
16
  interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
44
17
  context: TCurrentContext;
45
18
  input: TInput;
46
19
  path: readonly string[];
47
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
20
+ procedure: Procedure<Context, Context, Schemas, ErrorMap, TMeta>;
48
21
  signal?: AbortSignal;
49
22
  lastEventId: string | undefined;
50
23
  errors: TErrorConstructorMap;
@@ -52,7 +25,7 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
52
25
  interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
53
26
  (opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
54
27
  }
55
- interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
28
+ interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta> {
56
29
  __initialContext?: (type: TInitialContext) => unknown;
57
30
  middlewares: readonly AnyMiddleware[];
58
31
  inputValidationIndex: number;
@@ -64,14 +37,14 @@ interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends
64
37
  *
65
38
  * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
66
39
  */
67
- declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
40
+ declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> {
68
41
  /**
69
42
  * This property holds the defined options.
70
43
  */
71
- '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
72
- constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
44
+ '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
45
+ constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>);
73
46
  }
74
- type AnyProcedure = Procedure<any, any, AnySchema, AnySchema, any, any>;
47
+ type AnyProcedure = Procedure<any, any, Schemas, any, any>;
75
48
  declare function isProcedure(item: unknown): item is AnyProcedure;
76
49
 
77
50
  type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
@@ -92,7 +65,7 @@ interface MiddlewareOutputFn<TOutput> {
92
65
  interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
93
66
  context: TInContext;
94
67
  path: readonly string[];
95
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
68
+ procedure: Procedure<Context, Context, Schemas, ErrorMap, TMeta>;
96
69
  signal?: AbortSignal;
97
70
  lastEventId: string | undefined;
98
71
  next: MiddlewareNextFn<TOutput>;
@@ -112,41 +85,13 @@ interface MapInputMiddleware<TInput, TMappedInput> {
112
85
  }
113
86
  declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
114
87
 
115
- type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
116
- interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
117
- context: TInitialContext;
118
- input: unknown;
119
- errors: ORPCErrorConstructorMap<TErrorMap>;
120
- path: readonly string[];
121
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
122
- signal?: AbortSignal;
123
- lastEventId: string | undefined;
124
- }
125
- type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
126
- /**
127
- * This is helpful for logging and analytics.
128
- */
129
- path?: readonly string[];
130
- interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
131
- } & (Record<never, never> extends TInitialContext ? {
132
- context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
133
- } : {
134
- context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
135
- });
136
- /**
137
- * Create Server-side client from a procedure.
138
- *
139
- * @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
140
- */
141
- declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
142
-
143
88
  /**
144
89
  * Represents a router, which defines a hierarchical structure of procedures.
145
90
  *
146
91
  * @info A procedure is a router too.
147
92
  * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#contract-router Contract Router Docs}
148
93
  */
149
- type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
94
+ type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer USchemas, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, USchemas, UErrorMap, UMeta> : {
150
95
  [K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
151
96
  };
152
97
  type AnyRouter = Router<any, any>;
@@ -157,7 +102,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infe
157
102
  * @info A procedure is a router too.
158
103
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
159
104
  */
160
- type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
105
+ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any> ? UInitialContext : {
161
106
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
162
107
  };
163
108
  /**
@@ -166,7 +111,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
166
111
  * @info A procedure is a router too.
167
112
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
168
113
  */
169
- type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
114
+ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any> ? UCurrentContext : {
170
115
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
171
116
  };
172
117
  /**
@@ -175,7 +120,7 @@ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any,
175
120
  * @info A procedure is a router too.
176
121
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
177
122
  */
178
- type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
123
+ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer USchemas, any, any> ? InferSchemaInput<USchemas['inputSchema']> : {
179
124
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
180
125
  };
181
126
  /**
@@ -184,9 +129,107 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
184
129
  * @info A procedure is a router too.
185
130
  * @see {@link https://orpc.unnoq.com/docs/router#utilities Router Utilities Docs}
186
131
  */
187
- type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
132
+ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, infer USchemas, any, any> ? InferSchemaOutput<USchemas['outputSchema']> : {
188
133
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
189
134
  };
190
135
 
191
- export { isProcedure as D, createProcedureClient as F, Procedure as P, createORPCErrorConstructorMap as l, mergeCurrentContext as m, LAZY_SYMBOL as n, lazy as p, isLazy as q, getLazyMeta as r, unlazy as u, middlewareOutputFn as y };
192
- export type { AnyMiddleware as A, ProcedureDef as B, Context as C, ProcedureClientInterceptorOptions as E, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, MergedInitialContext as M, ORPCErrorConstructorMap as O, Router as R, CreateProcedureClientOptions as a, ProcedureClient as b, AnyRouter as c, Lazy as d, AnyProcedure as e, Middleware as f, MergedCurrentContext as g, ProcedureHandler as h, MapInputMiddleware as i, ORPCErrorConstructorMapItemOptions as j, ORPCErrorConstructorMapItem as k, LazyMeta as o, MiddlewareResult as s, MiddlewareNextFnOptions as t, MiddlewareNextFn as v, MiddlewareOutputFn as w, MiddlewareOptions as x, ProcedureHandlerOptions as z };
136
+ declare function getRouter<T extends Lazyable<AnyRouter | undefined>>(router: T, path: readonly string[]): T extends Lazy<any> ? Lazy<AnyRouter | undefined> : Lazyable<AnyRouter | undefined>;
137
+ type AccessibleLazyRouter<T extends Lazyable<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : T extends AnyProcedure | undefined ? Lazy<T> : Lazy<T> & {
138
+ [K in keyof T]: T[K] extends Lazyable<AnyRouter> ? AccessibleLazyRouter<T[K]> : never;
139
+ };
140
+ declare function createAccessibleLazyRouter<T extends Lazy<AnyRouter | undefined>>(lazied: T): AccessibleLazyRouter<T>;
141
+ type EnhancedRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap> = T extends Lazy<infer U extends AnyRouter> ? AccessibleLazyRouter<EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>> : T extends (Procedure<infer UInitialContext, infer UCurrentContext, infer USchemas, infer UErrorMap, infer UMeta>) ? Procedure<MergedInitialContext<TInitialContext, UInitialContext, TCurrentContext>, UCurrentContext, USchemas, MergedErrorMap<TErrorMap, UErrorMap>, UMeta> : {
142
+ [K in keyof T]: T[K] extends Lazyable<AnyRouter> ? EnhancedRouter<T[K], TInitialContext, TCurrentContext, TErrorMap> : never;
143
+ };
144
+ interface EnhanceRouterOptions<TErrorMap extends ErrorMap> extends EnhanceRouteOptions {
145
+ middlewares: readonly AnyMiddleware[];
146
+ errorMap: TErrorMap;
147
+ dedupeLeadingMiddlewares: boolean;
148
+ }
149
+ declare function enhanceRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap>(router: T, options: EnhanceRouterOptions<TErrorMap>): EnhancedRouter<T, TInitialContext, TCurrentContext, TErrorMap>;
150
+ interface TraverseContractProceduresOptions {
151
+ router: AnyContractRouter | AnyRouter;
152
+ path: readonly string[];
153
+ }
154
+ interface TraverseContractProcedureCallbackOptions {
155
+ contract: AnyContractProcedure | AnyProcedure;
156
+ path: readonly string[];
157
+ }
158
+ /**
159
+ * @deprecated Use `TraverseContractProcedureCallbackOptions` instead.
160
+ */
161
+ type ContractProcedureCallbackOptions = TraverseContractProcedureCallbackOptions;
162
+ interface LazyTraverseContractProceduresOptions {
163
+ router: Lazy<AnyRouter>;
164
+ path: readonly string[];
165
+ }
166
+ declare function traverseContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void, lazyOptions?: LazyTraverseContractProceduresOptions[]): LazyTraverseContractProceduresOptions[];
167
+ declare function resolveContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void): Promise<void>;
168
+ type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
169
+ [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? UnlaziedRouter<U> : never;
170
+ };
171
+ declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
172
+
173
+ declare const LAZY_SYMBOL: unique symbol;
174
+ interface LazyMeta {
175
+ prefix?: HTTPPath;
176
+ }
177
+ interface Lazy<T> {
178
+ [LAZY_SYMBOL]: {
179
+ loader: () => Promise<{
180
+ default: T;
181
+ }>;
182
+ meta: LazyMeta;
183
+ };
184
+ }
185
+ type Lazyable<T> = T | Lazy<T>;
186
+ /**
187
+ * @internal
188
+ */
189
+ declare function lazyInternal<T>(loader: () => Promise<{
190
+ default: T;
191
+ }>, meta?: LazyMeta): Lazy<T>;
192
+ /**
193
+ * Creates a lazy-loaded item.
194
+ *
195
+ * @warning The `prefix` in `meta` only holds metadata and does not apply the prefix to the lazy router, use `os.prefix(...).lazyRoute(...)` instead.
196
+ */
197
+ declare function lazy<T extends Router<ContractRouter<{}>, any>>(prefix: HTTPPath, loader: () => Promise<{
198
+ default: T;
199
+ }>): EnhancedRouter<Lazy<T>, {}, {}, {}>;
200
+ declare function isLazy(item: unknown): item is Lazy<any>;
201
+ declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
202
+ declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
203
+ default: T extends Lazy<infer U> ? U : T;
204
+ }>;
205
+
206
+ type ProcedureClient<TClientContext extends ClientContext, TSchemas extends Schemas, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TSchemas['inputSchema']>, InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
207
+ interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
208
+ context: TInitialContext;
209
+ input: unknown;
210
+ errors: ORPCErrorConstructorMap<TErrorMap>;
211
+ path: readonly string[];
212
+ procedure: Procedure<Context, Context, Schemas, ErrorMap, TMeta>;
213
+ signal?: AbortSignal;
214
+ lastEventId: string | undefined;
215
+ }
216
+ type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema | undefined, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
217
+ /**
218
+ * This is helpful for logging and analytics.
219
+ */
220
+ path?: readonly string[];
221
+ interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>>[];
222
+ } & (Record<never, never> extends TInitialContext ? {
223
+ context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
224
+ } : {
225
+ context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
226
+ });
227
+ /**
228
+ * Create Server-side client from a procedure.
229
+ *
230
+ * @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
231
+ */
232
+ declare function createProcedureClient<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TSchemas, TErrorMap>;
233
+
234
+ export { traverseContractProcedures as $, middlewareOutputFn as B, isProcedure as G, createProcedureClient as J, Procedure as P, getRouter as T, createAccessibleLazyRouter as V, enhanceRouter as W, resolveContractProcedures as a0, unlazyRouter as a2, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazyInternal as q, lazy as r, isLazy as s, getLazyMeta as t, unlazy as u };
235
+ export type { AnyMiddleware as A, Context as C, ProcedureHandlerOptions as D, EnhanceRouterOptions as E, ProcedureDef as F, ProcedureClientInterceptorOptions as H, InferRouterInitialContext as I, InferRouterInitialContexts as K, Lazy as L, Middleware as M, InferRouterCurrentContexts as N, ORPCErrorConstructorMap as O, InferRouterInputs as Q, Router as R, InferRouterOutputs as S, AccessibleLazyRouter as U, TraverseContractProceduresOptions as X, TraverseContractProcedureCallbackOptions as Y, ContractProcedureCallbackOptions as Z, LazyTraverseContractProceduresOptions as _, CreateProcedureClientOptions as a, UnlaziedRouter as a1, ProcedureClient as b, MergedInitialContext as c, MergedCurrentContext as d, ProcedureHandler as e, EnhancedRouter as f, MapInputMiddleware as g, AnyProcedure as h, Lazyable as i, AnyRouter as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as v, MiddlewareNextFnOptions as w, MiddlewareNextFn as x, MiddlewareOutputFn as y, MiddlewareOptions as z };
@@ -1,7 +1,7 @@
1
1
  import { Meta } from '@temporary-name/contract';
2
2
  import { HTTPPath, Interceptor } from '@temporary-name/shared';
3
3
  import { StandardLazyRequest, StandardResponse } from '@temporary-name/standard-server';
4
- import { C as Context, R as Router, E as ProcedureClientInterceptorOptions } from './server.CZNLCQBm.mjs';
4
+ import { C as Context, R as Router, H as ProcedureClientInterceptorOptions } from './server.Do2Whl-h.mjs';
5
5
 
6
6
  interface StandardHandlerPlugin<T extends Context> {
7
7
  order?: number;
@@ -244,4 +244,4 @@ function getDynamicParams(path) {
244
244
  })) : void 0;
245
245
  }
246
246
 
247
- export { standardizeHTTPPath as a, deserialize as d, getDynamicParams as g, jsonSerialize as j, serialize as s };
247
+ export { standardizeHTTPPath as a, bracketNotationDeserialize as b, deserialize as d, getDynamicParams as g, jsonSerialize as j, serialize as s };
@@ -1,45 +1,26 @@
1
- import { isObject, stringifyJSON, isORPCErrorStatus, tryDecodeURIComponent, value, toHttpPath, toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, ORPCError, toORPCError } from '@temporary-name/shared';
1
+ import { isObject, stringifyJSON, isORPCErrorStatus, tryDecodeURIComponent, toHttpPath, toArray, intercept, runWithSpan, ORPC_NAME, isAsyncIteratorObject, asyncIteratorWithSpan, setSpanError, ORPCError, toORPCError } from '@temporary-name/shared';
2
2
  import { flattenHeader } from '@temporary-name/standard-server';
3
- import { c as createProcedureClient } from './server.DcfsPloY.mjs';
3
+ import { c as createProcedureClient } from './server.BdGbIyq8.mjs';
4
4
  import { fallbackContractConfig } from '@temporary-name/contract';
5
- import { d as deserialize, s as serialize, a as standardizeHTTPPath } from './server.BEHw7Eyx.mjs';
5
+ import { d as deserialize, s as serialize, b as bracketNotationDeserialize, a as standardizeHTTPPath } from './server.Kxw442A9.mjs';
6
6
  import { traverseContractProcedures, isProcedure, getLazyMeta, unlazy, getRouter, createContractedProcedure } from '@temporary-name/server';
7
7
  import { createRouter, addRoute, findRoute } from 'rou3';
8
8
 
9
- async function decode(request, params, procedure) {
10
- const inputStructure = fallbackContractConfig(
11
- "defaultInputStructure",
12
- procedure["~orpc"].route.inputStructure
13
- );
14
- if (inputStructure === "compact") {
15
- const data = request.method === "GET" ? deserialize(request.url.searchParams) : deserialize(await request.body());
16
- if (data === void 0) {
17
- return params;
18
- }
19
- if (isObject(data)) {
20
- return {
21
- ...params,
22
- ...data
23
- };
24
- }
25
- return data;
26
- }
9
+ async function decode(request, pathParams) {
27
10
  const deserializeSearchParams = () => {
28
- return deserialize(request.url.searchParams);
29
- };
30
- return {
31
- params,
32
- get query() {
33
- const value = deserializeSearchParams();
34
- Object.defineProperty(this, "query", { value, writable: true });
35
- return value;
36
- },
37
- set query(value) {
38
- Object.defineProperty(this, "query", { value, writable: true });
39
- },
40
- headers: request.headers,
41
- body: deserialize(await request.body())
11
+ return bracketNotationDeserialize(Array.from(request.url.searchParams.entries()));
42
12
  };
13
+ const data = request.method === "GET" ? deserializeSearchParams() : deserialize(await request.body());
14
+ if (data === void 0) {
15
+ return pathParams;
16
+ }
17
+ if (isObject(data)) {
18
+ return {
19
+ ...pathParams,
20
+ ...data
21
+ };
22
+ }
23
+ return data;
43
24
  }
44
25
  function encode(output, procedure) {
45
26
  const successStatus = fallbackContractConfig(
@@ -117,9 +98,6 @@ class StandardOpenAPIMatcher {
117
98
  pendingRouters = [];
118
99
  init(router, path = []) {
119
100
  const laziedOptions = traverseContractProcedures({ router, path }, (traverseOptions) => {
120
- if (!value(true, traverseOptions)) {
121
- return;
122
- }
123
101
  const { path: path2, contract } = traverseOptions;
124
102
  const method = fallbackContractConfig("defaultMethod", contract["~orpc"].route.method);
125
103
  const httpPath = toRou3Pattern(contract["~orpc"].route.path ?? toHttpPath(path2));
@@ -236,10 +214,7 @@ class StandardHandler {
236
214
  span?.setAttribute("rpc.system", ORPC_NAME);
237
215
  span?.setAttribute("rpc.method", match.path.join("."));
238
216
  step = "decode_input";
239
- let input = await runWithSpan(
240
- { name: "decode_input" },
241
- () => decode(request2, match.params, match.procedure)
242
- );
217
+ let input = await runWithSpan({ name: "decode_input" }, () => decode(request2, match.params));
243
218
  step = void 0;
244
219
  if (isAsyncIteratorObject(input)) {
245
220
  input = asyncIteratorWithSpan(