@kubb/plugin-react-query 3.7.4 → 3.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-4SVY7MCZ.cjs → chunk-3POXOHIV.cjs} +32 -28
- package/dist/chunk-3POXOHIV.cjs.map +1 -0
- package/dist/{chunk-3SWEEDDH.js → chunk-BV6GD6VN.js} +17 -17
- package/dist/chunk-BV6GD6VN.js.map +1 -0
- package/dist/{chunk-VEHA2AAW.cjs → chunk-K33QTZRP.cjs} +17 -17
- package/dist/chunk-K33QTZRP.cjs.map +1 -0
- package/dist/{chunk-DJNTPCIJ.js → chunk-YWHO7HRI.js} +14 -10
- package/dist/chunk-YWHO7HRI.js.map +1 -0
- package/dist/components.cjs +9 -9
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/components.js +1 -1
- package/dist/generators.cjs +6 -6
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{types-CQseu_km.d.cts → types-dh-ZAXtR.d.cts} +8 -0
- package/dist/{types-CQseu_km.d.ts → types-dh-ZAXtR.d.ts} +8 -0
- package/package.json +10 -10
- package/src/components/InfiniteQuery.tsx +4 -4
- package/src/components/Mutation.tsx +3 -3
- package/src/components/Query.tsx +4 -4
- package/src/components/SuspenseQuery.tsx +4 -4
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +13 -8
- package/src/generators/__snapshots__/clientGetImportPath.ts +13 -8
- package/src/generators/__snapshots__/clientPostImportPath.ts +12 -9
- package/src/generators/__snapshots__/findByTags.ts +13 -8
- package/src/generators/__snapshots__/findByTagsObject.ts +13 -8
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +13 -8
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +13 -8
- package/src/generators/__snapshots__/findByTagsWithZod.ts +13 -8
- package/src/generators/__snapshots__/findInfiniteByTags.ts +13 -8
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +13 -8
- package/src/generators/__snapshots__/getPetIdCamelCase.ts +13 -8
- package/src/generators/__snapshots__/postAsQuery.ts +13 -8
- package/src/generators/__snapshots__/updatePetById.ts +12 -9
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +12 -9
- package/src/generators/infiniteQueryGenerator.tsx +1 -1
- package/src/generators/mutationGenerator.tsx +1 -1
- package/src/generators/queryGenerator.tsx +1 -1
- package/src/generators/suspenseQueryGenerator.tsx +1 -1
- package/dist/chunk-3SWEEDDH.js.map +0 -1
- package/dist/chunk-4SVY7MCZ.cjs.map +0 -1
- package/dist/chunk-DJNTPCIJ.js.map +0 -1
- package/dist/chunk-VEHA2AAW.cjs.map +0 -1
|
@@ -65,7 +65,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
65
65
|
options: {
|
|
66
66
|
type: `
|
|
67
67
|
{
|
|
68
|
-
query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}
|
|
68
|
+
query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },
|
|
69
69
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : 'Partial<RequestConfig> & { client?: typeof client }'}
|
|
70
70
|
}
|
|
71
71
|
`,
|
|
@@ -103,7 +103,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
103
103
|
options: {
|
|
104
104
|
type: `
|
|
105
105
|
{
|
|
106
|
-
query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}
|
|
106
|
+
query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },
|
|
107
107
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof client }` : 'Partial<RequestConfig> & { client?: typeof client }'}
|
|
108
108
|
}
|
|
109
109
|
`,
|
|
@@ -162,14 +162,14 @@ export function SuspenseQuery({
|
|
|
162
162
|
}}
|
|
163
163
|
>
|
|
164
164
|
{`
|
|
165
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
165
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
166
166
|
const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})
|
|
167
167
|
|
|
168
168
|
const query = useSuspenseQuery({
|
|
169
169
|
...${queryOptions},
|
|
170
170
|
queryKey,
|
|
171
171
|
...queryOptions as unknown as Omit<UseSuspenseQueryOptions, "queryKey">
|
|
172
|
-
}) as ${returnType}
|
|
172
|
+
}, queryClient) as ${returnType}
|
|
173
173
|
|
|
174
174
|
query.queryKey = queryKey as TQueryKey
|
|
175
175
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -62,18 +62,23 @@ export function useFindPetsByTags<
|
|
|
62
62
|
headers: FindPetsByTagsHeaderParams,
|
|
63
63
|
params?: FindPetsByTagsQueryParams,
|
|
64
64
|
options: {
|
|
65
|
-
query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
65
|
+
query?: Partial<QueryObserverOptions<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
66
|
+
client?: QueryClient
|
|
67
|
+
}
|
|
66
68
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
67
69
|
} = {},
|
|
68
70
|
) {
|
|
69
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
71
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
70
72
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
71
73
|
|
|
72
|
-
const query = useQuery(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
const query = useQuery(
|
|
75
|
+
{
|
|
76
|
+
...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
|
|
77
|
+
queryKey,
|
|
78
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
79
|
+
},
|
|
80
|
+
queryClient,
|
|
81
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
77
82
|
|
|
78
83
|
query.queryKey = queryKey as TQueryKey
|
|
79
84
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from 'axios'
|
|
2
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
2
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
3
|
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
@@ -57,18 +57,23 @@ export function useFindPetsByTags<
|
|
|
57
57
|
headers: FindPetsByTagsHeaderParams,
|
|
58
58
|
params?: FindPetsByTagsQueryParams,
|
|
59
59
|
options: {
|
|
60
|
-
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
60
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
61
|
+
client?: QueryClient
|
|
62
|
+
}
|
|
61
63
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
62
64
|
} = {},
|
|
63
65
|
) {
|
|
64
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
66
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
65
67
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
66
68
|
|
|
67
|
-
const query = useQuery(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const query = useQuery(
|
|
70
|
+
{
|
|
71
|
+
...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
|
|
72
|
+
queryKey,
|
|
73
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
74
|
+
},
|
|
75
|
+
queryClient,
|
|
76
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
72
77
|
|
|
73
78
|
query.queryKey = queryKey as TQueryKey
|
|
74
79
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import client from 'axios'
|
|
2
|
-
import type { UseMutationOptions } from '@tanstack/react-query'
|
|
2
|
+
import type { UseMutationOptions, QueryClient } from '@tanstack/react-query'
|
|
3
3
|
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
4
4
|
import { useMutation } from '@tanstack/react-query'
|
|
5
5
|
|
|
@@ -40,11 +40,11 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
40
40
|
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
41
41
|
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
42
42
|
TContext
|
|
43
|
-
>
|
|
43
|
+
> & { client?: QueryClient }
|
|
44
44
|
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
|
|
45
45
|
} = {},
|
|
46
46
|
) {
|
|
47
|
-
const { mutation: mutationOptions, client: config = {} } = options ?? {}
|
|
47
|
+
const { mutation: { client: queryClient, ...mutationOptions } = {}, client: config = {} } = options ?? {}
|
|
48
48
|
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
49
49
|
|
|
50
50
|
return useMutation<
|
|
@@ -52,11 +52,14 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
52
52
|
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
53
53
|
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
54
54
|
TContext
|
|
55
|
-
>(
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
>(
|
|
56
|
+
{
|
|
57
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
58
|
+
return updatePetWithForm(petId, data, params, config)
|
|
59
|
+
},
|
|
60
|
+
mutationKey,
|
|
61
|
+
...mutationOptions,
|
|
58
62
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
63
|
+
queryClient,
|
|
64
|
+
)
|
|
62
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -57,18 +57,23 @@ export function useFindPetsByTags<
|
|
|
57
57
|
headers: FindPetsByTagsHeaderParams,
|
|
58
58
|
params?: FindPetsByTagsQueryParams,
|
|
59
59
|
options: {
|
|
60
|
-
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
60
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
61
|
+
client?: QueryClient
|
|
62
|
+
}
|
|
61
63
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
62
64
|
} = {},
|
|
63
65
|
) {
|
|
64
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
66
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
65
67
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
66
68
|
|
|
67
|
-
const query = useQuery(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const query = useQuery(
|
|
70
|
+
{
|
|
71
|
+
...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
|
|
72
|
+
queryKey,
|
|
73
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
74
|
+
},
|
|
75
|
+
queryClient,
|
|
76
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
72
77
|
|
|
73
78
|
query.queryKey = queryKey as TQueryKey
|
|
74
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -54,18 +54,23 @@ export function useFindPetsByTags<
|
|
|
54
54
|
>(
|
|
55
55
|
{ headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
|
|
56
56
|
options: {
|
|
57
|
-
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
57
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
58
|
+
client?: QueryClient
|
|
59
|
+
}
|
|
58
60
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
59
61
|
} = {},
|
|
60
62
|
) {
|
|
61
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
63
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
62
64
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
63
65
|
|
|
64
|
-
const query = useQuery(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const query = useQuery(
|
|
67
|
+
{
|
|
68
|
+
...(findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions),
|
|
69
|
+
queryKey,
|
|
70
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
71
|
+
},
|
|
72
|
+
queryClient,
|
|
73
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
69
74
|
|
|
70
75
|
query.queryKey = queryKey as TQueryKey
|
|
71
76
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -57,18 +57,23 @@ export function useFindPetsByTags<
|
|
|
57
57
|
headers: FindPetsByTagsHeaderParams,
|
|
58
58
|
params?: FindPetsByTagsQueryParams,
|
|
59
59
|
options: {
|
|
60
|
-
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
60
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
61
|
+
client?: QueryClient
|
|
62
|
+
}
|
|
61
63
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
62
64
|
} = {},
|
|
63
65
|
) {
|
|
64
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
66
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
65
67
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
66
68
|
|
|
67
|
-
const query = useQuery(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const query = useQuery(
|
|
70
|
+
{
|
|
71
|
+
...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
|
|
72
|
+
queryKey,
|
|
73
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
74
|
+
},
|
|
75
|
+
queryClient,
|
|
76
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
72
77
|
|
|
73
78
|
query.queryKey = queryKey as TQueryKey
|
|
74
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => ['test', { url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -57,18 +57,23 @@ export function useFindPetsByTags<
|
|
|
57
57
|
headers: FindPetsByTagsHeaderParams,
|
|
58
58
|
params?: FindPetsByTagsQueryParams,
|
|
59
59
|
options: {
|
|
60
|
-
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
60
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
61
|
+
client?: QueryClient
|
|
62
|
+
}
|
|
61
63
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
62
64
|
} = {},
|
|
63
65
|
) {
|
|
64
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
66
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
65
67
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
66
68
|
|
|
67
|
-
const query = useQuery(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const query = useQuery(
|
|
70
|
+
{
|
|
71
|
+
...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
|
|
72
|
+
queryKey,
|
|
73
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
74
|
+
},
|
|
75
|
+
queryClient,
|
|
76
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
72
77
|
|
|
73
78
|
query.queryKey = queryKey as TQueryKey
|
|
74
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -57,18 +57,23 @@ export function useFindPetsByTags<
|
|
|
57
57
|
headers: FindPetsByTagsHeaderParams,
|
|
58
58
|
params?: FindPetsByTagsQueryParams,
|
|
59
59
|
options: {
|
|
60
|
-
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
60
|
+
query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
61
|
+
client?: QueryClient
|
|
62
|
+
}
|
|
61
63
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
62
64
|
} = {},
|
|
63
65
|
) {
|
|
64
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
66
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
65
67
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params)
|
|
66
68
|
|
|
67
|
-
const query = useQuery(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const query = useQuery(
|
|
70
|
+
{
|
|
71
|
+
...(findPetsByTagsQueryOptions(headers, params, config) as unknown as QueryObserverOptions),
|
|
72
|
+
queryKey,
|
|
73
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
74
|
+
},
|
|
75
|
+
queryClient,
|
|
76
|
+
) as UseQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
72
77
|
|
|
73
78
|
query.queryKey = queryKey as TQueryKey
|
|
74
79
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -64,18 +64,23 @@ export function useFindPetsByTagsInfinite<
|
|
|
64
64
|
headers: FindPetsByTagsHeaderParams,
|
|
65
65
|
params?: FindPetsByTagsQueryParams,
|
|
66
66
|
options: {
|
|
67
|
-
query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
67
|
+
query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
68
|
+
client?: QueryClient
|
|
69
|
+
}
|
|
68
70
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
69
71
|
} = {},
|
|
70
72
|
) {
|
|
71
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
73
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
72
74
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
|
|
73
75
|
|
|
74
|
-
const query = useInfiniteQuery(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const query = useInfiniteQuery(
|
|
77
|
+
{
|
|
78
|
+
...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions),
|
|
79
|
+
queryKey,
|
|
80
|
+
...(queryOptions as unknown as Omit<InfiniteQueryObserverOptions, 'queryKey'>),
|
|
81
|
+
},
|
|
82
|
+
queryClient,
|
|
83
|
+
) as UseInfiniteQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
79
84
|
|
|
80
85
|
query.queryKey = queryKey as TQueryKey
|
|
81
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { InfiniteData, QueryKey, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { InfiniteData, QueryKey, QueryClient, InfiniteQueryObserverOptions, UseInfiniteQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { infiniteQueryOptions, useInfiniteQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const findPetsByTagsInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
@@ -64,18 +64,23 @@ export function useFindPetsByTagsInfinite<
|
|
|
64
64
|
headers: FindPetsByTagsHeaderParams,
|
|
65
65
|
params?: FindPetsByTagsQueryParams,
|
|
66
66
|
options: {
|
|
67
|
-
query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>>
|
|
67
|
+
query?: Partial<InfiniteQueryObserverOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
|
|
68
|
+
client?: QueryClient
|
|
69
|
+
}
|
|
68
70
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
69
71
|
} = {},
|
|
70
72
|
) {
|
|
71
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
73
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
72
74
|
const queryKey = queryOptions?.queryKey ?? findPetsByTagsInfiniteQueryKey(params)
|
|
73
75
|
|
|
74
|
-
const query = useInfiniteQuery(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const query = useInfiniteQuery(
|
|
77
|
+
{
|
|
78
|
+
...(findPetsByTagsInfiniteQueryOptions(headers, params, config) as unknown as InfiniteQueryObserverOptions),
|
|
79
|
+
queryKey,
|
|
80
|
+
...(queryOptions as unknown as Omit<InfiniteQueryObserverOptions, 'queryKey'>),
|
|
81
|
+
},
|
|
82
|
+
queryClient,
|
|
83
|
+
) as UseInfiniteQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
79
84
|
|
|
80
85
|
query.queryKey = queryKey as TQueryKey
|
|
81
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from '@tanstack/react-query'
|
|
4
4
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const getPetByIdQueryKey = (petId: GetPetByIdPathParams['pet_id']) => [{ url: '/pet/:pet_id', params: { petId: petId } }] as const
|
|
@@ -43,18 +43,23 @@ export function getPetByIdQueryOptions(petId: GetPetByIdPathParams['pet_id'], co
|
|
|
43
43
|
export function useGetPetById<TData = GetPetByIdQueryResponse, TQueryData = GetPetByIdQueryResponse, TQueryKey extends QueryKey = GetPetByIdQueryKey>(
|
|
44
44
|
petId: GetPetByIdPathParams['pet_id'],
|
|
45
45
|
options: {
|
|
46
|
-
query?: Partial<QueryObserverOptions<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, TData, TQueryData, TQueryKey>>
|
|
46
|
+
query?: Partial<QueryObserverOptions<GetPetByIdQueryResponse, ResponseErrorConfig<GetPetById400 | GetPetById404>, TData, TQueryData, TQueryKey>> & {
|
|
47
|
+
client?: QueryClient
|
|
48
|
+
}
|
|
47
49
|
client?: Partial<RequestConfig> & { client?: typeof client }
|
|
48
50
|
} = {},
|
|
49
51
|
) {
|
|
50
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
52
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
51
53
|
const queryKey = queryOptions?.queryKey ?? getPetByIdQueryKey(petId)
|
|
52
54
|
|
|
53
|
-
const query = useQuery(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
const query = useQuery(
|
|
56
|
+
{
|
|
57
|
+
...(getPetByIdQueryOptions(petId, config) as unknown as QueryObserverOptions),
|
|
58
|
+
queryKey,
|
|
59
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
60
|
+
},
|
|
61
|
+
queryClient,
|
|
62
|
+
) as UseQueryResult<TData, ResponseErrorConfig<GetPetById400 | GetPetById404>> & { queryKey: TQueryKey }
|
|
58
63
|
|
|
59
64
|
query.queryKey = queryKey as TQueryKey
|
|
60
65
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryResult } from 'custom-query'
|
|
3
|
+
import type { QueryKey, QueryClient, QueryObserverOptions, UseQueryResult } from 'custom-query'
|
|
4
4
|
import { queryOptions, useQuery } from 'custom-query'
|
|
5
5
|
|
|
6
6
|
export const updatePetWithFormQueryKey = (
|
|
@@ -63,18 +63,23 @@ export function useUpdatePetWithForm<
|
|
|
63
63
|
data?: UpdatePetWithFormMutationRequest,
|
|
64
64
|
params?: UpdatePetWithFormQueryParams,
|
|
65
65
|
options: {
|
|
66
|
-
query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>>
|
|
66
|
+
query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>> & {
|
|
67
|
+
client?: QueryClient
|
|
68
|
+
}
|
|
67
69
|
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
|
|
68
70
|
} = {},
|
|
69
71
|
) {
|
|
70
|
-
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
72
|
+
const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
|
|
71
73
|
const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params)
|
|
72
74
|
|
|
73
|
-
const query = useQuery(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
const query = useQuery(
|
|
76
|
+
{
|
|
77
|
+
...(updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions),
|
|
78
|
+
queryKey,
|
|
79
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
80
|
+
},
|
|
81
|
+
queryClient,
|
|
82
|
+
) as UseQueryResult<TData, ResponseErrorConfig<UpdatePetWithForm405>> & { queryKey: TQueryKey }
|
|
78
83
|
|
|
79
84
|
query.queryKey = queryKey as TQueryKey
|
|
80
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { UseMutationOptions } from '@tanstack/react-query'
|
|
3
|
+
import type { UseMutationOptions, QueryClient } from '@tanstack/react-query'
|
|
4
4
|
import { useMutation } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as const
|
|
@@ -40,11 +40,11 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
40
40
|
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
41
41
|
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
42
42
|
TContext
|
|
43
|
-
>
|
|
43
|
+
> & { client?: QueryClient }
|
|
44
44
|
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
|
|
45
45
|
} = {},
|
|
46
46
|
) {
|
|
47
|
-
const { mutation: mutationOptions, client: config = {} } = options ?? {}
|
|
47
|
+
const { mutation: { client: queryClient, ...mutationOptions } = {}, client: config = {} } = options ?? {}
|
|
48
48
|
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
49
49
|
|
|
50
50
|
return useMutation<
|
|
@@ -52,11 +52,14 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
52
52
|
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
53
53
|
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
54
54
|
TContext
|
|
55
|
-
>(
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
>(
|
|
56
|
+
{
|
|
57
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
58
|
+
return updatePetWithForm(petId, data, params, config)
|
|
59
|
+
},
|
|
60
|
+
mutationKey,
|
|
61
|
+
...mutationOptions,
|
|
58
62
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
63
|
+
queryClient,
|
|
64
|
+
)
|
|
62
65
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
-
import type { UseMutationOptions } from '@tanstack/react-query'
|
|
3
|
+
import type { UseMutationOptions, QueryClient } from '@tanstack/react-query'
|
|
4
4
|
import { useMutation } from '@tanstack/react-query'
|
|
5
5
|
|
|
6
6
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{pet_id}' }] as const
|
|
@@ -40,11 +40,11 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
40
40
|
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
41
41
|
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
42
42
|
TContext
|
|
43
|
-
>
|
|
43
|
+
> & { client?: QueryClient }
|
|
44
44
|
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
|
|
45
45
|
} = {},
|
|
46
46
|
) {
|
|
47
|
-
const { mutation: mutationOptions, client: config = {} } = options ?? {}
|
|
47
|
+
const { mutation: { client: queryClient, ...mutationOptions } = {}, client: config = {} } = options ?? {}
|
|
48
48
|
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
49
49
|
|
|
50
50
|
return useMutation<
|
|
@@ -52,11 +52,14 @@ export function useUpdatePetWithForm<TContext>(
|
|
|
52
52
|
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
53
53
|
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
54
54
|
TContext
|
|
55
|
-
>(
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
>(
|
|
56
|
+
{
|
|
57
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
58
|
+
return updatePetWithForm({ petId }, data, params, config)
|
|
59
|
+
},
|
|
60
|
+
mutationKey,
|
|
61
|
+
...mutationOptions,
|
|
58
62
|
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
})
|
|
63
|
+
queryClient,
|
|
64
|
+
)
|
|
62
65
|
}
|
|
@@ -147,7 +147,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
147
147
|
{options.infinite && (
|
|
148
148
|
<>
|
|
149
149
|
<File.Import name={['useInfiniteQuery']} path={importPath} />
|
|
150
|
-
<File.Import name={['QueryKey', 'InfiniteQueryObserverOptions', 'UseInfiniteQueryResult']} path={importPath} isTypeOnly />
|
|
150
|
+
<File.Import name={['QueryKey', 'QueryClient', 'InfiniteQueryObserverOptions', 'UseInfiniteQueryResult']} path={importPath} isTypeOnly />
|
|
151
151
|
<InfiniteQuery
|
|
152
152
|
name={query.name}
|
|
153
153
|
queryOptionsName={queryOptions.name}
|
|
@@ -123,7 +123,7 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
123
123
|
{options.mutation && (
|
|
124
124
|
<>
|
|
125
125
|
<File.Import name={['useMutation']} path={importPath} />
|
|
126
|
-
<File.Import name={['UseMutationOptions']} path={importPath} isTypeOnly />
|
|
126
|
+
<File.Import name={['UseMutationOptions', 'QueryClient']} path={importPath} isTypeOnly />
|
|
127
127
|
<Mutation
|
|
128
128
|
name={mutation.name}
|
|
129
129
|
clientName={client.name}
|
|
@@ -138,7 +138,7 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
138
138
|
{options.query && (
|
|
139
139
|
<>
|
|
140
140
|
<File.Import name={['useQuery']} path={importPath} />
|
|
141
|
-
<File.Import name={['QueryKey', 'QueryObserverOptions', 'UseQueryResult']} path={importPath} isTypeOnly />
|
|
141
|
+
<File.Import name={['QueryKey', 'QueryClient', 'QueryObserverOptions', 'UseQueryResult', 'QueryClient']} path={importPath} isTypeOnly />
|
|
142
142
|
<Query
|
|
143
143
|
name={query.name}
|
|
144
144
|
queryOptionsName={queryOptions.name}
|