@kubb/plugin-react-query 3.5.2 → 3.5.4

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 (37) hide show
  1. package/dist/{chunk-2UDCBM34.js → chunk-3UCN4GIP.js} +329 -31
  2. package/dist/chunk-3UCN4GIP.js.map +1 -0
  3. package/dist/{chunk-ZHLF4MXY.cjs → chunk-7E2B7BQC.cjs} +16 -6
  4. package/dist/chunk-7E2B7BQC.cjs.map +1 -0
  5. package/dist/{chunk-5J7D6D3Z.js → chunk-D3JAKOKY.js} +16 -8
  6. package/dist/chunk-D3JAKOKY.js.map +1 -0
  7. package/dist/{chunk-QUDUSXV4.cjs → chunk-VKOQV7WK.cjs} +346 -44
  8. package/dist/chunk-VKOQV7WK.cjs.map +1 -0
  9. package/dist/components.cjs +9 -9
  10. package/dist/components.js +1 -1
  11. package/dist/generators.cjs +6 -6
  12. package/dist/generators.js +2 -2
  13. package/dist/index.cjs +5 -5
  14. package/dist/index.js +2 -2
  15. package/package.json +10 -10
  16. package/src/generators/__snapshots__/clientDataReturnTypeFull.ts +1 -1
  17. package/src/generators/__snapshots__/clientGetImportPath.ts +1 -1
  18. package/src/generators/__snapshots__/clientPostImportPath.ts +1 -1
  19. package/src/generators/__snapshots__/findByTags.ts +1 -1
  20. package/src/generators/__snapshots__/findByTagsObject.ts +1 -1
  21. package/src/generators/__snapshots__/findByTagsPathParamsObject.ts +1 -1
  22. package/src/generators/__snapshots__/findByTagsWithCustomQueryKey.ts +1 -1
  23. package/src/generators/__snapshots__/findByTagsWithZod.ts +1 -1
  24. package/src/generators/__snapshots__/findInfiniteByTags.ts +2 -2
  25. package/src/generators/__snapshots__/findInfiniteByTagsCursor.ts +2 -2
  26. package/src/generators/__snapshots__/getPetIdCamelCase.ts +1 -1
  27. package/src/generators/__snapshots__/postAsQuery.ts +1 -1
  28. package/src/generators/__snapshots__/updatePetById.ts +1 -1
  29. package/src/generators/__snapshots__/updatePetByIdPathParamsObject.ts +1 -1
  30. package/src/generators/infiniteQueryGenerator.tsx +29 -16
  31. package/src/generators/mutationGenerator.tsx +28 -16
  32. package/src/generators/queryGenerator.tsx +28 -16
  33. package/src/generators/suspenseQueryGenerator.tsx +28 -16
  34. package/dist/chunk-2UDCBM34.js.map +0 -1
  35. package/dist/chunk-5J7D6D3Z.js.map +0 -1
  36. package/dist/chunk-QUDUSXV4.cjs.map +0 -1
  37. package/dist/chunk-ZHLF4MXY.cjs.map +0 -1
@@ -1,22 +1,295 @@
1
1
  'use strict';
2
2
 
3
- var chunkZHLF4MXY_cjs = require('./chunk-ZHLF4MXY.cjs');
3
+ var chunk7E2B7BQC_cjs = require('./chunk-7E2B7BQC.cjs');
4
+ var path = require('path');
5
+ var core = require('@kubb/core');
6
+ var transformers = require('@kubb/core/transformers');
4
7
  var pluginOas = require('@kubb/plugin-oas');
8
+ var pluginZod = require('@kubb/plugin-zod');
5
9
  var hooks = require('@kubb/plugin-oas/hooks');
6
10
  var utils = require('@kubb/plugin-oas/utils');
7
11
  var pluginTs = require('@kubb/plugin-ts');
8
- var pluginZod = require('@kubb/plugin-zod');
9
12
  var react = require('@kubb/react');
10
- var remeda = require('remeda');
11
13
  var jsxRuntime = require('@kubb/react/jsx-runtime');
14
+ var remeda = require('remeda');
15
+
16
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
+
18
+ var path__default = /*#__PURE__*/_interopDefault(path);
19
+
20
+ var clientGenerator = pluginOas.createReactGenerator({
21
+ name: "client",
22
+ Operation({ options, operation }) {
23
+ const {
24
+ plugin: {
25
+ options: { output }
26
+ }
27
+ } = react.useApp();
28
+ const oas = hooks.useOas();
29
+ const { getSchemas, getName, getFile } = hooks.useOperationManager();
30
+ const client = {
31
+ name: getName(operation, { type: "function" }),
32
+ file: getFile(operation)
33
+ };
34
+ const url = {
35
+ name: getName(operation, { type: "function", suffix: "url", prefix: "get" }),
36
+ file: getFile(operation)
37
+ };
38
+ const type = {
39
+ file: getFile(operation, { pluginKey: [pluginTs.pluginTsName] }),
40
+ schemas: getSchemas(operation, { pluginKey: [pluginTs.pluginTsName], type: "type" })
41
+ };
42
+ const zod = {
43
+ file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
44
+ schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
45
+ };
46
+ return /* @__PURE__ */ jsxRuntime.jsxs(
47
+ react.File,
48
+ {
49
+ baseName: client.file.baseName,
50
+ path: client.file.path,
51
+ meta: client.file.meta,
52
+ banner: utils.getBanner({ oas, output }),
53
+ footer: utils.getFooter({ oas, output }),
54
+ children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.importPath }),
56
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.importPath, isTypeOnly: true }),
57
+ options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: client.file.path, path: zod.file.path }),
58
+ /* @__PURE__ */ jsxRuntime.jsx(
59
+ react.File.Import,
60
+ {
61
+ name: [
62
+ type.schemas.request?.name,
63
+ type.schemas.response.name,
64
+ type.schemas.pathParams?.name,
65
+ type.schemas.queryParams?.name,
66
+ type.schemas.headerParams?.name,
67
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
68
+ ].filter(Boolean),
69
+ root: client.file.path,
70
+ path: type.file.path,
71
+ isTypeOnly: true
72
+ }
73
+ ),
74
+ /* @__PURE__ */ jsxRuntime.jsx(
75
+ chunk7E2B7BQC_cjs.Url,
76
+ {
77
+ name: url.name,
78
+ baseURL: options.baseURL,
79
+ pathParamsType: options.pathParamsType,
80
+ paramsCasing: options.paramsCasing,
81
+ paramsType: options.paramsType,
82
+ typeSchemas: type.schemas,
83
+ operation
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsxRuntime.jsx(
87
+ chunk7E2B7BQC_cjs.Client,
88
+ {
89
+ name: client.name,
90
+ urlName: url.name,
91
+ baseURL: options.baseURL,
92
+ dataReturnType: options.dataReturnType,
93
+ pathParamsType: options.pathParamsType,
94
+ paramsCasing: options.paramsCasing,
95
+ paramsType: options.paramsType,
96
+ typeSchemas: type.schemas,
97
+ operation,
98
+ parser: options.parser,
99
+ zodSchemas: zod.schemas
100
+ }
101
+ )
102
+ ]
103
+ }
104
+ );
105
+ }
106
+ });
107
+ var operationsGenerator = pluginOas.createReactGenerator({
108
+ name: "client",
109
+ Operations({ operations }) {
110
+ const {
111
+ pluginManager,
112
+ plugin: {
113
+ key: pluginKey,
114
+ options: { output }
115
+ }
116
+ } = react.useApp();
117
+ const oas = hooks.useOas();
118
+ const name = "operations";
119
+ const file = pluginManager.getFile({ name, extname: ".ts", pluginKey });
120
+ return /* @__PURE__ */ jsxRuntime.jsx(react.File, { baseName: file.baseName, path: file.path, meta: file.meta, banner: utils.getBanner({ oas, output }), footer: utils.getFooter({ oas, output }), children: /* @__PURE__ */ jsxRuntime.jsx(chunk7E2B7BQC_cjs.Operations, { name, operations }) });
121
+ }
122
+ });
123
+ var groupedClientGenerator = pluginOas.createReactGenerator({
124
+ name: "groupedClient",
125
+ Operations({ operations }) {
126
+ const {
127
+ pluginManager,
128
+ plugin: { options, key: pluginKey }
129
+ } = react.useApp();
130
+ const oas = hooks.useOas();
131
+ const { getName, getFile, getGroup } = hooks.useOperationManager();
132
+ const controllers = operations.reduce(
133
+ (acc, operation) => {
134
+ if (options.group?.type === "tag") {
135
+ const group = getGroup(operation);
136
+ const name = group?.tag ? options.group?.name?.({ group: transformers.camelCase(group.tag) }) : void 0;
137
+ if (!group?.tag || !name) {
138
+ return acc;
139
+ }
140
+ const file = pluginManager.getFile({
141
+ name,
142
+ extname: ".ts",
143
+ pluginKey,
144
+ options: { group }
145
+ });
146
+ const client = {
147
+ name: getName(operation, { type: "function" }),
148
+ file: getFile(operation)
149
+ };
150
+ const previousFile = acc.find((item) => item.file.path === file.path);
151
+ if (previousFile) {
152
+ previousFile.clients.push(client);
153
+ } else {
154
+ acc.push({ name, file, clients: [client] });
155
+ }
156
+ }
157
+ return acc;
158
+ },
159
+ []
160
+ );
161
+ return controllers.map(({ name, file, clients }) => {
162
+ return /* @__PURE__ */ jsxRuntime.jsxs(
163
+ react.File,
164
+ {
165
+ baseName: file.baseName,
166
+ path: file.path,
167
+ meta: file.meta,
168
+ banner: utils.getBanner({ oas, output: options.output }),
169
+ footer: utils.getFooter({ oas, output: options.output }),
170
+ children: [
171
+ clients.map((client) => /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: file.path, path: client.file.path }, client.name)),
172
+ /* @__PURE__ */ jsxRuntime.jsx(react.File.Source, { name, isExportable: true, isIndexable: true, children: /* @__PURE__ */ jsxRuntime.jsx(react.Function, { export: true, name, children: `return { ${clients.map((client) => client.name).join(", ")} }` }) })
173
+ ]
174
+ },
175
+ file.path
176
+ );
177
+ });
178
+ }
179
+ });
12
180
 
181
+ // ../plugin-client/src/plugin.ts
182
+ var pluginClientName = "plugin-client";
183
+ core.createPlugin((options) => {
184
+ const {
185
+ output = { path: "clients", barrelType: "named" },
186
+ group,
187
+ exclude = [],
188
+ include,
189
+ override = [],
190
+ transformers: transformers$1 = {},
191
+ dataReturnType = "data",
192
+ pathParamsType = "inline",
193
+ paramsType = "inline",
194
+ operations = false,
195
+ baseURL,
196
+ paramsCasing,
197
+ generators = [clientGenerator, group ? groupedClientGenerator : void 0, operations ? operationsGenerator : void 0].filter(Boolean),
198
+ parser = "client",
199
+ client = "axios",
200
+ importPath = client === "fetch" ? "@kubb/plugin-client/clients/fetch" : "@kubb/plugin-client/clients/axios"
201
+ } = options;
202
+ return {
203
+ name: pluginClientName,
204
+ options: {
205
+ output,
206
+ group,
207
+ parser,
208
+ dataReturnType,
209
+ importPath,
210
+ paramsType,
211
+ paramsCasing,
212
+ pathParamsType: paramsType === "object" ? "object" : pathParamsType,
213
+ baseURL
214
+ },
215
+ pre: [pluginOas.pluginOasName, parser === "zod" ? pluginZod.pluginZodName : void 0].filter(Boolean),
216
+ resolvePath(baseName, pathMode, options2) {
217
+ const root = path__default.default.resolve(this.config.root, this.config.output.path);
218
+ const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path));
219
+ if (mode === "single") {
220
+ return path__default.default.resolve(root, output.path);
221
+ }
222
+ if (group && (options2?.group?.path || options2?.group?.tag)) {
223
+ const groupName = group?.name ? group.name : (ctx) => {
224
+ if (group?.type === "path") {
225
+ return `${ctx.group.split("/")[1]}`;
226
+ }
227
+ return `${transformers.camelCase(ctx.group)}Controller`;
228
+ };
229
+ return path__default.default.resolve(
230
+ root,
231
+ output.path,
232
+ groupName({
233
+ group: group.type === "path" ? options2.group.path : options2.group.tag
234
+ }),
235
+ baseName
236
+ );
237
+ }
238
+ return path__default.default.resolve(root, output.path, baseName);
239
+ },
240
+ resolveName(name, type) {
241
+ const resolvedName = transformers.camelCase(name, { isFile: type === "file" });
242
+ if (type) {
243
+ return transformers$1?.name?.(resolvedName, type) || resolvedName;
244
+ }
245
+ return resolvedName;
246
+ },
247
+ async buildStart() {
248
+ const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]);
249
+ const oas = await swaggerPlugin.context.getOas();
250
+ const root = path__default.default.resolve(this.config.root, this.config.output.path);
251
+ const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
252
+ const baseURL2 = await swaggerPlugin.context.getBaseURL();
253
+ const operationGenerator = new pluginOas.OperationGenerator(
254
+ baseURL2 ? {
255
+ ...this.plugin.options,
256
+ baseURL: baseURL2
257
+ } : this.plugin.options,
258
+ {
259
+ oas,
260
+ pluginManager: this.pluginManager,
261
+ plugin: this.plugin,
262
+ contentType: swaggerPlugin.context.contentType,
263
+ exclude,
264
+ include,
265
+ override,
266
+ mode
267
+ }
268
+ );
269
+ const files = await operationGenerator.build(...generators);
270
+ await this.addFile(...files);
271
+ const barrelFiles = await this.fileManager.getBarrelFiles({
272
+ type: output.barrelType ?? "named",
273
+ root,
274
+ output,
275
+ files: this.fileManager.files,
276
+ meta: {
277
+ pluginKey: this.plugin.key
278
+ },
279
+ logger: this.logger
280
+ });
281
+ await this.addFile(...barrelFiles);
282
+ }
283
+ };
284
+ });
13
285
  var queryGenerator = pluginOas.createReactGenerator({
14
286
  name: "react-query",
15
287
  Operation({ options, operation }) {
16
288
  const {
17
289
  plugin: {
18
290
  options: { output }
19
- }
291
+ },
292
+ pluginManager
20
293
  } = react.useApp();
21
294
  const oas = hooks.useOas();
22
295
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
@@ -30,8 +303,15 @@ var queryGenerator = pluginOas.createReactGenerator({
30
303
  typeName: getName(operation, { type: "type" }),
31
304
  file: getFile(operation, { prefix: "use" })
32
305
  };
306
+ const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
33
307
  const client = {
34
- name: getName(operation, { type: "function" })
308
+ name: hasClientPlugin ? getName(operation, {
309
+ type: "function",
310
+ pluginKey: [pluginClientName]
311
+ }) : getName(operation, {
312
+ type: "function"
313
+ }),
314
+ file: getFile(operation, { pluginKey: [pluginClientName] })
35
315
  };
36
316
  const queryOptions = {
37
317
  name: getName(operation, { type: "function", suffix: "QueryOptions" })
@@ -63,7 +343,8 @@ var queryGenerator = pluginOas.createReactGenerator({
63
343
  footer: utils.getFooter({ oas, output }),
64
344
  children: [
65
345
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
66
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
346
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
347
+ hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: query.file.path, path: client.file.path }),
67
348
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
68
349
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
69
350
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -83,7 +364,7 @@ var queryGenerator = pluginOas.createReactGenerator({
83
364
  }
84
365
  ),
85
366
  /* @__PURE__ */ jsxRuntime.jsx(
86
- chunkZHLF4MXY_cjs.QueryKey,
367
+ chunk7E2B7BQC_cjs.QueryKey,
87
368
  {
88
369
  name: queryKey.name,
89
370
  typeName: queryKey.typeName,
@@ -94,12 +375,10 @@ var queryGenerator = pluginOas.createReactGenerator({
94
375
  transformer: options.queryKey
95
376
  }
96
377
  ),
97
- /* @__PURE__ */ jsxRuntime.jsx(
98
- chunkZHLF4MXY_cjs.Client,
378
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(
379
+ chunk7E2B7BQC_cjs.Client,
99
380
  {
100
381
  name: client.name,
101
- isExportable: false,
102
- isIndexable: false,
103
382
  baseURL: options.client.baseURL,
104
383
  operation,
105
384
  typeSchemas: type.schemas,
@@ -113,7 +392,7 @@ var queryGenerator = pluginOas.createReactGenerator({
113
392
  ),
114
393
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
115
394
  /* @__PURE__ */ jsxRuntime.jsx(
116
- chunkZHLF4MXY_cjs.QueryOptions,
395
+ chunk7E2B7BQC_cjs.QueryOptions,
117
396
  {
118
397
  name: queryOptions.name,
119
398
  clientName: client.name,
@@ -129,7 +408,7 @@ var queryGenerator = pluginOas.createReactGenerator({
129
408
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useQuery"], path: importPath }),
130
409
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "QueryObserverOptions", "UseQueryResult"], path: importPath, isTypeOnly: true }),
131
410
  /* @__PURE__ */ jsxRuntime.jsx(
132
- chunkZHLF4MXY_cjs.Query,
411
+ chunk7E2B7BQC_cjs.Query,
133
412
  {
134
413
  name: query.name,
135
414
  queryOptionsName: queryOptions.name,
@@ -155,7 +434,8 @@ var mutationGenerator = pluginOas.createReactGenerator({
155
434
  const {
156
435
  plugin: {
157
436
  options: { output }
158
- }
437
+ },
438
+ pluginManager
159
439
  } = react.useApp();
160
440
  const oas = hooks.useOas();
161
441
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
@@ -176,8 +456,15 @@ var mutationGenerator = pluginOas.createReactGenerator({
176
456
  file: getFile(operation, { pluginKey: [pluginZod.pluginZodName] }),
177
457
  schemas: getSchemas(operation, { pluginKey: [pluginZod.pluginZodName], type: "function" })
178
458
  };
459
+ const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
179
460
  const client = {
180
- name: getName(operation, { type: "function" })
461
+ name: hasClientPlugin ? getName(operation, {
462
+ type: "function",
463
+ pluginKey: [pluginClientName]
464
+ }) : getName(operation, {
465
+ type: "function"
466
+ }),
467
+ file: getFile(operation, { pluginKey: [pluginClientName] })
181
468
  };
182
469
  const mutationKey = {
183
470
  name: getName(operation, { type: "const", suffix: "MutationKey" }),
@@ -196,7 +483,8 @@ var mutationGenerator = pluginOas.createReactGenerator({
196
483
  footer: utils.getFooter({ oas, output }),
197
484
  children: [
198
485
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: mutation.file.path, path: zod.file.path }),
199
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
486
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
487
+ !!hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: mutation.file.path, path: client.file.path }),
200
488
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
201
489
  /* @__PURE__ */ jsxRuntime.jsx(
202
490
  react.File.Import,
@@ -215,7 +503,7 @@ var mutationGenerator = pluginOas.createReactGenerator({
215
503
  }
216
504
  ),
217
505
  /* @__PURE__ */ jsxRuntime.jsx(
218
- chunkZHLF4MXY_cjs.MutationKey,
506
+ chunk7E2B7BQC_cjs.MutationKey,
219
507
  {
220
508
  name: mutationKey.name,
221
509
  typeName: mutationKey.typeName,
@@ -226,12 +514,10 @@ var mutationGenerator = pluginOas.createReactGenerator({
226
514
  transformer: options.mutationKey
227
515
  }
228
516
  ),
229
- /* @__PURE__ */ jsxRuntime.jsx(
230
- chunkZHLF4MXY_cjs.Client,
517
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(
518
+ chunk7E2B7BQC_cjs.Client,
231
519
  {
232
520
  name: client.name,
233
- isExportable: false,
234
- isIndexable: false,
235
521
  baseURL: options.client.baseURL,
236
522
  operation,
237
523
  typeSchemas: type.schemas,
@@ -247,7 +533,7 @@ var mutationGenerator = pluginOas.createReactGenerator({
247
533
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useMutation"], path: importPath }),
248
534
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["UseMutationOptions"], path: importPath, isTypeOnly: true }),
249
535
  /* @__PURE__ */ jsxRuntime.jsx(
250
- chunkZHLF4MXY_cjs.Mutation,
536
+ chunk7E2B7BQC_cjs.Mutation,
251
537
  {
252
538
  name: mutation.name,
253
539
  clientName: client.name,
@@ -273,7 +559,8 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
273
559
  const {
274
560
  plugin: {
275
561
  options: { output }
276
- }
562
+ },
563
+ pluginManager
277
564
  } = react.useApp();
278
565
  const oas = hooks.useOas();
279
566
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
@@ -288,8 +575,16 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
288
575
  typeName: getName(operation, { type: "type" }),
289
576
  file: getFile(operation, { prefix: "use", suffix: "infinite" })
290
577
  };
578
+ const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
291
579
  const client = {
292
- name: getName(operation, { type: "function" })
580
+ name: hasClientPlugin ? getName(operation, {
581
+ type: "function",
582
+ pluginKey: [pluginClientName]
583
+ }) : getName(operation, {
584
+ type: "function",
585
+ suffix: "infinite"
586
+ }),
587
+ file: getFile(operation, { pluginKey: [pluginClientName] })
293
588
  };
294
589
  const queryOptions = {
295
590
  name: getName(operation, { type: "function", suffix: "InfiniteQueryOptions" })
@@ -320,7 +615,8 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
320
615
  footer: utils.getFooter({ oas, output }),
321
616
  children: [
322
617
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
323
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
618
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
619
+ hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: query.file.path, path: client.file.path }),
324
620
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
325
621
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
326
622
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -340,7 +636,7 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
340
636
  }
341
637
  ),
342
638
  /* @__PURE__ */ jsxRuntime.jsx(
343
- chunkZHLF4MXY_cjs.QueryKey,
639
+ chunk7E2B7BQC_cjs.QueryKey,
344
640
  {
345
641
  name: queryKey.name,
346
642
  typeName: queryKey.typeName,
@@ -351,12 +647,10 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
351
647
  transformer: options.queryKey
352
648
  }
353
649
  ),
354
- /* @__PURE__ */ jsxRuntime.jsx(
355
- chunkZHLF4MXY_cjs.Client,
650
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(
651
+ chunk7E2B7BQC_cjs.Client,
356
652
  {
357
653
  name: client.name,
358
- isExportable: false,
359
- isIndexable: false,
360
654
  baseURL: options.client.baseURL,
361
655
  operation,
362
656
  typeSchemas: type.schemas,
@@ -372,7 +666,7 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
372
666
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["InfiniteData"], isTypeOnly: true, path: importPath }),
373
667
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["infiniteQueryOptions"], path: importPath }),
374
668
  /* @__PURE__ */ jsxRuntime.jsx(
375
- chunkZHLF4MXY_cjs.InfiniteQueryOptions,
669
+ chunk7E2B7BQC_cjs.InfiniteQueryOptions,
376
670
  {
377
671
  name: queryOptions.name,
378
672
  clientName: client.name,
@@ -392,7 +686,7 @@ var infiniteQueryGenerator = pluginOas.createReactGenerator({
392
686
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["useInfiniteQuery"], path: importPath }),
393
687
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "InfiniteQueryObserverOptions", "UseInfiniteQueryResult"], path: importPath, isTypeOnly: true }),
394
688
  /* @__PURE__ */ jsxRuntime.jsx(
395
- chunkZHLF4MXY_cjs.InfiniteQuery,
689
+ chunk7E2B7BQC_cjs.InfiniteQuery,
396
690
  {
397
691
  name: query.name,
398
692
  queryOptionsName: queryOptions.name,
@@ -418,7 +712,8 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
418
712
  const {
419
713
  plugin: {
420
714
  options: { output }
421
- }
715
+ },
716
+ pluginManager
422
717
  } = react.useApp();
423
718
  const oas = hooks.useOas();
424
719
  const { getSchemas, getName, getFile } = hooks.useOperationManager();
@@ -433,8 +728,16 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
433
728
  typeName: getName(operation, { type: "type" }),
434
729
  file: getFile(operation, { prefix: "use", suffix: "suspense" })
435
730
  };
731
+ const hasClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]);
436
732
  const client = {
437
- name: getName(operation, { type: "function" })
733
+ name: hasClientPlugin ? getName(operation, {
734
+ type: "function",
735
+ pluginKey: [pluginClientName]
736
+ }) : getName(operation, {
737
+ type: "function",
738
+ suffix: "suspense"
739
+ }),
740
+ file: getFile(operation, { pluginKey: [pluginClientName] })
438
741
  };
439
742
  const queryOptions = {
440
743
  name: getName(operation, { type: "function", suffix: "SuspenseQueryOptions" })
@@ -465,7 +768,8 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
465
768
  footer: utils.getFooter({ oas, output }),
466
769
  children: [
467
770
  options.parser === "zod" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [zod.schemas.response.name], root: query.file.path, path: zod.file.path }),
468
- /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
771
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: "client", path: options.client.importPath }),
772
+ hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: [client.name], root: query.file.path, path: client.file.path }),
469
773
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["RequestConfig", "ResponseErrorConfig"], path: options.client.importPath, isTypeOnly: true }),
470
774
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
471
775
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -485,7 +789,7 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
485
789
  }
486
790
  ),
487
791
  /* @__PURE__ */ jsxRuntime.jsx(
488
- chunkZHLF4MXY_cjs.QueryKey,
792
+ chunk7E2B7BQC_cjs.QueryKey,
489
793
  {
490
794
  name: queryKey.name,
491
795
  typeName: queryKey.typeName,
@@ -496,12 +800,10 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
496
800
  transformer: options.queryKey
497
801
  }
498
802
  ),
499
- /* @__PURE__ */ jsxRuntime.jsx(
500
- chunkZHLF4MXY_cjs.Client,
803
+ !hasClientPlugin && /* @__PURE__ */ jsxRuntime.jsx(
804
+ chunk7E2B7BQC_cjs.Client,
501
805
  {
502
806
  name: client.name,
503
- isExportable: false,
504
- isIndexable: false,
505
807
  baseURL: options.client.baseURL,
506
808
  operation,
507
809
  typeSchemas: type.schemas,
@@ -515,7 +817,7 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
515
817
  ),
516
818
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["queryOptions"], path: importPath }),
517
819
  /* @__PURE__ */ jsxRuntime.jsx(
518
- chunkZHLF4MXY_cjs.QueryOptions,
820
+ chunk7E2B7BQC_cjs.QueryOptions,
519
821
  {
520
822
  name: queryOptions.name,
521
823
  clientName: client.name,
@@ -532,7 +834,7 @@ var suspenseQueryGenerator = pluginOas.createReactGenerator({
532
834
  /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["QueryKey", "UseSuspenseQueryOptions", "UseSuspenseQueryResult"], path: importPath, isTypeOnly: true }),
533
835
  options.client.dataReturnType === "full" && /* @__PURE__ */ jsxRuntime.jsx(react.File.Import, { name: ["ResponseConfig"], path: options.client.importPath, isTypeOnly: true }),
534
836
  /* @__PURE__ */ jsxRuntime.jsx(
535
- chunkZHLF4MXY_cjs.SuspenseQuery,
837
+ chunk7E2B7BQC_cjs.SuspenseQuery,
536
838
  {
537
839
  name: query.name,
538
840
  queryOptionsName: queryOptions.name,
@@ -557,5 +859,5 @@ exports.infiniteQueryGenerator = infiniteQueryGenerator;
557
859
  exports.mutationGenerator = mutationGenerator;
558
860
  exports.queryGenerator = queryGenerator;
559
861
  exports.suspenseQueryGenerator = suspenseQueryGenerator;
560
- //# sourceMappingURL=chunk-QUDUSXV4.cjs.map
561
- //# sourceMappingURL=chunk-QUDUSXV4.cjs.map
862
+ //# sourceMappingURL=chunk-VKOQV7WK.cjs.map
863
+ //# sourceMappingURL=chunk-VKOQV7WK.cjs.map