@orpc/server 0.0.0-next.cba521d → 0.0.0-next.cc4cb21

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 (70) hide show
  1. package/README.md +118 -0
  2. package/dist/chunk-EWOWWNDI.js +182 -0
  3. package/dist/chunk-MHVECKBC.js +421 -0
  4. package/dist/chunk-TXHKQO7N.js +120 -0
  5. package/dist/chunk-XT6IYOIS.js +32 -0
  6. package/dist/fetch.js +6 -11
  7. package/dist/hono.js +18 -14
  8. package/dist/index.js +236 -385
  9. package/dist/next.js +6 -11
  10. package/dist/node.js +19 -75
  11. package/dist/plugins.js +11 -0
  12. package/dist/src/adapters/fetch/index.d.ts +1 -4
  13. package/dist/src/adapters/fetch/rpc-handler.d.ts +11 -0
  14. package/dist/src/adapters/fetch/types.d.ts +4 -11
  15. package/dist/src/adapters/hono/middleware.d.ts +6 -6
  16. package/dist/src/adapters/next/serve.d.ts +11 -11
  17. package/dist/src/adapters/node/index.d.ts +1 -3
  18. package/dist/src/adapters/node/rpc-handler.d.ts +11 -0
  19. package/dist/src/adapters/node/types.d.ts +15 -15
  20. package/dist/src/adapters/standard/handler.d.ts +53 -0
  21. package/dist/src/adapters/standard/index.d.ts +6 -0
  22. package/dist/src/adapters/standard/rpc-codec.d.ts +16 -0
  23. package/dist/src/adapters/standard/rpc-handler.d.ts +8 -0
  24. package/dist/src/adapters/standard/rpc-matcher.d.ts +10 -0
  25. package/dist/src/adapters/standard/types.d.ts +21 -0
  26. package/dist/src/builder-variants.d.ts +75 -0
  27. package/dist/src/builder.d.ts +51 -29
  28. package/dist/src/config.d.ts +6 -0
  29. package/dist/src/context.d.ts +8 -0
  30. package/dist/src/error.d.ts +9 -7
  31. package/dist/src/hidden.d.ts +6 -4
  32. package/dist/src/implementer-procedure.d.ts +33 -0
  33. package/dist/src/implementer-variants.d.ts +18 -0
  34. package/dist/src/implementer.d.ts +29 -0
  35. package/dist/src/index.d.ts +12 -12
  36. package/dist/src/lazy-utils.d.ts +4 -2
  37. package/dist/src/lazy.d.ts +9 -5
  38. package/dist/src/middleware-decorated.d.ts +7 -5
  39. package/dist/src/middleware-utils.d.ts +5 -0
  40. package/dist/src/middleware.d.ts +23 -21
  41. package/dist/src/plugins/base.d.ts +11 -0
  42. package/dist/src/plugins/cors.d.ts +19 -0
  43. package/dist/src/plugins/index.d.ts +4 -0
  44. package/dist/src/plugins/response-headers.d.ts +10 -0
  45. package/dist/src/procedure-client.d.ts +23 -12
  46. package/dist/src/procedure-decorated.d.ts +13 -15
  47. package/dist/src/procedure-utils.d.ts +6 -4
  48. package/dist/src/procedure.d.ts +20 -33
  49. package/dist/src/router-accessible-lazy.d.ts +8 -0
  50. package/dist/src/router-client.d.ts +8 -22
  51. package/dist/src/router.d.ts +26 -12
  52. package/dist/src/utils.d.ts +23 -2
  53. package/dist/standard.js +13 -0
  54. package/package.json +20 -3
  55. package/dist/chunk-3EVCPLVI.js +0 -301
  56. package/dist/chunk-OUPZ7QGV.js +0 -245
  57. package/dist/chunk-WUOGVGWG.js +0 -1
  58. package/dist/src/adapters/fetch/orpc-handler.d.ts +0 -20
  59. package/dist/src/adapters/fetch/orpc-payload-codec.d.ts +0 -16
  60. package/dist/src/adapters/fetch/orpc-procedure-matcher.d.ts +0 -12
  61. package/dist/src/adapters/fetch/super-json.d.ts +0 -12
  62. package/dist/src/adapters/node/orpc-handler.d.ts +0 -12
  63. package/dist/src/adapters/node/request-listener.d.ts +0 -28
  64. package/dist/src/implementer-chainable.d.ts +0 -10
  65. package/dist/src/lazy-decorated.d.ts +0 -7
  66. package/dist/src/procedure-builder.d.ts +0 -24
  67. package/dist/src/procedure-implementer.d.ts +0 -20
  68. package/dist/src/router-builder.d.ts +0 -29
  69. package/dist/src/router-implementer.d.ts +0 -21
  70. package/dist/src/types.d.ts +0 -14
package/dist/next.js CHANGED
@@ -1,17 +1,15 @@
1
- import "./chunk-WUOGVGWG.js";
2
1
  import {
3
- ORPCPayloadCodec,
4
- ORPCProcedureMatcher,
5
- RPCHandler,
6
- super_json_exports
7
- } from "./chunk-3EVCPLVI.js";
8
- import "./chunk-OUPZ7QGV.js";
2
+ RPCHandler
3
+ } from "./chunk-XT6IYOIS.js";
4
+ import "./chunk-EWOWWNDI.js";
5
+ import "./chunk-MHVECKBC.js";
6
+ import "./chunk-TXHKQO7N.js";
9
7
 
10
8
  // src/adapters/next/serve.ts
11
9
  import { value } from "@orpc/shared";
12
10
  function serve(handler, ...[options]) {
13
11
  const main = async (req) => {
14
- const context = await value(options?.context, req);
12
+ const context = await value(options?.context ?? {}, req);
15
13
  const { matched, response } = await handler.handle(req, { ...options, context });
16
14
  if (matched) {
17
15
  return response;
@@ -27,10 +25,7 @@ function serve(handler, ...[options]) {
27
25
  };
28
26
  }
29
27
  export {
30
- ORPCPayloadCodec,
31
- ORPCProcedureMatcher,
32
28
  RPCHandler,
33
- super_json_exports as SuperJSON,
34
29
  serve
35
30
  };
36
31
  //# sourceMappingURL=next.js.map
package/dist/node.js CHANGED
@@ -1,87 +1,31 @@
1
1
  import {
2
- RPCHandler
3
- } from "./chunk-3EVCPLVI.js";
4
- import "./chunk-OUPZ7QGV.js";
2
+ RPCCodec,
3
+ RPCMatcher,
4
+ StandardHandler
5
+ } from "./chunk-EWOWWNDI.js";
6
+ import "./chunk-MHVECKBC.js";
7
+ import "./chunk-TXHKQO7N.js";
5
8
 
6
- // src/adapters/node/request-listener.ts
7
- function createRequest(req, res) {
8
- const controller = new AbortController();
9
- res.on("close", () => {
10
- controller.abort();
11
- });
12
- const method = req.method ?? "GET";
13
- const headers = createHeaders(req);
14
- const protocol = "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
15
- const host = headers.get("Host") ?? "localhost";
16
- const url = new URL(req.originalUrl ?? req.url ?? "/", `${protocol}//${host}`);
17
- const init = { method, headers, signal: controller.signal };
18
- if (method !== "GET" && method !== "HEAD") {
19
- init.body = new ReadableStream({
20
- start(controller2) {
21
- req.on("data", (chunk) => {
22
- controller2.enqueue(new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength));
23
- });
24
- req.on("end", () => {
25
- controller2.close();
26
- });
27
- }
28
- });
29
- init.duplex = "half";
30
- }
31
- return new Request(url, init);
32
- }
33
- function createHeaders(req) {
34
- const headers = new Headers();
35
- const rawHeaders = req.rawHeaders;
36
- for (let i = 0; i < rawHeaders.length; i += 2) {
37
- headers.append(rawHeaders[i], rawHeaders[i + 1]);
38
- }
39
- return headers;
40
- }
41
- async function sendResponse(res, response) {
42
- const headers = {};
43
- for (const [key, value] of response.headers) {
44
- if (key in headers) {
45
- if (Array.isArray(headers[key])) {
46
- headers[key].push(value);
47
- } else {
48
- headers[key] = [headers[key], value];
49
- }
50
- } else {
51
- headers[key] = value;
52
- }
53
- }
54
- res.writeHead(response.status, headers);
55
- if (response.body != null && res.req.method !== "HEAD") {
56
- for await (const chunk of response.body) {
57
- res.write(chunk);
58
- }
59
- }
60
- res.end();
61
- }
62
-
63
- // src/adapters/node/orpc-handler.ts
64
- var RPCHandler2 = class {
65
- orpcFetchHandler;
9
+ // src/adapters/node/rpc-handler.ts
10
+ import { sendStandardResponse, toStandardRequest } from "@orpc/standard-server-node";
11
+ var RPCHandler = class {
12
+ standardHandler;
66
13
  constructor(router, options) {
67
- this.orpcFetchHandler = new RPCHandler(router, options);
14
+ const codec = options?.codec ?? new RPCCodec();
15
+ const matcher = options?.matcher ?? new RPCMatcher();
16
+ this.standardHandler = new StandardHandler(router, matcher, codec, options);
68
17
  }
69
- async handle(req, res, ...[options]) {
70
- const request = createRequest(req, res);
71
- const castedOptions = options ?? {};
72
- const result = await this.orpcFetchHandler.handle(request, castedOptions);
73
- if (result.matched === false) {
18
+ async handle(req, res, ...rest) {
19
+ const standardRequest = toStandardRequest(req, res);
20
+ const result = await this.standardHandler.handle(standardRequest, ...rest);
21
+ if (!result.matched) {
74
22
  return { matched: false };
75
23
  }
76
- await options?.beforeSend?.(result.response, castedOptions.context);
77
- await sendResponse(res, result.response);
24
+ await sendStandardResponse(res, result.response);
78
25
  return { matched: true };
79
26
  }
80
27
  };
81
28
  export {
82
- RPCHandler2 as RPCHandler,
83
- createHeaders,
84
- createRequest,
85
- sendResponse
29
+ RPCHandler
86
30
  };
87
31
  //# sourceMappingURL=node.js.map
@@ -0,0 +1,11 @@
1
+ import {
2
+ CORSPlugin,
3
+ CompositePlugin,
4
+ ResponseHeadersPlugin
5
+ } from "./chunk-TXHKQO7N.js";
6
+ export {
7
+ CORSPlugin,
8
+ CompositePlugin,
9
+ ResponseHeadersPlugin
10
+ };
11
+ //# sourceMappingURL=plugins.js.map
@@ -1,6 +1,3 @@
1
- export * from './orpc-handler';
2
- export * from './orpc-payload-codec';
3
- export * from './orpc-procedure-matcher';
4
- export * as SuperJSON from './super-json';
1
+ export * from './rpc-handler';
5
2
  export * from './types';
6
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { MaybeOptionalOptions } from '@orpc/shared';
2
+ import type { Context } from '../../context';
3
+ import type { Router } from '../../router';
4
+ import type { RPCHandlerOptions, StandardHandleOptions } from '../standard';
5
+ import type { FetchHandler, FetchHandleResult } from './types';
6
+ export declare class RPCHandler<T extends Context> implements FetchHandler<T> {
7
+ private readonly standardHandler;
8
+ constructor(router: Router<T, any>, options?: NoInfer<RPCHandlerOptions<T>>);
9
+ handle(request: Request, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<FetchHandleResult>;
10
+ }
11
+ //# sourceMappingURL=rpc-handler.d.ts.map
@@ -1,13 +1,6 @@
1
- import type { HTTPPath } from '@orpc/contract';
2
- import type { Context } from '../../types';
3
- export type FetchHandleOptions<T extends Context> = {
4
- prefix?: HTTPPath;
5
- } & (undefined extends T ? {
6
- context?: T;
7
- } : {
8
- context: T;
9
- });
10
- export type FetchHandleRest<T extends Context> = [options: FetchHandleOptions<T>] | (undefined extends T ? [] : never);
1
+ import type { MaybeOptionalOptions } from '@orpc/shared';
2
+ import type { Context } from '../../context';
3
+ import type { StandardHandleOptions } from '../standard';
11
4
  export type FetchHandleResult = {
12
5
  matched: true;
13
6
  response: Response;
@@ -16,6 +9,6 @@ export type FetchHandleResult = {
16
9
  response: undefined;
17
10
  };
18
11
  export interface FetchHandler<T extends Context> {
19
- handle: (request: Request, ...rest: FetchHandleRest<T>) => Promise<FetchHandleResult>;
12
+ handle(request: Request, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<FetchHandleResult>;
20
13
  }
21
14
  //# sourceMappingURL=types.d.ts.map
@@ -1,12 +1,12 @@
1
+ import type { MaybeOptionalOptions, Value } from '@orpc/shared';
1
2
  import type { Context as HonoContext, MiddlewareHandler } from 'hono';
2
- import type { Context } from '../../types';
3
- import type { FetchHandleOptions, FetchHandler } from '../fetch';
4
- import { type Value } from '@orpc/shared';
5
- export type CreateMiddlewareOptions<T extends Context> = Omit<FetchHandleOptions<T>, 'context'> & (undefined extends T ? {
3
+ import type { Context } from '../../context';
4
+ import type { FetchHandler } from '../fetch';
5
+ import type { StandardHandleOptions } from '../standard';
6
+ export type CreateMiddlewareOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
6
7
  context?: Value<T, [HonoContext]>;
7
8
  } : {
8
9
  context: Value<T, [HonoContext]>;
9
10
  });
10
- export type CreateMiddlewareRest<T extends Context> = [options: CreateMiddlewareOptions<T>] | (undefined extends T ? [] : never);
11
- export declare function createMiddleware<T extends Context>(handler: FetchHandler<T>, ...[options]: CreateMiddlewareRest<T>): MiddlewareHandler;
11
+ export declare function createMiddleware<T extends Context>(handler: FetchHandler<T>, ...[options]: MaybeOptionalOptions<CreateMiddlewareOptions<T>>): MiddlewareHandler;
12
12
  //# sourceMappingURL=middleware.d.ts.map
@@ -1,19 +1,19 @@
1
+ import type { MaybeOptionalOptions, Value } from '@orpc/shared';
1
2
  import type { NextRequest } from 'next/server';
2
- import type { Context } from '../../types';
3
- import type { FetchHandleOptions, FetchHandler } from '../fetch';
4
- import { type Value } from '@orpc/shared';
5
- export type ServeOptions<T extends Context> = Omit<FetchHandleOptions<T>, 'context'> & (undefined extends T ? {
3
+ import type { Context } from '../../context';
4
+ import type { FetchHandler } from '../fetch';
5
+ import type { StandardHandleOptions } from '../standard';
6
+ export type ServeOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
6
7
  context?: Value<T, [NextRequest]>;
7
8
  } : {
8
9
  context: Value<T, [NextRequest]>;
9
10
  });
10
- export type ServeRest<T extends Context> = [options: ServeOptions<T>] | (undefined extends T ? [] : never);
11
11
  export interface ServeResult {
12
- GET: (req: NextRequest) => Promise<Response>;
13
- POST: (req: NextRequest) => Promise<Response>;
14
- PUT: (req: NextRequest) => Promise<Response>;
15
- PATCH: (req: NextRequest) => Promise<Response>;
16
- DELETE: (req: NextRequest) => Promise<Response>;
12
+ GET(req: NextRequest): Promise<Response>;
13
+ POST(req: NextRequest): Promise<Response>;
14
+ PUT(req: NextRequest): Promise<Response>;
15
+ PATCH(req: NextRequest): Promise<Response>;
16
+ DELETE(req: NextRequest): Promise<Response>;
17
17
  }
18
- export declare function serve<T extends Context>(handler: FetchHandler<T>, ...[options]: ServeRest<T>): ServeResult;
18
+ export declare function serve<T extends Context>(handler: FetchHandler<T>, ...[options]: MaybeOptionalOptions<ServeOptions<T>>): ServeResult;
19
19
  //# sourceMappingURL=serve.d.ts.map
@@ -1,5 +1,3 @@
1
- export * from './orpc-handler';
2
- export * from './orpc-handler';
3
- export * from './request-listener';
1
+ export * from './rpc-handler';
4
2
  export * from './types';
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ import type { MaybeOptionalOptions } from '@orpc/shared';
2
+ import type { Context } from '../../context';
3
+ import type { Router } from '../../router';
4
+ import type { RPCHandlerOptions, StandardHandleOptions } from '../standard';
5
+ import type { NodeHttpHandler, NodeHttpHandleResult, NodeHttpRequest, NodeHttpResponse } from './types';
6
+ export declare class RPCHandler<T extends Context> implements NodeHttpHandler<T> {
7
+ private readonly standardHandler;
8
+ constructor(router: Router<T, any>, options?: NoInfer<RPCHandlerOptions<T>>);
9
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
10
+ }
11
+ //# sourceMappingURL=rpc-handler.d.ts.map
@@ -1,22 +1,22 @@
1
- import type { HTTPPath } from '@orpc/contract';
2
- import type { Promisable } from '@orpc/shared';
1
+ import type { MaybeOptionalOptions } from '@orpc/shared';
3
2
  import type { IncomingMessage, ServerResponse } from 'node:http';
4
- import type { Context } from '../../types';
5
- export type RequestHandleOptions<T extends Context> = {
6
- prefix?: HTTPPath;
7
- beforeSend?: (response: Response, context: T) => Promisable<void>;
8
- } & (undefined extends T ? {
9
- context?: T;
10
- } : {
11
- context: T;
12
- });
13
- export type RequestHandleRest<T extends Context> = [options: RequestHandleOptions<T>] | (undefined extends T ? [] : never);
14
- export type RequestHandleResult = {
3
+ import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
4
+ import type { Context } from '../../context';
5
+ import type { StandardHandleOptions } from '../standard';
6
+ export type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
7
+ /**
8
+ * Replace `req.url` with `req.originalUrl` when `req.originalUrl` is available.
9
+ * This is useful for `express.js` middleware.
10
+ */
11
+ originalUrl?: string;
12
+ };
13
+ export type NodeHttpResponse = ServerResponse | Http2ServerResponse;
14
+ export type NodeHttpHandleResult = {
15
15
  matched: true;
16
16
  } | {
17
17
  matched: false;
18
18
  };
19
- export interface RequestHandler<T extends Context> {
20
- handle: (req: IncomingMessage, res: ServerResponse, ...rest: RequestHandleRest<T>) => Promise<RequestHandleResult>;
19
+ export interface NodeHttpHandler<T extends Context> {
20
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
21
21
  }
22
22
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,53 @@
1
+ import type { ErrorFromErrorMap, HTTPPath, Meta, Schema, SchemaOutput } from '@orpc/contract';
2
+ import type { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
3
+ import type { StandardRequest, StandardResponse } from '@orpc/standard-server';
4
+ import type { Context } from '../../context';
5
+ import type { Plugin } from '../../plugins';
6
+ import type { ProcedureClientInterceptorOptions } from '../../procedure-client';
7
+ import type { Router } from '../../router';
8
+ import type { StandardCodec, StandardMatcher } from './types';
9
+ export type StandardHandleOptions<T extends Context> = {
10
+ prefix?: HTTPPath;
11
+ } & (Record<never, never> extends T ? {
12
+ context?: T;
13
+ } : {
14
+ context: T;
15
+ });
16
+ export type WellStandardHandleOptions<T extends Context> = StandardHandleOptions<T> & {
17
+ context: T;
18
+ };
19
+ export type StandardHandleResult = {
20
+ matched: true;
21
+ response: StandardResponse;
22
+ } | {
23
+ matched: false;
24
+ response: undefined;
25
+ };
26
+ export type StandardHandlerInterceptorOptions<TContext extends Context> = WellStandardHandleOptions<TContext> & {
27
+ request: StandardRequest;
28
+ };
29
+ export interface StandardHandlerOptions<TContext extends Context> {
30
+ plugins?: Plugin<TContext>[];
31
+ /**
32
+ * Interceptors at the request level, helpful when you want catch errors
33
+ */
34
+ interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
35
+ /**
36
+ * Interceptors at the root level, helpful when you want override the request/response
37
+ */
38
+ rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
39
+ /**
40
+ *
41
+ * Interceptors for procedure client.
42
+ */
43
+ clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Schema, Record<never, never>, Meta>, SchemaOutput<Schema, unknown>, ErrorFromErrorMap<Record<never, never>>>[];
44
+ }
45
+ export declare class StandardHandler<T extends Context> {
46
+ private readonly matcher;
47
+ private readonly codec;
48
+ private readonly options;
49
+ private readonly plugin;
50
+ constructor(router: Router<T, any>, matcher: StandardMatcher, codec: StandardCodec, options?: NoInfer<StandardHandlerOptions<T>>);
51
+ handle(request: StandardRequest, ...[options]: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<StandardHandleResult>;
52
+ }
53
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +1,6 @@
1
+ export * from './handler';
2
+ export * from './rpc-codec';
3
+ export * from './rpc-handler';
4
+ export * from './rpc-matcher';
5
+ export * from './types';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { ORPCError } from '@orpc/client';
2
+ import type { StandardRequest, StandardResponse } from '@orpc/standard-server';
3
+ import type { AnyProcedure } from '../../procedure';
4
+ import type { StandardCodec, StandardParams } from './types';
5
+ import { RPCSerializer } from '@orpc/client/rpc';
6
+ export interface StandardCodecOptions {
7
+ serializer?: RPCSerializer;
8
+ }
9
+ export declare class RPCCodec implements StandardCodec {
10
+ private readonly serializer;
11
+ constructor(options?: StandardCodecOptions);
12
+ decode(request: StandardRequest, _params: StandardParams | undefined, _procedure: AnyProcedure): Promise<unknown>;
13
+ encode(output: unknown, _procedure: AnyProcedure): StandardResponse;
14
+ encodeError(error: ORPCError<any, any>): StandardResponse;
15
+ }
16
+ //# sourceMappingURL=rpc-codec.d.ts.map
@@ -0,0 +1,8 @@
1
+ import type { Context } from '../../context';
2
+ import type { StandardHandlerOptions } from './handler';
3
+ import type { StandardCodec, StandardMatcher } from './types';
4
+ export interface RPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T> {
5
+ matcher?: StandardMatcher;
6
+ codec?: StandardCodec;
7
+ }
8
+ //# sourceMappingURL=rpc-handler.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { HTTPPath } from '@orpc/contract';
2
+ import type { StandardMatcher, StandardMatchResult } from './types';
3
+ import { type AnyRouter } from '../../router';
4
+ export declare class RPCMatcher implements StandardMatcher {
5
+ private readonly tree;
6
+ private pendingRouters;
7
+ init(router: AnyRouter, path?: string[]): void;
8
+ match(_method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
9
+ }
10
+ //# sourceMappingURL=rpc-matcher.d.ts.map
@@ -0,0 +1,21 @@
1
+ import type { ORPCError } from '@orpc/client';
2
+ import type { HTTPPath } from '@orpc/contract';
3
+ import type { StandardRequest, StandardResponse } from '@orpc/standard-server';
4
+ import type { AnyProcedure } from '../../procedure';
5
+ import type { AnyRouter } from '../../router';
6
+ export type StandardParams = Record<string, string>;
7
+ export type StandardMatchResult = {
8
+ path: string[];
9
+ procedure: AnyProcedure;
10
+ params?: StandardParams;
11
+ } | undefined;
12
+ export interface StandardMatcher {
13
+ init(router: AnyRouter): void;
14
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
15
+ }
16
+ export interface StandardCodec {
17
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
18
+ encodeError(error: ORPCError<any, any>): StandardResponse;
19
+ decode(request: StandardRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
20
+ }
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,75 @@
1
+ import type { ContractRouter, ErrorMap, HTTPPath, MergedErrorMap, Meta, Route, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
+ import type { BuilderDef } from './builder';
3
+ import type { ConflictContextGuard, Context, MergedContext } from './context';
4
+ import type { ORPCErrorConstructorMap } from './error';
5
+ import type { FlattenLazy } from './lazy-utils';
6
+ import type { MapInputMiddleware, Middleware } from './middleware';
7
+ import type { ProcedureHandler } from './procedure';
8
+ import type { DecoratedProcedure } from './procedure-decorated';
9
+ import type { AdaptedRouter, AdaptRouterOptions, Router } from './router';
10
+ export interface BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
11
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
12
+ 'errors'<U extends ErrorMap>(errors: U): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
13
+ 'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
14
+ 'meta'(meta: TMeta): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
15
+ 'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
16
+ 'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
17
+ 'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
18
+ 'handler'<UFuncOutput extends SchemaInput<TOutputSchema>>(handler: ProcedureHandler<TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
19
+ 'prefix'(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
20
+ 'tag'(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
21
+ 'router'<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
22
+ 'lazy'<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(loader: () => Promise<{
23
+ default: U;
24
+ }>): AdaptedRouter<FlattenLazy<U>, TInitialContext, TErrorMap>;
25
+ }
26
+ export interface ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
27
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
28
+ 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
29
+ 'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilder<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
30
+ 'meta'(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
31
+ 'route'(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
32
+ 'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
33
+ 'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
34
+ 'handler'<UFuncOutput extends SchemaInput<TOutputSchema>>(handler: ProcedureHandler<TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
35
+ }
36
+ export interface ProcedureBuilderWithInput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
37
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
38
+ 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
39
+ 'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
40
+ 'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
41
+ 'meta'(meta: TMeta): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
42
+ 'route'(route: Route): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
43
+ 'output'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
44
+ 'handler'<UFuncOutput extends SchemaInput<TOutputSchema>>(handler: ProcedureHandler<TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
45
+ }
46
+ export interface ProcedureBuilderWithOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
47
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
48
+ 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
49
+ 'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
50
+ 'meta'(meta: TMeta): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
51
+ 'route'(route: Route): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
52
+ 'input'<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
53
+ 'handler'<UFuncOutput extends SchemaInput<TOutputSchema>>(handler: ProcedureHandler<TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
54
+ }
55
+ export interface ProcedureBuilderWithInputOutput<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
56
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
57
+ 'errors'<U extends ErrorMap>(errors: U): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
58
+ 'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInputOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
59
+ 'use'<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & ProcedureBuilderWithInputOutput<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
60
+ 'meta'(meta: TMeta): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
61
+ 'route'(route: Route): ProcedureBuilderWithInputOutput<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
62
+ 'handler'<UFuncOutput extends SchemaInput<TOutputSchema>>(handler: ProcedureHandler<TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
63
+ }
64
+ export interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
65
+ '~orpc': AdaptRouterOptions<TErrorMap>;
66
+ 'errors'<U extends ErrorMap>(errors: U): RouterBuilder<TInitialContext, TCurrentContext, MergedErrorMap<TErrorMap, U>, TMeta>;
67
+ 'use'<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & RouterBuilder<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TErrorMap, TMeta>;
68
+ 'prefix'(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
69
+ 'tag'(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
70
+ 'router'<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
71
+ 'lazy'<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(loader: () => Promise<{
72
+ default: U;
73
+ }>): AdaptedRouter<FlattenLazy<U>, TInitialContext, TErrorMap>;
74
+ }
75
+ //# sourceMappingURL=builder-variants.d.ts.map
@@ -1,36 +1,58 @@
1
- import type { ANY_CONTRACT_PROCEDURE, ContractRouter, ErrorMap, HTTPPath, RouteOptions, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
- import type { FlattenLazy } from './lazy';
3
- import type { Middleware } from './middleware';
1
+ import type { ContractProcedureDef, ContractRouter, ErrorMap, HTTPPath, MergedErrorMap, Meta, Route, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
+ import type { BuilderWithMiddlewares, ProcedureBuilder, ProcedureBuilderWithInput, ProcedureBuilderWithOutput, RouterBuilder } from './builder-variants';
3
+ import type { ConflictContextGuard, Context, MergedContext } from './context';
4
+ import type { ORPCErrorConstructorMap } from './error';
5
+ import type { FlattenLazy } from './lazy-utils';
6
+ import type { AnyMiddleware, MapInputMiddleware, Middleware } from './middleware';
4
7
  import type { DecoratedMiddleware } from './middleware-decorated';
5
8
  import type { ProcedureHandler } from './procedure';
6
- import type { Router } from './router';
7
- import type { AdaptedRouter } from './router-builder';
8
- import type { Context, MergeContext, WELL_CONTEXT } from './types';
9
- import { type ChainableImplementer } from './implementer-chainable';
10
- import { ProcedureBuilder } from './procedure-builder';
9
+ import type { AdaptedRouter, AdaptRouterOptions, Router } from './router';
11
10
  import { DecoratedProcedure } from './procedure-decorated';
12
- 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>>[];
11
+ export interface BuilderConfig {
12
+ initialInputValidationIndex?: number;
13
+ initialOutputValidationIndex?: number;
15
14
  }
16
- export declare class Builder<TContext extends Context, TExtraContext extends Context> {
17
- '~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<{
15
+ export interface BuilderDef<TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>, AdaptRouterOptions<TErrorMap> {
16
+ middlewares: AnyMiddleware[];
17
+ inputValidationIndex: number;
18
+ outputValidationIndex: number;
19
+ config: BuilderConfig;
20
+ }
21
+ export declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
22
+ '~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
23
+ constructor(def: BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>);
24
+ /**
25
+ * Reset config
26
+ */
27
+ $config(config: BuilderConfig): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
28
+ /**
29
+ * Reset initial context
30
+ */
31
+ $context<U extends Context>(): Builder<U, U, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
32
+ /**
33
+ * Reset initial meta
34
+ */
35
+ $meta<U extends Meta>(initialMeta: U): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, U>;
36
+ /**
37
+ * Reset initial route
38
+ */
39
+ $route(initialRoute: Route): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
40
+ middleware<UOutContext extends Context, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
41
+ middleware: Middleware<TCurrentContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TCurrentContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<any>, TMeta>;
42
+ errors<U extends ErrorMap>(errors: U): Builder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
43
+ use<UOutContext extends Context>(middleware: Middleware<TCurrentContext, UOutContext, SchemaOutput<TInputSchema>, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
44
+ use<UOutContext extends Context, UInput>(middleware: Middleware<TCurrentContext, UOutContext, UInput, SchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<SchemaOutput<TInputSchema>, UInput>): ConflictContextGuard<MergedContext<TCurrentContext, UOutContext>> & BuilderWithMiddlewares<TInitialContext, MergedContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
45
+ meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
46
+ route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
47
+ input<USchema extends Schema>(schema: USchema): ProcedureBuilderWithInput<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta>;
48
+ output<USchema extends Schema>(schema: USchema): ProcedureBuilderWithOutput<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta>;
49
+ handler<UFuncOutput extends SchemaInput<TOutputSchema>>(handler: ProcedureHandler<TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, UFuncOutput, TErrorMap, TMeta>;
50
+ prefix(prefix: HTTPPath): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
51
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
52
+ router<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(router: U): AdaptedRouter<U, TInitialContext, TErrorMap>;
53
+ lazy<U extends Router<TCurrentContext, ContractRouter<TMeta>>>(loader: () => Promise<{
32
54
  default: U;
33
- }>): AdaptedRouter<TContext, FlattenLazy<U>>;
34
- contract<U extends ANY_CONTRACT_PROCEDURE | ContractRouter>(contract: U): ChainableImplementer<TContext, TExtraContext, U>;
55
+ }>): AdaptedRouter<FlattenLazy<U>, TInitialContext, TErrorMap>;
35
56
  }
57
+ export declare const os: Builder<Context, Context, undefined, undefined, {}, {}>;
36
58
  //# 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