@kubb/plugin-vue-query 5.7.0-canary.20261025T201031 → 5.7.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 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;
@@ -253,8 +286,7 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
253
286
  byResolver.set(cacheKey, result);
254
287
  return result;
255
288
  }
256
- //#endregion
257
- //#region ../../internals/utils/src/casing.ts
289
+ // ../../internals/utils/src/casing.ts
258
290
  /**
259
291
  * Shared implementation for camelCase and PascalCase conversion.
260
292
  * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
@@ -301,8 +333,146 @@ function camelCase(text, { prefix = "", suffix = "" } = {}) {
301
333
  function capitalize(text) {
302
334
  return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
303
335
  }
304
- //#endregion
305
- //#region ../../internals/utils/src/strings.ts
336
+ // ../../internals/utils/src/reserved.ts
337
+ /**
338
+ * JavaScript and Java reserved words.
339
+ * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
340
+ */
341
+ const reservedWords = /* @__PURE__ */ new Set([
342
+ "abstract",
343
+ "arguments",
344
+ "await",
345
+ "boolean",
346
+ "break",
347
+ "byte",
348
+ "case",
349
+ "catch",
350
+ "char",
351
+ "class",
352
+ "const",
353
+ "continue",
354
+ "debugger",
355
+ "default",
356
+ "delete",
357
+ "do",
358
+ "double",
359
+ "else",
360
+ "enum",
361
+ "eval",
362
+ "export",
363
+ "extends",
364
+ "false",
365
+ "final",
366
+ "finally",
367
+ "float",
368
+ "for",
369
+ "function",
370
+ "goto",
371
+ "if",
372
+ "implements",
373
+ "import",
374
+ "in",
375
+ "instanceof",
376
+ "int",
377
+ "interface",
378
+ "let",
379
+ "long",
380
+ "native",
381
+ "new",
382
+ "null",
383
+ "package",
384
+ "private",
385
+ "protected",
386
+ "public",
387
+ "return",
388
+ "short",
389
+ "static",
390
+ "super",
391
+ "switch",
392
+ "synchronized",
393
+ "this",
394
+ "throw",
395
+ "throws",
396
+ "transient",
397
+ "true",
398
+ "try",
399
+ "typeof",
400
+ "var",
401
+ "void",
402
+ "volatile",
403
+ "while",
404
+ "with",
405
+ "yield",
406
+ "Array",
407
+ "Date",
408
+ "hasOwnProperty",
409
+ "Infinity",
410
+ "isFinite",
411
+ "isNaN",
412
+ "isPrototypeOf",
413
+ "length",
414
+ "Math",
415
+ "name",
416
+ "NaN",
417
+ "Number",
418
+ "Object",
419
+ "prototype",
420
+ "String",
421
+ "toString",
422
+ "undefined",
423
+ "valueOf"
424
+ ]);
425
+ /**
426
+ * Returns `true` when `name` is a syntactically valid JavaScript variable name.
427
+ *
428
+ * @example
429
+ * ```ts
430
+ * isValidVarName('status') // true
431
+ * isValidVarName('class') // false (reserved word)
432
+ * isValidVarName('42foo') // false (starts with digit)
433
+ * ```
434
+ */
435
+ function isValidVarName(name) {
436
+ if (!name || reservedWords.has(name)) return false;
437
+ return isIdentifier(name);
438
+ }
439
+ /**
440
+ * Returns `name` when it's a syntactically valid JavaScript variable name,
441
+ * otherwise prefixes it with `_` so the result is a valid identifier.
442
+ *
443
+ * Useful for sanitizing OpenAPI schema names or operation IDs that start with
444
+ * a digit (e.g. `409`, `504AccountCancel`) before using them as exported
445
+ * variable, type, or function names.
446
+ *
447
+ * @example
448
+ * ```ts
449
+ * ensureValidVarName('409') // '_409'
450
+ * ensureValidVarName('504AccountCancel') // '_504AccountCancel'
451
+ * ensureValidVarName('Pet') // 'Pet'
452
+ * ensureValidVarName('class') // '_class'
453
+ * ```
454
+ */
455
+ function ensureValidVarName(name) {
456
+ if (!name || isValidVarName(name)) return name;
457
+ return `_${name}`;
458
+ }
459
+ /**
460
+ * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.
461
+ *
462
+ * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys
463
+ * even though they are not valid variable names, so use this (not {@link isValidVarName}) when
464
+ * deciding whether an object key needs quoting.
465
+ *
466
+ * @example
467
+ * ```ts
468
+ * isIdentifier('name') // true
469
+ * isIdentifier('x-total')// false
470
+ * ```
471
+ */
472
+ function isIdentifier(name) {
473
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
474
+ }
475
+ // ../../internals/utils/src/strings.ts
306
476
  /**
307
477
  * Renders a dotted path or string array as an optional-chaining accessor expression rooted at
308
478
  * `accessor`. Returns `null` for an empty path.
@@ -318,8 +488,29 @@ function getNestedAccessor(param, accessor) {
318
488
  if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
319
489
  return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
320
490
  }
321
- //#endregion
322
- //#region ../../internals/shared/src/group.ts
491
+ // ../../internals/shared/src/resolver.ts
492
+ function resolveOperationName(name) {
493
+ return ensureValidVarName(camelCase(name));
494
+ }
495
+ /**
496
+ * Builds the allocation key for a declaration an operation owns. `scope` names which declaration
497
+ * it is, so two of them never share an allocation even when a custom resolver gives both the same
498
+ * name. Leave `scope` empty for the operation's own declaration.
499
+ *
500
+ * @example
501
+ * ```ts
502
+ * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })
503
+ * ```
504
+ */
505
+ function operationKey(node, ...scope) {
506
+ return [
507
+ "operation",
508
+ node.method,
509
+ node.path,
510
+ ...scope.map(String)
511
+ ];
512
+ }
513
+ // ../../internals/shared/src/group.ts
323
514
  /**
324
515
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
325
516
  * shared default naming so every plugin groups output consistently:
@@ -349,17 +540,14 @@ function createGroupConfig(group) {
349
540
  name: group.name ? group.name : defaultName
350
541
  };
351
542
  }
352
- //#endregion
353
- //#region kubb-extension.json
543
+ // kubb-extension.json
354
544
  var compatibility = {
355
- "kubb": ">=5.8.3",
545
+ "kubb": ">=5.14.6",
356
546
  "node": ">=22.22"
357
547
  };
358
- //#endregion
359
- //#region package.json
360
- var version = "5.7.0-canary.20261025T201031";
361
- //#endregion
362
- //#region ../../internals/client/src/resolveOperationTypes.ts
548
+ // package.json
549
+ var version = "5.7.0";
550
+ // ../../internals/client/src/resolveOperationTypes.ts
363
551
  /**
364
552
  * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
365
553
  * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.
@@ -425,8 +613,7 @@ function resolveOperationTypes(driver, pluginName) {
425
613
  group: pluginZod.options.group ?? void 0
426
614
  };
427
615
  }
428
- //#endregion
429
- //#region ../../internals/client/src/resolveClient.ts
616
+ // ../../internals/client/src/resolveClient.ts
430
617
  /**
431
618
  * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
432
619
  * operation, shared so the selection rules and diagnostics stay in one place.
@@ -536,8 +723,7 @@ function resolveContractClient(options) {
536
723
  }
537
724
  return resolved;
538
725
  }
539
- //#endregion
540
- //#region ../../internals/client/src/resolveClientOperation.ts
726
+ // ../../internals/client/src/resolveClientOperation.ts
541
727
  function isRelativeImport(importPath) {
542
728
  return importPath.startsWith(".");
543
729
  }
@@ -584,8 +770,12 @@ function resolveClientOperation(options) {
584
770
  group: operationOptions.group ?? void 0
585
771
  });
586
772
  const { importPath } = operationOptions;
773
+ const name = resolver.name(node.operationId);
587
774
  return {
588
- name: resolver.name(node.operationId),
775
+ name: resolver.resolveName({
776
+ key: operationKey(node),
777
+ name
778
+ }),
589
779
  path: file.path,
590
780
  clientPath: importPath === void 0 ? node_path.default.resolve(root, ".kubb/client.ts") : resolveImportPath({
591
781
  importPath,
@@ -596,8 +786,7 @@ function resolveClientOperation(options) {
596
786
  };
597
787
  });
598
788
  }
599
- //#endregion
600
- //#region ../../internals/tanstack-query/src/components/HookFile.tsx
789
+ // ../../internals/tanstack-query/src/components/HookFile.tsx
601
790
  /**
602
791
  * Resolves what every TanStack hook file shares: its file, the operation types file and names (`@kubb/plugin-ts`, or
603
792
  * `pluginZod({ inferred: 'codec' })`), banner and footer.
@@ -686,8 +875,7 @@ function HookFile({ hook, imports, children }) {
686
875
  ]
687
876
  });
688
877
  }
689
- //#endregion
690
- //#region ../../internals/tanstack-query/src/utils.ts
878
+ // ../../internals/tanstack-query/src/utils.ts
691
879
  /**
692
880
  * The grouped request options, ordered for both the destructured signature and the
693
881
  * call passed to the underlying client.
@@ -723,7 +911,7 @@ function maybeRefOrGetter(type) {
723
911
  * `MaybeRefOrGetter` per group.
724
912
  */
725
913
  function buildGroupedRequestParam(node, options) {
726
- const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options;
914
+ const { resolver, keys = requestGroupOrder, memberTypeWrapper, withContentType = false } = options;
727
915
  const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node);
728
916
  const names = keys.filter((key) => groups[key]);
729
917
  if (names.length === 0) return null;
@@ -735,6 +923,11 @@ function buildGroupedRequestParam(node, options) {
735
923
  };
736
924
  const isOptional = names.every((name) => !requiredByGroup[name]);
737
925
  const optionsName = resolver.response.options(node);
926
+ if (withContentType && hasRequestContentTypeChoice(node)) return (0, _kubb_plugin_ts.createFunctionParameter)({
927
+ name: "variables",
928
+ type: optionsName,
929
+ optional: false
930
+ });
738
931
  const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key));
739
932
  const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(" | ")}>` : optionsName;
740
933
  if (memberTypeWrapper) {
@@ -792,14 +985,17 @@ function buildQueryOptionsParams(node, options) {
792
985
  * ```
793
986
  */
794
987
  function buildClientCall(node, options) {
795
- const { clientName, signal = false, unwrapName } = options;
988
+ const { clientName, signal = false, unwrapName, withContentType = false, returnType = "full" } = options;
796
989
  const { groups } = getRequestGroupOptionality(node);
797
- return `${clientName}({ ${[
990
+ const names = requestGroupOrder.filter((key) => groups[key]);
991
+ const args = [
798
992
  "...config",
799
- ...requestGroupOrder.filter((key) => groups[key]).map((name) => unwrapName ? `${name}: ${unwrapName(name)}` : name),
993
+ ...withContentType && hasRequestContentTypeChoice(node) ? ["...variables"] : names.map((name) => unwrapName ? `${name}: ${unwrapName(name)}` : name),
800
994
  signal ? "signal: config.signal ?? signal" : null,
801
995
  "throwOnError: true"
802
- ].filter((part) => part !== null).join(", ")} })`;
996
+ ].filter((part) => part !== null);
997
+ if (withContentType && hasRequestContentTypeChoice(node)) return `${clientName}(${castToClientOptions(`{ ${args.join(", ")} }`, clientName, returnType)})`;
998
+ return `${clientName}({ ${args.join(", ")} })`;
803
999
  }
804
1000
  /**
805
1001
  * Builds the query/mutation body that resolves a `buildClientCall` expression down to the bare
@@ -895,9 +1091,14 @@ function resolveMutationConfig(mutation, options) {
895
1091
  /**
896
1092
  * Classifies an operation as a query or a mutation from the resolved `query` / `mutation` method lists.
897
1093
  * 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.
1094
+ * enabled query config never counts as a mutation. Event streams are consumed through the client
1095
+ * directly, so they do not generate query or mutation hooks.
899
1096
  */
900
1097
  function classifyOperation(node, { query, mutation }) {
1098
+ if (isEventStream(node)) return {
1099
+ isQuery: false,
1100
+ isMutation: false
1101
+ };
901
1102
  const isQuery = !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
902
1103
  const queryMethods = new Set(query ? query.methods : []);
903
1104
  return {
@@ -1006,8 +1207,7 @@ function buildHookParams(node, options) {
1006
1207
  function resolveMutationRequestType(node, resolver) {
1007
1208
  return buildGroupedRequestParam(node, { resolver }) ? resolver.response.options(node) : "undefined";
1008
1209
  }
1009
- //#endregion
1010
- //#region ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1210
+ // ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1011
1211
  const declarationPrinter$5 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1012
1212
  const callPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1013
1213
  function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitInitialPageParam, cursorParam, nextParam, previousParam, getNextPageParam, getPreviousPageParam, node, tsResolver, queryParam, queryKeyName, queryKeyType = "typeof queryKey", memberTypeWrapper, unwrapName, returnType = "full" }) {
@@ -1083,8 +1283,7 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
1083
1283
  })
1084
1284
  });
1085
1285
  }
1086
- //#endregion
1087
- //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
1286
+ // ../../internals/tanstack-query/src/components/MutationKey.tsx
1088
1287
  const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1089
1288
  /**
1090
1289
  * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
@@ -1131,8 +1330,7 @@ function MutationKey({ name, node, transformer, typeName }) {
1131
1330
  })
1132
1331
  })] });
1133
1332
  }
1134
- //#endregion
1135
- //#region ../../internals/tanstack-query/src/resolver.ts
1333
+ // ../../internals/tanstack-query/src/resolver.ts
1136
1334
  /**
1137
1335
  * Builds the shared query namespace for a variant. Spread the result into
1138
1336
  * `createResolver` once per variant the plugin supports.
@@ -1148,19 +1346,39 @@ function MutationKey({ name, node, transformer, typeName }) {
1148
1346
  function createQueryResolver(variant = "") {
1149
1347
  return {
1150
1348
  name(node) {
1151
- return `use${capitalize(this.name(node.operationId))}${variant}`;
1349
+ const name = `use${capitalize(this.name(node.operationId))}${variant}`;
1350
+ return this.resolveName({
1351
+ key: operationKey(node, "query", variant, "name"),
1352
+ name
1353
+ });
1152
1354
  },
1153
1355
  optionsName(node) {
1154
- return `${this.name(node.operationId)}${variant}QueryOptions`;
1356
+ const name = `${this.name(node.operationId)}${variant}QueryOptions`;
1357
+ return this.resolveName({
1358
+ key: operationKey(node, "query", variant, "optionsName"),
1359
+ name
1360
+ });
1155
1361
  },
1156
1362
  keyName(node) {
1157
- return `${this.name(node.operationId)}${variant}QueryKey`;
1363
+ const name = `${this.name(node.operationId)}${variant}QueryKey`;
1364
+ return this.resolveName({
1365
+ key: operationKey(node, "query", variant, "keyName"),
1366
+ name
1367
+ });
1158
1368
  },
1159
1369
  keyTypeName(node) {
1160
- return `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
1370
+ const name = `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
1371
+ return this.resolveName({
1372
+ key: operationKey(node, "query", variant, "keyTypeName"),
1373
+ name
1374
+ });
1161
1375
  },
1162
1376
  clientName(node) {
1163
- return `${this.name(node.operationId)}${variant}`;
1377
+ const name = `${this.name(node.operationId)}${variant}`;
1378
+ return this.resolveName({
1379
+ key: operationKey(node, "query", variant, "clientName"),
1380
+ name
1381
+ });
1164
1382
  }
1165
1383
  };
1166
1384
  }
@@ -1177,15 +1395,22 @@ function createQueryResolver(variant = "") {
1177
1395
  function createMutationResolver() {
1178
1396
  return {
1179
1397
  name(node) {
1180
- return `use${capitalize(this.name(node.operationId))}`;
1398
+ const name = `use${capitalize(this.name(node.operationId))}`;
1399
+ return this.resolveName({
1400
+ key: operationKey(node, "mutation", "name"),
1401
+ name
1402
+ });
1181
1403
  },
1182
1404
  keyName(node) {
1183
- return `${this.name(node.operationId)}MutationKey`;
1405
+ const name = `${this.name(node.operationId)}MutationKey`;
1406
+ return this.resolveName({
1407
+ key: operationKey(node, "mutation", "keyName"),
1408
+ name
1409
+ });
1184
1410
  }
1185
1411
  };
1186
1412
  }
1187
- //#endregion
1188
- //#region ../../internals/tanstack-query/src/components/QueryKey.tsx
1413
+ // ../../internals/tanstack-query/src/components/QueryKey.tsx
1189
1414
  const declarationPrinter$3 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1190
1415
  /**
1191
1416
  * Default `queryKey` builder. Call it from a custom builder to extend the default key.
@@ -1243,8 +1468,7 @@ function QueryKey({ name, node, tsResolver, typeName, transformer, variant = "qu
1243
1468
  })
1244
1469
  })] });
1245
1470
  }
1246
- //#endregion
1247
- //#region src/components/QueryOptions.tsx
1471
+ // src/components/QueryOptions.tsx
1248
1472
  const declarationPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1249
1473
  const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1250
1474
  function getQueryOptionsParams(node, options) {
@@ -1287,8 +1511,7 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, return
1287
1511
  })
1288
1512
  });
1289
1513
  }
1290
- //#endregion
1291
- //#region src/components/Query.tsx
1514
+ // src/components/Query.tsx
1292
1515
  const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1293
1516
  const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1294
1517
  function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver, infinite }) {
@@ -1371,8 +1594,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, t
1371
1594
  })
1372
1595
  });
1373
1596
  }
1374
- //#endregion
1375
- //#region src/generators/infiniteQueryGenerator.tsx
1597
+ // src/generators/infiniteQueryGenerator.tsx
1376
1598
  /**
1377
1599
  * Built-in generator for `useInfiniteQuery` composables. Enabled when
1378
1600
  * `pluginVueQuery({ infinite: { ... }, hooks: true })`. Emits one
@@ -1505,8 +1727,7 @@ const infiniteQueryGenerator = (0, kubb_kit.defineGenerator)({
1505
1727
  });
1506
1728
  }
1507
1729
  });
1508
- //#endregion
1509
- //#region src/components/Mutation.tsx
1730
+ // src/components/Mutation.tsx
1510
1731
  const declarationPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1511
1732
  const callPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1512
1733
  function buildMutationParamsNode(node, options) {
@@ -1528,7 +1749,10 @@ function buildMutationParamsNode(node, options) {
1528
1749
  }
1529
1750
  function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnType = "full" }) {
1530
1751
  const { TData, TError } = buildResponseTypes(node, tsResolver);
1531
- const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver });
1752
+ const groupedParam = buildGroupedRequestParam(node, {
1753
+ resolver: tsResolver,
1754
+ withContentType: true
1755
+ });
1532
1756
  const hasMutationParams = groupedParam !== null;
1533
1757
  const groupedParamsNode = (0, _kubb_plugin_ts.createFunctionParameters)({ params: groupedParam ? [groupedParam] : [] });
1534
1758
  const argBindingStr = hasMutationParams ? callPrinter.print(groupedParamsNode) ?? "" : "";
@@ -1536,6 +1760,8 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
1536
1760
  const mutationFnBody = buildCallResultBody(buildClientCall(node, {
1537
1761
  clientName,
1538
1762
  signal: false,
1763
+ withContentType: true,
1764
+ returnType,
1539
1765
  unwrapName: (name) => `toValue<${TRequest}['${name}']>(${name})`
1540
1766
  }), { returnType });
1541
1767
  const generics = [
@@ -1572,8 +1798,7 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
1572
1798
  })
1573
1799
  });
1574
1800
  }
1575
- //#endregion
1576
- //#region src/generators/mutationGenerator.tsx
1801
+ // src/generators/mutationGenerator.tsx
1577
1802
  /**
1578
1803
  * Built-in generator for `useMutation` composables. Emits one
1579
1804
  * `useFooMutation` composable per POST/PUT/DELETE operation (configurable
@@ -1647,8 +1872,7 @@ const mutationGenerator = (0, kubb_kit.defineGenerator)({
1647
1872
  });
1648
1873
  }
1649
1874
  });
1650
- //#endregion
1651
- //#region src/generators/queryGenerator.tsx
1875
+ // src/generators/queryGenerator.tsx
1652
1876
  /**
1653
1877
  * Built-in generator for `useQuery` composables. Emits one `useFooQuery`
1654
1878
  * composable per GET and QUERY operation (configurable via `query.methods`) plus the
@@ -1749,14 +1973,13 @@ const queryGenerator = (0, kubb_kit.defineGenerator)({
1749
1973
  });
1750
1974
  }
1751
1975
  });
1752
- //#endregion
1753
- //#region src/resolvers/resolverVueQuery.ts
1976
+ // src/resolvers/resolverVueQuery.ts
1754
1977
  /**
1755
1978
  * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
1756
1979
  * file paths for every generated TanStack Query composable (`useFoo`,
1757
1980
  * `useFooInfinite`) and its companion helpers.
1758
1981
  *
1759
- * The `default` helpers are supplied by `createResolver`. Functions and files use camelCase;
1982
+ * The `default` helpers are supplied by `createResolver`. Functions use safe camelCase identifiers;
1760
1983
  * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,
1761
1984
  * `infiniteQuery`, and `mutation` namespaces.
1762
1985
  *
@@ -1771,17 +1994,21 @@ const queryGenerator = (0, kubb_kit.defineGenerator)({
1771
1994
  */
1772
1995
  const resolverVueQuery = (0, kubb_kit.createResolver)({
1773
1996
  pluginName: "plugin-vue-query",
1997
+ name: resolveOperationName,
1774
1998
  query: createQueryResolver(),
1775
1999
  infiniteQuery: createQueryResolver("Infinite"),
1776
2000
  mutation: {
1777
2001
  ...createMutationResolver(),
1778
2002
  typeName(node) {
1779
- return capitalize(this.name(node.operationId));
2003
+ const name = capitalize(this.name(node.operationId));
2004
+ return this.resolveName({
2005
+ key: operationKey(node, "mutation", "typeName"),
2006
+ name
2007
+ });
1780
2008
  }
1781
2009
  }
1782
2010
  });
1783
- //#endregion
1784
- //#region src/plugin.ts
2011
+ // src/plugin.ts
1785
2012
  /**
1786
2013
  * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
1787
2014
  * and cross-plugin dependency references.
@@ -1849,7 +2076,6 @@ const pluginVueQuery = (0, kubb_kit.defineExtension)({
1849
2076
  };
1850
2077
  }
1851
2078
  });
1852
- //#endregion
1853
2079
  exports.default = pluginVueQuery;
1854
2080
  exports.definePageParam = definePageParam;
1855
2081
  exports.mutationKeyTransformer = mutationKeyTransformer;