@kubb/plugin-react-query 5.5.1 → 5.5.4

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.
@@ -0,0 +1,564 @@
1
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
2
+ import "@kubb/plugin-zod";
3
+ import "@kubb/plugin-ts";
4
+ import "kubb/jsx";
5
+ //#region ../../internals/client/src/resolveClient.d.ts
6
+ /**
7
+ * The client selector accepted by a consumer's `client` option. Each calls a registered contract
8
+ * client plugin.
9
+ */
10
+ type ClientSelector = 'fetch' | 'axios' | 'client';
11
+ /**
12
+ * The resolved client strategy stored in a consumer plugin's options: the generated code always
13
+ * imports and calls a registered contract client plugin's `<op>`. The client runtime lives in
14
+ * plugin-axios / plugin-fetch, so nothing is bundled by the consumer.
15
+ */
16
+ type ResolvedContractClient = {
17
+ kind: 'contract';
18
+ pluginName: string;
19
+ };
20
+ //#endregion
21
+ //#region ../../internals/tanstack-query/src/types.d.ts
22
+ type ParamsCasing = 'camelcase' | undefined;
23
+ /**
24
+ * The hook a key is built for. Plain and suspense queries can share a key, but an infinite query
25
+ * caches `InfiniteData` and must never share one with a plain query.
26
+ */
27
+ type KeyVariant = 'query' | 'suspenseQuery' | 'infiniteQuery' | 'suspenseInfiniteQuery' | 'mutation';
28
+ /**
29
+ * Builds query or mutation key segments for an operation node.
30
+ * Receives `variant` indicating which hook or composable the key is built for.
31
+ */
32
+ type Transformer = (props: {
33
+ node: ast.OperationNode;
34
+ casing: ParamsCasing;
35
+ variant: KeyVariant;
36
+ }) => Array<unknown>;
37
+ /**
38
+ * Configures the query side of a TanStack-family plugin: which HTTP methods produce query
39
+ * hooks and where the query runtime is imported from.
40
+ */
41
+ type Query = {
42
+ /**
43
+ * HTTP methods treated as queries. Operations using these methods produce
44
+ * `useQuery`-style hooks.
45
+ *
46
+ * @default ['GET', 'QUERY']
47
+ */
48
+ methods?: Array<string>;
49
+ /**
50
+ * Module specifier used in the `import { useQuery } from '...'` statement at
51
+ * the top of every generated file. Each plugin defaults this to its own runtime
52
+ * package. Useful for routing through a wrapper that injects a default
53
+ * `queryClient`.
54
+ */
55
+ importPath?: string;
56
+ };
57
+ /**
58
+ * Configures the mutation side of a TanStack-family plugin: which HTTP methods produce
59
+ * mutation hooks and where the mutation runtime is imported from.
60
+ */
61
+ type Mutation = {
62
+ /**
63
+ * HTTP methods treated as mutations. Operations using these methods produce
64
+ * `useMutation`-style hooks.
65
+ *
66
+ * @default ['POST', 'PUT', 'PATCH', 'DELETE']
67
+ */
68
+ methods?: Array<string>;
69
+ /**
70
+ * Module specifier used in the `import { useMutation } from '...'` statement
71
+ * at the top of every generated file. Each plugin defaults this to its own
72
+ * runtime package.
73
+ */
74
+ importPath?: string;
75
+ };
76
+ type Infinite = {
77
+ /**
78
+ * Name of the query parameter that holds the page cursor.
79
+ *
80
+ * @default 'id'
81
+ */
82
+ queryParam?: string;
83
+ /**
84
+ * Path to the cursor field on the response. Leave undefined when the cursor
85
+ * is not known.
86
+ *
87
+ * @deprecated Use `nextParam` and `previousParam` for richer pagination control.
88
+ */
89
+ cursorParam?: string | null;
90
+ /**
91
+ * Path to the next-page cursor on the response. Supports dot notation
92
+ * (`'pagination.next.id'`) or array form (`['pagination', 'next', 'id']`).
93
+ */
94
+ nextParam?: string | Array<string> | null;
95
+ /**
96
+ * Path to the previous-page cursor on the response. Supports dot notation
97
+ * or array form.
98
+ */
99
+ previousParam?: string | Array<string> | null;
100
+ /**
101
+ * Initial value for `pageParam` on the first fetch.
102
+ *
103
+ * @default 0
104
+ */
105
+ initialPageParam?: unknown;
106
+ /**
107
+ * Whether `initialPageParam` was explicitly configured rather than defaulted.
108
+ * When omitted or false, the default previous page threshold remains 1 (legacy 1-based default).
109
+ */
110
+ hasExplicitInitialPageParam?: boolean;
111
+ /**
112
+ * Source of TanStack Query's `getNextPageParam`, inlined verbatim as a function expression. Use it
113
+ * when the next page has to be computed rather than read from a field. Takes precedence over
114
+ * `nextParam` and `cursorParam`.
115
+ *
116
+ * Note: Because functions are inlined verbatim into generated code via `.toString()`, they cannot
117
+ * reference local closures or external variables from the config file.
118
+ *
119
+ * @example
120
+ * `'(lastPage) => (lastPage.hasNext ? lastPage.number + 1 : undefined)'`
121
+ * // or with definePageParam:
122
+ * `definePageParam<MyResponse, number>((lastPage) => (lastPage.hasNext ? lastPage.number + 1 : undefined))`
123
+ */
124
+ getNextPageParam?: string | PageParamFn | null;
125
+ /**
126
+ * Source of TanStack Query's `getPreviousPageParam`, inlined verbatim as a function expression.
127
+ * Takes precedence over `previousParam` and `cursorParam`.
128
+ *
129
+ * Note: Because functions are inlined verbatim into generated code via `.toString()`, they cannot
130
+ * reference local closures or external variables from the config file.
131
+ *
132
+ * @example
133
+ * `'(firstPage) => (firstPage.number > 0 ? firstPage.number - 1 : undefined)'`
134
+ * // or with definePageParam:
135
+ * `definePageParam<MyResponse, number>((firstPage) => (firstPage.number > 0 ? firstPage.number - 1 : undefined))`
136
+ */
137
+ getPreviousPageParam?: string | PageParamFn | null;
138
+ };
139
+ type PageParamFn<TPage = any, TParam = any> = (page: TPage, allPages: Array<TPage>, pageParam: TParam, allPageParams: Array<TParam>) => TParam | undefined | null;
140
+ //#endregion
141
+ //#region ../../internals/tanstack-query/src/components/MutationKey.d.ts
142
+ /**
143
+ * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
144
+ *
145
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
150
+ * ```
151
+ */
152
+ export declare const mutationKeyTransformer: Transformer;
153
+ //#endregion
154
+ //#region ../../internals/tanstack-query/src/components/QueryKey.d.ts
155
+ /**
156
+ * Default `queryKey` builder. Call it from a custom builder to extend the default key.
157
+ *
158
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
163
+ * ```
164
+ */
165
+ export declare const queryKeyTransformer: Transformer;
166
+ //#endregion
167
+ //#region ../../internals/tanstack-query/src/utils.d.ts
168
+ /**
169
+ * Helper to define a typed page param function for `infinite.getNextPageParam` or
170
+ * `infinite.getPreviousPageParam`. Serializes the function to a string for inlining in generated code.
171
+ *
172
+ * Note: Because the function is inlined verbatim into the generated file via `.toString()`,
173
+ * it must be self-contained and cannot reference local closures or external variables from
174
+ * the config file.
175
+ */
176
+ export declare function definePageParam<TPage = any, TParam = any>(fn: PageParamFn<TPage, TParam>): string;
177
+ //#endregion
178
+ //#region src/types.d.ts
179
+ /**
180
+ * The concrete resolver type for `@kubb/plugin-react-query`.
181
+ * Extends the base `Resolver` (which provides `default` naming and option helpers, the top-level
182
+ * `name` casing, and the `file` builder) with plugin-specific naming namespaces for the generated
183
+ * `useQuery`, `useSuspenseQuery`, `useInfiniteQuery`, `useSuspenseInfiniteQuery`, and `useMutation`
184
+ * hooks and their companion helpers.
185
+ */
186
+ type ResolverReactQuery = Resolver & {
187
+ /**
188
+ * Naming for the generated `useQuery` hook and its companion helpers.
189
+ */
190
+ query: {
191
+ /**
192
+ * Resolves a query hook function name.
193
+ *
194
+ * @example Query hook names
195
+ * `resolver.query.name(node) // → 'useGetPetById'`
196
+ */
197
+ name(node: ast.OperationNode): string;
198
+ /**
199
+ * Resolves the query options helper name.
200
+ *
201
+ * @example Query options helper names
202
+ * `resolver.query.optionsName(node) // → 'getPetByIdQueryOptions'`
203
+ */
204
+ optionsName(node: ast.OperationNode): string;
205
+ /**
206
+ * Resolves the query key helper name.
207
+ *
208
+ * @example Query key helper names
209
+ * `resolver.query.keyName(node) // → 'getPetByIdQueryKey'`
210
+ */
211
+ keyName(node: ast.OperationNode): string;
212
+ /**
213
+ * Resolves the query key type name.
214
+ *
215
+ * @example Query key type names
216
+ * `resolver.query.keyTypeName(node) // → 'GetPetByIdQueryKey'`
217
+ */
218
+ keyTypeName(node: ast.OperationNode): string;
219
+ /**
220
+ * Resolves the client function name generated inline by query hooks.
221
+ *
222
+ * @example Client function names
223
+ * `resolver.query.clientName(node) // → 'getPetById'`
224
+ */
225
+ clientName(node: ast.OperationNode): string;
226
+ };
227
+ /**
228
+ * Naming for the generated `useSuspenseQuery` hook and its companion helpers.
229
+ */
230
+ suspenseQuery: {
231
+ /**
232
+ * Resolves a suspense query hook function name.
233
+ *
234
+ * @example Suspense query hook names
235
+ * `resolver.suspenseQuery.name(node) // → 'useGetPetByIdSuspense'`
236
+ */
237
+ name(node: ast.OperationNode): string;
238
+ /**
239
+ * Resolves the suspense query options helper name.
240
+ */
241
+ optionsName(node: ast.OperationNode): string;
242
+ /**
243
+ * Resolves the suspense query key helper name.
244
+ */
245
+ keyName(node: ast.OperationNode): string;
246
+ /**
247
+ * Resolves the suspense query key type name.
248
+ */
249
+ keyTypeName(node: ast.OperationNode): string;
250
+ /**
251
+ * Resolves the client function name generated inline by suspense query hooks.
252
+ */
253
+ clientName(node: ast.OperationNode): string;
254
+ };
255
+ /**
256
+ * Naming for the generated `useInfiniteQuery` hook and its companion helpers.
257
+ */
258
+ infiniteQuery: {
259
+ /**
260
+ * Resolves an infinite query hook function name.
261
+ *
262
+ * @example Infinite query hook names
263
+ * `resolver.infiniteQuery.name(node) // → 'useGetPetByIdInfinite'`
264
+ */
265
+ name(node: ast.OperationNode): string;
266
+ /**
267
+ * Resolves the infinite query options helper name.
268
+ */
269
+ optionsName(node: ast.OperationNode): string;
270
+ /**
271
+ * Resolves the infinite query key helper name.
272
+ */
273
+ keyName(node: ast.OperationNode): string;
274
+ /**
275
+ * Resolves the infinite query key type name.
276
+ */
277
+ keyTypeName(node: ast.OperationNode): string;
278
+ /**
279
+ * Resolves the client function name generated inline by infinite query hooks.
280
+ */
281
+ clientName(node: ast.OperationNode): string;
282
+ };
283
+ /**
284
+ * Naming for the generated `useSuspenseInfiniteQuery` hook and its companion helpers.
285
+ */
286
+ suspenseInfiniteQuery: {
287
+ /**
288
+ * Resolves a suspense infinite query hook function name.
289
+ *
290
+ * @example Suspense infinite query hook names
291
+ * `resolver.suspenseInfiniteQuery.name(node) // → 'useGetPetByIdSuspenseInfinite'`
292
+ */
293
+ name(node: ast.OperationNode): string;
294
+ /**
295
+ * Resolves the suspense infinite query options helper name.
296
+ */
297
+ optionsName(node: ast.OperationNode): string;
298
+ /**
299
+ * Resolves the suspense infinite query key helper name.
300
+ */
301
+ keyName(node: ast.OperationNode): string;
302
+ /**
303
+ * Resolves the suspense infinite query key type name.
304
+ */
305
+ keyTypeName(node: ast.OperationNode): string;
306
+ /**
307
+ * Resolves the client function name generated inline by suspense infinite query hooks.
308
+ */
309
+ clientName(node: ast.OperationNode): string;
310
+ };
311
+ /**
312
+ * Naming for the generated `useMutation` hook and its companion helpers.
313
+ */
314
+ mutation: {
315
+ /**
316
+ * Resolves a mutation hook function name.
317
+ *
318
+ * @example Mutation hook names
319
+ * `resolver.mutation.name(node) // → 'useUpdatePet'`
320
+ */
321
+ name(node: ast.OperationNode): string;
322
+ /**
323
+ * Resolves the mutation options helper name.
324
+ */
325
+ optionsName(node: ast.OperationNode): string;
326
+ /**
327
+ * Resolves the mutation key helper name.
328
+ */
329
+ keyName(node: ast.OperationNode): string;
330
+ /**
331
+ * Resolves the mutation type name.
332
+ *
333
+ * @example Mutation type names
334
+ * `resolver.mutation.typeName(node) // → 'UpdatePet'`
335
+ */
336
+ typeName(node: ast.OperationNode): string;
337
+ };
338
+ /**
339
+ * Naming for the generated custom hook options file.
340
+ */
341
+ hook: {
342
+ /**
343
+ * Resolves the generated custom hook options map type name.
344
+ */
345
+ optionsName(): string;
346
+ /**
347
+ * Resolves the helper function name used inside the custom hook options file.
348
+ */
349
+ customOptionsName(): string;
350
+ };
351
+ };
352
+ type Suspense = object;
353
+ /**
354
+ * Builds the `queryKey` used by each generated query hook. `variant` tells which hook the key is for,
355
+ * so infinite keys can stay apart from plain ones.
356
+ *
357
+ * @note String values are inlined verbatim into generated code. Wrap literal
358
+ * strings in `JSON.stringify(...)`.
359
+ */
360
+ type QueryKey = Transformer;
361
+ /**
362
+ * Builds the `mutationKey` used by each generated mutation hook.
363
+ *
364
+ * @note String values are inlined verbatim into generated code. Wrap literal
365
+ * strings in `JSON.stringify(...)`.
366
+ */
367
+ type MutationKey = Transformer;
368
+ type CustomOptions = {
369
+ /**
370
+ * Module specifier of your custom-options hook. Imported as a named import,
371
+ * `import { ${name} } from '${importPath}'`.
372
+ */
373
+ importPath: string;
374
+ /**
375
+ * Exported function name of your custom-options hook.
376
+ *
377
+ * @default 'useCustomHookOptions'
378
+ */
379
+ name?: string;
380
+ };
381
+ /**
382
+ * Where the generated hooks are written and how they are exported, plus the optional `group`
383
+ * strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
384
+ *
385
+ * @default { path: 'hooks', barrel: { type: 'named' } }
386
+ */
387
+ type Options = OutputOptions & {
388
+ /**
389
+ * Selects the HTTP client the generated hooks call. Every client plugin speaks the `RequestResult`
390
+ * contract, so the hooks call a contract `<op>` that takes one grouped `options` object.
391
+ *
392
+ * `'fetch'` / `'axios'` / `'client'` calls the `@kubb/plugin-fetch` / `@kubb/plugin-axios` /
393
+ * `@kubb/plugin-client` functions. When a single client plugin is registered it is
394
+ * auto-detected, so the string is only needed to disambiguate several client plugins.
395
+ *
396
+ * A client plugin must be registered. The hooks always call its `<op>`.
397
+ */
398
+ client?: ClientSelector;
399
+ /**
400
+ * Skip operations matching at least one entry in the list.
401
+ */
402
+ exclude?: Array<Exclude>;
403
+ /**
404
+ * Restrict generation to operations matching at least one entry in the list.
405
+ */
406
+ include?: Array<Include>;
407
+ /**
408
+ * Apply a different options object to operations matching a pattern.
409
+ */
410
+ override?: Array<Override<ResolvedOptions>>;
411
+ /**
412
+ * Enables `useInfiniteQuery` hooks for cursor- or page-based pagination.
413
+ * Pass an object to configure how the cursor is read, or pass `false` to skip.
414
+ *
415
+ * @default false
416
+ */
417
+ infinite?: Partial<Infinite> | false;
418
+ /**
419
+ * Adds `useSuspenseQuery` hooks alongside the regular `useQuery` ones.
420
+ * Pass an empty object (`{}`) to enable. TanStack Query v5+ only.
421
+ *
422
+ * @default false
423
+ */
424
+ suspense?: Partial<Suspense> | false;
425
+ /**
426
+ * Custom `queryKey` builder. Use to add a version namespace, swap to
427
+ * operation IDs, or shape keys to match an existing invalidation strategy.
428
+ */
429
+ queryKey?: QueryKey;
430
+ /**
431
+ * Configures query hooks. Set to `false` to skip generating hooks entirely
432
+ * and emit only `queryOptions(...)` helpers.
433
+ */
434
+ query?: Partial<Query> | false;
435
+ /**
436
+ * Custom `mutationKey` builder. Useful when you batch invalidations or read
437
+ * mutation state via `useMutationState`.
438
+ */
439
+ mutationKey?: MutationKey;
440
+ /**
441
+ * Configures mutation hooks. Set to `false` to skip mutation generation.
442
+ */
443
+ mutation?: Partial<Mutation> | false;
444
+ /**
445
+ * Wires every generated hook through a user-supplied function that returns
446
+ * extra options (`onSuccess`, `onError`, `select`, ...). Also emits a
447
+ * `HookOptions` type so the wrapper stays in sync with generated hooks.
448
+ */
449
+ customOptions?: CustomOptions;
450
+ /**
451
+ * Override how hook names and file paths are built. Methods you omit fall
452
+ * back to the default `resolverReactQuery`.
453
+ */
454
+ resolver?: ResolverPatch<ResolverReactQuery>;
455
+ /**
456
+ * Set to `true` to also generate `use*` hook functions. By default only the
457
+ * `queryOptions`, `mutationOptions`, `queryKey`, and `mutationKey` helpers are
458
+ * emitted, using `@tanstack/react-query` factory imports (`queryOptions`,
459
+ * `infiniteQueryOptions`, `mutationOptions`) that are adapter-portable across
460
+ * React, Vue, Solid, and Svelte. Infinite, suspense, and `customOptions` output
461
+ * needs `hooks: true` too.
462
+ *
463
+ * @default false
464
+ */
465
+ hooks?: boolean;
466
+ /**
467
+ * Macros applied to each operation node before printing.
468
+ */
469
+ macros?: Array<ast.Macro>;
470
+ };
471
+ /**
472
+ * The resolved client strategy for the generated hooks, computed once during setup. The hooks always
473
+ * import and call a registered contract client plugin's `<op>`.
474
+ */
475
+ type ResolvedClient = ResolvedContractClient;
476
+ type ResolvedOptions = {
477
+ output: Output;
478
+ group: Group | null;
479
+ exclude: NonNullable<Options['exclude']>;
480
+ include: Options['include'];
481
+ override: NonNullable<Options['override']>;
482
+ /**
483
+ * The resolved contract client the generators import and call.
484
+ */
485
+ client: ResolvedClient;
486
+ /**
487
+ * Resolved infinite query configuration, or `false` when infinite queries are disabled.
488
+ */
489
+ infinite: NonNullable<Infinite> | false;
490
+ suspense: Suspense | false;
491
+ queryKey: QueryKey | null;
492
+ query: NonNullable<Required<Query>> | false;
493
+ mutationKey: MutationKey | null;
494
+ mutation: NonNullable<Required<Mutation>> | false;
495
+ customOptions: NonNullable<Required<CustomOptions>> | null;
496
+ hooks: boolean;
497
+ resolver: ResolverReactQuery;
498
+ };
499
+ type PluginReactQuery = PluginType<'plugin-react-query', Options, ResolvedOptions, ResolverReactQuery>;
500
+ declare global {
501
+ namespace Kubb {
502
+ interface PluginRegistry {
503
+ 'plugin-react-query': PluginReactQuery;
504
+ }
505
+ }
506
+ }
507
+ //#endregion
508
+ //#region src/plugin.d.ts
509
+ /**
510
+ * Canonical plugin name for `@kubb/plugin-react-query`. Used for driver lookups
511
+ * and cross-plugin dependency references.
512
+ */
513
+ export declare const pluginReactQueryName = "plugin-react-query";
514
+ /**
515
+ * Generates one TanStack Query hook per OpenAPI operation for React. Queries
516
+ * become `useFoo`, with `useFooSuspense` and `useFooInfinite` variants.
517
+ * Mutations become `useFoo`. Each hook is fully typed: query keys, input
518
+ * variables, response data, and error shape all come from the spec.
519
+ *
520
+ * @example
521
+ * ```ts
522
+ * import { defineConfig } from 'kubb/config'
523
+ * import { pluginTs } from '@kubb/plugin-ts'
524
+ * import { pluginReactQuery } from '@kubb/plugin-react-query'
525
+ *
526
+ * export default defineConfig({
527
+ * input: './petStore.yaml',
528
+ * output: { path: './src/gen' },
529
+ * plugins: [
530
+ * pluginTs(),
531
+ * pluginReactQuery({
532
+ * output: { path: './hooks' },
533
+ * suspense: {},
534
+ * }),
535
+ * ],
536
+ * })
537
+ * ```
538
+ */
539
+ export declare const pluginReactQuery: import("kubb/kit").PluginFactory<PluginReactQuery>;
540
+ //#endregion
541
+ //#region src/resolvers/resolverReactQuery.d.ts
542
+ /**
543
+ * Default resolver used by `@kubb/plugin-react-query`. Decides the names and
544
+ * file paths for every generated TanStack Query hook (`useFoo`,
545
+ * `useFooSuspense`, `useFooInfinite`, ...) and its companion helpers
546
+ * (`fooQueryKey`, `fooQueryOptions`).
547
+ *
548
+ * Functions and files use the built-in camelCase casing; hooks get the `use`
549
+ * prefix; suspense and infinite variants are suffixed with `Suspense`/`Infinite`.
550
+ *
551
+ * @example Resolve hook and helper names
552
+ * ```ts
553
+ * import { resolverReactQuery } from '@kubb/plugin-react-query'
554
+ *
555
+ * resolverReactQuery.query.name(operationNode) // 'useGetPetById'
556
+ * resolverReactQuery.mutation.name(operationNode) // 'useUpdatePet'
557
+ * resolverReactQuery.query.keyName(operationNode) // 'getPetByIdQueryKey'
558
+ * resolverReactQuery.query.optionsName(operationNode) // 'getPetByIdQueryOptions'
559
+ * ```
560
+ */
561
+ export declare const resolverReactQuery: ResolverReactQuery;
562
+ //#endregion
563
+ export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, type Transformer, pluginReactQuery as default };
564
+ //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
2
- import { Diagnostics, Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
1
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginType, Resolver, ResolverPatch, ast } from "kubb/kit";
3
2
  import "@kubb/plugin-zod";
4
- import "kubb/jsx";
5
3
  import "@kubb/plugin-ts";
4
+ import "kubb/jsx";
6
5
  //#region ../../internals/client/src/resolveClient.d.ts
7
6
  /**
8
7
  * The client selector accepted by a consumer's `client` option. Each calls a registered contract
@@ -139,6 +138,32 @@ type Infinite = {
139
138
  };
140
139
  type PageParamFn<TPage = any, TParam = any> = (page: TPage, allPages: Array<TPage>, pageParam: TParam, allPageParams: Array<TParam>) => TParam | undefined | null;
141
140
  //#endregion
141
+ //#region ../../internals/tanstack-query/src/components/MutationKey.d.ts
142
+ /**
143
+ * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
144
+ *
145
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
150
+ * ```
151
+ */
152
+ export declare const mutationKeyTransformer: Transformer;
153
+ //#endregion
154
+ //#region ../../internals/tanstack-query/src/components/QueryKey.d.ts
155
+ /**
156
+ * Default `queryKey` builder. Call it from a custom builder to extend the default key.
157
+ *
158
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
163
+ * ```
164
+ */
165
+ export declare const queryKeyTransformer: Transformer;
166
+ //#endregion
142
167
  //#region ../../internals/tanstack-query/src/utils.d.ts
143
168
  /**
144
169
  * Helper to define a typed page param function for `infinite.getNextPageParam` or
@@ -535,5 +560,5 @@ export declare const pluginReactQuery: import("kubb/kit").PluginFactory<PluginRe
535
560
  */
536
561
  export declare const resolverReactQuery: ResolverReactQuery;
537
562
  //#endregion
538
- export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, pluginReactQuery as default };
563
+ export { type PageParamFn, type PluginReactQuery, type ResolverReactQuery, type Transformer, pluginReactQuery as default };
539
564
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import "./rolldown-runtime-C0LytTxp.js";
2
1
  import { Diagnostics, Resolver, Url, addGenerator, ast, createResolver, defineExtension, defineGenerator, setMacros, setResolver, useConfig } from "kubb/kit";
3
2
  import path from "node:path";
4
3
  import { File, Function, Type, jsxRenderer } from "kubb/jsx";
5
4
  import { createFunctionParameter, createFunctionParameters, createObjectBindingPattern, createTypeLiteral, functionPrinter, pluginTsName } from "@kubb/plugin-ts";
6
5
  import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
7
6
  import fs from "node:fs";
7
+ //#endregion
8
8
  //#region ../../internals/shared/src/operation.ts
9
9
  /**
10
10
  * Builds the `ResolverFileParams` every operation generator passes to
@@ -316,11 +316,11 @@ function createGroupConfig(group) {
316
316
  //#region kubb-extension.json
317
317
  var compatibility = {
318
318
  "kubb": ">=5.8.3",
319
- "node": ">=22"
319
+ "node": ">=22.12"
320
320
  };
321
321
  //#endregion
322
322
  //#region package.json
323
- var version = "5.5.1";
323
+ var version = "5.5.4";
324
324
  //#endregion
325
325
  //#region ../../internals/client/src/resolveClient.ts
326
326
  /**
@@ -846,6 +846,11 @@ function getDefaultPageParamsWarning(node, infinite) {
846
846
  return `${node.operationId}: the default infinite page params expect an array response and never end for this one. Set \`infinite.getNextPageParam\` (or \`nextParam\`) to read the next page from the response.`;
847
847
  }
848
848
  function matchesPattern(node, ov) {
849
+ if ("key" in ov) {
850
+ const extensions = node.extensions;
851
+ if (!extensions || !(ov.key in extensions)) return false;
852
+ return ov.value === void 0 || extensions[ov.key] === ov.value;
853
+ }
849
854
  const { type, pattern } = ov;
850
855
  const matches = (value) => typeof pattern === "string" ? value === pattern : pattern.test(value);
851
856
  if (type === "operationId") return matches(node.operationId);
@@ -1010,6 +1015,16 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
1010
1015
  //#endregion
1011
1016
  //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
1012
1017
  const declarationPrinter$5 = functionPrinter({ mode: "declaration" });
1018
+ /**
1019
+ * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
1020
+ *
1021
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
1022
+ *
1023
+ * @example
1024
+ * ```ts
1025
+ * mutationKey: (props) => [JSON.stringify(props.node.operationId), ...mutationKeyTransformer(props)]
1026
+ * ```
1027
+ */
1013
1028
  const mutationKeyTransformer = ({ node }) => {
1014
1029
  if (!node.path) return [];
1015
1030
  return [`{ url: '${Url.toPath(node.path)}' }`];
@@ -1101,6 +1116,16 @@ function createMutationResolver() {
1101
1116
  //#endregion
1102
1117
  //#region ../../internals/tanstack-query/src/components/QueryKey.tsx
1103
1118
  const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
1119
+ /**
1120
+ * Default `queryKey` builder. Call it from a custom builder to extend the default key.
1121
+ *
1122
+ * @remarks The returned segments may change between releases. Spread them instead of reading single entries.
1123
+ *
1124
+ * @example
1125
+ * ```ts
1126
+ * queryKey: (props) => [JSON.stringify(props.node.operationId), ...queryKeyTransformer(props)]
1127
+ * ```
1128
+ */
1104
1129
  const queryKeyTransformer = ({ node, variant }) => {
1105
1130
  if (!node.path) return [];
1106
1131
  const { path, query } = getOperationParameters(node);
@@ -2079,6 +2104,6 @@ const pluginReactQuery = defineExtension({
2079
2104
  }
2080
2105
  });
2081
2106
  //#endregion
2082
- export { pluginReactQuery as default, pluginReactQuery, definePageParam, pluginReactQueryName, resolverReactQuery };
2107
+ export { pluginReactQuery as default, pluginReactQuery, definePageParam, mutationKeyTransformer, pluginReactQueryName, queryKeyTransformer, resolverReactQuery };
2083
2108
 
2084
2109
  //# sourceMappingURL=index.js.map