@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
@@ -1,6 +1,7 @@
1
1
  import { t as __name } from "./chunk-C0LytTxp.js";
2
2
  import { ast } from "@kubb/core";
3
- import { functionPrinter } from "@kubb/plugin-ts";
3
+ import { buildGroupParam, caseParams, createOperationParams, getNestedAccessor, resolveGroupType, resolveParamType } from "@kubb/ast/utils";
4
+ import { functionPrinter, renderType } from "@kubb/plugin-ts";
4
5
  import { File, Function, Type } from "@kubb/renderer-jsx";
5
6
  import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
6
7
  //#region ../../internals/utils/src/casing.ts
@@ -14,50 +15,20 @@ import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
14
15
  function toCamelOrPascal(text, pascal) {
15
16
  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) => {
16
17
  if (word.length > 1 && word === word.toUpperCase()) return word;
17
- if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
18
- return word.charAt(0).toUpperCase() + word.slice(1);
18
+ return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
19
19
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
20
20
  }
21
21
  /**
22
- * Splits `text` on `.` and applies `transformPart` to each segment.
23
- * The last segment receives `isLast = true`, all earlier segments receive `false`.
24
- * Segments are joined with `/` to form a file path.
25
- *
26
- * Only splits on dots followed by a letter so that version numbers
27
- * embedded in operationIds (e.g. `v2025.0`) are kept intact.
28
- */
29
- function applyToFileParts(text, transformPart) {
30
- const parts = text.split(/\.(?=[a-zA-Z])/);
31
- return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
32
- }
33
- /**
34
22
  * Converts `text` to camelCase.
35
- * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
36
23
  *
37
- * @example
38
- * camelCase('hello-world') // 'helloWorld'
39
- * camelCase('pet.petId', { isFile: true }) // 'pet/petId'
40
- */
41
- function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
42
- if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
43
- prefix,
44
- suffix
45
- } : {}));
46
- return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
47
- }
48
- //#endregion
49
- //#region ../../internals/utils/src/object.ts
50
- /**
51
- * Converts a dot-notation path or string array into an optional-chaining accessor expression.
24
+ * @example Word boundaries
25
+ * `camelCase('hello-world') // 'helloWorld'`
52
26
  *
53
- * @example
54
- * getNestedAccessor('pagination.next.id', 'lastPage')
55
- * // → "lastPage?.['pagination']?.['next']?.['id']"
27
+ * @example With a prefix
28
+ * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
56
29
  */
57
- function getNestedAccessor(param, accessor) {
58
- const parts = Array.isArray(param) ? param : param.split(".");
59
- if (parts.length === 0 || parts.length === 1 && parts[0] === "") return null;
60
- return `${accessor}?.['${`${parts.join("']?.['")}']`}`;
30
+ function camelCase(text, { prefix = "", suffix = "" } = {}) {
31
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
61
32
  }
62
33
  //#endregion
63
34
  //#region ../../internals/utils/src/reserved.ts
@@ -163,99 +134,80 @@ function isValidVarName(name) {
163
134
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
164
135
  }
165
136
  //#endregion
166
- //#region ../../internals/utils/src/urlPath.ts
137
+ //#region ../../internals/utils/src/url.ts
138
+ function transformParam(raw, casing) {
139
+ const param = isValidVarName(raw) ? raw : camelCase(raw);
140
+ return casing === "camelcase" ? camelCase(param) : param;
141
+ }
142
+ function toParamsObject(path, { replacer, casing } = {}) {
143
+ const params = {};
144
+ for (const match of path.matchAll(/\{([^}]+)\}/g)) {
145
+ const param = transformParam(match[1], casing);
146
+ const key = replacer ? replacer(param) : param;
147
+ params[key] = key;
148
+ }
149
+ return Object.keys(params).length > 0 ? params : null;
150
+ }
167
151
  /**
168
- * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
169
- *
170
- * @example
171
- * const p = new URLPath('/pet/{petId}')
172
- * p.URL // '/pet/:petId'
173
- * p.template // '`/pet/${petId}`'
152
+ * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
174
153
  */
175
- var URLPath = class {
154
+ var Url = class Url {
176
155
  /**
177
- * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
178
- */
179
- path;
180
- #options;
181
- constructor(path, options = {}) {
182
- this.path = path;
183
- this.#options = options;
184
- }
185
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
156
+ * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.
186
157
  *
187
158
  * @example
188
- * ```ts
189
- * new URLPath('/pet/{petId}').URL // '/pet/:petId'
190
- * ```
159
+ * Url.canParse('https://petstore.swagger.io/v2') // true
160
+ * Url.canParse('/pet/{petId}') // false
191
161
  */
192
- get URL() {
193
- return this.toURLPath();
162
+ static canParse(url, base) {
163
+ return URL.canParse(url, base);
194
164
  }
195
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
165
+ /**
166
+ * Converts an OpenAPI/Swagger path to Express-style colon syntax.
196
167
  *
197
168
  * @example
198
- * ```ts
199
- * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
200
- * new URLPath('/pet/{petId}').isURL // false
201
- * ```
169
+ * Url.toPath('/pet/{petId}') // '/pet/:petId'
202
170
  */
203
- get isURL() {
204
- try {
205
- return !!new URL(this.path).href;
206
- } catch {
207
- return false;
208
- }
171
+ static toPath(path) {
172
+ return path.replace(/\{([^}]+)\}/g, ":$1");
209
173
  }
210
174
  /**
211
- * Converts the OpenAPI path to a TypeScript template literal string.
175
+ * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
176
+ * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
177
+ * and `casing` controls parameter identifier casing.
212
178
  *
213
179
  * @example
214
- * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
215
- * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
216
- */
217
- get template() {
218
- return this.toTemplateString();
219
- }
220
- /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
180
+ * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
221
181
  *
222
182
  * @example
223
- * ```ts
224
- * new URLPath('/pet/{petId}').object
225
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
226
- * ```
183
+ * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
227
184
  */
228
- get object() {
229
- return this.toObject();
185
+ static toTemplateString(path, { prefix, replacer, casing } = {}) {
186
+ const result = path.split(/\{([^}]+)\}/).map((part, i) => {
187
+ if (i % 2 === 0) return part;
188
+ const param = transformParam(part, casing);
189
+ return `\${${replacer ? replacer(param) : param}}`;
190
+ }).join("");
191
+ return `\`${prefix ?? ""}${result}\``;
230
192
  }
231
- /** Returns a map of path parameter names, or `null` when the path has no parameters.
193
+ /**
194
+ * Returns the path and its extracted params as a structured `URLObject`, or as a stringified
195
+ * expression when `stringify` is set.
232
196
  *
233
197
  * @example
234
- * ```ts
235
- * new URLPath('/pet/{petId}').params // { petId: 'petId' }
236
- * new URLPath('/pet').params // null
237
- * ```
238
- */
239
- get params() {
240
- return this.toParamsObject();
241
- }
242
- #transformParam(raw) {
243
- const param = isValidVarName(raw) ? raw : camelCase(raw);
244
- return this.#options.casing === "camelcase" ? camelCase(param) : param;
245
- }
246
- /**
247
- * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
198
+ * Url.toObject('/pet/{petId}')
199
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
248
200
  */
249
- #eachParam(fn) {
250
- for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
251
- const raw = match[1];
252
- fn(raw, this.#transformParam(raw));
253
- }
254
- }
255
- toObject({ type = "path", replacer, stringify } = {}) {
201
+ static toObject(path, { type = "path", replacer, stringify, casing } = {}) {
256
202
  const object = {
257
- url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
258
- params: this.toParamsObject()
203
+ url: type === "path" ? Url.toPath(path) : Url.toTemplateString(path, {
204
+ replacer,
205
+ casing
206
+ }),
207
+ params: toParamsObject(path, {
208
+ replacer,
209
+ casing
210
+ })
259
211
  };
260
212
  if (stringify) {
261
213
  if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
@@ -264,50 +216,6 @@ var URLPath = class {
264
216
  }
265
217
  return object;
266
218
  }
267
- /**
268
- * Converts the OpenAPI path to a TypeScript template literal string.
269
- * An optional `replacer` can transform each extracted parameter name before interpolation.
270
- *
271
- * @example
272
- * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
273
- */
274
- toTemplateString({ prefix, replacer } = {}) {
275
- const result = this.path.split(/\{([^}]+)\}/).map((part, i) => {
276
- if (i % 2 === 0) return part;
277
- const param = this.#transformParam(part);
278
- return `\${${replacer ? replacer(param) : param}}`;
279
- }).join("");
280
- return `\`${prefix ?? ""}${result}\``;
281
- }
282
- /**
283
- * Extracts all `{param}` segments from the path and returns them as a key-value map.
284
- * An optional `replacer` transforms each parameter name in both key and value positions.
285
- * Returns `undefined` when no path parameters are found.
286
- *
287
- * @example
288
- * ```ts
289
- * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()
290
- * // { petId: 'petId', tagId: 'tagId' }
291
- * ```
292
- */
293
- toParamsObject(replacer) {
294
- const params = {};
295
- this.#eachParam((_raw, param) => {
296
- const key = replacer ? replacer(param) : param;
297
- params[key] = key;
298
- });
299
- return Object.keys(params).length > 0 ? params : null;
300
- }
301
- /** Converts the OpenAPI path to Express-style colon syntax.
302
- *
303
- * @example
304
- * ```ts
305
- * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
306
- * ```
307
- */
308
- toURLPath() {
309
- return this.path.replace(/\{([^}]+)\}/g, ":$1");
310
- }
311
219
  };
312
220
  //#endregion
313
221
  //#region ../../internals/shared/src/operation.ts
@@ -333,7 +241,7 @@ function operationFileEntry(node, name, extname = ".ts") {
333
241
  function getOperationLink(node, link) {
334
242
  if (!link) return null;
335
243
  if (typeof link === "function") return link(node) ?? null;
336
- if (link === "urlPath") return node.path ? `{@link ${new URLPath(node.path).URL}}` : null;
244
+ if (link === "urlPath") return node.path ? `{@link ${Url.toPath(node.path)}}` : null;
337
245
  return node.path ? `{@link ${node.path.replaceAll("{", ":").replaceAll("}", "")}}` : null;
338
246
  }
339
247
  function getContentTypeInfo(node) {
@@ -370,7 +278,7 @@ function buildOperationComments(node, options = {}) {
370
278
  return filteredComments.flatMap((text) => text.split(/\r?\n/).map((line) => line.trim())).filter((comment) => Boolean(comment));
371
279
  }
372
280
  function getOperationParameters(node, options = {}) {
373
- const params = ast.caseParams(node.parameters, options.paramsCasing);
281
+ const params = caseParams(node.parameters, options.paramsCasing);
374
282
  return {
375
283
  path: params.filter((param) => param.in === "path"),
376
284
  query: params.filter((param) => param.in === "query"),
@@ -399,6 +307,19 @@ function resolveSuccessNames(node, resolver) {
399
307
  function resolveStatusCodeNames(node, resolver) {
400
308
  return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
401
309
  }
310
+ /**
311
+ * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.
312
+ * Each member is `{ status: N; data: StatusNType; statusText: string }`.
313
+ */
314
+ function buildStatusUnionType(node, resolver) {
315
+ const members = node.responses.map((r) => {
316
+ const typeName = resolver.resolveResponseStatusName(node, r.statusCode);
317
+ const statusCode = Number.parseInt(r.statusCode, 10);
318
+ return `{ status: ${Number.isNaN(statusCode) ? "number" : String(statusCode)}; data: ${typeName}; statusText: string }`;
319
+ });
320
+ if (members.length === 1) return members[0];
321
+ return `(${members.join(" | ")})`;
322
+ }
402
323
  const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
403
324
  function resolveOperationTypeNames(node, resolver, options = {}) {
404
325
  const cacheKey = `${node.operationId}\0${options.paramsCasing ?? ""}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${(options.exclude ?? []).join(",")}`;
@@ -434,12 +355,12 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
434
355
  //#endregion
435
356
  //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
436
357
  const declarationPrinter$7 = functionPrinter({ mode: "declaration" });
437
- const mutationKeyTransformer = ({ node, casing }) => {
358
+ const mutationKeyTransformer = ({ node }) => {
438
359
  if (!node.path) return [];
439
- return [`{ url: '${new URLPath(node.path, { casing }).toURLPath()}' }`];
360
+ return [`{ url: '${Url.toPath(node.path)}' }`];
440
361
  };
441
362
  function MutationKey({ name, paramsCasing, node, transformer }) {
442
- const paramsNode = ast.createFunctionParameters({ params: [] });
363
+ const paramsNode = ast.factory.createFunctionParameters({ params: [] });
443
364
  const paramsSignature = declarationPrinter$7.print(paramsNode) ?? "";
444
365
  const keys = (transformer ?? mutationKeyTransformer)({
445
366
  node,
@@ -461,116 +382,126 @@ function MutationKey({ name, paramsCasing, node, transformer }) {
461
382
  //#endregion
462
383
  //#region ../../internals/tanstack-query/src/utils.ts
463
384
  /**
464
- * Collects the Zod schema import names for an operation (response + request body).
465
- *
466
- * Returns an empty array when no resolver is provided or the operation has no request body schema.
385
+ * Returns the `TypeLiteral` members of a destructured group parameter, or `null`
386
+ * for a plain named parameter.
467
387
  */
468
- function resolveZodSchemaNames(node, zodResolver) {
469
- if (!zodResolver) return [];
470
- return [zodResolver.resolveResponseName?.(node), node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null].filter((n) => Boolean(n));
388
+ function groupMembers(param) {
389
+ if (typeof param.name === "string") return null;
390
+ return param.type && typeof param.type !== "string" && param.type.kind === "TypeLiteral" ? param.type.members : [];
471
391
  }
472
392
  /**
473
- * Resolve the type for a single path parameter.
474
- *
475
- * - When the resolver's group name differs from the individual param name
476
- * (e.g. kubbV4) `GroupName['paramName']` (member access).
477
- * - When they match (v5 default) → `TypeName` (direct reference).
393
+ * Builds the shared `(…params, config = {})` parameter list for a TanStack
394
+ * query-options function. The trailing `config` parameter is typed as a partial
395
+ * `RequestConfig` with an optional `client`. Framework plugins wrap the result
396
+ * when needed, for example vue-query applies `MaybeRefOrGetter`.
478
397
  */
479
- function resolvePathParamType(node, param, resolver) {
480
- const individualName = resolver.resolveParamName(node, param);
481
- const groupName = resolver.resolvePathParamsName(node, param);
482
- if (groupName !== individualName) return ast.createParamsType({
483
- variant: "member",
484
- base: groupName,
485
- key: param.name
486
- });
487
- return ast.createParamsType({
488
- variant: "reference",
489
- name: individualName
398
+ function buildQueryOptionsParams(node, options) {
399
+ const { paramsType, paramsCasing, pathParamsType, resolver } = options;
400
+ const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
401
+ return createOperationParams(node, {
402
+ paramsType,
403
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
404
+ paramsCasing,
405
+ resolver,
406
+ extraParams: [ast.factory.createFunctionParameter({
407
+ name: "config",
408
+ type: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }",
409
+ default: "{}"
410
+ })]
490
411
  });
491
412
  }
492
413
  /**
493
- * Derive a query-params group type from the resolver.
494
- * Returns `null` when no query params exist or when the group name
495
- * equals the individual param name (no real group).
414
+ * Returns `'zod'` when response-direction parsing is enabled.
415
+ * The string shorthand `'zod'` also enables response parsing.
496
416
  */
497
- function resolveQueryGroupType(node, params, resolver) {
498
- if (!params.length) return null;
499
- const firstParam = params[0];
500
- const groupName = resolver.resolveQueryParamsName(node, firstParam);
501
- if (groupName === resolver.resolveParamName(node, firstParam)) return null;
502
- return {
503
- type: ast.createParamsType({
504
- variant: "reference",
505
- name: groupName
506
- }),
507
- optional: params.every((p) => !p.required)
508
- };
417
+ function resolveResponseParser(parser) {
418
+ if (!parser) return null;
419
+ if (parser === "zod") return "zod";
420
+ return parser.response ?? null;
509
421
  }
510
422
  /**
511
- * Build a single `FunctionParameterNode` for a query or header group.
423
+ * Returns `'zod'` when request body parsing is enabled.
424
+ * The string shorthand `'zod'` also enables request body parsing (existing behavior).
512
425
  */
513
- function buildGroupParam(name, node, params, groupType, resolver) {
514
- if (groupType) return [ast.createFunctionParameter({
515
- name,
516
- type: groupType.type,
517
- optional: groupType.optional
518
- })];
519
- if (params.length) {
520
- const structProps = params.map((p) => ({
521
- name: p.name,
522
- type: ast.createParamsType({
523
- variant: "reference",
524
- name: resolver.resolveParamName(node, p)
525
- }),
526
- optional: !p.required
527
- }));
528
- return [ast.createFunctionParameter({
529
- name,
530
- type: ast.createParamsType({
531
- variant: "struct",
532
- properties: structProps
533
- }),
534
- optional: params.every((p) => !p.required)
535
- })];
536
- }
537
- return [];
426
+ function resolveRequestParser(parser) {
427
+ if (!parser) return null;
428
+ if (parser === "zod") return "zod";
429
+ return parser.request ?? null;
430
+ }
431
+ /**
432
+ * Returns `'zod'` when query-params parsing is enabled.
433
+ * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.
434
+ */
435
+ function resolveQueryParamsParser(parser) {
436
+ if (!parser || parser === "zod") return null;
437
+ return parser.request ?? null;
438
+ }
439
+ /**
440
+ * Collects the Zod schema import names for an operation based on the active parser directions.
441
+ *
442
+ * - `parser: 'zod'`: response and request body names (backward-compatible behavior).
443
+ * - `parser: { request: 'zod' }`: request body and query params names.
444
+ * - `parser: { response: 'zod' }`: response name only.
445
+ * - `parser: { request: 'zod', response: 'zod' }`: all three.
446
+ *
447
+ * Returns an empty array when no resolver is provided or `parser` is falsy.
448
+ */
449
+ function resolveZodSchemaNames(node, zodResolver, parser) {
450
+ if (!zodResolver || !parser) return [];
451
+ const { query: queryParams } = getOperationParameters(node);
452
+ return [
453
+ resolveResponseParser(parser) === "zod" ? zodResolver.resolveResponseName?.(node) : null,
454
+ resolveRequestParser(parser) === "zod" && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,
455
+ resolveQueryParamsParser(parser) === "zod" && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]) : null
456
+ ].filter((n) => Boolean(n));
538
457
  }
539
458
  /**
540
459
  * Build QueryKey params: pathParams + data + queryParams (NO headers, NO config).
541
460
  */
542
461
  function buildQueryKeyParams(node, options) {
543
462
  const { pathParamsType, paramsCasing, resolver } = options;
544
- const casedParams = ast.caseParams(node.parameters, paramsCasing);
463
+ const casedParams = caseParams(node.parameters, paramsCasing);
545
464
  const pathParams = casedParams.filter((p) => p.in === "path");
546
465
  const queryParams = casedParams.filter((p) => p.in === "query");
547
- const queryGroupType = resolveQueryGroupType(node, queryParams, resolver);
548
- const bodyType = node.requestBody?.content?.[0]?.schema ? ast.createParamsType({
549
- variant: "reference",
550
- name: resolver.resolveDataName(node)
551
- }) : null;
466
+ const queryGroupType = resolveGroupType({
467
+ node,
468
+ params: queryParams,
469
+ group: "query",
470
+ resolver
471
+ });
472
+ const bodyType = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
552
473
  const bodyRequired = node.requestBody?.required ?? false;
553
474
  const params = [];
554
475
  if (pathParams.length) {
555
- const pathChildren = pathParams.map((p) => ast.createFunctionParameter({
476
+ const pathChildren = pathParams.map((p) => ({
556
477
  name: p.name,
557
- type: resolvePathParamType(node, p, resolver),
478
+ type: resolveParamType({
479
+ node,
480
+ param: p,
481
+ resolver
482
+ }),
558
483
  optional: !p.required
559
484
  }));
560
- params.push({
561
- kind: "ParameterGroup",
485
+ if (pathParamsType === "object") params.push(ast.factory.createFunctionParameter({
562
486
  properties: pathChildren,
563
- inline: pathParamsType === "inline",
564
487
  default: pathChildren.every((c) => c.optional) ? "{}" : void 0
565
- });
488
+ }));
489
+ else params.push(...pathChildren.map((child) => ast.factory.createFunctionParameter(child)));
566
490
  }
567
- if (bodyType) params.push(ast.createFunctionParameter({
491
+ if (bodyType) params.push(ast.factory.createFunctionParameter({
568
492
  name: "data",
569
493
  type: bodyType,
570
494
  optional: !bodyRequired
571
495
  }));
572
- params.push(...buildGroupParam("params", node, queryParams, queryGroupType, resolver));
573
- return ast.createFunctionParameters({ params });
496
+ params.push(...buildGroupParam({
497
+ name: "params",
498
+ node,
499
+ params: queryParams,
500
+ groupType: queryGroupType,
501
+ resolver,
502
+ wrapType: (type) => type
503
+ }));
504
+ return ast.factory.createFunctionParameters({ params });
574
505
  }
575
506
  /**
576
507
  * Collect the names of the required params (no default) that drive the `enabled`
@@ -579,12 +510,11 @@ function buildQueryKeyParams(node, options) {
579
510
  */
580
511
  function getEnabledParamNames(paramsNode) {
581
512
  const required = [];
582
- for (const param of paramsNode.params) if ("kind" in param && param.kind === "ParameterGroup") {
583
- const group = param;
584
- for (const child of group.properties) if (!child.optional && child.default === void 0) required.push(child.name);
585
- } else {
586
- const fp = param;
587
- if (!fp.optional && fp.default === void 0) required.push(fp.name);
513
+ for (const param of paramsNode.params) {
514
+ const members = groupMembers(param);
515
+ if (members) {
516
+ for (const member of members) if (!member.optional) required.push(member.name);
517
+ } else if (typeof param.name === "string" && !param.optional && param.default === void 0) required.push(param.name);
588
518
  }
589
519
  return required;
590
520
  }
@@ -600,38 +530,36 @@ function markParamsOptional(paramsNode, names) {
600
530
  if (names.length === 0) return paramsNode;
601
531
  const nameSet = new Set(names);
602
532
  const params = paramsNode.params.map((param) => {
603
- if ("kind" in param && param.kind === "ParameterGroup") {
604
- const group = param;
533
+ const members = groupMembers(param);
534
+ if (members) {
535
+ const next = members.map((member) => nameSet.has(member.name) ? {
536
+ ...member,
537
+ optional: true
538
+ } : member);
605
539
  return {
606
- ...group,
607
- properties: group.properties.map((child) => nameSet.has(child.name) ? ast.createFunctionParameter({
608
- name: child.name,
609
- type: child.type,
610
- rest: child.rest,
611
- optional: true
612
- }) : child)
540
+ ...param,
541
+ type: ast.factory.createTypeLiteral({ members: next })
613
542
  };
614
543
  }
615
- const fp = param;
616
- return nameSet.has(fp.name) ? ast.createFunctionParameter({
617
- name: fp.name,
618
- type: fp.type,
619
- rest: fp.rest,
544
+ return typeof param.name === "string" && nameSet.has(param.name) ? ast.factory.createFunctionParameter({
545
+ name: param.name,
546
+ type: param.type,
547
+ rest: param.rest,
620
548
  optional: true
621
- }) : fp;
549
+ }) : param;
622
550
  });
623
- return ast.createFunctionParameters({ params });
551
+ return ast.factory.createFunctionParameters({ params });
624
552
  }
625
553
  functionPrinter({ mode: "declaration" });
626
554
  const queryKeyTransformer = ({ node, casing }) => {
627
555
  if (!node.path) return [];
628
- const path = new URLPath(node.path, { casing });
629
556
  const hasQueryParams = getOperationParameters(node).query.length > 0;
630
557
  const hasRequestBody = !!node.requestBody?.content?.[0]?.schema;
631
558
  return [
632
- path.toObject({
559
+ Url.toObject(node.path, {
633
560
  type: "path",
634
- stringify: true
561
+ stringify: true,
562
+ casing
635
563
  }),
636
564
  hasQueryParams ? "...(params ? [params] : [])" : null,
637
565
  hasRequestBody ? "...(data ? [data] : [])" : null
@@ -639,43 +567,31 @@ const queryKeyTransformer = ({ node, casing }) => {
639
567
  };
640
568
  //#endregion
641
569
  //#region src/utils.ts
642
- function printType(typeNode) {
643
- if (!typeNode) return "unknown";
644
- if (typeNode.variant === "reference") return typeNode.name;
645
- if (typeNode.variant === "member") return `${typeNode.base}['${typeNode.key}']`;
646
- if (typeNode.variant === "struct") return `{ ${typeNode.properties.map((p) => {
647
- const typeStr = printType(p.type);
648
- const key = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(p.name) ? p.name : JSON.stringify(p.name);
649
- return p.optional ? `${key}?: ${typeStr}` : `${key}: ${typeStr}`;
650
- }).join("; ")} }`;
651
- return "unknown";
652
- }
570
+ /**
571
+ * Wraps each parameter type in `MaybeRefOrGetter<…>` so a vue-query signature
572
+ * accepts refs or getters. Group members are wrapped individually; `skip` opts a
573
+ * plain parameter out by name.
574
+ */
653
575
  function wrapWithMaybeRefOrGetter(paramsNode, skip) {
654
576
  const wrappedParams = paramsNode.params.map((param) => {
655
- if ("kind" in param && param.kind === "ParameterGroup") {
656
- const group = param;
657
- return {
658
- ...group,
659
- properties: group.properties.map((p) => ({
660
- ...p,
661
- type: p.type ? ast.createParamsType({
662
- variant: "reference",
663
- name: `MaybeRefOrGetter<${printType(p.type)}>`
664
- }) : p.type
665
- }))
577
+ if (typeof param.name !== "string") {
578
+ const type = param.type;
579
+ if (type && typeof type !== "string" && type.kind === "TypeLiteral") return {
580
+ ...param,
581
+ type: ast.factory.createTypeLiteral({ members: type.members.map((member) => ({
582
+ ...member,
583
+ type: `MaybeRefOrGetter<${renderType(member.type)}>`
584
+ })) })
666
585
  };
586
+ return param;
667
587
  }
668
- const fp = param;
669
- if (skip?.(fp.name)) return fp;
588
+ if (skip?.(param.name)) return param;
670
589
  return {
671
- ...fp,
672
- type: fp.type ? ast.createParamsType({
673
- variant: "reference",
674
- name: `MaybeRefOrGetter<${printType(fp.type)}>`
675
- }) : fp.type
590
+ ...param,
591
+ type: param.type ? `MaybeRefOrGetter<${renderType(param.type)}>` : param.type
676
592
  };
677
593
  });
678
- return ast.createFunctionParameters({ params: wrappedParams });
594
+ return ast.factory.createFunctionParameters({ params: wrappedParams });
679
595
  }
680
596
  //#endregion
681
597
  //#region src/components/QueryKey.tsx
@@ -723,28 +639,13 @@ function QueryKey({ name, node, tsResolver, paramsCasing, pathParamsType, typeNa
723
639
  const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
724
640
  const callPrinter$4 = functionPrinter({ mode: "call" });
725
641
  function getQueryOptionsParams(node, options) {
726
- const { paramsType, paramsCasing, pathParamsType, resolver } = options;
727
- const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
728
- return wrapWithMaybeRefOrGetter(ast.createOperationParams(node, {
729
- paramsType,
730
- pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
731
- paramsCasing,
732
- resolver,
733
- extraParams: [ast.createFunctionParameter({
734
- name: "config",
735
- type: ast.createParamsType({
736
- variant: "reference",
737
- name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
738
- }),
739
- default: "{}"
740
- })]
741
- }), (name) => name === "config");
642
+ return wrapWithMaybeRefOrGetter(buildQueryOptionsParams(node, options), (name) => name === "config");
742
643
  }
743
644
  function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, paramsCasing, paramsType, pathParamsType, queryKeyName }) {
744
645
  const successNames = resolveSuccessNames(node, tsResolver);
745
646
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
746
647
  const errorNames = resolveErrorNames(node, tsResolver);
747
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
648
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
748
649
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
749
650
  const queryKeyParamsNode = buildQueryKeyParamsNode(node, {
750
651
  pathParamsType,
@@ -772,8 +673,7 @@ function QueryOptions({ name, clientName, dataReturnType, node, tsResolver, para
772
673
  params: paramsSignature,
773
674
  children: `
774
675
  const queryKey = ${queryKeyName}(${queryKeyParamsCall})
775
- return queryOptions<${TData}, ${TError}, ${TData}>({
776
- ${enabledText}
676
+ return queryOptions<${TData}, ${TError}, ${TData}>({${enabledText ? `\n ${enabledText}` : ""}
777
677
  queryKey,
778
678
  queryFn: async ({ signal }) => {
779
679
  return ${clientName}(${addToValueCalls$1(clientCallStr, enabledNames)})
@@ -814,26 +714,23 @@ function buildInfiniteQueryParamsNode(node, options) {
814
714
  const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
815
715
  const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
816
716
  const errorNames = resolveErrorNames(node, resolver);
817
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
717
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
818
718
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
819
- const optionsParam = ast.createFunctionParameter({
719
+ const optionsParam = ast.factory.createFunctionParameter({
820
720
  name: "options",
821
- type: ast.createParamsType({
822
- variant: "reference",
823
- name: `{
721
+ type: `{
824
722
  query?: Partial<UseInfiniteQueryOptions<${[
825
- TData,
826
- TError,
827
- "TQueryData",
828
- "TQueryKey",
829
- "TQueryData"
830
- ].join(", ")}>> & { client?: QueryClient },
723
+ TData,
724
+ TError,
725
+ "TQueryData",
726
+ "TQueryKey",
727
+ "TQueryData"
728
+ ].join(", ")}>> & { client?: QueryClient },
831
729
  client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
832
- }`
833
- }),
730
+ }`,
834
731
  default: "{}"
835
732
  });
836
- return wrapWithMaybeRefOrGetter(ast.createOperationParams(node, {
733
+ return wrapWithMaybeRefOrGetter(createOperationParams(node, {
837
734
  paramsType,
838
735
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
839
736
  paramsCasing,
@@ -845,7 +742,7 @@ function InfiniteQuery({ name, queryKeyTypeName, queryOptionsName, queryKeyName,
845
742
  const successNames = resolveSuccessNames(node, tsResolver);
846
743
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
847
744
  const errorNames = resolveErrorNames(node, tsResolver);
848
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
745
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
849
746
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
850
747
  const returnType = `UseInfiniteQueryReturnType<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
851
748
  const generics = [
@@ -910,7 +807,7 @@ const callPrinter$2 = functionPrinter({ mode: "call" });
910
807
  function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam, nextParam, previousParam, node, tsResolver, paramsCasing, paramsType, dataReturnType, pathParamsType, queryParam, queryKeyName }) {
911
808
  const successNames = resolveSuccessNames(node, tsResolver);
912
809
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
913
- const queryFnDataType = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
810
+ const queryFnDataType = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
914
811
  const errorNames = resolveErrorNames(node, tsResolver);
915
812
  const errorType = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
916
813
  const isInitialPageParamDefined = initialPageParam !== void 0 && initialPageParam !== null;
@@ -956,11 +853,10 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
956
853
  getNextPageParamExpr,
957
854
  getPreviousPageParamExpr
958
855
  ].filter(Boolean);
959
- const infiniteOverrideParams = queryParam && queryParamsTypeName ? `
960
- params = {
961
- ...(params ?? {}),
962
- ['${queryParam}']: pageParam as unknown as ${queryParamsTypeName}['${queryParam}'],
963
- } as ${queryParamsTypeName}` : "";
856
+ const infiniteOverrideParams = queryParam && queryParamsTypeName ? `params = {
857
+ ...(params ?? {}),
858
+ ['${queryParam}']: pageParam as unknown as ${queryParamsTypeName}['${queryParam}'],
859
+ } as ${queryParamsTypeName}` : "";
964
860
  if (infiniteOverrideParams) return /* @__PURE__ */ jsx(File.Source, {
965
861
  name,
966
862
  isExportable: true,
@@ -970,16 +866,15 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
970
866
  export: true,
971
867
  params: paramsSignature,
972
868
  children: `
973
- const queryKey = ${queryKeyName}(${queryKeyParamsCall})
974
- return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({
975
- ${enabledText}
976
- queryKey,
977
- queryFn: async ({ signal, pageParam }) => {
978
- ${infiniteOverrideParams}
979
- return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
980
- },
981
- ${queryOptionsArr.join(",\n")}
982
- })
869
+ const queryKey = ${queryKeyName}(${queryKeyParamsCall})
870
+ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({${enabledText ? `\n ${enabledText}` : ""}
871
+ queryKey,
872
+ queryFn: async ({ signal, pageParam }) => {
873
+ ${infiniteOverrideParams}
874
+ return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
875
+ },
876
+ ${queryOptionsArr.join(",\n ")}
877
+ })
983
878
  `
984
879
  })
985
880
  });
@@ -992,15 +887,14 @@ function InfiniteQueryOptions({ name, clientName, initialPageParam, cursorParam,
992
887
  export: true,
993
888
  params: paramsSignature,
994
889
  children: `
995
- const queryKey = ${queryKeyName}(${queryKeyParamsCall})
996
- return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({
997
- ${enabledText}
998
- queryKey,
999
- queryFn: async ({ signal }) => {
1000
- return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
1001
- },
1002
- ${queryOptionsArr.join(",\n")}
1003
- })
890
+ const queryKey = ${queryKeyName}(${queryKeyParamsCall})
891
+ return infiniteQueryOptions<${queryFnDataType}, ${errorType}, InfiniteData<${queryFnDataType}>, QueryKey, ${pageParamType}>({${enabledText ? `\n ${enabledText}` : ""}
892
+ queryKey,
893
+ queryFn: async ({ signal }) => {
894
+ return ${clientName}(${addToValueCalls(clientCallStr, enabledNames)})
895
+ },
896
+ ${queryOptionsArr.join(",\n ")}
897
+ })
1004
898
  `
1005
899
  })
1006
900
  });
@@ -1022,9 +916,9 @@ function addToValueCalls(callStr, enabledNames = []) {
1022
916
  //#region src/components/Mutation.tsx
1023
917
  const declarationPrinter$1 = functionPrinter({ mode: "declaration" });
1024
918
  const callPrinter$1 = functionPrinter({ mode: "call" });
1025
- const keysPrinter = functionPrinter({ mode: "keys" });
919
+ const keysPrinter = functionPrinter({ mode: "call" });
1026
920
  function createMutationArgParams(node, options) {
1027
- return ast.createOperationParams(node, {
921
+ return createOperationParams(node, {
1028
922
  paramsType: "inline",
1029
923
  pathParamsType: "inline",
1030
924
  paramsCasing: options.paramsCasing,
@@ -1036,27 +930,24 @@ function buildMutationParamsNode(node, options) {
1036
930
  const successNames = resolveSuccessNames(node, resolver);
1037
931
  const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
1038
932
  const errorNames = resolveErrorNames(node, resolver);
1039
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
933
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
1040
934
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1041
935
  const wrappedParamsNode = wrapWithMaybeRefOrGetter(createMutationArgParams(node, {
1042
936
  paramsCasing,
1043
937
  resolver
1044
938
  }));
1045
939
  const TRequestWrapped = wrappedParamsNode.params.length > 0 ? declarationPrinter$1.print(wrappedParamsNode) ?? "" : "";
1046
- return ast.createFunctionParameters({ params: [ast.createFunctionParameter({
940
+ return ast.factory.createFunctionParameters({ params: [ast.factory.createFunctionParameter({
1047
941
  name: "options",
1048
- type: ast.createParamsType({
1049
- variant: "reference",
1050
- name: `{
942
+ type: `{
1051
943
  mutation?: MutationObserverOptions<${[
1052
- TData,
1053
- TError,
1054
- TRequestWrapped ? `{${TRequestWrapped}}` : "undefined",
1055
- "TContext"
1056
- ].join(", ")}> & { client?: QueryClient },
944
+ TData,
945
+ TError,
946
+ TRequestWrapped ? `{${TRequestWrapped}}` : "undefined",
947
+ "TContext"
948
+ ].join(", ")}> & { client?: QueryClient },
1057
949
  client?: ${buildRequestConfigType(node, resolver)},
1058
- }`
1059
- }),
950
+ }`,
1060
951
  default: "{}"
1061
952
  })] });
1062
953
  }
@@ -1064,7 +955,7 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
1064
955
  const successNames = resolveSuccessNames(node, tsResolver);
1065
956
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
1066
957
  const errorNames = resolveErrorNames(node, tsResolver);
1067
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
958
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
1068
959
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1069
960
  const mutationArgParamsNode = createMutationArgParams(node, {
1070
961
  paramsCasing,
@@ -1079,19 +970,16 @@ function Mutation({ name, clientName, paramsCasing, paramsType, pathParamsType,
1079
970
  TRequest ? `{${TRequest}}` : "undefined",
1080
971
  "TContext"
1081
972
  ].join(", ");
1082
- const mutationKeyParamsNode = ast.createFunctionParameters({ params: [] });
973
+ const mutationKeyParamsNode = ast.factory.createFunctionParameters({ params: [] });
1083
974
  const mutationKeyParamsCall = callPrinter$1.print(mutationKeyParamsNode) ?? "";
1084
- const clientCallParamsNode = ast.createOperationParams(node, {
975
+ const clientCallParamsNode = createOperationParams(node, {
1085
976
  paramsType,
1086
977
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
1087
978
  paramsCasing,
1088
979
  resolver: tsResolver,
1089
- extraParams: [ast.createFunctionParameter({
980
+ extraParams: [ast.factory.createFunctionParameter({
1090
981
  name: "config",
1091
- type: ast.createParamsType({
1092
- variant: "reference",
1093
- name: buildRequestConfigType(node, tsResolver)
1094
- }),
982
+ type: buildRequestConfigType(node, tsResolver),
1095
983
  default: "{}"
1096
984
  })]
1097
985
  });
@@ -1138,26 +1026,23 @@ function buildQueryParamsNode(node, options) {
1138
1026
  const responseName = successNames.length > 0 ? successNames.join(" | ") : resolver.resolveResponseName(node);
1139
1027
  const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : null;
1140
1028
  const errorNames = resolveErrorNames(node, resolver);
1141
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
1029
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
1142
1030
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1143
- const optionsParam = ast.createFunctionParameter({
1031
+ const optionsParam = ast.factory.createFunctionParameter({
1144
1032
  name: "options",
1145
- type: ast.createParamsType({
1146
- variant: "reference",
1147
- name: `{
1033
+ type: `{
1148
1034
  query?: Partial<UseQueryOptions<${[
1149
- TData,
1150
- TError,
1151
- "TData",
1152
- "TQueryData",
1153
- "TQueryKey"
1154
- ].join(", ")}>> & { client?: QueryClient },
1035
+ TData,
1036
+ TError,
1037
+ "TData",
1038
+ "TQueryData",
1039
+ "TQueryKey"
1040
+ ].join(", ")}>> & { client?: QueryClient },
1155
1041
  client?: ${requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"}
1156
- }`
1157
- }),
1042
+ }`,
1158
1043
  default: "{}"
1159
1044
  });
1160
- return wrapWithMaybeRefOrGetter(ast.createOperationParams(node, {
1045
+ return wrapWithMaybeRefOrGetter(createOperationParams(node, {
1161
1046
  paramsType,
1162
1047
  pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
1163
1048
  paramsCasing,
@@ -1169,7 +1054,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
1169
1054
  const successNames = resolveSuccessNames(node, tsResolver);
1170
1055
  const responseName = successNames.length > 0 ? successNames.join(" | ") : tsResolver.resolveResponseName(node);
1171
1056
  const errorNames = resolveErrorNames(node, tsResolver);
1172
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
1057
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
1173
1058
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
1174
1059
  const returnType = `UseQueryReturnType<${["TData", TError].join(", ")}> & { queryKey: TQueryKey }`;
1175
1060
  const generics = [
@@ -1230,4 +1115,4 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
1230
1115
  //#endregion
1231
1116
  export { QueryOptions as a, resolveZodSchemaNames as c, getOperationParameters as d, operationFileEntry as f, InfiniteQuery as i, MutationKey as l, camelCase as m, Mutation as n, QueryKey as o, resolveOperationTypeNames as p, InfiniteQueryOptions as r, queryKeyTransformer as s, Query as t, mutationKeyTransformer as u };
1232
1117
 
1233
- //# sourceMappingURL=components-Bxe1EuWf.js.map
1118
+ //# sourceMappingURL=components-CAlEf7Oh.js.map