@hey-api/openapi-ts 0.93.0 → 0.94.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 +13 -12
- package/dist/clients/angular/client.ts +5 -3
- package/dist/clients/axios/client.ts +4 -1
- package/dist/clients/core/bodySerializer.ts +6 -8
- package/dist/clients/core/params.ts +1 -1
- package/dist/clients/fetch/client.ts +5 -3
- package/dist/clients/ky/client.ts +5 -3
- package/dist/clients/next/client.ts +5 -3
- package/dist/clients/nuxt/client.ts +4 -1
- package/dist/clients/nuxt/utils.ts +4 -0
- package/dist/clients/ofetch/client.ts +5 -3
- package/dist/index.d.mts +889 -266
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-BVQKw3ZX.mjs → init-PHWYaLgi.mjs} +372 -111
- package/dist/init-PHWYaLgi.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +5 -5
- package/dist/run.mjs.map +1 -1
- package/dist/{src-BD5OAshH.mjs → src-1D7PrOtb.mjs} +2 -2
- package/dist/{src-BD5OAshH.mjs.map → src-1D7PrOtb.mjs.map} +1 -1
- package/package.json +4 -4
- package/dist/init-BVQKw3ZX.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
59
59
|
<td align="center" width="336px">
|
|
60
60
|
<p></p>
|
|
61
61
|
<p>
|
|
62
|
-
<a href="https://kutt.
|
|
62
|
+
<a href="https://kutt.to/pkEZyc" target="_blank">
|
|
63
63
|
<picture height="50px">
|
|
64
64
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/.gen/stainless-logo-wordmark-480w.jpeg">
|
|
65
65
|
<img alt="Stainless logo" height="50px" src="https://heyapi.dev/assets/.gen/stainless-logo-wordmark-480w.jpeg">
|
|
@@ -68,7 +68,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
68
68
|
<br/>
|
|
69
69
|
Best-in-class developer interfaces for your API.
|
|
70
70
|
<br/>
|
|
71
|
-
<a href="https://kutt.
|
|
71
|
+
<a href="https://kutt.to/pkEZyc" style="text-decoration:none;" target="_blank">
|
|
72
72
|
stainless.com
|
|
73
73
|
</a>
|
|
74
74
|
</p>
|
|
@@ -77,7 +77,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
77
77
|
<td align="center" width="336px">
|
|
78
78
|
<p></p>
|
|
79
79
|
<p>
|
|
80
|
-
<a href="https://kutt.
|
|
80
|
+
<a href="https://kutt.to/QM9Q2N" target="_blank">
|
|
81
81
|
<picture height="50px">
|
|
82
82
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/opencode/logo-light.svg">
|
|
83
83
|
<img alt="Opencode logo" height="50px" src="https://heyapi.dev/assets/opencode/logo-dark.svg">
|
|
@@ -86,7 +86,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
86
86
|
<br/>
|
|
87
87
|
The open source coding agent.
|
|
88
88
|
<br/>
|
|
89
|
-
<a href="https://kutt.
|
|
89
|
+
<a href="https://kutt.to/QM9Q2N" style="text-decoration:none;" target="_blank">
|
|
90
90
|
opencode.ai
|
|
91
91
|
</a>
|
|
92
92
|
</p>
|
|
@@ -97,7 +97,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
97
97
|
<td align="center" width="336px">
|
|
98
98
|
<p></p>
|
|
99
99
|
<p>
|
|
100
|
-
<a href="https://kutt.
|
|
100
|
+
<a href="https://kutt.to/6vrYy9" target="_blank">
|
|
101
101
|
<picture height="50px">
|
|
102
102
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/mintlify/logo-light.svg">
|
|
103
103
|
<img alt="Mintlify logo" height="50px" src="https://heyapi.dev/assets/mintlify/logo-dark.svg">
|
|
@@ -106,7 +106,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
106
106
|
<br/>
|
|
107
107
|
The intelligent knowledge platform.
|
|
108
108
|
<br/>
|
|
109
|
-
<a href="https://kutt.
|
|
109
|
+
<a href="https://kutt.to/6vrYy9" style="text-decoration:none;" target="_blank">
|
|
110
110
|
mintlify.com
|
|
111
111
|
</a>
|
|
112
112
|
</p>
|
|
@@ -122,26 +122,26 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
122
122
|
<tbody>
|
|
123
123
|
<tr>
|
|
124
124
|
<td align="center" width="172px">
|
|
125
|
-
<a href="https://kutt.
|
|
125
|
+
<a href="https://kutt.to/skQUVd" target="_blank">
|
|
126
126
|
<picture height="40px">
|
|
127
127
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/scalar/logo-light.svg">
|
|
128
128
|
<img alt="Scalar logo" height="40px" src="https://heyapi.dev/assets/scalar/logo-dark.svg">
|
|
129
129
|
</picture>
|
|
130
130
|
</a>
|
|
131
131
|
<br/>
|
|
132
|
-
<a href="https://kutt.
|
|
132
|
+
<a href="https://kutt.to/skQUVd" style="text-decoration:none;" target="_blank">
|
|
133
133
|
scalar.com
|
|
134
134
|
</a>
|
|
135
135
|
</td>
|
|
136
136
|
<td align="center" width="172px">
|
|
137
|
-
<a href="https://kutt.
|
|
137
|
+
<a href="https://kutt.to/Dr9GuW" target="_blank">
|
|
138
138
|
<picture height="40px">
|
|
139
139
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/fastapi/logo-light.svg">
|
|
140
140
|
<img alt="FastAPI logo" height="40px" src="https://heyapi.dev/assets/fastapi/logo-dark.svg">
|
|
141
141
|
</picture>
|
|
142
142
|
</a>
|
|
143
143
|
<br/>
|
|
144
|
-
<a href="https://kutt.
|
|
144
|
+
<a href="https://kutt.to/Dr9GuW" style="text-decoration:none;" target="_blank">
|
|
145
145
|
fastapi.tiangolo.com
|
|
146
146
|
</a>
|
|
147
147
|
</td>
|
|
@@ -155,7 +155,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
155
155
|
<tbody>
|
|
156
156
|
<tr>
|
|
157
157
|
<td align="center" width="136px">
|
|
158
|
-
<a href="https://kutt.
|
|
158
|
+
<a href="https://kutt.to/YpaKsX" target="_blank">
|
|
159
159
|
<picture height="34px">
|
|
160
160
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/.gen/kinde-logo-wordmark-dark-480w.webp">
|
|
161
161
|
<img alt="Kinde logo" height="34px" src="https://heyapi.dev/assets/.gen/kinde-logo-wordmark-480w.jpeg">
|
|
@@ -163,7 +163,7 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
163
163
|
</a>
|
|
164
164
|
</td>
|
|
165
165
|
<td align="center" width="136px">
|
|
166
|
-
<a href="https://kutt.
|
|
166
|
+
<a href="https://kutt.to/KkqSaw" target="_blank">
|
|
167
167
|
<picture height="34px">
|
|
168
168
|
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/cella/logo-light.svg">
|
|
169
169
|
<img alt="Cella logo" height="34px" src="https://heyapi.dev/assets/cella/logo-dark.svg">
|
|
@@ -337,6 +337,7 @@ These plugins help reduce boilerplate associated with third-party dependencies.
|
|
|
337
337
|
- [`@hey-api/typescript`](https://heyapi.dev/openapi-ts/output/typescript)
|
|
338
338
|
- [`@pinia/colada`](https://heyapi.dev/openapi-ts/plugins/pinia-colada)
|
|
339
339
|
- [`@tanstack/angular-query-experimental`](https://heyapi.dev/openapi-ts/plugins/tanstack-query)
|
|
340
|
+
- [`@tanstack/preact-query`](https://heyapi.dev/openapi-ts/plugins/tanstack-query)
|
|
340
341
|
- [`@tanstack/react-query`](https://heyapi.dev/openapi-ts/plugins/tanstack-query)
|
|
341
342
|
- [`@tanstack/solid-query`](https://heyapi.dev/openapi-ts/plugins/tanstack-query)
|
|
342
343
|
- [`@tanstack/svelte-query`](https://heyapi.dev/openapi-ts/plugins/tanstack-query)
|
|
@@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
64
64
|
...options,
|
|
65
65
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
66
66
|
httpClient: options.httpClient ?? _config.httpClient,
|
|
67
|
-
serializedBody: undefined,
|
|
67
|
+
serializedBody: undefined as string | undefined,
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
if (!opts.httpClient) {
|
|
@@ -77,7 +77,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
80
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
80
|
+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -197,8 +197,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
197
197
|
});
|
|
198
198
|
};
|
|
199
199
|
|
|
200
|
+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
201
|
+
|
|
200
202
|
return {
|
|
201
|
-
buildUrl,
|
|
203
|
+
buildUrl: _buildUrl,
|
|
202
204
|
connect: makeMethodFn('CONNECT'),
|
|
203
205
|
delete: makeMethodFn('DELETE'),
|
|
204
206
|
get: makeMethodFn('GET'),
|
|
@@ -124,8 +124,11 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
124
124
|
});
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
const _buildUrl: Client['buildUrl'] = (options) =>
|
|
128
|
+
buildUrl({ axios: instance, ..._config, ...options });
|
|
129
|
+
|
|
127
130
|
return {
|
|
128
|
-
buildUrl,
|
|
131
|
+
buildUrl: _buildUrl,
|
|
129
132
|
connect: makeMethodFn('CONNECT'),
|
|
130
133
|
delete: makeMethodFn('DELETE'),
|
|
131
134
|
get: makeMethodFn('GET'),
|
|
@@ -2,7 +2,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
|
|
|
2
2
|
|
|
3
3
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
|
4
4
|
|
|
5
|
-
export type BodySerializer = (body:
|
|
5
|
+
export type BodySerializer = (body: unknown) => unknown;
|
|
6
6
|
|
|
7
7
|
type QuerySerializerOptionsObject = {
|
|
8
8
|
allowReserved?: boolean;
|
|
@@ -37,12 +37,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const formDataBodySerializer = {
|
|
40
|
-
bodySerializer:
|
|
41
|
-
body: T,
|
|
42
|
-
): FormData => {
|
|
40
|
+
bodySerializer: (body: unknown): FormData => {
|
|
43
41
|
const data = new FormData();
|
|
44
42
|
|
|
45
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
43
|
+
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
|
|
46
44
|
if (value === undefined || value === null) {
|
|
47
45
|
return;
|
|
48
46
|
}
|
|
@@ -58,15 +56,15 @@ export const formDataBodySerializer = {
|
|
|
58
56
|
};
|
|
59
57
|
|
|
60
58
|
export const jsonBodySerializer = {
|
|
61
|
-
bodySerializer:
|
|
59
|
+
bodySerializer: (body: unknown): string =>
|
|
62
60
|
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
|
|
63
61
|
};
|
|
64
62
|
|
|
65
63
|
export const urlSearchParamsBodySerializer = {
|
|
66
|
-
bodySerializer:
|
|
64
|
+
bodySerializer: (body: unknown): string => {
|
|
67
65
|
const data = new URLSearchParams();
|
|
68
66
|
|
|
69
|
-
Object.entries(body).forEach(([key, value]) => {
|
|
67
|
+
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
|
|
70
68
|
if (value === undefined || value === null) {
|
|
71
69
|
return;
|
|
72
70
|
}
|
|
@@ -94,7 +94,7 @@ interface Params {
|
|
|
94
94
|
|
|
95
95
|
const stripEmptySlots = (params: Params) => {
|
|
96
96
|
for (const [slot, value] of Object.entries(params)) {
|
|
97
|
-
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
97
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
|
|
98
98
|
delete params[slot as Slot];
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -35,7 +35,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
35
35
|
...options,
|
|
36
36
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
37
37
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
38
|
-
serializedBody: undefined,
|
|
38
|
+
serializedBody: undefined as string | undefined,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
if (opts.security) {
|
|
@@ -50,7 +50,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
53
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
53
|
+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -256,8 +256,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
256
256
|
});
|
|
257
257
|
};
|
|
258
258
|
|
|
259
|
+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
260
|
+
|
|
259
261
|
return {
|
|
260
|
-
buildUrl,
|
|
262
|
+
buildUrl: _buildUrl,
|
|
261
263
|
connect: makeMethodFn('CONNECT'),
|
|
262
264
|
delete: makeMethodFn('DELETE'),
|
|
263
265
|
get: makeMethodFn('GET'),
|
|
@@ -34,7 +34,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
34
34
|
...options,
|
|
35
35
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
36
36
|
ky: options.ky ?? _config.ky ?? ky,
|
|
37
|
-
serializedBody: undefined,
|
|
37
|
+
serializedBody: undefined as string | undefined,
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
if (opts.security) {
|
|
@@ -49,7 +49,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
52
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
52
|
+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
if (opts.body === undefined || opts.serializedBody === '') {
|
|
@@ -288,8 +288,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
288
288
|
});
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
292
|
+
|
|
291
293
|
return {
|
|
292
|
-
buildUrl,
|
|
294
|
+
buildUrl: _buildUrl,
|
|
293
295
|
connect: makeMethodFn('CONNECT'),
|
|
294
296
|
delete: makeMethodFn('DELETE'),
|
|
295
297
|
get: makeMethodFn('GET'),
|
|
@@ -35,7 +35,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
35
35
|
...options,
|
|
36
36
|
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
37
37
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
38
|
-
serializedBody: undefined,
|
|
38
|
+
serializedBody: undefined as string | undefined,
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
if (opts.security) {
|
|
@@ -50,7 +50,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
53
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
53
|
+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
// remove Content-Type header if body is empty to avoid sending invalid requests
|
|
@@ -223,8 +223,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
223
223
|
});
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
227
|
+
|
|
226
228
|
return {
|
|
227
|
-
buildUrl,
|
|
229
|
+
buildUrl: _buildUrl,
|
|
228
230
|
connect: makeMethodFn('CONNECT'),
|
|
229
231
|
delete: makeMethodFn('DELETE'),
|
|
230
232
|
get: makeMethodFn('GET'),
|
|
@@ -184,8 +184,11 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
184
184
|
});
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
+
const _buildUrl: Client['buildUrl'] = (options) =>
|
|
188
|
+
buildUrl({ ..._config, ...options } as typeof options);
|
|
189
|
+
|
|
187
190
|
return {
|
|
188
|
-
buildUrl,
|
|
191
|
+
buildUrl: _buildUrl,
|
|
189
192
|
connect: makeMethodFn('CONNECT'),
|
|
190
193
|
delete: makeMethodFn('DELETE'),
|
|
191
194
|
get: makeMethodFn('GET'),
|
|
@@ -344,6 +344,10 @@ export const unwrapRefs = <T>(value: T): UnwrapRefs<T> => {
|
|
|
344
344
|
return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
if (value instanceof Blob) {
|
|
348
|
+
return value as UnwrapRefs<T>;
|
|
349
|
+
}
|
|
350
|
+
|
|
347
351
|
if (Array.isArray(value)) {
|
|
348
352
|
return value.map((item) => unwrapRefs(item)) as UnwrapRefs<T>;
|
|
349
353
|
}
|
|
@@ -43,7 +43,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
43
43
|
..._config,
|
|
44
44
|
...options,
|
|
45
45
|
headers: mergeHeaders(_config.headers, options.headers),
|
|
46
|
-
serializedBody: undefined,
|
|
46
|
+
serializedBody: undefined as string | undefined,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
if (opts.security) {
|
|
@@ -58,7 +58,7 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
if (opts.body !== undefined && opts.bodySerializer) {
|
|
61
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
61
|
+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// remove Content-Type if body is empty to avoid invalid requests
|
|
@@ -229,8 +229,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
229
229
|
});
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
|
|
233
|
+
|
|
232
234
|
return {
|
|
233
|
-
buildUrl,
|
|
235
|
+
buildUrl: _buildUrl,
|
|
234
236
|
connect: makeMethodFn('CONNECT'),
|
|
235
237
|
delete: makeMethodFn('DELETE'),
|
|
236
238
|
get: makeMethodFn('GET'),
|