@kubb/plugin-swr 4.29.1 → 4.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components.d.ts +4 -3
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +4 -3
- package/dist/generators.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/{queryGenerator-CEsWWhOe.js → queryGenerator-96wr4Uxr.js} +5 -5
- package/dist/queryGenerator-96wr4Uxr.js.map +1 -0
- package/dist/{queryGenerator-CfKDvnGS.cjs → queryGenerator-Dn8pnjT4.cjs} +5 -5
- package/dist/queryGenerator-Dn8pnjT4.cjs.map +1 -0
- package/package.json +11 -10
- package/src/generators/mutationGenerator.tsx +4 -2
- package/src/generators/queryGenerator.tsx +4 -2
- package/dist/queryGenerator-CEsWWhOe.js.map +0 -1
- package/dist/queryGenerator-CfKDvnGS.cjs.map +0 -1
- package/dist/types-wR9RZTnh.d.ts +0 -144
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -70
- package/src/generators/__snapshots__/clientGetImportPath.ts +0 -67
- package/src/generators/__snapshots__/clientPostImportPath.ts +0 -62
- package/src/generators/__snapshots__/findByTags.ts +0 -67
- package/src/generators/__snapshots__/findByTagsObject.ts +0 -67
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -67
- package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -68
- package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -67
- package/src/generators/__snapshots__/getAsMutation.ts +0 -34
- package/src/generators/__snapshots__/postAsQuery.ts +0 -72
- package/src/generators/__snapshots__/updatePetById.ts +0 -62
- package/src/generators/__snapshots__/updatePetByIdParamsToTrigger.ts +0 -67
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -62
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import useSWRMutation from 'swr/mutation'
|
|
6
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
|
-
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
8
|
-
import { fetch } from './test/.kubb/fetch'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:petId' }] as const
|
|
11
|
-
|
|
12
|
-
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @summary Updates a pet in the store with form data
|
|
16
|
-
* {@link /pet/:petId}
|
|
17
|
-
*/
|
|
18
|
-
export async function updatePetWithForm(
|
|
19
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
20
|
-
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
|
-
) {
|
|
23
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
24
|
-
|
|
25
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
26
|
-
method: 'POST',
|
|
27
|
-
url: `/pet/${petId}`,
|
|
28
|
-
params,
|
|
29
|
-
...requestConfig,
|
|
30
|
-
})
|
|
31
|
-
return res.data
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @summary Updates a pet in the store with form data
|
|
36
|
-
* {@link /pet/:petId}
|
|
37
|
-
*/
|
|
38
|
-
export function useUpdatePetWithForm(
|
|
39
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
40
|
-
params?: UpdatePetWithFormQueryParams,
|
|
41
|
-
options: {
|
|
42
|
-
mutation?: SWRMutationConfiguration<
|
|
43
|
-
UpdatePetWithFormMutationResponse,
|
|
44
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
45
|
-
UpdatePetWithFormMutationKey | null,
|
|
46
|
-
never
|
|
47
|
-
> & { throwOnError?: boolean }
|
|
48
|
-
client?: Partial<RequestConfig> & { client?: Client }
|
|
49
|
-
shouldFetch?: boolean
|
|
50
|
-
} = {},
|
|
51
|
-
) {
|
|
52
|
-
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
|
|
53
|
-
const mutationKey = updatePetWithFormMutationKey()
|
|
54
|
-
|
|
55
|
-
return useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey | null>(
|
|
56
|
-
shouldFetch ? mutationKey : null,
|
|
57
|
-
async (_url) => {
|
|
58
|
-
return updatePetWithForm(petId, params, config)
|
|
59
|
-
},
|
|
60
|
-
mutationOptions,
|
|
61
|
-
)
|
|
62
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import useSWRMutation from 'swr/mutation'
|
|
6
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
|
-
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
8
|
-
import { fetch } from './test/.kubb/fetch'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:petId' }] as const
|
|
11
|
-
|
|
12
|
-
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @summary Updates a pet in the store with form data
|
|
16
|
-
* {@link /pet/:petId}
|
|
17
|
-
*/
|
|
18
|
-
export async function updatePetWithForm(
|
|
19
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
20
|
-
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
|
-
) {
|
|
23
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
24
|
-
|
|
25
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
26
|
-
method: 'POST',
|
|
27
|
-
url: `/pet/${petId}`,
|
|
28
|
-
params,
|
|
29
|
-
...requestConfig,
|
|
30
|
-
})
|
|
31
|
-
return res.data
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export type UpdatePetWithFormMutationArg = { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams }
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @summary Updates a pet in the store with form data
|
|
38
|
-
* {@link /pet/:petId}
|
|
39
|
-
*/
|
|
40
|
-
export function useUpdatePetWithForm(
|
|
41
|
-
options: {
|
|
42
|
-
mutation?: SWRMutationConfiguration<
|
|
43
|
-
UpdatePetWithFormMutationResponse,
|
|
44
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
45
|
-
UpdatePetWithFormMutationKey | null,
|
|
46
|
-
UpdatePetWithFormMutationArg
|
|
47
|
-
> & { throwOnError?: boolean }
|
|
48
|
-
client?: Partial<RequestConfig> & { client?: Client }
|
|
49
|
-
shouldFetch?: boolean
|
|
50
|
-
} = {},
|
|
51
|
-
) {
|
|
52
|
-
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
|
|
53
|
-
const mutationKey = updatePetWithFormMutationKey()
|
|
54
|
-
|
|
55
|
-
return useSWRMutation<
|
|
56
|
-
UpdatePetWithFormMutationResponse,
|
|
57
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
58
|
-
UpdatePetWithFormMutationKey | null,
|
|
59
|
-
UpdatePetWithFormMutationArg
|
|
60
|
-
>(
|
|
61
|
-
shouldFetch ? mutationKey : null,
|
|
62
|
-
async (_url, { arg: { petId, params } }) => {
|
|
63
|
-
return updatePetWithForm(petId, params, config)
|
|
64
|
-
},
|
|
65
|
-
mutationOptions,
|
|
66
|
-
)
|
|
67
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import useSWRMutation from 'swr/mutation'
|
|
6
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
|
|
7
|
-
import type { SWRMutationConfiguration } from 'swr/mutation'
|
|
8
|
-
import { fetch } from './test/.kubb/fetch'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormMutationKey = () => [{ url: '/pet/:petId' }] as const
|
|
11
|
-
|
|
12
|
-
export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @summary Updates a pet in the store with form data
|
|
16
|
-
* {@link /pet/:petId}
|
|
17
|
-
*/
|
|
18
|
-
export async function updatePetWithForm(
|
|
19
|
-
{ petId }: { petId: UpdatePetWithFormPathParams['petId'] },
|
|
20
|
-
params?: UpdatePetWithFormQueryParams,
|
|
21
|
-
config: Partial<RequestConfig> & { client?: Client } = {},
|
|
22
|
-
) {
|
|
23
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
24
|
-
|
|
25
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
|
|
26
|
-
method: 'POST',
|
|
27
|
-
url: `/pet/${petId}`,
|
|
28
|
-
params,
|
|
29
|
-
...requestConfig,
|
|
30
|
-
})
|
|
31
|
-
return res.data
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @summary Updates a pet in the store with form data
|
|
36
|
-
* {@link /pet/:petId}
|
|
37
|
-
*/
|
|
38
|
-
export function useUpdatePetWithForm(
|
|
39
|
-
{ petId }: { petId: UpdatePetWithFormPathParams['petId'] },
|
|
40
|
-
params?: UpdatePetWithFormQueryParams,
|
|
41
|
-
options: {
|
|
42
|
-
mutation?: SWRMutationConfiguration<
|
|
43
|
-
UpdatePetWithFormMutationResponse,
|
|
44
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
45
|
-
UpdatePetWithFormMutationKey | null,
|
|
46
|
-
never
|
|
47
|
-
> & { throwOnError?: boolean }
|
|
48
|
-
client?: Partial<RequestConfig> & { client?: Client }
|
|
49
|
-
shouldFetch?: boolean
|
|
50
|
-
} = {},
|
|
51
|
-
) {
|
|
52
|
-
const { mutation: mutationOptions, client: config = {}, shouldFetch = true } = options ?? {}
|
|
53
|
-
const mutationKey = updatePetWithFormMutationKey()
|
|
54
|
-
|
|
55
|
-
return useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey | null>(
|
|
56
|
-
shouldFetch ? mutationKey : null,
|
|
57
|
-
async (_url) => {
|
|
58
|
-
return updatePetWithForm({ petId }, params, config)
|
|
59
|
-
},
|
|
60
|
-
mutationOptions,
|
|
61
|
-
)
|
|
62
|
-
}
|