@kubb/plugin-vue-query 5.11.0 → 5.11.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/index.cjs +243 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -36
- package/dist/index.d.ts +48 -36
- package/dist/index.js +244 -189
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileNode, Macro, OperationNode, StatusCode } from "@kubb/ast";
|
|
2
|
+
import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch } from "@kubb/kit";
|
|
2
3
|
import { ResolverTs } from "@kubb/plugin-ts";
|
|
3
4
|
/**
|
|
4
5
|
* The client selector accepted by a consumer's `client` option. Each calls a registered contract
|
|
@@ -23,15 +24,15 @@ type OperationTypeNames = {
|
|
|
23
24
|
/**
|
|
24
25
|
* Resolves the name of the operation's grouped `{ body, path, query, headers, cookies }` input type.
|
|
25
26
|
*/
|
|
26
|
-
options(node:
|
|
27
|
+
options(node: OperationNode): string;
|
|
27
28
|
/**
|
|
28
29
|
* Resolves the name of the operation's per-status responses record type.
|
|
29
30
|
*/
|
|
30
|
-
responses(node:
|
|
31
|
+
responses(node: OperationNode): string;
|
|
31
32
|
/**
|
|
32
33
|
* Resolves the name of the type of the headers one response declares. Left out, results keep untyped headers.
|
|
33
34
|
*/
|
|
34
|
-
headers?(node:
|
|
35
|
+
headers?(node: OperationNode, statusCode: StatusCode): string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
@@ -74,7 +75,7 @@ type KeyVariant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfinit
|
|
|
74
75
|
* Receives `variant` indicating which hook or composable the key is built for.
|
|
75
76
|
*/
|
|
76
77
|
type Transformer = (props: {
|
|
77
|
-
node:
|
|
78
|
+
node: OperationNode;
|
|
78
79
|
casing: ParamsCasing;
|
|
79
80
|
variant: KeyVariant;
|
|
80
81
|
}) => Array<unknown>;
|
|
@@ -207,7 +208,7 @@ declare global {
|
|
|
207
208
|
namespace Kubb {
|
|
208
209
|
interface MemoRegistry {
|
|
209
210
|
operation: string;
|
|
210
|
-
file:
|
|
211
|
+
file: FileNode['baseName'];
|
|
211
212
|
operationTypeNames: Array<string>;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
@@ -232,6 +233,34 @@ declare global {
|
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* The options every plugin accepts: `output`, `group`, and the `exclude`, `include`, and `override` filters.
|
|
238
|
+
* `TResolvedOptions` is the options object an `override` entry can set.
|
|
239
|
+
*/
|
|
240
|
+
type PluginOptions<TResolvedOptions> = OutputOptions & {
|
|
241
|
+
/**
|
|
242
|
+
* Skip operations matching at least one entry in the list.
|
|
243
|
+
*/
|
|
244
|
+
exclude?: Array<Exclude>;
|
|
245
|
+
/**
|
|
246
|
+
* Restrict generation to operations matching at least one entry in the list.
|
|
247
|
+
*/
|
|
248
|
+
include?: Array<Include>;
|
|
249
|
+
/**
|
|
250
|
+
* Apply a different options object to operations matching a pattern.
|
|
251
|
+
*/
|
|
252
|
+
override?: Array<Override<TResolvedOptions>>;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* The common options after a plugin applies its defaults.
|
|
256
|
+
*/
|
|
257
|
+
interface ResolvedPluginOptions<TResolvedOptions> {
|
|
258
|
+
output: Output;
|
|
259
|
+
exclude: Array<Exclude>;
|
|
260
|
+
include: Array<Include> | undefined;
|
|
261
|
+
override: Array<Override<TResolvedOptions>>;
|
|
262
|
+
group: Group | null;
|
|
263
|
+
}
|
|
235
264
|
/**
|
|
236
265
|
* Resolver for Vue Query that provides naming methods for hook functions.
|
|
237
266
|
*/
|
|
@@ -243,19 +272,19 @@ type ResolverVueQuery = Resolver & {
|
|
|
243
272
|
/**
|
|
244
273
|
* Resolves a query hook function name.
|
|
245
274
|
*/
|
|
246
|
-
name(node:
|
|
275
|
+
name(node: OperationNode): string;
|
|
247
276
|
/**
|
|
248
277
|
* Resolves the query key helper name.
|
|
249
278
|
*/
|
|
250
|
-
keyName(node:
|
|
279
|
+
keyName(node: OperationNode): string;
|
|
251
280
|
/**
|
|
252
281
|
* Resolves the query key type name.
|
|
253
282
|
*/
|
|
254
|
-
keyTypeName(node:
|
|
283
|
+
keyTypeName(node: OperationNode): string;
|
|
255
284
|
/**
|
|
256
285
|
* Resolves the query options helper name.
|
|
257
286
|
*/
|
|
258
|
-
optionsName(node:
|
|
287
|
+
optionsName(node: OperationNode): string;
|
|
259
288
|
};
|
|
260
289
|
/**
|
|
261
290
|
* Names for an infinite query operation: its `useInfiniteQuery` composable, key helpers, and
|
|
@@ -265,19 +294,19 @@ type ResolverVueQuery = Resolver & {
|
|
|
265
294
|
/**
|
|
266
295
|
* Resolves an infinite query hook function name.
|
|
267
296
|
*/
|
|
268
|
-
name(node:
|
|
297
|
+
name(node: OperationNode): string;
|
|
269
298
|
/**
|
|
270
299
|
* Resolves the infinite query key helper name.
|
|
271
300
|
*/
|
|
272
|
-
keyName(node:
|
|
301
|
+
keyName(node: OperationNode): string;
|
|
273
302
|
/**
|
|
274
303
|
* Resolves the infinite query key type name.
|
|
275
304
|
*/
|
|
276
|
-
keyTypeName(node:
|
|
305
|
+
keyTypeName(node: OperationNode): string;
|
|
277
306
|
/**
|
|
278
307
|
* Resolves the infinite query options helper name.
|
|
279
308
|
*/
|
|
280
|
-
optionsName(node:
|
|
309
|
+
optionsName(node: OperationNode): string;
|
|
281
310
|
};
|
|
282
311
|
/**
|
|
283
312
|
* Names for a mutation operation: its `useMutation` composable and key helper.
|
|
@@ -286,11 +315,11 @@ type ResolverVueQuery = Resolver & {
|
|
|
286
315
|
/**
|
|
287
316
|
* Resolves a mutation hook function name.
|
|
288
317
|
*/
|
|
289
|
-
name(node:
|
|
318
|
+
name(node: OperationNode): string;
|
|
290
319
|
/**
|
|
291
320
|
* Resolves the mutation key helper name.
|
|
292
321
|
*/
|
|
293
|
-
keyName(node:
|
|
322
|
+
keyName(node: OperationNode): string;
|
|
294
323
|
};
|
|
295
324
|
};
|
|
296
325
|
/**
|
|
@@ -314,7 +343,7 @@ type MutationKey = Transformer;
|
|
|
314
343
|
*
|
|
315
344
|
* @default { path: 'hooks', barrel: { type: 'named' } }
|
|
316
345
|
*/
|
|
317
|
-
type Options =
|
|
346
|
+
type Options = PluginOptions<ResolvedOptions> & {
|
|
318
347
|
/**
|
|
319
348
|
* Selects the HTTP client the generated composables call. Every client plugin speaks the `RequestResult`
|
|
320
349
|
* contract, so the composables call a contract `<op>` that takes one grouped `options` object.
|
|
@@ -331,18 +360,6 @@ type Options = OutputOptions & {
|
|
|
331
360
|
* @default 'data'
|
|
332
361
|
*/
|
|
333
362
|
returnType?: 'data' | 'full';
|
|
334
|
-
/**
|
|
335
|
-
* Skip operations matching at least one entry in the list.
|
|
336
|
-
*/
|
|
337
|
-
exclude?: Array<Exclude>;
|
|
338
|
-
/**
|
|
339
|
-
* Restrict generation to operations matching at least one entry in the list.
|
|
340
|
-
*/
|
|
341
|
-
include?: Array<Include>;
|
|
342
|
-
/**
|
|
343
|
-
* Apply a different options object to operations matching a pattern.
|
|
344
|
-
*/
|
|
345
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
346
363
|
/**
|
|
347
364
|
* Enables `useInfiniteQuery` composables for cursor- or page-based pagination.
|
|
348
365
|
* Pass an object to configure how the cursor is read, or pass `false` to skip.
|
|
@@ -381,19 +398,14 @@ type Options = OutputOptions & {
|
|
|
381
398
|
/**
|
|
382
399
|
* Macros applied to each operation node before printing.
|
|
383
400
|
*/
|
|
384
|
-
macros?: Array<
|
|
401
|
+
macros?: Array<Macro>;
|
|
385
402
|
};
|
|
386
403
|
/**
|
|
387
404
|
* The resolved client strategy for the generated composables, computed once during setup. The
|
|
388
405
|
* composables always import and call a registered contract client plugin's `<op>`.
|
|
389
406
|
*/
|
|
390
407
|
type ResolvedClient = ResolvedContractClient;
|
|
391
|
-
type ResolvedOptions = {
|
|
392
|
-
output: Output;
|
|
393
|
-
group: Group | null;
|
|
394
|
-
exclude: NonNullable<Options['exclude']>;
|
|
395
|
-
include: Options['include'];
|
|
396
|
-
override: NonNullable<Options['override']>;
|
|
408
|
+
type ResolvedOptions = ResolvedPluginOptions<ResolvedOptions> & {
|
|
397
409
|
/**
|
|
398
410
|
* The resolved contract client the generators import and call.
|
|
399
411
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileNode, Macro, OperationNode, StatusCode } from "@kubb/ast";
|
|
2
|
+
import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch } from "@kubb/kit";
|
|
2
3
|
import { ResolverTs } from "@kubb/plugin-ts";
|
|
3
4
|
/**
|
|
4
5
|
* The client selector accepted by a consumer's `client` option. Each calls a registered contract
|
|
@@ -23,15 +24,15 @@ type OperationTypeNames = {
|
|
|
23
24
|
/**
|
|
24
25
|
* Resolves the name of the operation's grouped `{ body, path, query, headers, cookies }` input type.
|
|
25
26
|
*/
|
|
26
|
-
options(node:
|
|
27
|
+
options(node: OperationNode): string;
|
|
27
28
|
/**
|
|
28
29
|
* Resolves the name of the operation's per-status responses record type.
|
|
29
30
|
*/
|
|
30
|
-
responses(node:
|
|
31
|
+
responses(node: OperationNode): string;
|
|
31
32
|
/**
|
|
32
33
|
* Resolves the name of the type of the headers one response declares. Left out, results keep untyped headers.
|
|
33
34
|
*/
|
|
34
|
-
headers?(node:
|
|
35
|
+
headers?(node: OperationNode, statusCode: StatusCode): string;
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
@@ -74,7 +75,7 @@ type KeyVariant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfinit
|
|
|
74
75
|
* Receives `variant` indicating which hook or composable the key is built for.
|
|
75
76
|
*/
|
|
76
77
|
type Transformer = (props: {
|
|
77
|
-
node:
|
|
78
|
+
node: OperationNode;
|
|
78
79
|
casing: ParamsCasing;
|
|
79
80
|
variant: KeyVariant;
|
|
80
81
|
}) => Array<unknown>;
|
|
@@ -207,7 +208,7 @@ declare global {
|
|
|
207
208
|
namespace Kubb {
|
|
208
209
|
interface MemoRegistry {
|
|
209
210
|
operation: string;
|
|
210
|
-
file:
|
|
211
|
+
file: FileNode['baseName'];
|
|
211
212
|
operationTypeNames: Array<string>;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
@@ -232,6 +233,34 @@ declare global {
|
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* The options every plugin accepts: `output`, `group`, and the `exclude`, `include`, and `override` filters.
|
|
238
|
+
* `TResolvedOptions` is the options object an `override` entry can set.
|
|
239
|
+
*/
|
|
240
|
+
type PluginOptions<TResolvedOptions> = OutputOptions & {
|
|
241
|
+
/**
|
|
242
|
+
* Skip operations matching at least one entry in the list.
|
|
243
|
+
*/
|
|
244
|
+
exclude?: Array<Exclude>;
|
|
245
|
+
/**
|
|
246
|
+
* Restrict generation to operations matching at least one entry in the list.
|
|
247
|
+
*/
|
|
248
|
+
include?: Array<Include>;
|
|
249
|
+
/**
|
|
250
|
+
* Apply a different options object to operations matching a pattern.
|
|
251
|
+
*/
|
|
252
|
+
override?: Array<Override<TResolvedOptions>>;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* The common options after a plugin applies its defaults.
|
|
256
|
+
*/
|
|
257
|
+
interface ResolvedPluginOptions<TResolvedOptions> {
|
|
258
|
+
output: Output;
|
|
259
|
+
exclude: Array<Exclude>;
|
|
260
|
+
include: Array<Include> | undefined;
|
|
261
|
+
override: Array<Override<TResolvedOptions>>;
|
|
262
|
+
group: Group | null;
|
|
263
|
+
}
|
|
235
264
|
/**
|
|
236
265
|
* Resolver for Vue Query that provides naming methods for hook functions.
|
|
237
266
|
*/
|
|
@@ -243,19 +272,19 @@ type ResolverVueQuery = Resolver & {
|
|
|
243
272
|
/**
|
|
244
273
|
* Resolves a query hook function name.
|
|
245
274
|
*/
|
|
246
|
-
name(node:
|
|
275
|
+
name(node: OperationNode): string;
|
|
247
276
|
/**
|
|
248
277
|
* Resolves the query key helper name.
|
|
249
278
|
*/
|
|
250
|
-
keyName(node:
|
|
279
|
+
keyName(node: OperationNode): string;
|
|
251
280
|
/**
|
|
252
281
|
* Resolves the query key type name.
|
|
253
282
|
*/
|
|
254
|
-
keyTypeName(node:
|
|
283
|
+
keyTypeName(node: OperationNode): string;
|
|
255
284
|
/**
|
|
256
285
|
* Resolves the query options helper name.
|
|
257
286
|
*/
|
|
258
|
-
optionsName(node:
|
|
287
|
+
optionsName(node: OperationNode): string;
|
|
259
288
|
};
|
|
260
289
|
/**
|
|
261
290
|
* Names for an infinite query operation: its `useInfiniteQuery` composable, key helpers, and
|
|
@@ -265,19 +294,19 @@ type ResolverVueQuery = Resolver & {
|
|
|
265
294
|
/**
|
|
266
295
|
* Resolves an infinite query hook function name.
|
|
267
296
|
*/
|
|
268
|
-
name(node:
|
|
297
|
+
name(node: OperationNode): string;
|
|
269
298
|
/**
|
|
270
299
|
* Resolves the infinite query key helper name.
|
|
271
300
|
*/
|
|
272
|
-
keyName(node:
|
|
301
|
+
keyName(node: OperationNode): string;
|
|
273
302
|
/**
|
|
274
303
|
* Resolves the infinite query key type name.
|
|
275
304
|
*/
|
|
276
|
-
keyTypeName(node:
|
|
305
|
+
keyTypeName(node: OperationNode): string;
|
|
277
306
|
/**
|
|
278
307
|
* Resolves the infinite query options helper name.
|
|
279
308
|
*/
|
|
280
|
-
optionsName(node:
|
|
309
|
+
optionsName(node: OperationNode): string;
|
|
281
310
|
};
|
|
282
311
|
/**
|
|
283
312
|
* Names for a mutation operation: its `useMutation` composable and key helper.
|
|
@@ -286,11 +315,11 @@ type ResolverVueQuery = Resolver & {
|
|
|
286
315
|
/**
|
|
287
316
|
* Resolves a mutation hook function name.
|
|
288
317
|
*/
|
|
289
|
-
name(node:
|
|
318
|
+
name(node: OperationNode): string;
|
|
290
319
|
/**
|
|
291
320
|
* Resolves the mutation key helper name.
|
|
292
321
|
*/
|
|
293
|
-
keyName(node:
|
|
322
|
+
keyName(node: OperationNode): string;
|
|
294
323
|
};
|
|
295
324
|
};
|
|
296
325
|
/**
|
|
@@ -314,7 +343,7 @@ type MutationKey = Transformer;
|
|
|
314
343
|
*
|
|
315
344
|
* @default { path: 'hooks', barrel: { type: 'named' } }
|
|
316
345
|
*/
|
|
317
|
-
type Options =
|
|
346
|
+
type Options = PluginOptions<ResolvedOptions> & {
|
|
318
347
|
/**
|
|
319
348
|
* Selects the HTTP client the generated composables call. Every client plugin speaks the `RequestResult`
|
|
320
349
|
* contract, so the composables call a contract `<op>` that takes one grouped `options` object.
|
|
@@ -331,18 +360,6 @@ type Options = OutputOptions & {
|
|
|
331
360
|
* @default 'data'
|
|
332
361
|
*/
|
|
333
362
|
returnType?: 'data' | 'full';
|
|
334
|
-
/**
|
|
335
|
-
* Skip operations matching at least one entry in the list.
|
|
336
|
-
*/
|
|
337
|
-
exclude?: Array<Exclude>;
|
|
338
|
-
/**
|
|
339
|
-
* Restrict generation to operations matching at least one entry in the list.
|
|
340
|
-
*/
|
|
341
|
-
include?: Array<Include>;
|
|
342
|
-
/**
|
|
343
|
-
* Apply a different options object to operations matching a pattern.
|
|
344
|
-
*/
|
|
345
|
-
override?: Array<Override<ResolvedOptions>>;
|
|
346
363
|
/**
|
|
347
364
|
* Enables `useInfiniteQuery` composables for cursor- or page-based pagination.
|
|
348
365
|
* Pass an object to configure how the cursor is read, or pass `false` to skip.
|
|
@@ -381,19 +398,14 @@ type Options = OutputOptions & {
|
|
|
381
398
|
/**
|
|
382
399
|
* Macros applied to each operation node before printing.
|
|
383
400
|
*/
|
|
384
|
-
macros?: Array<
|
|
401
|
+
macros?: Array<Macro>;
|
|
385
402
|
};
|
|
386
403
|
/**
|
|
387
404
|
* The resolved client strategy for the generated composables, computed once during setup. The
|
|
388
405
|
* composables always import and call a registered contract client plugin's `<op>`.
|
|
389
406
|
*/
|
|
390
407
|
type ResolvedClient = ResolvedContractClient;
|
|
391
|
-
type ResolvedOptions = {
|
|
392
|
-
output: Output;
|
|
393
|
-
group: Group | null;
|
|
394
|
-
exclude: NonNullable<Options['exclude']>;
|
|
395
|
-
include: Options['include'];
|
|
396
|
-
override: NonNullable<Options['override']>;
|
|
408
|
+
type ResolvedOptions = ResolvedPluginOptions<ResolvedOptions> & {
|
|
397
409
|
/**
|
|
398
410
|
* The resolved contract client the generators import and call.
|
|
399
411
|
*/
|