@kubb/plugin-vue-query 4.12.0 → 4.12.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-vue-query",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "description": "Vue Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Vue.js applications.",
5
5
  "keywords": [
6
6
  "vue-query",
@@ -70,12 +70,12 @@
70
70
  "dependencies": {
71
71
  "@kubb/react-fabric": "0.7.0",
72
72
  "remeda": "^2.32.0",
73
- "@kubb/core": "4.12.0",
74
- "@kubb/oas": "4.12.0",
75
- "@kubb/plugin-client": "4.12.0",
76
- "@kubb/plugin-oas": "4.12.0",
77
- "@kubb/plugin-ts": "4.12.0",
78
- "@kubb/plugin-zod": "4.12.0"
73
+ "@kubb/core": "4.12.1",
74
+ "@kubb/oas": "4.12.1",
75
+ "@kubb/plugin-client": "4.12.1",
76
+ "@kubb/plugin-oas": "4.12.1",
77
+ "@kubb/plugin-ts": "4.12.1",
78
+ "@kubb/plugin-zod": "4.12.1"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@kubb/react-fabric": "0.7.0"
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Generated by Kubb (https://kubb.dev/).
3
+ * Do not edit manually.
4
+ */
5
+ import type { RequestConfig, ResponseErrorConfig } from './test/.kubb/fetch'
6
+ import type { QueryKey, QueryClient, UseQueryOptions, UseQueryReturnType } from '@tanstack/react-query'
7
+ import type { MaybeRefOrGetter } from 'vue'
8
+ import { fetch } from './test/.kubb/fetch'
9
+ import { queryOptions, useQuery } from '@tanstack/react-query'
10
+ import { toValue } from 'vue'
11
+
12
+ export const findPetsByTagsQueryKey = (params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>) =>
13
+ [{ url: '/pet/findByTags' }, ...(params ? [params] : [])] as const
14
+
15
+ export type FindPetsByTagsQueryKey = ReturnType<typeof findPetsByTagsQueryKey>
16
+
17
+ /**
18
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
19
+ * @summary Finds Pets by tags
20
+ * {@link /pet/findByTags}
21
+ */
22
+ export async function findPetsByTags(
23
+ headers: FindPetsByTagsHeaderParams,
24
+ params?: FindPetsByTagsQueryParams,
25
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
26
+ ) {
27
+ const { client: request = fetch, ...requestConfig } = config
28
+
29
+ const res = await request<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, unknown>({
30
+ method: 'GET',
31
+ url: `/pet/findByTags`,
32
+ baseURL: `${123456}`,
33
+ params,
34
+ ...requestConfig,
35
+ headers: { ...headers, ...requestConfig.headers },
36
+ })
37
+ return findPetsByTagsQueryResponse.parse(res.data)
38
+ }
39
+
40
+ export function findPetsByTagsQueryOptions(
41
+ headers: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
42
+ params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
43
+ config: Partial<RequestConfig> & { client?: typeof fetch } = {},
44
+ ) {
45
+ const queryKey = findPetsByTagsQueryKey(params)
46
+ return queryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, FindPetsByTagsQueryResponse, typeof queryKey>({
47
+ queryKey,
48
+ queryFn: async ({ signal }) => {
49
+ config.signal = signal
50
+ return findPetsByTags(toValue(headers), toValue(params), toValue(config))
51
+ },
52
+ })
53
+ }
54
+
55
+ /**
56
+ * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
57
+ * @summary Finds Pets by tags
58
+ * {@link /pet/findByTags}
59
+ */
60
+ export function useFindPetsByTags<
61
+ TData = FindPetsByTagsQueryResponse,
62
+ TQueryData = FindPetsByTagsQueryResponse,
63
+ TQueryKey extends QueryKey = FindPetsByTagsQueryKey,
64
+ >(
65
+ headers: MaybeRefOrGetter<FindPetsByTagsHeaderParams>,
66
+ params?: MaybeRefOrGetter<FindPetsByTagsQueryParams>,
67
+ options: {
68
+ query?: Partial<UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, TQueryData, TQueryKey>> & {
69
+ client?: QueryClient
70
+ }
71
+ client?: Partial<RequestConfig> & { client?: typeof fetch }
72
+ } = {},
73
+ ) {
74
+ const { query: queryConfig = {}, client: config = {} } = options ?? {}
75
+ const { client: queryClient, ...queryOptions } = queryConfig
76
+ const queryKey = (queryOptions && 'queryKey' in queryOptions ? toValue(queryOptions.queryKey) : undefined) ?? findPetsByTagsQueryKey(params)
77
+
78
+ const query = useQuery(
79
+ {
80
+ ...findPetsByTagsQueryOptions(headers, params, config),
81
+ ...queryOptions,
82
+ queryKey,
83
+ } as unknown as UseQueryOptions<FindPetsByTagsQueryResponse, ResponseErrorConfig<FindPetsByTags400>, TData, FindPetsByTagsQueryResponse, TQueryKey>,
84
+ toValue(queryClient),
85
+ ) as UseQueryReturnType<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
86
+
87
+ query.queryKey = queryKey as TQueryKey
88
+
89
+ return query
90
+ }