@kubb/plugin-react-query 4.5.15 → 4.6.1
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/{components-0G5mZf1J.cjs → components-DGCqud_F.cjs} +319 -25
- package/dist/components-DGCqud_F.cjs.map +1 -0
- package/dist/{components-BWrDXrTl.js → components-K4qy3AIg.js} +307 -25
- package/dist/components-K4qy3AIg.js.map +1 -0
- package/dist/components.cjs +3 -1
- package/dist/components.d.cts +121 -30
- package/dist/components.d.ts +121 -30
- package/dist/components.js +2 -2
- package/dist/{generators-BAjiYTwQ.js → generators-B7OE6SfM.js} +245 -3
- package/dist/generators-B7OE6SfM.js.map +1 -0
- package/dist/{generators-DTCyUuOe.cjs → generators-NgqfQF-c.cjs} +250 -2
- package/dist/generators-NgqfQF-c.cjs.map +1 -0
- package/dist/generators.cjs +3 -2
- package/dist/generators.d.cts +4 -1
- package/dist/generators.d.ts +4 -1
- package/dist/generators.js +3 -3
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/SuspenseInfiniteQuery.tsx +212 -0
- package/src/components/SuspenseInfiniteQueryOptions.tsx +230 -0
- package/src/components/index.ts +2 -0
- package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +100 -0
- package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +100 -0
- package/src/generators/index.ts +1 -0
- package/src/generators/infiniteQueryGenerator.tsx +3 -0
- package/src/generators/mutationGenerator.tsx +3 -0
- package/src/generators/queryGenerator.tsx +3 -0
- package/src/generators/suspenseInfiniteQueryGenerator.tsx +194 -0
- package/src/generators/suspenseQueryGenerator.tsx +3 -0
- package/src/plugin.ts +2 -2
- package/dist/components-0G5mZf1J.cjs.map +0 -1
- package/dist/components-BWrDXrTl.js.map +0 -1
- package/dist/generators-BAjiYTwQ.js.map +0 -1
- package/dist/generators-DTCyUuOe.cjs.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { InfiniteData, QueryKey, QueryClient, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
|
|
7
|
+
import { fetch } from './test/.kubb/fetch'
|
|
8
|
+
import { infiniteQueryOptions, useSuspenseInfiniteQuery } from '@tanstack/react-query'
|
|
9
|
+
|
|
10
|
+
export const findPetsByTagsSuspenseInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
11
|
+
|
|
12
|
+
export type FindPetsByTagsSuspenseInfiniteQueryKey = ReturnType<typeof findPetsByTagsSuspenseInfiniteQueryKey>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
16
|
+
* @summary Finds Pets by tags
|
|
17
|
+
* {@link /pet/findByTags}
|
|
18
|
+
*/
|
|
19
|
+
export async function findPetsByTagsSuspenseInfinite(
|
|
20
|
+
headers: FindPetsByTagsHeaderParams,
|
|
21
|
+
params?: FindPetsByTagsQueryParams,
|
|
22
|
+
config: Partial<RequestConfig> & { client?: typeof fetch } = {},
|
|
23
|
+
) {
|
|
24
|
+
const { client: request = fetch, ...requestConfig } = config
|
|
25
|
+
|
|
26
|
+
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
27
|
+
method: 'GET',
|
|
28
|
+
url: `/pet/findByTags`,
|
|
29
|
+
params,
|
|
30
|
+
...requestConfig,
|
|
31
|
+
headers: { ...headers, ...requestConfig.headers },
|
|
32
|
+
})
|
|
33
|
+
return findPetsByTagsQueryResponse.parse(res.data)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function findPetsByTagsSuspenseInfiniteQueryOptions(
|
|
37
|
+
headers: FindPetsByTagsHeaderParams,
|
|
38
|
+
params?: FindPetsByTagsQueryParams,
|
|
39
|
+
config: Partial<RequestConfig> & { client?: typeof fetch } = {},
|
|
40
|
+
) {
|
|
41
|
+
const queryKey = findPetsByTagsSuspenseInfiniteQueryKey(params)
|
|
42
|
+
return infiniteQueryOptions<
|
|
43
|
+
FindPetsByTagsQueryResponse,
|
|
44
|
+
ResponseErrorConfig<FindPetsByTags400>,
|
|
45
|
+
InfiniteData<FindPetsByTagsQueryResponse>,
|
|
46
|
+
typeof queryKey,
|
|
47
|
+
NonNullable<FindPetsByTagsQueryParams['pageSize']>
|
|
48
|
+
>({
|
|
49
|
+
queryKey,
|
|
50
|
+
queryFn: async ({ signal, pageParam }) => {
|
|
51
|
+
config.signal = signal
|
|
52
|
+
|
|
53
|
+
params = {
|
|
54
|
+
...(params ?? {}),
|
|
55
|
+
['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
|
|
56
|
+
} as FindPetsByTagsQueryParams
|
|
57
|
+
return findPetsByTagsSuspenseInfinite(headers, params, config)
|
|
58
|
+
},
|
|
59
|
+
initialPageParam: 0,
|
|
60
|
+
getNextPageParam: (lastPage, _allPages, lastPageParam) => (Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1),
|
|
61
|
+
getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => (firstPageParam <= 1 ? undefined : firstPageParam - 1),
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
67
|
+
* @summary Finds Pets by tags
|
|
68
|
+
* {@link /pet/findByTags}
|
|
69
|
+
*/
|
|
70
|
+
export function useFindPetsByTagsSuspenseInfinite<
|
|
71
|
+
TQueryFnData = FindPetsByTagsQueryResponse,
|
|
72
|
+
TError = ResponseErrorConfig<FindPetsByTags400>,
|
|
73
|
+
TData = InfiniteData<TQueryFnData>,
|
|
74
|
+
TQueryKey extends QueryKey = FindPetsByTagsSuspenseInfiniteQueryKey,
|
|
75
|
+
TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
|
|
76
|
+
>(
|
|
77
|
+
headers: FindPetsByTagsHeaderParams,
|
|
78
|
+
params?: FindPetsByTagsQueryParams,
|
|
79
|
+
options: {
|
|
80
|
+
query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
|
|
81
|
+
client?: Partial<RequestConfig> & { client?: typeof fetch }
|
|
82
|
+
} = {},
|
|
83
|
+
) {
|
|
84
|
+
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
85
|
+
const { client: queryClient, ...queryOptions } = queryConfig
|
|
86
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseInfiniteQueryKey(params)
|
|
87
|
+
|
|
88
|
+
const query = useSuspenseInfiniteQuery(
|
|
89
|
+
{
|
|
90
|
+
...findPetsByTagsSuspenseInfiniteQueryOptions(headers, params, config),
|
|
91
|
+
queryKey,
|
|
92
|
+
...queryOptions,
|
|
93
|
+
} as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
|
|
94
|
+
queryClient,
|
|
95
|
+
) as UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
|
|
96
|
+
|
|
97
|
+
query.queryKey = queryKey as TQueryKey
|
|
98
|
+
|
|
99
|
+
return query
|
|
100
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
6
|
+
import type { InfiniteData, QueryKey, QueryClient, UseSuspenseInfiniteQueryOptions, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query'
|
|
7
|
+
import { fetch } from './test/.kubb/fetch'
|
|
8
|
+
import { infiniteQueryOptions, useSuspenseInfiniteQuery } from '@tanstack/react-query'
|
|
9
|
+
|
|
10
|
+
export const findPetsByTagsSuspenseInfiniteQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
11
|
+
|
|
12
|
+
export type FindPetsByTagsSuspenseInfiniteQueryKey = ReturnType<typeof findPetsByTagsSuspenseInfiniteQueryKey>
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
16
|
+
* @summary Finds Pets by tags
|
|
17
|
+
* {@link /pet/findByTags}
|
|
18
|
+
*/
|
|
19
|
+
export async function findPetsByTagsSuspenseInfinite(
|
|
20
|
+
headers: FindPetsByTagsHeaderParams,
|
|
21
|
+
params?: FindPetsByTagsQueryParams,
|
|
22
|
+
config: Partial<RequestConfig> & { client?: typeof fetch } = {},
|
|
23
|
+
) {
|
|
24
|
+
const { client: request = fetch, ...requestConfig } = config
|
|
25
|
+
|
|
26
|
+
const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
27
|
+
method: 'GET',
|
|
28
|
+
url: `/pet/findByTags`,
|
|
29
|
+
params,
|
|
30
|
+
...requestConfig,
|
|
31
|
+
headers: { ...headers, ...requestConfig.headers },
|
|
32
|
+
})
|
|
33
|
+
return findPetsByTagsQueryResponse.parse(res.data)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function findPetsByTagsSuspenseInfiniteQueryOptions(
|
|
37
|
+
headers: FindPetsByTagsHeaderParams,
|
|
38
|
+
params?: FindPetsByTagsQueryParams,
|
|
39
|
+
config: Partial<RequestConfig> & { client?: typeof fetch } = {},
|
|
40
|
+
) {
|
|
41
|
+
const queryKey = findPetsByTagsSuspenseInfiniteQueryKey(params)
|
|
42
|
+
return infiniteQueryOptions<
|
|
43
|
+
FindPetsByTagsQueryResponse,
|
|
44
|
+
ResponseErrorConfig<FindPetsByTags400>,
|
|
45
|
+
InfiniteData<FindPetsByTagsQueryResponse>,
|
|
46
|
+
typeof queryKey,
|
|
47
|
+
NonNullable<FindPetsByTagsQueryParams['pageSize']>
|
|
48
|
+
>({
|
|
49
|
+
queryKey,
|
|
50
|
+
queryFn: async ({ signal, pageParam }) => {
|
|
51
|
+
config.signal = signal
|
|
52
|
+
|
|
53
|
+
params = {
|
|
54
|
+
...(params ?? {}),
|
|
55
|
+
['pageSize']: pageParam as unknown as FindPetsByTagsQueryParams['pageSize'],
|
|
56
|
+
} as FindPetsByTagsQueryParams
|
|
57
|
+
return findPetsByTagsSuspenseInfinite(headers, params, config)
|
|
58
|
+
},
|
|
59
|
+
initialPageParam: 0,
|
|
60
|
+
getNextPageParam: (lastPage) => lastPage['cursor'],
|
|
61
|
+
getPreviousPageParam: (firstPage) => firstPage['cursor'],
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
|
67
|
+
* @summary Finds Pets by tags
|
|
68
|
+
* {@link /pet/findByTags}
|
|
69
|
+
*/
|
|
70
|
+
export function useFindPetsByTagsSuspenseInfinite<
|
|
71
|
+
TQueryFnData = FindPetsByTagsQueryResponse,
|
|
72
|
+
TError = ResponseErrorConfig<FindPetsByTags400>,
|
|
73
|
+
TData = InfiniteData<TQueryFnData>,
|
|
74
|
+
TQueryKey extends QueryKey = FindPetsByTagsSuspenseInfiniteQueryKey,
|
|
75
|
+
TPageParam = NonNullable<FindPetsByTagsQueryParams['pageSize']>,
|
|
76
|
+
>(
|
|
77
|
+
headers: FindPetsByTagsHeaderParams,
|
|
78
|
+
params?: FindPetsByTagsQueryParams,
|
|
79
|
+
options: {
|
|
80
|
+
query?: Partial<UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>> & { client?: QueryClient }
|
|
81
|
+
client?: Partial<RequestConfig> & { client?: typeof fetch }
|
|
82
|
+
} = {},
|
|
83
|
+
) {
|
|
84
|
+
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
85
|
+
const { client: queryClient, ...queryOptions } = queryConfig
|
|
86
|
+
const queryKey = queryOptions?.queryKey ?? findPetsByTagsSuspenseInfiniteQueryKey(params)
|
|
87
|
+
|
|
88
|
+
const query = useSuspenseInfiniteQuery(
|
|
89
|
+
{
|
|
90
|
+
...findPetsByTagsSuspenseInfiniteQueryOptions(headers, params, config),
|
|
91
|
+
queryKey,
|
|
92
|
+
...queryOptions,
|
|
93
|
+
} as unknown as UseSuspenseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>,
|
|
94
|
+
queryClient,
|
|
95
|
+
) as UseSuspenseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }
|
|
96
|
+
|
|
97
|
+
query.queryKey = queryKey as TQueryKey
|
|
98
|
+
|
|
99
|
+
return query
|
|
100
|
+
}
|
package/src/generators/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { infiniteQueryGenerator } from './infiniteQueryGenerator.tsx'
|
|
2
2
|
export { mutationGenerator } from './mutationGenerator.tsx'
|
|
3
3
|
export { queryGenerator } from './queryGenerator.tsx'
|
|
4
|
+
export { suspenseInfiniteQueryGenerator } from './suspenseInfiniteQueryGenerator.tsx'
|
|
4
5
|
export { suspenseQueryGenerator } from './suspenseQueryGenerator.tsx'
|
|
@@ -122,6 +122,9 @@ export const infiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
122
122
|
)}
|
|
123
123
|
|
|
124
124
|
{hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
|
|
125
|
+
{!hasClientPlugin && (
|
|
126
|
+
<File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
127
|
+
)}
|
|
125
128
|
<File.Import
|
|
126
129
|
name={[
|
|
127
130
|
type.schemas.request?.name,
|
|
@@ -112,6 +112,9 @@ export const mutationGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
112
112
|
</>
|
|
113
113
|
)}
|
|
114
114
|
{!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}
|
|
115
|
+
{!hasClientPlugin && (
|
|
116
|
+
<File.Import name={['buildFormData']} root={mutation.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
117
|
+
)}
|
|
115
118
|
<File.Import
|
|
116
119
|
name={[
|
|
117
120
|
type.schemas.request?.name,
|
|
@@ -114,6 +114,9 @@ export const queryGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
114
114
|
)}
|
|
115
115
|
|
|
116
116
|
{hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
|
|
117
|
+
{!hasClientPlugin && (
|
|
118
|
+
<File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
119
|
+
)}
|
|
117
120
|
<File.Import
|
|
118
121
|
name={[
|
|
119
122
|
type.schemas.request?.name,
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import { usePluginManager } from '@kubb/core/hooks'
|
|
3
|
+
import { pluginClientName } from '@kubb/plugin-client'
|
|
4
|
+
import { Client } from '@kubb/plugin-client/components'
|
|
5
|
+
import { createReactGenerator } from '@kubb/plugin-oas/generators'
|
|
6
|
+
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
7
|
+
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
8
|
+
import { pluginTsName } from '@kubb/plugin-ts'
|
|
9
|
+
import { pluginZodName } from '@kubb/plugin-zod'
|
|
10
|
+
import { File } from '@kubb/react-fabric'
|
|
11
|
+
import { difference } from 'remeda'
|
|
12
|
+
import { QueryKey, SuspenseInfiniteQuery, SuspenseInfiniteQueryOptions } from '../components'
|
|
13
|
+
import type { PluginReactQuery } from '../types'
|
|
14
|
+
|
|
15
|
+
export const suspenseInfiniteQueryGenerator = createReactGenerator<PluginReactQuery>({
|
|
16
|
+
name: 'react-suspense-infinite-query',
|
|
17
|
+
Operation({ config, operation, generator, plugin }) {
|
|
18
|
+
const {
|
|
19
|
+
options,
|
|
20
|
+
options: { output },
|
|
21
|
+
} = plugin
|
|
22
|
+
const pluginManager = usePluginManager()
|
|
23
|
+
|
|
24
|
+
const oas = useOas()
|
|
25
|
+
const { getSchemas, getName, getFile } = useOperationManager(generator)
|
|
26
|
+
|
|
27
|
+
const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
|
|
28
|
+
const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(
|
|
29
|
+
(method) => operation.method === method,
|
|
30
|
+
)
|
|
31
|
+
const isSuspense = !!options.suspense
|
|
32
|
+
const infiniteOptions = options.infinite && typeof options.infinite === 'object' ? options.infinite : undefined
|
|
33
|
+
|
|
34
|
+
const importPath = options.query ? options.query.importPath : '@tanstack/react-query'
|
|
35
|
+
|
|
36
|
+
const query = {
|
|
37
|
+
name: getName(operation, { type: 'function', prefix: 'use', suffix: 'suspenseInfinite' }),
|
|
38
|
+
typeName: getName(operation, { type: 'type' }),
|
|
39
|
+
file: getFile(operation, { prefix: 'use', suffix: 'suspenseInfinite' }),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName])
|
|
43
|
+
const client = {
|
|
44
|
+
name: hasClientPlugin
|
|
45
|
+
? getName(operation, {
|
|
46
|
+
type: 'function',
|
|
47
|
+
pluginKey: [pluginClientName],
|
|
48
|
+
})
|
|
49
|
+
: getName(operation, {
|
|
50
|
+
type: 'function',
|
|
51
|
+
suffix: 'suspenseInfinite',
|
|
52
|
+
}),
|
|
53
|
+
file: getFile(operation, { pluginKey: [pluginClientName] }),
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const queryOptions = {
|
|
57
|
+
name: getName(operation, { type: 'function', suffix: 'SuspenseInfiniteQueryOptions' }),
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const queryKey = {
|
|
61
|
+
name: getName(operation, { type: 'const', suffix: 'SuspenseInfiniteQueryKey' }),
|
|
62
|
+
typeName: getName(operation, { type: 'type', suffix: 'SuspenseInfiniteQueryKey' }),
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const type = {
|
|
66
|
+
file: getFile(operation, { pluginKey: [pluginTsName] }),
|
|
67
|
+
//todo remove type?
|
|
68
|
+
schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const zod = {
|
|
72
|
+
file: getFile(operation, { pluginKey: [pluginZodName] }),
|
|
73
|
+
schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!isQuery || isMutation || !isSuspense || !infiniteOptions) {
|
|
77
|
+
return null
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<File
|
|
82
|
+
baseName={query.file.baseName}
|
|
83
|
+
path={query.file.path}
|
|
84
|
+
meta={query.file.meta}
|
|
85
|
+
banner={getBanner({ oas, output, config: pluginManager.config })}
|
|
86
|
+
footer={getFooter({ oas, output })}
|
|
87
|
+
>
|
|
88
|
+
{options.parser === 'zod' && (
|
|
89
|
+
<File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />
|
|
90
|
+
)}
|
|
91
|
+
{options.client.importPath ? (
|
|
92
|
+
<>
|
|
93
|
+
<File.Import name={'fetch'} path={options.client.importPath} />
|
|
94
|
+
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
95
|
+
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
96
|
+
</>
|
|
97
|
+
) : (
|
|
98
|
+
<>
|
|
99
|
+
<File.Import name={['fetch']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />
|
|
100
|
+
<File.Import
|
|
101
|
+
name={['RequestConfig', 'ResponseErrorConfig']}
|
|
102
|
+
root={query.file.path}
|
|
103
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
104
|
+
isTypeOnly
|
|
105
|
+
/>
|
|
106
|
+
{options.client.dataReturnType === 'full' && (
|
|
107
|
+
<File.Import name={['ResponseConfig']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />
|
|
108
|
+
)}
|
|
109
|
+
</>
|
|
110
|
+
)}
|
|
111
|
+
|
|
112
|
+
{hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
|
|
113
|
+
{!hasClientPlugin && (
|
|
114
|
+
<File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
115
|
+
)}
|
|
116
|
+
<File.Import
|
|
117
|
+
name={[
|
|
118
|
+
type.schemas.request?.name,
|
|
119
|
+
type.schemas.response.name,
|
|
120
|
+
type.schemas.pathParams?.name,
|
|
121
|
+
type.schemas.queryParams?.name,
|
|
122
|
+
type.schemas.headerParams?.name,
|
|
123
|
+
...(type.schemas.statusCodes?.map((item) => item.name) || []),
|
|
124
|
+
].filter(Boolean)}
|
|
125
|
+
root={query.file.path}
|
|
126
|
+
path={type.file.path}
|
|
127
|
+
isTypeOnly
|
|
128
|
+
/>
|
|
129
|
+
<QueryKey
|
|
130
|
+
name={queryKey.name}
|
|
131
|
+
typeName={queryKey.typeName}
|
|
132
|
+
operation={operation}
|
|
133
|
+
paramsCasing={options.paramsCasing}
|
|
134
|
+
pathParamsType={options.pathParamsType}
|
|
135
|
+
typeSchemas={type.schemas}
|
|
136
|
+
transformer={options.queryKey}
|
|
137
|
+
/>
|
|
138
|
+
{!hasClientPlugin && (
|
|
139
|
+
<Client
|
|
140
|
+
name={client.name}
|
|
141
|
+
baseURL={options.client.baseURL}
|
|
142
|
+
operation={operation}
|
|
143
|
+
typeSchemas={type.schemas}
|
|
144
|
+
zodSchemas={zod.schemas}
|
|
145
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
146
|
+
paramsCasing={options.paramsCasing}
|
|
147
|
+
paramsType={options.paramsType}
|
|
148
|
+
pathParamsType={options.pathParamsType}
|
|
149
|
+
parser={options.parser}
|
|
150
|
+
/>
|
|
151
|
+
)}
|
|
152
|
+
{infiniteOptions && (
|
|
153
|
+
<>
|
|
154
|
+
<File.Import name={['InfiniteData']} isTypeOnly path={importPath} />
|
|
155
|
+
<File.Import name={['infiniteQueryOptions']} path={importPath} />
|
|
156
|
+
<SuspenseInfiniteQueryOptions
|
|
157
|
+
name={queryOptions.name}
|
|
158
|
+
clientName={client.name}
|
|
159
|
+
queryKeyName={queryKey.name}
|
|
160
|
+
typeSchemas={type.schemas}
|
|
161
|
+
paramsCasing={options.paramsCasing}
|
|
162
|
+
paramsType={options.paramsType}
|
|
163
|
+
pathParamsType={options.pathParamsType}
|
|
164
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
165
|
+
cursorParam={infiniteOptions.cursorParam}
|
|
166
|
+
initialPageParam={infiniteOptions.initialPageParam}
|
|
167
|
+
queryParam={infiniteOptions.queryParam}
|
|
168
|
+
/>
|
|
169
|
+
</>
|
|
170
|
+
)}
|
|
171
|
+
{infiniteOptions && (
|
|
172
|
+
<>
|
|
173
|
+
<File.Import name={['useSuspenseInfiniteQuery']} path={importPath} />
|
|
174
|
+
<File.Import name={['QueryKey', 'QueryClient', 'UseSuspenseInfiniteQueryOptions', 'UseSuspenseInfiniteQueryResult']} path={importPath} isTypeOnly />
|
|
175
|
+
<SuspenseInfiniteQuery
|
|
176
|
+
name={query.name}
|
|
177
|
+
queryOptionsName={queryOptions.name}
|
|
178
|
+
typeSchemas={type.schemas}
|
|
179
|
+
paramsCasing={options.paramsCasing}
|
|
180
|
+
paramsType={options.paramsType}
|
|
181
|
+
pathParamsType={options.pathParamsType}
|
|
182
|
+
operation={operation}
|
|
183
|
+
dataReturnType={options.client.dataReturnType || 'data'}
|
|
184
|
+
queryKeyName={queryKey.name}
|
|
185
|
+
queryKeyTypeName={queryKey.typeName}
|
|
186
|
+
initialPageParam={infiniteOptions.initialPageParam}
|
|
187
|
+
queryParam={infiniteOptions.queryParam}
|
|
188
|
+
/>
|
|
189
|
+
</>
|
|
190
|
+
)}
|
|
191
|
+
</File>
|
|
192
|
+
)
|
|
193
|
+
},
|
|
194
|
+
})
|
|
@@ -125,6 +125,9 @@ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
|
|
|
125
125
|
</>
|
|
126
126
|
)}
|
|
127
127
|
{hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
|
|
128
|
+
{!hasClientPlugin && (
|
|
129
|
+
<File.Import name={['buildFormData']} root={query.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />
|
|
130
|
+
)}
|
|
128
131
|
<File.Import
|
|
129
132
|
name={[
|
|
130
133
|
type.schemas.request?.name,
|
package/src/plugin.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { pluginTsName } from '@kubb/plugin-ts'
|
|
|
8
8
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
9
9
|
import { MutationKey } from './components'
|
|
10
10
|
import { QueryKey } from './components/QueryKey.tsx'
|
|
11
|
-
import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from './generators'
|
|
11
|
+
import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseInfiniteQueryGenerator, suspenseQueryGenerator } from './generators'
|
|
12
12
|
import type { PluginReactQuery } from './types.ts'
|
|
13
13
|
|
|
14
14
|
export const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']
|
|
@@ -26,7 +26,7 @@ export const pluginReactQuery = definePlugin<PluginReactQuery>((options) => {
|
|
|
26
26
|
transformers = {},
|
|
27
27
|
paramsType = 'inline',
|
|
28
28
|
pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',
|
|
29
|
-
generators = [queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),
|
|
29
|
+
generators = [queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, suspenseInfiniteQueryGenerator, mutationGenerator].filter(Boolean),
|
|
30
30
|
mutation = {},
|
|
31
31
|
query = {},
|
|
32
32
|
mutationKey = MutationKey.getTransformer,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-0G5mZf1J.cjs","names":["getParams","FunctionParams","getTransformer: Transformer","URLPath","getTransformer","File","Function","Type","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","File","Function","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","getTransformer: Transformer","URLPath","File","Function","Type","getParams","FunctionParams","Client","File","Function","getParams","FunctionParams","File","Function","getParams","FunctionParams","File","Function","FunctionParams","File","Function"],"sources":["../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/InfiniteQuery.tsx","../src/components/InfiniteQueryOptions.tsx","../src/components/MutationKey.tsx","../src/components/MutationOptions.tsx","../src/components/Mutation.tsx","../src/components/Query.tsx","../src/components/SuspenseQuery.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ pathParamsType, paramsCasing, typeSchemas }: GetParamsProps) {\n return FunctionParams.factory({\n pathParams: {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n })\n}\n\nconst getTransformer: Transformer = ({ operation, schemas, casing }) => {\n const path = new URLPath(operation.path, { casing })\n const keys = [\n path.toObject({\n type: 'path',\n stringify: true,\n }),\n schemas.queryParams?.name ? '...(params ? [params] : [])' : undefined,\n schemas.request?.name ? '...(data ? [data] : [])' : undefined,\n ].filter(Boolean)\n\n return keys\n}\n\nexport function QueryKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): KubbNode {\n const params = getParams({ pathParamsType, typeSchemas, paramsCasing })\n const keys = transformer({\n operation,\n schemas: typeSchemas,\n casing: paramsCasing,\n })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nQueryKey.getParams = getParams\nQueryKey.getTransformer = getTransformer\n","import { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, queryKeyName }: Props): KubbNode {\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'\n\n const clientParams = Client.getParams({\n typeSchemas,\n paramsCasing,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n\n const enabled = Object.entries(queryKeyParams.flatParams)\n .map(([key, item]) => (item && !item.optional ? key : undefined))\n .filter(Boolean)\n .join('&& ')\n\n const enabledText = enabled ? `enabled: !!(${enabled}),` : ''\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return queryOptions<${TData}, ResponseErrorConfig<${TError}>, ${TData}, typeof queryKey>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal }) => {\n config.signal = signal\n return ${clientName}(${clientParams.toCall({})})\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nQueryOptions.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { Infinite, PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n initialPageParam: Infinite['initialPageParam']\n queryParam?: Infinite['queryParam']\n}\n\ntype GetParamsProps = {\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n pageParamGeneric: string\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, pageParamGeneric }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, ${pageParamGeneric}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function InfiniteQuery({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n initialPageParam,\n queryParam,\n}: Props): KubbNode {\n const responseType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n const fallbackPageParamType =\n typeof initialPageParam === 'number'\n ? 'number'\n : typeof initialPageParam === 'string'\n ? initialPageParam.includes(' as ')\n ? (() => {\n const parts = initialPageParam.split(' as ')\n return parts[parts.length - 1] ?? 'unknown'\n })()\n : 'string'\n : typeof initialPageParam === 'boolean'\n ? 'boolean'\n : 'unknown'\n const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : undefined\n const pageParamType = queryParamType ? (isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType) : fallbackPageParamType\n const returnType = 'UseInfiniteQueryResult<TData, TError> & { queryKey: TQueryKey }'\n const generics = [\n `TQueryFnData = ${responseType}`,\n `TError = ${errorType}`,\n 'TData = InfiniteData<TQueryFnData>',\n `TQueryKey extends QueryKey = ${queryKeyTypeName}`,\n `TPageParam = ${pageParamType}`,\n ]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsType,\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n pageParamGeneric: 'TPageParam',\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useInfiniteQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as InfiniteQueryObserverOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nInfiniteQuery.getParams = getParams\n","import { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { Infinite, PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n queryKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n initialPageParam: Infinite['initialPageParam']\n cursorParam: Infinite['cursorParam']\n queryParam: Infinite['queryParam']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, {\n typed: true,\n casing: paramsCasing,\n }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function InfiniteQueryOptions({\n name,\n clientName,\n initialPageParam,\n cursorParam,\n typeSchemas,\n paramsCasing,\n paramsType,\n dataReturnType,\n pathParamsType,\n queryParam,\n queryKeyName,\n}: Props): KubbNode {\n const queryFnDataType = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const errorType = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const isInitialPageParamDefined = initialPageParam !== undefined && initialPageParam !== null\n const fallbackPageParamType =\n typeof initialPageParam === 'number'\n ? 'number'\n : typeof initialPageParam === 'string'\n ? initialPageParam.includes(' as ')\n ? (() => {\n const parts = initialPageParam.split(' as ')\n return parts[parts.length - 1] ?? 'unknown'\n })()\n : 'string'\n : typeof initialPageParam === 'boolean'\n ? 'boolean'\n : 'unknown'\n const queryParamType = queryParam && typeSchemas.queryParams?.name ? `${typeSchemas.queryParams?.name}['${queryParam}']` : undefined\n const pageParamType = queryParamType ? (isInitialPageParamDefined ? `NonNullable<${queryParamType}>` : queryParamType) : fallbackPageParamType\n\n const params = getParams({\n paramsType,\n paramsCasing,\n pathParamsType,\n typeSchemas,\n })\n const clientParams = Client.getParams({\n paramsCasing,\n typeSchemas,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n\n const queryOptions = [\n `initialPageParam: ${typeof initialPageParam === 'string' ? JSON.stringify(initialPageParam) : initialPageParam}`,\n cursorParam ? `getNextPageParam: (lastPage) => lastPage['${cursorParam}']` : undefined,\n cursorParam ? `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']` : undefined,\n !cursorParam && dataReturnType === 'full'\n ? 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage.data) && lastPage.data.length === 0 ? undefined : lastPageParam + 1'\n : undefined,\n !cursorParam && dataReturnType === 'data'\n ? 'getNextPageParam: (lastPage, _allPages, lastPageParam) => Array.isArray(lastPage) && lastPage.length === 0 ? undefined : lastPageParam + 1'\n : undefined,\n !cursorParam ? 'getPreviousPageParam: (_firstPage, _allPages, firstPageParam) => firstPageParam <= 1 ? undefined : firstPageParam - 1' : undefined,\n ].filter(Boolean)\n\n const infiniteOverrideParams =\n queryParam && typeSchemas.queryParams?.name\n ? `\n params = {\n ...(params ?? {}),\n ['${queryParam}']: pageParam as unknown as ${typeSchemas.queryParams?.name}['${queryParam}'],\n } as ${typeSchemas.queryParams?.name}`\n : ''\n\n const enabled = Object.entries(queryKeyParams.flatParams)\n .map(([key, item]) => (item && !item.optional ? key : undefined))\n .filter(Boolean)\n .join('&& ')\n\n const enabledText = enabled ? `enabled: !!(${enabled}),` : ''\n\n if (infiniteOverrideParams) {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, typeof queryKey, ${pageParamType}>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal, pageParam }) => {\n config.signal = signal\n ${infiniteOverrideParams}\n return ${clientName}(${clientParams.toCall()})\n },\n ${queryOptions.join(',\\n')}\n })\n`}\n </Function>\n </File.Source>\n )\n }\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, typeof queryKey, ${pageParamType}>({\n ${enabledText}\n queryKey,\n queryFn: async ({ signal }) => {\n config.signal = signal\n return ${clientName}(${clientParams.toCall()})\n },\n ${queryOptions.join(',\\n')}\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nInfiniteQueryOptions.getParams = getParams\n","import { URLPath } from '@kubb/core/utils'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { File, Function, FunctionParams, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({}: GetParamsProps) {\n return FunctionParams.factory({})\n}\n\nconst getTransformer: Transformer = ({ operation, casing }) => {\n const path = new URLPath(operation.path, { casing })\n\n return [`{ url: '${path.toURLPath()}' }`]\n}\n\nexport function MutationKey({ name, typeSchemas, pathParamsType, paramsCasing, operation, typeName, transformer = getTransformer }: Props): KubbNode {\n const params = getParams({ pathParamsType, typeSchemas })\n const keys = transformer({ operation, schemas: typeSchemas, casing: paramsCasing })\n\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n <Function.Arrow name={name} export params={params.toConstructor()} singleLine>\n {`[${keys.join(', ')}] as const`}\n </Function.Arrow>\n </File.Source>\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`ReturnType<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n\nMutationKey.getParams = getParams\nMutationKey.getTransformer = getTransformer\n","import { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode, Params } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\n\ntype Props = {\n name: string\n clientName: string\n mutationKeyName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ typeSchemas }: GetParamsProps) {\n return FunctionParams.factory({\n config: {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n },\n })\n}\n\nexport function MutationOptions({ name, clientName, dataReturnType, typeSchemas, paramsCasing, paramsType, pathParamsType, mutationKeyName }: Props): KubbNode {\n const params = getParams({ typeSchemas })\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'\n\n const clientParams = Client.getParams({\n typeSchemas,\n paramsCasing,\n paramsType,\n pathParamsType,\n isConfigurable: true,\n })\n\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const mutationParams = FunctionParams.factory({\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n })\n\n const dataParams = FunctionParams.factory({\n data: {\n // No use of pathParams because useMutation can only take one argument in object form,\n // see https://tanstack.com/query/latest/docs/framework/react/reference/useMutation#usemutation\n mode: 'object',\n children: Object.entries(mutationParams.params).reduce((acc, [key, value]) => {\n if (value) {\n acc[key] = {\n ...value,\n type: undefined,\n }\n }\n\n return acc\n }, {} as Params),\n },\n })\n\n const TRequest = mutationParams.toConstructor()\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})\n return mutationOptions<${TData}, ResponseErrorConfig<${TError}>, ${TRequest ? `{${TRequest}}` : 'void'}, typeof mutationKey>({\n mutationKey,\n mutationFn: async(${dataParams.toConstructor()}) => {\n return ${clientName}(${clientParams.toCall()})\n },\n })\n`}\n </Function>\n </File.Source>\n )\n}\n\nMutationOptions.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\nimport { MutationOptions } from './MutationOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n mutationOptionsName: string\n mutationKeyName: string\n typeSchemas: OperationSchemas\n operation: Operation\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsCasing, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const mutationParams = FunctionParams.factory({\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n })\n const TRequest = mutationParams.toConstructor()\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n\n return FunctionParams.factory({\n options: {\n type: `\n{\n mutation?: UseMutationOptions<${generics}> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'},\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Mutation({\n name,\n mutationOptionsName,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n mutationKeyName,\n}: Props): KubbNode {\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const params = getParams({\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const mutationParams = FunctionParams.factory({\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n })\n\n const mutationOptionsParams = MutationOptions.getParams({ typeSchemas })\n\n const TRequest = mutationParams.toConstructor()\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const generics = [TData, TError, TRequest ? `{${TRequest}}` : 'void', 'TContext'].join(', ')\n const returnType = `UseMutationResult<${generics}>`\n\n const mutationOptions = `${mutationOptionsName}(${mutationOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n generics={['TContext']}\n >\n {`\n const { mutation = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...mutationOptions } = mutation;\n const mutationKey = mutationOptions.mutationKey ?? ${mutationKeyName}(${mutationKeyParams.toCall()})\n\n const baseOptions = ${mutationOptions} as UseMutationOptions<${generics}>\n\n return useMutation<${generics}>({\n ...baseOptions,\n mutationKey,\n ...mutationOptions,\n }, queryClient) as ${returnType}\n `}\n </Function>\n </File.Source>\n )\n}\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<QueryObserverOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<QueryObserverOptions<${[TData, TError, 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Query({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): KubbNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const returnType = `UseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsType,\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as QueryObserverOptions, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nQuery.getParams = getParams\n","import { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginReactQuery } from '../types.ts'\nimport { QueryKey } from './QueryKey.tsx'\nimport { QueryOptions } from './QueryOptions.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n queryOptionsName: string\n queryKeyName: string\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginReactQuery['resolvedOptions']['paramsCasing']\n paramsType: PluginReactQuery['resolvedOptions']['paramsType']\n pathParamsType: PluginReactQuery['resolvedOptions']['pathParamsType']\n dataReturnType: PluginReactQuery['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n options: {\n type: `\n{\n query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n options: {\n type: `\n{\n query?: Partial<UseSuspenseQueryOptions<${[TData, TError, 'TData', 'TQueryKey'].join(', ')}>> & { client?: QueryClient },\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : 'Partial<RequestConfig> & { client?: typeof fetch }'}\n}\n`,\n default: '{}',\n },\n })\n}\n\n/**\n * Generates a strongly-typed React Query Suspense hook function for an OpenAPI operation.\n *\n * The generated function wraps `useSuspenseQuery`, providing type-safe parameters and return types based on the supplied OpenAPI schemas and configuration.\n *\n * @returns A React component source node containing the generated query function.\n */\nexport function SuspenseQuery({\n name,\n queryKeyTypeName,\n queryOptionsName,\n queryKeyName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): KubbNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n const returnType = `UseSuspenseQueryResult<${['TData', TError].join(', ')}> & { queryKey: TQueryKey }`\n const generics = [`TData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const queryOptionsParams = QueryOptions.getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n })\n\n const queryOptions = `${queryOptionsName}(${queryOptionsParams.toCall()})`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n export\n generics={generics.join(', ')}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n >\n {`\n const { query: queryConfig = {}, client: config = {} } = options ?? {}\n const { client: queryClient, ...queryOptions } = queryConfig\n const queryKey = queryOptions?.queryKey ?? ${queryKeyName}(${queryKeyParams.toCall()})\n\n const query = useSuspenseQuery({\n ...${queryOptions},\n queryKey,\n ...queryOptions\n } as unknown as UseSuspenseQueryOptions, queryClient) as ${returnType}\n\n query.queryKey = queryKey as TQueryKey\n\n return query\n `}\n </Function>\n </File.Source>\n )\n}\n\nSuspenseQuery.getParams = getParams\n"],"mappings":";;;;;;;;;AAwBA,SAASA,YAAU,EAAE,gBAAgB,cAAc,eAA+B;AAChF,QAAOC,mCAAe,QAAQ;EAC5B,YAAY;GACV,MAAM,mBAAmB,WAAW,WAAW;GAC/C,qDAAwB,YAAY,YAAY;IAAE,OAAO;IAAM,QAAQ;IAAc,CAAC;GACvF;EACD,MAAM,YAAY,SAAS,OACvB;GACE,MAAM,YAAY,SAAS;GAC3B,qCAAqB,YAAY,SAAS,OAAO;GAClD,GACD;EACJ,QAAQ,YAAY,aAAa,OAC7B;GACE,MAAM,YAAY,aAAa;GAC/B,qCAAqB,YAAY,aAAa,OAAO;GACtD,GACD;EACL,CAAC;;AAGJ,MAAM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