@kubb/plugin-vue-query 3.0.0-beta.1 → 3.0.0-beta.11

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 (43) hide show
  1. package/dist/{chunk-FSQSBTBH.cjs → chunk-5MY3SE2R.cjs} +220 -18
  2. package/dist/chunk-5MY3SE2R.cjs.map +1 -0
  3. package/dist/{chunk-S7SEIU2L.cjs → chunk-DM6KQOMW.cjs} +40 -28
  4. package/dist/chunk-DM6KQOMW.cjs.map +1 -0
  5. package/dist/{chunk-V6YETPDM.js → chunk-DWWRCRGY.js} +220 -18
  6. package/dist/chunk-DWWRCRGY.js.map +1 -0
  7. package/dist/{chunk-VAPLKIAH.js → chunk-JOSO5JH4.js} +27 -15
  8. package/dist/chunk-JOSO5JH4.js.map +1 -0
  9. package/dist/components.cjs +8 -8
  10. package/dist/components.d.cts +19 -10
  11. package/dist/components.d.ts +19 -10
  12. package/dist/components.js +1 -1
  13. package/dist/generators.cjs +5 -5
  14. package/dist/generators.d.cts +1 -1
  15. package/dist/generators.d.ts +1 -1
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +19 -22
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +18 -21
  22. package/dist/index.js.map +1 -1
  23. package/dist/types-CJEMZz_Q.d.cts +371 -0
  24. package/dist/types-CJEMZz_Q.d.ts +371 -0
  25. package/package.json +14 -14
  26. package/src/components/InfiniteQuery.tsx +54 -1
  27. package/src/components/InfiniteQueryOptions.tsx +49 -2
  28. package/src/components/Mutation.tsx +7 -3
  29. package/src/components/Query.tsx +65 -2
  30. package/src/components/QueryOptions.tsx +50 -3
  31. package/src/generators/__snapshots__/findByTagsObject.ts +62 -0
  32. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -3
  33. package/src/generators/infiniteQueryGenerator.tsx +4 -2
  34. package/src/generators/mutationGenerator.tsx +3 -2
  35. package/src/generators/queryGenerator.tsx +4 -2
  36. package/src/plugin.ts +16 -19
  37. package/src/types.ts +17 -21
  38. package/dist/chunk-FSQSBTBH.cjs.map +0 -1
  39. package/dist/chunk-S7SEIU2L.cjs.map +0 -1
  40. package/dist/chunk-V6YETPDM.js.map +0 -1
  41. package/dist/chunk-VAPLKIAH.js.map +0 -1
  42. package/dist/types-FQruQAe4.d.cts +0 -225
  43. package/dist/types-FQruQAe4.d.ts +0 -225
@@ -3,6 +3,7 @@ import { File, Function, FunctionParams } from '@kubb/react'
3
3
  import { type Operation, isOptional } from '@kubb/oas'
4
4
  import type { OperationSchemas } from '@kubb/plugin-oas'
5
5
  import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
6
+ import type { PluginReactQuery } from '@kubb/plugin-react-query'
6
7
  import type { ReactNode } from 'react'
7
8
  import type { PluginVueQuery } from '../types.ts'
8
9
  import { QueryKey } from './QueryKey.tsx'
@@ -18,22 +19,72 @@ type Props = {
18
19
  queryKeyTypeName: string
19
20
  typeSchemas: OperationSchemas
20
21
  operation: Operation
22
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType']
21
23
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
22
24
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
23
25
  }
24
26
 
25
27
  type GetParamsProps = {
28
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType']
26
29
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
27
30
  dataReturnType: PluginVueQuery['resolvedOptions']['client']['dataReturnType']
28
31
  typeSchemas: OperationSchemas
29
32
  }
30
33
 
31
- function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
34
+ function getParams({ paramsType, pathParamsType, dataReturnType, typeSchemas }: GetParamsProps) {
32
35
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
33
36
 
37
+ if (paramsType === 'object') {
38
+ return FunctionParams.factory({
39
+ data: {
40
+ mode: 'object',
41
+ children: {
42
+ ...getPathParams(typeSchemas.pathParams, {
43
+ typed: true,
44
+ override(item) {
45
+ return {
46
+ ...item,
47
+ type: `MaybeRef<${item.type}>`,
48
+ }
49
+ },
50
+ }),
51
+ data: typeSchemas.request?.name
52
+ ? {
53
+ type: `MaybeRef<${typeSchemas.request?.name}>`,
54
+ optional: isOptional(typeSchemas.request?.schema),
55
+ }
56
+ : undefined,
57
+ params: typeSchemas.queryParams?.name
58
+ ? {
59
+ type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
60
+ optional: isOptional(typeSchemas.queryParams?.schema),
61
+ }
62
+ : undefined,
63
+ headers: typeSchemas.headerParams?.name
64
+ ? {
65
+ type: `MaybeRef<${typeSchemas.headerParams?.name}>`,
66
+ optional: isOptional(typeSchemas.headerParams?.schema),
67
+ }
68
+ : undefined,
69
+ },
70
+ },
71
+ options: {
72
+ type: `
73
+ {
74
+ query?: Partial<QueryObserverOptions<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', 'TData', 'TQueryData', 'TQueryKey'].join(', ')}>>,
75
+ client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'}
76
+ }
77
+ `,
78
+ default: '{}',
79
+ },
80
+ })
81
+ }
82
+
34
83
  return FunctionParams.factory({
35
84
  pathParams: {
36
85
  mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
86
+ type: typeSchemas.pathParams?.name,
87
+ optional: isOptional(typeSchemas.pathParams?.schema),
37
88
  children: getPathParams(typeSchemas.pathParams, {
38
89
  typed: true,
39
90
  override(item) {
@@ -74,7 +125,17 @@ function getParams({ pathParamsType, dataReturnType, typeSchemas }: GetParamsPro
74
125
  })
75
126
  }
76
127
 
77
- export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, pathParamsType, dataReturnType, typeSchemas, operation }: Props): ReactNode {
128
+ export function Query({
129
+ name,
130
+ queryKeyTypeName,
131
+ queryOptionsName,
132
+ queryKeyName,
133
+ paramsType,
134
+ pathParamsType,
135
+ dataReturnType,
136
+ typeSchemas,
137
+ operation,
138
+ }: Props): ReactNode {
78
139
  const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
79
140
  const returnType = `UseQueryReturnType<${['TData', typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'].join(', ')}> & { queryKey: TQueryKey }`
80
141
  const generics = [`TData = ${TData}`, `TQueryData = ${TData}`, `TQueryKey extends QueryKey = ${queryKeyTypeName}`]
@@ -84,10 +145,12 @@ export function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
84
145
  typeSchemas,
85
146
  })
86
147
  const queryOptionsParams = QueryOptions.getParams({
148
+ paramsType,
87
149
  pathParamsType,
88
150
  typeSchemas,
89
151
  })
90
152
  const params = getParams({
153
+ paramsType,
91
154
  pathParamsType,
92
155
  dataReturnType,
93
156
  typeSchemas,
@@ -6,6 +6,7 @@ import type { ReactNode } from 'react'
6
6
  import { isOptional } from '@kubb/oas'
7
7
  import { Client } from '@kubb/plugin-client/components'
8
8
  import type { OperationSchemas } from '@kubb/plugin-oas'
9
+ import type { PluginReactQuery } from '@kubb/plugin-react-query'
9
10
  import type { PluginVueQuery } from '../types.ts'
10
11
  import { QueryKey } from './QueryKey.tsx'
11
12
 
@@ -14,18 +15,63 @@ type Props = {
14
15
  clientName: string
15
16
  queryKeyName: string
16
17
  typeSchemas: OperationSchemas
18
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType']
17
19
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
18
20
  }
19
21
 
20
22
  type GetParamsProps = {
23
+ paramsType: PluginVueQuery['resolvedOptions']['paramsType']
21
24
  pathParamsType: PluginVueQuery['resolvedOptions']['pathParamsType']
22
25
  typeSchemas: OperationSchemas
23
26
  }
24
27
 
25
- function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
28
+ function getParams({ paramsType, pathParamsType, typeSchemas }: GetParamsProps) {
29
+ if (paramsType === 'object') {
30
+ return FunctionParams.factory({
31
+ data: {
32
+ mode: 'object',
33
+ children: {
34
+ ...getPathParams(typeSchemas.pathParams, {
35
+ typed: true,
36
+ override(item) {
37
+ return {
38
+ ...item,
39
+ type: `MaybeRef<${item.type}>`,
40
+ }
41
+ },
42
+ }),
43
+ data: typeSchemas.request?.name
44
+ ? {
45
+ type: `MaybeRef<${typeSchemas.request?.name}>`,
46
+ optional: isOptional(typeSchemas.request?.schema),
47
+ }
48
+ : undefined,
49
+ params: typeSchemas.queryParams?.name
50
+ ? {
51
+ type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
52
+ optional: isOptional(typeSchemas.queryParams?.schema),
53
+ }
54
+ : undefined,
55
+ headers: typeSchemas.headerParams?.name
56
+ ? {
57
+ type: `MaybeRef<${typeSchemas.queryParams?.name}>`,
58
+ optional: isOptional(typeSchemas.headerParams?.schema),
59
+ }
60
+ : undefined,
61
+ },
62
+ },
63
+ config: {
64
+ type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',
65
+ default: '{}',
66
+ },
67
+ })
68
+ }
69
+
26
70
  return FunctionParams.factory({
27
71
  pathParams: {
28
72
  mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',
73
+ type: typeSchemas.pathParams?.name,
74
+ optional: isOptional(typeSchemas.pathParams?.schema),
29
75
  children: getPathParams(typeSchemas.pathParams, {
30
76
  typed: true,
31
77
  override(item) {
@@ -61,9 +107,10 @@ function getParams({ pathParamsType, typeSchemas }: GetParamsProps) {
61
107
  })
62
108
  }
63
109
 
64
- export function QueryOptions({ name, clientName, typeSchemas, pathParamsType, queryKeyName }: Props): ReactNode {
65
- const params = getParams({ pathParamsType, typeSchemas })
110
+ export function QueryOptions({ name, clientName, typeSchemas, paramsType, pathParamsType, queryKeyName }: Props): ReactNode {
111
+ const params = getParams({ paramsType, pathParamsType, typeSchemas })
66
112
  const clientParams = Client.getParams({
113
+ paramsType,
67
114
  typeSchemas,
68
115
  pathParamsType,
69
116
  })
@@ -0,0 +1,62 @@
1
+ import client from "@kubb/plugin-client/client";
2
+ import type { RequestConfig } from "@kubb/plugin-client/client";
3
+ import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from "@tanstack/react-query";
4
+ import type { MaybeRef } from "vue";
5
+ import { useQuery, queryOptions } from "@tanstack/react-query";
6
+ import { unref } from "vue";
7
+
8
+ export const findPetsByTagsQueryKey = (params?: MaybeRef<FindPetsByTagsQueryParams>) => [{ url: "/pet/findByTags" }, ...(params ? [params] : [])] as const;
9
+
10
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>;
11
+
12
+ /**
13
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
14
+ * @summary Finds Pets by tags
15
+ * @link /pet/findByTags
16
+ */
17
+ async function findPetsByTags({ headers, params }: {
18
+ headers: FindPetsByTagsHeaderParams;
19
+ params?: FindPetsByTagsQueryParams;
20
+ }, config: Partial<RequestConfig> = {}) {
21
+ const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400, unknown>({ method: "GET", url: `/pet/findByTags`, params, headers: { ...headers, ...config.headers }, ...config });
22
+ return findPetsByTagsQueryResponse.parse(res.data);
23
+ }
24
+
25
+ export function findPetsByTagsQueryOptions({ headers, params }: {
26
+ headers: MaybeRef<FindPetsByTagsQueryParams>;
27
+ params?: MaybeRef<FindPetsByTagsQueryParams>;
28
+ }, config: Partial<RequestConfig> = {}) {
29
+ const queryKey = findPetsByTagsQueryKey(params);
30
+ return queryOptions({
31
+ queryKey,
32
+ queryFn: async ({ signal }) => {
33
+ config.signal = signal;
34
+ return findPetsByTags(unref({ headers: unref(headers), params: unref(params) }), unref(config));
35
+ },
36
+ });
37
+ }
38
+
39
+ /**
40
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
41
+ * @summary Finds Pets by tags
42
+ * @link /pet/findByTags
43
+ */
44
+ export function useFindPetsByTags<TData = FindPetsByTagsQueryResponse, TQueryData = FindPetsByTagsQueryResponse, TQueryKey extends QueryKey = FindPetsByTagsQueryKey>({ headers, params }: {
45
+ headers: MaybeRef<FindPetsByTagsHeaderParams>;
46
+ params?: MaybeRef<FindPetsByTagsQueryParams>;
47
+ }, options: {
48
+ query?: Partial<QueryObserverOptions<FindPetsByTagsQueryResponse, FindPetsByTags400, TData, TQueryData, TQueryKey>>;
49
+ client?: Partial<RequestConfig>;
50
+ } = {}) {
51
+ const { query: queryOptions, client: config = {} } = options ?? {};
52
+ const queryKey = queryOptions?.queryKey ?? findPetsByTagsQueryKey(params);
53
+ const query = useQuery({
54
+ ...findPetsByTagsQueryOptions({ headers, params }, config) as unknown as QueryObserverOptions,
55
+ queryKey: queryKey as QueryKey,
56
+ ...queryOptions as unknown as Omit<QueryObserverOptions, "queryKey">
57
+ }) as UseQueryReturnType<TData, FindPetsByTags400> & {
58
+ queryKey: TQueryKey;
59
+ };
60
+ query.queryKey = queryKey as TQueryKey;
61
+ return query;
62
+ }
@@ -12,9 +12,7 @@ import { useMutation } from "@tanstack/react-query";
12
12
  * @summary Updates a pet in the store with form data
13
13
  * @link /pet/:petId
14
14
  */
15
- async function updatePetWithForm({ petId }: {
16
- petId: UpdatePetWithFormPathParams["petId"];
17
- }, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
15
+ async function updatePetWithForm({ petId }: UpdatePetWithFormPathParams, data?: UpdatePetWithFormMutationRequest, params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {}) {
18
16
  const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({ method: "POST", url: `/pet/${petId}`, params, data, ...config });
19
17
  return updatePetWithFormMutationResponse.parse(res.data);
20
18
  }
@@ -1,4 +1,3 @@
1
- import transformers from '@kubb/core/transformers'
2
1
  import { pluginClientName } from '@kubb/plugin-client'
3
2
  import { Client } from '@kubb/plugin-client/components'
4
3
  import { createReactGenerator } from '@kubb/plugin-oas'
@@ -95,11 +94,12 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
95
94
  name={client.name}
96
95
  isExportable={false}
97
96
  isIndexable={false}
98
- baseURL={options.baseURL}
97
+ baseURL={options.client.baseURL}
99
98
  operation={operation}
100
99
  typeSchemas={type.schemas}
101
100
  zodSchemas={zod.schemas}
102
101
  dataReturnType={options.client.dataReturnType}
102
+ paramsType={options.paramsType}
103
103
  pathParamsType={options.pathParamsType}
104
104
  parser={options.parser}
105
105
  />
@@ -108,6 +108,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
108
108
  clientName={client.name}
109
109
  queryKeyName={queryKey.name}
110
110
  typeSchemas={type.schemas}
111
+ paramsType={options.paramsType}
111
112
  pathParamsType={options.pathParamsType}
112
113
  dataReturnType={options.client.dataReturnType}
113
114
  cursorParam={options.infinite.cursorParam}
@@ -118,6 +119,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
118
119
  name={query.name}
119
120
  queryOptionsName={queryOptions.name}
120
121
  typeSchemas={type.schemas}
122
+ paramsType={options.paramsType}
121
123
  pathParamsType={options.pathParamsType}
122
124
  operation={operation}
123
125
  dataReturnType={options.client.dataReturnType}
@@ -1,4 +1,3 @@
1
- import transformers from '@kubb/core/transformers'
2
1
  import { pluginClientName } from '@kubb/plugin-client'
3
2
  import { Client } from '@kubb/plugin-client/components'
4
3
  import { createReactGenerator } from '@kubb/plugin-oas'
@@ -85,11 +84,12 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
85
84
  name={client.name}
86
85
  isExportable={false}
87
86
  isIndexable={false}
88
- baseURL={options.baseURL}
87
+ baseURL={options.client.baseURL}
89
88
  operation={operation}
90
89
  typeSchemas={type.schemas}
91
90
  zodSchemas={zod.schemas}
92
91
  dataReturnType={options.client.dataReturnType}
92
+ paramsType={options.paramsType}
93
93
  pathParamsType={options.pathParamsType}
94
94
  parser={options.parser}
95
95
  />
@@ -100,6 +100,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
100
100
  typeSchemas={type.schemas}
101
101
  operation={operation}
102
102
  dataReturnType={options.client.dataReturnType}
103
+ paramsType={options.paramsType}
103
104
  pathParamsType={options.pathParamsType}
104
105
  mutationKeyName={mutationKey.name}
105
106
  />
@@ -1,4 +1,3 @@
1
- import transformers from '@kubb/core/transformers'
2
1
  import { pluginClientName } from '@kubb/plugin-client'
3
2
  import { Client } from '@kubb/plugin-client/components'
4
3
  import { createReactGenerator } from '@kubb/plugin-oas'
@@ -92,11 +91,12 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
92
91
  name={client.name}
93
92
  isExportable={false}
94
93
  isIndexable={false}
95
- baseURL={options.baseURL}
94
+ baseURL={options.client.baseURL}
96
95
  operation={operation}
97
96
  typeSchemas={type.schemas}
98
97
  zodSchemas={zod.schemas}
99
98
  dataReturnType={options.client.dataReturnType}
99
+ paramsType={options.paramsType}
100
100
  pathParamsType={options.pathParamsType}
101
101
  parser={options.parser}
102
102
  />
@@ -105,12 +105,14 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
105
105
  clientName={client.name}
106
106
  queryKeyName={queryKey.name}
107
107
  typeSchemas={type.schemas}
108
+ paramsType={options.paramsType}
108
109
  pathParamsType={options.pathParamsType}
109
110
  />
110
111
  <Query
111
112
  name={query.name}
112
113
  queryOptionsName={queryOptions.name}
113
114
  typeSchemas={type.schemas}
115
+ paramsType={options.paramsType}
114
116
  pathParamsType={options.pathParamsType}
115
117
  operation={operation}
116
118
  dataReturnType={options.client.dataReturnType}
package/src/plugin.ts CHANGED
@@ -2,7 +2,6 @@ import path from 'node:path'
2
2
 
3
3
  import { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'
4
4
  import { camelCase, pascalCase } from '@kubb/core/transformers'
5
- import { renderTemplate } from '@kubb/core/utils'
6
5
  import { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'
7
6
 
8
7
  import { pluginTsName } from '@kubb/plugin-ts'
@@ -25,6 +24,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
25
24
  parser = 'client',
26
25
  infinite,
27
26
  transformers = {},
27
+ paramsType = 'inline',
28
28
  pathParamsType = 'inline',
29
29
  mutation = {},
30
30
  query = {},
@@ -35,7 +35,6 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
35
35
  name: pluginVueQueryName,
36
36
  options: {
37
37
  output,
38
- baseURL: undefined,
39
38
  client: {
40
39
  importPath: '@kubb/plugin-client/client',
41
40
  dataReturnType: 'data',
@@ -62,7 +61,8 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
62
61
  importPath: '@tanstack/vue-query',
63
62
  ...mutation,
64
63
  },
65
- pathParamsType,
64
+ paramsType,
65
+ pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,
66
66
  parser,
67
67
  },
68
68
  pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
@@ -112,22 +112,19 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
112
112
  const mode = FileManager.getMode(path.resolve(root, output.path))
113
113
  const baseURL = await swaggerPlugin.context.getBaseURL()
114
114
 
115
- const operationGenerator = new OperationGenerator(
116
- {
117
- ...this.plugin.options,
118
- baseURL,
119
- },
120
- {
121
- oas,
122
- pluginManager: this.pluginManager,
123
- plugin: this.plugin,
124
- contentType: swaggerPlugin.context.contentType,
125
- exclude,
126
- include,
127
- override,
128
- mode,
129
- },
130
- )
115
+ if (baseURL) {
116
+ this.plugin.options.client.baseURL = baseURL
117
+ }
118
+ const operationGenerator = new OperationGenerator(this.plugin.options, {
119
+ oas,
120
+ pluginManager: this.pluginManager,
121
+ plugin: this.plugin,
122
+ contentType: swaggerPlugin.context.contentType,
123
+ exclude,
124
+ include,
125
+ override,
126
+ mode,
127
+ })
131
128
 
132
129
  const files = await operationGenerator.build(...generators)
133
130
  await this.addFile(...files)
package/src/types.ts CHANGED
@@ -3,6 +3,7 @@ import type { Group, Output, PluginFactoryOptions, ResolveNameParams } from '@ku
3
3
  import type { HttpMethod } from '@kubb/oas'
4
4
  import type { PluginClient } from '@kubb/plugin-client'
5
5
  import type { Exclude, Generator, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
6
+ import type { PluginReactQuery } from '@kubb/plugin-react-query'
6
7
 
7
8
  type Query = {
8
9
  /**
@@ -63,24 +64,15 @@ export type Infinite = {
63
64
 
64
65
  export type Options = {
65
66
  /**
66
- * @default 'hooks'
67
+ * Specify the export location for the files and define the behavior of the output
68
+ * @default { path: 'hooks', barrelType: 'named' }
67
69
  */
68
70
  output?: Output
69
71
  /**
70
72
  * Group the @tanstack/query hooks based on the provided name.
71
73
  */
72
74
  group?: Group
73
- client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>
74
-
75
- /**
76
- * ReturnType that needs to be used when calling client().
77
- *
78
- * `Data` will return ResponseConfig[data].
79
- *
80
- * `Full` will return ResponseConfig.
81
- * @default `'data'`
82
- * @private
83
- */
75
+ client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath' | 'baseURL'>
84
76
 
85
77
  /**
86
78
  * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
@@ -94,14 +86,18 @@ export type Options = {
94
86
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
95
87
  */
96
88
  override?: Array<Override<ResolvedOptions>>
89
+ /**
90
+ * How to pass your params
91
+ * - 'object' will return the params and pathParams as an object.
92
+ * - 'inline' will return the params as comma separated params.
93
+ * @default 'inline'
94
+ */
95
+ paramsType?: 'object' | 'inline'
97
96
  /**
98
97
  * How to pass your pathParams.
99
- *
100
- * `object` will return the pathParams as an object.
101
- *
102
- * `inline` will return the pathParams as comma separated params.
103
- * @default `'inline'`
104
- * @private
98
+ * - 'object' will return the pathParams as an object.
99
+ * - 'inline' will return the pathParams as comma separated params.
100
+ * @default 'inline'
105
101
  */
106
102
  pathParamsType?: PluginClient['options']['pathParamsType']
107
103
  /**
@@ -117,7 +113,7 @@ export type Options = {
117
113
  */
118
114
  mutation?: Mutation | false
119
115
  /**
120
- * Which parser can be used before returning the data to `@tanstack/query`.
116
+ * Which parser should be used before returning the data to `@tanstack/query`.
121
117
  * `'zod'` will use `@kubb/plugin-zod` to parse the data.
122
118
  */
123
119
  parser?: PluginClient['options']['parser']
@@ -135,9 +131,9 @@ export type Options = {
135
131
 
136
132
  type ResolvedOptions = {
137
133
  output: Output
138
- baseURL: string | undefined
139
- client: Required<NonNullable<PluginVueQuery['options']['client']>>
134
+ client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
140
135
  parser: Required<NonNullable<Options['parser']>>
136
+ paramsType: NonNullable<Options['paramsType']>
141
137
  pathParamsType: NonNullable<Options['pathParamsType']>
142
138
  /**
143
139
  * Only used of infinite