@hey-api/openapi-ts 0.97.2 → 0.97.3
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 +54 -53
- package/dist/clients/angular/types.ts +3 -2
- package/dist/clients/axios/types.ts +7 -2
- package/dist/clients/core/params.ts +4 -4
- package/dist/clients/fetch/types.ts +3 -2
- package/dist/clients/ky/types.ts +3 -2
- package/dist/clients/next/types.ts +7 -2
- package/dist/clients/ofetch/types.ts +3 -2
- package/dist/index.d.mts +683 -577
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-CitwzRmB.mjs → init-D3VuY80Z.mjs} +711 -648
- package/dist/init-D3VuY80Z.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +2 -2
- package/dist/{src-DEol_iHK.mjs → src-BeNy9O9X.mjs} +2 -2
- package/dist/{src-DEol_iHK.mjs.map → src-BeNy9O9X.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/init-CitwzRmB.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Part of the Hey API ecosystem.
|
|
|
39
39
|
- HTTP clients for Fetch API, Angular, Axios, Next.js, Nuxt, and more
|
|
40
40
|
- 20+ plugins to reduce third-party boilerplate
|
|
41
41
|
- highly customizable via plugins
|
|
42
|
-
- [sync with Hey API Registry](https://heyapi.dev/openapi
|
|
42
|
+
- [sync with Hey API Registry](https://heyapi.dev/docs/openapi/typescript/integrations) for spec management
|
|
43
43
|
|
|
44
44
|
<!-- template-contributing-start -->
|
|
45
45
|
|
|
@@ -177,7 +177,7 @@ The fastest way to use `@hey-api/openapi-ts` is via npx
|
|
|
177
177
|
npx @hey-api/openapi-ts -i hey-api/backend -o src/client
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](https://heyapi.dev/openapi
|
|
180
|
+
Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](https://heyapi.dev/docs/openapi/typescript/output) page.
|
|
181
181
|
|
|
182
182
|
## Installation
|
|
183
183
|
|
|
@@ -211,7 +211,7 @@ bun add @hey-api/openapi-ts -D
|
|
|
211
211
|
|
|
212
212
|
This package is in [initial development](https://semver.org/#spec-item-4). Please pin an exact version so you can safely upgrade when you're ready.
|
|
213
213
|
|
|
214
|
-
We publish [migration notes](https://heyapi.dev/openapi
|
|
214
|
+
We publish [migration notes](https://heyapi.dev/docs/openapi/typescript/migrating) for every breaking release. You might not be impacted by a breaking change if you don't use the affected features.
|
|
215
215
|
|
|
216
216
|
## Usage
|
|
217
217
|
|
|
@@ -225,7 +225,7 @@ Most people run `@hey-api/openapi-ts` via CLI. To do that, add a script to your
|
|
|
225
225
|
}
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
-
The above script can be executed by running `npm run openapi-ts` or equivalent command in other package managers. Next, we will create a [configuration](https://heyapi.dev/openapi
|
|
228
|
+
The above script can be executed by running `npm run openapi-ts` or equivalent command in other package managers. Next, we will create a [configuration](https://heyapi.dev/docs/openapi/typescript/configuration) file and move our options from Quick Start to it.
|
|
229
229
|
|
|
230
230
|
### Node.js
|
|
231
231
|
|
|
@@ -290,7 +290,7 @@ export default defineConfig({
|
|
|
290
290
|
});
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
-
See the [Vite](https://heyapi.dev/openapi
|
|
293
|
+
See the [Vite](https://heyapi.dev/docs/openapi/typescript/configuration/vite) page for full configuration options.
|
|
294
294
|
|
|
295
295
|
## Configuration
|
|
296
296
|
|
|
@@ -355,73 +355,74 @@ Clients are responsible for sending the actual HTTP requests. We default to Fetc
|
|
|
355
355
|
|
|
356
356
|
### Available Clients
|
|
357
357
|
|
|
358
|
-
- [`@hey-api/client-fetch`](https://heyapi.dev/openapi
|
|
359
|
-
- [`@hey-api/client-angular`](https://heyapi.dev/openapi
|
|
360
|
-
- [`@hey-api/client-axios`](https://heyapi.dev/openapi
|
|
361
|
-
- [`@hey-api/client-ky`](https://heyapi.dev/openapi
|
|
362
|
-
- [`@hey-api/client-next`](https://heyapi.dev/openapi
|
|
363
|
-
- [`@hey-api/client-nuxt`](https://heyapi.dev/openapi
|
|
364
|
-
- [`@hey-api/client-ofetch`](https://heyapi.dev/openapi
|
|
358
|
+
- [`@hey-api/client-fetch`](https://heyapi.dev/docs/openapi/typescript/clients/fetch)
|
|
359
|
+
- [`@hey-api/client-angular`](https://heyapi.dev/docs/openapi/typescript/clients/angular)
|
|
360
|
+
- [`@hey-api/client-axios`](https://heyapi.dev/docs/openapi/typescript/clients/axios)
|
|
361
|
+
- [`@hey-api/client-ky`](https://heyapi.dev/docs/openapi/typescript/clients/ky)
|
|
362
|
+
- [`@hey-api/client-next`](https://heyapi.dev/docs/openapi/typescript/clients/next-js)
|
|
363
|
+
- [`@hey-api/client-nuxt`](https://heyapi.dev/docs/openapi/typescript/clients/nuxt)
|
|
364
|
+
- [`@hey-api/client-ofetch`](https://heyapi.dev/docs/openapi/typescript/clients/ofetch)
|
|
365
365
|
|
|
366
366
|
### Proposed Clients (Vote to Prioritize)
|
|
367
367
|
|
|
368
368
|
The following clients are roadmap proposals and are not started yet. You can help us prioritize them by voting on [GitHub](https://github.com/hey-api/openapi-ts/issues?q=state%3Aopen%20label%3A%22vote%20%F0%9F%93%A9%22).
|
|
369
369
|
|
|
370
|
-
- [`@hey-api/client-effect`](https://heyapi.dev/openapi
|
|
370
|
+
- [`@hey-api/client-effect`](https://heyapi.dev/docs/openapi/typescript/clients/effect)
|
|
371
371
|
|
|
372
|
-
Don't see your client? [Build your own](https://heyapi.dev/openapi
|
|
372
|
+
Don't see your client? [Build your own](https://heyapi.dev/docs/openapi/typescript/clients/custom) or let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues).
|
|
373
373
|
|
|
374
374
|
### Available Plugins
|
|
375
375
|
|
|
376
376
|
These plugins help reduce boilerplate associated with third-party dependencies. Hey API natively supports the most popular packages. Please open an issue on [GitHub](https://github.com/hey-api/openapi-ts/issues) if you'd like us to support your favorite package.
|
|
377
377
|
|
|
378
|
-
- [`@angular/common`](https://heyapi.dev/openapi
|
|
379
|
-
- [`@hey-api/schemas`](https://heyapi.dev/openapi
|
|
380
|
-
- [`@hey-api/sdk`](https://heyapi.dev/openapi
|
|
381
|
-
- [`@hey-api/transformers`](https://heyapi.dev/openapi
|
|
382
|
-
- [`@hey-api/typescript`](https://heyapi.dev/openapi
|
|
383
|
-
- [`@pinia/colada`](https://heyapi.dev/openapi
|
|
384
|
-
- [`@tanstack/angular-query-experimental`](https://heyapi.dev/openapi
|
|
385
|
-
- [`@tanstack/preact-query`](https://heyapi.dev/openapi
|
|
386
|
-
- [`@tanstack/react-query`](https://heyapi.dev/openapi
|
|
387
|
-
- [`@tanstack/solid-query`](https://heyapi.dev/openapi
|
|
388
|
-
- [`@tanstack/svelte-query`](https://heyapi.dev/openapi
|
|
389
|
-
- [`@tanstack/vue-query`](https://heyapi.dev/openapi
|
|
390
|
-
- [`fastify`](https://heyapi.dev/openapi
|
|
391
|
-
- [`orpc`](https://heyapi.dev/openapi
|
|
392
|
-
- [`nestjs`](https://heyapi.dev/openapi
|
|
393
|
-
- [`valibot`](https://heyapi.dev/openapi
|
|
394
|
-
- [`zod`](https://heyapi.dev/openapi
|
|
378
|
+
- [`@angular/common`](https://heyapi.dev/docs/openapi/typescript/plugins/angular)
|
|
379
|
+
- [`@hey-api/schemas`](https://heyapi.dev/docs/openapi/typescript/plugins/schemas)
|
|
380
|
+
- [`@hey-api/sdk`](https://heyapi.dev/docs/openapi/typescript/plugins/sdk)
|
|
381
|
+
- [`@hey-api/transformers`](https://heyapi.dev/docs/openapi/typescript/plugins/transformers)
|
|
382
|
+
- [`@hey-api/typescript`](https://heyapi.dev/docs/openapi/typescript/plugins/typescript)
|
|
383
|
+
- [`@pinia/colada`](https://heyapi.dev/docs/openapi/typescript/plugins/pinia-colada)
|
|
384
|
+
- [`@tanstack/angular-query-experimental`](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-query)
|
|
385
|
+
- [`@tanstack/preact-query`](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-query)
|
|
386
|
+
- [`@tanstack/react-query`](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-query)
|
|
387
|
+
- [`@tanstack/solid-query`](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-query)
|
|
388
|
+
- [`@tanstack/svelte-query`](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-query)
|
|
389
|
+
- [`@tanstack/vue-query`](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-query)
|
|
390
|
+
- [`fastify`](https://heyapi.dev/docs/openapi/typescript/plugins/fastify)
|
|
391
|
+
- [`orpc`](https://heyapi.dev/docs/openapi/typescript/plugins/orpc)
|
|
392
|
+
- [`nestjs`](https://heyapi.dev/docs/openapi/typescript/plugins/nest)
|
|
393
|
+
- [`valibot`](https://heyapi.dev/docs/openapi/typescript/plugins/valibot)
|
|
394
|
+
- [`zod`](https://heyapi.dev/docs/openapi/typescript/plugins/zod)
|
|
395
395
|
|
|
396
396
|
### Proposed Plugins (Vote to Prioritize)
|
|
397
397
|
|
|
398
398
|
The following plugins are roadmap proposals and are not started yet. You can help us prioritize them by voting on [GitHub](https://github.com/hey-api/openapi-ts/issues?q=state%3Aopen%20label%3A%22vote%20%F0%9F%93%A9%22).
|
|
399
399
|
|
|
400
|
-
- [Adonis](https://heyapi.dev/openapi
|
|
401
|
-
- [Ajv](https://heyapi.dev/openapi
|
|
402
|
-
- [Arktype](https://heyapi.dev/openapi
|
|
403
|
-
- [Chance](https://heyapi.dev/openapi
|
|
404
|
-
- [Elysia](https://heyapi.dev/openapi
|
|
405
|
-
- [Express](https://heyapi.dev/openapi
|
|
406
|
-
- [Faker](https://heyapi.dev/openapi
|
|
407
|
-
- [Falso](https://heyapi.dev/openapi
|
|
408
|
-
- [Hono](https://heyapi.dev/openapi
|
|
409
|
-
- [Joi](https://heyapi.dev/openapi
|
|
410
|
-
- [Koa](https://heyapi.dev/openapi
|
|
411
|
-
- [MSW](https://heyapi.dev/openapi
|
|
412
|
-
- [Nock](https://heyapi.dev/openapi
|
|
413
|
-
- [Superstruct](https://heyapi.dev/openapi
|
|
414
|
-
- [Supertest](https://heyapi.dev/openapi
|
|
415
|
-
- [SWR](https://heyapi.dev/openapi
|
|
416
|
-
- [
|
|
417
|
-
- [
|
|
418
|
-
- [
|
|
419
|
-
|
|
420
|
-
|
|
400
|
+
- [Adonis](https://heyapi.dev/docs/openapi/typescript/plugins/adonis)
|
|
401
|
+
- [Ajv](https://heyapi.dev/docs/openapi/typescript/plugins/ajv)
|
|
402
|
+
- [Arktype](https://heyapi.dev/docs/openapi/typescript/plugins/arktype)
|
|
403
|
+
- [Chance](https://heyapi.dev/docs/openapi/typescript/plugins/chance)
|
|
404
|
+
- [Elysia](https://heyapi.dev/docs/openapi/typescript/plugins/elysia)
|
|
405
|
+
- [Express](https://heyapi.dev/docs/openapi/typescript/plugins/express)
|
|
406
|
+
- [Faker](https://heyapi.dev/docs/openapi/typescript/plugins/faker)
|
|
407
|
+
- [Falso](https://heyapi.dev/docs/openapi/typescript/plugins/falso)
|
|
408
|
+
- [Hono](https://heyapi.dev/docs/openapi/typescript/plugins/hono)
|
|
409
|
+
- [Joi](https://heyapi.dev/docs/openapi/typescript/plugins/joi)
|
|
410
|
+
- [Koa](https://heyapi.dev/docs/openapi/typescript/plugins/koa)
|
|
411
|
+
- [MSW](https://heyapi.dev/docs/openapi/typescript/plugins/msw)
|
|
412
|
+
- [Nock](https://heyapi.dev/docs/openapi/typescript/plugins/nock)
|
|
413
|
+
- [Superstruct](https://heyapi.dev/docs/openapi/typescript/plugins/superstruct)
|
|
414
|
+
- [Supertest](https://heyapi.dev/docs/openapi/typescript/plugins/supertest)
|
|
415
|
+
- [SWR](https://heyapi.dev/docs/openapi/typescript/plugins/swr)
|
|
416
|
+
- [TanStack Start](https://heyapi.dev/docs/openapi/typescript/plugins/tanstack-start)
|
|
417
|
+
- [TypeBox](https://heyapi.dev/docs/openapi/typescript/plugins/typebox)
|
|
418
|
+
- [Yup](https://heyapi.dev/docs/openapi/typescript/plugins/yup)
|
|
419
|
+
- [Zustand](https://heyapi.dev/docs/openapi/typescript/plugins/zustand)
|
|
420
|
+
|
|
421
|
+
Don't see your plugin? [Build your own](https://heyapi.dev/docs/openapi/typescript/plugins/custom) or let us know your interest by [opening an issue](https://github.com/hey-api/openapi-ts/issues).
|
|
421
422
|
|
|
422
423
|
## Migrating
|
|
423
424
|
|
|
424
|
-
You can learn more on the [Migrating](https://heyapi.dev/openapi
|
|
425
|
+
You can learn more on the [Migrating](https://heyapi.dev/docs/openapi/typescript/migrating) page.
|
|
425
426
|
|
|
426
427
|
<!-- template-license-start -->
|
|
427
428
|
|
|
@@ -156,12 +156,13 @@ type MethodFn = <
|
|
|
156
156
|
|
|
157
157
|
type SseFn = <
|
|
158
158
|
TData = unknown,
|
|
159
|
-
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
160
|
+
_TError = unknown,
|
|
160
161
|
ThrowOnError extends boolean = false,
|
|
161
162
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
162
163
|
>(
|
|
163
164
|
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
164
|
-
) => Promise<ServerSentEventsResult<TData
|
|
165
|
+
) => Promise<ServerSentEventsResult<TData>>;
|
|
165
166
|
|
|
166
167
|
type RequestFn = <
|
|
167
168
|
TData = unknown,
|
|
@@ -105,9 +105,14 @@ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean
|
|
|
105
105
|
options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>,
|
|
106
106
|
) => RequestResult<TData, TError, ThrowOnError>;
|
|
107
107
|
|
|
108
|
-
type SseFn = <
|
|
108
|
+
type SseFn = <
|
|
109
|
+
TData = unknown,
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
111
|
+
_TError = unknown,
|
|
112
|
+
ThrowOnError extends boolean = false,
|
|
113
|
+
>(
|
|
109
114
|
options: Omit<RequestOptions<never, ThrowOnError>, 'method'>,
|
|
110
|
-
) => Promise<ServerSentEventsResult<TData
|
|
115
|
+
) => Promise<ServerSentEventsResult<TData>>;
|
|
111
116
|
|
|
112
117
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(
|
|
113
118
|
options: Omit<RequestOptions<TData, ThrowOnError>, 'method'> &
|
|
@@ -102,10 +102,10 @@ const stripEmptySlots = (params: Params) => {
|
|
|
102
102
|
|
|
103
103
|
export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
|
|
104
104
|
const params: Params = {
|
|
105
|
-
body:
|
|
106
|
-
headers:
|
|
107
|
-
path:
|
|
108
|
-
query:
|
|
105
|
+
body: Object.create(null),
|
|
106
|
+
headers: Object.create(null),
|
|
107
|
+
path: Object.create(null),
|
|
108
|
+
query: Object.create(null),
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
const map = buildKeyMap(fields);
|
|
@@ -149,12 +149,13 @@ type MethodFn = <
|
|
|
149
149
|
|
|
150
150
|
type SseFn = <
|
|
151
151
|
TData = unknown,
|
|
152
|
-
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153
|
+
_TError = unknown,
|
|
153
154
|
ThrowOnError extends boolean = false,
|
|
154
155
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
155
156
|
>(
|
|
156
157
|
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
157
|
-
) => Promise<ServerSentEventsResult<TData
|
|
158
|
+
) => Promise<ServerSentEventsResult<TData>>;
|
|
158
159
|
|
|
159
160
|
type RequestFn = <
|
|
160
161
|
TData = unknown,
|
package/dist/clients/ky/types.ts
CHANGED
|
@@ -167,12 +167,13 @@ type MethodFn = <
|
|
|
167
167
|
|
|
168
168
|
type SseFn = <
|
|
169
169
|
TData = unknown,
|
|
170
|
-
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
171
|
+
_TError = unknown,
|
|
171
172
|
ThrowOnError extends boolean = false,
|
|
172
173
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
173
174
|
>(
|
|
174
175
|
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
175
|
-
) => Promise<ServerSentEventsResult<TData
|
|
176
|
+
) => Promise<ServerSentEventsResult<TData>>;
|
|
176
177
|
|
|
177
178
|
type RequestFn = <
|
|
178
179
|
TData = unknown,
|
|
@@ -111,9 +111,14 @@ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean
|
|
|
111
111
|
options: Omit<RequestOptions<TData, ThrowOnError>, 'method'>,
|
|
112
112
|
) => RequestResult<TData, TError, ThrowOnError>;
|
|
113
113
|
|
|
114
|
-
type SseFn = <
|
|
114
|
+
type SseFn = <
|
|
115
|
+
TData = unknown,
|
|
116
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
117
|
+
_TError = unknown,
|
|
118
|
+
ThrowOnError extends boolean = false,
|
|
119
|
+
>(
|
|
115
120
|
options: Omit<RequestOptions<never, ThrowOnError>, 'method'>,
|
|
116
|
-
) => Promise<ServerSentEventsResult<TData
|
|
121
|
+
) => Promise<ServerSentEventsResult<TData>>;
|
|
117
122
|
|
|
118
123
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(
|
|
119
124
|
options: Omit<RequestOptions<TData, ThrowOnError>, 'method'> &
|
|
@@ -212,12 +212,13 @@ type MethodFn = <
|
|
|
212
212
|
|
|
213
213
|
type SseFn = <
|
|
214
214
|
TData = unknown,
|
|
215
|
-
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
216
|
+
_TError = unknown,
|
|
216
217
|
ThrowOnError extends boolean = false,
|
|
217
218
|
TResponseStyle extends ResponseStyle = 'fields',
|
|
218
219
|
>(
|
|
219
220
|
options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>,
|
|
220
|
-
) => Promise<ServerSentEventsResult<TData
|
|
221
|
+
) => Promise<ServerSentEventsResult<TData>>;
|
|
221
222
|
|
|
222
223
|
type RequestFn = <
|
|
223
224
|
TData = unknown,
|