@orpc/server 0.0.0-next.b4e6d3a → 0.0.0-next.b825e0c

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.
@@ -2,11 +2,11 @@ import {
2
2
  RPCCodec,
3
3
  RPCMatcher,
4
4
  StandardHandler
5
- } from "./chunk-GIXDBJGV.js";
5
+ } from "./chunk-PYUF3JOC.js";
6
6
 
7
7
  // src/adapters/fetch/utils.ts
8
8
  import { once } from "@orpc/shared";
9
- import { contentDisposition, parse as parseContentDisposition } from "@tinyhttp/content-disposition";
9
+ import cd from "content-disposition";
10
10
  function fetchHeadersToStandardHeaders(headers) {
11
11
  const standardHeaders = {};
12
12
  for (const [key, value] of headers) {
@@ -24,15 +24,13 @@ async function fetchReToStandardBody(re) {
24
24
  if (!re.body) {
25
25
  return void 0;
26
26
  }
27
- const contentDisposition2 = re.headers.get("content-disposition");
28
- if (contentDisposition2) {
29
- const fileName = parseContentDisposition(contentDisposition2).parameters.filename;
30
- if (typeof fileName === "string") {
31
- const blob2 = await re.blob();
32
- return new File([blob2], fileName, {
33
- type: blob2.type
34
- });
35
- }
27
+ const contentDisposition = re.headers.get("content-disposition");
28
+ const fileName = contentDisposition ? cd.parse(contentDisposition).parameters.filename : void 0;
29
+ if (fileName) {
30
+ const blob2 = await re.blob();
31
+ return new File([blob2], fileName, {
32
+ type: blob2.type
33
+ });
36
34
  }
37
35
  const contentType = re.headers.get("content-type");
38
36
  if (!contentType || contentType.startsWith("application/json")) {
@@ -87,32 +85,24 @@ function standardResponseToFetchHeaders(response) {
87
85
  fetchHeaders.append(key, value);
88
86
  }
89
87
  }
88
+ if (response.body instanceof Blob && !fetchHeaders.has("content-disposition")) {
89
+ fetchHeaders.set("content-disposition", cd(response.body instanceof File ? response.body.name : "blob"));
90
+ } else if (!(response.body instanceof Blob) && !(response.body instanceof URLSearchParams) && !(response.body instanceof FormData) && response.body !== void 0 && !fetchHeaders.has("content-type")) {
91
+ fetchHeaders.set("content-type", "application/json");
92
+ }
90
93
  return fetchHeaders;
91
94
  }
92
- function standardResponseToFetchResponse(response) {
93
- const resHeaders = standardResponseToFetchHeaders(response);
94
- resHeaders.delete("content-type");
95
- resHeaders.delete("content-disposition");
96
- if (response.body === void 0) {
97
- return new Response(void 0, { headers: resHeaders, status: response.status });
98
- }
99
- if (response.body instanceof Blob) {
100
- resHeaders.set("content-type", response.body.type);
101
- resHeaders.set("content-length", response.body.size.toString());
102
- resHeaders.set(
103
- "content-disposition",
104
- contentDisposition(response.body instanceof File ? response.body.name : "blob", { type: "inline" })
105
- );
106
- return new Response(response.body, { headers: resHeaders, status: response.status });
107
- }
108
- if (response.body instanceof FormData) {
109
- return new Response(response.body, { headers: resHeaders, status: response.status });
95
+ function standardBodyToFetchBody(body) {
96
+ if (body instanceof Blob || body instanceof FormData || body instanceof URLSearchParams) {
97
+ return body;
110
98
  }
111
- if (response.body instanceof URLSearchParams) {
112
- return new Response(response.body, { headers: resHeaders, status: response.status });
113
- }
114
- resHeaders.set("content-type", "application/json");
115
- return new Response(JSON.stringify(response.body), { headers: resHeaders, status: response.status });
99
+ return JSON.stringify(body);
100
+ }
101
+ function standardResponseToFetchResponse(response) {
102
+ return new Response(standardBodyToFetchBody(response.body), {
103
+ headers: standardResponseToFetchHeaders(response),
104
+ status: response.status
105
+ });
116
106
  }
117
107
 
118
108
  // src/adapters/fetch/rpc-handler.ts
@@ -139,7 +129,8 @@ var RPCHandler = class {
139
129
  export {
140
130
  fetchReToStandardBody,
141
131
  fetchRequestToStandardRequest,
132
+ standardBodyToFetchBody,
142
133
  standardResponseToFetchResponse,
143
134
  RPCHandler
144
135
  };
145
- //# sourceMappingURL=chunk-WJ2G7572.js.map
136
+ //# sourceMappingURL=chunk-IWQZNJGN.js.map
@@ -68,22 +68,22 @@ function createProcedureClient(lazyableProcedure, ...[options]) {
68
68
  return async (...[input, callerOptions]) => {
69
69
  const path = options?.path ?? [];
70
70
  const { default: procedure } = await unlazy(lazyableProcedure);
71
- const clientContext = callerOptions?.context ?? {};
72
- const context = await value(options?.context ?? {}, clientContext);
71
+ const context = await value(options?.context ?? {}, callerOptions?.context);
73
72
  const errors = createORPCErrorConstructorMap(procedure["~orpc"].errorMap);
73
+ const interceptorOptions = {
74
+ context,
75
+ input,
76
+ // input only optional when it undefinable so we can safely cast it
77
+ errors,
78
+ path,
79
+ procedure,
80
+ signal: callerOptions?.signal
81
+ };
74
82
  try {
75
83
  return await intercept(
76
84
  options?.interceptors ?? [],
77
- {
78
- context,
79
- input,
80
- // input only optional when it undefinable so we can safely cast it
81
- errors,
82
- path,
83
- procedure,
84
- signal: callerOptions?.signal
85
- },
86
- (interceptorOptions) => executeProcedureInternal(interceptorOptions.procedure, interceptorOptions)
85
+ interceptorOptions,
86
+ (interceptorOptions2) => executeProcedureInternal(interceptorOptions2.procedure, interceptorOptions2)
87
87
  );
88
88
  } catch (e) {
89
89
  if (!(e instanceof ORPCError)) {
@@ -375,4 +375,4 @@ export {
375
375
  convertPathToHttpPath,
376
376
  createContractedProcedure
377
377
  };
378
- //# sourceMappingURL=chunk-XP6YRLY2.js.map
378
+ //# sourceMappingURL=chunk-OEPDHGQ4.js.map
@@ -6,10 +6,10 @@ import {
6
6
  getRouterChild,
7
7
  isProcedure,
8
8
  unlazy
9
- } from "./chunk-XP6YRLY2.js";
9
+ } from "./chunk-OEPDHGQ4.js";
10
10
  import {
11
11
  CompositePlugin
12
- } from "./chunk-XFBAK67J.js";
12
+ } from "./chunk-Q2XV45Q4.js";
13
13
 
14
14
  // src/adapters/standard/handler.ts
15
15
  import { toORPCError } from "@orpc/contract";
@@ -25,35 +25,30 @@ var StandardHandler = class {
25
25
  }
26
26
  plugin;
27
27
  handle(request, ...[options]) {
28
+ const handleOptions = options ?? {};
29
+ handleOptions.context ??= {};
28
30
  return intercept(
29
31
  this.options.interceptorsRoot ?? [],
30
- {
31
- request,
32
- ...options,
33
- context: options?.context ?? {}
34
- // context is optional only when all fields are optional so we can safely force it to have a context
35
- },
36
- async (interceptorOptions) => {
32
+ { request, ...handleOptions },
33
+ async (interceptorRootOptions) => {
37
34
  try {
38
35
  return await intercept(
39
36
  this.options.interceptors ?? [],
40
- interceptorOptions,
41
- async (interceptorOptions2) => {
42
- const method = interceptorOptions2.request.method;
43
- const url = interceptorOptions2.request.url;
44
- const pathname = `/${trim(url.pathname.replace(interceptorOptions2.prefix ?? "", ""), "/")}`;
37
+ interceptorRootOptions,
38
+ async ({ request: request2, context }) => {
39
+ const method = request2.method;
40
+ const url = request2.url;
41
+ const pathname = `/${trim(url.pathname.replace(options?.prefix ?? "", ""), "/")}`;
45
42
  const match = await this.matcher.match(method, pathname);
46
43
  if (!match) {
47
44
  return { matched: false, response: void 0 };
48
45
  }
49
- const clientOptions = {
50
- context: interceptorOptions2.context,
46
+ const client = createProcedureClient(match.procedure, {
47
+ context,
51
48
  path: match.path
52
- };
53
- this.plugin.beforeCreateProcedureClient(clientOptions, interceptorOptions2);
54
- const client = createProcedureClient(match.procedure, clientOptions);
55
- const input = await this.codec.decode(request, match.params, match.procedure);
56
- const output = await client(input, { signal: request.signal });
49
+ });
50
+ const input = await this.codec.decode(request2, match.params, match.procedure);
51
+ const output = await client(input, { signal: request2.signal });
57
52
  const response = this.codec.encode(output, match.procedure);
58
53
  return {
59
54
  matched: true,
@@ -75,12 +70,9 @@ var StandardHandler = class {
75
70
  };
76
71
 
77
72
  // src/adapters/standard/rpc-serializer.ts
78
- import { findDeepMatches, isObject, set } from "@orpc/shared";
73
+ import { findDeepMatches, isPlainObject, set } from "@orpc/shared";
79
74
  var RPCSerializer = class {
80
75
  serialize(data) {
81
- if (data === void 0) {
82
- return void 0;
83
- }
84
76
  if (data instanceof Blob) {
85
77
  return data;
86
78
  }
@@ -98,9 +90,6 @@ var RPCSerializer = class {
98
90
  return form;
99
91
  }
100
92
  deserialize(serialized) {
101
- if (serialized === void 0) {
102
- return void 0;
103
- }
104
93
  if (serialized instanceof Blob) {
105
94
  return serialized;
106
95
  }
@@ -137,7 +126,7 @@ function serializeRPCJson(value, segments = [], meta = []) {
137
126
  meta.push(["url", segments]);
138
127
  return { json: value.toString(), meta };
139
128
  }
140
- if (isObject(value)) {
129
+ if (isPlainObject(value)) {
141
130
  const json = {};
142
131
  for (const k in value) {
143
132
  json[k] = serializeRPCJson(value[k], [...segments, k], meta).json;
@@ -316,4 +305,4 @@ export {
316
305
  RPCCodec,
317
306
  RPCMatcher
318
307
  };
319
- //# sourceMappingURL=chunk-GIXDBJGV.js.map
308
+ //# sourceMappingURL=chunk-PYUF3JOC.js.map
@@ -8,11 +8,6 @@ var CompositePlugin = class {
8
8
  plugin.init?.(options);
9
9
  }
10
10
  }
11
- beforeCreateProcedureClient(clientOptions, interceptorOptions) {
12
- for (const plugin of this.plugins) {
13
- plugin.beforeCreateProcedureClient?.(clientOptions, interceptorOptions);
14
- }
15
- }
16
11
  };
17
12
 
18
13
  // src/plugins/cors.ts
@@ -125,4 +120,4 @@ export {
125
120
  CORSPlugin,
126
121
  ResponseHeadersPlugin
127
122
  };
128
- //# sourceMappingURL=chunk-XFBAK67J.js.map
123
+ //# sourceMappingURL=chunk-Q2XV45Q4.js.map
package/dist/fetch.js CHANGED
@@ -2,15 +2,17 @@ import {
2
2
  RPCHandler,
3
3
  fetchReToStandardBody,
4
4
  fetchRequestToStandardRequest,
5
+ standardBodyToFetchBody,
5
6
  standardResponseToFetchResponse
6
- } from "./chunk-WJ2G7572.js";
7
- import "./chunk-GIXDBJGV.js";
8
- import "./chunk-XP6YRLY2.js";
9
- import "./chunk-XFBAK67J.js";
7
+ } from "./chunk-IWQZNJGN.js";
8
+ import "./chunk-PYUF3JOC.js";
9
+ import "./chunk-OEPDHGQ4.js";
10
+ import "./chunk-Q2XV45Q4.js";
10
11
  export {
11
12
  RPCHandler,
12
13
  fetchReToStandardBody,
13
14
  fetchRequestToStandardRequest,
15
+ standardBodyToFetchBody,
14
16
  standardResponseToFetchResponse
15
17
  };
16
18
  //# sourceMappingURL=fetch.js.map
package/dist/hono.js CHANGED
@@ -2,11 +2,12 @@ import {
2
2
  RPCHandler,
3
3
  fetchReToStandardBody,
4
4
  fetchRequestToStandardRequest,
5
+ standardBodyToFetchBody,
5
6
  standardResponseToFetchResponse
6
- } from "./chunk-WJ2G7572.js";
7
- import "./chunk-GIXDBJGV.js";
8
- import "./chunk-XP6YRLY2.js";
9
- import "./chunk-XFBAK67J.js";
7
+ } from "./chunk-IWQZNJGN.js";
8
+ import "./chunk-PYUF3JOC.js";
9
+ import "./chunk-OEPDHGQ4.js";
10
+ import "./chunk-Q2XV45Q4.js";
10
11
 
11
12
  // src/adapters/hono/middleware.ts
12
13
  import { value } from "@orpc/shared";
@@ -25,7 +26,7 @@ function createMiddleware(handler, ...[options]) {
25
26
  const context = await value(options?.context ?? {}, c);
26
27
  const { matched, response } = await handler.handle(request, { ...options, context });
27
28
  if (matched) {
28
- return c.newResponse(response.body, response);
29
+ return c.body(response.body, response);
29
30
  }
30
31
  await next();
31
32
  };
@@ -35,6 +36,7 @@ export {
35
36
  createMiddleware,
36
37
  fetchReToStandardBody,
37
38
  fetchRequestToStandardRequest,
39
+ standardBodyToFetchBody,
38
40
  standardResponseToFetchResponse
39
41
  };
40
42
  //# sourceMappingURL=hono.js.map
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  middlewareOutputFn,
22
22
  setRouterContract,
23
23
  unlazy
24
- } from "./chunk-XP6YRLY2.js";
24
+ } from "./chunk-OEPDHGQ4.js";
25
25
 
26
26
  // src/builder.ts
27
27
  import { mergeErrorMap as mergeErrorMap2, mergeMeta as mergeMeta2, mergePrefix, mergeRoute as mergeRoute2, mergeTags } from "@orpc/contract";
package/dist/next.js CHANGED
@@ -2,11 +2,12 @@ import {
2
2
  RPCHandler,
3
3
  fetchReToStandardBody,
4
4
  fetchRequestToStandardRequest,
5
+ standardBodyToFetchBody,
5
6
  standardResponseToFetchResponse
6
- } from "./chunk-WJ2G7572.js";
7
- import "./chunk-GIXDBJGV.js";
8
- import "./chunk-XP6YRLY2.js";
9
- import "./chunk-XFBAK67J.js";
7
+ } from "./chunk-IWQZNJGN.js";
8
+ import "./chunk-PYUF3JOC.js";
9
+ import "./chunk-OEPDHGQ4.js";
10
+ import "./chunk-Q2XV45Q4.js";
10
11
 
11
12
  // src/adapters/next/serve.ts
12
13
  import { value } from "@orpc/shared";
@@ -32,6 +33,7 @@ export {
32
33
  fetchReToStandardBody,
33
34
  fetchRequestToStandardRequest,
34
35
  serve,
36
+ standardBodyToFetchBody,
35
37
  standardResponseToFetchResponse
36
38
  };
37
39
  //# sourceMappingURL=next.js.map
package/dist/node.js CHANGED
@@ -2,15 +2,15 @@ import {
2
2
  RPCCodec,
3
3
  RPCMatcher,
4
4
  StandardHandler
5
- } from "./chunk-GIXDBJGV.js";
6
- import "./chunk-XP6YRLY2.js";
7
- import "./chunk-XFBAK67J.js";
5
+ } from "./chunk-PYUF3JOC.js";
6
+ import "./chunk-OEPDHGQ4.js";
7
+ import "./chunk-Q2XV45Q4.js";
8
8
 
9
9
  // src/adapters/node/utils.ts
10
10
  import { Buffer, File } from "node:buffer";
11
11
  import { Readable } from "node:stream";
12
12
  import { once } from "@orpc/shared";
13
- import { contentDisposition, parse as parseContentDisposition } from "@tinyhttp/content-disposition";
13
+ import cd from "content-disposition";
14
14
  function nodeHttpToStandardRequest(req, res) {
15
15
  const method = req.method ?? "GET";
16
16
  const protocol = "encrypted" in req.socket && req.socket.encrypted ? "https:" : "http:";
@@ -38,21 +38,20 @@ function nodeHttpResponseSendStandardResponse(res, standardResponse) {
38
38
  return new Promise((resolve, reject) => {
39
39
  res.on("error", reject);
40
40
  res.on("finish", resolve);
41
- const resHeaders = standardResponse.headers;
42
- delete resHeaders["content-type"];
43
- delete resHeaders["content-disposition"];
44
41
  if (standardResponse.body === void 0) {
45
42
  res.writeHead(standardResponse.status, standardResponse.headers);
46
43
  res.end();
47
44
  return;
48
45
  }
49
46
  if (standardResponse.body instanceof Blob) {
50
- resHeaders["content-type"] = standardResponse.body.type;
51
- resHeaders["content-length"] = standardResponse.body.size.toString();
52
- resHeaders["content-disposition"] = contentDisposition(
53
- standardResponse.body instanceof File ? standardResponse.body.name : "blob",
54
- { type: "inline" }
55
- );
47
+ const resHeaders = {
48
+ ...standardResponse.headers,
49
+ "content-type": standardResponse.body.type,
50
+ "content-length": standardResponse.body.size.toString()
51
+ };
52
+ if (!standardResponse.headers["content-disposition"] && standardResponse.body instanceof Blob) {
53
+ resHeaders["content-disposition"] = cd(standardResponse.body instanceof File ? standardResponse.body.name : "blob");
54
+ }
56
55
  res.writeHead(standardResponse.status, resHeaders);
57
56
  Readable.fromWeb(
58
57
  standardResponse.body.stream()
@@ -62,8 +61,10 @@ function nodeHttpResponseSendStandardResponse(res, standardResponse) {
62
61
  }
63
62
  if (standardResponse.body instanceof FormData) {
64
63
  const response = new Response(standardResponse.body);
65
- resHeaders["content-type"] = response.headers.get("content-type");
66
- res.writeHead(standardResponse.status, resHeaders);
64
+ res.writeHead(standardResponse.status, {
65
+ ...standardResponse.headers,
66
+ "content-type": response.headers.get("content-type")
67
+ });
67
68
  Readable.fromWeb(
68
69
  response.body
69
70
  // Conflict between types=node and lib=dom so we need to cast it
@@ -71,14 +72,20 @@ function nodeHttpResponseSendStandardResponse(res, standardResponse) {
71
72
  return;
72
73
  }
73
74
  if (standardResponse.body instanceof URLSearchParams) {
74
- resHeaders["content-type"] = "application/x-www-form-urlencoded";
75
- res.writeHead(standardResponse.status, resHeaders);
76
- res.end(standardResponse.body.toString());
75
+ res.writeHead(standardResponse.status, {
76
+ ...standardResponse.headers,
77
+ "content-type": "application/x-www-form-urlencoded"
78
+ });
79
+ const string2 = standardResponse.body.toString();
80
+ res.end(string2);
77
81
  return;
78
82
  }
79
- resHeaders["content-type"] = "application/json";
80
- res.writeHead(standardResponse.status, resHeaders);
81
- res.end(JSON.stringify(standardResponse.body));
83
+ res.writeHead(standardResponse.status, {
84
+ ...standardResponse.headers,
85
+ "content-type": "application/json"
86
+ });
87
+ const string = JSON.stringify(standardResponse.body);
88
+ res.end(string);
82
89
  });
83
90
  }
84
91
  async function nodeHttpRequestToStandardBody(req) {
@@ -86,13 +93,11 @@ async function nodeHttpRequestToStandardBody(req) {
86
93
  if (method === "GET" || method === "HEAD") {
87
94
  return void 0;
88
95
  }
89
- const contentDisposition2 = req.headers["content-disposition"];
96
+ const contentDisposition = req.headers["content-disposition"];
97
+ const fileName = contentDisposition ? cd.parse(contentDisposition).parameters.filename : void 0;
90
98
  const contentType = req.headers["content-type"];
91
- if (contentDisposition2) {
92
- const fileName = parseContentDisposition(contentDisposition2).parameters.filename;
93
- if (typeof fileName === "string") {
94
- return await streamToFile(req, fileName, contentType || "application/octet-stream");
95
- }
99
+ if (fileName) {
100
+ return await streamToFile(req, fileName, contentType || "application/octet-stream");
96
101
  }
97
102
  if (!contentType || contentType.startsWith("application/json")) {
98
103
  const text = await streamToString(req);
package/dist/plugins.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  CORSPlugin,
3
3
  CompositePlugin,
4
4
  ResponseHeadersPlugin
5
- } from "./chunk-XFBAK67J.js";
5
+ } from "./chunk-Q2XV45Q4.js";
6
6
  export {
7
7
  CORSPlugin,
8
8
  CompositePlugin,
@@ -1,11 +1,10 @@
1
- import type { MaybeOptionalOptions } from '@orpc/shared';
2
1
  import type { Context } from '../../context';
3
2
  import type { Router } from '../../router';
4
- import type { RPCHandlerOptions, StandardHandleOptions } from '../standard';
3
+ import type { RPCHandlerOptions, StandardHandleRest } from '../standard';
5
4
  import type { FetchHandler, FetchHandleResult } from './types';
6
5
  export declare class RPCHandler<T extends Context> implements FetchHandler<T> {
7
6
  private readonly standardHandler;
8
7
  constructor(router: Router<T, any>, options?: NoInfer<RPCHandlerOptions<T>>);
9
- handle(request: Request, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<FetchHandleResult>;
8
+ handle(request: Request, ...rest: StandardHandleRest<T>): Promise<FetchHandleResult>;
10
9
  }
11
10
  //# sourceMappingURL=rpc-handler.d.ts.map
@@ -1,6 +1,5 @@
1
- import type { MaybeOptionalOptions } from '@orpc/shared';
2
1
  import type { Context } from '../../context';
3
- import type { StandardHandleOptions } from '../standard';
2
+ import type { StandardHandleRest } from '../standard';
4
3
  export type FetchHandleResult = {
5
4
  matched: true;
6
5
  response: Response;
@@ -9,6 +8,6 @@ export type FetchHandleResult = {
9
8
  response: undefined;
10
9
  };
11
10
  export interface FetchHandler<T extends Context> {
12
- handle(request: Request, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<FetchHandleResult>;
11
+ handle(request: Request, ...rest: StandardHandleRest<T>): Promise<FetchHandleResult>;
13
12
  }
14
13
  //# sourceMappingURL=types.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import type { StandardBody, StandardRequest, StandardResponse } from '../standard';
2
2
  export declare function fetchReToStandardBody(re: Request | Response): Promise<StandardBody>;
3
3
  export declare function fetchRequestToStandardRequest(request: Request): StandardRequest;
4
+ export declare function standardBodyToFetchBody(body: StandardBody): Blob | FormData | URLSearchParams | string | undefined;
4
5
  export declare function standardResponseToFetchResponse(response: StandardResponse): Response;
5
6
  //# sourceMappingURL=utils.d.ts.map
@@ -1,12 +1,13 @@
1
- import type { MaybeOptionalOptions, Value } from '@orpc/shared';
2
1
  import type { Context as HonoContext, MiddlewareHandler } from 'hono';
3
2
  import type { Context } from '../../context';
4
3
  import type { FetchHandler } from '../fetch';
5
4
  import type { StandardHandleOptions } from '../standard';
5
+ import { type Value } from '@orpc/shared';
6
6
  export type CreateMiddlewareOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
7
7
  context?: Value<T, [HonoContext]>;
8
8
  } : {
9
9
  context: Value<T, [HonoContext]>;
10
10
  });
11
- export declare function createMiddleware<T extends Context>(handler: FetchHandler<T>, ...[options]: MaybeOptionalOptions<CreateMiddlewareOptions<T>>): MiddlewareHandler;
11
+ export type CreateMiddlewareRest<T extends Context> = [options: CreateMiddlewareOptions<T>] | (Record<never, never> extends T ? [] : never);
12
+ export declare function createMiddleware<T extends Context>(handler: FetchHandler<T>, ...[options]: CreateMiddlewareRest<T>): MiddlewareHandler;
12
13
  //# sourceMappingURL=middleware.d.ts.map
@@ -1,13 +1,14 @@
1
- import type { MaybeOptionalOptions, Value } from '@orpc/shared';
2
1
  import type { NextRequest } from 'next/server';
3
2
  import type { Context } from '../../context';
4
3
  import type { FetchHandler } from '../fetch';
5
4
  import type { StandardHandleOptions } from '../standard';
5
+ import { type Value } from '@orpc/shared';
6
6
  export type ServeOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
7
7
  context?: Value<T, [NextRequest]>;
8
8
  } : {
9
9
  context: Value<T, [NextRequest]>;
10
10
  });
11
+ export type ServeRest<T extends Context> = [options: ServeOptions<T>] | (Record<never, never> extends T ? [] : never);
11
12
  export interface ServeResult {
12
13
  GET(req: NextRequest): Promise<Response>;
13
14
  POST(req: NextRequest): Promise<Response>;
@@ -15,5 +16,5 @@ export interface ServeResult {
15
16
  PATCH(req: NextRequest): Promise<Response>;
16
17
  DELETE(req: NextRequest): Promise<Response>;
17
18
  }
18
- export declare function serve<T extends Context>(handler: FetchHandler<T>, ...[options]: MaybeOptionalOptions<ServeOptions<T>>): ServeResult;
19
+ export declare function serve<T extends Context>(handler: FetchHandler<T>, ...[options]: ServeRest<T>): ServeResult;
19
20
  //# sourceMappingURL=serve.d.ts.map
@@ -1,11 +1,10 @@
1
- import type { MaybeOptionalOptions } from '@orpc/shared';
2
1
  import type { Context } from '../../context';
3
2
  import type { Router } from '../../router';
4
- import type { RPCHandlerOptions, StandardHandleOptions } from '../standard';
3
+ import type { RPCHandlerOptions, StandardHandleRest } from '../standard';
5
4
  import type { NodeHttpHandler, NodeHttpHandleResult, NodeHttpRequest, NodeHttpResponse } from './types';
6
5
  export declare class RPCHandler<T extends Context> implements NodeHttpHandler<T> {
7
6
  private readonly standardHandler;
8
7
  constructor(router: Router<T, any>, options?: NoInfer<RPCHandlerOptions<T>>);
9
- handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
8
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: StandardHandleRest<T>): Promise<NodeHttpHandleResult>;
10
9
  }
11
10
  //# sourceMappingURL=rpc-handler.d.ts.map
@@ -1,8 +1,7 @@
1
- import type { MaybeOptionalOptions } from '@orpc/shared';
2
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
3
2
  import type { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
4
3
  import type { Context } from '../../context';
5
- import type { StandardHandleOptions } from '../standard';
4
+ import type { StandardHandleRest } from '../standard';
6
5
  export type NodeHttpRequest = (IncomingMessage | Http2ServerRequest) & {
7
6
  /**
8
7
  * Replace `req.url` with `req.originalUrl` when `req.originalUrl` is available.
@@ -17,6 +16,6 @@ export type NodeHttpHandleResult = {
17
16
  matched: false;
18
17
  };
19
18
  export interface NodeHttpHandler<T extends Context> {
20
- handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<NodeHttpHandleResult>;
19
+ handle(req: NodeHttpRequest, res: NodeHttpResponse, ...rest: StandardHandleRest<T>): Promise<NodeHttpHandleResult>;
21
20
  }
22
21
  //# sourceMappingURL=types.d.ts.map
@@ -1,8 +1,7 @@
1
- import type { ErrorMap, HTTPPath, Meta, Schema } from '@orpc/contract';
2
- import type { Interceptor, MaybeOptionalOptions } from '@orpc/shared';
1
+ import type { HTTPPath } from '@orpc/contract';
2
+ import type { Interceptor } from '@orpc/shared';
3
3
  import type { Context } from '../../context';
4
4
  import type { Plugin } from '../../plugins';
5
- import type { CreateProcedureClientOptions } from '../../procedure-client';
6
5
  import type { Router } from '../../router';
7
6
  import type { StandardCodec, StandardMatcher, StandardRequest, StandardResponse } from './types';
8
7
  export type StandardHandleOptions<T extends Context> = {
@@ -15,6 +14,7 @@ export type StandardHandleOptions<T extends Context> = {
15
14
  export type WellStandardHandleOptions<T extends Context> = StandardHandleOptions<T> & {
16
15
  context: T;
17
16
  };
17
+ export type StandardHandleRest<T extends Context> = [options: StandardHandleOptions<T>] | (Record<never, never> extends T ? [] : never);
18
18
  export type StandardHandleResult = {
19
19
  matched: true;
20
20
  response: StandardResponse;
@@ -25,9 +25,6 @@ export type StandardHandleResult = {
25
25
  export type StandardHandlerInterceptorOptions<TContext extends Context> = WellStandardHandleOptions<TContext> & {
26
26
  request: StandardRequest;
27
27
  };
28
- export type WellCreateProcedureClientOptions<TContext extends Context> = CreateProcedureClientOptions<TContext, Schema, Schema, unknown, ErrorMap, Meta, Record<never, never>> & {
29
- context: TContext;
30
- };
31
28
  export interface StandardHandlerOptions<TContext extends Context> {
32
29
  plugins?: Plugin<TContext>[];
33
30
  /**
@@ -39,12 +36,12 @@ export interface StandardHandlerOptions<TContext extends Context> {
39
36
  */
40
37
  interceptorsRoot?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, unknown>[];
41
38
  }
42
- export declare class StandardHandler<T extends Context> {
39
+ export declare class StandardHandler<TContext extends Context> {
43
40
  private readonly matcher;
44
41
  private readonly codec;
45
42
  private readonly options;
46
43
  private readonly plugin;
47
- constructor(router: Router<T, any>, matcher: StandardMatcher, codec: StandardCodec, options?: NoInfer<StandardHandlerOptions<T>>);
48
- handle(request: StandardRequest, ...[options]: MaybeOptionalOptions<StandardHandleOptions<T>>): Promise<StandardHandleResult>;
44
+ constructor(router: Router<TContext, any>, matcher: StandardMatcher, codec: StandardCodec, options?: NoInfer<StandardHandlerOptions<TContext>>);
45
+ handle(request: StandardRequest, ...[options]: StandardHandleRest<TContext>): Promise<StandardHandleResult>;
49
46
  }
50
47
  //# sourceMappingURL=handler.d.ts.map
@@ -3,7 +3,7 @@ export type RPCSerializedJsonMeta = ['bigint' | 'date' | 'nan' | 'undefined' | '
3
3
  export type RPCSerialized = {
4
4
  json: unknown;
5
5
  meta: RPCSerializedJsonMeta;
6
- } | FormData | Blob | undefined;
6
+ } | FormData | Blob;
7
7
  export type RPCSerializedFormDataMaps = Segment[][];
8
8
  export declare class RPCSerializer {
9
9
  serialize(data: unknown): RPCSerialized;
@@ -1,4 +1,4 @@
1
- import type { HTTPPath, ORPCError } from '@orpc/contract';
1
+ import type { AbortSignal, HTTPPath, ORPCError } from '@orpc/contract';
2
2
  import type { JsonValue } from '@orpc/shared';
3
3
  import type { AnyProcedure } from '../../procedure';
4
4
  import type { AnyRouter } from '../../router';
@@ -1,10 +1,9 @@
1
- import type { ClientContext, ClientRest, ErrorMap, Meta, ORPCErrorConstructorMap, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
- import type { MaybeOptionalOptions } from '@orpc/shared';
1
+ import type { ClientRest, ErrorMap, Meta, ORPCErrorConstructorMap, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
3
2
  import type { BuilderDef } from './builder';
4
3
  import type { ConflictContextGuard, Context, MergedContext } from './context';
5
4
  import type { MapInputMiddleware, Middleware } from './middleware';
6
5
  import type { Procedure, ProcedureHandler } from './procedure';
7
- import type { CreateProcedureClientOptions, ProcedureClient } from './procedure-client';
6
+ import type { CreateProcedureClientRest, ProcedureClient } from './procedure-client';
8
7
  import type { DecoratedProcedure } from './procedure-decorated';
9
8
  /**
10
9
  * Like `DecoratedProcedure`, but removed all method that can change the contract.
@@ -14,11 +13,11 @@ export interface ImplementedProcedure<TInitialContext extends Context, TCurrentC
14
13
  /**
15
14
  * Make this procedure callable (works like a function while still being a procedure).
16
15
  */
17
- callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
16
+ callable<TClientContext>(...rest: CreateProcedureClientRest<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
18
17
  /**
19
18
  * Make this procedure compatible with server action (the same as .callable, but the type is compatible with server action).
20
19
  */
21
- actionable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ((...rest: ClientRest<TClientContext, SchemaInput<TInputSchema>>) => Promise<SchemaOutput<TOutputSchema, THandlerOutput>>);
20
+ actionable<TClientContext>(...rest: CreateProcedureClientRest<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ((...rest: ClientRest<TClientContext, SchemaInput<TInputSchema>>) => Promise<SchemaOutput<TOutputSchema, THandlerOutput>>);
22
21
  }
23
22
  /**
24
23
  * Like `ProcedureBuilderWithoutHandler`, but removed all method that can change the contract.
@@ -1,5 +1,5 @@
1
- import type { ErrorMap, Meta, ORPCErrorConstructorMap, Schema } from '@orpc/contract';
2
- import type { MaybeOptionalOptions, Promisable } from '@orpc/shared';
1
+ import type { AbortSignal, ErrorMap, Meta, ORPCErrorConstructorMap, Schema } from '@orpc/contract';
2
+ import type { Promisable } from '@orpc/shared';
3
3
  import type { Context } from './context';
4
4
  import type { Procedure } from './procedure';
5
5
  export type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
@@ -11,8 +11,9 @@ export type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never,
11
11
  } : {
12
12
  context: TOutContext;
13
13
  };
14
+ export type MiddlewareNextFnRest<TOutContext extends Context> = [options: MiddlewareNextFnOptions<TOutContext>] | (Record<never, never> extends TOutContext ? [] : never);
14
15
  export interface MiddlewareNextFn<TInContext extends Context, TOutput> {
15
- <U extends Context & Partial<TInContext> = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
16
+ <U extends Context & Partial<TInContext> = Record<never, never>>(...rest: MiddlewareNextFnRest<U>): MiddlewareResult<U, TOutput>;
16
17
  }
17
18
  export interface MiddlewareOutputFn<TOutput> {
18
19
  (output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
@@ -1,13 +1,11 @@
1
- import type { StandardHandlerInterceptorOptions, StandardHandlerOptions, WellCreateProcedureClientOptions } from '../adapters/standard';
1
+ import type { StandardHandlerOptions } from '../adapters/standard';
2
2
  import type { Context } from '../context';
3
3
  export interface Plugin<TContext extends Context> {
4
4
  init?(options: StandardHandlerOptions<TContext>): void;
5
- beforeCreateProcedureClient?(clientOptions: WellCreateProcedureClientOptions<TContext>, interceptorOptions: StandardHandlerInterceptorOptions<TContext>): void;
6
5
  }
7
6
  export declare class CompositePlugin<TContext extends Context> implements Plugin<TContext> {
8
7
  private readonly plugins;
9
8
  constructor(plugins?: Plugin<TContext>[]);
10
9
  init(options: StandardHandlerOptions<TContext>): void;
11
- beforeCreateProcedureClient(clientOptions: WellCreateProcedureClientOptions<TContext>, interceptorOptions: StandardHandlerInterceptorOptions<TContext>): void;
12
10
  }
13
11
  //# sourceMappingURL=base.d.ts.map
@@ -1,9 +1,9 @@
1
- import type { Client, ClientContext, ErrorFromErrorMap, ErrorMap, Meta, ORPCErrorConstructorMap, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
- import type { Interceptor, MaybeOptionalOptions, Value } from '@orpc/shared';
1
+ import type { Client, ErrorFromErrorMap, ErrorMap, Meta, ORPCErrorConstructorMap, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
+ import type { Interceptor, Value } from '@orpc/shared';
3
3
  import type { Context } from './context';
4
4
  import type { Lazyable } from './lazy';
5
5
  import type { Procedure } from './procedure';
6
- export type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
6
+ export type ProcedureClient<TClientContext, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap> = Client<TClientContext, SchemaInput<TInputSchema>, SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
7
7
  export interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TInputSchema extends Schema, TErrorMap extends ErrorMap, TMeta extends Meta> {
8
8
  context: TInitialContext;
9
9
  input: SchemaInput<TInputSchema>;
@@ -15,7 +15,7 @@ export interface ProcedureClientInterceptorOptions<TInitialContext extends Conte
15
15
  /**
16
16
  * Options for creating a procedure caller with comprehensive type safety
17
17
  */
18
- export type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
18
+ export type CreateProcedureClientOptions<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext> = {
19
19
  /**
20
20
  * This is helpful for logging and analytics.
21
21
  */
@@ -26,5 +26,6 @@ export type CreateProcedureClientOptions<TInitialContext extends Context, TInput
26
26
  } : {
27
27
  context: Value<TInitialContext, [clientContext: TClientContext]>;
28
28
  });
29
- export declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, 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>;
29
+ export type CreateProcedureClientRest<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext> = [options: CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>] | (Record<never, never> extends TInitialContext ? [] : never);
30
+ export declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, ...[options]: CreateProcedureClientRest<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
30
31
  //# sourceMappingURL=procedure-client.d.ts.map
@@ -1,8 +1,7 @@
1
- import type { ClientContext, ClientRest, ErrorMap, MergedErrorMap, Meta, ORPCErrorConstructorMap, Route, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
- import type { MaybeOptionalOptions } from '@orpc/shared';
1
+ import type { ClientRest, ErrorMap, MergedErrorMap, Meta, ORPCErrorConstructorMap, Route, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
3
2
  import type { ConflictContextGuard, Context, MergedContext } from './context';
4
3
  import type { MapInputMiddleware, Middleware } from './middleware';
5
- import type { CreateProcedureClientOptions, ProcedureClient } from './procedure-client';
4
+ import type { CreateProcedureClientRest, ProcedureClient } from './procedure-client';
6
5
  import { Procedure } from './procedure';
7
6
  export declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> {
8
7
  errors<U extends ErrorMap>(errors: U): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, MergedErrorMap<TErrorMap, U>, TMeta>;
@@ -13,10 +12,10 @@ export declare class DecoratedProcedure<TInitialContext extends Context, TCurren
13
12
  /**
14
13
  * Make this procedure callable (works like a function while still being a procedure).
15
14
  */
16
- callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
15
+ callable<TClientContext>(...rest: CreateProcedureClientRest<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap>;
17
16
  /**
18
17
  * Make this procedure compatible with server action (the same as .callable, but the type is compatible with server action).
19
18
  */
20
- actionable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ((...rest: ClientRest<TClientContext, SchemaInput<TInputSchema>>) => Promise<SchemaOutput<TOutputSchema, THandlerOutput>>);
19
+ actionable<TClientContext>(...rest: CreateProcedureClientRest<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, TClientContext>): Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta> & ((...rest: ClientRest<TClientContext, SchemaInput<TInputSchema>>) => Promise<SchemaOutput<TOutputSchema, THandlerOutput>>);
21
20
  }
22
21
  //# sourceMappingURL=procedure-decorated.d.ts.map
@@ -1,9 +1,8 @@
1
1
  import type { ClientPromiseResult, ErrorFromErrorMap, ErrorMap, Meta, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
- import type { MaybeOptionalOptions } from '@orpc/shared';
3
2
  import type { Context } from './context';
4
3
  import type { Lazyable } from './lazy';
5
4
  import type { Procedure } from './procedure';
6
- import type { CreateProcedureClientOptions } from './procedure-client';
5
+ import { type CreateProcedureClientRest } from './procedure-client';
7
6
  /**
8
7
  * Directly call a procedure without creating a client.
9
8
  *
@@ -14,5 +13,5 @@ import type { CreateProcedureClientOptions } from './procedure-client';
14
13
  * ```
15
14
  *
16
15
  */
17
- export declare function call<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, input: SchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, Record<never, never>>>): ClientPromiseResult<SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
16
+ export declare function call<TInitialContext extends Context, TInputSchema extends Schema, TOutputSchema extends Schema, THandlerOutput extends SchemaInput<TOutputSchema>, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta>>, input: SchemaInput<TInputSchema>, ...rest: CreateProcedureClientRest<TInitialContext, TInputSchema, TOutputSchema, THandlerOutput, TErrorMap, TMeta, unknown>): ClientPromiseResult<SchemaOutput<TOutputSchema, THandlerOutput>, ErrorFromErrorMap<TErrorMap>>;
18
17
  //# sourceMappingURL=procedure-utils.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { ContractProcedureDef, ErrorMap, Meta, ORPCErrorConstructorMap, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
1
+ import type { AbortSignal, ContractProcedureDef, ErrorMap, Meta, ORPCErrorConstructorMap, Schema, SchemaInput, SchemaOutput } from '@orpc/contract';
2
2
  import type { Promisable } from '@orpc/shared';
3
3
  import type { Context, TypeInitialContext } from './context';
4
4
  import type { AnyMiddleware } from './middleware';
@@ -1,11 +1,10 @@
1
- import type { ClientContext, ErrorMap, Meta } from '@orpc/contract';
2
- import type { MaybeOptionalOptions } from '@orpc/shared';
1
+ import type { ErrorMap, Meta } from '@orpc/contract';
3
2
  import type { Lazy } from './lazy';
4
3
  import type { Procedure } from './procedure';
5
- import type { CreateProcedureClientOptions, ProcedureClient } from './procedure-client';
6
- import type { AnyRouter, InferRouterInitialContext } from './router';
7
- export type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext> = TRouter extends Lazy<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UFuncOutput, UErrorMap> : {
4
+ import type { CreateProcedureClientRest, ProcedureClient } from './procedure-client';
5
+ import type { AnyRouter, Router } from './router';
6
+ export type RouterClient<TRouter extends AnyRouter, TClientContext> = TRouter extends Lazy<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UFuncOutput, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UFuncOutput, UErrorMap> : {
8
7
  [K in keyof TRouter]: TRouter[K] extends AnyRouter ? RouterClient<TRouter[K], TClientContext> : never;
9
8
  };
10
- export declare function createRouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext>(router: TRouter | Lazy<undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<TRouter>, undefined, undefined, unknown, ErrorMap, Meta, TClientContext>>): RouterClient<TRouter, TClientContext>;
9
+ export declare function createRouterClient<TRouter extends AnyRouter, TClientContext>(router: TRouter | Lazy<undefined>, ...rest: CreateProcedureClientRest<TRouter extends Router<infer UContext, any> ? UContext : never, undefined, undefined, unknown, ErrorMap, Meta, TClientContext>): RouterClient<TRouter, TClientContext>;
11
10
  //# sourceMappingURL=router-client.d.ts.map
@@ -9,7 +9,6 @@ export type Router<TInitialContext extends Context, TContract extends AnyContrac
9
9
  [K in keyof TContract]: TContract[K] extends AnyContractRouter ? Router<TInitialContext, TContract[K]> : never;
10
10
  }>;
11
11
  export type AnyRouter = Router<any, any>;
12
- export type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer UInitialContext, any> ? UInitialContext : never;
13
12
  export 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> : {
14
13
  [K in keyof T]: T[K] extends AnyRouter ? InferRouterInputs<T[K]> : never;
15
14
  };
package/dist/standard.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  RPCSerializer,
5
5
  StandardHandler,
6
6
  serializeRPCJson
7
- } from "./chunk-GIXDBJGV.js";
8
- import "./chunk-XP6YRLY2.js";
9
- import "./chunk-XFBAK67J.js";
7
+ } from "./chunk-PYUF3JOC.js";
8
+ import "./chunk-OEPDHGQ4.js";
9
+ import "./chunk-Q2XV45Q4.js";
10
10
  export {
11
11
  RPCCodec,
12
12
  RPCMatcher,
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.b4e6d3a",
4
+ "version": "0.0.0-next.b825e0c",
5
5
  "license": "MIT",
6
6
  "homepage": "https://orpc.unnoq.com",
7
7
  "repository": {
@@ -63,9 +63,9 @@
63
63
  "next": ">=14.0.0"
64
64
  },
65
65
  "dependencies": {
66
- "@tinyhttp/content-disposition": "^2.2.2",
67
- "@orpc/contract": "0.0.0-next.b4e6d3a",
68
- "@orpc/shared": "0.0.0-next.b4e6d3a"
66
+ "content-disposition": "^0.5.4",
67
+ "@orpc/contract": "0.0.0-next.b825e0c",
68
+ "@orpc/shared": "0.0.0-next.b825e0c"
69
69
  },
70
70
  "devDependencies": {
71
71
  "light-my-request": "^6.5.1"