@orpc/contract 0.21.0 → 0.23.0
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/dist/src/procedure.d.ts +49 -0
- package/package.json +2 -2
package/dist/src/procedure.d.ts
CHANGED
|
@@ -6,7 +6,56 @@ export interface RouteOptions {
|
|
|
6
6
|
description?: string;
|
|
7
7
|
deprecated?: boolean;
|
|
8
8
|
tags?: readonly string[];
|
|
9
|
+
/**
|
|
10
|
+
* The status code of the response when the procedure is successful.
|
|
11
|
+
*
|
|
12
|
+
* @default 200
|
|
13
|
+
*/
|
|
9
14
|
successStatus?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Determines how the input should be structured based on `params`, `query`, `headers`, and `body`.
|
|
17
|
+
*
|
|
18
|
+
* @option 'compact'
|
|
19
|
+
* Combines `params` and either `query` or `body` (depending on the HTTP method) into a single object.
|
|
20
|
+
*
|
|
21
|
+
* @option 'detailed'
|
|
22
|
+
* Keeps each part of the request (`params`, `query`, `headers`, and `body`) as separate fields in the input object.
|
|
23
|
+
*
|
|
24
|
+
* Example:
|
|
25
|
+
* ```ts
|
|
26
|
+
* const input = {
|
|
27
|
+
* params: { id: 1 },
|
|
28
|
+
* query: { search: 'hello' },
|
|
29
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
30
|
+
* body: { name: 'John' },
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @default 'compact'
|
|
35
|
+
*/
|
|
36
|
+
inputStructure?: 'compact' | 'detailed';
|
|
37
|
+
/**
|
|
38
|
+
* Determines how the response should be structured based on the output.
|
|
39
|
+
*
|
|
40
|
+
* @option 'compact'
|
|
41
|
+
* Includes only the body data, encoded directly in the response.
|
|
42
|
+
*
|
|
43
|
+
* @option 'detailed'
|
|
44
|
+
* Separates the output into `headers` and `body` fields.
|
|
45
|
+
* - `headers`: Custom headers to merge with the response headers.
|
|
46
|
+
* - `body`: The response data.
|
|
47
|
+
*
|
|
48
|
+
* Example:
|
|
49
|
+
* ```ts
|
|
50
|
+
* const output = {
|
|
51
|
+
* headers: { 'x-custom-header': 'value' },
|
|
52
|
+
* body: { message: 'Hello, world!' },
|
|
53
|
+
* };
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @default 'compact'
|
|
57
|
+
*/
|
|
58
|
+
outputStructure?: 'compact' | 'detailed';
|
|
10
59
|
}
|
|
11
60
|
export interface ContractProcedureDef<TInputSchema extends Schema, TOutputSchema extends Schema> {
|
|
12
61
|
route?: RouteOptions;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/contract",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.23.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@standard-schema/spec": "1.0.0-beta.4",
|
|
33
|
-
"@orpc/shared": "0.
|
|
33
|
+
"@orpc/shared": "0.23.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"arktype": "2.0.0-rc.26",
|