@kubb/plugin-react-query 0.0.0-canary-20241104172400

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +123 -0
  3. package/dist/chunk-EOG7AHFO.cjs +890 -0
  4. package/dist/chunk-EOG7AHFO.cjs.map +1 -0
  5. package/dist/chunk-EY5KE7R7.js +879 -0
  6. package/dist/chunk-EY5KE7R7.js.map +1 -0
  7. package/dist/chunk-NBC6BPMV.cjs +700 -0
  8. package/dist/chunk-NBC6BPMV.cjs.map +1 -0
  9. package/dist/chunk-NZKAIPYC.js +691 -0
  10. package/dist/chunk-NZKAIPYC.js.map +1 -0
  11. package/dist/components.cjs +40 -0
  12. package/dist/components.cjs.map +1 -0
  13. package/dist/components.d.cts +175 -0
  14. package/dist/components.d.ts +175 -0
  15. package/dist/components.js +3 -0
  16. package/dist/components.js.map +1 -0
  17. package/dist/generators.cjs +25 -0
  18. package/dist/generators.cjs.map +1 -0
  19. package/dist/generators.d.cts +14 -0
  20. package/dist/generators.d.ts +14 -0
  21. package/dist/generators.js +4 -0
  22. package/dist/generators.js.map +1 -0
  23. package/dist/index.cjs +135 -0
  24. package/dist/index.cjs.map +1 -0
  25. package/dist/index.d.cts +9 -0
  26. package/dist/index.d.ts +9 -0
  27. package/dist/index.js +128 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/types-IuxCCG1K.d.cts +244 -0
  30. package/dist/types-IuxCCG1K.d.ts +244 -0
  31. package/package.json +102 -0
  32. package/src/components/InfiniteQuery.tsx +176 -0
  33. package/src/components/InfiniteQueryOptions.tsx +185 -0
  34. package/src/components/Mutation.tsx +163 -0
  35. package/src/components/MutationKey.tsx +54 -0
  36. package/src/components/Query.tsx +176 -0
  37. package/src/components/QueryKey.tsx +83 -0
  38. package/src/components/QueryOptions.tsx +133 -0
  39. package/src/components/SuspenseQuery.tsx +176 -0
  40. package/src/components/index.ts +8 -0
  41. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +51 -0
  42. package/src/generators/__snapshots__/clientGetImportPath.ts +51 -0
  43. package/src/generators/__snapshots__/clientPostImportPath.ts +44 -0
  44. package/src/generators/__snapshots__/findByTags.ts +51 -0
  45. package/src/generators/__snapshots__/findByTagsObject.ts +60 -0
  46. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +51 -0
  47. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +51 -0
  48. package/src/generators/__snapshots__/findByTagsWithZod.ts +51 -0
  49. package/src/generators/__snapshots__/findInfiniteByTags.ts +57 -0
  50. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +57 -0
  51. package/src/generators/__snapshots__/getAsMutation.ts +31 -0
  52. package/src/generators/__snapshots__/postAsQuery.ts +50 -0
  53. package/src/generators/__snapshots__/updatePetById.ts +44 -0
  54. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +44 -0
  55. package/src/generators/index.ts +4 -0
  56. package/src/generators/infiniteQueryGenerator.tsx +136 -0
  57. package/src/generators/mutationGenerator.tsx +117 -0
  58. package/src/generators/queryGenerator.tsx +127 -0
  59. package/src/generators/suspenseQueryGenerator.tsx +130 -0
  60. package/src/index.ts +2 -0
  61. package/src/plugin.ts +152 -0
  62. package/src/types.ts +166 -0
@@ -0,0 +1,127 @@
1
+ import { pluginClientName } from '@kubb/plugin-client'
2
+ import { Client } from '@kubb/plugin-client/components'
3
+ import { createReactGenerator } from '@kubb/plugin-oas'
4
+ import { useOperationManager } from '@kubb/plugin-oas/hooks'
5
+ import { pluginTsName } from '@kubb/plugin-ts'
6
+ import { pluginZodName } from '@kubb/plugin-zod'
7
+ import { File, useApp } from '@kubb/react'
8
+ import { Query, QueryKey, QueryOptions } from '../components'
9
+ import type { PluginReactQuery } from '../types'
10
+
11
+ export const queryGenerator = createReactGenerator<PluginReactQuery>({
12
+ name: 'react-query',
13
+ Operation({ options, operation }) {
14
+ const {
15
+ plugin: {
16
+ options: { output },
17
+ },
18
+ } = useApp<PluginReactQuery>()
19
+ const { getSchemas, getName, getFile } = useOperationManager()
20
+
21
+ const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)
22
+ const importPath = options.query ? options.query.importPath : '@tanstack/react-query'
23
+
24
+ const query = {
25
+ name: getName(operation, { type: 'function', prefix: 'use' }),
26
+ typeName: getName(operation, { type: 'type' }),
27
+ file: getFile(operation, { prefix: 'use' }),
28
+ }
29
+
30
+ const client = {
31
+ name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }),
32
+ }
33
+
34
+ const queryOptions = {
35
+ name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),
36
+ }
37
+
38
+ const queryKey = {
39
+ name: getName(operation, { type: 'const', suffix: 'QueryKey' }),
40
+ typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),
41
+ }
42
+
43
+ const type = {
44
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
45
+ //todo remove type?
46
+ schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),
47
+ }
48
+
49
+ const zod = {
50
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
51
+ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),
52
+ }
53
+
54
+ if (!isQuery) {
55
+ return null
56
+ }
57
+
58
+ return (
59
+ <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
60
+ {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
61
+ <File.Import name={'client'} path={options.client.importPath} />
62
+ <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />
63
+ {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
64
+ <File.Import
65
+ name={[
66
+ type.schemas.request?.name,
67
+ type.schemas.response.name,
68
+ type.schemas.pathParams?.name,
69
+ type.schemas.queryParams?.name,
70
+ type.schemas.headerParams?.name,
71
+ ...(type.schemas.statusCodes?.map((item) => item.name) || []),
72
+ ].filter(Boolean)}
73
+ root={query.file.path}
74
+ path={type.file.path}
75
+ isTypeOnly
76
+ />
77
+ <QueryKey
78
+ name={queryKey.name}
79
+ typeName={queryKey.typeName}
80
+ operation={operation}
81
+ pathParamsType={options.pathParamsType}
82
+ typeSchemas={type.schemas}
83
+ transformer={options.queryKey}
84
+ />
85
+ <Client
86
+ name={client.name}
87
+ isExportable={false}
88
+ isIndexable={false}
89
+ baseURL={options.client.baseURL}
90
+ operation={operation}
91
+ typeSchemas={type.schemas}
92
+ zodSchemas={zod.schemas}
93
+ dataReturnType={options.client.dataReturnType}
94
+ paramsType={options.paramsType}
95
+ pathParamsType={options.pathParamsType}
96
+ parser={options.parser}
97
+ />
98
+ <File.Import name={['queryOptions']} path={importPath} />
99
+ <QueryOptions
100
+ name={queryOptions.name}
101
+ clientName={client.name}
102
+ queryKeyName={queryKey.name}
103
+ typeSchemas={type.schemas}
104
+ paramsType={options.paramsType}
105
+ pathParamsType={options.pathParamsType}
106
+ />
107
+ {options.query && (
108
+ <>
109
+ <File.Import name={['useQuery']} path={importPath} />
110
+ <File.Import name={['QueryKey', 'QueryObserverOptions', 'UseQueryResult']} path={importPath} isTypeOnly />
111
+ <Query
112
+ name={query.name}
113
+ queryOptionsName={queryOptions.name}
114
+ typeSchemas={type.schemas}
115
+ paramsType={options.paramsType}
116
+ pathParamsType={options.pathParamsType}
117
+ operation={operation}
118
+ dataReturnType={options.client.dataReturnType}
119
+ queryKeyName={queryKey.name}
120
+ queryKeyTypeName={queryKey.typeName}
121
+ />
122
+ </>
123
+ )}
124
+ </File>
125
+ )
126
+ },
127
+ })
@@ -0,0 +1,130 @@
1
+ import transformers from '@kubb/core/transformers'
2
+ import { pluginClientName } from '@kubb/plugin-client'
3
+ import { Client } from '@kubb/plugin-client/components'
4
+ import { createReactGenerator } from '@kubb/plugin-oas'
5
+ import { useOperationManager } from '@kubb/plugin-oas/hooks'
6
+ import { pluginTsName } from '@kubb/plugin-ts'
7
+ import { pluginZodName } from '@kubb/plugin-zod'
8
+ import { File, useApp } from '@kubb/react'
9
+ import { QueryKey, QueryOptions, SuspenseQuery } from '../components'
10
+ import type { PluginReactQuery } from '../types'
11
+
12
+ export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
13
+ name: 'react-suspense-query',
14
+ Operation({ options, operation }) {
15
+ const {
16
+ plugin: {
17
+ options: { output },
18
+ },
19
+ } = useApp<PluginReactQuery>()
20
+ const { getSchemas, getName, getFile } = useOperationManager()
21
+ const isQuery = typeof options.query === 'boolean' ? options.query : !!options.query.methods?.some((method) => operation.method === method)
22
+ const isSuspense = isQuery && !!options.suspense
23
+
24
+ const importPath = options.query ? options.query.importPath : '@tanstack/react-query'
25
+
26
+ const query = {
27
+ name: getName(operation, { type: 'function', prefix: 'use', suffix: 'suspense' }),
28
+ typeName: getName(operation, { type: 'type' }),
29
+ file: getFile(operation, { prefix: 'use', suffix: 'suspense' }),
30
+ }
31
+
32
+ const client = {
33
+ name: getName(operation, { type: 'function', pluginKey: [pluginClientName] }),
34
+ }
35
+
36
+ const queryOptions = {
37
+ name: getName(operation, { type: 'function', suffix: 'SuspenseQueryOptions' }),
38
+ }
39
+
40
+ const queryKey = {
41
+ name: getName(operation, { type: 'const', suffix: 'SuspenseQueryKey' }),
42
+ typeName: getName(operation, { type: 'type', suffix: 'SuspenseQueryKey' }),
43
+ }
44
+
45
+ const type = {
46
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
47
+ //todo remove type?
48
+ schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),
49
+ }
50
+
51
+ const zod = {
52
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
53
+ schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),
54
+ }
55
+
56
+ if (!isQuery || !isSuspense) {
57
+ return null
58
+ }
59
+
60
+ return (
61
+ <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>
62
+ {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
63
+ <File.Import name={'client'} path={options.client.importPath} />
64
+ <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />
65
+ {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
66
+ <File.Import
67
+ name={[
68
+ type.schemas.request?.name,
69
+ type.schemas.response.name,
70
+ type.schemas.pathParams?.name,
71
+ type.schemas.queryParams?.name,
72
+ type.schemas.headerParams?.name,
73
+ ...(type.schemas.statusCodes?.map((item) => item.name) || []),
74
+ ].filter(Boolean)}
75
+ root={query.file.path}
76
+ path={type.file.path}
77
+ isTypeOnly
78
+ />
79
+ <QueryKey
80
+ name={queryKey.name}
81
+ typeName={queryKey.typeName}
82
+ operation={operation}
83
+ pathParamsType={options.pathParamsType}
84
+ typeSchemas={type.schemas}
85
+ transformer={options.queryKey}
86
+ />
87
+
88
+ <Client
89
+ name={client.name}
90
+ isExportable={false}
91
+ isIndexable={false}
92
+ baseURL={options.client.baseURL}
93
+ operation={operation}
94
+ typeSchemas={type.schemas}
95
+ zodSchemas={zod.schemas}
96
+ dataReturnType={options.client.dataReturnType}
97
+ paramsType={options.paramsType}
98
+ pathParamsType={options.pathParamsType}
99
+ parser={options.parser}
100
+ />
101
+ <File.Import name={['queryOptions']} path={importPath} />
102
+ <QueryOptions
103
+ name={queryOptions.name}
104
+ clientName={client.name}
105
+ queryKeyName={queryKey.name}
106
+ typeSchemas={type.schemas}
107
+ paramsType={options.paramsType}
108
+ pathParamsType={options.pathParamsType}
109
+ />
110
+ {options.suspense && (
111
+ <>
112
+ <File.Import name={['useSuspenseQuery']} path={importPath} />
113
+ <File.Import name={['QueryKey', 'UseSuspenseQueryOptions', 'UseSuspenseQueryResult']} path={importPath} isTypeOnly />
114
+ <SuspenseQuery
115
+ name={query.name}
116
+ queryOptionsName={queryOptions.name}
117
+ typeSchemas={type.schemas}
118
+ paramsType={options.paramsType}
119
+ pathParamsType={options.pathParamsType}
120
+ operation={operation}
121
+ dataReturnType={options.client.dataReturnType}
122
+ queryKeyName={queryKey.name}
123
+ queryKeyTypeName={queryKey.typeName}
124
+ />
125
+ </>
126
+ )}
127
+ </File>
128
+ )
129
+ },
130
+ })
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { pluginReactQuery, pluginReactQueryName } from './plugin.ts'
2
+ export type { PluginReactQuery } from './types.ts'
package/src/plugin.ts ADDED
@@ -0,0 +1,152 @@
1
+ import path from 'node:path'
2
+
3
+ import { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'
4
+ import { camelCase, pascalCase } from '@kubb/core/transformers'
5
+ import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
6
+
7
+ import { pluginTsName } from '@kubb/plugin-ts'
8
+ import { pluginZodName } from '@kubb/plugin-zod'
9
+
10
+ import type { Plugin } from '@kubb/core'
11
+ import type { PluginOas } from '@kubb/plugin-oas'
12
+ import { MutationKey } from './components'
13
+ import { QueryKey } from './components/QueryKey.tsx'
14
+ import { infiniteQueryGenerator, mutationGenerator, queryGenerator, suspenseQueryGenerator } from './generators'
15
+ import type { PluginReactQuery } from './types.ts'
16
+
17
+ export const pluginReactQueryName = 'plugin-react-query' satisfies PluginReactQuery['name']
18
+
19
+ export const pluginReactQuery = createPlugin<PluginReactQuery>((options) => {
20
+ const {
21
+ output = { path: 'hooks', barrelType: 'named' },
22
+ group,
23
+ exclude = [],
24
+ include,
25
+ override = [],
26
+ parser = 'client',
27
+ suspense = {},
28
+ infinite = false,
29
+ transformers = {},
30
+ paramsType = 'inline',
31
+ pathParamsType = 'inline',
32
+ generators = [queryGenerator, suspenseQueryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),
33
+ mutation = {},
34
+ query = {},
35
+ mutationKey = MutationKey.getTransformer,
36
+ queryKey = QueryKey.getTransformer,
37
+ } = options
38
+
39
+ return {
40
+ name: pluginReactQueryName,
41
+ options: {
42
+ output,
43
+ client: {
44
+ importPath: '@kubb/plugin-client/client',
45
+ dataReturnType: 'data',
46
+ ...options.client,
47
+ },
48
+ infinite: infinite
49
+ ? {
50
+ queryParam: 'id',
51
+ initialPageParam: 0,
52
+ cursorParam: undefined,
53
+ ...infinite,
54
+ }
55
+ : false,
56
+ suspense,
57
+ queryKey,
58
+ query: {
59
+ methods: ['get'],
60
+ importPath: '@tanstack/react-query',
61
+ ...query,
62
+ },
63
+ mutationKey,
64
+ mutation: {
65
+ methods: ['post', 'put', 'patch', 'delete'],
66
+ importPath: '@tanstack/react-query',
67
+ ...mutation,
68
+ },
69
+ paramsType,
70
+ pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,
71
+ parser,
72
+ },
73
+ pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
74
+ resolvePath(baseName, pathMode, options) {
75
+ const root = path.resolve(this.config.root, this.config.output.path)
76
+ const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))
77
+
78
+ if (options?.tag && group?.type === 'tag') {
79
+ const groupName: Group['name'] = group?.name ? group.name : (ctx) => `${ctx.group}Controller`
80
+
81
+ return path.resolve(root, output.path, groupName({ group: camelCase(options.tag) }), baseName)
82
+ }
83
+
84
+ if (mode === 'single') {
85
+ /**
86
+ * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
87
+ * Other plugins then need to call addOrAppend instead of just add from the fileManager class
88
+ */
89
+ return path.resolve(root, output.path)
90
+ }
91
+
92
+ return path.resolve(root, output.path, baseName)
93
+ },
94
+ resolveName(name, type) {
95
+ let resolvedName = camelCase(name)
96
+
97
+ if (type === 'file' || type === 'function') {
98
+ resolvedName = camelCase(name, {
99
+ isFile: type === 'file',
100
+ })
101
+ }
102
+ if (type === 'type') {
103
+ resolvedName = pascalCase(name)
104
+ }
105
+
106
+ if (type) {
107
+ return transformers?.name?.(resolvedName, type) || resolvedName
108
+ }
109
+
110
+ return resolvedName
111
+ },
112
+ async buildStart() {
113
+ const [swaggerPlugin]: [Plugin<PluginOas>] = PluginManager.getDependedPlugins<PluginOas>(this.plugins, [pluginOasName])
114
+
115
+ const oas = await swaggerPlugin.context.getOas()
116
+ const root = path.resolve(this.config.root, this.config.output.path)
117
+ const mode = FileManager.getMode(path.resolve(root, output.path))
118
+ const baseURL = await swaggerPlugin.context.getBaseURL()
119
+
120
+ if (baseURL) {
121
+ this.plugin.options.client.baseURL = baseURL
122
+ }
123
+
124
+ const operationGenerator = new OperationGenerator(this.plugin.options, {
125
+ oas,
126
+ pluginManager: this.pluginManager,
127
+ plugin: this.plugin,
128
+ contentType: swaggerPlugin.context.contentType,
129
+ exclude,
130
+ include,
131
+ override,
132
+ mode,
133
+ })
134
+
135
+ const files = await operationGenerator.build(...generators)
136
+ await this.addFile(...files)
137
+
138
+ const barrelFiles = await this.fileManager.getBarrelFiles({
139
+ type: output.barrelType ?? 'named',
140
+ root,
141
+ output,
142
+ files: this.fileManager.files,
143
+ meta: {
144
+ pluginKey: this.plugin.key,
145
+ },
146
+ logger: this.logger,
147
+ })
148
+
149
+ await this.addFile(...barrelFiles)
150
+ },
151
+ }
152
+ })
package/src/types.ts ADDED
@@ -0,0 +1,166 @@
1
+ import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@kubb/core'
2
+
3
+ import type { HttpMethod, Operation } from '@kubb/oas'
4
+ import type { PluginClient } from '@kubb/plugin-client'
5
+ import type { Exclude, Generator, Include, OperationSchemas, Override, ResolvePathOptions } from '@kubb/plugin-oas'
6
+
7
+ type TransformerProps = {
8
+ operation: Operation
9
+ schemas: OperationSchemas
10
+ }
11
+
12
+ export type Transformer = (props: TransformerProps) => unknown[]
13
+
14
+ type Suspense = object
15
+
16
+ /**
17
+ * Customize the queryKey
18
+ */
19
+ type QueryKey = Transformer
20
+
21
+ /**
22
+ * Customize the mutationKey
23
+ */
24
+ type MutationKey = Transformer
25
+
26
+ type Query = {
27
+ /**
28
+ * Define which HttpMethods can be used for queries
29
+ * @default ['get']
30
+ */
31
+ methods: Array<HttpMethod>
32
+ /**
33
+ * Path to the useQuery that will be used to do the useQuery functionality.
34
+ * It will be used as `import { useQuery } from '${importPath}'`.
35
+ * It allows both relative and absolute path.
36
+ * the path will be applied as is, so relative path should be based on the file being generated.
37
+ * @default '@tanstack/react-query'
38
+ */
39
+ importPath?: string
40
+ }
41
+
42
+ type Mutation = {
43
+ /**
44
+ * Define which HttpMethods can be used for mutations
45
+ * @default ['post', 'put', 'delete']
46
+ */
47
+ methods: Array<HttpMethod>
48
+ /**
49
+ * Path to the useQuery that will be used to do the useQuery functionality.
50
+ * It will be used as `import { useQuery } from '${importPath}'`.
51
+ * It allows both relative and absolute path.
52
+ * the path will be applied as is, so relative path should be based on the file being generated.
53
+ * @default '@tanstack/react-query'
54
+ */
55
+ importPath?: string
56
+ }
57
+
58
+ export type Infinite = {
59
+ /**
60
+ * Specify the params key used for `pageParam`.
61
+ * @default 'id'
62
+ */
63
+ queryParam: string
64
+ /**
65
+ * Which field of the data will be used, set it to undefined when no cursor is known.
66
+ */
67
+ cursorParam?: string | undefined
68
+ /**
69
+ * The initial value, the value of the first page.
70
+ * @default 0
71
+ */
72
+ initialPageParam: unknown
73
+ }
74
+
75
+ export type Options = {
76
+ /**
77
+ * Specify the export location for the files and define the behavior of the output
78
+ * @default { path: 'hooks', barrelType: 'named' }
79
+ */
80
+ output?: Output
81
+ /**
82
+ * Group the @tanstack/query hooks based on the provided name.
83
+ */
84
+ group?: Group
85
+
86
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>
87
+ /**
88
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
89
+ */
90
+ exclude?: Array<Exclude>
91
+ /**
92
+ * Array containing include parameters to include tags/operations/methods/paths.
93
+ */
94
+ include?: Array<Include>
95
+ /**
96
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
97
+ */
98
+ override?: Array<Override<ResolvedOptions>>
99
+ /**
100
+ * How to pass your params
101
+ * - 'object' will return the params and pathParams as an object.
102
+ * - 'inline' will return the params as comma separated params.
103
+ * @default 'inline'
104
+ */
105
+ paramsType?: 'object' | 'inline'
106
+ /**
107
+ * How to pass your pathParams.
108
+ * - 'object' will return the pathParams as an object.
109
+ * - 'inline' will return the pathParams as comma separated params.
110
+ * @default 'inline'
111
+ */
112
+ pathParamsType?: PluginClient['options']['pathParamsType']
113
+
114
+ /**
115
+ * When set, an infiniteQuery hooks will be added.
116
+ */
117
+ infinite?: Partial<Infinite> | false
118
+ /**
119
+ * When set, a suspenseQuery hooks will be added.
120
+ */
121
+ suspense?: Partial<Suspense> | false
122
+ queryKey?: QueryKey
123
+ /**
124
+ * Override some useQuery behaviours.
125
+ */
126
+ query?: Partial<Query> | false
127
+ mutationKey?: MutationKey
128
+ /**
129
+ * Override some useMutation behaviours.
130
+ */
131
+ mutation?: Partial<Mutation> | false
132
+ /**
133
+ * Which parser should be used before returning the data to `@tanstack/query`.
134
+ * `'zod'` will use `@kubb/plugin-zod` to parse the data.
135
+ */
136
+ parser?: PluginClient['options']['parser']
137
+ transformers?: {
138
+ /**
139
+ * Customize the names based on the type that is provided by the plugin.
140
+ */
141
+ name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string
142
+ }
143
+ /**
144
+ * Define some generators next to the react-query generators
145
+ */
146
+ generators?: Array<Generator<PluginReactQuery>>
147
+ }
148
+
149
+ type ResolvedOptions = {
150
+ output: Output
151
+ client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
152
+ parser: Required<NonNullable<Options['parser']>>
153
+ pathParamsType: NonNullable<Options['pathParamsType']>
154
+ paramsType: NonNullable<Options['paramsType']>
155
+ /**
156
+ * Only used of infinite
157
+ */
158
+ infinite: NonNullable<Infinite> | false
159
+ suspense: Suspense | false
160
+ queryKey: QueryKey | undefined
161
+ query: NonNullable<Required<Query>> | false
162
+ mutationKey: MutationKey | undefined
163
+ mutation: NonNullable<Required<Mutation>> | false
164
+ }
165
+
166
+ export type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>