@orpc/server 0.0.0-next.1431467 → 0.0.0-next.15d9202

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 (32) hide show
  1. package/README.md +3 -1
  2. package/dist/adapters/fetch/index.d.mts +3 -3
  3. package/dist/adapters/fetch/index.d.ts +3 -3
  4. package/dist/adapters/fetch/index.mjs +3 -3
  5. package/dist/adapters/hono/index.d.mts +2 -2
  6. package/dist/adapters/hono/index.d.ts +2 -2
  7. package/dist/adapters/hono/index.mjs +3 -3
  8. package/dist/adapters/next/index.d.mts +2 -2
  9. package/dist/adapters/next/index.d.ts +2 -2
  10. package/dist/adapters/next/index.mjs +3 -3
  11. package/dist/adapters/node/index.d.mts +3 -3
  12. package/dist/adapters/node/index.d.ts +3 -3
  13. package/dist/adapters/node/index.mjs +2 -2
  14. package/dist/adapters/standard/index.d.mts +4 -4
  15. package/dist/adapters/standard/index.d.ts +4 -4
  16. package/dist/adapters/standard/index.mjs +2 -2
  17. package/dist/index.d.mts +135 -112
  18. package/dist/index.d.ts +135 -112
  19. package/dist/index.mjs +56 -43
  20. package/dist/plugins/index.d.mts +12 -12
  21. package/dist/plugins/index.d.ts +12 -12
  22. package/dist/plugins/index.mjs +1 -1
  23. package/dist/shared/{server.DKrKGnk2.mjs → server.3mOimouH.mjs} +8 -11
  24. package/dist/shared/{server.V6zT5iYQ.mjs → server.B_5ZADvP.mjs} +142 -158
  25. package/dist/shared/{server.BHIDiY4a.mjs → server.BgDZnmUZ.mjs} +1 -1
  26. package/dist/shared/{server.Drm1Lma3.d.ts → server.CL84X8p4.d.mts} +12 -14
  27. package/dist/shared/server.DnmJuN02.d.mts +144 -0
  28. package/dist/shared/server.DnmJuN02.d.ts +144 -0
  29. package/dist/shared/{server.CtBp-i4f.d.mts → server.hqPWnakL.d.ts} +12 -14
  30. package/package.json +7 -7
  31. package/dist/shared/server.ptXwNGQr.d.mts +0 -158
  32. package/dist/shared/server.ptXwNGQr.d.ts +0 -158
@@ -0,0 +1,144 @@
1
+ import { ORPCErrorCode, ORPCErrorOptions, ORPCError, ClientContext, Client } from '@orpc/client';
2
+ import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
3
+ import { ErrorMap, ErrorMapItem, InferSchemaInput, HTTPPath, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
4
+
5
+ type Context = Record<string, any>;
6
+ type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
7
+ type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
8
+ declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
9
+ type ContextExtendsGuard<T extends Context, U extends Context> = T extends T & U ? unknown : never;
10
+
11
+ type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
12
+ type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
13
+ type ORPCErrorConstructorMap<T extends ErrorMap> = {
14
+ [K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
15
+ };
16
+ declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
17
+ declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
18
+
19
+ declare const LAZY_SYMBOL: unique symbol;
20
+ interface LazyMeta {
21
+ prefix?: HTTPPath;
22
+ }
23
+ interface Lazy<T> {
24
+ [LAZY_SYMBOL]: {
25
+ loader: () => Promise<{
26
+ default: T;
27
+ }>;
28
+ meta: LazyMeta;
29
+ };
30
+ }
31
+ type Lazyable<T> = T | Lazy<T>;
32
+ declare function lazy<T>(loader: () => Promise<{
33
+ default: T;
34
+ }>, meta?: LazyMeta): Lazy<T>;
35
+ declare function isLazy(item: unknown): item is Lazy<any>;
36
+ declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
37
+ declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
38
+ default: T extends Lazy<infer U> ? U : T;
39
+ }>;
40
+
41
+ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
42
+ context: TCurrentContext;
43
+ input: TInput;
44
+ path: readonly string[];
45
+ procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
46
+ signal?: AbortSignal;
47
+ lastEventId: string | undefined;
48
+ errors: TErrorConstructorMap;
49
+ }
50
+ interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
51
+ (opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
52
+ }
53
+ 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> {
54
+ __initialContext?: (type: TInitialContext) => unknown;
55
+ middlewares: readonly AnyMiddleware[];
56
+ inputValidationIndex: number;
57
+ outputValidationIndex: number;
58
+ handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
59
+ }
60
+ declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
61
+ '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
62
+ constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
63
+ }
64
+ type AnyProcedure = Procedure<any, any, any, any, any, any>;
65
+ declare function isProcedure(item: unknown): item is AnyProcedure;
66
+
67
+ type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
68
+ output: TOutput;
69
+ context: TOutContext;
70
+ }>;
71
+ type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
72
+ context?: TOutContext;
73
+ } : {
74
+ context: TOutContext;
75
+ };
76
+ interface MiddlewareNextFn<TOutput> {
77
+ <U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
78
+ }
79
+ interface MiddlewareOutputFn<TOutput> {
80
+ (output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
81
+ }
82
+ interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
83
+ context: TInContext;
84
+ path: readonly string[];
85
+ procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
86
+ signal?: AbortSignal;
87
+ lastEventId: string | undefined;
88
+ next: MiddlewareNextFn<TOutput>;
89
+ errors: TErrorConstructorMap;
90
+ }
91
+ interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
92
+ (options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
93
+ }
94
+ type AnyMiddleware = Middleware<any, any, any, any, any, any>;
95
+ interface MapInputMiddleware<TInput, TMappedInput> {
96
+ (input: TInput): TMappedInput;
97
+ }
98
+ declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
99
+
100
+ type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
101
+ interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TInputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
102
+ context: TInitialContext;
103
+ input: InferSchemaInput<TInputSchema>;
104
+ errors: ORPCErrorConstructorMap<TErrorMap>;
105
+ path: readonly string[];
106
+ procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
107
+ signal?: AbortSignal;
108
+ lastEventId: string | undefined;
109
+ }
110
+ /**
111
+ * Options for creating a procedure caller with comprehensive type safety
112
+ */
113
+ type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
114
+ /**
115
+ * This is helpful for logging and analytics.
116
+ */
117
+ path?: readonly string[];
118
+ interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TInputSchema, TErrorMap, TMeta>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>[];
119
+ } & (Record<never, never> extends TInitialContext ? {
120
+ context?: Value<TInitialContext, [clientContext: TClientContext]>;
121
+ } : {
122
+ context: Value<TInitialContext, [clientContext: TClientContext]>;
123
+ });
124
+ 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>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
125
+
126
+ 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> : {
127
+ [K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
128
+ };
129
+ type AnyRouter = Router<any, any>;
130
+ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infer UInitialContext> ? UInitialContext : never;
131
+ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
132
+ [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
133
+ };
134
+ type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
135
+ [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
136
+ };
137
+ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
138
+ [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
139
+ };
140
+ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
141
+ [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
142
+ };
143
+
144
+ export { type AnyProcedure as A, type MiddlewareOptions as B, type Context as C, middlewareOutputFn as D, type ProcedureHandlerOptions as E, type ProcedureDef as F, isProcedure as G, createProcedureClient as H, type InferRouterInitialContext as I, type InferRouterInitialContexts as J, type InferRouterCurrentContexts as K, type Lazyable as L, type Middleware as M, type InferRouterInputs as N, type ORPCErrorConstructorMap as O, type ProcedureClientInterceptorOptions as P, type InferRouterOutputs as Q, type Router as R, type AnyRouter as a, Procedure as b, type ContextExtendsGuard as c, type MergedCurrentContext as d, type MergedInitialContext as e, type MapInputMiddleware as f, type CreateProcedureClientOptions as g, type ProcedureClient as h, type AnyMiddleware as i, type Lazy as j, type ProcedureHandler as k, type ORPCErrorConstructorMapItemOptions as l, mergeCurrentContext as m, type ORPCErrorConstructorMapItem as n, createORPCErrorConstructorMap as o, LAZY_SYMBOL as p, type LazyMeta as q, lazy as r, isLazy as s, getLazyMeta as t, unlazy as u, validateORPCError as v, type MiddlewareResult as w, type MiddlewareNextFnOptions as x, type MiddlewareNextFn as y, type MiddlewareOutputFn as z };
@@ -1,12 +1,12 @@
1
- import { HTTPPath, Schema, Meta, SchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
1
+ import { HTTPPath, AnySchema, Meta, InferSchemaOutput, ErrorFromErrorMap } from '@orpc/contract';
2
2
  import { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
3
3
  import { StandardResponse, StandardLazyRequest } from '@orpc/standard-server';
4
- import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.ptXwNGQr.mjs';
4
+ import { a as AnyRouter, A as AnyProcedure, C as Context, P as ProcedureClientInterceptorOptions, R as Router } from './server.DnmJuN02.js';
5
5
  import { ORPCError } from '@orpc/client';
6
6
 
7
7
  type StandardParams = Record<string, string>;
8
8
  type StandardMatchResult = {
9
- path: string[];
9
+ path: readonly string[];
10
10
  procedure: AnyProcedure;
11
11
  params?: StandardParams;
12
12
  } | undefined;
@@ -27,9 +27,6 @@ type StandardHandleOptions<T extends Context> = {
27
27
  } : {
28
28
  context: T;
29
29
  });
30
- type WellStandardHandleOptions<T extends Context> = StandardHandleOptions<T> & {
31
- context: T;
32
- };
33
30
  type StandardHandleResult = {
34
31
  matched: true;
35
32
  response: StandardResponse;
@@ -37,11 +34,12 @@ type StandardHandleResult = {
37
34
  matched: false;
38
35
  response: undefined;
39
36
  };
40
- type StandardHandlerInterceptorOptions<TContext extends Context> = WellStandardHandleOptions<TContext> & {
37
+ type StandardHandlerInterceptorOptions<T extends Context> = StandardHandleOptions<T> & {
38
+ context: T;
41
39
  request: StandardLazyRequest;
42
40
  };
43
41
  interface StandardHandlerOptions<TContext extends Context> {
44
- plugins?: Plugin<TContext>[];
42
+ plugins?: HandlerPlugin<TContext>[];
45
43
  /**
46
44
  * Interceptors at the request level, helpful when you want catch errors
47
45
  */
@@ -54,24 +52,24 @@ interface StandardHandlerOptions<TContext extends Context> {
54
52
  *
55
53
  * Interceptors for procedure client.
56
54
  */
57
- clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Schema, Record<never, never>, Meta>, SchemaOutput<Schema, unknown>, ErrorFromErrorMap<Record<never, never>>>[];
55
+ clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, AnySchema, Record<never, never>, Meta>, InferSchemaOutput<AnySchema>, ErrorFromErrorMap<Record<never, never>>>[];
58
56
  }
59
57
  declare class StandardHandler<T extends Context> {
60
58
  private readonly matcher;
61
59
  private readonly codec;
62
60
  private readonly options;
63
61
  private readonly plugin;
64
- constructor(router: Router<T, any>, matcher: StandardMatcher, codec: StandardCodec, options: NoInfer<StandardHandlerOptions<T>>);
62
+ constructor(router: Router<any, T>, matcher: StandardMatcher, codec: StandardCodec, options: NoInfer<StandardHandlerOptions<T>>);
65
63
  handle(request: StandardLazyRequest, ...[options]: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<StandardHandleResult>;
66
64
  }
67
65
 
68
- interface Plugin<TContext extends Context> {
66
+ interface HandlerPlugin<TContext extends Context> {
69
67
  init?(options: StandardHandlerOptions<TContext>): void;
70
68
  }
71
- declare class CompositePlugin<TContext extends Context> implements Plugin<TContext> {
69
+ declare class CompositePlugin<TContext extends Context> implements HandlerPlugin<TContext> {
72
70
  private readonly plugins;
73
- constructor(plugins?: Plugin<TContext>[]);
71
+ constructor(plugins?: HandlerPlugin<TContext>[]);
74
72
  init(options: StandardHandlerOptions<TContext>): void;
75
73
  }
76
74
 
77
- export { CompositePlugin as C, type Plugin as P, type StandardHandleOptions as S, type WellStandardHandleOptions as W, type StandardHandlerInterceptorOptions as a, type StandardHandlerOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleResult as g, StandardHandler as h };
75
+ export { CompositePlugin as C, type HandlerPlugin as H, type StandardHandleOptions as S, type StandardHandlerInterceptorOptions as a, type StandardHandlerOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleResult as g, StandardHandler as h };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/server",
3
3
  "type": "module",
4
- "version": "0.0.0-next.1431467",
4
+ "version": "0.0.0-next.15d9202",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -58,12 +58,12 @@
58
58
  "next": ">=14.0.0"
59
59
  },
60
60
  "dependencies": {
61
- "@orpc/client": "0.0.0-next.1431467",
62
- "@orpc/contract": "0.0.0-next.1431467",
63
- "@orpc/shared": "0.0.0-next.1431467",
64
- "@orpc/standard-server": "0.0.0-next.1431467",
65
- "@orpc/standard-server-node": "0.0.0-next.1431467",
66
- "@orpc/standard-server-fetch": "0.0.0-next.1431467"
61
+ "@orpc/contract": "0.0.0-next.15d9202",
62
+ "@orpc/standard-server": "0.0.0-next.15d9202",
63
+ "@orpc/client": "0.0.0-next.15d9202",
64
+ "@orpc/standard-server-fetch": "0.0.0-next.15d9202",
65
+ "@orpc/shared": "0.0.0-next.15d9202",
66
+ "@orpc/standard-server-node": "0.0.0-next.15d9202"
67
67
  },
68
68
  "devDependencies": {
69
69
  "light-my-request": "^6.5.1"
@@ -1,158 +0,0 @@
1
- import { ORPCErrorCode, ORPCErrorOptions, ORPCError, ClientContext, Client } from '@orpc/client';
2
- import { IsNever, MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
3
- import { ErrorMap, ErrorMapItem, SchemaInput, HTTPPath, Meta, Schema, ContractProcedureDef, SchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure, MergedErrorMap } from '@orpc/contract';
4
-
5
- type Context = Record<string, any>;
6
- type MergedContext<T extends Context, U extends Context> = T & U;
7
- declare function mergeContext<T extends Context, U extends Context>(context: T, other: U): MergedContext<T, U>;
8
- type ConflictContextGuard<T extends Context> = true extends IsNever<T> | {
9
- [K in keyof T]: IsNever<T[K]>;
10
- }[keyof T] ? never : unknown;
11
-
12
- type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
13
- type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
14
- type ORPCErrorConstructorMap<T extends ErrorMap> = {
15
- [K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, SchemaInput<UInputSchema>> : never : never;
16
- };
17
-
18
- declare const LAZY_LOADER_SYMBOL: unique symbol;
19
- interface LazyMeta {
20
- prefix?: HTTPPath;
21
- }
22
- interface Lazy<T> {
23
- [LAZY_LOADER_SYMBOL](): Promise<{
24
- default: T;
25
- }>;
26
- }
27
- type Lazyable<T> = T | Lazy<T>;
28
- interface LazyOptions {
29
- prefix?: HTTPPath;
30
- }
31
- declare function lazy<T>(loader: () => Promise<{
32
- default: T;
33
- }>): Lazy<T>;
34
- declare function isLazy(item: unknown): item is Lazy<any>;
35
- declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
36
- default: T extends Lazy<infer U> ? U : T;
37
- }>;
38
-
39
- type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
40
- output: TOutput;
41
- context: TOutContext;
42
- }>;
43
- type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
44
- context?: TOutContext;
45
- } : {
46
- context: TOutContext;
47
- };
48
- interface MiddlewareNextFn<TInContext extends Context, TOutput> {
49
- <U extends Context & Partial<TInContext> = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
50
- }
51
- interface MiddlewareOutputFn<TOutput> {
52
- (output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
53
- }
54
- interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
55
- context: TInContext;
56
- path: string[];
57
- procedure: Procedure<Context, Context, Schema, Schema, unknown, ErrorMap, TMeta>;
58
- signal?: AbortSignal;
59
- lastEventId: string | undefined;
60
- next: MiddlewareNextFn<TInContext, TOutput>;
61
- errors: TErrorConstructorMap;
62
- }
63
- interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
64
- (options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
65
- }
66
- type AnyMiddleware = Middleware<any, any, any, any, any, any>;
67
- interface MapInputMiddleware<TInput, TMappedInput> {
68
- (input: TInput): TMappedInput;
69
- }
70
- declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
71
-
72
- interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
73
- context: TCurrentContext;
74
- input: TInput;
75
- path: string[];
76
- procedure: Procedure<Context, Context, Schema, Schema, unknown, ErrorMap, TMeta>;
77
- signal?: AbortSignal;
78
- lastEventId: string | undefined;
79
- errors: TErrorConstructorMap;
80
- }
81
- interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
82
- (opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
83
- }
84
- interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
85
- __initialContext?: (type: TInitialContext) => unknown;
86
- middlewares: AnyMiddleware[];
87
- inputValidationIndex: number;
88
- outputValidationIndex: number;
89
- handler: ProcedureHandler<TCurrentContext, any, THandlerOutput, any, any>;
90
- }
91
- declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
92
- '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
93
- constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>);
94
- }
95
- type AnyProcedure = Procedure<any, any, any, any, any, any, any>;
96
- declare function isProcedure(item: unknown): item is AnyProcedure;
97
-
98
- type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
99
- interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TInputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
100
- context: TInitialContext;
101
- input: SchemaInput<TInputSchema>;
102
- errors: ORPCErrorConstructorMap<TErrorMap>;
103
- path: string[];
104
- procedure: Procedure<Context, Context, Schema, Schema, unknown, ErrorMap, TMeta>;
105
- signal?: AbortSignal;
106
- lastEventId: string | undefined;
107
- }
108
- /**
109
- * Options for creating a procedure caller with comprehensive type safety
110
- */
111
- type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
112
- /**
113
- * This is helpful for logging and analytics.
114
- */
115
- path?: string[];
116
- interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TInputSchema, TErrorMap, TMeta>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>[];
117
- } & (Record<never, never> extends TInitialContext ? {
118
- context?: Value<TInitialContext, [clientContext: TClientContext]>;
119
- } : {
120
- context: Value<TInitialContext, [clientContext: TClientContext]>;
121
- });
122
- declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
123
-
124
- type AccessibleLazyRouter<T extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : Lazy<T> & (T extends AnyProcedure | undefined ? unknown : {
125
- [K in keyof T]: T[K] extends AnyRouter ? AccessibleLazyRouter<T[K]> : never;
126
- });
127
- declare function createAccessibleLazyRouter<T extends Lazy<AnyRouter | undefined>>(lazied: T): AccessibleLazyRouter<T>;
128
-
129
- type Router<TInitialContext extends Context, TContract extends AnyContractRouter> = Lazyable<TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, any, UErrorMap, UMeta> : {
130
- [K in keyof TContract]: TContract[K] extends AnyContractRouter ? Router<TInitialContext, TContract[K]> : never;
131
- }>;
132
- type AnyRouter = Router<any, any>;
133
- type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer UInitialContext, any> ? UInitialContext : never;
134
- type InferRouterInitialContexts<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : T extends Procedure<infer UInitialContext, any, any, any, any, any, any> ? UInitialContext : {
135
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterInitialContexts<T[K]> : never;
136
- };
137
- type InferRouterCurrentContexts<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : T extends Procedure<any, infer UCurrentContext, any, any, any, any, any> ? UCurrentContext : {
138
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterCurrentContexts<T[K]> : never;
139
- };
140
- type InferRouterInputs<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterInputs<U> : T extends Procedure<any, any, infer UInputSchema, any, any, any, any> ? SchemaInput<UInputSchema> : {
141
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterInputs<T[K]> : never;
142
- };
143
- type InferRouterOutputs<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterOutputs<U> : T extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput, any, any> ? SchemaOutput<UOutputSchema, UFuncOutput> : {
144
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterOutputs<T[K]> : never;
145
- };
146
- type AdaptedRouter<TRouter extends AnyRouter, TInitialContext extends Context, TErrorMap extends ErrorMap> = TRouter extends Lazy<infer U extends AnyRouter> ? AccessibleLazyRouter<AdaptedRouter<U, TInitialContext, TErrorMap>> : TRouter extends Procedure<any, infer UCurrentContext, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, UCurrentContext, UInputSchema, UOutputSchema, UFuncOutput, MergedErrorMap<TErrorMap, UErrorMap>, UMeta> : {
147
- [K in keyof TRouter]: TRouter[K] extends AnyRouter ? AdaptedRouter<TRouter[K], TInitialContext, TErrorMap> : never;
148
- };
149
- interface AdaptRouterOptions<TErrorMap extends ErrorMap> {
150
- middlewares: AnyMiddleware[];
151
- tags?: readonly string[];
152
- prefix?: HTTPPath;
153
- errorMap: TErrorMap;
154
- }
155
- declare function adaptRouter<TRouter extends AnyRouter, TInitialContext extends Context, TErrorMap extends ErrorMap>(router: TRouter, options: AdaptRouterOptions<TErrorMap>): AdaptedRouter<TRouter, TInitialContext, TErrorMap>;
156
- declare function getRouterChild<T extends AnyRouter | Lazy<undefined>>(router: T, ...path: string[]): T extends Lazy<any> ? Lazy<AnyProcedure> | Lazy<Record<string, AnyRouter>> | Lazy<undefined> : AnyRouter | Lazy<undefined> | undefined;
157
-
158
- export { type AnyProcedure as A, type ProcedureDef as B, type Context as C, isProcedure as D, createProcedureClient as E, type InferRouterInitialContexts as F, type InferRouterCurrentContexts as G, type InferRouterInputs as H, type InferRouterInitialContext as I, type InferRouterOutputs as J, adaptRouter as K, type Lazy as L, type Middleware as M, getRouterChild as N, type ORPCErrorConstructorMap as O, type ProcedureClientInterceptorOptions as P, type AccessibleLazyRouter as Q, type Router as R, createAccessibleLazyRouter as S, type AnyRouter as a, Procedure as b, type ConflictContextGuard as c, type MergedContext as d, type MapInputMiddleware as e, type CreateProcedureClientOptions as f, type ProcedureClient as g, type ProcedureHandler as h, type AdaptRouterOptions as i, type AdaptedRouter as j, type AnyMiddleware as k, type Lazyable as l, mergeContext as m, LAZY_LOADER_SYMBOL as n, type LazyMeta as o, type LazyOptions as p, lazy as q, isLazy as r, type MiddlewareResult as s, type MiddlewareNextFnOptions as t, unlazy as u, type MiddlewareNextFn as v, type MiddlewareOutputFn as w, type MiddlewareOptions as x, middlewareOutputFn as y, type ProcedureHandlerOptions as z };
@@ -1,158 +0,0 @@
1
- import { ORPCErrorCode, ORPCErrorOptions, ORPCError, ClientContext, Client } from '@orpc/client';
2
- import { IsNever, MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
3
- import { ErrorMap, ErrorMapItem, SchemaInput, HTTPPath, Meta, Schema, ContractProcedureDef, SchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure, MergedErrorMap } from '@orpc/contract';
4
-
5
- type Context = Record<string, any>;
6
- type MergedContext<T extends Context, U extends Context> = T & U;
7
- declare function mergeContext<T extends Context, U extends Context>(context: T, other: U): MergedContext<T, U>;
8
- type ConflictContextGuard<T extends Context> = true extends IsNever<T> | {
9
- [K in keyof T]: IsNever<T[K]>;
10
- }[keyof T] ? never : unknown;
11
-
12
- type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
13
- type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
14
- type ORPCErrorConstructorMap<T extends ErrorMap> = {
15
- [K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, SchemaInput<UInputSchema>> : never : never;
16
- };
17
-
18
- declare const LAZY_LOADER_SYMBOL: unique symbol;
19
- interface LazyMeta {
20
- prefix?: HTTPPath;
21
- }
22
- interface Lazy<T> {
23
- [LAZY_LOADER_SYMBOL](): Promise<{
24
- default: T;
25
- }>;
26
- }
27
- type Lazyable<T> = T | Lazy<T>;
28
- interface LazyOptions {
29
- prefix?: HTTPPath;
30
- }
31
- declare function lazy<T>(loader: () => Promise<{
32
- default: T;
33
- }>): Lazy<T>;
34
- declare function isLazy(item: unknown): item is Lazy<any>;
35
- declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
36
- default: T extends Lazy<infer U> ? U : T;
37
- }>;
38
-
39
- type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
40
- output: TOutput;
41
- context: TOutContext;
42
- }>;
43
- type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
44
- context?: TOutContext;
45
- } : {
46
- context: TOutContext;
47
- };
48
- interface MiddlewareNextFn<TInContext extends Context, TOutput> {
49
- <U extends Context & Partial<TInContext> = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
50
- }
51
- interface MiddlewareOutputFn<TOutput> {
52
- (output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
53
- }
54
- interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
55
- context: TInContext;
56
- path: string[];
57
- procedure: Procedure<Context, Context, Schema, Schema, unknown, ErrorMap, TMeta>;
58
- signal?: AbortSignal;
59
- lastEventId: string | undefined;
60
- next: MiddlewareNextFn<TInContext, TOutput>;
61
- errors: TErrorConstructorMap;
62
- }
63
- interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
64
- (options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
65
- }
66
- type AnyMiddleware = Middleware<any, any, any, any, any, any>;
67
- interface MapInputMiddleware<TInput, TMappedInput> {
68
- (input: TInput): TMappedInput;
69
- }
70
- declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
71
-
72
- interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
73
- context: TCurrentContext;
74
- input: TInput;
75
- path: string[];
76
- procedure: Procedure<Context, Context, Schema, Schema, unknown, ErrorMap, TMeta>;
77
- signal?: AbortSignal;
78
- lastEventId: string | undefined;
79
- errors: TErrorConstructorMap;
80
- }
81
- interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
82
- (opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
83
- }
84
- interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
85
- __initialContext?: (type: TInitialContext) => unknown;
86
- middlewares: AnyMiddleware[];
87
- inputValidationIndex: number;
88
- outputValidationIndex: number;
89
- handler: ProcedureHandler<TCurrentContext, any, THandlerOutput, any, any>;
90
- }
91
- declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
92
- '~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>;
93
- constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>);
94
- }
95
- type AnyProcedure = Procedure<any, any, any, any, any, any, any>;
96
- declare function isProcedure(item: unknown): item is AnyProcedure;
97
-
98
- type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
99
- interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TInputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
100
- context: TInitialContext;
101
- input: SchemaInput<TInputSchema>;
102
- errors: ORPCErrorConstructorMap<TErrorMap>;
103
- path: string[];
104
- procedure: Procedure<Context, Context, Schema, Schema, unknown, ErrorMap, TMeta>;
105
- signal?: AbortSignal;
106
- lastEventId: string | undefined;
107
- }
108
- /**
109
- * Options for creating a procedure caller with comprehensive type safety
110
- */
111
- type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
112
- /**
113
- * This is helpful for logging and analytics.
114
- */
115
- path?: string[];
116
- interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TInputSchema, TErrorMap, TMeta>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>[];
117
- } & (Record<never, never> extends TInitialContext ? {
118
- context?: Value<TInitialContext, [clientContext: TClientContext]>;
119
- } : {
120
- context: Value<TInitialContext, [clientContext: TClientContext]>;
121
- });
122
- declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
123
-
124
- type AccessibleLazyRouter<T extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : Lazy<T> & (T extends AnyProcedure | undefined ? unknown : {
125
- [K in keyof T]: T[K] extends AnyRouter ? AccessibleLazyRouter<T[K]> : never;
126
- });
127
- declare function createAccessibleLazyRouter<T extends Lazy<AnyRouter | undefined>>(lazied: T): AccessibleLazyRouter<T>;
128
-
129
- type Router<TInitialContext extends Context, TContract extends AnyContractRouter> = Lazyable<TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, any, UErrorMap, UMeta> : {
130
- [K in keyof TContract]: TContract[K] extends AnyContractRouter ? Router<TInitialContext, TContract[K]> : never;
131
- }>;
132
- type AnyRouter = Router<any, any>;
133
- type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer UInitialContext, any> ? UInitialContext : never;
134
- type InferRouterInitialContexts<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : T extends Procedure<infer UInitialContext, any, any, any, any, any, any> ? UInitialContext : {
135
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterInitialContexts<T[K]> : never;
136
- };
137
- type InferRouterCurrentContexts<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : T extends Procedure<any, infer UCurrentContext, any, any, any, any, any> ? UCurrentContext : {
138
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterCurrentContexts<T[K]> : never;
139
- };
140
- type InferRouterInputs<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterInputs<U> : T extends Procedure<any, any, infer UInputSchema, any, any, any, any> ? SchemaInput<UInputSchema> : {
141
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterInputs<T[K]> : never;
142
- };
143
- type InferRouterOutputs<T extends AnyRouter> = T extends Lazy<infer U extends AnyRouter> ? InferRouterOutputs<U> : T extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput, any, any> ? SchemaOutput<UOutputSchema, UFuncOutput> : {
144
- [K in keyof T]: T[K] extends AnyRouter ? InferRouterOutputs<T[K]> : never;
145
- };
146
- type AdaptedRouter<TRouter extends AnyRouter, TInitialContext extends Context, TErrorMap extends ErrorMap> = TRouter extends Lazy<infer U extends AnyRouter> ? AccessibleLazyRouter<AdaptedRouter<U, TInitialContext, TErrorMap>> : TRouter extends Procedure<any, infer UCurrentContext, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, UCurrentContext, UInputSchema, UOutputSchema, UFuncOutput, MergedErrorMap<TErrorMap, UErrorMap>, UMeta> : {
147
- [K in keyof TRouter]: TRouter[K] extends AnyRouter ? AdaptedRouter<TRouter[K], TInitialContext, TErrorMap> : never;
148
- };
149
- interface AdaptRouterOptions<TErrorMap extends ErrorMap> {
150
- middlewares: AnyMiddleware[];
151
- tags?: readonly string[];
152
- prefix?: HTTPPath;
153
- errorMap: TErrorMap;
154
- }
155
- declare function adaptRouter<TRouter extends AnyRouter, TInitialContext extends Context, TErrorMap extends ErrorMap>(router: TRouter, options: AdaptRouterOptions<TErrorMap>): AdaptedRouter<TRouter, TInitialContext, TErrorMap>;
156
- declare function getRouterChild<T extends AnyRouter | Lazy<undefined>>(router: T, ...path: string[]): T extends Lazy<any> ? Lazy<AnyProcedure> | Lazy<Record<string, AnyRouter>> | Lazy<undefined> : AnyRouter | Lazy<undefined> | undefined;
157
-
158
- export { type AnyProcedure as A, type ProcedureDef as B, type Context as C, isProcedure as D, createProcedureClient as E, type InferRouterInitialContexts as F, type InferRouterCurrentContexts as G, type InferRouterInputs as H, type InferRouterInitialContext as I, type InferRouterOutputs as J, adaptRouter as K, type Lazy as L, type Middleware as M, getRouterChild as N, type ORPCErrorConstructorMap as O, type ProcedureClientInterceptorOptions as P, type AccessibleLazyRouter as Q, type Router as R, createAccessibleLazyRouter as S, type AnyRouter as a, Procedure as b, type ConflictContextGuard as c, type MergedContext as d, type MapInputMiddleware as e, type CreateProcedureClientOptions as f, type ProcedureClient as g, type ProcedureHandler as h, type AdaptRouterOptions as i, type AdaptedRouter as j, type AnyMiddleware as k, type Lazyable as l, mergeContext as m, LAZY_LOADER_SYMBOL as n, type LazyMeta as o, type LazyOptions as p, lazy as q, isLazy as r, type MiddlewareResult as s, type MiddlewareNextFnOptions as t, unlazy as u, type MiddlewareNextFn as v, type MiddlewareOutputFn as w, type MiddlewareOptions as x, middlewareOutputFn as y, type ProcedureHandlerOptions as z };