@kubb/plugin-vue-query 5.0.0-beta.15 → 5.0.0-beta.25
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/{components-1cEftHJm.cjs → components-CeZrYaZj.cjs} +44 -53
- package/dist/components-CeZrYaZj.cjs.map +1 -0
- package/dist/{components-DTSvTMEo.js → components-CpTXuQiK.js} +44 -53
- package/dist/components-CpTXuQiK.js.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +3 -3
- package/dist/components.js +1 -1
- package/dist/{generators-BEiWCS-U.cjs → generators-BSMwPpbh.cjs} +55 -39
- package/dist/generators-BSMwPpbh.cjs.map +1 -0
- package/dist/{generators-F6_EduRU.js → generators-Cb5_nhMY.js} +55 -39
- package/dist/generators-Cb5_nhMY.js.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 +47 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +47 -8
- package/dist/index.js.map +1 -1
- package/dist/{types-Bkm7bWT3.d.ts → types-D-LjzI_Q.d.ts} +73 -46
- package/extension.yaml +779 -255
- package/package.json +7 -7
- package/src/components/InfiniteQuery.tsx +1 -1
- package/src/components/InfiniteQueryOptions.tsx +21 -31
- package/src/components/Mutation.tsx +2 -2
- package/src/components/Query.tsx +1 -1
- package/src/components/QueryKey.tsx +3 -3
- package/src/components/QueryOptions.tsx +1 -1
- package/src/generators/infiniteQueryGenerator.tsx +22 -13
- package/src/generators/mutationGenerator.tsx +20 -12
- package/src/generators/queryGenerator.tsx +20 -12
- package/src/plugin.ts +32 -4
- package/src/resolvers/resolverVueQuery.ts +13 -2
- package/src/types.ts +72 -45
- package/dist/components-1cEftHJm.cjs.map +0 -1
- package/dist/components-DTSvTMEo.js.map +0 -1
- package/dist/generators-BEiWCS-U.cjs.map +0 -1
- package/dist/generators-F6_EduRU.js.map +0 -1
|
@@ -6,7 +6,7 @@ import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
|
|
|
6
6
|
type Transformer = (props: {
|
|
7
7
|
node: ast.OperationNode;
|
|
8
8
|
casing: 'camelcase' | undefined;
|
|
9
|
-
}) => unknown
|
|
9
|
+
}) => Array<unknown>;
|
|
10
10
|
/**
|
|
11
11
|
* Resolver for Vue Query that provides naming methods for hook functions.
|
|
12
12
|
*/
|
|
@@ -73,145 +73,172 @@ type ResolverVueQuery = Resolver & {
|
|
|
73
73
|
resolveInfiniteClientName(this: ResolverVueQuery, node: ast.OperationNode): string;
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* Builds the `queryKey` used by each generated query composable.
|
|
77
|
+
*
|
|
78
|
+
* @note String values are inlined verbatim into generated code. Wrap literal
|
|
79
|
+
* strings in `JSON.stringify(...)`.
|
|
77
80
|
*/
|
|
78
81
|
type QueryKey = Transformer;
|
|
79
82
|
/**
|
|
80
|
-
*
|
|
83
|
+
* Builds the `mutationKey` used by each generated mutation composable.
|
|
84
|
+
*
|
|
85
|
+
* @note String values are inlined verbatim into generated code. Wrap literal
|
|
86
|
+
* strings in `JSON.stringify(...)`.
|
|
81
87
|
*/
|
|
82
88
|
type MutationKey = Transformer;
|
|
83
89
|
type Query = {
|
|
84
90
|
/**
|
|
85
|
-
* HTTP methods
|
|
91
|
+
* HTTP methods treated as queries.
|
|
86
92
|
*
|
|
87
93
|
* @default ['get']
|
|
88
94
|
*/
|
|
89
95
|
methods?: Array<string>;
|
|
90
96
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* Path is used as-is; relative paths are based on the generated file location.
|
|
97
|
+
* Module specifier used in the `import { useQuery } from '...'` statement at
|
|
98
|
+
* the top of every generated composable file.
|
|
99
|
+
*
|
|
95
100
|
* @default '@tanstack/vue-query'
|
|
96
101
|
*/
|
|
97
102
|
importPath?: string;
|
|
98
103
|
};
|
|
99
104
|
type Mutation = {
|
|
100
105
|
/**
|
|
101
|
-
* HTTP methods
|
|
106
|
+
* HTTP methods treated as mutations.
|
|
102
107
|
*
|
|
103
108
|
* @default ['post', 'put', 'delete']
|
|
104
109
|
*/
|
|
105
110
|
methods?: Array<string>;
|
|
106
111
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* Path is used as-is; relative paths are based on the generated file location.
|
|
112
|
+
* Module specifier used in the `import { useMutation } from '...'` statement
|
|
113
|
+
* at the top of every generated composable file.
|
|
114
|
+
*
|
|
111
115
|
* @default '@tanstack/vue-query'
|
|
112
116
|
*/
|
|
113
117
|
importPath?: string;
|
|
114
118
|
};
|
|
115
119
|
type Infinite = {
|
|
116
120
|
/**
|
|
117
|
-
*
|
|
121
|
+
* Name of the query parameter that holds the page cursor.
|
|
122
|
+
*
|
|
118
123
|
* @default 'id'
|
|
119
124
|
*/
|
|
120
|
-
queryParam
|
|
125
|
+
queryParam?: string;
|
|
121
126
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
127
|
+
* Path to the cursor field on the response. Leave undefined when the cursor
|
|
128
|
+
* is not known.
|
|
129
|
+
*
|
|
130
|
+
* @deprecated Use `nextParam` and `previousParam` for richer pagination control.
|
|
124
131
|
*/
|
|
125
|
-
cursorParam?: string |
|
|
132
|
+
cursorParam?: string | null;
|
|
126
133
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
134
|
+
* Path to the next-page cursor on the response. Supports dot notation
|
|
135
|
+
* (`'pagination.next.id'`) or array form.
|
|
129
136
|
*/
|
|
130
|
-
nextParam?: string | string
|
|
137
|
+
nextParam?: string | Array<string> | null;
|
|
131
138
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
139
|
+
* Path to the previous-page cursor on the response. Supports dot notation
|
|
140
|
+
* or array form.
|
|
134
141
|
*/
|
|
135
|
-
previousParam?: string | string
|
|
142
|
+
previousParam?: string | Array<string> | null;
|
|
136
143
|
/**
|
|
137
|
-
*
|
|
144
|
+
* Initial value for `pageParam` on the first fetch.
|
|
145
|
+
*
|
|
138
146
|
* @default 0
|
|
139
147
|
*/
|
|
140
|
-
initialPageParam
|
|
148
|
+
initialPageParam?: unknown;
|
|
141
149
|
};
|
|
142
150
|
type Options = {
|
|
143
151
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
152
|
+
* Where the generated composables are written and how they are exported.
|
|
153
|
+
*
|
|
154
|
+
* @default { path: 'hooks', barrel: { type: 'named' } }
|
|
146
155
|
*/
|
|
147
156
|
output?: Output;
|
|
148
157
|
/**
|
|
149
|
-
*
|
|
158
|
+
* Split generated files into subfolders based on the operation's tag.
|
|
150
159
|
*/
|
|
151
160
|
group?: Group;
|
|
161
|
+
/**
|
|
162
|
+
* HTTP client used inside every generated composable. Mirrors a subset of
|
|
163
|
+
* `pluginClient` options.
|
|
164
|
+
*/
|
|
152
165
|
client?: ClientImportPath & Pick<PluginClient['options'], 'clientType' | 'dataReturnType' | 'baseURL' | 'bundle' | 'paramsCasing'>;
|
|
153
166
|
/**
|
|
154
|
-
*
|
|
167
|
+
* Skip operations matching at least one entry in the list.
|
|
155
168
|
*/
|
|
156
169
|
exclude?: Array<Exclude>;
|
|
157
170
|
/**
|
|
158
|
-
*
|
|
171
|
+
* Restrict generation to operations matching at least one entry in the list.
|
|
159
172
|
*/
|
|
160
173
|
include?: Array<Include>;
|
|
161
174
|
/**
|
|
162
|
-
*
|
|
175
|
+
* Apply a different options object to operations matching a pattern.
|
|
163
176
|
*/
|
|
164
177
|
override?: Array<Override<ResolvedOptions>>;
|
|
165
178
|
/**
|
|
166
|
-
*
|
|
179
|
+
* Rename parameter properties in the generated composables.
|
|
180
|
+
*
|
|
181
|
+
* @note Must match the value of `paramsCasing` on `@kubb/plugin-ts`.
|
|
167
182
|
*/
|
|
168
183
|
paramsCasing?: 'camelcase';
|
|
169
184
|
/**
|
|
170
|
-
* How parameters
|
|
185
|
+
* How operation parameters appear in the generated composable signature.
|
|
171
186
|
*
|
|
172
187
|
* @default 'inline'
|
|
173
188
|
*/
|
|
174
189
|
paramsType?: 'object' | 'inline';
|
|
175
190
|
/**
|
|
176
|
-
* How path parameters are
|
|
191
|
+
* How URL path parameters are arranged inside the inline argument list.
|
|
177
192
|
*
|
|
178
193
|
* @default 'inline'
|
|
179
194
|
*/
|
|
180
195
|
pathParamsType?: PluginClient['options']['pathParamsType'];
|
|
181
196
|
/**
|
|
182
|
-
*
|
|
197
|
+
* Enables `useInfiniteQuery` composables for cursor- or page-based pagination.
|
|
198
|
+
* Pass an object to configure how the cursor is read; pass `false` to skip.
|
|
199
|
+
*
|
|
200
|
+
* @default false
|
|
183
201
|
*/
|
|
184
202
|
infinite?: Partial<Infinite> | false;
|
|
203
|
+
/**
|
|
204
|
+
* Custom `queryKey` builder.
|
|
205
|
+
*/
|
|
185
206
|
queryKey?: QueryKey;
|
|
186
207
|
/**
|
|
187
|
-
*
|
|
208
|
+
* Configures query composables. Set to `false` to skip composable generation
|
|
209
|
+
* and emit only `queryOptions(...)` helpers.
|
|
188
210
|
*/
|
|
189
211
|
query?: Partial<Query> | false;
|
|
212
|
+
/**
|
|
213
|
+
* Custom `mutationKey` builder.
|
|
214
|
+
*/
|
|
190
215
|
mutationKey?: MutationKey;
|
|
191
216
|
/**
|
|
192
|
-
*
|
|
217
|
+
* Configures mutation composables. Set to `false` to skip mutation generation.
|
|
193
218
|
*/
|
|
194
219
|
mutation?: Partial<Mutation> | false;
|
|
195
220
|
/**
|
|
196
|
-
*
|
|
221
|
+
* Validator applied to response bodies before they reach the caller.
|
|
222
|
+
* - `'client'` — no validation.
|
|
223
|
+
* - `'zod'` — pipes responses through schemas from `@kubb/plugin-zod`.
|
|
197
224
|
*/
|
|
198
225
|
parser?: PluginClient['options']['parser'];
|
|
199
226
|
/**
|
|
200
|
-
* Override
|
|
227
|
+
* Override how composable names and file paths are built.
|
|
201
228
|
*/
|
|
202
229
|
resolver?: Partial<ResolverVueQuery> & ThisType<ResolverVueQuery>;
|
|
203
230
|
/**
|
|
204
|
-
* AST visitor to
|
|
231
|
+
* AST visitor applied to each operation node before printing.
|
|
205
232
|
*/
|
|
206
233
|
transformer?: ast.Visitor;
|
|
207
234
|
/**
|
|
208
|
-
*
|
|
235
|
+
* Custom generators that run alongside the built-in Vue Query generators.
|
|
209
236
|
*/
|
|
210
237
|
generators?: Array<Generator<PluginVueQuery>>;
|
|
211
238
|
};
|
|
212
239
|
type ResolvedOptions = {
|
|
213
240
|
output: Output;
|
|
214
|
-
group: Group |
|
|
241
|
+
group: Group | null;
|
|
215
242
|
exclude: NonNullable<Options['exclude']>;
|
|
216
243
|
include: Options['include'];
|
|
217
244
|
override: NonNullable<Options['override']>;
|
|
@@ -224,9 +251,9 @@ type ResolvedOptions = {
|
|
|
224
251
|
* Only used for infinite
|
|
225
252
|
*/
|
|
226
253
|
infinite: NonNullable<Infinite> | false;
|
|
227
|
-
queryKey: QueryKey |
|
|
254
|
+
queryKey: QueryKey | null;
|
|
228
255
|
query: NonNullable<Required<Query>> | false;
|
|
229
|
-
mutationKey: MutationKey |
|
|
256
|
+
mutationKey: MutationKey | null;
|
|
230
257
|
mutation: NonNullable<Required<Mutation>> | false;
|
|
231
258
|
resolver: ResolverVueQuery;
|
|
232
259
|
};
|
|
@@ -240,4 +267,4 @@ declare global {
|
|
|
240
267
|
}
|
|
241
268
|
//#endregion
|
|
242
269
|
export { Transformer as i, Options as n, PluginVueQuery as r, Infinite as t };
|
|
243
|
-
//# sourceMappingURL=types-
|
|
270
|
+
//# sourceMappingURL=types-D-LjzI_Q.d.ts.map
|