@kubb/agent 5.0.0-alpha.35 → 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 (180) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/server/chunks/nitro/nitro.mjs +1293 -20554
  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/buffer-from/index.js +72 -0
  134. package/.output/server/node_modules/buffer-from/package.json +19 -0
  135. package/.output/server/node_modules/empathic/access.js +39 -0
  136. package/.output/server/node_modules/empathic/access.mjs +34 -0
  137. package/.output/server/node_modules/empathic/find.js +81 -0
  138. package/.output/server/node_modules/empathic/find.mjs +76 -0
  139. package/.output/server/node_modules/empathic/package.json +49 -0
  140. package/.output/server/node_modules/empathic/package.mjs +52 -0
  141. package/.output/server/node_modules/empathic/resolve.js +31 -0
  142. package/.output/server/node_modules/empathic/resolve.mjs +27 -0
  143. package/.output/server/node_modules/empathic/walk.js +22 -0
  144. package/.output/server/node_modules/empathic/walk.mjs +20 -0
  145. package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
  146. package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
  147. package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
  148. package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
  149. package/.output/server/node_modules/fast-string-width/package.json +34 -0
  150. package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
  151. package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
  152. package/.output/server/node_modules/p-limit/index.js +127 -0
  153. package/.output/server/node_modules/p-limit/package.json +58 -0
  154. package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
  155. package/.output/server/node_modules/react-devtools-core/package.json +38 -0
  156. package/.output/server/node_modules/sisteransi/package.json +34 -0
  157. package/.output/server/node_modules/sisteransi/src/index.js +58 -0
  158. package/.output/server/node_modules/source-map-support/package.json +31 -0
  159. package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
  160. package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
  161. package/.output/server/node_modules/typescript/package.json +120 -0
  162. package/.output/server/node_modules/yocto-queue/index.js +90 -0
  163. package/.output/server/node_modules/yocto-queue/package.json +48 -0
  164. package/.output/server/package.json +34 -2
  165. package/package.json +20 -20
  166. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
  167. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
  168. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
  169. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
  170. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
  171. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
  172. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
  173. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
  174. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
  175. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
  176. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
  177. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
  178. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
  179. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
  180. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
@@ -0,0 +1,415 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as MutationKey, i as QueryKey, n as QueryOptions, r as Mutation, t as Query } from "./components-BhStIi1M.js";
3
+ import path from "node:path";
4
+ import { pluginClientName } from "@kubb/plugin-client";
5
+ import { pluginTsName } from "@kubb/plugin-ts";
6
+ import { pluginZodName } from "@kubb/plugin-zod";
7
+ import { Client } from "@kubb/plugin-client/components";
8
+ import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
9
+ import { File } from "@kubb/react-fabric";
10
+ import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
11
+ import { usePluginManager } from "@kubb/core/hooks";
12
+ import { createReactGenerator } from "@kubb/plugin-oas/generators";
13
+ import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
14
+ import { difference } from "remeda";
15
+ //#region src/generators/mutationGenerator.tsx
16
+ const mutationGenerator = createReactGenerator({
17
+ name: "solid-query",
18
+ Operation({ config, operation, generator, plugin }) {
19
+ const { options, options: { output } } = plugin;
20
+ const pluginManager = usePluginManager();
21
+ const oas = useOas();
22
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
23
+ const isQuery = !!options.query && options.query?.methods.some((method) => operation.method === method);
24
+ const isMutation = options.mutation !== false && !isQuery && difference(options.mutation ? options.mutation.methods : [], options.query ? options.query.methods : []).some((method) => operation.method === method);
25
+ const importPath = options.mutation ? options.mutation.importPath : "@tanstack/solid-query";
26
+ const mutation = {
27
+ name: getName(operation, {
28
+ type: "function",
29
+ prefix: "use"
30
+ }),
31
+ typeName: getName(operation, { type: "type" }),
32
+ file: getFile(operation, { prefix: "use" })
33
+ };
34
+ const type = {
35
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
36
+ schemas: getSchemas(operation, {
37
+ pluginKey: [pluginTsName],
38
+ type: "type"
39
+ })
40
+ };
41
+ const zod = {
42
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
43
+ schemas: getSchemas(operation, {
44
+ pluginKey: [pluginZodName],
45
+ type: "function"
46
+ })
47
+ };
48
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
49
+ const client = {
50
+ name: shouldUseClientPlugin ? getName(operation, {
51
+ type: "function",
52
+ pluginKey: [pluginClientName]
53
+ }) : getName(operation, { type: "function" }),
54
+ file: getFile(operation, { pluginKey: [pluginClientName] })
55
+ };
56
+ const mutationKey = {
57
+ name: getName(operation, {
58
+ type: "const",
59
+ suffix: "MutationKey"
60
+ }),
61
+ typeName: getName(operation, {
62
+ type: "type",
63
+ suffix: "MutationKey"
64
+ })
65
+ };
66
+ if (!isMutation) return null;
67
+ return /* @__PURE__ */ jsxs(File, {
68
+ baseName: mutation.file.baseName,
69
+ path: mutation.file.path,
70
+ meta: mutation.file.meta,
71
+ banner: getBanner({
72
+ oas,
73
+ output,
74
+ config: pluginManager.config
75
+ }),
76
+ footer: getFooter({
77
+ oas,
78
+ output
79
+ }),
80
+ children: [
81
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
82
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
83
+ root: mutation.file.path,
84
+ path: zod.file.path
85
+ }),
86
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
87
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
88
+ name: "fetch",
89
+ path: options.client.importPath
90
+ }),
91
+ /* @__PURE__ */ jsx(File.Import, {
92
+ name: [
93
+ "Client",
94
+ "RequestConfig",
95
+ "ResponseErrorConfig"
96
+ ],
97
+ path: options.client.importPath,
98
+ isTypeOnly: true
99
+ }),
100
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
101
+ name: ["ResponseConfig"],
102
+ path: options.client.importPath,
103
+ isTypeOnly: true
104
+ })
105
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
106
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
107
+ name: ["fetch"],
108
+ root: mutation.file.path,
109
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
110
+ }),
111
+ /* @__PURE__ */ jsx(File.Import, {
112
+ name: [
113
+ "Client",
114
+ "RequestConfig",
115
+ "ResponseErrorConfig"
116
+ ],
117
+ root: mutation.file.path,
118
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
119
+ isTypeOnly: true
120
+ }),
121
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
122
+ name: ["ResponseConfig"],
123
+ root: mutation.file.path,
124
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
125
+ isTypeOnly: true
126
+ })
127
+ ] }),
128
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
129
+ name: [client.name],
130
+ root: mutation.file.path,
131
+ path: client.file.path
132
+ }),
133
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
134
+ name: ["buildFormData"],
135
+ root: mutation.file.path,
136
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
137
+ }),
138
+ /* @__PURE__ */ jsx(File.Import, {
139
+ name: [
140
+ type.schemas.request?.name,
141
+ type.schemas.response.name,
142
+ type.schemas.pathParams?.name,
143
+ type.schemas.queryParams?.name,
144
+ type.schemas.headerParams?.name,
145
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
146
+ ].filter(Boolean),
147
+ root: mutation.file.path,
148
+ path: type.file.path,
149
+ isTypeOnly: true
150
+ }),
151
+ /* @__PURE__ */ jsx(MutationKey, {
152
+ name: mutationKey.name,
153
+ typeName: mutationKey.typeName,
154
+ operation,
155
+ pathParamsType: options.pathParamsType,
156
+ typeSchemas: type.schemas,
157
+ paramsCasing: options.paramsCasing,
158
+ transformer: options.mutationKey
159
+ }),
160
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
161
+ name: client.name,
162
+ baseURL: options.client.baseURL,
163
+ operation,
164
+ typeSchemas: type.schemas,
165
+ zodSchemas: zod.schemas,
166
+ dataReturnType: options.client.dataReturnType || "data",
167
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
168
+ paramsType: options.paramsType,
169
+ pathParamsType: options.pathParamsType,
170
+ parser: options.parser
171
+ }),
172
+ options.mutation && /* @__PURE__ */ jsxs(Fragment, { children: [
173
+ /* @__PURE__ */ jsx(File.Import, {
174
+ name: ["useMutation"],
175
+ path: importPath
176
+ }),
177
+ /* @__PURE__ */ jsx(File.Import, {
178
+ name: ["UseMutationOptions", "QueryClient"],
179
+ path: importPath,
180
+ isTypeOnly: true
181
+ }),
182
+ /* @__PURE__ */ jsx(Mutation, {
183
+ name: mutation.name,
184
+ clientName: client.name,
185
+ typeName: mutation.typeName,
186
+ typeSchemas: type.schemas,
187
+ operation,
188
+ dataReturnType: options.client.dataReturnType || "data",
189
+ paramsCasing: options.paramsCasing,
190
+ paramsType: options.paramsType,
191
+ pathParamsType: options.pathParamsType,
192
+ mutationKeyName: mutationKey.name
193
+ })
194
+ ] })
195
+ ]
196
+ });
197
+ }
198
+ });
199
+ //#endregion
200
+ //#region src/generators/queryGenerator.tsx
201
+ const queryGenerator = createReactGenerator({
202
+ name: "solid-query",
203
+ Operation({ config, operation, generator, plugin }) {
204
+ const { options, options: { output } } = plugin;
205
+ const pluginManager = usePluginManager();
206
+ const oas = useOas();
207
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
208
+ const isQuery = typeof options.query === "boolean" ? true : options.query?.methods.some((method) => operation.method === method);
209
+ const isMutation = difference([
210
+ "post",
211
+ "put",
212
+ "delete",
213
+ "patch"
214
+ ], options.query ? options.query.methods : []).some((method) => operation.method === method);
215
+ const importPath = options.query ? options.query.importPath : "@tanstack/solid-query";
216
+ const query = {
217
+ name: getName(operation, {
218
+ type: "function",
219
+ prefix: "create"
220
+ }),
221
+ typeName: getName(operation, { type: "type" }),
222
+ file: getFile(operation, { prefix: "create" })
223
+ };
224
+ const shouldUseClientPlugin = !!pluginManager.getPluginByKey([pluginClientName]) && options.client.clientType !== "class";
225
+ const client = {
226
+ name: shouldUseClientPlugin ? getName(operation, {
227
+ type: "function",
228
+ pluginKey: [pluginClientName]
229
+ }) : getName(operation, { type: "function" }),
230
+ file: getFile(operation, { pluginKey: [pluginClientName] })
231
+ };
232
+ const queryOptions = { name: getName(operation, {
233
+ type: "function",
234
+ suffix: "QueryOptions"
235
+ }) };
236
+ const queryKey = {
237
+ name: getName(operation, {
238
+ type: "const",
239
+ suffix: "QueryKey"
240
+ }),
241
+ typeName: getName(operation, {
242
+ type: "type",
243
+ suffix: "QueryKey"
244
+ })
245
+ };
246
+ const type = {
247
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
248
+ schemas: getSchemas(operation, {
249
+ pluginKey: [pluginTsName],
250
+ type: "type"
251
+ })
252
+ };
253
+ const zod = {
254
+ file: getFile(operation, { pluginKey: [pluginZodName] }),
255
+ schemas: getSchemas(operation, {
256
+ pluginKey: [pluginZodName],
257
+ type: "function"
258
+ })
259
+ };
260
+ if (!isQuery || isMutation) return null;
261
+ return /* @__PURE__ */ jsxs(File, {
262
+ baseName: query.file.baseName,
263
+ path: query.file.path,
264
+ meta: query.file.meta,
265
+ banner: getBanner({
266
+ oas,
267
+ output,
268
+ config: pluginManager.config
269
+ }),
270
+ footer: getFooter({
271
+ oas,
272
+ output
273
+ }),
274
+ children: [
275
+ options.parser === "zod" && /* @__PURE__ */ jsx(File.Import, {
276
+ name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
277
+ root: query.file.path,
278
+ path: zod.file.path
279
+ }),
280
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
281
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
282
+ name: "fetch",
283
+ path: options.client.importPath
284
+ }),
285
+ /* @__PURE__ */ jsx(File.Import, {
286
+ name: [
287
+ "Client",
288
+ "RequestConfig",
289
+ "ResponseErrorConfig"
290
+ ],
291
+ path: options.client.importPath,
292
+ isTypeOnly: true
293
+ }),
294
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
295
+ name: ["ResponseConfig"],
296
+ path: options.client.importPath,
297
+ isTypeOnly: true
298
+ })
299
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
300
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
301
+ name: ["fetch"],
302
+ root: query.file.path,
303
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
304
+ }),
305
+ /* @__PURE__ */ jsx(File.Import, {
306
+ name: [
307
+ "Client",
308
+ "RequestConfig",
309
+ "ResponseErrorConfig"
310
+ ],
311
+ root: query.file.path,
312
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
313
+ isTypeOnly: true
314
+ }),
315
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
316
+ name: ["ResponseConfig"],
317
+ root: query.file.path,
318
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
319
+ isTypeOnly: true
320
+ })
321
+ ] }),
322
+ shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
323
+ name: [client.name],
324
+ root: query.file.path,
325
+ path: client.file.path
326
+ }),
327
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(File.Import, {
328
+ name: ["buildFormData"],
329
+ root: query.file.path,
330
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
331
+ }),
332
+ /* @__PURE__ */ jsx(File.Import, {
333
+ name: [
334
+ type.schemas.request?.name,
335
+ type.schemas.response.name,
336
+ type.schemas.pathParams?.name,
337
+ type.schemas.queryParams?.name,
338
+ type.schemas.headerParams?.name,
339
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
340
+ ].filter(Boolean),
341
+ root: query.file.path,
342
+ path: type.file.path,
343
+ isTypeOnly: true
344
+ }),
345
+ /* @__PURE__ */ jsx(QueryKey, {
346
+ name: queryKey.name,
347
+ typeName: queryKey.typeName,
348
+ operation,
349
+ paramsCasing: options.paramsCasing,
350
+ pathParamsType: options.pathParamsType,
351
+ typeSchemas: type.schemas,
352
+ transformer: options.queryKey
353
+ }),
354
+ !shouldUseClientPlugin && /* @__PURE__ */ jsx(Client, {
355
+ name: client.name,
356
+ baseURL: options.client.baseURL,
357
+ operation,
358
+ typeSchemas: type.schemas,
359
+ zodSchemas: zod.schemas,
360
+ dataReturnType: options.client.dataReturnType || "data",
361
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
362
+ paramsType: options.paramsType,
363
+ pathParamsType: options.pathParamsType,
364
+ parser: options.parser
365
+ }),
366
+ /* @__PURE__ */ jsx(File.Import, {
367
+ name: ["queryOptions"],
368
+ path: importPath
369
+ }),
370
+ /* @__PURE__ */ jsx(QueryOptions, {
371
+ name: queryOptions.name,
372
+ clientName: client.name,
373
+ queryKeyName: queryKey.name,
374
+ typeSchemas: type.schemas,
375
+ paramsCasing: options.paramsCasing,
376
+ paramsType: options.paramsType,
377
+ pathParamsType: options.pathParamsType,
378
+ dataReturnType: options.client.dataReturnType || "data"
379
+ }),
380
+ options.query && /* @__PURE__ */ jsxs(Fragment, { children: [
381
+ /* @__PURE__ */ jsx(File.Import, {
382
+ name: ["useQuery"],
383
+ path: importPath
384
+ }),
385
+ /* @__PURE__ */ jsx(File.Import, {
386
+ name: [
387
+ "QueryKey",
388
+ "QueryClient",
389
+ "UseBaseQueryOptions",
390
+ "UseQueryResult"
391
+ ],
392
+ path: importPath,
393
+ isTypeOnly: true
394
+ }),
395
+ /* @__PURE__ */ jsx(Query, {
396
+ name: query.name,
397
+ queryOptionsName: queryOptions.name,
398
+ typeSchemas: type.schemas,
399
+ paramsType: options.paramsType,
400
+ pathParamsType: options.pathParamsType,
401
+ operation,
402
+ paramsCasing: options.paramsCasing,
403
+ dataReturnType: options.client.dataReturnType || "data",
404
+ queryKeyName: queryKey.name,
405
+ queryKeyTypeName: queryKey.typeName
406
+ })
407
+ ] })
408
+ ]
409
+ });
410
+ }
411
+ });
412
+ //#endregion
413
+ export { mutationGenerator as n, queryGenerator as t };
414
+
415
+ //# sourceMappingURL=generators-CQClzsST.js.map
@@ -0,0 +1,145 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as MutationKey, i as QueryKey, o as camelCase, s as pascalCase } from "./components-BhStIi1M.js";
3
+ import { n as mutationGenerator, t as queryGenerator } from "./generators-CQClzsST.js";
4
+ import path from "node:path";
5
+ import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
6
+ import { pluginClientName } from "@kubb/plugin-client";
7
+ import { source } from "@kubb/plugin-client/templates/clients/axios.source";
8
+ import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
9
+ import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
+ import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
11
+ import { pluginTsName } from "@kubb/plugin-ts";
12
+ import { pluginZodName } from "@kubb/plugin-zod";
13
+ //#region src/plugin.ts
14
+ const pluginSolidQueryName = "plugin-solid-query";
15
+ const pluginSolidQuery = definePlugin((options) => {
16
+ const { output = {
17
+ path: "hooks",
18
+ barrelType: "named"
19
+ }, group, exclude = [], include, override = [], parser = "client", transformers = {}, paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", queryKey = QueryKey.getTransformer, generators = [queryGenerator, mutationGenerator].filter(Boolean), mutation = {}, query = {}, mutationKey = MutationKey.getTransformer, paramsCasing, contentType, client } = options;
20
+ const clientName = client?.client ?? "axios";
21
+ const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
22
+ return {
23
+ name: pluginSolidQueryName,
24
+ options: {
25
+ output,
26
+ client: {
27
+ bundle: client?.bundle,
28
+ baseURL: client?.baseURL,
29
+ client: clientName,
30
+ clientType: client?.clientType ?? "function",
31
+ dataReturnType: client?.dataReturnType ?? "data",
32
+ pathParamsType,
33
+ importPath: clientImportPath,
34
+ paramsCasing
35
+ },
36
+ queryKey,
37
+ query: query === false ? false : {
38
+ methods: ["get"],
39
+ importPath: "@tanstack/solid-query",
40
+ ...query
41
+ },
42
+ mutationKey,
43
+ mutation: mutation === false ? false : {
44
+ methods: [
45
+ "post",
46
+ "put",
47
+ "patch",
48
+ "delete"
49
+ ],
50
+ importPath: "@tanstack/solid-query",
51
+ ...mutation
52
+ },
53
+ paramsType,
54
+ pathParamsType,
55
+ parser,
56
+ group,
57
+ paramsCasing
58
+ },
59
+ pre: [
60
+ pluginOasName,
61
+ pluginTsName,
62
+ parser === "zod" ? pluginZodName : void 0
63
+ ].filter(Boolean),
64
+ resolvePath(baseName, pathMode, options) {
65
+ const root = path.resolve(this.config.root, this.config.output.path);
66
+ if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
67
+ /**
68
+ * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
69
+ * Other plugins then need to call addOrAppend instead of just add from the fileManager class
70
+ */
71
+ return path.resolve(root, output.path);
72
+ if (group && (options?.group?.path || options?.group?.tag)) {
73
+ const groupName = group?.name ? group.name : (ctx) => {
74
+ if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
75
+ return `${camelCase(ctx.group)}Controller`;
76
+ };
77
+ return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
78
+ }
79
+ return path.resolve(root, output.path, baseName);
80
+ },
81
+ resolveName(name, type) {
82
+ let resolvedName = camelCase(name);
83
+ if (type === "file" || type === "function") resolvedName = camelCase(name, { isFile: type === "file" });
84
+ if (type === "type") resolvedName = pascalCase(name);
85
+ if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
86
+ return resolvedName;
87
+ },
88
+ async install() {
89
+ const root = path.resolve(this.config.root, this.config.output.path);
90
+ const mode = getMode(path.resolve(root, output.path));
91
+ const oas = await this.getOas();
92
+ const baseURL = await this.getBaseURL();
93
+ if (baseURL) this.plugin.options.client.baseURL = baseURL;
94
+ const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName]);
95
+ if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.upsertFile({
96
+ baseName: "fetch.ts",
97
+ path: path.resolve(root, ".kubb/fetch.ts"),
98
+ sources: [{
99
+ name: "fetch",
100
+ value: this.plugin.options.client.client === "fetch" ? source$1 : source,
101
+ isExportable: true,
102
+ isIndexable: true
103
+ }],
104
+ imports: [],
105
+ exports: []
106
+ });
107
+ if (!hasClientPlugin) await this.addFile({
108
+ baseName: "config.ts",
109
+ path: path.resolve(root, ".kubb/config.ts"),
110
+ sources: [{
111
+ name: "config",
112
+ value: source$2,
113
+ isExportable: false,
114
+ isIndexable: false
115
+ }],
116
+ imports: [],
117
+ exports: []
118
+ });
119
+ const files = await new OperationGenerator(this.plugin.options, {
120
+ fabric: this.fabric,
121
+ oas,
122
+ pluginManager: this.pluginManager,
123
+ events: this.events,
124
+ plugin: this.plugin,
125
+ contentType,
126
+ exclude,
127
+ include,
128
+ override,
129
+ mode
130
+ }).build(...generators);
131
+ await this.upsertFile(...files);
132
+ const barrelFiles = await getBarrelFiles(this.fabric.files, {
133
+ type: output.barrelType ?? "named",
134
+ root,
135
+ output,
136
+ meta: { pluginKey: this.plugin.key }
137
+ });
138
+ await this.upsertFile(...barrelFiles);
139
+ }
140
+ };
141
+ });
142
+ //#endregion
143
+ export { pluginSolidQuery, pluginSolidQueryName };
144
+
145
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,113 @@
1
+ {
2
+ "name": "@kubb/plugin-solid-query",
3
+ "version": "4.37.2",
4
+ "description": "Solid Query hooks generator plugin for Kubb, creating type-safe API client hooks from OpenAPI specifications for Solid.js applications.",
5
+ "keywords": [
6
+ "solid-query",
7
+ "solid-js",
8
+ "solid",
9
+ "tanstack-query",
10
+ "primitives",
11
+ "hooks",
12
+ "data-fetching",
13
+ "api-client",
14
+ "sdk-generator",
15
+ "typescript",
16
+ "type-safe",
17
+ "openapi",
18
+ "swagger",
19
+ "oas",
20
+ "code-generator",
21
+ "codegen",
22
+ "plugins",
23
+ "kubb"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/kubb-labs/kubb.git",
28
+ "directory": "packages/plugin-solid-query"
29
+ },
30
+ "license": "MIT",
31
+ "author": "stijnvanhulle",
32
+ "sideEffects": false,
33
+ "type": "module",
34
+ "exports": {
35
+ ".": {
36
+ "import": "./dist/index.js",
37
+ "require": "./dist/index.cjs"
38
+ },
39
+ "./components": {
40
+ "import": "./dist/components.js",
41
+ "require": "./dist/components.cjs"
42
+ },
43
+ "./generators": {
44
+ "import": "./dist/generators.js",
45
+ "require": "./dist/generators.cjs"
46
+ },
47
+ "./package.json": "./package.json"
48
+ },
49
+ "types": "./dist/index.d.ts",
50
+ "typesVersions": {
51
+ "*": {
52
+ "components": [
53
+ "./dist/components.d.ts"
54
+ ],
55
+ "generators": [
56
+ "./dist/generators.d.ts"
57
+ ]
58
+ }
59
+ },
60
+ "files": [
61
+ "src",
62
+ "dist",
63
+ "!/**/**.test.**",
64
+ "!/**/__tests__/**",
65
+ "!/**/__snapshots__/**"
66
+ ],
67
+ "size-limit": [
68
+ {
69
+ "path": "./dist/*.js",
70
+ "limit": "510 KiB",
71
+ "gzip": true
72
+ }
73
+ ],
74
+ "dependencies": {
75
+ "@kubb/fabric-core": "0.14.0",
76
+ "@kubb/react-fabric": "0.14.0",
77
+ "remeda": "^2.33.6",
78
+ "@kubb/core": "4.37.2",
79
+ "@kubb/oas": "4.37.2",
80
+ "@kubb/plugin-client": "4.37.2",
81
+ "@kubb/plugin-oas": "4.37.2",
82
+ "@kubb/plugin-ts": "4.37.2",
83
+ "@kubb/plugin-zod": "4.37.2"
84
+ },
85
+ "peerDependencies": {
86
+ "@kubb/fabric-core": "0.14.0",
87
+ "@kubb/react-fabric": "0.14.0"
88
+ },
89
+ "engines": {
90
+ "node": ">=20"
91
+ },
92
+ "publishConfig": {
93
+ "access": "public",
94
+ "registry": "https://registry.npmjs.org/"
95
+ },
96
+ "main": "./dist/index.cjs",
97
+ "module": "./dist/index.js",
98
+ "devDependencies": {
99
+ "@internals/tanstack-query": "0.0.0",
100
+ "@internals/utils": "0.0.0"
101
+ },
102
+ "scripts": {
103
+ "build": "tsdown && size-limit",
104
+ "clean": "npx rimraf ./dist",
105
+ "lint": "bun biome lint .",
106
+ "lint:fix": "bun biome lint --fix --unsafe .",
107
+ "release": "pnpm publish --no-git-check",
108
+ "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
109
+ "start": "tsdown --watch",
110
+ "test": "vitest --passWithNoTests",
111
+ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
112
+ }
113
+ }
@@ -0,0 +1,8 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ //#endregion
8
+ export { __name as t };