@kubb/plugin-vue-query 3.3.4 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/{chunk-2UMU7BVZ.cjs → chunk-4JVSXKZU.cjs} +82 -43
  2. package/dist/chunk-4JVSXKZU.cjs.map +1 -0
  3. package/dist/{chunk-KZ7PBMDR.js → chunk-CVYZAPKX.js} +82 -43
  4. package/dist/chunk-CVYZAPKX.js.map +1 -0
  5. package/dist/{chunk-7G2R5CBV.js → chunk-JP4ER6DI.js} +8 -7
  6. package/dist/chunk-JP4ER6DI.js.map +1 -0
  7. package/dist/{chunk-B5VPX5AX.cjs → chunk-XYOUND2J.cjs} +19 -18
  8. package/dist/chunk-XYOUND2J.cjs.map +1 -0
  9. package/dist/components.cjs +8 -8
  10. package/dist/components.d.cts +2 -1
  11. package/dist/components.d.ts +2 -1
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +5 -5
  14. package/dist/generators.js +2 -2
  15. package/dist/index.cjs +5 -5
  16. package/dist/index.js +2 -2
  17. package/package.json +12 -12
  18. package/src/components/InfiniteQuery.tsx +5 -3
  19. package/src/components/InfiniteQueryOptions.tsx +4 -1
  20. package/src/components/Mutation.tsx +6 -4
  21. package/src/components/Query.tsx +5 -3
  22. package/src/components/QueryOptions.tsx +6 -3
  23. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +10 -5
  24. package/src/generators/__snapshots__/clientGetImportPath.ts +5 -5
  25. package/src/generators/__snapshots__/clientPostImportPath.ts +4 -4
  26. package/src/generators/__snapshots__/findByTags.ts +5 -5
  27. package/src/generators/__snapshots__/findByTagsObject.ts +5 -5
  28. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +5 -5
  29. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +5 -5
  30. package/src/generators/__snapshots__/findByTagsWithZod.ts +5 -5
  31. package/src/generators/__snapshots__/findInfiniteByTags.ts +5 -5
  32. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +5 -5
  33. package/src/generators/__snapshots__/postAsQuery.ts +5 -5
  34. package/src/generators/__snapshots__/updatePetById.ts +4 -4
  35. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +4 -4
  36. package/src/generators/infiniteQueryGenerator.tsx +1 -1
  37. package/src/generators/mutationGenerator.tsx +1 -1
  38. package/src/generators/queryGenerator.tsx +2 -2
  39. package/dist/chunk-2UMU7BVZ.cjs.map +0 -1
  40. package/dist/chunk-7G2R5CBV.js.map +0 -1
  41. package/dist/chunk-B5VPX5AX.cjs.map +0 -1
  42. package/dist/chunk-KZ7PBMDR.js.map +0 -1
@@ -35,6 +35,7 @@ type GetParamsProps = {
35
35
 
36
36
  function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
37
37
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
38
+ const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
38
39
 
39
40
  if (paramsType === 'object') {
40
41
  return FunctionParams.factory({
@@ -74,7 +75,7 @@ function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, t
74
75
  options: {
75
76
  type: `
76
77
  {
77
- query?: Partial<QueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
78
+ query?: Partial<QueryObserverOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
78
79
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
79
80
  }
80
81
  `,
@@ -119,7 +120,7 @@ function getParams({ paramsCasing, paramsType, pathParamsType, dataReturnType, t
119
120
  options: {
120
121
  type: `
121
122
  {
122
- query?: Partial<QueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
123
+ query?: Partial<QueryObserverOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
123
124
  client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
124
125
  }
125
126
  `,
@@ -141,7 +142,8 @@ export function Query({
141
142
  operation,
142
143
  }: Props): ReactNode {
143
144
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
144
- const returnType = `UseQueryReturnType<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }`
145
+ const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
146
+ const returnType = `UseQueryReturnType<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`
145
147
  const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]
146
148
 
147
149
  const queryKeyParams = QueryKey.getParams({
@@ -6,7 +6,6 @@ import type { ReactNode } from 'react'
6
6
  import { isOptional } from '@kubb/oas'
7
7
  import { Client } from '@kubb/plugin-client/components'
8
8
  import type { OperationSchemas } from '@kubb/plugin-oas'
9
- import type { PluginReactQuery } from '@kubb/plugin-react-query'
10
9
  import type { PluginVueQuery } from '../types.ts'
11
10
  import { QueryKey } from './QueryKey.tsx'
12
11
 
@@ -18,6 +17,7 @@ type Props = {
18
17
  paramsCasing: PluginVueQuery['resolvedOptions']['paramsCasing']
19
18
  paramsType: PluginVueQuery['resolvedOptions']['paramsType']
20
19
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
20
+ dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
21
21
  }
22
22
 
23
23
  type GetParamsProps = {
@@ -110,7 +110,10 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: Ge
110
110
  })
111
111
  }
112
112
 
113
- export function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
113
+ export function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
114
+ const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
115
+ const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
116
+
114
117
  const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })
115
118
  const clientParams = Client.getParams({
116
119
  paramsType,
@@ -136,7 +139,7 @@ export function QueryOptions({ name, clientName, typeSchemas, paramsCasing, para
136
139
  <Function name={name} export params={params.toConstructor()}>
137
140
  {`
138
141
  const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})
139
- return queryOptions({
142
+ return queryOptions<${TData}, ${TError}, ${TData}, typeof queryKey>({
140
143
  ${enabledText}
141
144
  queryKey,
142
145
  queryFn: async ({ signal }) => {
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,12 @@ export function findPetsByTagsQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsQueryKey(params)
34
- return queryOptions({
34
+ return queryOptions<
35
+ ResponseConfig<FindPetsByTagsQueryResponse>,
36
+ ResponseErrorConfig<FindPetsByTags400>,
37
+ ResponseConfig<FindPetsByTagsQueryResponse>,
38
+ typeof queryKey
39
+ >({
35
40
  queryKey,
36
41
  queryFn: async ({ signal }) => {
37
42
  config.signal = signal
@@ -53,7 +58,7 @@ export function useFindPetsByTags<
53
58
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
59
  params?: MaybeRef<FindPetsByTagsQueryParams>,
55
60
  options: {
56
- query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400, TData, TQueryData, TQueryKey>>
61
+ query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
57
62
  client?: Partial<RequestConfig>
58
63
  } = {},
59
64
  ) {
@@ -64,7 +69,7 @@ export function useFindPetsByTags<
64
69
  ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
70
  queryKey: queryKey as QueryKey,
66
71
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
72
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
68
73
 
69
74
  query.queryKey = queryKey as TQueryKey
70
75
 
@@ -1,6 +1,6 @@
1
1
  import client from 'axios'
2
2
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
3
- import type { RequestConfig } from 'axios'
3
+ import type { RequestConfig, ResponseErrorConfig } from 'axios'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
6
6
  import { unref } from 'vue'
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,7 @@ export function findPetsByTagsQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsQueryKey(params)
34
- return queryOptions({
34
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
35
35
  queryKey,
36
36
  queryFn: async ({ signal }) => {
37
37
  config.signal = signal
@@ -53,7 +53,7 @@ export function useFindPetsByTags<
53
53
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
54
  params?: MaybeRef<FindPetsByTagsQueryParams>,
55
55
  options: {
56
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
56
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
57
57
  client?: Partial<RequestConfig>
58
58
  } = {},
59
59
  ) {
@@ -64,7 +64,7 @@ export function useFindPetsByTags<
64
64
  ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
65
  queryKey: queryKey as QueryKey,
66
66
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
67
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
68
68
 
69
69
  query.queryKey = queryKey as TQueryKey
70
70
 
@@ -1,6 +1,6 @@
1
1
  import client from 'axios'
2
2
  import type { MutationObserverOptions } from '@tanstack/vue-query'
3
- import type { RequestConfig } from 'axios'
3
+ import type { RequestConfig, ResponseErrorConfig } from 'axios'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { useMutation } from '@tanstack/vue-query'
6
6
 
@@ -18,7 +18,7 @@ async function updatePetWithForm(
18
18
  params?: UpdatePetWithFormQueryParams,
19
19
  config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
20
20
  ) {
21
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
21
+ const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
22
22
  method: 'POST',
23
23
  url: `/pet/${petId}`,
24
24
  params,
@@ -36,7 +36,7 @@ export function useUpdatePetWithForm(
36
36
  options: {
37
37
  mutation?: MutationObserverOptions<
38
38
  UpdatePetWithFormMutationResponse,
39
- UpdatePetWithForm405,
39
+ ResponseErrorConfig<UpdatePetWithForm405>,
40
40
  {
41
41
  petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
42
42
  data?: MaybeRef<UpdatePetWithFormMutationRequest>
@@ -51,7 +51,7 @@ export function useUpdatePetWithForm(
51
51
 
52
52
  return useMutation<
53
53
  UpdatePetWithFormMutationResponse,
54
- UpdatePetWithForm405,
54
+ ResponseErrorConfig<UpdatePetWithForm405>,
55
55
  { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
56
56
  >({
57
57
  mutationFn: async ({ petId, data, params }) => {
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,7 @@ export function findPetsByTagsQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsQueryKey(params)
34
- return queryOptions({
34
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
35
35
  queryKey,
36
36
  queryFn: async ({ signal }) => {
37
37
  config.signal = signal
@@ -53,7 +53,7 @@ export function useFindPetsByTags<
53
53
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
54
  params?: MaybeRef<FindPetsByTagsQueryParams>,
55
55
  options: {
56
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
56
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
57
57
  client?: Partial<RequestConfig>
58
58
  } = {},
59
59
  ) {
@@ -64,7 +64,7 @@ export function useFindPetsByTags<
64
64
  ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
65
  queryKey: queryKey as QueryKey,
66
66
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
67
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
68
68
 
69
69
  query.queryKey = queryKey as TQueryKey
70
70
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
@@ -18,7 +18,7 @@ async function findPetsByTags(
18
18
  { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
19
19
  config: Partial<RequestConfig> = {},
20
20
  ) {
21
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
21
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
22
22
  method: 'GET',
23
23
  url: `/pet/findByTags`,
24
24
  params,
@@ -33,7 +33,7 @@ export function findPetsByTagsQueryOptions(
33
33
  config: Partial<RequestConfig> = {},
34
34
  ) {
35
35
  const queryKey = findPetsByTagsQueryKey(params)
36
- return queryOptions({
36
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
37
37
  queryKey,
38
38
  queryFn: async ({ signal }) => {
39
39
  config.signal = signal
@@ -54,7 +54,7 @@ export function useFindPetsByTags<
54
54
  >(
55
55
  { headers, params }: { headers: MaybeRef<FindPetsByTagsHeaderParams>; params?: MaybeRef<FindPetsByTagsQueryParams> },
56
56
  options: {
57
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
57
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
58
58
  client?: Partial<RequestConfig>
59
59
  } = {},
60
60
  ) {
@@ -65,7 +65,7 @@ export function useFindPetsByTags<
65
65
  ...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions),
66
66
  queryKey: queryKey as QueryKey,
67
67
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
68
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
68
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
69
69
 
70
70
  query.queryKey = queryKey as TQueryKey
71
71
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,7 @@ export function findPetsByTagsQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsQueryKey(params)
34
- return queryOptions({
34
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
35
35
  queryKey,
36
36
  queryFn: async ({ signal }) => {
37
37
  config.signal = signal
@@ -53,7 +53,7 @@ export function useFindPetsByTags<
53
53
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
54
  params?: MaybeRef<FindPetsByTagsQueryParams>,
55
55
  options: {
56
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
56
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
57
57
  client?: Partial<RequestConfig>
58
58
  } = {},
59
59
  ) {
@@ -64,7 +64,7 @@ export function useFindPetsByTags<
64
64
  ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
65
  queryKey: queryKey as QueryKey,
66
66
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
67
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
68
68
 
69
69
  query.queryKey = queryKey as TQueryKey
70
70
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
@@ -16,7 +16,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
16
16
  * {@link /pet/findByTags}
17
17
  */
18
18
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
19
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
19
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
20
20
  method: 'GET',
21
21
  url: `/pet/findByTags`,
22
22
  params,
@@ -32,7 +32,7 @@ export function findPetsByTagsQueryOptions(
32
32
  config: Partial<RequestConfig> = {},
33
33
  ) {
34
34
  const queryKey = findPetsByTagsQueryKey(params)
35
- return queryOptions({
35
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
36
36
  queryKey,
37
37
  queryFn: async ({ signal }) => {
38
38
  config.signal = signal
@@ -54,7 +54,7 @@ export function useFindPetsByTags<
54
54
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
55
55
  params?: MaybeRef<FindPetsByTagsQueryParams>,
56
56
  options: {
57
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
57
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
58
58
  client?: Partial<RequestConfig>
59
59
  } = {},
60
60
  ) {
@@ -65,7 +65,7 @@ export function useFindPetsByTags<
65
65
  ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
66
66
  queryKey: queryKey as QueryKey,
67
67
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
68
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
68
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
69
69
 
70
70
  query.queryKey = queryKey as TQueryKey
71
71
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from '@tanstack/react-query'
@@ -15,7 +15,7 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,7 @@ export function findPetsByTagsQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsQueryKey(params)
34
- return queryOptions({
34
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
35
35
  queryKey,
36
36
  queryFn: async ({ signal }) => {
37
37
  config.signal = signal
@@ -53,7 +53,7 @@ export function useFindPetsByTags<
53
53
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
54
54
  params?: MaybeRef<FindPetsByTagsQueryParams>,
55
55
  options: {
56
- query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
56
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
57
57
  client?: Partial<RequestConfig>
58
58
  } = {},
59
59
  ) {
@@ -64,7 +64,7 @@ export function useFindPetsByTags<
64
64
  ...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
65
65
  queryKey: queryKey as QueryKey,
66
66
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
67
- }) as UseQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
67
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
68
68
 
69
69
  query.queryKey = queryKey as TQueryKey
70
70
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
@@ -15,7 +15,7 @@ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInf
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,7 @@ export function findPetsByTagsInfiniteQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsInfiniteQueryKey(params)
34
- return infiniteQueryOptions({
34
+ return infiniteQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey, number>({
35
35
  queryKey,
36
36
  queryFn: async ({ signal, pageParam }) => {
37
37
  config.signal = signal
@@ -60,7 +60,7 @@ export function useFindPetsByTagsInfinite<
60
60
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
61
61
  params?: MaybeRef<FindPetsByTagsQueryParams>,
62
62
  options: {
63
- query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
63
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
64
64
  client?: Partial<RequestConfig>
65
65
  } = {},
66
66
  ) {
@@ -71,7 +71,7 @@ export function useFindPetsByTagsInfinite<
71
71
  ...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions),
72
72
  queryKey: queryKey as QueryKey,
73
73
  ...(queryOptions as unknown as Omit<InfiniteQueryObserverOptions, 'queryKey'>),
74
- }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
74
+ }) as UseInfiniteQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
75
75
 
76
76
  query.queryKey = queryKey as TQueryKey
77
77
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryReturnType } from '@tanstack/react-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
@@ -15,7 +15,7 @@ export type FindPetsByTagsInfiniteQueryKey = ReturnType<typeof findPetsByTagsInf
15
15
  * {@link /pet/findByTags}
16
16
  */
17
17
  async function findPetsByTags(headers: FindPetsByTagsHeaderParams, params?: FindPetsByTagsQueryParams, config: Partial<RequestConfig> = {}) {
18
- const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({
18
+ const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
19
19
  method: 'GET',
20
20
  url: `/pet/findByTags`,
21
21
  params,
@@ -31,7 +31,7 @@ export function findPetsByTagsInfiniteQueryOptions(
31
31
  config: Partial<RequestConfig> = {},
32
32
  ) {
33
33
  const queryKey = findPetsByTagsInfiniteQueryKey(params)
34
- return infiniteQueryOptions({
34
+ return infiniteQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey, number>({
35
35
  queryKey,
36
36
  queryFn: async ({ signal, pageParam }) => {
37
37
  config.signal = signal
@@ -60,7 +60,7 @@ export function useFindPetsByTagsInfinite<
60
60
  headers: MaybeRef<FindPetsByTagsHeaderParams>,
61
61
  params?: MaybeRef<FindPetsByTagsQueryParams>,
62
62
  options: {
63
- query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>
63
+ query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
64
64
  client?: Partial<RequestConfig>
65
65
  } = {},
66
66
  ) {
@@ -71,7 +71,7 @@ export function useFindPetsByTagsInfinite<
71
71
  ...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions),
72
72
  queryKey: queryKey as QueryKey,
73
73
  ...(queryOptions as unknown as Omit<InfiniteQueryObserverOptions, 'queryKey'>),
74
- }) as UseInfiniteQueryReturnType<TData, FindPetsByTags400> & { queryKey: TQueryKey }
74
+ }) as UseInfiniteQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
75
75
 
76
76
  query.queryKey = queryKey as TQueryKey
77
77
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from 'custom-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { queryOptions, useQuery } from 'custom-query'
@@ -23,7 +23,7 @@ async function updatePetWithForm(
23
23
  params?: UpdatePetWithFormQueryParams,
24
24
  config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
25
25
  ) {
26
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
26
+ const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
27
27
  method: 'POST',
28
28
  url: `/pet/${petId}`,
29
29
  params,
@@ -40,7 +40,7 @@ export function updatePetWithFormQueryOptions(
40
40
  config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
41
41
  ) {
42
42
  const queryKey = updatePetWithFormQueryKey(petId, data, params)
43
- return queryOptions({
43
+ return queryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationResponse, typeof queryKey>({
44
44
  enabled: !!petId,
45
45
  queryKey,
46
46
  queryFn: async ({ signal }) => {
@@ -63,7 +63,7 @@ export function useUpdatePetWithForm<
63
63
  data?: MaybeRef<UpdatePetWithFormMutationRequest>,
64
64
  params?: MaybeRef<UpdatePetWithFormQueryParams>,
65
65
  options: {
66
- query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>
66
+ query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>>
67
67
  client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
68
68
  } = {},
69
69
  ) {
@@ -74,7 +74,7 @@ export function useUpdatePetWithForm<
74
74
  ...(updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions),
75
75
  queryKey: queryKey as QueryKey,
76
76
  ...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
77
- }) as UseQueryReturnType<TData, UpdatePetWithForm405> & { queryKey: TQueryKey }
77
+ }) as UseQueryReturnType<TData, ResponseErrorConfig<UpdatePetWithForm405>> & { queryKey: TQueryKey }
78
78
 
79
79
  query.queryKey = queryKey as TQueryKey
80
80
 
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { MutationObserverOptions } from '@tanstack/vue-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { useMutation } from '@tanstack/vue-query'
@@ -18,7 +18,7 @@ async function updatePetWithForm(
18
18
  params?: UpdatePetWithFormQueryParams,
19
19
  config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
20
20
  ) {
21
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
21
+ const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
22
22
  method: 'POST',
23
23
  url: `/pet/${petId}`,
24
24
  params,
@@ -36,7 +36,7 @@ export function useUpdatePetWithForm(
36
36
  options: {
37
37
  mutation?: MutationObserverOptions<
38
38
  UpdatePetWithFormMutationResponse,
39
- UpdatePetWithForm405,
39
+ ResponseErrorConfig<UpdatePetWithForm405>,
40
40
  {
41
41
  petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
42
42
  data?: MaybeRef<UpdatePetWithFormMutationRequest>
@@ -51,7 +51,7 @@ export function useUpdatePetWithForm(
51
51
 
52
52
  return useMutation<
53
53
  UpdatePetWithFormMutationResponse,
54
- UpdatePetWithForm405,
54
+ ResponseErrorConfig<UpdatePetWithForm405>,
55
55
  { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
56
56
  >({
57
57
  mutationFn: async ({ petId, data, params }) => {
@@ -1,5 +1,5 @@
1
1
  import client from '@kubb/plugin-client/clients/axios'
2
- import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
2
+ import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
3
3
  import type { MutationObserverOptions } from '@tanstack/vue-query'
4
4
  import type { MaybeRef } from 'vue'
5
5
  import { useMutation } from '@tanstack/vue-query'
@@ -18,7 +18,7 @@ async function updatePetWithForm(
18
18
  params?: UpdatePetWithFormQueryParams,
19
19
  config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
20
20
  ) {
21
- const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
21
+ const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
22
22
  method: 'POST',
23
23
  url: `/pet/${petId}`,
24
24
  params,
@@ -36,7 +36,7 @@ export function useUpdatePetWithForm(
36
36
  options: {
37
37
  mutation?: MutationObserverOptions<
38
38
  UpdatePetWithFormMutationResponse,
39
- UpdatePetWithForm405,
39
+ ResponseErrorConfig<UpdatePetWithForm405>,
40
40
  {
41
41
  petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
42
42
  data?: MaybeRef<UpdatePetWithFormMutationRequest>
@@ -51,7 +51,7 @@ export function useUpdatePetWithForm(
51
51
 
52
52
  return useMutation<
53
53
  UpdatePetWithFormMutationResponse,
54
- UpdatePetWithForm405,
54
+ ResponseErrorConfig<UpdatePetWithForm405>,
55
55
  { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
56
56
  >({
57
57
  mutationFn: async ({ petId, data, params }) => {
@@ -66,7 +66,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
66
66
  <File.Import name={['unref']} path="vue" />
67
67
  <File.Import name={['MaybeRef']} path="vue" isTypeOnly />
68
68
  <File.Import name={'client'} path={options.client.importPath} />
69
- <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />
69
+ <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
70
70
  {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
71
71
  <File.Import
72
72
  name={[
@@ -61,7 +61,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
61
61
  {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}
62
62
  <File.Import name={['MaybeRef']} path="vue" isTypeOnly />
63
63
  <File.Import name={'client'} path={options.client.importPath} />
64
- <File.Import name={['RequestConfig', 'ResponseConfig']} path={options.client.importPath} isTypeOnly />
64
+ <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
65
65
  <File.Import
66
66
  name={[
67
67
  type.schemas.request?.name,