@kubb/plugin-vue-query 5.7.0-canary.20261025T201031 → 5.7.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 CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- //#region \0rolldown/runtime.js
5
+ // \0rolldown/runtime.js
6
6
  var __create = Object.create;
7
7
  var __defProp = Object.defineProperty;
8
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -23,7 +23,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  value: mod,
24
24
  enumerable: true
25
25
  }) : target, mod));
26
- //#endregion
27
26
  let kubb_kit = require("kubb/kit");
28
27
  let node_path = require("node:path");
29
28
  node_path = __toESM(node_path, 1);
@@ -31,7 +30,7 @@ let _kubb_plugin_ts = require("@kubb/plugin-ts");
31
30
  let _kubb_plugin_zod = require("@kubb/plugin-zod");
32
31
  let kubb_jsx = require("kubb/jsx");
33
32
  let kubb_jsx_jsx_runtime = require("kubb/jsx/jsx-runtime");
34
- //#region ../../internals/shared/src/operation.ts
33
+ // ../../internals/shared/src/operation.ts
35
34
  /**
36
35
  * Builds the `ResolverFileParams` every operation generator passes to
37
36
  * `resolver.file`: a file named `name`, tagged by the operation's first
@@ -100,6 +99,24 @@ function getContentTypeInfo(node) {
100
99
  function getResponseContentTypeInfo(node) {
101
100
  return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? []);
102
101
  }
102
+ /**
103
+ * Reads the single base content type of an operation's primary success response, lowercased and
104
+ * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or
105
+ * more than one content type, since neither case has a single type to act on.
106
+ */
107
+ function getPrimarySuccessContentType(node) {
108
+ const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? [];
109
+ if (contentTypes.length !== 1) return void 0;
110
+ return contentTypes[0].split(";")[0].trim().toLowerCase();
111
+ }
112
+ /**
113
+ * Whether an operation streams its primary success response as Server-Sent Events
114
+ * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a
115
+ * one-shot `RequestResult`.
116
+ */
117
+ function isEventStream(node) {
118
+ return getPrimarySuccessContentType(node) === "text/event-stream";
119
+ }
103
120
  const requestConfigBaseType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`;
104
121
  function buildRequestConfigType(node) {
105
122
  const request = getContentTypeInfo(node);
@@ -191,6 +208,22 @@ function getOperationParameters(node) {
191
208
  operationParameterGroupsByNode.set(node, groups);
192
209
  return groups;
193
210
  }
211
+ /**
212
+ * Builds the combined `{ body, path, query, headers }` options object schema for an operation,
213
+ * referencing the already-resolved body and grouped param names. Shared by `@kubb/plugin-ts`'s
214
+ * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same
215
+ * shape from the same inputs. `primitive: 'object'` is a no-op for the TS printer and tells the Zod
216
+ * printer to emit `z.object(…)` rather than a record.
217
+ */
218
+ function hasRequestContentTypeChoice(node) {
219
+ return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1;
220
+ }
221
+ /**
222
+ * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.
223
+ */
224
+ function castToClientOptions(callArg, clientName, returnType = "full") {
225
+ return `${callArg} as Parameters<typeof ${clientName}${returnType === "plain" ? "" : "<true>"}>[0]`;
226
+ }
194
227
  function getStatusCodeNumber(statusCode) {
195
228
  const code = Number(statusCode);
196
229
  return Number.isNaN(code) ? null : code;
@@ -221,88 +254,184 @@ function resolveSuccessNames(node, resolver) {
221
254
  function resolveStatusCodeNames(node, resolver) {
222
255
  return node.responses.map((response) => resolver.response.status(node, response.statusCode));
223
256
  }
224
- const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
257
+ /**
258
+ * Lists the type names an operation's types file declares, computed once per resolver and `options` so every
259
+ * dependent reads the same list.
260
+ */
225
261
  function resolveOperationTypeNames(node, resolver, options = {}) {
226
- const cacheKey = `${node.operationId}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${options.includeParams === false ? "noparams" : ""}\0${(options.exclude ?? []).join(",")}`;
227
- let byResolver = typeNamesByResolver.get(resolver);
228
- if (byResolver) {
229
- const cached = byResolver.get(cacheKey);
230
- if (cached) return cached;
231
- } else {
232
- byResolver = /* @__PURE__ */ new Map();
233
- typeNamesByResolver.set(resolver, byResolver);
234
- }
235
- const { path, query, header } = getOperationParameters(node);
236
- const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
237
- const exclude = new Set(options.exclude ?? []);
238
- const paramNames = options.includeParams === false ? [] : [
239
- ...path.map((param) => resolver.param.path(node, param)),
240
- ...query.map((param) => resolver.param.query(node, param)),
241
- ...header.map((param) => resolver.param.headers(node, param))
242
- ];
243
- const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)];
244
- const result = (options.order === "body-response-first" ? [
245
- ...bodyAndResponseNames,
246
- ...paramNames,
247
- ...responseStatusNames
248
- ] : [
249
- ...paramNames,
250
- ...bodyAndResponseNames,
251
- ...responseStatusNames
252
- ]).filter((name) => Boolean(name) && !exclude.has(name));
253
- byResolver.set(cacheKey, result);
254
- return result;
262
+ const key = `${node.operationId}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${options.includeParams === false ? "noparams" : ""}\0${(options.exclude ?? []).join(",")}`;
263
+ return resolver.memo(`operationTypeNames:${key}`, () => {
264
+ const { path, query, header } = getOperationParameters(node);
265
+ const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
266
+ const exclude = new Set(options.exclude ?? []);
267
+ const paramNames = options.includeParams === false ? [] : [
268
+ ...path.map((param) => resolver.param.path(node, param)),
269
+ ...query.map((param) => resolver.param.query(node, param)),
270
+ ...header.map((param) => resolver.param.headers(node, param))
271
+ ];
272
+ const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.response.body(node) : null, resolver.response.response(node)];
273
+ return (options.order === "body-response-first" ? [
274
+ ...bodyAndResponseNames,
275
+ ...paramNames,
276
+ ...responseStatusNames
277
+ ] : [
278
+ ...paramNames,
279
+ ...bodyAndResponseNames,
280
+ ...responseStatusNames
281
+ ]).filter((name) => Boolean(name) && !exclude.has(name));
282
+ });
255
283
  }
256
- //#endregion
257
- //#region ../../internals/utils/src/casing.ts
284
+ // ../../internals/utils/src/casing.ts
258
285
  /**
259
- * Shared implementation for camelCase and PascalCase conversion.
260
- * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
261
- * and capitalizes each word according to `pascal`.
286
+ * Uppercases only the first character of `text`, leaving the rest untouched.
287
+ * Unlike `pascalCase` it never re-splits word boundaries or strips characters.
262
288
  *
263
- * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
289
+ * @example
290
+ * `capitalize('getPetById') // 'GetPetById'`
264
291
  */
265
- function convert(text, pascal) {
266
- return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
267
- if (word.length > 1 && word === word.toUpperCase()) return word;
268
- return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
269
- }).join("").replace(/[^a-zA-Z0-9]/g, "");
270
- }
271
- const cache = /* @__PURE__ */ new Map();
272
- const cacheLimit = 1e4;
273
- function toCamelOrPascal(text, pascal) {
274
- const key = `${pascal ? "P" : "c"}${text}`;
275
- const cached = cache.get(key);
276
- if (cached !== void 0) return cached;
277
- const result = convert(text, pascal);
278
- if (cache.size >= cacheLimit) cache.clear();
279
- cache.set(key, result);
280
- return result;
292
+ function capitalize(text) {
293
+ return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
294
+ }
295
+ // ../../internals/utils/src/reserved.ts
296
+ /**
297
+ * JavaScript and Java reserved words.
298
+ * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
299
+ */
300
+ const reservedWords = /* @__PURE__ */ new Set([
301
+ "abstract",
302
+ "arguments",
303
+ "await",
304
+ "boolean",
305
+ "break",
306
+ "byte",
307
+ "case",
308
+ "catch",
309
+ "char",
310
+ "class",
311
+ "const",
312
+ "continue",
313
+ "debugger",
314
+ "default",
315
+ "delete",
316
+ "do",
317
+ "double",
318
+ "else",
319
+ "enum",
320
+ "eval",
321
+ "export",
322
+ "extends",
323
+ "false",
324
+ "final",
325
+ "finally",
326
+ "float",
327
+ "for",
328
+ "function",
329
+ "goto",
330
+ "if",
331
+ "implements",
332
+ "import",
333
+ "in",
334
+ "instanceof",
335
+ "int",
336
+ "interface",
337
+ "let",
338
+ "long",
339
+ "native",
340
+ "new",
341
+ "null",
342
+ "package",
343
+ "private",
344
+ "protected",
345
+ "public",
346
+ "return",
347
+ "short",
348
+ "static",
349
+ "super",
350
+ "switch",
351
+ "synchronized",
352
+ "this",
353
+ "throw",
354
+ "throws",
355
+ "transient",
356
+ "true",
357
+ "try",
358
+ "typeof",
359
+ "var",
360
+ "void",
361
+ "volatile",
362
+ "while",
363
+ "with",
364
+ "yield",
365
+ "Array",
366
+ "Date",
367
+ "hasOwnProperty",
368
+ "Infinity",
369
+ "isFinite",
370
+ "isNaN",
371
+ "isPrototypeOf",
372
+ "length",
373
+ "Math",
374
+ "name",
375
+ "NaN",
376
+ "Number",
377
+ "Object",
378
+ "prototype",
379
+ "String",
380
+ "toString",
381
+ "undefined",
382
+ "valueOf"
383
+ ]);
384
+ /**
385
+ * Returns `true` when `name` is a syntactically valid JavaScript variable name.
386
+ *
387
+ * @example
388
+ * ```ts
389
+ * isValidVarName('status') // true
390
+ * isValidVarName('class') // false (reserved word)
391
+ * isValidVarName('42foo') // false (starts with digit)
392
+ * ```
393
+ */
394
+ function isValidVarName(name) {
395
+ if (!name || reservedWords.has(name)) return false;
396
+ return isIdentifier(name);
281
397
  }
282
398
  /**
283
- * Converts `text` to camelCase.
399
+ * Returns `name` when it's a syntactically valid JavaScript variable name,
400
+ * otherwise prefixes it with `_` so the result is a valid identifier.
284
401
  *
285
- * @example Word boundaries
286
- * `camelCase('hello-world') // 'helloWorld'`
402
+ * Useful for sanitizing OpenAPI schema names or operation IDs that start with
403
+ * a digit (e.g. `409`, `504AccountCancel`) before using them as exported
404
+ * variable, type, or function names.
287
405
  *
288
- * @example With a prefix
289
- * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
406
+ * @example
407
+ * ```ts
408
+ * ensureValidVarName('409') // '_409'
409
+ * ensureValidVarName('504AccountCancel') // '_504AccountCancel'
410
+ * ensureValidVarName('Pet') // 'Pet'
411
+ * ensureValidVarName('class') // '_class'
412
+ * ```
290
413
  */
291
- function camelCase(text, { prefix = "", suffix = "" } = {}) {
292
- return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
414
+ function ensureValidVarName(name) {
415
+ if (!name || isValidVarName(name)) return name;
416
+ return `_${name}`;
293
417
  }
294
418
  /**
295
- * Uppercases only the first character of `text`, leaving the rest untouched.
296
- * Unlike {@link pascalCase} it never re-splits word boundaries or strips characters.
419
+ * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.
420
+ *
421
+ * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys
422
+ * even though they are not valid variable names, so use this (not {@link isValidVarName}) when
423
+ * deciding whether an object key needs quoting.
297
424
  *
298
425
  * @example
299
- * `capitalize('getPetById') // 'GetPetById'`
426
+ * ```ts
427
+ * isIdentifier('name') // true
428
+ * isIdentifier('x-total')// false
429
+ * ```
300
430
  */
301
- function capitalize(text) {
302
- return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
431
+ function isIdentifier(name) {
432
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
303
433
  }
304
- //#endregion
305
- //#region ../../internals/utils/src/strings.ts
434
+ // ../../internals/utils/src/strings.ts
306
435
  /**
307
436
  * Renders a dotted path or string array as an optional-chaining accessor expression rooted at
308
437
  * `accessor`. Returns `null` for an empty path.
@@ -318,8 +447,32 @@ function getNestedAccessor(param, accessor) {
318
447
  if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
319
448
  return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
320
449
  }
321
- //#endregion
322
- //#region ../../internals/shared/src/group.ts
450
+ // ../../internals/shared/src/resolver.ts
451
+ /**
452
+ * The shared top-level `name` of the operation plugins, computed once per operation name and build.
453
+ */
454
+ function resolveOperationName(name) {
455
+ return this.memo(`operation:${name}`, () => ensureValidVarName((0, kubb_kit.camelCase)(name)));
456
+ }
457
+ /**
458
+ * Builds the allocation key for a declaration an operation owns. `scope` names which declaration
459
+ * it is, so two of them never share an allocation even when a custom resolver gives both the same
460
+ * name. Leave `scope` empty for the operation's own declaration.
461
+ *
462
+ * @example
463
+ * ```ts
464
+ * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })
465
+ * ```
466
+ */
467
+ function operationKey(node, ...scope) {
468
+ return [
469
+ "operation",
470
+ node.method,
471
+ node.path,
472
+ ...scope.map(String)
473
+ ];
474
+ }
475
+ // ../../internals/shared/src/group.ts
323
476
  /**
324
477
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
325
478
  * shared default naming so every plugin groups output consistently:
@@ -342,24 +495,21 @@ function createGroupConfig(group) {
342
495
  if (!group) return null;
343
496
  const defaultName = (ctx) => {
344
497
  if (group.type === "path") return `${ctx.group.split("/")[1]}`;
345
- return camelCase(ctx.group);
498
+ return (0, kubb_kit.camelCase)(ctx.group);
346
499
  };
347
500
  return {
348
501
  ...group,
349
502
  name: group.name ? group.name : defaultName
350
503
  };
351
504
  }
352
- //#endregion
353
- //#region kubb-extension.json
505
+ // kubb-extension.json
354
506
  var compatibility = {
355
- "kubb": ">=5.8.3",
507
+ "kubb": ">=5.14.6",
356
508
  "node": ">=22.22"
357
509
  };
358
- //#endregion
359
- //#region package.json
360
- var version = "5.7.0-canary.20261025T201031";
361
- //#endregion
362
- //#region ../../internals/client/src/resolveOperationTypes.ts
510
+ // package.json
511
+ var version = "5.7.1";
512
+ // ../../internals/client/src/resolveOperationTypes.ts
363
513
  /**
364
514
  * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
365
515
  * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.
@@ -369,6 +519,7 @@ function toZodTypeResolver(resolver) {
369
519
  return {
370
520
  ...resolver,
371
521
  file: resolver.file.bind(resolver),
522
+ memo: (key, compute) => resolver.memo(`zodTypes:${key}`, compute),
372
523
  param: {
373
524
  name: (node, p) => type(resolver.param.name(node, p)),
374
525
  path: (node, p) => type(resolver.param.path(node, p)),
@@ -425,8 +576,7 @@ function resolveOperationTypes(driver, pluginName) {
425
576
  group: pluginZod.options.group ?? void 0
426
577
  };
427
578
  }
428
- //#endregion
429
- //#region ../../internals/client/src/resolveClient.ts
579
+ // ../../internals/client/src/resolveClient.ts
430
580
  /**
431
581
  * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
432
582
  * operation, shared so the selection rules and diagnostics stay in one place.
@@ -536,8 +686,7 @@ function resolveContractClient(options) {
536
686
  }
537
687
  return resolved;
538
688
  }
539
- //#endregion
540
- //#region ../../internals/client/src/resolveClientOperation.ts
689
+ // ../../internals/client/src/resolveClientOperation.ts
541
690
  function isRelativeImport(importPath) {
542
691
  return importPath.startsWith(".");
543
692
  }
@@ -584,8 +733,12 @@ function resolveClientOperation(options) {
584
733
  group: operationOptions.group ?? void 0
585
734
  });
586
735
  const { importPath } = operationOptions;
736
+ const name = resolver.name(node.operationId);
587
737
  return {
588
- name: resolver.name(node.operationId),
738
+ name: resolver.resolveName({
739
+ key: operationKey(node),
740
+ name
741
+ }),
589
742
  path: file.path,
590
743
  clientPath: importPath === void 0 ? node_path.default.resolve(root, ".kubb/client.ts") : resolveImportPath({
591
744
  importPath,
@@ -596,8 +749,7 @@ function resolveClientOperation(options) {
596
749
  };
597
750
  });
598
751
  }
599
- //#endregion
600
- //#region ../../internals/tanstack-query/src/components/HookFile.tsx
752
+ // ../../internals/tanstack-query/src/components/HookFile.tsx
601
753
  /**
602
754
  * Resolves what every TanStack hook file shares: its file, the operation types file and names (`@kubb/plugin-ts`, or
603
755
  * `pluginZod({ inferred: 'codec' })`), banner and footer.
@@ -686,8 +838,7 @@ function HookFile({ hook, imports, children }) {
686
838
  ]
687
839
  });
688
840
  }
689
- //#endregion
690
- //#region ../../internals/tanstack-query/src/utils.ts
841
+ // ../../internals/tanstack-query/src/utils.ts
691
842
  /**
692
843
  * The grouped request options, ordered for both the destructured signature and the
693
844
  * call passed to the underlying client.
@@ -723,7 +874,7 @@ function maybeRefOrGetter(type) {
723
874
  * `MaybeRefOrGetter` per group.
724
875
  */
725
876
  function buildGroupedRequestParam(node, options) {
726
- const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options;
877
+ const { resolver, keys = requestGroupOrder, memberTypeWrapper, withContentType = false } = options;
727
878
  const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node);
728
879
  const names = keys.filter((key) => groups[key]);
729
880
  if (names.length === 0) return null;
@@ -735,6 +886,11 @@ function buildGroupedRequestParam(node, options) {
735
886
  };
736
887
  const isOptional = names.every((name) => !requiredByGroup[name]);
737
888
  const optionsName = resolver.response.options(node);
889
+ if (withContentType && hasRequestContentTypeChoice(node)) return (0, _kubb_plugin_ts.createFunctionParameter)({
890
+ name: "variables",
891
+ type: optionsName,
892
+ optional: false
893
+ });
738
894
  const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key));
739
895
  const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(" | ")}>` : optionsName;
740
896
  if (memberTypeWrapper) {
@@ -792,14 +948,17 @@ function buildQueryOptionsParams(node, options) {
792
948
  * ```
793
949
  */
794
950
  function buildClientCall(node, options) {
795
- const { clientName, signal = false, unwrapName } = options;
951
+ const { clientName, signal = false, unwrapName, withContentType = false, returnType = "full" } = options;
796
952
  const { groups } = getRequestGroupOptionality(node);
797
- return `${clientName}({ ${[
953
+ const names = requestGroupOrder.filter((key) => groups[key]);
954
+ const args = [
798
955
  "...config",
799
- ...requestGroupOrder.filter((key) => groups[key]).map((name) => unwrapName ? `${name}: ${unwrapName(name)}` : name),
956
+ ...withContentType && hasRequestContentTypeChoice(node) ? ["...variables"] : names.map((name) => unwrapName ? `${name}: ${unwrapName(name)}` : name),
800
957
  signal ? "signal: config.signal ?? signal" : null,
801
958
  "throwOnError: true"
802
- ].filter((part) => part !== null).join(", ")} })`;
959
+ ].filter((part) => part !== null);
960
+ if (withContentType && hasRequestContentTypeChoice(node)) return `${clientName}(${castToClientOptions(`{ ${args.join(", ")} }`, clientName, returnType)})`;
961
+ return `${clientName}({ ${args.join(", ")} })`;
803
962
  }
804
963
  /**
805
964
  * Builds the query/mutation body that resolves a `buildClientCall` expression down to the bare
@@ -895,9 +1054,14 @@ function resolveMutationConfig(mutation, options) {
895
1054
  /**
896
1055
  * Classifies an operation as a query or a mutation from the resolved `query` / `mutation` method lists.
897
1056
  * Disabled query and mutation configs do not claim operations, and a method already claimed by an
898
- * enabled query config never counts as a mutation.
1057
+ * enabled query config never counts as a mutation. Event streams are consumed through the client
1058
+ * directly, so they do not generate query or mutation hooks.
899
1059
  */
900
1060
  function classifyOperation(node, { query, mutation }) {
1061
+ if (isEventStream(node)) return {
1062
+ isQuery: false,
1063
+ isMutation: false
1064
+ };
901
1065
  const isQuery = !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
902
1066
  const queryMethods = new Set(query ? query.methods : []);
903
1067
  return {
@@ -1006,8 +1170,7 @@ function buildHookParams(node, options) {
1006
1170
  function resolveMutationRequestType(node, resolver) {
1007
1171
  return buildGroupedRequestParam(node, { resolver }) ? resolver.response.options(node) : "undefined";
1008
1172
  }
1009
- //#endregion
1010
- //#region ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1173
+ // ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1011
1174
  const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1012
1175
  const callPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1013
1176
  function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitInitialPageParam, cursorParam, nextParam, previousParam, getNextPageParam, getPreviousPageParam, node, tsResolver, queryParam, queryKeyName, queryKeyType = "typeof queryKey", memberTypeWrapper, unwrapName, returnType = "full" }) {
@@ -1083,8 +1246,7 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
1083
1246
  })
1084
1247
  });
1085
1248
  }
1086
- //#endregion
1087
- //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
1249
+ // ../../internals/tanstack-query/src/components/MutationKey.tsx
1088
1250
  const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1089
1251
  /**
1090
1252
  * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
@@ -1131,8 +1293,7 @@ function MutationKey({ name, node, transformer, typeName }) {
1131
1293
  })
1132
1294
  })] });
1133
1295
  }
1134
- //#endregion
1135
- //#region ../../internals/tanstack-query/src/resolver.ts
1296
+ // ../../internals/tanstack-query/src/resolver.ts
1136
1297
  /**
1137
1298
  * Builds the shared query namespace for a variant. Spread the result into
1138
1299
  * `createResolver` once per variant the plugin supports.
@@ -1148,19 +1309,39 @@ function MutationKey({ name, node, transformer, typeName }) {
1148
1309
  function createQueryResolver(variant = "") {
1149
1310
  return {
1150
1311
  name(node) {
1151
- return `use${capitalize(this.name(node.operationId))}${variant}`;
1312
+ const name = `use${capitalize(this.name(node.operationId))}${variant}`;
1313
+ return this.resolveName({
1314
+ key: operationKey(node, "query", variant, "name"),
1315
+ name
1316
+ });
1152
1317
  },
1153
1318
  optionsName(node) {
1154
- return `${this.name(node.operationId)}${variant}QueryOptions`;
1319
+ const name = `${this.name(node.operationId)}${variant}QueryOptions`;
1320
+ return this.resolveName({
1321
+ key: operationKey(node, "query", variant, "optionsName"),
1322
+ name
1323
+ });
1155
1324
  },
1156
1325
  keyName(node) {
1157
- return `${this.name(node.operationId)}${variant}QueryKey`;
1326
+ const name = `${this.name(node.operationId)}${variant}QueryKey`;
1327
+ return this.resolveName({
1328
+ key: operationKey(node, "query", variant, "keyName"),
1329
+ name
1330
+ });
1158
1331
  },
1159
1332
  keyTypeName(node) {
1160
- return `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
1333
+ const name = `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
1334
+ return this.resolveName({
1335
+ key: operationKey(node, "query", variant, "keyTypeName"),
1336
+ name
1337
+ });
1161
1338
  },
1162
1339
  clientName(node) {
1163
- return `${this.name(node.operationId)}${variant}`;
1340
+ const name = `${this.name(node.operationId)}${variant}`;
1341
+ return this.resolveName({
1342
+ key: operationKey(node, "query", variant, "clientName"),
1343
+ name
1344
+ });
1164
1345
  }
1165
1346
  };
1166
1347
  }
@@ -1177,15 +1358,22 @@ function createQueryResolver(variant = "") {
1177
1358
  function createMutationResolver() {
1178
1359
  return {
1179
1360
  name(node) {
1180
- return `use${capitalize(this.name(node.operationId))}`;
1361
+ const name = `use${capitalize(this.name(node.operationId))}`;
1362
+ return this.resolveName({
1363
+ key: operationKey(node, "mutation", "name"),
1364
+ name
1365
+ });
1181
1366
  },
1182
1367
  keyName(node) {
1183
- return `${this.name(node.operationId)}MutationKey`;
1368
+ const name = `${this.name(node.operationId)}MutationKey`;
1369
+ return this.resolveName({
1370
+ key: operationKey(node, "mutation", "keyName"),
1371
+ name
1372
+ });
1184
1373
  }
1185
1374
  };
1186
1375
  }
1187
- //#endregion
1188
- //#region ../../internals/tanstack-query/src/components/QueryKey.tsx
1376
+ // ../../internals/tanstack-query/src/components/QueryKey.tsx
1189
1377
  const declarationPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1190
1378
  /**
1191
1379
  * Default `queryKey` builder. Call it from a custom builder to extend the default key.
@@ -1243,8 +1431,7 @@ function QueryKey({ name, node, tsResolver, typeName, transformer, variant = "qu
1243
1431
  })
1244
1432
  })] });
1245
1433
  }
1246
- //#endregion
1247
- //#region src/components/QueryOptions.tsx
1434
+ // src/components/QueryOptions.tsx
1248
1435
  const declarationPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1249
1436
  const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1250
1437
  function getQueryOptionsParams(node, options) {
@@ -1287,8 +1474,7 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, return
1287
1474
  })
1288
1475
  });
1289
1476
  }
1290
- //#endregion
1291
- //#region src/components/Query.tsx
1477
+ // src/components/Query.tsx
1292
1478
  const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1293
1479
  const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1294
1480
  function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver, infinite }) {
@@ -1371,8 +1557,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, t
1371
1557
  })
1372
1558
  });
1373
1559
  }
1374
- //#endregion
1375
- //#region src/generators/infiniteQueryGenerator.tsx
1560
+ // src/generators/infiniteQueryGenerator.tsx
1376
1561
  /**
1377
1562
  * Built-in generator for `useInfiniteQuery` composables. Enabled when
1378
1563
  * `pluginVueQuery({ infinite: { ... }, hooks: true })`. Emits one
@@ -1505,8 +1690,7 @@ const infiniteQueryGenerator = (0, kubb_kit.defineGenerator)({
1505
1690
  });
1506
1691
  }
1507
1692
  });
1508
- //#endregion
1509
- //#region src/components/Mutation.tsx
1693
+ // src/components/Mutation.tsx
1510
1694
  const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1511
1695
  const callPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1512
1696
  function buildMutationParamsNode(node, options) {
@@ -1528,7 +1712,10 @@ function buildMutationParamsNode(node, options) {
1528
1712
  }
1529
1713
  function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnType = "full" }) {
1530
1714
  const { TData, TError } = buildResponseTypes(node, tsResolver);
1531
- const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver });
1715
+ const groupedParam = buildGroupedRequestParam(node, {
1716
+ resolver: tsResolver,
1717
+ withContentType: true
1718
+ });
1532
1719
  const hasMutationParams = groupedParam !== null;
1533
1720
  const groupedParamsNode = (0, _kubb_plugin_ts.createFunctionParameters)({ params: groupedParam ? [groupedParam] : [] });
1534
1721
  const argBindingStr = hasMutationParams ? callPrinter.print(groupedParamsNode) ?? "" : "";
@@ -1536,6 +1723,8 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
1536
1723
  const mutationFnBody = buildCallResultBody(buildClientCall(node, {
1537
1724
  clientName,
1538
1725
  signal: false,
1726
+ withContentType: true,
1727
+ returnType,
1539
1728
  unwrapName: (name) => `toValue<${TRequest}['${name}']>(${name})`
1540
1729
  }), { returnType });
1541
1730
  const generics = [
@@ -1572,8 +1761,7 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
1572
1761
  })
1573
1762
  });
1574
1763
  }
1575
- //#endregion
1576
- //#region src/generators/mutationGenerator.tsx
1764
+ // src/generators/mutationGenerator.tsx
1577
1765
  /**
1578
1766
  * Built-in generator for `useMutation` composables. Emits one
1579
1767
  * `useFooMutation` composable per POST/PUT/DELETE operation (configurable
@@ -1647,8 +1835,7 @@ const mutationGenerator = (0, kubb_kit.defineGenerator)({
1647
1835
  });
1648
1836
  }
1649
1837
  });
1650
- //#endregion
1651
- //#region src/generators/queryGenerator.tsx
1838
+ // src/generators/queryGenerator.tsx
1652
1839
  /**
1653
1840
  * Built-in generator for `useQuery` composables. Emits one `useFooQuery`
1654
1841
  * composable per GET and QUERY operation (configurable via `query.methods`) plus the
@@ -1749,14 +1936,13 @@ const queryGenerator = (0, kubb_kit.defineGenerator)({
1749
1936
  });
1750
1937
  }
1751
1938
  });
1752
- //#endregion
1753
- //#region src/resolvers/resolverVueQuery.ts
1939
+ // src/resolvers/resolverVueQuery.ts
1754
1940
  /**
1755
1941
  * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
1756
1942
  * file paths for every generated TanStack Query composable (`useFoo`,
1757
1943
  * `useFooInfinite`) and its companion helpers.
1758
1944
  *
1759
- * The `default` helpers are supplied by `createResolver`. Functions and files use camelCase;
1945
+ * The `default` helpers are supplied by `createResolver`. Functions use safe camelCase identifiers;
1760
1946
  * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,
1761
1947
  * `infiniteQuery`, and `mutation` namespaces.
1762
1948
  *
@@ -1771,17 +1957,21 @@ const queryGenerator = (0, kubb_kit.defineGenerator)({
1771
1957
  */
1772
1958
  const resolverVueQuery = (0, kubb_kit.createResolver)({
1773
1959
  pluginName: "plugin-vue-query",
1960
+ name: resolveOperationName,
1774
1961
  query: createQueryResolver(),
1775
1962
  infiniteQuery: createQueryResolver("Infinite"),
1776
1963
  mutation: {
1777
1964
  ...createMutationResolver(),
1778
1965
  typeName(node) {
1779
- return capitalize(this.name(node.operationId));
1966
+ const name = capitalize(this.name(node.operationId));
1967
+ return this.resolveName({
1968
+ key: operationKey(node, "mutation", "typeName"),
1969
+ name
1970
+ });
1780
1971
  }
1781
1972
  }
1782
1973
  });
1783
- //#endregion
1784
- //#region src/plugin.ts
1974
+ // src/plugin.ts
1785
1975
  /**
1786
1976
  * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
1787
1977
  * and cross-plugin dependency references.
@@ -1849,7 +2039,6 @@ const pluginVueQuery = (0, kubb_kit.defineExtension)({
1849
2039
  };
1850
2040
  }
1851
2041
  });
1852
- //#endregion
1853
2042
  exports.default = pluginVueQuery;
1854
2043
  exports.definePageParam = definePageParam;
1855
2044
  exports.mutationKeyTransformer = mutationKeyTransformer;