@kubb/agent 5.0.0-alpha.34 → 5.0.0-alpha.36

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 (183) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/server/chunks/nitro/nitro.mjs +1790 -20812
  3. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  4. package/.output/server/chunks/routes/api/health.get.mjs +16 -14
  5. package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
  6. package/.output/server/index.mjs +16 -14
  7. package/.output/server/index.mjs.map +1 -1
  8. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
  9. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
  10. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
  11. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
  12. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
  13. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
  14. package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
  15. package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
  16. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/buffer-util.js +131 -0
  17. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/event-target.js +292 -0
  18. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/extension.js +203 -0
  19. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/limiter.js +55 -0
  20. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/receiver.js +706 -0
  21. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/subprotocol.js +62 -0
  22. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/validation.js +152 -0
  23. package/.output/server/node_modules/@clack/core/dist/index.mjs +11 -0
  24. package/.output/server/node_modules/@clack/core/package.json +60 -0
  25. package/.output/server/node_modules/@clack/prompts/dist/index.mjs +137 -0
  26. package/.output/server/node_modules/@clack/prompts/package.json +65 -0
  27. package/.output/server/node_modules/@kubb/ast/dist/chunk--u3MIqq1.js +8 -0
  28. package/.output/server/node_modules/@kubb/ast/dist/index.js +423 -0
  29. package/.output/server/node_modules/@kubb/ast/package.json +70 -0
  30. package/.output/server/node_modules/@kubb/core/dist/chunk--u3MIqq1.js +8 -0
  31. package/.output/server/node_modules/@kubb/core/dist/hooks.js +23 -0
  32. package/.output/server/node_modules/@kubb/core/dist/index.js +2311 -0
  33. package/.output/server/node_modules/@kubb/core/package.json +109 -0
  34. package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-O_arW02_.js +17 -0
  35. package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-iCpMSYCp.js +15 -0
  36. package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-NAm_Y-vp.js +55 -0
  37. package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +653 -0
  38. package/.output/server/node_modules/@kubb/fabric-core/dist/onProcessExit-Cput7j2c.js +742 -0
  39. package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +101 -0
  40. package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +17 -0
  41. package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +375 -0
  42. package/.output/server/node_modules/@kubb/fabric-core/package.json +111 -0
  43. package/.output/server/node_modules/@kubb/oas/dist/chunk--u3MIqq1.js +8 -0
  44. package/.output/server/node_modules/@kubb/oas/dist/index.js +918 -0
  45. package/.output/server/node_modules/@kubb/oas/package.json +94 -0
  46. package/.output/server/node_modules/@kubb/plugin-client/dist/StaticClassClient-bCe7RG_w.js +636 -0
  47. package/.output/server/node_modules/@kubb/plugin-client/dist/chunk--u3MIqq1.js +8 -0
  48. package/.output/server/node_modules/@kubb/plugin-client/dist/components.js +2 -0
  49. package/.output/server/node_modules/@kubb/plugin-client/dist/generators-BffddRNu.js +723 -0
  50. package/.output/server/node_modules/@kubb/plugin-client/dist/index.js +124 -0
  51. package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/axios.source.js +6 -0
  52. package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/fetch.source.js +6 -0
  53. package/.output/server/node_modules/@kubb/plugin-client/dist/templates/config.source.js +6 -0
  54. package/.output/server/node_modules/@kubb/plugin-client/package.json +153 -0
  55. package/.output/server/node_modules/@kubb/plugin-cypress/dist/chunk--u3MIqq1.js +8 -0
  56. package/.output/server/node_modules/@kubb/plugin-cypress/dist/components-BK_6GU4v.js +257 -0
  57. package/.output/server/node_modules/@kubb/plugin-cypress/dist/generators-D5YFtyyC.js +71 -0
  58. package/.output/server/node_modules/@kubb/plugin-cypress/dist/index.js +79 -0
  59. package/.output/server/node_modules/@kubb/plugin-cypress/package.json +108 -0
  60. package/.output/server/node_modules/@kubb/plugin-faker/dist/chunk--u3MIqq1.js +8 -0
  61. package/.output/server/node_modules/@kubb/plugin-faker/dist/components-BkBIov4R.js +419 -0
  62. package/.output/server/node_modules/@kubb/plugin-faker/dist/fakerGenerator-BztogaeO.js +200 -0
  63. package/.output/server/node_modules/@kubb/plugin-faker/dist/index.js +141 -0
  64. package/.output/server/node_modules/@kubb/plugin-faker/package.json +103 -0
  65. package/.output/server/node_modules/@kubb/plugin-mcp/dist/Server-H3SwqhwF.js +178 -0
  66. package/.output/server/node_modules/@kubb/plugin-mcp/dist/chunk--u3MIqq1.js +8 -0
  67. package/.output/server/node_modules/@kubb/plugin-mcp/dist/generators-BqkMrcs9.js +274 -0
  68. package/.output/server/node_modules/@kubb/plugin-mcp/dist/index.js +122 -0
  69. package/.output/server/node_modules/@kubb/plugin-mcp/package.json +107 -0
  70. package/.output/server/node_modules/@kubb/plugin-msw/dist/chunk--u3MIqq1.js +8 -0
  71. package/.output/server/node_modules/@kubb/plugin-msw/dist/components-DgtTZkWX.js +277 -0
  72. package/.output/server/node_modules/@kubb/plugin-msw/dist/generators-C34kqa1L.js +161 -0
  73. package/.output/server/node_modules/@kubb/plugin-msw/dist/index.js +84 -0
  74. package/.output/server/node_modules/@kubb/plugin-msw/package.json +109 -0
  75. package/.output/server/node_modules/@kubb/plugin-oas/dist/SchemaMapper-CqMkO2T1.js +58 -0
  76. package/.output/server/node_modules/@kubb/plugin-oas/dist/chunk--u3MIqq1.js +8 -0
  77. package/.output/server/node_modules/@kubb/plugin-oas/dist/generators-D7C3CXsN.js +79 -0
  78. package/.output/server/node_modules/@kubb/plugin-oas/dist/generators.js +2 -0
  79. package/.output/server/node_modules/@kubb/plugin-oas/dist/getFooter-Pw3tLCiV.js +112 -0
  80. package/.output/server/node_modules/@kubb/plugin-oas/dist/hooks.js +200 -0
  81. package/.output/server/node_modules/@kubb/plugin-oas/dist/index.js +408 -0
  82. package/.output/server/node_modules/@kubb/plugin-oas/dist/requestBody-pRavthCw.js +1336 -0
  83. package/.output/server/node_modules/@kubb/plugin-oas/dist/utils.js +268 -0
  84. package/.output/server/node_modules/@kubb/plugin-oas/package.json +122 -0
  85. package/.output/server/node_modules/@kubb/plugin-react-query/dist/chunk--u3MIqq1.js +8 -0
  86. package/.output/server/node_modules/@kubb/plugin-react-query/dist/components-CpyHYGOw.js +1520 -0
  87. package/.output/server/node_modules/@kubb/plugin-react-query/dist/generators-CpiBv5eE.js +1427 -0
  88. package/.output/server/node_modules/@kubb/plugin-react-query/dist/index.js +166 -0
  89. package/.output/server/node_modules/@kubb/plugin-react-query/package.json +112 -0
  90. package/.output/server/node_modules/@kubb/plugin-redoc/dist/chunk--u3MIqq1.js +8 -0
  91. package/.output/server/node_modules/@kubb/plugin-redoc/dist/index.js +65 -0
  92. package/.output/server/node_modules/@kubb/plugin-redoc/package.json +85 -0
  93. package/.output/server/node_modules/@kubb/plugin-redoc/static/redoc.hbs +22 -0
  94. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/chunk--u3MIqq1.js +8 -0
  95. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/components-BhStIi1M.js +665 -0
  96. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/generators-CQClzsST.js +415 -0
  97. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/index.js +145 -0
  98. package/.output/server/node_modules/@kubb/plugin-solid-query/package.json +113 -0
  99. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/chunk--u3MIqq1.js +8 -0
  100. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/components-DntKBsnB.js +666 -0
  101. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/generators-BtTsGGrM.js +414 -0
  102. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/index.js +145 -0
  103. package/.output/server/node_modules/@kubb/plugin-svelte-query/package.json +113 -0
  104. package/.output/server/node_modules/@kubb/plugin-swr/dist/chunk--u3MIqq1.js +8 -0
  105. package/.output/server/node_modules/@kubb/plugin-swr/dist/components-DRDGvgXG.js +702 -0
  106. package/.output/server/node_modules/@kubb/plugin-swr/dist/generators-ClWZJ-YG.js +399 -0
  107. package/.output/server/node_modules/@kubb/plugin-swr/dist/index.js +144 -0
  108. package/.output/server/node_modules/@kubb/plugin-swr/package.json +115 -0
  109. package/.output/server/node_modules/@kubb/plugin-ts/dist/chunk--u3MIqq1.js +8 -0
  110. package/.output/server/node_modules/@kubb/plugin-ts/dist/components-C7fu-sK1.js +723 -0
  111. package/.output/server/node_modules/@kubb/plugin-ts/dist/index.js +2 -0
  112. package/.output/server/node_modules/@kubb/plugin-ts/dist/plugin-CYC-FGXe.js +479 -0
  113. package/.output/server/node_modules/@kubb/plugin-ts/package.json +105 -0
  114. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/chunk--u3MIqq1.js +8 -0
  115. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/components-_AMBl0g-.js +1029 -0
  116. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/generators-Zb1s5Wmb.js +661 -0
  117. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/index.js +157 -0
  118. package/.output/server/node_modules/@kubb/plugin-vue-query/package.json +114 -0
  119. package/.output/server/node_modules/@kubb/plugin-zod/dist/chunk--u3MIqq1.js +8 -0
  120. package/.output/server/node_modules/@kubb/plugin-zod/dist/components-eECfXVou.js +842 -0
  121. package/.output/server/node_modules/@kubb/plugin-zod/dist/generators-D1R6NNf2.js +290 -0
  122. package/.output/server/node_modules/@kubb/plugin-zod/dist/index.js +175 -0
  123. package/.output/server/node_modules/@kubb/plugin-zod/dist/templates/ToZod.source.js +6 -0
  124. package/.output/server/node_modules/@kubb/plugin-zod/package.json +112 -0
  125. package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-BGCRLu6H.js +38 -0
  126. package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +525 -0
  127. package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-Bl0DfUmV.js +1448 -0
  128. package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +12 -0
  129. package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +2 -0
  130. package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +4 -0
  131. package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-QQPrjNuQ.js +17813 -0
  132. package/.output/server/node_modules/@kubb/react-fabric/package.json +143 -0
  133. package/.output/server/node_modules/@redocly/config/lib/root-config-schema.js +11 -1
  134. package/.output/server/node_modules/@redocly/config/package.json +1 -1
  135. package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-document.js +25 -10
  136. package/.output/server/node_modules/@redocly/openapi-core/lib/bundle/bundle-visitor.js +32 -29
  137. package/.output/server/node_modules/@redocly/openapi-core/lib/config/config.js +5 -0
  138. package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/index.js +1 -1
  139. package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas2/remove-unused-components.js +47 -38
  140. package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/index.js +1 -1
  141. package/.output/server/node_modules/@redocly/openapi-core/lib/decorators/oas3/remove-unused-components.js +45 -41
  142. package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-http-verbs-in-paths.js +3 -1
  143. package/.output/server/node_modules/@redocly/openapi-core/lib/rules/common/no-required-schema-properties-undefined.js +41 -55
  144. package/.output/server/node_modules/@redocly/openapi-core/lib/walk.js +28 -16
  145. package/.output/server/node_modules/@redocly/openapi-core/package.json +2 -2
  146. package/.output/server/node_modules/buffer-from/index.js +72 -0
  147. package/.output/server/node_modules/buffer-from/package.json +19 -0
  148. package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
  149. package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
  150. package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
  151. package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
  152. package/.output/server/node_modules/fast-string-width/package.json +34 -0
  153. package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
  154. package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
  155. package/.output/server/node_modules/p-limit/index.js +127 -0
  156. package/.output/server/node_modules/p-limit/package.json +58 -0
  157. package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
  158. package/.output/server/node_modules/react-devtools-core/package.json +38 -0
  159. package/.output/server/node_modules/sisteransi/package.json +34 -0
  160. package/.output/server/node_modules/sisteransi/src/index.js +58 -0
  161. package/.output/server/node_modules/source-map-support/package.json +31 -0
  162. package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
  163. package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
  164. package/.output/server/node_modules/typescript/package.json +120 -0
  165. package/.output/server/node_modules/yocto-queue/index.js +90 -0
  166. package/.output/server/node_modules/yocto-queue/package.json +48 -0
  167. package/.output/server/package.json +35 -4
  168. package/package.json +20 -20
  169. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
  170. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
  171. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
  172. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
  173. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
  174. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
  175. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
  176. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
  177. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
  178. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
  179. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
  180. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
  181. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
  182. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
  183. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
@@ -0,0 +1,1427 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as Mutation, c as InfiniteQuery, d as MutationKey, i as Query, l as QueryOptions, n as SuspenseInfiniteQueryOptions, o as MutationOptions, r as SuspenseInfiniteQuery, s as InfiniteQueryOptions, t as SuspenseQuery, u as QueryKey } from "./components-CpyHYGOw.js";
3
+ import path from "node:path";
4
+ import fs from "node:fs";
5
+ import { pluginClientName } from "@kubb/plugin-client";
6
+ import { pluginTsName } from "@kubb/plugin-ts";
7
+ import { pluginZodName } from "@kubb/plugin-zod";
8
+ import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
9
+ import { File, Function, Type } from "@kubb/react-fabric";
10
+ import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
11
+ import { Client } from "@kubb/plugin-client/components";
12
+ import { usePluginManager } from "@kubb/core/hooks";
13
+ import { createReactGenerator } from "@kubb/plugin-oas/generators";
14
+ import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
15
+ import { difference } from "remeda";
16
+ //#region src/generators/customHookOptionsFileGenerator.tsx
17
+ const customHookOptionsFileGenerator = createReactGenerator({
18
+ name: "react-query-custom-hook-options-file",
19
+ Operations({ operations, generator, plugin, config }) {
20
+ const { options, options: { output }, key: pluginKey } = plugin;
21
+ const pluginManager = usePluginManager();
22
+ const { getFile } = useOperationManager(generator);
23
+ if (!options.customOptions) return null;
24
+ const override = output.override ?? config.output.override ?? false;
25
+ const { importPath, name } = options.customOptions;
26
+ const root = path.resolve(config.root, config.output.path);
27
+ const reactQueryImportPath = options.query ? options.query.importPath : "@tanstack/react-query";
28
+ const getHookFilePath = (operations) => {
29
+ const firstOperation = operations[0];
30
+ if (firstOperation != null) return getFile(firstOperation, { prefix: "use" }).path;
31
+ return pluginManager.getFile({
32
+ name: "index",
33
+ extname: ".ts",
34
+ pluginKey
35
+ }).path;
36
+ };
37
+ const ensureExtension = (filePath, extname) => {
38
+ if (path.extname(filePath) === "") return filePath + extname;
39
+ return filePath;
40
+ };
41
+ const getExternalFile = (filePath, rootPath) => {
42
+ const actualFilePath = ensureExtension(filePath, ".ts");
43
+ return {
44
+ baseName: path.basename(actualFilePath),
45
+ name: path.basename(actualFilePath, path.extname(actualFilePath)),
46
+ path: path.resolve(rootPath, actualFilePath)
47
+ };
48
+ };
49
+ const file = getExternalFile(importPath, path.dirname(getHookFilePath(operations)));
50
+ if (fs.existsSync(file.path) && !override) return null;
51
+ return /* @__PURE__ */ jsxs(File, {
52
+ baseName: file.baseName,
53
+ path: file.path,
54
+ children: [
55
+ /* @__PURE__ */ jsx(File.Import, {
56
+ name: ["QueryClient"],
57
+ path: reactQueryImportPath,
58
+ isTypeOnly: true
59
+ }),
60
+ /* @__PURE__ */ jsx(File.Import, {
61
+ name: ["useQueryClient"],
62
+ path: reactQueryImportPath
63
+ }),
64
+ /* @__PURE__ */ jsx(File.Import, {
65
+ name: ["HookOptions"],
66
+ root: file.path,
67
+ path: path.resolve(root, "./index.ts")
68
+ }),
69
+ /* @__PURE__ */ jsxs(File.Source, {
70
+ name: file.name,
71
+ isExportable: true,
72
+ isIndexable: true,
73
+ children: [/* @__PURE__ */ jsx(Function, {
74
+ name: "getCustomHookOptions",
75
+ params: "{ queryClient }: { queryClient: QueryClient }",
76
+ returnType: "Partial<HookOptions>",
77
+ children: `return {
78
+ // TODO: Define custom hook options here
79
+ // Example:
80
+ // useUpdatePetHook: {
81
+ // onSuccess: () => {
82
+ // void queryClient.invalidateQueries({ queryKey: ['pet'] })
83
+ // }
84
+ // }
85
+ }`
86
+ }), /* @__PURE__ */ jsx(Function, {
87
+ name,
88
+ generics: "T extends keyof HookOptions",
89
+ params: "{ hookName, operationId }: { hookName: T, operationId: string }",
90
+ returnType: "HookOptions[T]",
91
+ export: true,
92
+ children: `const queryClient = useQueryClient()
93
+ const customOptions = getCustomHookOptions({ queryClient })
94
+ return customOptions[hookName] ?? {}`
95
+ })]
96
+ })
97
+ ]
98
+ });
99
+ }
100
+ });
101
+ //#endregion
102
+ //#region src/generators/hookOptionsGenerator.tsx
103
+ const hookOptionsGenerator = createReactGenerator({
104
+ name: "react-query-hook-options",
105
+ Operations({ operations, plugin, generator }) {
106
+ const { options, options: { output }, key: pluginKey } = plugin;
107
+ const pluginManager = usePluginManager();
108
+ const oas = useOas();
109
+ const { getName, getFile } = useOperationManager(generator);
110
+ if (!options.customOptions) return null;
111
+ const name = "HookOptions";
112
+ const file = pluginManager.getFile({
113
+ name,
114
+ extname: ".ts",
115
+ pluginKey
116
+ });
117
+ const getOperationOptions = (operation) => {
118
+ const operationOptions = generator.getOptions(operation, operation.method);
119
+ return {
120
+ ...options,
121
+ ...operationOptions
122
+ };
123
+ };
124
+ const isQuery = (operation) => {
125
+ const operationOptions = getOperationOptions(operation);
126
+ return typeof operationOptions.query === "boolean" ? true : operationOptions.query?.methods.some((method) => operation.method === method);
127
+ };
128
+ const isMutation = (operation) => {
129
+ const operationOptions = getOperationOptions(operation);
130
+ return operationOptions.mutation !== false && !isQuery(operation) && difference(operationOptions.mutation ? operationOptions.mutation.methods : [], operationOptions.query ? operationOptions.query.methods : []).some((method) => operation.method === method);
131
+ };
132
+ const isSuspense = (operation) => {
133
+ return !!getOperationOptions(operation).suspense;
134
+ };
135
+ const isInfinite = (operation) => {
136
+ const operationOptions = getOperationOptions(operation);
137
+ return !!(operationOptions.infinite && typeof operationOptions.infinite === "object" ? operationOptions.infinite : void 0);
138
+ };
139
+ const getHookName = (operation) => {
140
+ return getName(operation, {
141
+ type: "function",
142
+ prefix: "use"
143
+ });
144
+ };
145
+ const getHookFile = (operation) => {
146
+ return getFile(operation, { prefix: "use" });
147
+ };
148
+ const getQueryHookOptions = (operation) => {
149
+ return getName(operation, {
150
+ type: "function",
151
+ suffix: "QueryOptions"
152
+ });
153
+ };
154
+ const getQueryHookOptionsImport = (operation) => {
155
+ return /* @__PURE__ */ jsx(File.Import, {
156
+ name: [getQueryHookOptions(operation)],
157
+ root: file.path,
158
+ path: getHookFile(operation).path
159
+ });
160
+ };
161
+ const getMutationHookOptions = (operation) => {
162
+ return getName(operation, {
163
+ type: "function",
164
+ suffix: "MutationOptions"
165
+ });
166
+ };
167
+ const getMutationHookOptionsImport = (operation) => {
168
+ return /* @__PURE__ */ jsx(File.Import, {
169
+ name: [getMutationHookOptions(operation)],
170
+ root: file.path,
171
+ path: getHookFile(operation).path
172
+ });
173
+ };
174
+ const getSuspenseHookName = (operation) => {
175
+ return getName(operation, {
176
+ type: "function",
177
+ prefix: "use",
178
+ suffix: "suspense"
179
+ });
180
+ };
181
+ const getSuspenseHookFile = (operation) => {
182
+ return getFile(operation, {
183
+ prefix: "use",
184
+ suffix: "suspense"
185
+ });
186
+ };
187
+ const getSuspenseHookOptions = (operation) => {
188
+ return getName(operation, {
189
+ type: "function",
190
+ suffix: "SuspenseQueryOptions"
191
+ });
192
+ };
193
+ const getSuspenseHookOptionsImport = (operation) => {
194
+ return /* @__PURE__ */ jsx(File.Import, {
195
+ name: [getSuspenseHookOptions(operation)],
196
+ root: file.path,
197
+ path: getSuspenseHookFile(operation).path
198
+ });
199
+ };
200
+ const getInfiniteHookName = (operation) => {
201
+ return getName(operation, {
202
+ type: "function",
203
+ prefix: "use",
204
+ suffix: "infinite"
205
+ });
206
+ };
207
+ const getInfiniteHookFile = (operation) => {
208
+ return getFile(operation, {
209
+ prefix: "use",
210
+ suffix: "infinite"
211
+ });
212
+ };
213
+ const getInfiniteHookOptions = (operation) => {
214
+ return getName(operation, {
215
+ type: "function",
216
+ suffix: "InfiniteQueryOptions"
217
+ });
218
+ };
219
+ const getInfiniteHookOptionsImport = (operation) => {
220
+ return /* @__PURE__ */ jsx(File.Import, {
221
+ name: [getInfiniteHookOptions(operation)],
222
+ root: file.path,
223
+ path: getInfiniteHookFile(operation).path
224
+ });
225
+ };
226
+ const getSuspenseInfiniteHookName = (operation) => {
227
+ return getName(operation, {
228
+ type: "function",
229
+ prefix: "use",
230
+ suffix: "suspenseInfinite"
231
+ });
232
+ };
233
+ const getSuspenseInfiniteHookFile = (operation) => {
234
+ return getFile(operation, {
235
+ prefix: "use",
236
+ suffix: "suspenseInfinite"
237
+ });
238
+ };
239
+ const getSuspenseInfiniteHookOptions = (operation) => {
240
+ return getName(operation, {
241
+ type: "function",
242
+ suffix: "SuspenseInfiniteQueryOptions"
243
+ });
244
+ };
245
+ const getSuspenseInfiniteHookOptionsImport = (operation) => {
246
+ return /* @__PURE__ */ jsx(File.Import, {
247
+ name: [getSuspenseInfiniteHookOptions(operation)],
248
+ root: file.path,
249
+ path: getSuspenseInfiniteHookFile(operation).path
250
+ });
251
+ };
252
+ const imports = operations.flatMap((operation) => {
253
+ if (isQuery(operation)) return [
254
+ getQueryHookOptionsImport(operation),
255
+ isSuspense(operation) ? getSuspenseHookOptionsImport(operation) : void 0,
256
+ isInfinite(operation) ? getInfiniteHookOptionsImport(operation) : void 0,
257
+ isSuspense(operation) && isInfinite(operation) ? getSuspenseInfiniteHookOptionsImport(operation) : void 0
258
+ ].filter(Boolean);
259
+ if (isMutation(operation)) return [getMutationHookOptionsImport(operation)];
260
+ return [];
261
+ }).filter(Boolean);
262
+ const hookOptions = operations.reduce((acc, operation) => {
263
+ if (isQuery(operation)) {
264
+ acc[getHookName(operation)] = `Partial<ReturnType<typeof ${getQueryHookOptions(operation)}>>`;
265
+ if (isSuspense(operation)) acc[getSuspenseHookName(operation)] = `Partial<ReturnType<typeof ${getSuspenseHookOptions(operation)}>>`;
266
+ if (isInfinite(operation)) acc[getInfiniteHookName(operation)] = `Partial<ReturnType<typeof ${getInfiniteHookOptions(operation)}>>`;
267
+ if (isSuspense(operation) && isInfinite(operation)) acc[getSuspenseInfiniteHookName(operation)] = `Partial<ReturnType<typeof ${getSuspenseInfiniteHookOptions(operation)}>>`;
268
+ }
269
+ if (isMutation(operation)) acc[getHookName(operation)] = `Partial<ReturnType<typeof ${getMutationHookOptions(operation)}>>`;
270
+ return acc;
271
+ }, {});
272
+ return /* @__PURE__ */ jsxs(File, {
273
+ baseName: file.baseName,
274
+ path: file.path,
275
+ meta: file.meta,
276
+ banner: getBanner({
277
+ oas,
278
+ output,
279
+ config: pluginManager.config
280
+ }),
281
+ footer: getFooter({
282
+ oas,
283
+ output
284
+ }),
285
+ children: [imports, /* @__PURE__ */ jsx(File.Source, {
286
+ name,
287
+ isExportable: true,
288
+ isIndexable: true,
289
+ isTypeOnly: true,
290
+ children: /* @__PURE__ */ jsx(Type, {
291
+ export: true,
292
+ name,
293
+ children: `{ ${Object.keys(hookOptions).map((key) => `${JSON.stringify(key)}: ${hookOptions[key]}`)} }`
294
+ })
295
+ })]
296
+ });
297
+ }
298
+ });
299
+ //#endregion
300
+ //#region src/generators/infiniteQueryGenerator.tsx
301
+ const infiniteQueryGenerator = createReactGenerator({
302
+ name: "react-infinite-query",
303
+ Operation({ config, operation, generator, plugin }) {
304
+ const { options, options: { output } } = plugin;
305
+ const pluginManager = usePluginManager();
306
+ const oas = useOas();
307
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
308
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
309
+ const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
310
+ const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
311
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
312
+ const query = {
313
+ name: getName(operation, {
314
+ type: "function",
315
+ prefix: "use",
316
+ suffix: "infinite"
317
+ }),
318
+ typeName: getName(operation, { type: "type" }),
319
+ file: getFile(operation, {
320
+ prefix: "use",
321
+ suffix: "infinite"
322
+ })
323
+ };
324
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
325
+ const client = {
326
+ name: shouldUseClientPlugin ? getName(operation, {
327
+ type: "function",
328
+ pluginKey: [pluginClientName]
329
+ }) : getName(operation, {
330
+ type: "function",
331
+ suffix: "infinite"
332
+ }),
333
+ file: getFile(operation, { pluginKey: [pluginClientName] })
334
+ };
335
+ const queryOptions = { name: getName(operation, {
336
+ type: "function",
337
+ suffix: "InfiniteQueryOptions"
338
+ }) };
339
+ const queryKey = {
340
+ name: getName(operation, {
341
+ type: "const",
342
+ suffix: "InfiniteQueryKey"
343
+ }),
344
+ typeName: getName(operation, {
345
+ type: "type",
346
+ suffix: "InfiniteQueryKey"
347
+ })
348
+ };
349
+ const type = {
350
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
351
+ schemas: getSchemas(operation, {
352
+ pluginKey: [pluginTsName],
353
+ type: "type"
354
+ })
355
+ };
356
+ const zod = {
357
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
358
+ schemas: getSchemas(operation, {
359
+ pluginKey: [pluginZodName],
360
+ type: "function"
361
+ })
362
+ };
363
+ if (!isQuery || isMutation || !infiniteOptions) return null;
364
+ const normalizeKey = (key) => (key ?? "").replace(/\?$/, "");
365
+ const queryParam = infiniteOptions.queryParam;
366
+ const cursorParam = infiniteOptions.cursorParam;
367
+ const queryParamKeys = type.schemas.queryParams?.keys ?? [];
368
+ const responseKeys = [...type.schemas.responses?.flatMap((item) => item.keys ?? []) ?? [], ...type.schemas.response?.keys ?? []];
369
+ const hasQueryParam = queryParam ? queryParamKeys.some((key) => normalizeKey(key) === queryParam) : false;
370
+ const hasCursorParam = cursorParam ? responseKeys.some((key) => normalizeKey(key) === cursorParam) : true;
371
+ if (!hasQueryParam || !hasCursorParam) return null;
372
+ return /* @__PURE__ */ jsxs(File, {
373
+ baseName: query.file.baseName,
374
+ path: query.file.path,
375
+ meta: query.file.meta,
376
+ banner: getBanner({
377
+ oas,
378
+ output,
379
+ config: pluginManager.config
380
+ }),
381
+ footer: getFooter({
382
+ oas,
383
+ output
384
+ }),
385
+ children: [
386
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
387
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
388
+ root: query.file.path,
389
+ path: zod.file.path
390
+ }),
391
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
392
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
393
+ name: "fetch",
394
+ path: options.client.importPath
395
+ }),
396
+ /* @__PURE__ */ jsx(File.Import, {
397
+ name: [
398
+ "Client",
399
+ "RequestConfig",
400
+ "ResponseErrorConfig"
401
+ ],
402
+ path: options.client.importPath,
403
+ isTypeOnly: true
404
+ }),
405
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
406
+ name: ["ResponseConfig"],
407
+ path: options.client.importPath,
408
+ isTypeOnly: true
409
+ })
410
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
411
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
412
+ name: ["fetch"],
413
+ root: query.file.path,
414
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
415
+ }),
416
+ /* @__PURE__ */ jsx(File.Import, {
417
+ name: [
418
+ "Client",
419
+ "RequestConfig",
420
+ "ResponseErrorConfig"
421
+ ],
422
+ root: query.file.path,
423
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
424
+ isTypeOnly: true
425
+ }),
426
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
427
+ name: ["ResponseConfig"],
428
+ root: query.file.path,
429
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
430
+ isTypeOnly: true
431
+ })
432
+ ] }),
433
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
434
+ name: [client.name],
435
+ root: query.file.path,
436
+ path: client.file.path
437
+ }),
438
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
439
+ name: ["buildFormData"],
440
+ root: query.file.path,
441
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
442
+ }),
443
+ /* @__PURE__ */ jsx(File.Import, {
444
+ name: [
445
+ type.schemas.request?.name,
446
+ type.schemas.response.name,
447
+ type.schemas.pathParams?.name,
448
+ type.schemas.queryParams?.name,
449
+ type.schemas.headerParams?.name,
450
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
451
+ ].filter(Boolean),
452
+ root: query.file.path,
453
+ path: type.file.path,
454
+ isTypeOnly: true
455
+ }),
456
+ /* @__PURE__ */ jsx(QueryKey, {
457
+ name: queryKey.name,
458
+ typeName: queryKey.typeName,
459
+ operation,
460
+ paramsCasing: options.paramsCasing,
461
+ pathParamsType: options.pathParamsType,
462
+ typeSchemas: type.schemas,
463
+ transformer: options.queryKey
464
+ }),
465
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
466
+ name: client.name,
467
+ baseURL: options.client.baseURL,
468
+ operation,
469
+ typeSchemas: type.schemas,
470
+ zodSchemas: zod.schemas,
471
+ dataReturnType: options.client.dataReturnType || "data",
472
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
473
+ paramsType: options.paramsType,
474
+ pathParamsType: options.pathParamsType,
475
+ parser: options.parser
476
+ }),
477
+ options.customOptions && /* @__PURE__ */ jsx(File.Import, {
478
+ name: [options.customOptions.name],
479
+ path: options.customOptions.importPath
480
+ }),
481
+ infiniteOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
482
+ /* @__PURE__ */ jsx(File.Import, {
483
+ name: ["InfiniteData"],
484
+ isTypeOnly: true,
485
+ path: importPath
486
+ }),
487
+ /* @__PURE__ */ jsx(File.Import, {
488
+ name: ["infiniteQueryOptions"],
489
+ path: importPath
490
+ }),
491
+ /* @__PURE__ */ jsx(InfiniteQueryOptions, {
492
+ name: queryOptions.name,
493
+ clientName: client.name,
494
+ queryKeyName: queryKey.name,
495
+ typeSchemas: type.schemas,
496
+ paramsCasing: options.paramsCasing,
497
+ paramsType: options.paramsType,
498
+ pathParamsType: options.pathParamsType,
499
+ dataReturnType: options.client.dataReturnType || "data",
500
+ cursorParam: infiniteOptions.cursorParam,
501
+ nextParam: infiniteOptions.nextParam,
502
+ previousParam: infiniteOptions.previousParam,
503
+ initialPageParam: infiniteOptions.initialPageParam,
504
+ queryParam: infiniteOptions.queryParam
505
+ })
506
+ ] }),
507
+ infiniteOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
508
+ /* @__PURE__ */ jsx(File.Import, {
509
+ name: ["useInfiniteQuery"],
510
+ path: importPath
511
+ }),
512
+ /* @__PURE__ */ jsx(File.Import, {
513
+ name: [
514
+ "QueryKey",
515
+ "QueryClient",
516
+ "InfiniteQueryObserverOptions",
517
+ "UseInfiniteQueryResult"
518
+ ],
519
+ path: importPath,
520
+ isTypeOnly: true
521
+ }),
522
+ /* @__PURE__ */ jsx(InfiniteQuery, {
523
+ name: query.name,
524
+ queryOptionsName: queryOptions.name,
525
+ typeSchemas: type.schemas,
526
+ paramsCasing: options.paramsCasing,
527
+ paramsType: options.paramsType,
528
+ pathParamsType: options.pathParamsType,
529
+ operation,
530
+ dataReturnType: options.client.dataReturnType || "data",
531
+ queryKeyName: queryKey.name,
532
+ queryKeyTypeName: queryKey.typeName,
533
+ initialPageParam: infiniteOptions.initialPageParam,
534
+ queryParam: infiniteOptions.queryParam,
535
+ customOptions: options.customOptions
536
+ })
537
+ ] })
538
+ ]
539
+ });
540
+ }
541
+ });
542
+ //#endregion
543
+ //#region src/generators/mutationGenerator.tsx
544
+ const mutationGenerator = createReactGenerator({
545
+ name: "react-query",
546
+ Operation({ config, plugin, operation, generator }) {
547
+ const { options, options: { output } } = plugin;
548
+ const pluginManager = usePluginManager();
549
+ const oas = useOas();
550
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
551
+ const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
552
+ const isMutation = options.mutation !== false && !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
553
+ const importPath = options.mutation ? options.mutation.importPath : "@tanstack/react-query";
554
+ const mutation = {
555
+ name: getName(operation, {
556
+ type: "function",
557
+ prefix: "use"
558
+ }),
559
+ typeName: getName(operation, { type: "type" }),
560
+ file: getFile(operation, { prefix: "use" })
561
+ };
562
+ const type = {
563
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
564
+ schemas: getSchemas(operation, {
565
+ pluginKey: [pluginTsName],
566
+ type: "type"
567
+ })
568
+ };
569
+ const zod = {
570
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
571
+ schemas: getSchemas(operation, {
572
+ pluginKey: [pluginZodName],
573
+ type: "function"
574
+ })
575
+ };
576
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
577
+ const client = {
578
+ name: shouldUseClientPlugin ? getName(operation, {
579
+ type: "function",
580
+ pluginKey: [pluginClientName]
581
+ }) : getName(operation, { type: "function" }),
582
+ file: getFile(operation, { pluginKey: [pluginClientName] })
583
+ };
584
+ const mutationOptions = { name: getName(operation, {
585
+ type: "function",
586
+ suffix: "MutationOptions"
587
+ }) };
588
+ const mutationKey = {
589
+ name: getName(operation, {
590
+ type: "const",
591
+ suffix: "MutationKey"
592
+ }),
593
+ typeName: getName(operation, {
594
+ type: "type",
595
+ suffix: "MutationKey"
596
+ })
597
+ };
598
+ if (!isMutation) return null;
599
+ return /* @__PURE__ */ jsxs(File, {
600
+ baseName: mutation.file.baseName,
601
+ path: mutation.file.path,
602
+ meta: mutation.file.meta,
603
+ banner: getBanner({
604
+ oas,
605
+ output,
606
+ config: pluginManager.config
607
+ }),
608
+ footer: getFooter({
609
+ oas,
610
+ output
611
+ }),
612
+ children: [
613
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
614
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
615
+ root: mutation.file.path,
616
+ path: zod.file.path
617
+ }),
618
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
619
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
620
+ name: "fetch",
621
+ path: options.client.importPath
622
+ }),
623
+ /* @__PURE__ */ jsx(File.Import, {
624
+ name: [
625
+ "Client",
626
+ "RequestConfig",
627
+ "ResponseErrorConfig"
628
+ ],
629
+ path: options.client.importPath,
630
+ isTypeOnly: true
631
+ }),
632
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
633
+ name: ["ResponseConfig"],
634
+ path: options.client.importPath,
635
+ isTypeOnly: true
636
+ })
637
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
638
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
639
+ name: ["fetch"],
640
+ root: mutation.file.path,
641
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
642
+ }),
643
+ /* @__PURE__ */ jsx(File.Import, {
644
+ name: [
645
+ "Client",
646
+ "RequestConfig",
647
+ "ResponseErrorConfig"
648
+ ],
649
+ root: mutation.file.path,
650
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
651
+ isTypeOnly: true
652
+ }),
653
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
654
+ name: ["ResponseConfig"],
655
+ root: mutation.file.path,
656
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
657
+ isTypeOnly: true
658
+ })
659
+ ] }),
660
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
661
+ name: [client.name],
662
+ root: mutation.file.path,
663
+ path: client.file.path
664
+ }),
665
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
666
+ name: ["buildFormData"],
667
+ root: mutation.file.path,
668
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
669
+ }),
670
+ options.customOptions && /* @__PURE__ */ jsx(File.Import, {
671
+ name: [options.customOptions.name],
672
+ path: options.customOptions.importPath
673
+ }),
674
+ /* @__PURE__ */ jsx(File.Import, {
675
+ name: [
676
+ type.schemas.request?.name,
677
+ type.schemas.response.name,
678
+ type.schemas.pathParams?.name,
679
+ type.schemas.queryParams?.name,
680
+ type.schemas.headerParams?.name,
681
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
682
+ ].filter(Boolean),
683
+ root: mutation.file.path,
684
+ path: type.file.path,
685
+ isTypeOnly: true
686
+ }),
687
+ /* @__PURE__ */ jsx(MutationKey, {
688
+ name: mutationKey.name,
689
+ typeName: mutationKey.typeName,
690
+ operation,
691
+ pathParamsType: options.pathParamsType,
692
+ typeSchemas: type.schemas,
693
+ paramsCasing: options.paramsCasing,
694
+ transformer: options.mutationKey
695
+ }),
696
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
697
+ name: client.name,
698
+ baseURL: options.client.baseURL,
699
+ operation,
700
+ typeSchemas: type.schemas,
701
+ zodSchemas: zod.schemas,
702
+ dataReturnType: options.client.dataReturnType || "data",
703
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
704
+ paramsType: options.paramsType,
705
+ pathParamsType: options.pathParamsType,
706
+ parser: options.parser
707
+ }),
708
+ /* @__PURE__ */ jsx(File.Import, {
709
+ name: ["mutationOptions"],
710
+ path: importPath
711
+ }),
712
+ /* @__PURE__ */ jsx(MutationOptions, {
713
+ name: mutationOptions.name,
714
+ clientName: client.name,
715
+ mutationKeyName: mutationKey.name,
716
+ typeSchemas: type.schemas,
717
+ paramsCasing: options.paramsCasing,
718
+ paramsType: options.paramsType,
719
+ pathParamsType: options.pathParamsType,
720
+ dataReturnType: options.client.dataReturnType || "data"
721
+ }),
722
+ options.mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
723
+ /* @__PURE__ */ jsx(File.Import, {
724
+ name: ["useMutation"],
725
+ path: importPath
726
+ }),
727
+ /* @__PURE__ */ jsx(File.Import, {
728
+ name: [
729
+ "UseMutationOptions",
730
+ "UseMutationResult",
731
+ "QueryClient"
732
+ ],
733
+ path: importPath,
734
+ isTypeOnly: true
735
+ }),
736
+ /* @__PURE__ */ jsx(Mutation, {
737
+ name: mutation.name,
738
+ mutationOptionsName: mutationOptions.name,
739
+ typeName: mutation.typeName,
740
+ typeSchemas: type.schemas,
741
+ operation,
742
+ dataReturnType: options.client.dataReturnType || "data",
743
+ paramsCasing: options.paramsCasing,
744
+ pathParamsType: options.pathParamsType,
745
+ mutationKeyName: mutationKey.name,
746
+ customOptions: options.customOptions
747
+ })
748
+ ] })
749
+ ]
750
+ });
751
+ }
752
+ });
753
+ //#endregion
754
+ //#region src/generators/queryGenerator.tsx
755
+ const queryGenerator = createReactGenerator({
756
+ name: "react-query",
757
+ Operation({ config, plugin, operation, generator }) {
758
+ const { options, options: { output } } = plugin;
759
+ const pluginManager = usePluginManager();
760
+ const oas = useOas();
761
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
762
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
763
+ const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
764
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
765
+ const query = {
766
+ name: getName(operation, {
767
+ type: "function",
768
+ prefix: "use"
769
+ }),
770
+ typeName: getName(operation, { type: "type" }),
771
+ file: getFile(operation, { prefix: "use" })
772
+ };
773
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
774
+ const client = {
775
+ name: shouldUseClientPlugin ? getName(operation, {
776
+ type: "function",
777
+ pluginKey: [pluginClientName]
778
+ }) : getName(operation, { type: "function" }),
779
+ file: getFile(operation, { pluginKey: [pluginClientName] })
780
+ };
781
+ const queryOptions = { name: getName(operation, {
782
+ type: "function",
783
+ suffix: "QueryOptions"
784
+ }) };
785
+ const queryKey = {
786
+ name: getName(operation, {
787
+ type: "const",
788
+ suffix: "QueryKey"
789
+ }),
790
+ typeName: getName(operation, {
791
+ type: "type",
792
+ suffix: "QueryKey"
793
+ })
794
+ };
795
+ const type = {
796
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
797
+ schemas: getSchemas(operation, {
798
+ pluginKey: [pluginTsName],
799
+ type: "type"
800
+ })
801
+ };
802
+ const zod = {
803
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
804
+ schemas: getSchemas(operation, {
805
+ pluginKey: [pluginZodName],
806
+ type: "function"
807
+ })
808
+ };
809
+ if (!isQuery || isMutation) return null;
810
+ return /* @__PURE__ */ jsxs(File, {
811
+ baseName: query.file.baseName,
812
+ path: query.file.path,
813
+ meta: query.file.meta,
814
+ banner: getBanner({
815
+ oas,
816
+ output,
817
+ config: pluginManager.config
818
+ }),
819
+ footer: getFooter({
820
+ oas,
821
+ output
822
+ }),
823
+ children: [
824
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
825
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
826
+ root: query.file.path,
827
+ path: zod.file.path
828
+ }),
829
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
830
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
831
+ name: "fetch",
832
+ path: options.client.importPath
833
+ }),
834
+ /* @__PURE__ */ jsx(File.Import, {
835
+ name: [
836
+ "Client",
837
+ "RequestConfig",
838
+ "ResponseErrorConfig"
839
+ ],
840
+ path: options.client.importPath,
841
+ isTypeOnly: true
842
+ }),
843
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
844
+ name: ["ResponseConfig"],
845
+ path: options.client.importPath,
846
+ isTypeOnly: true
847
+ })
848
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
849
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
850
+ name: ["fetch"],
851
+ root: query.file.path,
852
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
853
+ }),
854
+ /* @__PURE__ */ jsx(File.Import, {
855
+ name: [
856
+ "Client",
857
+ "RequestConfig",
858
+ "ResponseErrorConfig"
859
+ ],
860
+ root: query.file.path,
861
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
862
+ isTypeOnly: true
863
+ }),
864
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
865
+ name: ["ResponseConfig"],
866
+ root: query.file.path,
867
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
868
+ isTypeOnly: true
869
+ })
870
+ ] }),
871
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
872
+ name: [client.name],
873
+ root: query.file.path,
874
+ path: client.file.path
875
+ }),
876
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
877
+ name: ["buildFormData"],
878
+ root: query.file.path,
879
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
880
+ }),
881
+ options.customOptions && /* @__PURE__ */ jsx(File.Import, {
882
+ name: [options.customOptions.name],
883
+ path: options.customOptions.importPath
884
+ }),
885
+ /* @__PURE__ */ jsx(File.Import, {
886
+ name: [
887
+ type.schemas.request?.name,
888
+ type.schemas.response.name,
889
+ type.schemas.pathParams?.name,
890
+ type.schemas.queryParams?.name,
891
+ type.schemas.headerParams?.name,
892
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
893
+ ].filter(Boolean),
894
+ root: query.file.path,
895
+ path: type.file.path,
896
+ isTypeOnly: true
897
+ }),
898
+ /* @__PURE__ */ jsx(QueryKey, {
899
+ name: queryKey.name,
900
+ typeName: queryKey.typeName,
901
+ operation,
902
+ pathParamsType: options.pathParamsType,
903
+ typeSchemas: type.schemas,
904
+ paramsCasing: options.paramsCasing,
905
+ transformer: options.queryKey
906
+ }),
907
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
908
+ name: client.name,
909
+ baseURL: options.client.baseURL,
910
+ operation,
911
+ typeSchemas: type.schemas,
912
+ zodSchemas: zod.schemas,
913
+ dataReturnType: options.client.dataReturnType || "data",
914
+ paramsType: options.paramsType,
915
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
916
+ pathParamsType: options.pathParamsType,
917
+ parser: options.parser
918
+ }),
919
+ /* @__PURE__ */ jsx(File.Import, {
920
+ name: ["queryOptions"],
921
+ path: importPath
922
+ }),
923
+ /* @__PURE__ */ jsx(QueryOptions, {
924
+ name: queryOptions.name,
925
+ clientName: client.name,
926
+ queryKeyName: queryKey.name,
927
+ typeSchemas: type.schemas,
928
+ paramsCasing: options.paramsCasing,
929
+ paramsType: options.paramsType,
930
+ pathParamsType: options.pathParamsType,
931
+ dataReturnType: options.client.dataReturnType || "data"
932
+ }),
933
+ options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
934
+ /* @__PURE__ */ jsx(File.Import, {
935
+ name: ["useQuery"],
936
+ path: importPath
937
+ }),
938
+ /* @__PURE__ */ jsx(File.Import, {
939
+ name: [
940
+ "QueryKey",
941
+ "QueryClient",
942
+ "QueryObserverOptions",
943
+ "UseQueryResult",
944
+ "QueryClient"
945
+ ],
946
+ path: importPath,
947
+ isTypeOnly: true
948
+ }),
949
+ /* @__PURE__ */ jsx(Query, {
950
+ name: query.name,
951
+ queryOptionsName: queryOptions.name,
952
+ typeSchemas: type.schemas,
953
+ paramsCasing: options.paramsCasing,
954
+ paramsType: options.paramsType,
955
+ pathParamsType: options.pathParamsType,
956
+ operation,
957
+ dataReturnType: options.client.dataReturnType || "data",
958
+ queryKeyName: queryKey.name,
959
+ queryKeyTypeName: queryKey.typeName,
960
+ customOptions: options.customOptions
961
+ })
962
+ ] })
963
+ ]
964
+ });
965
+ }
966
+ });
967
+ //#endregion
968
+ //#region src/generators/suspenseInfiniteQueryGenerator.tsx
969
+ const suspenseInfiniteQueryGenerator = createReactGenerator({
970
+ name: "react-suspense-infinite-query",
971
+ Operation({ config, operation, generator, plugin }) {
972
+ const { options, options: { output } } = plugin;
973
+ const pluginManager = usePluginManager();
974
+ const oas = useOas();
975
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
976
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
977
+ const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
978
+ const isSuspense = !!options.suspense;
979
+ const infiniteOptions = options.infinite && typeof options.infinite === "object" ? options.infinite : void 0;
980
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
981
+ const query = {
982
+ name: getName(operation, {
983
+ type: "function",
984
+ prefix: "use",
985
+ suffix: "suspenseInfinite"
986
+ }),
987
+ typeName: getName(operation, { type: "type" }),
988
+ file: getFile(operation, {
989
+ prefix: "use",
990
+ suffix: "suspenseInfinite"
991
+ })
992
+ };
993
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
994
+ const client = {
995
+ name: shouldUseClientPlugin ? getName(operation, {
996
+ type: "function",
997
+ pluginKey: [pluginClientName]
998
+ }) : getName(operation, {
999
+ type: "function",
1000
+ suffix: "suspenseInfinite"
1001
+ }),
1002
+ file: getFile(operation, { pluginKey: [pluginClientName] })
1003
+ };
1004
+ const queryOptions = { name: getName(operation, {
1005
+ type: "function",
1006
+ suffix: "SuspenseInfiniteQueryOptions"
1007
+ }) };
1008
+ const queryKey = {
1009
+ name: getName(operation, {
1010
+ type: "const",
1011
+ suffix: "SuspenseInfiniteQueryKey"
1012
+ }),
1013
+ typeName: getName(operation, {
1014
+ type: "type",
1015
+ suffix: "SuspenseInfiniteQueryKey"
1016
+ })
1017
+ };
1018
+ const type = {
1019
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
1020
+ schemas: getSchemas(operation, {
1021
+ pluginKey: [pluginTsName],
1022
+ type: "type"
1023
+ })
1024
+ };
1025
+ const zod = {
1026
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
1027
+ schemas: getSchemas(operation, {
1028
+ pluginKey: [pluginZodName],
1029
+ type: "function"
1030
+ })
1031
+ };
1032
+ if (!isQuery || isMutation || !isSuspense || !infiniteOptions) return null;
1033
+ return /* @__PURE__ */ jsxs(File, {
1034
+ baseName: query.file.baseName,
1035
+ path: query.file.path,
1036
+ meta: query.file.meta,
1037
+ banner: getBanner({
1038
+ oas,
1039
+ output,
1040
+ config: pluginManager.config
1041
+ }),
1042
+ footer: getFooter({
1043
+ oas,
1044
+ output
1045
+ }),
1046
+ children: [
1047
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
1048
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
1049
+ root: query.file.path,
1050
+ path: zod.file.path
1051
+ }),
1052
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
1053
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1054
+ name: "fetch",
1055
+ path: options.client.importPath
1056
+ }),
1057
+ /* @__PURE__ */ jsx(File.Import, {
1058
+ name: [
1059
+ "Client",
1060
+ "RequestConfig",
1061
+ "ResponseErrorConfig"
1062
+ ],
1063
+ path: options.client.importPath,
1064
+ isTypeOnly: true
1065
+ }),
1066
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
1067
+ name: ["ResponseConfig"],
1068
+ path: options.client.importPath,
1069
+ isTypeOnly: true
1070
+ })
1071
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1072
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1073
+ name: ["fetch"],
1074
+ root: query.file.path,
1075
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
1076
+ }),
1077
+ /* @__PURE__ */ jsx(File.Import, {
1078
+ name: [
1079
+ "Client",
1080
+ "RequestConfig",
1081
+ "ResponseErrorConfig"
1082
+ ],
1083
+ root: query.file.path,
1084
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1085
+ isTypeOnly: true
1086
+ }),
1087
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
1088
+ name: ["ResponseConfig"],
1089
+ root: query.file.path,
1090
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1091
+ isTypeOnly: true
1092
+ })
1093
+ ] }),
1094
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1095
+ name: [client.name],
1096
+ root: query.file.path,
1097
+ path: client.file.path
1098
+ }),
1099
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1100
+ name: ["buildFormData"],
1101
+ root: query.file.path,
1102
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
1103
+ }),
1104
+ options.customOptions && /* @__PURE__ */ jsx(File.Import, {
1105
+ name: [options.customOptions.name],
1106
+ path: options.customOptions.importPath
1107
+ }),
1108
+ /* @__PURE__ */ jsx(File.Import, {
1109
+ name: [
1110
+ type.schemas.request?.name,
1111
+ type.schemas.response.name,
1112
+ type.schemas.pathParams?.name,
1113
+ type.schemas.queryParams?.name,
1114
+ type.schemas.headerParams?.name,
1115
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
1116
+ ].filter(Boolean),
1117
+ root: query.file.path,
1118
+ path: type.file.path,
1119
+ isTypeOnly: true
1120
+ }),
1121
+ /* @__PURE__ */ jsx(QueryKey, {
1122
+ name: queryKey.name,
1123
+ typeName: queryKey.typeName,
1124
+ operation,
1125
+ paramsCasing: options.paramsCasing,
1126
+ pathParamsType: options.pathParamsType,
1127
+ typeSchemas: type.schemas,
1128
+ transformer: options.queryKey
1129
+ }),
1130
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
1131
+ name: client.name,
1132
+ baseURL: options.client.baseURL,
1133
+ operation,
1134
+ typeSchemas: type.schemas,
1135
+ zodSchemas: zod.schemas,
1136
+ dataReturnType: options.client.dataReturnType || "data",
1137
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
1138
+ paramsType: options.paramsType,
1139
+ pathParamsType: options.pathParamsType,
1140
+ parser: options.parser
1141
+ }),
1142
+ infiniteOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
1143
+ /* @__PURE__ */ jsx(File.Import, {
1144
+ name: ["InfiniteData"],
1145
+ isTypeOnly: true,
1146
+ path: importPath
1147
+ }),
1148
+ /* @__PURE__ */ jsx(File.Import, {
1149
+ name: ["infiniteQueryOptions"],
1150
+ path: importPath
1151
+ }),
1152
+ /* @__PURE__ */ jsx(SuspenseInfiniteQueryOptions, {
1153
+ name: queryOptions.name,
1154
+ clientName: client.name,
1155
+ queryKeyName: queryKey.name,
1156
+ typeSchemas: type.schemas,
1157
+ paramsCasing: options.paramsCasing,
1158
+ paramsType: options.paramsType,
1159
+ pathParamsType: options.pathParamsType,
1160
+ dataReturnType: options.client.dataReturnType || "data",
1161
+ cursorParam: infiniteOptions.cursorParam,
1162
+ nextParam: infiniteOptions.nextParam,
1163
+ previousParam: infiniteOptions.previousParam,
1164
+ initialPageParam: infiniteOptions.initialPageParam,
1165
+ queryParam: infiniteOptions.queryParam
1166
+ })
1167
+ ] }),
1168
+ infiniteOptions && /* @__PURE__ */ jsxs(Fragment, { children: [
1169
+ /* @__PURE__ */ jsx(File.Import, {
1170
+ name: ["useSuspenseInfiniteQuery"],
1171
+ path: importPath
1172
+ }),
1173
+ /* @__PURE__ */ jsx(File.Import, {
1174
+ name: [
1175
+ "QueryKey",
1176
+ "QueryClient",
1177
+ "UseSuspenseInfiniteQueryOptions",
1178
+ "UseSuspenseInfiniteQueryResult"
1179
+ ],
1180
+ path: importPath,
1181
+ isTypeOnly: true
1182
+ }),
1183
+ /* @__PURE__ */ jsx(SuspenseInfiniteQuery, {
1184
+ name: query.name,
1185
+ queryOptionsName: queryOptions.name,
1186
+ typeSchemas: type.schemas,
1187
+ paramsCasing: options.paramsCasing,
1188
+ paramsType: options.paramsType,
1189
+ pathParamsType: options.pathParamsType,
1190
+ operation,
1191
+ dataReturnType: options.client.dataReturnType || "data",
1192
+ queryKeyName: queryKey.name,
1193
+ queryKeyTypeName: queryKey.typeName,
1194
+ customOptions: options.customOptions,
1195
+ initialPageParam: infiniteOptions.initialPageParam,
1196
+ queryParam: infiniteOptions.queryParam
1197
+ })
1198
+ ] })
1199
+ ]
1200
+ });
1201
+ }
1202
+ });
1203
+ //#endregion
1204
+ //#region src/generators/suspenseQueryGenerator.tsx
1205
+ const suspenseQueryGenerator = createReactGenerator({
1206
+ name: "react-suspense-query",
1207
+ Operation({ config, operation, generator, plugin }) {
1208
+ const { options, options: { output } } = plugin;
1209
+ const pluginManager = usePluginManager();
1210
+ const oas = useOas();
1211
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
1212
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
1213
+ const isMutation = difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
1214
+ const isSuspense = !!options.suspense;
1215
+ const importPath = options.query ? options.query.importPath : "@tanstack/react-query";
1216
+ const query = {
1217
+ name: getName(operation, {
1218
+ type: "function",
1219
+ prefix: "use",
1220
+ suffix: "suspense"
1221
+ }),
1222
+ typeName: getName(operation, { type: "type" }),
1223
+ file: getFile(operation, {
1224
+ prefix: "use",
1225
+ suffix: "suspense"
1226
+ })
1227
+ };
1228
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
1229
+ const client = {
1230
+ name: shouldUseClientPlugin ? getName(operation, {
1231
+ type: "function",
1232
+ pluginKey: [pluginClientName]
1233
+ }) : getName(operation, {
1234
+ type: "function",
1235
+ suffix: "suspense"
1236
+ }),
1237
+ file: getFile(operation, { pluginKey: [pluginClientName] })
1238
+ };
1239
+ const queryOptions = { name: getName(operation, {
1240
+ type: "function",
1241
+ suffix: "SuspenseQueryOptions"
1242
+ }) };
1243
+ const queryKey = {
1244
+ name: getName(operation, {
1245
+ type: "const",
1246
+ suffix: "SuspenseQueryKey"
1247
+ }),
1248
+ typeName: getName(operation, {
1249
+ type: "type",
1250
+ suffix: "SuspenseQueryKey"
1251
+ })
1252
+ };
1253
+ const type = {
1254
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
1255
+ schemas: getSchemas(operation, {
1256
+ pluginKey: [pluginTsName],
1257
+ type: "type"
1258
+ })
1259
+ };
1260
+ const zod = {
1261
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
1262
+ schemas: getSchemas(operation, {
1263
+ pluginKey: [pluginZodName],
1264
+ type: "function"
1265
+ })
1266
+ };
1267
+ if (!isQuery || isMutation || !isSuspense) return null;
1268
+ return /* @__PURE__ */ jsxs(File, {
1269
+ baseName: query.file.baseName,
1270
+ path: query.file.path,
1271
+ meta: query.file.meta,
1272
+ banner: getBanner({
1273
+ oas,
1274
+ output,
1275
+ config: pluginManager.config
1276
+ }),
1277
+ footer: getFooter({
1278
+ oas,
1279
+ output
1280
+ }),
1281
+ children: [
1282
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
1283
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
1284
+ root: query.file.path,
1285
+ path: zod.file.path
1286
+ }),
1287
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
1288
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1289
+ name: "fetch",
1290
+ path: options.client.importPath
1291
+ }),
1292
+ /* @__PURE__ */ jsx(File.Import, {
1293
+ name: [
1294
+ "Client",
1295
+ "RequestConfig",
1296
+ "ResponseErrorConfig"
1297
+ ],
1298
+ path: options.client.importPath,
1299
+ isTypeOnly: true
1300
+ }),
1301
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
1302
+ name: ["ResponseConfig"],
1303
+ path: options.client.importPath,
1304
+ isTypeOnly: true
1305
+ })
1306
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1307
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1308
+ name: ["fetch"],
1309
+ root: query.file.path,
1310
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
1311
+ }),
1312
+ /* @__PURE__ */ jsx(File.Import, {
1313
+ name: [
1314
+ "Client",
1315
+ "RequestConfig",
1316
+ "ResponseErrorConfig"
1317
+ ],
1318
+ root: query.file.path,
1319
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1320
+ isTypeOnly: true
1321
+ }),
1322
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
1323
+ name: ["ResponseConfig"],
1324
+ root: query.file.path,
1325
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
1326
+ isTypeOnly: true
1327
+ })
1328
+ ] }),
1329
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1330
+ name: [client.name],
1331
+ root: query.file.path,
1332
+ path: client.file.path
1333
+ }),
1334
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
1335
+ name: ["buildFormData"],
1336
+ root: query.file.path,
1337
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
1338
+ }),
1339
+ options.customOptions && /* @__PURE__ */ jsx(File.Import, {
1340
+ name: [options.customOptions.name],
1341
+ path: options.customOptions.importPath
1342
+ }),
1343
+ /* @__PURE__ */ jsx(File.Import, {
1344
+ name: [
1345
+ type.schemas.request?.name,
1346
+ type.schemas.response.name,
1347
+ type.schemas.pathParams?.name,
1348
+ type.schemas.queryParams?.name,
1349
+ type.schemas.headerParams?.name,
1350
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
1351
+ ].filter(Boolean),
1352
+ root: query.file.path,
1353
+ path: type.file.path,
1354
+ isTypeOnly: true
1355
+ }),
1356
+ /* @__PURE__ */ jsx(QueryKey, {
1357
+ name: queryKey.name,
1358
+ typeName: queryKey.typeName,
1359
+ operation,
1360
+ paramsCasing: options.paramsCasing,
1361
+ pathParamsType: options.pathParamsType,
1362
+ typeSchemas: type.schemas,
1363
+ transformer: options.queryKey
1364
+ }),
1365
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
1366
+ name: client.name,
1367
+ baseURL: options.client.baseURL,
1368
+ operation,
1369
+ typeSchemas: type.schemas,
1370
+ zodSchemas: zod.schemas,
1371
+ dataReturnType: options.client.dataReturnType || "data",
1372
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
1373
+ paramsType: options.paramsType,
1374
+ pathParamsType: options.pathParamsType,
1375
+ parser: options.parser
1376
+ }),
1377
+ /* @__PURE__ */ jsx(File.Import, {
1378
+ name: ["queryOptions"],
1379
+ path: importPath
1380
+ }),
1381
+ /* @__PURE__ */ jsx(QueryOptions, {
1382
+ name: queryOptions.name,
1383
+ clientName: client.name,
1384
+ queryKeyName: queryKey.name,
1385
+ typeSchemas: type.schemas,
1386
+ paramsCasing: options.paramsCasing,
1387
+ paramsType: options.paramsType,
1388
+ pathParamsType: options.pathParamsType,
1389
+ dataReturnType: options.client.dataReturnType
1390
+ }),
1391
+ options.suspense && /* @__PURE__ */ jsxs(Fragment, { children: [
1392
+ /* @__PURE__ */ jsx(File.Import, {
1393
+ name: ["useSuspenseQuery"],
1394
+ path: importPath
1395
+ }),
1396
+ /* @__PURE__ */ jsx(File.Import, {
1397
+ name: [
1398
+ "QueryKey",
1399
+ "QueryClient",
1400
+ "UseSuspenseQueryOptions",
1401
+ "UseSuspenseQueryResult"
1402
+ ],
1403
+ path: importPath,
1404
+ isTypeOnly: true
1405
+ }),
1406
+ /* @__PURE__ */ jsx(SuspenseQuery, {
1407
+ name: query.name,
1408
+ queryOptionsName: queryOptions.name,
1409
+ typeSchemas: type.schemas,
1410
+ paramsType: options.paramsType,
1411
+ paramsCasing: options.paramsCasing,
1412
+ pathParamsType: options.pathParamsType,
1413
+ operation,
1414
+ dataReturnType: options.client.dataReturnType || "data",
1415
+ queryKeyName: queryKey.name,
1416
+ queryKeyTypeName: queryKey.typeName,
1417
+ customOptions: options.customOptions
1418
+ })
1419
+ ] })
1420
+ ]
1421
+ });
1422
+ }
1423
+ });
1424
+ //#endregion
1425
+ export { infiniteQueryGenerator as a, mutationGenerator as i, suspenseInfiniteQueryGenerator as n, hookOptionsGenerator as o, queryGenerator as r, customHookOptionsFileGenerator as s, suspenseQueryGenerator as t };
1426
+
1427
+ //# sourceMappingURL=generators-CpiBv5eE.js.map