@kubb/plugin-svelte-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-svelte-query",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.1",
|
|
4
4
|
"description": "Svelte Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Svelte applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte-query",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@kubb/react-fabric": "0.7.0",
|
|
71
71
|
"remeda": "^2.32.0",
|
|
72
|
-
"@kubb/core": "4.12.
|
|
73
|
-
"@kubb/oas": "4.12.
|
|
74
|
-
"@kubb/plugin-client": "4.12.
|
|
75
|
-
"@kubb/plugin-oas": "4.12.
|
|
76
|
-
"@kubb/plugin-ts": "4.12.
|
|
77
|
-
"@kubb/plugin-zod": "4.12.
|
|
72
|
+
"@kubb/core": "4.12.1",
|
|
73
|
+
"@kubb/oas": "4.12.1",
|
|
74
|
+
"@kubb/plugin-client": "4.12.1",
|
|
75
|
+
"@kubb/plugin-oas": "4.12.1",
|
|
76
|
+
"@kubb/plugin-ts": "4.12.1",
|
|
77
|
+
"@kubb/plugin-zod": "4.12.1"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@kubb/react-fabric": "0.7.0"
|
|
@@ -0,0 +1,87 @@
|
|
|
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, CreateBaseQueryOptions, CreateQueryResult } from '@tanstack/svelte-query'
|
|
7
|
+
import { fetch } from './test/.kubb/fetch'
|
|
8
|
+
import { queryOptions, createQuery } 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<CreateBaseQueryOptions<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 = createQuery(
|
|
76
|
+
{
|
|
77
|
+
...findPetsByTagsQueryOptions(headers, params, config),
|
|
78
|
+
queryKey,
|
|
79
|
+
...queryOptions,
|
|
80
|
+
} as unknown as CreateBaseQueryOptions,
|
|
81
|
+
queryClient,
|
|
82
|
+
) as CreateQueryResult<TData, ResponseErrorConfig<FindPetsByTags400>> & { queryKey: TQueryKey }
|
|
83
|
+
|
|
84
|
+
query.queryKey = queryKey as TQueryKey
|
|
85
|
+
|
|
86
|
+
return query
|
|
87
|
+
}
|