@kubb/plugin-swr 3.13.1 → 3.13.2

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 (30) hide show
  1. package/dist/{chunk-OEKZAXPK.cjs → chunk-DJRAEUFP.cjs} +7 -7
  2. package/dist/{chunk-OEKZAXPK.cjs.map → chunk-DJRAEUFP.cjs.map} +1 -1
  3. package/dist/{chunk-C2XG3E32.js → chunk-KWMBMDHD.js} +7 -7
  4. package/dist/{chunk-C2XG3E32.js.map → chunk-KWMBMDHD.js.map} +1 -1
  5. package/dist/{chunk-EIJ5OBEY.js → chunk-N7PW75XY.js} +5 -5
  6. package/dist/{chunk-EIJ5OBEY.js.map → chunk-N7PW75XY.js.map} +1 -1
  7. package/dist/{chunk-4EI3Q6LV.cjs → chunk-Z73UMYJP.cjs} +10 -10
  8. package/dist/{chunk-4EI3Q6LV.cjs.map → chunk-Z73UMYJP.cjs.map} +1 -1
  9. package/dist/components.cjs +6 -6
  10. package/dist/components.js +1 -1
  11. package/dist/generators.cjs +4 -4
  12. package/dist/generators.js +2 -2
  13. package/dist/index.cjs +5 -5
  14. package/dist/index.js +2 -2
  15. package/package.json +10 -10
  16. package/src/components/Mutation.tsx +1 -1
  17. package/src/components/Query.tsx +2 -2
  18. package/src/components/QueryOptions.tsx +4 -4
  19. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +5 -5
  20. package/src/generators/__snapshots__/clientGetImportPath.ts +5 -5
  21. package/src/generators/__snapshots__/clientPostImportPath.ts +4 -4
  22. package/src/generators/__snapshots__/findByTags.ts +5 -5
  23. package/src/generators/__snapshots__/findByTagsObject.ts +5 -5
  24. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +5 -5
  25. package/src/generators/__snapshots__/findByTagsWithZod.ts +5 -5
  26. package/src/generators/__snapshots__/postAsQuery.ts +5 -5
  27. package/src/generators/__snapshots__/updatePetById.ts +4 -4
  28. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +4 -4
  29. package/src/generators/mutationGenerator.tsx +1 -1
  30. package/src/generators/queryGenerator.tsx +1 -1
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import client from '@kubb/plugin-client/clients/axios'
5
+ import fetch from '@kubb/plugin-client/clients/axios'
6
6
  import useSWR from 'swr'
7
7
  import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
8
8
 
@@ -15,8 +15,8 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
15
15
  * @summary Finds Pets by tags
16
16
  * {@link /pet/findByTags}
17
17
  */
18
- export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> & { client?: typeof client } = {}) {
19
- const { client: request = client, ...requestConfig } = config
18
+ export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryParams }, config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {
19
+ const { client: request = fetch, ...requestConfig } = config
20
20
 
21
21
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
22
22
  method: 'GET',
@@ -29,7 +29,7 @@ export async function findPetsByTags({ params }: { params?: FindPetsByTagsQueryP
29
29
 
30
30
  export function findPetsByTagsQueryOptions(
31
31
  { params }: { params?: FindPetsByTagsQueryParams },
32
- config: Partial<RequestConfig> & { client?: typeof client } = {},
32
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
33
33
  ) {
34
34
  return {
35
35
  fetcher: async () => {
@@ -47,7 +47,7 @@ export function useFindPetsByTags(
47
47
  { params }: { params?: FindPetsByTagsQueryParams },
48
48
  options: {
49
49
  query?: Parameters<typeof useSWR<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>>>[2]
50
- client?: Partial<RequestConfig> & { client?: typeof client }
50
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
51
51
  shouldFetch?: boolean
52
52
  } = {},
53
53
  ) {
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import client from '@kubb/plugin-client/clients/axios'
5
+ import fetch from '@kubb/plugin-client/clients/axios'
6
6
  import useSWR from 'custom-swr'
7
7
  import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
8
8
 
@@ -17,9 +17,9 @@ export type UpdatePetWithFormQueryKey = ReturnType<typeof updatePetWithFormQuery
17
17
  */
18
18
  export async function updatePetWithForm(
19
19
  { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
20
- config: Partial<RequestConfig> & { client?: typeof client } = {},
20
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
21
21
  ) {
22
- const { client: request = client, ...requestConfig } = config
22
+ const { client: request = fetch, ...requestConfig } = config
23
23
 
24
24
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
25
25
  method: 'POST',
@@ -32,7 +32,7 @@ export async function updatePetWithForm(
32
32
 
33
33
  export function updatePetWithFormQueryOptions(
34
34
  { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
35
- config: Partial<RequestConfig> & { client?: typeof client } = {},
35
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
36
36
  ) {
37
37
  return {
38
38
  fetcher: async () => {
@@ -49,7 +49,7 @@ export function useUpdatePetWithForm(
49
49
  { petId, params }: { petId: UpdatePetWithFormPathParams['petId']; params?: UpdatePetWithFormQueryParams },
50
50
  options: {
51
51
  query?: Parameters<typeof useSWR<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>>>[2]
52
- client?: Partial<RequestConfig> & { client?: typeof client }
52
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
53
53
  shouldFetch?: boolean
54
54
  } = {},
55
55
  ) {
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import client from '@kubb/plugin-client/clients/axios'
5
+ import fetch from '@kubb/plugin-client/clients/axios'
6
6
  import useSWRMutation from 'swr/mutation'
7
7
  import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
8
8
 
@@ -17,9 +17,9 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
17
17
  export async function updatePetWithForm(
18
18
  petId: UpdatePetWithFormPathParams['petId'],
19
19
  params?: UpdatePetWithFormQueryParams,
20
- config: Partial<RequestConfig> & { client?: typeof client } = {},
20
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
21
21
  ) {
22
- const { client: request = client, ...requestConfig } = config
22
+ const { client: request = fetch, ...requestConfig } = config
23
23
 
24
24
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
25
25
  method: 'POST',
@@ -39,7 +39,7 @@ export function useUpdatePetWithForm(
39
39
  params?: UpdatePetWithFormQueryParams,
40
40
  options: {
41
41
  mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey>>[2]
42
- client?: Partial<RequestConfig> & { client?: typeof client }
42
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
43
43
  shouldFetch?: boolean
44
44
  } = {},
45
45
  ) {
@@ -2,7 +2,7 @@
2
2
  * Generated by Kubb (https://kubb.dev/).
3
3
  * Do not edit manually.
4
4
  */
5
- import client from '@kubb/plugin-client/clients/axios'
5
+ import fetch from '@kubb/plugin-client/clients/axios'
6
6
  import useSWRMutation from 'swr/mutation'
7
7
  import type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
8
8
 
@@ -17,9 +17,9 @@ export type UpdatePetWithFormMutationKey = ReturnType<typeof updatePetWithFormMu
17
17
  export async function updatePetWithForm(
18
18
  { petId }: { petId: UpdatePetWithFormPathParams['petId'] },
19
19
  params?: UpdatePetWithFormQueryParams,
20
- config: Partial<RequestConfig> & { client?: typeof client } = {},
20
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
21
21
  ) {
22
- const { client: request = client, ...requestConfig } = config
22
+ const { client: request = fetch, ...requestConfig } = config
23
23
 
24
24
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, unknown>({
25
25
  method: 'POST',
@@ -39,7 +39,7 @@ export function useUpdatePetWithForm(
39
39
  params?: UpdatePetWithFormQueryParams,
40
40
  options: {
41
41
  mutation?: Parameters<typeof useSWRMutation<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationKey>>[2]
42
- client?: Partial<RequestConfig> & { client?: typeof client }
42
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
43
43
  shouldFetch?: boolean
44
44
  } = {},
45
45
  ) {
@@ -82,7 +82,7 @@ export const mutationGenerator = createReactGenerator<PluginSwr>({
82
82
  )}
83
83
  <File.Import name="useSWRMutation" path={importPath} />
84
84
  <File.Import name={['SWRMutationResponse']} path={importPath} isTypeOnly />
85
- {<File.Import name={'client'} path={options.client.importPath} />}
85
+ {<File.Import name={'fetch'} path={options.client.importPath} />}
86
86
  {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}
87
87
  <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
88
88
  <File.Import
@@ -82,7 +82,7 @@ export const queryGenerator = createReactGenerator<PluginSwr>({
82
82
  {options.parser === 'zod' && (
83
83
  <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={query.file.path} path={zod.file.path} />
84
84
  )}
85
- <File.Import name={'client'} path={options.client.importPath} />
85
+ <File.Import name={'fetch'} path={options.client.importPath} />
86
86
  {!!hasClientPlugin && <File.Import name={[client.name]} root={query.file.path} path={client.file.path} />}
87
87
  <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
88
88
  {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}