@kubb/plugin-swr 3.3.5 → 3.4.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-ZUCDXWMR.js → chunk-5V4WE7OH.js} +5 -5
- package/dist/chunk-5V4WE7OH.js.map +1 -0
- package/dist/{chunk-HKFWO4UW.cjs → chunk-DRK4LTOH.cjs} +10 -10
- package/dist/chunk-DRK4LTOH.cjs.map +1 -0
- package/dist/{chunk-DJ57MWSH.cjs → chunk-OQB3Y5YU.cjs} +11 -7
- package/dist/chunk-OQB3Y5YU.cjs.map +1 -0
- package/dist/{chunk-7ELDJ4IB.js → chunk-VNUP6G3W.js} +11 -7
- package/dist/chunk-VNUP6G3W.js.map +1 -0
- package/dist/components.cjs +6 -6
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -4
- package/dist/generators.js +2 -2
- package/dist/index.cjs +5 -5
- package/dist/index.js +2 -2
- package/package.json +11 -11
- package/src/components/Mutation.tsx +5 -2
- package/src/components/Query.tsx +5 -3
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +17 -7
- package/src/generators/__snapshots__/clientGetImportPath.ts +9 -4
- package/src/generators/__snapshots__/clientPostImportPath.ts +9 -4
- package/src/generators/__snapshots__/findByTags.ts +9 -4
- package/src/generators/__snapshots__/findByTagsObject.ts +9 -4
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +9 -4
- package/src/generators/__snapshots__/findByTagsWithZod.ts +9 -4
- package/src/generators/__snapshots__/postAsQuery.ts +9 -4
- package/src/generators/__snapshots__/updatePetById.ts +9 -4
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +9 -4
- package/src/generators/mutationGenerator.tsx +1 -1
- package/src/generators/queryGenerator.tsx +1 -1
- package/dist/chunk-7ELDJ4IB.js.map +0 -1
- package/dist/chunk-DJ57MWSH.cjs.map +0 -1
- package/dist/chunk-HKFWO4UW.cjs.map +0 -1
- package/dist/chunk-ZUCDXWMR.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { queryGenerator, mutationGenerator } from './chunk-
|
|
2
|
-
import { MutationKey, QueryKey } from './chunk-
|
|
1
|
+
import { queryGenerator, mutationGenerator } from './chunk-5V4WE7OH.js';
|
|
2
|
+
import { MutationKey, QueryKey } from './chunk-VNUP6G3W.js';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { createPlugin, FileManager, PluginManager } from '@kubb/core';
|
|
5
5
|
import { camelCase, pascalCase } from '@kubb/core/transformers';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-swr",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"description": "Generator plugin-swr",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -64,22 +64,22 @@
|
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"remeda": "^2.19.0",
|
|
67
|
-
"@kubb/core": "3.
|
|
68
|
-
"@kubb/fs": "3.
|
|
69
|
-
"@kubb/oas": "3.
|
|
70
|
-
"@kubb/plugin-client": "3.
|
|
71
|
-
"@kubb/plugin-oas": "3.
|
|
72
|
-
"@kubb/plugin-ts": "3.
|
|
73
|
-
"@kubb/plugin-zod": "3.
|
|
74
|
-
"@kubb/react": "3.
|
|
67
|
+
"@kubb/core": "3.4.0",
|
|
68
|
+
"@kubb/fs": "3.4.0",
|
|
69
|
+
"@kubb/oas": "3.4.0",
|
|
70
|
+
"@kubb/plugin-client": "3.4.0",
|
|
71
|
+
"@kubb/plugin-oas": "3.4.0",
|
|
72
|
+
"@kubb/plugin-ts": "3.4.0",
|
|
73
|
+
"@kubb/plugin-zod": "3.4.0",
|
|
74
|
+
"@kubb/react": "3.4.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/react": "^18.3.18",
|
|
78
78
|
"react": "^18.3.1",
|
|
79
79
|
"tsup": "^8.3.5",
|
|
80
80
|
"typescript": "^5.7.2",
|
|
81
|
-
"@kubb/config-ts": "3.
|
|
82
|
-
"@kubb/config-tsup": "3.
|
|
81
|
+
"@kubb/config-ts": "3.4.0",
|
|
82
|
+
"@kubb/config-tsup": "3.4.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@kubb/react": "^3.0.0"
|
|
@@ -35,6 +35,7 @@ type GetParamsProps = {
|
|
|
35
35
|
// TODO add same logic as being done for react-query mutations
|
|
36
36
|
function getParams({ pathParamsType, paramsCasing, dataReturnType, typeSchemas, mutationKeyTypeName }: GetParamsProps) {
|
|
37
37
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
38
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
38
39
|
|
|
39
40
|
return FunctionParams.factory({
|
|
40
41
|
pathParams: {
|
|
@@ -56,7 +57,7 @@ function getParams({ pathParamsType, paramsCasing, dataReturnType, typeSchemas,
|
|
|
56
57
|
options: {
|
|
57
58
|
type: `
|
|
58
59
|
{
|
|
59
|
-
mutation?: Parameters<typeof useSWRMutation<${[TData,
|
|
60
|
+
mutation?: Parameters<typeof useSWRMutation<${[TData, TError, mutationKeyTypeName, typeSchemas.request?.name].join(', ')}>>[2],
|
|
60
61
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},
|
|
61
62
|
shouldFetch?: boolean,
|
|
62
63
|
}
|
|
@@ -79,9 +80,11 @@ export function Mutation({
|
|
|
79
80
|
operation,
|
|
80
81
|
}: Props): ReactNode {
|
|
81
82
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
83
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
84
|
+
|
|
82
85
|
const generics = [
|
|
83
86
|
TData,
|
|
84
|
-
|
|
87
|
+
TError,
|
|
85
88
|
`${mutationKeyTypeName} | null`,
|
|
86
89
|
typeSchemas.request?.name, //arg: data
|
|
87
90
|
].filter(Boolean)
|
package/src/components/Query.tsx
CHANGED
|
@@ -36,6 +36,7 @@ type GetParamsProps = {
|
|
|
36
36
|
|
|
37
37
|
function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }: GetParamsProps) {
|
|
38
38
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
39
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
39
40
|
|
|
40
41
|
if (paramsType === 'object') {
|
|
41
42
|
return FunctionParams.factory({
|
|
@@ -66,7 +67,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
66
67
|
options: {
|
|
67
68
|
type: `
|
|
68
69
|
{
|
|
69
|
-
query?: Parameters<typeof useSWR<${[TData,
|
|
70
|
+
query?: Parameters<typeof useSWR<${[TData, TError, `${queryKeyTypeName} | null`].join(', ')}, any>>[2],
|
|
70
71
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},
|
|
71
72
|
shouldFetch?: boolean,
|
|
72
73
|
}
|
|
@@ -105,7 +106,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, t
|
|
|
105
106
|
options: {
|
|
106
107
|
type: `
|
|
107
108
|
{
|
|
108
|
-
query?: Parameters<typeof useSWR<${[TData,
|
|
109
|
+
query?: Parameters<typeof useSWR<${[TData, TError, `${queryKeyTypeName} | null`].join(', ')}, any>>[2],
|
|
109
110
|
client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},
|
|
110
111
|
shouldFetch?: boolean,
|
|
111
112
|
}
|
|
@@ -128,7 +129,8 @@ export function Query({
|
|
|
128
129
|
pathParamsType,
|
|
129
130
|
}: Props): ReactNode {
|
|
130
131
|
const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`
|
|
131
|
-
const
|
|
132
|
+
const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`
|
|
133
|
+
const generics = [TData, TError, `${queryKeyTypeName} | null`]
|
|
132
134
|
|
|
133
135
|
const queryKeyParams = QueryKey.getParams({
|
|
134
136
|
pathParamsType,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWR from 'swr'
|
|
3
|
-
import type { RequestConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig, ResponseConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
6
6
|
|
|
@@ -12,7 +12,12 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
12
12
|
* {@link /pet/findByTags}
|
|
13
13
|
*/
|
|
14
14
|
async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
|
|
15
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
15
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/pet/findByTags`,
|
|
18
|
+
params,
|
|
19
|
+
...config,
|
|
20
|
+
})
|
|
16
21
|
return res
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -32,7 +37,9 @@ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTags
|
|
|
32
37
|
export function useFindPetsByTags(
|
|
33
38
|
{ params }: { params?: FindPetsByTagsQueryParams },
|
|
34
39
|
options: {
|
|
35
|
-
query?: Parameters<
|
|
40
|
+
query?: Parameters<
|
|
41
|
+
typeof useSWR<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null, any>
|
|
42
|
+
>[2]
|
|
36
43
|
client?: Partial<RequestConfig>
|
|
37
44
|
shouldFetch?: boolean
|
|
38
45
|
} = {},
|
|
@@ -41,8 +48,11 @@ export function useFindPetsByTags(
|
|
|
41
48
|
|
|
42
49
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
43
50
|
|
|
44
|
-
return useSWR<ResponseConfig<FindPetsByTagsQueryResponse>, FindPetsByTags400
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
return useSWR<ResponseConfig<FindPetsByTagsQueryResponse>, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null>(
|
|
52
|
+
shouldFetch ? queryKey : null,
|
|
53
|
+
{
|
|
54
|
+
...findPetsByTagsQueryOptions({ params }, config),
|
|
55
|
+
...queryOptions,
|
|
56
|
+
},
|
|
57
|
+
)
|
|
48
58
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from 'axios'
|
|
2
2
|
import useSWR from 'swr'
|
|
3
|
-
import type { RequestConfig } from 'axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
4
4
|
|
|
5
5
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
6
6
|
|
|
@@ -12,7 +12,12 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
12
12
|
* {@link /pet/findByTags}
|
|
13
13
|
*/
|
|
14
14
|
async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
|
|
15
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
15
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/pet/findByTags`,
|
|
18
|
+
params,
|
|
19
|
+
...config,
|
|
20
|
+
})
|
|
16
21
|
return res.data
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -32,7 +37,7 @@ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTags
|
|
|
32
37
|
export function useFindPetsByTags(
|
|
33
38
|
{ params }: { params?: FindPetsByTagsQueryParams },
|
|
34
39
|
options: {
|
|
35
|
-
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
40
|
+
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null, any>>[2]
|
|
36
41
|
client?: Partial<RequestConfig>
|
|
37
42
|
shouldFetch?: boolean
|
|
38
43
|
} = {},
|
|
@@ -41,7 +46,7 @@ export function useFindPetsByTags(
|
|
|
41
46
|
|
|
42
47
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
43
48
|
|
|
44
|
-
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
49
|
+
return useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
|
|
45
50
|
...findPetsByTagsQueryOptions({ params }, config),
|
|
46
51
|
...queryOptions,
|
|
47
52
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from 'axios'
|
|
2
2
|
import useSWRMutation from 'swr/mutation'
|
|
3
|
-
import type { RequestConfig } from 'axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from 'axios'
|
|
4
4
|
|
|
5
5
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
|
|
6
6
|
|
|
@@ -11,7 +11,12 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
|
|
|
11
11
|
* {@link /pet/:petId}
|
|
12
12
|
*/
|
|
13
13
|
async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
|
|
14
|
-
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
14
|
+
const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
url: `/pet/${petId}`,
|
|
17
|
+
params,
|
|
18
|
+
...config,
|
|
19
|
+
})
|
|
15
20
|
return res.data
|
|
16
21
|
}
|
|
17
22
|
|
|
@@ -23,7 +28,7 @@ export function useUpdatePetWithForm(
|
|
|
23
28
|
petId: UpdatePetWithFormPathParams['petId'],
|
|
24
29
|
params?: UpdatePetWithFormQueryParams,
|
|
25
30
|
options: {
|
|
26
|
-
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
31
|
+
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey>>[2]
|
|
27
32
|
client?: Partial<RequestConfig>
|
|
28
33
|
shouldFetch?: boolean
|
|
29
34
|
} = {},
|
|
@@ -31,7 +36,7 @@ export function useUpdatePetWithForm(
|
|
|
31
36
|
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
|
|
32
37
|
const mutationKey = updatePetWithFormMutationKey()
|
|
33
38
|
|
|
34
|
-
return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
39
|
+
return useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey | null>(
|
|
35
40
|
shouldFetch ? mutationKey : null,
|
|
36
41
|
async (_url) => {
|
|
37
42
|
return updatePetWithForm(petId, params, config)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWR from 'swr'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
6
6
|
|
|
@@ -12,7 +12,12 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
12
12
|
* {@link /pet/findByTags}
|
|
13
13
|
*/
|
|
14
14
|
async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
|
|
15
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
15
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/pet/findByTags`,
|
|
18
|
+
params,
|
|
19
|
+
...config,
|
|
20
|
+
})
|
|
16
21
|
return res.data
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -32,7 +37,7 @@ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTags
|
|
|
32
37
|
export function useFindPetsByTags(
|
|
33
38
|
{ params }: { params?: FindPetsByTagsQueryParams },
|
|
34
39
|
options: {
|
|
35
|
-
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
40
|
+
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null, any>>[2]
|
|
36
41
|
client?: Partial<RequestConfig>
|
|
37
42
|
shouldFetch?: boolean
|
|
38
43
|
} = {},
|
|
@@ -41,7 +46,7 @@ export function useFindPetsByTags(
|
|
|
41
46
|
|
|
42
47
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
43
48
|
|
|
44
|
-
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
49
|
+
return useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
|
|
45
50
|
...findPetsByTagsQueryOptions({ params }, config),
|
|
46
51
|
...queryOptions,
|
|
47
52
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWR from 'swr'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
6
6
|
|
|
@@ -12,7 +12,12 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
12
12
|
* {@link /pet/findByTags}
|
|
13
13
|
*/
|
|
14
14
|
async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
|
|
15
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
15
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/pet/findByTags`,
|
|
18
|
+
params,
|
|
19
|
+
...config,
|
|
20
|
+
})
|
|
16
21
|
return res.data
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -32,7 +37,7 @@ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTags
|
|
|
32
37
|
export function useFindPetsByTags(
|
|
33
38
|
{ params }: { params?: FindPetsByTagsQueryParams },
|
|
34
39
|
options: {
|
|
35
|
-
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
40
|
+
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null, any>>[2]
|
|
36
41
|
client?: Partial<RequestConfig>
|
|
37
42
|
shouldFetch?: boolean
|
|
38
43
|
} = {},
|
|
@@ -41,7 +46,7 @@ export function useFindPetsByTags(
|
|
|
41
46
|
|
|
42
47
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
43
48
|
|
|
44
|
-
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
49
|
+
return useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
|
|
45
50
|
...findPetsByTagsQueryOptions({ params }, config),
|
|
46
51
|
...queryOptions,
|
|
47
52
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWR from 'swr'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
6
6
|
|
|
@@ -12,7 +12,12 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
12
12
|
* {@link /pet/findByTags}
|
|
13
13
|
*/
|
|
14
14
|
async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
|
|
15
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
15
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/pet/findByTags`,
|
|
18
|
+
params,
|
|
19
|
+
...config,
|
|
20
|
+
})
|
|
16
21
|
return res.data
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -32,7 +37,7 @@ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTags
|
|
|
32
37
|
export function useFindPetsByTags(
|
|
33
38
|
{ params }: { params?: FindPetsByTagsQueryParams },
|
|
34
39
|
options: {
|
|
35
|
-
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
40
|
+
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null, any>>[2]
|
|
36
41
|
client?: Partial<RequestConfig>
|
|
37
42
|
shouldFetch?: boolean
|
|
38
43
|
} = {},
|
|
@@ -41,7 +46,7 @@ export function useFindPetsByTags(
|
|
|
41
46
|
|
|
42
47
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
43
48
|
|
|
44
|
-
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
49
|
+
return useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
|
|
45
50
|
...findPetsByTagsQueryOptions({ params }, config),
|
|
46
51
|
...queryOptions,
|
|
47
52
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWR from 'swr'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const findPetsByTagsQueryKey = (params?: FindPetsByTagsQueryParams) => [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
|
|
6
6
|
|
|
@@ -12,7 +12,12 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
|
|
|
12
12
|
* {@link /pet/findByTags}
|
|
13
13
|
*/
|
|
14
14
|
async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> = {}) {
|
|
15
|
-
const res = await client<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
15
|
+
const res = await client<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
url: `/pet/findByTags`,
|
|
18
|
+
params,
|
|
19
|
+
...config,
|
|
20
|
+
})
|
|
16
21
|
return findPetsByTagsQueryResponse.parse(res.data)
|
|
17
22
|
}
|
|
18
23
|
|
|
@@ -32,7 +37,7 @@ export function findPetsByTagsQueryOptions({ params }: { params?: FindPetsByTags
|
|
|
32
37
|
export function useFindPetsByTags(
|
|
33
38
|
{ params }: { params?: FindPetsByTagsQueryParams },
|
|
34
39
|
options: {
|
|
35
|
-
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
40
|
+
query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null, any>>[2]
|
|
36
41
|
client?: Partial<RequestConfig>
|
|
37
42
|
shouldFetch?: boolean
|
|
38
43
|
} = {},
|
|
@@ -41,7 +46,7 @@ export function useFindPetsByTags(
|
|
|
41
46
|
|
|
42
47
|
const queryKey = findPetsByTagsQueryKey(params)
|
|
43
48
|
|
|
44
|
-
return useSWR<FindPetsByTagsQueryResponse, FindPetsByTags400
|
|
49
|
+
return useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryKey | null>(shouldFetch ? queryKey : null, {
|
|
45
50
|
...findPetsByTagsQueryOptions({ params }, config),
|
|
46
51
|
...queryOptions,
|
|
47
52
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWR from 'custom-swr'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const updatePetWithFormQueryKey = (petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams) =>
|
|
6
6
|
[{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : [])] as const
|
|
@@ -15,7 +15,12 @@ async function updatePetWithForm(
|
|
|
15
15
|
{ petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
|
|
16
16
|
config: Partial<RequestConfig> = {},
|
|
17
17
|
) {
|
|
18
|
-
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
18
|
+
const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
url: `/pet/${petId}`,
|
|
21
|
+
params,
|
|
22
|
+
...config,
|
|
23
|
+
})
|
|
19
24
|
return res.data
|
|
20
25
|
}
|
|
21
26
|
|
|
@@ -37,7 +42,7 @@ export function updatePetWithFormQueryOptions(
|
|
|
37
42
|
export function useUpdatePetWithForm(
|
|
38
43
|
{ petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
|
|
39
44
|
options: {
|
|
40
|
-
query?: Parameters<typeof useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
45
|
+
query?: Parameters<typeof useSWR<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormQueryKey | null, any>>[2]
|
|
41
46
|
client?: Partial<RequestConfig>
|
|
42
47
|
shouldFetch?: boolean
|
|
43
48
|
} = {},
|
|
@@ -46,7 +51,7 @@ export function useUpdatePetWithForm(
|
|
|
46
51
|
|
|
47
52
|
const queryKey = updatePetWithFormQueryKey(petId, params)
|
|
48
53
|
|
|
49
|
-
return useSWR<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
54
|
+
return useSWR<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormQueryKey | null>(shouldFetch ? queryKey : null, {
|
|
50
55
|
...updatePetWithFormQueryOptions({ petId, params }, config),
|
|
51
56
|
...queryOptions,
|
|
52
57
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWRMutation from 'swr/mutation'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
|
|
6
6
|
|
|
@@ -11,7 +11,12 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
|
|
|
11
11
|
* {@link /pet/:petId}
|
|
12
12
|
*/
|
|
13
13
|
async function updatePetWithForm(petId: UpdatePetWithFormPathParams['petId'], params?: UpdatePetWithFormQueryParams, config: Partial<RequestConfig> = {}) {
|
|
14
|
-
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
14
|
+
const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
url: `/pet/${petId}`,
|
|
17
|
+
params,
|
|
18
|
+
...config,
|
|
19
|
+
})
|
|
15
20
|
return res.data
|
|
16
21
|
}
|
|
17
22
|
|
|
@@ -23,7 +28,7 @@ export function useUpdatePetWithForm(
|
|
|
23
28
|
petId: UpdatePetWithFormPathParams['petId'],
|
|
24
29
|
params?: UpdatePetWithFormQueryParams,
|
|
25
30
|
options: {
|
|
26
|
-
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
31
|
+
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey>>[2]
|
|
27
32
|
client?: Partial<RequestConfig>
|
|
28
33
|
shouldFetch?: boolean
|
|
29
34
|
} = {},
|
|
@@ -31,7 +36,7 @@ export function useUpdatePetWithForm(
|
|
|
31
36
|
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
|
|
32
37
|
const mutationKey = updatePetWithFormMutationKey()
|
|
33
38
|
|
|
34
|
-
return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
39
|
+
return useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey | null>(
|
|
35
40
|
shouldFetch ? mutationKey : null,
|
|
36
41
|
async (_url) => {
|
|
37
42
|
return updatePetWithForm(petId, params, config)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import client from '@kubb/plugin-client/clients/axios'
|
|
2
2
|
import useSWRMutation from 'swr/mutation'
|
|
3
|
-
import type { RequestConfig } from '@kubb/plugin-client/clients/axios'
|
|
3
|
+
import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
4
4
|
|
|
5
5
|
export const updatePetWithFormMutationKey = () => [{ url: '/pet/{petId}' }] as const
|
|
6
6
|
|
|
@@ -15,7 +15,12 @@ async function updatePetWithForm(
|
|
|
15
15
|
params?: UpdatePetWithFormQueryParams,
|
|
16
16
|
config: Partial<RequestConfig> = {},
|
|
17
17
|
) {
|
|
18
|
-
const res = await client<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
18
|
+
const res = await client<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
19
|
+
method: 'POST',
|
|
20
|
+
url: `/pet/${petId}`,
|
|
21
|
+
params,
|
|
22
|
+
...config,
|
|
23
|
+
})
|
|
19
24
|
return res.data
|
|
20
25
|
}
|
|
21
26
|
|
|
@@ -27,7 +32,7 @@ export function useUpdatePetWithForm(
|
|
|
27
32
|
{ petId }: { petId: UpdatePetWithFormPathParams['petId'] },
|
|
28
33
|
params?: UpdatePetWithFormQueryParams,
|
|
29
34
|
options: {
|
|
30
|
-
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
35
|
+
mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey>>[2]
|
|
31
36
|
client?: Partial<RequestConfig>
|
|
32
37
|
shouldFetch?: boolean
|
|
33
38
|
} = {},
|
|
@@ -35,7 +40,7 @@ export function useUpdatePetWithForm(
|
|
|
35
40
|
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
|
|
36
41
|
const mutationKey = updatePetWithFormMutationKey()
|
|
37
42
|
|
|
38
|
-
return useSWRMutation<UpdatePetWithFormMutationResponse, UpdatePetWithForm405
|
|
43
|
+
return useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey | null>(
|
|
39
44
|
shouldFetch ? mutationKey : null,
|
|
40
45
|
async (_url) => {
|
|
41
46
|
return updatePetWithForm({ petId }, params, config)
|
|
@@ -63,7 +63,7 @@ export const mutationGenerator = createReactGenerator<PluginSwr>({
|
|
|
63
63
|
<File.Import name="useSWRMutation" path={importPath} />
|
|
64
64
|
<File.Import name={['SWRMutationResponse']} path={importPath} isTypeOnly />
|
|
65
65
|
<File.Import name={'client'} path={options.client.importPath} />
|
|
66
|
-
<File.Import name={['RequestConfig', 'ResponseConfig']} path={options.client.importPath} isTypeOnly />
|
|
66
|
+
<File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
67
67
|
<File.Import
|
|
68
68
|
name={[
|
|
69
69
|
type.schemas.request?.name,
|
|
@@ -63,7 +63,7 @@ export const queryGenerator = createReactGenerator<PluginSwr>({
|
|
|
63
63
|
{options.parser === 'zod' && <File.Import name={[zod.schemas.response.name]} root={query.file.path} path={zod.file.path} />}
|
|
64
64
|
|
|
65
65
|
<File.Import name={'client'} path={options.client.importPath} />
|
|
66
|
-
<File.Import name={['RequestConfig']} path={options.client.importPath} isTypeOnly />
|
|
66
|
+
<File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
|
|
67
67
|
{options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}
|
|
68
68
|
|
|
69
69
|
<File.Import
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/MutationKey.tsx","../src/components/Mutation.tsx","../src/components/QueryKey.tsx","../src/components/QueryOptions.tsx","../src/components/Query.tsx"],"names":["getParams","FunctionParams","jsx","File","Function","getPathParams","isOptional","getTransformer","URLPath","jsxs","Fragment","Type","Client","getComments"],"mappings":";;;;;;;;AAuBA,SAAS,SAAA,CAAU,EAAoB,EAAA;AACrC,EAAO,OAAA,cAAA,CAAe,OAAQ,CAAA,EAAE,CAAA;AAClC;AAEA,IAAM,cAA8B,GAAA,CAAC,EAAE,SAAA,EAAW,QAAa,KAAA;AAC7D,EAAA,MAAM,OAAO,IAAI,OAAA,CAAQ,UAAU,IAAM,EAAA,EAAE,QAAQ,CAAA;AAEnD,EAAO,OAAA,CAAC,IAAK,CAAA,SAAA,CAAU,EAAE,GAAA,EAAK,IAAK,CAAA,IAAA,EAAM,CAAC,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAC5D,CAAA;AAEO,SAAS,WAAA,CAAY,EAAE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;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAM,MAAA,kBAAA,GAAqB,aAAa,SAAU,CAAA;AAAA,IAChD,YAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EACE,uBAAAE,GAACC,CAAAA,IAAAA,CAAK,MAAL,EAAA,EAAY,MAAY,YAAY,EAAA,IAAA,EAAC,WAAW,EAAA,IAAA,EAC/C,QAAAD,kBAAAA,GAAAA;AAAA,IAACE,QAAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,MAAM,EAAA,IAAA;AAAA,MACN,MAAA,EAAQ,OAAO,aAAc,EAAA;AAAA,MAC7B,KAAO,EAAA;AAAA,QACL,QAAA,EAAUS,YAAY,SAAS;AAAA,OACjC;AAAA,MAEC,QAAA,EAAA;AAAA;;AAAA,wBAAA,EAGiB,YAAY,CAAA,CAAA,EAAI,cAAe,CAAA,MAAA,EAAQ,CAAA;;AAAA,qBAE1C,EAAA,QAAA,CAAS,IAAK,CAAA,IAAI,CAAC,CAAA;AAAA;AAAA;AAAA,aAAA,EAG3B,gBAAgB,CAAA,CAAA,EAAI,kBAAmB,CAAA,MAAA,EAAQ,CAAA;AAAA;AAAA;AAAA;AAAA,OAAA;AAAA;AAAA,GAM1D,EAAA,CAAA;AAEJ","file":"chunk-7ELDJ4IB.js","sourcesContent":["import { URLPath } from '@kubb/core/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react'\n\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n pathParamsType: PluginSwr['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 [JSON.stringify({ url: path.path })].filter(Boolean)\n}\n\nexport function MutationKey({ name, typeSchemas, paramsCasing, pathParamsType, operation, typeName, transformer = getTransformer }: Props): ReactNode {\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 { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\nimport { MutationKey } from './MutationKey.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n clientName: string\n mutationKeyName: string\n mutationKeyTypeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n typeSchemas: OperationSchemas\n mutationKeyTypeName: string\n}\n// TODO add same logic as being done for react-query mutations\nfunction getParams({ pathParamsType, paramsCasing, dataReturnType, typeSchemas, mutationKeyTypeName }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n\n return FunctionParams.factory({\n pathParams: {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\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 mutation?: Parameters<typeof useSWRMutation<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', mutationKeyTypeName, typeSchemas.request?.name].join(', ')}>>[2],\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},\n shouldFetch?: boolean,\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Mutation({\n name,\n clientName,\n mutationKeyName,\n mutationKeyTypeName,\n paramsType,\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n operation,\n}: Props): ReactNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const generics = [\n TData,\n typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error',\n `${mutationKeyTypeName} | null`,\n typeSchemas.request?.name, //arg: data\n ].filter(Boolean)\n\n const mutationKeyParams = MutationKey.getParams({\n pathParamsType,\n typeSchemas,\n })\n\n const params = getParams({\n paramsCasing,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n mutationKeyTypeName,\n })\n\n const clientParams = Client.getParams({\n paramsCasing,\n paramsType,\n typeSchemas,\n pathParamsType,\n })\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 >\n {`\n const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}\n const mutationKey = ${mutationKeyName}(${mutationKeyParams.toCall()})\n\n return useSWRMutation<${generics}>(\n shouldFetch ? mutationKey : null,\n async (_url${typeSchemas.request?.name ? ', { arg: data }' : ''}) => {\n return ${clientName}(${clientParams.toCall()})\n },\n mutationOptions\n )\n `}\n </Function>\n </File.Source>\n )\n}\n","import { URLPath } from '@kubb/core/utils'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams, Type } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr, Transformer } from '../types'\n\ntype Props = {\n name: string\n typeName: string\n typeSchemas: OperationSchemas\n operation: Operation\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n transformer: Transformer | undefined\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['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): ReactNode {\n const params = getParams({ pathParamsType, paramsCasing, typeSchemas })\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 { getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react'\n\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } from '../types.ts'\n\nimport { isOptional } from '@kubb/oas'\nimport { Client } from '@kubb/plugin-client/components'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\n\ntype Props = {\n name: string\n clientName: string\n typeSchemas: OperationSchemas\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n}\n\ntype GetParamsProps = {\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n pathParamsType: PluginSwr['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 ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',\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 ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>',\n default: '{}',\n },\n })\n}\n\nexport function QueryOptions({ name, clientName, typeSchemas, paramsCasing, paramsType, pathParamsType }: Props): ReactNode {\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n const clientParams = Client.getParams({\n paramsCasing,\n paramsType,\n typeSchemas,\n pathParamsType,\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function name={name} export params={params.toConstructor()}>\n {`\n return {\n fetcher: async () => {\n return ${clientName}(${clientParams.toCall()})\n },\n }\n `}\n </Function>\n </File.Source>\n )\n}\n\nQueryOptions.getParams = getParams\n","import { URLPath } from '@kubb/core/utils'\nimport { File, Function, FunctionParams } from '@kubb/react'\n\nimport { type Operation, isOptional } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport type { ReactNode } from 'react'\nimport type { PluginSwr } 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 paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n operation: Operation\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginSwr['resolvedOptions']['paramsCasing']\n paramsType: PluginSwr['resolvedOptions']['paramsType']\n pathParamsType: PluginSwr['resolvedOptions']['pathParamsType']\n dataReturnType: PluginSwr['resolvedOptions']['client']['dataReturnType']\n queryKeyTypeName: string\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, dataReturnType, typeSchemas, queryKeyTypeName }: GetParamsProps) {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\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?: Parameters<typeof useSWR<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`].join(', ')}, any>>[2],\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},\n shouldFetch?: boolean,\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?: Parameters<typeof useSWR<${[TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`].join(', ')}, any>>[2],\n client?: ${typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>>` : 'Partial<RequestConfig>'},\n shouldFetch?: boolean,\n}\n`,\n default: '{}',\n },\n })\n}\n\nexport function Query({\n name,\n typeSchemas,\n queryKeyName,\n queryKeyTypeName,\n queryOptionsName,\n operation,\n dataReturnType,\n paramsType,\n paramsCasing,\n pathParamsType,\n}: Props): ReactNode {\n const TData = dataReturnType === 'data' ? typeSchemas.response.name : `ResponseConfig<${typeSchemas.response.name}>`\n const generics = [TData, typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error', `${queryKeyTypeName} | null`]\n\n const queryKeyParams = QueryKey.getParams({\n pathParamsType,\n typeSchemas,\n paramsCasing,\n })\n const params = getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n dataReturnType,\n typeSchemas,\n queryKeyTypeName,\n })\n\n const queryOptionsParams = QueryOptions.getParams({\n paramsCasing,\n paramsType,\n pathParamsType,\n typeSchemas,\n })\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 >\n {`\n const { query: queryOptions, client: config = {}, shouldFetch = true } = options ?? {}\n\n const queryKey = ${queryKeyName}(${queryKeyParams.toCall()})\n\n return useSWR<${generics.join(', ')}>(\n shouldFetch ? queryKey : null,\n {\n ...${queryOptionsName}(${queryOptionsParams.toCall()}),\n ...queryOptions\n }\n )\n `}\n </Function>\n </File.Source>\n )\n}\n"]}
|