@orpc/contract 1.12.0 → 1.12.1
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 +3 -3
- package/dist/index.d.mts +41 -41
- package/dist/index.d.ts +41 -41
- package/dist/index.mjs +12 -12
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/shared/{contract.CvRxURhn.d.mts → contract.TuRtB1Ca.d.mts} +18 -18
- package/dist/shared/{contract.CvRxURhn.d.ts → contract.TuRtB1Ca.d.ts} +18 -18
- package/package.json +4 -4
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>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
## Documentation
|
|
47
47
|
|
|
48
|
-
You can find the full documentation [here](https://orpc.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
49
49
|
|
|
50
50
|
## Packages
|
|
51
51
|
|
|
@@ -66,7 +66,7 @@ You can find the full documentation [here](https://orpc.unnoq.com).
|
|
|
66
66
|
|
|
67
67
|
## `@orpc/contract`
|
|
68
68
|
|
|
69
|
-
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.
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
72
|
export const PlanetSchema = z.object({
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTTPPath, HTTPMethod, ClientContext, Client } from '@orpc/client';
|
|
2
2
|
export { HTTPMethod, HTTPPath, ORPCError } from '@orpc/client';
|
|
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.
|
|
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.
|
|
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
5
|
import { AsyncIteratorClass } from '@orpc/shared';
|
|
6
6
|
export { AsyncIteratorClass, Registry, ThrowableError } from '@orpc/shared';
|
|
7
7
|
export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
|
|
@@ -21,7 +21,7 @@ declare function enhanceContractRouter<T extends AnyContractRouter, TErrorMap ex
|
|
|
21
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
22
|
* This reduces the size of the contract and helps prevent leaking internal details of the router to the client.
|
|
23
23
|
*
|
|
24
|
-
* @see {@link https://orpc.
|
|
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
25
|
*/
|
|
26
26
|
declare function minifyContractRouter(router: AnyContractRouter): AnyContractRouter;
|
|
27
27
|
|
|
@@ -30,14 +30,14 @@ interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema
|
|
|
30
30
|
* Adds type-safe custom errors to the contract.
|
|
31
31
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
32
32
|
*
|
|
33
|
-
* @see {@link https://orpc.
|
|
33
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
34
34
|
*/
|
|
35
35
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
36
36
|
/**
|
|
37
37
|
* Sets or updates the metadata for the contract.
|
|
38
38
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
39
39
|
*
|
|
40
|
-
* @see {@link https://orpc.
|
|
40
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
41
41
|
*/
|
|
42
42
|
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
43
43
|
/**
|
|
@@ -45,20 +45,20 @@ interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema
|
|
|
45
45
|
* The provided route is spared-merged with any existing route in the contract.
|
|
46
46
|
* This option is typically relevant when integrating with OpenAPI.
|
|
47
47
|
*
|
|
48
|
-
* @see {@link https://orpc.
|
|
49
|
-
* @see {@link https://orpc.
|
|
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}
|
|
50
50
|
*/
|
|
51
51
|
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
52
52
|
/**
|
|
53
53
|
* Defines the input validation schema for the contract.
|
|
54
54
|
*
|
|
55
|
-
* @see {@link https://orpc.
|
|
55
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
56
56
|
*/
|
|
57
57
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
58
58
|
/**
|
|
59
59
|
* Defines the output validation schema for the contract.
|
|
60
60
|
*
|
|
61
|
-
* @see {@link https://orpc.
|
|
61
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
62
62
|
*/
|
|
63
63
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
64
64
|
}
|
|
@@ -67,14 +67,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
|
|
|
67
67
|
* Adds type-safe custom errors to the contract.
|
|
68
68
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
69
69
|
*
|
|
70
|
-
* @see {@link https://orpc.
|
|
70
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
71
71
|
*/
|
|
72
72
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
73
73
|
/**
|
|
74
74
|
* Sets or updates the metadata for the contract.
|
|
75
75
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
76
76
|
*
|
|
77
|
-
* @see {@link https://orpc.
|
|
77
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
78
78
|
*/
|
|
79
79
|
meta(meta: TMeta): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
80
80
|
/**
|
|
@@ -82,14 +82,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
|
|
|
82
82
|
* The provided route is spared-merged with any existing route in the contract.
|
|
83
83
|
* This option is typically relevant when integrating with OpenAPI.
|
|
84
84
|
*
|
|
85
|
-
* @see {@link https://orpc.
|
|
86
|
-
* @see {@link https://orpc.
|
|
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}
|
|
87
87
|
*/
|
|
88
88
|
route(route: Route): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
89
89
|
/**
|
|
90
90
|
* Defines the output validation schema for the contract.
|
|
91
91
|
*
|
|
92
|
-
* @see {@link https://orpc.
|
|
92
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
93
93
|
*/
|
|
94
94
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
95
95
|
}
|
|
@@ -98,14 +98,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
|
|
|
98
98
|
* Adds type-safe custom errors to the contract.
|
|
99
99
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
100
100
|
*
|
|
101
|
-
* @see {@link https://orpc.
|
|
101
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
102
102
|
*/
|
|
103
103
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
104
104
|
/**
|
|
105
105
|
* Sets or updates the metadata for the contract.
|
|
106
106
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
107
107
|
*
|
|
108
|
-
* @see {@link https://orpc.
|
|
108
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
109
109
|
*/
|
|
110
110
|
meta(meta: TMeta): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
111
111
|
/**
|
|
@@ -113,14 +113,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
|
|
|
113
113
|
* The provided route is spared-merged with any existing route in the contract.
|
|
114
114
|
* This option is typically relevant when integrating with OpenAPI.
|
|
115
115
|
*
|
|
116
|
-
* @see {@link https://orpc.
|
|
117
|
-
* @see {@link https://orpc.
|
|
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}
|
|
118
118
|
*/
|
|
119
119
|
route(route: Route): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
120
120
|
/**
|
|
121
121
|
* Defines the input validation schema for the contract.
|
|
122
122
|
*
|
|
123
|
-
* @see {@link https://orpc.
|
|
123
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
124
124
|
*/
|
|
125
125
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
126
126
|
}
|
|
@@ -129,14 +129,14 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
|
|
|
129
129
|
* Adds type-safe custom errors to the contract.
|
|
130
130
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
131
131
|
*
|
|
132
|
-
* @see {@link https://orpc.
|
|
132
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
133
133
|
*/
|
|
134
134
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
135
135
|
/**
|
|
136
136
|
* Sets or updates the metadata for the contract.
|
|
137
137
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
138
138
|
*
|
|
139
|
-
* @see {@link https://orpc.
|
|
139
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
140
140
|
*/
|
|
141
141
|
meta(meta: TMeta): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
142
142
|
/**
|
|
@@ -144,8 +144,8 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
|
|
|
144
144
|
* The provided route is spared-merged with any existing route in the contract.
|
|
145
145
|
* This option is typically relevant when integrating with OpenAPI.
|
|
146
146
|
*
|
|
147
|
-
* @see {@link https://orpc.
|
|
148
|
-
* @see {@link https://orpc.
|
|
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}
|
|
149
149
|
*/
|
|
150
150
|
route(route: Route): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
151
151
|
}
|
|
@@ -158,7 +158,7 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
|
|
|
158
158
|
* Adds type-safe custom errors to the contract.
|
|
159
159
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
160
160
|
*
|
|
161
|
-
* @see {@link https://orpc.
|
|
161
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
162
162
|
*/
|
|
163
163
|
'errors'<U extends ErrorMap>(errors: U): ContractRouterBuilder<MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
164
164
|
/**
|
|
@@ -167,20 +167,20 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
|
|
|
167
167
|
*
|
|
168
168
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
169
169
|
*
|
|
170
|
-
* @see {@link https://orpc.
|
|
170
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
171
171
|
*/
|
|
172
172
|
'prefix'(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
173
173
|
/**
|
|
174
174
|
* Adds tags to all procedures in the contract router.
|
|
175
175
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
176
176
|
*
|
|
177
|
-
* @see {@link https://orpc.
|
|
177
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
178
178
|
*/
|
|
179
179
|
'tag'(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
180
180
|
/**
|
|
181
181
|
* Applies all of the previously defined options to the specified contract router.
|
|
182
182
|
*
|
|
183
|
-
* @see {@link https://orpc.
|
|
183
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
184
184
|
*/
|
|
185
185
|
'router'<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
|
|
186
186
|
}
|
|
@@ -196,29 +196,29 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
196
196
|
/**
|
|
197
197
|
* Sets or overrides the initial meta.
|
|
198
198
|
*
|
|
199
|
-
* @see {@link https://orpc.
|
|
199
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
200
200
|
*/
|
|
201
201
|
$meta<U extends Meta>(initialMeta: U): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, U & Record<never, never>>;
|
|
202
202
|
/**
|
|
203
203
|
* Sets or overrides the initial route.
|
|
204
204
|
* This option is typically relevant when integrating with OpenAPI.
|
|
205
205
|
*
|
|
206
|
-
* @see {@link https://orpc.
|
|
207
|
-
* @see {@link https://orpc.
|
|
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}
|
|
208
208
|
*/
|
|
209
209
|
$route(initialRoute: Route): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
210
210
|
/**
|
|
211
211
|
* Adds type-safe custom errors to the contract.
|
|
212
212
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
213
213
|
*
|
|
214
|
-
* @see {@link https://orpc.
|
|
214
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
215
215
|
*/
|
|
216
216
|
errors<U extends ErrorMap>(errors: U): ContractBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
217
217
|
/**
|
|
218
218
|
* Sets or updates the metadata for the contract.
|
|
219
219
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
220
220
|
*
|
|
221
|
-
* @see {@link https://orpc.
|
|
221
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
222
222
|
*/
|
|
223
223
|
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
224
224
|
/**
|
|
@@ -226,20 +226,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
226
226
|
* The provided route is spared-merged with any existing route in the contract.
|
|
227
227
|
* This option is typically relevant when integrating with OpenAPI.
|
|
228
228
|
*
|
|
229
|
-
* @see {@link https://orpc.
|
|
230
|
-
* @see {@link https://orpc.
|
|
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}
|
|
231
231
|
*/
|
|
232
232
|
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
233
233
|
/**
|
|
234
234
|
* Defines the input validation schema for the contract.
|
|
235
235
|
*
|
|
236
|
-
* @see {@link https://orpc.
|
|
236
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
237
237
|
*/
|
|
238
238
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
239
239
|
/**
|
|
240
240
|
* Defines the output validation schema for the contract.
|
|
241
241
|
*
|
|
242
|
-
* @see {@link https://orpc.
|
|
242
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
243
243
|
*/
|
|
244
244
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
245
245
|
/**
|
|
@@ -248,20 +248,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
248
248
|
*
|
|
249
249
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
250
250
|
*
|
|
251
|
-
* @see {@link https://orpc.
|
|
251
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
252
252
|
*/
|
|
253
253
|
prefix(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
254
254
|
/**
|
|
255
255
|
* Adds tags to all procedures in the contract router.
|
|
256
256
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
257
257
|
*
|
|
258
|
-
* @see {@link https://orpc.
|
|
258
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
259
259
|
*/
|
|
260
260
|
tag(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
261
261
|
/**
|
|
262
262
|
* Applies all of the previously defined options to the specified contract router.
|
|
263
263
|
*
|
|
264
|
-
* @see {@link https://orpc.
|
|
264
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
265
265
|
*/
|
|
266
266
|
router<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
|
|
267
267
|
}
|
|
@@ -283,7 +283,7 @@ interface EventIteratorSchemaDetails {
|
|
|
283
283
|
/**
|
|
284
284
|
* Define schema for an event iterator.
|
|
285
285
|
*
|
|
286
|
-
* @see {@link https://orpc.
|
|
286
|
+
* @see {@link https://orpc.dev/docs/event-iterator#validate-event-iterator Validate Event Iterator Docs}
|
|
287
287
|
*/
|
|
288
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>>;
|
|
289
289
|
declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): undefined | EventIteratorSchemaDetails;
|
|
@@ -291,7 +291,7 @@ declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): u
|
|
|
291
291
|
/**
|
|
292
292
|
* Help RPCLink automatically send requests using the specified HTTP method in the contract.
|
|
293
293
|
*
|
|
294
|
-
* @see {@link https://orpc.
|
|
294
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link#custom-request-method RPCLink Custom Request Method}
|
|
295
295
|
*/
|
|
296
296
|
declare function inferRPCMethodFromContractRouter(contract: AnyContractRouter): (options: unknown, path: readonly string[]) => Exclude<HTTPMethod, 'HEAD'>;
|
|
297
297
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTTPPath, HTTPMethod, ClientContext, Client } from '@orpc/client';
|
|
2
2
|
export { HTTPMethod, HTTPPath, ORPCError } from '@orpc/client';
|
|
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.
|
|
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.
|
|
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.js';
|
|
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.js';
|
|
5
5
|
import { AsyncIteratorClass } from '@orpc/shared';
|
|
6
6
|
export { AsyncIteratorClass, Registry, ThrowableError } from '@orpc/shared';
|
|
7
7
|
export { OpenAPIV3_1 as OpenAPI } from 'openapi-types';
|
|
@@ -21,7 +21,7 @@ declare function enhanceContractRouter<T extends AnyContractRouter, TErrorMap ex
|
|
|
21
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
22
|
* This reduces the size of the contract and helps prevent leaking internal details of the router to the client.
|
|
23
23
|
*
|
|
24
|
-
* @see {@link https://orpc.
|
|
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
25
|
*/
|
|
26
26
|
declare function minifyContractRouter(router: AnyContractRouter): AnyContractRouter;
|
|
27
27
|
|
|
@@ -30,14 +30,14 @@ interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema
|
|
|
30
30
|
* Adds type-safe custom errors to the contract.
|
|
31
31
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
32
32
|
*
|
|
33
|
-
* @see {@link https://orpc.
|
|
33
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
34
34
|
*/
|
|
35
35
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
36
36
|
/**
|
|
37
37
|
* Sets or updates the metadata for the contract.
|
|
38
38
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
39
39
|
*
|
|
40
|
-
* @see {@link https://orpc.
|
|
40
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
41
41
|
*/
|
|
42
42
|
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
43
43
|
/**
|
|
@@ -45,20 +45,20 @@ interface ContractProcedureBuilder<TInputSchema extends AnySchema, TOutputSchema
|
|
|
45
45
|
* The provided route is spared-merged with any existing route in the contract.
|
|
46
46
|
* This option is typically relevant when integrating with OpenAPI.
|
|
47
47
|
*
|
|
48
|
-
* @see {@link https://orpc.
|
|
49
|
-
* @see {@link https://orpc.
|
|
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}
|
|
50
50
|
*/
|
|
51
51
|
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
52
52
|
/**
|
|
53
53
|
* Defines the input validation schema for the contract.
|
|
54
54
|
*
|
|
55
|
-
* @see {@link https://orpc.
|
|
55
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
56
56
|
*/
|
|
57
57
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
58
58
|
/**
|
|
59
59
|
* Defines the output validation schema for the contract.
|
|
60
60
|
*
|
|
61
|
-
* @see {@link https://orpc.
|
|
61
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
62
62
|
*/
|
|
63
63
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
64
64
|
}
|
|
@@ -67,14 +67,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
|
|
|
67
67
|
* Adds type-safe custom errors to the contract.
|
|
68
68
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
69
69
|
*
|
|
70
|
-
* @see {@link https://orpc.
|
|
70
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
71
71
|
*/
|
|
72
72
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
73
73
|
/**
|
|
74
74
|
* Sets or updates the metadata for the contract.
|
|
75
75
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
76
76
|
*
|
|
77
|
-
* @see {@link https://orpc.
|
|
77
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
78
78
|
*/
|
|
79
79
|
meta(meta: TMeta): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
80
80
|
/**
|
|
@@ -82,14 +82,14 @@ interface ContractProcedureBuilderWithInput<TInputSchema extends AnySchema, TOut
|
|
|
82
82
|
* The provided route is spared-merged with any existing route in the contract.
|
|
83
83
|
* This option is typically relevant when integrating with OpenAPI.
|
|
84
84
|
*
|
|
85
|
-
* @see {@link https://orpc.
|
|
86
|
-
* @see {@link https://orpc.
|
|
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}
|
|
87
87
|
*/
|
|
88
88
|
route(route: Route): ContractProcedureBuilderWithInput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
89
89
|
/**
|
|
90
90
|
* Defines the output validation schema for the contract.
|
|
91
91
|
*
|
|
92
|
-
* @see {@link https://orpc.
|
|
92
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
93
93
|
*/
|
|
94
94
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
95
95
|
}
|
|
@@ -98,14 +98,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
|
|
|
98
98
|
* Adds type-safe custom errors to the contract.
|
|
99
99
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
100
100
|
*
|
|
101
|
-
* @see {@link https://orpc.
|
|
101
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
102
102
|
*/
|
|
103
103
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
104
104
|
/**
|
|
105
105
|
* Sets or updates the metadata for the contract.
|
|
106
106
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
107
107
|
*
|
|
108
|
-
* @see {@link https://orpc.
|
|
108
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
109
109
|
*/
|
|
110
110
|
meta(meta: TMeta): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
111
111
|
/**
|
|
@@ -113,14 +113,14 @@ interface ContractProcedureBuilderWithOutput<TInputSchema extends AnySchema, TOu
|
|
|
113
113
|
* The provided route is spared-merged with any existing route in the contract.
|
|
114
114
|
* This option is typically relevant when integrating with OpenAPI.
|
|
115
115
|
*
|
|
116
|
-
* @see {@link https://orpc.
|
|
117
|
-
* @see {@link https://orpc.
|
|
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}
|
|
118
118
|
*/
|
|
119
119
|
route(route: Route): ContractProcedureBuilderWithOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
120
120
|
/**
|
|
121
121
|
* Defines the input validation schema for the contract.
|
|
122
122
|
*
|
|
123
|
-
* @see {@link https://orpc.
|
|
123
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
124
124
|
*/
|
|
125
125
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInputOutput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
126
126
|
}
|
|
@@ -129,14 +129,14 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
|
|
|
129
129
|
* Adds type-safe custom errors to the contract.
|
|
130
130
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
131
131
|
*
|
|
132
|
-
* @see {@link https://orpc.
|
|
132
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
133
133
|
*/
|
|
134
134
|
errors<U extends ErrorMap>(errors: U): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
135
135
|
/**
|
|
136
136
|
* Sets or updates the metadata for the contract.
|
|
137
137
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
138
138
|
*
|
|
139
|
-
* @see {@link https://orpc.
|
|
139
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
140
140
|
*/
|
|
141
141
|
meta(meta: TMeta): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
142
142
|
/**
|
|
@@ -144,8 +144,8 @@ interface ContractProcedureBuilderWithInputOutput<TInputSchema extends AnySchema
|
|
|
144
144
|
* The provided route is spared-merged with any existing route in the contract.
|
|
145
145
|
* This option is typically relevant when integrating with OpenAPI.
|
|
146
146
|
*
|
|
147
|
-
* @see {@link https://orpc.
|
|
148
|
-
* @see {@link https://orpc.
|
|
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}
|
|
149
149
|
*/
|
|
150
150
|
route(route: Route): ContractProcedureBuilderWithInputOutput<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
151
151
|
}
|
|
@@ -158,7 +158,7 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
|
|
|
158
158
|
* Adds type-safe custom errors to the contract.
|
|
159
159
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
160
160
|
*
|
|
161
|
-
* @see {@link https://orpc.
|
|
161
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
162
162
|
*/
|
|
163
163
|
'errors'<U extends ErrorMap>(errors: U): ContractRouterBuilder<MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
164
164
|
/**
|
|
@@ -167,20 +167,20 @@ interface ContractRouterBuilder<TErrorMap extends ErrorMap, TMeta extends Meta>
|
|
|
167
167
|
*
|
|
168
168
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
169
169
|
*
|
|
170
|
-
* @see {@link https://orpc.
|
|
170
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
171
171
|
*/
|
|
172
172
|
'prefix'(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
173
173
|
/**
|
|
174
174
|
* Adds tags to all procedures in the contract router.
|
|
175
175
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
176
176
|
*
|
|
177
|
-
* @see {@link https://orpc.
|
|
177
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
178
178
|
*/
|
|
179
179
|
'tag'(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
180
180
|
/**
|
|
181
181
|
* Applies all of the previously defined options to the specified contract router.
|
|
182
182
|
*
|
|
183
|
-
* @see {@link https://orpc.
|
|
183
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
184
184
|
*/
|
|
185
185
|
'router'<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
|
|
186
186
|
}
|
|
@@ -196,29 +196,29 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
196
196
|
/**
|
|
197
197
|
* Sets or overrides the initial meta.
|
|
198
198
|
*
|
|
199
|
-
* @see {@link https://orpc.
|
|
199
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
200
200
|
*/
|
|
201
201
|
$meta<U extends Meta>(initialMeta: U): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, U & Record<never, never>>;
|
|
202
202
|
/**
|
|
203
203
|
* Sets or overrides the initial route.
|
|
204
204
|
* This option is typically relevant when integrating with OpenAPI.
|
|
205
205
|
*
|
|
206
|
-
* @see {@link https://orpc.
|
|
207
|
-
* @see {@link https://orpc.
|
|
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}
|
|
208
208
|
*/
|
|
209
209
|
$route(initialRoute: Route): ContractBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
210
210
|
/**
|
|
211
211
|
* Adds type-safe custom errors to the contract.
|
|
212
212
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
213
213
|
*
|
|
214
|
-
* @see {@link https://orpc.
|
|
214
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
215
215
|
*/
|
|
216
216
|
errors<U extends ErrorMap>(errors: U): ContractBuilder<TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
217
217
|
/**
|
|
218
218
|
* Sets or updates the metadata for the contract.
|
|
219
219
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
220
220
|
*
|
|
221
|
-
* @see {@link https://orpc.
|
|
221
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
222
222
|
*/
|
|
223
223
|
meta(meta: TMeta): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
224
224
|
/**
|
|
@@ -226,20 +226,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
226
226
|
* The provided route is spared-merged with any existing route in the contract.
|
|
227
227
|
* This option is typically relevant when integrating with OpenAPI.
|
|
228
228
|
*
|
|
229
|
-
* @see {@link https://orpc.
|
|
230
|
-
* @see {@link https://orpc.
|
|
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}
|
|
231
231
|
*/
|
|
232
232
|
route(route: Route): ContractProcedureBuilder<TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
233
233
|
/**
|
|
234
234
|
* Defines the input validation schema for the contract.
|
|
235
235
|
*
|
|
236
|
-
* @see {@link https://orpc.
|
|
236
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
237
237
|
*/
|
|
238
238
|
input<U extends AnySchema>(schema: U): ContractProcedureBuilderWithInput<U, TOutputSchema, TErrorMap, TMeta>;
|
|
239
239
|
/**
|
|
240
240
|
* Defines the output validation schema for the contract.
|
|
241
241
|
*
|
|
242
|
-
* @see {@link https://orpc.
|
|
242
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
243
243
|
*/
|
|
244
244
|
output<U extends AnySchema>(schema: U): ContractProcedureBuilderWithOutput<TInputSchema, U, TErrorMap, TMeta>;
|
|
245
245
|
/**
|
|
@@ -248,20 +248,20 @@ declare class ContractBuilder<TInputSchema extends AnySchema, TOutputSchema exte
|
|
|
248
248
|
*
|
|
249
249
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
250
250
|
*
|
|
251
|
-
* @see {@link https://orpc.
|
|
251
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
252
252
|
*/
|
|
253
253
|
prefix(prefix: HTTPPath): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
254
254
|
/**
|
|
255
255
|
* Adds tags to all procedures in the contract router.
|
|
256
256
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
257
257
|
*
|
|
258
|
-
* @see {@link https://orpc.
|
|
258
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
259
259
|
*/
|
|
260
260
|
tag(...tags: string[]): ContractRouterBuilder<TErrorMap, TMeta>;
|
|
261
261
|
/**
|
|
262
262
|
* Applies all of the previously defined options to the specified contract router.
|
|
263
263
|
*
|
|
264
|
-
* @see {@link https://orpc.
|
|
264
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
265
265
|
*/
|
|
266
266
|
router<T extends ContractRouter<TMeta>>(router: T): EnhancedContractRouter<T, TErrorMap>;
|
|
267
267
|
}
|
|
@@ -283,7 +283,7 @@ interface EventIteratorSchemaDetails {
|
|
|
283
283
|
/**
|
|
284
284
|
* Define schema for an event iterator.
|
|
285
285
|
*
|
|
286
|
-
* @see {@link https://orpc.
|
|
286
|
+
* @see {@link https://orpc.dev/docs/event-iterator#validate-event-iterator Validate Event Iterator Docs}
|
|
287
287
|
*/
|
|
288
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>>;
|
|
289
289
|
declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): undefined | EventIteratorSchemaDetails;
|
|
@@ -291,7 +291,7 @@ declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): u
|
|
|
291
291
|
/**
|
|
292
292
|
* Help RPCLink automatically send requests using the specified HTTP method in the contract.
|
|
293
293
|
*
|
|
294
|
-
* @see {@link https://orpc.
|
|
294
|
+
* @see {@link https://orpc.dev/docs/client/rpc-link#custom-request-method RPCLink Custom Request Method}
|
|
295
295
|
*/
|
|
296
296
|
declare function inferRPCMethodFromContractRouter(contract: AnyContractRouter): (options: unknown, path: readonly string[]) => Exclude<HTTPMethod, 'HEAD'>;
|
|
297
297
|
|
package/dist/index.mjs
CHANGED
|
@@ -100,7 +100,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
100
100
|
/**
|
|
101
101
|
* Sets or overrides the initial meta.
|
|
102
102
|
*
|
|
103
|
-
* @see {@link https://orpc.
|
|
103
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
104
104
|
*/
|
|
105
105
|
$meta(initialMeta) {
|
|
106
106
|
return new ContractBuilder({
|
|
@@ -112,8 +112,8 @@ class ContractBuilder extends ContractProcedure {
|
|
|
112
112
|
* Sets or overrides the initial route.
|
|
113
113
|
* This option is typically relevant when integrating with OpenAPI.
|
|
114
114
|
*
|
|
115
|
-
* @see {@link https://orpc.
|
|
116
|
-
* @see {@link https://orpc.
|
|
115
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
116
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
117
117
|
*/
|
|
118
118
|
$route(initialRoute) {
|
|
119
119
|
return new ContractBuilder({
|
|
@@ -125,7 +125,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
125
125
|
* Adds type-safe custom errors to the contract.
|
|
126
126
|
* The provided errors are spared-merged with any existing errors in the contract.
|
|
127
127
|
*
|
|
128
|
-
* @see {@link https://orpc.
|
|
128
|
+
* @see {@link https://orpc.dev/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
129
129
|
*/
|
|
130
130
|
errors(errors) {
|
|
131
131
|
return new ContractBuilder({
|
|
@@ -137,7 +137,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
137
137
|
* Sets or updates the metadata for the contract.
|
|
138
138
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
139
139
|
*
|
|
140
|
-
* @see {@link https://orpc.
|
|
140
|
+
* @see {@link https://orpc.dev/docs/metadata Metadata Docs}
|
|
141
141
|
*/
|
|
142
142
|
meta(meta) {
|
|
143
143
|
return new ContractBuilder({
|
|
@@ -150,8 +150,8 @@ class ContractBuilder extends ContractProcedure {
|
|
|
150
150
|
* The provided route is spared-merged with any existing route in the contract.
|
|
151
151
|
* This option is typically relevant when integrating with OpenAPI.
|
|
152
152
|
*
|
|
153
|
-
* @see {@link https://orpc.
|
|
154
|
-
* @see {@link https://orpc.
|
|
153
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
154
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
155
155
|
*/
|
|
156
156
|
route(route) {
|
|
157
157
|
return new ContractBuilder({
|
|
@@ -162,7 +162,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
162
162
|
/**
|
|
163
163
|
* Defines the input validation schema for the contract.
|
|
164
164
|
*
|
|
165
|
-
* @see {@link https://orpc.
|
|
165
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Input Validation Docs}
|
|
166
166
|
*/
|
|
167
167
|
input(schema) {
|
|
168
168
|
return new ContractBuilder({
|
|
@@ -173,7 +173,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
173
173
|
/**
|
|
174
174
|
* Defines the output validation schema for the contract.
|
|
175
175
|
*
|
|
176
|
-
* @see {@link https://orpc.
|
|
176
|
+
* @see {@link https://orpc.dev/docs/procedure#input-output-validation Output Validation Docs}
|
|
177
177
|
*/
|
|
178
178
|
output(schema) {
|
|
179
179
|
return new ContractBuilder({
|
|
@@ -187,7 +187,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
187
187
|
*
|
|
188
188
|
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
189
189
|
*
|
|
190
|
-
* @see {@link https://orpc.
|
|
190
|
+
* @see {@link https://orpc.dev/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
191
191
|
*/
|
|
192
192
|
prefix(prefix) {
|
|
193
193
|
return new ContractBuilder({
|
|
@@ -199,7 +199,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
199
199
|
* Adds tags to all procedures in the contract router.
|
|
200
200
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
201
201
|
*
|
|
202
|
-
* @see {@link https://orpc.
|
|
202
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
203
203
|
*/
|
|
204
204
|
tag(...tags) {
|
|
205
205
|
return new ContractBuilder({
|
|
@@ -210,7 +210,7 @@ class ContractBuilder extends ContractProcedure {
|
|
|
210
210
|
/**
|
|
211
211
|
* Applies all of the previously defined options to the specified contract router.
|
|
212
212
|
*
|
|
213
|
-
* @see {@link https://orpc.
|
|
213
|
+
* @see {@link https://orpc.dev/docs/router#extending-router Extending Router Docs}
|
|
214
214
|
*/
|
|
215
215
|
router(router) {
|
|
216
216
|
return enhanceContractRouter(router, this["~orpc"]);
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
2
|
import { StandardLinkPlugin, StandardLinkOptions } from '@orpc/client/standard';
|
|
3
|
-
import { A as AnyContractRouter } from '../shared/contract.
|
|
3
|
+
import { A as AnyContractRouter } from '../shared/contract.TuRtB1Ca.mjs';
|
|
4
4
|
import '@orpc/shared';
|
|
5
5
|
import '@standard-schema/spec';
|
|
6
6
|
import 'openapi-types';
|
|
@@ -12,7 +12,7 @@ declare class RequestValidationPluginError extends Error {
|
|
|
12
12
|
* ensuring that data sent to your server matches the expected types defined in your contract.
|
|
13
13
|
*
|
|
14
14
|
* @throws {ORPCError} with code `BAD_REQUEST` (same as server side) if input doesn't match the expected schema
|
|
15
|
-
* @see {@link https://orpc.
|
|
15
|
+
* @see {@link https://orpc.dev/docs/plugins/request-validation Request Validation Plugin Docs}
|
|
16
16
|
*/
|
|
17
17
|
declare class RequestValidationPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
18
18
|
private readonly contract;
|
|
@@ -27,7 +27,7 @@ declare class RequestValidationPlugin<T extends ClientContext> implements Standa
|
|
|
27
27
|
* - Throws `ValidationError` if output doesn't match the expected schema
|
|
28
28
|
* - Converts mismatched defined errors to normal `ORPCError` instances
|
|
29
29
|
*
|
|
30
|
-
* @see {@link https://orpc.
|
|
30
|
+
* @see {@link https://orpc.dev/docs/plugins/response-validation Response Validation Plugin Docs}
|
|
31
31
|
*/
|
|
32
32
|
declare class ResponseValidationPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
33
33
|
private readonly contract;
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientContext } from '@orpc/client';
|
|
2
2
|
import { StandardLinkPlugin, StandardLinkOptions } from '@orpc/client/standard';
|
|
3
|
-
import { A as AnyContractRouter } from '../shared/contract.
|
|
3
|
+
import { A as AnyContractRouter } from '../shared/contract.TuRtB1Ca.js';
|
|
4
4
|
import '@orpc/shared';
|
|
5
5
|
import '@standard-schema/spec';
|
|
6
6
|
import 'openapi-types';
|
|
@@ -12,7 +12,7 @@ declare class RequestValidationPluginError extends Error {
|
|
|
12
12
|
* ensuring that data sent to your server matches the expected types defined in your contract.
|
|
13
13
|
*
|
|
14
14
|
* @throws {ORPCError} with code `BAD_REQUEST` (same as server side) if input doesn't match the expected schema
|
|
15
|
-
* @see {@link https://orpc.
|
|
15
|
+
* @see {@link https://orpc.dev/docs/plugins/request-validation Request Validation Plugin Docs}
|
|
16
16
|
*/
|
|
17
17
|
declare class RequestValidationPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
18
18
|
private readonly contract;
|
|
@@ -27,7 +27,7 @@ declare class RequestValidationPlugin<T extends ClientContext> implements Standa
|
|
|
27
27
|
* - Throws `ValidationError` if output doesn't match the expected schema
|
|
28
28
|
* - Converts mismatched defined errors to normal `ORPCError` instances
|
|
29
29
|
*
|
|
30
|
-
* @see {@link https://orpc.
|
|
30
|
+
* @see {@link https://orpc.dev/docs/plugins/response-validation Response Validation Plugin Docs}
|
|
31
31
|
*/
|
|
32
32
|
declare class ResponseValidationPlugin<T extends ClientContext> implements StandardLinkPlugin<T> {
|
|
33
33
|
private readonly contract;
|
|
@@ -13,7 +13,7 @@ type TypeRest<TInput, TOutput> = [map: (input: TInput) => Promisable<TOutput>] |
|
|
|
13
13
|
* The schema for things can be trust without validation.
|
|
14
14
|
* If the TInput and TOutput are different, you need pass a map function.
|
|
15
15
|
*
|
|
16
|
-
* @see {@link https://orpc.
|
|
16
|
+
* @see {@link https://orpc.dev/docs/procedure#type-utility Type Utility Docs}
|
|
17
17
|
*/
|
|
18
18
|
declare function type<TInput, TOutput = TInput>(...[map]: TypeRest<TInput, TOutput>): Schema<TInput, TOutput>;
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ interface ValidationErrorOptions extends ErrorOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* This errors usually used for ORPCError.cause when the error is a validation error.
|
|
30
30
|
*
|
|
31
|
-
* @see {@link https://orpc.
|
|
31
|
+
* @see {@link https://orpc.dev/docs/advanced/validation-errors Validation Errors Docs}
|
|
32
32
|
*/
|
|
33
33
|
declare class ValidationError extends Error {
|
|
34
34
|
readonly issues: readonly SchemaIssue[];
|
|
@@ -61,14 +61,14 @@ interface Route {
|
|
|
61
61
|
* The HTTP method of the procedure.
|
|
62
62
|
* This option is typically relevant when integrating with OpenAPI.
|
|
63
63
|
*
|
|
64
|
-
* @see {@link https://orpc.
|
|
64
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
65
65
|
*/
|
|
66
66
|
method?: HTTPMethod;
|
|
67
67
|
/**
|
|
68
68
|
* The HTTP path of the procedure.
|
|
69
69
|
* This option is typically relevant when integrating with OpenAPI.
|
|
70
70
|
*
|
|
71
|
-
* @see {@link https://orpc.
|
|
71
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
72
72
|
*/
|
|
73
73
|
path?: HTTPPath;
|
|
74
74
|
/**
|
|
@@ -82,28 +82,28 @@ interface Route {
|
|
|
82
82
|
* The summary of the procedure.
|
|
83
83
|
* This option is typically relevant when integrating with OpenAPI.
|
|
84
84
|
*
|
|
85
|
-
* @see {@link https://orpc.
|
|
85
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
86
86
|
*/
|
|
87
87
|
summary?: string;
|
|
88
88
|
/**
|
|
89
89
|
* The description of the procedure.
|
|
90
90
|
* This option is typically relevant when integrating with OpenAPI.
|
|
91
91
|
*
|
|
92
|
-
* @see {@link https://orpc.
|
|
92
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
93
93
|
*/
|
|
94
94
|
description?: string;
|
|
95
95
|
/**
|
|
96
96
|
* Marks the procedure as deprecated.
|
|
97
97
|
* This option is typically relevant when integrating with OpenAPI.
|
|
98
98
|
*
|
|
99
|
-
* @see {@link https://orpc.
|
|
99
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
100
100
|
*/
|
|
101
101
|
deprecated?: boolean;
|
|
102
102
|
/**
|
|
103
103
|
* The tags of the procedure.
|
|
104
104
|
* This option is typically relevant when integrating with OpenAPI.
|
|
105
105
|
*
|
|
106
|
-
* @see {@link https://orpc.
|
|
106
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
107
107
|
*/
|
|
108
108
|
tags?: readonly string[];
|
|
109
109
|
/**
|
|
@@ -111,7 +111,7 @@ interface Route {
|
|
|
111
111
|
* The status code must be in the 200-399 range.
|
|
112
112
|
* This option is typically relevant when integrating with OpenAPI.
|
|
113
113
|
*
|
|
114
|
-
* @see {@link https://orpc.
|
|
114
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
115
115
|
* @default 200
|
|
116
116
|
*/
|
|
117
117
|
successStatus?: number;
|
|
@@ -119,7 +119,7 @@ interface Route {
|
|
|
119
119
|
* The description of the response when the procedure is successful.
|
|
120
120
|
* This option is typically relevant when integrating with OpenAPI.
|
|
121
121
|
*
|
|
122
|
-
* @see {@link https://orpc.
|
|
122
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
123
123
|
* @default 'OK'
|
|
124
124
|
*/
|
|
125
125
|
successDescription?: string;
|
|
@@ -142,7 +142,7 @@ interface Route {
|
|
|
142
142
|
* }
|
|
143
143
|
* ```
|
|
144
144
|
*
|
|
145
|
-
* @see {@link https://orpc.
|
|
145
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
146
146
|
* @default 'compact'
|
|
147
147
|
*/
|
|
148
148
|
inputStructure?: InputStructure;
|
|
@@ -167,14 +167,14 @@ interface Route {
|
|
|
167
167
|
* };
|
|
168
168
|
* ```
|
|
169
169
|
*
|
|
170
|
-
* @see {@link https://orpc.
|
|
170
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
171
171
|
* @default 'compact'
|
|
172
172
|
*/
|
|
173
173
|
outputStructure?: OutputStructure;
|
|
174
174
|
/**
|
|
175
175
|
* Override entire auto-generated OpenAPI Operation Object Specification.
|
|
176
176
|
*
|
|
177
|
-
* @see {@link https://orpc.
|
|
177
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata Operation Metadata Docs}
|
|
178
178
|
*/
|
|
179
179
|
spec?: OpenAPIV3_1.OperationObject | ((current: OpenAPIV3_1.OperationObject) => OpenAPIV3_1.OperationObject);
|
|
180
180
|
}
|
|
@@ -199,7 +199,7 @@ interface ContractProcedureDef<TInputSchema extends AnySchema, TOutputSchema ext
|
|
|
199
199
|
/**
|
|
200
200
|
* This class represents a contract procedure.
|
|
201
201
|
*
|
|
202
|
-
* @see {@link https://orpc.
|
|
202
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#procedure-contract Contract Procedure Docs}
|
|
203
203
|
*/
|
|
204
204
|
declare class ContractProcedure<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
205
205
|
/**
|
|
@@ -215,7 +215,7 @@ declare function isContractProcedure(item: unknown): item is AnyContractProcedur
|
|
|
215
215
|
* Represents a contract router, which defines a hierarchical structure of contract procedures.
|
|
216
216
|
*
|
|
217
217
|
* @info A contract procedure is a contract router too.
|
|
218
|
-
* @see {@link https://orpc.
|
|
218
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
219
219
|
*/
|
|
220
220
|
type ContractRouter<TMeta extends Meta> = ContractProcedure<any, any, any, TMeta> | {
|
|
221
221
|
[k: string]: ContractRouter<TMeta>;
|
|
@@ -225,7 +225,7 @@ type AnyContractRouter = ContractRouter<any>;
|
|
|
225
225
|
* Infer all inputs of the contract router.
|
|
226
226
|
*
|
|
227
227
|
* @info A contract procedure is a contract router too.
|
|
228
|
-
* @see {@link https://orpc.
|
|
228
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
229
229
|
*/
|
|
230
230
|
type InferContractRouterInputs<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
231
231
|
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterInputs<T[K]> : never;
|
|
@@ -234,7 +234,7 @@ type InferContractRouterInputs<T extends AnyContractRouter> = T extends Contract
|
|
|
234
234
|
* Infer all outputs of the contract router.
|
|
235
235
|
*
|
|
236
236
|
* @info A contract procedure is a contract router too.
|
|
237
|
-
* @see {@link https://orpc.
|
|
237
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
238
238
|
*/
|
|
239
239
|
type InferContractRouterOutputs<T extends AnyContractRouter> = T extends ContractProcedure<any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
240
240
|
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterOutputs<T[K]> : never;
|
|
@@ -243,7 +243,7 @@ type InferContractRouterOutputs<T extends AnyContractRouter> = T extends Contrac
|
|
|
243
243
|
* Infer all errors of the contract router.
|
|
244
244
|
*
|
|
245
245
|
* @info A contract procedure is a contract router too.
|
|
246
|
-
* @see {@link https://orpc.
|
|
246
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
247
247
|
*/
|
|
248
248
|
type InferContractRouterErrorMap<T extends AnyContractRouter> = T extends ContractProcedure<any, any, infer UErrorMap, any> ? UErrorMap : {
|
|
249
249
|
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterErrorMap<T[K]> : never;
|
|
@@ -13,7 +13,7 @@ type TypeRest<TInput, TOutput> = [map: (input: TInput) => Promisable<TOutput>] |
|
|
|
13
13
|
* The schema for things can be trust without validation.
|
|
14
14
|
* If the TInput and TOutput are different, you need pass a map function.
|
|
15
15
|
*
|
|
16
|
-
* @see {@link https://orpc.
|
|
16
|
+
* @see {@link https://orpc.dev/docs/procedure#type-utility Type Utility Docs}
|
|
17
17
|
*/
|
|
18
18
|
declare function type<TInput, TOutput = TInput>(...[map]: TypeRest<TInput, TOutput>): Schema<TInput, TOutput>;
|
|
19
19
|
|
|
@@ -28,7 +28,7 @@ interface ValidationErrorOptions extends ErrorOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* This errors usually used for ORPCError.cause when the error is a validation error.
|
|
30
30
|
*
|
|
31
|
-
* @see {@link https://orpc.
|
|
31
|
+
* @see {@link https://orpc.dev/docs/advanced/validation-errors Validation Errors Docs}
|
|
32
32
|
*/
|
|
33
33
|
declare class ValidationError extends Error {
|
|
34
34
|
readonly issues: readonly SchemaIssue[];
|
|
@@ -61,14 +61,14 @@ interface Route {
|
|
|
61
61
|
* The HTTP method of the procedure.
|
|
62
62
|
* This option is typically relevant when integrating with OpenAPI.
|
|
63
63
|
*
|
|
64
|
-
* @see {@link https://orpc.
|
|
64
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
65
65
|
*/
|
|
66
66
|
method?: HTTPMethod;
|
|
67
67
|
/**
|
|
68
68
|
* The HTTP path of the procedure.
|
|
69
69
|
* This option is typically relevant when integrating with OpenAPI.
|
|
70
70
|
*
|
|
71
|
-
* @see {@link https://orpc.
|
|
71
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
72
72
|
*/
|
|
73
73
|
path?: HTTPPath;
|
|
74
74
|
/**
|
|
@@ -82,28 +82,28 @@ interface Route {
|
|
|
82
82
|
* The summary of the procedure.
|
|
83
83
|
* This option is typically relevant when integrating with OpenAPI.
|
|
84
84
|
*
|
|
85
|
-
* @see {@link https://orpc.
|
|
85
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
86
86
|
*/
|
|
87
87
|
summary?: string;
|
|
88
88
|
/**
|
|
89
89
|
* The description of the procedure.
|
|
90
90
|
* This option is typically relevant when integrating with OpenAPI.
|
|
91
91
|
*
|
|
92
|
-
* @see {@link https://orpc.
|
|
92
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
93
93
|
*/
|
|
94
94
|
description?: string;
|
|
95
95
|
/**
|
|
96
96
|
* Marks the procedure as deprecated.
|
|
97
97
|
* This option is typically relevant when integrating with OpenAPI.
|
|
98
98
|
*
|
|
99
|
-
* @see {@link https://orpc.
|
|
99
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
100
100
|
*/
|
|
101
101
|
deprecated?: boolean;
|
|
102
102
|
/**
|
|
103
103
|
* The tags of the procedure.
|
|
104
104
|
* This option is typically relevant when integrating with OpenAPI.
|
|
105
105
|
*
|
|
106
|
-
* @see {@link https://orpc.
|
|
106
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
107
107
|
*/
|
|
108
108
|
tags?: readonly string[];
|
|
109
109
|
/**
|
|
@@ -111,7 +111,7 @@ interface Route {
|
|
|
111
111
|
* The status code must be in the 200-399 range.
|
|
112
112
|
* This option is typically relevant when integrating with OpenAPI.
|
|
113
113
|
*
|
|
114
|
-
* @see {@link https://orpc.
|
|
114
|
+
* @see {@link https://orpc.dev/docs/openapi/routing OpenAPI Routing Docs}
|
|
115
115
|
* @default 200
|
|
116
116
|
*/
|
|
117
117
|
successStatus?: number;
|
|
@@ -119,7 +119,7 @@ interface Route {
|
|
|
119
119
|
* The description of the response when the procedure is successful.
|
|
120
120
|
* This option is typically relevant when integrating with OpenAPI.
|
|
121
121
|
*
|
|
122
|
-
* @see {@link https://orpc.
|
|
122
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
123
123
|
* @default 'OK'
|
|
124
124
|
*/
|
|
125
125
|
successDescription?: string;
|
|
@@ -142,7 +142,7 @@ interface Route {
|
|
|
142
142
|
* }
|
|
143
143
|
* ```
|
|
144
144
|
*
|
|
145
|
-
* @see {@link https://orpc.
|
|
145
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
146
146
|
* @default 'compact'
|
|
147
147
|
*/
|
|
148
148
|
inputStructure?: InputStructure;
|
|
@@ -167,14 +167,14 @@ interface Route {
|
|
|
167
167
|
* };
|
|
168
168
|
* ```
|
|
169
169
|
*
|
|
170
|
-
* @see {@link https://orpc.
|
|
170
|
+
* @see {@link https://orpc.dev/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
171
171
|
* @default 'compact'
|
|
172
172
|
*/
|
|
173
173
|
outputStructure?: OutputStructure;
|
|
174
174
|
/**
|
|
175
175
|
* Override entire auto-generated OpenAPI Operation Object Specification.
|
|
176
176
|
*
|
|
177
|
-
* @see {@link https://orpc.
|
|
177
|
+
* @see {@link https://orpc.dev/docs/openapi/openapi-specification#operation-metadata Operation Metadata Docs}
|
|
178
178
|
*/
|
|
179
179
|
spec?: OpenAPIV3_1.OperationObject | ((current: OpenAPIV3_1.OperationObject) => OpenAPIV3_1.OperationObject);
|
|
180
180
|
}
|
|
@@ -199,7 +199,7 @@ interface ContractProcedureDef<TInputSchema extends AnySchema, TOutputSchema ext
|
|
|
199
199
|
/**
|
|
200
200
|
* This class represents a contract procedure.
|
|
201
201
|
*
|
|
202
|
-
* @see {@link https://orpc.
|
|
202
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#procedure-contract Contract Procedure Docs}
|
|
203
203
|
*/
|
|
204
204
|
declare class ContractProcedure<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
205
205
|
/**
|
|
@@ -215,7 +215,7 @@ declare function isContractProcedure(item: unknown): item is AnyContractProcedur
|
|
|
215
215
|
* Represents a contract router, which defines a hierarchical structure of contract procedures.
|
|
216
216
|
*
|
|
217
217
|
* @info A contract procedure is a contract router too.
|
|
218
|
-
* @see {@link https://orpc.
|
|
218
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#contract-router Contract Router Docs}
|
|
219
219
|
*/
|
|
220
220
|
type ContractRouter<TMeta extends Meta> = ContractProcedure<any, any, any, TMeta> | {
|
|
221
221
|
[k: string]: ContractRouter<TMeta>;
|
|
@@ -225,7 +225,7 @@ type AnyContractRouter = ContractRouter<any>;
|
|
|
225
225
|
* Infer all inputs of the contract router.
|
|
226
226
|
*
|
|
227
227
|
* @info A contract procedure is a contract router too.
|
|
228
|
-
* @see {@link https://orpc.
|
|
228
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
229
229
|
*/
|
|
230
230
|
type InferContractRouterInputs<T extends AnyContractRouter> = T extends ContractProcedure<infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
|
231
231
|
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterInputs<T[K]> : never;
|
|
@@ -234,7 +234,7 @@ type InferContractRouterInputs<T extends AnyContractRouter> = T extends Contract
|
|
|
234
234
|
* Infer all outputs of the contract router.
|
|
235
235
|
*
|
|
236
236
|
* @info A contract procedure is a contract router too.
|
|
237
|
-
* @see {@link https://orpc.
|
|
237
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
238
238
|
*/
|
|
239
239
|
type InferContractRouterOutputs<T extends AnyContractRouter> = T extends ContractProcedure<any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
|
240
240
|
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterOutputs<T[K]> : never;
|
|
@@ -243,7 +243,7 @@ type InferContractRouterOutputs<T extends AnyContractRouter> = T extends Contrac
|
|
|
243
243
|
* Infer all errors of the contract router.
|
|
244
244
|
*
|
|
245
245
|
* @info A contract procedure is a contract router too.
|
|
246
|
-
* @see {@link https://orpc.
|
|
246
|
+
* @see {@link https://orpc.dev/docs/contract-first/define-contract#utilities Contract Utilities Docs}
|
|
247
247
|
*/
|
|
248
248
|
type InferContractRouterErrorMap<T extends AnyContractRouter> = T extends ContractProcedure<any, any, infer UErrorMap, any> ? UErrorMap : {
|
|
249
249
|
[K in keyof T]: T[K] extends AnyContractRouter ? InferContractRouterErrorMap<T[K]> : never;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.12.
|
|
4
|
+
"version": "1.12.1",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/unnoq/orpc.git",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@standard-schema/spec": "^1.0.0",
|
|
33
33
|
"openapi-types": "^12.1.3",
|
|
34
|
-
"@orpc/
|
|
35
|
-
"@orpc/
|
|
34
|
+
"@orpc/shared": "1.12.1",
|
|
35
|
+
"@orpc/client": "1.12.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"arktype": "2.1.27",
|