@kubb/plugin-react-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.
Files changed (54) hide show
  1. package/dist/components.d.ts +2 -3
  2. package/dist/generators.cjs +1 -1
  3. package/dist/generators.d.ts +3 -4
  4. package/dist/generators.js +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.js +1 -1
  8. package/dist/{suspenseQueryGenerator-CHrwd9jE.cjs → suspenseQueryGenerator-CwhqyJW_.cjs} +11 -11
  9. package/dist/suspenseQueryGenerator-CwhqyJW_.cjs.map +1 -0
  10. package/dist/{suspenseQueryGenerator-BjEGcQcE.js → suspenseQueryGenerator-DJeXy1-j.js} +11 -11
  11. package/dist/suspenseQueryGenerator-DJeXy1-j.js.map +1 -0
  12. package/package.json +11 -10
  13. package/src/generators/infiniteQueryGenerator.tsx +4 -2
  14. package/src/generators/mutationGenerator.tsx +4 -2
  15. package/src/generators/queryGenerator.tsx +4 -2
  16. package/src/generators/suspenseInfiniteQueryGenerator.tsx +4 -2
  17. package/src/generators/suspenseQueryGenerator.tsx +4 -2
  18. package/dist/suspenseQueryGenerator-BjEGcQcE.js.map +0 -1
  19. package/dist/suspenseQueryGenerator-CHrwd9jE.cjs.map +0 -1
  20. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +0 -93
  21. package/src/generators/__snapshots__/clientGetImportPath.ts +0 -88
  22. package/src/generators/__snapshots__/clientPostImportPath.ts +0 -99
  23. package/src/generators/__snapshots__/createUsersWithListInput.ts +0 -83
  24. package/src/generators/__snapshots__/createUsersWithListInputAsQuery.ts +0 -87
  25. package/src/generators/__snapshots__/findByStatusAllOptional.ts +0 -81
  26. package/src/generators/__snapshots__/findByStatusAllOptionalInline.ts +0 -78
  27. package/src/generators/__snapshots__/findByTags.ts +0 -88
  28. package/src/generators/__snapshots__/findByTagsObject.ts +0 -85
  29. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +0 -88
  30. package/src/generators/__snapshots__/findByTagsTemplateString.ts +0 -89
  31. package/src/generators/__snapshots__/findByTagsWithCustomOptions.ts +0 -91
  32. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +0 -88
  33. package/src/generators/__snapshots__/findByTagsWithZod.ts +0 -88
  34. package/src/generators/__snapshots__/findInfiniteByStatusAllOptional.ts +0 -99
  35. package/src/generators/__snapshots__/findInfiniteByTags.ts +0 -102
  36. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +0 -102
  37. package/src/generators/__snapshots__/findInfiniteByTagsNextAndPreviousParam.ts +0 -102
  38. package/src/generators/__snapshots__/findInfiniteByTagsNextParam.ts +0 -101
  39. package/src/generators/__snapshots__/findInfiniteByTagsWithCustomOptions.ts +0 -105
  40. package/src/generators/__snapshots__/findSuspenseByStatusAllOptional.ts +0 -81
  41. package/src/generators/__snapshots__/findSuspenseByTags.ts +0 -82
  42. package/src/generators/__snapshots__/findSuspenseByTagsWithCustomOptions.ts +0 -85
  43. package/src/generators/__snapshots__/findSuspenseInfiniteByStatusAllOptional.ts +0 -99
  44. package/src/generators/__snapshots__/findSuspenseInfiniteByTags.ts +0 -103
  45. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsCursor.ts +0 -103
  46. package/src/generators/__snapshots__/findSuspenseInfiniteByTagsWithCustomOptions.ts +0 -106
  47. package/src/generators/__snapshots__/getAsMutation.ts +0 -31
  48. package/src/generators/__snapshots__/getPetIdCamelCase.ts +0 -76
  49. package/src/generators/__snapshots__/postAsQuery.ts +0 -96
  50. package/src/generators/__snapshots__/requiredOneOfRequestBody.ts +0 -94
  51. package/src/generators/__snapshots__/requiredOneOfRequestBodyWithClientPlugin.ts +0 -71
  52. package/src/generators/__snapshots__/updatePetById.ts +0 -99
  53. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +0 -99
  54. 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
- }