@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.js CHANGED
@@ -4,8 +4,7 @@ import { createFunctionParameter, createFunctionParameters, createObjectBindingP
4
4
  import { pluginZodName } from "@kubb/plugin-zod";
5
5
  import { File, Function, Type, jsxRenderer } from "kubb/jsx";
6
6
  import { Fragment, jsx, jsxs } from "kubb/jsx/jsx-runtime";
7
- //#endregion
8
- //#region ../../internals/shared/src/operation.ts
7
+ // ../../internals/shared/src/operation.ts
9
8
  /**
10
9
  * Builds the `ResolverFileParams` every operation generator passes to
11
10
  * `resolver.file`: a file named `name`, tagged by the operation's first
@@ -74,6 +73,24 @@ function getContentTypeInfo(node) {
74
73
  function getResponseContentTypeInfo(node) {
75
74
  return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? []);
76
75
  }
76
+ /**
77
+ * Reads the single base content type of an operation's primary success response, lowercased and
78
+ * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or
79
+ * more than one content type, since neither case has a single type to act on.
80
+ */
81
+ function getPrimarySuccessContentType(node) {
82
+ const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? [];
83
+ if (contentTypes.length !== 1) return void 0;
84
+ return contentTypes[0].split(";")[0].trim().toLowerCase();
85
+ }
86
+ /**
87
+ * Whether an operation streams its primary success response as Server-Sent Events
88
+ * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a
89
+ * one-shot `RequestResult`.
90
+ */
91
+ function isEventStream(node) {
92
+ return getPrimarySuccessContentType(node) === "text/event-stream";
93
+ }
77
94
  const requestConfigBaseType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`;
78
95
  function buildRequestConfigType(node) {
79
96
  const request = getContentTypeInfo(node);
@@ -165,6 +182,22 @@ function getOperationParameters(node) {
165
182
  operationParameterGroupsByNode.set(node, groups);
166
183
  return groups;
167
184
  }
185
+ /**
186
+ * Builds the combined `{ body, path, query, headers }` options object schema for an operation,
187
+ * referencing the already-resolved body and grouped param names. Shared by `@kubb/plugin-ts`'s
188
+ * `Options` type and `@kubb/plugin-zod`'s inferred options schema, so both printers emit the same
189
+ * shape from the same inputs. `primitive: 'object'` is a no-op for the TS printer and tells the Zod
190
+ * printer to emit `z.object(…)` rather than a record.
191
+ */
192
+ function hasRequestContentTypeChoice(node) {
193
+ return (node.requestBody?.content ?? []).filter((entry) => entry.schema).length > 1;
194
+ }
195
+ /**
196
+ * Casts a call argument to the client's parameter type; a `'plain'` client is non-generic.
197
+ */
198
+ function castToClientOptions(callArg, clientName, returnType = "full") {
199
+ return `${callArg} as Parameters<typeof ${clientName}${returnType === "plain" ? "" : "<true>"}>[0]`;
200
+ }
168
201
  function getStatusCodeNumber(statusCode) {
169
202
  const code = Number(statusCode);
170
203
  return Number.isNaN(code) ? null : code;
@@ -227,8 +260,7 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
227
260
  byResolver.set(cacheKey, result);
228
261
  return result;
229
262
  }
230
- //#endregion
231
- //#region ../../internals/utils/src/casing.ts
263
+ // ../../internals/utils/src/casing.ts
232
264
  /**
233
265
  * Shared implementation for camelCase and PascalCase conversion.
234
266
  * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
@@ -275,8 +307,146 @@ function camelCase(text, { prefix = "", suffix = "" } = {}) {
275
307
  function capitalize(text) {
276
308
  return `${text.charAt(0).toUpperCase()}${text.slice(1)}`;
277
309
  }
278
- //#endregion
279
- //#region ../../internals/utils/src/strings.ts
310
+ // ../../internals/utils/src/reserved.ts
311
+ /**
312
+ * JavaScript and Java reserved words.
313
+ * @link https://github.com/jonschlinkert/reserved/blob/master/index.js
314
+ */
315
+ const reservedWords = /* @__PURE__ */ new Set([
316
+ "abstract",
317
+ "arguments",
318
+ "await",
319
+ "boolean",
320
+ "break",
321
+ "byte",
322
+ "case",
323
+ "catch",
324
+ "char",
325
+ "class",
326
+ "const",
327
+ "continue",
328
+ "debugger",
329
+ "default",
330
+ "delete",
331
+ "do",
332
+ "double",
333
+ "else",
334
+ "enum",
335
+ "eval",
336
+ "export",
337
+ "extends",
338
+ "false",
339
+ "final",
340
+ "finally",
341
+ "float",
342
+ "for",
343
+ "function",
344
+ "goto",
345
+ "if",
346
+ "implements",
347
+ "import",
348
+ "in",
349
+ "instanceof",
350
+ "int",
351
+ "interface",
352
+ "let",
353
+ "long",
354
+ "native",
355
+ "new",
356
+ "null",
357
+ "package",
358
+ "private",
359
+ "protected",
360
+ "public",
361
+ "return",
362
+ "short",
363
+ "static",
364
+ "super",
365
+ "switch",
366
+ "synchronized",
367
+ "this",
368
+ "throw",
369
+ "throws",
370
+ "transient",
371
+ "true",
372
+ "try",
373
+ "typeof",
374
+ "var",
375
+ "void",
376
+ "volatile",
377
+ "while",
378
+ "with",
379
+ "yield",
380
+ "Array",
381
+ "Date",
382
+ "hasOwnProperty",
383
+ "Infinity",
384
+ "isFinite",
385
+ "isNaN",
386
+ "isPrototypeOf",
387
+ "length",
388
+ "Math",
389
+ "name",
390
+ "NaN",
391
+ "Number",
392
+ "Object",
393
+ "prototype",
394
+ "String",
395
+ "toString",
396
+ "undefined",
397
+ "valueOf"
398
+ ]);
399
+ /**
400
+ * Returns `true` when `name` is a syntactically valid JavaScript variable name.
401
+ *
402
+ * @example
403
+ * ```ts
404
+ * isValidVarName('status') // true
405
+ * isValidVarName('class') // false (reserved word)
406
+ * isValidVarName('42foo') // false (starts with digit)
407
+ * ```
408
+ */
409
+ function isValidVarName(name) {
410
+ if (!name || reservedWords.has(name)) return false;
411
+ return isIdentifier(name);
412
+ }
413
+ /**
414
+ * Returns `name` when it's a syntactically valid JavaScript variable name,
415
+ * otherwise prefixes it with `_` so the result is a valid identifier.
416
+ *
417
+ * Useful for sanitizing OpenAPI schema names or operation IDs that start with
418
+ * a digit (e.g. `409`, `504AccountCancel`) before using them as exported
419
+ * variable, type, or function names.
420
+ *
421
+ * @example
422
+ * ```ts
423
+ * ensureValidVarName('409') // '_409'
424
+ * ensureValidVarName('504AccountCancel') // '_504AccountCancel'
425
+ * ensureValidVarName('Pet') // 'Pet'
426
+ * ensureValidVarName('class') // '_class'
427
+ * ```
428
+ */
429
+ function ensureValidVarName(name) {
430
+ if (!name || isValidVarName(name)) return name;
431
+ return `_${name}`;
432
+ }
433
+ /**
434
+ * Returns `true` when `name` is syntactically a valid identifier, ignoring reserved words.
435
+ *
436
+ * Reserved words and globals (`class`, `name`, `Date`, …) are valid as bare object-literal keys
437
+ * even though they are not valid variable names, so use this (not {@link isValidVarName}) when
438
+ * deciding whether an object key needs quoting.
439
+ *
440
+ * @example
441
+ * ```ts
442
+ * isIdentifier('name') // true
443
+ * isIdentifier('x-total')// false
444
+ * ```
445
+ */
446
+ function isIdentifier(name) {
447
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
448
+ }
449
+ // ../../internals/utils/src/strings.ts
280
450
  /**
281
451
  * Renders a dotted path or string array as an optional-chaining accessor expression rooted at
282
452
  * `accessor`. Returns `null` for an empty path.
@@ -292,8 +462,29 @@ function getNestedAccessor(param, accessor) {
292
462
  if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
293
463
  return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
294
464
  }
295
- //#endregion
296
- //#region ../../internals/shared/src/group.ts
465
+ // ../../internals/shared/src/resolver.ts
466
+ function resolveOperationName(name) {
467
+ return ensureValidVarName(camelCase(name));
468
+ }
469
+ /**
470
+ * Builds the allocation key for a declaration an operation owns. `scope` names which declaration
471
+ * it is, so two of them never share an allocation even when a custom resolver gives both the same
472
+ * name. Leave `scope` empty for the operation's own declaration.
473
+ *
474
+ * @example
475
+ * ```ts
476
+ * resolver.resolveName({ key: operationKey(node, 'response', 'status', 404), name })
477
+ * ```
478
+ */
479
+ function operationKey(node, ...scope) {
480
+ return [
481
+ "operation",
482
+ node.method,
483
+ node.path,
484
+ ...scope.map(String)
485
+ ];
486
+ }
487
+ // ../../internals/shared/src/group.ts
297
488
  /**
298
489
  * Builds the `group` config a Kubb plugin passes to `ctx.setOptions`, applying the
299
490
  * shared default naming so every plugin groups output consistently:
@@ -323,17 +514,14 @@ function createGroupConfig(group) {
323
514
  name: group.name ? group.name : defaultName
324
515
  };
325
516
  }
326
- //#endregion
327
- //#region kubb-extension.json
517
+ // kubb-extension.json
328
518
  var compatibility = {
329
- "kubb": ">=5.8.3",
519
+ "kubb": ">=5.14.6",
330
520
  "node": ">=22.22"
331
521
  };
332
- //#endregion
333
- //#region package.json
334
- var version = "5.7.0-canary.20261025T201031";
335
- //#endregion
336
- //#region ../../internals/client/src/resolveOperationTypes.ts
522
+ // package.json
523
+ var version = "5.7.0";
524
+ // ../../internals/client/src/resolveOperationTypes.ts
337
525
  /**
338
526
  * A `plugin-ts` shaped resolver whose operation type names point at the types `pluginZod({ inferred })`
339
527
  * exports next to each schema, so code written against `plugin-ts` names picks up the zod types.
@@ -399,8 +587,7 @@ function resolveOperationTypes(driver, pluginName) {
399
587
  group: pluginZod.options.group ?? void 0
400
588
  };
401
589
  }
402
- //#endregion
403
- //#region ../../internals/client/src/resolveClient.ts
590
+ // ../../internals/client/src/resolveClient.ts
404
591
  /**
405
592
  * Resolves which client plugin a consumer (react-query, vue-query, swr, mcp) should call for an
406
593
  * operation, shared so the selection rules and diagnostics stay in one place.
@@ -510,8 +697,7 @@ function resolveContractClient(options) {
510
697
  }
511
698
  return resolved;
512
699
  }
513
- //#endregion
514
- //#region ../../internals/client/src/resolveClientOperation.ts
700
+ // ../../internals/client/src/resolveClientOperation.ts
515
701
  function isRelativeImport(importPath) {
516
702
  return importPath.startsWith(".");
517
703
  }
@@ -558,8 +744,12 @@ function resolveClientOperation(options) {
558
744
  group: operationOptions.group ?? void 0
559
745
  });
560
746
  const { importPath } = operationOptions;
747
+ const name = resolver.name(node.operationId);
561
748
  return {
562
- name: resolver.name(node.operationId),
749
+ name: resolver.resolveName({
750
+ key: operationKey(node),
751
+ name
752
+ }),
563
753
  path: file.path,
564
754
  clientPath: importPath === void 0 ? path.resolve(root, ".kubb/client.ts") : resolveImportPath({
565
755
  importPath,
@@ -570,8 +760,7 @@ function resolveClientOperation(options) {
570
760
  };
571
761
  });
572
762
  }
573
- //#endregion
574
- //#region ../../internals/tanstack-query/src/components/HookFile.tsx
763
+ // ../../internals/tanstack-query/src/components/HookFile.tsx
575
764
  /**
576
765
  * Resolves what every TanStack hook file shares: its file, the operation types file and names (`@kubb/plugin-ts`, or
577
766
  * `pluginZod({ inferred: 'codec' })`), banner and footer.
@@ -660,8 +849,7 @@ function HookFile({ hook, imports, children }) {
660
849
  ]
661
850
  });
662
851
  }
663
- //#endregion
664
- //#region ../../internals/tanstack-query/src/utils.ts
852
+ // ../../internals/tanstack-query/src/utils.ts
665
853
  /**
666
854
  * The grouped request options, ordered for both the destructured signature and the
667
855
  * call passed to the underlying client.
@@ -697,7 +885,7 @@ function maybeRefOrGetter(type) {
697
885
  * `MaybeRefOrGetter` per group.
698
886
  */
699
887
  function buildGroupedRequestParam(node, options) {
700
- const { resolver, keys = requestGroupOrder, memberTypeWrapper } = options;
888
+ const { resolver, keys = requestGroupOrder, memberTypeWrapper, withContentType = false } = options;
701
889
  const { groups, hasRequiredPath, hasRequiredQuery, hasRequiredHeader } = getRequestGroupOptionality(node);
702
890
  const names = keys.filter((key) => groups[key]);
703
891
  if (names.length === 0) return null;
@@ -709,6 +897,11 @@ function buildGroupedRequestParam(node, options) {
709
897
  };
710
898
  const isOptional = names.every((name) => !requiredByGroup[name]);
711
899
  const optionsName = resolver.response.options(node);
900
+ if (withContentType && hasRequestContentTypeChoice(node)) return createFunctionParameter({
901
+ name: "variables",
902
+ type: optionsName,
903
+ optional: false
904
+ });
712
905
  const omittedKeys = requestGroupOrder.filter((key) => !keys.includes(key));
713
906
  const optionsType = omittedKeys.length > 0 ? `Omit<${optionsName}, ${omittedKeys.map((key) => `'${key}'`).join(" | ")}>` : optionsName;
714
907
  if (memberTypeWrapper) {
@@ -766,14 +959,17 @@ function buildQueryOptionsParams(node, options) {
766
959
  * ```
767
960
  */
768
961
  function buildClientCall(node, options) {
769
- const { clientName, signal = false, unwrapName } = options;
962
+ const { clientName, signal = false, unwrapName, withContentType = false, returnType = "full" } = options;
770
963
  const { groups } = getRequestGroupOptionality(node);
771
- return `${clientName}({ ${[
964
+ const names = requestGroupOrder.filter((key) => groups[key]);
965
+ const args = [
772
966
  "...config",
773
- ...requestGroupOrder.filter((key) => groups[key]).map((name) => unwrapName ? `${name}: ${unwrapName(name)}` : name),
967
+ ...withContentType && hasRequestContentTypeChoice(node) ? ["...variables"] : names.map((name) => unwrapName ? `${name}: ${unwrapName(name)}` : name),
774
968
  signal ? "signal: config.signal ?? signal" : null,
775
969
  "throwOnError: true"
776
- ].filter((part) => part !== null).join(", ")} })`;
970
+ ].filter((part) => part !== null);
971
+ if (withContentType && hasRequestContentTypeChoice(node)) return `${clientName}(${castToClientOptions(`{ ${args.join(", ")} }`, clientName, returnType)})`;
972
+ return `${clientName}({ ${args.join(", ")} })`;
777
973
  }
778
974
  /**
779
975
  * Builds the query/mutation body that resolves a `buildClientCall` expression down to the bare
@@ -869,9 +1065,14 @@ function resolveMutationConfig(mutation, options) {
869
1065
  /**
870
1066
  * Classifies an operation as a query or a mutation from the resolved `query` / `mutation` method lists.
871
1067
  * Disabled query and mutation configs do not claim operations, and a method already claimed by an
872
- * enabled query config never counts as a mutation.
1068
+ * enabled query config never counts as a mutation. Event streams are consumed through the client
1069
+ * directly, so they do not generate query or mutation hooks.
873
1070
  */
874
1071
  function classifyOperation(node, { query, mutation }) {
1072
+ if (isEventStream(node)) return {
1073
+ isQuery: false,
1074
+ isMutation: false
1075
+ };
875
1076
  const isQuery = !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
876
1077
  const queryMethods = new Set(query ? query.methods : []);
877
1078
  return {
@@ -980,8 +1181,7 @@ function buildHookParams(node, options) {
980
1181
  function resolveMutationRequestType(node, resolver) {
981
1182
  return buildGroupedRequestParam(node, { resolver }) ? resolver.response.options(node) : "undefined";
982
1183
  }
983
- //#endregion
984
- //#region ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
1184
+ // ../../internals/tanstack-query/src/components/InfiniteQueryOptions.tsx
985
1185
  const declarationPrinter$5 = functionPrinter({ mode: "declaration" });
986
1186
  const callPrinter$3 = functionPrinter({ mode: "call" });
987
1187
  function InfiniteQueryOptions({ name, clientName, initialPageParam, hasExplicitInitialPageParam, cursorParam, nextParam, previousParam, getNextPageParam, getPreviousPageParam, node, tsResolver, queryParam, queryKeyName, queryKeyType = "typeof queryKey", memberTypeWrapper, unwrapName, returnType = "full" }) {
@@ -1057,8 +1257,7 @@ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${que
1057
1257
  })
1058
1258
  });
1059
1259
  }
1060
- //#endregion
1061
- //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
1260
+ // ../../internals/tanstack-query/src/components/MutationKey.tsx
1062
1261
  const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
1063
1262
  /**
1064
1263
  * Default `mutationKey` builder. Call it from a custom builder to extend the default key.
@@ -1105,8 +1304,7 @@ function MutationKey({ name, node, transformer, typeName }) {
1105
1304
  })
1106
1305
  })] });
1107
1306
  }
1108
- //#endregion
1109
- //#region ../../internals/tanstack-query/src/resolver.ts
1307
+ // ../../internals/tanstack-query/src/resolver.ts
1110
1308
  /**
1111
1309
  * Builds the shared query namespace for a variant. Spread the result into
1112
1310
  * `createResolver` once per variant the plugin supports.
@@ -1122,19 +1320,39 @@ function MutationKey({ name, node, transformer, typeName }) {
1122
1320
  function createQueryResolver(variant = "") {
1123
1321
  return {
1124
1322
  name(node) {
1125
- return `use${capitalize(this.name(node.operationId))}${variant}`;
1323
+ const name = `use${capitalize(this.name(node.operationId))}${variant}`;
1324
+ return this.resolveName({
1325
+ key: operationKey(node, "query", variant, "name"),
1326
+ name
1327
+ });
1126
1328
  },
1127
1329
  optionsName(node) {
1128
- return `${this.name(node.operationId)}${variant}QueryOptions`;
1330
+ const name = `${this.name(node.operationId)}${variant}QueryOptions`;
1331
+ return this.resolveName({
1332
+ key: operationKey(node, "query", variant, "optionsName"),
1333
+ name
1334
+ });
1129
1335
  },
1130
1336
  keyName(node) {
1131
- return `${this.name(node.operationId)}${variant}QueryKey`;
1337
+ const name = `${this.name(node.operationId)}${variant}QueryKey`;
1338
+ return this.resolveName({
1339
+ key: operationKey(node, "query", variant, "keyName"),
1340
+ name
1341
+ });
1132
1342
  },
1133
1343
  keyTypeName(node) {
1134
- return `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
1344
+ const name = `${capitalize(this.name(node.operationId))}${variant}QueryKey`;
1345
+ return this.resolveName({
1346
+ key: operationKey(node, "query", variant, "keyTypeName"),
1347
+ name
1348
+ });
1135
1349
  },
1136
1350
  clientName(node) {
1137
- return `${this.name(node.operationId)}${variant}`;
1351
+ const name = `${this.name(node.operationId)}${variant}`;
1352
+ return this.resolveName({
1353
+ key: operationKey(node, "query", variant, "clientName"),
1354
+ name
1355
+ });
1138
1356
  }
1139
1357
  };
1140
1358
  }
@@ -1151,15 +1369,22 @@ function createQueryResolver(variant = "") {
1151
1369
  function createMutationResolver() {
1152
1370
  return {
1153
1371
  name(node) {
1154
- return `use${capitalize(this.name(node.operationId))}`;
1372
+ const name = `use${capitalize(this.name(node.operationId))}`;
1373
+ return this.resolveName({
1374
+ key: operationKey(node, "mutation", "name"),
1375
+ name
1376
+ });
1155
1377
  },
1156
1378
  keyName(node) {
1157
- return `${this.name(node.operationId)}MutationKey`;
1379
+ const name = `${this.name(node.operationId)}MutationKey`;
1380
+ return this.resolveName({
1381
+ key: operationKey(node, "mutation", "keyName"),
1382
+ name
1383
+ });
1158
1384
  }
1159
1385
  };
1160
1386
  }
1161
- //#endregion
1162
- //#region ../../internals/tanstack-query/src/components/QueryKey.tsx
1387
+ // ../../internals/tanstack-query/src/components/QueryKey.tsx
1163
1388
  const declarationPrinter$3 = functionPrinter({ mode: "declaration" });
1164
1389
  /**
1165
1390
  * Default `queryKey` builder. Call it from a custom builder to extend the default key.
@@ -1217,8 +1442,7 @@ function QueryKey({ name, node, tsResolver, typeName, transformer, variant = "qu
1217
1442
  })
1218
1443
  })] });
1219
1444
  }
1220
- //#endregion
1221
- //#region src/components/QueryOptions.tsx
1445
+ // src/components/QueryOptions.tsx
1222
1446
  const declarationPrinter$2 = functionPrinter({ mode: "declaration" });
1223
1447
  const callPrinter$2 = functionPrinter({ mode: "call" });
1224
1448
  function getQueryOptionsParams(node, options) {
@@ -1261,8 +1485,7 @@ function QueryOptions({ name, clientName, node, tsResolver, queryKeyName, return
1261
1485
  })
1262
1486
  });
1263
1487
  }
1264
- //#endregion
1265
- //#region src/components/Query.tsx
1488
+ // src/components/Query.tsx
1266
1489
  const declarationPrinter$1 = functionPrinter({ mode: "declaration" });
1267
1490
  const callPrinter$1 = functionPrinter({ mode: "call" });
1268
1491
  function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, tsResolver, infinite }) {
@@ -1345,8 +1568,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, node, t
1345
1568
  })
1346
1569
  });
1347
1570
  }
1348
- //#endregion
1349
- //#region src/generators/infiniteQueryGenerator.tsx
1571
+ // src/generators/infiniteQueryGenerator.tsx
1350
1572
  /**
1351
1573
  * Built-in generator for `useInfiniteQuery` composables. Enabled when
1352
1574
  * `pluginVueQuery({ infinite: { ... }, hooks: true })`. Emits one
@@ -1479,8 +1701,7 @@ const infiniteQueryGenerator = defineGenerator({
1479
1701
  });
1480
1702
  }
1481
1703
  });
1482
- //#endregion
1483
- //#region src/components/Mutation.tsx
1704
+ // src/components/Mutation.tsx
1484
1705
  const declarationPrinter = functionPrinter({ mode: "declaration" });
1485
1706
  const callPrinter = functionPrinter({ mode: "call" });
1486
1707
  function buildMutationParamsNode(node, options) {
@@ -1502,7 +1723,10 @@ function buildMutationParamsNode(node, options) {
1502
1723
  }
1503
1724
  function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnType = "full" }) {
1504
1725
  const { TData, TError } = buildResponseTypes(node, tsResolver);
1505
- const groupedParam = buildGroupedRequestParam(node, { resolver: tsResolver });
1726
+ const groupedParam = buildGroupedRequestParam(node, {
1727
+ resolver: tsResolver,
1728
+ withContentType: true
1729
+ });
1506
1730
  const hasMutationParams = groupedParam !== null;
1507
1731
  const groupedParamsNode = createFunctionParameters({ params: groupedParam ? [groupedParam] : [] });
1508
1732
  const argBindingStr = hasMutationParams ? callPrinter.print(groupedParamsNode) ?? "" : "";
@@ -1510,6 +1734,8 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
1510
1734
  const mutationFnBody = buildCallResultBody(buildClientCall(node, {
1511
1735
  clientName,
1512
1736
  signal: false,
1737
+ withContentType: true,
1738
+ returnType,
1513
1739
  unwrapName: (name) => `toValue<${TRequest}['${name}']>(${name})`
1514
1740
  }), { returnType });
1515
1741
  const generics = [
@@ -1546,8 +1772,7 @@ function Mutation({ name, clientName, node, tsResolver, mutationKeyName, returnT
1546
1772
  })
1547
1773
  });
1548
1774
  }
1549
- //#endregion
1550
- //#region src/generators/mutationGenerator.tsx
1775
+ // src/generators/mutationGenerator.tsx
1551
1776
  /**
1552
1777
  * Built-in generator for `useMutation` composables. Emits one
1553
1778
  * `useFooMutation` composable per POST/PUT/DELETE operation (configurable
@@ -1621,8 +1846,7 @@ const mutationGenerator = defineGenerator({
1621
1846
  });
1622
1847
  }
1623
1848
  });
1624
- //#endregion
1625
- //#region src/generators/queryGenerator.tsx
1849
+ // src/generators/queryGenerator.tsx
1626
1850
  /**
1627
1851
  * Built-in generator for `useQuery` composables. Emits one `useFooQuery`
1628
1852
  * composable per GET and QUERY operation (configurable via `query.methods`) plus the
@@ -1723,14 +1947,13 @@ const queryGenerator = defineGenerator({
1723
1947
  });
1724
1948
  }
1725
1949
  });
1726
- //#endregion
1727
- //#region src/resolvers/resolverVueQuery.ts
1950
+ // src/resolvers/resolverVueQuery.ts
1728
1951
  /**
1729
1952
  * Default resolver used by `@kubb/plugin-vue-query`. Decides the names and
1730
1953
  * file paths for every generated TanStack Query composable (`useFoo`,
1731
1954
  * `useFooInfinite`) and its companion helpers.
1732
1955
  *
1733
- * The `default` helpers are supplied by `createResolver`. Functions and files use camelCase;
1956
+ * The `default` helpers are supplied by `createResolver`. Functions use safe camelCase identifiers;
1734
1957
  * composables get the `use` prefix. Operation-specific naming is grouped under the `query`,
1735
1958
  * `infiniteQuery`, and `mutation` namespaces.
1736
1959
  *
@@ -1745,17 +1968,21 @@ const queryGenerator = defineGenerator({
1745
1968
  */
1746
1969
  const resolverVueQuery = createResolver({
1747
1970
  pluginName: "plugin-vue-query",
1971
+ name: resolveOperationName,
1748
1972
  query: createQueryResolver(),
1749
1973
  infiniteQuery: createQueryResolver("Infinite"),
1750
1974
  mutation: {
1751
1975
  ...createMutationResolver(),
1752
1976
  typeName(node) {
1753
- return capitalize(this.name(node.operationId));
1977
+ const name = capitalize(this.name(node.operationId));
1978
+ return this.resolveName({
1979
+ key: operationKey(node, "mutation", "typeName"),
1980
+ name
1981
+ });
1754
1982
  }
1755
1983
  }
1756
1984
  });
1757
- //#endregion
1758
- //#region src/plugin.ts
1985
+ // src/plugin.ts
1759
1986
  /**
1760
1987
  * Canonical plugin name for `@kubb/plugin-vue-query`. Used for driver lookups
1761
1988
  * and cross-plugin dependency references.
@@ -1823,7 +2050,6 @@ const pluginVueQuery = defineExtension({
1823
2050
  };
1824
2051
  }
1825
2052
  });
1826
- //#endregion
1827
2053
  export { pluginVueQuery as default, pluginVueQuery, definePageParam, mutationKeyTransformer, pluginVueQueryName, queryKeyTransformer, resolverVueQuery };
1828
2054
 
1829
2055
  //# sourceMappingURL=index.js.map