@kubb/plugin-vue-query 3.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HWT3VLRR.js → chunk-FPSHQREX.js} +69 -32
- package/dist/chunk-FPSHQREX.js.map +1 -0
- package/dist/{chunk-YWUOBXLY.js → chunk-GNUJZEZD.js} +14 -3
- package/dist/chunk-GNUJZEZD.js.map +1 -0
- package/dist/{chunk-63EIV54R.cjs → chunk-M7ME77VI.cjs} +25 -14
- package/dist/chunk-M7ME77VI.cjs.map +1 -0
- package/dist/{chunk-JYBDVID2.cjs → chunk-X3AYO2AG.cjs} +69 -32
- package/dist/chunk-X3AYO2AG.cjs.map +1 -0
- package/dist/components.cjs +8 -8
- package/dist/components.d.cts +25 -13
- package/dist/components.d.ts +25 -13
- package/dist/components.js +1 -1
- package/dist/generators.cjs +5 -5
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-DAqaLrlX.d.cts → types-B6HlLDzG.d.cts} +30 -3
- package/dist/{types-DAqaLrlX.d.ts → types-B6HlLDzG.d.ts} +30 -3
- package/package.json +11 -11
- package/src/components/InfiniteQuery.tsx +9 -1
- package/src/components/InfiniteQueryOptions.tsx +9 -2
- package/src/components/Mutation.tsx +18 -3
- package/src/components/MutationKey.tsx +5 -4
- package/src/components/Query.tsx +9 -1
- package/src/components/QueryKey.tsx +9 -5
- package/src/components/QueryOptions.tsx +9 -3
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +55 -36
- package/src/generators/__snapshots__/clientGetImportPath.ts +55 -36
- package/src/generators/__snapshots__/clientPostImportPath.ts +51 -33
- package/src/generators/__snapshots__/findByTags.ts +55 -36
- package/src/generators/__snapshots__/findByTagsObject.ts +57 -46
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +55 -36
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +56 -36
- package/src/generators/__snapshots__/findByTagsWithZod.ts +55 -36
- package/src/generators/__snapshots__/findInfiniteByTags.ts +62 -41
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +62 -41
- package/src/generators/__snapshots__/postAsQuery.ts +68 -38
- package/src/generators/__snapshots__/updatePetById.ts +51 -33
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +51 -35
- package/src/generators/infiniteQueryGenerator.tsx +4 -0
- package/src/generators/mutationGenerator.tsx +3 -0
- package/src/generators/queryGenerator.tsx +4 -0
- package/src/plugin.ts +3 -1
- package/src/types.ts +7 -0
- package/dist/chunk-63EIV54R.cjs.map +0 -1
- package/dist/chunk-HWT3VLRR.js.map +0 -1
- package/dist/chunk-JYBDVID2.cjs.map +0 -1
- package/dist/chunk-YWUOBXLY.js.map +0 -1
|
@@ -1,52 +1,82 @@
|
|
|
1
|
-
import client from
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from
|
|
4
|
-
import type { MaybeRef } from
|
|
5
|
-
import { queryOptions, useQuery } from
|
|
6
|
-
import { unref } from
|
|
1
|
+
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { QueryKey, QueryObserverOptions, UseQueryReturnType } from 'custom-query'
|
|
4
|
+
import type { MaybeRef } from 'vue'
|
|
5
|
+
import { queryOptions, useQuery } from 'custom-query'
|
|
6
|
+
import { unref } from 'vue'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
export const updatePetWithFormQueryKey = (
|
|
9
|
+
petId: MaybeRef<UpdatePetWithFormPathParams['petId']>,
|
|
10
|
+
data?: MaybeRef<UpdatePetWithFormMutationRequest>,
|
|
11
|
+
params?: MaybeRef<UpdatePetWithFormQueryParams>,
|
|
12
|
+
) => [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
/**
|
|
13
17
|
* @summary Updates a pet in the store with form data
|
|
14
18
|
* {@link /pet/:petId}
|
|
15
19
|
*/
|
|
16
|
-
async function updatePetWithForm(
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
async function updatePetWithForm(
|
|
21
|
+
petId: UpdatePetWithFormPathParams['petId'],
|
|
22
|
+
data?: UpdatePetWithFormMutationRequest,
|
|
23
|
+
params?: UpdatePetWithFormQueryParams,
|
|
24
|
+
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
|
|
25
|
+
) {
|
|
26
|
+
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
|
|
27
|
+
method: 'POST',
|
|
28
|
+
url: `/pet/${petId}`,
|
|
29
|
+
params,
|
|
30
|
+
data,
|
|
31
|
+
...config,
|
|
32
|
+
})
|
|
33
|
+
return updatePetWithFormMutationResponse.parse(res.data)
|
|
19
34
|
}
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
export function updatePetWithFormQueryOptions(
|
|
37
|
+
petId: MaybeRef<UpdatePetWithFormPathParams['petId']>,
|
|
38
|
+
data?: MaybeRef<UpdatePetWithFormMutationRequest>,
|
|
39
|
+
params?: MaybeRef<UpdatePetWithFormQueryParams>,
|
|
40
|
+
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
|
|
41
|
+
) {
|
|
42
|
+
const queryKey = updatePetWithFormQueryKey(petId, data, params)
|
|
43
|
+
return queryOptions({
|
|
44
|
+
enabled: !!petId,
|
|
45
|
+
queryKey,
|
|
46
|
+
queryFn: async ({ signal }) => {
|
|
47
|
+
config.signal = signal
|
|
48
|
+
return updatePetWithForm(unref(petId), unref(data), unref(params), unref(config))
|
|
49
|
+
},
|
|
50
|
+
})
|
|
31
51
|
}
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
/**
|
|
34
54
|
* @summary Updates a pet in the store with form data
|
|
35
55
|
* {@link /pet/:petId}
|
|
36
56
|
*/
|
|
37
|
-
export function useUpdatePetWithForm<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
export function useUpdatePetWithForm<
|
|
58
|
+
TData = UpdatePetWithFormMutationResponse,
|
|
59
|
+
TQueryData = UpdatePetWithFormMutationResponse,
|
|
60
|
+
TQueryKey extends QueryKey = UpdatePetWithFormQueryKey,
|
|
61
|
+
>(
|
|
62
|
+
petId: MaybeRef<UpdatePetWithFormPathParams['petId']>,
|
|
63
|
+
data?: MaybeRef<UpdatePetWithFormMutationRequest>,
|
|
64
|
+
params?: MaybeRef<UpdatePetWithFormQueryParams>,
|
|
65
|
+
options: {
|
|
66
|
+
query?: Partial<QueryObserverOptions<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, TData, TQueryData, TQueryKey>>
|
|
67
|
+
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
|
|
68
|
+
} = {},
|
|
69
|
+
) {
|
|
70
|
+
const { query: queryOptions, client: config = {} } = options ?? {}
|
|
71
|
+
const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params)
|
|
72
|
+
|
|
73
|
+
const query = useQuery({
|
|
74
|
+
...(updatePetWithFormQueryOptions(petId, data, params, config) as unknown as QueryObserverOptions),
|
|
75
|
+
queryKey: queryKey as QueryKey,
|
|
76
|
+
...(queryOptions as unknown as Omit<QueryObserverOptions, 'queryKey'>),
|
|
77
|
+
}) as UseQueryReturnType<TData, UpdatePetWithForm405> & { queryKey: TQueryKey }
|
|
78
|
+
|
|
79
|
+
query.queryKey = queryKey as TQueryKey
|
|
80
|
+
|
|
81
|
+
return query
|
|
52
82
|
}
|
|
@@ -1,45 +1,63 @@
|
|
|
1
|
-
import client from
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { MutationObserverOptions } from
|
|
4
|
-
import type { MaybeRef } from
|
|
5
|
-
import { useMutation } from
|
|
1
|
+
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { MutationObserverOptions } from '@tanstack/vue-query'
|
|
4
|
+
import type { MaybeRef } from 'vue'
|
|
5
|
+
import { useMutation } from '@tanstack/vue-query'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
12
|
* @summary Updates a pet in the store with form data
|
|
13
13
|
* {@link /pet/:petId}
|
|
14
14
|
*/
|
|
15
|
-
async function updatePetWithForm(
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
async function updatePetWithForm(
|
|
16
|
+
petId: UpdatePetWithFormPathParams['petId'],
|
|
17
|
+
data?: UpdatePetWithFormMutationRequest,
|
|
18
|
+
params?: UpdatePetWithFormQueryParams,
|
|
19
|
+
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
|
|
20
|
+
) {
|
|
21
|
+
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: `/pet/${petId}`,
|
|
24
|
+
params,
|
|
25
|
+
data,
|
|
26
|
+
...config,
|
|
27
|
+
})
|
|
28
|
+
return updatePetWithFormMutationResponse.parse(res.data)
|
|
18
29
|
}
|
|
19
30
|
|
|
20
|
-
|
|
31
|
+
/**
|
|
21
32
|
* @summary Updates a pet in the store with form data
|
|
22
33
|
* {@link /pet/:petId}
|
|
23
34
|
*/
|
|
24
|
-
export function useUpdatePetWithForm(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
35
|
+
export function useUpdatePetWithForm(
|
|
36
|
+
options: {
|
|
37
|
+
mutation?: MutationObserverOptions<
|
|
38
|
+
UpdatePetWithFormMutationResponse,
|
|
39
|
+
UpdatePetWithForm405,
|
|
40
|
+
{
|
|
41
|
+
petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
|
|
42
|
+
data?: MaybeRef<UpdatePetWithFormMutationRequest>
|
|
43
|
+
params?: MaybeRef<UpdatePetWithFormQueryParams>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
|
|
47
|
+
} = {},
|
|
48
|
+
) {
|
|
49
|
+
const { mutation: mutationOptions, client: config = {} } = options ?? {}
|
|
50
|
+
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
51
|
+
|
|
52
|
+
return useMutation<
|
|
53
|
+
UpdatePetWithFormMutationResponse,
|
|
54
|
+
UpdatePetWithForm405,
|
|
55
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
|
|
56
|
+
>({
|
|
57
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
58
|
+
return updatePetWithForm(petId, data, params, config)
|
|
59
|
+
},
|
|
60
|
+
mutationKey,
|
|
61
|
+
...mutationOptions,
|
|
62
|
+
})
|
|
45
63
|
}
|
|
@@ -1,47 +1,63 @@
|
|
|
1
|
-
import client from
|
|
2
|
-
import type { RequestConfig } from
|
|
3
|
-
import type { MutationObserverOptions } from
|
|
4
|
-
import type { MaybeRef } from
|
|
5
|
-
import { useMutation } from
|
|
1
|
+
import client from '@kubb/plugin-client/clients/axios'
|
|
2
|
+
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { MutationObserverOptions } from '@tanstack/vue-query'
|
|
4
|
+
import type { MaybeRef } from 'vue'
|
|
5
|
+
import { useMutation } from '@tanstack/vue-query'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
12
|
* @summary Updates a pet in the store with form data
|
|
13
13
|
* {@link /pet/:petId}
|
|
14
14
|
*/
|
|
15
|
-
async function updatePetWithForm(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
async function updatePetWithForm(
|
|
16
|
+
{ petId }: { petId: UpdatePetWithFormPathParams['petId'] },
|
|
17
|
+
data?: UpdatePetWithFormMutationRequest,
|
|
18
|
+
params?: UpdatePetWithFormQueryParams,
|
|
19
|
+
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> = {},
|
|
20
|
+
) {
|
|
21
|
+
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405, UpdatePetWithFormMutationRequest>({
|
|
22
|
+
method: 'POST',
|
|
23
|
+
url: `/pet/${petId}`,
|
|
24
|
+
params,
|
|
25
|
+
data,
|
|
26
|
+
...config,
|
|
27
|
+
})
|
|
28
|
+
return updatePetWithFormMutationResponse.parse(res.data)
|
|
20
29
|
}
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
/**
|
|
23
32
|
* @summary Updates a pet in the store with form data
|
|
24
33
|
* {@link /pet/:petId}
|
|
25
34
|
*/
|
|
26
|
-
export function useUpdatePetWithForm(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
35
|
+
export function useUpdatePetWithForm(
|
|
36
|
+
options: {
|
|
37
|
+
mutation?: MutationObserverOptions<
|
|
38
|
+
UpdatePetWithFormMutationResponse,
|
|
39
|
+
UpdatePetWithForm405,
|
|
40
|
+
{
|
|
41
|
+
petId: MaybeRef<UpdatePetWithFormPathParams['petId']>
|
|
42
|
+
data?: MaybeRef<UpdatePetWithFormMutationRequest>
|
|
43
|
+
params?: MaybeRef<UpdatePetWithFormQueryParams>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>>
|
|
47
|
+
} = {},
|
|
48
|
+
) {
|
|
49
|
+
const { mutation: mutationOptions, client: config = {} } = options ?? {}
|
|
50
|
+
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
51
|
+
|
|
52
|
+
return useMutation<
|
|
53
|
+
UpdatePetWithFormMutationResponse,
|
|
54
|
+
UpdatePetWithForm405,
|
|
55
|
+
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams }
|
|
56
|
+
>({
|
|
57
|
+
mutationFn: async ({ petId, data, params }) => {
|
|
58
|
+
return updatePetWithForm({ petId }, data, params, config)
|
|
59
|
+
},
|
|
60
|
+
mutationKey,
|
|
61
|
+
...mutationOptions,
|
|
62
|
+
})
|
|
47
63
|
}
|
|
@@ -85,6 +85,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
85
85
|
name={queryKey.name}
|
|
86
86
|
typeName={queryKey.typeName}
|
|
87
87
|
operation={operation}
|
|
88
|
+
paramsCasing={options.paramsCasing}
|
|
88
89
|
pathParamsType={options.pathParamsType}
|
|
89
90
|
typeSchemas={type.schemas}
|
|
90
91
|
transformer={options.queryKey}
|
|
@@ -98,6 +99,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
98
99
|
typeSchemas={type.schemas}
|
|
99
100
|
zodSchemas={zod.schemas}
|
|
100
101
|
dataReturnType={options.client.dataReturnType}
|
|
102
|
+
paramsCasing={options.paramsCasing}
|
|
101
103
|
paramsType={options.paramsType}
|
|
102
104
|
pathParamsType={options.pathParamsType}
|
|
103
105
|
parser={options.parser}
|
|
@@ -112,6 +114,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
112
114
|
queryKeyName={queryKey.name}
|
|
113
115
|
typeSchemas={type.schemas}
|
|
114
116
|
paramsType={options.paramsType}
|
|
117
|
+
paramsCasing={options.paramsCasing}
|
|
115
118
|
pathParamsType={options.pathParamsType}
|
|
116
119
|
dataReturnType={options.client.dataReturnType}
|
|
117
120
|
cursorParam={options.infinite.cursorParam}
|
|
@@ -128,6 +131,7 @@ export const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
128
131
|
name={query.name}
|
|
129
132
|
queryOptionsName={queryOptions.name}
|
|
130
133
|
typeSchemas={type.schemas}
|
|
134
|
+
paramsCasing={options.paramsCasing}
|
|
131
135
|
paramsType={options.paramsType}
|
|
132
136
|
pathParamsType={options.pathParamsType}
|
|
133
137
|
operation={operation}
|
|
@@ -80,6 +80,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
80
80
|
typeName={mutationKey.typeName}
|
|
81
81
|
operation={operation}
|
|
82
82
|
pathParamsType={options.pathParamsType}
|
|
83
|
+
paramsCasing={options.paramsCasing}
|
|
83
84
|
typeSchemas={type.schemas}
|
|
84
85
|
transformer={options.mutationKey}
|
|
85
86
|
/>
|
|
@@ -92,6 +93,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
92
93
|
typeSchemas={type.schemas}
|
|
93
94
|
zodSchemas={zod.schemas}
|
|
94
95
|
dataReturnType={options.client.dataReturnType}
|
|
96
|
+
paramsCasing={options.paramsCasing}
|
|
95
97
|
paramsType={options.paramsType}
|
|
96
98
|
pathParamsType={options.pathParamsType}
|
|
97
99
|
parser={options.parser}
|
|
@@ -106,6 +108,7 @@ export const mutationGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
106
108
|
typeName={mutation.typeName}
|
|
107
109
|
typeSchemas={type.schemas}
|
|
108
110
|
operation={operation}
|
|
111
|
+
paramsCasing={options.paramsCasing}
|
|
109
112
|
dataReturnType={options.client.dataReturnType}
|
|
110
113
|
paramsType={options.paramsType}
|
|
111
114
|
pathParamsType={options.pathParamsType}
|
|
@@ -84,6 +84,7 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
84
84
|
name={queryKey.name}
|
|
85
85
|
typeName={queryKey.typeName}
|
|
86
86
|
operation={operation}
|
|
87
|
+
paramsCasing={options.paramsCasing}
|
|
87
88
|
pathParamsType={options.pathParamsType}
|
|
88
89
|
typeSchemas={type.schemas}
|
|
89
90
|
transformer={options.queryKey}
|
|
@@ -97,6 +98,7 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
97
98
|
typeSchemas={type.schemas}
|
|
98
99
|
zodSchemas={zod.schemas}
|
|
99
100
|
dataReturnType={options.client.dataReturnType}
|
|
101
|
+
paramsCasing={options.paramsCasing}
|
|
100
102
|
paramsType={options.paramsType}
|
|
101
103
|
pathParamsType={options.pathParamsType}
|
|
102
104
|
parser={options.parser}
|
|
@@ -106,6 +108,7 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
106
108
|
name={queryOptions.name}
|
|
107
109
|
clientName={client.name}
|
|
108
110
|
queryKeyName={queryKey.name}
|
|
111
|
+
paramsCasing={options.paramsCasing}
|
|
109
112
|
typeSchemas={type.schemas}
|
|
110
113
|
paramsType={options.paramsType}
|
|
111
114
|
pathParamsType={options.pathParamsType}
|
|
@@ -118,6 +121,7 @@ export const queryGenerator = createReactGenerator<PluginVueQuery>({
|
|
|
118
121
|
name={query.name}
|
|
119
122
|
queryOptionsName={queryOptions.name}
|
|
120
123
|
typeSchemas={type.schemas}
|
|
124
|
+
paramsCasing={options.paramsCasing}
|
|
121
125
|
paramsType={options.paramsType}
|
|
122
126
|
pathParamsType={options.pathParamsType}
|
|
123
127
|
operation={operation}
|
package/src/plugin.ts
CHANGED
|
@@ -29,6 +29,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
|
|
|
29
29
|
pathParamsType = 'inline',
|
|
30
30
|
mutation = {},
|
|
31
31
|
query = {},
|
|
32
|
+
paramsCasing,
|
|
32
33
|
mutationKey = MutationKey.getTransformer,
|
|
33
34
|
queryKey = QueryKey.getTransformer,
|
|
34
35
|
generators = [queryGenerator, infiniteQueryGenerator, mutationGenerator].filter(Boolean),
|
|
@@ -39,7 +40,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
|
|
|
39
40
|
options: {
|
|
40
41
|
output,
|
|
41
42
|
client: {
|
|
42
|
-
importPath: '@kubb/plugin-client/
|
|
43
|
+
importPath: '@kubb/plugin-client/clients/axios',
|
|
43
44
|
dataReturnType: 'data',
|
|
44
45
|
pathParamsType: 'inline',
|
|
45
46
|
...options.client,
|
|
@@ -70,6 +71,7 @@ export const pluginVueQuery = createPlugin<PluginVueQuery>((options) => {
|
|
|
70
71
|
paramsType,
|
|
71
72
|
pathParamsType: paramsType === 'object' ? 'object' : pathParamsType,
|
|
72
73
|
parser,
|
|
74
|
+
paramsCasing,
|
|
73
75
|
group,
|
|
74
76
|
},
|
|
75
77
|
pre: [pluginOasName, pluginTsName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
|
package/src/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { PluginReactQuery } from '@kubb/plugin-react-query'
|
|
|
8
8
|
type TransformerProps = {
|
|
9
9
|
operation: Operation
|
|
10
10
|
schemas: OperationSchemas
|
|
11
|
+
casing: 'camelcase' | undefined
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export type Transformer = (props: TransformerProps) => unknown[]
|
|
@@ -95,6 +96,11 @@ export type Options = {
|
|
|
95
96
|
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
96
97
|
*/
|
|
97
98
|
override?: Array<Override<ResolvedOptions>>
|
|
99
|
+
/**
|
|
100
|
+
* How to style your params, by default no casing is applied
|
|
101
|
+
* - 'camelcase' will use camelcase for the params names
|
|
102
|
+
*/
|
|
103
|
+
paramsCasing?: 'camelcase'
|
|
98
104
|
/**
|
|
99
105
|
* How to pass your params
|
|
100
106
|
* - 'object' will return the params and pathParams as an object.
|
|
@@ -145,6 +151,7 @@ type ResolvedOptions = {
|
|
|
145
151
|
group: Options['group']
|
|
146
152
|
client: Required<Omit<NonNullable<PluginReactQuery['options']['client']>, 'baseURL'>> & { baseURL?: string }
|
|
147
153
|
parser: Required<NonNullable<Options['parser']>>
|
|
154
|
+
paramsCasing: Options['paramsCasing']
|
|
148
155
|
paramsType: NonNullable<Options['paramsType']>
|
|
149
156
|
pathParamsType: NonNullable<Options['pathParamsType']>
|
|
150
157
|
/**
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generators/queryGenerator.tsx","../src/generators/mutationGenerator.tsx","../src/generators/infiniteQueryGenerator.tsx"],"names":["createReactGenerator","useApp","useOperationMan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AAA,wBAC5HC,cAAAA;AAAA,UAACU,+BAAA;AAAA,UAAA;AAAA,YACC,MAAM,KAAM,CAAA,IAAA;AAAA,YACZ,kBAAkB,YAAa,CAAA,IAAA;AAAA,YAC/B,aAAa,IAAK,CAAA,OAAA;AAAA,YAClB,YAAY,OAAQ,CAAA,UAAA;AAAA,YACpB,gBAAgB,OAAQ,CAAA,cAAA;AAAA,YACxB,SAAA;AAAA,YACA,cAAA,EAAgB,QAAQ,MAAO,CAAA,cAAA;AAAA,YAC/B,cAAc,QAAS,CAAA,IAAA;AAAA,YACvB,kBAAkB,QAAS,CAAA;AAAA;AAAA;AAC7B,OACF,EAAA;AAAA,KAEJ,EAAA,CAAA;AAAA;AAGN,CAAC","file":"chunk-63EIV54R.cjs","sourcesContent":["import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Query, QueryKey, QueryOptions } from '../components'\nimport type { PluginVueQuery } from '../types'\n\nexport const queryGenerator = createReactGenerator<PluginVueQuery>({\n name: 'vue-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginVueQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const importPath = options.query ? options.query.importPath : '@tanstack/vue-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'QueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'QueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'QueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={['unref']} path=\"vue\" />\n <File.Import name={['MaybeRef']} path=\"vue\" isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n <File.Import name={['queryOptions']} path={importPath} />\n <QueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n />\n {options.query && (\n <>\n <File.Import name={['useQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'QueryObserverOptions', 'UseQueryReturnType']} path={importPath} isTypeOnly />\n <Query\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { Mutation, MutationKey } from '../components'\nimport type { PluginVueQuery } from '../types'\n\nexport const mutationGenerator = createReactGenerator<PluginVueQuery>({\n name: 'vue-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginVueQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method)\n const isMutation =\n !isQuery &&\n difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method)\n\n const importPath = options.mutation ? options.mutation.importPath : '@tanstack/vue-query'\n\n const mutation = {\n name: getName(operation, { type: 'function', prefix: 'use' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const mutationKey = {\n name: getName(operation, { type: 'const', suffix: 'MutationKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'MutationKey' }),\n }\n\n if (!isMutation) {\n return null\n }\n\n return (\n <File baseName={mutation.file.baseName} path={mutation.file.path} meta={mutation.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={mutation.file.path} path={zod.file.path} />}\n <File.Import name={['MaybeRef']} path=\"vue\" isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseConfig']} path={options.client.importPath} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mutation.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <MutationKey\n name={mutationKey.name}\n typeName={mutationKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.mutationKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n {options.mutation && (\n <>\n <File.Import name={['useMutation']} path={importPath} />\n <File.Import name={['MutationObserverOptions']} path={importPath} isTypeOnly />\n <Mutation\n name={mutation.name}\n clientName={client.name}\n typeName={mutation.typeName}\n typeSchemas={type.schemas}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n mutationKeyName={mutationKey.name}\n />\n </>\n )}\n </File>\n )\n },\n})\n","import { pluginClientName } from '@kubb/plugin-client'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, useApp } from '@kubb/react'\nimport { difference } from 'remeda'\nimport { InfiniteQuery, InfiniteQueryOptions, QueryKey } from '../components'\nimport type { PluginVueQuery } from '../types'\n\nexport const infiniteQueryGenerator = createReactGenerator<PluginVueQuery>({\n name: 'vue-infinite-query',\n Operation({ options, operation }) {\n const {\n plugin: {\n options: { output },\n },\n } = useApp<PluginVueQuery>()\n const { getSchemas, getName, getFile } = useOperationManager()\n\n const isQuery = typeof options.query === 'boolean' ? true : options.query?.methods.some((method) => operation.method === method)\n const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some(\n (method) => operation.method === method,\n )\n const isInfinite = isQuery && !!options.infinite\n const importPath = options.query ? options.query.importPath : '@tanstack/vue-query'\n\n const query = {\n name: getName(operation, { type: 'function', prefix: 'use', suffix: 'infinite' }),\n typeName: getName(operation, { type: 'type' }),\n file: getFile(operation, { prefix: 'use', suffix: 'infinite' }),\n }\n\n const client = {\n name: getName(operation, { type: 'function' }),\n }\n\n const queryOptions = {\n name: getName(operation, { type: 'function', suffix: 'InfiniteQueryOptions' }),\n }\n\n const queryKey = {\n name: getName(operation, { type: 'const', suffix: 'InfiniteQueryKey' }),\n typeName: getName(operation, { type: 'type', suffix: 'InfiniteQueryKey' }),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n //todo remove type?\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n if (!isQuery || isMutation || !isInfinite) {\n return null\n }\n\n return (\n <File baseName={query.file.baseName} path={query.file.path} meta={query.file.meta} banner={output?.banner} footer={output?.footer}>\n {options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}\n <File.Import name={['unref']} path=\"vue\" />\n <File.Import name={['MaybeRef']} path=\"vue\" isTypeOnly />\n <File.Import name={'client'} path={options.client.importPath} />\n <File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={query.file.path}\n path={type.file.path}\n isTypeOnly\n />\n <QueryKey\n name={queryKey.name}\n typeName={queryKey.typeName}\n operation={operation}\n pathParamsType={options.pathParamsType}\n typeSchemas={type.schemas}\n transformer={options.queryKey}\n />\n <Client\n name={client.name}\n isExportable={false}\n isIndexable={false}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={zod.schemas}\n dataReturnType={options.client.dataReturnType}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n parser={options.parser}\n />\n {options.infinite && (\n <>\n <File.Import name={['InfiniteData']} isTypeOnly path={importPath} />\n <File.Import name={['infiniteQueryOptions']} path={importPath} />\n <InfiniteQueryOptions\n name={queryOptions.name}\n clientName={client.name}\n queryKeyName={queryKey.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n dataReturnType={options.client.dataReturnType}\n cursorParam={options.infinite.cursorParam}\n initialPageParam={options.infinite.initialPageParam}\n queryParam={options.infinite.queryParam}\n />\n </>\n )}\n {options.infinite && (\n <>\n <File.Import name={['useInfiniteQuery']} path={importPath} />\n <File.Import name={['QueryKey', 'InfiniteQueryObserverOptions', 'UseInfiniteQueryReturnType']} path={importPath} isTypeOnly />\n <InfiniteQuery\n name={query.name}\n queryOptionsName={queryOptions.name}\n typeSchemas={type.schemas}\n paramsType={options.paramsType}\n pathParamsType={options.pathParamsType}\n operation={operation}\n dataReturnType={options.client.dataReturnType}\n queryKeyName={queryKey.name}\n queryKeyTypeName={queryKey.typeName}\n />\n </>\n )}\n </File>\n )\n },\n})\n"]}
|