@orpc/contract 0.0.0-next.a439c82 → 0.0.0-next.a464abe
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 +14 -10
- package/dist/index.d.mts +82 -265
- package/dist/index.d.ts +82 -265
- package/dist/index.mjs +97 -49
- package/dist/plugins/index.d.mts +43 -0
- package/dist/plugins/index.d.ts +43 -0
- package/dist/plugins/index.mjs +81 -0
- package/dist/shared/contract.D_dZrO__.mjs +53 -0
- package/dist/shared/contract.TuRtB1Ca.d.mts +254 -0
- package/dist/shared/contract.TuRtB1Ca.d.ts +254 -0
- package/package.json +14 -8
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.
|
|
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
|
-
-
|
|
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,31 +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.
|
|
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.
|
|
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/).
|
|
52
58
|
- [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
|
|
53
|
-
- [@orpc/
|
|
54
|
-
- [@orpc/
|
|
55
|
-
- [@orpc/solid-query](https://www.npmjs.com/package/@orpc/solid-query): Integration with [Solid Query](https://tanstack.com/query/latest/docs/framework/solid/overview).
|
|
56
|
-
- [@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.
|
|
57
61
|
- [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
|
|
58
|
-
- [@orpc/
|
|
62
|
+
- [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
|
|
59
63
|
- [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
|
|
60
64
|
- [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
|
|
61
65
|
- [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
|
|
62
66
|
|
|
63
67
|
## `@orpc/contract`
|
|
64
68
|
|
|
65
|
-
Build your API contract. Read the [documentation](https://orpc.
|
|
69
|
+
Build your API contract. Read the [documentation](https://orpc.dev/docs/contract-first/define-contract) for more information.
|
|
66
70
|
|
|
67
71
|
```ts
|
|
68
72
|
export const PlanetSchema = z.object({
|
package/dist/index.d.mts
CHANGED
|
@@ -1,256 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HTTPPath, HTTPMethod, ClientContext, Client } from '@orpc/client';
|
|
2
2
|
export { HTTPMethod, HTTPPath, ORPCError } from '@orpc/client';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import {
|
|
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';
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
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>;
|
|
10
|
+
declare function getContractRouter(router: AnyContractRouter, path: readonly string[]): AnyContractRouter | undefined;
|
|
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> : {
|
|
12
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? EnhancedContractRouter<T[K], TErrorMap> : never;
|
|
41
13
|
};
|
|
42
|
-
|
|
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
|
-
* This option is typically relevant when integrating with OpenAPI.
|
|
100
|
-
*
|
|
101
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
102
|
-
* @default 200
|
|
103
|
-
*/
|
|
104
|
-
successStatus?: number;
|
|
105
|
-
/**
|
|
106
|
-
* The description of the response when the procedure is successful.
|
|
107
|
-
* This option is typically relevant when integrating with OpenAPI.
|
|
108
|
-
*
|
|
109
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
110
|
-
* @default 'OK'
|
|
111
|
-
*/
|
|
112
|
-
successDescription?: string;
|
|
113
|
-
/**
|
|
114
|
-
* Determines how the input should be structured based on `params`, `query`, `headers`, and `body`.
|
|
115
|
-
*
|
|
116
|
-
* @option 'compact'
|
|
117
|
-
* Combines `params` and either `query` or `body` (depending on the HTTP method) into a single object.
|
|
118
|
-
*
|
|
119
|
-
* @option 'detailed'
|
|
120
|
-
* Keeps each part of the request (`params`, `query`, `headers`, and `body`) as separate fields in the input object.
|
|
121
|
-
*
|
|
122
|
-
* Example:
|
|
123
|
-
* ```ts
|
|
124
|
-
* const input = {
|
|
125
|
-
* params: { id: 1 },
|
|
126
|
-
* query: { search: 'hello' },
|
|
127
|
-
* headers: { 'Content-Type': 'application/json' },
|
|
128
|
-
* body: { name: 'John' },
|
|
129
|
-
* }
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
133
|
-
* @default 'compact'
|
|
134
|
-
*/
|
|
135
|
-
inputStructure?: InputStructure;
|
|
136
|
-
/**
|
|
137
|
-
* Determines how the response should be structured based on the output.
|
|
138
|
-
*
|
|
139
|
-
* @option 'compact'
|
|
140
|
-
* Includes only the body data, encoded directly in the response.
|
|
141
|
-
*
|
|
142
|
-
* @option 'detailed'
|
|
143
|
-
* Separates the output into `headers` and `body` fields.
|
|
144
|
-
* - `headers`: Custom headers to merge with the response headers.
|
|
145
|
-
* - `body`: The response data.
|
|
146
|
-
*
|
|
147
|
-
* Example:
|
|
148
|
-
* ```ts
|
|
149
|
-
* const output = {
|
|
150
|
-
* headers: { 'x-custom-header': 'value' },
|
|
151
|
-
* body: { message: 'Hello, world!' },
|
|
152
|
-
* };
|
|
153
|
-
* ```
|
|
154
|
-
*
|
|
155
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
156
|
-
* @default 'compact'
|
|
157
|
-
*/
|
|
158
|
-
outputStructure?: OutputStructure;
|
|
159
|
-
}
|
|
160
|
-
declare function mergeRoute(a: Route, b: Route): Route;
|
|
161
|
-
declare function prefixRoute(route: Route, prefix: HTTPPath): Route;
|
|
162
|
-
declare function unshiftTagRoute(route: Route, tags: readonly string[]): Route;
|
|
163
|
-
declare function mergePrefix(a: HTTPPath | undefined, b: HTTPPath): HTTPPath;
|
|
164
|
-
declare function mergeTags(a: readonly string[] | undefined, b: readonly string[]): readonly string[];
|
|
165
|
-
interface EnhanceRouteOptions {
|
|
166
|
-
prefix?: HTTPPath;
|
|
167
|
-
tags?: readonly string[];
|
|
168
|
-
}
|
|
169
|
-
declare function enhanceRoute(route: Route, options: EnhanceRouteOptions): Route;
|
|
170
|
-
|
|
171
|
-
interface ContractProcedureDef<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
172
|
-
meta: TMeta;
|
|
173
|
-
route: Route;
|
|
174
|
-
inputSchema?: TInputSchema;
|
|
175
|
-
outputSchema?: TOutputSchema;
|
|
14
|
+
interface EnhanceContractRouterOptions<TErrorMap extends ErrorMap> extends EnhanceRouteOptions {
|
|
176
15
|
errorMap: TErrorMap;
|
|
177
16
|
}
|
|
17
|
+
declare function enhanceContractRouter<T extends AnyContractRouter, TErrorMap extends ErrorMap>(router: T, options: EnhanceContractRouterOptions<TErrorMap>): EnhancedContractRouter<T, TErrorMap>;
|
|
178
18
|
/**
|
|
179
|
-
*
|
|
19
|
+
* Minify a contract router into a smaller object.
|
|
180
20
|
*
|
|
181
|
-
*
|
|
182
|
-
|
|
183
|
-
declare class ContractProcedure<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
184
|
-
/**
|
|
185
|
-
* This property holds the defined options for the contract procedure.
|
|
186
|
-
*/
|
|
187
|
-
'~orpc': ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
188
|
-
constructor(def: ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
|
189
|
-
}
|
|
190
|
-
type AnyContractProcedure = ContractProcedure<any, any, any, any>;
|
|
191
|
-
declare function isContractProcedure(item: unknown): item is AnyContractProcedure;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Represents a contract router, which defines a hierarchical structure of contract procedures.
|
|
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.
|
|
195
23
|
*
|
|
196
|
-
* @
|
|
197
|
-
* @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
24
|
+
* @see {@link https://orpc.dev/docs/contract-first/router-to-contract#minify-export-the-contract-router-for-the-client Router to Contract Docs}
|
|
198
25
|
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
type AnyContractRouter = ContractRouter<any>;
|
|
203
|
-
/**
|
|
204
|
-
* Infer all inputs of the contract router.
|
|
205
|
-
*
|
|
206
|
-
* @info A contract procedure is a contract router too.
|
|
207
|
-
* @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
208
|
-
*/
|
|
209
|
-
type InferContractRouterInputs<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
210
|
-
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterInputs<T[K]> : never;
|
|
26
|
+
declare function minifyContractRouter(router: AnyContractRouter): AnyContractRouter;
|
|
27
|
+
type PopulatedContractRouterPaths<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrors, infer UMeta> ? ContractProcedure<UInputSchema, UOutputSchema, UErrors, UMeta> : {
|
|
28
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? PopulatedContractRouterPaths<T[K]> : never;
|
|
211
29
|
};
|
|
30
|
+
interface PopulateContractRouterPathsOptions {
|
|
31
|
+
path?: readonly string[];
|
|
32
|
+
}
|
|
212
33
|
/**
|
|
213
|
-
*
|
|
34
|
+
* Automatically populates missing route paths using the router's nested keys.
|
|
214
35
|
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*/
|
|
218
|
-
type InferContractRouterOutputs<T extends AnyContractRouter> = T extends ContractProcedure<any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
219
|
-
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterOutputs<T[K]> : never;
|
|
220
|
-
};
|
|
221
|
-
/**
|
|
222
|
-
* Infer all errors of the contract router.
|
|
36
|
+
* Constructs paths by joining router keys with `/`.
|
|
37
|
+
* Useful for NestJS integration that require explicit route paths.
|
|
223
38
|
*
|
|
224
|
-
* @
|
|
225
|
-
* @see {@link https://orpc.unnoq.com/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
39
|
+
* @see {@link https://orpc.dev/docs/openapi/integrations/implement-contract-in-nest#define-your-contract NestJS Implement Contract Docs}
|
|
226
40
|
*/
|
|
227
|
-
|
|
228
|
-
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterErrorMap<T[K]> : never;
|
|
229
|
-
}[keyof T];
|
|
230
|
-
type InferContractRouterMeta<T extends AnyContractRouter> = T extends ContractRouter<infer UMeta> ? UMeta : never;
|
|
231
|
-
|
|
232
|
-
declare function getContractRouter(router: AnyContractRouter, path: readonly string[]): AnyContractRouter | undefined;
|
|
233
|
-
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> : {
|
|
234
|
-
[K in keyof T]: T[K] extends AnyContractRouter ? EnhancedContractRouter<T[K], TErrorMap> : never;
|
|
235
|
-
};
|
|
236
|
-
interface EnhanceContractRouterOptions<TErrorMap extends ErrorMap> extends EnhanceRouteOptions {
|
|
237
|
-
errorMap: TErrorMap;
|
|
238
|
-
}
|
|
239
|
-
declare function enhanceContractRouter<T extends AnyContractRouter, TErrorMap extends ErrorMap>(router: T, options: EnhanceContractRouterOptions<TErrorMap>): EnhancedContractRouter<T, TErrorMap>;
|
|
41
|
+
declare function populateContractRouterPaths<T extends AnyContractRouter>(router: T, options?: PopulateContractRouterPathsOptions): PopulatedContractRouterPaths<T>;
|
|
240
42
|
|
|
241
43
|
interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
242
44
|
/**
|
|
243
45
|
* Adds type-safe custom errors to the contract.
|
|
244
46
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
245
47
|
*
|
|
246
|
-
* @see {@link https://orpc.
|
|
48
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
247
49
|
*/
|
|
248
50
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
249
51
|
/**
|
|
250
52
|
* Sets or updates the metadata for the contract.
|
|
251
53
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
252
54
|
*
|
|
253
|
-
* @see {@link https://orpc.
|
|
55
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
254
56
|
*/
|
|
255
57
|
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
256
58
|
/**
|
|
@@ -258,20 +60,20 @@ interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema
|
|
|
258
60
|
* The provided route is spared-merged with any existing route in the contract.
|
|
259
61
|
* This option is typically relevant when integrating with OpenAPI.
|
|
260
62
|
*
|
|
261
|
-
* @see {@link https://orpc.
|
|
262
|
-
* @see {@link https://orpc.
|
|
63
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
64
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
263
65
|
*/
|
|
264
66
|
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
265
67
|
/**
|
|
266
68
|
* Defines the input validation schema for the contract.
|
|
267
69
|
*
|
|
268
|
-
* @see {@link https://orpc.
|
|
70
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
269
71
|
*/
|
|
270
72
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
271
73
|
/**
|
|
272
74
|
* Defines the output validation schema for the contract.
|
|
273
75
|
*
|
|
274
|
-
* @see {@link https://orpc.
|
|
76
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
275
77
|
*/
|
|
276
78
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
277
79
|
}
|
|
@@ -280,14 +82,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
|
|
|
280
82
|
* Adds type-safe custom errors to the contract.
|
|
281
83
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
282
84
|
*
|
|
283
|
-
* @see {@link https://orpc.
|
|
85
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
284
86
|
*/
|
|
285
87
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
286
88
|
/**
|
|
287
89
|
* Sets or updates the metadata for the contract.
|
|
288
90
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
289
91
|
*
|
|
290
|
-
* @see {@link https://orpc.
|
|
92
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
291
93
|
*/
|
|
292
94
|
meta(meta: TMeta): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
293
95
|
/**
|
|
@@ -295,14 +97,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
|
|
|
295
97
|
* The provided route is spared-merged with any existing route in the contract.
|
|
296
98
|
* This option is typically relevant when integrating with OpenAPI.
|
|
297
99
|
*
|
|
298
|
-
* @see {@link https://orpc.
|
|
299
|
-
* @see {@link https://orpc.
|
|
100
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
101
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
300
102
|
*/
|
|
301
103
|
route(route: Route): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
302
104
|
/**
|
|
303
105
|
* Defines the output validation schema for the contract.
|
|
304
106
|
*
|
|
305
|
-
* @see {@link https://orpc.
|
|
107
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
306
108
|
*/
|
|
307
109
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
308
110
|
}
|
|
@@ -311,14 +113,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
|
|
|
311
113
|
* Adds type-safe custom errors to the contract.
|
|
312
114
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
313
115
|
*
|
|
314
|
-
* @see {@link https://orpc.
|
|
116
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
315
117
|
*/
|
|
316
118
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
317
119
|
/**
|
|
318
120
|
* Sets or updates the metadata for the contract.
|
|
319
121
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
320
122
|
*
|
|
321
|
-
* @see {@link https://orpc.
|
|
123
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
322
124
|
*/
|
|
323
125
|
meta(meta: TMeta): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
324
126
|
/**
|
|
@@ -326,14 +128,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
|
|
|
326
128
|
* The provided route is spared-merged with any existing route in the contract.
|
|
327
129
|
* This option is typically relevant when integrating with OpenAPI.
|
|
328
130
|
*
|
|
329
|
-
* @see {@link https://orpc.
|
|
330
|
-
* @see {@link https://orpc.
|
|
131
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
132
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
331
133
|
*/
|
|
332
134
|
route(route: Route): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
333
135
|
/**
|
|
334
136
|
* Defines the input validation schema for the contract.
|
|
335
137
|
*
|
|
336
|
-
* @see {@link https://orpc.
|
|
138
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
337
139
|
*/
|
|
338
140
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
339
141
|
}
|
|
@@ -342,14 +144,14 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
|
|
|
342
144
|
* Adds type-safe custom errors to the contract.
|
|
343
145
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
344
146
|
*
|
|
345
|
-
* @see {@link https://orpc.
|
|
147
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
346
148
|
*/
|
|
347
149
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
348
150
|
/**
|
|
349
151
|
* Sets or updates the metadata for the contract.
|
|
350
152
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
351
153
|
*
|
|
352
|
-
* @see {@link https://orpc.
|
|
154
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
353
155
|
*/
|
|
354
156
|
meta(meta: TMeta): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
355
157
|
/**
|
|
@@ -357,8 +159,8 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
|
|
|
357
159
|
* The provided route is spared-merged with any existing route in the contract.
|
|
358
160
|
* This option is typically relevant when integrating with OpenAPI.
|
|
359
161
|
*
|
|
360
|
-
* @see {@link https://orpc.
|
|
361
|
-
* @see {@link https://orpc.
|
|
162
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
163
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
362
164
|
*/
|
|
363
165
|
route(route: Route): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
364
166
|
}
|
|
@@ -371,7 +173,7 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
|
|
|
371
173
|
* Adds type-safe custom errors to the contract.
|
|
372
174
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
373
175
|
*
|
|
374
|
-
* @see {@link https://orpc.
|
|
176
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
375
177
|
*/
|
|
376
178
|
'errors'<U extends ErrorMap>(errors: U): ContractRouterBuilder<MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
377
179
|
/**
|
|
@@ -380,20 +182,20 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
|
|
|
380
182
|
*
|
|
381
183
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
382
184
|
*
|
|
383
|
-
* @see {@link https://orpc.
|
|
185
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
384
186
|
*/
|
|
385
187
|
'prefix'(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
386
188
|
/**
|
|
387
189
|
* Adds tags to all procedures in the contract router.
|
|
388
190
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
389
191
|
*
|
|
390
|
-
* @see {@link https://orpc.
|
|
192
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
391
193
|
*/
|
|
392
194
|
'tag'(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
393
195
|
/**
|
|
394
196
|
* Applies all of the previously defined options to the specified contract router.
|
|
395
197
|
*
|
|
396
|
-
* @see {@link https://orpc.
|
|
198
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
397
199
|
*/
|
|
398
200
|
'router'<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
|
|
399
201
|
}
|
|
@@ -409,29 +211,35 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
409
211
|
/**
|
|
410
212
|
* Sets or overrides the initial meta.
|
|
411
213
|
*
|
|
412
|
-
* @see {@link https://orpc.
|
|
214
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
413
215
|
*/
|
|
414
216
|
$meta<U extends Meta>(initialMeta: U): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, U & Record<never, never>>;
|
|
415
217
|
/**
|
|
416
218
|
* Sets or overrides the initial route.
|
|
417
219
|
* This option is typically relevant when integrating with OpenAPI.
|
|
418
220
|
*
|
|
419
|
-
* @see {@link https://orpc.
|
|
420
|
-
* @see {@link https://orpc.
|
|
221
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
222
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
421
223
|
*/
|
|
422
224
|
$route(initialRoute: Route): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
225
|
+
/**
|
|
226
|
+
* Sets or overrides the initial input schema.
|
|
227
|
+
*
|
|
228
|
+
* @see {@link https://orpc.dev/docs/procedure#initial-configuration Initial Procedure Configuration Docs}
|
|
229
|
+
*/
|
|
230
|
+
$input<U extends AnySchema>(initialInputSchema?: U): ContractBuilder<U, TOutputSchema, TErrorMap, TMeta>;
|
|
423
231
|
/**
|
|
424
232
|
* Adds type-safe custom errors to the contract.
|
|
425
233
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
426
234
|
*
|
|
427
|
-
* @see {@link https://orpc.
|
|
235
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
428
236
|
*/
|
|
429
237
|
errors<U extends ErrorMap>(errors: U): ContractBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
430
238
|
/**
|
|
431
239
|
* Sets or updates the metadata for the contract.
|
|
432
240
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
433
241
|
*
|
|
434
|
-
* @see {@link https://orpc.
|
|
242
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
435
243
|
*/
|
|
436
244
|
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
437
245
|
/**
|
|
@@ -439,20 +247,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
439
247
|
* The provided route is spared-merged with any existing route in the contract.
|
|
440
248
|
* This option is typically relevant when integrating with OpenAPI.
|
|
441
249
|
*
|
|
442
|
-
* @see {@link https://orpc.
|
|
443
|
-
* @see {@link https://orpc.
|
|
250
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
251
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
444
252
|
*/
|
|
445
253
|
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
446
254
|
/**
|
|
447
255
|
* Defines the input validation schema for the contract.
|
|
448
256
|
*
|
|
449
|
-
* @see {@link https://orpc.
|
|
257
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
450
258
|
*/
|
|
451
259
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
452
260
|
/**
|
|
453
261
|
* Defines the output validation schema for the contract.
|
|
454
262
|
*
|
|
455
|
-
* @see {@link https://orpc.
|
|
263
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
456
264
|
*/
|
|
457
265
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
458
266
|
/**
|
|
@@ -461,20 +269,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
461
269
|
*
|
|
462
270
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
463
271
|
*
|
|
464
|
-
* @see {@link https://orpc.
|
|
272
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
465
273
|
*/
|
|
466
274
|
prefix(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
467
275
|
/**
|
|
468
276
|
* Adds tags to all procedures in the contract router.
|
|
469
277
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
470
278
|
*
|
|
471
|
-
* @see {@link https://orpc.
|
|
279
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
472
280
|
*/
|
|
473
281
|
tag(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
474
282
|
/**
|
|
475
283
|
* Applies all of the previously defined options to the specified contract router.
|
|
476
284
|
*
|
|
477
|
-
* @see {@link https://orpc.
|
|
285
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
478
286
|
*/
|
|
479
287
|
router<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
|
|
480
288
|
}
|
|
@@ -496,16 +304,25 @@ interface EventIteratorSchemaDetails {
|
|
|
496
304
|
/**
|
|
497
305
|
* Define schema for an event iterator.
|
|
498
306
|
*
|
|
499
|
-
* @see {@link https://orpc.
|
|
307
|
+
* @see {@link https://orpc.dev/docs/event-iterator#validate-event-iterator Validate Event Iterator Docs}
|
|
500
308
|
*/
|
|
501
|
-
declare function eventIterator<TYieldIn, TYieldOut, TReturnIn = unknown, TReturnOut = unknown>(yields: Schema<TYieldIn, TYieldOut>, returns?: Schema<TReturnIn, TReturnOut>): Schema<AsyncIteratorObject<TYieldIn, TReturnIn, void>,
|
|
309
|
+
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>>;
|
|
502
310
|
declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): undefined | EventIteratorSchemaDetails;
|
|
503
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Help RPCLink automatically send requests using the specified HTTP method in the contract.
|
|
314
|
+
*
|
|
315
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link#custom-request-method RPCLink Custom Request Method}
|
|
316
|
+
*/
|
|
317
|
+
declare function inferRPCMethodFromContractRouter(contract: AnyContractRouter): (options: unknown, path: readonly string[]) => Exclude<HTTPMethod, 'HEAD'>;
|
|
318
|
+
|
|
504
319
|
type ContractProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
505
320
|
|
|
506
321
|
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> : {
|
|
507
322
|
[K in keyof TRouter]: TRouter[K] extends AnyContractRouter ? ContractRouterClient<TRouter[K], TClientContext> : never;
|
|
508
323
|
};
|
|
509
324
|
|
|
510
|
-
|
|
511
|
-
|
|
325
|
+
declare function isSchemaIssue(issue: unknown): issue is SchemaIssue;
|
|
326
|
+
|
|
327
|
+
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, populateContractRouterPaths };
|
|
328
|
+
export type { ContractBuilderDef, ContractConfig, ContractProcedureBuilder, ContractProcedureBuilderWithInput, ContractProcedureBuilderWithInputOutput, ContractProcedureBuilderWithOutput, ContractProcedureClient, ContractRouterBuilder, ContractRouterClient, EnhanceContractRouterOptions, EnhancedContractRouter, EventIteratorSchemaDetails, PopulateContractRouterPathsOptions, PopulatedContractRouterPaths };
|