From 7f4a7a53b2fbe0f9db68f55a35f2d09d836e36df Mon Sep 17 00:00:00 2001 From: Stijn Van Hulle Date: Tue, 24 Sep 2024 21:53:51 +0200 Subject: [PATCH] feat: Expose queryKey and mutationKey for the SWR plugin --- .changeset/modern-laws-deliver.md | 14 + .changeset/warm-ligers-rescue.md | 5 + docs/blog/benefits-of-templates.md | 2 +- docs/blog/v2.md | 7 +- docs/changelog.md | 24 +- docs/package.json | 4 +- .../clients/swr/petSWRController/useAddPet.ts | 8 +- .../swr/petSWRController/useDeletePet.ts | 8 +- .../petSWRController/useFindPetsByStatus.ts | 8 +- .../swr/petSWRController/useFindPetsByTags.ts | 8 +- .../swr/petSWRController/useGetPetById.ts | 8 +- .../swr/petSWRController/useUpdatePet.ts | 8 +- .../petSWRController/useUpdatePetWithForm.ts | 8 +- .../swr/petSWRController/useUploadFile.ts | 8 +- .../swr/petsSWRController/useCreatePets.ts | 8 +- .../swr/userSWRController/useCreateUser.ts | 8 +- .../useCreateUsersWithListInput.ts | 8 +- .../swr/userSWRController/useDeleteUser.ts | 8 +- .../swr/userSWRController/useGetUserByName.ts | 8 +- .../swr/userSWRController/useLoginUser.ts | 8 +- .../swr/userSWRController/useLogoutUser.ts | 8 +- .../swr/userSWRController/useUpdateUser.ts | 8 +- examples/client/kubb.config.ts | 2 + examples/client/src/gen/tagObject.ts | 40 +++ .../src/generators/clientStaticGenerator.tsx | 72 ++++ examples/react-query/package.json | 2 +- examples/swr/src/gen/hooks/index.ts | 60 ++-- examples/swr/src/gen/hooks/useAddPet.ts | 8 +- examples/swr/src/gen/hooks/useCreateUser.ts | 8 +- .../gen/hooks/useCreateUsersWithListInput.ts | 8 +- examples/swr/src/gen/hooks/useDeleteOrder.ts | 8 +- examples/swr/src/gen/hooks/useDeletePet.ts | 8 +- examples/swr/src/gen/hooks/useDeleteUser.ts | 8 +- .../swr/src/gen/hooks/useFindPetsByStatus.ts | 8 +- .../swr/src/gen/hooks/useFindPetsByTags.ts | 8 +- examples/swr/src/gen/hooks/useGetInventory.ts | 8 +- examples/swr/src/gen/hooks/useGetOrderById.ts | 8 +- examples/swr/src/gen/hooks/useGetPetById.ts | 8 +- .../swr/src/gen/hooks/useGetUserByName.ts | 8 +- examples/swr/src/gen/hooks/useLoginUser.ts | 8 +- examples/swr/src/gen/hooks/useLogoutUser.ts | 8 +- examples/swr/src/gen/hooks/usePlaceOrder.ts | 8 +- .../swr/src/gen/hooks/usePlaceOrderPatch.ts | 8 +- examples/swr/src/gen/hooks/useUpdatePet.ts | 8 +- .../swr/src/gen/hooks/useUpdatePetWithForm.ts | 8 +- examples/swr/src/gen/hooks/useUpdateUser.ts | 8 +- examples/swr/src/gen/hooks/useUploadFile.ts | 8 +- examples/swr/src/gen/index.ts | 60 ++-- examples/vue-query/src/gen/hooks/useAddPet.ts | 80 +++-- .../vue-query/src/gen/hooks/useCreateUser.ts | 80 +++-- .../gen/hooks/useCreateUsersWithListInput.ts | 85 +++-- .../vue-query/src/gen/hooks/useDeleteOrder.ts | 81 +++-- .../vue-query/src/gen/hooks/useDeletePet.ts | 87 +++-- .../vue-query/src/gen/hooks/useDeleteUser.ts | 81 +++-- .../src/gen/hooks/useFindPetsByStatus.ts | 87 +++-- .../src/gen/hooks/useFindPetsByTags.ts | 87 +++-- .../src/gen/hooks/useGetInventory.ts | 79 +++-- .../src/gen/hooks/useGetOrderById.ts | 85 ++--- .../vue-query/src/gen/hooks/useGetPetById.ts | 84 ++--- .../src/gen/hooks/useGetUserByName.ts | 89 ++--- .../vue-query/src/gen/hooks/useLoginUser.ts | 83 +++-- .../vue-query/src/gen/hooks/useLogoutUser.ts | 79 +++-- .../vue-query/src/gen/hooks/usePlaceOrder.ts | 80 +++-- .../vue-query/src/gen/hooks/useUpdatePet.ts | 80 +++-- .../src/gen/hooks/useUpdatePetWithForm.ts | 92 +++-- .../vue-query/src/gen/hooks/useUpdateUser.ts | 91 +++-- .../vue-query/src/gen/hooks/useUploadFile.ts | 99 +++--- examples/vue-query/src/gen/models/AddPet.ts | 36 +- examples/vue-query/src/gen/models/Address.ts | 60 ++-- .../vue-query/src/gen/models/ApiResponse.ts | 26 +- examples/vue-query/src/gen/models/Category.ts | 18 +- .../vue-query/src/gen/models/CreateUser.ts | 24 +- .../gen/models/CreateUsersWithListInput.ts | 30 +- examples/vue-query/src/gen/models/Customer.ts | 30 +- .../vue-query/src/gen/models/DeleteOrder.ts | 36 +- .../vue-query/src/gen/models/DeletePet.ts | 44 +-- .../vue-query/src/gen/models/DeleteUser.ts | 36 +- .../src/gen/models/FindPetsByStatus.ts | 58 ++-- .../src/gen/models/FindPetsByTags.ts | 44 +-- .../vue-query/src/gen/models/GetInventory.ts | 20 +- .../vue-query/src/gen/models/GetOrderById.ts | 50 +-- .../vue-query/src/gen/models/GetPetById.ts | 50 +-- .../vue-query/src/gen/models/GetUserByName.ts | 50 +-- .../vue-query/src/gen/models/LoginUser.ts | 50 +-- .../vue-query/src/gen/models/LogoutUser.ts | 12 +- examples/vue-query/src/gen/models/Order.ts | 64 ++-- examples/vue-query/src/gen/models/Pet.ts | 70 ++-- .../vue-query/src/gen/models/PlaceOrder.ts | 32 +- examples/vue-query/src/gen/models/Tag.ts | 18 +- .../vue-query/src/gen/models/UpdatePet.ts | 48 +-- .../src/gen/models/UpdatePetWithForm.ts | 56 +-- .../vue-query/src/gen/models/UpdateUser.ts | 40 +-- .../vue-query/src/gen/models/UploadFile.ts | 56 +-- examples/vue-query/src/gen/models/User.ts | 68 ++-- .../vue-query/src/gen/models/UserArray.ts | 4 +- package.json | 2 +- packages/cli/package.json | 2 +- packages/config-tsup/package.json | 2 +- packages/kubb/package.json | 2 +- packages/plugin-client/src/plugin.ts | 3 +- packages/plugin-client/src/types.ts | 6 +- packages/plugin-faker/src/plugin.ts | 5 +- packages/plugin-faker/src/types.ts | 6 +- packages/plugin-msw/package.json | 2 +- packages/plugin-msw/src/plugin.ts | 13 +- packages/plugin-msw/src/types.ts | 6 +- packages/plugin-oas/package.json | 2 +- packages/plugin-react-query/package.json | 2 +- .../src/components/Mutation.tsx | 3 +- .../src/generators/mutationGenerator.tsx | 1 - packages/plugin-react-query/src/plugin.ts | 3 +- packages/plugin-react-query/src/types.ts | 7 +- packages/plugin-redoc/package.json | 2 +- packages/plugin-solid-query/package.json | 2 +- packages/plugin-solid-query/src/plugin.ts | 3 +- packages/plugin-solid-query/src/types.ts | 6 +- packages/plugin-svelte-query/package.json | 2 +- .../src/components/Mutation.tsx | 3 +- .../src/generators/mutationGenerator.tsx | 1 - packages/plugin-svelte-query/src/plugin.ts | 3 +- packages/plugin-svelte-query/src/types.ts | 6 +- packages/plugin-swr/package.json | 2 +- .../plugin-swr/src/components/Mutation.tsx | 20 +- .../plugin-swr/src/components/MutationKey.tsx | 48 +++ packages/plugin-swr/src/components/Query.tsx | 18 +- .../plugin-swr/src/components/QueryKey.tsx | 73 ++++ packages/plugin-swr/src/components/index.ts | 2 + .../__snapshots__/clientDataReturnTypeFull.ts | 8 +- .../__snapshots__/clientGetImportPath.ts | 8 +- .../__snapshots__/clientPostImportPath.ts | 8 +- .../generators/__snapshots__/findByTags.ts | 8 +- .../findByTagsPathParamsObject.ts | 8 +- .../__snapshots__/findByTagsWithZod.ts | 8 +- .../generators/__snapshots__/getAsMutation.ts | 8 +- .../generators/__snapshots__/postAsQuery.ts | 8 +- .../generators/__snapshots__/updatePetById.ts | 8 +- .../updatePetByIdPathParamsObject.ts | 8 +- .../src/generators/mutationGenerator.test.tsx | 3 + .../src/generators/mutationGenerator.tsx | 16 + .../src/generators/queryGenerator.test.tsx | 3 + .../src/generators/queryGenerator.tsx | 14 + packages/plugin-swr/src/plugin.ts | 5 +- packages/plugin-swr/src/types.ts | 14 +- packages/plugin-ts/package.json | 2 +- packages/plugin-ts/src/plugin.ts | 5 +- packages/plugin-ts/src/types.ts | 6 +- packages/plugin-vue-query/package.json | 2 +- .../src/components/Mutation.tsx | 3 +- .../src/generators/mutationGenerator.tsx | 1 - packages/plugin-vue-query/src/plugin.ts | 3 +- packages/plugin-vue-query/src/types.ts | 6 +- packages/plugin-zod/src/plugin.ts | 5 +- packages/plugin-zod/src/types.ts | 6 +- packages/react/package.json | 2 +- packages/unplugin-kubb/package.json | 2 +- pnpm-lock.yaml | 318 +++++++++--------- 156 files changed, 2457 insertions(+), 1616 deletions(-) create mode 100644 .changeset/modern-laws-deliver.md create mode 100644 .changeset/warm-ligers-rescue.md create mode 100644 examples/client/src/generators/clientStaticGenerator.tsx create mode 100644 packages/plugin-swr/src/components/MutationKey.tsx create mode 100644 packages/plugin-swr/src/components/QueryKey.tsx diff --git a/.changeset/modern-laws-deliver.md b/.changeset/modern-laws-deliver.md new file mode 100644 index 000000000..9b80ef3d7 --- /dev/null +++ b/.changeset/modern-laws-deliver.md @@ -0,0 +1,14 @@ +--- +"@kubb/plugin-svelte-query": minor +"@kubb/plugin-react-query": minor +"@kubb/plugin-solid-query": minor +"@kubb/plugin-vue-query": minor +"@kubb/plugin-client": minor +"@kubb/plugin-faker": minor +"@kubb/plugin-msw": minor +"@kubb/plugin-swr": minor +"@kubb/plugin-zod": minor +"@kubb/plugin-ts": minor +--- + +'generators' option for all plugins diff --git a/.changeset/warm-ligers-rescue.md b/.changeset/warm-ligers-rescue.md new file mode 100644 index 000000000..618231d61 --- /dev/null +++ b/.changeset/warm-ligers-rescue.md @@ -0,0 +1,5 @@ +--- +"@kubb/plugin-swr": minor +--- + +Expose queryKey and mutationKey for the SWR plugin diff --git a/docs/blog/benefits-of-templates.md b/docs/blog/benefits-of-templates.md index acbd86af2..c8b563623 100644 --- a/docs/blog/benefits-of-templates.md +++ b/docs/blog/benefits-of-templates.md @@ -111,4 +111,4 @@ If you compare the previous template with an example using JSX/React, you can al ## Overriding with templates -We've made a guide on how you can override templates in our plugins: [templates the guide](/guide/tutorial/templates). +We've made a guide on how you can override templates in our plugins: [templates the guide](/tutorials/templates). diff --git a/docs/blog/v2.md b/docs/blog/v2.md index fbcc86bcb..fa40da7f5 100644 --- a/docs/blog/v2.md +++ b/docs/blog/v2.md @@ -33,7 +33,7 @@ Kubb has been available for almost a year and we have learned a lot since v1. Mo Another big change is that it will now also be possible to use multiple of the same plugins and with the introduction of `exclude/include/override` you can generate code for just one specific path. -The introduction of `React` and `JSX` was also a big change, in the background we can now 'translate' Swagger/OpenAPI files to generated code(TypeScript, ReactQuery, ...). More about why and how we did this can be found in the [Benefits of using JSX for templates](/blog/whyTemplates) blog. +The introduction of `React` and `JSX` was also a big change, in the background we can now 'translate' Swagger/OpenAPI files to generated code(TypeScript, ReactQuery, ...). More about why and how we did this can be found in the [Benefits of using JSX for templates](/blog/benefits-of-templates) blog. Because of this change we can now use [templates](/reference/templates) to override the default behaviour of for example the `useQuery` of @tanstack/query. @@ -54,9 +54,8 @@ In practice, most of the "breaking" changes should not have an actual effect, an With templates you can override the default behaviour of our plugins. -- [What are templates](/reference/templates) -- [Benefits of using JSX for templates](/blog/whyTemplates) -- [Guide in create your own template](/guide/tutorial/templates) +- [Benefits of using JSX for templates](/blog/benefits-of-templates) +- [Guide in create your own template](/tutorials/templates) ### Exclude and include diff --git a/docs/changelog.md b/docs/changelog.md index 1cb3dc009..29d7e0ca2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,22 +4,26 @@ title: Changelog # Changelog +## 3.0.0-alpha.26 +- [`plugin-swr`](/plugins/plugin-swr/): Expose queryKey and mutationKey for the SWR plugin +- 'generators' option for all plugins + ## 3.0.0-alpha.25 -- [`plugin-react-query`](/plugins/plugin-react-query): Use of MutationKeys for `useMutation` -- [`plugin-svelte-query`](/plugins/plugin-react-query): Use of MutationKeys for `createMutation` -- [`plugin-vue-query`](/plugins/plugin-vue-query): Use of MutationKeys for `useMutation` +- [`plugin-react-query`](/plugins/plugin-react-query/): Use of MutationKeys for `useMutation` +- [`plugin-svelte-query`](/plugins/plugin-react-query/): Use of MutationKeys for `createMutation` +- [`plugin-vue-query`](/plugins/plugin-vue-query/): Use of MutationKeys for `useMutation` ## 3.0.0-alpha.24 -- [`plugin-oas`](/plugins/plugin-oas): Support for [discriminator](https://swagger.io/specification/?sbsearch=discriminator) +- [`plugin-oas`](/plugins/plugin-oas/): Support for [discriminator](https://swagger.io/specification/?sbsearch=discriminator) ## 3.0.0-alpha.23 -- [`plugin-client`](/plugins/plugin-client): Use of uppercase for httpMethods, `GET` instead of `get`, `POST` instead of `post`, ... +- [`plugin-client`](/plugins/plugin-client/): Use of uppercase for httpMethods, `GET` instead of `get`, `POST` instead of `post`, ... ## 3.0.0-alpha.22 -- [`plugin-faker`](/plugins/plugin-faker): Use of `faker.image.url()` instead of `faker.image.imageUrl()` -- [`plugin-zod`](/plugins/plugin-zod): Enums should use `z.literal` when format is set to number, string or boolean +- [`plugin-faker`](/plugins/plugin-faker/): Use of `faker.image.url()` instead of `faker.image.imageUrl()` +- [`plugin-zod`](/plugins/plugin-zod/): Enums should use `z.literal` when format is set to number, string or boolean ::: code-group @@ -35,12 +39,12 @@ z.enum(["true", "false"]) // [!code --] z.union([z.literal(true), z.literal(false)]) // [!code ++] ``` ::: -- [`plugin-ts`](/plugins/plugin-ts): Use of `readonly` for references($ref) -- [`plugin-client`](/plugins/plugin-client): Use of type `Error` when no errors are set for an operation +- [`plugin-ts`](/plugins/plugin-ts/): Use of `readonly` for references($ref) +- [`plugin-client`](/plugins/plugin-client/): Use of type `Error` when no errors are set for an operation ## 3.0.0-alpha.21 -- [`plugin-zod`](/plugins/plugin-zod): Use of `x-nullable` and `nullable` for additionalProperties. +- [`plugin-zod`](/plugins/plugin-zod/): Use of `x-nullable` and `nullable` for additionalProperties. ## 3.0.0-alpha.20 diff --git a/docs/package.json b/docs/package.json index aff8542ee..315c44c52 100644 --- a/docs/package.json +++ b/docs/package.json @@ -43,8 +43,8 @@ "@kubb/plugin-vue-query": "workspace:*", "@kubb/plugin-zod": "workspace:*", "@kubb/react": "workspace:*", - "@types/node": "^20.16.5", - "@types/react": "^18.3.8", + "@types/node": "^20.16.6", + "@types/react": "^18.3.9", "cross-env": "^7.0.3", "react": "^18.3.1", "unplugin-kubb": "workspace:^", diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts index f6a7381de..de3a1fa79 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useAddPet.ts @@ -6,6 +6,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { addPetMutationResponseSchema } from '../../../zod/petController/addPetSchema.ts' +export const addPetMutationKey = () => [{ url: '/pet' }] as const + +export type AddPetMutationKey = ReturnType + /** * @description Add a new pet to the store * @summary Add a new pet to the store @@ -35,9 +39,9 @@ export function useAddPet( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet'] as const + const mutationKey = addPetMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return addPet(data, config) }, diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts index 3760ef6c4..5e65e80e2 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useDeletePet.ts @@ -6,6 +6,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { deletePetMutationResponseSchema } from '../../../zod/petController/deletePetSchema.ts' +export const deletePetMutationKey = () => [{ url: '/pet/{petId}' }] as const + +export type DeletePetMutationKey = ReturnType + /** * @description delete a pet * @summary Deletes a pet @@ -37,9 +41,9 @@ export function useDeletePet( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}`] as const + const mutationKey = deletePetMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return deletePet(petId, headers, config) }, diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts index 1cb52af60..fa1597776 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByStatus.ts @@ -5,6 +5,10 @@ import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPe import type { Key, SWRConfiguration } from 'swr' import { findPetsByStatusQueryResponseSchema } from '../../../zod/petController/findPetsByStatusSchema.ts' +export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const + +export type FindPetsByStatusQueryKey = ReturnType + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status @@ -43,8 +47,8 @@ export function useFindPetsByStatus( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet/findByStatus', params] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByStatusQueryKey(params) + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByStatusQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts index abd19081d..3d5ba0e9a 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useFindPetsByTags.ts @@ -10,6 +10,10 @@ import type { import type { Key, SWRConfiguration } from 'swr' import { findPetsByTagsQueryResponseSchema } from '../../../zod/petController/findPetsByTagsSchema.ts' +export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const + +export type FindPetsByTagsQueryKey = ReturnType + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -50,8 +54,8 @@ export function useFindPetsByTags( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet/findByTags', params] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params) + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(headers, params, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts index e6a825221..f3ba5202b 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useGetPetById.ts @@ -5,6 +5,10 @@ import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetP import type { Key, SWRConfiguration } from 'swr' import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts' +export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const + +export type GetPetByIdQueryKey = ReturnType + /** * @description Returns a single pet * @summary Find pet by ID @@ -42,8 +46,8 @@ export function useGetPetById( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}`] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = getPetByIdQueryKey(petId) + return useSWR(shouldFetch ? queryKey : null, { ...getPetByIdQueryOptions(petId, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts index 1f292ca62..efc4e314c 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePet.ts @@ -12,6 +12,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { updatePetMutationResponseSchema } from '../../../zod/petController/updatePetSchema.ts' +export const updatePetMutationKey = () => [{ url: '/pet' }] as const + +export type UpdatePetMutationKey = ReturnType + /** * @description Update an existing pet by Id * @summary Update an existing pet @@ -41,9 +45,9 @@ export function useUpdatePet( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet'] as const + const mutationKey = updatePetMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return updatePet(data, config) }, diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts index 2270b8f1d..43c3dd3c4 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useUpdatePetWithForm.ts @@ -11,6 +11,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { updatePetWithFormMutationResponseSchema } from '../../../zod/petController/updatePetWithFormSchema.ts' +export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const + +export type UpdatePetWithFormMutationKey = ReturnType + /** * @summary Updates a pet in the store with form data * @link /pet/:petId @@ -40,9 +44,9 @@ export function useUpdatePetWithForm( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}`, params] as const + const mutationKey = updatePetWithFormMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return updatePetWithForm(petId, params, config) }, diff --git a/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts b/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts index 967c6f809..2edb623c9 100644 --- a/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts +++ b/examples/advanced/src/gen/clients/swr/petSWRController/useUploadFile.ts @@ -11,6 +11,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { uploadFileMutationResponseSchema } from '../../../zod/petController/uploadFileSchema.ts' +export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const + +export type UploadFileMutationKey = ReturnType + /** * @summary uploads an image * @link /pet/:petId/uploadImage @@ -47,9 +51,9 @@ export function useUploadFile( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}/uploadImage`, params] as const + const mutationKey = uploadFileMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return uploadFile(petId, data, params, config) }, diff --git a/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts b/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts index 1322cebaa..69fc26e9f 100644 --- a/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts +++ b/examples/advanced/src/gen/clients/swr/petsSWRController/useCreatePets.ts @@ -12,6 +12,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { createPetsMutationResponseSchema } from '../../../zod/petsController/createPetsSchema.ts' +export const createPetsMutationKey = () => [{ url: '/pets/{uuid}' }] as const + +export type CreatePetsMutationKey = ReturnType + /** * @summary Create a pet * @link /pets/:uuid @@ -50,9 +54,9 @@ export function useCreatePets( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pets/${uuid}`, params] as const + const mutationKey = createPetsMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return createPets(uuid, data, headers, params, config) }, diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts index 3595a5932..61eca0bff 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUser.ts @@ -6,6 +6,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { createUserMutationResponseSchema } from '../../../zod/userController/createUserSchema.ts' +export const createUserMutationKey = () => [{ url: '/user' }] as const + +export type CreateUserMutationKey = ReturnType + /** * @description This can only be done by the logged in user. * @summary Create user @@ -35,9 +39,9 @@ export function useCreateUser( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user'] as const + const mutationKey = createUserMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return createUser(data, config) }, diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts index 08fb5e3c8..f4b5f388e 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useCreateUsersWithListInput.ts @@ -9,6 +9,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { createUsersWithListInputMutationResponseSchema } from '../../../zod/userController/createUsersWithListInputSchema.ts' +export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const + +export type CreateUsersWithListInputMutationKey = ReturnType + /** * @description Creates list of users with given input array * @summary Creates list of users with given input array @@ -41,9 +45,9 @@ export function useCreateUsersWithListInput( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user/createWithList'] as const + const mutationKey = createUsersWithListInputMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return createUsersWithListInput(data, config) }, diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts index 80bf7e122..64de004b6 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useDeleteUser.ts @@ -6,6 +6,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { deleteUserMutationResponseSchema } from '../../../zod/userController/deleteUserSchema.ts' +export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const + +export type DeleteUserMutationKey = ReturnType + /** * @description This can only be done by the logged in user. * @summary Delete user @@ -35,9 +39,9 @@ export function useDeleteUser( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/user/${username}`] as const + const mutationKey = deleteUserMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return deleteUser(username, config) }, diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts index a8d594169..94104f4fe 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useGetUserByName.ts @@ -10,6 +10,10 @@ import type { import type { Key, SWRConfiguration } from 'swr' import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts' +export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const + +export type GetUserByNameQueryKey = ReturnType + /** * @summary Get user by user name * @link /user/:username @@ -45,8 +49,8 @@ export function useGetUserByName( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/user/${username}`] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = getUserByNameQueryKey(username) + return useSWR(shouldFetch ? queryKey : null, { ...getUserByNameQueryOptions(username, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts index c37127dc2..58fa4a315 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useLoginUser.ts @@ -5,6 +5,10 @@ import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from import type { Key, SWRConfiguration } from 'swr' import { loginUserQueryResponseSchema } from '../../../zod/userController/loginUserSchema.ts' +export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const + +export type LoginUserQueryKey = ReturnType + /** * @summary Logs user into the system * @link /user/login @@ -41,8 +45,8 @@ export function useLoginUser( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user/login', params] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = loginUserQueryKey(params) + return useSWR(shouldFetch ? queryKey : null, { ...loginUserQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts index 30726677b..65bb1265a 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useLogoutUser.ts @@ -5,6 +5,10 @@ import type { LogoutUserQueryResponse } from '../../../models/ts/userController/ import type { Key, SWRConfiguration } from 'swr' import { logoutUserQueryResponseSchema } from '../../../zod/userController/logoutUserSchema.ts' +export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const + +export type LogoutUserQueryKey = ReturnType + /** * @summary Logs out current logged in user session * @link /user/logout @@ -39,8 +43,8 @@ export function useLogoutUser( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user/logout'] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = logoutUserQueryKey() + return useSWR(shouldFetch ? queryKey : null, { ...logoutUserQueryOptions(config), ...queryOptions, }) diff --git a/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts b/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts index 53ea549e6..1269d69ac 100644 --- a/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts +++ b/examples/advanced/src/gen/clients/swr/userSWRController/useUpdateUser.ts @@ -6,6 +6,10 @@ import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' import { updateUserMutationResponseSchema } from '../../../zod/userController/updateUserSchema.ts' +export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const + +export type UpdateUserMutationKey = ReturnType + /** * @description This can only be done by the logged in user. * @summary Update user @@ -40,9 +44,9 @@ export function useUpdateUser( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/user/${username}`] as const + const mutationKey = updateUserMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return updateUser(username, data, config) }, diff --git a/examples/client/kubb.config.ts b/examples/client/kubb.config.ts index f6b650886..c9c1ec320 100644 --- a/examples/client/kubb.config.ts +++ b/examples/client/kubb.config.ts @@ -5,6 +5,7 @@ import transformers from '@kubb/core/transformers' import { pluginClient } from '@kubb/plugin-client' import { pluginOas } from '@kubb/plugin-oas' import { pluginTs } from '@kubb/plugin-ts' +import { clientStaticGenerator } from './src/generators/clientStaticGenerator' export default defineConfig(() => { return { @@ -51,6 +52,7 @@ export default defineConfig(() => { path: './tagObject.ts', exportType: false, }, + generators: [clientStaticGenerator], include: [ { type: 'tag', diff --git a/examples/client/src/gen/tagObject.ts b/examples/client/src/gen/tagObject.ts index e149e58d5..212df90fb 100644 --- a/examples/client/src/gen/tagObject.ts +++ b/examples/client/src/gen/tagObject.ts @@ -21,6 +21,14 @@ export async function getInventory(config: Partial = {}) { return res } +getInventory.method = 'get' as const +getInventory.url = '/store/inventory' as const +getInventory.operationId = 'getInventory' as const +getInventory.request = {} as never +getInventory.response = {} as GetInventoryQueryResponse +getInventory.pathParams = {} as never +getInventory.queryParams = {} as never + /** * @description Place a new order in the store * @summary Place an order for a pet @@ -37,6 +45,14 @@ export async function placeOrder(data?: PlaceOrderMutationRequest, config: Parti return res } +placeOrder.method = 'post' as const +placeOrder.url = '/store/order' as const +placeOrder.operationId = 'placeOrder' as const +placeOrder.request = {} as PlaceOrderMutationRequest +placeOrder.response = {} as PlaceOrderMutationResponse +placeOrder.pathParams = {} as never +placeOrder.queryParams = {} as never + /** * @description Place a new order in the store with patch * @summary Place an order for a pet with patch @@ -53,6 +69,14 @@ export async function placeOrderPatch(data?: PlaceOrderPatchMutationRequest, con return res } +placeOrderPatch.method = 'patch' as const +placeOrderPatch.url = '/store/order' as const +placeOrderPatch.operationId = 'placeOrderPatch' as const +placeOrderPatch.request = {} as PlaceOrderPatchMutationRequest +placeOrderPatch.response = {} as PlaceOrderPatchMutationResponse +placeOrderPatch.pathParams = {} as never +placeOrderPatch.queryParams = {} as never + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID @@ -75,6 +99,14 @@ export async function getOrderById( return res } +getOrderById.method = 'get' as const +getOrderById.url = '/store/order/:orderId' as const +getOrderById.operationId = 'getOrderById' as const +getOrderById.request = {} as never +getOrderById.response = {} as GetOrderByIdQueryResponse +getOrderById.pathParams = {} as GetOrderByIdPathParams +getOrderById.queryParams = {} as never + /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID @@ -96,3 +128,11 @@ export async function deleteOrder( }) return res } + +deleteOrder.method = 'delete' as const +deleteOrder.url = '/store/order/:orderId' as const +deleteOrder.operationId = 'deleteOrder' as const +deleteOrder.request = {} as never +deleteOrder.response = {} as DeleteOrderMutationResponse +deleteOrder.pathParams = {} as DeleteOrderPathParams +deleteOrder.queryParams = {} as never diff --git a/examples/client/src/generators/clientStaticGenerator.tsx b/examples/client/src/generators/clientStaticGenerator.tsx new file mode 100644 index 000000000..ef40a9ac2 --- /dev/null +++ b/examples/client/src/generators/clientStaticGenerator.tsx @@ -0,0 +1,72 @@ +import { URLPath } from '@kubb/core/utils' +import type { PluginClient } from '@kubb/plugin-client' +import { Client } from '@kubb/plugin-client/components' +import { createReactGenerator } from '@kubb/plugin-oas' +import { useOperationManager } from '@kubb/plugin-oas/hooks' +import { pluginTsName } from '@kubb/plugin-ts' +import { File, useApp } from '@kubb/react' + +export const clientStaticGenerator = createReactGenerator({ + name: 'client', + Operation({ options, operation }) { + const { + plugin: { + options: { output }, + }, + } = useApp() + const { getSchemas, getName, getFile } = useOperationManager() + + const client = { + name: getName(operation, { type: 'function' }), + file: getFile(operation), + } + + const type = { + file: getFile(operation, { pluginKey: [pluginTsName] }), + schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }), + } + + return ( + + + + item.name) || []), + ].filter(Boolean)} + root={client.file.path} + path={type.file.path} + isTypeOnly + /> + + + + {` + ${client.name}.method = "${operation.method}" as const; + ${client.name}.url = "${new URLPath(operation.path).URL}" as const; + ${client.name}.operationId = "${client.name}" as const; + ${client.name}.request = {} as ${type.schemas.request?.name || 'never'}; + ${client.name}.response = {} as ${type.schemas.response?.name || 'never'}; + ${client.name}.pathParams = {} as ${type.schemas.pathParams?.name || 'never'}; + ${client.name}.queryParams = {} as ${type.schemas.queryParams?.name || 'never'}; + `} + + + ) + }, +}) diff --git a/examples/react-query/package.json b/examples/react-query/package.json index e960bc48b..d60140d95 100644 --- a/examples/react-query/package.json +++ b/examples/react-query/package.json @@ -37,7 +37,7 @@ "unplugin-kubb": "workspace:*" }, "devDependencies": { - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", "msw": "^1.3.4", diff --git a/examples/swr/src/gen/hooks/index.ts b/examples/swr/src/gen/hooks/index.ts index 88c4ef14e..b6c5660a5 100644 --- a/examples/swr/src/gen/hooks/index.ts +++ b/examples/swr/src/gen/hooks/index.ts @@ -1,20 +1,40 @@ -export { useAddPet } from './useAddPet.ts' -export { useCreateUser } from './useCreateUser.ts' -export { useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts' -export { useDeleteOrder } from './useDeleteOrder.ts' -export { useDeletePet } from './useDeletePet.ts' -export { useDeleteUser } from './useDeleteUser.ts' -export { findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts' -export { findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts' -export { getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts' -export { getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts' -export { getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts' -export { getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts' -export { loginUserQueryOptions, useLoginUser } from './useLoginUser.ts' -export { logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts' -export { usePlaceOrder } from './usePlaceOrder.ts' -export { usePlaceOrderPatch } from './usePlaceOrderPatch.ts' -export { useUpdatePet } from './useUpdatePet.ts' -export { useUpdatePetWithForm } from './useUpdatePetWithForm.ts' -export { useUpdateUser } from './useUpdateUser.ts' -export { useUploadFile } from './useUploadFile.ts' +export type { AddPetMutationKey } from './useAddPet.ts' +export type { CreateUserMutationKey } from './useCreateUser.ts' +export type { CreateUsersWithListInputMutationKey } from './useCreateUsersWithListInput.ts' +export type { DeleteOrderMutationKey } from './useDeleteOrder.ts' +export type { DeletePetMutationKey } from './useDeletePet.ts' +export type { DeleteUserMutationKey } from './useDeleteUser.ts' +export type { FindPetsByStatusQueryKey } from './useFindPetsByStatus.ts' +export type { FindPetsByTagsQueryKey } from './useFindPetsByTags.ts' +export type { GetInventoryQueryKey } from './useGetInventory.ts' +export type { GetOrderByIdQueryKey } from './useGetOrderById.ts' +export type { GetPetByIdQueryKey } from './useGetPetById.ts' +export type { GetUserByNameQueryKey } from './useGetUserByName.ts' +export type { LoginUserQueryKey } from './useLoginUser.ts' +export type { LogoutUserQueryKey } from './useLogoutUser.ts' +export type { PlaceOrderMutationKey } from './usePlaceOrder.ts' +export type { PlaceOrderPatchMutationKey } from './usePlaceOrderPatch.ts' +export type { UpdatePetMutationKey } from './useUpdatePet.ts' +export type { UpdatePetWithFormMutationKey } from './useUpdatePetWithForm.ts' +export type { UpdateUserMutationKey } from './useUpdateUser.ts' +export type { UploadFileMutationKey } from './useUploadFile.ts' +export { addPetMutationKey, useAddPet } from './useAddPet.ts' +export { createUserMutationKey, useCreateUser } from './useCreateUser.ts' +export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './useCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, useDeleteOrder } from './useDeleteOrder.ts' +export { deletePetMutationKey, useDeletePet } from './useDeletePet.ts' +export { deleteUserMutationKey, useDeleteUser } from './useDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './useFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './useFindPetsByTags.ts' +export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './useGetInventory.ts' +export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './useGetOrderById.ts' +export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './useGetPetById.ts' +export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './useGetUserByName.ts' +export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './useLoginUser.ts' +export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './useLogoutUser.ts' +export { placeOrderMutationKey, usePlaceOrder } from './usePlaceOrder.ts' +export { placeOrderPatchMutationKey, usePlaceOrderPatch } from './usePlaceOrderPatch.ts' +export { updatePetMutationKey, useUpdatePet } from './useUpdatePet.ts' +export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './useUpdatePetWithForm.ts' +export { updateUserMutationKey, useUpdateUser } from './useUpdateUser.ts' +export { uploadFileMutationKey, useUploadFile } from './useUploadFile.ts' diff --git a/examples/swr/src/gen/hooks/useAddPet.ts b/examples/swr/src/gen/hooks/useAddPet.ts index cedb7d39d..0e7be43fe 100644 --- a/examples/swr/src/gen/hooks/useAddPet.ts +++ b/examples/swr/src/gen/hooks/useAddPet.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const addPetMutationKey = () => [{ url: '/pet' }] as const + +export type AddPetMutationKey = ReturnType + /** * @description Add a new pet to the store * @summary Add a new pet to the store @@ -34,9 +38,9 @@ export function useAddPet( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet'] as const + const mutationKey = addPetMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return addPet(data, config) }, diff --git a/examples/swr/src/gen/hooks/useCreateUser.ts b/examples/swr/src/gen/hooks/useCreateUser.ts index 5990e233f..72ede147e 100644 --- a/examples/swr/src/gen/hooks/useCreateUser.ts +++ b/examples/swr/src/gen/hooks/useCreateUser.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const createUserMutationKey = () => [{ url: '/user' }] as const + +export type CreateUserMutationKey = ReturnType + /** * @description This can only be done by the logged in user. * @summary Create user @@ -34,9 +38,9 @@ export function useCreateUser( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user'] as const + const mutationKey = createUserMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return createUser(data, config) }, diff --git a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts index 50dec00ce..73fe55d6f 100644 --- a/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/swr/src/gen/hooks/useCreateUsersWithListInput.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const + +export type CreateUsersWithListInputMutationKey = ReturnType + /** * @description Creates list of users with given input array * @summary Creates list of users with given input array @@ -37,9 +41,9 @@ export function useCreateUsersWithListInput( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user/createWithList'] as const + const mutationKey = createUsersWithListInputMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return createUsersWithListInput(data, config) }, diff --git a/examples/swr/src/gen/hooks/useDeleteOrder.ts b/examples/swr/src/gen/hooks/useDeleteOrder.ts index 859d061eb..14046caea 100644 --- a/examples/swr/src/gen/hooks/useDeleteOrder.ts +++ b/examples/swr/src/gen/hooks/useDeleteOrder.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const deleteOrderMutationKey = () => [{ url: '/store/order/{orderId}' }] as const + +export type DeleteOrderMutationKey = ReturnType + /** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID @@ -34,9 +38,9 @@ export function useDeleteOrder( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/store/order/${orderId}`] as const + const mutationKey = deleteOrderMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return deleteOrder(orderId, config) }, diff --git a/examples/swr/src/gen/hooks/useDeletePet.ts b/examples/swr/src/gen/hooks/useDeletePet.ts index 0ce503e4a..29d095f4d 100644 --- a/examples/swr/src/gen/hooks/useDeletePet.ts +++ b/examples/swr/src/gen/hooks/useDeletePet.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const deletePetMutationKey = () => [{ url: '/pet/{petId}' }] as const + +export type DeletePetMutationKey = ReturnType + /** * @description delete a pet * @summary Deletes a pet @@ -36,9 +40,9 @@ export function useDeletePet( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}`] as const + const mutationKey = deletePetMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return deletePet(petId, headers, config) }, diff --git a/examples/swr/src/gen/hooks/useDeleteUser.ts b/examples/swr/src/gen/hooks/useDeleteUser.ts index 70dd66ad8..a92b4feba 100644 --- a/examples/swr/src/gen/hooks/useDeleteUser.ts +++ b/examples/swr/src/gen/hooks/useDeleteUser.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const + +export type DeleteUserMutationKey = ReturnType + /** * @description This can only be done by the logged in user. * @summary Delete user @@ -34,9 +38,9 @@ export function useDeleteUser( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/user/${username}`] as const + const mutationKey = deleteUserMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return deleteUser(username, config) }, diff --git a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts index e610965ef..bec3f5bc0 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByStatus.ts @@ -4,6 +4,10 @@ import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPe import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const findPetsByStatusQueryKey = (params?: FindPetsByStatusQueryParams) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const + +export type FindPetsByStatusQueryKey = ReturnType + /** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status @@ -42,8 +46,8 @@ export function useFindPetsByStatus( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet/findByStatus', params] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByStatusQueryKey(params) + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByStatusQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useFindPetsByTags.ts b/examples/swr/src/gen/hooks/useFindPetsByTags.ts index e37018b87..4ea4ff5ea 100644 --- a/examples/swr/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/swr/src/gen/hooks/useFindPetsByTags.ts @@ -4,6 +4,10 @@ import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsBy import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const + +export type FindPetsByTagsQueryKey = ReturnType + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -42,8 +46,8 @@ export function useFindPetsByTags( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet/findByTags', params] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params) + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetInventory.ts b/examples/swr/src/gen/hooks/useGetInventory.ts index 2a5a3c154..d165ff329 100644 --- a/examples/swr/src/gen/hooks/useGetInventory.ts +++ b/examples/swr/src/gen/hooks/useGetInventory.ts @@ -4,6 +4,10 @@ import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const + +export type GetInventoryQueryKey = ReturnType + /** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status @@ -40,8 +44,8 @@ export function useGetInventory( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/store/inventory'] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = getInventoryQueryKey() + return useSWR(shouldFetch ? queryKey : null, { ...getInventoryQueryOptions(config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetOrderById.ts b/examples/swr/src/gen/hooks/useGetOrderById.ts index 796db7487..34b8f0b15 100644 --- a/examples/swr/src/gen/hooks/useGetOrderById.ts +++ b/examples/swr/src/gen/hooks/useGetOrderById.ts @@ -4,6 +4,10 @@ import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400 import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const getOrderByIdQueryKey = (orderId: GetOrderByIdPathParams['orderId']) => [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const + +export type GetOrderByIdQueryKey = ReturnType + /** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID @@ -41,8 +45,8 @@ export function useGetOrderById( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/store/order/${orderId}`] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = getOrderByIdQueryKey(orderId) + return useSWR(shouldFetch ? queryKey : null, { ...getOrderByIdQueryOptions(orderId, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetPetById.ts b/examples/swr/src/gen/hooks/useGetPetById.ts index 62fe233ab..1527ab67a 100644 --- a/examples/swr/src/gen/hooks/useGetPetById.ts +++ b/examples/swr/src/gen/hooks/useGetPetById.ts @@ -4,6 +4,10 @@ import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetP import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const + +export type GetPetByIdQueryKey = ReturnType + /** * @description Returns a single pet * @summary Find pet by ID @@ -41,8 +45,8 @@ export function useGetPetById( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}`] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = getPetByIdQueryKey(petId) + return useSWR(shouldFetch ? queryKey : null, { ...getPetByIdQueryOptions(petId, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useGetUserByName.ts b/examples/swr/src/gen/hooks/useGetUserByName.ts index 939268fb8..82b140266 100644 --- a/examples/swr/src/gen/hooks/useGetUserByName.ts +++ b/examples/swr/src/gen/hooks/useGetUserByName.ts @@ -4,6 +4,10 @@ import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const + +export type GetUserByNameQueryKey = ReturnType + /** * @summary Get user by user name * @link /user/:username @@ -39,8 +43,8 @@ export function useGetUserByName( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/user/${username}`] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = getUserByNameQueryKey(username) + return useSWR(shouldFetch ? queryKey : null, { ...getUserByNameQueryOptions(username, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useLoginUser.ts b/examples/swr/src/gen/hooks/useLoginUser.ts index c2dfae05a..34b74de38 100644 --- a/examples/swr/src/gen/hooks/useLoginUser.ts +++ b/examples/swr/src/gen/hooks/useLoginUser.ts @@ -4,6 +4,10 @@ import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const loginUserQueryKey = (params?: LoginUserQueryParams) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const + +export type LoginUserQueryKey = ReturnType + /** * @summary Logs user into the system * @link /user/login @@ -40,8 +44,8 @@ export function useLoginUser( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user/login', params] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = loginUserQueryKey(params) + return useSWR(shouldFetch ? queryKey : null, { ...loginUserQueryOptions(params, config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/useLogoutUser.ts b/examples/swr/src/gen/hooks/useLogoutUser.ts index 262639a41..560e119ce 100644 --- a/examples/swr/src/gen/hooks/useLogoutUser.ts +++ b/examples/swr/src/gen/hooks/useLogoutUser.ts @@ -4,6 +4,10 @@ import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key, SWRConfiguration } from 'swr' +export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const + +export type LogoutUserQueryKey = ReturnType + /** * @summary Logs out current logged in user session * @link /user/logout @@ -38,8 +42,8 @@ export function useLogoutUser( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/user/logout'] as const - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = logoutUserQueryKey() + return useSWR(shouldFetch ? queryKey : null, { ...logoutUserQueryOptions(config), ...queryOptions, }) diff --git a/examples/swr/src/gen/hooks/usePlaceOrder.ts b/examples/swr/src/gen/hooks/usePlaceOrder.ts index f6e0af2c9..a67da0a92 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrder.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrder.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const placeOrderMutationKey = () => [{ url: '/store/order' }] as const + +export type PlaceOrderMutationKey = ReturnType + /** * @description Place a new order in the store * @summary Place an order for a pet @@ -34,9 +38,9 @@ export function usePlaceOrder( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/store/order'] as const + const mutationKey = placeOrderMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return placeOrder(data, config) }, diff --git a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts index 6c8ee827e..095d96017 100644 --- a/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts +++ b/examples/swr/src/gen/hooks/usePlaceOrderPatch.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const placeOrderPatchMutationKey = () => [{ url: '/store/order' }] as const + +export type PlaceOrderPatchMutationKey = ReturnType + /** * @description Place a new order in the store with patch * @summary Place an order for a pet with patch @@ -34,9 +38,9 @@ export function usePlaceOrderPatch( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/store/order'] as const + const mutationKey = placeOrderPatchMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return placeOrderPatch(data, config) }, diff --git a/examples/swr/src/gen/hooks/useUpdatePet.ts b/examples/swr/src/gen/hooks/useUpdatePet.ts index 16f8cc539..3112334c2 100644 --- a/examples/swr/src/gen/hooks/useUpdatePet.ts +++ b/examples/swr/src/gen/hooks/useUpdatePet.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const updatePetMutationKey = () => [{ url: '/pet' }] as const + +export type UpdatePetMutationKey = ReturnType + /** * @description Update an existing pet by Id * @summary Update an existing pet @@ -34,9 +38,9 @@ export function useUpdatePet( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = ['/pet'] as const + const mutationKey = updatePetMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return updatePet(data, config) }, diff --git a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts index 8f7117b50..cca70fa9a 100644 --- a/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/swr/src/gen/hooks/useUpdatePetWithForm.ts @@ -10,6 +10,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const + +export type UpdatePetWithFormMutationKey = ReturnType + /** * @summary Updates a pet in the store with form data * @link /pet/:petId @@ -39,9 +43,9 @@ export function useUpdatePetWithForm( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}`, params] as const + const mutationKey = updatePetWithFormMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url) => { return updatePetWithForm(petId, params, config) }, diff --git a/examples/swr/src/gen/hooks/useUpdateUser.ts b/examples/swr/src/gen/hooks/useUpdateUser.ts index 140e4c557..2dc85180a 100644 --- a/examples/swr/src/gen/hooks/useUpdateUser.ts +++ b/examples/swr/src/gen/hooks/useUpdateUser.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const + +export type UpdateUserMutationKey = ReturnType + /** * @description This can only be done by the logged in user. * @summary Update user @@ -39,9 +43,9 @@ export function useUpdateUser( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/user/${username}`] as const + const mutationKey = updateUserMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return updateUser(username, data, config) }, diff --git a/examples/swr/src/gen/hooks/useUploadFile.ts b/examples/swr/src/gen/hooks/useUploadFile.ts index 5b4e36cae..8aa9aa095 100644 --- a/examples/swr/src/gen/hooks/useUploadFile.ts +++ b/examples/swr/src/gen/hooks/useUploadFile.ts @@ -5,6 +5,10 @@ import type { RequestConfig } from '@kubb/plugin-client/client' import type { Key } from 'swr' import type { SWRMutationConfiguration } from 'swr/mutation' +export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const + +export type UploadFileMutationKey = ReturnType + /** * @summary uploads an image * @link /pet/:petId/uploadImage @@ -41,9 +45,9 @@ export function useUploadFile( } = {}, ) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} - const swrKey = [`/pet/${petId}/uploadImage`, params] as const + const mutationKey = uploadFileMutationKey() return useSWRMutation( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { return uploadFile(petId, data, params, config) }, diff --git a/examples/swr/src/gen/index.ts b/examples/swr/src/gen/index.ts index 8b53d02ec..0ee753dc4 100644 --- a/examples/swr/src/gen/index.ts +++ b/examples/swr/src/gen/index.ts @@ -29,23 +29,43 @@ export type * from './models/UpdateUser.ts' export type * from './models/UploadFile.ts' export type * from './models/User.ts' export type * from './models/UserArray.ts' -export { useAddPet } from './hooks/useAddPet.ts' -export { useCreateUser } from './hooks/useCreateUser.ts' -export { useCreateUsersWithListInput } from './hooks/useCreateUsersWithListInput.ts' -export { useDeleteOrder } from './hooks/useDeleteOrder.ts' -export { useDeletePet } from './hooks/useDeletePet.ts' -export { useDeleteUser } from './hooks/useDeleteUser.ts' -export { findPetsByStatusQueryOptions, useFindPetsByStatus } from './hooks/useFindPetsByStatus.ts' -export { findPetsByTagsQueryOptions, useFindPetsByTags } from './hooks/useFindPetsByTags.ts' -export { getInventoryQueryOptions, useGetInventory } from './hooks/useGetInventory.ts' -export { getOrderByIdQueryOptions, useGetOrderById } from './hooks/useGetOrderById.ts' -export { getPetByIdQueryOptions, useGetPetById } from './hooks/useGetPetById.ts' -export { getUserByNameQueryOptions, useGetUserByName } from './hooks/useGetUserByName.ts' -export { loginUserQueryOptions, useLoginUser } from './hooks/useLoginUser.ts' -export { logoutUserQueryOptions, useLogoutUser } from './hooks/useLogoutUser.ts' -export { usePlaceOrder } from './hooks/usePlaceOrder.ts' -export { usePlaceOrderPatch } from './hooks/usePlaceOrderPatch.ts' -export { useUpdatePet } from './hooks/useUpdatePet.ts' -export { useUpdatePetWithForm } from './hooks/useUpdatePetWithForm.ts' -export { useUpdateUser } from './hooks/useUpdateUser.ts' -export { useUploadFile } from './hooks/useUploadFile.ts' +export type { AddPetMutationKey } from './hooks/useAddPet.ts' +export type { CreateUserMutationKey } from './hooks/useCreateUser.ts' +export type { CreateUsersWithListInputMutationKey } from './hooks/useCreateUsersWithListInput.ts' +export type { DeleteOrderMutationKey } from './hooks/useDeleteOrder.ts' +export type { DeletePetMutationKey } from './hooks/useDeletePet.ts' +export type { DeleteUserMutationKey } from './hooks/useDeleteUser.ts' +export type { FindPetsByStatusQueryKey } from './hooks/useFindPetsByStatus.ts' +export type { FindPetsByTagsQueryKey } from './hooks/useFindPetsByTags.ts' +export type { GetInventoryQueryKey } from './hooks/useGetInventory.ts' +export type { GetOrderByIdQueryKey } from './hooks/useGetOrderById.ts' +export type { GetPetByIdQueryKey } from './hooks/useGetPetById.ts' +export type { GetUserByNameQueryKey } from './hooks/useGetUserByName.ts' +export type { LoginUserQueryKey } from './hooks/useLoginUser.ts' +export type { LogoutUserQueryKey } from './hooks/useLogoutUser.ts' +export type { PlaceOrderMutationKey } from './hooks/usePlaceOrder.ts' +export type { PlaceOrderPatchMutationKey } from './hooks/usePlaceOrderPatch.ts' +export type { UpdatePetMutationKey } from './hooks/useUpdatePet.ts' +export type { UpdatePetWithFormMutationKey } from './hooks/useUpdatePetWithForm.ts' +export type { UpdateUserMutationKey } from './hooks/useUpdateUser.ts' +export type { UploadFileMutationKey } from './hooks/useUploadFile.ts' +export { addPetMutationKey, useAddPet } from './hooks/useAddPet.ts' +export { createUserMutationKey, useCreateUser } from './hooks/useCreateUser.ts' +export { createUsersWithListInputMutationKey, useCreateUsersWithListInput } from './hooks/useCreateUsersWithListInput.ts' +export { deleteOrderMutationKey, useDeleteOrder } from './hooks/useDeleteOrder.ts' +export { deletePetMutationKey, useDeletePet } from './hooks/useDeletePet.ts' +export { deleteUserMutationKey, useDeleteUser } from './hooks/useDeleteUser.ts' +export { findPetsByStatusQueryKey, findPetsByStatusQueryOptions, useFindPetsByStatus } from './hooks/useFindPetsByStatus.ts' +export { findPetsByTagsQueryKey, findPetsByTagsQueryOptions, useFindPetsByTags } from './hooks/useFindPetsByTags.ts' +export { getInventoryQueryKey, getInventoryQueryOptions, useGetInventory } from './hooks/useGetInventory.ts' +export { getOrderByIdQueryKey, getOrderByIdQueryOptions, useGetOrderById } from './hooks/useGetOrderById.ts' +export { getPetByIdQueryKey, getPetByIdQueryOptions, useGetPetById } from './hooks/useGetPetById.ts' +export { getUserByNameQueryKey, getUserByNameQueryOptions, useGetUserByName } from './hooks/useGetUserByName.ts' +export { loginUserQueryKey, loginUserQueryOptions, useLoginUser } from './hooks/useLoginUser.ts' +export { logoutUserQueryKey, logoutUserQueryOptions, useLogoutUser } from './hooks/useLogoutUser.ts' +export { placeOrderMutationKey, usePlaceOrder } from './hooks/usePlaceOrder.ts' +export { placeOrderPatchMutationKey, usePlaceOrderPatch } from './hooks/usePlaceOrderPatch.ts' +export { updatePetMutationKey, useUpdatePet } from './hooks/useUpdatePet.ts' +export { updatePetWithFormMutationKey, useUpdatePetWithForm } from './hooks/useUpdatePetWithForm.ts' +export { updateUserMutationKey, useUpdateUser } from './hooks/useUpdateUser.ts' +export { uploadFileMutationKey, useUploadFile } from './hooks/useUploadFile.ts' diff --git a/examples/vue-query/src/gen/hooks/useAddPet.ts b/examples/vue-query/src/gen/hooks/useAddPet.ts index c3efa8725..1e9bfe3f3 100644 --- a/examples/vue-query/src/gen/hooks/useAddPet.ts +++ b/examples/vue-query/src/gen/hooks/useAddPet.ts @@ -1,47 +1,61 @@ -import client from "@kubb/plugin-client/client"; -import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from "../models/AddPet.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '../models/AddPet.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const addPetMutationKey = () => [{ "url": "/pet" }] as const; +export const addPetMutationKey = () => [{ url: '/pet' }] as const - export type AddPetMutationKey = ReturnType; +export type AddPetMutationKey = ReturnType - /** +/** * @description Add a new pet to the store * @summary Add a new pet to the store * @link /pet */ async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { - const res = await client({ method: "POST", url: `/pet`, baseURL: "https://petstore3.swagger.io/api/v3", data, ...config }); - return res.data; + const res = await client({ + method: 'POST', + url: '/pet', + baseURL: 'https://petstore3.swagger.io/api/v3', + data, + ...config, + }) + return res.data } - /** +/** * @description Add a new pet to the store * @summary Add a new pet to the store * @link /pet */ -export function useAddPet(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? addPetMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ data }: { - data: AddPetMutationRequest; - }) => { - return addPet(data, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useAddPet( + options: { + mutation?: MutationObserverOptions< + AddPetMutationResponse, + AddPet405, + { + data: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? addPetMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + data, + }: { + data: AddPetMutationRequest + }) => { + return addPet(data, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useCreateUser.ts b/examples/vue-query/src/gen/hooks/useCreateUser.ts index d235105c4..c61fb01a2 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUser.ts @@ -1,47 +1,61 @@ -import client from "@kubb/plugin-client/client"; -import type { CreateUserMutationRequest, CreateUserMutationResponse } from "../models/CreateUser.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../models/CreateUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const createUserMutationKey = () => [{ "url": "/user" }] as const; +export const createUserMutationKey = () => [{ url: '/user' }] as const - export type CreateUserMutationKey = ReturnType; +export type CreateUserMutationKey = ReturnType - /** +/** * @description This can only be done by the logged in user. * @summary Create user * @link /user */ async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { - const res = await client({ method: "POST", url: `/user`, baseURL: "https://petstore3.swagger.io/api/v3", data, ...config }); - return res.data; + const res = await client({ + method: 'POST', + url: '/user', + baseURL: 'https://petstore3.swagger.io/api/v3', + data, + ...config, + }) + return res.data } - /** +/** * @description This can only be done by the logged in user. * @summary Create user * @link /user */ -export function useCreateUser(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? createUserMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ data }: { - data?: CreateUserMutationRequest; - }) => { - return createUser(data, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useCreateUser( + options: { + mutation?: MutationObserverOptions< + CreateUserMutationResponse, + Error, + { + data?: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? createUserMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + data, + }: { + data?: CreateUserMutationRequest + }) => { + return createUser(data, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts index d7644f17c..809980616 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts @@ -1,47 +1,64 @@ -import client from "@kubb/plugin-client/client"; -import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from "../models/CreateUsersWithListInput.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { CreateUsersWithListInputMutationRequest, CreateUsersWithListInputMutationResponse } from '../models/CreateUsersWithListInput.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const createUsersWithListInputMutationKey = () => [{ "url": "/user/createWithList" }] as const; +export const createUsersWithListInputMutationKey = () => [{ url: '/user/createWithList' }] as const - export type CreateUsersWithListInputMutationKey = ReturnType; +export type CreateUsersWithListInputMutationKey = ReturnType - /** +/** * @description Creates list of users with given input array * @summary Creates list of users with given input array * @link /user/createWithList */ -async function createUsersWithListInput(data?: CreateUsersWithListInputMutationRequest, config: Partial> = {}) { - const res = await client({ method: "POST", url: `/user/createWithList`, baseURL: "https://petstore3.swagger.io/api/v3", data, ...config }); - return res.data; +async function createUsersWithListInput( + data?: CreateUsersWithListInputMutationRequest, + config: Partial> = {}, +) { + const res = await client({ + method: 'POST', + url: '/user/createWithList', + baseURL: 'https://petstore3.swagger.io/api/v3', + data, + ...config, + }) + return res.data } - /** +/** * @description Creates list of users with given input array * @summary Creates list of users with given input array * @link /user/createWithList */ -export function useCreateUsersWithListInput(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? createUsersWithListInputMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ data }: { - data?: CreateUsersWithListInputMutationRequest; - }) => { - return createUsersWithListInput(data, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useCreateUsersWithListInput( + options: { + mutation?: MutationObserverOptions< + CreateUsersWithListInputMutationResponse, + Error, + { + data?: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? createUsersWithListInputMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + data, + }: { + data?: CreateUsersWithListInputMutationRequest + }) => { + return createUsersWithListInput(data, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts index d8518e1c8..542892403 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts @@ -1,47 +1,60 @@ -import client from "@kubb/plugin-client/client"; -import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from "../models/DeleteOrder.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { DeleteOrderMutationResponse, DeleteOrderPathParams, DeleteOrder400, DeleteOrder404 } from '../models/DeleteOrder.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const deleteOrderMutationKey = () => [{ "url": "/store/order/{orderId}" }] as const; +export const deleteOrderMutationKey = () => [{ url: '/store/order/{orderId}' }] as const - export type DeleteOrderMutationKey = ReturnType; +export type DeleteOrderMutationKey = ReturnType - /** +/** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * @link /store/order/:orderId */ -async function deleteOrder(orderId: DeleteOrderPathParams["orderId"], config: Partial = {}) { - const res = await client({ method: "DELETE", url: `/store/order/${orderId}`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; +async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { + const res = await client({ + method: 'DELETE', + url: `/store/order/${orderId}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - /** +/** * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * @summary Delete purchase order by ID * @link /store/order/:orderId */ -export function useDeleteOrder(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? deleteOrderMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ orderId }: { - orderId: DeleteOrderPathParams["orderId"]; - }) => { - return deleteOrder(orderId, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useDeleteOrder( + options: { + mutation?: MutationObserverOptions< + DeleteOrderMutationResponse, + DeleteOrder400 | DeleteOrder404, + { + orderId: MaybeRef + } + > + client?: Partial + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? deleteOrderMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + orderId, + }: { + orderId: DeleteOrderPathParams['orderId'] + }) => { + return deleteOrder(orderId, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useDeletePet.ts b/examples/vue-query/src/gen/hooks/useDeletePet.ts index 2411e99da..a18dbbd89 100644 --- a/examples/vue-query/src/gen/hooks/useDeletePet.ts +++ b/examples/vue-query/src/gen/hooks/useDeletePet.ts @@ -1,49 +1,64 @@ -import client from "@kubb/plugin-client/client"; -import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from "../models/DeletePet.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderParams, DeletePet400 } from '../models/DeletePet.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const deletePetMutationKey = () => [{ "url": "/pet/{petId}" }] as const; +export const deletePetMutationKey = () => [{ url: '/pet/{petId}' }] as const - export type DeletePetMutationKey = ReturnType; +export type DeletePetMutationKey = ReturnType - /** +/** * @description delete a pet * @summary Deletes a pet * @link /pet/:petId */ -async function deletePet(petId: DeletePetPathParams["petId"], headers?: DeletePetHeaderParams, config: Partial = {}) { - const res = await client({ method: "DELETE", url: `/pet/${petId}`, baseURL: "https://petstore3.swagger.io/api/v3", headers: { ...headers, ...config.headers }, ...config }); - return res.data; +async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { + const res = await client({ + method: 'DELETE', + url: `/pet/${petId}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + headers: { ...headers, ...config.headers }, + ...config, + }) + return res.data } - /** +/** * @description delete a pet * @summary Deletes a pet * @link /pet/:petId */ -export function useDeletePet(options: { - mutation?: MutationObserverOptions; - headers?: MaybeRef; - }>; - client?: Partial; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? deletePetMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ petId, headers }: { - petId: DeletePetPathParams["petId"]; - headers?: DeletePetHeaderParams; - }) => { - return deletePet(petId, headers, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useDeletePet( + options: { + mutation?: MutationObserverOptions< + DeletePetMutationResponse, + DeletePet400, + { + petId: MaybeRef + headers?: MaybeRef + } + > + client?: Partial + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? deletePetMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + petId, + headers, + }: { + petId: DeletePetPathParams['petId'] + headers?: DeletePetHeaderParams + }) => { + return deletePet(petId, headers, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useDeleteUser.ts b/examples/vue-query/src/gen/hooks/useDeleteUser.ts index 9a5d6465f..feb7f3a0a 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteUser.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteUser.ts @@ -1,47 +1,60 @@ -import client from "@kubb/plugin-client/client"; -import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from "../models/DeleteUser.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { DeleteUserMutationResponse, DeleteUserPathParams, DeleteUser400, DeleteUser404 } from '../models/DeleteUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const deleteUserMutationKey = () => [{ "url": "/user/{username}" }] as const; +export const deleteUserMutationKey = () => [{ url: '/user/{username}' }] as const - export type DeleteUserMutationKey = ReturnType; +export type DeleteUserMutationKey = ReturnType - /** +/** * @description This can only be done by the logged in user. * @summary Delete user * @link /user/:username */ -async function deleteUser(username: DeleteUserPathParams["username"], config: Partial = {}) { - const res = await client({ method: "DELETE", url: `/user/${username}`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; +async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { + const res = await client({ + method: 'DELETE', + url: `/user/${username}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - /** +/** * @description This can only be done by the logged in user. * @summary Delete user * @link /user/:username */ -export function useDeleteUser(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? deleteUserMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ username }: { - username: DeleteUserPathParams["username"]; - }) => { - return deleteUser(username, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useDeleteUser( + options: { + mutation?: MutationObserverOptions< + DeleteUserMutationResponse, + DeleteUser400 | DeleteUser404, + { + username: MaybeRef + } + > + client?: Partial + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? deleteUserMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + username, + }: { + username: DeleteUserPathParams['username'] + }) => { + return deleteUser(username, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts index 4b40aeaa8..50233b36d 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts @@ -1,53 +1,66 @@ -import client from "@kubb/plugin-client/client"; -import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from "../models/FindPetsByStatus.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPetsByStatus400 } from '../models/FindPetsByStatus.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const findPetsByStatusQueryKey = (params?: MaybeRef) => [{ url: "/pet/findByStatus" }, ...(params ? [params] : [])] as const; +export const findPetsByStatusQueryKey = (params?: MaybeRef) => [{ url: '/pet/findByStatus' }, ...(params ? [params] : [])] as const - export type FindPetsByStatusQueryKey = ReturnType; +export type FindPetsByStatusQueryKey = ReturnType - /** +/** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * @link /pet/findByStatus */ async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { - const res = await client({ method: "GET", url: `/pet/findByStatus`, baseURL: "https://petstore3.swagger.io/api/v3", params, ...config }); - return res.data; + const res = await client({ + method: 'GET', + url: '/pet/findByStatus', + baseURL: 'https://petstore3.swagger.io/api/v3', + params, + ...config, + }) + return res.data } - export function findPetsByStatusQueryOptions(params?: MaybeRef, config: Partial = {}) { - const queryKey = findPetsByStatusQueryKey(params); - return queryOptions({ - queryKey, - queryFn: async () => { - return findPetsByStatus(unref(params), unref(config)); - }, - }); +export function findPetsByStatusQueryOptions(params?: MaybeRef, config: Partial = {}) { + const queryKey = findPetsByStatusQueryKey(params) + return queryOptions({ + queryKey, + queryFn: async () => { + return findPetsByStatus(unref(params), unref(config)) + }, + }) } - /** +/** * @description Multiple status values can be provided with comma separated strings * @summary Finds Pets by status * @link /pet/findByStatus */ -export function useFindPetsByStatus(params?: MaybeRef, options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params); - const query = useQuery({ - ...findPetsByStatusQueryOptions(params, config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useFindPetsByStatus< + TData = FindPetsByStatusQueryResponse, + TQueryData = FindPetsByStatusQueryResponse, + TQueryKey extends QueryKey = FindPetsByStatusQueryKey, +>( + params?: MaybeRef, + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params) + const query = useQuery({ + ...(findPetsByStatusQueryOptions(params, config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts index 1636bba78..ab4c3056b 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts @@ -1,53 +1,66 @@ -import client from "@kubb/plugin-client/client"; -import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from "../models/FindPetsByTags.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { FindPetsByTagsQueryResponse, FindPetsByTagsQueryParams, FindPetsByTags400 } from '../models/FindPetsByTags.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; +export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const - export type FindPetsByTagsQueryKey = ReturnType; +export type FindPetsByTagsQueryKey = ReturnType - /** +/** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * @link /pet/findByTags */ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { - const res = await client({ method: "GET", url: `/pet/findByTags`, baseURL: "https://petstore3.swagger.io/api/v3", params, ...config }); - return res.data; + const res = await client({ + method: 'GET', + url: '/pet/findByTags', + baseURL: 'https://petstore3.swagger.io/api/v3', + params, + ...config, + }) + return res.data } - export function findPetsByTagsQueryOptions(params?: MaybeRef, config: Partial = {}) { - const queryKey = findPetsByTagsQueryKey(params); - return queryOptions({ - queryKey, - queryFn: async () => { - return findPetsByTags(unref(params), unref(config)); - }, - }); +export function findPetsByTagsQueryOptions(params?: MaybeRef, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params) + return queryOptions({ + queryKey, + queryFn: async () => { + return findPetsByTags(unref(params), unref(config)) + }, + }) } - /** +/** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags(params?: MaybeRef, options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); - const query = useQuery({ - ...findPetsByTagsQueryOptions(params, config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useFindPetsByTags< + TData = FindPetsByTagsQueryResponse, + TQueryData = FindPetsByTagsQueryResponse, + TQueryKey extends QueryKey = FindPetsByTagsQueryKey, +>( + params?: MaybeRef, + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params) + const query = useQuery({ + ...(findPetsByTagsQueryOptions(params, config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useGetInventory.ts b/examples/vue-query/src/gen/hooks/useGetInventory.ts index b086b4162..6ac485760 100644 --- a/examples/vue-query/src/gen/hooks/useGetInventory.ts +++ b/examples/vue-query/src/gen/hooks/useGetInventory.ts @@ -1,52 +1,59 @@ -import client from "@kubb/plugin-client/client"; -import type { GetInventoryQueryResponse } from "../models/GetInventory.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { GetInventoryQueryResponse } from '../models/GetInventory.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const getInventoryQueryKey = () => [{ url: "/store/inventory" }] as const; +export const getInventoryQueryKey = () => [{ url: '/store/inventory' }] as const - export type GetInventoryQueryKey = ReturnType; +export type GetInventoryQueryKey = ReturnType - /** +/** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * @link /store/inventory */ async function getInventory(config: Partial = {}) { - const res = await client({ method: "GET", url: `/store/inventory`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; + const res = await client({ + method: 'GET', + url: '/store/inventory', + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - export function getInventoryQueryOptions(config: Partial = {}) { - const queryKey = getInventoryQueryKey(); - return queryOptions({ - queryKey, - queryFn: async () => { - return getInventory(unref(config)); - }, - }); +export function getInventoryQueryOptions(config: Partial = {}) { + const queryKey = getInventoryQueryKey() + return queryOptions({ + queryKey, + queryFn: async () => { + return getInventory(unref(config)) + }, + }) } - /** +/** * @description Returns a map of status codes to quantities * @summary Returns pet inventories by status * @link /store/inventory */ -export function useGetInventory(options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey(); - const query = useQuery({ - ...getInventoryQueryOptions(config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useGetInventory( + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? getInventoryQueryKey() + const query = useQuery({ + ...(getInventoryQueryOptions(config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useGetOrderById.ts b/examples/vue-query/src/gen/hooks/useGetOrderById.ts index 8ddd96894..97deaeee9 100644 --- a/examples/vue-query/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query/src/gen/hooks/useGetOrderById.ts @@ -1,53 +1,62 @@ -import client from "@kubb/plugin-client/client"; -import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from "../models/GetOrderById.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { GetOrderByIdQueryResponse, GetOrderByIdPathParams, GetOrderById400, GetOrderById404 } from '../models/GetOrderById.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const getOrderByIdQueryKey = (orderId: MaybeRef) => [{ url: "/store/order/:orderId", params: { orderId: orderId } }] as const; +export const getOrderByIdQueryKey = (orderId: MaybeRef) => + [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const - export type GetOrderByIdQueryKey = ReturnType; +export type GetOrderByIdQueryKey = ReturnType - /** +/** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * @link /store/order/:orderId */ -async function getOrderById(orderId: GetOrderByIdPathParams["orderId"], config: Partial = {}) { - const res = await client({ method: "GET", url: `/store/order/${orderId}`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; +async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { + const res = await client({ + method: 'GET', + url: `/store/order/${orderId}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - export function getOrderByIdQueryOptions(orderId: MaybeRef, config: Partial = {}) { - const queryKey = getOrderByIdQueryKey(orderId); - return queryOptions({ - queryKey, - queryFn: async () => { - return getOrderById(unref(orderId), unref(config)); - }, - }); +export function getOrderByIdQueryOptions(orderId: MaybeRef, config: Partial = {}) { + const queryKey = getOrderByIdQueryKey(orderId) + return queryOptions({ + queryKey, + queryFn: async () => { + return getOrderById(unref(orderId), unref(config)) + }, + }) } - /** +/** * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. * @summary Find purchase order by ID * @link /store/order/:orderId */ -export function useGetOrderById(orderId: MaybeRef, options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(orderId); - const query = useQuery({ - ...getOrderByIdQueryOptions(orderId, config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useGetOrderById( + orderId: MaybeRef, + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(orderId) + const query = useQuery({ + ...(getOrderByIdQueryOptions(orderId, config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useGetPetById.ts b/examples/vue-query/src/gen/hooks/useGetPetById.ts index 4f742d868..7c9844012 100644 --- a/examples/vue-query/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query/src/gen/hooks/useGetPetById.ts @@ -1,53 +1,61 @@ -import client from "@kubb/plugin-client/client"; -import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from "../models/GetPetById.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../models/GetPetById.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const getPetByIdQueryKey = (petId: MaybeRef) => [{ url: "/pet/:petId", params: { petId: petId } }] as const; +export const getPetByIdQueryKey = (petId: MaybeRef) => [{ url: '/pet/:petId', params: { petId: petId } }] as const - export type GetPetByIdQueryKey = ReturnType; +export type GetPetByIdQueryKey = ReturnType - /** +/** * @description Returns a single pet * @summary Find pet by ID * @link /pet/:petId */ -async function getPetById(petId: GetPetByIdPathParams["petId"], config: Partial = {}) { - const res = await client({ method: "GET", url: `/pet/${petId}`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; +async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { + const res = await client({ + method: 'GET', + url: `/pet/${petId}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - export function getPetByIdQueryOptions(petId: MaybeRef, config: Partial = {}) { - const queryKey = getPetByIdQueryKey(petId); - return queryOptions({ - queryKey, - queryFn: async () => { - return getPetById(unref(petId), unref(config)); - }, - }); +export function getPetByIdQueryOptions(petId: MaybeRef, config: Partial = {}) { + const queryKey = getPetByIdQueryKey(petId) + return queryOptions({ + queryKey, + queryFn: async () => { + return getPetById(unref(petId), unref(config)) + }, + }) } - /** +/** * @description Returns a single pet * @summary Find pet by ID * @link /pet/:petId */ -export function useGetPetById(petId: MaybeRef, options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId); - const query = useQuery({ - ...getPetByIdQueryOptions(petId, config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useGetPetById( + petId: MaybeRef, + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId) + const query = useQuery({ + ...(getPetByIdQueryOptions(petId, config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useGetUserByName.ts b/examples/vue-query/src/gen/hooks/useGetUserByName.ts index 83dd445b5..a400caa0f 100644 --- a/examples/vue-query/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query/src/gen/hooks/useGetUserByName.ts @@ -1,51 +1,64 @@ -import client from "@kubb/plugin-client/client"; -import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from "../models/GetUserByName.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { GetUserByNameQueryResponse, GetUserByNamePathParams, GetUserByName400, GetUserByName404 } from '../models/GetUserByName.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const getUserByNameQueryKey = (username: MaybeRef) => [{ url: "/user/:username", params: { username: username } }] as const; +export const getUserByNameQueryKey = (username: MaybeRef) => + [{ url: '/user/:username', params: { username: username } }] as const - export type GetUserByNameQueryKey = ReturnType; +export type GetUserByNameQueryKey = ReturnType - /** +/** * @summary Get user by user name * @link /user/:username */ -async function getUserByName(username: GetUserByNamePathParams["username"], config: Partial = {}) { - const res = await client({ method: "GET", url: `/user/${username}`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; +async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { + const res = await client({ + method: 'GET', + url: `/user/${username}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - export function getUserByNameQueryOptions(username: MaybeRef, config: Partial = {}) { - const queryKey = getUserByNameQueryKey(username); - return queryOptions({ - queryKey, - queryFn: async () => { - return getUserByName(unref(username), unref(config)); - }, - }); +export function getUserByNameQueryOptions(username: MaybeRef, config: Partial = {}) { + const queryKey = getUserByNameQueryKey(username) + return queryOptions({ + queryKey, + queryFn: async () => { + return getUserByName(unref(username), unref(config)) + }, + }) } - /** +/** * @summary Get user by user name * @link /user/:username */ -export function useGetUserByName(username: MaybeRef, options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(username); - const query = useQuery({ - ...getUserByNameQueryOptions(username, config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useGetUserByName< + TData = GetUserByNameQueryResponse, + TQueryData = GetUserByNameQueryResponse, + TQueryKey extends QueryKey = GetUserByNameQueryKey, +>( + username: MaybeRef, + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(username) + const query = useQuery({ + ...(getUserByNameQueryOptions(username, config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useLoginUser.ts b/examples/vue-query/src/gen/hooks/useLoginUser.ts index 8d77a94c6..b7088e094 100644 --- a/examples/vue-query/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query/src/gen/hooks/useLoginUser.ts @@ -1,51 +1,60 @@ -import client from "@kubb/plugin-client/client"; -import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from "../models/LoginUser.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from '../models/LoginUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const loginUserQueryKey = (params?: MaybeRef) => [{ url: "/user/login" }, ...(params ? [params] : [])] as const; +export const loginUserQueryKey = (params?: MaybeRef) => [{ url: '/user/login' }, ...(params ? [params] : [])] as const - export type LoginUserQueryKey = ReturnType; +export type LoginUserQueryKey = ReturnType - /** +/** * @summary Logs user into the system * @link /user/login */ async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { - const res = await client({ method: "GET", url: `/user/login`, baseURL: "https://petstore3.swagger.io/api/v3", params, ...config }); - return res.data; + const res = await client({ + method: 'GET', + url: '/user/login', + baseURL: 'https://petstore3.swagger.io/api/v3', + params, + ...config, + }) + return res.data } - export function loginUserQueryOptions(params?: MaybeRef, config: Partial = {}) { - const queryKey = loginUserQueryKey(params); - return queryOptions({ - queryKey, - queryFn: async () => { - return loginUser(unref(params), unref(config)); - }, - }); +export function loginUserQueryOptions(params?: MaybeRef, config: Partial = {}) { + const queryKey = loginUserQueryKey(params) + return queryOptions({ + queryKey, + queryFn: async () => { + return loginUser(unref(params), unref(config)) + }, + }) } - /** +/** * @summary Logs user into the system * @link /user/login */ -export function useLoginUser(params?: MaybeRef, options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params); - const query = useQuery({ - ...loginUserQueryOptions(params, config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useLoginUser( + params?: MaybeRef, + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params) + const query = useQuery({ + ...(loginUserQueryOptions(params, config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/useLogoutUser.ts b/examples/vue-query/src/gen/hooks/useLogoutUser.ts index 8233794c0..aa0b4e2c7 100644 --- a/examples/vue-query/src/gen/hooks/useLogoutUser.ts +++ b/examples/vue-query/src/gen/hooks/useLogoutUser.ts @@ -1,50 +1,57 @@ -import client from "@kubb/plugin-client/client"; -import type { LogoutUserQueryResponse } from "../models/LogoutUser.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { QueryKey, QueryObserverOptions } from "@tanstack/vue-query"; -import { useQuery, queryOptions } from "@tanstack/vue-query"; -import { unref } from "vue"; +import client from '@kubb/plugin-client/client' +import type { LogoutUserQueryResponse } from '../models/LogoutUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { QueryKey, QueryObserverOptions } from '@tanstack/vue-query' +import { useQuery, queryOptions } from '@tanstack/vue-query' +import { unref } from 'vue' - export const logoutUserQueryKey = () => [{ url: "/user/logout" }] as const; +export const logoutUserQueryKey = () => [{ url: '/user/logout' }] as const - export type LogoutUserQueryKey = ReturnType; +export type LogoutUserQueryKey = ReturnType - /** +/** * @summary Logs out current logged in user session * @link /user/logout */ async function logoutUser(config: Partial = {}) { - const res = await client({ method: "GET", url: `/user/logout`, baseURL: "https://petstore3.swagger.io/api/v3", ...config }); - return res.data; + const res = await client({ + method: 'GET', + url: '/user/logout', + baseURL: 'https://petstore3.swagger.io/api/v3', + ...config, + }) + return res.data } - export function logoutUserQueryOptions(config: Partial = {}) { - const queryKey = logoutUserQueryKey(); - return queryOptions({ - queryKey, - queryFn: async () => { - return logoutUser(unref(config)); - }, - }); +export function logoutUserQueryOptions(config: Partial = {}) { + const queryKey = logoutUserQueryKey() + return queryOptions({ + queryKey, + queryFn: async () => { + return logoutUser(unref(config)) + }, + }) } - /** +/** * @summary Logs out current logged in user session * @link /user/logout */ -export function useLogoutUser(options: { - query?: Partial>; - client?: Partial; -} = {}) { - const { query: queryOptions, client: config = {} } = options ?? {}; - const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey(); - const query = useQuery({ - ...logoutUserQueryOptions(config) as unknown as QueryObserverOptions, - queryKey, - ...queryOptions as unknown as Omit - }) as ReturnType & { - queryKey: TQueryKey; - }; - query.queryKey = queryKey as TQueryKey; - return query; -} \ No newline at end of file +export function useLogoutUser( + options: { + query?: Partial> + client?: Partial + } = {}, +) { + const { query: queryOptions, client: config = {} } = options ?? {} + const queryKey = queryOptions?.queryKey ?? logoutUserQueryKey() + const query = useQuery({ + ...(logoutUserQueryOptions(config) as unknown as QueryObserverOptions), + queryKey, + ...(queryOptions as unknown as Omit), + }) as ReturnType & { + queryKey: TQueryKey + } + query.queryKey = queryKey as TQueryKey + return query +} diff --git a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts index d38eb604a..5affc802d 100644 --- a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts +++ b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts @@ -1,47 +1,61 @@ -import client from "@kubb/plugin-client/client"; -import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from "../models/PlaceOrder.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { PlaceOrderMutationRequest, PlaceOrderMutationResponse, PlaceOrder405 } from '../models/PlaceOrder.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const placeOrderMutationKey = () => [{ "url": "/store/order" }] as const; +export const placeOrderMutationKey = () => [{ url: '/store/order' }] as const - export type PlaceOrderMutationKey = ReturnType; +export type PlaceOrderMutationKey = ReturnType - /** +/** * @description Place a new order in the store * @summary Place an order for a pet * @link /store/order */ async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { - const res = await client({ method: "POST", url: `/store/order`, baseURL: "https://petstore3.swagger.io/api/v3", data, ...config }); - return res.data; + const res = await client({ + method: 'POST', + url: '/store/order', + baseURL: 'https://petstore3.swagger.io/api/v3', + data, + ...config, + }) + return res.data } - /** +/** * @description Place a new order in the store * @summary Place an order for a pet * @link /store/order */ -export function usePlaceOrder(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? placeOrderMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ data }: { - data?: PlaceOrderMutationRequest; - }) => { - return placeOrder(data, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function usePlaceOrder( + options: { + mutation?: MutationObserverOptions< + PlaceOrderMutationResponse, + PlaceOrder405, + { + data?: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? placeOrderMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + data, + }: { + data?: PlaceOrderMutationRequest + }) => { + return placeOrder(data, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useUpdatePet.ts b/examples/vue-query/src/gen/hooks/useUpdatePet.ts index 18f47a2f0..ce598932c 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePet.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePet.ts @@ -1,47 +1,61 @@ -import client from "@kubb/plugin-client/client"; -import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from "../models/UpdatePet.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { UpdatePetMutationRequest, UpdatePetMutationResponse, UpdatePet400, UpdatePet404, UpdatePet405 } from '../models/UpdatePet.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const updatePetMutationKey = () => [{ "url": "/pet" }] as const; +export const updatePetMutationKey = () => [{ url: '/pet' }] as const - export type UpdatePetMutationKey = ReturnType; +export type UpdatePetMutationKey = ReturnType - /** +/** * @description Update an existing pet by Id * @summary Update an existing pet * @link /pet */ async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { - const res = await client({ method: "PUT", url: `/pet`, baseURL: "https://petstore3.swagger.io/api/v3", data, ...config }); - return res.data; + const res = await client({ + method: 'PUT', + url: '/pet', + baseURL: 'https://petstore3.swagger.io/api/v3', + data, + ...config, + }) + return res.data } - /** +/** * @description Update an existing pet by Id * @summary Update an existing pet * @link /pet */ -export function useUpdatePet(options: { - mutation?: MutationObserverOptions; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? updatePetMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ data }: { - data: UpdatePetMutationRequest; - }) => { - return updatePet(data, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useUpdatePet( + options: { + mutation?: MutationObserverOptions< + UpdatePetMutationResponse, + UpdatePet400 | UpdatePet404 | UpdatePet405, + { + data: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? updatePetMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + data, + }: { + data: UpdatePetMutationRequest + }) => { + return updatePet(data, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts index 935785ae4..30ab695f6 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts @@ -1,47 +1,67 @@ -import client from "@kubb/plugin-client/client"; -import type { UpdatePetWithFormMutationResponse, UpdatePetWithFormPathParams, UpdatePetWithFormQueryParams, UpdatePetWithForm405 } from "../models/UpdatePetWithForm.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { + UpdatePetWithFormMutationResponse, + UpdatePetWithFormPathParams, + UpdatePetWithFormQueryParams, + UpdatePetWithForm405, +} from '../models/UpdatePetWithForm.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; +export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const - export type UpdatePetWithFormMutationKey = ReturnType; +export type UpdatePetWithFormMutationKey = ReturnType - /** +/** * @summary Updates a pet in the store with form data * @link /pet/:petId */ -async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { - const res = await client({ method: "POST", url: `/pet/${petId}`, baseURL: "https://petstore3.swagger.io/api/v3", params, ...config }); - return res.data; +async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { + const res = await client({ + method: 'POST', + url: `/pet/${petId}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + params, + ...config, + }) + return res.data } - /** +/** * @summary Updates a pet in the store with form data * @link /pet/:petId */ -export function useUpdatePetWithForm(options: { - mutation?: MutationObserverOptions; - params?: MaybeRef; - }>; - client?: Partial; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ petId, params }: { - petId: UpdatePetWithFormPathParams["petId"]; - params?: UpdatePetWithFormQueryParams; - }) => { - return updatePetWithForm(petId, params, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useUpdatePetWithForm( + options: { + mutation?: MutationObserverOptions< + UpdatePetWithFormMutationResponse, + UpdatePetWithForm405, + { + petId: MaybeRef + params?: MaybeRef + } + > + client?: Partial + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + petId, + params, + }: { + petId: UpdatePetWithFormPathParams['petId'] + params?: UpdatePetWithFormQueryParams + }) => { + return updatePetWithForm(petId, params, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useUpdateUser.ts b/examples/vue-query/src/gen/hooks/useUpdateUser.ts index 7142c952d..4d718306b 100644 --- a/examples/vue-query/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query/src/gen/hooks/useUpdateUser.ts @@ -1,49 +1,68 @@ -import client from "@kubb/plugin-client/client"; -import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from "../models/UpdateUser.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserPathParams } from '../models/UpdateUser.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const updateUserMutationKey = () => [{ "url": "/user/{username}" }] as const; +export const updateUserMutationKey = () => [{ url: '/user/{username}' }] as const - export type UpdateUserMutationKey = ReturnType; +export type UpdateUserMutationKey = ReturnType - /** +/** * @description This can only be done by the logged in user. * @summary Update user * @link /user/:username */ -async function updateUser(username: UpdateUserPathParams["username"], data?: UpdateUserMutationRequest, config: Partial> = {}) { - const res = await client({ method: "PUT", url: `/user/${username}`, baseURL: "https://petstore3.swagger.io/api/v3", data, ...config }); - return res.data; +async function updateUser( + username: UpdateUserPathParams['username'], + data?: UpdateUserMutationRequest, + config: Partial> = {}, +) { + const res = await client({ + method: 'PUT', + url: `/user/${username}`, + baseURL: 'https://petstore3.swagger.io/api/v3', + data, + ...config, + }) + return res.data } - /** +/** * @description This can only be done by the logged in user. * @summary Update user * @link /user/:username */ -export function useUpdateUser(options: { - mutation?: MutationObserverOptions; - data?: MaybeRef; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? updateUserMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ username, data }: { - username: UpdateUserPathParams["username"]; - data?: UpdateUserMutationRequest; - }) => { - return updateUser(username, data, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useUpdateUser( + options: { + mutation?: MutationObserverOptions< + UpdateUserMutationResponse, + Error, + { + username: MaybeRef + data?: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? updateUserMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + username, + data, + }: { + username: UpdateUserPathParams['username'] + data?: UpdateUserMutationRequest + }) => { + return updateUser(username, data, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/hooks/useUploadFile.ts b/examples/vue-query/src/gen/hooks/useUploadFile.ts index 2b29e7934..e0f6a7dc1 100644 --- a/examples/vue-query/src/gen/hooks/useUploadFile.ts +++ b/examples/vue-query/src/gen/hooks/useUploadFile.ts @@ -1,49 +1,72 @@ -import client from "@kubb/plugin-client/client"; -import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from "../models/UploadFile.ts"; -import type { RequestConfig } from "@kubb/plugin-client/client"; -import type { MutationObserverOptions, MutationKey } from "@tanstack/vue-query"; -import type { MaybeRef } from "vue"; -import { useMutation } from "@tanstack/vue-query"; +import client from '@kubb/plugin-client/client' +import type { UploadFileMutationRequest, UploadFileMutationResponse, UploadFilePathParams, UploadFileQueryParams } from '../models/UploadFile.ts' +import type { RequestConfig } from '@kubb/plugin-client/client' +import type { MutationObserverOptions, MutationKey } from '@tanstack/vue-query' +import type { MaybeRef } from 'vue' +import { useMutation } from '@tanstack/vue-query' - export const uploadFileMutationKey = () => [{ "url": "/pet/{petId}/uploadImage" }] as const; +export const uploadFileMutationKey = () => [{ url: '/pet/{petId}/uploadImage' }] as const - export type UploadFileMutationKey = ReturnType; +export type UploadFileMutationKey = ReturnType - /** +/** * @summary uploads an image * @link /pet/:petId/uploadImage */ -async function uploadFile(petId: UploadFilePathParams["petId"], data?: UploadFileMutationRequest, params?: UploadFileQueryParams, config: Partial> = {}) { - const res = await client({ method: "POST", url: `/pet/${petId}/uploadImage`, baseURL: "https://petstore3.swagger.io/api/v3", params, data, headers: { "Content-Type": "application/octet-stream", ...config.headers }, ...config }); - return res.data; +async function uploadFile( + petId: UploadFilePathParams['petId'], + data?: UploadFileMutationRequest, + params?: UploadFileQueryParams, + config: Partial> = {}, +) { + const res = await client({ + method: 'POST', + url: `/pet/${petId}/uploadImage`, + baseURL: 'https://petstore3.swagger.io/api/v3', + params, + data, + headers: { 'Content-Type': 'application/octet-stream', ...config.headers }, + ...config, + }) + return res.data } - /** +/** * @summary uploads an image * @link /pet/:petId/uploadImage */ -export function useUploadFile(options: { - mutation?: MutationObserverOptions; - data?: MaybeRef; - params?: MaybeRef; - }>; - client?: Partial>; -} = {}) { - const { mutation: mutationOptions, client: config = {} } = options ?? {}; - const mutationKey = mutationOptions?.mutationKey ?? uploadFileMutationKey(); - const mutation = useMutation({ - mutationFn: async ({ petId, data, params }: { - petId: UploadFilePathParams["petId"]; - data?: UploadFileMutationRequest; - params?: UploadFileQueryParams; - }) => { - return uploadFile(petId, data, params, config); - }, - ...mutationOptions - }) as ReturnType & { - mutationKey: MutationKey; - }; - mutation.mutationKey = mutationKey as MutationKey; - return mutation; -} \ No newline at end of file +export function useUploadFile( + options: { + mutation?: MutationObserverOptions< + UploadFileMutationResponse, + Error, + { + petId: MaybeRef + data?: MaybeRef + params?: MaybeRef + } + > + client?: Partial> + } = {}, +) { + const { mutation: mutationOptions, client: config = {} } = options ?? {} + const mutationKey = mutationOptions?.mutationKey ?? uploadFileMutationKey() + const mutation = useMutation({ + mutationFn: async ({ + petId, + data, + params, + }: { + petId: UploadFilePathParams['petId'] + data?: UploadFileMutationRequest + params?: UploadFileQueryParams + }) => { + return uploadFile(petId, data, params, config) + }, + ...mutationOptions, + }) as ReturnType & { + mutationKey: MutationKey + } + mutation.mutationKey = mutationKey as MutationKey + return mutation +} diff --git a/examples/vue-query/src/gen/models/AddPet.ts b/examples/vue-query/src/gen/models/AddPet.ts index 7b2e35807..3dbae81f2 100644 --- a/examples/vue-query/src/gen/models/AddPet.ts +++ b/examples/vue-query/src/gen/models/AddPet.ts @@ -1,27 +1,27 @@ -import type { Pet } from "./Pet.ts"; +import type { Pet } from './Pet.ts' - /** +/** * @description Successful operation -*/ -export type AddPet200 = Pet; + */ +export type AddPet200 = Pet - /** +/** * @description Invalid input -*/ -export type AddPet405 = any; + */ +export type AddPet405 = any - /** +/** * @description Create a new pet in the store -*/ -export type AddPetMutationRequest = Pet; + */ +export type AddPetMutationRequest = Pet - /** +/** * @description Successful operation -*/ -export type AddPetMutationResponse = Pet; + */ +export type AddPetMutationResponse = Pet - export type AddPetMutation = { - Response: AddPetMutationResponse; - Request: AddPetMutationRequest; - Errors: AddPet405; -}; \ No newline at end of file +export type AddPetMutation = { + Response: AddPetMutationResponse + Request: AddPetMutationRequest + Errors: AddPet405 +} diff --git a/examples/vue-query/src/gen/models/Address.ts b/examples/vue-query/src/gen/models/Address.ts index 8bb3f7dff..28e63df2c 100644 --- a/examples/vue-query/src/gen/models/Address.ts +++ b/examples/vue-query/src/gen/models/Address.ts @@ -1,35 +1,31 @@ export const addressIdentifier = { - "NW": "NW", - "NE": "NE", - "SW": "SW", - "SE": "SE" -} as const; + NW: 'NW', + NE: 'NE', + SW: 'SW', + SE: 'SE', +} as const - export type AddressIdentifier = (typeof addressIdentifier)[keyof typeof addressIdentifier]; +export type AddressIdentifier = (typeof addressIdentifier)[keyof typeof addressIdentifier] - export type Address = { - /** - * @type string | undefined - */ - street?: string; - /** - * @type string | undefined - */ - city?: string; - /** - * @type string | undefined - */ - state?: string; - /** - * @type string | undefined - */ - zip?: string; - /** - * @type array | undefined - */ - identifier?: [ - number, - string, - AddressIdentifier - ]; -}; \ No newline at end of file +export type Address = { + /** + * @type string | undefined + */ + street?: string + /** + * @type string | undefined + */ + city?: string + /** + * @type string | undefined + */ + state?: string + /** + * @type string | undefined + */ + zip?: string + /** + * @type array | undefined + */ + identifier?: [number, string, AddressIdentifier] +} diff --git a/examples/vue-query/src/gen/models/ApiResponse.ts b/examples/vue-query/src/gen/models/ApiResponse.ts index 2a8e81e25..3a6dae779 100644 --- a/examples/vue-query/src/gen/models/ApiResponse.ts +++ b/examples/vue-query/src/gen/models/ApiResponse.ts @@ -1,14 +1,14 @@ export type ApiResponse = { - /** - * @type integer | undefined, int32 - */ - code?: number; - /** - * @type string | undefined - */ - type?: string; - /** - * @type string | undefined - */ - message?: string; -}; \ No newline at end of file + /** + * @type integer | undefined, int32 + */ + code?: number + /** + * @type string | undefined + */ + type?: string + /** + * @type string | undefined + */ + message?: string +} diff --git a/examples/vue-query/src/gen/models/Category.ts b/examples/vue-query/src/gen/models/Category.ts index 49380ed19..3b48c48f3 100644 --- a/examples/vue-query/src/gen/models/Category.ts +++ b/examples/vue-query/src/gen/models/Category.ts @@ -1,10 +1,10 @@ export type Category = { - /** - * @type integer | undefined, int64 - */ - id?: number; - /** - * @type string | undefined - */ - name?: string; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + name?: string +} diff --git a/examples/vue-query/src/gen/models/CreateUser.ts b/examples/vue-query/src/gen/models/CreateUser.ts index d7ee3b05e..94650b6d6 100644 --- a/examples/vue-query/src/gen/models/CreateUser.ts +++ b/examples/vue-query/src/gen/models/CreateUser.ts @@ -1,18 +1,18 @@ -import type { User } from "./User.ts"; +import type { User } from './User.ts' - /** +/** * @description successful operation -*/ -export type CreateUserError = User; + */ +export type CreateUserError = User - /** +/** * @description Created user object -*/ -export type CreateUserMutationRequest = User; + */ +export type CreateUserMutationRequest = User - export type CreateUserMutationResponse = any; +export type CreateUserMutationResponse = any - export type CreateUserMutation = { - Response: CreateUserMutationResponse; - Request: CreateUserMutationRequest; -}; \ No newline at end of file +export type CreateUserMutation = { + Response: CreateUserMutationResponse + Request: CreateUserMutationRequest +} diff --git a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts index 844fecbee..ebe8cbcdc 100644 --- a/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/models/CreateUsersWithListInput.ts @@ -1,23 +1,23 @@ -import type { User } from "./User.ts"; +import type { User } from './User.ts' - /** +/** * @description Successful operation -*/ -export type CreateUsersWithListInput200 = User; + */ +export type CreateUsersWithListInput200 = User - /** +/** * @description successful operation -*/ -export type CreateUsersWithListInputError = any; + */ +export type CreateUsersWithListInputError = any - export type CreateUsersWithListInputMutationRequest = User[]; +export type CreateUsersWithListInputMutationRequest = User[] - /** +/** * @description Successful operation -*/ -export type CreateUsersWithListInputMutationResponse = User; + */ +export type CreateUsersWithListInputMutationResponse = User - export type CreateUsersWithListInputMutation = { - Response: CreateUsersWithListInputMutationResponse; - Request: CreateUsersWithListInputMutationRequest; -}; \ No newline at end of file +export type CreateUsersWithListInputMutation = { + Response: CreateUsersWithListInputMutationResponse + Request: CreateUsersWithListInputMutationRequest +} diff --git a/examples/vue-query/src/gen/models/Customer.ts b/examples/vue-query/src/gen/models/Customer.ts index 08afa9179..dea157e6e 100644 --- a/examples/vue-query/src/gen/models/Customer.ts +++ b/examples/vue-query/src/gen/models/Customer.ts @@ -1,16 +1,16 @@ -import type { Address } from "./Address.ts"; +import type { Address } from './Address.ts' - export type Customer = { - /** - * @type integer | undefined, int64 - */ - id?: number; - /** - * @type string | undefined - */ - username?: string; - /** - * @type array | undefined - */ - address?: Address[]; -}; \ No newline at end of file +export type Customer = { + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + username?: string + /** + * @type array | undefined + */ + address?: Address[] +} diff --git a/examples/vue-query/src/gen/models/DeleteOrder.ts b/examples/vue-query/src/gen/models/DeleteOrder.ts index fc5f0ae6f..ca0a4a26b 100644 --- a/examples/vue-query/src/gen/models/DeleteOrder.ts +++ b/examples/vue-query/src/gen/models/DeleteOrder.ts @@ -1,25 +1,25 @@ export type DeleteOrderPathParams = { - /** - * @description ID of the order that needs to be deleted - * @type integer, int64 - */ - orderId: number; -}; + /** + * @description ID of the order that needs to be deleted + * @type integer, int64 + */ + orderId: number +} - /** +/** * @description Invalid ID supplied -*/ -export type DeleteOrder400 = any; + */ +export type DeleteOrder400 = any - /** +/** * @description Order not found -*/ -export type DeleteOrder404 = any; + */ +export type DeleteOrder404 = any - export type DeleteOrderMutationResponse = any; +export type DeleteOrderMutationResponse = any - export type DeleteOrderMutation = { - Response: DeleteOrderMutationResponse; - PathParams: DeleteOrderPathParams; - Errors: DeleteOrder400 | DeleteOrder404; -}; \ No newline at end of file +export type DeleteOrderMutation = { + Response: DeleteOrderMutationResponse + PathParams: DeleteOrderPathParams + Errors: DeleteOrder400 | DeleteOrder404 +} diff --git a/examples/vue-query/src/gen/models/DeletePet.ts b/examples/vue-query/src/gen/models/DeletePet.ts index 89c7db814..fc83516d0 100644 --- a/examples/vue-query/src/gen/models/DeletePet.ts +++ b/examples/vue-query/src/gen/models/DeletePet.ts @@ -1,28 +1,28 @@ export type DeletePetPathParams = { - /** - * @description Pet id to delete - * @type integer, int64 - */ - petId: number; -}; + /** + * @description Pet id to delete + * @type integer, int64 + */ + petId: number +} - export type DeletePetHeaderParams = { - /** - * @type string | undefined - */ - api_key?: string; -}; +export type DeletePetHeaderParams = { + /** + * @type string | undefined + */ + api_key?: string +} - /** +/** * @description Invalid pet value -*/ -export type DeletePet400 = any; + */ +export type DeletePet400 = any - export type DeletePetMutationResponse = any; +export type DeletePetMutationResponse = any - export type DeletePetMutation = { - Response: DeletePetMutationResponse; - PathParams: DeletePetPathParams; - HeaderParams: DeletePetHeaderParams; - Errors: DeletePet400; -}; \ No newline at end of file +export type DeletePetMutation = { + Response: DeletePetMutationResponse + PathParams: DeletePetPathParams + HeaderParams: DeletePetHeaderParams + Errors: DeletePet400 +} diff --git a/examples/vue-query/src/gen/models/DeleteUser.ts b/examples/vue-query/src/gen/models/DeleteUser.ts index 16327e3b1..63010e04f 100644 --- a/examples/vue-query/src/gen/models/DeleteUser.ts +++ b/examples/vue-query/src/gen/models/DeleteUser.ts @@ -1,25 +1,25 @@ export type DeleteUserPathParams = { - /** - * @description The name that needs to be deleted - * @type string - */ - username: string; -}; + /** + * @description The name that needs to be deleted + * @type string + */ + username: string +} - /** +/** * @description Invalid username supplied -*/ -export type DeleteUser400 = any; + */ +export type DeleteUser400 = any - /** +/** * @description User not found -*/ -export type DeleteUser404 = any; + */ +export type DeleteUser404 = any - export type DeleteUserMutationResponse = any; +export type DeleteUserMutationResponse = any - export type DeleteUserMutation = { - Response: DeleteUserMutationResponse; - PathParams: DeleteUserPathParams; - Errors: DeleteUser400 | DeleteUser404; -}; \ No newline at end of file +export type DeleteUserMutation = { + Response: DeleteUserMutationResponse + PathParams: DeleteUserPathParams + Errors: DeleteUser400 | DeleteUser404 +} diff --git a/examples/vue-query/src/gen/models/FindPetsByStatus.ts b/examples/vue-query/src/gen/models/FindPetsByStatus.ts index 417db0f0a..b1785d14a 100644 --- a/examples/vue-query/src/gen/models/FindPetsByStatus.ts +++ b/examples/vue-query/src/gen/models/FindPetsByStatus.ts @@ -1,39 +1,39 @@ -import type { Pet } from "./Pet.ts"; +import type { Pet } from './Pet.ts' - export const findPetsByStatusQueryParamsStatus = { - "available": "available", - "pending": "pending", - "sold": "sold" -} as const; +export const findPetsByStatusQueryParamsStatus = { + available: 'available', + pending: 'pending', + sold: 'sold', +} as const - export type FindPetsByStatusQueryParamsStatus = (typeof findPetsByStatusQueryParamsStatus)[keyof typeof findPetsByStatusQueryParamsStatus]; +export type FindPetsByStatusQueryParamsStatus = (typeof findPetsByStatusQueryParamsStatus)[keyof typeof findPetsByStatusQueryParamsStatus] - export type FindPetsByStatusQueryParams = { - /** - * @description Status values that need to be considered for filter - * @default "available" - * @type string | undefined - */ - status?: FindPetsByStatusQueryParamsStatus; -}; +export type FindPetsByStatusQueryParams = { + /** + * @description Status values that need to be considered for filter + * @default "available" + * @type string | undefined + */ + status?: FindPetsByStatusQueryParamsStatus +} - /** +/** * @description successful operation -*/ -export type FindPetsByStatus200 = Pet[]; + */ +export type FindPetsByStatus200 = Pet[] - /** +/** * @description Invalid status value -*/ -export type FindPetsByStatus400 = any; + */ +export type FindPetsByStatus400 = any - /** +/** * @description successful operation -*/ -export type FindPetsByStatusQueryResponse = Pet[]; + */ +export type FindPetsByStatusQueryResponse = Pet[] - export type FindPetsByStatusQuery = { - Response: FindPetsByStatusQueryResponse; - QueryParams: FindPetsByStatusQueryParams; - Errors: FindPetsByStatus400; -}; \ No newline at end of file +export type FindPetsByStatusQuery = { + Response: FindPetsByStatusQueryResponse + QueryParams: FindPetsByStatusQueryParams + Errors: FindPetsByStatus400 +} diff --git a/examples/vue-query/src/gen/models/FindPetsByTags.ts b/examples/vue-query/src/gen/models/FindPetsByTags.ts index 0701d3936..7771e04a6 100644 --- a/examples/vue-query/src/gen/models/FindPetsByTags.ts +++ b/examples/vue-query/src/gen/models/FindPetsByTags.ts @@ -1,30 +1,30 @@ -import type { Pet } from "./Pet.ts"; +import type { Pet } from './Pet.ts' - export type FindPetsByTagsQueryParams = { - /** - * @description Tags to filter by - * @type array | undefined - */ - tags?: string[]; -}; +export type FindPetsByTagsQueryParams = { + /** + * @description Tags to filter by + * @type array | undefined + */ + tags?: string[] +} - /** +/** * @description successful operation -*/ -export type FindPetsByTags200 = Pet[]; + */ +export type FindPetsByTags200 = Pet[] - /** +/** * @description Invalid tag value -*/ -export type FindPetsByTags400 = any; + */ +export type FindPetsByTags400 = any - /** +/** * @description successful operation -*/ -export type FindPetsByTagsQueryResponse = Pet[]; + */ +export type FindPetsByTagsQueryResponse = Pet[] - export type FindPetsByTagsQuery = { - Response: FindPetsByTagsQueryResponse; - QueryParams: FindPetsByTagsQueryParams; - Errors: FindPetsByTags400; -}; \ No newline at end of file +export type FindPetsByTagsQuery = { + Response: FindPetsByTagsQueryResponse + QueryParams: FindPetsByTagsQueryParams + Errors: FindPetsByTags400 +} diff --git a/examples/vue-query/src/gen/models/GetInventory.ts b/examples/vue-query/src/gen/models/GetInventory.ts index 23861c1bf..ec0602416 100644 --- a/examples/vue-query/src/gen/models/GetInventory.ts +++ b/examples/vue-query/src/gen/models/GetInventory.ts @@ -1,17 +1,17 @@ /** * @description successful operation -*/ + */ export type GetInventory200 = { - [key: string]: number; -}; + [key: string]: number +} - /** +/** * @description successful operation -*/ + */ export type GetInventoryQueryResponse = { - [key: string]: number; -}; + [key: string]: number +} - export type GetInventoryQuery = { - Response: GetInventoryQueryResponse; -}; \ No newline at end of file +export type GetInventoryQuery = { + Response: GetInventoryQueryResponse +} diff --git a/examples/vue-query/src/gen/models/GetOrderById.ts b/examples/vue-query/src/gen/models/GetOrderById.ts index 67315c64f..e08727f9b 100644 --- a/examples/vue-query/src/gen/models/GetOrderById.ts +++ b/examples/vue-query/src/gen/models/GetOrderById.ts @@ -1,35 +1,35 @@ -import type { Order } from "./Order.ts"; +import type { Order } from './Order.ts' - export type GetOrderByIdPathParams = { - /** - * @description ID of order that needs to be fetched - * @type integer, int64 - */ - orderId: number; -}; +export type GetOrderByIdPathParams = { + /** + * @description ID of order that needs to be fetched + * @type integer, int64 + */ + orderId: number +} - /** +/** * @description successful operation -*/ -export type GetOrderById200 = Order; + */ +export type GetOrderById200 = Order - /** +/** * @description Invalid ID supplied -*/ -export type GetOrderById400 = any; + */ +export type GetOrderById400 = any - /** +/** * @description Order not found -*/ -export type GetOrderById404 = any; + */ +export type GetOrderById404 = any - /** +/** * @description successful operation -*/ -export type GetOrderByIdQueryResponse = Order; + */ +export type GetOrderByIdQueryResponse = Order - export type GetOrderByIdQuery = { - Response: GetOrderByIdQueryResponse; - PathParams: GetOrderByIdPathParams; - Errors: GetOrderById400 | GetOrderById404; -}; \ No newline at end of file +export type GetOrderByIdQuery = { + Response: GetOrderByIdQueryResponse + PathParams: GetOrderByIdPathParams + Errors: GetOrderById400 | GetOrderById404 +} diff --git a/examples/vue-query/src/gen/models/GetPetById.ts b/examples/vue-query/src/gen/models/GetPetById.ts index ee29301bb..399175976 100644 --- a/examples/vue-query/src/gen/models/GetPetById.ts +++ b/examples/vue-query/src/gen/models/GetPetById.ts @@ -1,35 +1,35 @@ -import type { Pet } from "./Pet.ts"; +import type { Pet } from './Pet.ts' - export type GetPetByIdPathParams = { - /** - * @description ID of pet to return - * @type integer, int64 - */ - petId: number; -}; +export type GetPetByIdPathParams = { + /** + * @description ID of pet to return + * @type integer, int64 + */ + petId: number +} - /** +/** * @description successful operation -*/ -export type GetPetById200 = Pet; + */ +export type GetPetById200 = Pet - /** +/** * @description Invalid ID supplied -*/ -export type GetPetById400 = any; + */ +export type GetPetById400 = any - /** +/** * @description Pet not found -*/ -export type GetPetById404 = any; + */ +export type GetPetById404 = any - /** +/** * @description successful operation -*/ -export type GetPetByIdQueryResponse = Pet; + */ +export type GetPetByIdQueryResponse = Pet - export type GetPetByIdQuery = { - Response: GetPetByIdQueryResponse; - PathParams: GetPetByIdPathParams; - Errors: GetPetById400 | GetPetById404; -}; \ No newline at end of file +export type GetPetByIdQuery = { + Response: GetPetByIdQueryResponse + PathParams: GetPetByIdPathParams + Errors: GetPetById400 | GetPetById404 +} diff --git a/examples/vue-query/src/gen/models/GetUserByName.ts b/examples/vue-query/src/gen/models/GetUserByName.ts index 969322234..e6bcf2532 100644 --- a/examples/vue-query/src/gen/models/GetUserByName.ts +++ b/examples/vue-query/src/gen/models/GetUserByName.ts @@ -1,35 +1,35 @@ -import type { User } from "./User.ts"; +import type { User } from './User.ts' - export type GetUserByNamePathParams = { - /** - * @description The name that needs to be fetched. Use user1 for testing. - * @type string - */ - username: string; -}; +export type GetUserByNamePathParams = { + /** + * @description The name that needs to be fetched. Use user1 for testing. + * @type string + */ + username: string +} - /** +/** * @description successful operation -*/ -export type GetUserByName200 = User; + */ +export type GetUserByName200 = User - /** +/** * @description Invalid username supplied -*/ -export type GetUserByName400 = any; + */ +export type GetUserByName400 = any - /** +/** * @description User not found -*/ -export type GetUserByName404 = any; + */ +export type GetUserByName404 = any - /** +/** * @description successful operation -*/ -export type GetUserByNameQueryResponse = User; + */ +export type GetUserByNameQueryResponse = User - export type GetUserByNameQuery = { - Response: GetUserByNameQueryResponse; - PathParams: GetUserByNamePathParams; - Errors: GetUserByName400 | GetUserByName404; -}; \ No newline at end of file +export type GetUserByNameQuery = { + Response: GetUserByNameQueryResponse + PathParams: GetUserByNamePathParams + Errors: GetUserByName400 | GetUserByName404 +} diff --git a/examples/vue-query/src/gen/models/LoginUser.ts b/examples/vue-query/src/gen/models/LoginUser.ts index 6658166a8..64e5db7b6 100644 --- a/examples/vue-query/src/gen/models/LoginUser.ts +++ b/examples/vue-query/src/gen/models/LoginUser.ts @@ -1,33 +1,33 @@ export type LoginUserQueryParams = { - /** - * @description The user name for login - * @type string | undefined - */ - username?: string; - /** - * @description The password for login in clear text - * @type string | undefined - */ - password?: string; -}; + /** + * @description The user name for login + * @type string | undefined + */ + username?: string + /** + * @description The password for login in clear text + * @type string | undefined + */ + password?: string +} - /** +/** * @description successful operation -*/ -export type LoginUser200 = string; + */ +export type LoginUser200 = string - /** +/** * @description Invalid username/password supplied -*/ -export type LoginUser400 = any; + */ +export type LoginUser400 = any - /** +/** * @description successful operation -*/ -export type LoginUserQueryResponse = string; + */ +export type LoginUserQueryResponse = string - export type LoginUserQuery = { - Response: LoginUserQueryResponse; - QueryParams: LoginUserQueryParams; - Errors: LoginUser400; -}; \ No newline at end of file +export type LoginUserQuery = { + Response: LoginUserQueryResponse + QueryParams: LoginUserQueryParams + Errors: LoginUser400 +} diff --git a/examples/vue-query/src/gen/models/LogoutUser.ts b/examples/vue-query/src/gen/models/LogoutUser.ts index a685be5fa..521837490 100644 --- a/examples/vue-query/src/gen/models/LogoutUser.ts +++ b/examples/vue-query/src/gen/models/LogoutUser.ts @@ -1,10 +1,10 @@ /** * @description successful operation -*/ -export type LogoutUserError = any; + */ +export type LogoutUserError = any - export type LogoutUserQueryResponse = any; +export type LogoutUserQueryResponse = any - export type LogoutUserQuery = { - Response: LogoutUserQueryResponse; -}; \ No newline at end of file +export type LogoutUserQuery = { + Response: LogoutUserQueryResponse +} diff --git a/examples/vue-query/src/gen/models/Order.ts b/examples/vue-query/src/gen/models/Order.ts index 3c7aefb16..75ac3d189 100644 --- a/examples/vue-query/src/gen/models/Order.ts +++ b/examples/vue-query/src/gen/models/Order.ts @@ -1,35 +1,35 @@ export const orderStatus = { - "placed": "placed", - "approved": "approved", - "delivered": "delivered" -} as const; + placed: 'placed', + approved: 'approved', + delivered: 'delivered', +} as const - export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus]; +export type OrderStatus = (typeof orderStatus)[keyof typeof orderStatus] - export type Order = { - /** - * @type integer | undefined, int64 - */ - id?: number; - /** - * @type integer | undefined, int64 - */ - petId?: number; - /** - * @type integer | undefined, int32 - */ - quantity?: number; - /** - * @type string | undefined, date-time - */ - shipDate?: string; - /** - * @description Order Status - * @type string | undefined - */ - status?: OrderStatus; - /** - * @type boolean | undefined - */ - complete?: boolean; -}; \ No newline at end of file +export type Order = { + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type integer | undefined, int64 + */ + petId?: number + /** + * @type integer | undefined, int32 + */ + quantity?: number + /** + * @type string | undefined, date-time + */ + shipDate?: string + /** + * @description Order Status + * @type string | undefined + */ + status?: OrderStatus + /** + * @type boolean | undefined + */ + complete?: boolean +} diff --git a/examples/vue-query/src/gen/models/Pet.ts b/examples/vue-query/src/gen/models/Pet.ts index 14fb98f9a..54e2ce22f 100644 --- a/examples/vue-query/src/gen/models/Pet.ts +++ b/examples/vue-query/src/gen/models/Pet.ts @@ -1,38 +1,38 @@ -import type { Category } from "./Category.ts"; -import type { Tag } from "./Tag.ts"; +import type { Category } from './Category.ts' +import type { Tag } from './Tag.ts' - export const petStatus = { - "available": "available", - "pending": "pending", - "sold": "sold" -} as const; +export const petStatus = { + available: 'available', + pending: 'pending', + sold: 'sold', +} as const - export type PetStatus = (typeof petStatus)[keyof typeof petStatus]; +export type PetStatus = (typeof petStatus)[keyof typeof petStatus] - export type Pet = { - /** - * @type integer | undefined, int64 - */ - id?: number; - /** - * @type string - */ - name: string; - /** - * @type object | undefined - */ - category?: Category; - /** - * @type array - */ - photoUrls: string[]; - /** - * @type array | undefined - */ - tags?: Tag[]; - /** - * @description pet status in the store - * @type string | undefined - */ - status?: PetStatus; -}; \ No newline at end of file +export type Pet = { + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string + */ + name: string + /** + * @type object | undefined + */ + category?: Category + /** + * @type array + */ + photoUrls: string[] + /** + * @type array | undefined + */ + tags?: Tag[] + /** + * @description pet status in the store + * @type string | undefined + */ + status?: PetStatus +} diff --git a/examples/vue-query/src/gen/models/PlaceOrder.ts b/examples/vue-query/src/gen/models/PlaceOrder.ts index 482a80076..6d47f48b4 100644 --- a/examples/vue-query/src/gen/models/PlaceOrder.ts +++ b/examples/vue-query/src/gen/models/PlaceOrder.ts @@ -1,24 +1,24 @@ -import type { Order } from "./Order.ts"; +import type { Order } from './Order.ts' - /** +/** * @description successful operation -*/ -export type PlaceOrder200 = Order; + */ +export type PlaceOrder200 = Order - /** +/** * @description Invalid input -*/ -export type PlaceOrder405 = any; + */ +export type PlaceOrder405 = any - export type PlaceOrderMutationRequest = Order; +export type PlaceOrderMutationRequest = Order - /** +/** * @description successful operation -*/ -export type PlaceOrderMutationResponse = Order; + */ +export type PlaceOrderMutationResponse = Order - export type PlaceOrderMutation = { - Response: PlaceOrderMutationResponse; - Request: PlaceOrderMutationRequest; - Errors: PlaceOrder405; -}; \ No newline at end of file +export type PlaceOrderMutation = { + Response: PlaceOrderMutationResponse + Request: PlaceOrderMutationRequest + Errors: PlaceOrder405 +} diff --git a/examples/vue-query/src/gen/models/Tag.ts b/examples/vue-query/src/gen/models/Tag.ts index 3ae285108..d76160eae 100644 --- a/examples/vue-query/src/gen/models/Tag.ts +++ b/examples/vue-query/src/gen/models/Tag.ts @@ -1,10 +1,10 @@ export type Tag = { - /** - * @type integer | undefined, int64 - */ - id?: number; - /** - * @type string | undefined - */ - name?: string; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + name?: string +} diff --git a/examples/vue-query/src/gen/models/UpdatePet.ts b/examples/vue-query/src/gen/models/UpdatePet.ts index 9a5bc56de..153b553f1 100644 --- a/examples/vue-query/src/gen/models/UpdatePet.ts +++ b/examples/vue-query/src/gen/models/UpdatePet.ts @@ -1,37 +1,37 @@ -import type { Pet } from "./Pet.ts"; +import type { Pet } from './Pet.ts' - /** +/** * @description Successful operation -*/ -export type UpdatePet200 = Pet; + */ +export type UpdatePet200 = Pet - /** +/** * @description Invalid ID supplied -*/ -export type UpdatePet400 = any; + */ +export type UpdatePet400 = any - /** +/** * @description Pet not found -*/ -export type UpdatePet404 = any; + */ +export type UpdatePet404 = any - /** +/** * @description Validation exception -*/ -export type UpdatePet405 = any; + */ +export type UpdatePet405 = any - /** +/** * @description Update an existent pet in the store -*/ -export type UpdatePetMutationRequest = Pet; + */ +export type UpdatePetMutationRequest = Pet - /** +/** * @description Successful operation -*/ -export type UpdatePetMutationResponse = Pet; + */ +export type UpdatePetMutationResponse = Pet - export type UpdatePetMutation = { - Response: UpdatePetMutationResponse; - Request: UpdatePetMutationRequest; - Errors: UpdatePet400 | UpdatePet404 | UpdatePet405; -}; \ No newline at end of file +export type UpdatePetMutation = { + Response: UpdatePetMutationResponse + Request: UpdatePetMutationRequest + Errors: UpdatePet400 | UpdatePet404 | UpdatePet405 +} diff --git a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts index 77cbc4bb8..b547bc9a9 100644 --- a/examples/vue-query/src/gen/models/UpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/models/UpdatePetWithForm.ts @@ -1,34 +1,34 @@ export type UpdatePetWithFormPathParams = { - /** - * @description ID of pet that needs to be updated - * @type integer, int64 - */ - petId: number; -}; + /** + * @description ID of pet that needs to be updated + * @type integer, int64 + */ + petId: number +} - export type UpdatePetWithFormQueryParams = { - /** - * @description Name of pet that needs to be updated - * @type string | undefined - */ - name?: string; - /** - * @description Status of pet that needs to be updated - * @type string | undefined - */ - status?: string; -}; +export type UpdatePetWithFormQueryParams = { + /** + * @description Name of pet that needs to be updated + * @type string | undefined + */ + name?: string + /** + * @description Status of pet that needs to be updated + * @type string | undefined + */ + status?: string +} - /** +/** * @description Invalid input -*/ -export type UpdatePetWithForm405 = any; + */ +export type UpdatePetWithForm405 = any - export type UpdatePetWithFormMutationResponse = any; +export type UpdatePetWithFormMutationResponse = any - export type UpdatePetWithFormMutation = { - Response: UpdatePetWithFormMutationResponse; - PathParams: UpdatePetWithFormPathParams; - QueryParams: UpdatePetWithFormQueryParams; - Errors: UpdatePetWithForm405; -}; \ No newline at end of file +export type UpdatePetWithFormMutation = { + Response: UpdatePetWithFormMutationResponse + PathParams: UpdatePetWithFormPathParams + QueryParams: UpdatePetWithFormQueryParams + Errors: UpdatePetWithForm405 +} diff --git a/examples/vue-query/src/gen/models/UpdateUser.ts b/examples/vue-query/src/gen/models/UpdateUser.ts index ae2fb991b..1fe366191 100644 --- a/examples/vue-query/src/gen/models/UpdateUser.ts +++ b/examples/vue-query/src/gen/models/UpdateUser.ts @@ -1,27 +1,27 @@ -import type { User } from "./User.ts"; +import type { User } from './User.ts' - export type UpdateUserPathParams = { - /** - * @description name that need to be deleted - * @type string - */ - username: string; -}; +export type UpdateUserPathParams = { + /** + * @description name that need to be deleted + * @type string + */ + username: string +} - /** +/** * @description successful operation -*/ -export type UpdateUserError = any; + */ +export type UpdateUserError = any - /** +/** * @description Update an existent user in the store -*/ -export type UpdateUserMutationRequest = User; + */ +export type UpdateUserMutationRequest = User - export type UpdateUserMutationResponse = any; +export type UpdateUserMutationResponse = any - export type UpdateUserMutation = { - Response: UpdateUserMutationResponse; - Request: UpdateUserMutationRequest; - PathParams: UpdateUserPathParams; -}; \ No newline at end of file +export type UpdateUserMutation = { + Response: UpdateUserMutationResponse + Request: UpdateUserMutationRequest + PathParams: UpdateUserPathParams +} diff --git a/examples/vue-query/src/gen/models/UploadFile.ts b/examples/vue-query/src/gen/models/UploadFile.ts index 908b32bf6..049c96c0d 100644 --- a/examples/vue-query/src/gen/models/UploadFile.ts +++ b/examples/vue-query/src/gen/models/UploadFile.ts @@ -1,36 +1,36 @@ -import type { ApiResponse } from "./ApiResponse.ts"; +import type { ApiResponse } from './ApiResponse.ts' - export type UploadFilePathParams = { - /** - * @description ID of pet to update - * @type integer, int64 - */ - petId: number; -}; +export type UploadFilePathParams = { + /** + * @description ID of pet to update + * @type integer, int64 + */ + petId: number +} - export type UploadFileQueryParams = { - /** - * @description Additional Metadata - * @type string | undefined - */ - additionalMetadata?: string; -}; +export type UploadFileQueryParams = { + /** + * @description Additional Metadata + * @type string | undefined + */ + additionalMetadata?: string +} - /** +/** * @description successful operation -*/ -export type UploadFile200 = ApiResponse; + */ +export type UploadFile200 = ApiResponse - export type UploadFileMutationRequest = Blob; +export type UploadFileMutationRequest = Blob - /** +/** * @description successful operation -*/ -export type UploadFileMutationResponse = ApiResponse; + */ +export type UploadFileMutationResponse = ApiResponse - export type UploadFileMutation = { - Response: UploadFileMutationResponse; - Request: UploadFileMutationRequest; - PathParams: UploadFilePathParams; - QueryParams: UploadFileQueryParams; -}; \ No newline at end of file +export type UploadFileMutation = { + Response: UploadFileMutationResponse + Request: UploadFileMutationRequest + PathParams: UploadFilePathParams + QueryParams: UploadFileQueryParams +} diff --git a/examples/vue-query/src/gen/models/User.ts b/examples/vue-query/src/gen/models/User.ts index 9e8b913d4..5fbab3d29 100644 --- a/examples/vue-query/src/gen/models/User.ts +++ b/examples/vue-query/src/gen/models/User.ts @@ -1,35 +1,35 @@ export type User = { - /** - * @type integer | undefined, int64 - */ - id?: number; - /** - * @type string | undefined - */ - username?: string; - /** - * @type string | undefined - */ - firstName?: string; - /** - * @type string | undefined - */ - lastName?: string; - /** - * @type string | undefined - */ - email?: string; - /** - * @type string | undefined - */ - password?: string; - /** - * @type string | undefined - */ - phone?: string; - /** - * @description User Status - * @type integer | undefined, int32 - */ - userStatus?: number; -}; \ No newline at end of file + /** + * @type integer | undefined, int64 + */ + id?: number + /** + * @type string | undefined + */ + username?: string + /** + * @type string | undefined + */ + firstName?: string + /** + * @type string | undefined + */ + lastName?: string + /** + * @type string | undefined + */ + email?: string + /** + * @type string | undefined + */ + password?: string + /** + * @type string | undefined + */ + phone?: string + /** + * @description User Status + * @type integer | undefined, int32 + */ + userStatus?: number +} diff --git a/examples/vue-query/src/gen/models/UserArray.ts b/examples/vue-query/src/gen/models/UserArray.ts index 557992a74..3b7eef0e8 100644 --- a/examples/vue-query/src/gen/models/UserArray.ts +++ b/examples/vue-query/src/gen/models/UserArray.ts @@ -1,3 +1,3 @@ -import type { User } from "./User.ts"; +import type { User } from './User.ts' - export type UserArray = User[]; \ No newline at end of file +export type UserArray = User[] diff --git a/package.json b/package.json index 1205bcc50..18dabec99 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@changesets/cli": "^2.27.8", "@kubb/config-biome": "workspace:*", "@kubb/config-ts": "workspace:*", - "@types/node": "^20.16.5", + "@types/node": "^20.16.6", "@vitest/coverage-v8": "^2.1.1", "@vitest/ui": "^2.1.1", "bun-types": "^1.1.29", diff --git a/packages/cli/package.json b/packages/cli/package.json index 066665f8f..843b35aee 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -70,7 +70,7 @@ "@kubb/config-tsup": "workspace:*", "@kubb/plugin-oas": "workspace:*", "@types/cli-progress": "^3.11.6", - "@types/node": "^20.16.5", + "@types/node": "^20.16.6", "@types/semver": "^7.5.8", "source-map-support": "^0.5.21", "tsup": "^8.3.0", diff --git a/packages/config-tsup/package.json b/packages/config-tsup/package.json index 4fc6c4d27..ecc8ca7ad 100644 --- a/packages/config-tsup/package.json +++ b/packages/config-tsup/package.json @@ -37,7 +37,7 @@ }, "devDependencies": { "@kubb/config-ts": "workspace:*", - "@types/node": "^20.16.5", + "@types/node": "^20.16.6", "tsup": "^8.3.0" }, "peerDependencies": { diff --git a/packages/kubb/package.json b/packages/kubb/package.json index e0858d245..8df014f44 100644 --- a/packages/kubb/package.json +++ b/packages/kubb/package.json @@ -49,7 +49,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/node": "^20.16.5", + "@types/node": "^20.16.6", "tsup": "^8.3.0", "typescript": "^5.6.2" }, diff --git a/packages/plugin-client/src/plugin.ts b/packages/plugin-client/src/plugin.ts index 22dd47113..e10453e64 100644 --- a/packages/plugin-client/src/plugin.ts +++ b/packages/plugin-client/src/plugin.ts @@ -25,6 +25,7 @@ export const pluginClient = createPlugin((options) => { dataReturnType = 'data', pathParamsType = 'inline', operations = false, + generators = [clientGenerator, operations ? operationsGenerator : undefined].filter(Boolean), importPath = '@kubb/plugin-client/client', parser = 'client', } = options @@ -99,7 +100,7 @@ export const pluginClient = createPlugin((options) => { }, ) - const files = await operationGenerator.build(...[clientGenerator, operations ? operationsGenerator : undefined].filter(Boolean)) + const files = await operationGenerator.build(...generators) await this.addFile(...files) diff --git a/packages/plugin-client/src/types.ts b/packages/plugin-client/src/types.ts index 7ebf3f7ee..e074c8909 100644 --- a/packages/plugin-client/src/types.ts +++ b/packages/plugin-client/src/types.ts @@ -1,6 +1,6 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' export type Options = { output?: Output @@ -83,6 +83,10 @@ export type Options = { */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string } + /** + * Define some generators next to the client generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-faker/src/plugin.ts b/packages/plugin-faker/src/plugin.ts index f78dc232e..0dd3c86f2 100644 --- a/packages/plugin-faker/src/plugin.ts +++ b/packages/plugin-faker/src/plugin.ts @@ -27,6 +27,7 @@ export const pluginFaker = createPlugin((options) => { unknownType = 'any', dateType = 'string', dateParser = 'faker', + generators = [fakerGenerator].filter(Boolean), regexGenerator = 'faker', } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` @@ -98,7 +99,7 @@ export const pluginFaker = createPlugin((options) => { output: output.path, }) - const schemaFiles = await schemaGenerator.build(fakerGenerator) + const schemaFiles = await schemaGenerator.build(...generators) await this.addFile(...schemaFiles) const operationGenerator = new OperationGenerator(this.plugin.options, { @@ -112,7 +113,7 @@ export const pluginFaker = createPlugin((options) => { mode, }) - const operationFiles = await operationGenerator.build(fakerGenerator) + const operationFiles = await operationGenerator.build(...generators) await this.addFile(...operationFiles) if (this.config.output.exportType) { diff --git a/packages/plugin-faker/src/types.ts b/packages/plugin-faker/src/types.ts index 32062894a..e38cf6542 100644 --- a/packages/plugin-faker/src/types.ts +++ b/packages/plugin-faker/src/types.ts @@ -1,7 +1,7 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { SchemaObject } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions, Schema } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions, Schema } from '@kubb/plugin-oas' export type Options = { /** @@ -89,6 +89,10 @@ export type Options = { */ schema?: (props: { schema?: SchemaObject; name?: string; parentName?: string }, defaultSchemas: Schema[]) => Schema[] | undefined } + /** + * Define some generators next to the faker generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-msw/package.json b/packages/plugin-msw/package.json index 73323f908..a162f09e7 100644 --- a/packages/plugin-msw/package.json +++ b/packages/plugin-msw/package.json @@ -96,7 +96,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-msw/src/plugin.ts b/packages/plugin-msw/src/plugin.ts index 9b339bcd7..bfbab1cda 100644 --- a/packages/plugin-msw/src/plugin.ts +++ b/packages/plugin-msw/src/plugin.ts @@ -16,7 +16,16 @@ import type { PluginMsw } from './types.ts' export const pluginMswName = 'plugin-msw' satisfies PluginMsw['name'] export const pluginMsw = createPlugin((options) => { - const { output = { path: 'handlers' }, group, exclude = [], include, override = [], transformers = {}, handlers = false } = options + const { + output = { path: 'handlers' }, + group, + exclude = [], + include, + override = [], + transformers = {}, + handlers = false, + generators = [mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean), + } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` return { @@ -77,7 +86,7 @@ export const pluginMsw = createPlugin((options) => { mode, }) - const files = await operationGenerator.build(...[mswGenerator, handlers ? handlersGenerator : undefined].filter(Boolean)) + const files = await operationGenerator.build(...generators) await this.addFile(...files) if (this.config.output.exportType) { diff --git a/packages/plugin-msw/src/types.ts b/packages/plugin-msw/src/types.ts index b2e9cf26e..f962ed7fc 100644 --- a/packages/plugin-msw/src/types.ts +++ b/packages/plugin-msw/src/types.ts @@ -1,6 +1,6 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' export type Options = { /** @@ -52,6 +52,10 @@ export type Options = { * @default `false` */ handlers?: boolean + /** + * Define some generators next to the msw generators + */ + generators?: Array> } type ResolvedOptions = { output: Output diff --git a/packages/plugin-oas/package.json b/packages/plugin-oas/package.json index 1eb4c5d5e..8360ff5e6 100644 --- a/packages/plugin-oas/package.json +++ b/packages/plugin-oas/package.json @@ -95,7 +95,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-react-query/package.json b/packages/plugin-react-query/package.json index 713551712..473b214c0 100644 --- a/packages/plugin-react-query/package.json +++ b/packages/plugin-react-query/package.json @@ -84,7 +84,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-react-query/src/components/Mutation.tsx b/packages/plugin-react-query/src/components/Mutation.tsx index c06398e4b..2102f90e7 100644 --- a/packages/plugin-react-query/src/components/Mutation.tsx +++ b/packages/plugin-react-query/src/components/Mutation.tsx @@ -16,7 +16,6 @@ type Props = { typeName: string clientName: string mutationKeyName: string - mutationKeyTypeName: string typeSchemas: OperationSchemas operation: Operation dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] @@ -67,7 +66,7 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) { }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyTypeName, mutationKeyName }: Props): ReactNode { +export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { const returnType = 'ReturnType & { mutationKey: MutationKey }' const mutationKeyParams = MutationKey.getParams({ diff --git a/packages/plugin-react-query/src/generators/mutationGenerator.tsx b/packages/plugin-react-query/src/generators/mutationGenerator.tsx index 96d1ce94b..b1e8fa9e1 100644 --- a/packages/plugin-react-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-react-query/src/generators/mutationGenerator.tsx @@ -104,7 +104,6 @@ export const mutationGenerator = createReactGenerator({ dataReturnType={options.client.dataReturnType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} - mutationKeyTypeName={mutationKey.typeName} /> ) diff --git a/packages/plugin-react-query/src/plugin.ts b/packages/plugin-react-query/src/plugin.ts index ca0d92f2a..212a5242e 100644 --- a/packages/plugin-react-query/src/plugin.ts +++ b/packages/plugin-react-query/src/plugin.ts @@ -27,6 +27,7 @@ export const pluginReactQuery = createPlugin((options) => { infinite, transformers = {}, pathParamsType = 'inline', + generators = [queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean), mutation = {}, query = {}, } = options @@ -134,7 +135,7 @@ export const pluginReactQuery = createPlugin((options) => { }, ) - const files = await operationGenerator.build(queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator) + const files = await operationGenerator.build(...generators) await this.addFile(...files) if (this.config.output.exportType) { diff --git a/packages/plugin-react-query/src/types.ts b/packages/plugin-react-query/src/types.ts index c4701e341..30283b7ef 100644 --- a/packages/plugin-react-query/src/types.ts +++ b/packages/plugin-react-query/src/types.ts @@ -1,7 +1,8 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { HttpMethod } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { PluginClient } from '@kubb/plugin-client' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' type Suspense = object @@ -170,6 +171,10 @@ export type Options = { */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string } + /** + * Define some generators next to the react-query generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-redoc/package.json b/packages/plugin-redoc/package.json index 009c4b69e..70329055d 100644 --- a/packages/plugin-redoc/package.json +++ b/packages/plugin-redoc/package.json @@ -65,7 +65,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "@types/react-dom": "^18.3.0", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-solid-query/package.json b/packages/plugin-solid-query/package.json index 977f8aa1f..8ff142e93 100644 --- a/packages/plugin-solid-query/package.json +++ b/packages/plugin-solid-query/package.json @@ -84,7 +84,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-solid-query/src/plugin.ts b/packages/plugin-solid-query/src/plugin.ts index 452311101..c523b117a 100644 --- a/packages/plugin-solid-query/src/plugin.ts +++ b/packages/plugin-solid-query/src/plugin.ts @@ -25,6 +25,7 @@ export const pluginSolidQuery = createPlugin((options) => { parser = 'client', transformers = {}, pathParamsType = 'inline', + generators = [queryGenerator].filter(Boolean), query = {}, } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` @@ -116,7 +117,7 @@ export const pluginSolidQuery = createPlugin((options) => { }, ) - const files = await operationGenerator.build(queryGenerator) + const files = await operationGenerator.build(...generators) await this.addFile(...files) if (this.config.output.exportType) { diff --git a/packages/plugin-solid-query/src/types.ts b/packages/plugin-solid-query/src/types.ts index bd516134b..e7441e075 100644 --- a/packages/plugin-solid-query/src/types.ts +++ b/packages/plugin-solid-query/src/types.ts @@ -1,7 +1,7 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { HttpMethod } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' type Query = { /** @@ -118,6 +118,10 @@ export type Options = { */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string } + /** + * Define some generators next to the solid-query generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-svelte-query/package.json b/packages/plugin-svelte-query/package.json index a82e88dfd..9b85478e6 100644 --- a/packages/plugin-svelte-query/package.json +++ b/packages/plugin-svelte-query/package.json @@ -84,7 +84,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-svelte-query/src/components/Mutation.tsx b/packages/plugin-svelte-query/src/components/Mutation.tsx index e433d6d2c..de55fa12a 100644 --- a/packages/plugin-svelte-query/src/components/Mutation.tsx +++ b/packages/plugin-svelte-query/src/components/Mutation.tsx @@ -16,7 +16,6 @@ type Props = { typeName: string clientName: string mutationKeyName: string - mutationKeyTypeName: string typeSchemas: OperationSchemas operation: Operation dataReturnType: PluginSvelteQuery['resolvedOptions']['client']['dataReturnType'] @@ -67,7 +66,7 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) { }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyTypeName, mutationKeyName }: Props): ReactNode { +export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { const returnType = 'ReturnType & { mutationKey: MutationKey }' const mutationKeyParams = MutationKey.getParams({ diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx index 147bb99b0..f4bd62fd2 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx @@ -104,7 +104,6 @@ export const mutationGenerator = createReactGenerator({ dataReturnType={options.client.dataReturnType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} - mutationKeyTypeName={mutationKey.typeName} /> ) diff --git a/packages/plugin-svelte-query/src/plugin.ts b/packages/plugin-svelte-query/src/plugin.ts index 1b698c405..6e4b394f4 100644 --- a/packages/plugin-svelte-query/src/plugin.ts +++ b/packages/plugin-svelte-query/src/plugin.ts @@ -27,6 +27,7 @@ export const pluginSvelteQuery = createPlugin((options) => { pathParamsType = 'inline', mutation = {}, query = {}, + generators = [queryGenerator, mutationGenerator].filter(Boolean), } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` @@ -123,7 +124,7 @@ export const pluginSvelteQuery = createPlugin((options) => { }, ) - const files = await operationGenerator.build(queryGenerator, mutationGenerator) + const files = await operationGenerator.build(...generators) await this.addFile(...files) if (this.config.output.exportType) { diff --git a/packages/plugin-svelte-query/src/types.ts b/packages/plugin-svelte-query/src/types.ts index 9bbea00f1..bc3496e54 100644 --- a/packages/plugin-svelte-query/src/types.ts +++ b/packages/plugin-svelte-query/src/types.ts @@ -1,7 +1,7 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { HttpMethod } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' type Query = { /** @@ -142,6 +142,10 @@ export type Options = { */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string } + /** + * Define some generators next to the svelte-query generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-swr/package.json b/packages/plugin-swr/package.json index a8d4c4ce8..80661a3eb 100644 --- a/packages/plugin-swr/package.json +++ b/packages/plugin-swr/package.json @@ -86,7 +86,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-swr/src/components/Mutation.tsx b/packages/plugin-swr/src/components/Mutation.tsx index 007c43d2c..8e2d99033 100644 --- a/packages/plugin-swr/src/components/Mutation.tsx +++ b/packages/plugin-swr/src/components/Mutation.tsx @@ -7,6 +7,7 @@ import type { OperationSchemas } from '@kubb/plugin-oas' import { getComments, getPathParams } from '@kubb/plugin-oas/utils' import type { ReactNode } from 'react' import type { PluginSwr } from '../types.ts' +import { MutationKey } from './MutationKey.tsx' type Props = { /** @@ -15,6 +16,7 @@ type Props = { name: string typeName: string clientName: string + mutationKeyName: string typeSchemas: OperationSchemas operation: Operation dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType'] @@ -60,11 +62,15 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { - const path = new URLPath(operation.path) +export function Mutation({ name, clientName, mutationKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const hookGenerics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'Key'] + const mutationKeyParams = MutationKey.getParams({ + pathParamsType, + typeSchemas, + }) + const params = getParams({ pathParamsType, dataReturnType, @@ -76,9 +82,6 @@ export function Mutation({ name, clientName, pathParamsType, dataReturnType, typ pathParamsType, }) - //fixed name, see Query.getParams and params - const swrKey = [path.template, typeSchemas.queryParams?.name ? 'params' : undefined].filter(Boolean) - return ( {` - const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} + const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {} + + const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()}) - const swrKey = [${swrKey.join(', ')}] as const return useSWRMutation<${hookGenerics}>( - shouldFetch ? swrKey : null, + shouldFetch ? mutationKey : null, async (_url${typeSchemas.request?.name ? ', { arg: data }' : ''}) => { return ${clientName}(${clientParams.toCall()}) }, diff --git a/packages/plugin-swr/src/components/MutationKey.tsx b/packages/plugin-swr/src/components/MutationKey.tsx new file mode 100644 index 000000000..8cfe0b22f --- /dev/null +++ b/packages/plugin-swr/src/components/MutationKey.tsx @@ -0,0 +1,48 @@ +import { URLPath } from '@kubb/core/utils' +import { File, Function, FunctionParams, Type } from '@kubb/react' + +import type { Operation } from '@kubb/oas' +import type { OperationSchemas } from '@kubb/plugin-oas' +import type { ReactNode } from 'react' +import type { PluginSwr } from '../types' + +type Props = { + name: string + typeName: string + typeSchemas: OperationSchemas + operation: Operation + pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] + keysFn: ((keys: unknown[]) => unknown[]) | undefined +} + +type GetParamsProps = { + pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] + typeSchemas: OperationSchemas +} + +function getParams({}: GetParamsProps) { + return FunctionParams.factory({}) +} + +export function MutationKey({ name, typeSchemas, pathParamsType, operation, typeName, keysFn = (name) => name }: Props): ReactNode { + const path = new URLPath(operation.path) + const params = getParams({ pathParamsType, typeSchemas }) + const keys = [JSON.stringify({ url: path.path })].filter(Boolean) + + return ( + <> + + + {`[${keysFn(keys).join(', ')}] as const`} + + + + + {`ReturnType`} + + + + ) +} + +MutationKey.getParams = getParams diff --git a/packages/plugin-swr/src/components/Query.tsx b/packages/plugin-swr/src/components/Query.tsx index d6bdef67c..31299c3fa 100644 --- a/packages/plugin-swr/src/components/Query.tsx +++ b/packages/plugin-swr/src/components/Query.tsx @@ -6,6 +6,7 @@ import type { OperationSchemas } from '@kubb/plugin-oas' import { getComments, getPathParams } from '@kubb/plugin-oas/utils' import type { ReactNode } from 'react' import type { PluginSwr } from '../types.ts' +import { QueryKey } from './QueryKey.tsx' import { QueryOptions } from './QueryOptions.tsx' type Props = { @@ -14,6 +15,7 @@ type Props = { */ name: string queryOptionsName: string + queryKeyName: string typeSchemas: OperationSchemas pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType'] @@ -66,10 +68,14 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro }) } -export function Query({ name, typeSchemas, queryOptionsName, operation, dataReturnType, pathParamsType }: Props): ReactNode { - const path = new URLPath(operation.path) +export function Query({ name, typeSchemas, queryKeyName, queryOptionsName, operation, dataReturnType, pathParamsType }: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const hookGenerics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'Key'] + + const queryKeyParams = QueryKey.getParams({ + pathParamsType, + typeSchemas, + }) const params = getParams({ pathParamsType, dataReturnType, @@ -81,9 +87,6 @@ export function Query({ name, typeSchemas, queryOptionsName, operation, dataRetu typeSchemas, }) - //fixed name, see Query.getParams and params - const swrKey = [path.template, typeSchemas.queryParams?.name ? 'params' : undefined].filter(Boolean) - return ( ( - shouldFetch ? swrKey : null, + shouldFetch ? queryKey : null, { ...${queryOptionsName}(${queryOptionsParams.toCall()}) ...queryOptions diff --git a/packages/plugin-swr/src/components/QueryKey.tsx b/packages/plugin-swr/src/components/QueryKey.tsx new file mode 100644 index 000000000..9a04fd271 --- /dev/null +++ b/packages/plugin-swr/src/components/QueryKey.tsx @@ -0,0 +1,73 @@ +import { URLPath } from '@kubb/core/utils' +import { getPathParams } from '@kubb/plugin-oas/utils' +import { File, Function, FunctionParams, Type } from '@kubb/react' + +import { type Operation, isOptional } from '@kubb/oas' +import type { OperationSchemas } from '@kubb/plugin-oas' +import type { ReactNode } from 'react' +import type { PluginSwr } from '../types' + +type Props = { + name: string + typeName: string + typeSchemas: OperationSchemas + operation: Operation + pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] + keysFn: ((keys: unknown[]) => unknown[]) | undefined +} + +type GetParamsProps = { + pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] + typeSchemas: OperationSchemas +} + +function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { + return FunctionParams.factory({ + pathParams: { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + }, + data: typeSchemas.request?.name + ? { + type: typeSchemas.request?.name, + optional: isOptional(typeSchemas.request?.schema), + } + : undefined, + params: typeSchemas.queryParams?.name + ? { + type: typeSchemas.queryParams?.name, + optional: isOptional(typeSchemas.queryParams?.schema), + } + : undefined, + }) +} + +export function QueryKey({ name, typeSchemas, pathParamsType, operation, typeName, keysFn = (name) => name }: Props): ReactNode { + const path = new URLPath(operation.path) + const params = getParams({ pathParamsType, typeSchemas }) + const keys = [ + path.toObject({ + type: 'path', + stringify: true, + }), + typeSchemas.queryParams?.name ? '...(params ? [params] : [])' : undefined, + typeSchemas.request?.name ? '...(data ? [data] : [])' : undefined, + ].filter(Boolean) + + return ( + <> + + + {`[${keysFn(keys).join(', ')}] as const`} + + + + + {`ReturnType`} + + + + ) +} + +QueryKey.getParams = getParams diff --git a/packages/plugin-swr/src/components/index.ts b/packages/plugin-swr/src/components/index.ts index ac5f8d123..32c0affcc 100644 --- a/packages/plugin-swr/src/components/index.ts +++ b/packages/plugin-swr/src/components/index.ts @@ -1,3 +1,5 @@ export { Mutation } from './Mutation.tsx' export { Query } from './Query.tsx' export { QueryOptions } from './QueryOptions.tsx' +export { QueryKey } from './QueryKey.tsx' +export { MutationKey } from './MutationKey.tsx' diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts index 4a693e50e..2d94e256e 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -3,6 +3,10 @@ import useSWR from "swr"; import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; import type { Key, SWRConfiguration } from "swr"; + export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; + + export type FindPetsByTagsQueryKey = ReturnType; + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -32,8 +36,8 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/findByTags`, params] as const; - return useSWR, FindPetsByTags400, Key>(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params); + return useSWR, FindPetsByTags400, Key>(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts index e362fe97a..6f3de9e28 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts @@ -3,6 +3,10 @@ import useSWR from "swr"; import type { RequestConfig } from "axios"; import type { Key, SWRConfiguration } from "swr"; + export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; + + export type FindPetsByTagsQueryKey = ReturnType; + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -32,8 +36,8 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params); + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts index d2002e714..b8366af68 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientPostImportPath.ts @@ -4,6 +4,10 @@ import type { RequestConfig } from "axios"; import type { Key } from "swr"; import type { SWRMutationConfiguration } from "swr/mutation"; + export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; + + export type UpdatePetWithFormMutationKey = ReturnType; + /** * @summary Updates a pet in the store with form data * @link /pet/:petId @@ -23,8 +27,8 @@ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"] shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/${petId}`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + const mutationKey = updatePetWithFormMutationKey(); + return useSWRMutation(shouldFetch ? mutationKey : null, async (_url) => { return updatePetWithForm(petId, params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts index 36993e604..2159c4a90 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts @@ -3,6 +3,10 @@ import useSWR from "swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; import type { Key, SWRConfiguration } from "swr"; + export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; + + export type FindPetsByTagsQueryKey = ReturnType; + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -32,8 +36,8 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params); + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts index 36993e604..2159c4a90 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -3,6 +3,10 @@ import useSWR from "swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; import type { Key, SWRConfiguration } from "swr"; + export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; + + export type FindPetsByTagsQueryKey = ReturnType; + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -32,8 +36,8 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params); + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts index 468de44f6..f4d003dd7 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts @@ -3,6 +3,10 @@ import useSWR from "swr"; import type { RequestConfig } from "@kubb/plugin-client/client"; import type { Key, SWRConfiguration } from "swr"; + export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const; + + export type FindPetsByTagsQueryKey = ReturnType; + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -32,8 +36,8 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/findByTags`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = findPetsByTagsQueryKey(params); + return useSWR(shouldFetch ? queryKey : null, { ...findPetsByTagsQueryOptions(params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts b/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts index 1f92065a9..4e38b484b 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/getAsMutation.ts @@ -4,6 +4,10 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; import type { SWRMutationConfiguration } from "custom-swr/mutation"; import type { Key } from "swr"; + export const findPetsByTagsMutationKey = () => [{ "url": "/pet/findByTags" }] as const; + + export type FindPetsByTagsMutationKey = ReturnType; + /** * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * @summary Finds Pets by tags @@ -25,8 +29,8 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/findByTags`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + const mutationKey = findPetsByTagsMutationKey(); + return useSWRMutation(shouldFetch ? mutationKey : null, async (_url) => { return findPetsByTags(params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts index 54da20647..98cd6e874 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts @@ -4,6 +4,10 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; import type { SWRConfiguration } from "custom-swr"; import type { Key } from "swr"; + export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams) => [{ url: "/pet/:petId", params: { petId: petId } }, ...(params ? [params] : [])] as const; + + export type UpdatePetWithFormQueryKey = ReturnType; + /** * @summary Updates a pet in the store with form data * @link /pet/:petId @@ -31,8 +35,8 @@ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"] shouldFetch?: boolean; } = {}) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/${petId}`, params] as const; - return useSWR(shouldFetch ? swrKey : null, { + const queryKey = updatePetWithFormQueryKey(petId, params); + return useSWR(shouldFetch ? queryKey : null, { ...updatePetWithFormQueryOptions(petId, params, config), ...queryOptions }); diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts index da7587b7c..c1a968772 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetById.ts @@ -4,6 +4,10 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; import type { Key } from "swr"; import type { SWRMutationConfiguration } from "swr/mutation"; + export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; + + export type UpdatePetWithFormMutationKey = ReturnType; + /** * @summary Updates a pet in the store with form data * @link /pet/:petId @@ -23,8 +27,8 @@ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"] shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/${petId}`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + const mutationKey = updatePetWithFormMutationKey(); + return useSWRMutation(shouldFetch ? mutationKey : null, async (_url) => { return updatePetWithForm(petId, params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 1cf90c3c6..d187ffade 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -4,6 +4,10 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; import type { Key } from "swr"; import type { SWRMutationConfiguration } from "swr/mutation"; + export const updatePetWithFormMutationKey = () => [{ "url": "/pet/{petId}" }] as const; + + export type UpdatePetWithFormMutationKey = ReturnType; + /** * @summary Updates a pet in the store with form data * @link /pet/:petId @@ -27,8 +31,8 @@ export function useUpdatePetWithForm({ petId }: { shouldFetch?: boolean; } = {}) { const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}; - const swrKey = [`/pet/${petId}`, params] as const; - return useSWRMutation(shouldFetch ? swrKey : null, async (_url) => { + const mutationKey = updatePetWithFormMutationKey(); + return useSWRMutation(shouldFetch ? mutationKey : null, async (_url) => { return updatePetWithForm({ petId }, params, config); }, mutationOptions); } diff --git a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx index e8b14878f..efacc08c7 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx @@ -17,6 +17,7 @@ describe('mutationGenerator operation', async () => { method: 'get', options: { mutation: { + key: (key: unknown[]) => key, importPath: 'custom-swr/mutation', methods: ['get'], }, @@ -75,10 +76,12 @@ describe('mutationGenerator operation', async () => { }, parser: 'client', query: { + key: (key: unknown[]) => key, importPath: 'swr', methods: ['get'], }, mutation: { + key: (key: unknown[]) => key, importPath: 'swr/mutation', methods: ['post'], }, diff --git a/packages/plugin-swr/src/generators/mutationGenerator.tsx b/packages/plugin-swr/src/generators/mutationGenerator.tsx index bae1e73ee..c29cd7783 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.tsx @@ -1,3 +1,4 @@ +import transformers from '@kubb/core/transformers' import { pluginClientName } from '@kubb/plugin-client' import { Client } from '@kubb/plugin-client/components' import { createReactGenerator } from '@kubb/plugin-oas' @@ -5,6 +6,7 @@ import { useOperationManager } from '@kubb/plugin-oas/hooks' import { pluginTsName } from '@kubb/plugin-ts' import { pluginZodName } from '@kubb/plugin-zod' import { File, useApp } from '@kubb/react' +import { MutationKey } from '../components' import { Mutation } from '../components' import type { PluginSwr } from '../types' @@ -41,6 +43,11 @@ export const mutationGenerator = createReactGenerator({ name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }), } + const mutationKey = { + name: transformers.camelCase(`${operation.getOperationId()} MutationKey`), + typeName: transformers.pascalCase(`${operation.getOperationId()} MutationKey`), + } + if (!isMutate) { return null } @@ -69,6 +76,14 @@ export const mutationGenerator = createReactGenerator({ path={type.file.path} isTypeOnly /> + ({ operation={operation} dataReturnType={options.client.dataReturnType} pathParamsType={options.pathParamsType} + mutationKeyName={mutationKey.name} /> ) diff --git a/packages/plugin-swr/src/generators/queryGenerator.test.tsx b/packages/plugin-swr/src/generators/queryGenerator.test.tsx index da6415ad9..1a2729dfc 100644 --- a/packages/plugin-swr/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/queryGenerator.test.tsx @@ -66,6 +66,7 @@ describe('queryGenerator operation', async () => { method: 'post', options: { query: { + key: (key: unknown[]) => key, importPath: 'custom-swr', methods: ['post'], }, @@ -88,10 +89,12 @@ describe('queryGenerator operation', async () => { importPath: '@kubb/plugin-client/client', }, query: { + key: (key: unknown[]) => key, importPath: 'swr', methods: ['get'], }, mutation: { + key: (key: unknown[]) => key, importPath: 'swr/mutation', methods: ['post'], }, diff --git a/packages/plugin-swr/src/generators/queryGenerator.tsx b/packages/plugin-swr/src/generators/queryGenerator.tsx index 95e1e6823..f2ede3369 100644 --- a/packages/plugin-swr/src/generators/queryGenerator.tsx +++ b/packages/plugin-swr/src/generators/queryGenerator.tsx @@ -7,6 +7,7 @@ import { pluginTsName } from '@kubb/plugin-ts' import { pluginZodName } from '@kubb/plugin-zod' import { File, useApp } from '@kubb/react' import { Query, QueryOptions } from '../components' +import { QueryKey } from '../components' import type { PluginSwr } from '../types' export const queryGenerator = createReactGenerator({ @@ -34,6 +35,10 @@ export const queryGenerator = createReactGenerator({ const queryOptions = { name: transformers.camelCase(`${operation.getOperationId()} QueryOptions`), } + const queryKey = { + name: transformers.camelCase(`${operation.getOperationId()} QueryKey`), + typeName: transformers.pascalCase(`${operation.getOperationId()} QueryKey`), + } const type = { file: getFile(operation, { pluginKey: [pluginTsName] }), @@ -74,6 +79,14 @@ export const queryGenerator = createReactGenerator({ path={type.file.path} isTypeOnly /> + ({ pathParamsType={options.pathParamsType} operation={operation} dataReturnType={options.client.dataReturnType} + queryKeyName={queryKey.name} /> ) diff --git a/packages/plugin-swr/src/plugin.ts b/packages/plugin-swr/src/plugin.ts index 60e106a04..2326e1855 100644 --- a/packages/plugin-swr/src/plugin.ts +++ b/packages/plugin-swr/src/plugin.ts @@ -28,6 +28,7 @@ export const pluginSwr = createPlugin((options) => { mutation, client, pathParamsType = 'inline', + generators = [queryGenerator, mutationGenerator].filter(Boolean), } = options const template = group?.output ? group.output : `${output.path}/{{tag}}SWRController` @@ -45,11 +46,13 @@ export const pluginSwr = createPlugin((options) => { ...client, }, query: { + key: (key: unknown[]) => key, importPath: 'swr', methods: ['get'], ...query, }, mutation: { + key: (key: unknown[]) => key, importPath: 'swr/mutation', methods: ['post', 'put', 'delete', 'patch'], ...mutation, @@ -122,7 +125,7 @@ export const pluginSwr = createPlugin((options) => { }, ) - const files = await operationGenerator.build(queryGenerator, mutationGenerator) + const files = await operationGenerator.build(...generators) await this.addFile(...files) if (this.config.output.exportType) { diff --git a/packages/plugin-swr/src/types.ts b/packages/plugin-swr/src/types.ts index 6306db904..a9a7f520b 100644 --- a/packages/plugin-swr/src/types.ts +++ b/packages/plugin-swr/src/types.ts @@ -1,6 +1,6 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { HttpMethod } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' export type Options = { /** @@ -62,6 +62,10 @@ export type Options = { dataReturnType?: 'data' | 'full' } query?: { + /** + * Customize the queryKey, here you can specify a suffix. + */ + key: (key: unknown[]) => unknown[] /** * Define which HttpMethods can be used for queries * @default ['get'] @@ -77,6 +81,10 @@ export type Options = { importPath?: string } mutation?: { + /** + * Customize the queryKey, here you can specify a suffix. + */ + key: (key: unknown[]) => unknown[] /** * Define which HttpMethods can be used for queries * @default ['post', 'put', 'delete', 'patch'] @@ -112,6 +120,10 @@ export type Options = { */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string } + /** + * Define some generators next to the swr generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-ts/package.json b/packages/plugin-ts/package.json index fcfd2c4a2..706a93679 100644 --- a/packages/plugin-ts/package.json +++ b/packages/plugin-ts/package.json @@ -79,7 +79,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-ts/src/plugin.ts b/packages/plugin-ts/src/plugin.ts index 783716c39..a57f129e1 100644 --- a/packages/plugin-ts/src/plugin.ts +++ b/packages/plugin-ts/src/plugin.ts @@ -27,6 +27,7 @@ export const pluginTs = createPlugin((options) => { transformers = {}, oasType = false, mapper = {}, + generators = [typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean), } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` @@ -97,7 +98,7 @@ export const pluginTs = createPlugin((options) => { output: output.path, }) - const schemaFiles = await schemaGenerator.build(...[typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean)) + const schemaFiles = await schemaGenerator.build(...generators) await this.addFile(...schemaFiles) const operationGenerator = new OperationGenerator(this.plugin.options, { @@ -111,7 +112,7 @@ export const pluginTs = createPlugin((options) => { mode, }) - const operationFiles = await operationGenerator.build(...[typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean)) + const operationFiles = await operationGenerator.build(...generators) await this.addFile(...operationFiles) if (this.config.output.exportType) { diff --git a/packages/plugin-ts/src/types.ts b/packages/plugin-ts/src/types.ts index f59709709..86d22f595 100644 --- a/packages/plugin-ts/src/types.ts +++ b/packages/plugin-ts/src/types.ts @@ -1,5 +1,5 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' import type ts from 'typescript' export type Options = { @@ -88,6 +88,10 @@ export type Options = { * ) */ mapper?: Record + /** + * Define some generators next to the ts generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-vue-query/package.json b/packages/plugin-vue-query/package.json index c2ee265b7..5912ec5ae 100644 --- a/packages/plugin-vue-query/package.json +++ b/packages/plugin-vue-query/package.json @@ -84,7 +84,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "react": "^18.3.1", "tsup": "^8.3.0", "typescript": "^5.6.2" diff --git a/packages/plugin-vue-query/src/components/Mutation.tsx b/packages/plugin-vue-query/src/components/Mutation.tsx index d9a59941a..d9a439549 100644 --- a/packages/plugin-vue-query/src/components/Mutation.tsx +++ b/packages/plugin-vue-query/src/components/Mutation.tsx @@ -16,7 +16,6 @@ type Props = { typeName: string clientName: string mutationKeyName: string - mutationKeyTypeName: string typeSchemas: OperationSchemas operation: Operation dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] @@ -75,7 +74,7 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) { }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyTypeName, mutationKeyName }: Props): ReactNode { +export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { const returnType = 'ReturnType & { mutationKey: MutationKey }' const mutationKeyParams = MutationKey.getParams({ diff --git a/packages/plugin-vue-query/src/generators/mutationGenerator.tsx b/packages/plugin-vue-query/src/generators/mutationGenerator.tsx index 9412d0ea8..686c238ef 100644 --- a/packages/plugin-vue-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/mutationGenerator.tsx @@ -105,7 +105,6 @@ export const mutationGenerator = createReactGenerator({ dataReturnType={options.client.dataReturnType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} - mutationKeyTypeName={mutationKey.typeName} /> ) diff --git a/packages/plugin-vue-query/src/plugin.ts b/packages/plugin-vue-query/src/plugin.ts index 5494adfe1..4a10476fc 100644 --- a/packages/plugin-vue-query/src/plugin.ts +++ b/packages/plugin-vue-query/src/plugin.ts @@ -28,6 +28,7 @@ export const pluginVueQuery = createPlugin((options) => { pathParamsType = 'inline', mutation = {}, query = {}, + generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean), } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` @@ -132,7 +133,7 @@ export const pluginVueQuery = createPlugin((options) => { }, ) - const files = await operationGenerator.build(queryGenerator, infiniteQueryGenerator, mutationGenerator) + const files = await operationGenerator.build(...generators) await this.addFile(...files) if (this.config.output.exportType) { diff --git a/packages/plugin-vue-query/src/types.ts b/packages/plugin-vue-query/src/types.ts index 7392bfee0..c7a3c0cb3 100644 --- a/packages/plugin-vue-query/src/types.ts +++ b/packages/plugin-vue-query/src/types.ts @@ -1,7 +1,7 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { HttpMethod } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas' type Query = { /** @@ -164,6 +164,10 @@ export type Options = { */ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string } + /** + * Define some generators next to the vue-query generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/plugin-zod/src/plugin.ts b/packages/plugin-zod/src/plugin.ts index 96702053b..7dfe775f7 100644 --- a/packages/plugin-zod/src/plugin.ts +++ b/packages/plugin-zod/src/plugin.ts @@ -31,6 +31,7 @@ export const pluginZod = createPlugin((options) => { importPath = 'zod', coercion = false, inferred = false, + generators = [zodGenerator, operations ? operationsGenerator : undefined].filter(Boolean), } = options const template = group?.output ? group.output : `${output.path}/{{tag}}Controller` @@ -110,7 +111,7 @@ export const pluginZod = createPlugin((options) => { output: output.path, }) - const schemaFiles = await schemaGenerator.build(...[zodGenerator, operations ? operationsGenerator : undefined].filter(Boolean)) + const schemaFiles = await schemaGenerator.build(...generators) await this.addFile(...schemaFiles) const operationGenerator = new OperationGenerator(this.plugin.options, { @@ -124,7 +125,7 @@ export const pluginZod = createPlugin((options) => { mode, }) - const operationFiles = await operationGenerator.build(...[zodGenerator, operations ? operationsGenerator : undefined].filter(Boolean)) + const operationFiles = await operationGenerator.build(...generators) await this.addFile(...operationFiles) if (this.config.output.exportType) { diff --git a/packages/plugin-zod/src/types.ts b/packages/plugin-zod/src/types.ts index 4081602c0..55c83b9bf 100644 --- a/packages/plugin-zod/src/types.ts +++ b/packages/plugin-zod/src/types.ts @@ -1,6 +1,6 @@ import type { Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core' import type { SchemaObject } from '@kubb/oas' -import type { Exclude, Include, Override, ResolvePathOptions, Schema } from '@kubb/plugin-oas' +import type { Exclude, Generator, Include, Override, ResolvePathOptions, Schema } from '@kubb/plugin-oas' export type Options = { /** @@ -94,6 +94,10 @@ export type Options = { defaultSchemas: Schema[], ) => Schema[] | undefined } + /** + * Define some generators next to the zod generators + */ + generators?: Array> } type ResolvedOptions = { diff --git a/packages/react/package.json b/packages/react/package.json index de5104f0a..c68f70916 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -97,7 +97,7 @@ "devDependencies": { "@kubb/config-ts": "workspace:*", "@kubb/config-tsup": "workspace:*", - "@types/react": "^18.3.8", + "@types/react": "^18.3.9", "@types/react-reconciler": "^0.28.8", "@types/signal-exit": "^3.0.4", "@types/ws": "^8.5.12", diff --git a/packages/unplugin-kubb/package.json b/packages/unplugin-kubb/package.json index 9246c2fb5..5b650e8ac 100644 --- a/packages/unplugin-kubb/package.json +++ b/packages/unplugin-kubb/package.json @@ -112,7 +112,7 @@ "@kubb/core": "workspace:*", "@nuxt/kit": "^3.13.2", "@nuxt/schema": "^3.13.2", - "@types/node": "^20.16.5", + "@types/node": "^20.16.6", "rimraf": "^5.0.10", "rollup": "^4.22.4", "tsup": "^8.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c7e01004b..3070fc227 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,11 +32,11 @@ importers: specifier: workspace:* version: link:packages/config-ts '@types/node': - specifier: ^20.16.5 - version: 20.16.5 + specifier: ^20.16.6 + version: 20.16.6 '@vitest/coverage-v8': specifier: ^2.1.1 - version: 2.1.1(vitest@2.1.1(@types/node@20.16.5)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1)) + version: 2.1.1(vitest@2.1.1(@types/node@20.16.6)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1)) '@vitest/ui': specifier: ^2.1.1 version: 2.1.1(vitest@2.1.1) @@ -48,7 +48,7 @@ importers: version: 6.0.1 ts-node: specifier: ^10.9.2 - version: 10.9.2(@swc/core@1.7.22)(@types/node@20.16.5)(typescript@5.6.2) + version: 10.9.2(@swc/core@1.7.22)(@types/node@20.16.6)(typescript@5.6.2) turbo: specifier: ^2.1.2 version: 2.1.2 @@ -57,10 +57,10 @@ importers: version: 5.6.2 vite-tsconfig-paths: specifier: ^4.3.2 - version: 4.3.2(typescript@5.6.2)(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1)) + version: 4.3.2(typescript@5.6.2)(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1)) vitest: specifier: ^2.1.1 - version: 2.1.1(@types/node@20.16.5)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1) + version: 2.1.1(@types/node@20.16.6)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1) docs: dependencies: @@ -72,7 +72,7 @@ importers: version: 8.0.0 vitepress: specifier: ^1.3.4 - version: 1.3.4(@algolia/client-search@4.24.0)(@types/node@20.16.5)(@types/react@18.3.8)(axios@1.7.7)(change-case@5.4.4)(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)(terser@5.31.1)(typescript@5.6.2) + version: 1.3.4(@algolia/client-search@4.24.0)(@types/node@20.16.6)(@types/react@18.3.9)(axios@1.7.7)(change-case@5.4.4)(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)(terser@5.31.1)(typescript@5.6.2) vitepress-plugin-group-icons: specifier: ^1.2.4 version: 1.2.4 @@ -126,11 +126,11 @@ importers: specifier: workspace:* version: link:../packages/react '@types/node': - specifier: ^20.16.5 - version: 20.16.5 + specifier: ^20.16.6 + version: 20.16.6 '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -142,7 +142,7 @@ importers: version: link:../packages/unplugin-kubb vite: specifier: ^5.4.7 - version: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + version: 5.4.7(@types/node@20.16.6)(terser@5.31.1) e2e: dependencies: @@ -214,7 +214,7 @@ importers: version: 2.2.5(react@18.3.1) tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) vue: specifier: ^3.5.8 version: 3.5.8(typescript@5.6.2) @@ -318,7 +318,7 @@ importers: version: link:../../packages/config-ts tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -355,7 +355,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -394,7 +394,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) devDependencies: '@kubb/config-ts': specifier: workspace:* @@ -429,7 +429,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -471,7 +471,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1) devDependencies: '@kubb/config-ts': specifier: workspace:* @@ -526,26 +526,26 @@ importers: version: link:../../packages/unplugin-kubb devDependencies: '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 '@types/react-dom': specifier: ^18.3.0 version: 18.3.0 '@vitejs/plugin-react': specifier: ^4.3.1 - version: 4.3.1(vite@4.5.5(@types/node@20.16.5)(terser@5.31.1)) + version: 4.3.1(vite@4.5.5(@types/node@20.16.6)(terser@5.31.1)) msw: specifier: ^1.3.4 version: 1.3.4(typescript@5.6.2) tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 vite: specifier: ^4.5.5 - version: 4.5.5(@types/node@20.16.5)(terser@5.31.1) + version: 4.5.5(@types/node@20.16.6)(terser@5.31.1) examples/simple-single: dependencies: @@ -584,7 +584,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) zod: specifier: ^3.23.8 version: 3.23.8 @@ -623,7 +623,7 @@ importers: version: 1.8.23 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) devDependencies: typescript: specifier: ^5.6.2 @@ -663,7 +663,7 @@ importers: version: 3.59.2 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) devDependencies: typescript: specifier: ^5.6.2 @@ -703,7 +703,7 @@ importers: version: 2.2.5(react@18.3.1) tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) examples/typescript: dependencies: @@ -727,7 +727,7 @@ importers: version: 1.7.7 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) devDependencies: typescript: specifier: ^5.6.2 @@ -771,19 +771,19 @@ importers: devDependencies: '@vitejs/plugin-vue': specifier: ^4.6.2 - version: 4.6.2(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2)) + version: 4.6.2(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2)) msw: specifier: ^1.3.4 version: 1.3.4(typescript@5.6.2) tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 vite: specifier: ^5.4.7 - version: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + version: 5.4.7(@types/node@20.16.6)(terser@5.31.1) examples/zod: dependencies: @@ -810,7 +810,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) zod: specifier: ^3.23.8 version: 3.23.8 @@ -880,8 +880,8 @@ importers: specifier: ^3.11.6 version: 3.11.6 '@types/node': - specifier: ^20.16.5 - version: 20.16.5 + specifier: ^20.16.6 + version: 20.16.6 '@types/semver': specifier: ^7.5.8 version: 7.5.8 @@ -890,7 +890,7 @@ importers: version: 0.5.21 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -907,17 +907,17 @@ importers: dependencies: '@microsoft/api-extractor': specifier: ^7.47.9 - version: 7.47.9(@types/node@20.16.5) + version: 7.47.9(@types/node@20.16.6) devDependencies: '@kubb/config-ts': specifier: workspace:* version: link:../config-ts '@types/node': - specifier: ^20.16.5 - version: 20.16.5 + specifier: ^20.16.6 + version: 20.16.6 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) packages/core: dependencies: @@ -981,7 +981,7 @@ importers: version: 1.2.0 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1006,7 +1006,7 @@ importers: version: 11.0.4 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) packages/kubb: dependencies: @@ -1024,11 +1024,11 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/node': - specifier: ^20.16.5 - version: 20.16.5 + specifier: ^20.16.6 + version: 20.16.6 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1083,7 +1083,7 @@ importers: version: 0.19.0 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1105,7 +1105,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) packages/plugin-client: dependencies: @@ -1142,7 +1142,7 @@ importers: version: 1.7.7 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1176,7 +1176,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1212,14 +1212,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1252,14 +1252,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1295,14 +1295,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1347,14 +1347,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 '@types/react-dom': specifier: ^18.3.0 version: 18.3.0 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1390,14 +1390,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1433,14 +1433,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1479,14 +1479,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1519,14 +1519,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1562,14 +1562,14 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1606,7 +1606,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) packages/react: dependencies: @@ -1651,8 +1651,8 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/react': - specifier: ^18.3.8 - version: 18.3.8 + specifier: ^18.3.9 + version: 18.3.9 '@types/react-reconciler': specifier: ^0.28.8 version: 0.28.8 @@ -1664,7 +1664,7 @@ importers: version: 8.5.12 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1679,7 +1679,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 @@ -1712,8 +1712,8 @@ importers: specifier: ^3.13.2 version: 3.13.2(rollup@4.22.4)(webpack-sources@3.2.3) '@types/node': - specifier: ^20.16.5 - version: 20.16.5 + specifier: ^20.16.6 + version: 20.16.6 rimraf: specifier: ^5.0.10 version: 5.0.10 @@ -1722,13 +1722,13 @@ importers: version: 4.22.4 tsup: specifier: ^8.3.0 - version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) + version: 8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1) typescript: specifier: ^5.6.2 version: 5.6.2 vite: specifier: ^5.4.7 - version: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + version: 5.4.7(@types/node@20.16.6)(terser@5.31.1) webpack: specifier: ^5.94.0 version: 5.94.0(@swc/core@1.7.22)(esbuild@0.20.2) @@ -3478,8 +3478,8 @@ packages: '@types/node@20.12.14': resolution: {integrity: sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg==} - '@types/node@20.16.5': - resolution: {integrity: sha512-VwYCweNo3ERajwy0IUlqqcyZ8/A7Zwa9ZP3MnENWcB11AejO+tLy3pu850goUW2FC/IJMdZUfKpX/yxL1gymCA==} + '@types/node@20.16.6': + resolution: {integrity: sha512-T7PpxM/6yeDE+AdlVysT62BX6/bECZOmQAgiFg5NoBd5MQheZ3tzal7f1wvzfiEcmrcJNRi2zRr2nY2zF+0uqw==} '@types/object-hash@3.0.6': resolution: {integrity: sha512-fOBV8C1FIu2ELinoILQ+ApxcUKz4ngq+IWUYrxSGjXzzjUALijilampwkMgEtJ+h2njAW3pi853QpzNVCHB73w==} @@ -3499,8 +3499,8 @@ packages: '@types/react-reconciler@0.28.8': resolution: {integrity: sha512-SN9c4kxXZonFhbX4hJrZy37yw9e7EIxcpHCxQv5JUS18wDE5ovkQKlqQEkufdJCCMfuI9BnjUJvhYeJ9x5Ra7g==} - '@types/react@18.3.8': - resolution: {integrity: sha512-syBUrW3/XpnW4WJ41Pft+I+aPoDVbrBVQGEnbD7NijDGlVC+8gV/XKRY+7vMDlfPpbwYt0l1vd/Sj8bJGMbs9Q==} + '@types/react@18.3.9': + resolution: {integrity: sha512-+BpAVyTpJkNWWSSnaLBk6ePpHLOGJKnEQNbINNovPWzvEUyAe3e+/d494QdEh71RekM/qV7lw6jzf1HGrJyAtQ==} '@types/sax@1.2.7': resolution: {integrity: sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==} @@ -7870,9 +7870,9 @@ snapshots: '@docsearch/css@3.6.1': {} - '@docsearch/js@3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)': + '@docsearch/js@3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)': dependencies: - '@docsearch/react': 3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1) + '@docsearch/react': 3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1) preact: 10.23.2 transitivePeerDependencies: - '@algolia/client-search' @@ -7881,14 +7881,14 @@ snapshots: - react-dom - search-insights - '@docsearch/react@3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)': + '@docsearch/react@3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)': dependencies: '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.24.0)(algoliasearch@4.24.0)(search-insights@2.17.1) '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.24.0)(algoliasearch@4.24.0) '@docsearch/css': 3.6.1 algoliasearch: 4.24.0 optionalDependencies: - '@types/react': 18.3.8 + '@types/react': 18.3.9 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) search-insights: 2.17.1 @@ -8227,7 +8227,7 @@ snapshots: '@inquirer/figures': 1.0.3 '@inquirer/type': 1.3.3 '@types/mute-stream': 0.0.4 - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 chalk: 4.1.2 @@ -8422,23 +8422,23 @@ snapshots: globby: 11.1.0 read-yaml-file: 1.1.0 - '@microsoft/api-extractor-model@7.29.8(@types/node@20.16.5)': + '@microsoft/api-extractor-model@7.29.8(@types/node@20.16.6)': dependencies: '@microsoft/tsdoc': 0.15.0 '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.9.0(@types/node@20.16.5) + '@rushstack/node-core-library': 5.9.0(@types/node@20.16.6) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.47.9(@types/node@20.16.5)': + '@microsoft/api-extractor@7.47.9(@types/node@20.16.6)': dependencies: - '@microsoft/api-extractor-model': 7.29.8(@types/node@20.16.5) + '@microsoft/api-extractor-model': 7.29.8(@types/node@20.16.6) '@microsoft/tsdoc': 0.15.0 '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.9.0(@types/node@20.16.5) + '@rushstack/node-core-library': 5.9.0(@types/node@20.16.6) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.14.2(@types/node@20.16.5) - '@rushstack/ts-command-line': 4.22.8(@types/node@20.16.5) + '@rushstack/terminal': 0.14.2(@types/node@20.16.6) + '@rushstack/ts-command-line': 4.22.8(@types/node@20.16.6) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.8 @@ -8800,7 +8800,7 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.22.4': optional: true - '@rushstack/node-core-library@5.9.0(@types/node@20.16.5)': + '@rushstack/node-core-library@5.9.0(@types/node@20.16.6)': dependencies: ajv: 8.13.0 ajv-draft-04: 1.0.0(ajv@8.13.0) @@ -8811,23 +8811,23 @@ snapshots: resolve: 1.22.8 semver: 7.5.4 optionalDependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@rushstack/rig-package@0.5.3': dependencies: resolve: 1.22.8 strip-json-comments: 3.1.1 - '@rushstack/terminal@0.14.2(@types/node@20.16.5)': + '@rushstack/terminal@0.14.2(@types/node@20.16.6)': dependencies: - '@rushstack/node-core-library': 5.9.0(@types/node@20.16.5) + '@rushstack/node-core-library': 5.9.0(@types/node@20.16.6) supports-color: 8.1.1 optionalDependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 - '@rushstack/ts-command-line@4.22.8(@types/node@20.16.5)': + '@rushstack/ts-command-line@4.22.8(@types/node@20.16.6)': dependencies: - '@rushstack/terminal': 0.14.2(@types/node@20.16.5) + '@rushstack/terminal': 0.14.2(@types/node@20.16.6) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -9052,15 +9052,15 @@ snapshots: '@types/body-parser@1.19.5': dependencies: '@types/connect': 3.4.38 - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/cli-progress@3.11.6': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/connect@3.4.38': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/cookie@0.4.1': {} @@ -9074,7 +9074,7 @@ snapshots: '@types/express-serve-static-core@4.19.5': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/qs': 6.9.15 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -9089,7 +9089,7 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/hast@3.0.4': dependencies: @@ -9103,7 +9103,7 @@ snapshots: '@types/jsonfile@6.1.4': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/linkify-it@5.0.0': {} @@ -9124,7 +9124,7 @@ snapshots: '@types/mute-stream@0.0.4': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/node@12.20.55': {} @@ -9134,7 +9134,7 @@ snapshots: dependencies: undici-types: 5.26.5 - '@types/node@20.16.5': + '@types/node@20.16.6': dependencies: undici-types: 6.19.8 @@ -9148,20 +9148,20 @@ snapshots: '@types/react-dom@18.3.0': dependencies: - '@types/react': 18.3.8 + '@types/react': 18.3.9 '@types/react-reconciler@0.28.8': dependencies: - '@types/react': 18.3.8 + '@types/react': 18.3.9 - '@types/react@18.3.8': + '@types/react@18.3.9': dependencies: '@types/prop-types': 15.7.12 csstype: 3.1.3 '@types/sax@1.2.7': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/seedrandom@3.0.8': {} @@ -9170,17 +9170,17 @@ snapshots: '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/serve-static@1.15.7': dependencies: '@types/http-errors': 2.0.4 - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/send': 0.17.4 '@types/set-cookie-parser@2.4.9': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@types/signal-exit@3.0.4': {} @@ -9190,7 +9190,7 @@ snapshots: '@types/swagger2openapi@7.0.4': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 openapi-types: 12.1.3 '@types/tough-cookie@4.0.5': {} @@ -9203,7 +9203,7 @@ snapshots: '@types/ws@8.5.12': dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@typescript/vfs@1.6.0(typescript@5.6.2)': dependencies: @@ -9214,28 +9214,28 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-react@4.3.1(vite@4.5.5(@types/node@20.16.5)(terser@5.31.1))': + '@vitejs/plugin-react@4.3.1(vite@4.5.5(@types/node@20.16.6)(terser@5.31.1))': dependencies: '@babel/core': 7.24.7 '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.7) '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.24.7) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 4.5.5(@types/node@20.16.5)(terser@5.31.1) + vite: 4.5.5(@types/node@20.16.6)(terser@5.31.1) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@4.6.2(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2))': + '@vitejs/plugin-vue@4.6.2(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2))': dependencies: - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) vue: 3.5.8(typescript@5.6.2) - '@vitejs/plugin-vue@5.1.3(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2))': + '@vitejs/plugin-vue@5.1.3(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2))': dependencies: - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) vue: 3.5.8(typescript@5.6.2) - '@vitest/coverage-v8@2.1.1(vitest@2.1.1(@types/node@20.16.5)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1))': + '@vitest/coverage-v8@2.1.1(vitest@2.1.1(@types/node@20.16.6)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 @@ -9249,7 +9249,7 @@ snapshots: std-env: 3.7.0 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.1.1(@types/node@20.16.5)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1) + vitest: 2.1.1(@types/node@20.16.6)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1) transitivePeerDependencies: - supports-color @@ -9260,14 +9260,14 @@ snapshots: chai: 5.1.1 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(msw@2.4.9(typescript@5.6.2))(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1))': + '@vitest/mocker@2.1.1(@vitest/spy@2.1.1)(msw@2.4.9(typescript@5.6.2))(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1))': dependencies: '@vitest/spy': 2.1.1 estree-walker: 3.0.3 magic-string: 0.30.11 optionalDependencies: msw: 2.4.9(typescript@5.6.2) - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) '@vitest/pretty-format@2.1.1': dependencies: @@ -9297,7 +9297,7 @@ snapshots: sirv: 2.0.4 tinyglobby: 0.2.6 tinyrainbow: 1.2.0 - vitest: 2.1.1(@types/node@20.16.5)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1) + vitest: 2.1.1(@types/node@20.16.6)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1) '@vitest/utils@2.1.1': dependencies: @@ -11124,7 +11124,7 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -12953,14 +12953,14 @@ snapshots: '@ts-morph/common': 0.24.0 code-block-writer: 13.0.2 - ts-node@10.9.2(@swc/core@1.7.22)(@types/node@20.16.5)(typescript@5.6.2): + ts-node@10.9.2(@swc/core@1.7.22)(@types/node@20.16.6)(typescript@5.6.2): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.16.5 + '@types/node': 20.16.6 acorn: 8.12.0 acorn-walk: 8.3.3 arg: 4.1.3 @@ -12983,7 +12983,7 @@ snapshots: tslib@2.6.3: {} - tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1): + tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1): dependencies: bundle-require: 5.0.0(esbuild@0.23.1) cac: 6.7.14 @@ -13002,7 +13002,7 @@ snapshots: tinyglobby: 0.2.6 tree-kill: 1.2.2 optionalDependencies: - '@microsoft/api-extractor': 7.47.9(@types/node@20.16.5) + '@microsoft/api-extractor': 7.47.9(@types/node@20.16.6) '@swc/core': 1.7.22 postcss: 8.4.47 typescript: 5.2.2 @@ -13012,7 +13012,7 @@ snapshots: - tsx - yaml - tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.5))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1): + tsup@8.3.0(@microsoft/api-extractor@7.47.9(@types/node@20.16.6))(@swc/core@1.7.22)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.6.2)(yaml@2.5.1): dependencies: bundle-require: 5.0.0(esbuild@0.23.1) cac: 6.7.14 @@ -13031,7 +13031,7 @@ snapshots: tinyglobby: 0.2.6 tree-kill: 1.2.2 optionalDependencies: - '@microsoft/api-extractor': 7.47.9(@types/node@20.16.5) + '@microsoft/api-extractor': 7.47.9(@types/node@20.16.6) '@swc/core': 1.7.22 postcss: 8.4.47 typescript: 5.6.2 @@ -13306,12 +13306,12 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.1(@types/node@20.16.5)(terser@5.31.1): + vite-node@2.1.1(@types/node@20.16.6)(terser@5.31.1): dependencies: cac: 6.7.14 debug: 4.3.7 pathe: 1.1.2 - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) transitivePeerDependencies: - '@types/node' - less @@ -13323,34 +13323,34 @@ snapshots: - supports-color - terser - vite-tsconfig-paths@4.3.2(typescript@5.6.2)(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1)): + vite-tsconfig-paths@4.3.2(typescript@5.6.2)(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1)): dependencies: debug: 4.3.5 globrex: 0.1.2 tsconfck: 3.1.0(typescript@5.6.2) optionalDependencies: - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) transitivePeerDependencies: - supports-color - typescript - vite@4.5.5(@types/node@20.16.5)(terser@5.31.1): + vite@4.5.5(@types/node@20.16.6)(terser@5.31.1): dependencies: esbuild: 0.18.20 postcss: 8.4.47 rollup: 3.29.4 optionalDependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 fsevents: 2.3.3 terser: 5.31.1 - vite@5.4.7(@types/node@20.16.5)(terser@5.31.1): + vite@5.4.7(@types/node@20.16.6)(terser@5.31.1): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.22.2 optionalDependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 fsevents: 2.3.3 terser: 5.31.1 @@ -13362,14 +13362,14 @@ snapshots: transitivePeerDependencies: - supports-color - vitepress@1.3.4(@algolia/client-search@4.24.0)(@types/node@20.16.5)(@types/react@18.3.8)(axios@1.7.7)(change-case@5.4.4)(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)(terser@5.31.1)(typescript@5.6.2): + vitepress@1.3.4(@algolia/client-search@4.24.0)(@types/node@20.16.6)(@types/react@18.3.9)(axios@1.7.7)(change-case@5.4.4)(postcss@8.4.47)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1)(terser@5.31.1)(typescript@5.6.2): dependencies: '@docsearch/css': 3.6.1 - '@docsearch/js': 3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.8)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1) + '@docsearch/js': 3.6.1(@algolia/client-search@4.24.0)(@types/react@18.3.9)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1) '@shikijs/core': 1.16.3 '@shikijs/transformers': 1.16.3 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.1.3(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2)) + '@vitejs/plugin-vue': 5.1.3(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1))(vue@3.5.8(typescript@5.6.2)) '@vue/devtools-api': 7.4.4 '@vue/shared': 3.5.4 '@vueuse/core': 11.0.3(vue@3.5.8(typescript@5.6.2)) @@ -13378,7 +13378,7 @@ snapshots: mark.js: 8.11.1 minisearch: 7.1.0 shiki: 1.16.3 - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) vue: 3.5.8(typescript@5.6.2) optionalDependencies: postcss: 8.4.47 @@ -13410,10 +13410,10 @@ snapshots: - typescript - universal-cookie - vitest@2.1.1(@types/node@20.16.5)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1): + vitest@2.1.1(@types/node@20.16.6)(@vitest/ui@2.1.1)(msw@2.4.9(typescript@5.6.2))(terser@5.31.1): dependencies: '@vitest/expect': 2.1.1 - '@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(msw@2.4.9(typescript@5.6.2))(vite@5.4.7(@types/node@20.16.5)(terser@5.31.1)) + '@vitest/mocker': 2.1.1(@vitest/spy@2.1.1)(msw@2.4.9(typescript@5.6.2))(vite@5.4.7(@types/node@20.16.6)(terser@5.31.1)) '@vitest/pretty-format': 2.1.1 '@vitest/runner': 2.1.1 '@vitest/snapshot': 2.1.1 @@ -13428,11 +13428,11 @@ snapshots: tinyexec: 0.3.0 tinypool: 1.0.0 tinyrainbow: 1.2.0 - vite: 5.4.7(@types/node@20.16.5)(terser@5.31.1) - vite-node: 2.1.1(@types/node@20.16.5)(terser@5.31.1) + vite: 5.4.7(@types/node@20.16.6)(terser@5.31.1) + vite-node: 2.1.1(@types/node@20.16.6)(terser@5.31.1) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 20.16.5 + '@types/node': 20.16.6 '@vitest/ui': 2.1.1(vitest@2.1.1) transitivePeerDependencies: - less