@hey-api/openapi-ts 0.93.1 → 0.94.1

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 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.it/pkEZyc" target="_blank">
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.it/pkEZyc" style="text-decoration:none;" target="_blank">
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.it/QM9Q2N" target="_blank">
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.it/QM9Q2N" style="text-decoration:none;" target="_blank">
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.it/6vrYy9" target="_blank">
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.it/6vrYy9" style="text-decoration:none;" target="_blank">
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.it/skQUVd" target="_blank">
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.it/skQUVd" style="text-decoration:none;" target="_blank">
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.it/Dr9GuW" target="_blank">
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.it/Dr9GuW" style="text-decoration:none;" target="_blank">
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.it/YpaKsX" target="_blank">
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.it/KkqSaw" target="_blank">
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'),
@@ -209,7 +209,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
209
209
  */
210
210
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
211
211
  override?: Config<ClientOptions & T>,
212
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
212
+ ) => Config<Required<ClientOptions> & T>;
213
213
 
214
214
  export interface TDataShape {
215
215
  body?: unknown;
@@ -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'),
@@ -139,7 +139,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
139
139
  */
140
140
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
141
141
  override?: Config<ClientOptions & T>,
142
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
142
+ ) => Config<Required<ClientOptions> & T>;
143
143
 
144
144
  export interface TDataShape {
145
145
  body?: unknown;
@@ -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: any) => any;
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: <T extends Record<string, any> | Array<Record<string, any>>>(
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: <T>(body: T): string =>
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: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
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
  }
@@ -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'),
@@ -188,7 +188,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
188
188
  */
189
189
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
190
190
  override?: Config<ClientOptions & T>,
191
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
191
+ ) => Config<Required<ClientOptions> & T>;
192
192
 
193
193
  export interface TDataShape {
194
194
  body?: unknown;
@@ -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'),
@@ -220,7 +220,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
220
220
  */
221
221
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
222
222
  override?: Config<ClientOptions & T>,
223
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
223
+ ) => Config<Required<ClientOptions> & T>;
224
224
 
225
225
  export interface TDataShape {
226
226
  body?: unknown;
@@ -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'),
@@ -143,7 +143,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
143
143
  */
144
144
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
145
145
  override?: Config<ClientOptions & T>,
146
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
146
+ ) => Config<Required<ClientOptions> & T>;
147
147
 
148
148
  export interface TDataShape {
149
149
  body?: unknown;
@@ -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'),
@@ -147,7 +147,7 @@ type RequestFn = <
147
147
  */
148
148
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
149
149
  override?: Config<ClientOptions & T>,
150
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
150
+ ) => Config<Required<ClientOptions> & T>;
151
151
 
152
152
  export interface TDataShape {
153
153
  body?: unknown;
@@ -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'),
@@ -251,7 +251,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
251
251
  */
252
252
  export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
253
253
  override?: Config<ClientOptions & T>,
254
- ) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
254
+ ) => Config<Required<ClientOptions> & T>;
255
255
 
256
256
  export interface TDataShape {
257
257
  body?: unknown;