@kubb/plugin-vue-query 5.14.0-canary.20261124T213240 → 5.14.0
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 +4 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -60
- package/dist/index.d.ts +58 -60
- package/dist/index.js +4 -10
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
package/dist/index.d.cts
CHANGED
|
@@ -57,20 +57,23 @@ type ParamsCasing = 'camelcase' | undefined;
|
|
|
57
57
|
* caches `InfiniteData` and must never share one with a plain query.
|
|
58
58
|
*/
|
|
59
59
|
type KeyVariant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfiniteQuery' | 'mutation';
|
|
60
|
+
type KeyTransformerProps = {
|
|
61
|
+
node: OperationNode;
|
|
62
|
+
casing: ParamsCasing;
|
|
63
|
+
variant: KeyVariant;
|
|
64
|
+
};
|
|
60
65
|
/**
|
|
61
66
|
* Builds query or mutation key segments for an operation node.
|
|
62
67
|
* Receives `variant` indicating which hook or composable the key is built for.
|
|
63
68
|
*/
|
|
64
|
-
type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
variant: KeyVariant;
|
|
68
|
-
}) => Array<unknown>;
|
|
69
|
+
type KeyTransformer = (props: KeyTransformerProps) => Array<unknown>;
|
|
70
|
+
/** @deprecated Use `KeyTransformer`. Removed in v6. */
|
|
71
|
+
type Transformer = KeyTransformer;
|
|
69
72
|
/**
|
|
70
73
|
* Configures the query side of a TanStack-family plugin: which HTTP methods produce query
|
|
71
74
|
* hooks and where the query runtime is imported from.
|
|
72
75
|
*/
|
|
73
|
-
type
|
|
76
|
+
type QueryConfig = {
|
|
74
77
|
/**
|
|
75
78
|
* HTTP methods treated as queries. Operations using these methods produce
|
|
76
79
|
* `useQuery`-style hooks.
|
|
@@ -90,7 +93,7 @@ type Query = {
|
|
|
90
93
|
* Configures the mutation side of a TanStack-family plugin: which HTTP methods produce
|
|
91
94
|
* mutation hooks and where the mutation runtime is imported from.
|
|
92
95
|
*/
|
|
93
|
-
type
|
|
96
|
+
type MutationConfig = {
|
|
94
97
|
/**
|
|
95
98
|
* HTTP methods treated as mutations. Operations using these methods produce
|
|
96
99
|
* `useMutation`-style hooks.
|
|
@@ -105,7 +108,7 @@ type Mutation = {
|
|
|
105
108
|
*/
|
|
106
109
|
importPath?: string;
|
|
107
110
|
};
|
|
108
|
-
type
|
|
111
|
+
type InfiniteConfig = {
|
|
109
112
|
/**
|
|
110
113
|
* Name of the query parameter that holds the page cursor.
|
|
111
114
|
*
|
|
@@ -179,7 +182,7 @@ type PageParamFn<TPage = any, TParam = any> = (page: TPage, allPages: Array<TPag
|
|
|
179
182
|
* mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
|
|
180
183
|
* ```
|
|
181
184
|
*/
|
|
182
|
-
export declare const mutationKeyTransformer:
|
|
185
|
+
export declare const mutationKeyTransformer: KeyTransformer;
|
|
183
186
|
/**
|
|
184
187
|
* Default `queryKey` builder. Call it from a custom builder to extend the default key.
|
|
185
188
|
*
|
|
@@ -190,35 +193,7 @@ export declare const mutationKeyTransformer: Transformer;
|
|
|
190
193
|
* queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
|
|
191
194
|
* ```
|
|
192
195
|
*/
|
|
193
|
-
export declare const queryKeyTransformer:
|
|
194
|
-
declare global {
|
|
195
|
-
namespace Kubb {
|
|
196
|
-
interface MemoRegistry {
|
|
197
|
-
operation: string;
|
|
198
|
-
operationTypeNames: Array<string>;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
type ResponseTypes = {
|
|
203
|
-
TData: string;
|
|
204
|
-
TError: string;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* Helper to define a typed page param function for `infinite.getNextPageParam` or
|
|
208
|
-
* `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.
|
|
209
|
-
*
|
|
210
|
-
* Note: Because the function is inlined verbatim into the generated file via `.toString()`,
|
|
211
|
-
* it must be self-contained and cannot reference local closures or external variables from
|
|
212
|
-
* the config file.
|
|
213
|
-
*/
|
|
214
|
-
export declare function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string;
|
|
215
|
-
declare global {
|
|
216
|
-
namespace Kubb {
|
|
217
|
-
interface MemoRegistry {
|
|
218
|
-
responseTypes: ResponseTypes;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
196
|
+
export declare const queryKeyTransformer: KeyTransformer;
|
|
222
197
|
/**
|
|
223
198
|
* The options every plugin accepts: `output`, `group`, and the `exclude`, `include`, and `override` filters.
|
|
224
199
|
* `TResolvedOptions` is the options object an `override` entry can set.
|
|
@@ -247,6 +222,34 @@ interface ResolvedPluginOptions<TResolvedOptions> {
|
|
|
247
222
|
override: Array<Override<TResolvedOptions>>;
|
|
248
223
|
group: Group | null;
|
|
249
224
|
}
|
|
225
|
+
declare global {
|
|
226
|
+
namespace Kubb {
|
|
227
|
+
interface MemoRegistry {
|
|
228
|
+
operation: string;
|
|
229
|
+
operationTypeNames: Array<string>;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
type ResponseTypes = {
|
|
234
|
+
TData: string;
|
|
235
|
+
TError: string;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Helper to define a typed page param function for `infinite.getNextPageParam` or
|
|
239
|
+
* `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.
|
|
240
|
+
*
|
|
241
|
+
* Note: Because the function is inlined verbatim into the generated file via `.toString()`,
|
|
242
|
+
* it must be self-contained and cannot reference local closures or external variables from
|
|
243
|
+
* the config file.
|
|
244
|
+
*/
|
|
245
|
+
export declare function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string;
|
|
246
|
+
declare global {
|
|
247
|
+
namespace Kubb {
|
|
248
|
+
interface MemoRegistry {
|
|
249
|
+
responseTypes: ResponseTypes;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
250
253
|
/**
|
|
251
254
|
* Resolver for Vue Query that provides naming methods for hook functions.
|
|
252
255
|
*/
|
|
@@ -315,21 +318,21 @@ type ResolverVueQuery = Resolver & {
|
|
|
315
318
|
* @note String values are inlined verbatim into generated code. Wrap literal
|
|
316
319
|
* strings in `JSON.stringify(...)`.
|
|
317
320
|
*/
|
|
318
|
-
type
|
|
321
|
+
type QueryKeyTransformer = KeyTransformer;
|
|
319
322
|
/**
|
|
320
323
|
* Builds the `mutationKey` used by each generated mutation composable.
|
|
321
324
|
*
|
|
322
325
|
* @note String values are inlined verbatim into generated code. Wrap literal
|
|
323
326
|
* strings in `JSON.stringify(...)`.
|
|
324
327
|
*/
|
|
325
|
-
type
|
|
328
|
+
type MutationKeyTransformer = KeyTransformer;
|
|
326
329
|
/**
|
|
327
330
|
* Where the generated composables are written and how they are exported, plus the optional
|
|
328
331
|
* `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
|
|
329
332
|
*
|
|
330
333
|
* @default { path: 'hooks', barrel: { type: 'named' } }
|
|
331
334
|
*/
|
|
332
|
-
type
|
|
335
|
+
type PluginVueQueryOptions = PluginOptions<PluginVueQueryResolvedOptions> & {
|
|
333
336
|
/**
|
|
334
337
|
* Selects the HTTP client the generated composables call. Every client plugin speaks the `RequestResult`
|
|
335
338
|
* contract, so the composables call a contract `<op>` that takes one grouped `options` object.
|
|
@@ -352,23 +355,23 @@ type Options = PluginOptions<ResolvedOptions> & {
|
|
|
352
355
|
*
|
|
353
356
|
* @default false
|
|
354
357
|
*/
|
|
355
|
-
infinite?: Partial<
|
|
358
|
+
infinite?: Partial<InfiniteConfig> | false;
|
|
356
359
|
/**
|
|
357
360
|
* Custom `queryKey` builder.
|
|
358
361
|
*/
|
|
359
|
-
queryKey?:
|
|
362
|
+
queryKey?: QueryKeyTransformer;
|
|
360
363
|
/**
|
|
361
364
|
* Configures query composables. Set to `false` to skip the query output.
|
|
362
365
|
*/
|
|
363
|
-
query?: Partial<
|
|
366
|
+
query?: Partial<QueryConfig> | false;
|
|
364
367
|
/**
|
|
365
368
|
* Custom `mutationKey` builder.
|
|
366
369
|
*/
|
|
367
|
-
mutationKey?:
|
|
370
|
+
mutationKey?: MutationKeyTransformer;
|
|
368
371
|
/**
|
|
369
372
|
* Configures mutation composables. Set to `false` to skip mutation generation.
|
|
370
373
|
*/
|
|
371
|
-
mutation?: Partial<
|
|
374
|
+
mutation?: Partial<MutationConfig> | false;
|
|
372
375
|
/**
|
|
373
376
|
* Override how composable names and file paths are built.
|
|
374
377
|
*/
|
|
@@ -385,29 +388,24 @@ type Options = PluginOptions<ResolvedOptions> & {
|
|
|
385
388
|
*/
|
|
386
389
|
macros?: Array<Macro>;
|
|
387
390
|
};
|
|
388
|
-
|
|
389
|
-
* The resolved client strategy for the generated composables, computed once during setup. The
|
|
390
|
-
* composables always import and call a registered contract client plugin's `<op>`.
|
|
391
|
-
*/
|
|
392
|
-
type ResolvedClient = ResolvedContractClient;
|
|
393
|
-
type ResolvedOptions = ResolvedPluginOptions<ResolvedOptions> & {
|
|
391
|
+
type PluginVueQueryResolvedOptions = ResolvedPluginOptions<PluginVueQueryResolvedOptions> & {
|
|
394
392
|
/**
|
|
395
393
|
* The resolved contract client the generators import and call.
|
|
396
394
|
*/
|
|
397
|
-
client:
|
|
395
|
+
client: ResolvedContractClient;
|
|
398
396
|
returnType?: 'data' | 'full';
|
|
399
397
|
/**
|
|
400
398
|
* Resolved infinite query configuration, or `false` when infinite queries are disabled.
|
|
401
399
|
*/
|
|
402
|
-
infinite: NonNullable<
|
|
403
|
-
queryKey:
|
|
404
|
-
query: NonNullable<Required<
|
|
405
|
-
mutationKey:
|
|
406
|
-
mutation: NonNullable<Required<
|
|
400
|
+
infinite: NonNullable<InfiniteConfig> | false;
|
|
401
|
+
queryKey: QueryKeyTransformer | null;
|
|
402
|
+
query: NonNullable<Required<QueryConfig>> | false;
|
|
403
|
+
mutationKey: MutationKeyTransformer | null;
|
|
404
|
+
mutation: NonNullable<Required<MutationConfig>> | false;
|
|
407
405
|
hooks: boolean;
|
|
408
406
|
resolver: ResolverVueQuery;
|
|
409
407
|
};
|
|
410
|
-
type PluginVueQuery = PluginType<'plugin-vue-query',
|
|
408
|
+
type PluginVueQuery = PluginType<'plugin-vue-query', PluginVueQueryOptions, PluginVueQueryResolvedOptions, ResolverVueQuery>;
|
|
411
409
|
declare global {
|
|
412
410
|
namespace Kubb {
|
|
413
411
|
interface PluginRegistry {
|
|
@@ -464,4 +462,4 @@ export declare const pluginVueQuery: import("@kubb/kit").PluginFactory<PluginVue
|
|
|
464
462
|
* ```
|
|
465
463
|
*/
|
|
466
464
|
export declare const resolverVueQuery: ResolverVueQuery;
|
|
467
|
-
export { type PageParamFn, type PluginVueQuery, type ResolverVueQuery, type Transformer, pluginVueQuery as default };
|
|
465
|
+
export { type KeyTransformer, type PageParamFn, type PluginVueQuery, type ResolverVueQuery, type Transformer, pluginVueQuery as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -57,20 +57,23 @@ type ParamsCasing = 'camelcase' | undefined;
|
|
|
57
57
|
* caches `InfiniteData` and must never share one with a plain query.
|
|
58
58
|
*/
|
|
59
59
|
type KeyVariant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfiniteQuery' | 'mutation';
|
|
60
|
+
type KeyTransformerProps = {
|
|
61
|
+
node: OperationNode;
|
|
62
|
+
casing: ParamsCasing;
|
|
63
|
+
variant: KeyVariant;
|
|
64
|
+
};
|
|
60
65
|
/**
|
|
61
66
|
* Builds query or mutation key segments for an operation node.
|
|
62
67
|
* Receives `variant` indicating which hook or composable the key is built for.
|
|
63
68
|
*/
|
|
64
|
-
type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
variant: KeyVariant;
|
|
68
|
-
}) => Array<unknown>;
|
|
69
|
+
type KeyTransformer = (props: KeyTransformerProps) => Array<unknown>;
|
|
70
|
+
/** @deprecated Use `KeyTransformer`. Removed in v6. */
|
|
71
|
+
type Transformer = KeyTransformer;
|
|
69
72
|
/**
|
|
70
73
|
* Configures the query side of a TanStack-family plugin: which HTTP methods produce query
|
|
71
74
|
* hooks and where the query runtime is imported from.
|
|
72
75
|
*/
|
|
73
|
-
type
|
|
76
|
+
type QueryConfig = {
|
|
74
77
|
/**
|
|
75
78
|
* HTTP methods treated as queries. Operations using these methods produce
|
|
76
79
|
* `useQuery`-style hooks.
|
|
@@ -90,7 +93,7 @@ type Query = {
|
|
|
90
93
|
* Configures the mutation side of a TanStack-family plugin: which HTTP methods produce
|
|
91
94
|
* mutation hooks and where the mutation runtime is imported from.
|
|
92
95
|
*/
|
|
93
|
-
type
|
|
96
|
+
type MutationConfig = {
|
|
94
97
|
/**
|
|
95
98
|
* HTTP methods treated as mutations. Operations using these methods produce
|
|
96
99
|
* `useMutation`-style hooks.
|
|
@@ -105,7 +108,7 @@ type Mutation = {
|
|
|
105
108
|
*/
|
|
106
109
|
importPath?: string;
|
|
107
110
|
};
|
|
108
|
-
type
|
|
111
|
+
type InfiniteConfig = {
|
|
109
112
|
/**
|
|
110
113
|
* Name of the query parameter that holds the page cursor.
|
|
111
114
|
*
|
|
@@ -179,7 +182,7 @@ type PageParamFn<TPage = any, TParam = any> = (page: TPage, allPages: Array<TPag
|
|
|
179
182
|
* mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
|
|
180
183
|
* ```
|
|
181
184
|
*/
|
|
182
|
-
export declare const mutationKeyTransformer:
|
|
185
|
+
export declare const mutationKeyTransformer: KeyTransformer;
|
|
183
186
|
/**
|
|
184
187
|
* Default `queryKey` builder. Call it from a custom builder to extend the default key.
|
|
185
188
|
*
|
|
@@ -190,35 +193,7 @@ export declare const mutationKeyTransformer: Transformer;
|
|
|
190
193
|
* queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
|
|
191
194
|
* ```
|
|
192
195
|
*/
|
|
193
|
-
export declare const queryKeyTransformer:
|
|
194
|
-
declare global {
|
|
195
|
-
namespace Kubb {
|
|
196
|
-
interface MemoRegistry {
|
|
197
|
-
operation: string;
|
|
198
|
-
operationTypeNames: Array<string>;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
type ResponseTypes = {
|
|
203
|
-
TData: string;
|
|
204
|
-
TError: string;
|
|
205
|
-
};
|
|
206
|
-
/**
|
|
207
|
-
* Helper to define a typed page param function for `infinite.getNextPageParam` or
|
|
208
|
-
* `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.
|
|
209
|
-
*
|
|
210
|
-
* Note: Because the function is inlined verbatim into the generated file via `.toString()`,
|
|
211
|
-
* it must be self-contained and cannot reference local closures or external variables from
|
|
212
|
-
* the config file.
|
|
213
|
-
*/
|
|
214
|
-
export declare function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string;
|
|
215
|
-
declare global {
|
|
216
|
-
namespace Kubb {
|
|
217
|
-
interface MemoRegistry {
|
|
218
|
-
responseTypes: ResponseTypes;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
196
|
+
export declare const queryKeyTransformer: KeyTransformer;
|
|
222
197
|
/**
|
|
223
198
|
* The options every plugin accepts: `output`, `group`, and the `exclude`, `include`, and `override` filters.
|
|
224
199
|
* `TResolvedOptions` is the options object an `override` entry can set.
|
|
@@ -247,6 +222,34 @@ interface ResolvedPluginOptions<TResolvedOptions> {
|
|
|
247
222
|
override: Array<Override<TResolvedOptions>>;
|
|
248
223
|
group: Group | null;
|
|
249
224
|
}
|
|
225
|
+
declare global {
|
|
226
|
+
namespace Kubb {
|
|
227
|
+
interface MemoRegistry {
|
|
228
|
+
operation: string;
|
|
229
|
+
operationTypeNames: Array<string>;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
type ResponseTypes = {
|
|
234
|
+
TData: string;
|
|
235
|
+
TError: string;
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* Helper to define a typed page param function for `infinite.getNextPageParam` or
|
|
239
|
+
* `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.
|
|
240
|
+
*
|
|
241
|
+
* Note: Because the function is inlined verbatim into the generated file via `.toString()`,
|
|
242
|
+
* it must be self-contained and cannot reference local closures or external variables from
|
|
243
|
+
* the config file.
|
|
244
|
+
*/
|
|
245
|
+
export declare function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string;
|
|
246
|
+
declare global {
|
|
247
|
+
namespace Kubb {
|
|
248
|
+
interface MemoRegistry {
|
|
249
|
+
responseTypes: ResponseTypes;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
250
253
|
/**
|
|
251
254
|
* Resolver for Vue Query that provides naming methods for hook functions.
|
|
252
255
|
*/
|
|
@@ -315,21 +318,21 @@ type ResolverVueQuery = Resolver & {
|
|
|
315
318
|
* @note String values are inlined verbatim into generated code. Wrap literal
|
|
316
319
|
* strings in `JSON.stringify(...)`.
|
|
317
320
|
*/
|
|
318
|
-
type
|
|
321
|
+
type QueryKeyTransformer = KeyTransformer;
|
|
319
322
|
/**
|
|
320
323
|
* Builds the `mutationKey` used by each generated mutation composable.
|
|
321
324
|
*
|
|
322
325
|
* @note String values are inlined verbatim into generated code. Wrap literal
|
|
323
326
|
* strings in `JSON.stringify(...)`.
|
|
324
327
|
*/
|
|
325
|
-
type
|
|
328
|
+
type MutationKeyTransformer = KeyTransformer;
|
|
326
329
|
/**
|
|
327
330
|
* Where the generated composables are written and how they are exported, plus the optional
|
|
328
331
|
* `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
|
|
329
332
|
*
|
|
330
333
|
* @default { path: 'hooks', barrel: { type: 'named' } }
|
|
331
334
|
*/
|
|
332
|
-
type
|
|
335
|
+
type PluginVueQueryOptions = PluginOptions<PluginVueQueryResolvedOptions> & {
|
|
333
336
|
/**
|
|
334
337
|
* Selects the HTTP client the generated composables call. Every client plugin speaks the `RequestResult`
|
|
335
338
|
* contract, so the composables call a contract `<op>` that takes one grouped `options` object.
|
|
@@ -352,23 +355,23 @@ type Options = PluginOptions<ResolvedOptions> & {
|
|
|
352
355
|
*
|
|
353
356
|
* @default false
|
|
354
357
|
*/
|
|
355
|
-
infinite?: Partial<
|
|
358
|
+
infinite?: Partial<InfiniteConfig> | false;
|
|
356
359
|
/**
|
|
357
360
|
* Custom `queryKey` builder.
|
|
358
361
|
*/
|
|
359
|
-
queryKey?:
|
|
362
|
+
queryKey?: QueryKeyTransformer;
|
|
360
363
|
/**
|
|
361
364
|
* Configures query composables. Set to `false` to skip the query output.
|
|
362
365
|
*/
|
|
363
|
-
query?: Partial<
|
|
366
|
+
query?: Partial<QueryConfig> | false;
|
|
364
367
|
/**
|
|
365
368
|
* Custom `mutationKey` builder.
|
|
366
369
|
*/
|
|
367
|
-
mutationKey?:
|
|
370
|
+
mutationKey?: MutationKeyTransformer;
|
|
368
371
|
/**
|
|
369
372
|
* Configures mutation composables. Set to `false` to skip mutation generation.
|
|
370
373
|
*/
|
|
371
|
-
mutation?: Partial<
|
|
374
|
+
mutation?: Partial<MutationConfig> | false;
|
|
372
375
|
/**
|
|
373
376
|
* Override how composable names and file paths are built.
|
|
374
377
|
*/
|
|
@@ -385,29 +388,24 @@ type Options = PluginOptions<ResolvedOptions> & {
|
|
|
385
388
|
*/
|
|
386
389
|
macros?: Array<Macro>;
|
|
387
390
|
};
|
|
388
|
-
|
|
389
|
-
* The resolved client strategy for the generated composables, computed once during setup. The
|
|
390
|
-
* composables always import and call a registered contract client plugin's `<op>`.
|
|
391
|
-
*/
|
|
392
|
-
type ResolvedClient = ResolvedContractClient;
|
|
393
|
-
type ResolvedOptions = ResolvedPluginOptions<ResolvedOptions> & {
|
|
391
|
+
type PluginVueQueryResolvedOptions = ResolvedPluginOptions<PluginVueQueryResolvedOptions> & {
|
|
394
392
|
/**
|
|
395
393
|
* The resolved contract client the generators import and call.
|
|
396
394
|
*/
|
|
397
|
-
client:
|
|
395
|
+
client: ResolvedContractClient;
|
|
398
396
|
returnType?: 'data' | 'full';
|
|
399
397
|
/**
|
|
400
398
|
* Resolved infinite query configuration, or `false` when infinite queries are disabled.
|
|
401
399
|
*/
|
|
402
|
-
infinite: NonNullable<
|
|
403
|
-
queryKey:
|
|
404
|
-
query: NonNullable<Required<
|
|
405
|
-
mutationKey:
|
|
406
|
-
mutation: NonNullable<Required<
|
|
400
|
+
infinite: NonNullable<InfiniteConfig> | false;
|
|
401
|
+
queryKey: QueryKeyTransformer | null;
|
|
402
|
+
query: NonNullable<Required<QueryConfig>> | false;
|
|
403
|
+
mutationKey: MutationKeyTransformer | null;
|
|
404
|
+
mutation: NonNullable<Required<MutationConfig>> | false;
|
|
407
405
|
hooks: boolean;
|
|
408
406
|
resolver: ResolverVueQuery;
|
|
409
407
|
};
|
|
410
|
-
type PluginVueQuery = PluginType<'plugin-vue-query',
|
|
408
|
+
type PluginVueQuery = PluginType<'plugin-vue-query', PluginVueQueryOptions, PluginVueQueryResolvedOptions, ResolverVueQuery>;
|
|
411
409
|
declare global {
|
|
412
410
|
namespace Kubb {
|
|
413
411
|
interface PluginRegistry {
|
|
@@ -464,4 +462,4 @@ export declare const pluginVueQuery: import("@kubb/kit").PluginFactory<PluginVue
|
|
|
464
462
|
* ```
|
|
465
463
|
*/
|
|
466
464
|
export declare const resolverVueQuery: ResolverVueQuery;
|
|
467
|
-
export { type PageParamFn, type PluginVueQuery, type ResolverVueQuery, type Transformer, pluginVueQuery as default };
|
|
465
|
+
export { type KeyTransformer, type PageParamFn, type PluginVueQuery, type ResolverVueQuery, type Transformer, pluginVueQuery as default };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var compatibility = {
|
|
|
10
10
|
"node": ">=22.22"
|
|
11
11
|
};
|
|
12
12
|
// package.json
|
|
13
|
-
var version = "5.14.0
|
|
13
|
+
var version = "5.14.0";
|
|
14
14
|
// ../../internals/ast/src/http/requestBody.ts
|
|
15
15
|
/** The schema of the first request body entry, else `undefined` when the operation takes no body. */
|
|
16
16
|
function getSchema(node) {
|
|
@@ -25,7 +25,7 @@ const classByRange = /* @__PURE__ */ new Map([
|
|
|
25
25
|
["5xx", 5]
|
|
26
26
|
]);
|
|
27
27
|
/** The class digit of a status code or range: `2` for `201` and `2xx`, `null` for `default`. */
|
|
28
|
-
function
|
|
28
|
+
function getClass(input) {
|
|
29
29
|
const statusCode = typeof input === "object" ? input.statusCode : input;
|
|
30
30
|
const rangeClass = classByRange.get(String(statusCode));
|
|
31
31
|
if (rangeClass) return rangeClass;
|
|
@@ -33,10 +33,10 @@ function statusClass(input) {
|
|
|
33
33
|
return Number.isNaN(code) ? null : Math.floor(code / 100);
|
|
34
34
|
}
|
|
35
35
|
function isSuccess(statusCode) {
|
|
36
|
-
return
|
|
36
|
+
return getClass(statusCode) === 2;
|
|
37
37
|
}
|
|
38
38
|
function isError(statusCode) {
|
|
39
|
-
const code =
|
|
39
|
+
const code = getClass(statusCode);
|
|
40
40
|
return code !== null && code >= 4;
|
|
41
41
|
}
|
|
42
42
|
// ../../internals/ast/src/http/responses.ts
|
|
@@ -246,12 +246,6 @@ function resolveClient(options) {
|
|
|
246
246
|
help: "Add `@kubb/plugin-fetch`, `@kubb/plugin-axios`, `@kubb/plugin-ky`, or `@kubb/plugin-client` to `plugins` so the generated code has an HTTP client to call."
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Resolves the contract client during a consumer plugin's setup hook.
|
|
251
|
-
* It extracts the plugin names from the raw `plugins` config and applies {@link resolveClient}.
|
|
252
|
-
* On a misconfiguration it throws a config diagnostic tagged with `plugin`, so every consumer
|
|
253
|
-
* fails fast with the same message.
|
|
254
|
-
*/
|
|
255
249
|
function resolveContractClient(options) {
|
|
256
250
|
const { plugin, client, plugins = [] } = options;
|
|
257
251
|
const resolved = resolveClient({
|