@orpc/server 0.0.0-next.4220427 → 0.0.0-next.43889a7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/dist/{chunk-V3I7RIRY.js → chunk-26GHKV43.js} +6 -7
  2. package/dist/{chunk-DNG2IB3R.js → chunk-LDIL7OEP.js} +40 -50
  3. package/dist/fetch.js +4 -4
  4. package/dist/hono.js +5 -5
  5. package/dist/index.js +687 -181
  6. package/dist/next.js +5 -5
  7. package/dist/node.js +10 -10
  8. package/dist/src/adapters/fetch/orpc-handler.d.ts +4 -4
  9. package/dist/src/adapters/fetch/types.d.ts +3 -3
  10. package/dist/src/adapters/hono/middleware.d.ts +3 -3
  11. package/dist/src/adapters/next/serve.d.ts +3 -3
  12. package/dist/src/adapters/node/orpc-handler.d.ts +5 -5
  13. package/dist/src/adapters/node/types.d.ts +3 -3
  14. package/dist/src/builder-with-errors-middlewares.d.ts +49 -0
  15. package/dist/src/builder-with-errors.d.ts +49 -0
  16. package/dist/src/builder-with-middlewares.d.ts +49 -0
  17. package/dist/src/builder.d.ts +33 -23
  18. package/dist/src/config.d.ts +6 -0
  19. package/dist/src/context.d.ts +10 -0
  20. package/dist/src/error.d.ts +1 -1
  21. package/dist/src/hidden.d.ts +2 -2
  22. package/dist/src/implementer-chainable.d.ts +11 -5
  23. package/dist/src/index.d.ts +5 -4
  24. package/dist/src/lazy-decorated.d.ts +4 -6
  25. package/dist/src/middleware-decorated.d.ts +5 -5
  26. package/dist/src/middleware.d.ts +19 -15
  27. package/dist/src/procedure-builder-with-input.d.ts +35 -0
  28. package/dist/src/procedure-builder-with-output.d.ts +34 -0
  29. package/dist/src/procedure-builder.d.ts +23 -19
  30. package/dist/src/procedure-client.d.ts +8 -21
  31. package/dist/src/procedure-decorated.d.ts +21 -11
  32. package/dist/src/procedure-implementer.d.ts +14 -10
  33. package/dist/src/procedure-utils.d.ts +17 -0
  34. package/dist/src/procedure.d.ts +16 -12
  35. package/dist/src/router-builder.d.ts +20 -16
  36. package/dist/src/router-client.d.ts +7 -6
  37. package/dist/src/router-implementer.d.ts +12 -10
  38. package/dist/src/router.d.ts +4 -4
  39. package/dist/src/types.d.ts +0 -3
  40. package/package.json +3 -3
  41. package/dist/src/utils.d.ts +0 -3
package/dist/next.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import "./chunk-WUOGVGWG.js";
2
2
  import {
3
- ORPCHandler,
4
3
  ORPCPayloadCodec,
5
4
  ORPCProcedureMatcher,
5
+ RPCHandler,
6
6
  super_json_exports
7
- } from "./chunk-V3I7RIRY.js";
8
- import "./chunk-DNG2IB3R.js";
7
+ } from "./chunk-26GHKV43.js";
8
+ import "./chunk-LDIL7OEP.js";
9
9
 
10
10
  // src/adapters/next/serve.ts
11
11
  import { value } from "@orpc/shared";
12
12
  function serve(handler, ...[options]) {
13
13
  const main = async (req) => {
14
- const context = await value(options?.context, req);
14
+ const context = await value(options?.context ?? {}, req);
15
15
  const { matched, response } = await handler.handle(req, { ...options, context });
16
16
  if (matched) {
17
17
  return response;
@@ -27,9 +27,9 @@ function serve(handler, ...[options]) {
27
27
  };
28
28
  }
29
29
  export {
30
- ORPCHandler,
31
30
  ORPCPayloadCodec,
32
31
  ORPCProcedureMatcher,
32
+ RPCHandler,
33
33
  super_json_exports as SuperJSON,
34
34
  serve
35
35
  };
package/dist/node.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
- ORPCHandler
3
- } from "./chunk-V3I7RIRY.js";
4
- import "./chunk-DNG2IB3R.js";
2
+ RPCHandler
3
+ } from "./chunk-26GHKV43.js";
4
+ import "./chunk-LDIL7OEP.js";
5
5
 
6
6
  // src/adapters/node/request-listener.ts
7
7
  function createRequest(req, res) {
@@ -61,25 +61,25 @@ async function sendResponse(res, response) {
61
61
  }
62
62
 
63
63
  // src/adapters/node/orpc-handler.ts
64
- var ORPCHandler2 = class {
64
+ var RPCHandler2 = class {
65
65
  orpcFetchHandler;
66
66
  constructor(router, options) {
67
- this.orpcFetchHandler = new ORPCHandler(router, options);
67
+ this.orpcFetchHandler = new RPCHandler(router, options);
68
68
  }
69
- async handle(req, res, ...[options]) {
69
+ async handle(req, res, ...rest) {
70
70
  const request = createRequest(req, res);
71
- const castedOptions = options ?? {};
72
- const result = await this.orpcFetchHandler.handle(request, castedOptions);
71
+ const result = await this.orpcFetchHandler.handle(request, ...rest);
73
72
  if (result.matched === false) {
74
73
  return { matched: false };
75
74
  }
76
- await options?.beforeSend?.(result.response, castedOptions.context);
75
+ const context = rest[0]?.context ?? {};
76
+ await rest[0]?.beforeSend?.(result.response, context);
77
77
  await sendResponse(res, result.response);
78
78
  return { matched: true };
79
79
  }
80
80
  };
81
81
  export {
82
- ORPCHandler2 as ORPCHandler,
82
+ RPCHandler2 as RPCHandler,
83
83
  createHeaders,
84
84
  createRequest,
85
85
  sendResponse
@@ -1,20 +1,20 @@
1
1
  import type { Hooks } from '@orpc/shared';
2
+ import type { Context } from '../../context';
2
3
  import type { Router } from '../../router';
3
- import type { Context } from '../../types';
4
4
  import type { FetchHandler, FetchHandleRest, FetchHandleResult } from './types';
5
5
  import { type PublicORPCPayloadCodec } from './orpc-payload-codec';
6
6
  import { type PublicORPCProcedureMatcher } from './orpc-procedure-matcher';
7
- export type ORPCHandlerOptions<T extends Context> = Hooks<Request, FetchHandleResult, T, {
7
+ export type RPCHandlerOptions<T extends Context> = Hooks<Request, FetchHandleResult, T, {
8
8
  signal?: AbortSignal;
9
9
  }> & {
10
10
  procedureMatcher?: PublicORPCProcedureMatcher;
11
11
  payloadCodec?: PublicORPCPayloadCodec;
12
12
  };
13
- export declare class ORPCHandler<T extends Context> implements FetchHandler<T> {
13
+ export declare class RPCHandler<T extends Context> implements FetchHandler<T> {
14
14
  private readonly options?;
15
15
  private readonly procedureMatcher;
16
16
  private readonly payloadCodec;
17
- constructor(router: Router<T, any>, options?: NoInfer<ORPCHandlerOptions<T>> | undefined);
17
+ constructor(router: Router<T, any>, options?: NoInfer<RPCHandlerOptions<T>> | undefined);
18
18
  handle(request: Request, ...[options]: FetchHandleRest<T>): Promise<FetchHandleResult>;
19
19
  }
20
20
  //# sourceMappingURL=orpc-handler.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import type { HTTPPath } from '@orpc/contract';
2
- import type { Context } from '../../types';
2
+ import type { Context } from '../../context';
3
3
  export type FetchHandleOptions<T extends Context> = {
4
4
  prefix?: HTTPPath;
5
- } & (undefined extends T ? {
5
+ } & (Record<never, never> extends T ? {
6
6
  context?: T;
7
7
  } : {
8
8
  context: T;
9
9
  });
10
- export type FetchHandleRest<T extends Context> = [options: FetchHandleOptions<T>] | (undefined extends T ? [] : never);
10
+ export type FetchHandleRest<T extends Context> = [options: FetchHandleOptions<T>] | (Record<never, never> extends T ? [] : never);
11
11
  export type FetchHandleResult = {
12
12
  matched: true;
13
13
  response: Response;
@@ -1,12 +1,12 @@
1
1
  import type { Context as HonoContext, MiddlewareHandler } from 'hono';
2
- import type { Context } from '../../types';
2
+ import type { Context } from '../../context';
3
3
  import type { FetchHandleOptions, FetchHandler } from '../fetch';
4
4
  import { type Value } from '@orpc/shared';
5
- export type CreateMiddlewareOptions<T extends Context> = Omit<FetchHandleOptions<T>, 'context'> & (undefined extends T ? {
5
+ export type CreateMiddlewareOptions<T extends Context> = Omit<FetchHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
6
6
  context?: Value<T, [HonoContext]>;
7
7
  } : {
8
8
  context: Value<T, [HonoContext]>;
9
9
  });
10
- export type CreateMiddlewareRest<T extends Context> = [options: CreateMiddlewareOptions<T>] | (undefined extends T ? [] : never);
10
+ export type CreateMiddlewareRest<T extends Context> = [options: CreateMiddlewareOptions<T>] | (Record<never, never> extends T ? [] : never);
11
11
  export declare function createMiddleware<T extends Context>(handler: FetchHandler<T>, ...[options]: CreateMiddlewareRest<T>): MiddlewareHandler;
12
12
  //# sourceMappingURL=middleware.d.ts.map
@@ -1,13 +1,13 @@
1
1
  import type { NextRequest } from 'next/server';
2
- import type { Context } from '../../types';
2
+ import type { Context } from '../../context';
3
3
  import type { FetchHandleOptions, FetchHandler } from '../fetch';
4
4
  import { type Value } from '@orpc/shared';
5
- export type ServeOptions<T extends Context> = Omit<FetchHandleOptions<T>, 'context'> & (undefined extends T ? {
5
+ export type ServeOptions<T extends Context> = Omit<FetchHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
6
6
  context?: Value<T, [NextRequest]>;
7
7
  } : {
8
8
  context: Value<T, [NextRequest]>;
9
9
  });
10
- export type ServeRest<T extends Context> = [options: ServeOptions<T>] | (undefined extends T ? [] : never);
10
+ export type ServeRest<T extends Context> = [options: ServeOptions<T>] | (Record<never, never> extends T ? [] : never);
11
11
  export interface ServeResult {
12
12
  GET: (req: NextRequest) => Promise<Response>;
13
13
  POST: (req: NextRequest) => Promise<Response>;
@@ -1,12 +1,12 @@
1
1
  import type { ServerResponse } from 'node:http';
2
+ import type { Context } from '../../context';
2
3
  import type { Router } from '../../router';
3
- import type { Context } from '../../types';
4
- import type { ORPCHandlerOptions } from '../fetch/orpc-handler';
4
+ import type { RPCHandlerOptions } from '../fetch/orpc-handler';
5
5
  import type { RequestHandler, RequestHandleRest, RequestHandleResult } from './types';
6
6
  import { type ExpressableIncomingMessage } from './request-listener';
7
- export declare class ORPCHandler<T extends Context> implements RequestHandler<T> {
7
+ export declare class RPCHandler<T extends Context> implements RequestHandler<T> {
8
8
  private readonly orpcFetchHandler;
9
- constructor(router: Router<T, any>, options?: NoInfer<ORPCHandlerOptions<T>>);
10
- handle(req: ExpressableIncomingMessage, res: ServerResponse, ...[options]: RequestHandleRest<T>): Promise<RequestHandleResult>;
9
+ constructor(router: Router<T, any>, options?: NoInfer<RPCHandlerOptions<T>>);
10
+ handle(req: ExpressableIncomingMessage, res: ServerResponse, ...rest: RequestHandleRest<T>): Promise<RequestHandleResult>;
11
11
  }
12
12
  //# sourceMappingURL=orpc-handler.d.ts.map
@@ -1,16 +1,16 @@
1
1
  import type { HTTPPath } from '@orpc/contract';
2
2
  import type { Promisable } from '@orpc/shared';
3
3
  import type { IncomingMessage, ServerResponse } from 'node:http';
4
- import type { Context } from '../../types';
4
+ import type { Context } from '../../context';
5
5
  export type RequestHandleOptions<T extends Context> = {
6
6
  prefix?: HTTPPath;
7
7
  beforeSend?: (response: Response, context: T) => Promisable<void>;
8
- } & (undefined extends T ? {
8
+ } & (Record<never, never> extends T ? {
9
9
  context?: T;
10
10
  } : {
11
11
  context: T;
12
12
  });
13
- export type RequestHandleRest<T extends Context> = [options: RequestHandleOptions<T>] | (undefined extends T ? [] : never);
13
+ export type RequestHandleRest<T extends Context> = [options: RequestHandleOptions<T>] | (Record<never, never> extends T ? [] : never);
14
14
  export type RequestHandleResult = {
15
15
  matched: true;
16
16
  } | {
@@ -0,0 +1,49 @@
1
+ import type { ContractBuilderConfig, ContractRouter, ErrorMap, ErrorMapGuard, ErrorMapSuggestions, HTTPPath, RouteOptions, Schema, SchemaInput, SchemaOutput, StrictErrorMap } from '@orpc/contract';
2
+ import type { ConflictContextGuard, Context, TypeCurrentContext, TypeInitialContext } from './context';
3
+ import type { ORPCErrorConstructorMap } from './error';
4
+ import type { FlattenLazy } from './lazy';
5
+ import type { Middleware } from './middleware';
6
+ import type { ProcedureHandler } from './procedure';
7
+ import type { Router } from './router';
8
+ import type { AdaptedRouter } from './router-builder';
9
+ import { ProcedureBuilder } from './procedure-builder';
10
+ import { ProcedureBuilderWithInput } from './procedure-builder-with-input';
11
+ import { ProcedureBuilderWithOutput } from './procedure-builder-with-output';
12
+ import { DecoratedProcedure } from './procedure-decorated';
13
+ import { RouterBuilder } from './router-builder';
14
+ export interface BuilderWithErrorsMiddlewaresDef<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap> {
15
+ __initialContext?: TypeInitialContext<TInitialContext>;
16
+ __currentContext?: TypeCurrentContext<TCurrentContext>;
17
+ errorMap: TErrorMap;
18
+ middlewares: Middleware<any, any, any, any, any>[];
19
+ inputValidationIndex: number;
20
+ outputValidationIndex: number;
21
+ config: ContractBuilderConfig;
22
+ }
23
+ /**
24
+ * `BuilderWithErrorsMiddlewares` is a combination of `BuilderWithErrorsMiddlewares` and `BuilderWithErrors`.
25
+ *
26
+ * Why?
27
+ * - prevents .middleware after .use (can mislead the behavior)
28
+ * - prevents .contract after .errors (add error map to existing contract can make the contract invalid)
29
+ * - prevents .context after .use (middlewares required current context, so it tricky when change the current context)
30
+ *
31
+ */
32
+ export declare class BuilderWithErrorsMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap> {
33
+ '~type': "BuilderWithErrorsMiddlewares";
34
+ '~orpc': BuilderWithErrorsMiddlewaresDef<TInitialContext, TCurrentContext, TErrorMap>;
35
+ constructor(def: BuilderWithErrorsMiddlewaresDef<TInitialContext, TCurrentContext, TErrorMap>);
36
+ errors<U extends ErrorMap & ErrorMapGuard<TErrorMap> & ErrorMapSuggestions>(errors: U): BuilderWithErrorsMiddlewares<TInitialContext, TCurrentContext, TErrorMap & U>;
37
+ use<U extends Context>(middleware: Middleware<TCurrentContext, U, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>>): ConflictContextGuard<TCurrentContext & U> & BuilderWithErrorsMiddlewares<TInitialContext, TCurrentContext & U, TErrorMap>;
38
+ route(route: RouteOptions): ProcedureBuilder<TInitialContext, TCurrentContext, TErrorMap>;
39
+ input<USchema extends Schema>(schema: USchema, example?: SchemaInput<USchema>): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TErrorMap>;
40
+ output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, USchema, TErrorMap>;
41
+ handler<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, undefined, undefined, UFuncOutput, TErrorMap>): DecoratedProcedure<TInitialContext, TCurrentContext, undefined, undefined, UFuncOutput, TErrorMap>;
42
+ prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap>;
43
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap>;
44
+ router<U extends Router<TCurrentContext, ContractRouter<ErrorMap & Partial<StrictErrorMap<TErrorMap>>>>>(router: U): AdaptedRouter<TInitialContext, U, TErrorMap>;
45
+ lazy<U extends Router<TCurrentContext, ContractRouter<ErrorMap & Partial<StrictErrorMap<TErrorMap>>>>>(loader: () => Promise<{
46
+ default: U;
47
+ }>): AdaptedRouter<TInitialContext, FlattenLazy<U>, TErrorMap>;
48
+ }
49
+ //# sourceMappingURL=builder-with-errors-middlewares.d.ts.map
@@ -0,0 +1,49 @@
1
+ import type { ContractBuilderConfig, ContractRouter, ErrorMap, ErrorMapGuard, ErrorMapSuggestions, HTTPPath, RouteOptions, Schema, SchemaInput, SchemaOutput, StrictErrorMap } from '@orpc/contract';
2
+ import type { BuilderConfig } from './builder';
3
+ import type { Context, TypeInitialContext } from './context';
4
+ import type { ORPCErrorConstructorMap } from './error';
5
+ import type { FlattenLazy } from './lazy';
6
+ import type { Middleware } from './middleware';
7
+ import type { DecoratedMiddleware } from './middleware-decorated';
8
+ import type { ProcedureHandler } from './procedure';
9
+ import type { Router } from './router';
10
+ import type { AdaptedRouter } from './router-builder';
11
+ import { BuilderWithErrorsMiddlewares } from './builder-with-errors-middlewares';
12
+ import { ProcedureBuilder } from './procedure-builder';
13
+ import { ProcedureBuilderWithInput } from './procedure-builder-with-input';
14
+ import { ProcedureBuilderWithOutput } from './procedure-builder-with-output';
15
+ import { DecoratedProcedure } from './procedure-decorated';
16
+ import { RouterBuilder } from './router-builder';
17
+ export interface BuilderWithErrorsDef<TInitialContext extends Context, TErrorMap extends ErrorMap> {
18
+ __initialContext?: TypeInitialContext<TInitialContext>;
19
+ errorMap: TErrorMap;
20
+ config: BuilderConfig;
21
+ }
22
+ /**
23
+ * `BuilderWithErrors` is a branch of `Builder` which it has error map.
24
+ *
25
+ * Why?
26
+ * - prevents .contract after .errors (add error map to existing contract can make the contract invalid)
27
+ *
28
+ */
29
+ export declare class BuilderWithErrors<TInitialContext extends Context, TErrorMap extends ErrorMap> {
30
+ '~type': "BuilderWithErrors";
31
+ '~orpc': BuilderWithErrorsDef<TInitialContext, TErrorMap>;
32
+ constructor(def: BuilderWithErrorsDef<TInitialContext, TErrorMap>);
33
+ config(config: ContractBuilderConfig): BuilderWithErrors<TInitialContext, TErrorMap>;
34
+ context<UContext extends Context & TInitialContext = TInitialContext>(): BuilderWithErrors<UContext, TErrorMap>;
35
+ errors<U extends ErrorMap & ErrorMapGuard<TErrorMap> & ErrorMapSuggestions>(errors: U): BuilderWithErrors<TInitialContext, TErrorMap & U>;
36
+ middleware<UOutContext extends Context, TInput, TOutput = any>(middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>>;
37
+ use<U extends Context>(middleware: Middleware<TInitialContext, U, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>>): BuilderWithErrorsMiddlewares<TInitialContext, TInitialContext & U, TErrorMap>;
38
+ route(route: RouteOptions): ProcedureBuilder<TInitialContext, TInitialContext, TErrorMap>;
39
+ input<USchema extends Schema>(schema: USchema, example?: SchemaInput<USchema>): ProcedureBuilderWithInput<TInitialContext, TInitialContext, USchema, TErrorMap>;
40
+ output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): ProcedureBuilderWithOutput<TInitialContext, TInitialContext, USchema, TErrorMap>;
41
+ handler<UFuncOutput>(handler: ProcedureHandler<TInitialContext, undefined, undefined, UFuncOutput, TErrorMap>): DecoratedProcedure<TInitialContext, TInitialContext, undefined, undefined, UFuncOutput, TErrorMap>;
42
+ prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TInitialContext, TErrorMap>;
43
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TInitialContext, TErrorMap>;
44
+ router<U extends Router<TInitialContext, ContractRouter<ErrorMap & Partial<StrictErrorMap<TErrorMap>>>>>(router: U): AdaptedRouter<TInitialContext, U, TErrorMap>;
45
+ lazy<U extends Router<TInitialContext, ContractRouter<ErrorMap & Partial<StrictErrorMap<TErrorMap>>>>>(loader: () => Promise<{
46
+ default: U;
47
+ }>): AdaptedRouter<TInitialContext, FlattenLazy<U>, TErrorMap>;
48
+ }
49
+ //# sourceMappingURL=builder-with-errors.d.ts.map
@@ -0,0 +1,49 @@
1
+ import type { ContractBuilderConfig, ContractRouter, ErrorMap, ErrorMapSuggestions, HTTPPath, RouteOptions, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
+ import type { ConflictContextGuard, Context, TypeCurrentContext, TypeInitialContext } from './context';
3
+ import type { FlattenLazy } from './lazy';
4
+ import type { Middleware } from './middleware';
5
+ import type { ProcedureHandler } from './procedure';
6
+ import type { Router } from './router';
7
+ import type { AdaptedRouter } from './router-builder';
8
+ import { BuilderWithErrorsMiddlewares } from './builder-with-errors-middlewares';
9
+ import { type ChainableImplementer } from './implementer-chainable';
10
+ import { ProcedureBuilder } from './procedure-builder';
11
+ import { ProcedureBuilderWithInput } from './procedure-builder-with-input';
12
+ import { ProcedureBuilderWithOutput } from './procedure-builder-with-output';
13
+ import { DecoratedProcedure } from './procedure-decorated';
14
+ import { RouterBuilder } from './router-builder';
15
+ /**
16
+ * `BuilderWithMiddlewares` is a branch of `Builder` which it has middlewares.
17
+ *
18
+ * Why?
19
+ * - prevents .middleware after .use (can mislead the behavior)
20
+ * - prevents .context after .use (middlewares required current context, so it tricky when change the current context)
21
+ *
22
+ */
23
+ export interface BuilderWithMiddlewaresDef<TInitialContext extends Context, TCurrentContext extends Context> {
24
+ __initialContext?: TypeInitialContext<TInitialContext>;
25
+ __currentContext?: TypeCurrentContext<TCurrentContext>;
26
+ config: ContractBuilderConfig;
27
+ middlewares: Middleware<any, any, any, any, any>[];
28
+ inputValidationIndex: number;
29
+ outputValidationIndex: number;
30
+ }
31
+ export declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context> {
32
+ '~type': "BuilderHasMiddlewares";
33
+ '~orpc': BuilderWithMiddlewaresDef<TInitialContext, TCurrentContext>;
34
+ constructor(def: BuilderWithMiddlewaresDef<TInitialContext, TCurrentContext>);
35
+ use<U extends Context>(middleware: Middleware<TCurrentContext, U, unknown, unknown, Record<never, never>>): ConflictContextGuard<TCurrentContext & U> & BuilderWithMiddlewares<TInitialContext, TCurrentContext & U>;
36
+ errors<U extends ErrorMap & ErrorMapSuggestions>(errors: U): BuilderWithErrorsMiddlewares<TInitialContext, TCurrentContext, U>;
37
+ route(route: RouteOptions): ProcedureBuilder<TInitialContext, TCurrentContext, Record<never, never>>;
38
+ input<USchema extends Schema>(schema: USchema, example?: SchemaInput<USchema>): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, Record<never, never>>;
39
+ output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, USchema, Record<never, never>>;
40
+ handler<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, undefined, undefined, UFuncOutput, Record<never, never>>): DecoratedProcedure<TInitialContext, TCurrentContext, undefined, undefined, UFuncOutput, Record<never, never>>;
41
+ prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, Record<never, never>>;
42
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, Record<never, never>>;
43
+ router<U extends Router<TCurrentContext, any>>(router: U): AdaptedRouter<TInitialContext, U, Record<never, never>>;
44
+ lazy<U extends Router<TCurrentContext, any>>(loader: () => Promise<{
45
+ default: U;
46
+ }>): AdaptedRouter<TInitialContext, FlattenLazy<U>, Record<never, never>>;
47
+ contract<U extends ContractRouter<any>>(contract: U): ChainableImplementer<TInitialContext, TCurrentContext, U>;
48
+ }
49
+ //# sourceMappingURL=builder-with-middlewares.d.ts.map
@@ -1,36 +1,46 @@
1
- import type { ANY_CONTRACT_PROCEDURE, ContractRouter, ErrorMap, HTTPPath, RouteOptions, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
1
+ import type { ContractBuilderConfig, ContractRouter, ErrorMap, ErrorMapSuggestions, HTTPPath, RouteOptions, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
+ import type { ConflictContextGuard, Context, TypeInitialContext } from './context';
2
3
  import type { FlattenLazy } from './lazy';
3
4
  import type { Middleware } from './middleware';
4
5
  import type { DecoratedMiddleware } from './middleware-decorated';
6
+ import type { ProcedureHandler } from './procedure';
5
7
  import type { Router } from './router';
6
8
  import type { AdaptedRouter } from './router-builder';
7
- import type { Context, MergeContext, WELL_CONTEXT } from './types';
9
+ import { BuilderWithErrors } from './builder-with-errors';
10
+ import { BuilderWithMiddlewares } from './builder-with-middlewares';
8
11
  import { type ChainableImplementer } from './implementer-chainable';
9
- import { type ProcedureHandler } from './procedure';
10
12
  import { ProcedureBuilder } from './procedure-builder';
11
- import { type DecoratedProcedure } from './procedure-decorated';
13
+ import { ProcedureBuilderWithInput } from './procedure-builder-with-input';
14
+ import { ProcedureBuilderWithOutput } from './procedure-builder-with-output';
15
+ import { DecoratedProcedure } from './procedure-decorated';
12
16
  import { RouterBuilder } from './router-builder';
13
- export interface BuilderDef<TContext extends Context, TExtraContext extends Context> {
14
- middlewares?: Middleware<MergeContext<TContext, TExtraContext>, Partial<TExtraContext> | undefined, unknown, any, Record<string, unknown>>[];
17
+ export interface BuilderConfig extends ContractBuilderConfig {
18
+ initialInputValidationIndex?: number;
19
+ initialOutputValidationIndex?: number;
15
20
  }
16
- export declare class Builder<TContext extends Context, TExtraContext extends Context> {
21
+ export interface BuilderDef<TInitialContext extends Context> {
22
+ __initialContext?: TypeInitialContext<TInitialContext>;
23
+ config: BuilderConfig;
24
+ }
25
+ export declare class Builder<TInitialContext extends Context> {
17
26
  '~type': "Builder";
18
- '~orpc': BuilderDef<TContext, TExtraContext>;
19
- constructor(def: BuilderDef<TContext, TExtraContext>);
20
- context<UContext extends Context = WELL_CONTEXT>(): Builder<UContext, undefined>;
21
- use<U extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined>(middleware: Middleware<MergeContext<TContext, TExtraContext>, U, unknown, unknown, Record<string, unknown>>): Builder<TContext, MergeContext<TExtraContext, U>>;
22
- middleware<UExtraContext extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined, TInput = unknown, TOutput = any>(middleware: Middleware<MergeContext<TContext, TExtraContext>, UExtraContext, TInput, TOutput, Record<string, unknown>>): DecoratedMiddleware<MergeContext<TContext, TExtraContext>, UExtraContext, TInput, TOutput, Record<string, unknown>>;
23
- route(route: RouteOptions): ProcedureBuilder<TContext, TExtraContext, undefined, undefined, undefined>;
24
- input<USchema extends Schema>(schema: USchema, example?: SchemaInput<USchema>): ProcedureBuilder<TContext, TExtraContext, USchema, undefined, undefined>;
25
- output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): ProcedureBuilder<TContext, TExtraContext, undefined, USchema, undefined>;
26
- errors<UErrorMap extends ErrorMap>(errors: UErrorMap): ProcedureBuilder<TContext, TExtraContext, undefined, undefined, UErrorMap>;
27
- handler<UFuncOutput = undefined>(handler: ProcedureHandler<TContext, TExtraContext, undefined, undefined, UFuncOutput, undefined>): DecoratedProcedure<TContext, TExtraContext, undefined, undefined, UFuncOutput, undefined>;
28
- prefix(prefix: HTTPPath): RouterBuilder<TContext, TExtraContext>;
29
- tag(...tags: string[]): RouterBuilder<TContext, TExtraContext>;
30
- router<U extends Router<MergeContext<TContext, TExtraContext>, any>>(router: U): AdaptedRouter<TContext, U>;
31
- lazy<U extends Router<MergeContext<TContext, TExtraContext>, any>>(loader: () => Promise<{
27
+ '~orpc': BuilderDef<TInitialContext>;
28
+ constructor(def: BuilderDef<TInitialContext>);
29
+ config(config: ContractBuilderConfig): Builder<TInitialContext>;
30
+ context<UContext extends Context & TInitialContext = TInitialContext>(): Builder<UContext>;
31
+ middleware<UOutContext extends Context, TInput, TOutput = any>(middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, Record<never, never>>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, Record<never, never>>;
32
+ errors<U extends ErrorMap & ErrorMapSuggestions>(errors: U): BuilderWithErrors<TInitialContext, U>;
33
+ use<UOutContext extends Context>(middleware: Middleware<TInitialContext, UOutContext, unknown, unknown, Record<never, never>>): ConflictContextGuard<TInitialContext & UOutContext> & BuilderWithMiddlewares<TInitialContext, TInitialContext & UOutContext>;
34
+ route(route: RouteOptions): ProcedureBuilder<TInitialContext, TInitialContext, Record<never, never>>;
35
+ input<USchema extends Schema>(schema: USchema, example?: SchemaInput<USchema>): ProcedureBuilderWithInput<TInitialContext, TInitialContext, USchema, Record<never, never>>;
36
+ output<USchema extends Schema>(schema: USchema, example?: SchemaOutput<USchema>): ProcedureBuilderWithOutput<TInitialContext, TInitialContext, USchema, Record<never, never>>;
37
+ handler<UFuncOutput>(handler: ProcedureHandler<TInitialContext, undefined, undefined, UFuncOutput, Record<never, never>>): DecoratedProcedure<TInitialContext, TInitialContext, undefined, undefined, UFuncOutput, Record<never, never>>;
38
+ prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TInitialContext, Record<never, never>>;
39
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TInitialContext, Record<never, never>>;
40
+ router<U extends Router<TInitialContext, any>>(router: U): AdaptedRouter<TInitialContext, U, Record<never, never>>;
41
+ lazy<U extends Router<TInitialContext, any>>(loader: () => Promise<{
32
42
  default: U;
33
- }>): AdaptedRouter<TContext, FlattenLazy<U>>;
34
- contract<U extends ANY_CONTRACT_PROCEDURE | ContractRouter>(contract: U): ChainableImplementer<TContext, TExtraContext, U>;
43
+ }>): AdaptedRouter<TInitialContext, FlattenLazy<U>, Record<never, never>>;
44
+ contract<U extends ContractRouter<any>>(contract: U): ChainableImplementer<TInitialContext, TInitialContext, U>;
35
45
  }
36
46
  //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1,6 @@
1
+ export interface Config {
2
+ initialInputValidationIndex: number;
3
+ initialOutputValidationIndex: number;
4
+ }
5
+ export declare function fallbackConfig<T extends keyof Config>(key: T, value?: Config[T]): Config[T];
6
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { IsNever } from '@orpc/shared';
2
+ export type Context = Record<string, any>;
3
+ export type TypeInitialContext<T extends Context> = (type: T) => any;
4
+ export type TypeCurrentContext<T extends Context> = {
5
+ type: T;
6
+ };
7
+ export type ConflictContextGuard<T extends Context> = true extends IsNever<T> | {
8
+ [K in keyof T]: IsNever<T[K]>;
9
+ }[keyof T] ? never : unknown;
10
+ //# sourceMappingURL=context.d.ts.map
@@ -3,7 +3,7 @@ import { ORPCError } from '@orpc/contract';
3
3
  export type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<any, TData>, 'defined' | 'code' | 'status'>;
4
4
  export type ORPCErrorConstructorMapItemRest<TData> = [options: ORPCErrorConstructorMapItemOptions<TData>] | (undefined extends TData ? [] : never);
5
5
  export type ORPCErrorConstructorMapItem<TCode extends string, TDataSchema extends Schema> = (...rest: ORPCErrorConstructorMapItemRest<SchemaInput<TDataSchema>>) => ORPCError<TCode, SchemaOutput<TDataSchema>>;
6
- export type ORPCErrorConstructorMap<T extends ErrorMap> = T extends undefined ? Record<string, unknown> : {
6
+ export type ORPCErrorConstructorMap<T extends ErrorMap> = {
7
7
  [K in keyof T]: K extends string ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, UInputSchema> : never : never;
8
8
  };
9
9
  export declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
@@ -1,6 +1,6 @@
1
1
  import type { ContractRouter, HTTPPath } from '@orpc/contract';
2
- export declare function setRouterContract<T extends object>(obj: T, contract: ContractRouter): T;
3
- export declare function getRouterContract(obj: object): ContractRouter | undefined;
2
+ export declare function setRouterContract<T extends object>(obj: T, contract: ContractRouter<any>): T;
3
+ export declare function getRouterContract(obj: object): ContractRouter<any> | undefined;
4
4
  export declare function deepSetLazyRouterPrefix<T extends object>(router: T, prefix: HTTPPath): T;
5
5
  export declare function getLazyRouterPrefix(obj: object): HTTPPath | undefined;
6
6
  //# sourceMappingURL=hidden.d.ts.map
@@ -1,10 +1,16 @@
1
+ import type { Context, TypeCurrentContext, TypeInitialContext } from './context';
1
2
  import type { Middleware } from './middleware';
2
- import type { Context, MergeContext, WELL_CONTEXT } from './types';
3
3
  import { type ContractProcedure, type ContractRouter } from '@orpc/contract';
4
4
  import { ProcedureImplementer } from './procedure-implementer';
5
5
  import { RouterImplementer } from './router-implementer';
6
- export type ChainableImplementer<TContext extends Context, TExtraContext extends Context, TContract extends ContractRouter> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap> ? ProcedureImplementer<TContext, TExtraContext, UInputSchema, UOutputSchema, UErrorMap> : {
7
- [K in keyof TContract]: TContract[K] extends ContractRouter ? ChainableImplementer<TContext, TExtraContext, TContract[K]> : never;
8
- } & Omit<RouterImplementer<TContext, TExtraContext, TContract>, '~type' | '~orpc'>;
9
- export declare function createChainableImplementer<TContext extends Context = WELL_CONTEXT, TExtraContext extends Context = undefined, TContract extends ContractRouter = any>(contract: TContract, middlewares?: Middleware<MergeContext<TContext, TExtraContext>, Partial<TExtraContext> | undefined, unknown, any, Record<string, unknown>>[]): ChainableImplementer<TContext, TExtraContext, TContract>;
6
+ export type ChainableImplementer<TInitialContext extends Context, TCurrentContext extends Context, TContract extends ContractRouter<any>> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap> : {
7
+ [K in keyof TContract]: TContract[K] extends ContractRouter<any> ? ChainableImplementer<TInitialContext, TCurrentContext, TContract[K]> : never;
8
+ } & Omit<RouterImplementer<TInitialContext, TCurrentContext, TContract>, '~type' | '~orpc'>;
9
+ export declare function createChainableImplementer<TInitialContext extends Context, TCurrentContext extends Context, TContract extends ContractRouter<any>>(contract: TContract, options: {
10
+ __initialContext?: TypeInitialContext<TInitialContext>;
11
+ __currentContext?: TypeCurrentContext<TCurrentContext>;
12
+ middlewares: Middleware<any, any, any, any, any>[];
13
+ inputValidationIndex: number;
14
+ outputValidationIndex: number;
15
+ }): ChainableImplementer<TInitialContext, TCurrentContext, TContract>;
10
16
  //# sourceMappingURL=implementer-chainable.d.ts.map
@@ -1,6 +1,7 @@
1
- import type { WELL_CONTEXT } from './types';
2
1
  import { Builder } from './builder';
3
2
  export * from './builder';
3
+ export * from './config';
4
+ export * from './context';
4
5
  export * from './error';
5
6
  export * from './hidden';
6
7
  export * from './implementer-chainable';
@@ -13,12 +14,12 @@ export * from './procedure-builder';
13
14
  export * from './procedure-client';
14
15
  export * from './procedure-decorated';
15
16
  export * from './procedure-implementer';
17
+ export * from './procedure-utils';
16
18
  export * from './router';
17
19
  export * from './router-builder';
18
20
  export * from './router-client';
19
21
  export * from './router-implementer';
20
22
  export * from './types';
21
- export * from './utils';
22
- export { configGlobal, fallbackToGlobalConfig, isDefinedError, ORPCError, safe } from '@orpc/contract';
23
- export declare const os: Builder<WELL_CONTEXT, undefined>;
23
+ export { isDefinedError, ORPCError, safe, type } from '@orpc/contract';
24
+ export declare const os: Builder<import("./context").Context>;
24
25
  //# sourceMappingURL=index.d.ts.map
@@ -1,10 +1,8 @@
1
- import type { ErrorFromErrorMap, SchemaInput, SchemaOutput } from '@orpc/contract';
2
1
  import type { Lazy } from './lazy';
3
- import type { Procedure } from './procedure';
4
- import type { ProcedureClient } from './procedure-client';
2
+ import type { ANY_PROCEDURE } from './procedure';
5
3
  import { type ANY_ROUTER } from './router';
6
- export type DecoratedLazy<T> = T extends Lazy<infer U> ? DecoratedLazy<U> : Lazy<T> & (T extends Procedure<infer UContext, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap> ? undefined extends UContext ? ProcedureClient<unknown, SchemaInput<UInputSchema>, SchemaOutput<UOutputSchema, UFuncOutput>, ErrorFromErrorMap<UErrorMap>> : unknown : {
7
- [K in keyof T]: T[K] extends object ? DecoratedLazy<T[K]> : never;
8
- });
4
+ export type DecoratedLazy<T> = T extends Lazy<infer U> ? DecoratedLazy<U> : Lazy<T> & (T extends ANY_PROCEDURE ? unknown : T extends ANY_ROUTER ? {
5
+ [K in keyof T]: DecoratedLazy<T[K]>;
6
+ } : unknown);
9
7
  export declare function decorateLazy<T extends Lazy<ANY_ROUTER | undefined>>(lazied: T): DecoratedLazy<T>;
10
8
  //# sourceMappingURL=lazy-decorated.d.ts.map
@@ -1,9 +1,9 @@
1
+ import type { Context } from './context';
1
2
  import type { ORPCErrorConstructorMap } from './error';
2
3
  import type { MapInputMiddleware, Middleware } from './middleware';
3
- import type { Context, MergeContext } from './types';
4
- export interface DecoratedMiddleware<TContext extends Context, TExtraContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>> extends Middleware<TContext, TExtraContext, TInput, TOutput, TErrorConstructorMap> {
5
- concat: (<UExtraContext extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined, UInput = unknown>(middleware: Middleware<MergeContext<TContext, TExtraContext>, UExtraContext, UInput & TInput, TOutput, TErrorConstructorMap>) => DecoratedMiddleware<TContext, MergeContext<TExtraContext, UExtraContext>, UInput & TInput, TOutput, TErrorConstructorMap>) & (<UExtraContext extends Context & Partial<MergeContext<TContext, TExtraContext>> | undefined = undefined, UInput = TInput, UMappedInput = unknown>(middleware: Middleware<MergeContext<TContext, TExtraContext>, UExtraContext, UMappedInput, TOutput, TErrorConstructorMap>, mapInput: MapInputMiddleware<UInput & TInput, UMappedInput>) => DecoratedMiddleware<TContext, MergeContext<TExtraContext, UExtraContext>, UInput & TInput, TOutput, TErrorConstructorMap>);
6
- mapInput: <UInput = unknown>(map: MapInputMiddleware<UInput, TInput>) => DecoratedMiddleware<TContext, TExtraContext, UInput, TOutput, TErrorConstructorMap>;
4
+ export interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>> extends Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap> {
5
+ concat: (<UOutContext extends Context, UInput>(middleware: Middleware<TInContext & TOutContext, UOutContext, UInput & TInput, TOutput, TErrorConstructorMap>) => DecoratedMiddleware<TInContext, TOutContext & UOutContext, UInput & TInput, TOutput, TErrorConstructorMap>) & (<UOutContext extends Context, UInput = TInput, UMappedInput = unknown>(middleware: Middleware<TInContext & TOutContext, UOutContext, UMappedInput, TOutput, TErrorConstructorMap>, mapInput: MapInputMiddleware<UInput & TInput, UMappedInput>) => DecoratedMiddleware<TInContext, TOutContext & UOutContext, UInput & TInput, TOutput, TErrorConstructorMap>);
6
+ mapInput: <UInput = unknown>(map: MapInputMiddleware<UInput, TInput>) => DecoratedMiddleware<TInContext, TOutContext, UInput, TOutput, TErrorConstructorMap>;
7
7
  }
8
- export declare function decorateMiddleware<TContext extends Context, TExtraContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>>(middleware: Middleware<TContext, TExtraContext, TInput, TOutput, TErrorConstructorMap>): DecoratedMiddleware<TContext, TExtraContext, TInput, TOutput, TErrorConstructorMap>;
8
+ export declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>>(middleware: Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap>): DecoratedMiddleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap>;
9
9
  //# sourceMappingURL=middleware-decorated.d.ts.map
@@ -1,35 +1,39 @@
1
1
  import type { Promisable } from '@orpc/shared';
2
+ import type { Context } from './context';
2
3
  import type { ORPCErrorConstructorMap } from './error';
3
4
  import type { ANY_PROCEDURE } from './procedure';
4
- import type { AbortSignal, Context } from './types';
5
- export type MiddlewareResult<TExtraContext extends Context, TOutput> = Promisable<{
5
+ import type { AbortSignal } from './types';
6
+ export type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
6
7
  output: TOutput;
7
- context: TExtraContext;
8
+ context: TOutContext;
8
9
  }>;
9
- export interface MiddlewareNextFn<TOutput> {
10
- <UExtraContext extends Context = undefined>(options: UExtraContext extends undefined ? {
11
- context?: UExtraContext;
12
- } : {
13
- context: UExtraContext;
14
- }): MiddlewareResult<UExtraContext, TOutput>;
10
+ export type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
11
+ context?: TOutContext;
12
+ } : {
13
+ context: TOutContext;
14
+ };
15
+ export type MiddlewareNextFnRest<TOutContext extends Context> = [options: MiddlewareNextFnOptions<TOutContext>] | (Record<never, never> extends TOutContext ? [] : never);
16
+ export interface MiddlewareNextFn<TInContext extends Context, TOutput> {
17
+ <U extends Context & Partial<TInContext> = Record<never, never>>(...rest: MiddlewareNextFnRest<U>): MiddlewareResult<U, TOutput>;
15
18
  }
16
19
  export interface MiddlewareOutputFn<TOutput> {
17
- (output: TOutput): MiddlewareResult<undefined, TOutput>;
20
+ (output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
18
21
  }
19
- export interface MiddlewareOptions<TContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>> {
20
- context: TContext;
22
+ export interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>> {
23
+ context: TInContext;
21
24
  path: string[];
22
25
  procedure: ANY_PROCEDURE;
23
26
  signal?: AbortSignal;
24
- next: MiddlewareNextFn<TOutput>;
27
+ next: MiddlewareNextFn<TInContext, TOutput>;
25
28
  errors: TErrorConstructorMap;
26
29
  }
27
- export interface Middleware<TContext extends Context, TExtraContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>> {
28
- (options: MiddlewareOptions<TContext, TOutput, TErrorConstructorMap>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TExtraContext, TOutput>>;
30
+ export interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>> {
31
+ (options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
29
32
  }
30
33
  export type ANY_MIDDLEWARE = Middleware<any, any, any, any, any>;
31
34
  export interface MapInputMiddleware<TInput, TMappedInput> {
32
35
  (input: TInput): TMappedInput;
33
36
  }
34
37
  export type ANY_MAP_INPUT_MIDDLEWARE = MapInputMiddleware<any, any>;
38
+ export declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
35
39
  //# sourceMappingURL=middleware.d.ts.map