@kubb/plugin-vue-query 5.0.0-beta.3 → 5.0.0-beta.30
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 +26 -5
- package/dist/{components-D1UhYFgY.js → components-B4IlVmNa.js} +244 -353
- package/dist/components-B4IlVmNa.js.map +1 -0
- package/dist/{components-qfOFRSoM.cjs → components-CIedagno.cjs} +269 -354
- package/dist/components-CIedagno.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +3 -67
- package/dist/components.js +1 -1
- package/dist/{generators-CbnIVBgY.js → generators-ClYptnDj.js} +144 -132
- package/dist/generators-ClYptnDj.js.map +1 -0
- package/dist/{generators-C4gs_P1i.cjs → generators-D7kNtBBo.cjs} +142 -130
- package/dist/generators-D7kNtBBo.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +17 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +100 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +100 -17
- package/dist/index.js.map +1 -1
- package/dist/types-D-LjzI_Q.d.ts +270 -0
- package/extension.yaml +1273 -0
- package/package.json +16 -18
- package/src/components/InfiniteQuery.tsx +11 -48
- package/src/components/InfiniteQueryOptions.tsx +38 -50
- package/src/components/Mutation.tsx +33 -42
- package/src/components/Query.tsx +11 -49
- package/src/components/QueryKey.tsx +8 -61
- package/src/components/QueryOptions.tsx +14 -67
- package/src/generators/infiniteQueryGenerator.tsx +46 -51
- package/src/generators/mutationGenerator.tsx +41 -49
- package/src/generators/queryGenerator.tsx +43 -49
- package/src/plugin.ts +43 -15
- package/src/resolvers/resolverVueQuery.ts +61 -4
- package/src/types.ts +129 -53
- package/src/utils.ts +44 -25
- package/dist/components-D1UhYFgY.js.map +0 -1
- package/dist/components-qfOFRSoM.cjs.map +0 -1
- package/dist/generators-C4gs_P1i.cjs.map +0 -1
- package/dist/generators-CbnIVBgY.js.map +0 -1
- package/dist/types-nVDTfuS1.d.ts +0 -194
package/dist/types-nVDTfuS1.d.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
|
|
3
|
-
import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
|
|
4
|
-
|
|
5
|
-
//#region src/types.d.ts
|
|
6
|
-
type Transformer = (props: {
|
|
7
|
-
node: ast.OperationNode;
|
|
8
|
-
casing: 'camelcase' | undefined;
|
|
9
|
-
}) => unknown[];
|
|
10
|
-
/**
|
|
11
|
-
* Resolver for Vue Query that provides naming methods for hook functions.
|
|
12
|
-
*/
|
|
13
|
-
type ResolverVueQuery = Resolver & {
|
|
14
|
-
/**
|
|
15
|
-
* Resolves the hook function name for an operation.
|
|
16
|
-
*/
|
|
17
|
-
resolveName(this: ResolverVueQuery, name: string): string;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Customize the queryKey.
|
|
21
|
-
*/
|
|
22
|
-
type QueryKey = Transformer;
|
|
23
|
-
/**
|
|
24
|
-
* Customize the mutationKey.
|
|
25
|
-
*/
|
|
26
|
-
type MutationKey = Transformer;
|
|
27
|
-
type Query = {
|
|
28
|
-
/**
|
|
29
|
-
* HTTP methods to use for queries.
|
|
30
|
-
*
|
|
31
|
-
* @default ['get']
|
|
32
|
-
*/
|
|
33
|
-
methods?: Array<string>;
|
|
34
|
-
/**
|
|
35
|
-
* Path to the useQuery hook for useQuery functionality.
|
|
36
|
-
* Used as `import { useQuery } from '${importPath}'`.
|
|
37
|
-
* Accepts relative and absolute paths.
|
|
38
|
-
* Path is used as-is; relative paths are based on the generated file location.
|
|
39
|
-
* @default '@tanstack/vue-query'
|
|
40
|
-
*/
|
|
41
|
-
importPath?: string;
|
|
42
|
-
};
|
|
43
|
-
type Mutation = {
|
|
44
|
-
/**
|
|
45
|
-
* HTTP methods to use for mutations.
|
|
46
|
-
*
|
|
47
|
-
* @default ['post', 'put', 'delete']
|
|
48
|
-
*/
|
|
49
|
-
methods?: Array<string>;
|
|
50
|
-
/**
|
|
51
|
-
* Path to the useMutation hook for useMutation functionality.
|
|
52
|
-
* Used as `import { useMutation } from '${importPath}'`.
|
|
53
|
-
* Accepts relative and absolute paths.
|
|
54
|
-
* Path is used as-is; relative paths are based on the generated file location.
|
|
55
|
-
* @default '@tanstack/vue-query'
|
|
56
|
-
*/
|
|
57
|
-
importPath?: string;
|
|
58
|
-
};
|
|
59
|
-
type Infinite = {
|
|
60
|
-
/**
|
|
61
|
-
* Specify the params key used for `pageParam`.
|
|
62
|
-
* @default 'id'
|
|
63
|
-
*/
|
|
64
|
-
queryParam: string;
|
|
65
|
-
/**
|
|
66
|
-
* Which field of the data is used, set it to undefined when no cursor is known.
|
|
67
|
-
* @deprecated Use `nextParam` and `previousParam` instead for more flexible pagination handling.
|
|
68
|
-
*/
|
|
69
|
-
cursorParam?: string | undefined;
|
|
70
|
-
/**
|
|
71
|
-
* Which field of the data is used to get the cursor for the next page.
|
|
72
|
-
* Supports dot notation (e.g. 'pagination.next.id') or array path (e.g. ['pagination', 'next', 'id']) to access nested fields.
|
|
73
|
-
*/
|
|
74
|
-
nextParam?: string | string[] | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* Which field of the data is used to get the cursor for the previous page.
|
|
77
|
-
* Supports dot notation (e.g. 'pagination.prev.id') or array path (e.g. ['pagination', 'prev', 'id']) to access nested fields.
|
|
78
|
-
*/
|
|
79
|
-
previousParam?: string | string[] | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* The initial value, the value of the first page.
|
|
82
|
-
* @default 0
|
|
83
|
-
*/
|
|
84
|
-
initialPageParam: unknown;
|
|
85
|
-
};
|
|
86
|
-
type Options = {
|
|
87
|
-
/**
|
|
88
|
-
* Specify the export location for the files and define the behavior of the output
|
|
89
|
-
* @default { path: 'hooks', barrelType: 'named' }
|
|
90
|
-
*/
|
|
91
|
-
output?: Output;
|
|
92
|
-
/**
|
|
93
|
-
* Group the @tanstack/query hooks based on the provided name.
|
|
94
|
-
*/
|
|
95
|
-
group?: Group;
|
|
96
|
-
client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
97
|
-
/**
|
|
98
|
-
* Tags, operations, or paths to exclude from generation.
|
|
99
|
-
*/
|
|
100
|
-
exclude?: Array<Exclude>;
|
|
101
|
-
/**
|
|
102
|
-
* Tags, operations, or paths to include in generation.
|
|
103
|
-
*/
|
|
104
|
-
include?: Array<Include>;
|
|
105
|
-
/**
|
|
106
|
-
* Override options for specific tags, operations, or paths.
|
|
107
|
-
*/
|
|
108
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
109
|
-
/**
|
|
110
|
-
* Apply casing to parameter names.
|
|
111
|
-
*/
|
|
112
|
-
paramsCasing?: 'camelcase';
|
|
113
|
-
/**
|
|
114
|
-
* How parameters are passed: grouped in an object or spread inline.
|
|
115
|
-
*
|
|
116
|
-
* @default 'inline'
|
|
117
|
-
*/
|
|
118
|
-
paramsType?: 'object' | 'inline';
|
|
119
|
-
/**
|
|
120
|
-
* How path parameters are passed: grouped in an object or spread inline.
|
|
121
|
-
*
|
|
122
|
-
* @default 'inline'
|
|
123
|
-
*/
|
|
124
|
-
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
125
|
-
/**
|
|
126
|
-
* Add infinite query hooks.
|
|
127
|
-
*/
|
|
128
|
-
infinite?: Partial<Infinite> | false;
|
|
129
|
-
queryKey?: QueryKey;
|
|
130
|
-
/**
|
|
131
|
-
* Configure useQuery behavior.
|
|
132
|
-
*/
|
|
133
|
-
query?: Partial<Query> | false;
|
|
134
|
-
mutationKey?: MutationKey;
|
|
135
|
-
/**
|
|
136
|
-
* Configure useMutation behavior.
|
|
137
|
-
*/
|
|
138
|
-
mutation?: Partial<Mutation> | false;
|
|
139
|
-
/**
|
|
140
|
-
* Parser to use for validating response data.
|
|
141
|
-
*/
|
|
142
|
-
parser?: PluginClient['options']['parser'];
|
|
143
|
-
transformers?: {
|
|
144
|
-
/**
|
|
145
|
-
* Override the default naming for hooks.
|
|
146
|
-
*/
|
|
147
|
-
name?: (name: string, type?: string) => string;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Override naming conventions for function names and types.
|
|
151
|
-
*/
|
|
152
|
-
resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
|
|
153
|
-
/**
|
|
154
|
-
* AST visitor to transform generated nodes.
|
|
155
|
-
*/
|
|
156
|
-
transformer?: ast.Visitor;
|
|
157
|
-
/**
|
|
158
|
-
* Additional generators alongside the default generators.
|
|
159
|
-
*/
|
|
160
|
-
generators?: Array<Generator<PluginVueQuery>>;
|
|
161
|
-
};
|
|
162
|
-
type ResolvedOptions = {
|
|
163
|
-
output: Output;
|
|
164
|
-
group: Group | undefined;
|
|
165
|
-
exclude: NonNullable<Options['exclude']>;
|
|
166
|
-
include: Options['include'];
|
|
167
|
-
override: NonNullable<Options['override']>;
|
|
168
|
-
client: Pick<PluginClient['options'], 'client' | 'clientType' | 'dataReturnType' | 'importPath' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
169
|
-
parser: Required<NonNullable<Options['parser']>>;
|
|
170
|
-
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
171
|
-
paramsCasing: Options['paramsCasing'];
|
|
172
|
-
paramsType: NonNullable<Options['paramsType']>;
|
|
173
|
-
/**
|
|
174
|
-
* Only used for infinite
|
|
175
|
-
*/
|
|
176
|
-
infinite: NonNullable<Infinite> | false;
|
|
177
|
-
queryKey: QueryKey | undefined;
|
|
178
|
-
query: NonNullable<Required<Query>> | false;
|
|
179
|
-
mutationKey: MutationKey | undefined;
|
|
180
|
-
mutation: NonNullable<Required<Mutation>> | false;
|
|
181
|
-
resolver: ResolverVueQuery;
|
|
182
|
-
transformers: NonNullable<Options['transformers']>;
|
|
183
|
-
};
|
|
184
|
-
type PluginVueQuery = PluginFactoryOptions<'plugin-vue-query', Options, ResolvedOptions, ResolverVueQuery>;
|
|
185
|
-
declare global {
|
|
186
|
-
namespace Kubb {
|
|
187
|
-
interface PluginRegistry {
|
|
188
|
-
'plugin-vue-query': PluginVueQuery;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
//#endregion
|
|
193
|
-
export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
|
|
194
|
-
//# sourceMappingURL=types-nVDTfuS1.d.ts.map
|