@hey-api/openapi-ts 0.89.2 → 0.90.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 +14 -13
- package/dist/clients/angular/client.ts +4 -0
- package/dist/clients/axios/client.ts +4 -0
- package/dist/clients/fetch/client.ts +4 -0
- package/dist/clients/ky/client.ts +4 -0
- package/dist/clients/next/client.ts +4 -0
- package/dist/clients/nuxt/client.ts +5 -0
- package/dist/clients/nuxt/types.ts +15 -9
- package/dist/{config-Baq-Kb-6.d.mts → config-D5jw0Xaw.d.mts} +6582 -5475
- package/dist/{config-CREHWzRd.d.cts → config-Dl9mEw3s.d.cts} +4112 -3006
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +49 -32
- package/dist/index.d.mts +22 -5
- package/dist/index.mjs +2 -1
- package/dist/internal.cjs +2 -1
- package/dist/internal.d.cts +2 -1
- package/dist/internal.d.mts +2 -1
- package/dist/internal.mjs +2 -1
- package/dist/openApi-BfsCCQJN.mjs +14 -0
- package/dist/openApi-BfsCCQJN.mjs.map +1 -0
- package/dist/openApi-VRTfi3V4.cjs +14 -0
- package/dist/openApi-VRTfi3V4.cjs.map +1 -0
- package/dist/run.cjs +3 -1
- package/dist/run.cjs.map +1 -1
- package/dist/run.d.cts +1 -0
- package/dist/run.d.mts +1 -0
- package/dist/run.mjs +3 -1
- package/dist/run.mjs.map +1 -1
- package/dist/src-CB7dCcql.cjs +20 -0
- package/dist/src-CB7dCcql.cjs.map +1 -0
- package/dist/src-DxXY6pL5.mjs +12 -0
- package/dist/src-DxXY6pL5.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/openApi-DV_SToAE.cjs +0 -13
- package/dist/openApi-DV_SToAE.cjs.map +0 -1
- package/dist/openApi-Dz9FsU_q.mjs +0 -13
- package/dist/openApi-Dz9FsU_q.mjs.map +0 -1
- package/dist/src-CnDKH9rV.cjs +0 -19
- package/dist/src-CnDKH9rV.cjs.map +0 -1
- package/dist/src-novPNOHw.mjs +0 -11
- package/dist/src-novPNOHw.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<p align="center">
|
|
15
15
|
<a href="https://stackblitz.com/edit/hey-api-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fsdk.gen.ts,src%2Fclient%2Ftypes.gen.ts">Demo</a>
|
|
16
16
|
<span> • </span>
|
|
17
|
-
<a href="https://heyapi.dev">
|
|
17
|
+
<a href="https://heyapi.dev">Manual</a>
|
|
18
18
|
<span> • </span>
|
|
19
19
|
<a href="https://github.com/hey-api/openapi-ts/issues">Issues</a>
|
|
20
20
|
<span> • </span>
|
|
@@ -23,21 +23,22 @@
|
|
|
23
23
|
|
|
24
24
|
## About
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
The OpenAPI to TypeScript code generator used by Vercel, OpenCode, and PayPal.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Generate production-ready SDKs, Zod schemas, TanStack Query hooks, or choose from 20+ other plugins.
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
- works with OpenAPI 2.0, 3.0, and 3.1
|
|
32
|
-
- core plugins for types, SDKs, and schemas
|
|
33
|
-
- clients for your runtime (Fetch API, Angular, Axios, Next.js, Nuxt, etc.)
|
|
34
|
-
- plugin ecosystem to reduce third-party boilerplate
|
|
35
|
-
- custom plugins and custom clients
|
|
36
|
-
- [integration](https://heyapi.dev/openapi-ts/integrations) with Hey API Platform
|
|
30
|
+
Part of the Hey API ecosystem.
|
|
37
31
|
|
|
38
|
-
##
|
|
32
|
+
## Features
|
|
39
33
|
|
|
40
|
-
|
|
34
|
+
- production-ready code that compiles
|
|
35
|
+
- runs in any Node.js 20+ environment
|
|
36
|
+
- accepts any OpenAPI specification
|
|
37
|
+
- core plugins for SDKs, types, and schemas
|
|
38
|
+
- HTTP clients for Fetch API, Angular, Axios, Next.js, Nuxt, and more
|
|
39
|
+
- 20+ plugins to reduce third-party boilerplate
|
|
40
|
+
- highly customizable via plugins
|
|
41
|
+
- [sync with Hey API Registry](https://heyapi.dev/openapi-ts/integrations) for spec management
|
|
41
42
|
|
|
42
43
|
## Contributing
|
|
43
44
|
|
|
@@ -47,7 +48,7 @@ Start with our [Contributing](https://heyapi.dev/openapi-ts/community/contributi
|
|
|
47
48
|
|
|
48
49
|
## Sponsors
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
Hey API is sponsor-funded. If you rely on Hey API in production, consider becoming a [sponsor](https://github.com/sponsors/hey-api) to accelerate the roadmap.
|
|
51
52
|
|
|
52
53
|
<h3 align="center">Gold</h3>
|
|
53
54
|
|
|
@@ -212,6 +212,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
212
212
|
body: opts.body as BodyInit | null | undefined,
|
|
213
213
|
headers: opts.headers as unknown as Record<string, string>,
|
|
214
214
|
method,
|
|
215
|
+
serializedBody: getValidRequestBody(opts) as
|
|
216
|
+
| BodyInit
|
|
217
|
+
| null
|
|
218
|
+
| undefined,
|
|
215
219
|
url,
|
|
216
220
|
});
|
|
217
221
|
};
|
|
@@ -125,6 +125,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
125
125
|
body: opts.body as BodyInit | null | undefined,
|
|
126
126
|
headers: opts.headers as Record<string, string>,
|
|
127
127
|
method,
|
|
128
|
+
serializedBody: getValidRequestBody(opts) as
|
|
129
|
+
| BodyInit
|
|
130
|
+
| null
|
|
131
|
+
| undefined,
|
|
128
132
|
// @ts-expect-error
|
|
129
133
|
signal: opts.signal,
|
|
130
134
|
url,
|
|
@@ -8,6 +8,7 @@ import { reactive, ref, watch } from 'vue';
|
|
|
8
8
|
|
|
9
9
|
import { createSseClient } from '../core/serverSentEvents';
|
|
10
10
|
import type { HttpMethod } from '../core/types';
|
|
11
|
+
import { getValidRequestBody } from '../core/utils';
|
|
11
12
|
import type { Client, Config, RequestOptions } from './types';
|
|
12
13
|
import {
|
|
13
14
|
buildUrl,
|
|
@@ -193,6 +194,10 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
193
194
|
body: opts.body as BodyInit | null | undefined,
|
|
194
195
|
method,
|
|
195
196
|
onRequest: undefined,
|
|
197
|
+
serializedBody: getValidRequestBody(opts) as
|
|
198
|
+
| BodyInit
|
|
199
|
+
| null
|
|
200
|
+
| undefined,
|
|
196
201
|
signal: unwrapRefs(opts.signal) as AbortSignal,
|
|
197
202
|
url,
|
|
198
203
|
});
|
|
@@ -31,8 +31,14 @@ export type QuerySerializer = (
|
|
|
31
31
|
|
|
32
32
|
type WithRefs<TData> = {
|
|
33
33
|
[K in keyof TData]: NonNullable<TData[K]> extends object
|
|
34
|
-
?
|
|
35
|
-
|
|
34
|
+
?
|
|
35
|
+
| WithRefs<NonNullable<TData[K]>>
|
|
36
|
+
| Ref<NonNullable<TData[K]>>
|
|
37
|
+
| Extract<TData[K], null>
|
|
38
|
+
:
|
|
39
|
+
| NonNullable<TData[K]>
|
|
40
|
+
| Ref<NonNullable<TData[K]>>
|
|
41
|
+
| Extract<TData[K], null>;
|
|
36
42
|
};
|
|
37
43
|
|
|
38
44
|
// copied from Nuxt
|
|
@@ -68,15 +74,8 @@ export interface RequestOptions<
|
|
|
68
74
|
Url extends string = string,
|
|
69
75
|
> extends Config,
|
|
70
76
|
WithRefs<{
|
|
71
|
-
/**
|
|
72
|
-
* Any body that you want to add to your request.
|
|
73
|
-
*
|
|
74
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
75
|
-
*/
|
|
76
|
-
body?: unknown;
|
|
77
77
|
path?: FetchOptions<unknown>['query'];
|
|
78
78
|
query?: FetchOptions<unknown>['query'];
|
|
79
|
-
rawBody?: unknown;
|
|
80
79
|
}>,
|
|
81
80
|
Pick<
|
|
82
81
|
ServerSentEventsOptions<ResT>,
|
|
@@ -87,8 +86,15 @@ export interface RequestOptions<
|
|
|
87
86
|
| 'sseMaxRetryDelay'
|
|
88
87
|
> {
|
|
89
88
|
asyncDataOptions?: AsyncDataOptions<ResT, ResT, KeysOf<ResT>, DefaultT>;
|
|
89
|
+
/**
|
|
90
|
+
* Any body that you want to add to your request.
|
|
91
|
+
*
|
|
92
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
|
93
|
+
*/
|
|
94
|
+
body?: NonNullable<unknown> | Ref<NonNullable<unknown>> | null;
|
|
90
95
|
composable?: TComposable;
|
|
91
96
|
key?: string;
|
|
97
|
+
rawBody?: NonNullable<unknown> | Ref<NonNullable<unknown>> | null;
|
|
92
98
|
/**
|
|
93
99
|
* Security mechanism(s) to use for the request.
|
|
94
100
|
*/
|