diff --git a/.changeset/quiet-parrots-cry.md b/.changeset/quiet-parrots-cry.md new file mode 100644 index 000000000..23f1e39d0 --- /dev/null +++ b/.changeset/quiet-parrots-cry.md @@ -0,0 +1,10 @@ +--- +"@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-swr": minor +--- + +`paramsType` to change the amount of parameters when calling a query diff --git a/docs/changelog.md b/docs/changelog.md index dc00e2529..f4325292a 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -4,6 +4,13 @@ title: Changelog # Changelog +## 3.0.0-beta.10 +- [`plugin-react-query`](/plugins/plugin-react-query/): `paramsType` with options `'inline'` and `'object'` to have control over the amount of parameters when calling one of the generated functions. +- [`plugin-svelte-query`](/plugins/plugin-svelte-query/): `paramsType` with options `'inline'` and `'object'` to have control over the amount of parameters when calling one of the generated functions. +- [`plugin-vue-query`](/plugins/plugin-vue-query/): `paramsType` with options `'inline'` and `'object'` to have control over the amount of parameters when calling one of the generated functions. +- [`plugin-solid-query`](/plugins/plugin-solid-query/): `paramsType` with options `'inline'` and `'object'` to have control over the amount of parameters when calling one of the generated functions. +- [`plugin-client`](/plugins/plugin-client/): `paramsType` with options `'inline'` and `'object'` to have control over the amount of parameters when calling one of the generated functions. + ## 3.0.0-beta.9 - [`plugin-msw`](/plugins/plugin-msw): `parser` option to disable faker generation - `'faker'` will use `@kubb/plugin-faker` to generate the data for the response diff --git a/docs/migration-guide.md b/docs/migration-guide.md index d744c26f8..af07d676f 100644 --- a/docs/migration-guide.md +++ b/docs/migration-guide.md @@ -324,6 +324,7 @@ See [Filter And Sort](/knowledge-base/filter-and-sort). - `client.importPath` becomes `importPath` - `operations` will control the creation of a file with all operations grouped by methods. - `parser` will make it possible to chose between using no parser(`client`) or using Zod(`zod`). +- `paramsType` will make it possible to have one object to pass your pathParams, params, headers and data. ### @kubb/plugin-ts - `enumType` `'asPascalConst'` has been removed as an option. @@ -349,6 +350,7 @@ See [Filter And Sort](/knowledge-base/filter-and-sort). - `mutation.key` same as in `@kubb/plugin-react-query` - `mutation.methods` same as in `@kubb/plugin-react-query` - `mutation.importPath` same as in `@kubb/plugin-react-query` +- `paramsType` will make it possible to have one object to pass your pathParams, params, headers and data. ### @kubb/plugin-react-query - `dataReturnType` becomes `client.dataReturnType` @@ -363,6 +365,7 @@ See [Filter And Sort](/knowledge-base/filter-and-sort). - `enabled` will be generated based on which params are required - Support for `signal`, this makes it possible to cancel a request - Removal of `mutate.variablesType` and use `'mutate'` as default +- `paramsType` will make it possible to have one object to pass your pathParams, params, headers and data. ### @kubb/plugin-msw - `parser` to switch between using Faker(`'faker'`) for your data or define your own data with `'data'`. diff --git a/docs/package.json b/docs/package.json index 031e532a9..5fb736d7e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -24,7 +24,7 @@ "@shikijs/vitepress-twoslash": "^1.22.2", "mermaid": "^11.3.0", "sitemap": "^8.0.0", - "vitepress": "^1.4.1", + "vitepress": "^1.4.2", "vitepress-plugin-group-icons": "^1.3.0", "vue": "^3.5.12" }, @@ -44,7 +44,7 @@ "@kubb/plugin-zod": "workspace:*", "@kubb/react": "workspace:*", "@mermaid-js/mermaid-cli": "^11.2.1", - "@types/node": "^20.17.1", + "@types/node": "^20.17.3", "@types/react": "^18.3.12", "cross-env": "^7.0.3", "react": "^18.3.1", diff --git a/docs/plugins/plugin-client/index.md b/docs/plugins/plugin-client/index.md index 4c5227ea3..6d9e8ae55 100644 --- a/docs/plugins/plugin-client/index.md +++ b/docs/plugins/plugin-client/index.md @@ -115,6 +115,9 @@ Create `operations.ts` file with all operations grouped by methods. ### dataReturnType +### paramsType + + ### pathParamsType diff --git a/docs/plugins/plugin-client/paramsType.md b/docs/plugins/plugin-client/paramsType.md new file mode 100644 index 000000000..27368137a --- /dev/null +++ b/docs/plugins/plugin-client/paramsType.md @@ -0,0 +1,41 @@ +How to pass your params. + +| | | +|----------:|:-----------------------| +| Type: | `'object' \| 'inline'` | +| Required: | `false` | +| Default: | `'inline'` | + + +> [!TIP] +> When `paramsType` is set to `'object'`, `pathParams` will also be set to `'object'`. + +- `'object'` will return the params and pathParams as an object. +- `'inline'` will return the params as comma separated params. + +::: code-group +```typescript ['object'] +export async function deletePet( + { + petId, + headers, + }: { + petId: DeletePetPathParams['petId'] + headers?: DeletePetHeaderParams + }, + config: Partial = {}, +) { +... +} +``` + +```typescript ['inline'] +export async function deletePet( + petId: DeletePetPathParams['petId'], + headers?: DeletePetHeaderParams, + config: Partial = {} +){ + ... +} +``` +::: diff --git a/docs/plugins/plugin-client/pathParamsType.md b/docs/plugins/plugin-client/pathParamsType.md index 8c89ac321..0214acb48 100644 --- a/docs/plugins/plugin-client/pathParamsType.md +++ b/docs/plugins/plugin-client/pathParamsType.md @@ -4,7 +4,7 @@ How to pass your pathParams. |----------:|:-----------------------| | Type: | `'object' \| 'inline'` | | Required: | `false` | -| Default: | `'data'` | +| Default: | `'inline'` | - `'object'` will return the pathParams as an object. @@ -12,17 +12,17 @@ How to pass your pathParams. ::: code-group ```typescript ['object'] -export async function getPetById( +export async function getPetById ( { petId }: GetPetByIdPathParams, -): Promise> { +) { ... } ``` ```typescript ['inline'] -export async function getPetById( +export async function getPetById( petId: GetPetByIdPathParams, -): Promise> { +) { ... } ``` diff --git a/docs/plugins/plugin-react-query/index.md b/docs/plugins/plugin-react-query/index.md index 99fb6914f..1240bc0af 100644 --- a/docs/plugins/plugin-react-query/index.md +++ b/docs/plugins/plugin-react-query/index.md @@ -175,6 +175,9 @@ Return the name of a group based on the group name, this will be used for the fi #### client.dataReturnType +### paramsType + + ### pathParamsType diff --git a/docs/plugins/plugin-solid-query/index.md b/docs/plugins/plugin-solid-query/index.md index dfdf712e5..76cc5f740 100644 --- a/docs/plugins/plugin-solid-query/index.md +++ b/docs/plugins/plugin-solid-query/index.md @@ -108,6 +108,9 @@ Return the name of a group based on the group name, this will be used for the fi #### client.dataReturnType +### paramsType + + ### pathParamsType diff --git a/docs/plugins/plugin-svelte-query/index.md b/docs/plugins/plugin-svelte-query/index.md index c2e4ccb2b..6be12e3da 100644 --- a/docs/plugins/plugin-svelte-query/index.md +++ b/docs/plugins/plugin-svelte-query/index.md @@ -108,6 +108,9 @@ Return the name of a group based on the group name, this will be used for the fi #### client.dataReturnType +### paramsType + + ### pathParamsType diff --git a/docs/plugins/plugin-swr/index.md b/docs/plugins/plugin-swr/index.md index 395654bb8..fe79864a4 100644 --- a/docs/plugins/plugin-swr/index.md +++ b/docs/plugins/plugin-swr/index.md @@ -108,6 +108,9 @@ Return the name of a group based on the group name, this will be used for the fi #### client.dataReturnType +### paramsType + + ### pathParamsType diff --git a/docs/plugins/plugin-vue-query/index.md b/docs/plugins/plugin-vue-query/index.md index a6f2968c9..cc58a49b3 100644 --- a/docs/plugins/plugin-vue-query/index.md +++ b/docs/plugins/plugin-vue-query/index.md @@ -109,6 +109,9 @@ Return the name of a group based on the group name, this will be used for the fi #### client.dataReturnType +### paramsType + + ### pathParamsType diff --git a/e2e/package.json b/e2e/package.json index 4b87a8190..9f624045e 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -37,7 +37,7 @@ "@tanstack/svelte-query": "^5.59.16", "@tanstack/vue-query": "^5.59.16", "axios": "^1.7.7", - "msw": "^2.5.2", + "msw": "^2.6.0", "react": "^18.3.1", "solid-js": "^1.9.3", "svelte": "^3.59.2", diff --git a/examples/advanced/configs/kubb.config.ts b/examples/advanced/configs/kubb.config.ts index 1c5b52be6..6e541234b 100644 --- a/examples/advanced/configs/kubb.config.ts +++ b/examples/advanced/configs/kubb.config.ts @@ -93,7 +93,7 @@ export default defineConfig(() => { }, infinite: false, suspense: false, - + paramsType: 'object', parser: 'zod', }), pluginSwr({ @@ -111,6 +111,7 @@ export default defineConfig(() => { importPath: '../../../../swr-client.ts', dataReturnType: 'data', }, + paramsType: 'object', parser: 'zod', transformers: { name(name, type) { @@ -132,6 +133,7 @@ export default defineConfig(() => { importPath: '../../../../axios-client.ts', operations: true, dataReturnType: 'full', + paramsType: 'object', pathParamsType: 'object', }), pluginZod({ diff --git a/examples/advanced/package.json b/examples/advanced/package.json index 2e127a7c3..4291e48bf 100644 --- a/examples/advanced/package.json +++ b/examples/advanced/package.json @@ -44,7 +44,7 @@ "@tanstack/svelte-query": "^5.59.16", "@tanstack/vue-query": "^5.59.16", "axios": "^1.7.7", - "msw": "^2.5.2", + "msw": "^2.6.0", "react": "^18.3.1", "solid-js": "^1.9.3", "svelte": "^3.59.2", diff --git a/examples/advanced/src/gen/clients/axios/petService/addPet.ts b/examples/advanced/src/gen/clients/axios/petService/addPet.ts index e2307c475..c4ae8dbe2 100644 --- a/examples/advanced/src/gen/clients/axios/petService/addPet.ts +++ b/examples/advanced/src/gen/clients/axios/petService/addPet.ts @@ -7,7 +7,14 @@ import type { AddPetMutationRequest, AddPetMutationResponse, AddPet405 } from '. * @summary Add a new pet to the store * @link /pet */ -export async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +export async function addPet( + { + data, + }: { + data: AddPetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/pet', diff --git a/examples/advanced/src/gen/clients/axios/petService/deletePet.ts b/examples/advanced/src/gen/clients/axios/petService/deletePet.ts index a0a18fcd5..2e375b99d 100644 --- a/examples/advanced/src/gen/clients/axios/petService/deletePet.ts +++ b/examples/advanced/src/gen/clients/axios/petService/deletePet.ts @@ -10,10 +10,11 @@ import type { DeletePetMutationResponse, DeletePetPathParams, DeletePetHeaderPar export async function deletePet( { petId, + headers, }: { petId: DeletePetPathParams['petId'] + headers?: DeletePetHeaderParams }, - headers?: DeletePetHeaderParams, config: Partial = {}, ) { const res = await client({ diff --git a/examples/advanced/src/gen/clients/axios/petService/findPetsByStatus.ts b/examples/advanced/src/gen/clients/axios/petService/findPetsByStatus.ts index a00cdd092..b2897764a 100644 --- a/examples/advanced/src/gen/clients/axios/petService/findPetsByStatus.ts +++ b/examples/advanced/src/gen/clients/axios/petService/findPetsByStatus.ts @@ -7,7 +7,14 @@ import type { FindPetsByStatusQueryResponse, FindPetsByStatusQueryParams, FindPe * @summary Finds Pets by status * @link /pet/findByStatus */ -export async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Partial = {}) { +export async function findPetsByStatus( + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByStatus', diff --git a/examples/advanced/src/gen/clients/axios/petService/findPetsByTags.ts b/examples/advanced/src/gen/clients/axios/petService/findPetsByTags.ts index 5d5fcad20..28c2edf1f 100644 --- a/examples/advanced/src/gen/clients/axios/petService/findPetsByTags.ts +++ b/examples/advanced/src/gen/clients/axios/petService/findPetsByTags.ts @@ -12,7 +12,16 @@ import type { * @summary Finds Pets by tags * @link /pet/findByTags */ -export async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export async function findPetsByTags( + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByTags', diff --git a/examples/advanced/src/gen/clients/axios/petService/updatePet.ts b/examples/advanced/src/gen/clients/axios/petService/updatePet.ts index ee65fccff..83fb6cad4 100644 --- a/examples/advanced/src/gen/clients/axios/petService/updatePet.ts +++ b/examples/advanced/src/gen/clients/axios/petService/updatePet.ts @@ -13,7 +13,14 @@ import type { * @summary Update an existing pet * @link /pet */ -export async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +export async function updatePet( + { + data, + }: { + data: UpdatePetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'PUT', url: '/pet', diff --git a/examples/advanced/src/gen/clients/axios/petService/updatePetWithForm.ts b/examples/advanced/src/gen/clients/axios/petService/updatePetWithForm.ts index 201ec8a42..488194637 100644 --- a/examples/advanced/src/gen/clients/axios/petService/updatePetWithForm.ts +++ b/examples/advanced/src/gen/clients/axios/petService/updatePetWithForm.ts @@ -14,10 +14,11 @@ import type { export async function updatePetWithForm( { petId, + params, }: { petId: UpdatePetWithFormPathParams['petId'] + params?: UpdatePetWithFormQueryParams }, - params?: UpdatePetWithFormQueryParams, config: Partial = {}, ) { const res = await client({ diff --git a/examples/advanced/src/gen/clients/axios/petService/uploadFile.ts b/examples/advanced/src/gen/clients/axios/petService/uploadFile.ts index 676eeb886..295aeaa1e 100644 --- a/examples/advanced/src/gen/clients/axios/petService/uploadFile.ts +++ b/examples/advanced/src/gen/clients/axios/petService/uploadFile.ts @@ -14,11 +14,13 @@ import type { export async function uploadFile( { petId, + data, + params, }: { petId: UploadFilePathParams['petId'] + data?: UploadFileMutationRequest + params?: UploadFileQueryParams }, - data?: UploadFileMutationRequest, - params?: UploadFileQueryParams, config: Partial> = {}, ) { const res = await client({ diff --git a/examples/advanced/src/gen/clients/axios/petsService/createPets.ts b/examples/advanced/src/gen/clients/axios/petsService/createPets.ts index 581483ed3..f5256d405 100644 --- a/examples/advanced/src/gen/clients/axios/petsService/createPets.ts +++ b/examples/advanced/src/gen/clients/axios/petsService/createPets.ts @@ -15,12 +15,15 @@ import type { export async function createPets( { uuid, + data, + headers, + params, }: { uuid: CreatePetsPathParams['uuid'] + data: CreatePetsMutationRequest + headers: CreatePetsHeaderParams + params?: CreatePetsQueryParams }, - data: CreatePetsMutationRequest, - headers: CreatePetsHeaderParams, - params?: CreatePetsQueryParams, config: Partial> = {}, ) { const res = await client({ diff --git a/examples/advanced/src/gen/clients/axios/userService/createUser.ts b/examples/advanced/src/gen/clients/axios/userService/createUser.ts index 0a2390c90..3cd98f6f6 100644 --- a/examples/advanced/src/gen/clients/axios/userService/createUser.ts +++ b/examples/advanced/src/gen/clients/axios/userService/createUser.ts @@ -7,7 +7,14 @@ import type { CreateUserMutationRequest, CreateUserMutationResponse } from '../. * @summary Create user * @link /user */ -export async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +export async function createUser( + { + data, + }: { + data?: CreateUserMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/user', diff --git a/examples/advanced/src/gen/clients/axios/userService/createUsersWithListInput.ts b/examples/advanced/src/gen/clients/axios/userService/createUsersWithListInput.ts index e91f1e2b2..9810f7234 100644 --- a/examples/advanced/src/gen/clients/axios/userService/createUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/axios/userService/createUsersWithListInput.ts @@ -11,7 +11,11 @@ import type { * @link /user/createWithList */ export async function createUsersWithListInput( - data?: CreateUsersWithListInputMutationRequest, + { + data, + }: { + data?: CreateUsersWithListInputMutationRequest + }, config: Partial> = {}, ) { const res = await client({ diff --git a/examples/advanced/src/gen/clients/axios/userService/loginUser.ts b/examples/advanced/src/gen/clients/axios/userService/loginUser.ts index b3f947073..17ca6a878 100644 --- a/examples/advanced/src/gen/clients/axios/userService/loginUser.ts +++ b/examples/advanced/src/gen/clients/axios/userService/loginUser.ts @@ -6,7 +6,14 @@ import type { LoginUserQueryResponse, LoginUserQueryParams, LoginUser400 } from * @summary Logs user into the system * @link /user/login */ -export async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export async function loginUser( + { + params, + }: { + params?: LoginUserQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/user/login', diff --git a/examples/advanced/src/gen/clients/axios/userService/updateUser.ts b/examples/advanced/src/gen/clients/axios/userService/updateUser.ts index f4391a341..a4a8c78bd 100644 --- a/examples/advanced/src/gen/clients/axios/userService/updateUser.ts +++ b/examples/advanced/src/gen/clients/axios/userService/updateUser.ts @@ -10,10 +10,11 @@ import type { UpdateUserMutationRequest, UpdateUserMutationResponse, UpdateUserP export async function updateUser( { username, + data, }: { username: UpdateUserPathParams['username'] + data?: UpdateUserMutationRequest }, - data?: UpdateUserMutationRequest, config: Partial> = {}, ) { const res = await client({ diff --git a/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts b/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts index 5904a2a0b..da315dedc 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useAddPet.ts @@ -14,7 +14,14 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * @link /pet */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +async function addPet( + { + data, + }: { + data: AddPetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/pet', @@ -52,7 +59,7 @@ export function useAddPet( } >({ mutationFn: async ({ data }) => { - return addPet(data, config) + return addPet({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts b/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts index 557cb687f..171595ba6 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useDeletePet.ts @@ -14,7 +14,16 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * @link /pet/:petId */ -async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { +async function deletePet( + { + petId, + headers, + }: { + petId: DeletePetPathParams['petId'] + headers?: DeletePetHeaderParams + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/pet/${petId}`, @@ -54,7 +63,7 @@ export function useDeletePet( } >({ mutationFn: async ({ petId, headers }) => { - return deletePet(petId, headers, config) + return deletePet({ petId, headers }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts index 3133afabb..4acb1a29a 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByStatus.ts @@ -14,7 +14,14 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +async function findPetsByStatus( + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByStatus', @@ -25,13 +32,20 @@ async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Pa return { ...res, data: findPetsByStatusQueryResponseSchema.parse(res.data) } } -export function findPetsByStatusQueryOptions(params?: FindPetsByStatusQueryParams, config: Partial = {}) { +export function findPetsByStatusQueryOptions( + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, + config: Partial = {}, +) { const queryKey = findPetsByStatusQueryKey(params) return queryOptions({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatus(params, config) + return findPetsByStatus({ params }, config) }, }) } @@ -46,7 +60,11 @@ export function useFindPetsByStatus< TQueryData = ResponseConfig, TQueryKey extends QueryKey = FindPetsByStatusQueryKey, >( - params?: FindPetsByStatusQueryParams, + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, options: { query?: Partial, FindPetsByStatus400, TData, TQueryData, TQueryKey>> client?: Partial @@ -55,7 +73,7 @@ export function useFindPetsByStatus< const { query: queryOptions, client: config = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params) const query = useQuery({ - ...(findPetsByStatusQueryOptions(params, config) as unknown as QueryObserverOptions), + ...(findPetsByStatusQueryOptions({ params }, config) as unknown as QueryObserverOptions), queryKey, ...(queryOptions as unknown as Omit), }) as UseQueryResult & { diff --git a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts index 8354ce793..67129fd23 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTags.ts @@ -19,7 +19,16 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags( + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByTags', @@ -31,13 +40,22 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find return { ...res, data: findPetsByTagsQueryResponseSchema.parse(res.data) } } -export function findPetsByTagsQueryOptions(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export function findPetsByTagsQueryOptions( + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTags(headers, params, config) + return findPetsByTags({ headers, params }, config) }, }) } @@ -52,8 +70,13 @@ export function useFindPetsByTags< TQueryData = ResponseConfig, TQueryKey extends QueryKey = FindPetsByTagsQueryKey, >( - headers: FindPetsByTagsHeaderParams, - params?: FindPetsByTagsQueryParams, + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, options: { query?: Partial, FindPetsByTags400, TData, TQueryData, TQueryKey>> client?: Partial @@ -62,7 +85,7 @@ export function useFindPetsByTags< const { query: queryOptions, client: config = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params) const query = useQuery({ - ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions), + ...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions), queryKey, ...(queryOptions as unknown as Omit), }) as UseQueryResult & { diff --git a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts index cda1545a8..e4d601d86 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useFindPetsByTagsInfinite.ts @@ -19,7 +19,16 @@ export type FindPetsByTagsInfiniteQueryKey = ReturnType = {}) { +async function findPetsByTags( + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByTags', @@ -32,8 +41,13 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find } export function findPetsByTagsInfiniteQueryOptions( - headers: FindPetsByTagsHeaderParams, - params?: FindPetsByTagsQueryParams, + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, config: Partial = {}, ) { const queryKey = findPetsByTagsInfiniteQueryKey(params) @@ -44,7 +58,7 @@ export function findPetsByTagsInfiniteQueryOptions( if (params) { params['pageSize'] = pageParam as unknown as FindPetsByTagsQueryParams['pageSize'] } - return findPetsByTags(headers, params, config) + return findPetsByTags({ headers, params }, config) }, initialPageParam: 0, getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1), @@ -62,8 +76,13 @@ export function useFindPetsByTagsInfinite< TQueryData = ResponseConfig, TQueryKey extends QueryKey = FindPetsByTagsInfiniteQueryKey, >( - headers: FindPetsByTagsHeaderParams, - params?: FindPetsByTagsQueryParams, + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, options: { query?: Partial, FindPetsByTags400, TData, TQueryData, TQueryKey>> client?: Partial @@ -72,7 +91,7 @@ export function useFindPetsByTagsInfinite< const { query: queryOptions, client: config = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params) const query = useInfiniteQuery({ - ...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions), + ...(findPetsByTagsInfiniteQueryOptions({ headers, params }, config) as unknown as InfiniteQueryObserverOptions), queryKey, ...(queryOptions as unknown as Omit), }) as UseInfiniteQueryResult & { diff --git a/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts b/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts index 92387a4ca..2500bfd16 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useGetPetById.ts @@ -5,7 +5,11 @@ import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetP import { useQuery, queryOptions } from '../../../../tanstack-query-hook.ts' import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts' -export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const +export const getPetByIdQueryKey = ({ + petId, +}: { + petId: GetPetByIdPathParams['petId'] +}) => [{ url: '/pet/:petId', params: { petId: petId } }] as const export type GetPetByIdQueryKey = ReturnType @@ -14,7 +18,14 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * @link /pet/:petId */ -async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +async function getPetById( + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/pet/${petId}`, @@ -24,14 +35,21 @@ async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial< return { ...res, data: getPetByIdQueryResponseSchema.parse(res.data) } } -export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { - const queryKey = getPetByIdQueryKey(petId) +export function getPetByIdQueryOptions( + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, + config: Partial = {}, +) { + const queryKey = getPetByIdQueryKey({ petId }) return queryOptions({ enabled: !!petId, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getPetById(petId, config) + return getPetById({ petId }, config) }, }) } @@ -46,16 +64,20 @@ export function useGetPetById< TQueryData = ResponseConfig, TQueryKey extends QueryKey = GetPetByIdQueryKey, >( - petId: GetPetByIdPathParams['petId'], + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, options: { query?: Partial, GetPetById400 | GetPetById404, TData, TQueryData, TQueryKey>> client?: Partial } = {}, ) { const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId) + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey({ petId }) const query = useQuery({ - ...(getPetByIdQueryOptions(petId, config) as unknown as QueryObserverOptions), + ...(getPetByIdQueryOptions({ petId }, config) as unknown as QueryObserverOptions), queryKey, ...(queryOptions as unknown as Omit), }) as UseQueryResult & { diff --git a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts index d0b990b7b..c698cdbbb 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePet.ts @@ -20,7 +20,14 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * @link /pet */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +async function updatePet( + { + data, + }: { + data: UpdatePetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'PUT', url: '/pet', @@ -58,7 +65,7 @@ export function useUpdatePet( } >({ mutationFn: async ({ data }) => { - return updatePet(data, config) + return updatePet({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts index cbd934590..5ad4f9c0c 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useUpdatePetWithForm.ts @@ -18,7 +18,16 @@ export type UpdatePetWithFormMutationKey = ReturnType = {}) { +async function updatePetWithForm( + { + petId, + params, + }: { + petId: UpdatePetWithFormPathParams['petId'] + params?: UpdatePetWithFormQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'POST', url: `/pet/${petId}`, @@ -57,7 +66,7 @@ export function useUpdatePetWithForm( } >({ mutationFn: async ({ petId, params }) => { - return updatePetWithForm(petId, params, config) + return updatePetWithForm({ petId, params }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts b/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts index 064867081..0b99147f0 100644 --- a/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts +++ b/examples/advanced/src/gen/clients/hooks/petController/useUploadFile.ts @@ -19,9 +19,15 @@ export type UploadFileMutationKey = ReturnType * @link /pet/:petId/uploadImage */ async function uploadFile( - petId: UploadFilePathParams['petId'], - data?: UploadFileMutationRequest, - params?: UploadFileQueryParams, + { + petId, + data, + params, + }: { + petId: UploadFilePathParams['petId'] + data?: UploadFileMutationRequest + params?: UploadFileQueryParams + }, config: Partial> = {}, ) { const res = await client({ @@ -66,7 +72,7 @@ export function useUploadFile( } >({ mutationFn: async ({ petId, data, params }) => { - return uploadFile(petId, data, params, config) + return uploadFile({ petId, data, params }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts b/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts index 69ba9509b..4530e6109 100644 --- a/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts +++ b/examples/advanced/src/gen/clients/hooks/petsController/useCreatePets.ts @@ -20,10 +20,17 @@ export type CreatePetsMutationKey = ReturnType * @link /pets/:uuid */ async function createPets( - uuid: CreatePetsPathParams['uuid'], - data: CreatePetsMutationRequest, - headers: CreatePetsHeaderParams, - params?: CreatePetsQueryParams, + { + uuid, + data, + headers, + params, + }: { + uuid: CreatePetsPathParams['uuid'] + data: CreatePetsMutationRequest + headers: CreatePetsHeaderParams + params?: CreatePetsQueryParams + }, config: Partial> = {}, ) { const res = await client({ @@ -70,7 +77,7 @@ export function useCreatePets( } >({ mutationFn: async ({ uuid, data, headers, params }) => { - return createPets(uuid, data, headers, params, config) + return createPets({ uuid, data, headers, params }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts index fd9d57081..9f25e59e8 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useCreateUser.ts @@ -14,7 +14,14 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * @link /user */ -async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +async function createUser( + { + data, + }: { + data?: CreateUserMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/user', @@ -52,7 +59,7 @@ export function useCreateUser( } >({ mutationFn: async ({ data }) => { - return createUser(data, config) + return createUser({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts b/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts index 8e32b144e..de105fffa 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useCreateUsersWithListInput.ts @@ -18,7 +18,11 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { const res = await client({ @@ -58,7 +62,7 @@ export function useCreateUsersWithListInput( } >({ mutationFn: async ({ data }) => { - return createUsersWithListInput(data, config) + return createUsersWithListInput({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts index 8b9b38386..b18a19e6b 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useDeleteUser.ts @@ -14,7 +14,14 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * @link /user/:username */ -async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { +async function deleteUser( + { + username, + }: { + username: DeleteUserPathParams['username'] + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/user/${username}`, @@ -51,7 +58,7 @@ export function useDeleteUser( } >({ mutationFn: async ({ username }) => { - return deleteUser(username, config) + return deleteUser({ username }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts b/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts index c0315b2ac..b43237593 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useGetUserByName.ts @@ -10,7 +10,11 @@ import type { import { useQuery, queryOptions } from '../../../../tanstack-query-hook.ts' import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts' -export const getUserByNameQueryKey = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const +export const getUserByNameQueryKey = ({ + username, +}: { + username: GetUserByNamePathParams['username'] +}) => [{ url: '/user/:username', params: { username: username } }] as const export type GetUserByNameQueryKey = ReturnType @@ -18,7 +22,14 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * @link /user/:username */ -async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { +async function getUserByName( + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/user/${username}`, @@ -28,14 +39,21 @@ async function getUserByName(username: GetUserByNamePathParams['username'], conf return { ...res, data: getUserByNameQueryResponseSchema.parse(res.data) } } -export function getUserByNameQueryOptions(username: GetUserByNamePathParams['username'], config: Partial = {}) { - const queryKey = getUserByNameQueryKey(username) +export function getUserByNameQueryOptions( + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, + config: Partial = {}, +) { + const queryKey = getUserByNameQueryKey({ username }) return queryOptions({ enabled: !!username, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByName(username, config) + return getUserByName({ username }, config) }, }) } @@ -49,16 +67,20 @@ export function useGetUserByName< TQueryData = ResponseConfig, TQueryKey extends QueryKey = GetUserByNameQueryKey, >( - username: GetUserByNamePathParams['username'], + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, options: { query?: Partial, GetUserByName400 | GetUserByName404, TData, TQueryData, TQueryKey>> client?: Partial } = {}, ) { const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(username) + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey({ username }) const query = useQuery({ - ...(getUserByNameQueryOptions(username, config) as unknown as QueryObserverOptions), + ...(getUserByNameQueryOptions({ username }, config) as unknown as QueryObserverOptions), queryKey, ...(queryOptions as unknown as Omit), }) as UseQueryResult & { diff --git a/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts index cb381a86c..8fb0c2a11 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useLoginUser.ts @@ -13,7 +13,14 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * @link /user/login */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +async function loginUser( + { + params, + }: { + params?: LoginUserQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/user/login', @@ -24,13 +31,20 @@ async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export function loginUserQueryOptions( + { + params, + }: { + params?: LoginUserQueryParams + }, + config: Partial = {}, +) { const queryKey = loginUserQueryKey(params) return queryOptions({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUser(params, config) + return loginUser({ params }, config) }, }) } @@ -44,7 +58,11 @@ export function useLoginUser< TQueryData = ResponseConfig, TQueryKey extends QueryKey = LoginUserQueryKey, >( - params?: LoginUserQueryParams, + { + params, + }: { + params?: LoginUserQueryParams + }, options: { query?: Partial, LoginUser400, TData, TQueryData, TQueryKey>> client?: Partial @@ -53,7 +71,7 @@ export function useLoginUser< const { query: queryOptions, client: config = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? loginUserQueryKey(params) const query = useQuery({ - ...(loginUserQueryOptions(params, config) as unknown as QueryObserverOptions), + ...(loginUserQueryOptions({ params }, config) as unknown as QueryObserverOptions), queryKey, ...(queryOptions as unknown as Omit), }) as UseQueryResult & { diff --git a/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts b/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts index 4f79da1ca..de23bc09b 100644 --- a/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts +++ b/examples/advanced/src/gen/clients/hooks/userController/useUpdateUser.ts @@ -15,8 +15,13 @@ export type UpdateUserMutationKey = ReturnType * @link /user/:username */ async function updateUser( - username: UpdateUserPathParams['username'], - data?: UpdateUserMutationRequest, + { + username, + data, + }: { + username: UpdateUserPathParams['username'] + data?: UpdateUserMutationRequest + }, config: Partial> = {}, ) { const res = await client({ @@ -58,7 +63,7 @@ export function useUpdateUser( } >({ mutationFn: async ({ username, data }) => { - return updateUser(username, data, config) + return updateUser({ username, data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts index 9db6206e6..ac521260a 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useAddPetSWR.ts @@ -13,7 +13,14 @@ export type AddPetMutationKeySWR = ReturnType * @summary Add a new pet to the store * @link /pet */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +async function addPet( + { + data, + }: { + data: AddPetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/pet', @@ -41,7 +48,7 @@ export function useAddPetSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return addPet(data, config) + return addPet({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts index 7c332e2c0..3a6bd8afc 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useDeletePetSWR.ts @@ -13,7 +13,16 @@ export type DeletePetMutationKeySWR = ReturnType * @summary Deletes a pet * @link /pet/:petId */ -async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { +async function deletePet( + { + petId, + headers, + }: { + petId: DeletePetPathParams['petId'] + headers?: DeletePetHeaderParams + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/pet/${petId}`, @@ -30,7 +39,11 @@ async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePe * @link /pet/:petId */ export function useDeletePetSWR( - petId: DeletePetPathParams['petId'], + { + petId, + }: { + petId: DeletePetPathParams['petId'] + }, headers?: DeletePetHeaderParams, options: { mutation?: Parameters>[2] @@ -43,7 +56,7 @@ export function useDeletePetSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url) => { - return deletePet(petId, headers, config) + return deletePet({ petId, headers }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts index 690f454d8..3f747a8a2 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByStatusSWR.ts @@ -13,7 +13,14 @@ export type FindPetsByStatusQueryKeySWR = ReturnType = {}) { +async function findPetsByStatus( + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByStatus', @@ -24,10 +31,17 @@ async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Pa return findPetsByStatusQueryResponseSchema.parse(res.data) } -export function findPetsByStatusQueryOptionsSWR(params?: FindPetsByStatusQueryParams, config: Partial = {}) { +export function findPetsByStatusQueryOptionsSWR( + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, + config: Partial = {}, +) { return { fetcher: async () => { - return findPetsByStatus(params, config) + return findPetsByStatus({ params }, config) }, } } @@ -38,7 +52,11 @@ export function findPetsByStatusQueryOptionsSWR(params?: FindPetsByStatusQueryPa * @link /pet/findByStatus */ export function useFindPetsByStatusSWR( - params?: FindPetsByStatusQueryParams, + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, options: { query?: Parameters>[2] client?: Partial @@ -48,7 +66,7 @@ export function useFindPetsByStatusSWR( const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const queryKey = findPetsByStatusQueryKeySWR(params) return useSWR(shouldFetch ? queryKey : null, { - ...findPetsByStatusQueryOptionsSWR(params, config), + ...findPetsByStatusQueryOptionsSWR({ params }, config), ...queryOptions, }) } diff --git a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts index 00fb65094..6b5a249a8 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useFindPetsByTagsSWR.ts @@ -18,7 +18,16 @@ export type FindPetsByTagsQueryKeySWR = ReturnType = {}) { +async function findPetsByTags( + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByTags', @@ -30,10 +39,19 @@ async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: Find return findPetsByTagsQueryResponseSchema.parse(res.data) } -export function findPetsByTagsQueryOptionsSWR(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial = {}) { +export function findPetsByTagsQueryOptionsSWR( + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { return { fetcher: async () => { - return findPetsByTags(headers, params, config) + return findPetsByTags({ headers, params }, config) }, } } @@ -44,8 +62,13 @@ export function findPetsByTagsQueryOptionsSWR(headers: FindPetsByTagsHeaderParam * @link /pet/findByTags */ export function useFindPetsByTagsSWR( - headers: FindPetsByTagsHeaderParams, - params?: FindPetsByTagsQueryParams, + { + headers, + params, + }: { + headers: FindPetsByTagsHeaderParams + params?: FindPetsByTagsQueryParams + }, options: { query?: Parameters>[2] client?: Partial @@ -55,7 +78,7 @@ export function useFindPetsByTagsSWR( const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const queryKey = findPetsByTagsQueryKeySWR(params) return useSWR(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptionsSWR(headers, params, config), + ...findPetsByTagsQueryOptionsSWR({ headers, params }, config), ...queryOptions, }) } diff --git a/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts index 7fd0118f9..f87824e57 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useGetPetByIdSWR.ts @@ -4,7 +4,11 @@ import type { RequestConfig } from '../../../../swr-client.ts' import type { GetPetByIdQueryResponse, GetPetByIdPathParams, GetPetById400, GetPetById404 } from '../../../models/ts/petController/GetPetById.ts' import { getPetByIdQueryResponseSchema } from '../../../zod/petController/getPetByIdSchema.ts' -export const getPetByIdQueryKeySWR = (petId: GetPetByIdPathParams['petId']) => [{ url: '/pet/:petId', params: { petId: petId } }] as const +export const getPetByIdQueryKeySWR = ({ + petId, +}: { + petId: GetPetByIdPathParams['petId'] +}) => [{ url: '/pet/:petId', params: { petId: petId } }] as const export type GetPetByIdQueryKeySWR = ReturnType @@ -13,7 +17,14 @@ export type GetPetByIdQueryKeySWR = ReturnType * @summary Find pet by ID * @link /pet/:petId */ -async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +async function getPetById( + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/pet/${petId}`, @@ -23,10 +34,17 @@ async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial< return getPetByIdQueryResponseSchema.parse(res.data) } -export function getPetByIdQueryOptionsSWR(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +export function getPetByIdQueryOptionsSWR( + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, + config: Partial = {}, +) { return { fetcher: async () => { - return getPetById(petId, config) + return getPetById({ petId }, config) }, } } @@ -37,7 +55,11 @@ export function getPetByIdQueryOptionsSWR(petId: GetPetByIdPathParams['petId'], * @link /pet/:petId */ export function useGetPetByIdSWR( - petId: GetPetByIdPathParams['petId'], + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, options: { query?: Parameters>[2] client?: Partial @@ -45,9 +67,9 @@ export function useGetPetByIdSWR( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const queryKey = getPetByIdQueryKeySWR(petId) + const queryKey = getPetByIdQueryKeySWR({ petId }) return useSWR(shouldFetch ? queryKey : null, { - ...getPetByIdQueryOptionsSWR(petId, config), + ...getPetByIdQueryOptionsSWR({ petId }, config), ...queryOptions, }) } diff --git a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts index 835b52c51..c58dd2c37 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetSWR.ts @@ -19,7 +19,14 @@ export type UpdatePetMutationKeySWR = ReturnType * @summary Update an existing pet * @link /pet */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +async function updatePet( + { + data, + }: { + data: UpdatePetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'PUT', url: '/pet', @@ -49,7 +56,7 @@ export function useUpdatePetSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return updatePet(data, config) + return updatePet({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts index 04a559648..00c49b0bf 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useUpdatePetWithFormSWR.ts @@ -17,7 +17,16 @@ export type UpdatePetWithFormMutationKeySWR = ReturnType = {}) { +async function updatePetWithForm( + { + petId, + params, + }: { + petId: UpdatePetWithFormPathParams['petId'] + params?: UpdatePetWithFormQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'POST', url: `/pet/${petId}`, @@ -33,7 +42,11 @@ async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], pa * @link /pet/:petId */ export function useUpdatePetWithFormSWR( - petId: UpdatePetWithFormPathParams['petId'], + { + petId, + }: { + petId: UpdatePetWithFormPathParams['petId'] + }, params?: UpdatePetWithFormQueryParams, options: { mutation?: Parameters>[2] @@ -46,7 +59,7 @@ export function useUpdatePetWithFormSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url) => { - return updatePetWithForm(petId, params, config) + return updatePetWithForm({ petId, params }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts b/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts index bf11bb4de..eafa2678f 100644 --- a/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petController/useUploadFileSWR.ts @@ -18,9 +18,15 @@ export type UploadFileMutationKeySWR = ReturnType> = {}, ) { const res = await client({ @@ -40,7 +46,11 @@ async function uploadFile( * @link /pet/:petId/uploadImage */ export function useUploadFileSWR( - petId: UploadFilePathParams['petId'], + { + petId, + }: { + petId: UploadFilePathParams['petId'] + }, params?: UploadFileQueryParams, options: { mutation?: Parameters>[2] @@ -53,7 +63,7 @@ export function useUploadFileSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return uploadFile(petId, data, params, config) + return uploadFile({ petId, data, params }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts b/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts index 3d7128ea6..f2d6441fa 100644 --- a/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts +++ b/examples/advanced/src/gen/clients/swr/petsController/useCreatePetsSWR.ts @@ -19,10 +19,17 @@ export type CreatePetsMutationKeySWR = ReturnType> = {}, ) { const res = await client({ @@ -42,7 +49,11 @@ async function createPets( * @link /pets/:uuid */ export function useCreatePetsSWR( - uuid: CreatePetsPathParams['uuid'], + { + uuid, + }: { + uuid: CreatePetsPathParams['uuid'] + }, headers: CreatePetsHeaderParams, params?: CreatePetsQueryParams, options: { @@ -56,7 +67,7 @@ export function useCreatePetsSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return createPets(uuid, data, headers, params, config) + return createPets({ uuid, data, headers, params }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts index 5ef8f414e..fb7841a0a 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useCreateUserSWR.ts @@ -13,7 +13,14 @@ export type CreateUserMutationKeySWR = ReturnType> = {}) { +async function createUser( + { + data, + }: { + data?: CreateUserMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/user', @@ -41,7 +48,7 @@ export function useCreateUserSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return createUser(data, config) + return createUser({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts index 67656d75a..fb4f8e1c3 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useCreateUsersWithListInputSWR.ts @@ -17,7 +17,11 @@ export type CreateUsersWithListInputMutationKeySWR = ReturnType> = {}, ) { const res = await client({ @@ -54,7 +58,7 @@ export function useCreateUsersWithListInputSWR( >( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return createUsersWithListInput(data, config) + return createUsersWithListInput({ data }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts index b21649101..188b7e9ed 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useDeleteUserSWR.ts @@ -13,7 +13,14 @@ export type DeleteUserMutationKeySWR = ReturnType = {}) { +async function deleteUser( + { + username, + }: { + username: DeleteUserPathParams['username'] + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/user/${username}`, @@ -29,7 +36,11 @@ async function deleteUser(username: DeleteUserPathParams['username'], config: Pa * @link /user/:username */ export function useDeleteUserSWR( - username: DeleteUserPathParams['username'], + { + username, + }: { + username: DeleteUserPathParams['username'] + }, options: { mutation?: Parameters>[2] client?: Partial @@ -41,7 +52,7 @@ export function useDeleteUserSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url) => { - return deleteUser(username, config) + return deleteUser({ username }, config) }, mutationOptions, ) diff --git a/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts index 80b95d63b..50488a708 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useGetUserByNameSWR.ts @@ -9,7 +9,11 @@ import type { } from '../../../models/ts/userController/GetUserByName.ts' import { getUserByNameQueryResponseSchema } from '../../../zod/userController/getUserByNameSchema.ts' -export const getUserByNameQueryKeySWR = (username: GetUserByNamePathParams['username']) => [{ url: '/user/:username', params: { username: username } }] as const +export const getUserByNameQueryKeySWR = ({ + username, +}: { + username: GetUserByNamePathParams['username'] +}) => [{ url: '/user/:username', params: { username: username } }] as const export type GetUserByNameQueryKeySWR = ReturnType @@ -17,7 +21,14 @@ export type GetUserByNameQueryKeySWR = ReturnType = {}) { +async function getUserByName( + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/user/${username}`, @@ -27,10 +38,17 @@ async function getUserByName(username: GetUserByNamePathParams['username'], conf return getUserByNameQueryResponseSchema.parse(res.data) } -export function getUserByNameQueryOptionsSWR(username: GetUserByNamePathParams['username'], config: Partial = {}) { +export function getUserByNameQueryOptionsSWR( + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, + config: Partial = {}, +) { return { fetcher: async () => { - return getUserByName(username, config) + return getUserByName({ username }, config) }, } } @@ -40,7 +58,11 @@ export function getUserByNameQueryOptionsSWR(username: GetUserByNamePathParams[' * @link /user/:username */ export function useGetUserByNameSWR( - username: GetUserByNamePathParams['username'], + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, options: { query?: Parameters>[2] client?: Partial @@ -48,9 +70,9 @@ export function useGetUserByNameSWR( } = {}, ) { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} - const queryKey = getUserByNameQueryKeySWR(username) + const queryKey = getUserByNameQueryKeySWR({ username }) return useSWR(shouldFetch ? queryKey : null, { - ...getUserByNameQueryOptionsSWR(username, config), + ...getUserByNameQueryOptionsSWR({ username }, config), ...queryOptions, }) } diff --git a/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts index 7fb3a52c0..06c568c5e 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useLoginUserSWR.ts @@ -12,7 +12,14 @@ export type LoginUserQueryKeySWR = ReturnType * @summary Logs user into the system * @link /user/login */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +async function loginUser( + { + params, + }: { + params?: LoginUserQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/user/login', @@ -23,10 +30,17 @@ async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +export function loginUserQueryOptionsSWR( + { + params, + }: { + params?: LoginUserQueryParams + }, + config: Partial = {}, +) { return { fetcher: async () => { - return loginUser(params, config) + return loginUser({ params }, config) }, } } @@ -36,7 +50,11 @@ export function loginUserQueryOptionsSWR(params?: LoginUserQueryParams, config: * @link /user/login */ export function useLoginUserSWR( - params?: LoginUserQueryParams, + { + params, + }: { + params?: LoginUserQueryParams + }, options: { query?: Parameters>[2] client?: Partial @@ -46,7 +64,7 @@ export function useLoginUserSWR( const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {} const queryKey = loginUserQueryKeySWR(params) return useSWR(shouldFetch ? queryKey : null, { - ...loginUserQueryOptionsSWR(params, config), + ...loginUserQueryOptionsSWR({ params }, config), ...queryOptions, }) } diff --git a/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts b/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts index fa20b9c87..8acf9e1bf 100644 --- a/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts +++ b/examples/advanced/src/gen/clients/swr/userController/useUpdateUserSWR.ts @@ -14,8 +14,13 @@ export type UpdateUserMutationKeySWR = ReturnType> = {}, ) { const res = await client({ @@ -34,7 +39,11 @@ async function updateUser( * @link /user/:username */ export function useUpdateUserSWR( - username: UpdateUserPathParams['username'], + { + username, + }: { + username: UpdateUserPathParams['username'] + }, options: { mutation?: Parameters>[2] client?: Partial> @@ -46,7 +55,7 @@ export function useUpdateUserSWR( return useSWRMutation( shouldFetch ? mutationKey : null, async (_url, { arg: data }) => { - return updateUser(username, data, config) + return updateUser({ username, data }, config) }, mutationOptions, ) diff --git a/examples/client/src/gen/clients/axios/petService/deletePet.ts b/examples/client/src/gen/clients/axios/petService/deletePet.ts index f5c444fbf..49d20a4c9 100644 --- a/examples/client/src/gen/clients/axios/petService/deletePet.ts +++ b/examples/client/src/gen/clients/axios/petService/deletePet.ts @@ -8,15 +8,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @summary Deletes a pet * @link /pet/:petId */ -export async function deletePet( - { - petId, - }: { - petId: DeletePetPathParams['petId'] - }, - headers?: DeletePetHeaderParams, - config: Partial = {}, -) { +export async function deletePet({ petId }: DeletePetPathParams, headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/pet/${petId}`, diff --git a/examples/client/src/gen/clients/axios/petService/getPetById.ts b/examples/client/src/gen/clients/axios/petService/getPetById.ts index bdff77650..862dbf4bf 100644 --- a/examples/client/src/gen/clients/axios/petService/getPetById.ts +++ b/examples/client/src/gen/clients/axios/petService/getPetById.ts @@ -8,14 +8,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @summary Find pet by ID * @link /pet/:petId */ -export async function getPetById( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, - config: Partial = {}, -) { +export async function getPetById({ petId }: GetPetByIdPathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/pet/${petId}`, diff --git a/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts b/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts index f5ec32f70..bf9c9f10f 100644 --- a/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts +++ b/examples/client/src/gen/clients/axios/petService/updatePetWithForm.ts @@ -12,15 +12,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @summary Updates a pet in the store with form data * @link /pet/:petId */ -export async function updatePetWithForm( - { - petId, - }: { - petId: UpdatePetWithFormPathParams['petId'] - }, - params?: UpdatePetWithFormQueryParams, - config: Partial = {}, -) { +export async function updatePetWithForm({ petId }: UpdatePetWithFormPathParams, params?: UpdatePetWithFormQueryParams, config: Partial = {}) { const res = await client({ method: 'POST', url: `/pet/${petId}`, diff --git a/examples/client/src/gen/clients/axios/petService/uploadFile.ts b/examples/client/src/gen/clients/axios/petService/uploadFile.ts index b08af9849..9f2db61c3 100644 --- a/examples/client/src/gen/clients/axios/petService/uploadFile.ts +++ b/examples/client/src/gen/clients/axios/petService/uploadFile.ts @@ -13,11 +13,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @link /pet/:petId/uploadImage */ export async function uploadFile( - { - petId, - }: { - petId: UploadFilePathParams['petId'] - }, + { petId }: UploadFilePathParams, data: UploadFileMutationRequest, params?: UploadFileQueryParams, config: Partial> = {}, diff --git a/examples/client/src/gen/clients/axios/userService/deleteUser.ts b/examples/client/src/gen/clients/axios/userService/deleteUser.ts index a1b44f56d..b12f5f9d0 100644 --- a/examples/client/src/gen/clients/axios/userService/deleteUser.ts +++ b/examples/client/src/gen/clients/axios/userService/deleteUser.ts @@ -8,14 +8,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @summary Delete user * @link /user/:username */ -export async function deleteUser( - { - username, - }: { - username: DeleteUserPathParams['username'] - }, - config: Partial = {}, -) { +export async function deleteUser({ username }: DeleteUserPathParams, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/user/${username}`, diff --git a/examples/client/src/gen/clients/axios/userService/getUserByName.ts b/examples/client/src/gen/clients/axios/userService/getUserByName.ts index c58c984d1..d2f915a9b 100644 --- a/examples/client/src/gen/clients/axios/userService/getUserByName.ts +++ b/examples/client/src/gen/clients/axios/userService/getUserByName.ts @@ -12,14 +12,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @summary Get user by user name * @link /user/:username */ -export async function getUserByName( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { +export async function getUserByName({ username }: GetUserByNamePathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/user/${username}`, diff --git a/examples/client/src/gen/clients/axios/userService/updateUser.ts b/examples/client/src/gen/clients/axios/userService/updateUser.ts index e17375f85..89725b08c 100644 --- a/examples/client/src/gen/clients/axios/userService/updateUser.ts +++ b/examples/client/src/gen/clients/axios/userService/updateUser.ts @@ -9,11 +9,7 @@ import type { RequestConfig } from '@kubb/plugin-client/client' * @link /user/:username */ export async function updateUser( - { - username, - }: { - username: UpdateUserPathParams['username'] - }, + { username }: UpdateUserPathParams, data?: UpdateUserMutationRequest, config: Partial> = {}, ) { diff --git a/examples/client/src/gen/tagObject.ts b/examples/client/src/gen/tagObject.ts index b29e12334..391b0c16d 100644 --- a/examples/client/src/gen/tagObject.ts +++ b/examples/client/src/gen/tagObject.ts @@ -82,14 +82,7 @@ placeOrderPatch.queryParams = {} as never * @summary Find purchase order by ID * @link /store/order/:orderId */ -export async function getOrderById( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { +export async function getOrderById({ orderId }: GetOrderByIdPathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/store/order/${orderId}`, @@ -112,14 +105,7 @@ getOrderById.queryParams = {} as never * @summary Delete purchase order by ID * @link /store/order/:orderId */ -export async function deleteOrder( - { - orderId, - }: { - orderId: DeleteOrderPathParams['orderId'] - }, - config: Partial = {}, -) { +export async function deleteOrder({ orderId }: DeleteOrderPathParams, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/store/order/${orderId}`, diff --git a/examples/client/src/generators/clientStaticGenerator.tsx b/examples/client/src/generators/clientStaticGenerator.tsx index db5ed17b3..e9cb4f540 100644 --- a/examples/client/src/generators/clientStaticGenerator.tsx +++ b/examples/client/src/generators/clientStaticGenerator.tsx @@ -50,6 +50,7 @@ export const clientStaticGenerator = createReactGenerator({ baseURL={options.baseURL} dataReturnType={options.dataReturnType} pathParamsType={options.pathParamsType} + paramsType={options.paramsType} typeSchemas={type.schemas} operation={operation} parser={options.parser} diff --git a/examples/msw/package.json b/examples/msw/package.json index 13328f4b7..0a0fc04eb 100644 --- a/examples/msw/package.json +++ b/examples/msw/package.json @@ -33,7 +33,7 @@ "@kubb/plugin-oas": "workspace:*", "@kubb/plugin-ts": "workspace:*", "@mswjs/http-middleware": "^0.9.2", - "msw": "^2.5.2", + "msw": "^2.6.0", "react": "^18.3.1", "tsup": "^8.3.5" }, diff --git a/examples/msw/src/server.ts b/examples/msw/src/server.ts index c336f12e0..b135e2315 100644 --- a/examples/msw/src/server.ts +++ b/examples/msw/src/server.ts @@ -8,6 +8,5 @@ const server = createServer(...handlers) server.listen(9090, () => { console.log('Mock server ready at http://localhost:9090') console.log('\n\n') - const mswServer = setupServer(...handlers) - console.log(mswServer.listHandlers().map((item) => item.info)) + setupServer(...handlers) }) diff --git a/examples/react-query/kubb.config.ts b/examples/react-query/kubb.config.ts index 9b7161b89..fbdbfcc2d 100644 --- a/examples/react-query/kubb.config.ts +++ b/examples/react-query/kubb.config.ts @@ -38,6 +38,7 @@ export const config = { query: { key: (keys) => ['"v5"', ...keys], }, + paramsType: 'inline', pathParamsType: 'object', suspense: {}, override: [ diff --git a/examples/react-query/src/gen/hooks/useDeleteOrderHook.ts b/examples/react-query/src/gen/hooks/useDeleteOrderHook.ts index f972755c7..3b5c1a155 100644 --- a/examples/react-query/src/gen/hooks/useDeleteOrderHook.ts +++ b/examples/react-query/src/gen/hooks/useDeleteOrderHook.ts @@ -13,14 +13,7 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * @link /store/order/:orderId */ -async function deleteOrder( - { - orderId, - }: { - orderId: DeleteOrderPathParams['orderId'] - }, - config: Partial = {}, -) { +async function deleteOrder({ orderId }: DeleteOrderPathParams, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/store/order/${orderId}`, diff --git a/examples/react-query/src/gen/hooks/useDeletePetHook.ts b/examples/react-query/src/gen/hooks/useDeletePetHook.ts index 2fc9eeae5..07602cda0 100644 --- a/examples/react-query/src/gen/hooks/useDeletePetHook.ts +++ b/examples/react-query/src/gen/hooks/useDeletePetHook.ts @@ -13,15 +13,7 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * @link /pet/:petId */ -async function deletePet( - { - petId, - }: { - petId: DeletePetPathParams['petId'] - }, - headers?: DeletePetHeaderParams, - config: Partial = {}, -) { +async function deletePet({ petId }: DeletePetPathParams, headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/pet/${petId}`, diff --git a/examples/react-query/src/gen/hooks/useDeleteUserHook.ts b/examples/react-query/src/gen/hooks/useDeleteUserHook.ts index dd330a39b..5166b6a9c 100644 --- a/examples/react-query/src/gen/hooks/useDeleteUserHook.ts +++ b/examples/react-query/src/gen/hooks/useDeleteUserHook.ts @@ -13,14 +13,7 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * @link /user/:username */ -async function deleteUser( - { - username, - }: { - username: DeleteUserPathParams['username'] - }, - config: Partial = {}, -) { +async function deleteUser({ username }: DeleteUserPathParams, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/user/${username}`, diff --git a/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts b/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts index be9a2ccea..91cc7f25f 100644 --- a/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts +++ b/examples/react-query/src/gen/hooks/useGetOrderByIdHook.ts @@ -17,14 +17,7 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * @link /store/order/:orderId */ -async function getOrderById( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { +async function getOrderById({ orderId }: GetOrderByIdPathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/store/order/${orderId}`, @@ -34,14 +27,7 @@ async function getOrderById( return res.data } -export function getOrderByIdQueryOptionsHook( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { +export function getOrderByIdQueryOptionsHook({ orderId }: GetOrderByIdPathParams, config: Partial = {}) { const queryKey = getOrderByIdQueryKey({ orderId }) return queryOptions({ enabled: !!orderId, @@ -63,11 +49,7 @@ export function useGetOrderByIdHook< TQueryData = GetOrderByIdQueryResponse, TQueryKey extends QueryKey = GetOrderByIdQueryKey, >( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, + { orderId }: GetOrderByIdPathParams, options: { query?: Partial> client?: Partial diff --git a/examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts index da2c709d1..43b6e9d2a 100644 --- a/examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/useGetOrderByIdSuspenseHook.ts @@ -17,14 +17,7 @@ export type GetOrderByIdSuspenseQueryKey = ReturnType = {}, -) { +async function getOrderById({ orderId }: GetOrderByIdPathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/store/order/${orderId}`, @@ -34,14 +27,7 @@ async function getOrderById( return res.data } -export function getOrderByIdSuspenseQueryOptionsHook( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, - config: Partial = {}, -) { +export function getOrderByIdSuspenseQueryOptionsHook({ orderId }: GetOrderByIdPathParams, config: Partial = {}) { const queryKey = getOrderByIdSuspenseQueryKey({ orderId }) return queryOptions({ enabled: !!orderId, @@ -63,11 +49,7 @@ export function useGetOrderByIdSuspenseHook< TQueryData = GetOrderByIdQueryResponse, TQueryKey extends QueryKey = GetOrderByIdSuspenseQueryKey, >( - { - orderId, - }: { - orderId: GetOrderByIdPathParams['orderId'] - }, + { orderId }: GetOrderByIdPathParams, options: { query?: Partial> client?: Partial diff --git a/examples/react-query/src/gen/hooks/useGetPetByIdHook.ts b/examples/react-query/src/gen/hooks/useGetPetByIdHook.ts index 409e0dedc..101a1b799 100644 --- a/examples/react-query/src/gen/hooks/useGetPetByIdHook.ts +++ b/examples/react-query/src/gen/hooks/useGetPetByIdHook.ts @@ -17,14 +17,7 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * @link /pet/:petId */ -async function getPetById( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, - config: Partial = {}, -) { +async function getPetById({ petId }: GetPetByIdPathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/pet/${petId}`, @@ -34,14 +27,7 @@ async function getPetById( return res.data } -export function getPetByIdQueryOptionsHook( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, - config: Partial = {}, -) { +export function getPetByIdQueryOptionsHook({ petId }: GetPetByIdPathParams, config: Partial = {}) { const queryKey = getPetByIdQueryKey({ petId }) return queryOptions({ enabled: !!petId, @@ -59,11 +45,7 @@ export function getPetByIdQueryOptionsHook( * @link /pet/:petId */ export function useGetPetByIdHook( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, + { petId }: GetPetByIdPathParams, options: { query?: Partial> client?: Partial diff --git a/examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts b/examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts index acf6d95c2..6cbf77ba6 100644 --- a/examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/useGetPetByIdSuspenseHook.ts @@ -17,14 +17,7 @@ export type GetPetByIdSuspenseQueryKey = ReturnType = {}, -) { +async function getPetById({ petId }: GetPetByIdPathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/pet/${petId}`, @@ -34,14 +27,7 @@ async function getPetById( return res.data } -export function getPetByIdSuspenseQueryOptionsHook( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, - config: Partial = {}, -) { +export function getPetByIdSuspenseQueryOptionsHook({ petId }: GetPetByIdPathParams, config: Partial = {}) { const queryKey = getPetByIdSuspenseQueryKey({ petId }) return queryOptions({ enabled: !!petId, @@ -63,11 +49,7 @@ export function useGetPetByIdSuspenseHook< TQueryData = GetPetByIdQueryResponse, TQueryKey extends QueryKey = GetPetByIdSuspenseQueryKey, >( - { - petId, - }: { - petId: GetPetByIdPathParams['petId'] - }, + { petId }: GetPetByIdPathParams, options: { query?: Partial> client?: Partial diff --git a/examples/react-query/src/gen/hooks/useGetUserByNameHook.ts b/examples/react-query/src/gen/hooks/useGetUserByNameHook.ts index 3028c2dcc..46dc92bb6 100644 --- a/examples/react-query/src/gen/hooks/useGetUserByNameHook.ts +++ b/examples/react-query/src/gen/hooks/useGetUserByNameHook.ts @@ -16,14 +16,7 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * @link /user/:username */ -async function getUserByName( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { +async function getUserByName({ username }: GetUserByNamePathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/user/${username}`, @@ -33,14 +26,7 @@ async function getUserByName( return res.data } -export function getUserByNameQueryOptionsHook( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { +export function getUserByNameQueryOptionsHook({ username }: GetUserByNamePathParams, config: Partial = {}) { const queryKey = getUserByNameQueryKey({ username }) return queryOptions({ enabled: !!username, @@ -61,11 +47,7 @@ export function useGetUserByNameHook< TQueryData = GetUserByNameQueryResponse, TQueryKey extends QueryKey = GetUserByNameQueryKey, >( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, + { username }: GetUserByNamePathParams, options: { query?: Partial> client?: Partial diff --git a/examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts b/examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts index bb5f4b014..ac2943292 100644 --- a/examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts +++ b/examples/react-query/src/gen/hooks/useGetUserByNameSuspenseHook.ts @@ -16,14 +16,7 @@ export type GetUserByNameSuspenseQueryKey = ReturnType = {}, -) { +async function getUserByName({ username }: GetUserByNamePathParams, config: Partial = {}) { const res = await client({ method: 'GET', url: `/user/${username}`, @@ -33,14 +26,7 @@ async function getUserByName( return res.data } -export function getUserByNameSuspenseQueryOptionsHook( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, - config: Partial = {}, -) { +export function getUserByNameSuspenseQueryOptionsHook({ username }: GetUserByNamePathParams, config: Partial = {}) { const queryKey = getUserByNameSuspenseQueryKey({ username }) return queryOptions({ enabled: !!username, @@ -61,11 +47,7 @@ export function useGetUserByNameSuspenseHook< TQueryData = GetUserByNameQueryResponse, TQueryKey extends QueryKey = GetUserByNameSuspenseQueryKey, >( - { - username, - }: { - username: GetUserByNamePathParams['username'] - }, + { username }: GetUserByNamePathParams, options: { query?: Partial> client?: Partial diff --git a/examples/react-query/src/gen/hooks/useUpdateUserHook.ts b/examples/react-query/src/gen/hooks/useUpdateUserHook.ts index fc9d2f0ca..f6cf7397c 100644 --- a/examples/react-query/src/gen/hooks/useUpdateUserHook.ts +++ b/examples/react-query/src/gen/hooks/useUpdateUserHook.ts @@ -14,11 +14,7 @@ export type UpdateUserMutationKey = ReturnType * @link /user/:username */ async function updateUser( - { - username, - }: { - username: UpdateUserPathParams['username'] - }, + { username }: UpdateUserPathParams, data?: UpdateUserMutationRequest, config: Partial> = {}, ) { diff --git a/examples/react-query/src/gen/hooks/useUploadFileHook.ts b/examples/react-query/src/gen/hooks/useUploadFileHook.ts index d7a8b2b69..493a57d88 100644 --- a/examples/react-query/src/gen/hooks/useUploadFileHook.ts +++ b/examples/react-query/src/gen/hooks/useUploadFileHook.ts @@ -13,11 +13,7 @@ export type UploadFileMutationKey = ReturnType * @link /pet/:petId/uploadImage */ async function uploadFile( - { - petId, - }: { - petId: UploadFilePathParams['petId'] - }, + { petId }: UploadFilePathParams, data?: UploadFileMutationRequest, params?: UploadFileQueryParams, config: Partial> = {}, diff --git a/examples/vue-query/src/gen/hooks/useAddPet.ts b/examples/vue-query/src/gen/hooks/useAddPet.ts index b54d617d7..b0c34c2c1 100644 --- a/examples/vue-query/src/gen/hooks/useAddPet.ts +++ b/examples/vue-query/src/gen/hooks/useAddPet.ts @@ -14,7 +14,14 @@ export type AddPetMutationKey = ReturnType * @summary Add a new pet to the store * @link /pet */ -async function addPet(data: AddPetMutationRequest, config: Partial> = {}) { +async function addPet( + { + data, + }: { + data: AddPetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/pet', @@ -52,7 +59,7 @@ export function useAddPet( } >({ mutationFn: async ({ data }) => { - return addPet(data, config) + return addPet({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useCreateUser.ts b/examples/vue-query/src/gen/hooks/useCreateUser.ts index 925bf10d7..752931c86 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUser.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUser.ts @@ -14,7 +14,14 @@ export type CreateUserMutationKey = ReturnType * @summary Create user * @link /user */ -async function createUser(data?: CreateUserMutationRequest, config: Partial> = {}) { +async function createUser( + { + data, + }: { + data?: CreateUserMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/user', @@ -52,7 +59,7 @@ export function useCreateUser( } >({ mutationFn: async ({ data }) => { - return createUser(data, config) + return createUser({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts index 8e079a77c..f248fbf1b 100644 --- a/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts +++ b/examples/vue-query/src/gen/hooks/useCreateUsersWithListInput.ts @@ -15,7 +15,11 @@ export type CreateUsersWithListInputMutationKey = ReturnType> = {}, ) { const res = await client({ @@ -55,7 +59,7 @@ export function useCreateUsersWithListInput( } >({ mutationFn: async ({ data }) => { - return createUsersWithListInput(data, config) + return createUsersWithListInput({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts index 9b26be3fd..b88d23bcc 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteOrder.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteOrder.ts @@ -14,7 +14,14 @@ export type DeleteOrderMutationKey = ReturnType * @summary Delete purchase order by ID * @link /store/order/:orderId */ -async function deleteOrder(orderId: DeleteOrderPathParams['orderId'], config: Partial = {}) { +async function deleteOrder( + { + orderId, + }: { + orderId: DeleteOrderPathParams['orderId'] + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/store/order/${orderId}`, @@ -51,7 +58,7 @@ export function useDeleteOrder( } >({ mutationFn: async ({ orderId }) => { - return deleteOrder(orderId, config) + return deleteOrder({ orderId }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useDeletePet.ts b/examples/vue-query/src/gen/hooks/useDeletePet.ts index 8f74717a7..f3aacf2e8 100644 --- a/examples/vue-query/src/gen/hooks/useDeletePet.ts +++ b/examples/vue-query/src/gen/hooks/useDeletePet.ts @@ -14,7 +14,16 @@ export type DeletePetMutationKey = ReturnType * @summary Deletes a pet * @link /pet/:petId */ -async function deletePet(petId: DeletePetPathParams['petId'], headers?: DeletePetHeaderParams, config: Partial = {}) { +async function deletePet( + { + petId, + headers, + }: { + petId: DeletePetPathParams['petId'] + headers?: DeletePetHeaderParams + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/pet/${petId}`, @@ -54,7 +63,7 @@ export function useDeletePet( } >({ mutationFn: async ({ petId, headers }) => { - return deletePet(petId, headers, config) + return deletePet({ petId, headers }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useDeleteUser.ts b/examples/vue-query/src/gen/hooks/useDeleteUser.ts index b07642802..db3b0c377 100644 --- a/examples/vue-query/src/gen/hooks/useDeleteUser.ts +++ b/examples/vue-query/src/gen/hooks/useDeleteUser.ts @@ -14,7 +14,14 @@ export type DeleteUserMutationKey = ReturnType * @summary Delete user * @link /user/:username */ -async function deleteUser(username: DeleteUserPathParams['username'], config: Partial = {}) { +async function deleteUser( + { + username, + }: { + username: DeleteUserPathParams['username'] + }, + config: Partial = {}, +) { const res = await client({ method: 'DELETE', url: `/user/${username}`, @@ -51,7 +58,7 @@ export function useDeleteUser( } >({ mutationFn: async ({ username }) => { - return deleteUser(username, config) + return deleteUser({ username }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts index 81db9facc..053faf82f 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByStatus.ts @@ -15,7 +15,14 @@ export type FindPetsByStatusQueryKey = ReturnType = {}) { +async function findPetsByStatus( + { + params, + }: { + params?: FindPetsByStatusQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByStatus', @@ -26,13 +33,20 @@ async function findPetsByStatus(params?: FindPetsByStatusQueryParams, config: Pa return res.data } -export function findPetsByStatusQueryOptions(params?: MaybeRef, config: Partial = {}) { +export function findPetsByStatusQueryOptions( + { + params, + }: { + params?: MaybeRef + }, + config: Partial = {}, +) { const queryKey = findPetsByStatusQueryKey(params) return queryOptions({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByStatus(unref(params), unref(config)) + return findPetsByStatus(unref({ params: unref(params) }), unref(config)) }, }) } @@ -47,7 +61,11 @@ export function useFindPetsByStatus< TQueryData = FindPetsByStatusQueryResponse, TQueryKey extends QueryKey = FindPetsByStatusQueryKey, >( - params?: MaybeRef, + { + params, + }: { + params?: MaybeRef + }, options: { query?: Partial> client?: Partial @@ -56,7 +74,7 @@ export function useFindPetsByStatus< const { query: queryOptions, client: config = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? findPetsByStatusQueryKey(params) const query = useQuery({ - ...(findPetsByStatusQueryOptions(params, config) as unknown as QueryObserverOptions), + ...(findPetsByStatusQueryOptions({ params }, config) as unknown as QueryObserverOptions), queryKey: queryKey as QueryKey, ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { diff --git a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts index 8ab285925..7711f114b 100644 --- a/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts +++ b/examples/vue-query/src/gen/hooks/useFindPetsByTags.ts @@ -15,7 +15,14 @@ export type FindPetsByTagsQueryKey = ReturnType * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags( + { + params, + }: { + params?: FindPetsByTagsQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/pet/findByTags', @@ -26,13 +33,20 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia return res.data } -export function findPetsByTagsQueryOptions(params?: MaybeRef, config: Partial = {}) { +export function findPetsByTagsQueryOptions( + { + params, + }: { + params?: MaybeRef + }, + config: Partial = {}, +) { const queryKey = findPetsByTagsQueryKey(params) return queryOptions({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return findPetsByTags(unref(params), unref(config)) + return findPetsByTags(unref({ params: unref(params) }), unref(config)) }, }) } @@ -47,7 +61,11 @@ export function useFindPetsByTags< TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey, >( - params?: MaybeRef, + { + params, + }: { + params?: MaybeRef + }, options: { query?: Partial> client?: Partial @@ -56,7 +74,7 @@ export function useFindPetsByTags< const { query: queryOptions, client: config = {} } = options ?? {} const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params) const query = useQuery({ - ...(findPetsByTagsQueryOptions(params, config) as unknown as QueryObserverOptions), + ...(findPetsByTagsQueryOptions({ params }, config) as unknown as QueryObserverOptions), queryKey: queryKey as QueryKey, ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { diff --git a/examples/vue-query/src/gen/hooks/useGetOrderById.ts b/examples/vue-query/src/gen/hooks/useGetOrderById.ts index 25c1905b0..267412a47 100644 --- a/examples/vue-query/src/gen/hooks/useGetOrderById.ts +++ b/examples/vue-query/src/gen/hooks/useGetOrderById.ts @@ -6,8 +6,11 @@ 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, +}: { + orderId: MaybeRef +}) => [{ url: '/store/order/:orderId', params: { orderId: orderId } }] as const export type GetOrderByIdQueryKey = ReturnType @@ -16,7 +19,14 @@ export type GetOrderByIdQueryKey = ReturnType * @summary Find purchase order by ID * @link /store/order/:orderId */ -async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: Partial = {}) { +async function getOrderById( + { + orderId, + }: { + orderId: GetOrderByIdPathParams['orderId'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/store/order/${orderId}`, @@ -26,14 +36,21 @@ async function getOrderById(orderId: GetOrderByIdPathParams['orderId'], config: return res.data } -export function getOrderByIdQueryOptions(orderId: MaybeRef, config: Partial = {}) { - const queryKey = getOrderByIdQueryKey(orderId) +export function getOrderByIdQueryOptions( + { + orderId, + }: { + orderId: MaybeRef + }, + config: Partial = {}, +) { + const queryKey = getOrderByIdQueryKey({ orderId }) return queryOptions({ enabled: !!orderId, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getOrderById(unref(orderId), unref(config)) + return getOrderById(unref({ orderId: unref(orderId) }), unref(config)) }, }) } @@ -44,16 +61,20 @@ export function getOrderByIdQueryOptions(orderId: MaybeRef( - orderId: MaybeRef, + { + orderId, + }: { + orderId: MaybeRef + }, options: { query?: Partial> client?: Partial } = {}, ) { const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey(orderId) + const queryKey = queryOptions?.queryKey ?? getOrderByIdQueryKey({ orderId }) const query = useQuery({ - ...(getOrderByIdQueryOptions(orderId, config) as unknown as QueryObserverOptions), + ...(getOrderByIdQueryOptions({ orderId }, config) as unknown as QueryObserverOptions), queryKey: queryKey as QueryKey, ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { diff --git a/examples/vue-query/src/gen/hooks/useGetPetById.ts b/examples/vue-query/src/gen/hooks/useGetPetById.ts index 45bd0b6b9..ecb696eec 100644 --- a/examples/vue-query/src/gen/hooks/useGetPetById.ts +++ b/examples/vue-query/src/gen/hooks/useGetPetById.ts @@ -6,7 +6,11 @@ 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, +}: { + petId: MaybeRef +}) => [{ url: '/pet/:petId', params: { petId: petId } }] as const export type GetPetByIdQueryKey = ReturnType @@ -15,7 +19,14 @@ export type GetPetByIdQueryKey = ReturnType * @summary Find pet by ID * @link /pet/:petId */ -async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial = {}) { +async function getPetById( + { + petId, + }: { + petId: GetPetByIdPathParams['petId'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/pet/${petId}`, @@ -25,14 +36,21 @@ async function getPetById(petId: GetPetByIdPathParams['petId'], config: Partial< return res.data } -export function getPetByIdQueryOptions(petId: MaybeRef, config: Partial = {}) { - const queryKey = getPetByIdQueryKey(petId) +export function getPetByIdQueryOptions( + { + petId, + }: { + petId: MaybeRef + }, + config: Partial = {}, +) { + const queryKey = getPetByIdQueryKey({ petId }) return queryOptions({ enabled: !!petId, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getPetById(unref(petId), unref(config)) + return getPetById(unref({ petId: unref(petId) }), unref(config)) }, }) } @@ -43,16 +61,20 @@ export function getPetByIdQueryOptions(petId: MaybeRef( - petId: MaybeRef, + { + petId, + }: { + petId: MaybeRef + }, options: { query?: Partial> client?: Partial } = {}, ) { const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId) + const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey({ petId }) const query = useQuery({ - ...(getPetByIdQueryOptions(petId, config) as unknown as QueryObserverOptions), + ...(getPetByIdQueryOptions({ petId }, config) as unknown as QueryObserverOptions), queryKey: queryKey as QueryKey, ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { diff --git a/examples/vue-query/src/gen/hooks/useGetUserByName.ts b/examples/vue-query/src/gen/hooks/useGetUserByName.ts index 2ebf77ef7..e0cbb44ac 100644 --- a/examples/vue-query/src/gen/hooks/useGetUserByName.ts +++ b/examples/vue-query/src/gen/hooks/useGetUserByName.ts @@ -6,8 +6,11 @@ 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, +}: { + username: MaybeRef +}) => [{ url: '/user/:username', params: { username: username } }] as const export type GetUserByNameQueryKey = ReturnType @@ -15,7 +18,14 @@ export type GetUserByNameQueryKey = ReturnType * @summary Get user by user name * @link /user/:username */ -async function getUserByName(username: GetUserByNamePathParams['username'], config: Partial = {}) { +async function getUserByName( + { + username, + }: { + username: GetUserByNamePathParams['username'] + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: `/user/${username}`, @@ -25,14 +35,21 @@ async function getUserByName(username: GetUserByNamePathParams['username'], conf return res.data } -export function getUserByNameQueryOptions(username: MaybeRef, config: Partial = {}) { - const queryKey = getUserByNameQueryKey(username) +export function getUserByNameQueryOptions( + { + username, + }: { + username: MaybeRef + }, + config: Partial = {}, +) { + const queryKey = getUserByNameQueryKey({ username }) return queryOptions({ enabled: !!username, queryKey, queryFn: async ({ signal }) => { config.signal = signal - return getUserByName(unref(username), unref(config)) + return getUserByName(unref({ username: unref(username) }), unref(config)) }, }) } @@ -46,16 +63,20 @@ export function useGetUserByName< TQueryData = GetUserByNameQueryResponse, TQueryKey extends QueryKey = GetUserByNameQueryKey, >( - username: MaybeRef, + { + username, + }: { + username: MaybeRef + }, options: { query?: Partial> client?: Partial } = {}, ) { const { query: queryOptions, client: config = {} } = options ?? {} - const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey(username) + const queryKey = queryOptions?.queryKey ?? getUserByNameQueryKey({ username }) const query = useQuery({ - ...(getUserByNameQueryOptions(username, config) as unknown as QueryObserverOptions), + ...(getUserByNameQueryOptions({ username }, config) as unknown as QueryObserverOptions), queryKey: queryKey as QueryKey, ...(queryOptions as unknown as Omit), }) as UseQueryReturnType & { diff --git a/examples/vue-query/src/gen/hooks/useLoginUser.ts b/examples/vue-query/src/gen/hooks/useLoginUser.ts index 0610e8d6d..7a87c7785 100644 --- a/examples/vue-query/src/gen/hooks/useLoginUser.ts +++ b/examples/vue-query/src/gen/hooks/useLoginUser.ts @@ -14,7 +14,14 @@ export type LoginUserQueryKey = ReturnType * @summary Logs user into the system * @link /user/login */ -async function loginUser(params?: LoginUserQueryParams, config: Partial = {}) { +async function loginUser( + { + params, + }: { + params?: LoginUserQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'GET', url: '/user/login', @@ -25,13 +32,20 @@ async function loginUser(params?: LoginUserQueryParams, config: Partial, config: Partial = {}) { +export function loginUserQueryOptions( + { + params, + }: { + params?: MaybeRef + }, + config: Partial = {}, +) { const queryKey = loginUserQueryKey(params) return queryOptions({ queryKey, queryFn: async ({ signal }) => { config.signal = signal - return loginUser(unref(params), unref(config)) + return loginUser(unref({ params: unref(params) }), unref(config)) }, }) } @@ -41,7 +55,11 @@ export function loginUserQueryOptions(params?: MaybeRef, c * @link /user/login */ export function useLoginUser( - params?: MaybeRef, + { + params, + }: { + params?: MaybeRef + }, options: { query?: Partial> client?: Partial @@ -50,7 +68,7 @@ export function useLoginUser), }) as UseQueryReturnType & { diff --git a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts index ea49a9681..ab75f6124 100644 --- a/examples/vue-query/src/gen/hooks/usePlaceOrder.ts +++ b/examples/vue-query/src/gen/hooks/usePlaceOrder.ts @@ -14,7 +14,14 @@ export type PlaceOrderMutationKey = ReturnType * @summary Place an order for a pet * @link /store/order */ -async function placeOrder(data?: PlaceOrderMutationRequest, config: Partial> = {}) { +async function placeOrder( + { + data, + }: { + data?: PlaceOrderMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'POST', url: '/store/order', @@ -52,7 +59,7 @@ export function usePlaceOrder( } >({ mutationFn: async ({ data }) => { - return placeOrder(data, config) + return placeOrder({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useUpdatePet.ts b/examples/vue-query/src/gen/hooks/useUpdatePet.ts index e71ef95b0..920e6522b 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePet.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePet.ts @@ -14,7 +14,14 @@ export type UpdatePetMutationKey = ReturnType * @summary Update an existing pet * @link /pet */ -async function updatePet(data: UpdatePetMutationRequest, config: Partial> = {}) { +async function updatePet( + { + data, + }: { + data: UpdatePetMutationRequest + }, + config: Partial> = {}, +) { const res = await client({ method: 'PUT', url: '/pet', @@ -52,7 +59,7 @@ export function useUpdatePet( } >({ mutationFn: async ({ data }) => { - return updatePet(data, config) + return updatePet({ data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts index b134a500c..d624d04ed 100644 --- a/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts +++ b/examples/vue-query/src/gen/hooks/useUpdatePetWithForm.ts @@ -18,7 +18,16 @@ export type UpdatePetWithFormMutationKey = ReturnType = {}) { +async function updatePetWithForm( + { + petId, + params, + }: { + petId: UpdatePetWithFormPathParams['petId'] + params?: UpdatePetWithFormQueryParams + }, + config: Partial = {}, +) { const res = await client({ method: 'POST', url: `/pet/${petId}`, @@ -57,7 +66,7 @@ export function useUpdatePetWithForm( } >({ mutationFn: async ({ petId, params }) => { - return updatePetWithForm(petId, params, config) + return updatePetWithForm({ petId, params }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useUpdateUser.ts b/examples/vue-query/src/gen/hooks/useUpdateUser.ts index 73b6797b7..54939caf1 100644 --- a/examples/vue-query/src/gen/hooks/useUpdateUser.ts +++ b/examples/vue-query/src/gen/hooks/useUpdateUser.ts @@ -15,8 +15,13 @@ export type UpdateUserMutationKey = ReturnType * @link /user/:username */ async function updateUser( - username: UpdateUserPathParams['username'], - data?: UpdateUserMutationRequest, + { + username, + data, + }: { + username: UpdateUserPathParams['username'] + data?: UpdateUserMutationRequest + }, config: Partial> = {}, ) { const res = await client({ @@ -58,7 +63,7 @@ export function useUpdateUser( } >({ mutationFn: async ({ username, data }) => { - return updateUser(username, data, config) + return updateUser({ username, data }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/src/gen/hooks/useUploadFile.ts b/examples/vue-query/src/gen/hooks/useUploadFile.ts index 3e43ba6f6..02f2139ce 100644 --- a/examples/vue-query/src/gen/hooks/useUploadFile.ts +++ b/examples/vue-query/src/gen/hooks/useUploadFile.ts @@ -14,9 +14,15 @@ export type UploadFileMutationKey = ReturnType * @link /pet/:petId/uploadImage */ async function uploadFile( - petId: UploadFilePathParams['petId'], - data?: UploadFileMutationRequest, - params?: UploadFileQueryParams, + { + petId, + data, + params, + }: { + petId: UploadFilePathParams['petId'] + data?: UploadFileMutationRequest + params?: UploadFileQueryParams + }, config: Partial> = {}, ) { const res = await client({ @@ -61,7 +67,7 @@ export function useUploadFile( } >({ mutationFn: async ({ petId, data, params }) => { - return uploadFile(petId, data, params, config) + return uploadFile({ petId, data, params }, config) }, mutationKey, ...mutationOptions, diff --git a/examples/vue-query/vite.config.ts b/examples/vue-query/vite.config.ts index 6aeb3eb5c..7a135ff59 100644 --- a/examples/vue-query/vite.config.ts +++ b/examples/vue-query/vite.config.ts @@ -32,6 +32,7 @@ export default defineConfig({ output: { path: './hooks', }, + paramsType: 'object', }), ], }, diff --git a/examples/zod/src/gen/zodClients.ts b/examples/zod/src/gen/zodClients.ts index 1773e9a1e..3de54b65f 100644 --- a/examples/zod/src/gen/zodClients.ts +++ b/examples/zod/src/gen/zodClients.ts @@ -63,14 +63,7 @@ export async function placeOrderPatch(data?: PlaceOrderPatchMutationRequestType, * @summary Find purchase order by ID * @link /store/order/:orderId */ -export async function getOrderById( - { - orderId, - }: { - orderId: GetOrderByIdPathParamsType['orderId'] - }, - config: Partial = {}, -) { +export async function getOrderById({ orderId }: GetOrderByIdPathParamsType, config: Partial = {}) { const res = await client({ method: 'GET', url: `/store/order/${orderId}`, @@ -85,14 +78,7 @@ export async function getOrderById( * @summary Delete purchase order by ID * @link /store/order/:orderId */ -export async function deleteOrder( - { - orderId, - }: { - orderId: DeleteOrderPathParamsType['orderId'] - }, - config: Partial = {}, -) { +export async function deleteOrder({ orderId }: DeleteOrderPathParamsType, config: Partial = {}) { const res = await client({ method: 'DELETE', url: `/store/order/${orderId}`, diff --git a/package.json b/package.json index 274dbf054..a410ff870 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@changesets/cli": "^2.27.9", "@kubb/config-biome": "workspace:*", "@kubb/config-ts": "workspace:*", - "@types/node": "^20.17.1", + "@types/node": "^20.17.3", "@vitest/coverage-v8": "^2.1.4", "@vitest/ui": "^2.1.4", "bun-types": "^1.1.33", diff --git a/packages/cli/package.json b/packages/cli/package.json index 2f45de269..10561c49d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -56,7 +56,7 @@ "cli-progress": "^3.12.0", "consola": "^3.2.3", "cosmiconfig": "^9.0.0", - "execa": "^9.5.0", + "execa": "^9.5.1", "jiti": "^2.3.3", "latest-version": "^9.0.0", "p-queue": "^8.0.1", @@ -69,7 +69,7 @@ "@kubb/config-tsup": "workspace:*", "@kubb/plugin-oas": "workspace:*", "@types/cli-progress": "^3.11.6", - "@types/node": "^20.17.1", + "@types/node": "^20.17.3", "@types/semver": "^7.5.8", "source-map-support": "^0.5.21", "tsup": "^8.3.5", diff --git a/packages/config-tsup/package.json b/packages/config-tsup/package.json index 404bef765..2a9b2ffe3 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.17.1", + "@types/node": "^20.17.3", "tsup": "^8.3.5" }, "peerDependencies": { diff --git a/packages/core/src/__snapshots__/FileManager.test.ts.snap b/packages/core/src/__snapshots__/FileManager.test.ts.snap index 23e764129..32302f3f3 100644 --- a/packages/core/src/__snapshots__/FileManager.test.ts.snap +++ b/packages/core/src/__snapshots__/FileManager.test.ts.snap @@ -48,3 +48,10 @@ exports[`FileManager utils > if getFileSource is returning code with imports and export type Pet = Pets " `; + +exports[`FileManager utils > if getFileSource is returning code with imports and default import 2`] = ` +"import type { Pets } from './Pets' + +export type Pet = Pets +" +`; diff --git a/packages/kubb/package.json b/packages/kubb/package.json index 2e26e56ab..f0b25cb32 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.17.1", + "@types/node": "^20.17.3", "tsup": "^8.3.5", "typescript": "^5.6.3" }, diff --git a/packages/plugin-client/src/components/Client.tsx b/packages/plugin-client/src/components/Client.tsx index bc13685fb..77aea41cf 100644 --- a/packages/plugin-client/src/components/Client.tsx +++ b/packages/plugin-client/src/components/Client.tsx @@ -17,6 +17,7 @@ type Props = { baseURL: string | undefined dataReturnType: PluginClient['resolvedOptions']['dataReturnType'] + paramsType: PluginClient['resolvedOptions']['pathParamsType'] pathParamsType: PluginClient['resolvedOptions']['pathParamsType'] parser: PluginClient['resolvedOptions']['parser'] | undefined typeSchemas: OperationSchemas @@ -25,16 +26,54 @@ type Props = { } type GetParamsProps = { + paramsType: PluginClient['resolvedOptions']['paramsType'] pathParamsType: PluginClient['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -69,6 +108,7 @@ export function Client({ dataReturnType, parser, zodSchemas, + paramsType, pathParamsType, operation, }: Props): KubbNode { @@ -85,7 +125,7 @@ export function Client({ typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', typeSchemas.request?.name || 'unknown', ].filter(Boolean) - const params = getParams({ pathParamsType, typeSchemas }) + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = FunctionParams.factory({ config: { mode: 'object', diff --git a/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts b/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts index a08123b96..2e37331a1 100644 --- a/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts +++ b/packages/plugin-client/src/generators/__snapshots__/deletePetObject.ts @@ -7,9 +7,7 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; * @summary Deletes a pet * @link /pet/:petId */ -export async function deletePet({ petId }: { - petId: DeletePetPathParams["petId"]; -}, headers?: DeletePetHeaderParams, config: Partial = {}) { +export async function deletePet({ petId }: DeletePetPathParams, headers?: DeletePetHeaderParams, config: Partial = {}) { const res = await client({ method: "DELETE", url: `/pet/${petId}`, headers: { ...headers, ...config.headers }, ...config }); return res.data; } diff --git a/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts new file mode 100644 index 000000000..19eb95551 --- /dev/null +++ b/packages/plugin-client/src/generators/__snapshots__/findByTagsObject.ts @@ -0,0 +1,15 @@ +/* eslint-disable no-alert, no-console */ +import client from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/client"; + + /** + * @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 async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); + return res.data; +} diff --git a/packages/plugin-client/src/generators/clientGenerator.test.tsx b/packages/plugin-client/src/generators/clientGenerator.test.tsx index c688c5f28..53caea9a3 100644 --- a/packages/plugin-client/src/generators/clientGenerator.test.tsx +++ b/packages/plugin-client/src/generators/clientGenerator.test.tsx @@ -54,6 +54,16 @@ describe('clientGenerator operation', async () => { importPath: 'axios', }, }, + { + name: 'findByTagsObject', + input: '../../mocks/petStore.yaml', + path: '/pet/findByTags', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, { name: 'updatePetById', input: '../../mocks/petStore.yaml', @@ -90,6 +100,7 @@ describe('clientGenerator operation', async () => { const options: PluginClient['resolvedOptions'] = { dataReturnType: 'data', + paramsType: 'inline', pathParamsType: 'inline', importPath: '@kubb/plugin-client/client', baseURL: '', diff --git a/packages/plugin-client/src/generators/clientGenerator.tsx b/packages/plugin-client/src/generators/clientGenerator.tsx index 3dab5a1fd..773e0aaca 100644 --- a/packages/plugin-client/src/generators/clientGenerator.tsx +++ b/packages/plugin-client/src/generators/clientGenerator.tsx @@ -55,6 +55,7 @@ export const clientGenerator = createReactGenerator({ baseURL={options.baseURL} dataReturnType={options.dataReturnType} pathParamsType={options.pathParamsType} + paramsType={options.paramsType} typeSchemas={type.schemas} operation={operation} parser={options.parser} diff --git a/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx b/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx index c5dc8a945..8608ffbb9 100644 --- a/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx +++ b/packages/plugin-client/src/generators/groupedClientGenerator.test.tsx @@ -30,6 +30,7 @@ describe('groupedClientsGenerators operations', async () => { const options: PluginClient['resolvedOptions'] = { dataReturnType: 'data', + paramsType: 'inline', pathParamsType: 'inline', importPath: '@kubb/plugin-client/client', baseURL: '', diff --git a/packages/plugin-client/src/generators/operationsGenerator.test.tsx b/packages/plugin-client/src/generators/operationsGenerator.test.tsx index 592474a99..a85253e56 100644 --- a/packages/plugin-client/src/generators/operationsGenerator.test.tsx +++ b/packages/plugin-client/src/generators/operationsGenerator.test.tsx @@ -30,6 +30,7 @@ describe('operationsGenerator operations', async () => { const options: PluginClient['resolvedOptions'] = { dataReturnType: 'data', + paramsType: 'inline', pathParamsType: 'inline', importPath: '@kubb/plugin-client/client', baseURL: '', diff --git a/packages/plugin-client/src/plugin.ts b/packages/plugin-client/src/plugin.ts index bc495624f..1452b34ec 100644 --- a/packages/plugin-client/src/plugin.ts +++ b/packages/plugin-client/src/plugin.ts @@ -24,6 +24,7 @@ export const pluginClient = createPlugin((options) => { transformers = {}, dataReturnType = 'data', pathParamsType = 'inline', + paramsType = 'inline', operations = false, generators = [clientGenerator, group ? groupedClientGenerator : undefined, operations ? operationsGenerator : undefined].filter(Boolean), importPath = '@kubb/plugin-client/client', @@ -38,7 +39,8 @@ export const pluginClient = createPlugin((options) => { parser, dataReturnType, importPath, - pathParamsType, + paramsType, + pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, baseURL: undefined, }, pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), diff --git a/packages/plugin-client/src/types.ts b/packages/plugin-client/src/types.ts index 8948f0f19..3e94ccb11 100644 --- a/packages/plugin-client/src/types.ts +++ b/packages/plugin-client/src/types.ts @@ -43,6 +43,13 @@ export type Options = { * @default 'data' */ dataReturnType?: 'data' | 'full' + /** + * How to pass your params + * - 'object' will return the params and pathParams as an object. + * - 'inline' will return the params as comma separated params. + * @default 'inline' + */ + paramsType?: 'object' | 'inline' /** * How to pass your pathParams. * - 'object' will return the pathParams as an object. @@ -76,6 +83,7 @@ type ResolvedOptions = { importPath: NonNullable dataReturnType: NonNullable pathParamsType: NonNullable + paramsType: NonNullable } export type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions> diff --git a/packages/plugin-msw/src/generators/mswGenerator.tsx b/packages/plugin-msw/src/generators/mswGenerator.tsx index 7ed162f37..a91fcb3af 100644 --- a/packages/plugin-msw/src/generators/mswGenerator.tsx +++ b/packages/plugin-msw/src/generators/mswGenerator.tsx @@ -36,7 +36,9 @@ export const mswGenerator = createReactGenerator({ - {faker.file && faker.schemas.response && } + {parser === 'faker' && faker.file && faker.schemas.response && ( + + )} {parser === 'faker' && ( ` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -71,6 +115,7 @@ export function InfiniteQuery({ queryKeyTypeName, queryOptionsName, queryKeyName, + paramsType, pathParamsType, dataReturnType, typeSchemas, @@ -85,10 +130,12 @@ export function InfiniteQuery({ typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-react-query/src/components/InfiniteQueryOptions.tsx b/packages/plugin-react-query/src/components/InfiniteQueryOptions.tsx index ff242ed3f..de0c11639 100644 --- a/packages/plugin-react-query/src/components/InfiniteQueryOptions.tsx +++ b/packages/plugin-react-query/src/components/InfiniteQueryOptions.tsx @@ -14,6 +14,7 @@ type Props = { clientName: string queryKeyName: string typeSchemas: OperationSchemas + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] initialPageParam: Infinite['initialPageParam'] @@ -22,16 +23,54 @@ type Props = { } type GetParamsProps = { + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -63,14 +102,16 @@ export function InfiniteQueryOptions({ initialPageParam, cursorParam, typeSchemas, + paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName, }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ typeSchemas, + paramsType, pathParamsType, }) const queryKeyParams = QueryKey.getParams({ diff --git a/packages/plugin-react-query/src/components/Mutation.tsx b/packages/plugin-react-query/src/components/Mutation.tsx index b0e8259b6..aaaf040a7 100644 --- a/packages/plugin-react-query/src/components/Mutation.tsx +++ b/packages/plugin-react-query/src/components/Mutation.tsx @@ -20,6 +20,7 @@ type Props = { typeSchemas: OperationSchemas operation: Operation dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] } @@ -70,7 +71,7 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) { }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { +export function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { const mutationKeyParams = MutationKey.getParams({ pathParamsType, typeSchemas, @@ -83,6 +84,7 @@ export function Mutation({ name, clientName, pathParamsType, dataReturnType, typ }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-react-query/src/components/Query.tsx b/packages/plugin-react-query/src/components/Query.tsx index 88ddacf04..5fe870bb9 100644 --- a/packages/plugin-react-query/src/components/Query.tsx +++ b/packages/plugin-react-query/src/components/Query.tsx @@ -18,24 +18,68 @@ type Props = { queryKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] } type GetParamsProps = { + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -66,7 +110,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro }) } -export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { +export function Query({ + name, + queryKeyTypeName, + queryOptionsName, + queryKeyName, + paramsType, + pathParamsType, + dataReturnType, + typeSchemas, + operation, +}: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const returnType = `UseQueryResult<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }` const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`] @@ -76,10 +130,12 @@ export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-react-query/src/components/QueryOptions.tsx b/packages/plugin-react-query/src/components/QueryOptions.tsx index 9b72b17a0..c00eb467a 100644 --- a/packages/plugin-react-query/src/components/QueryOptions.tsx +++ b/packages/plugin-react-query/src/components/QueryOptions.tsx @@ -14,20 +14,59 @@ type Props = { clientName: string queryKeyName: string typeSchemas: OperationSchemas + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] } type GetParamsProps = { + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -53,10 +92,11 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { }) } -export function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) +export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode { + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ typeSchemas, + paramsType, pathParamsType, }) const queryKeyParams = QueryKey.getParams({ diff --git a/packages/plugin-react-query/src/components/SuspenseQuery.tsx b/packages/plugin-react-query/src/components/SuspenseQuery.tsx index 40c34b811..e64a47554 100644 --- a/packages/plugin-react-query/src/components/SuspenseQuery.tsx +++ b/packages/plugin-react-query/src/components/SuspenseQuery.tsx @@ -18,24 +18,68 @@ type Props = { queryKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] } type GetParamsProps = { + paramsType: PluginReactQuery['resolvedOptions']['paramsType'] pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -71,6 +115,7 @@ export function SuspenseQuery({ queryKeyTypeName, queryOptionsName, queryKeyName, + paramsType, pathParamsType, dataReturnType, typeSchemas, @@ -85,10 +130,12 @@ export function SuspenseQuery({ typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts new file mode 100644 index 000000000..be34d0c3d --- /dev/null +++ b/packages/plugin-react-query/src/generators/__snapshots__/findByTagsObject.ts @@ -0,0 +1,60 @@ +import client from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryResult } from "@tanstack/react-query"; +import { useQuery, queryOptions } from "@tanstack/react-query"; + + 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 + * @link /pet/findByTags + */ +async function findPetsByTags({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config }); + return findPetsByTagsQueryResponse.parse(res.data); +} + + export function findPetsByTagsQueryOptions({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTags({ headers, params }, 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({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = useQuery({ + ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as UseQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} diff --git a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 50cd4f4e8..192199430 100644 --- a/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-react-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -11,9 +11,7 @@ import { useMutation } from "@tanstack/react-query"; * @summary Updates a pet in the store with form data * @link /pet/:petId */ -async function updatePetWithForm({ petId }: { - petId: UpdatePetWithFormPathParams["petId"]; -}, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial> = {}) { +async function updatePetWithForm({ petId }: UpdatePetWithFormPathParams, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial> = {}) { const res = await client({ method: "POST", url: `/pet/${petId}`, params, data, ...config }); return updatePetWithFormMutationResponse.parse(res.data); } diff --git a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx index 7199e6f0e..7f354e3a8 100644 --- a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.test.tsx @@ -54,6 +54,7 @@ describe('infiniteQueryGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx index 33458790e..6954cbbfe 100644 --- a/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx +++ b/packages/plugin-react-query/src/generators/infiniteQueryGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -94,6 +93,7 @@ export const infiniteQueryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -102,6 +102,7 @@ export const infiniteQueryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} dataReturnType={options.client.dataReturnType} cursorParam={options.infinite.cursorParam} @@ -112,6 +113,7 @@ export const infiniteQueryGenerator = createReactGenerator({ name={query.name} queryOptionsName={queryOptions.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} operation={operation} dataReturnType={options.client.dataReturnType} diff --git a/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx index d8514ccf0..4def5f88a 100644 --- a/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/mutationGenerator.test.tsx @@ -58,6 +58,16 @@ describe('mutationGenerator operation', async () => { method: 'delete', options: {}, }, + { + name: 'deletePetObject', + input: '../../mocks/petStore.yaml', + path: '/pet/{petId}', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -76,6 +86,7 @@ describe('mutationGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-react-query/src/generators/mutationGenerator.tsx b/packages/plugin-react-query/src/generators/mutationGenerator.tsx index 9f23a3a56..1a5546d36 100644 --- a/packages/plugin-react-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-react-query/src/generators/mutationGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -89,6 +88,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -99,6 +99,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} operation={operation} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} /> diff --git a/packages/plugin-react-query/src/generators/queryGenerator.test.tsx b/packages/plugin-react-query/src/generators/queryGenerator.test.tsx index 2fdd1601a..4f5b9ad60 100644 --- a/packages/plugin-react-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-react-query/src/generators/queryGenerator.test.tsx @@ -85,6 +85,16 @@ describe('queryGenerator operation', async () => { }, }, }, + { + name: 'findByTagsObject', + input: '../../mocks/petStore.yaml', + path: '/pet/findByTags', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -103,6 +113,7 @@ describe('queryGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-react-query/src/generators/queryGenerator.tsx b/packages/plugin-react-query/src/generators/queryGenerator.tsx index eeed6d05b..f3cad1a80 100644 --- a/packages/plugin-react-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-react-query/src/generators/queryGenerator.tsx @@ -94,6 +94,7 @@ export const queryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -102,12 +103,14 @@ export const queryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} /> { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-react-query/src/generators/suspenseQueryGenerator.tsx b/packages/plugin-react-query/src/generators/suspenseQueryGenerator.tsx index 6d7ccb697..32acad1b7 100644 --- a/packages/plugin-react-query/src/generators/suspenseQueryGenerator.tsx +++ b/packages/plugin-react-query/src/generators/suspenseQueryGenerator.tsx @@ -94,6 +94,7 @@ export const suspenseQueryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -102,12 +103,14 @@ export const suspenseQueryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} /> ((options) => { suspense = {}, infinite = false, transformers = {}, + paramsType = 'inline', pathParamsType = 'inline', generators = [queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean), mutation = {}, @@ -62,7 +63,8 @@ export const pluginReactQuery = createPlugin((options) => { importPath: '@tanstack/react-query', ...mutation, }, - pathParamsType, + paramsType, + pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), diff --git a/packages/plugin-react-query/src/types.ts b/packages/plugin-react-query/src/types.ts index a982f59df..476d82417 100644 --- a/packages/plugin-react-query/src/types.ts +++ b/packages/plugin-react-query/src/types.ts @@ -87,6 +87,13 @@ export type Options = { * Array containing override parameters to override `options` based on tags/operations/methods/paths. */ override?: Array> + /** + * How to pass your params + * - 'object' will return the params and pathParams as an object. + * - 'inline' will return the params as comma separated params. + * @default 'inline' + */ + paramsType?: 'object' | 'inline' /** * How to pass your pathParams. * - 'object' will return the pathParams as an object. @@ -134,6 +141,7 @@ type ResolvedOptions = { client: Required> parser: Required> pathParamsType: NonNullable + paramsType: NonNullable /** * Only used of infinite */ diff --git a/packages/plugin-solid-query/src/components/Query.tsx b/packages/plugin-solid-query/src/components/Query.tsx index 82d73ef4a..a27d5c631 100644 --- a/packages/plugin-solid-query/src/components/Query.tsx +++ b/packages/plugin-solid-query/src/components/Query.tsx @@ -18,24 +18,68 @@ type Props = { queryKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginSolidQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType'] } type GetParamsProps = { + paramsType: PluginSolidQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginSolidQuery['resolvedOptions']['client']['dataReturnType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -66,7 +110,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro }) } -export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { +export function Query({ + name, + queryKeyTypeName, + queryOptionsName, + queryKeyName, + paramsType, + pathParamsType, + dataReturnType, + typeSchemas, + operation, +}: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const returnType = `CreateQueryResult<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }` const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`] @@ -76,10 +130,12 @@ export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-solid-query/src/components/QueryOptions.tsx b/packages/plugin-solid-query/src/components/QueryOptions.tsx index cba6d41fb..f9b553f47 100644 --- a/packages/plugin-solid-query/src/components/QueryOptions.tsx +++ b/packages/plugin-solid-query/src/components/QueryOptions.tsx @@ -14,20 +14,59 @@ type Props = { clientName: string queryKeyName: string typeSchemas: OperationSchemas + paramsType: PluginSolidQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'] } type GetParamsProps = { + paramsType: PluginSolidQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSolidQuery['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -53,10 +92,11 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { }) } -export function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) +export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode { + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ typeSchemas, + paramsType, pathParamsType, }) const queryKeyParams = QueryKey.getParams({ diff --git a/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts new file mode 100644 index 000000000..5a736b8d3 --- /dev/null +++ b/packages/plugin-solid-query/src/generators/__snapshots__/findByTagsObject.ts @@ -0,0 +1,61 @@ +import client from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; +import { createQuery, queryOptions } from "@tanstack/svelte-query"; + + 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 + * @link /pet/findByTags + */ +async function findPetsByTags({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config }); + return findPetsByTagsQueryResponse.parse(res.data); +} + + export function findPetsByTagsQueryOptions({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTags({ headers, params }, 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 createFindPetsByTags({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = createQuery(() => ({ + ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as CreateBaseQueryOptions, + queryKey, + initialData: null, + ...queryOptions as unknown as Omit + })) as CreateQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} diff --git a/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx b/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx index aab26f039..7aa08a11c 100644 --- a/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-solid-query/src/generators/queryGenerator.test.tsx @@ -85,6 +85,16 @@ describe('queryGenerator operation', async () => { }, }, }, + { + name: 'findByTagsObject', + input: '../../mocks/petStore.yaml', + path: '/pet/findByTags', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -103,6 +113,7 @@ describe('queryGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { key: (key) => key, diff --git a/packages/plugin-solid-query/src/generators/queryGenerator.tsx b/packages/plugin-solid-query/src/generators/queryGenerator.tsx index e733ca603..5a0d09017 100644 --- a/packages/plugin-solid-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-solid-query/src/generators/queryGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -94,6 +93,7 @@ export const queryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -102,12 +102,14 @@ export const queryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} /> ((options) => { override = [], parser = 'client', transformers = {}, + paramsType = 'inline', pathParamsType = 'inline', generators = [queryGenerator].filter(Boolean), query = {}, @@ -46,7 +46,8 @@ export const pluginSolidQuery = createPlugin((options) => { importPath: '@tanstack/solid-query', ...query, }, - pathParamsType, + paramsType, + pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), diff --git a/packages/plugin-solid-query/src/types.ts b/packages/plugin-solid-query/src/types.ts index c678fec87..08c4dd530 100644 --- a/packages/plugin-solid-query/src/types.ts +++ b/packages/plugin-solid-query/src/types.ts @@ -48,6 +48,13 @@ export type Options = { * Array containing override parameters to override `options` based on tags/operations/methods/paths. */ override?: Array> + /** + * How to pass your params + * - 'object' will return the params and pathParams as an object. + * - 'inline' will return the params as comma separated params. + * @default 'inline' + */ + paramsType?: 'object' | 'inline' /** * How to pass your pathParams. * - 'object' will return the pathParams as an object. @@ -81,6 +88,7 @@ type ResolvedOptions = { baseURL: string | undefined client: Required> parser: Required> + paramsType: NonNullable pathParamsType: NonNullable query: NonNullable> | false } diff --git a/packages/plugin-svelte-query/src/components/Mutation.tsx b/packages/plugin-svelte-query/src/components/Mutation.tsx index cf7b570bb..15071db7e 100644 --- a/packages/plugin-svelte-query/src/components/Mutation.tsx +++ b/packages/plugin-svelte-query/src/components/Mutation.tsx @@ -19,6 +19,7 @@ type Props = { mutationKeyName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginSvelteQuery['resolvedOptions']['paramsType'] dataReturnType: PluginSvelteQuery['resolvedOptions']['client']['dataReturnType'] pathParamsType: PluginSvelteQuery['resolvedOptions']['pathParamsType'] } @@ -67,7 +68,7 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) { }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { +export function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { const mutationKeyParams = MutationKey.getParams({ pathParamsType, typeSchemas, @@ -80,6 +81,7 @@ export function Mutation({ name, clientName, pathParamsType, dataReturnType, typ }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-svelte-query/src/components/Query.tsx b/packages/plugin-svelte-query/src/components/Query.tsx index dd679b0f7..000089a3b 100644 --- a/packages/plugin-svelte-query/src/components/Query.tsx +++ b/packages/plugin-svelte-query/src/components/Query.tsx @@ -18,24 +18,68 @@ type Props = { queryKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginSvelteQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSvelteQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginSvelteQuery['resolvedOptions']['client']['dataReturnType'] } type GetParamsProps = { + paramsType: PluginSvelteQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSvelteQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginSvelteQuery['resolvedOptions']['client']['dataReturnType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -66,7 +110,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro }) } -export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { +export function Query({ + name, + queryKeyTypeName, + queryOptionsName, + queryKeyName, + paramsType, + pathParamsType, + dataReturnType, + typeSchemas, + operation, +}: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const returnType = `CreateQueryResult<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }` const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`] @@ -76,10 +130,12 @@ export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-svelte-query/src/components/QueryOptions.tsx b/packages/plugin-svelte-query/src/components/QueryOptions.tsx index bf7394733..83cb54a58 100644 --- a/packages/plugin-svelte-query/src/components/QueryOptions.tsx +++ b/packages/plugin-svelte-query/src/components/QueryOptions.tsx @@ -14,20 +14,59 @@ type Props = { clientName: string queryKeyName: string typeSchemas: OperationSchemas + paramsType: PluginSvelteQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSvelteQuery['resolvedOptions']['pathParamsType'] } type GetParamsProps = { + paramsType: PluginSvelteQuery['resolvedOptions']['paramsType'] pathParamsType: PluginSvelteQuery['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -53,9 +92,10 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { }) } -export function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) +export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode { + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts new file mode 100644 index 000000000..93c8309e7 --- /dev/null +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/findByTagsObject.ts @@ -0,0 +1,60 @@ +import client from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, CreateBaseQueryOptions, CreateQueryResult } from "@tanstack/svelte-query"; +import { createQuery, queryOptions } from "@tanstack/svelte-query"; + + 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 + * @link /pet/findByTags + */ +async function findPetsByTags({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config }); + return findPetsByTagsQueryResponse.parse(res.data); +} + + export function findPetsByTagsQueryOptions({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTags({ headers, params }, 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 createFindPetsByTags({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = createQuery({ + ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as CreateBaseQueryOptions, + queryKey, + ...queryOptions as unknown as Omit + }) as CreateQueryResult & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} diff --git a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 0c3a7c758..81bcd76e8 100644 --- a/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-svelte-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -11,9 +11,7 @@ import { createMutation } from "@tanstack/svelte-query"; * @summary Updates a pet in the store with form data * @link /pet/:petId */ -async function updatePetWithForm({ petId }: { - petId: UpdatePetWithFormPathParams["petId"]; -}, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial> = {}) { +async function updatePetWithForm({ petId }: UpdatePetWithFormPathParams, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial> = {}) { const res = await client({ method: "POST", url: `/pet/${petId}`, params, data, ...config }); return updatePetWithFormMutationResponse.parse(res.data); } diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx index 4588ce516..6a634b88d 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.test.tsx @@ -58,6 +58,16 @@ describe('mutationGenerator operation', async () => { method: 'delete', options: {}, }, + { + name: 'deletePetObject', + input: '../../mocks/petStore.yaml', + path: '/pet/{petId}', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -76,6 +86,7 @@ describe('mutationGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/svelte-query', diff --git a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx index 07d00dd16..400567f9c 100644 --- a/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-svelte-query/src/generators/mutationGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -89,6 +88,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -99,6 +99,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} operation={operation} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} /> diff --git a/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx b/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx index 16b80ab0e..5551284db 100644 --- a/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-svelte-query/src/generators/queryGenerator.test.tsx @@ -85,6 +85,16 @@ describe('queryGenerator operation', async () => { }, }, }, + { + name: 'findByTagsObject', + input: '../../mocks/petStore.yaml', + path: '/pet/findByTags', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -103,6 +113,7 @@ describe('queryGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/svelte-query', diff --git a/packages/plugin-svelte-query/src/generators/queryGenerator.tsx b/packages/plugin-svelte-query/src/generators/queryGenerator.tsx index 9a344dd06..41c31ece7 100644 --- a/packages/plugin-svelte-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-svelte-query/src/generators/queryGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -95,6 +94,7 @@ export const queryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -103,6 +103,7 @@ export const queryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} /> ({ typeSchemas={type.schemas} pathParamsType={options.pathParamsType} operation={operation} + paramsType={options.paramsType} dataReturnType={options.client.dataReturnType} queryKeyName={queryKey.name} queryKeyTypeName={queryKey.typeName} diff --git a/packages/plugin-svelte-query/src/plugin.ts b/packages/plugin-svelte-query/src/plugin.ts index 4cd30b4c6..00d3d8d1c 100644 --- a/packages/plugin-svelte-query/src/plugin.ts +++ b/packages/plugin-svelte-query/src/plugin.ts @@ -2,7 +2,6 @@ import path from 'node:path' import { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core' import { camelCase, pascalCase } from '@kubb/core/transformers' -import { renderTemplate } from '@kubb/core/utils' import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas' import { pluginTsName } from '@kubb/plugin-ts' @@ -24,6 +23,7 @@ export const pluginSvelteQuery = createPlugin((options) => { override = [], parser = 'client', transformers = {}, + paramsType = 'inline', pathParamsType = 'inline', mutation = {}, query = {}, @@ -53,7 +53,8 @@ export const pluginSvelteQuery = createPlugin((options) => { importPath: '@tanstack/svelte-query', ...mutation, }, - pathParamsType, + paramsType, + pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), diff --git a/packages/plugin-svelte-query/src/types.ts b/packages/plugin-svelte-query/src/types.ts index 09492e1d9..de71b6fc1 100644 --- a/packages/plugin-svelte-query/src/types.ts +++ b/packages/plugin-svelte-query/src/types.ts @@ -69,6 +69,13 @@ export type Options = { * Array containing override parameters to override `options` based on tags/operations/methods/paths. */ override?: Array> + /** + * How to pass your params + * - 'object' will return the params and pathParams as an object. + * - 'inline' will return the params as comma separated params. + * @default 'inline' + */ + paramsType?: 'object' | 'inline' /** * How to pass your pathParams. * - 'object' will return the pathParams as an object. @@ -106,6 +113,7 @@ type ResolvedOptions = { baseURL: string | undefined client: Required> parser: Required> + paramsType: NonNullable pathParamsType: NonNullable query: NonNullable> | false mutation: NonNullable> | false diff --git a/packages/plugin-swr/src/components/Mutation.tsx b/packages/plugin-swr/src/components/Mutation.tsx index 01a484ef9..e1704afc9 100644 --- a/packages/plugin-swr/src/components/Mutation.tsx +++ b/packages/plugin-swr/src/components/Mutation.tsx @@ -20,6 +20,7 @@ type Props = { mutationKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginSwr['resolvedOptions']['paramsType'] dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType'] pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] } @@ -30,7 +31,7 @@ type GetParamsProps = { typeSchemas: OperationSchemas mutationKeyTypeName: string } - +// TODO add same logic as being done for react-query mutations function getParams({ pathParamsType, dataReturnType, typeSchemas, mutationKeyTypeName }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` @@ -64,13 +65,23 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas, mutationKeyTyp }) } -export function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { +export function Mutation({ + name, + clientName, + mutationKeyName, + mutationKeyTypeName, + paramsType, + pathParamsType, + dataReturnType, + typeSchemas, + operation, +}: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const generics = [ TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${mutationKeyTypeName} | null`, - typeSchemas.request?.name, + typeSchemas.request?.name, //arg: data ].filter(Boolean) const mutationKeyParams = MutationKey.getParams({ @@ -86,6 +97,7 @@ export function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeNam }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-swr/src/components/Query.tsx b/packages/plugin-swr/src/components/Query.tsx index 1db7532fa..0f41d484e 100644 --- a/packages/plugin-swr/src/components/Query.tsx +++ b/packages/plugin-swr/src/components/Query.tsx @@ -18,26 +18,71 @@ type Props = { queryKeyName: string queryKeyTypeName: string typeSchemas: OperationSchemas + paramsType: PluginSwr['resolvedOptions']['paramsType'] pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType'] operation: Operation } type GetParamsProps = { + paramsType: PluginSwr['resolvedOptions']['paramsType'] pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType'] queryKeyTypeName: string typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Parameters item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`].join(', ')}, any>>[2], + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'}, + shouldFetch?: boolean, +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -69,7 +114,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas, queryKeyTypeNa }) } -export function Query({ name, typeSchemas, queryKeyName, queryKeyTypeName, queryOptionsName, operation, dataReturnType, pathParamsType }: Props): ReactNode { +export function Query({ + name, + typeSchemas, + queryKeyName, + queryKeyTypeName, + queryOptionsName, + operation, + dataReturnType, + paramsType, + pathParamsType, +}: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`] @@ -78,6 +133,7 @@ export function Query({ name, typeSchemas, queryKeyName, queryKeyTypeName, query typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, @@ -85,6 +141,7 @@ export function Query({ name, typeSchemas, queryKeyName, queryKeyTypeName, query }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) diff --git a/packages/plugin-swr/src/components/QueryOptions.tsx b/packages/plugin-swr/src/components/QueryOptions.tsx index 0f6f3946b..eaf63fc1f 100644 --- a/packages/plugin-swr/src/components/QueryOptions.tsx +++ b/packages/plugin-swr/src/components/QueryOptions.tsx @@ -12,20 +12,59 @@ type Props = { name: string clientName: string typeSchemas: OperationSchemas + paramsType: PluginSwr['resolvedOptions']['paramsType'] pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] } type GetParamsProps = { + paramsType: PluginSwr['resolvedOptions']['paramsType'] pathParamsType: PluginSwr['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + 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, + headers: typeSchemas.headerParams?.name + ? { + type: typeSchemas.headerParams?.name, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ - pathParams: { - mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', - children: getPathParams(typeSchemas.pathParams, { typed: true }), - }, + pathParams: typeSchemas.pathParams?.name + ? { + mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + children: getPathParams(typeSchemas.pathParams, { typed: true }), + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), + } + : undefined, data: typeSchemas.request?.name ? { type: typeSchemas.request?.name, @@ -51,9 +90,10 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { }) } -export function QueryOptions({ name, clientName, typeSchemas, pathParamsType }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) +export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType }: Props): ReactNode { + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts index 0d035cb6e..b21aa4aad 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientDataReturnTypeFull.ts @@ -11,15 +11,19 @@ import type { RequestConfig, ResponseConfig } from "@kubb/plugin-client/client"; * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); return res; } - export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + export function findPetsByTagsQueryOptions({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { return { fetcher: async () => { - return findPetsByTags(params, config); + return findPetsByTags({ params }, config); }, }; } @@ -29,7 +33,9 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { +export function useFindPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, options: { query?: Parameters, FindPetsByTags400, FindPetsByTagsQueryKey | null, any>>[2]; client?: Partial; shouldFetch?: boolean; @@ -37,7 +43,7 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const queryKey = findPetsByTagsQueryKey(params); return useSWR, FindPetsByTags400, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptions(params, config), + ...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 a8b248824..197f9351d 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/clientGetImportPath.ts @@ -11,15 +11,19 @@ import type { RequestConfig } from "axios"; * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); return res.data; } - export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + export function findPetsByTagsQueryOptions({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { return { fetcher: async () => { - return findPetsByTags(params, config); + return findPetsByTags({ params }, config); }, }; } @@ -29,7 +33,9 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { +export function useFindPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, options: { query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; @@ -37,7 +43,7 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const queryKey = findPetsByTagsQueryKey(params); return useSWR(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptions(params, config), + ...findPetsByTagsQueryOptions({ params }, config), ...queryOptions }); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts index b0adb4c4d..eca89ad60 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTags.ts @@ -11,15 +11,19 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); return res.data; } - export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + export function findPetsByTagsQueryOptions({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { return { fetcher: async () => { - return findPetsByTags(params, config); + return findPetsByTags({ params }, config); }, }; } @@ -29,7 +33,9 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { +export function useFindPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, options: { query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; @@ -37,7 +43,7 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const queryKey = findPetsByTagsQueryKey(params); return useSWR(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptions(params, config), + ...findPetsByTagsQueryOptions({ params }, config), ...queryOptions }); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts new file mode 100644 index 000000000..eca89ad60 --- /dev/null +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsObject.ts @@ -0,0 +1,49 @@ +import client from "@kubb/plugin-client/client"; +import useSWR from "swr"; +import type { RequestConfig } from "@kubb/plugin-client/client"; + + 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 + * @link /pet/findByTags + */ +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); + return res.data; +} + + export function findPetsByTagsQueryOptions({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + return { + fetcher: async () => { + return findPetsByTags({ params }, 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 }: { + params?: FindPetsByTagsQueryParams; +}, options: { + query?: Parameters>[2]; + client?: Partial; + shouldFetch?: boolean; +} = {}) { + const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; + 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 b0adb4c4d..eca89ad60 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsPathParamsObject.ts @@ -11,15 +11,19 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); return res.data; } - export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + export function findPetsByTagsQueryOptions({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { return { fetcher: async () => { - return findPetsByTags(params, config); + return findPetsByTags({ params }, config); }, }; } @@ -29,7 +33,9 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { +export function useFindPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, options: { query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; @@ -37,7 +43,7 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const queryKey = findPetsByTagsQueryKey(params); return useSWR(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptions(params, config), + ...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 d531dbcf1..d0316a46c 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/findByTagsWithZod.ts @@ -11,15 +11,19 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; * @summary Finds Pets by tags * @link /pet/findByTags */ -async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partial = {}) { +async function findPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { const res = await client({ method: "GET", url: `/pet/findByTags`, params, ...config }); return findPetsByTagsQueryResponse.parse(res.data); } - export function findPetsByTagsQueryOptions(params?: FindPetsByTagsQueryParams, config: Partial = {}) { + export function findPetsByTagsQueryOptions({ params }: { + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { return { fetcher: async () => { - return findPetsByTags(params, config); + return findPetsByTags({ params }, config); }, }; } @@ -29,7 +33,9 @@ async function findPetsByTags(params?: FindPetsByTagsQueryParams, config: Partia * @summary Finds Pets by tags * @link /pet/findByTags */ -export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { +export function useFindPetsByTags({ params }: { + params?: FindPetsByTagsQueryParams; +}, options: { query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; @@ -37,7 +43,7 @@ export function useFindPetsByTags(params?: FindPetsByTagsQueryParams, options: { const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const queryKey = findPetsByTagsQueryKey(params); return useSWR(shouldFetch ? queryKey : null, { - ...findPetsByTagsQueryOptions(params, config), + ...findPetsByTagsQueryOptions({ params }, config), ...queryOptions }); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts index f55444033..7b2be1fba 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/postAsQuery.ts @@ -10,15 +10,21 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; * @summary Updates a pet in the store with form data * @link /pet/:petId */ -async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { +async function updatePetWithForm({ petId, params }: { + petId: UpdatePetWithFormPathParams["petId"]; + params?: UpdatePetWithFormQueryParams; +}, config: Partial = {}) { const res = await client({ method: "POST", url: `/pet/${petId}`, params, ...config }); return res.data; } - export function updatePetWithFormQueryOptions(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, config: Partial = {}) { + export function updatePetWithFormQueryOptions({ petId, params }: { + petId: UpdatePetWithFormPathParams["petId"]; + params?: UpdatePetWithFormQueryParams; +}, config: Partial = {}) { return { fetcher: async () => { - return updatePetWithForm(petId, params, config); + return updatePetWithForm({ petId, params }, config); }, }; } @@ -27,7 +33,10 @@ async function updatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], pa * @summary Updates a pet in the store with form data * @link /pet/:petId */ -export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"], params?: UpdatePetWithFormQueryParams, options: { +export function useUpdatePetWithForm({ petId, params }: { + petId: UpdatePetWithFormPathParams["petId"]; + params?: UpdatePetWithFormQueryParams; +}, options: { query?: Parameters>[2]; client?: Partial; shouldFetch?: boolean; @@ -35,7 +44,7 @@ export function useUpdatePetWithForm(petId: UpdatePetWithFormPathParams["petId"] const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}; const queryKey = updatePetWithFormQueryKey(petId, params); return useSWR(shouldFetch ? queryKey : null, { - ...updatePetWithFormQueryOptions(petId, params, config), + ...updatePetWithFormQueryOptions({ petId, params }, config), ...queryOptions }); } diff --git a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 57ea8f5a2..e9925915f 100644 --- a/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-swr/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -10,9 +10,7 @@ import type { RequestConfig } from "@kubb/plugin-client/client"; * @summary Updates a pet in the store with form data * @link /pet/:petId */ -async function updatePetWithForm({ petId }: { - petId: UpdatePetWithFormPathParams["petId"]; -}, params?: UpdatePetWithFormQueryParams, config: Partial = {}) { +async function updatePetWithForm({ petId }: UpdatePetWithFormPathParams, params?: UpdatePetWithFormQueryParams, config: Partial = {}) { const res = await client({ method: "POST", url: `/pet/${petId}`, params, ...config }); return res.data; } diff --git a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx index efacc08c7..3e2cfff74 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.test.tsx @@ -58,6 +58,16 @@ describe('mutationGenerator operation', async () => { method: 'delete', options: {}, }, + { + name: 'deletePetObject', + input: '../../mocks/petStore.yaml', + path: '/pet/{petId}', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -85,6 +95,7 @@ describe('mutationGenerator operation', async () => { importPath: 'swr/mutation', methods: ['post'], }, + paramsType: 'inline', pathParamsType: 'inline', baseURL: undefined, output: { diff --git a/packages/plugin-swr/src/generators/mutationGenerator.tsx b/packages/plugin-swr/src/generators/mutationGenerator.tsx index 634bd4453..a477479d4 100644 --- a/packages/plugin-swr/src/generators/mutationGenerator.tsx +++ b/packages/plugin-swr/src/generators/mutationGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -89,6 +88,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -99,6 +99,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} operation={operation} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} mutationKeyTypeName={mutationKey.typeName} diff --git a/packages/plugin-swr/src/generators/queryGenerator.test.tsx b/packages/plugin-swr/src/generators/queryGenerator.test.tsx index 1a2729dfc..7c242ce30 100644 --- a/packages/plugin-swr/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-swr/src/generators/queryGenerator.test.tsx @@ -72,6 +72,16 @@ describe('queryGenerator operation', async () => { }, }, }, + { + name: 'findByTagsObject', + input: '../../mocks/petStore.yaml', + path: '/pet/findByTags', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -98,6 +108,7 @@ describe('queryGenerator operation', async () => { importPath: 'swr/mutation', methods: ['post'], }, + paramsType: 'object', pathParamsType: 'inline', baseURL: undefined, parser: 'client', diff --git a/packages/plugin-swr/src/generators/queryGenerator.tsx b/packages/plugin-swr/src/generators/queryGenerator.tsx index a05aa47d1..0c4e93367 100644 --- a/packages/plugin-swr/src/generators/queryGenerator.tsx +++ b/packages/plugin-swr/src/generators/queryGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -94,14 +93,22 @@ export const queryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> - + ((options) => { query, mutation, client, + paramsType = 'inline', pathParamsType = 'inline', generators = [queryGenerator, mutationGenerator].filter(Boolean), } = options @@ -35,7 +35,6 @@ export const pluginSwr = createPlugin((options) => { name: pluginSwrName, options: { output, - pathParamsType, client: { importPath: '@kubb/plugin-client/client', dataReturnType: 'data', @@ -54,6 +53,8 @@ export const pluginSwr = createPlugin((options) => { ...mutation, }, parser, + paramsType, + pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, baseURL: undefined, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), diff --git a/packages/plugin-swr/src/types.ts b/packages/plugin-swr/src/types.ts index 7ee9620ea..55ede8b32 100644 --- a/packages/plugin-swr/src/types.ts +++ b/packages/plugin-swr/src/types.ts @@ -64,6 +64,13 @@ export type Options = { */ importPath?: string } + /** + * How to pass your params + * - 'object' will return the params and pathParams as an object. + * - 'inline' will return the params as comma separated params. + * @default 'inline' + */ + paramsType?: 'object' | 'inline' /** * How to pass your pathParams. * - 'object' will return the pathParams as an object. @@ -95,6 +102,7 @@ type ResolvedOptions = { parser: Required> mutation: Required> query: Required> + paramsType: NonNullable pathParamsType: NonNullable } diff --git a/packages/plugin-vue-query/src/components/InfiniteQuery.tsx b/packages/plugin-vue-query/src/components/InfiniteQuery.tsx index 3d144ab39..acd13e688 100644 --- a/packages/plugin-vue-query/src/components/InfiniteQuery.tsx +++ b/packages/plugin-vue-query/src/components/InfiniteQuery.tsx @@ -18,22 +18,72 @@ type Props = { queryKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] } type GetParamsProps = { + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + children: { + ...getPathParams(typeSchemas.pathParams, { + typed: true, + override(item) { + return { + ...item, + type: `MaybeRef<${item.type}>`, + } + }, + }), + data: typeSchemas.request?.name + ? { + type: `MaybeRef<${typeSchemas.request?.name}>`, + optional: isOptional(typeSchemas.request?.schema), + } + : undefined, + params: typeSchemas.queryParams?.name + ? { + type: `MaybeRef<${typeSchemas.queryParams?.name}>`, + optional: isOptional(typeSchemas.queryParams?.schema), + } + : undefined, + headers: typeSchemas.headerParams?.name + ? { + type: `MaybeRef<${typeSchemas.headerParams?.name}>`, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ pathParams: { mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), children: getPathParams(typeSchemas.pathParams, { typed: true, override(item) { @@ -79,6 +129,7 @@ export function InfiniteQuery({ queryKeyTypeName, queryOptionsName, queryKeyName, + paramsType, pathParamsType, dataReturnType, typeSchemas, @@ -93,10 +144,12 @@ export function InfiniteQuery({ typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-vue-query/src/components/InfiniteQueryOptions.tsx b/packages/plugin-vue-query/src/components/InfiniteQueryOptions.tsx index e46d4dce0..aa9196bb5 100644 --- a/packages/plugin-vue-query/src/components/InfiniteQueryOptions.tsx +++ b/packages/plugin-vue-query/src/components/InfiniteQueryOptions.tsx @@ -14,6 +14,7 @@ type Props = { clientName: string queryKeyName: string typeSchemas: OperationSchemas + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] initialPageParam: Infinite['initialPageParam'] @@ -22,14 +23,58 @@ type Props = { } type GetParamsProps = { + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + children: { + ...getPathParams(typeSchemas.pathParams, { + typed: true, + override(item) { + return { + ...item, + type: `MaybeRef<${item.type}>`, + } + }, + }), + data: typeSchemas.request?.name + ? { + type: `MaybeRef<${typeSchemas.request?.name}>`, + optional: isOptional(typeSchemas.request?.schema), + } + : undefined, + params: typeSchemas.queryParams?.name + ? { + type: `MaybeRef<${typeSchemas.queryParams?.name}>`, + optional: isOptional(typeSchemas.queryParams?.schema), + } + : undefined, + headers: typeSchemas.headerParams?.name + ? { + type: `MaybeRef<${typeSchemas.queryParams?.name}>`, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ pathParams: { mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), children: getPathParams(typeSchemas.pathParams, { typed: true, override(item) { @@ -71,13 +116,15 @@ export function InfiniteQueryOptions({ initialPageParam, cursorParam, typeSchemas, + paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName, }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-vue-query/src/components/Mutation.tsx b/packages/plugin-vue-query/src/components/Mutation.tsx index f35e92c66..6af61ba7f 100644 --- a/packages/plugin-vue-query/src/components/Mutation.tsx +++ b/packages/plugin-vue-query/src/components/Mutation.tsx @@ -19,6 +19,7 @@ type Props = { mutationKeyName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] } @@ -75,7 +76,7 @@ function getParams({ dataReturnType, typeSchemas }: GetParamsProps) { }) } -export function Mutation({ name, clientName, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { +export function Mutation({ name, clientName, paramsType, pathParamsType, dataReturnType, typeSchemas, operation, mutationKeyName }: Props): ReactNode { const mutationKeyParams = MutationKey.getParams({ pathParamsType, typeSchemas, @@ -88,6 +89,7 @@ export function Mutation({ name, clientName, pathParamsType, dataReturnType, typ }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-vue-query/src/components/Query.tsx b/packages/plugin-vue-query/src/components/Query.tsx index c7cba5b7b..f0a415851 100644 --- a/packages/plugin-vue-query/src/components/Query.tsx +++ b/packages/plugin-vue-query/src/components/Query.tsx @@ -3,6 +3,7 @@ import { File, Function, FunctionParams } from '@kubb/react' import { type Operation, isOptional } from '@kubb/oas' import type { OperationSchemas } from '@kubb/plugin-oas' import { getComments, getPathParams } from '@kubb/plugin-oas/utils' +import type { PluginReactQuery } from '@kubb/plugin-react-query' import type { ReactNode } from 'react' import type { PluginVueQuery } from '../types.ts' import { QueryKey } from './QueryKey.tsx' @@ -18,22 +19,72 @@ type Props = { queryKeyTypeName: string typeSchemas: OperationSchemas operation: Operation + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] } type GetParamsProps = { + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + children: { + ...getPathParams(typeSchemas.pathParams, { + typed: true, + override(item) { + return { + ...item, + type: `MaybeRef<${item.type}>`, + } + }, + }), + data: typeSchemas.request?.name + ? { + type: `MaybeRef<${typeSchemas.request?.name}>`, + optional: isOptional(typeSchemas.request?.schema), + } + : undefined, + params: typeSchemas.queryParams?.name + ? { + type: `MaybeRef<${typeSchemas.queryParams?.name}>`, + optional: isOptional(typeSchemas.queryParams?.schema), + } + : undefined, + headers: typeSchemas.headerParams?.name + ? { + type: `MaybeRef<${typeSchemas.headerParams?.name}>`, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + options: { + type: ` +{ + query?: Partial item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>, + client?: ${typeSchemas.request?.name ? `Partial>` : 'Partial'} +} +`, + default: '{}', + }, + }) + } + return FunctionParams.factory({ pathParams: { mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), children: getPathParams(typeSchemas.pathParams, { typed: true, override(item) { @@ -74,7 +125,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro }) } -export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode { +export function Query({ + name, + queryKeyTypeName, + queryOptionsName, + queryKeyName, + paramsType, + pathParamsType, + dataReturnType, + typeSchemas, + operation, +}: Props): ReactNode { const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>` const returnType = `UseQueryReturnType<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }` const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`] @@ -84,10 +145,12 @@ export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, typeSchemas, }) const queryOptionsParams = QueryOptions.getParams({ + paramsType, pathParamsType, typeSchemas, }) const params = getParams({ + paramsType, pathParamsType, dataReturnType, typeSchemas, diff --git a/packages/plugin-vue-query/src/components/QueryOptions.tsx b/packages/plugin-vue-query/src/components/QueryOptions.tsx index 011d0cba0..4be2f5ee4 100644 --- a/packages/plugin-vue-query/src/components/QueryOptions.tsx +++ b/packages/plugin-vue-query/src/components/QueryOptions.tsx @@ -6,6 +6,7 @@ import type { ReactNode } from 'react' import { isOptional } from '@kubb/oas' import { Client } from '@kubb/plugin-client/components' import type { OperationSchemas } from '@kubb/plugin-oas' +import type { PluginReactQuery } from '@kubb/plugin-react-query' import type { PluginVueQuery } from '../types.ts' import { QueryKey } from './QueryKey.tsx' @@ -14,18 +15,63 @@ type Props = { clientName: string queryKeyName: string typeSchemas: OperationSchemas + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] } type GetParamsProps = { + paramsType: PluginVueQuery['resolvedOptions']['paramsType'] pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType'] typeSchemas: OperationSchemas } -function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { +function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) { + if (paramsType === 'object') { + return FunctionParams.factory({ + data: { + mode: 'object', + children: { + ...getPathParams(typeSchemas.pathParams, { + typed: true, + override(item) { + return { + ...item, + type: `MaybeRef<${item.type}>`, + } + }, + }), + data: typeSchemas.request?.name + ? { + type: `MaybeRef<${typeSchemas.request?.name}>`, + optional: isOptional(typeSchemas.request?.schema), + } + : undefined, + params: typeSchemas.queryParams?.name + ? { + type: `MaybeRef<${typeSchemas.queryParams?.name}>`, + optional: isOptional(typeSchemas.queryParams?.schema), + } + : undefined, + headers: typeSchemas.headerParams?.name + ? { + type: `MaybeRef<${typeSchemas.queryParams?.name}>`, + optional: isOptional(typeSchemas.headerParams?.schema), + } + : undefined, + }, + }, + config: { + type: typeSchemas.request?.name ? `Partial>` : 'Partial', + default: '{}', + }, + }) + } + return FunctionParams.factory({ pathParams: { mode: pathParamsType === 'object' ? 'object' : 'inlineSpread', + type: typeSchemas.pathParams?.name, + optional: isOptional(typeSchemas.pathParams?.schema), children: getPathParams(typeSchemas.pathParams, { typed: true, override(item) { @@ -61,9 +107,10 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) { }) } -export function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props): ReactNode { - const params = getParams({ pathParamsType, typeSchemas }) +export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode { + const params = getParams({ paramsType, pathParamsType, typeSchemas }) const clientParams = Client.getParams({ + paramsType, typeSchemas, pathParamsType, }) diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts new file mode 100644 index 000000000..d6ba4bcb0 --- /dev/null +++ b/packages/plugin-vue-query/src/generators/__snapshots__/findByTagsObject.ts @@ -0,0 +1,62 @@ +import client from "@kubb/plugin-client/client"; +import type { RequestConfig } from "@kubb/plugin-client/client"; +import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query"; +import type { MaybeRef } from "vue"; +import { useQuery, queryOptions } from "@tanstack/react-query"; +import { unref } from "vue"; + + export const findPetsByTagsQueryKey = (params?: MaybeRef) => [{ 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 + * @link /pet/findByTags + */ +async function findPetsByTags({ headers, params }: { + headers: FindPetsByTagsHeaderParams; + params?: FindPetsByTagsQueryParams; +}, config: Partial = {}) { + const res = await client({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config }); + return findPetsByTagsQueryResponse.parse(res.data); +} + + export function findPetsByTagsQueryOptions({ headers, params }: { + headers: MaybeRef; + params?: MaybeRef; +}, config: Partial = {}) { + const queryKey = findPetsByTagsQueryKey(params); + return queryOptions({ + queryKey, + queryFn: async ({ signal }) => { + config.signal = signal; + return findPetsByTags(unref({ headers: unref(headers), params: 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({ headers, params }: { + headers: MaybeRef; + params?: MaybeRef; +}, options: { + query?: Partial>; + client?: Partial; +} = {}) { + const { query: queryOptions, client: config = {} } = options ?? {}; + const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params); + const query = useQuery({ + ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions, + queryKey: queryKey as QueryKey, + ...queryOptions as unknown as Omit + }) as UseQueryReturnType & { + queryKey: TQueryKey; + }; + query.queryKey = queryKey as TQueryKey; + return query; +} diff --git a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts index 1992df0a6..2540100db 100644 --- a/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +++ b/packages/plugin-vue-query/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts @@ -12,9 +12,7 @@ import { useMutation } from "@tanstack/react-query"; * @summary Updates a pet in the store with form data * @link /pet/:petId */ -async function updatePetWithForm({ petId }: { - petId: UpdatePetWithFormPathParams["petId"]; -}, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial> = {}) { +async function updatePetWithForm({ petId }: UpdatePetWithFormPathParams, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial> = {}) { const res = await client({ method: "POST", url: `/pet/${petId}`, params, data, ...config }); return updatePetWithFormMutationResponse.parse(res.data); } diff --git a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx index baca1469e..3a5a2cd9f 100644 --- a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.test.tsx @@ -54,6 +54,7 @@ describe('infiniteQueryGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx index 8dec51324..5a69bd833 100644 --- a/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/infiniteQueryGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -100,6 +99,7 @@ export const infiniteQueryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -108,6 +108,7 @@ export const infiniteQueryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} dataReturnType={options.client.dataReturnType} cursorParam={options.infinite.cursorParam} @@ -118,6 +119,7 @@ export const infiniteQueryGenerator = createReactGenerator({ name={query.name} queryOptionsName={queryOptions.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} operation={operation} dataReturnType={options.client.dataReturnType} diff --git a/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx b/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx index 92a7f4a42..9beced473 100644 --- a/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/mutationGenerator.test.tsx @@ -58,6 +58,16 @@ describe('mutationGenerator operation', async () => { method: 'delete', options: {}, }, + { + name: 'deletePetObject', + input: '../../mocks/petStore.yaml', + path: '/pet/{petId}', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -76,6 +86,7 @@ describe('mutationGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-vue-query/src/generators/mutationGenerator.tsx b/packages/plugin-vue-query/src/generators/mutationGenerator.tsx index 13765378e..abda12a22 100644 --- a/packages/plugin-vue-query/src/generators/mutationGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/mutationGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -90,6 +89,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -100,6 +100,7 @@ export const mutationGenerator = createReactGenerator({ typeSchemas={type.schemas} operation={operation} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} mutationKeyName={mutationKey.name} /> diff --git a/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx b/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx index f579f12e7..1119814a5 100644 --- a/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx +++ b/packages/plugin-vue-query/src/generators/queryGenerator.test.tsx @@ -85,6 +85,16 @@ describe('queryGenerator operation', async () => { }, }, }, + { + name: 'findByTagsObject', + input: '../../mocks/petStore.yaml', + path: '/pet/findByTags', + method: 'get', + options: { + paramsType: 'object', + pathParamsType: 'object', + }, + }, ] as const satisfies Array<{ input: string name: string @@ -103,6 +113,7 @@ describe('queryGenerator operation', async () => { }, parser: 'zod', baseURL: undefined, + paramsType: 'inline', pathParamsType: 'inline', query: { importPath: '@tanstack/react-query', diff --git a/packages/plugin-vue-query/src/generators/queryGenerator.tsx b/packages/plugin-vue-query/src/generators/queryGenerator.tsx index 239c5a0a0..1796505ba 100644 --- a/packages/plugin-vue-query/src/generators/queryGenerator.tsx +++ b/packages/plugin-vue-query/src/generators/queryGenerator.tsx @@ -1,4 +1,3 @@ -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' @@ -97,6 +96,7 @@ export const queryGenerator = createReactGenerator({ typeSchemas={type.schemas} zodSchemas={zod.schemas} dataReturnType={options.client.dataReturnType} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} parser={options.parser} /> @@ -105,12 +105,14 @@ export const queryGenerator = createReactGenerator({ clientName={client.name} queryKeyName={queryKey.name} typeSchemas={type.schemas} + paramsType={options.paramsType} pathParamsType={options.pathParamsType} /> ((options) => { parser = 'client', infinite, transformers = {}, + paramsType = 'inline', pathParamsType = 'inline', mutation = {}, query = {}, @@ -62,7 +62,8 @@ export const pluginVueQuery = createPlugin((options) => { importPath: '@tanstack/vue-query', ...mutation, }, - pathParamsType, + paramsType, + pathParamsType: paramsType === 'object' ? 'object' : pathParamsType, parser, }, pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean), diff --git a/packages/plugin-vue-query/src/types.ts b/packages/plugin-vue-query/src/types.ts index 5359b7f30..60120bc18 100644 --- a/packages/plugin-vue-query/src/types.ts +++ b/packages/plugin-vue-query/src/types.ts @@ -85,6 +85,13 @@ export type Options = { * Array containing override parameters to override `options` based on tags/operations/methods/paths. */ override?: Array> + /** + * How to pass your params + * - 'object' will return the params and pathParams as an object. + * - 'inline' will return the params as comma separated params. + * @default 'inline' + */ + paramsType?: 'object' | 'inline' /** * How to pass your pathParams. * - 'object' will return the pathParams as an object. @@ -126,6 +133,7 @@ type ResolvedOptions = { baseURL: string | undefined client: Required> parser: Required> + paramsType: NonNullable pathParamsType: NonNullable /** * Only used of infinite diff --git a/packages/react/package.json b/packages/react/package.json index 98edad041..60e63a483 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -86,7 +86,7 @@ "@kubb/fs": "workspace:*", "@kubb/parser-ts": "workspace:*", "auto-bind": "^5.0.1", - "execa": "^9.5.0", + "execa": "^9.5.1", "natural-orderby": "^4.0.0", "react": "^18.3.1", "react-devtools-core": "^5.3.2", diff --git a/packages/react/src/utils/getFunctionParams.ts b/packages/react/src/utils/getFunctionParams.ts index 2ebb1c4da..7383b8929 100644 --- a/packages/react/src/utils/getFunctionParams.ts +++ b/packages/react/src/utils/getFunctionParams.ts @@ -64,7 +64,7 @@ function order(items: Array<[key: string, item?: ParamItem]>) { ) } -function parseChild(key: string, item: ParamItem, options: Options): string[] { +function parseChild(key: string, item: ParamItem, options: Options): string | null { // @ts-ignore const entries = order(Object.entries(item.children)) @@ -75,18 +75,40 @@ function parseChild(key: string, item: ParamItem, options: Options): string[] { entries.forEach(([key, entryItem]) => { if (entryItem) { - names.push(...parseItem(key, { ...entryItem, type: undefined }, options)) + const name = parseItem(key, { ...entryItem, type: undefined }, options) + if (entryItem.children) { + const subTypes = Object.entries(entryItem.children) + .map(([key]) => { + return key + }) + .join(', ') + + if (subTypes) { + names.push(`${name}: { ${subTypes} }`) + } else { + names.push(name) + } + } else { + if (options.type === 'call' && options.transformName) { + names.push(`${key}: ${name}`) + } else { + names.push(name) + } + } if (entries.some(([_key, item]) => item?.type)) { - // @ts-ignore - types.push(...parseItem(key, { ...entryItem, default: undefined }, options)) + types.push(parseItem(key, { ...entryItem, default: undefined }, options)) } } }) - const name = item.mode === 'inline' ? key : names.length ? `{ ${names.join(', ')} }` : '' + const name = item.mode === 'inline' ? key : names.length ? `{ ${names.join(', ')} }` : undefined const type = item.type ? item.type : types.length ? `{ ${types.join('; ')} }` : undefined + if (!name) { + return null + } + return parseItem( name, { @@ -98,8 +120,8 @@ function parseChild(key: string, item: ParamItem, options: Options): string[] { ) } -function parseItem(name: string, item: ParamItem, options: Options): string[] { - const acc = [] +function parseItem(name: string, item: ParamItem, options: Options): string { + const acc: string[] = [] const transformedName = options.transformName ? options.transformName(name) : name const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type @@ -119,7 +141,7 @@ function parseItem(name: string, item: ParamItem, options: Options): string[] { acc.push(transformedName) } - return acc + return acc[0] as string } export function getFunctionParams(params: Params, options: Options): string { @@ -136,18 +158,21 @@ export function getFunctionParams(params: Params, options: Options): string { return acc } - if (item.mode === 'inlineSpread' && item.children) { + if (item.mode === 'inlineSpread') { return [...acc, getFunctionParams(item.children, options)] } const parsedItem = parseChild(key, item, options) + if (!parsedItem) { + return acc + } - return [...acc, ...parsedItem] + return [...acc, parsedItem] } const parsedItem = parseItem(key, item, options) - return [...acc, ...parsedItem] + return [...acc, parsedItem] }, [] as string[]) .join(', ') } diff --git a/packages/unplugin-kubb/package.json b/packages/unplugin-kubb/package.json index 08356b1d5..0828587f0 100644 --- a/packages/unplugin-kubb/package.json +++ b/packages/unplugin-kubb/package.json @@ -112,9 +112,9 @@ "@kubb/core": "workspace:*", "@nuxt/kit": "^3.13.2", "@nuxt/schema": "^3.13.2", - "@types/node": "^20.17.1", + "@types/node": "^20.17.3", "rimraf": "^5.0.10", - "rollup": "^4.24.2", + "rollup": "^4.24.3", "tsup": "^8.3.5", "typescript": "^5.6.3", "vite": "^5.4.10", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f5d33b1ab..9d1679f88 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,8 +32,8 @@ importers: specifier: workspace:* version: link:packages/config-ts '@types/node': - specifier: ^20.17.1 - version: 20.17.1 + specifier: ^20.17.3 + version: 20.17.3 '@vitest/coverage-v8': specifier: ^2.1.4 version: 2.1.4(vitest@2.1.4) @@ -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.17.1)(typescript@5.6.3) + version: 10.9.2(@swc/core@1.7.22)(@types/node@20.17.3)(typescript@5.6.3) turbo: specifier: ^2.2.3 version: 2.2.3 @@ -57,10 +57,10 @@ importers: version: 5.6.3 vite-tsconfig-paths: specifier: ^5.0.1 - version: 5.0.1(typescript@5.6.3)(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1)) + version: 5.0.1(typescript@5.6.3)(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1)) vitest: specifier: ^2.1.4 - version: 2.1.4(@types/node@20.17.1)(@vitest/ui@2.1.4)(msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3))(terser@5.31.1) + version: 2.1.4(@types/node@20.17.3)(@vitest/ui@2.1.4)(msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3))(terser@5.31.1) docs: dependencies: @@ -74,8 +74,8 @@ importers: specifier: ^8.0.0 version: 8.0.0 vitepress: - specifier: ^1.4.1 - version: 1.4.1(@algolia/client-search@4.24.0)(@types/node@20.17.1)(@types/react@18.3.12)(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.3) + specifier: ^1.4.2 + version: 1.4.2(@algolia/client-search@4.24.0)(@types/node@20.17.3)(@types/react@18.3.12)(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.3) vitepress-plugin-group-icons: specifier: ^1.3.0 version: 1.3.0 @@ -129,8 +129,8 @@ importers: specifier: ^11.2.1 version: 11.2.1(puppeteer@23.4.1(bufferutil@4.0.8)(typescript@5.6.3)) '@types/node': - specifier: ^20.17.1 - version: 20.17.1 + specifier: ^20.17.3 + version: 20.17.3 '@types/react': specifier: ^18.3.12 version: 18.3.12 @@ -145,7 +145,7 @@ importers: version: link:../packages/unplugin-kubb vite: specifier: ^5.4.10 - version: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + version: 5.4.10(@types/node@20.17.3)(terser@5.31.1) e2e: dependencies: @@ -201,8 +201,8 @@ importers: specifier: ^1.7.7 version: 1.7.7 msw: - specifier: ^2.5.2 - version: 2.5.2(@types/node@20.17.1)(typescript@5.6.3) + specifier: ^2.6.0 + version: 2.6.0(@types/node@20.17.3)(typescript@5.6.3) react: specifier: ^18.3.1 version: 18.3.1 @@ -217,7 +217,7 @@ importers: version: 2.2.5(react@18.3.1) tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) vue: specifier: ^3.5.12 version: 3.5.12(typescript@5.6.3) @@ -295,8 +295,8 @@ importers: specifier: ^1.7.7 version: 1.7.7 msw: - specifier: ^2.5.2 - version: 2.5.2(@types/node@20.17.1)(typescript@5.6.3) + specifier: ^2.6.0 + version: 2.6.0(@types/node@20.17.3)(typescript@5.6.3) react: specifier: ^18.3.1 version: 18.3.1 @@ -321,7 +321,7 @@ importers: version: link:../../packages/config-ts tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -361,7 +361,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -400,7 +400,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) devDependencies: '@kubb/config-ts': specifier: workspace:* @@ -435,7 +435,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -475,7 +475,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -508,16 +508,16 @@ importers: version: link:../../packages/plugin-ts '@mswjs/http-middleware': specifier: ^0.9.2 - version: 0.9.2(msw@2.5.2(@types/node@20.17.1)(typescript@5.2.2)) + version: 0.9.2(msw@2.6.0(@types/node@20.17.3)(typescript@5.2.2)) msw: - specifier: ^2.5.2 - version: 2.5.2(@types/node@20.17.1)(typescript@5.2.2) + specifier: ^2.6.0 + version: 2.6.0(@types/node@20.17.3)(typescript@5.2.2) react: specifier: ^18.3.1 version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1) devDependencies: '@kubb/config-ts': specifier: workspace:* @@ -579,19 +579,19 @@ importers: version: 18.3.1 '@vitejs/plugin-react': specifier: ^4.3.3 - version: 4.3.3(vite@4.5.5(@types/node@20.17.1)(terser@5.31.1)) + version: 4.3.3(vite@4.5.5(@types/node@20.17.3)(terser@5.31.1)) msw: specifier: ^1.3.5 version: 1.3.5(typescript@5.6.3) tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 vite: specifier: ^4.5.5 - version: 4.5.5(@types/node@20.17.1)(terser@5.31.1) + version: 4.5.5(@types/node@20.17.3)(terser@5.31.1) examples/simple-single: dependencies: @@ -630,7 +630,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) zod: specifier: ^3.23.8 version: 3.23.8 @@ -669,7 +669,7 @@ importers: version: 1.9.3 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) devDependencies: typescript: specifier: ^5.6.3 @@ -709,7 +709,7 @@ importers: version: 3.59.2 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) devDependencies: typescript: specifier: ^5.6.3 @@ -749,7 +749,7 @@ importers: version: 2.2.5(react@18.3.1) tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) examples/typescript: dependencies: @@ -773,7 +773,7 @@ importers: version: 1.7.7 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) devDependencies: typescript: specifier: ^5.6.3 @@ -817,19 +817,19 @@ importers: devDependencies: '@vitejs/plugin-vue': specifier: ^4.6.2 - version: 4.6.2(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3)) + version: 4.6.2(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3)) msw: specifier: ^1.3.5 version: 1.3.5(typescript@5.6.3) tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 vite: specifier: ^5.4.10 - version: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + version: 5.4.10(@types/node@20.17.3)(terser@5.31.1) examples/zod: dependencies: @@ -856,7 +856,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) zod: specifier: ^3.23.8 version: 3.23.8 @@ -889,8 +889,8 @@ importers: specifier: ^9.0.0 version: 9.0.0(typescript@5.6.3) execa: - specifier: ^9.5.0 - version: 9.5.0 + specifier: ^9.5.1 + version: 9.5.1 jiti: specifier: ^2.3.3 version: 2.3.3 @@ -923,8 +923,8 @@ importers: specifier: ^3.11.6 version: 3.11.6 '@types/node': - specifier: ^20.17.1 - version: 20.17.1 + specifier: ^20.17.3 + version: 20.17.3 '@types/semver': specifier: ^7.5.8 version: 7.5.8 @@ -933,7 +933,7 @@ importers: version: 0.5.21 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -950,17 +950,17 @@ importers: dependencies: '@microsoft/api-extractor': specifier: ^7.47.11 - version: 7.47.11(@types/node@20.17.1) + version: 7.47.11(@types/node@20.17.3) devDependencies: '@kubb/config-ts': specifier: workspace:* version: link:../config-ts '@types/node': - specifier: ^20.17.1 - version: 20.17.1 + specifier: ^20.17.3 + version: 20.17.3 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) packages/core: dependencies: @@ -1024,7 +1024,7 @@ importers: version: 1.2.0 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1049,7 +1049,7 @@ importers: version: 11.0.4 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) packages/kubb: dependencies: @@ -1067,11 +1067,11 @@ importers: specifier: workspace:* version: link:../config-tsup '@types/node': - specifier: ^20.17.1 - version: 20.17.1 + specifier: ^20.17.3 + version: 20.17.3 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1126,7 +1126,7 @@ importers: version: 0.20.0 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1148,7 +1148,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) packages/plugin-client: dependencies: @@ -1185,7 +1185,7 @@ importers: version: 1.7.7 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1219,7 +1219,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1262,7 +1262,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1302,7 +1302,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1345,7 +1345,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1397,7 +1397,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1440,7 +1440,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1483,7 +1483,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1529,7 +1529,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1569,7 +1569,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1612,7 +1612,7 @@ importers: version: 18.3.1 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1649,7 +1649,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) packages/react: dependencies: @@ -1666,8 +1666,8 @@ importers: specifier: ^5.0.1 version: 5.0.1 execa: - specifier: ^9.5.0 - version: 9.5.0 + specifier: ^9.5.1 + version: 9.5.1 natural-orderby: specifier: ^4.0.0 version: 4.0.0 @@ -1707,7 +1707,7 @@ importers: version: 8.5.12 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1722,7 +1722,7 @@ importers: version: link:../config-tsup tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -1750,28 +1750,28 @@ importers: version: link:../core '@nuxt/kit': specifier: ^3.13.2 - version: 3.13.2(magicast@0.3.5)(rollup@4.24.2)(webpack-sources@3.2.3) + version: 3.13.2(magicast@0.3.5)(rollup@4.24.3)(webpack-sources@3.2.3) '@nuxt/schema': specifier: ^3.13.2 - version: 3.13.2(rollup@4.24.2)(webpack-sources@3.2.3) + version: 3.13.2(rollup@4.24.3)(webpack-sources@3.2.3) '@types/node': - specifier: ^20.17.1 - version: 20.17.1 + specifier: ^20.17.3 + version: 20.17.3 rimraf: specifier: ^5.0.10 version: 5.0.10 rollup: - specifier: ^4.24.2 - version: 4.24.2 + specifier: ^4.24.3 + version: 4.24.3 tsup: specifier: ^8.3.5 - version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) + version: 8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1) typescript: specifier: ^5.6.3 version: 5.6.3 vite: specifier: ^5.4.10 - version: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + version: 5.4.10(@types/node@20.17.3)(terser@5.31.1) webpack: specifier: ^5.95.0 version: 5.95.0(@swc/core@1.7.22)(esbuild@0.23.1) @@ -2951,6 +2951,11 @@ packages: cpu: [arm] os: [android] + '@rollup/rollup-android-arm-eabi@4.24.3': + resolution: {integrity: sha512-ufb2CH2KfBWPJok95frEZZ82LtDl0A6QKTa8MoM+cWwDZvVGl5/jNb79pIhRvAalUu+7LD91VYR0nwRD799HkQ==} + cpu: [arm] + os: [android] + '@rollup/rollup-android-arm64@4.24.0': resolution: {integrity: sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==} cpu: [arm64] @@ -2961,6 +2966,11 @@ packages: cpu: [arm64] os: [android] + '@rollup/rollup-android-arm64@4.24.3': + resolution: {integrity: sha512-iAHpft/eQk9vkWIV5t22V77d90CRofgR2006UiCjHcHJFVI1E0oBkQIAbz+pLtthFw3hWEmVB4ilxGyBf48i2Q==} + cpu: [arm64] + os: [android] + '@rollup/rollup-darwin-arm64@4.24.0': resolution: {integrity: sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==} cpu: [arm64] @@ -2971,6 +2981,11 @@ packages: cpu: [arm64] os: [darwin] + '@rollup/rollup-darwin-arm64@4.24.3': + resolution: {integrity: sha512-QPW2YmkWLlvqmOa2OwrfqLJqkHm7kJCIMq9kOz40Zo9Ipi40kf9ONG5Sz76zszrmIZZ4hgRIkez69YnTHgEz1w==} + cpu: [arm64] + os: [darwin] + '@rollup/rollup-darwin-x64@4.24.0': resolution: {integrity: sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==} cpu: [x64] @@ -2981,16 +2996,31 @@ packages: cpu: [x64] os: [darwin] + '@rollup/rollup-darwin-x64@4.24.3': + resolution: {integrity: sha512-KO0pN5x3+uZm1ZXeIfDqwcvnQ9UEGN8JX5ufhmgH5Lz4ujjZMAnxQygZAVGemFWn+ZZC0FQopruV4lqmGMshow==} + cpu: [x64] + os: [darwin] + '@rollup/rollup-freebsd-arm64@4.24.2': resolution: {integrity: sha512-1YWOpFcGuC6iGAS4EI+o3BV2/6S0H+m9kFOIlyFtp4xIX5rjSnL3AwbTBxROX0c8yWtiWM7ZI6mEPTI7VkSpZw==} cpu: [arm64] os: [freebsd] + '@rollup/rollup-freebsd-arm64@4.24.3': + resolution: {integrity: sha512-CsC+ZdIiZCZbBI+aRlWpYJMSWvVssPuWqrDy/zi9YfnatKKSLFCe6fjna1grHuo/nVaHG+kiglpRhyBQYRTK4A==} + cpu: [arm64] + os: [freebsd] + '@rollup/rollup-freebsd-x64@4.24.2': resolution: {integrity: sha512-3qAqTewYrCdnOD9Gl9yvPoAoFAVmPJsBvleabvx4bnu1Kt6DrB2OALeRVag7BdWGWLhP1yooeMLEi6r2nYSOjg==} cpu: [x64] os: [freebsd] + '@rollup/rollup-freebsd-x64@4.24.3': + resolution: {integrity: sha512-F0nqiLThcfKvRQhZEzMIXOQG4EeX61im61VYL1jo4eBxv4aZRmpin6crnBJQ/nWnCsjH5F6J3W6Stdm0mBNqBg==} + cpu: [x64] + os: [freebsd] + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': resolution: {integrity: sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==} cpu: [arm] @@ -3001,6 +3031,11 @@ packages: cpu: [arm] os: [linux] + '@rollup/rollup-linux-arm-gnueabihf@4.24.3': + resolution: {integrity: sha512-KRSFHyE/RdxQ1CSeOIBVIAxStFC/hnBgVcaiCkQaVC+EYDtTe4X7z5tBkFyRoBgUGtB6Xg6t9t2kulnX6wJc6A==} + cpu: [arm] + os: [linux] + '@rollup/rollup-linux-arm-musleabihf@4.24.0': resolution: {integrity: sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==} cpu: [arm] @@ -3011,6 +3046,11 @@ packages: cpu: [arm] os: [linux] + '@rollup/rollup-linux-arm-musleabihf@4.24.3': + resolution: {integrity: sha512-h6Q8MT+e05zP5BxEKz0vi0DhthLdrNEnspdLzkoFqGwnmOzakEHSlXfVyA4HJ322QtFy7biUAVFPvIDEDQa6rw==} + cpu: [arm] + os: [linux] + '@rollup/rollup-linux-arm64-gnu@4.24.0': resolution: {integrity: sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==} cpu: [arm64] @@ -3021,6 +3061,11 @@ packages: cpu: [arm64] os: [linux] + '@rollup/rollup-linux-arm64-gnu@4.24.3': + resolution: {integrity: sha512-fKElSyXhXIJ9pqiYRqisfirIo2Z5pTTve5K438URf08fsypXrEkVmShkSfM8GJ1aUyvjakT+fn2W7Czlpd/0FQ==} + cpu: [arm64] + os: [linux] + '@rollup/rollup-linux-arm64-musl@4.24.0': resolution: {integrity: sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==} cpu: [arm64] @@ -3031,6 +3076,11 @@ packages: cpu: [arm64] os: [linux] + '@rollup/rollup-linux-arm64-musl@4.24.3': + resolution: {integrity: sha512-YlddZSUk8G0px9/+V9PVilVDC6ydMz7WquxozToozSnfFK6wa6ne1ATUjUvjin09jp34p84milxlY5ikueoenw==} + cpu: [arm64] + os: [linux] + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': resolution: {integrity: sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==} cpu: [ppc64] @@ -3041,6 +3091,11 @@ packages: cpu: [ppc64] os: [linux] + '@rollup/rollup-linux-powerpc64le-gnu@4.24.3': + resolution: {integrity: sha512-yNaWw+GAO8JjVx3s3cMeG5Esz1cKVzz8PkTJSfYzE5u7A+NvGmbVFEHP+BikTIyYWuz0+DX9kaA3pH9Sqxp69g==} + cpu: [ppc64] + os: [linux] + '@rollup/rollup-linux-riscv64-gnu@4.24.0': resolution: {integrity: sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==} cpu: [riscv64] @@ -3051,6 +3106,11 @@ packages: cpu: [riscv64] os: [linux] + '@rollup/rollup-linux-riscv64-gnu@4.24.3': + resolution: {integrity: sha512-lWKNQfsbpv14ZCtM/HkjCTm4oWTKTfxPmr7iPfp3AHSqyoTz5AgLemYkWLwOBWc+XxBbrU9SCokZP0WlBZM9lA==} + cpu: [riscv64] + os: [linux] + '@rollup/rollup-linux-s390x-gnu@4.24.0': resolution: {integrity: sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==} cpu: [s390x] @@ -3061,6 +3121,11 @@ packages: cpu: [s390x] os: [linux] + '@rollup/rollup-linux-s390x-gnu@4.24.3': + resolution: {integrity: sha512-HoojGXTC2CgCcq0Woc/dn12wQUlkNyfH0I1ABK4Ni9YXyFQa86Fkt2Q0nqgLfbhkyfQ6003i3qQk9pLh/SpAYw==} + cpu: [s390x] + os: [linux] + '@rollup/rollup-linux-x64-gnu@4.24.0': resolution: {integrity: sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==} cpu: [x64] @@ -3071,6 +3136,11 @@ packages: cpu: [x64] os: [linux] + '@rollup/rollup-linux-x64-gnu@4.24.3': + resolution: {integrity: sha512-mnEOh4iE4USSccBOtcrjF5nj+5/zm6NcNhbSEfR3Ot0pxBwvEn5QVUXcuOwwPkapDtGZ6pT02xLoPaNv06w7KQ==} + cpu: [x64] + os: [linux] + '@rollup/rollup-linux-x64-musl@4.24.0': resolution: {integrity: sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==} cpu: [x64] @@ -3081,6 +3151,11 @@ packages: cpu: [x64] os: [linux] + '@rollup/rollup-linux-x64-musl@4.24.3': + resolution: {integrity: sha512-rMTzawBPimBQkG9NKpNHvquIUTQPzrnPxPbCY1Xt+mFkW7pshvyIS5kYgcf74goxXOQk0CP3EoOC1zcEezKXhw==} + cpu: [x64] + os: [linux] + '@rollup/rollup-win32-arm64-msvc@4.24.0': resolution: {integrity: sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==} cpu: [arm64] @@ -3091,6 +3166,11 @@ packages: cpu: [arm64] os: [win32] + '@rollup/rollup-win32-arm64-msvc@4.24.3': + resolution: {integrity: sha512-2lg1CE305xNvnH3SyiKwPVsTVLCg4TmNCF1z7PSHX2uZY2VbUpdkgAllVoISD7JO7zu+YynpWNSKAtOrX3AiuA==} + cpu: [arm64] + os: [win32] + '@rollup/rollup-win32-ia32-msvc@4.24.0': resolution: {integrity: sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==} cpu: [ia32] @@ -3101,6 +3181,11 @@ packages: cpu: [ia32] os: [win32] + '@rollup/rollup-win32-ia32-msvc@4.24.3': + resolution: {integrity: sha512-9SjYp1sPyxJsPWuhOCX6F4jUMXGbVVd5obVpoVEi8ClZqo52ViZewA6eFz85y8ezuOA+uJMP5A5zo6Oz4S5rVQ==} + cpu: [ia32] + os: [win32] + '@rollup/rollup-win32-x64-msvc@4.24.0': resolution: {integrity: sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==} cpu: [x64] @@ -3111,6 +3196,11 @@ packages: cpu: [x64] os: [win32] + '@rollup/rollup-win32-x64-msvc@4.24.3': + resolution: {integrity: sha512-HGZgRFFYrMrP3TJlq58nR1xy8zHKId25vhmm5S9jETEfDf6xybPxsavFTJaufe2zgOGYJBskGlj49CwtEuFhWQ==} + cpu: [x64] + os: [win32] + '@rushstack/node-core-library@5.9.0': resolution: {integrity: sha512-MMsshEWkTbXqxqFxD4gcIUWQOCeBChlGczdZbHfqmNZQFLHB3yWxDFSMHFUdu2/OB9NUk7Awn5qRL+rws4HQNg==} peerDependencies: @@ -3136,33 +3226,21 @@ packages: '@sec-ant/readable-stream@0.4.1': resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} - '@shikijs/core@1.22.0': - resolution: {integrity: sha512-S8sMe4q71TJAW+qG93s5VaiihujRK6rqDFqBnxqvga/3LvqHEnxqBIOPkt//IdXVtHkQWKu4nOQNk0uBGicU7Q==} - '@shikijs/core@1.22.2': resolution: {integrity: sha512-bvIQcd8BEeR1yFvOYv6HDiyta2FFVePbzeowf5pPS1avczrPK+cjmaxxh0nx5QzbON7+Sv0sQfQVciO7bN72sg==} - '@shikijs/engine-javascript@1.22.0': - resolution: {integrity: sha512-AeEtF4Gcck2dwBqCFUKYfsCq0s+eEbCEbkUuFou53NZ0sTGnJnJ/05KHQFZxpii5HMXbocV9URYVowOP2wH5kw==} - '@shikijs/engine-javascript@1.22.2': resolution: {integrity: sha512-iOvql09ql6m+3d1vtvP8fLCVCK7BQD1pJFmHIECsujB0V32BJ0Ab6hxk1ewVSMFA58FI0pR2Had9BKZdyQrxTw==} - '@shikijs/engine-oniguruma@1.22.0': - resolution: {integrity: sha512-5iBVjhu/DYs1HB0BKsRRFipRrD7rqjxlWTj4F2Pf+nQSPqc3kcyqFFeZXnBMzDf0HdqaFVvhDRAGiYNvyLP+Mw==} - '@shikijs/engine-oniguruma@1.22.2': resolution: {integrity: sha512-GIZPAGzQOy56mGvWMoZRPggn0dTlBf1gutV5TdceLCZlFNqWmuc7u+CzD0Gd9vQUTgLbrt0KLzz6FNprqYAxlA==} - '@shikijs/transformers@1.22.0': - resolution: {integrity: sha512-k7iMOYuGQA62KwAuJOQBgH2IQb5vP8uiB3lMvAMGUgAMMurePOx3Z7oNqJdcpxqZP6I9cc7nc4DNqSKduCxmdg==} + '@shikijs/transformers@1.22.2': + resolution: {integrity: sha512-8f78OiBa6pZDoZ53lYTmuvpFPlWtevn23bzG+azpPVvZg7ITax57o/K3TC91eYL3OMJOO0onPbgnQyZjRos8XQ==} '@shikijs/twoslash@1.22.2': resolution: {integrity: sha512-4R3A7aH/toZgtlveXHKk01nIsvn8hjAfPJ1aT550zcV4qK6vK/tfaEyYtaljOaY1wig2l5+8sKjNSEz3PcSiEw==} - '@shikijs/types@1.22.0': - resolution: {integrity: sha512-Fw/Nr7FGFhlQqHfxzZY8Cwtwk5E9nKDUgeLjZgt3UuhcM3yJR9xj3ZGNravZZok8XmEZMiYkSMTPlPkULB8nww==} - '@shikijs/types@1.22.2': resolution: {integrity: sha512-NCWDa6LGZqTuzjsGfXOBWfjS/fDIbDdmVDug+7ykVe1IKT4c1gakrvlfFYp5NhAXH/lyqLM8wsAPo5wNy73Feg==} @@ -3412,8 +3490,8 @@ packages: '@types/node@20.12.14': resolution: {integrity: sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg==} - '@types/node@20.17.1': - resolution: {integrity: sha512-j2VlPv1NnwPJbaCNv69FO/1z4lId0QmGvpT41YxitRtWlg96g/j8qcv2RKsLKe2F6OJgyXhupN1Xo17b2m139Q==} + '@types/node@20.17.3': + resolution: {integrity: sha512-tSQrmKKatLDGnG92h40GD7FzUt0MjahaHwOME4VAFeeA/Xopayq5qLyQRy7Jg/pjgKIFBXuKcGhJo+UdYG55jQ==} '@types/object-hash@3.0.6': resolution: {integrity: sha512-fOBV8C1FIu2ELinoILQ+ApxcUKz4ngq+IWUYrxSGjXzzjUALijilampwkMgEtJ+h2njAW3pi853QpzNVCHB73w==} @@ -3576,14 +3654,14 @@ packages: '@vue/devtools-api@6.6.3': resolution: {integrity: sha512-0MiMsFma/HqA6g3KLKn+AGpL1kgKhFWszC9U29NfpWK5LE7bjeXxySWJrOJ77hBz+TBrBQ7o4QJqbPbqbs8rJw==} - '@vue/devtools-api@7.4.6': - resolution: {integrity: sha512-XipBV5k0/IfTr0sNBDTg7OBUCp51cYMMXyPxLXJZ4K/wmUeMqt8cVdr2ZZGOFq+si/jTyCYnNxeKoyev5DOUUA==} + '@vue/devtools-api@7.5.6': + resolution: {integrity: sha512-/7ov2ioU80fYcYENEJXp88l88gX1PJCGJdMtQmUV3VQmGgQvKrpeUoPWgkpXPkUxmAquh6PZnVtXeDpTX5mmLg==} - '@vue/devtools-kit@7.4.6': - resolution: {integrity: sha512-NbYBwPWgEic1AOd9bWExz9weBzFdjiIfov0yRn4DrRfR+EQJCI9dn4I0XS7IxYGdkmUJi8mFW42LLk18WsGqew==} + '@vue/devtools-kit@7.5.6': + resolution: {integrity: sha512-44qr4/l9BsNP5hKETucueP8SKkyDZBHEurV4pQnRWs906OG9f2aYWhk4vL+27tsB4ZoWJM2h3RLhygzeeKZzWg==} - '@vue/devtools-shared@7.4.6': - resolution: {integrity: sha512-rPeSBzElnHYMB05Cc056BQiJpgocQjY8XVulgni+O9a9Gr9tNXgPteSzFFD+fT/iWMxNuUgGKs9CuW5DZewfIg==} + '@vue/devtools-shared@7.5.6': + resolution: {integrity: sha512-5iq/BF6f05JTcC7J/1DTUm4CpyVVB4KiyLAo/fDcoyWR7EulharWQVbr6W7ek5lO23f5mbnJ+adA5tfFTJt6Sw==} '@vue/language-core@2.1.6': resolution: {integrity: sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg==} @@ -3909,8 +3987,8 @@ packages: resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} engines: {node: '>=8'} - birpc@0.2.17: - resolution: {integrity: sha512-+hkTxhot+dWsLpp3gia5AkVHIsKlZybNT5gIYiDlNzJrmYPcTM9k5/w2uaj3IPpd7LlEYpmCj4Jj1nC41VhDFg==} + birpc@0.2.19: + resolution: {integrity: sha512-5WeXXAvTmitV1RqJFppT5QtUiz2p1mRSYU000Jkft5ZUCLJIk4uQriYNO50HknxKwM6jd8utNc66K1qGIwwWBQ==} bl@4.1.0: resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==} @@ -4753,8 +4831,8 @@ packages: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} - execa@9.5.0: - resolution: {integrity: sha512-t7vvYt+oKnMbF3O+S5+HkylsPrsUatwJSe4Cv+4017R0MCySjECxnVJ2eyDXVD/Xpj5H29YzyYn6eEpugG7GJA==} + execa@9.5.1: + resolution: {integrity: sha512-QY5PPtSonnGwhhHDNI7+3RvY285c7iuJFFB+lU+oEzMY/gEGJ808owqJsrr8Otd1E/x07po1LkUBmdAc5duPAg==} engines: {node: ^18.19.0 || >=20.5.0} expect-type@0.20.0: @@ -5853,8 +5931,8 @@ packages: typescript: optional: true - msw@2.5.2: - resolution: {integrity: sha512-eBsFgU30NYtrfC62XzS1rdAzFK+Br0zKU4ORqD9Qliq86362DWZyPiD6FLfMgy0Ktik83DPTXmqPMz2bqwmJdA==} + msw@2.6.0: + resolution: {integrity: sha512-n3tx2w0MZ3H4pxY0ozrQ4sNPzK/dGtlr2cIIyuEsgq2Bhy4wvcW6ZH2w/gXM9+MEUY6HC1fWhqtcXDxVZr5Jxw==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -6536,6 +6614,11 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + rollup@4.24.3: + resolution: {integrity: sha512-HBW896xR5HGmoksbi3JBDtmVzWiPAYqp7wip50hjQ67JbDz61nyoMPdqu1DvVW9asYb2M65Z20ZHsyJCMqMyDg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + roughjs@4.6.6: resolution: {integrity: sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==} @@ -6659,9 +6742,6 @@ packages: shell-quote@1.8.1: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} - shiki@1.22.0: - resolution: {integrity: sha512-/t5LlhNs+UOKQCYBtl5ZsH/Vclz73GIqT2yQsCBygr8L/ppTdmpL4w3kPLoZJbMKVWtoG77Ue1feOjZfDxvMkw==} - shiki@1.22.2: resolution: {integrity: sha512-3IZau0NdGKXhH2bBlUk4w1IHNxPh6A5B2sUpyY+8utLu2j/h1QpFkAaUA1bAMxOWWGtTWcAh531vnS4NJKS/lA==} @@ -7409,8 +7489,8 @@ packages: vitepress-plugin-group-icons@1.3.0: resolution: {integrity: sha512-E6Up5HyWh0gxmy2v1v1VVzQpL9UOZuHgoqOmSNBMTRv2rSwg6nk8MeIiJD0tJ0xtWrY5dwG69ENZPyFoD+fVoA==} - vitepress@1.4.1: - resolution: {integrity: sha512-C2rQ7PMlDVqgsaHOa0uJtgGGWaGv74QMaGL62lxKbtFkYtosJB5HAfZ8+pEbfzzvLemYaYwaiQdFLBlexK2sFw==} + vitepress@1.4.2: + resolution: {integrity: sha512-10v92Lqx0N4r7YC3cQLBvu+gRS2rHviE7vgdKiwlupUGfSWkyiQDqYccxM5iPStDGSi1Brnec1lf+lmhaQcZXw==} hasBin: true peerDependencies: markdown-it-mathjax3: ^4 @@ -8505,17 +8585,17 @@ snapshots: transitivePeerDependencies: - supports-color - '@inquirer/confirm@5.0.0(@types/node@20.17.1)': + '@inquirer/confirm@5.0.0(@types/node@20.17.3)': dependencies: - '@inquirer/core': 10.0.0(@types/node@20.17.1) - '@inquirer/type': 3.0.0(@types/node@20.17.1) + '@inquirer/core': 10.0.0(@types/node@20.17.3) + '@inquirer/type': 3.0.0(@types/node@20.17.3) transitivePeerDependencies: - '@types/node' - '@inquirer/core@10.0.0(@types/node@20.17.1)': + '@inquirer/core@10.0.0(@types/node@20.17.3)': dependencies: '@inquirer/figures': 1.0.7 - '@inquirer/type': 3.0.0(@types/node@20.17.1) + '@inquirer/type': 3.0.0(@types/node@20.17.3) ansi-escapes: 4.3.2 cli-width: 4.1.0 mute-stream: 2.0.0 @@ -8528,9 +8608,9 @@ snapshots: '@inquirer/figures@1.0.7': {} - '@inquirer/type@3.0.0(@types/node@20.17.1)': + '@inquirer/type@3.0.0(@types/node@20.17.3)': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@isaacs/cliui@8.0.2': dependencies: @@ -8609,23 +8689,23 @@ snapshots: dependencies: langium: 3.0.0 - '@microsoft/api-extractor-model@7.29.8(@types/node@20.17.1)': + '@microsoft/api-extractor-model@7.29.8(@types/node@20.17.3)': dependencies: '@microsoft/tsdoc': 0.15.0 '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.9.0(@types/node@20.17.1) + '@rushstack/node-core-library': 5.9.0(@types/node@20.17.3) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.47.11(@types/node@20.17.1)': + '@microsoft/api-extractor@7.47.11(@types/node@20.17.3)': dependencies: - '@microsoft/api-extractor-model': 7.29.8(@types/node@20.17.1) + '@microsoft/api-extractor-model': 7.29.8(@types/node@20.17.3) '@microsoft/tsdoc': 0.15.0 '@microsoft/tsdoc-config': 0.17.0 - '@rushstack/node-core-library': 5.9.0(@types/node@20.17.1) + '@rushstack/node-core-library': 5.9.0(@types/node@20.17.3) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.14.2(@types/node@20.17.1) - '@rushstack/ts-command-line': 4.23.0(@types/node@20.17.1) + '@rushstack/terminal': 0.14.2(@types/node@20.17.3) + '@rushstack/ts-command-line': 4.23.0(@types/node@20.17.3) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.8 @@ -8649,10 +8729,10 @@ snapshots: '@types/set-cookie-parser': 2.4.9 set-cookie-parser: 2.6.0 - '@mswjs/http-middleware@0.9.2(msw@2.5.2(@types/node@20.17.1)(typescript@5.2.2))': + '@mswjs/http-middleware@0.9.2(msw@2.6.0(@types/node@20.17.3)(typescript@5.2.2))': dependencies: express: 4.19.2 - msw: 2.5.2(@types/node@20.17.1)(typescript@5.2.2) + msw: 2.6.0(@types/node@20.17.3)(typescript@5.2.2) strict-event-emitter: 0.5.1 transitivePeerDependencies: - supports-color @@ -8691,9 +8771,9 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@nuxt/kit@3.13.2(magicast@0.3.5)(rollup@4.24.2)(webpack-sources@3.2.3)': + '@nuxt/kit@3.13.2(magicast@0.3.5)(rollup@4.24.3)(webpack-sources@3.2.3)': dependencies: - '@nuxt/schema': 3.13.2(rollup@4.24.2)(webpack-sources@3.2.3) + '@nuxt/schema': 3.13.2(rollup@4.24.3)(webpack-sources@3.2.3) c12: 1.11.2(magicast@0.3.5) consola: 3.2.3 defu: 6.1.4 @@ -8711,7 +8791,7 @@ snapshots: semver: 7.6.3 ufo: 1.5.4 unctx: 2.3.1(webpack-sources@3.2.3) - unimport: 3.12.0(rollup@4.24.2)(webpack-sources@3.2.3) + unimport: 3.12.0(rollup@4.24.3)(webpack-sources@3.2.3) untyped: 1.4.2 transitivePeerDependencies: - magicast @@ -8719,7 +8799,7 @@ snapshots: - supports-color - webpack-sources - '@nuxt/schema@3.13.2(rollup@4.24.2)(webpack-sources@3.2.3)': + '@nuxt/schema@3.13.2(rollup@4.24.3)(webpack-sources@3.2.3)': dependencies: compatx: 0.1.8 consola: 3.2.3 @@ -8731,7 +8811,7 @@ snapshots: std-env: 3.7.0 ufo: 1.5.4 uncrypto: 0.1.3 - unimport: 3.12.0(rollup@4.24.2)(webpack-sources@3.2.3) + unimport: 3.12.0(rollup@4.24.3)(webpack-sources@3.2.3) untyped: 1.4.2 transitivePeerDependencies: - rollup @@ -8848,13 +8928,13 @@ snapshots: - encoding - supports-color - '@rollup/pluginutils@5.1.0(rollup@4.24.2)': + '@rollup/pluginutils@5.1.0(rollup@4.24.3)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 picomatch: 2.3.1 optionalDependencies: - rollup: 4.24.2 + rollup: 4.24.3 '@rollup/rollup-android-arm-eabi@4.24.0': optional: true @@ -8862,103 +8942,157 @@ snapshots: '@rollup/rollup-android-arm-eabi@4.24.2': optional: true + '@rollup/rollup-android-arm-eabi@4.24.3': + optional: true + '@rollup/rollup-android-arm64@4.24.0': optional: true '@rollup/rollup-android-arm64@4.24.2': optional: true + '@rollup/rollup-android-arm64@4.24.3': + optional: true + '@rollup/rollup-darwin-arm64@4.24.0': optional: true '@rollup/rollup-darwin-arm64@4.24.2': optional: true + '@rollup/rollup-darwin-arm64@4.24.3': + optional: true + '@rollup/rollup-darwin-x64@4.24.0': optional: true '@rollup/rollup-darwin-x64@4.24.2': optional: true + '@rollup/rollup-darwin-x64@4.24.3': + optional: true + '@rollup/rollup-freebsd-arm64@4.24.2': optional: true + '@rollup/rollup-freebsd-arm64@4.24.3': + optional: true + '@rollup/rollup-freebsd-x64@4.24.2': optional: true + '@rollup/rollup-freebsd-x64@4.24.3': + optional: true + '@rollup/rollup-linux-arm-gnueabihf@4.24.0': optional: true '@rollup/rollup-linux-arm-gnueabihf@4.24.2': optional: true + '@rollup/rollup-linux-arm-gnueabihf@4.24.3': + optional: true + '@rollup/rollup-linux-arm-musleabihf@4.24.0': optional: true '@rollup/rollup-linux-arm-musleabihf@4.24.2': optional: true + '@rollup/rollup-linux-arm-musleabihf@4.24.3': + optional: true + '@rollup/rollup-linux-arm64-gnu@4.24.0': optional: true '@rollup/rollup-linux-arm64-gnu@4.24.2': optional: true + '@rollup/rollup-linux-arm64-gnu@4.24.3': + optional: true + '@rollup/rollup-linux-arm64-musl@4.24.0': optional: true '@rollup/rollup-linux-arm64-musl@4.24.2': optional: true + '@rollup/rollup-linux-arm64-musl@4.24.3': + optional: true + '@rollup/rollup-linux-powerpc64le-gnu@4.24.0': optional: true '@rollup/rollup-linux-powerpc64le-gnu@4.24.2': optional: true + '@rollup/rollup-linux-powerpc64le-gnu@4.24.3': + optional: true + '@rollup/rollup-linux-riscv64-gnu@4.24.0': optional: true '@rollup/rollup-linux-riscv64-gnu@4.24.2': optional: true + '@rollup/rollup-linux-riscv64-gnu@4.24.3': + optional: true + '@rollup/rollup-linux-s390x-gnu@4.24.0': optional: true '@rollup/rollup-linux-s390x-gnu@4.24.2': optional: true + '@rollup/rollup-linux-s390x-gnu@4.24.3': + optional: true + '@rollup/rollup-linux-x64-gnu@4.24.0': optional: true '@rollup/rollup-linux-x64-gnu@4.24.2': optional: true + '@rollup/rollup-linux-x64-gnu@4.24.3': + optional: true + '@rollup/rollup-linux-x64-musl@4.24.0': optional: true '@rollup/rollup-linux-x64-musl@4.24.2': optional: true + '@rollup/rollup-linux-x64-musl@4.24.3': + optional: true + '@rollup/rollup-win32-arm64-msvc@4.24.0': optional: true '@rollup/rollup-win32-arm64-msvc@4.24.2': optional: true + '@rollup/rollup-win32-arm64-msvc@4.24.3': + optional: true + '@rollup/rollup-win32-ia32-msvc@4.24.0': optional: true '@rollup/rollup-win32-ia32-msvc@4.24.2': optional: true + '@rollup/rollup-win32-ia32-msvc@4.24.3': + optional: true + '@rollup/rollup-win32-x64-msvc@4.24.0': optional: true '@rollup/rollup-win32-x64-msvc@4.24.2': optional: true - '@rushstack/node-core-library@5.9.0(@types/node@20.17.1)': + '@rollup/rollup-win32-x64-msvc@4.24.3': + optional: true + + '@rushstack/node-core-library@5.9.0(@types/node@20.17.3)': dependencies: ajv: 8.13.0 ajv-draft-04: 1.0.0(ajv@8.13.0) @@ -8969,23 +9103,23 @@ snapshots: resolve: 1.22.8 semver: 7.5.4 optionalDependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@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.17.1)': + '@rushstack/terminal@0.14.2(@types/node@20.17.3)': dependencies: - '@rushstack/node-core-library': 5.9.0(@types/node@20.17.1) + '@rushstack/node-core-library': 5.9.0(@types/node@20.17.3) supports-color: 8.1.1 optionalDependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 - '@rushstack/ts-command-line@4.23.0(@types/node@20.17.1)': + '@rushstack/ts-command-line@4.23.0(@types/node@20.17.3)': dependencies: - '@rushstack/terminal': 0.14.2(@types/node@20.17.1) + '@rushstack/terminal': 0.14.2(@types/node@20.17.3) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -8994,15 +9128,6 @@ snapshots: '@sec-ant/readable-stream@0.4.1': {} - '@shikijs/core@1.22.0': - dependencies: - '@shikijs/engine-javascript': 1.22.0 - '@shikijs/engine-oniguruma': 1.22.0 - '@shikijs/types': 1.22.0 - '@shikijs/vscode-textmate': 9.3.0 - '@types/hast': 3.0.4 - hast-util-to-html: 9.0.3 - '@shikijs/core@1.22.2': dependencies: '@shikijs/engine-javascript': 1.22.2 @@ -9012,31 +9137,20 @@ snapshots: '@types/hast': 3.0.4 hast-util-to-html: 9.0.3 - '@shikijs/engine-javascript@1.22.0': - dependencies: - '@shikijs/types': 1.22.0 - '@shikijs/vscode-textmate': 9.3.0 - oniguruma-to-js: 0.4.3 - '@shikijs/engine-javascript@1.22.2': dependencies: '@shikijs/types': 1.22.2 '@shikijs/vscode-textmate': 9.3.0 oniguruma-to-js: 0.4.3 - '@shikijs/engine-oniguruma@1.22.0': - dependencies: - '@shikijs/types': 1.22.0 - '@shikijs/vscode-textmate': 9.3.0 - '@shikijs/engine-oniguruma@1.22.2': dependencies: '@shikijs/types': 1.22.2 '@shikijs/vscode-textmate': 9.3.0 - '@shikijs/transformers@1.22.0': + '@shikijs/transformers@1.22.2': dependencies: - shiki: 1.22.0 + shiki: 1.22.2 '@shikijs/twoslash@1.22.2(typescript@5.6.3)': dependencies: @@ -9047,11 +9161,6 @@ snapshots: - supports-color - typescript - '@shikijs/types@1.22.0': - dependencies: - '@shikijs/vscode-textmate': 9.3.0 - '@types/hast': 3.0.4 - '@shikijs/types@1.22.2': dependencies: '@shikijs/vscode-textmate': 9.3.0 @@ -9223,15 +9332,15 @@ snapshots: '@types/body-parser@1.19.5': dependencies: '@types/connect': 3.4.38 - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/cli-progress@3.11.6': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/connect@3.4.38': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/cookie@0.4.1': {} @@ -9245,7 +9354,7 @@ snapshots: '@types/express-serve-static-core@4.19.5': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/qs': 6.9.15 '@types/range-parser': 1.2.7 '@types/send': 0.17.4 @@ -9260,7 +9369,7 @@ snapshots: '@types/fs-extra@11.0.4': dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/hast@3.0.4': dependencies: @@ -9274,7 +9383,7 @@ snapshots: '@types/jsonfile@6.1.4': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/linkify-it@5.0.0': {} @@ -9301,7 +9410,7 @@ snapshots: dependencies: undici-types: 5.26.5 - '@types/node@20.17.1': + '@types/node@20.17.3': dependencies: undici-types: 6.19.8 @@ -9328,7 +9437,7 @@ snapshots: '@types/sax@1.2.7': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/seedrandom@3.0.8': {} @@ -9337,17 +9446,17 @@ snapshots: '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/serve-static@1.15.7': dependencies: '@types/http-errors': 2.0.4 - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/send': 0.17.4 '@types/set-cookie-parser@2.4.9': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/signal-exit@3.0.4': {} @@ -9357,7 +9466,7 @@ snapshots: '@types/swagger2openapi@7.0.4': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 openapi-types: 12.1.3 '@types/tough-cookie@4.0.5': {} @@ -9368,11 +9477,11 @@ snapshots: '@types/ws@8.5.12': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@types/yauzl@2.10.3': dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 optional: true '@typescript/vfs@1.6.0(typescript@5.6.3)': @@ -9384,25 +9493,25 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitejs/plugin-react@4.3.3(vite@4.5.5(@types/node@20.17.1)(terser@5.31.1))': + '@vitejs/plugin-react@4.3.3(vite@4.5.5(@types/node@20.17.3)(terser@5.31.1))': dependencies: '@babel/core': 7.25.2 '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.25.2) '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.25.2) '@types/babel__core': 7.20.5 react-refresh: 0.14.2 - vite: 4.5.5(@types/node@20.17.1)(terser@5.31.1) + vite: 4.5.5(@types/node@20.17.3)(terser@5.31.1) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@4.6.2(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3))': + '@vitejs/plugin-vue@4.6.2(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3))': dependencies: - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) vue: 3.5.12(typescript@5.6.3) - '@vitejs/plugin-vue@5.1.4(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3))': + '@vitejs/plugin-vue@5.1.4(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3))': dependencies: - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) vue: 3.5.12(typescript@5.6.3) '@vitest/coverage-v8@2.1.4(vitest@2.1.4)': @@ -9419,7 +9528,7 @@ snapshots: std-env: 3.7.0 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.1.4(@types/node@20.17.1)(@vitest/ui@2.1.4)(msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3))(terser@5.31.1) + vitest: 2.1.4(@types/node@20.17.3)(@vitest/ui@2.1.4)(msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3))(terser@5.31.1) transitivePeerDependencies: - supports-color @@ -9430,14 +9539,14 @@ snapshots: chai: 5.1.2 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.4(msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3))(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1))': + '@vitest/mocker@2.1.4(msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3))(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1))': dependencies: '@vitest/spy': 2.1.4 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - msw: 2.5.2(@types/node@20.17.1)(typescript@5.6.3) - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + msw: 2.6.0(@types/node@20.17.3)(typescript@5.6.3) + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) '@vitest/pretty-format@2.1.4': dependencies: @@ -9467,7 +9576,7 @@ snapshots: sirv: 3.0.0 tinyglobby: 0.2.10 tinyrainbow: 1.2.0 - vitest: 2.1.4(@types/node@20.17.1)(@vitest/ui@2.1.4)(msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3))(terser@5.31.1) + vitest: 2.1.4(@types/node@20.17.3)(@vitest/ui@2.1.4)(msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3))(terser@5.31.1) '@vitest/utils@2.1.4': dependencies: @@ -9518,21 +9627,21 @@ snapshots: '@vue/devtools-api@6.6.3': {} - '@vue/devtools-api@7.4.6': + '@vue/devtools-api@7.5.6': dependencies: - '@vue/devtools-kit': 7.4.6 + '@vue/devtools-kit': 7.5.6 - '@vue/devtools-kit@7.4.6': + '@vue/devtools-kit@7.5.6': dependencies: - '@vue/devtools-shared': 7.4.6 - birpc: 0.2.17 + '@vue/devtools-shared': 7.5.6 + birpc: 0.2.19 hookable: 5.5.3 mitt: 3.0.1 perfect-debounce: 1.0.0 speakingurl: 14.0.1 superjson: 2.2.1 - '@vue/devtools-shared@7.4.6': + '@vue/devtools-shared@7.5.6': dependencies: rfdc: 1.4.1 @@ -9908,7 +10017,7 @@ snapshots: binary-extensions@2.3.0: {} - birpc@0.2.17: {} + birpc@0.2.19: {} bl@4.1.0: dependencies: @@ -10937,7 +11046,7 @@ snapshots: signal-exit: 4.1.0 strip-final-newline: 3.0.0 - execa@9.5.0: + execa@9.5.1: dependencies: '@sindresorhus/merge-streams': 4.0.0 cross-spawn: 7.0.3 @@ -11087,7 +11196,7 @@ snapshots: vue: 3.5.12(typescript@5.6.3) vue-resize: 2.0.0-alpha.1(vue@3.5.12(typescript@5.6.3)) optionalDependencies: - '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.24.2)(webpack-sources@3.2.3) + '@nuxt/kit': 3.13.2(magicast@0.3.5)(rollup@4.24.3)(webpack-sources@3.2.3) focus-trap@7.6.0: dependencies: @@ -11584,7 +11693,7 @@ snapshots: jest-worker@27.5.1: dependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -12217,13 +12326,14 @@ snapshots: - encoding - supports-color - msw@2.5.2(@types/node@20.17.1)(typescript@5.2.2): + msw@2.6.0(@types/node@20.17.3)(typescript@5.2.2): dependencies: '@bundled-es-modules/cookie': 2.0.0 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.0.0(@types/node@20.17.1) + '@inquirer/confirm': 5.0.0(@types/node@20.17.3) '@mswjs/interceptors': 0.36.5 + '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 '@types/statuses': 2.0.5 @@ -12241,13 +12351,14 @@ snapshots: transitivePeerDependencies: - '@types/node' - msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3): + msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3): dependencies: '@bundled-es-modules/cookie': 2.0.0 '@bundled-es-modules/statuses': 1.0.1 '@bundled-es-modules/tough-cookie': 0.1.6 - '@inquirer/confirm': 5.0.0(@types/node@20.17.1) + '@inquirer/confirm': 5.0.0(@types/node@20.17.3) '@mswjs/interceptors': 0.36.5 + '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 '@types/statuses': 2.0.5 @@ -13001,6 +13112,30 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.24.2 fsevents: 2.3.3 + rollup@4.24.3: + dependencies: + '@types/estree': 1.0.6 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.24.3 + '@rollup/rollup-android-arm64': 4.24.3 + '@rollup/rollup-darwin-arm64': 4.24.3 + '@rollup/rollup-darwin-x64': 4.24.3 + '@rollup/rollup-freebsd-arm64': 4.24.3 + '@rollup/rollup-freebsd-x64': 4.24.3 + '@rollup/rollup-linux-arm-gnueabihf': 4.24.3 + '@rollup/rollup-linux-arm-musleabihf': 4.24.3 + '@rollup/rollup-linux-arm64-gnu': 4.24.3 + '@rollup/rollup-linux-arm64-musl': 4.24.3 + '@rollup/rollup-linux-powerpc64le-gnu': 4.24.3 + '@rollup/rollup-linux-riscv64-gnu': 4.24.3 + '@rollup/rollup-linux-s390x-gnu': 4.24.3 + '@rollup/rollup-linux-x64-gnu': 4.24.3 + '@rollup/rollup-linux-x64-musl': 4.24.3 + '@rollup/rollup-win32-arm64-msvc': 4.24.3 + '@rollup/rollup-win32-ia32-msvc': 4.24.3 + '@rollup/rollup-win32-x64-msvc': 4.24.3 + fsevents: 2.3.3 + roughjs@4.6.6: dependencies: hachure-fill: 0.5.2 @@ -13141,15 +13276,6 @@ snapshots: shell-quote@1.8.1: {} - shiki@1.22.0: - dependencies: - '@shikijs/core': 1.22.0 - '@shikijs/engine-javascript': 1.22.0 - '@shikijs/engine-oniguruma': 1.22.0 - '@shikijs/types': 1.22.0 - '@shikijs/vscode-textmate': 9.3.0 - '@types/hast': 3.0.4 - shiki@1.22.2: dependencies: '@shikijs/core': 1.22.2 @@ -13545,14 +13671,14 @@ snapshots: ts-interface-checker@0.1.13: {} - ts-node@10.9.2(@swc/core@1.7.22)(@types/node@20.17.1)(typescript@5.6.3): + ts-node@10.9.2(@swc/core@1.7.22)(@types/node@20.17.3)(typescript@5.6.3): 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.17.1 + '@types/node': 20.17.3 acorn: 8.12.1 acorn-walk: 8.3.3 arg: 4.1.3 @@ -13575,7 +13701,7 @@ snapshots: tslib@2.6.3: {} - tsup@8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1): + tsup@8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.2.2)(yaml@2.5.1): dependencies: bundle-require: 5.0.0(esbuild@0.24.0) cac: 6.7.14 @@ -13594,7 +13720,7 @@ snapshots: tinyglobby: 0.2.10 tree-kill: 1.2.2 optionalDependencies: - '@microsoft/api-extractor': 7.47.11(@types/node@20.17.1) + '@microsoft/api-extractor': 7.47.11(@types/node@20.17.3) '@swc/core': 1.7.22 postcss: 8.4.47 typescript: 5.2.2 @@ -13604,7 +13730,7 @@ snapshots: - tsx - yaml - tsup@8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.1))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1): + tsup@8.3.5(@microsoft/api-extractor@7.47.11(@types/node@20.17.3))(@swc/core@1.7.22)(jiti@2.3.3)(postcss@8.4.47)(typescript@5.6.3)(yaml@2.5.1): dependencies: bundle-require: 5.0.0(esbuild@0.24.0) cac: 6.7.14 @@ -13623,7 +13749,7 @@ snapshots: tinyglobby: 0.2.10 tree-kill: 1.2.2 optionalDependencies: - '@microsoft/api-extractor': 7.47.11(@types/node@20.17.1) + '@microsoft/api-extractor': 7.47.11(@types/node@20.17.3) '@swc/core': 1.7.22 postcss: 8.4.47 typescript: 5.6.3 @@ -13768,9 +13894,9 @@ snapshots: unicorn-magic@0.3.0: {} - unimport@3.12.0(rollup@4.24.2)(webpack-sources@3.2.3): + unimport@3.12.0(rollup@4.24.3)(webpack-sources@3.2.3): dependencies: - '@rollup/pluginutils': 5.1.0(rollup@4.24.2) + '@rollup/pluginutils': 5.1.0(rollup@4.24.3) acorn: 8.12.1 escape-string-regexp: 5.0.0 estree-walker: 3.0.3 @@ -13907,12 +14033,12 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.4(@types/node@20.17.1)(terser@5.31.1): + vite-node@2.1.4(@types/node@20.17.3)(terser@5.31.1): dependencies: cac: 6.7.14 debug: 4.3.7 pathe: 1.1.2 - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) transitivePeerDependencies: - '@types/node' - less @@ -13924,34 +14050,34 @@ snapshots: - supports-color - terser - vite-tsconfig-paths@5.0.1(typescript@5.6.3)(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1)): + vite-tsconfig-paths@5.0.1(typescript@5.6.3)(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1)): dependencies: debug: 4.3.7 globrex: 0.1.2 tsconfck: 3.1.0(typescript@5.6.3) optionalDependencies: - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) transitivePeerDependencies: - supports-color - typescript - vite@4.5.5(@types/node@20.17.1)(terser@5.31.1): + vite@4.5.5(@types/node@20.17.3)(terser@5.31.1): dependencies: esbuild: 0.18.20 postcss: 8.4.47 rollup: 3.29.4 optionalDependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 fsevents: 2.3.3 terser: 5.31.1 - vite@5.4.10(@types/node@20.17.1)(terser@5.31.1): + vite@5.4.10(@types/node@20.17.3)(terser@5.31.1): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.24.0 optionalDependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 fsevents: 2.3.3 terser: 5.31.1 @@ -13963,24 +14089,24 @@ snapshots: transitivePeerDependencies: - supports-color - vitepress@1.4.1(@algolia/client-search@4.24.0)(@types/node@20.17.1)(@types/react@18.3.12)(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.3): + vitepress@1.4.2(@algolia/client-search@4.24.0)(@types/node@20.17.3)(@types/react@18.3.12)(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.3): dependencies: '@docsearch/css': 3.6.2 '@docsearch/js': 3.6.2(@algolia/client-search@4.24.0)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.1) - '@shikijs/core': 1.22.0 - '@shikijs/transformers': 1.22.0 - '@shikijs/types': 1.22.0 + '@shikijs/core': 1.22.2 + '@shikijs/transformers': 1.22.2 + '@shikijs/types': 1.22.2 '@types/markdown-it': 14.1.2 - '@vitejs/plugin-vue': 5.1.4(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3)) - '@vue/devtools-api': 7.4.6 + '@vitejs/plugin-vue': 5.1.4(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1))(vue@3.5.12(typescript@5.6.3)) + '@vue/devtools-api': 7.5.6 '@vue/shared': 3.5.12 '@vueuse/core': 11.1.0(vue@3.5.12(typescript@5.6.3)) '@vueuse/integrations': 11.1.0(axios@1.7.7)(change-case@5.4.4)(focus-trap@7.6.0)(vue@3.5.12(typescript@5.6.3)) focus-trap: 7.6.0 mark.js: 8.11.1 minisearch: 7.1.0 - shiki: 1.22.0 - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) + shiki: 1.22.2 + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) vue: 3.5.12(typescript@5.6.3) optionalDependencies: postcss: 8.4.47 @@ -14012,10 +14138,10 @@ snapshots: - typescript - universal-cookie - vitest@2.1.4(@types/node@20.17.1)(@vitest/ui@2.1.4)(msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3))(terser@5.31.1): + vitest@2.1.4(@types/node@20.17.3)(@vitest/ui@2.1.4)(msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3))(terser@5.31.1): dependencies: '@vitest/expect': 2.1.4 - '@vitest/mocker': 2.1.4(msw@2.5.2(@types/node@20.17.1)(typescript@5.6.3))(vite@5.4.10(@types/node@20.17.1)(terser@5.31.1)) + '@vitest/mocker': 2.1.4(msw@2.6.0(@types/node@20.17.3)(typescript@5.6.3))(vite@5.4.10(@types/node@20.17.3)(terser@5.31.1)) '@vitest/pretty-format': 2.1.4 '@vitest/runner': 2.1.4 '@vitest/snapshot': 2.1.4 @@ -14031,11 +14157,11 @@ snapshots: tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.10(@types/node@20.17.1)(terser@5.31.1) - vite-node: 2.1.4(@types/node@20.17.1)(terser@5.31.1) + vite: 5.4.10(@types/node@20.17.3)(terser@5.31.1) + vite-node: 2.1.4(@types/node@20.17.3)(terser@5.31.1) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 20.17.1 + '@types/node': 20.17.3 '@vitest/ui': 2.1.4(vitest@2.1.4) transitivePeerDependencies: - less