@orpc/contract 0.0.0-next.dd705fc → 0.0.0-next.dd914a8
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 +118 -12
- package/dist/index.d.mts +64 -43
- package/dist/index.d.ts +64 -43
- package/dist/index.mjs +47 -15
- package/dist/plugins/index.d.mts +22 -3
- package/dist/plugins/index.d.ts +22 -3
- package/dist/plugins/index.mjs +41 -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 +9 -10
|
@@ -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,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.dd914a8",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/middleapi/orpc.git",
|
|
10
10
|
"directory": "packages/contract"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
|
-
"unnoq",
|
|
14
13
|
"orpc"
|
|
15
14
|
],
|
|
16
15
|
"exports": {
|
|
@@ -29,15 +28,15 @@
|
|
|
29
28
|
"dist"
|
|
30
29
|
],
|
|
31
30
|
"dependencies": {
|
|
32
|
-
"@standard-schema/spec": "^1.
|
|
31
|
+
"@standard-schema/spec": "^1.1.0",
|
|
33
32
|
"openapi-types": "^12.1.3",
|
|
34
|
-
"@orpc/client": "0.0.0-next.
|
|
35
|
-
"@orpc/shared": "0.0.0-next.
|
|
33
|
+
"@orpc/client": "0.0.0-next.dd914a8",
|
|
34
|
+
"@orpc/shared": "0.0.0-next.dd914a8"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
|
-
"arktype": "2.
|
|
39
|
-
"valibot": "^1.
|
|
40
|
-
"zod": "^4.
|
|
37
|
+
"arktype": "2.2.0",
|
|
38
|
+
"valibot": "^1.2.0",
|
|
39
|
+
"zod": "^4.3.6"
|
|
41
40
|
},
|
|
42
41
|
"scripts": {
|
|
43
42
|
"build": "unbuild",
|