@hey-api/openapi-ts 0.94.5 → 0.95.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 +0 -20
- package/dist/clients/angular/client.ts +8 -2
- package/dist/clients/angular/types.ts +1 -1
- package/dist/clients/axios/client.ts +7 -2
- package/dist/clients/axios/types.ts +6 -3
- package/dist/clients/fetch/client.ts +12 -4
- package/dist/clients/fetch/types.ts +1 -1
- package/dist/clients/ky/client.ts +12 -4
- package/dist/clients/ky/types.ts +1 -1
- package/dist/clients/next/client.ts +10 -4
- package/dist/clients/next/types.ts +1 -1
- package/dist/clients/ofetch/types.ts +1 -1
- package/dist/index.d.mts +1036 -476
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-DXg2DSyt.mjs → init-C3GzFcQR.mjs} +1333 -538
- package/dist/init-C3GzFcQR.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +3 -3
- package/dist/{src-onOyaUFS.mjs → src-BzTu1krN.mjs} +2 -2
- package/dist/{src-onOyaUFS.mjs.map → src-BzTu1krN.mjs.map} +1 -1
- package/package.json +5 -5
- package/dist/init-DXg2DSyt.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -93,26 +93,6 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
93
93
|
<p></p>
|
|
94
94
|
</td>
|
|
95
95
|
</tr>
|
|
96
|
-
<tr>
|
|
97
|
-
<td align="center" width="336px">
|
|
98
|
-
<p></p>
|
|
99
|
-
<p>
|
|
100
|
-
<a href="https://kutt.to/6vrYy9" target="_blank">
|
|
101
|
-
<picture height="50px">
|
|
102
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/mintlify/logo-light.svg">
|
|
103
|
-
<img alt="Mintlify logo" height="50px" src="https://heyapi.dev/assets/mintlify/logo-dark.svg">
|
|
104
|
-
</picture>
|
|
105
|
-
</a>
|
|
106
|
-
<br/>
|
|
107
|
-
The intelligent knowledge platform.
|
|
108
|
-
<br/>
|
|
109
|
-
<a href="https://kutt.to/6vrYy9" style="text-decoration:none;" target="_blank">
|
|
110
|
-
mintlify.com
|
|
111
|
-
</a>
|
|
112
|
-
</p>
|
|
113
|
-
<p></p>
|
|
114
|
-
</td>
|
|
115
|
-
</tr>
|
|
116
96
|
</tbody>
|
|
117
97
|
</table>
|
|
118
98
|
|
|
@@ -95,7 +95,14 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
95
95
|
return { opts, req, url };
|
|
96
96
|
};
|
|
97
97
|
|
|
98
|
-
const beforeRequest = async
|
|
98
|
+
const beforeRequest = async <
|
|
99
|
+
TData = unknown,
|
|
100
|
+
TResponseStyle extends ResponseStyle = 'fields',
|
|
101
|
+
ThrowOnError extends boolean = boolean,
|
|
102
|
+
Url extends string = string,
|
|
103
|
+
>(
|
|
104
|
+
options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,
|
|
105
|
+
) => {
|
|
99
106
|
const { opts, req, url } = requestOptions(options);
|
|
100
107
|
|
|
101
108
|
if (opts.security) {
|
|
@@ -113,7 +120,6 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
113
120
|
};
|
|
114
121
|
|
|
115
122
|
const request: Client['request'] = async (options) => {
|
|
116
|
-
// @ts-expect-error
|
|
117
123
|
const { opts, req: initialReq } = await beforeRequest(options);
|
|
118
124
|
|
|
119
125
|
let req = initialReq;
|
|
@@ -157,7 +157,7 @@ type SseFn = <
|
|
|
157
157
|
ThrowOnError extends boolean = false,
|
|
158
158
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
159
159
|
>(
|
|
160
|
-
options: Omit<RequestOptions<
|
|
160
|
+
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
161
161
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
162
162
|
|
|
163
163
|
type RequestFn = <
|
|
@@ -33,7 +33,13 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
33
33
|
return getConfig();
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const beforeRequest = async
|
|
36
|
+
const beforeRequest = async <
|
|
37
|
+
TData = unknown,
|
|
38
|
+
ThrowOnError extends boolean = boolean,
|
|
39
|
+
Url extends string = string,
|
|
40
|
+
>(
|
|
41
|
+
options: RequestOptions<TData, ThrowOnError, Url>,
|
|
42
|
+
) => {
|
|
37
43
|
const opts = {
|
|
38
44
|
..._config,
|
|
39
45
|
...options,
|
|
@@ -63,7 +69,6 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
63
69
|
|
|
64
70
|
// @ts-expect-error
|
|
65
71
|
const request: Client['request'] = async (options) => {
|
|
66
|
-
// @ts-expect-error
|
|
67
72
|
const { opts, url } = await beforeRequest(options);
|
|
68
73
|
try {
|
|
69
74
|
// assign Axios here for consistency with fetch
|
|
@@ -106,7 +106,7 @@ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean
|
|
|
106
106
|
) => RequestResult<TData, TError, ThrowOnError>;
|
|
107
107
|
|
|
108
108
|
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(
|
|
109
|
-
options: Omit<RequestOptions<
|
|
109
|
+
options: Omit<RequestOptions<never, ThrowOnError>, 'method'>,
|
|
110
110
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
111
111
|
|
|
112
112
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(
|
|
@@ -116,13 +116,16 @@ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolea
|
|
|
116
116
|
|
|
117
117
|
type BuildUrlFn = <
|
|
118
118
|
TData extends {
|
|
119
|
-
body?: unknown;
|
|
120
119
|
path?: Record<string, unknown>;
|
|
121
120
|
query?: Record<string, unknown>;
|
|
122
121
|
url: string;
|
|
123
122
|
},
|
|
124
123
|
>(
|
|
125
|
-
options: TData &
|
|
124
|
+
options: TData &
|
|
125
|
+
Pick<
|
|
126
|
+
RequestOptions<unknown, boolean>,
|
|
127
|
+
'axios' | 'baseURL' | 'paramsSerializer' | 'querySerializer'
|
|
128
|
+
>,
|
|
126
129
|
) => string;
|
|
127
130
|
|
|
128
131
|
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
|
@@ -29,7 +29,14 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
29
29
|
|
|
30
30
|
const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>();
|
|
31
31
|
|
|
32
|
-
const beforeRequest = async
|
|
32
|
+
const beforeRequest = async <
|
|
33
|
+
TData = unknown,
|
|
34
|
+
TResponseStyle extends 'data' | 'fields' = 'fields',
|
|
35
|
+
ThrowOnError extends boolean = boolean,
|
|
36
|
+
Url extends string = string,
|
|
37
|
+
>(
|
|
38
|
+
options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,
|
|
39
|
+
) => {
|
|
33
40
|
const opts = {
|
|
34
41
|
..._config,
|
|
35
42
|
...options,
|
|
@@ -58,13 +65,14 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
58
65
|
opts.headers.delete('Content-Type');
|
|
59
66
|
}
|
|
60
67
|
|
|
61
|
-
const
|
|
68
|
+
const resolvedOpts = opts as typeof opts &
|
|
69
|
+
ResolvedRequestOptions<TResponseStyle, ThrowOnError, Url>;
|
|
70
|
+
const url = buildUrl(resolvedOpts);
|
|
62
71
|
|
|
63
|
-
return { opts, url };
|
|
72
|
+
return { opts: resolvedOpts, url };
|
|
64
73
|
};
|
|
65
74
|
|
|
66
75
|
const request: Client['request'] = async (options) => {
|
|
67
|
-
// @ts-expect-error
|
|
68
76
|
const { opts, url } = await beforeRequest(options);
|
|
69
77
|
const requestInit: ReqInit = {
|
|
70
78
|
redirect: 'follow',
|
|
@@ -150,7 +150,7 @@ type SseFn = <
|
|
|
150
150
|
ThrowOnError extends boolean = false,
|
|
151
151
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
152
152
|
>(
|
|
153
|
-
options: Omit<RequestOptions<
|
|
153
|
+
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
154
154
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
155
155
|
|
|
156
156
|
type RequestFn = <
|
|
@@ -28,7 +28,14 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
28
28
|
|
|
29
29
|
const interceptors = createInterceptors<Request, Response, unknown, ResolvedRequestOptions>();
|
|
30
30
|
|
|
31
|
-
const beforeRequest = async
|
|
31
|
+
const beforeRequest = async <
|
|
32
|
+
TData = unknown,
|
|
33
|
+
TResponseStyle extends 'data' | 'fields' = 'fields',
|
|
34
|
+
ThrowOnError extends boolean = boolean,
|
|
35
|
+
Url extends string = string,
|
|
36
|
+
>(
|
|
37
|
+
options: RequestOptions<TData, TResponseStyle, ThrowOnError, Url>,
|
|
38
|
+
) => {
|
|
32
39
|
const opts = {
|
|
33
40
|
..._config,
|
|
34
41
|
...options,
|
|
@@ -56,9 +63,11 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
56
63
|
opts.headers.delete('Content-Type');
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
const
|
|
66
|
+
const resolvedOpts = opts as typeof opts &
|
|
67
|
+
ResolvedRequestOptions<TResponseStyle, ThrowOnError, Url>;
|
|
68
|
+
const url = buildUrl(resolvedOpts);
|
|
60
69
|
|
|
61
|
-
return { opts, url };
|
|
70
|
+
return { opts: resolvedOpts, url };
|
|
62
71
|
};
|
|
63
72
|
|
|
64
73
|
const parseErrorResponse = async (
|
|
@@ -105,7 +114,6 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
105
114
|
};
|
|
106
115
|
|
|
107
116
|
const request: Client['request'] = async (options) => {
|
|
108
|
-
// @ts-expect-error
|
|
109
117
|
const { opts, url } = await beforeRequest(options);
|
|
110
118
|
|
|
111
119
|
const kyInstance = opts.ky!;
|
package/dist/clients/ky/types.ts
CHANGED
|
@@ -182,7 +182,7 @@ type SseFn = <
|
|
|
182
182
|
ThrowOnError extends boolean = false,
|
|
183
183
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
184
184
|
>(
|
|
185
|
-
options: Omit<RequestOptions<
|
|
185
|
+
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
186
186
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
187
187
|
|
|
188
188
|
type RequestFn = <
|
|
@@ -29,7 +29,13 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
29
29
|
|
|
30
30
|
const interceptors = createInterceptors<Response, unknown, ResolvedRequestOptions>();
|
|
31
31
|
|
|
32
|
-
const beforeRequest = async
|
|
32
|
+
const beforeRequest = async <
|
|
33
|
+
TData = unknown,
|
|
34
|
+
ThrowOnError extends boolean = boolean,
|
|
35
|
+
Url extends string = string,
|
|
36
|
+
>(
|
|
37
|
+
options: RequestOptions<TData, ThrowOnError, Url>,
|
|
38
|
+
) => {
|
|
33
39
|
const opts = {
|
|
34
40
|
..._config,
|
|
35
41
|
...options,
|
|
@@ -58,14 +64,14 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
58
64
|
opts.headers.delete('Content-Type');
|
|
59
65
|
}
|
|
60
66
|
|
|
61
|
-
const
|
|
67
|
+
const resolvedOpts = opts as typeof opts & ResolvedRequestOptions<ThrowOnError, Url>;
|
|
68
|
+
const url = buildUrl(resolvedOpts);
|
|
62
69
|
|
|
63
|
-
return { opts, url };
|
|
70
|
+
return { opts: resolvedOpts, url };
|
|
64
71
|
};
|
|
65
72
|
|
|
66
73
|
// @ts-expect-error
|
|
67
74
|
const request: Client['request'] = async (options) => {
|
|
68
|
-
// @ts-expect-error
|
|
69
75
|
const { opts, url } = await beforeRequest(options);
|
|
70
76
|
|
|
71
77
|
for (const fn of interceptors.request.fns) {
|
|
@@ -110,7 +110,7 @@ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean
|
|
|
110
110
|
) => RequestResult<TData, TError, ThrowOnError>;
|
|
111
111
|
|
|
112
112
|
type SseFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(
|
|
113
|
-
options: Omit<RequestOptions<
|
|
113
|
+
options: Omit<RequestOptions<never, ThrowOnError>, 'method'>,
|
|
114
114
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
115
115
|
|
|
116
116
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(
|
|
@@ -213,7 +213,7 @@ type SseFn = <
|
|
|
213
213
|
ThrowOnError extends boolean = false,
|
|
214
214
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
215
215
|
>(
|
|
216
|
-
options: Omit<RequestOptions<
|
|
216
|
+
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
217
217
|
) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
218
218
|
|
|
219
219
|
type RequestFn = <
|