@kubb/plugin-svelte-query 4.29.1 → 4.31.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/components.d.ts +3 -4
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +3 -4
- package/dist/generators.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/{queryGenerator-tYjKyUsB.cjs → queryGenerator-B6eKMcKo.cjs} +5 -5
- package/dist/queryGenerator-B6eKMcKo.cjs.map +1 -0
- package/dist/{queryGenerator-C775F9UI.js → queryGenerator-Cz7Up0dL.js} +5 -5
- package/dist/queryGenerator-Cz7Up0dL.js.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-C775F9UI.js.map +0 -1
- package/dist/queryGenerator-tYjKyUsB.cjs.map +0 -1
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -93
- package/src/generators/__snapshots__/clientGetImportPath.ts +0 -88
- package/src/generators/__snapshots__/clientPostImportPath.ts +0 -72
- package/src/generators/__snapshots__/findByTags.ts +0 -88
- package/src/generators/__snapshots__/findByTagsObject.ts +0 -85
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -88
- package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -89
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -88
- package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -88
- package/src/generators/__snapshots__/postAsQuery.ts +0 -96
- package/src/generators/__snapshots__/updatePetById.ts +0 -72
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -72
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import fetch from '@kubb/plugin-client/clients/axios'
|
|
6
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
7
|
-
import type { QueryKey, QueryClient, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query'
|
|
8
|
-
import { createQuery, queryOptions } from 'custom-query'
|
|
9
|
-
|
|
10
|
-
export const updatePetWithFormQueryKey = (
|
|
11
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
12
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
13
|
-
params?: UpdatePetWithFormQueryParams,
|
|
14
|
-
) => [{ url: '/pet/:petId', params: { petId: petId } }, ...(params ? [params] : []), ...(data ? [data] : [])] as const
|
|
15
|
-
|
|
16
|
-
export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQueryKey>
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @summary Updates a pet in the store with form data
|
|
20
|
-
* {@link /pet/:petId}
|
|
21
|
-
*/
|
|
22
|
-
export async function updatePetWithForm(
|
|
23
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
24
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
25
|
-
params?: UpdatePetWithFormQueryParams,
|
|
26
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
27
|
-
) {
|
|
28
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
29
|
-
|
|
30
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
31
|
-
|
|
32
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
33
|
-
method: 'POST',
|
|
34
|
-
url: `/pet/${petId}`,
|
|
35
|
-
params,
|
|
36
|
-
data: requestData,
|
|
37
|
-
...requestConfig,
|
|
38
|
-
})
|
|
39
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function updatePetWithFormQueryOptions(
|
|
43
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
44
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
45
|
-
params?: UpdatePetWithFormQueryParams,
|
|
46
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
47
|
-
) {
|
|
48
|
-
const queryKey = updatePetWithFormQueryKey(petId, data, params)
|
|
49
|
-
return queryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationResponse, typeof queryKey>({
|
|
50
|
-
enabled: !!petId,
|
|
51
|
-
queryKey,
|
|
52
|
-
queryFn: async ({ signal }) => {
|
|
53
|
-
if (!config.signal) {
|
|
54
|
-
config.signal = signal
|
|
55
|
-
}
|
|
56
|
-
return updatePetWithForm(petId, data, params, config)
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @summary Updates a pet in the store with form data
|
|
63
|
-
* {@link /pet/:petId}
|
|
64
|
-
*/
|
|
65
|
-
export function createUpdatePetWithForm<
|
|
66
|
-
TData = UpdatePetWithFormMutationResponse,
|
|
67
|
-
TQueryData = UpdatePetWithFormMutationResponse,
|
|
68
|
-
TQueryKey extends QueryKey = UpdatePetWithFormQueryKey,
|
|
69
|
-
>(
|
|
70
|
-
petId: UpdatePetWithFormPathParams['petId'],
|
|
71
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
72
|
-
params?: UpdatePetWithFormQueryParams,
|
|
73
|
-
options: {
|
|
74
|
-
query?: Partial<CreateBaseQueryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>> & {
|
|
75
|
-
client?: QueryClient
|
|
76
|
-
}
|
|
77
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
78
|
-
} = {},
|
|
79
|
-
) {
|
|
80
|
-
const { query: queryConfig = {}, client: config = {} } = options ?? {}
|
|
81
|
-
const { client: queryClient, ...queryOptions } = queryConfig
|
|
82
|
-
const queryKey = queryOptions?.queryKey ?? updatePetWithFormQueryKey(petId, data, params)
|
|
83
|
-
|
|
84
|
-
const query = createQuery(
|
|
85
|
-
{
|
|
86
|
-
...updatePetWithFormQueryOptions(petId, data, params, config),
|
|
87
|
-
queryKey,
|
|
88
|
-
...queryOptions,
|
|
89
|
-
} as unknown as CreateBaseQueryOptions,
|
|
90
|
-
queryClient,
|
|
91
|
-
) as CreateQueryResult<TData, ResponseErrorConfig<UpdatePetWithForm405>> & { queryKey: TQueryKey }
|
|
92
|
-
|
|
93
|
-
query.queryKey = queryKey as TQueryKey
|
|
94
|
-
|
|
95
|
-
return query
|
|
96
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import fetch from '@kubb/plugin-client/clients/axios'
|
|
6
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
7
|
-
import type { CreateMutationOptions, QueryClient } from '@tanstack/svelte-query'
|
|
8
|
-
import { createMutation } from '@tanstack/svelte-query'
|
|
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
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
21
|
-
params?: UpdatePetWithFormQueryParams,
|
|
22
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
23
|
-
) {
|
|
24
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
25
|
-
|
|
26
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
27
|
-
|
|
28
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
29
|
-
method: 'POST',
|
|
30
|
-
url: `/pet/${petId}`,
|
|
31
|
-
params,
|
|
32
|
-
data: requestData,
|
|
33
|
-
...requestConfig,
|
|
34
|
-
})
|
|
35
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @summary Updates a pet in the store with form data
|
|
40
|
-
* {@link /pet/:petId}
|
|
41
|
-
*/
|
|
42
|
-
export function createUpdatePetWithForm<TContext>(
|
|
43
|
-
options: {
|
|
44
|
-
mutation?: CreateMutationOptions<
|
|
45
|
-
UpdatePetWithFormMutationResponse,
|
|
46
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
47
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
48
|
-
TContext
|
|
49
|
-
> & { client?: QueryClient }
|
|
50
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
51
|
-
} = {},
|
|
52
|
-
) {
|
|
53
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
54
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
55
|
-
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
56
|
-
|
|
57
|
-
return createMutation<
|
|
58
|
-
UpdatePetWithFormMutationResponse,
|
|
59
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
60
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
61
|
-
TContext
|
|
62
|
-
>(
|
|
63
|
-
{
|
|
64
|
-
mutationFn: async ({ petId, data, params }) => {
|
|
65
|
-
return updatePetWithForm(petId, data, params, config)
|
|
66
|
-
},
|
|
67
|
-
mutationKey,
|
|
68
|
-
...mutationOptions,
|
|
69
|
-
},
|
|
70
|
-
queryClient,
|
|
71
|
-
)
|
|
72
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by Kubb (https://kubb.dev/).
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
*/
|
|
5
|
-
import fetch from '@kubb/plugin-client/clients/axios'
|
|
6
|
-
import type { Client, RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
|
|
7
|
-
import type { CreateMutationOptions, QueryClient } from '@tanstack/svelte-query'
|
|
8
|
-
import { createMutation } from '@tanstack/svelte-query'
|
|
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
|
-
data?: UpdatePetWithFormMutationRequest,
|
|
21
|
-
params?: UpdatePetWithFormQueryParams,
|
|
22
|
-
config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
|
|
23
|
-
) {
|
|
24
|
-
const { client: request = fetch, ...requestConfig } = config
|
|
25
|
-
|
|
26
|
-
const requestData = updatePetWithFormMutationRequest.parse(data)
|
|
27
|
-
|
|
28
|
-
const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
|
|
29
|
-
method: 'POST',
|
|
30
|
-
url: `/pet/${petId}`,
|
|
31
|
-
params,
|
|
32
|
-
data: requestData,
|
|
33
|
-
...requestConfig,
|
|
34
|
-
})
|
|
35
|
-
return updatePetWithFormMutationResponse.parse(res.data)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @summary Updates a pet in the store with form data
|
|
40
|
-
* {@link /pet/:petId}
|
|
41
|
-
*/
|
|
42
|
-
export function createUpdatePetWithForm<TContext>(
|
|
43
|
-
options: {
|
|
44
|
-
mutation?: CreateMutationOptions<
|
|
45
|
-
UpdatePetWithFormMutationResponse,
|
|
46
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
47
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
48
|
-
TContext
|
|
49
|
-
> & { client?: QueryClient }
|
|
50
|
-
client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
|
|
51
|
-
} = {},
|
|
52
|
-
) {
|
|
53
|
-
const { mutation = {}, client: config = {} } = options ?? {}
|
|
54
|
-
const { client: queryClient, ...mutationOptions } = mutation
|
|
55
|
-
const mutationKey = mutationOptions?.mutationKey ?? updatePetWithFormMutationKey()
|
|
56
|
-
|
|
57
|
-
return createMutation<
|
|
58
|
-
UpdatePetWithFormMutationResponse,
|
|
59
|
-
ResponseErrorConfig<UpdatePetWithForm405>,
|
|
60
|
-
{ petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
|
|
61
|
-
TContext
|
|
62
|
-
>(
|
|
63
|
-
{
|
|
64
|
-
mutationFn: async ({ petId, data, params }) => {
|
|
65
|
-
return updatePetWithForm({ petId }, data, params, config)
|
|
66
|
-
},
|
|
67
|
-
mutationKey,
|
|
68
|
-
...mutationOptions,
|
|
69
|
-
},
|
|
70
|
-
queryClient,
|
|
71
|
-
)
|
|
72
|
-
}
|