@kubb/plugin-react-query 3.0.0-alpha.17 → 3.0.0-alpha.18
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/README.md +0 -4
- package/dist/{chunk-ME7ZFS5H.js → chunk-G6I2OU3A.js} +2 -2
- package/dist/{chunk-ME7ZFS5H.js.map → chunk-G6I2OU3A.js.map} +1 -1
- package/dist/{chunk-KRG2LWHM.cjs → chunk-MPBVA37Y.cjs} +2 -2
- package/dist/{chunk-KRG2LWHM.cjs.map → chunk-MPBVA37Y.cjs.map} +1 -1
- package/dist/generators.cjs +5 -5
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/package.json +11 -14
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +33 -47
- package/src/generators/__snapshots__/clientGetImportPath.ts +33 -47
- package/src/generators/__snapshots__/clientPostImportPath.ts +28 -49
- package/src/generators/__snapshots__/findByTags.ts +33 -47
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +33 -47
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +33 -47
- package/src/generators/__snapshots__/findByTagsWithZod.ts +33 -47
- package/src/generators/__snapshots__/findInfiniteByTags.ts +39 -57
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +39 -57
- package/src/generators/__snapshots__/postAsQuery.ts +34 -63
- package/src/generators/__snapshots__/updatePetById.ts +28 -49
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +30 -53
- package/src/generators/infiniteQueryGenerator.tsx +1 -1
- package/src/generators/suspenseQueryGenerator.tsx +1 -1
- package/src/types.ts +3 -8
- package/src/utils.ts +0 -96
|
@@ -6,7 +6,7 @@ import { useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
7
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
8
8
|
import { File, useApp } from '@kubb/react'
|
|
9
|
-
import {
|
|
9
|
+
import { QueryKey, QueryOptions, SuspenseQuery } from '../components'
|
|
10
10
|
import type { PluginReactQuery } from '../types'
|
|
11
11
|
|
|
12
12
|
export const suspenseQueryGenerator = createReactGenerator<PluginReactQuery>({
|
package/src/types.ts
CHANGED
|
@@ -4,9 +4,9 @@ import type * as KubbFile from '@kubb/fs/types'
|
|
|
4
4
|
import type { HttpMethod } from '@kubb/oas'
|
|
5
5
|
import type { Exclude, Include, Override, ResolvePathOptions } from '@kubb/plugin-oas'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type Suspense = object
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type Query = {
|
|
10
10
|
/**
|
|
11
11
|
* Customize the queryKey, here you can specify a suffix.
|
|
12
12
|
*/
|
|
@@ -26,7 +26,7 @@ export type Query = {
|
|
|
26
26
|
importPath?: string
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
type Mutation = {
|
|
30
30
|
/**
|
|
31
31
|
* Define which HttpMethods can be used for mutations
|
|
32
32
|
* @default ['post', 'put', 'delete']
|
|
@@ -199,9 +199,4 @@ type ResolvedOptions = {
|
|
|
199
199
|
mutation: NonNullable<Required<Mutation>> | false
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
export type FileMeta = {
|
|
203
|
-
pluginKey?: Plugin['key']
|
|
204
|
-
tag?: string
|
|
205
|
-
}
|
|
206
|
-
|
|
207
202
|
export type PluginReactQuery = PluginFactoryOptions<'plugin-react-query', Options, ResolvedOptions, never, ResolvePathOptions>
|
package/src/utils.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { PackageManager } from '@kubb/core'
|
|
2
|
-
|
|
3
|
-
export const reactQueryDepRegex = /@tanstack\/(react|solid|vue|svelte)-query/
|
|
4
|
-
|
|
5
|
-
export function getImportNames() {
|
|
6
|
-
const isV5 = new PackageManager().isValidSync(reactQueryDepRegex, '>=5')
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
mutation: {
|
|
10
|
-
react: {
|
|
11
|
-
path: '@tanstack/react-query',
|
|
12
|
-
hookName: 'useMutation',
|
|
13
|
-
optionsType: 'UseMutationOptions',
|
|
14
|
-
resultType: 'UseMutationResult',
|
|
15
|
-
},
|
|
16
|
-
solid: {
|
|
17
|
-
path: '@tanstack/solid-query',
|
|
18
|
-
hookName: 'createMutation',
|
|
19
|
-
optionsType: 'CreateMutationOptions',
|
|
20
|
-
resultType: 'CreateMutationResult',
|
|
21
|
-
},
|
|
22
|
-
svelte: {
|
|
23
|
-
path: '@tanstack/svelte-query',
|
|
24
|
-
hookName: 'createMutation',
|
|
25
|
-
optionsType: 'CreateMutationOptions',
|
|
26
|
-
resultType: 'CreateMutationResult',
|
|
27
|
-
},
|
|
28
|
-
vue: {
|
|
29
|
-
path: '@tanstack/vue-query',
|
|
30
|
-
hookName: 'useMutation',
|
|
31
|
-
optionsType: isV5 ? 'UseMutationOptions' : 'VueMutationObserverOptions',
|
|
32
|
-
resultType: 'UseMutationReturnType',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
query: {
|
|
36
|
-
react: {
|
|
37
|
-
path: '@tanstack/react-query',
|
|
38
|
-
hookName: 'useQuery',
|
|
39
|
-
optionsType: isV5 ? 'QueryObserverOptions' : 'UseBaseQueryOptions',
|
|
40
|
-
resultType: 'UseQueryResult',
|
|
41
|
-
},
|
|
42
|
-
solid: {
|
|
43
|
-
path: '@tanstack/solid-query',
|
|
44
|
-
hookName: 'createQuery',
|
|
45
|
-
optionsType: 'CreateBaseQueryOptions',
|
|
46
|
-
resultType: 'CreateQueryResult',
|
|
47
|
-
},
|
|
48
|
-
svelte: {
|
|
49
|
-
path: '@tanstack/svelte-query',
|
|
50
|
-
hookName: 'createQuery',
|
|
51
|
-
optionsType: 'CreateBaseQueryOptions',
|
|
52
|
-
resultType: 'CreateQueryResult',
|
|
53
|
-
},
|
|
54
|
-
vue: {
|
|
55
|
-
path: '@tanstack/vue-query',
|
|
56
|
-
hookName: 'useQuery',
|
|
57
|
-
optionsType: isV5 ? 'QueryObserverOptions' : 'VueQueryObserverOptions',
|
|
58
|
-
resultType: isV5 ? 'UseQueryReturnType' : 'UseQueryReturnType',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
queryInfinite: {
|
|
62
|
-
react: {
|
|
63
|
-
path: '@tanstack/react-query',
|
|
64
|
-
hookName: 'useInfiniteQuery',
|
|
65
|
-
optionsType: isV5 ? 'InfiniteQueryObserverOptions' : 'UseInfiniteQueryOptions',
|
|
66
|
-
resultType: 'UseInfiniteQueryResult',
|
|
67
|
-
},
|
|
68
|
-
solid: {
|
|
69
|
-
path: '@tanstack/solid-query',
|
|
70
|
-
hookName: 'createInfiniteQuery',
|
|
71
|
-
optionsType: 'CreateInfiniteQueryOptions',
|
|
72
|
-
resultType: 'CreateInfiniteQueryResult',
|
|
73
|
-
},
|
|
74
|
-
svelte: {
|
|
75
|
-
path: '@tanstack/svelte-query',
|
|
76
|
-
hookName: 'createInfiniteQuery',
|
|
77
|
-
optionsType: 'CreateInfiniteQueryOptions',
|
|
78
|
-
resultType: 'CreateInfiniteQueryResult',
|
|
79
|
-
},
|
|
80
|
-
vue: {
|
|
81
|
-
path: '@tanstack/vue-query',
|
|
82
|
-
hookName: 'useInfiniteQuery',
|
|
83
|
-
optionsType: isV5 ? 'UseInfiniteQueryOptions' : 'VueInfiniteQueryObserverOptions',
|
|
84
|
-
resultType: isV5 ? 'UseInfiniteQueryReturnType' : 'VueInfiniteQueryObserverOptions',
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
querySuspense: {
|
|
88
|
-
react: {
|
|
89
|
-
path: '@tanstack/react-query',
|
|
90
|
-
hookName: 'useSuspenseQuery',
|
|
91
|
-
optionsType: 'UseSuspenseQueryOptions',
|
|
92
|
-
resultType: 'UseSuspenseQueryResult',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
} as const
|
|
96
|
-
}
|