@kubb/plugin-vue-query 3.0.0-beta.9 → 3.0.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/dist/{chunk-VEQJK4QZ.js → chunk-6PXSXFQR.js} +239 -25
- package/dist/chunk-6PXSXFQR.js.map +1 -0
- package/dist/{chunk-CJBEHJ3D.cjs → chunk-FG7T5YC2.cjs} +125 -100
- package/dist/chunk-FG7T5YC2.cjs.map +1 -0
- package/dist/{chunk-CYO3ZQ3K.js → chunk-L4RJORUB.js} +117 -92
- package/dist/chunk-L4RJORUB.js.map +1 -0
- package/dist/{chunk-QS4ZHURK.cjs → chunk-YSXKGUG5.cjs} +239 -25
- package/dist/chunk-YSXKGUG5.cjs.map +1 -0
- package/dist/components.cjs +8 -8
- package/dist/components.d.cts +25 -14
- package/dist/components.d.ts +25 -14
- package/dist/components.js +1 -1
- package/dist/generators.cjs +5 -5
- package/dist/generators.d.cts +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +2 -2
- package/dist/index.cjs +24 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -24
- package/dist/index.js.map +1 -1
- package/dist/types-C8LfCZUP.d.cts +389 -0
- package/dist/types-C8LfCZUP.d.ts +389 -0
- package/package.json +13 -12
- package/src/components/InfiniteQuery.tsx +55 -2
- package/src/components/InfiniteQueryOptions.tsx +49 -2
- package/src/components/Mutation.tsx +3 -1
- package/src/components/MutationKey.tsx +11 -5
- package/src/components/Query.tsx +65 -2
- package/src/components/QueryKey.tsx +17 -7
- package/src/components/QueryOptions.tsx +50 -3
- package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
- package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
- package/src/generators/__snapshots__/clientPostImportPath.ts +2 -2
- package/src/generators/__snapshots__/findByTags.ts +1 -1
- package/src/generators/__snapshots__/findByTagsObject.ts +62 -0
- package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
- package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +2 -2
- package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
- package/src/generators/__snapshots__/findInfiniteByTags.ts +3 -3
- package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +3 -3
- package/src/generators/__snapshots__/postAsQuery.ts +1 -1
- package/src/generators/__snapshots__/updatePetById.ts +2 -2
- package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +3 -5
- package/src/generators/infiniteQueryGenerator.tsx +46 -33
- package/src/generators/mutationGenerator.tsx +28 -18
- package/src/generators/queryGenerator.tsx +28 -18
- package/src/plugin.ts +29 -26
- package/src/types.ts +35 -14
- package/dist/chunk-CJBEHJ3D.cjs.map +0 -1
- package/dist/chunk-CYO3ZQ3K.js.map +0 -1
- package/dist/chunk-QS4ZHURK.cjs.map +0 -1
- package/dist/chunk-VEQJK4QZ.js.map +0 -1
- package/dist/types-BGseXQR_.d.cts +0 -208
- package/dist/types-BGseXQR_.d.ts +0 -208
package/dist/types-BGseXQR_.d.ts
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { PluginFactoryOptions, Output, Group, ResolveNameParams } from '@kubb/core';
|
|
2
|
-
import { HttpMethod } from '@kubb/oas';
|
|
3
|
-
import { ResolvePathOptions, Exclude, Include, Override, Generator } from '@kubb/plugin-oas';
|
|
4
|
-
|
|
5
|
-
type Options$1 = {
|
|
6
|
-
/**
|
|
7
|
-
* Specify the export location for the files and define the behavior of the output
|
|
8
|
-
* @default { path: 'clients', barrelType: 'named' }
|
|
9
|
-
*/
|
|
10
|
-
output?: Output;
|
|
11
|
-
/**
|
|
12
|
-
* Group the clients based on the provided name.
|
|
13
|
-
*/
|
|
14
|
-
group?: Group;
|
|
15
|
-
/**
|
|
16
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
17
|
-
*/
|
|
18
|
-
exclude?: Array<Exclude>;
|
|
19
|
-
/**
|
|
20
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
21
|
-
*/
|
|
22
|
-
include?: Array<Include>;
|
|
23
|
-
/**
|
|
24
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
25
|
-
*/
|
|
26
|
-
override?: Array<Override<ResolvedOptions$1>>;
|
|
27
|
-
/**
|
|
28
|
-
* Create `operations.ts` file with all operations grouped by methods.
|
|
29
|
-
* @default false
|
|
30
|
-
*/
|
|
31
|
-
operations?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Path to the client import path that will be used to do the API calls.
|
|
34
|
-
* It will be used as `import client from '${client.importPath}'`.
|
|
35
|
-
* It allows both relative and absolute path but be aware that we will not change the path.
|
|
36
|
-
* @default '@kubb/plugin-client/client'
|
|
37
|
-
*/
|
|
38
|
-
importPath?: string;
|
|
39
|
-
/**
|
|
40
|
-
* ReturnType that will be used when calling the client.
|
|
41
|
-
* - 'data' will return ResponseConfig[data].
|
|
42
|
-
* - 'full' will return ResponseConfig.
|
|
43
|
-
* @default 'data'
|
|
44
|
-
*/
|
|
45
|
-
dataReturnType?: 'data' | 'full';
|
|
46
|
-
/**
|
|
47
|
-
* How to pass your pathParams.
|
|
48
|
-
* - 'object' will return the pathParams as an object.
|
|
49
|
-
* - 'inline' will return the pathParams as comma separated params.
|
|
50
|
-
* @default 'inline'
|
|
51
|
-
*/
|
|
52
|
-
pathParamsType?: 'object' | 'inline';
|
|
53
|
-
/**
|
|
54
|
-
* Which parser can be used before returning the data
|
|
55
|
-
* - 'zod' will use `@kubb/plugin-zod` to parse the data.
|
|
56
|
-
* @default 'client'
|
|
57
|
-
*/
|
|
58
|
-
parser?: 'client' | 'zod';
|
|
59
|
-
transformers?: {
|
|
60
|
-
/**
|
|
61
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
62
|
-
*/
|
|
63
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Define some generators next to the client generators
|
|
67
|
-
*/
|
|
68
|
-
generators?: Array<Generator<PluginClient>>;
|
|
69
|
-
};
|
|
70
|
-
type ResolvedOptions$1 = {
|
|
71
|
-
output: Output;
|
|
72
|
-
group?: Options$1['group'];
|
|
73
|
-
baseURL: string | undefined;
|
|
74
|
-
parser: NonNullable<Options$1['parser']>;
|
|
75
|
-
importPath: NonNullable<Options$1['importPath']>;
|
|
76
|
-
dataReturnType: NonNullable<Options$1['dataReturnType']>;
|
|
77
|
-
pathParamsType: NonNullable<Options$1['pathParamsType']>;
|
|
78
|
-
};
|
|
79
|
-
type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions$1, never, ResolvePathOptions>;
|
|
80
|
-
|
|
81
|
-
type Query = {
|
|
82
|
-
/**
|
|
83
|
-
* Customize the queryKey, here you can specify a suffix.
|
|
84
|
-
*/
|
|
85
|
-
key: (key: unknown[]) => unknown[];
|
|
86
|
-
/**
|
|
87
|
-
* Define which HttpMethods can be used for queries
|
|
88
|
-
* @default ['get']
|
|
89
|
-
*/
|
|
90
|
-
methods: Array<HttpMethod>;
|
|
91
|
-
/**
|
|
92
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
93
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
94
|
-
* It allows both relative and absolute path.
|
|
95
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
96
|
-
* @default '@tanstack/react-query'
|
|
97
|
-
*/
|
|
98
|
-
importPath?: string;
|
|
99
|
-
};
|
|
100
|
-
type Mutation = {
|
|
101
|
-
/**
|
|
102
|
-
* Customize the queryKey, here you can specify a suffix.
|
|
103
|
-
*/
|
|
104
|
-
key: (key: unknown[]) => unknown[];
|
|
105
|
-
/**
|
|
106
|
-
* Define which HttpMethods can be used for mutations
|
|
107
|
-
* @default ['post', 'put', 'delete']
|
|
108
|
-
*/
|
|
109
|
-
methods: Array<HttpMethod>;
|
|
110
|
-
/**
|
|
111
|
-
* Path to the useQuery that will be used to do the useQuery functionality.
|
|
112
|
-
* It will be used as `import { useQuery } from '${importPath}'`.
|
|
113
|
-
* It allows both relative and absolute path.
|
|
114
|
-
* the path will be applied as is, so relative path should be based on the file being generated.
|
|
115
|
-
* @default '@tanstack/react-query'
|
|
116
|
-
*/
|
|
117
|
-
importPath?: string;
|
|
118
|
-
};
|
|
119
|
-
type Infinite = {
|
|
120
|
-
/**
|
|
121
|
-
* Specify the params key used for `pageParam`.
|
|
122
|
-
* @default `'id'`
|
|
123
|
-
*/
|
|
124
|
-
queryParam: string;
|
|
125
|
-
/**
|
|
126
|
-
* Which field of the data will be used, set it to undefined when no cursor is known.
|
|
127
|
-
*/
|
|
128
|
-
cursorParam?: string | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* The initial value, the value of the first page.
|
|
131
|
-
* @default `0`
|
|
132
|
-
*/
|
|
133
|
-
initialPageParam: unknown;
|
|
134
|
-
};
|
|
135
|
-
type Options = {
|
|
136
|
-
/**
|
|
137
|
-
* Specify the export location for the files and define the behavior of the output
|
|
138
|
-
* @default { path: 'hooks', barrelType: 'named' }
|
|
139
|
-
*/
|
|
140
|
-
output?: Output;
|
|
141
|
-
/**
|
|
142
|
-
* Group the @tanstack/query hooks based on the provided name.
|
|
143
|
-
*/
|
|
144
|
-
group?: Group;
|
|
145
|
-
client?: Pick<PluginClient['options'], 'dataReturnType' | 'importPath'>;
|
|
146
|
-
/**
|
|
147
|
-
* Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
|
|
148
|
-
*/
|
|
149
|
-
exclude?: Array<Exclude>;
|
|
150
|
-
/**
|
|
151
|
-
* Array containing include parameters to include tags/operations/methods/paths.
|
|
152
|
-
*/
|
|
153
|
-
include?: Array<Include>;
|
|
154
|
-
/**
|
|
155
|
-
* Array containing override parameters to override `options` based on tags/operations/methods/paths.
|
|
156
|
-
*/
|
|
157
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
158
|
-
/**
|
|
159
|
-
* How to pass your pathParams.
|
|
160
|
-
* - 'object' will return the pathParams as an object.
|
|
161
|
-
* - 'inline' will return the pathParams as comma separated params.
|
|
162
|
-
* @default 'inline'
|
|
163
|
-
*/
|
|
164
|
-
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
165
|
-
/**
|
|
166
|
-
* When set, an infiniteQuery hooks will be added.
|
|
167
|
-
*/
|
|
168
|
-
infinite?: Partial<Infinite> | false;
|
|
169
|
-
/**
|
|
170
|
-
* Override some useQuery behaviours.
|
|
171
|
-
*/
|
|
172
|
-
query?: Partial<Query> | false;
|
|
173
|
-
/**
|
|
174
|
-
* Override some useMutation behaviours.
|
|
175
|
-
*/
|
|
176
|
-
mutation?: Mutation | false;
|
|
177
|
-
/**
|
|
178
|
-
* Which parser can be used before returning the data to `@tanstack/query`.
|
|
179
|
-
* `'zod'` will use `@kubb/plugin-zod` to parse the data.
|
|
180
|
-
*/
|
|
181
|
-
parser?: PluginClient['options']['parser'];
|
|
182
|
-
transformers?: {
|
|
183
|
-
/**
|
|
184
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
185
|
-
*/
|
|
186
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
187
|
-
};
|
|
188
|
-
/**
|
|
189
|
-
* Define some generators next to the vue-query generators
|
|
190
|
-
*/
|
|
191
|
-
generators?: Array<Generator<PluginVueQuery>>;
|
|
192
|
-
};
|
|
193
|
-
type ResolvedOptions = {
|
|
194
|
-
output: Output;
|
|
195
|
-
baseURL: string | undefined;
|
|
196
|
-
client: Required<NonNullable<PluginVueQuery['options']['client']>>;
|
|
197
|
-
parser: Required<NonNullable<Options['parser']>>;
|
|
198
|
-
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
199
|
-
/**
|
|
200
|
-
* Only used of infinite
|
|
201
|
-
*/
|
|
202
|
-
infinite: NonNullable<Infinite> | false;
|
|
203
|
-
query: NonNullable<Required<Query>> | false;
|
|
204
|
-
mutation: NonNullable<Required<Mutation>> | false;
|
|
205
|
-
};
|
|
206
|
-
type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
207
|
-
|
|
208
|
-
export type { Infinite as I, Options as O, PluginVueQuery as P };
|