@orpc/contract 0.0.0-next.e385fb7 → 0.0.0-next.e4434d0

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.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
2
+ <image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
3
3
  </div>
4
4
 
5
5
  <h1></h1>
@@ -17,6 +17,9 @@
17
17
  <a href="https://discord.gg/TXEbwRBvQn">
18
18
  <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
19
  </a>
20
+ <a href="https://deepwiki.com/unnoq/orpc">
21
+ <img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
22
+ </a>
20
23
  </div>
21
24
 
22
25
  <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
@@ -30,7 +33,8 @@
30
33
  - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
34
  - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
35
  - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
- - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte), Pinia Colada, and more.
36
+ - **🔍 First-Class OpenTelemetry**: Seamlessly integrate with OpenTelemetry for observability.
37
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), SWR, Pinia Colada, and more.
34
38
  - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
35
39
  - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
36
40
  - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
@@ -38,32 +42,31 @@
38
42
  - **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
39
43
  - **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
40
44
  - **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
41
- - **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
42
45
 
43
46
  ## Documentation
44
47
 
45
- You can find the full documentation [here](https://orpc.unnoq.com).
48
+ You can find the full documentation [here](https://orpc.dev).
46
49
 
47
50
  ## Packages
48
51
 
49
52
  - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
53
  - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
54
  - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
- - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with NestJS.
55
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
56
+ - [@orpc/otel](https://www.npmjs.com/package/@orpc/otel): [OpenTelemetry](https://opentelemetry.io/) integration for observability.
57
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
53
58
  - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
54
- - [@orpc/react-query](https://www.npmjs.com/package/@orpc/react-query): Integration with [React Query](https://tanstack.com/query/latest/docs/framework/react/overview).
55
- - [@orpc/vue-query](https://www.npmjs.com/package/@orpc/vue-query): Integration with [Vue Query](https://tanstack.com/query/latest/docs/framework/vue/overview).
56
- - [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
57
- - [@orpc/svelte-query](https://www.npmjs.com/package/@orpc/svelte-query): Integration with [Svelte Query](https://tanstack.com/query/latest/docs/framework/svelte/overview).
59
+ - [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
60
+ - [@orpc/experimental-react-swr](https://www.npmjs.com/package/@orpc/experimental-react-swr): [SWR](https://swr.vercel.app/) integration.
58
61
  - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
59
- - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
62
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
60
63
  - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
61
64
  - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
62
65
  - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
63
66
 
64
67
  ## `@orpc/contract`
65
68
 
66
- Build your API contract. Read the [documentation](https://orpc.unnoq.com/docs/contract-first/define-contract) for more information.
69
+ Build your API contract. Read the [documentation](https://orpc.dev/docs/contract-first/define-contract) for more information.
67
70
 
68
71
  ```ts
69
72
  export const PlanetSchema = z.object({
package/dist/index.d.mts CHANGED
@@ -1,236 +1,11 @@
1
- import { ORPCErrorCode, ORPCError, HTTPMethod, HTTPPath, ClientContext, Client } from '@orpc/client';
1
+ import { HTTPPath, HTTPMethod, ClientContext, Client } from '@orpc/client';
2
2
  export { HTTPMethod, HTTPPath, ORPCError } from '@orpc/client';
3
- import { Promisable, IsEqual, ThrowableError } from '@orpc/shared';
4
- export { Registry, ThrowableError } from '@orpc/shared';
5
- import { StandardSchemaV1 } from '@standard-schema/spec';
6
-
7
- type Schema<TInput, TOutput> = StandardSchemaV1<TInput, TOutput>;
8
- type AnySchema = Schema<any, any>;
9
- type SchemaIssue = StandardSchemaV1.Issue;
10
- type InferSchemaInput<T extends AnySchema> = T extends StandardSchemaV1<infer UInput, any> ? UInput : never;
11
- type InferSchemaOutput<T extends AnySchema> = T extends StandardSchemaV1<any, infer UOutput> ? UOutput : never;
12
- type TypeRest<TInput, TOutput> = [map: (input: TInput) => Promisable<TOutput>] | (IsEqual<TInput, TOutput> extends true ? [] : never);
13
- /**
14
- * The schema for things can be trust without validation.
15
- * If the TInput and TOutput are different, you need pass a map function.
16
- *
17
- * @see {@link https://orpc.unnoq.com/docs/procedure#type-utility Type Utility Docs}
18
- */
19
- declare function type<TInput, TOutput = TInput>(...[map]: TypeRest<TInput, TOutput>): Schema<TInput, TOutput>;
20
-
21
- interface ValidationErrorOptions extends ErrorOptions {
22
- message: string;
23
- issues: readonly SchemaIssue[];
24
- }
25
- /**
26
- * This errors usually used for ORPCError.cause when the error is a validation error.
27
- *
28
- * @see {@link https://orpc.unnoq.com/docs/advanced/validation-errors Validation Errors Docs}
29
- */
30
- declare class ValidationError extends Error {
31
- readonly issues: readonly SchemaIssue[];
32
- constructor(options: ValidationErrorOptions);
33
- }
34
- interface ErrorMapItem<TDataSchema extends AnySchema> {
35
- status?: number;
36
- message?: string;
37
- data?: TDataSchema;
38
- }
39
- type ErrorMap = {
40
- [key in ORPCErrorCode]?: ErrorMapItem<AnySchema>;
41
- };
42
- type MergedErrorMap<T1 extends ErrorMap, T2 extends ErrorMap> = Omit<T1, keyof T2> & T2;
43
- declare function mergeErrorMap<T1 extends ErrorMap, T2 extends ErrorMap>(errorMap1: T1, errorMap2: T2): MergedErrorMap<T1, T2>;
44
- type ORPCErrorFromErrorMap<TErrorMap extends ErrorMap> = {
45
- [K in keyof TErrorMap]: K extends string ? TErrorMap[K] extends ErrorMapItem<infer TDataSchema extends Schema<unknown, unknown>> ? ORPCError<K, InferSchemaOutput<TDataSchema>> : never : never;
46
- }[keyof TErrorMap];
47
- type ErrorFromErrorMap<TErrorMap extends ErrorMap> = ORPCErrorFromErrorMap<TErrorMap> | ThrowableError;
48
-
49
- type Meta = Record<string, any>;
50
- declare function mergeMeta<T extends Meta>(meta1: T, meta2: T): T;
51
-
52
- type InputStructure = 'compact' | 'detailed';
53
- type OutputStructure = 'compact' | 'detailed';
54
- interface Route {
55
- /**
56
- * The HTTP method of the procedure.
57
- * This option is typically relevant when integrating with OpenAPI.
58
- *
59
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
60
- */
61
- method?: HTTPMethod;
62
- /**
63
- * The HTTP path of the procedure.
64
- * This option is typically relevant when integrating with OpenAPI.
65
- *
66
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
67
- */
68
- path?: HTTPPath;
69
- /**
70
- * The summary of the procedure.
71
- * This option is typically relevant when integrating with OpenAPI.
72
- *
73
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
74
- */
75
- summary?: string;
76
- /**
77
- * The description of the procedure.
78
- * This option is typically relevant when integrating with OpenAPI.
79
- *
80
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
81
- */
82
- description?: string;
83
- /**
84
- * Marks the procedure as deprecated.
85
- * This option is typically relevant when integrating with OpenAPI.
86
- *
87
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
88
- */
89
- deprecated?: boolean;
90
- /**
91
- * The tags of the procedure.
92
- * This option is typically relevant when integrating with OpenAPI.
93
- *
94
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
95
- */
96
- tags?: readonly string[];
97
- /**
98
- * The status code of the response when the procedure is successful.
99
- * The status code must be in the 200-399 range.
100
- * This option is typically relevant when integrating with OpenAPI.
101
- *
102
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
103
- * @default 200
104
- */
105
- successStatus?: number;
106
- /**
107
- * The description of the response when the procedure is successful.
108
- * This option is typically relevant when integrating with OpenAPI.
109
- *
110
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
111
- * @default 'OK'
112
- */
113
- successDescription?: string;
114
- /**
115
- * Determines how the input should be structured based on `params`, `query`, `headers`, and `body`.
116
- *
117
- * @option 'compact'
118
- * Combines `params` and either `query` or `body` (depending on the HTTP method) into a single object.
119
- *
120
- * @option 'detailed'
121
- * Keeps each part of the request (`params`, `query`, `headers`, and `body`) as separate fields in the input object.
122
- *
123
- * Example:
124
- * ```ts
125
- * const input = {
126
- * params: { id: 1 },
127
- * query: { search: 'hello' },
128
- * headers: { 'Content-Type': 'application/json' },
129
- * body: { name: 'John' },
130
- * }
131
- * ```
132
- *
133
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
134
- * @default 'compact'
135
- */
136
- inputStructure?: InputStructure;
137
- /**
138
- * Determines how the response should be structured based on the output.
139
- *
140
- * @option 'compact'
141
- * The output data is directly returned as the response body.
142
- *
143
- * @option 'detailed'
144
- * Return an object with optional properties:
145
- * - `status`: The response status (must be in 200-399 range) if not set fallback to `successStatus`.
146
- * - `headers`: Custom headers to merge with the response headers (`Record<string, string | string[] | undefined>`)
147
- * - `body`: The response body.
148
- *
149
- * Example:
150
- * ```ts
151
- * const output = {
152
- * status: 201,
153
- * headers: { 'x-custom-header': 'value' },
154
- * body: { message: 'Hello, world!' },
155
- * };
156
- * ```
157
- *
158
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
159
- * @default 'compact'
160
- */
161
- outputStructure?: OutputStructure;
162
- }
163
- declare function mergeRoute(a: Route, b: Route): Route;
164
- declare function prefixRoute(route: Route, prefix: HTTPPath): Route;
165
- declare function unshiftTagRoute(route: Route, tags: readonly string[]): Route;
166
- declare function mergePrefix(a: HTTPPath | undefined, b: HTTPPath): HTTPPath;
167
- declare function mergeTags(a: readonly string[] | undefined, b: readonly string[]): readonly string[];
168
- interface EnhanceRouteOptions {
169
- prefix?: HTTPPath;
170
- tags?: readonly string[];
171
- }
172
- declare function enhanceRoute(route: Route, options: EnhanceRouteOptions): Route;
173
-
174
- interface ContractProcedureDef<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
175
- meta: TMeta;
176
- route: Route;
177
- inputSchema?: TInputSchema;
178
- outputSchema?: TOutputSchema;
179
- errorMap: TErrorMap;
180
- }
181
- /**
182
- * This class represents a contract procedure.
183
- *
184
- * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#procedure-contract Contract Procedure Docs}
185
- */
186
- declare class ContractProcedure<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
187
- /**
188
- * This property holds the defined options for the contract procedure.
189
- */
190
- '~orpc': ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
191
- constructor(def: ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>);
192
- }
193
- type AnyContractProcedure = ContractProcedure<any, any, any, any>;
194
- declare function isContractProcedure(item: unknown): item is AnyContractProcedure;
195
-
196
- /**
197
- * Represents a contract router, which defines a hierarchical structure of contract procedures.
198
- *
199
- * @info A contract procedure is a contract router too.
200
- * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#contract-router Contract Router Docs}
201
- */
202
- type ContractRouter<TMeta extends Meta> = ContractProcedure<any, any, any, TMeta> | {
203
- [k: string]: ContractRouter<TMeta>;
204
- };
205
- type AnyContractRouter = ContractRouter<any>;
206
- /**
207
- * Infer all inputs of the contract router.
208
- *
209
- * @info A contract procedure is a contract router too.
210
- * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#utilities Contract Utilities Docs}
211
- */
212
- type InferContractRouterInputs<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
213
- [K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterInputs<T[K]> : never;
214
- };
215
- /**
216
- * Infer all outputs of the contract router.
217
- *
218
- * @info A contract procedure is a contract router too.
219
- * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#utilities Contract Utilities Docs}
220
- */
221
- type InferContractRouterOutputs<T extends AnyContractRouter> = T extends ContractProcedure<any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
222
- [K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterOutputs<T[K]> : never;
223
- };
224
- /**
225
- * Infer all errors of the contract router.
226
- *
227
- * @info A contract procedure is a contract router too.
228
- * @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#utilities Contract Utilities Docs}
229
- */
230
- type InferContractRouterErrorMap<T extends AnyContractRouter> = T extends ContractProcedure<any, any, infer UErrorMap, any> ? UErrorMap : {
231
- [K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterErrorMap<T[K]> : never;
232
- }[keyof T];
233
- type InferContractRouterMeta<T extends AnyContractRouter> = T extends ContractRouter<infer UMeta> ? UMeta : never;
3
+ import { E as ErrorMap, a as EnhanceRouteOptions, A as AnyContractRouter, C as ContractProcedure, M as MergedErrorMap, b as AnySchema, c as Meta, R as Route, d as ContractRouter, e as ContractProcedureDef, S as Schema, I as InputStructure, O as OutputStructure, f as InferSchemaInput, g as InferSchemaOutput, h as ErrorFromErrorMap, i as SchemaIssue } from './shared/contract.TuRtB1Ca.mjs';
4
+ export { o as AnyContractProcedure, k as ErrorMapItem, z as InferContractRouterErrorMap, x as InferContractRouterInputs, B as InferContractRouterMeta, y as InferContractRouterOutputs, l as ORPCErrorFromErrorMap, T as TypeRest, j as ValidationError, V as ValidationErrorOptions, w as enhanceRoute, p as isContractProcedure, m as mergeErrorMap, n as mergeMeta, s as mergePrefix, q as mergeRoute, t as mergeTags, r as prefixRoute, D as type, u as unshiftTagRoute, v as validateORPCError } from './shared/contract.TuRtB1Ca.mjs';
5
+ import { AsyncIteratorClass } from '@orpc/shared';
6
+ export { AsyncIteratorClass, Registry, ThrowableError } from '@orpc/shared';
7
+ export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
8
+ import '@standard-schema/spec';
234
9
 
235
10
  declare function getContractRouter(router: AnyContractRouter, path: readonly string[]): AnyContractRouter | undefined;
236
11
  type EnhancedContractRouter<T extends AnyContractRouter, TErrorMap extends ErrorMap> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrors, infer UMeta> ? ContractProcedure<UInputSchema, UOutputSchema, MergedErrorMap<TErrorMap, UErrors>, UMeta> : {
@@ -240,20 +15,29 @@ interface EnhanceContractRouterOptions<TErrorMap extends ErrorMap> extends Enhan
240
15
  errorMap: TErrorMap;
241
16
  }
242
17
  declare function enhanceContractRouter<T extends AnyContractRouter, TErrorMap extends ErrorMap>(router: T, options: EnhanceContractRouterOptions<TErrorMap>): EnhancedContractRouter<T, TErrorMap>;
18
+ /**
19
+ * Minify a contract router into a smaller object.
20
+ *
21
+ * You should export the result to a JSON file. On the client side, you can import this JSON file and use it as a contract router.
22
+ * This reduces the size of the contract and helps prevent leaking internal details of the router to the client.
23
+ *
24
+ * @see {@link https://orpc.dev/docs/contract-first/router-to-contract#minify-export-the-contract-router-for-the-client Router to Contract Docs}
25
+ */
26
+ declare function minifyContractRouter(router: AnyContractRouter): AnyContractRouter;
243
27
 
244
28
  interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
245
29
  /**
246
30
  * Adds type-safe custom errors to the contract.
247
31
  * The provided errors are spared-merged with any existing errors in the contract.
248
32
  *
249
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
33
+ * @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
250
34
  */
251
35
  errors<U extends ErrorMap>(errors: U): ContractProcedureBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
252
36
  /**
253
37
  * Sets or updates the metadata for the contract.
254
38
  * The provided metadata is spared-merged with any existing metadata in the contract.
255
39
  *
256
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
40
+ * @see {@link https://orpc.dev/docs/metadata Metadata Docs}
257
41
  */
258
42
  meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
259
43
  /**
@@ -261,20 +45,20 @@ interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema
261
45
  * The provided route is spared-merged with any existing route in the contract.
262
46
  * This option is typically relevant when integrating with OpenAPI.
263
47
  *
264
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
265
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
48
+ * @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
49
+ * @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
266
50
  */
267
51
  route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
268
52
  /**
269
53
  * Defines the input validation schema for the contract.
270
54
  *
271
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
55
+ * @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
272
56
  */
273
57
  input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
274
58
  /**
275
59
  * Defines the output validation schema for the contract.
276
60
  *
277
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
61
+ * @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
278
62
  */
279
63
  output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
280
64
  }
@@ -283,14 +67,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
283
67
  * Adds type-safe custom errors to the contract.
284
68
  * The provided errors are spared-merged with any existing errors in the contract.
285
69
  *
286
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
70
+ * @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
287
71
  */
288
72
  errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
289
73
  /**
290
74
  * Sets or updates the metadata for the contract.
291
75
  * The provided metadata is spared-merged with any existing metadata in the contract.
292
76
  *
293
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
77
+ * @see {@link https://orpc.dev/docs/metadata Metadata Docs}
294
78
  */
295
79
  meta(meta: TMeta): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
296
80
  /**
@@ -298,14 +82,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
298
82
  * The provided route is spared-merged with any existing route in the contract.
299
83
  * This option is typically relevant when integrating with OpenAPI.
300
84
  *
301
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
302
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
85
+ * @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
86
+ * @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
303
87
  */
304
88
  route(route: Route): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
305
89
  /**
306
90
  * Defines the output validation schema for the contract.
307
91
  *
308
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
92
+ * @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
309
93
  */
310
94
  output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<TInputSchema, U, TErrorMap, TMeta>;
311
95
  }
@@ -314,14 +98,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
314
98
  * Adds type-safe custom errors to the contract.
315
99
  * The provided errors are spared-merged with any existing errors in the contract.
316
100
  *
317
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
101
+ * @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
318
102
  */
319
103
  errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
320
104
  /**
321
105
  * Sets or updates the metadata for the contract.
322
106
  * The provided metadata is spared-merged with any existing metadata in the contract.
323
107
  *
324
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
108
+ * @see {@link https://orpc.dev/docs/metadata Metadata Docs}
325
109
  */
326
110
  meta(meta: TMeta): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
327
111
  /**
@@ -329,14 +113,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
329
113
  * The provided route is spared-merged with any existing route in the contract.
330
114
  * This option is typically relevant when integrating with OpenAPI.
331
115
  *
332
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
333
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
116
+ * @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
117
+ * @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
334
118
  */
335
119
  route(route: Route): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
336
120
  /**
337
121
  * Defines the input validation schema for the contract.
338
122
  *
339
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
123
+ * @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
340
124
  */
341
125
  input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<U, TOutputSchema, TErrorMap, TMeta>;
342
126
  }
@@ -345,14 +129,14 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
345
129
  * Adds type-safe custom errors to the contract.
346
130
  * The provided errors are spared-merged with any existing errors in the contract.
347
131
  *
348
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
132
+ * @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
349
133
  */
350
134
  errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
351
135
  /**
352
136
  * Sets or updates the metadata for the contract.
353
137
  * The provided metadata is spared-merged with any existing metadata in the contract.
354
138
  *
355
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
139
+ * @see {@link https://orpc.dev/docs/metadata Metadata Docs}
356
140
  */
357
141
  meta(meta: TMeta): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
358
142
  /**
@@ -360,8 +144,8 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
360
144
  * The provided route is spared-merged with any existing route in the contract.
361
145
  * This option is typically relevant when integrating with OpenAPI.
362
146
  *
363
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
364
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
147
+ * @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
148
+ * @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
365
149
  */
366
150
  route(route: Route): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
367
151
  }
@@ -374,7 +158,7 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
374
158
  * Adds type-safe custom errors to the contract.
375
159
  * The provided errors are spared-merged with any existing errors in the contract.
376
160
  *
377
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
161
+ * @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
378
162
  */
379
163
  'errors'<U extends ErrorMap>(errors: U): ContractRouterBuilder<MergedErrorMap<TErrorMap, U>, TMeta>;
380
164
  /**
@@ -383,20 +167,20 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
383
167
  *
384
168
  * @note This option does not affect procedures that do not define a path in their route definition.
385
169
  *
386
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
170
+ * @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
387
171
  */
388
172
  'prefix'(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
389
173
  /**
390
174
  * Adds tags to all procedures in the contract router.
391
175
  * This helpful when you want to group procedures together in the OpenAPI specification.
392
176
  *
393
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
177
+ * @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
394
178
  */
395
179
  'tag'(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
396
180
  /**
397
181
  * Applies all of the previously defined options to the specified contract router.
398
182
  *
399
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
183
+ * @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
400
184
  */
401
185
  'router'<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
402
186
  }
@@ -412,29 +196,29 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
412
196
  /**
413
197
  * Sets or overrides the initial meta.
414
198
  *
415
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
199
+ * @see {@link https://orpc.dev/docs/metadata Metadata Docs}
416
200
  */
417
201
  $meta<U extends Meta>(initialMeta: U): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, U & Record<never, never>>;
418
202
  /**
419
203
  * Sets or overrides the initial route.
420
204
  * This option is typically relevant when integrating with OpenAPI.
421
205
  *
422
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
423
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
206
+ * @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
207
+ * @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
424
208
  */
425
209
  $route(initialRoute: Route): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
426
210
  /**
427
211
  * Adds type-safe custom errors to the contract.
428
212
  * The provided errors are spared-merged with any existing errors in the contract.
429
213
  *
430
- * @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
214
+ * @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
431
215
  */
432
216
  errors<U extends ErrorMap>(errors: U): ContractBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
433
217
  /**
434
218
  * Sets or updates the metadata for the contract.
435
219
  * The provided metadata is spared-merged with any existing metadata in the contract.
436
220
  *
437
- * @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
221
+ * @see {@link https://orpc.dev/docs/metadata Metadata Docs}
438
222
  */
439
223
  meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
440
224
  /**
@@ -442,20 +226,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
442
226
  * The provided route is spared-merged with any existing route in the contract.
443
227
  * This option is typically relevant when integrating with OpenAPI.
444
228
  *
445
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
446
- * @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
229
+ * @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
230
+ * @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
447
231
  */
448
232
  route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
449
233
  /**
450
234
  * Defines the input validation schema for the contract.
451
235
  *
452
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
236
+ * @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
453
237
  */
454
238
  input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
455
239
  /**
456
240
  * Defines the output validation schema for the contract.
457
241
  *
458
- * @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
242
+ * @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
459
243
  */
460
244
  output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
461
245
  /**
@@ -464,20 +248,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
464
248
  *
465
249
  * @note This option does not affect procedures that do not define a path in their route definition.
466
250
  *
467
- * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
251
+ * @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
468
252
  */
469
253
  prefix(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
470
254
  /**
471
255
  * Adds tags to all procedures in the contract router.
472
256
  * This helpful when you want to group procedures together in the OpenAPI specification.
473
257
  *
474
- * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
258
+ * @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
475
259
  */
476
260
  tag(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
477
261
  /**
478
262
  * Applies all of the previously defined options to the specified contract router.
479
263
  *
480
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
264
+ * @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
481
265
  */
482
266
  router<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
483
267
  }
@@ -499,11 +283,18 @@ interface EventIteratorSchemaDetails {
499
283
  /**
500
284
  * Define schema for an event iterator.
501
285
  *
502
- * @see {@link https://orpc.unnoq.com/docs/event-iterator#validate-event-iterator Validate Event Iterator Docs}
286
+ * @see {@link https://orpc.dev/docs/event-iterator#validate-event-iterator Validate Event Iterator Docs}
503
287
  */
504
- declare function eventIterator<TYieldIn, TYieldOut, TReturnIn = unknown, TReturnOut = unknown>(yields: Schema<TYieldIn, TYieldOut>, returns?: Schema<TReturnIn, TReturnOut>): Schema<AsyncIteratorObject<TYieldIn, TReturnIn, void>, AsyncIteratorObject<TYieldOut, TReturnOut, void>>;
288
+ declare function eventIterator<TYieldIn, TYieldOut, TReturnIn = unknown, TReturnOut = unknown>(yields: Schema<TYieldIn, TYieldOut>, returns?: Schema<TReturnIn, TReturnOut>): Schema<AsyncIteratorObject<TYieldIn, TReturnIn, void>, AsyncIteratorClass<TYieldOut, TReturnOut, void>>;
505
289
  declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): undefined | EventIteratorSchemaDetails;
506
290
 
291
+ /**
292
+ * Help RPCLink automatically send requests using the specified HTTP method in the contract.
293
+ *
294
+ * @see {@link https://orpc.dev/docs/client/rpc-link#custom-request-method RPCLink Custom Request Method}
295
+ */
296
+ declare function inferRPCMethodFromContractRouter(contract: AnyContractRouter): (options: unknown, path: readonly string[]) => Exclude<HTTPMethod, 'HEAD'>;
297
+
507
298
  type ContractProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
508
299
 
509
300
  type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ContractProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
@@ -512,5 +303,5 @@ type ContractRouterClient<TRouter extends AnyContractRouter, TClientContext exte
512
303
 
513
304
  declare function isSchemaIssue(issue: unknown): issue is SchemaIssue;
514
305
 
515
- export { ContractBuilder, ContractProcedure, ValidationError, enhanceContractRouter, enhanceRoute, eventIterator, fallbackContractConfig, getContractRouter, getEventIteratorSchemaDetails, isContractProcedure, isSchemaIssue, mergeErrorMap, mergeMeta, mergePrefix, mergeRoute, mergeTags, oc, prefixRoute, type, unshiftTagRoute };
516
- export type { AnyContractProcedure, AnyContractRouter, AnySchema, ContractBuilderDef, ContractConfig, ContractProcedureBuilder, ContractProcedureBuilderWithInput, ContractProcedureBuilderWithInputOutput, ContractProcedureBuilderWithOutput, ContractProcedureClient, ContractProcedureDef, ContractRouter, ContractRouterBuilder, ContractRouterClient, EnhanceContractRouterOptions, EnhanceRouteOptions, EnhancedContractRouter, ErrorFromErrorMap, ErrorMap, ErrorMapItem, EventIteratorSchemaDetails, InferContractRouterErrorMap, InferContractRouterInputs, InferContractRouterMeta, InferContractRouterOutputs, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, ORPCErrorFromErrorMap, OutputStructure, Route, Schema, SchemaIssue, TypeRest, ValidationErrorOptions };
306
+ export { AnyContractRouter, AnySchema, ContractBuilder, ContractProcedure, ContractProcedureDef, ContractRouter, EnhanceRouteOptions, ErrorFromErrorMap, ErrorMap, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, SchemaIssue, enhanceContractRouter, eventIterator, fallbackContractConfig, getContractRouter, getEventIteratorSchemaDetails, inferRPCMethodFromContractRouter, isSchemaIssue, minifyContractRouter, oc };
307
+ export type { ContractBuilderDef, ContractConfig, ContractProcedureBuilder, ContractProcedureBuilderWithInput, ContractProcedureBuilderWithInputOutput, ContractProcedureBuilderWithOutput, ContractProcedureClient, ContractRouterBuilder, ContractRouterClient, EnhanceContractRouterOptions, EnhancedContractRouter, EventIteratorSchemaDetails };