@kubb/plugin-svelte-query 3.13.1 → 3.14.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 (32) hide show
  1. package/LICENSE +1 -1
  2. package/dist/{chunk-JAAPF7JO.js → chunk-3342YRAM.js} +5 -5
  3. package/dist/{chunk-JAAPF7JO.js.map → chunk-3342YRAM.js.map} +1 -1
  4. package/dist/{chunk-6NYLQXQV.js → chunk-7WT5HSWG.js} +7 -7
  5. package/dist/{chunk-6NYLQXQV.js.map → chunk-7WT5HSWG.js.map} +1 -1
  6. package/dist/{chunk-VA4UHKD4.cjs → chunk-SHCPASNF.cjs} +10 -10
  7. package/dist/{chunk-VA4UHKD4.cjs.map → chunk-SHCPASNF.cjs.map} +1 -1
  8. package/dist/{chunk-OLAYM2GV.cjs → chunk-YI2JYFB4.cjs} +7 -7
  9. package/dist/{chunk-OLAYM2GV.cjs.map → chunk-YI2JYFB4.cjs.map} +1 -1
  10. package/dist/components.cjs +6 -6
  11. package/dist/components.js +1 -1
  12. package/dist/generators.cjs +4 -4
  13. package/dist/generators.js +2 -2
  14. package/dist/index.cjs +5 -5
  15. package/dist/index.js +2 -2
  16. package/package.json +23 -21
  17. package/src/components/Mutation.tsx +1 -1
  18. package/src/components/Query.tsx +2 -2
  19. package/src/components/QueryOptions.tsx +4 -4
  20. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +5 -5
  21. package/src/generators/__snapshots__/clientGetImportPath.ts +5 -5
  22. package/src/generators/__snapshots__/clientPostImportPath.ts +4 -4
  23. package/src/generators/__snapshots__/findByTags.ts +5 -5
  24. package/src/generators/__snapshots__/findByTagsObject.ts +5 -5
  25. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +5 -5
  26. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +5 -5
  27. package/src/generators/__snapshots__/findByTagsWithZod.ts +5 -5
  28. package/src/generators/__snapshots__/postAsQuery.ts +5 -5
  29. package/src/generators/__snapshots__/updatePetById.ts +4 -4
  30. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +4 -4
  31. package/src/generators/mutationGenerator.tsx +1 -1
  32. 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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { QueryKey, QueryClient, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
8
8
  import { queryOptions, createQuery } from '@tanstack/svelte-query'
@@ -18,9 +18,9 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
18
18
  */
19
19
  export async function findPetsByTags(
20
20
  { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
21
- config: Partial<RequestConfig> & { client?: typeof client } = {},
21
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
22
22
  ) {
23
- const { client: request = client, ...requestConfig } = config
23
+ const { client: request = fetch, ...requestConfig } = config
24
24
 
25
25
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
26
26
  method: 'GET',
@@ -34,7 +34,7 @@ export async function findPetsByTags(
34
34
 
35
35
  export function findPetsByTagsQueryOptions(
36
36
  { headers, params }: { headers: FindPetsByTagsHeaderParams; params?: FindPetsByTagsQueryParams },
37
- config: Partial<RequestConfig> & { client?: typeof client } = {},
37
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
38
38
  ) {
39
39
  const queryKey = findPetsByTagsQueryKey(params)
40
40
  return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
@@ -61,7 +61,7 @@ export function createFindPetsByTags<
61
61
  query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
62
62
  client?: QueryClient
63
63
  }
64
- client?: Partial<RequestConfig> & { client?: typeof client }
64
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
65
65
  } = {},
66
66
  ) {
67
67
  const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
@@ -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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { QueryKey, QueryClient, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
8
8
  import { queryOptions, createQuery } from '@tanstack/svelte-query'
@@ -19,9 +19,9 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
19
19
  export async function findPetsByTags(
20
20
  headers: FindPetsByTagsHeaderParams,
21
21
  params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: typeof client } = {},
22
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
23
23
  ) {
24
- const { client: request = client, ...requestConfig } = config
24
+ const { client: request = fetch, ...requestConfig } = config
25
25
 
26
26
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
27
  method: 'GET',
@@ -36,7 +36,7 @@ export async function findPetsByTags(
36
36
  export function findPetsByTagsQueryOptions(
37
37
  headers: FindPetsByTagsHeaderParams,
38
38
  params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: typeof client } = {},
39
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
40
40
  ) {
41
41
  const queryKey = findPetsByTagsQueryKey(params)
42
42
  return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
@@ -64,7 +64,7 @@ export function createFindPetsByTags<
64
64
  query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
65
65
  client?: QueryClient
66
66
  }
67
- client?: Partial<RequestConfig> & { client?: typeof client }
67
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
68
68
  } = {},
69
69
  ) {
70
70
  const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
@@ -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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { QueryKey, QueryClient, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/react-query'
8
8
  import { queryOptions, createQuery } from '@tanstack/react-query'
@@ -19,9 +19,9 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
19
19
  export async function findPetsByTags(
20
20
  headers: FindPetsByTagsHeaderParams,
21
21
  params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: typeof client } = {},
22
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
23
23
  ) {
24
- const { client: request = client, ...requestConfig } = config
24
+ const { client: request = fetch, ...requestConfig } = config
25
25
 
26
26
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
27
  method: 'GET',
@@ -36,7 +36,7 @@ export async function findPetsByTags(
36
36
  export function findPetsByTagsQueryOptions(
37
37
  headers: FindPetsByTagsHeaderParams,
38
38
  params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: typeof client } = {},
39
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
40
40
  ) {
41
41
  const queryKey = findPetsByTagsQueryKey(params)
42
42
  return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
@@ -64,7 +64,7 @@ export function createFindPetsByTags<
64
64
  query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
65
65
  client?: QueryClient
66
66
  }
67
- client?: Partial<RequestConfig> & { client?: typeof client }
67
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
68
68
  } = {},
69
69
  ) {
70
70
  const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
@@ -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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { QueryKey, QueryClient, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
8
8
  import { queryOptions, createQuery } from '@tanstack/svelte-query'
@@ -19,9 +19,9 @@ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
19
19
  export async function findPetsByTags(
20
20
  headers: FindPetsByTagsHeaderParams,
21
21
  params?: FindPetsByTagsQueryParams,
22
- config: Partial<RequestConfig> & { client?: typeof client } = {},
22
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
23
23
  ) {
24
- const { client: request = client, ...requestConfig } = config
24
+ const { client: request = fetch, ...requestConfig } = config
25
25
 
26
26
  const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
27
27
  method: 'GET',
@@ -36,7 +36,7 @@ export async function findPetsByTags(
36
36
  export function findPetsByTagsQueryOptions(
37
37
  headers: FindPetsByTagsHeaderParams,
38
38
  params?: FindPetsByTagsQueryParams,
39
- config: Partial<RequestConfig> & { client?: typeof client } = {},
39
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
40
40
  ) {
41
41
  const queryKey = findPetsByTagsQueryKey(params)
42
42
  return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
@@ -64,7 +64,7 @@ export function createFindPetsByTags<
64
64
  query?: Partial<CreateBaseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
65
65
  client?: QueryClient
66
66
  }
67
- client?: Partial<RequestConfig> & { client?: typeof client }
67
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
68
68
  } = {},
69
69
  ) {
70
70
  const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
@@ -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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { QueryKey, QueryClient, CreateBaseQueryOptions, CreateQueryResult } from 'custom-query'
8
8
  import { queryOptions, createQuery } from 'custom-query'
@@ -23,9 +23,9 @@ export async function updatePetWithForm(
23
23
  petId: UpdatePetWithFormPathParams['petId'],
24
24
  data?: UpdatePetWithFormMutationRequest,
25
25
  params?: UpdatePetWithFormQueryParams,
26
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client } = {},
26
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {},
27
27
  ) {
28
- const { client: request = client, ...requestConfig } = config
28
+ const { client: request = fetch, ...requestConfig } = config
29
29
 
30
30
  const requestData = updatePetWithFormMutationRequest.parse(data)
31
31
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
@@ -42,7 +42,7 @@ export function updatePetWithFormQueryOptions(
42
42
  petId: UpdatePetWithFormPathParams['petId'],
43
43
  data?: UpdatePetWithFormMutationRequest,
44
44
  params?: UpdatePetWithFormQueryParams,
45
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client } = {},
45
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {},
46
46
  ) {
47
47
  const queryKey = updatePetWithFormQueryKey(petId, data, params)
48
48
  return queryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationResponse, typeof queryKey>({
@@ -71,7 +71,7 @@ export function createUpdatePetWithForm<
71
71
  query?: Partial<CreateBaseQueryOptions<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, TData, TQueryData, TQueryKey>> & {
72
72
  client?: QueryClient
73
73
  }
74
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
74
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch }
75
75
  } = {},
76
76
  ) {
77
77
  const { query: { client: queryClient, ...queryOptions } = {}, client: config = {} } = options ?? {}
@@ -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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { CreateMutationOptions, QueryClient } from '@tanstack/svelte-query'
8
8
  import { createMutation } from '@tanstack/svelte-query'
@@ -19,9 +19,9 @@ export async function updatePetWithForm(
19
19
  petId: UpdatePetWithFormPathParams['petId'],
20
20
  data?: UpdatePetWithFormMutationRequest,
21
21
  params?: UpdatePetWithFormQueryParams,
22
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client } = {},
22
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {},
23
23
  ) {
24
- const { client: request = client, ...requestConfig } = config
24
+ const { client: request = fetch, ...requestConfig } = config
25
25
 
26
26
  const requestData = updatePetWithFormMutationRequest.parse(data)
27
27
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
@@ -46,7 +46,7 @@ export function createUpdatePetWithForm<TContext>(
46
46
  { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
47
47
  TContext
48
48
  > & { client?: QueryClient }
49
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
49
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch }
50
50
  } = {},
51
51
  ) {
52
52
  const { mutation = {}, client: config = {} } = options ?? {}
@@ -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 type { RequestConfig, ResponseErrorConfig } from '@kubb/plugin-client/clients/axios'
7
7
  import type { CreateMutationOptions, QueryClient } from '@tanstack/svelte-query'
8
8
  import { createMutation } from '@tanstack/svelte-query'
@@ -19,9 +19,9 @@ export async function updatePetWithForm(
19
19
  { petId }: { petId: UpdatePetWithFormPathParams['petId'] },
20
20
  data?: UpdatePetWithFormMutationRequest,
21
21
  params?: UpdatePetWithFormQueryParams,
22
- config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client } = {},
22
+ config: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch } = {},
23
23
  ) {
24
- const { client: request = client, ...requestConfig } = config
24
+ const { client: request = fetch, ...requestConfig } = config
25
25
 
26
26
  const requestData = updatePetWithFormMutationRequest.parse(data)
27
27
  const res = await request<UpdatePetWithFormMutationResponse, ResponseErrorConfig<UpdatePetWithForm405>, UpdatePetWithFormMutationRequest>({
@@ -46,7 +46,7 @@ export function createUpdatePetWithForm<TContext>(
46
46
  { petId: UpdatePetWithFormPathParams['petId']; data?: UpdatePetWithFormMutationRequest; params?: UpdatePetWithFormQueryParams },
47
47
  TContext
48
48
  > & { client?: QueryClient }
49
- client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof client }
49
+ client?: Partial<RequestConfig<UpdatePetWithFormMutationRequest>> & { client?: typeof fetch }
50
50
  } = {},
51
51
  ) {
52
52
  const { mutation = {}, client: config = {} } = options ?? {}
@@ -79,7 +79,7 @@ export const mutationGenerator = createReactGenerator<PluginSvelteQuery>({
79
79
  {options.parser === 'zod' && (
80
80
  <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={mutation.file.path} path={zod.file.path} />
81
81
  )}
82
- <File.Import name={'client'} path={options.client.importPath} />
82
+ <File.Import name={'fetch'} path={options.client.importPath} />
83
83
  {!!hasClientPlugin && <File.Import name={[client.name]} root={mutation.file.path} path={client.file.path} />}
84
84
  <File.Import name={['RequestConfig', 'ResponseConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />
85
85
  <File.Import
@@ -82,7 +82,7 @@ export const queryGenerator = createReactGenerator<PluginSvelteQuery>({
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 />}