@kubb/plugin-swr 5.0.0-beta.42 → 5.0.0-beta.56

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 (35) hide show
  1. package/dist/{components-CD7ZoS3B.cjs → components-C8FJ3-Cb.cjs} +175 -196
  2. package/dist/components-C8FJ3-Cb.cjs.map +1 -0
  3. package/dist/{components-BuLagnaM.js → components-CR9NLFcO.js} +176 -197
  4. package/dist/components-CR9NLFcO.js.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-CSinCSzM.js → generators-BB6csINY.js} +67 -91
  9. package/dist/generators-BB6csINY.js.map +1 -0
  10. package/dist/{generators-D_Cz5DDw.cjs → generators-mw3FvFJD.cjs} +66 -90
  11. package/dist/generators-mw3FvFJD.cjs.map +1 -0
  12. package/dist/generators.cjs +1 -1
  13. package/dist/generators.d.ts +6 -1
  14. package/dist/generators.js +1 -1
  15. package/dist/index.cjs +62 -12
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +63 -13
  19. package/dist/index.js.map +1 -1
  20. package/dist/{types-BoANASs2.d.ts → types-Dz_j0Bqv.d.ts} +11 -14
  21. package/package.json +9 -17
  22. package/src/components/Mutation.tsx +3 -3
  23. package/src/components/Query.tsx +3 -3
  24. package/src/components/QueryOptions.tsx +3 -21
  25. package/src/generators/mutationGenerator.tsx +11 -7
  26. package/src/generators/queryGenerator.tsx +3 -7
  27. package/src/plugin.ts +6 -18
  28. package/src/resolvers/resolverSwr.ts +2 -2
  29. package/src/types.ts +9 -12
  30. package/src/utils.ts +8 -1
  31. package/dist/components-BuLagnaM.js.map +0 -1
  32. package/dist/components-CD7ZoS3B.cjs.map +0 -1
  33. package/dist/generators-CSinCSzM.js.map +0 -1
  34. package/dist/generators-D_Cz5DDw.cjs.map +0 -1
  35. package/extension.yaml +0 -199
@@ -14,35 +14,19 @@ import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
14
14
  function toCamelOrPascal(text, pascal) {
15
15
  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
16
  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);
17
+ return (i === 0 && !pascal ? word.charAt(0).toLowerCase() : word.charAt(0).toUpperCase()) + word.slice(1);
19
18
  }).join("").replace(/[^a-zA-Z0-9]/g, "");
20
19
  }
21
20
  /**
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
21
  * Converts `text` to camelCase.
35
- * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
36
22
  *
37
- * @example
38
- * camelCase('hello-world') // 'helloWorld'
39
- * camelCase('pet.petId', { isFile: true }) // 'pet/petId'
23
+ * @example Word boundaries
24
+ * `camelCase('hello-world') // 'helloWorld'`
25
+ *
26
+ * @example With a prefix
27
+ * `camelCase('tag', { prefix: 'create' }) // 'createTag'`
40
28
  */
41
- function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
42
- if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
43
- prefix,
44
- suffix
45
- } : {}));
29
+ function camelCase(text, { prefix = "", suffix = "" } = {}) {
46
30
  return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
47
31
  }
48
32
  //#endregion
@@ -149,99 +133,80 @@ function isValidVarName(name) {
149
133
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name);
150
134
  }
151
135
  //#endregion
152
- //#region ../../internals/utils/src/urlPath.ts
136
+ //#region ../../internals/utils/src/url.ts
137
+ function transformParam(raw, casing) {
138
+ const param = isValidVarName(raw) ? raw : camelCase(raw);
139
+ return casing === "camelcase" ? camelCase(param) : param;
140
+ }
141
+ function toParamsObject(path, { replacer, casing } = {}) {
142
+ const params = {};
143
+ for (const match of path.matchAll(/\{([^}]+)\}/g)) {
144
+ const param = transformParam(match[1], casing);
145
+ const key = replacer ? replacer(param) : param;
146
+ params[key] = key;
147
+ }
148
+ return Object.keys(params).length > 0 ? params : null;
149
+ }
153
150
  /**
154
- * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
155
- *
156
- * @example
157
- * const p = new URLPath('/pet/{petId}')
158
- * p.URL // '/pet/:petId'
159
- * p.template // '`/pet/${petId}`'
151
+ * Helpers for OpenAPI/Swagger paths, plus a thin wrapper over the native `URL`.
160
152
  */
161
- var URLPath = class {
153
+ var Url = class Url {
162
154
  /**
163
- * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
164
- */
165
- path;
166
- #options;
167
- constructor(path, options = {}) {
168
- this.path = path;
169
- this.#options = options;
170
- }
171
- /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
155
+ * Reports whether `url` is a parseable absolute URL. Delegates to the native `URL.canParse`.
172
156
  *
173
157
  * @example
174
- * ```ts
175
- * new URLPath('/pet/{petId}').URL // '/pet/:petId'
176
- * ```
158
+ * Url.canParse('https://petstore.swagger.io/v2') // true
159
+ * Url.canParse('/pet/{petId}') // false
177
160
  */
178
- get URL() {
179
- return this.toURLPath();
161
+ static canParse(url, base) {
162
+ return URL.canParse(url, base);
180
163
  }
181
- /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
164
+ /**
165
+ * Converts an OpenAPI/Swagger path to Express-style colon syntax.
182
166
  *
183
167
  * @example
184
- * ```ts
185
- * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
186
- * new URLPath('/pet/{petId}').isURL // false
187
- * ```
168
+ * Url.toPath('/pet/{petId}') // '/pet/:petId'
188
169
  */
189
- get isURL() {
190
- try {
191
- return !!new URL(this.path).href;
192
- } catch {
193
- return false;
194
- }
170
+ static toPath(path) {
171
+ return path.replace(/\{([^}]+)\}/g, ":$1");
195
172
  }
196
173
  /**
197
- * Converts the OpenAPI path to a TypeScript template literal string.
174
+ * Converts an OpenAPI/Swagger path to a TypeScript template literal string.
175
+ * `prefix` is prepended inside the literal, `replacer` transforms each parameter name,
176
+ * and `casing` controls parameter identifier casing.
198
177
  *
199
178
  * @example
200
- * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
201
- * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
202
- */
203
- get template() {
204
- return this.toTemplateString();
205
- }
206
- /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
179
+ * Url.toTemplateString('/pet/{petId}') // '`/pet/${petId}`'
207
180
  *
208
181
  * @example
209
- * ```ts
210
- * new URLPath('/pet/{petId}').object
211
- * // { url: '/pet/:petId', params: { petId: 'petId' } }
212
- * ```
182
+ * Url.toTemplateString('/pet/{petId}', { prefix: 'https://api' }) // '`https://api/pet/${petId}`'
213
183
  */
214
- get object() {
215
- return this.toObject();
184
+ static toTemplateString(path, { prefix, replacer, casing } = {}) {
185
+ const result = path.split(/\{([^}]+)\}/).map((part, i) => {
186
+ if (i % 2 === 0) return part;
187
+ const param = transformParam(part, casing);
188
+ return `\${${replacer ? replacer(param) : param}}`;
189
+ }).join("");
190
+ return `\`${prefix ?? ""}${result}\``;
216
191
  }
217
- /** Returns a map of path parameter names, or `null` when the path has no parameters.
192
+ /**
193
+ * Returns the path and its extracted params as a structured `URLObject`, or as a stringified
194
+ * expression when `stringify` is set.
218
195
  *
219
196
  * @example
220
- * ```ts
221
- * new URLPath('/pet/{petId}').params // { petId: 'petId' }
222
- * new URLPath('/pet').params // null
223
- * ```
224
- */
225
- get params() {
226
- return this.toParamsObject();
227
- }
228
- #transformParam(raw) {
229
- const param = isValidVarName(raw) ? raw : camelCase(raw);
230
- return this.#options.casing === "camelcase" ? camelCase(param) : param;
231
- }
232
- /**
233
- * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
197
+ * Url.toObject('/pet/{petId}')
198
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
234
199
  */
235
- #eachParam(fn) {
236
- for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
237
- const raw = match[1];
238
- fn(raw, this.#transformParam(raw));
239
- }
240
- }
241
- toObject({ type = "path", replacer, stringify } = {}) {
200
+ static toObject(path, { type = "path", replacer, stringify, casing } = {}) {
242
201
  const object = {
243
- url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
244
- params: this.toParamsObject()
202
+ url: type === "path" ? Url.toPath(path) : Url.toTemplateString(path, {
203
+ replacer,
204
+ casing
205
+ }),
206
+ params: toParamsObject(path, {
207
+ replacer,
208
+ casing
209
+ })
245
210
  };
246
211
  if (stringify) {
247
212
  if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
@@ -250,85 +215,13 @@ var URLPath = class {
250
215
  }
251
216
  return object;
252
217
  }
253
- /**
254
- * Converts the OpenAPI path to a TypeScript template literal string.
255
- * An optional `replacer` can transform each extracted parameter name before interpolation.
256
- *
257
- * @example
258
- * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
259
- */
260
- toTemplateString({ prefix, replacer } = {}) {
261
- const result = this.path.split(/\{([^}]+)\}/).map((part, i) => {
262
- if (i % 2 === 0) return part;
263
- const param = this.#transformParam(part);
264
- return `\${${replacer ? replacer(param) : param}}`;
265
- }).join("");
266
- return `\`${prefix ?? ""}${result}\``;
267
- }
268
- /**
269
- * Extracts all `{param}` segments from the path and returns them as a key-value map.
270
- * An optional `replacer` transforms each parameter name in both key and value positions.
271
- * Returns `undefined` when no path parameters are found.
272
- *
273
- * @example
274
- * ```ts
275
- * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()
276
- * // { petId: 'petId', tagId: 'tagId' }
277
- * ```
278
- */
279
- toParamsObject(replacer) {
280
- const params = {};
281
- this.#eachParam((_raw, param) => {
282
- const key = replacer ? replacer(param) : param;
283
- params[key] = key;
284
- });
285
- return Object.keys(params).length > 0 ? params : null;
286
- }
287
- /** Converts the OpenAPI path to Express-style colon syntax.
288
- *
289
- * @example
290
- * ```ts
291
- * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
292
- * ```
293
- */
294
- toURLPath() {
295
- return this.path.replace(/\{([^}]+)\}/g, ":$1");
296
- }
297
218
  };
298
219
  //#endregion
299
- //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
300
- const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
301
- const mutationKeyTransformer = ({ node, casing }) => {
302
- if (!node.path) return [];
303
- return [`{ url: '${new URLPath(node.path, { casing }).toURLPath()}' }`];
304
- };
305
- function MutationKey$1({ name, paramsCasing, node, transformer }) {
306
- const paramsNode = ast.createFunctionParameters({ params: [] });
307
- const paramsSignature = declarationPrinter$4.print(paramsNode) ?? "";
308
- const keys = (transformer ?? mutationKeyTransformer)({
309
- node,
310
- casing: paramsCasing
311
- });
312
- return /* @__PURE__ */ jsx(File.Source, {
313
- name,
314
- isExportable: true,
315
- isIndexable: true,
316
- children: /* @__PURE__ */ jsx(Function.Arrow, {
317
- name,
318
- export: true,
319
- params: paramsSignature,
320
- singleLine: true,
321
- children: `[${keys.join(", ")}] as const`
322
- })
323
- });
324
- }
325
- __name(MutationKey$1, "MutationKey");
326
- //#endregion
327
220
  //#region ../../internals/shared/src/operation.ts
328
221
  function getOperationLink(node, link) {
329
222
  if (!link) return null;
330
223
  if (typeof link === "function") return link(node) ?? null;
331
- if (link === "urlPath") return node.path ? `{@link ${new URLPath(node.path).URL}}` : null;
224
+ if (link === "urlPath") return node.path ? `{@link ${Url.toPath(node.path)}}` : null;
332
225
  return node.path ? `{@link ${node.path.replaceAll("{", ":").replaceAll("}", "")}}` : null;
333
226
  }
334
227
  function getContentTypeInfo(node) {
@@ -387,6 +280,19 @@ function resolveErrorNames(node, resolver) {
387
280
  function resolveStatusCodeNames(node, resolver) {
388
281
  return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
389
282
  }
283
+ /**
284
+ * Builds the discriminated union type string for `dataReturnType: 'full'` return shapes.
285
+ * Each member is `{ status: N; data: StatusNType; statusText: string }`.
286
+ */
287
+ function buildStatusUnionType(node, resolver) {
288
+ const members = node.responses.map((r) => {
289
+ const typeName = resolver.resolveResponseStatusName(node, r.statusCode);
290
+ const statusCode = Number.parseInt(r.statusCode, 10);
291
+ return `{ status: ${Number.isNaN(statusCode) ? "number" : String(statusCode)}; data: ${typeName}; statusText: string }`;
292
+ });
293
+ if (members.length === 1) return members[0];
294
+ return `(${members.join(" | ")})`;
295
+ }
390
296
  const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
391
297
  function resolveOperationTypeNames(node, resolver, options = {}) {
392
298
  const cacheKey = `${node.operationId}\0${options.paramsCasing ?? ""}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${(options.exclude ?? []).join(",")}`;
@@ -420,15 +326,103 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
420
326
  return result;
421
327
  }
422
328
  //#endregion
329
+ //#region ../../internals/tanstack-query/src/components/MutationKey.tsx
330
+ const declarationPrinter$4 = functionPrinter({ mode: "declaration" });
331
+ const mutationKeyTransformer = ({ node }) => {
332
+ if (!node.path) return [];
333
+ return [`{ url: '${Url.toPath(node.path)}' }`];
334
+ };
335
+ function MutationKey$1({ name, paramsCasing, node, transformer }) {
336
+ const paramsNode = ast.createFunctionParameters({ params: [] });
337
+ const paramsSignature = declarationPrinter$4.print(paramsNode) ?? "";
338
+ const keys = (transformer ?? mutationKeyTransformer)({
339
+ node,
340
+ casing: paramsCasing
341
+ });
342
+ return /* @__PURE__ */ jsx(File.Source, {
343
+ name,
344
+ isExportable: true,
345
+ isIndexable: true,
346
+ children: /* @__PURE__ */ jsx(Function.Arrow, {
347
+ name,
348
+ export: true,
349
+ params: paramsSignature,
350
+ singleLine: true,
351
+ children: `[${keys.join(", ")}] as const`
352
+ })
353
+ });
354
+ }
355
+ __name(MutationKey$1, "MutationKey");
356
+ //#endregion
423
357
  //#region ../../internals/tanstack-query/src/utils.ts
424
358
  /**
425
- * Collects the Zod schema import names for an operation (response + request body).
359
+ * Builds the shared `(…params, config = {})` parameter list for a TanStack
360
+ * query-options function. The trailing `config` parameter is typed as a partial
361
+ * `RequestConfig` with an optional `client`. Framework plugins wrap the result
362
+ * when needed, for example vue-query applies `MaybeRefOrGetter`.
363
+ */
364
+ function buildQueryOptionsParams(node, options) {
365
+ const { paramsType, paramsCasing, pathParamsType, resolver } = options;
366
+ const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
367
+ return ast.createOperationParams(node, {
368
+ paramsType,
369
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
370
+ paramsCasing,
371
+ resolver,
372
+ extraParams: [ast.createFunctionParameter({
373
+ name: "config",
374
+ type: ast.createParamsType({
375
+ variant: "reference",
376
+ name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
377
+ }),
378
+ default: "{}"
379
+ })]
380
+ });
381
+ }
382
+ /**
383
+ * Returns `'zod'` when response-direction parsing is enabled.
384
+ * The string shorthand `'zod'` also enables response parsing.
385
+ */
386
+ function resolveResponseParser(parser) {
387
+ if (!parser) return null;
388
+ if (parser === "zod") return "zod";
389
+ return parser.response ?? null;
390
+ }
391
+ /**
392
+ * Returns `'zod'` when request body parsing is enabled.
393
+ * The string shorthand `'zod'` also enables request body parsing (existing behavior).
394
+ */
395
+ function resolveRequestParser(parser) {
396
+ if (!parser) return null;
397
+ if (parser === "zod") return "zod";
398
+ return parser.request ?? null;
399
+ }
400
+ /**
401
+ * Returns `'zod'` when query-params parsing is enabled.
402
+ * Only the object form `{ request: 'zod' }` enables this. `parser: 'zod'` does not.
403
+ */
404
+ function resolveQueryParamsParser(parser) {
405
+ if (!parser || parser === "zod") return null;
406
+ return parser.request ?? null;
407
+ }
408
+ /**
409
+ * Collects the Zod schema import names for an operation based on the active parser directions.
426
410
  *
427
- * Returns an empty array when no resolver is provided or the operation has no request body schema.
411
+ * - `parser: 'zod'`: response and request body names (backward-compatible behavior).
412
+ * - `parser: { request: 'zod' }`: request body and query params names.
413
+ * - `parser: { response: 'zod' }`: response name only.
414
+ * - `parser: { request: 'zod', response: 'zod' }`: all three.
415
+ *
416
+ * Returns an empty array when no resolver is provided or `parser` is falsy.
428
417
  */
429
- function resolveZodSchemaNames(node, zodResolver) {
430
- if (!zodResolver) return [];
431
- return [zodResolver.resolveResponseName?.(node), node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null].filter((n) => Boolean(n));
418
+ function resolveZodSchemaNames(node, zodResolver, parser) {
419
+ if (!zodResolver || !parser) return [];
420
+ const { query: queryParams } = getOperationParameters(node);
421
+ return [
422
+ resolveResponseParser(parser) === "zod" ? zodResolver.resolveResponseName?.(node) : null,
423
+ resolveRequestParser(parser) === "zod" && node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName?.(node) : null,
424
+ resolveQueryParamsParser(parser) === "zod" && queryParams.length > 0 ? zodResolver.resolveQueryParamsName?.(node, queryParams[0]) : null
425
+ ].filter((n) => Boolean(n));
432
426
  }
433
427
  /**
434
428
  * Resolve the type for a single path parameter.
@@ -608,13 +602,13 @@ function injectNonNullAssertions(callStr, names) {
608
602
  const declarationPrinter$3 = functionPrinter({ mode: "declaration" });
609
603
  const queryKeyTransformer = ({ node, casing }) => {
610
604
  if (!node.path) return [];
611
- const path = new URLPath(node.path, { casing });
612
605
  const hasQueryParams = getOperationParameters(node).query.length > 0;
613
606
  const hasRequestBody = !!node.requestBody?.content?.[0]?.schema;
614
607
  return [
615
- path.toObject({
608
+ Url.toObject(node.path, {
616
609
  type: "path",
617
- stringify: true
610
+ stringify: true,
611
+ casing
618
612
  }),
619
613
  hasQueryParams ? "...(params ? [params] : [])" : null,
620
614
  hasRequestBody ? "...(data ? [data] : [])" : null
@@ -669,7 +663,7 @@ function buildMutationParamsNode(node, options) {
669
663
  const { dataReturnType, mutationKeyTypeName, mutationArgTypeName, resolver } = options;
670
664
  const responseName = resolver.resolveResponseName(node);
671
665
  const errorNames = resolveErrorNames(node, resolver);
672
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
666
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
673
667
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
674
668
  return ast.createFunctionParameters({ params: [ast.createFunctionParameter({
675
669
  name: "options",
@@ -687,7 +681,7 @@ function buildMutationParamsNode(node, options) {
687
681
  function Mutation({ name, clientName, mutationKeyName, mutationKeyTypeName, mutationArgTypeName, paramsCasing, paramsType, pathParamsType, dataReturnType, node, tsResolver }) {
688
682
  const responseName = tsResolver.resolveResponseName(node);
689
683
  const errorNames = resolveErrorNames(node, tsResolver);
690
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
684
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver);
691
685
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
692
686
  const mutationArgParamsNode = createMutationArgParams(node, {
693
687
  paramsCasing,
@@ -785,22 +779,7 @@ function MutationKey({ name, typeName, node, paramsCasing, pathParamsType, trans
785
779
  const declarationPrinter$1 = functionPrinter({ mode: "declaration" });
786
780
  const callPrinter$1 = functionPrinter({ mode: "call" });
787
781
  function getQueryOptionsParams(node, options) {
788
- const { paramsType, paramsCasing, pathParamsType, resolver } = options;
789
- const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
790
- return ast.createOperationParams(node, {
791
- paramsType,
792
- pathParamsType: paramsType === "object" ? "object" : pathParamsType === "object" ? "object" : "inline",
793
- paramsCasing,
794
- resolver,
795
- extraParams: [ast.createFunctionParameter({
796
- name: "config",
797
- type: ast.createParamsType({
798
- variant: "reference",
799
- name: requestName ? `Partial<RequestConfig<${requestName}>> & { client?: Client }` : "Partial<RequestConfig> & { client?: Client }"
800
- }),
801
- default: "{}"
802
- })]
803
- });
782
+ return buildQueryOptionsParams(node, options);
804
783
  }
805
784
  function QueryOptions({ name, clientName, node, tsResolver, paramsCasing, paramsType, pathParamsType }) {
806
785
  const enabledNames = getEnabledParamNames(buildQueryKeyParams(node, {
@@ -843,7 +822,7 @@ function buildQueryParamsNode(node, options) {
843
822
  const responseName = resolver.resolveResponseName(node);
844
823
  const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0;
845
824
  const errorNames = resolveErrorNames(node, resolver);
846
- const TData = dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`;
825
+ const TData = dataReturnType === "data" ? responseName : buildStatusUnionType(node, resolver);
847
826
  const TError = `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`;
848
827
  const optionsParam = ast.createFunctionParameter({
849
828
  name: "options",
@@ -870,7 +849,7 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
870
849
  const responseName = tsResolver.resolveResponseName(node);
871
850
  const errorNames = resolveErrorNames(node, tsResolver);
872
851
  const generics = [
873
- dataReturnType === "data" ? responseName : `ResponseConfig<${responseName}>`,
852
+ dataReturnType === "data" ? responseName : buildStatusUnionType(node, tsResolver),
874
853
  `ResponseErrorConfig<${errorNames.length > 0 ? errorNames.join(" | ") : "Error"}>`,
875
854
  `${queryKeyTypeName} | null`
876
855
  ];
@@ -928,6 +907,6 @@ function Query({ name, queryKeyTypeName, queryOptionsName, queryKeyName, paramsT
928
907
  });
929
908
  }
930
909
  //#endregion
931
- export { QueryKey as a, resolveOperationTypeNames as c, Mutation as i, mutationKeyTransformer as l, QueryOptions as n, queryKeyTransformer as o, MutationKey as r, resolveZodSchemaNames as s, Query as t, camelCase as u };
910
+ export { QueryKey as a, mutationKeyTransformer as c, Mutation as i, resolveOperationTypeNames as l, QueryOptions as n, queryKeyTransformer as o, MutationKey as r, resolveZodSchemaNames as s, Query as t, camelCase as u };
932
911
 
933
- //# sourceMappingURL=components-BuLagnaM.js.map
912
+ //# sourceMappingURL=components-CR9NLFcO.js.map