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