@kubb/plugin-react-query 4.29.0 → 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.
Files changed (51) hide show
  1. package/dist/generators.cjs +1 -1
  2. package/dist/generators.js +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/{suspenseQueryGenerator-CHrwd9jE.cjs → suspenseQueryGenerator-CwhqyJW_.cjs} +11 -11
  6. package/dist/suspenseQueryGenerator-CwhqyJW_.cjs.map +1 -0
  7. package/dist/{suspenseQueryGenerator-BjEGcQcE.js → suspenseQueryGenerator-DJeXy1-j.js} +11 -11
  8. package/dist/suspenseQueryGenerator-DJeXy1-j.js.map +1 -0
  9. package/package.json +11 -10
  10. package/src/generators/infiniteQueryGenerator.tsx +4 -2
  11. package/src/generators/mutationGenerator.tsx +4 -2
  12. package/src/generators/queryGenerator.tsx +4 -2
  13. package/src/generators/suspenseInfiniteQueryGenerator.tsx +4 -2
  14. package/src/generators/suspenseQueryGenerator.tsx +4 -2
  15. package/dist/suspenseQueryGenerator-BjEGcQcE.js.map +0 -1
  16. package/dist/suspenseQueryGenerator-CHrwd9jE.cjs.map +0 -1
  17. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -93
  18. package/src/generators/__snapshots__/clientGetImportPath.ts +0 -88
  19. package/src/generators/__snapshots__/clientPostImportPath.ts +0 -99
  20. package/src/generators/__snapshots__/createUsersWithListInput.ts +0 -83
  21. package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +0 -87
  22. package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -81
  23. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -78
  24. package/src/generators/__snapshots__/findByTags.ts +0 -88
  25. package/src/generators/__snapshots__/findByTagsObject.ts +0 -85
  26. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -88
  27. package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -89
  28. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +0 -91
  29. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -88
  30. package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -88
  31. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +0 -99
  32. package/src/generators/__snapshots__/findInfiniteByTags.ts +0 -102
  33. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +0 -102
  34. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +0 -102
  35. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +0 -101
  36. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +0 -105
  37. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +0 -81
  38. package/src/generators/__snapshots__/findSuspenseByTags.ts +0 -82
  39. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +0 -85
  40. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +0 -99
  41. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +0 -103
  42. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +0 -103
  43. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +0 -106
  44. package/src/generators/__snapshots__/getAsMutation.ts +0 -31
  45. package/src/generators/__snapshots__/getPetIdCamelCase.ts +0 -76
  46. package/src/generators/__snapshots__/postAsQuery.ts +0 -96
  47. package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -94
  48. package/src/generators/__snapshots__/requiredOneOfRequestBodyWithClientPlugin.ts +0 -71
  49. package/src/generators/__snapshots__/updatePetById.ts +0 -99
  50. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -99
  51. package/src/generators/__snapshots__/updatePetByIdWithCustomOptions.ts +0 -107
@@ -1,107 +0,0 @@
1
- /**
2
- * Generated by Kubb (https://kubb.dev/).
3
- * Do not edit manually.
4
- */
5
- import type { Client, RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
- import type { UseMutationOptions, UseMutationResult, QueryClient } from '@tanstack/react-query'
7
- import { fetch } from './test/.kubb/fetch'
8
- import { mutationOptions, useMutation } from '@tanstack/react-query'
9
- import { useCustomHookOptions } from 'useCustomHookOptions.ts'
10
-
11
- export const updatePetWithFormMutationKey = () => [{ url: '/pet/:pet_id' }] as const
12
-
13
- export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMutationKey>
14
-
15
- /**
16
- * @summary Updates a pet in the store with form data
17
- * {@link /pet/:pet_id}
18
- */
19
- export async function updatePetWithForm(
20
- petId: UpdatePetWithFormPathParams['petId'],
21
- data?: UpdatePetWithFormMutationRequest,
22
- params?: UpdatePetWithFormQueryParams,
23
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
24
- ) {
25
- const { client: request = fetch, ...requestConfig } = config
26
-
27
- const requestData = updatePetWithFormMutationRequest.parse(data)
28
-
29
- const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
30
- method: 'POST',
31
- url: `/pet/${pet_id}`,
32
- params,
33
- data: requestData,
34
- ...requestConfig,
35
- })
36
- return updatePetWithFormMutationResponse.parse(res.data)
37
- }
38
-
39
- export function updatePetWithFormMutationOptions<TContext = unknown>(
40
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client } = {},
41
- ) {
42
- const mutationKey = updatePetWithFormMutationKey()
43
- return mutationOptions<
44
- UpdatePetWithFormMutationResponse,
45
- ResponseErrorConfig<UpdatePetWithForm405>,
46
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
47
- TContext
48
- >({
49
- mutationKey,
50
- mutationFn: async ({ petId, data, params }) => {
51
- return updatePetWithForm(petId, data, params, config)
52
- },
53
- })
54
- }
55
-
56
- /**
57
- * @summary Updates a pet in the store with form data
58
- * {@link /pet/:pet_id}
59
- */
60
- export function useUpdatePetWithForm<TContext>(
61
- options: {
62
- mutation?: UseMutationOptions<
63
- UpdatePetWithFormMutationResponse,
64
- ResponseErrorConfig<UpdatePetWithForm405>,
65
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
66
- TContext
67
- > & { client?: QueryClient }
68
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: Client }
69
- } = {},
70
- ) {
71
- const { mutation = {}, client: config = {} } = options ?? {}
72
- const { client: queryClient, ...mutationOptions } = mutation
73
- const mutationKey = mutationOptions.mutationKey ?? updatePetWithFormMutationKey()
74
-
75
- const baseOptions = updatePetWithFormMutationOptions(config) as UseMutationOptions<
76
- UpdatePetWithFormMutationResponse,
77
- ResponseErrorConfig<UpdatePetWithForm405>,
78
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
79
- TContext
80
- >
81
- const customOptions = useCustomHookOptions({ hookName: 'useUpdatePetWithForm', operationId: 'updatePetWithForm' }) as UseMutationOptions<
82
- UpdatePetWithFormMutationResponse,
83
- ResponseErrorConfig<UpdatePetWithForm405>,
84
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
85
- TContext
86
- >
87
-
88
- return useMutation<
89
- UpdatePetWithFormMutationResponse,
90
- ResponseErrorConfig<UpdatePetWithForm405>,
91
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
92
- TContext
93
- >(
94
- {
95
- ...baseOptions,
96
- ...customOptions,
97
- mutationKey,
98
- ...mutationOptions,
99
- },
100
- queryClient,
101
- ) as UseMutationResult<
102
- UpdatePetWithFormMutationResponse,
103
- ResponseErrorConfig<UpdatePetWithForm405>,
104
- { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
105
- TContext
106
- >
107
- }