@kubb/plugin-vue-query 5.0.0-beta.42 → 5.0.0-beta.64

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.
Files changed (43) hide show
  1. package/dist/{components-Bxe1EuWf.js → components-CAlEf7Oh.js} +273 -388
  2. package/dist/components-CAlEf7Oh.js.map +1 -0
  3. package/dist/{components-BwFPMwK7.cjs → components-CfU59l8V.cjs} +274 -389
  4. package/dist/components-CfU59l8V.cjs.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.ts +1 -1
  7. package/dist/components.js +1 -1
  8. package/dist/{generators-BSN6A0ED.cjs → generators-DpMLVmyi.cjs} +91 -137
  9. package/dist/generators-DpMLVmyi.cjs.map +1 -0
  10. package/dist/{generators-D9TUvYRN.js → generators-fWBjs0CN.js} +93 -139
  11. package/dist/generators-fWBjs0CN.js.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +1 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +41 -18
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +42 -19
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-HHnnlEhK.d.ts → types-C6a_58nb.d.ts} +12 -16
  21. package/package.json +10 -18
  22. package/dist/components-BwFPMwK7.cjs.map +0 -1
  23. package/dist/components-Bxe1EuWf.js.map +0 -1
  24. package/dist/generators-BSN6A0ED.cjs.map +0 -1
  25. package/dist/generators-D9TUvYRN.js.map +0 -1
  26. package/extension.yaml +0 -1248
  27. package/src/components/InfiniteQuery.tsx +0 -127
  28. package/src/components/InfiniteQueryOptions.tsx +0 -194
  29. package/src/components/Mutation.tsx +0 -150
  30. package/src/components/MutationKey.tsx +0 -1
  31. package/src/components/Query.tsx +0 -126
  32. package/src/components/QueryKey.tsx +0 -52
  33. package/src/components/QueryOptions.tsx +0 -137
  34. package/src/components/index.ts +0 -7
  35. package/src/generators/index.ts +0 -3
  36. package/src/generators/infiniteQueryGenerator.tsx +0 -200
  37. package/src/generators/mutationGenerator.tsx +0 -158
  38. package/src/generators/queryGenerator.tsx +0 -184
  39. package/src/index.ts +0 -2
  40. package/src/plugin.ts +0 -183
  41. package/src/resolvers/resolverVueQuery.ts +0 -76
  42. package/src/types.ts +0 -272
  43. package/src/utils.ts +0 -56
@@ -25,6 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
  //#endregion
27
27
  let _kubb_core = require("@kubb/core");
28
+ let _kubb_ast_utils = require("@kubb/ast/utils");
28
29
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
29
30
  let _kubb_renderer_jsx = require("@kubb/renderer-jsx");
30
31
  let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
@@ -39,50 +40,20 @@ let _kubb_renderer_jsx_jsx_runtime = require("@kubb/renderer-jsx/jsx-runtime");
39
40
  function toCamelOrPascal(text, pascal) {
40
41
  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) => {
41
42
  if (word.length > 1 && word === word.toUpperCase()) return word;
42
- if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
43
- return word.charAt(0).toUpperCase() + word.slice(1);
43
+ return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
44
44
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
45
45
  }
46
46
  /**
47
- * Splits `text` on `.` and applies `transformPart` to each segment.
48
- * The last segment receives `isLast = true`, all earlier segments receive `false`.
49
- * Segments are joined with `/` to form a file path.
50
- *
51
- * Only splits on dots followed by a letter so that version numbers
52
- * embedded in operationIds (e.g. `v2025.0`) are kept intact.
53
- */
54
- function applyToFileParts(text, transformPart) {
55
- const parts = text.split(/\.(?=[a-zA-Z])/);
56
- return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
57
- }
58
- /**
59
47
  * Converts `text` to camelCase.
60
- * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
61
48
  *
62
- * @example
63
- * camelCase('hello-world') // 'helloWorld'
64
- * camelCase('pet.petId', { isFile: true }) // 'pet/petId'
65
- */
66
- function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
67
- if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
68
- prefix,
69
- suffix
70
- } : {}));
71
- return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
72
- }
73
- //#endregion
74
- //#region ../../internals/utils/src/object.ts
75
- /**
76
- * Converts a dot-notation path or string array into an optional-chaining accessor expression.
49
+ * @example Word boundaries
50
+ * `camelCase('hello-world') // 'helloWorld'`
77
51
  *
78
- * @example
79
- * getNestedAccessor('pagination.next.id', 'lastPage')
80
- * // → "lastPage?.['pagination']?.['next']?.['id']"
52
+ * @example With a prefix
53
+ * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
81
54
  */
82
- function getNestedAccessor(param, accessor) {
83
- const parts = Array.isArray(param) ? param : param.split(".");
84
- if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
85
- return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
55
+ function camelCase(text, { prefix = "", suffix = "" } = {}) {
56
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
86
57
  }
87
58
  //#endregion
88
59
  //#region ../../internals/utils/src/reserved.ts
@@ -188,99 +159,80 @@ function isValidVarName(name) {
188
159
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
189
160
  }
190
161
  //#endregion
191
- //#region ../../internals/utils/src/urlPath.ts
162
+ //#region ../../internals/utils/src/url.ts
163
+ function transformParam(raw, casing) {
164
+ const param = isValidVarName(raw) ? raw : camelCase(raw);
165
+ return casing === "camelcase" ? camelCase(param) : param;
166
+ }
167
+ function toParamsObject(path, { replacer, casing } = {}) {
168
+ const params = {};
169
+ for (const match of path.matchAll(/\{([^}]+)\}/g)) {
170
+ const param = transformParam(match[1], casing);
171
+ const key = replacer ? replacer(param) : param;
172
+ params[key] = key;
173
+ }
174
+ return Object.keys(params).length > 0 ? params : null;
175
+ }
192
176
  /**
193
- * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
194
- *
195
- * @example
196
- * const p = new URLPath('/pet/{petId}')
197
- * p.URL // '/pet/:petId'
198
- * p.template // '`/pet/${petId}`'
177
+ * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
199
178
  */
200
- var URLPath = class {
179
+ var Url = class Url {
201
180
  /**
202
- * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
203
- */
204
- path;
205
- #options;
206
- constructor(path, options = {}) {
207
- this.path = path;
208
- this.#options = options;
209
- }
210
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
181
+ * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.
211
182
  *
212
183
  * @example
213
- * ```ts
214
- * new URLPath('/pet/{petId}').URL // '/pet/:petId'
215
- * ```
184
+ * Url.canParse('https://petstore.swagger.io/v2') // true
185
+ * Url.canParse('/pet/{petId}') // false
216
186
  */
217
- get URL() {
218
- return this.toURLPath();
187
+ static canParse(url, base) {
188
+ return URL.canParse(url, base);
219
189
  }
220
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
190
+ /**
191
+ * Converts an OpenAPI/Swagger path to Express-style colon syntax.
221
192
  *
222
193
  * @example
223
- * ```ts
224
- * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
225
- * new URLPath('/pet/{petId}').isURL // false
226
- * ```
194
+ * Url.toPath('/pet/{petId}') // '/pet/:petId'
227
195
  */
228
- get isURL() {
229
- try {
230
- return !!new URL(this.path).href;
231
- } catch {
232
- return false;
233
- }
196
+ static toPath(path) {
197
+ return path.replace(/\{([^}]+)\}/g, ":$1");
234
198
  }
235
199
  /**
236
- * Converts the OpenAPI path to a TypeScript template literal string.
200
+ * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
201
+ * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
202
+ * and `casing` controls parameter identifier casing.
237
203
  *
238
204
  * @example
239
- * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
240
- * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
241
- */
242
- get template() {
243
- return this.toTemplateString();
244
- }
245
- /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
205
+ * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
246
206
  *
247
207
  * @example
248
- * ```ts
249
- * new URLPath('/pet/{petId}').object
250
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
251
- * ```
208
+ * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
252
209
  */
253
- get object() {
254
- return this.toObject();
210
+ static toTemplateString(path, { prefix, replacer, casing } = {}) {
211
+ const result = path.split(/\{([^}]+)\}/).map((part, i) => {
212
+ if (i % 2 === 0) return part;
213
+ const param = transformParam(part, casing);
214
+ return `\${${replacer ? replacer(param) : param}}`;
215
+ }).join("");
216
+ return `\`${prefix ?? ""}${result}\``;
255
217
  }
256
- /** Returns a map of path parameter names, or `null` when the path has no parameters.
218
+ /**
219
+ * Returns the path and its extracted params as a structured `URLObject`, or as a stringified
220
+ * expression when `stringify` is set.
257
221
  *
258
222
  * @example
259
- * ```ts
260
- * new URLPath('/pet/{petId}').params // { petId: 'petId' }
261
- * new URLPath('/pet').params // null
262
- * ```
263
- */
264
- get params() {
265
- return this.toParamsObject();
266
- }
267
- #transformParam(raw) {
268
- const param = isValidVarName(raw) ? raw : camelCase(raw);
269
- return this.#options.casing === "camelcase" ? camelCase(param) : param;
270
- }
271
- /**
272
- * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
223
+ * Url.toObject('/pet/{petId}')
224
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
273
225
  */
274
- #eachParam(fn) {
275
- for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
276
- const raw = match[1];
277
- fn(raw, this.#transformParam(raw));
278
- }
279
- }
280
- toObject({ type = "path", replacer, stringify } = {}) {
226
+ static toObject(path, { type = "path", replacer, stringify, casing } = {}) {
281
227
  const object = {
282
- url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
283
- params: this.toParamsObject()
228
+ url: type === "path" ? Url.toPath(path) : Url.toTemplateString(path, {
229
+ replacer,
230
+ casing
231
+ }),
232
+ params: toParamsObject(path, {
233
+ replacer,
234
+ casing
235
+ })
284
236
  };
285
237
  if (stringify) {
286
238
  if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
@@ -289,50 +241,6 @@ var URLPath = class {
289
241
  }
290
242
  return object;
291
243
  }
292
- /**
293
- * Converts the OpenAPI path to a TypeScript template literal string.
294
- * An optional `replacer` can transform each extracted parameter name before interpolation.
295
- *
296
- * @example
297
- * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
298
- */
299
- toTemplateString({ prefix, replacer } = {}) {
300
- const result = this.path.split(/\{([^}]+)\}/).map((part, i) => {
301
- if (i % 2 === 0) return part;
302
- const param = this.#transformParam(part);
303
- return `\${${replacer ? replacer(param) : param}}`;
304
- }).join("");
305
- return `\`${prefix ?? ""}${result}\``;
306
- }
307
- /**
308
- * Extracts all `{param}` segments from the path and returns them as a key-value map.
309
- * An optional `replacer` transforms each parameter name in both key and value positions.
310
- * Returns `undefined` when no path parameters are found.
311
- *
312
- * @example
313
- * ```ts
314
- * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()
315
- * // { petId: 'petId', tagId: 'tagId' }
316
- * ```
317
- */
318
- toParamsObject(replacer) {
319
- const params = {};
320
- this.#eachParam((_raw, param) => {
321
- const key = replacer ? replacer(param) : param;
322
- params[key] = key;
323
- });
324
- return Object.keys(params).length > 0 ? params : null;
325
- }
326
- /** Converts the OpenAPI path to Express-style colon syntax.
327
- *
328
- * @example
329
- * ```ts
330
- * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
331
- * ```
332
- */
333
- toURLPath() {
334
- return this.path.replace(/\{([^}]+)\}/g, ":$1");
335
- }
336
244
  };
337
245
  //#endregion
338
246
  //#region ../../internals/shared/src/operation.ts
@@ -358,7 +266,7 @@ function operationFileEntry(node, name, extname = ".ts") {
358
266
  function getOperationLink(node, link) {
359
267
  if (!link) return null;
360
268
  if (typeof link === "function") return link(node) ?? null;
361
- if (link === "urlPath") return node.path ? `{@link ${new URLPath(node.path).URL}}` : null;
269
+ if (link === "urlPath") return node.path ? `{@link ${Url.toPath(node.path)}}` : null;
362
270
  return node.path ? `{@link ${node.path.replaceAll("{", ":").replaceAll("}", "")}}` : null;
363
271
  }
364
272
  function getContentTypeInfo(node) {
@@ -395,7 +303,7 @@ function buildOperationComments(node, options = {}) {
395
303
  return filteredComments.flatMap((text) => text.split(/\r?\n/).map((line) => line.trim())).filter((comment) => Boolean(comment));
396
304
  }
397
305
  function getOperationParameters(node, options = {}) {
398
- const params = _kubb_core.ast.caseParams(node.parameters, options.paramsCasing);
306
+ const params = (0, _kubb_ast_utils.caseParams)(node.parameters, options.paramsCasing);
399
307
  return {
400
308
  path: params.filter((param) => param.in === "path"),
401
309
  query: params.filter((param) => param.in === "query"),
@@ -424,6 +332,19 @@ function resolveSuccessNames(node, resolver) {
424
332
  function resolveStatusCodeNames(node, resolver) {
425
333
  return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
426
334
  }
335
+ /**
336
+ * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.
337
+ * Each member is `{ status: N; data: StatusNType; statusText: string }`.
338
+ */
339
+ function buildStatusUnionType(node, resolver) {
340
+ const members = node.responses.map((r) => {
341
+ const typeName = resolver.resolveResponseStatusName(node, r.statusCode);
342
+ const statusCode = Number.parseInt(r.statusCode, 10);
343
+ return `{ status: ${Number.isNaN(statusCode) ? "number" : String(statusCode)}; data: ${typeName}; statusText: string }`;
344
+ });
345
+ if (members.length === 1) return members[0];
346
+ return `(${members.join(" | ")})`;
347
+ }
427
348
  const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
428
349
  function resolveOperationTypeNames(node, resolver, options = {}) {
429
350
  const cacheKey = `${node.operationId}\0${options.paramsCasing ?? ""}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${(options.exclude ?? []).join(",")}`;
@@ -459,12 +380,12 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
459
380
  //#endregion
460
381
  //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
461
382
  const declarationPrinter$7 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
462
- const mutationKeyTransformer = ({ node, casing }) => {
383
+ const mutationKeyTransformer = ({ node }) => {
463
384
  if (!node.path) return [];
464
- return [`{ url: '${new URLPath(node.path, { casing }).toURLPath()}' }`];
385
+ return [`{ url: '${Url.toPath(node.path)}' }`];
465
386
  };
466
387
  function MutationKey({ name, paramsCasing, node, transformer }) {
467
- const paramsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
388
+ const paramsNode = _kubb_core.ast.factory.createFunctionParameters({ params: [] });
468
389
  const paramsSignature = declarationPrinter$7.print(paramsNode) ?? "";
469
390
  const keys = (transformer ?? mutationKeyTransformer)({
470
391
  node,
@@ -486,116 +407,126 @@ function MutationKey({ name, paramsCasing, node, transformer }) {
486
407
  //#endregion
487
408
  //#region ../../internals/tanstack-query/src/utils.ts
488
409
  /**
489
- * Collects the Zod schema import names for an operation (response + request body).
490
- *
491
- * Returns an empty array when no resolver is provided or the operation has no request body schema.
410
+ * Returns the `TypeLiteral` members of a destructured group parameter, or `null`
411
+ * for a plain named parameter.
492
412
  */
493
- function resolveZodSchemaNames(node, zodResolver) {
494
- if (!zodResolver) return [];
495
- return [zodResolver.resolveResponseName?.(node), node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null].filter((n) => Boolean(n));
413
+ function groupMembers(param) {
414
+ if (typeof param.name === "string") return null;
415
+ return param.type && typeof param.type !== "string" && param.type.kind === "TypeLiteral" ? param.type.members : [];
496
416
  }
497
417
  /**
498
- * Resolve the type for a single path parameter.
499
- *
500
- * - When the resolver's group name differs from the individual param name
501
- * (e.g. kubbV4) `GroupName['paramName']` (member access).
502
- * - When they match (v5 default) → `TypeName` (direct reference).
418
+ * Builds the shared `(…params, config = {})` parameter list for a TanStack
419
+ * query-options function. The trailing `config` parameter is typed as a partial
420
+ * `RequestConfig` with an optional `client`. Framework plugins wrap the result
421
+ * when needed, for example vue-query applies `MaybeRefOrGetter`.
503
422
  */
504
- function resolvePathParamType(node, param, resolver) {
505
- const individualName = resolver.resolveParamName(node, param);
506
- const groupName = resolver.resolvePathParamsName(node, param);
507
- if (groupName !== individualName) return _kubb_core.ast.createParamsType({
508
- variant: "member",
509
- base: groupName,
510
- key: param.name
511
- });
512
- return _kubb_core.ast.createParamsType({
513
- variant: "reference",
514
- name: individualName
423
+ function buildQueryOptionsParams(node, options) {
424
+ const { paramsType, paramsCasing, pathParamsType, resolver } = options;
425
+ const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
426
+ return (0, _kubb_ast_utils.createOperationParams)(node, {
427
+ paramsType,
428
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
429
+ paramsCasing,
430
+ resolver,
431
+ extraParams: [_kubb_core.ast.factory.createFunctionParameter({
432
+ name: "config",
433
+ type: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }",
434
+ default: "{}"
435
+ })]
515
436
  });
516
437
  }
517
438
  /**
518
- * Derive a query-params group type from the resolver.
519
- * Returns `null` when no query params exist or when the group name
520
- * equals the individual param name (no real group).
439
+ * Returns `'zod'` when response-direction parsing is enabled.
440
+ * The string shorthand `'zod'` also enables response parsing.
521
441
  */
522
- function resolveQueryGroupType(node, params, resolver) {
523
- if (!params.length) return null;
524
- const firstParam = params[0];
525
- const groupName = resolver.resolveQueryParamsName(node, firstParam);
526
- if (groupName === resolver.resolveParamName(node, firstParam)) return null;
527
- return {
528
- type: _kubb_core.ast.createParamsType({
529
- variant: "reference",
530
- name: groupName
531
- }),
532
- optional: params.every((p) => !p.required)
533
- };
442
+ function resolveResponseParser(parser) {
443
+ if (!parser) return null;
444
+ if (parser === "zod") return "zod";
445
+ return parser.response ?? null;
534
446
  }
535
447
  /**
536
- * Build a single `FunctionParameterNode` for a query or header group.
448
+ * Returns `'zod'` when request body parsing is enabled.
449
+ * The string shorthand `'zod'` also enables request body parsing (existing behavior).
537
450
  */
538
- function buildGroupParam(name, node, params, groupType, resolver) {
539
- if (groupType) return [_kubb_core.ast.createFunctionParameter({
540
- name,
541
- type: groupType.type,
542
- optional: groupType.optional
543
- })];
544
- if (params.length) {
545
- const structProps = params.map((p) => ({
546
- name: p.name,
547
- type: _kubb_core.ast.createParamsType({
548
- variant: "reference",
549
- name: resolver.resolveParamName(node, p)
550
- }),
551
- optional: !p.required
552
- }));
553
- return [_kubb_core.ast.createFunctionParameter({
554
- name,
555
- type: _kubb_core.ast.createParamsType({
556
- variant: "struct",
557
- properties: structProps
558
- }),
559
- optional: params.every((p) => !p.required)
560
- })];
561
- }
562
- return [];
451
+ function resolveRequestParser(parser) {
452
+ if (!parser) return null;
453
+ if (parser === "zod") return "zod";
454
+ return parser.request ?? null;
455
+ }
456
+ /**
457
+ * Returns `'zod'` when query-params parsing is enabled.
458
+ * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.
459
+ */
460
+ function resolveQueryParamsParser(parser) {
461
+ if (!parser || parser === "zod") return null;
462
+ return parser.request ?? null;
463
+ }
464
+ /**
465
+ * Collects the Zod schema import names for an operation based on the active parser directions.
466
+ *
467
+ * - `parser: 'zod'`: response and request body names (backward-compatible behavior).
468
+ * - `parser: { request: 'zod' }`: request body and query params names.
469
+ * - `parser: { response: 'zod' }`: response name only.
470
+ * - `parser: { request: 'zod', response: 'zod' }`: all three.
471
+ *
472
+ * Returns an empty array when no resolver is provided or `parser` is falsy.
473
+ */
474
+ function resolveZodSchemaNames(node, zodResolver, parser) {
475
+ if (!zodResolver || !parser) return [];
476
+ const { query: queryParams } = getOperationParameters(node);
477
+ return [
478
+ resolveResponseParser(parser) === "zod" ? zodResolver.resolveResponseName?.(node) : null,
479
+ resolveRequestParser(parser) === "zod" && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,
480
+ resolveQueryParamsParser(parser) === "zod" && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]) : null
481
+ ].filter((n) => Boolean(n));
563
482
  }
564
483
  /**
565
484
  * Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).
566
485
  */
567
486
  function buildQueryKeyParams(node, options) {
568
487
  const { pathParamsType, paramsCasing, resolver } = options;
569
- const casedParams = _kubb_core.ast.caseParams(node.parameters, paramsCasing);
488
+ const casedParams = (0, _kubb_ast_utils.caseParams)(node.parameters, paramsCasing);
570
489
  const pathParams = casedParams.filter((p) => p.in === "path");
571
490
  const queryParams = casedParams.filter((p) => p.in === "query");
572
- const queryGroupType = resolveQueryGroupType(node, queryParams, resolver);
573
- const bodyType = node.requestBody?.content?.[0]?.schema ? _kubb_core.ast.createParamsType({
574
- variant: "reference",
575
- name: resolver.resolveDataName(node)
576
- }) : null;
491
+ const queryGroupType = (0, _kubb_ast_utils.resolveGroupType)({
492
+ node,
493
+ params: queryParams,
494
+ group: "query",
495
+ resolver
496
+ });
497
+ const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
577
498
  const bodyRequired = node.requestBody?.required ?? false;
578
499
  const params = [];
579
500
  if (pathParams.length) {
580
- const pathChildren = pathParams.map((p) => _kubb_core.ast.createFunctionParameter({
501
+ const pathChildren = pathParams.map((p) => ({
581
502
  name: p.name,
582
- type: resolvePathParamType(node, p, resolver),
503
+ type: (0, _kubb_ast_utils.resolveParamType)({
504
+ node,
505
+ param: p,
506
+ resolver
507
+ }),
583
508
  optional: !p.required
584
509
  }));
585
- params.push({
586
- kind: "ParameterGroup",
510
+ if (pathParamsType === "object") params.push(_kubb_core.ast.factory.createFunctionParameter({
587
511
  properties: pathChildren,
588
- inline: pathParamsType === "inline",
589
512
  default: pathChildren.every((c) => c.optional) ? "{}" : void 0
590
- });
513
+ }));
514
+ else params.push(...pathChildren.map((child) => _kubb_core.ast.factory.createFunctionParameter(child)));
591
515
  }
592
- if (bodyType) params.push(_kubb_core.ast.createFunctionParameter({
516
+ if (bodyType) params.push(_kubb_core.ast.factory.createFunctionParameter({
593
517
  name: "data",
594
518
  type: bodyType,
595
519
  optional: !bodyRequired
596
520
  }));
597
- params.push(...buildGroupParam("params", node, queryParams, queryGroupType, resolver));
598
- return _kubb_core.ast.createFunctionParameters({ params });
521
+ params.push(...(0, _kubb_ast_utils.buildGroupParam)({
522
+ name: "params",
523
+ node,
524
+ params: queryParams,
525
+ groupType: queryGroupType,
526
+ resolver,
527
+ wrapType: (type) => type
528
+ }));
529
+ return _kubb_core.ast.factory.createFunctionParameters({ params });
599
530
  }
600
531
  /**
601
532
  * Collect the names of the required params (no default) that drive the `enabled`
@@ -604,12 +535,11 @@ function buildQueryKeyParams(node, options) {
604
535
  */
605
536
  function getEnabledParamNames(paramsNode) {
606
537
  const required = [];
607
- for (const param of paramsNode.params) if ("kind" in param && param.kind === "ParameterGroup") {
608
- const group = param;
609
- for (const child of group.properties) if (!child.optional && child.default === void 0) required.push(child.name);
610
- } else {
611
- const fp = param;
612
- if (!fp.optional && fp.default === void 0) required.push(fp.name);
538
+ for (const param of paramsNode.params) {
539
+ const members = groupMembers(param);
540
+ if (members) {
541
+ for (const member of members) if (!member.optional) required.push(member.name);
542
+ } else if (typeof param.name === "string" && !param.optional && param.default === void 0) required.push(param.name);
613
543
  }
614
544
  return required;
615
545
  }
@@ -625,38 +555,36 @@ function markParamsOptional(paramsNode, names) {
625
555
  if (names.length === 0) return paramsNode;
626
556
  const nameSet = new Set(names);
627
557
  const params = paramsNode.params.map((param) => {
628
- if ("kind" in param && param.kind === "ParameterGroup") {
629
- const group = param;
558
+ const members = groupMembers(param);
559
+ if (members) {
560
+ const next = members.map((member) => nameSet.has(member.name) ? {
561
+ ...member,
562
+ optional: true
563
+ } : member);
630
564
  return {
631
- ...group,
632
- properties: group.properties.map((child) => nameSet.has(child.name) ? _kubb_core.ast.createFunctionParameter({
633
- name: child.name,
634
- type: child.type,
635
- rest: child.rest,
636
- optional: true
637
- }) : child)
565
+ ...param,
566
+ type: _kubb_core.ast.factory.createTypeLiteral({ members: next })
638
567
  };
639
568
  }
640
- const fp = param;
641
- return nameSet.has(fp.name) ? _kubb_core.ast.createFunctionParameter({
642
- name: fp.name,
643
- type: fp.type,
644
- rest: fp.rest,
569
+ return typeof param.name === "string" && nameSet.has(param.name) ? _kubb_core.ast.factory.createFunctionParameter({
570
+ name: param.name,
571
+ type: param.type,
572
+ rest: param.rest,
645
573
  optional: true
646
- }) : fp;
574
+ }) : param;
647
575
  });
648
- return _kubb_core.ast.createFunctionParameters({ params });
576
+ return _kubb_core.ast.factory.createFunctionParameters({ params });
649
577
  }
650
578
  (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
651
579
  const queryKeyTransformer = ({ node, casing }) => {
652
580
  if (!node.path) return [];
653
- const path = new URLPath(node.path, { casing });
654
581
  const hasQueryParams = getOperationParameters(node).query.length > 0;
655
582
  const hasRequestBody = !!node.requestBody?.content?.[0]?.schema;
656
583
  return [
657
- path.toObject({
584
+ Url.toObject(node.path, {
658
585
  type: "path",
659
- stringify: true
586
+ stringify: true,
587
+ casing
660
588
  }),
661
589
  hasQueryParams ? "...(params ? [params] : [])" : null,
662
590
  hasRequestBody ? "...(data ? [data] : [])" : null
@@ -664,43 +592,31 @@ const queryKeyTransformer = ({ node, casing }) => {
664
592
  };
665
593
  //#endregion
666
594
  //#region src/utils.ts
667
- function printType(typeNode) {
668
- if (!typeNode) return "unknown";
669
- if (typeNode.variant === "reference") return typeNode.name;
670
- if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
671
- if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
672
- const typeStr = printType(p.type);
673
- const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
674
- return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
675
- }).join("; ")} }`;
676
- return "unknown";
677
- }
595
+ /**
596
+ * Wraps each parameter type in `MaybeRefOrGetter<…>` so a vue-query signature
597
+ * accepts refs or getters. Group members are wrapped individually; `skip` opts a
598
+ * plain parameter out by name.
599
+ */
678
600
  function wrapWithMaybeRefOrGetter(paramsNode, skip) {
679
601
  const wrappedParams = paramsNode.params.map((param) => {
680
- if ("kind" in param && param.kind === "ParameterGroup") {
681
- const group = param;
682
- return {
683
- ...group,
684
- properties: group.properties.map((p) => ({
685
- ...p,
686
- type: p.type ? _kubb_core.ast.createParamsType({
687
- variant: "reference",
688
- name: `MaybeRefOrGetter<${printType(p.type)}>`
689
- }) : p.type
690
- }))
602
+ if (typeof param.name !== "string") {
603
+ const type = param.type;
604
+ if (type && typeof type !== "string" && type.kind === "TypeLiteral") return {
605
+ ...param,
606
+ type: _kubb_core.ast.factory.createTypeLiteral({ members: type.members.map((member) => ({
607
+ ...member,
608
+ type: `MaybeRefOrGetter<${(0, _kubb_plugin_ts.renderType)(member.type)}>`
609
+ })) })
691
610
  };
611
+ return param;
692
612
  }
693
- const fp = param;
694
- if (skip?.(fp.name)) return fp;
613
+ if (skip?.(param.name)) return param;
695
614
  return {
696
- ...fp,
697
- type: fp.type ? _kubb_core.ast.createParamsType({
698
- variant: "reference",
699
- name: `MaybeRefOrGetter<${printType(fp.type)}>`
700
- }) : fp.type
615
+ ...param,
616
+ type: param.type ? `MaybeRefOrGetter<${(0, _kubb_plugin_ts.renderType)(param.type)}>` : param.type
701
617
  };
702
618
  });
703
- return _kubb_core.ast.createFunctionParameters({ params: wrappedParams });
619
+ return _kubb_core.ast.factory.createFunctionParameters({ params: wrappedParams });
704
620
  }
705
621
  //#endregion
706
622
  //#region src/components/QueryKey.tsx
@@ -748,28 +664,13 @@ function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeNa
748
664
  const declarationPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
749
665
  const callPrinter$4 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
750
666
  function getQueryOptionsParams(node, options) {
751
- const { paramsType, paramsCasing, pathParamsType, resolver } = options;
752
- const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
753
- return wrapWithMaybeRefOrGetter(_kubb_core.ast.createOperationParams(node, {
754
- paramsType,
755
- pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
756
- paramsCasing,
757
- resolver,
758
- extraParams: [_kubb_core.ast.createFunctionParameter({
759
- name: "config",
760
- type: _kubb_core.ast.createParamsType({
761
- variant: "reference",
762
- name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
763
- }),
764
- default: "{}"
765
- })]
766
- }), (name) => name === "config");
667
+ return wrapWithMaybeRefOrGetter(buildQueryOptionsParams(node, options), (name) => name === "config");
767
668
  }
768
669
  function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
769
670
  const successNames = resolveSuccessNames(node, tsResolver);
770
671
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
771
672
  const errorNames = resolveErrorNames(node, tsResolver);
772
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
673
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
773
674
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
774
675
  const queryKeyParamsNode = buildQueryKeyParamsNode(node, {
775
676
  pathParamsType,
@@ -797,8 +698,7 @@ function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, para
797
698
  params: paramsSignature,
798
699
  children: `
799
700
  const queryKey = ${queryKeyName}(${queryKeyParamsCall})
800
- return queryOptions<${TData}, ${TError}, ${TData}>({
801
- ${enabledText}
701
+ return queryOptions<${TData}, ${TError}, ${TData}>({${enabledText ? `\n ${enabledText}` : ""}
802
702
  queryKey,
803
703
  queryFn: async ({ signal }) => {
804
704
  return ${clientName}(${addToValueCalls$1(clientCallStr, enabledNames)})
@@ -839,26 +739,23 @@ function buildInfiniteQueryParamsNode(node, options) {
839
739
  const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
840
740
  const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
841
741
  const errorNames = resolveErrorNames(node, resolver);
842
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
742
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
843
743
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
844
- const optionsParam = _kubb_core.ast.createFunctionParameter({
744
+ const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
845
745
  name: "options",
846
- type: _kubb_core.ast.createParamsType({
847
- variant: "reference",
848
- name: `{
746
+ type: `{
849
747
  query?: Partial<UseInfiniteQueryOptions<${[
850
- TData,
851
- TError,
852
- "TQueryData",
853
- "TQueryKey",
854
- "TQueryData"
855
- ].join(", ")}>> & { client?: QueryClient },
748
+ TData,
749
+ TError,
750
+ "TQueryData",
751
+ "TQueryKey",
752
+ "TQueryData"
753
+ ].join(", ")}>> & { client?: QueryClient },
856
754
  client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
857
- }`
858
- }),
755
+ }`,
859
756
  default: "{}"
860
757
  });
861
- return wrapWithMaybeRefOrGetter(_kubb_core.ast.createOperationParams(node, {
758
+ return wrapWithMaybeRefOrGetter((0, _kubb_ast_utils.createOperationParams)(node, {
862
759
  paramsType,
863
760
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
864
761
  paramsCasing,
@@ -870,7 +767,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
870
767
  const successNames = resolveSuccessNames(node, tsResolver);
871
768
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
872
769
  const errorNames = resolveErrorNames(node, tsResolver);
873
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
770
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
874
771
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
875
772
  const returnType = `UseInfiniteQueryReturnType<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
876
773
  const generics = [
@@ -935,7 +832,7 @@ const callPrinter$2 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
935
832
  function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, nextParam, previousParam, node, tsResolver, paramsCasing, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName }) {
936
833
  const successNames = resolveSuccessNames(node, tsResolver);
937
834
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
938
- const queryFnDataType = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
835
+ const queryFnDataType = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
939
836
  const errorNames = resolveErrorNames(node, tsResolver);
940
837
  const errorType = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
941
838
  const isInitialPageParamDefined = initialPageParam !== void 0 && initialPageParam !== null;
@@ -969,8 +866,8 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
969
866
  const hasNewParams = nextParam != null || previousParam != null;
970
867
  const [getNextPageParamExpr, getPreviousPageParamExpr] = (() => {
971
868
  if (hasNewParams) {
972
- const nextAccessor = nextParam ? getNestedAccessor(nextParam, "lastPage") : null;
973
- const prevAccessor = previousParam ? getNestedAccessor(previousParam, "firstPage") : null;
869
+ const nextAccessor = nextParam ? (0, _kubb_ast_utils.getNestedAccessor)(nextParam, "lastPage") : null;
870
+ const prevAccessor = previousParam ? (0, _kubb_ast_utils.getNestedAccessor)(previousParam, "firstPage") : null;
974
871
  return [nextAccessor ? `getNextPageParam: (lastPage) => ${nextAccessor}` : null, prevAccessor ? `getPreviousPageParam: (firstPage) => ${prevAccessor}` : null];
975
872
  }
976
873
  if (cursorParam) return [`getNextPageParam: (lastPage) => lastPage['${cursorParam}']`, `getPreviousPageParam: (firstPage) => firstPage['${cursorParam}']`];
@@ -981,11 +878,10 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
981
878
  getNextPageParamExpr,
982
879
  getPreviousPageParamExpr
983
880
  ].filter(Boolean);
984
- const infiniteOverrideParams = queryParam && queryParamsTypeName ? `
985
- params = {
986
- ...(params ?? {}),
987
- ['${queryParam}']: pageParam as unknown as ${queryParamsTypeName}['${queryParam}'],
988
- } as ${queryParamsTypeName}` : "";
881
+ const infiniteOverrideParams = queryParam && queryParamsTypeName ? `params = {
882
+ ...(params ?? {}),
883
+ ['${queryParam}']: pageParam as unknown as ${queryParamsTypeName}['${queryParam}'],
884
+ } as ${queryParamsTypeName}` : "";
989
885
  if (infiniteOverrideParams) return /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(_kubb_renderer_jsx.File.Source, {
990
886
  name,
991
887
  isExportable: true,
@@ -995,16 +891,15 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
995
891
  export: true,
996
892
  params: paramsSignature,
997
893
  children: `
998
- const queryKey = ${queryKeyName}(${queryKeyParamsCall})
999
- return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({
1000
- ${enabledText}
1001
- queryKey,
1002
- queryFn: async ({ signal, pageParam }) => {
1003
- ${infiniteOverrideParams}
1004
- return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
1005
- },
1006
- ${queryOptionsArr.join(",\n")}
1007
- })
894
+ const queryKey = ${queryKeyName}(${queryKeyParamsCall})
895
+ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({${enabledText ? `\n ${enabledText}` : ""}
896
+ queryKey,
897
+ queryFn: async ({ signal, pageParam }) => {
898
+ ${infiniteOverrideParams}
899
+ return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
900
+ },
901
+ ${queryOptionsArr.join(",\n ")}
902
+ })
1008
903
  `
1009
904
  })
1010
905
  });
@@ -1017,15 +912,14 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
1017
912
  export: true,
1018
913
  params: paramsSignature,
1019
914
  children: `
1020
- const queryKey = ${queryKeyName}(${queryKeyParamsCall})
1021
- return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({
1022
- ${enabledText}
1023
- queryKey,
1024
- queryFn: async ({ signal }) => {
1025
- return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
1026
- },
1027
- ${queryOptionsArr.join(",\n")}
1028
- })
915
+ const queryKey = ${queryKeyName}(${queryKeyParamsCall})
916
+ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({${enabledText ? `\n ${enabledText}` : ""}
917
+ queryKey,
918
+ queryFn: async ({ signal }) => {
919
+ return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
920
+ },
921
+ ${queryOptionsArr.join(",\n ")}
922
+ })
1029
923
  `
1030
924
  })
1031
925
  });
@@ -1047,9 +941,9 @@ function addToValueCalls(callStr, enabledNames = []) {
1047
941
  //#region src/components/Mutation.tsx
1048
942
  const declarationPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "declaration" });
1049
943
  const callPrinter$1 = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1050
- const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "keys" });
944
+ const keysPrinter = (0, _kubb_plugin_ts.functionPrinter)({ mode: "call" });
1051
945
  function createMutationArgParams(node, options) {
1052
- return _kubb_core.ast.createOperationParams(node, {
946
+ return (0, _kubb_ast_utils.createOperationParams)(node, {
1053
947
  paramsType: "inline",
1054
948
  pathParamsType: "inline",
1055
949
  paramsCasing: options.paramsCasing,
@@ -1061,27 +955,24 @@ function buildMutationParamsNode(node, options) {
1061
955
  const successNames = resolveSuccessNames(node, resolver);
1062
956
  const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
1063
957
  const errorNames = resolveErrorNames(node, resolver);
1064
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
958
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
1065
959
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1066
960
  const wrappedParamsNode = wrapWithMaybeRefOrGetter(createMutationArgParams(node, {
1067
961
  paramsCasing,
1068
962
  resolver
1069
963
  }));
1070
964
  const TRequestWrapped = wrappedParamsNode.params.length > 0 ? declarationPrinter$1.print(wrappedParamsNode) ?? "" : "";
1071
- return _kubb_core.ast.createFunctionParameters({ params: [_kubb_core.ast.createFunctionParameter({
965
+ return _kubb_core.ast.factory.createFunctionParameters({ params: [_kubb_core.ast.factory.createFunctionParameter({
1072
966
  name: "options",
1073
- type: _kubb_core.ast.createParamsType({
1074
- variant: "reference",
1075
- name: `{
967
+ type: `{
1076
968
  mutation?: MutationObserverOptions<${[
1077
- TData,
1078
- TError,
1079
- TRequestWrapped ? `{${TRequestWrapped}}` : "undefined",
1080
- "TContext"
1081
- ].join(", ")}> & { client?: QueryClient },
969
+ TData,
970
+ TError,
971
+ TRequestWrapped ? `{${TRequestWrapped}}` : "undefined",
972
+ "TContext"
973
+ ].join(", ")}> & { client?: QueryClient },
1082
974
  client?: ${buildRequestConfigType(node, resolver)},
1083
- }`
1084
- }),
975
+ }`,
1085
976
  default: "{}"
1086
977
  })] });
1087
978
  }
@@ -1089,7 +980,7 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
1089
980
  const successNames = resolveSuccessNames(node, tsResolver);
1090
981
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
1091
982
  const errorNames = resolveErrorNames(node, tsResolver);
1092
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
983
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
1093
984
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1094
985
  const mutationArgParamsNode = createMutationArgParams(node, {
1095
986
  paramsCasing,
@@ -1104,19 +995,16 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
1104
995
  TRequest ? `{${TRequest}}` : "undefined",
1105
996
  "TContext"
1106
997
  ].join(", ");
1107
- const mutationKeyParamsNode = _kubb_core.ast.createFunctionParameters({ params: [] });
998
+ const mutationKeyParamsNode = _kubb_core.ast.factory.createFunctionParameters({ params: [] });
1108
999
  const mutationKeyParamsCall = callPrinter$1.print(mutationKeyParamsNode) ?? "";
1109
- const clientCallParamsNode = _kubb_core.ast.createOperationParams(node, {
1000
+ const clientCallParamsNode = (0, _kubb_ast_utils.createOperationParams)(node, {
1110
1001
  paramsType,
1111
1002
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
1112
1003
  paramsCasing,
1113
1004
  resolver: tsResolver,
1114
- extraParams: [_kubb_core.ast.createFunctionParameter({
1005
+ extraParams: [_kubb_core.ast.factory.createFunctionParameter({
1115
1006
  name: "config",
1116
- type: _kubb_core.ast.createParamsType({
1117
- variant: "reference",
1118
- name: buildRequestConfigType(node, tsResolver)
1119
- }),
1007
+ type: buildRequestConfigType(node, tsResolver),
1120
1008
  default: "{}"
1121
1009
  })]
1122
1010
  });
@@ -1163,26 +1051,23 @@ function buildQueryParamsNode(node, options) {
1163
1051
  const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
1164
1052
  const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
1165
1053
  const errorNames = resolveErrorNames(node, resolver);
1166
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
1054
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
1167
1055
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1168
- const optionsParam = _kubb_core.ast.createFunctionParameter({
1056
+ const optionsParam = _kubb_core.ast.factory.createFunctionParameter({
1169
1057
  name: "options",
1170
- type: _kubb_core.ast.createParamsType({
1171
- variant: "reference",
1172
- name: `{
1058
+ type: `{
1173
1059
  query?: Partial<UseQueryOptions<${[
1174
- TData,
1175
- TError,
1176
- "TData",
1177
- "TQueryData",
1178
- "TQueryKey"
1179
- ].join(", ")}>> & { client?: QueryClient },
1060
+ TData,
1061
+ TError,
1062
+ "TData",
1063
+ "TQueryData",
1064
+ "TQueryKey"
1065
+ ].join(", ")}>> & { client?: QueryClient },
1180
1066
  client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
1181
- }`
1182
- }),
1067
+ }`,
1183
1068
  default: "{}"
1184
1069
  });
1185
- return wrapWithMaybeRefOrGetter(_kubb_core.ast.createOperationParams(node, {
1070
+ return wrapWithMaybeRefOrGetter((0, _kubb_ast_utils.createOperationParams)(node, {
1186
1071
  paramsType,
1187
1072
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
1188
1073
  paramsCasing,
@@ -1194,7 +1079,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
1194
1079
  const successNames = resolveSuccessNames(node, tsResolver);
1195
1080
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
1196
1081
  const errorNames = resolveErrorNames(node, tsResolver);
1197
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
1082
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
1198
1083
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1199
1084
  const returnType = `UseQueryReturnType<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
1200
1085
  const generics = [
@@ -1350,4 +1235,4 @@ Object.defineProperty(exports, "resolveZodSchemaNames", {
1350
1235
  }
1351
1236
  });
1352
1237
 
1353
- //# sourceMappingURL=components-BwFPMwK7.cjs.map
1238
+ //# sourceMappingURL=components-CfU59l8V.cjs.map