@hey-api/openapi-ts 0.78.2 → 0.79.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/README.md +34 -13
- package/dist/chunk-OKLCYIL3.js +39 -0
- package/dist/chunk-OKLCYIL3.js.map +1 -0
- package/dist/clients/core/params.ts +10 -0
- package/dist/clients/core/types.ts +14 -0
- package/dist/clients/fetch/client.ts +4 -2
- package/dist/clients/next/client.ts +4 -2
- package/dist/index.cjs +61 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +11 -11
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{types.d-CaH9PF-K.d.cts → types.d-BJ8Em-Ol.d.cts} +1776 -268
- package/dist/{types.d-CaH9PF-K.d.ts → types.d-BJ8Em-Ol.d.ts} +1776 -268
- package/package.json +1 -1
- package/dist/chunk-YJGQGZQU.js +0 -39
- package/dist/chunk-YJGQGZQU.js.map +0 -1
|
@@ -3,11 +3,21 @@ type Slot = 'body' | 'headers' | 'path' | 'query';
|
|
|
3
3
|
export type Field =
|
|
4
4
|
| {
|
|
5
5
|
in: Exclude<Slot, 'body'>;
|
|
6
|
+
/**
|
|
7
|
+
* Field name. This is the name we want the user to see and use.
|
|
8
|
+
*/
|
|
6
9
|
key: string;
|
|
10
|
+
/**
|
|
11
|
+
* Field mapped name. This is the name we want to use in the request.
|
|
12
|
+
* If omitted, we use the same value as `key`.
|
|
13
|
+
*/
|
|
7
14
|
map?: string;
|
|
8
15
|
}
|
|
9
16
|
| {
|
|
10
17
|
in: Extract<Slot, 'body'>;
|
|
18
|
+
/**
|
|
19
|
+
* Key isn't required for bodies.
|
|
20
|
+
*/
|
|
11
21
|
key?: string;
|
|
12
22
|
map?: string;
|
|
13
23
|
};
|
|
@@ -102,3 +102,17 @@ export interface Config {
|
|
|
102
102
|
*/
|
|
103
103
|
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
|
|
107
|
+
? true
|
|
108
|
+
: [T] extends [never | undefined]
|
|
109
|
+
? [undefined] extends [T]
|
|
110
|
+
? false
|
|
111
|
+
: true
|
|
112
|
+
: false;
|
|
113
|
+
|
|
114
|
+
export type OmitNever<T extends Record<string, unknown>> = {
|
|
115
|
+
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
|
|
116
|
+
? never
|
|
117
|
+
: K]: T[K];
|
|
118
|
+
};
|
|
@@ -143,14 +143,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
const textError = await response.text();
|
|
147
|
+
let jsonError: unknown;
|
|
147
148
|
|
|
148
149
|
try {
|
|
149
|
-
|
|
150
|
+
jsonError = JSON.parse(textError);
|
|
150
151
|
} catch {
|
|
151
152
|
// noop
|
|
152
153
|
}
|
|
153
154
|
|
|
155
|
+
const error = jsonError ?? textError;
|
|
154
156
|
let finalError = error;
|
|
155
157
|
|
|
156
158
|
for (const fn of interceptors.error._fns) {
|
|
@@ -128,14 +128,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
const textError = await response.text();
|
|
132
|
+
let jsonError: unknown;
|
|
132
133
|
|
|
133
134
|
try {
|
|
134
|
-
|
|
135
|
+
jsonError = JSON.parse(textError);
|
|
135
136
|
} catch {
|
|
136
137
|
// noop
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
const error = jsonError ?? textError;
|
|
139
141
|
let finalError = error;
|
|
140
142
|
|
|
141
143
|
for (const fn of interceptors.error._fns) {
|