@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,2 @@
1
+ import { n as pluginTsName, t as pluginTs } from "./plugin-CYC-FGXe.js";
2
+ export { pluginTs, pluginTsName };
@@ -0,0 +1,479 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { a as createTypeAliasDeclaration, c as createTypeReferenceNode, d as getUnknownType, f as keywordTypeNodes, h as pascalCase, i as createPropertySignature, l as createUnionDeclaration, m as camelCase, n as createIdentifier, o as createTypeLiteralNode, p as modifiers, r as createIndexedAccessTypeNode, s as createTypeOperatorNode, t as Type, u as createUrlTemplateType } from "./components-C7fu-sK1.js";
3
+ import path from "node:path";
4
+ import { walk } from "@kubb/ast";
5
+ import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
6
+ import { OperationGenerator, SchemaGenerator, buildSchema, isKeyword, pluginOasName, schemaKeywords } from "@kubb/plugin-oas";
7
+ import { useMode, usePluginManager } from "@kubb/core/hooks";
8
+ import { safePrint } from "@kubb/fabric-core/parsers/typescript";
9
+ import { createReactGenerator } from "@kubb/plugin-oas/generators";
10
+ import { useOas, useOperationManager, useSchemaManager } from "@kubb/plugin-oas/hooks";
11
+ import { applyParamsCasing, getBanner, getFooter, getImports, isParameterSchema } from "@kubb/plugin-oas/utils";
12
+ import { File } from "@kubb/react-fabric";
13
+ import ts from "typescript";
14
+ import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
15
+ //#region src/generators/typeGenerator.tsx
16
+ function printCombinedSchema({ name, schemas, pluginManager }) {
17
+ const properties = {};
18
+ if (schemas.response) properties["response"] = createUnionDeclaration({ nodes: schemas.responses.map((res) => {
19
+ return createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
20
+ name: res.name,
21
+ pluginKey: [pluginTsName],
22
+ type: "function"
23
+ })), void 0);
24
+ }) });
25
+ if (schemas.request) properties["request"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
26
+ name: schemas.request.name,
27
+ pluginKey: [pluginTsName],
28
+ type: "function"
29
+ })), void 0);
30
+ if (schemas.pathParams) properties["pathParams"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
31
+ name: schemas.pathParams.name,
32
+ pluginKey: [pluginTsName],
33
+ type: "function"
34
+ })), void 0);
35
+ if (schemas.queryParams) properties["queryParams"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
36
+ name: schemas.queryParams.name,
37
+ pluginKey: [pluginTsName],
38
+ type: "function"
39
+ })), void 0);
40
+ if (schemas.headerParams) properties["headerParams"] = createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
41
+ name: schemas.headerParams.name,
42
+ pluginKey: [pluginTsName],
43
+ type: "function"
44
+ })), void 0);
45
+ if (schemas.errors) properties["errors"] = createUnionDeclaration({ nodes: schemas.errors.map((error) => {
46
+ return createTypeReferenceNode(createIdentifier(pluginManager.resolveName({
47
+ name: error.name,
48
+ pluginKey: [pluginTsName],
49
+ type: "function"
50
+ })), void 0);
51
+ }) });
52
+ return safePrint(createTypeAliasDeclaration({
53
+ name,
54
+ type: createTypeLiteralNode(Object.keys(properties).map((key) => {
55
+ const type = properties[key];
56
+ if (!type) return;
57
+ return createPropertySignature({
58
+ name: pascalCase(key),
59
+ type
60
+ });
61
+ }).filter(Boolean)),
62
+ modifiers: [modifiers.export]
63
+ }));
64
+ }
65
+ function printRequestSchema({ baseName, operation, schemas, pluginManager }) {
66
+ const name = pluginManager.resolveName({
67
+ name: `${baseName} Request`,
68
+ pluginKey: [pluginTsName],
69
+ type: "type"
70
+ });
71
+ const results = [];
72
+ const dataRequestProperties = [];
73
+ if (schemas.request) {
74
+ const identifier = pluginManager.resolveName({
75
+ name: schemas.request.name,
76
+ pluginKey: [pluginTsName],
77
+ type: "type"
78
+ });
79
+ dataRequestProperties.push(createPropertySignature({
80
+ name: "data",
81
+ questionToken: true,
82
+ type: createTypeReferenceNode(createIdentifier(identifier), void 0)
83
+ }));
84
+ } else dataRequestProperties.push(createPropertySignature({
85
+ name: "data",
86
+ questionToken: true,
87
+ type: keywordTypeNodes.never
88
+ }));
89
+ if (schemas.pathParams) {
90
+ const identifier = pluginManager.resolveName({
91
+ name: schemas.pathParams.name,
92
+ pluginKey: [pluginTsName],
93
+ type: "type"
94
+ });
95
+ dataRequestProperties.push(createPropertySignature({
96
+ name: "pathParams",
97
+ type: createTypeReferenceNode(createIdentifier(identifier), void 0)
98
+ }));
99
+ } else dataRequestProperties.push(createPropertySignature({
100
+ name: "pathParams",
101
+ questionToken: true,
102
+ type: keywordTypeNodes.never
103
+ }));
104
+ if (schemas.queryParams) {
105
+ const identifier = pluginManager.resolveName({
106
+ name: schemas.queryParams.name,
107
+ pluginKey: [pluginTsName],
108
+ type: "type"
109
+ });
110
+ dataRequestProperties.push(createPropertySignature({
111
+ name: "queryParams",
112
+ questionToken: true,
113
+ type: createTypeReferenceNode(createIdentifier(identifier), void 0)
114
+ }));
115
+ } else dataRequestProperties.push(createPropertySignature({
116
+ name: "queryParams",
117
+ questionToken: true,
118
+ type: keywordTypeNodes.never
119
+ }));
120
+ if (schemas.headerParams) {
121
+ const identifier = pluginManager.resolveName({
122
+ name: schemas.headerParams.name,
123
+ pluginKey: [pluginTsName],
124
+ type: "type"
125
+ });
126
+ dataRequestProperties.push(createPropertySignature({
127
+ name: "headerParams",
128
+ questionToken: true,
129
+ type: createTypeReferenceNode(createIdentifier(identifier), void 0)
130
+ }));
131
+ } else dataRequestProperties.push(createPropertySignature({
132
+ name: "headerParams",
133
+ questionToken: true,
134
+ type: keywordTypeNodes.never
135
+ }));
136
+ dataRequestProperties.push(createPropertySignature({
137
+ name: "url",
138
+ type: createUrlTemplateType(operation.path)
139
+ }));
140
+ const dataRequestNode = createTypeAliasDeclaration({
141
+ name,
142
+ type: createTypeLiteralNode(dataRequestProperties),
143
+ modifiers: [modifiers.export]
144
+ });
145
+ results.push(safePrint(dataRequestNode));
146
+ return results.join("\n\n");
147
+ }
148
+ function printResponseSchema({ baseName, schemas, pluginManager, unknownType }) {
149
+ const results = [];
150
+ const name = pluginManager.resolveName({
151
+ name: `${baseName} ResponseData`,
152
+ pluginKey: [pluginTsName],
153
+ type: "type"
154
+ });
155
+ if (schemas.responses && schemas.responses.length > 0) {
156
+ const responsesProperties = schemas.responses.map((res) => {
157
+ const identifier = pluginManager.resolveName({
158
+ name: res.name,
159
+ pluginKey: [pluginTsName],
160
+ type: "type"
161
+ });
162
+ return createPropertySignature({
163
+ name: res.statusCode?.toString() ?? "default",
164
+ type: createTypeReferenceNode(createIdentifier(identifier), void 0)
165
+ });
166
+ });
167
+ const responsesNode = createTypeAliasDeclaration({
168
+ name: `${baseName}Responses`,
169
+ type: createTypeLiteralNode(responsesProperties),
170
+ modifiers: [modifiers.export]
171
+ });
172
+ results.push(safePrint(responsesNode));
173
+ const responseNode = createTypeAliasDeclaration({
174
+ name,
175
+ type: createIndexedAccessTypeNode(createTypeReferenceNode(createIdentifier(`${baseName}Responses`), void 0), createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, createTypeReferenceNode(createIdentifier(`${baseName}Responses`), void 0))),
176
+ modifiers: [modifiers.export]
177
+ });
178
+ results.push(safePrint(responseNode));
179
+ } else {
180
+ const responseNode = createTypeAliasDeclaration({
181
+ name,
182
+ modifiers: [modifiers.export],
183
+ type: getUnknownType(unknownType)
184
+ });
185
+ results.push(safePrint(responseNode));
186
+ }
187
+ return results.join("\n\n");
188
+ }
189
+ const typeGenerator = createReactGenerator({
190
+ name: "typescript",
191
+ version: "1",
192
+ Operation({ operation, generator, plugin }) {
193
+ const { options, options: { mapper, enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, unknownType, paramsCasing } } = plugin;
194
+ const mode = useMode();
195
+ const pluginManager = usePluginManager();
196
+ const oas = useOas();
197
+ const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator);
198
+ const schemaManager = useSchemaManager();
199
+ const name = getName(operation, {
200
+ type: "type",
201
+ pluginKey: [pluginTsName]
202
+ });
203
+ const file = getFile(operation);
204
+ const schemas = getSchemas(operation);
205
+ const schemaGenerator = new SchemaGenerator(options, {
206
+ fabric: generator.context.fabric,
207
+ oas,
208
+ events: generator.context.events,
209
+ plugin,
210
+ pluginManager,
211
+ mode,
212
+ override: options.override
213
+ });
214
+ const operationSchemas = [
215
+ schemas.pathParams,
216
+ schemas.queryParams,
217
+ schemas.headerParams,
218
+ schemas.statusCodes,
219
+ schemas.request,
220
+ schemas.response
221
+ ].flat().filter(Boolean);
222
+ const mapOperationSchema = ({ name, schema, description, keysToOmit, ...options }) => {
223
+ const transformedSchema = paramsCasing && isParameterSchema(name) ? applyParamsCasing(schema, paramsCasing) : schema;
224
+ const tree = schemaGenerator.parse({
225
+ schema: transformedSchema,
226
+ name,
227
+ parentName: null
228
+ });
229
+ const imports = getImports(tree);
230
+ const group = options.operation ? getGroup(options.operation) : void 0;
231
+ const type = {
232
+ name: schemaManager.getName(name, { type: "type" }),
233
+ typedName: schemaManager.getName(name, { type: "type" }),
234
+ file: schemaManager.getFile(options.operationName || name, { group })
235
+ };
236
+ return /* @__PURE__ */ jsxs(Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
237
+ root: file.path,
238
+ path: imp.path,
239
+ name: imp.name,
240
+ isTypeOnly: true
241
+ }, [
242
+ name,
243
+ imp.name,
244
+ imp.path,
245
+ imp.isTypeOnly
246
+ ].join("-"))), /* @__PURE__ */ jsx(Type, {
247
+ name: type.name,
248
+ typedName: type.typedName,
249
+ description,
250
+ tree,
251
+ schema: transformedSchema,
252
+ mapper,
253
+ enumType,
254
+ enumTypeSuffix,
255
+ enumKeyCasing,
256
+ optionalType,
257
+ arrayType,
258
+ keysToOmit,
259
+ syntaxType
260
+ })] });
261
+ };
262
+ const responseName = schemaManager.getName(schemas.response.name, { type: "type" });
263
+ const combinedSchemaName = operation.method === "get" ? `${name}Query` : `${name}Mutation`;
264
+ return /* @__PURE__ */ jsxs(File, {
265
+ baseName: file.baseName,
266
+ path: file.path,
267
+ meta: file.meta,
268
+ banner: getBanner({
269
+ oas,
270
+ output: plugin.options.output,
271
+ config: pluginManager.config
272
+ }),
273
+ footer: getFooter({
274
+ oas,
275
+ output: plugin.options.output
276
+ }),
277
+ children: [operationSchemas.map(mapOperationSchema), generator.context.UNSTABLE_NAMING ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(File.Source, {
278
+ name: `${name}Request`,
279
+ isExportable: true,
280
+ isIndexable: true,
281
+ isTypeOnly: true,
282
+ children: printRequestSchema({
283
+ baseName: name,
284
+ operation,
285
+ schemas,
286
+ pluginManager
287
+ })
288
+ }), /* @__PURE__ */ jsx(File.Source, {
289
+ name: responseName,
290
+ isExportable: true,
291
+ isIndexable: true,
292
+ isTypeOnly: true,
293
+ children: printResponseSchema({
294
+ baseName: name,
295
+ schemas,
296
+ pluginManager,
297
+ unknownType
298
+ })
299
+ })] }) : /* @__PURE__ */ jsx(File.Source, {
300
+ name: combinedSchemaName,
301
+ isExportable: true,
302
+ isIndexable: true,
303
+ isTypeOnly: true,
304
+ children: printCombinedSchema({
305
+ name: combinedSchemaName,
306
+ schemas,
307
+ pluginManager
308
+ })
309
+ })]
310
+ });
311
+ },
312
+ Schema({ schema, plugin }) {
313
+ const { options: { mapper, enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output } } = plugin;
314
+ const mode = useMode();
315
+ const oas = useOas();
316
+ const pluginManager = usePluginManager();
317
+ const { getName, getFile } = useSchemaManager();
318
+ const imports = getImports(schema.tree);
319
+ const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema);
320
+ let typedName = getName(schema.name, { type: "type" });
321
+ if (["asConst", "asPascalConst"].includes(enumType) && schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.enum)) typedName += enumTypeSuffix;
322
+ const type = {
323
+ name: getName(schema.name, { type: "function" }),
324
+ typedName,
325
+ file: getFile(schema.name)
326
+ };
327
+ return /* @__PURE__ */ jsxs(File, {
328
+ baseName: type.file.baseName,
329
+ path: type.file.path,
330
+ meta: type.file.meta,
331
+ banner: getBanner({
332
+ oas,
333
+ output,
334
+ config: pluginManager.config
335
+ }),
336
+ footer: getFooter({
337
+ oas,
338
+ output
339
+ }),
340
+ children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ jsx(File.Import, {
341
+ root: type.file.path,
342
+ path: imp.path,
343
+ name: imp.name,
344
+ isTypeOnly: true
345
+ }, [
346
+ schema.name,
347
+ imp.path,
348
+ imp.isTypeOnly
349
+ ].join("-"))), /* @__PURE__ */ jsx(Type, {
350
+ name: type.name,
351
+ typedName: type.typedName,
352
+ description: schema.value.description,
353
+ tree: schema.tree,
354
+ schema: schema.value,
355
+ mapper,
356
+ enumType,
357
+ enumTypeSuffix,
358
+ enumKeyCasing,
359
+ optionalType,
360
+ arrayType,
361
+ syntaxType
362
+ })]
363
+ });
364
+ }
365
+ });
366
+ //#endregion
367
+ //#region src/plugin.ts
368
+ const pluginTsName = "plugin-ts";
369
+ const pluginTs = definePlugin((options) => {
370
+ const { output = {
371
+ path: "types",
372
+ barrelType: "named"
373
+ }, group, exclude = [], include, override = [], enumType = "asConst", enumTypeSuffix = "Key", enumKeyCasing = "none", enumSuffix = "enum", dateType = "string", integerType = "number", unknownType = "any", optionalType = "questionToken", arrayType = "array", emptySchemaType = unknownType, syntaxType = "type", transformers = {}, mapper = {}, paramsCasing, generators = [typeGenerator].filter(Boolean), contentType, UNSTABLE_NAMING } = options;
374
+ return {
375
+ name: pluginTsName,
376
+ options: {
377
+ output,
378
+ transformers,
379
+ dateType,
380
+ integerType,
381
+ optionalType,
382
+ arrayType,
383
+ enumType,
384
+ enumTypeSuffix,
385
+ enumKeyCasing,
386
+ enumSuffix,
387
+ unknownType,
388
+ emptySchemaType,
389
+ syntaxType,
390
+ group,
391
+ override,
392
+ mapper,
393
+ paramsCasing,
394
+ usedEnumNames: {}
395
+ },
396
+ pre: [pluginOasName],
397
+ resolvePath(baseName, pathMode, options) {
398
+ const root = path.resolve(this.config.root, this.config.output.path);
399
+ if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
400
+ /**
401
+ * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
402
+ * Other plugins then need to call addOrAppend instead of just add from the fileManager class
403
+ */
404
+ return path.resolve(root, output.path);
405
+ if (group && (options?.group?.path || options?.group?.tag)) {
406
+ const groupName = group?.name ? group.name : (ctx) => {
407
+ if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
408
+ return `${camelCase(ctx.group)}Controller`;
409
+ };
410
+ return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
411
+ }
412
+ return path.resolve(root, output.path, baseName);
413
+ },
414
+ resolveName(name, type) {
415
+ const resolvedName = pascalCase(name, { isFile: type === "file" });
416
+ if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
417
+ return resolvedName;
418
+ },
419
+ async install() {
420
+ const { config, fabric, plugin } = this;
421
+ const root = path.resolve(config.root, config.output.path);
422
+ const mode = getMode(path.resolve(root, output.path));
423
+ if (this.rootNode) {
424
+ await this.openInStudio({ ast: true });
425
+ await walk(this.rootNode, { async schema(schemaNode) {
426
+ await generators.map(async (generator) => {
427
+ if (generator.type === "react" && generator.version === "2") await buildSchema(schemaNode, {
428
+ config,
429
+ fabric,
430
+ Component: generator.Schema,
431
+ plugin,
432
+ version: generator.version
433
+ });
434
+ });
435
+ } }, { depth: "shallow" });
436
+ return;
437
+ }
438
+ const oas = await this.getOas();
439
+ const schemaFiles = await new SchemaGenerator(this.plugin.options, {
440
+ fabric: this.fabric,
441
+ oas,
442
+ pluginManager: this.pluginManager,
443
+ events: this.events,
444
+ plugin: this.plugin,
445
+ contentType,
446
+ include: void 0,
447
+ override,
448
+ mode,
449
+ output: output.path
450
+ }).build(...generators);
451
+ await this.upsertFile(...schemaFiles);
452
+ const operationFiles = await new OperationGenerator(this.plugin.options, {
453
+ fabric: this.fabric,
454
+ oas,
455
+ pluginManager: this.pluginManager,
456
+ events: this.events,
457
+ plugin: this.plugin,
458
+ contentType,
459
+ exclude,
460
+ include,
461
+ override,
462
+ mode,
463
+ UNSTABLE_NAMING
464
+ }).build(...generators);
465
+ await this.upsertFile(...operationFiles);
466
+ const barrelFiles = await getBarrelFiles(this.fabric.files, {
467
+ type: output.barrelType ?? "named",
468
+ root,
469
+ output,
470
+ meta: { pluginKey: this.plugin.key }
471
+ });
472
+ await this.upsertFile(...barrelFiles);
473
+ }
474
+ };
475
+ });
476
+ //#endregion
477
+ export { pluginTsName as n, typeGenerator as r, pluginTs as t };
478
+
479
+ //# sourceMappingURL=plugin-CYC-FGXe.js.map
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "@kubb/plugin-ts",
3
+ "version": "4.37.2",
4
+ "description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
5
+ "keywords": [
6
+ "typescript",
7
+ "types",
8
+ "type-generation",
9
+ "interfaces",
10
+ "type-definitions",
11
+ "type-safe",
12
+ "openapi",
13
+ "swagger",
14
+ "oas",
15
+ "code-generator",
16
+ "codegen",
17
+ "plugins",
18
+ "kubb"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/kubb-labs/kubb.git",
23
+ "directory": "packages/plugin-ts"
24
+ },
25
+ "license": "MIT",
26
+ "author": "stijnvanhulle",
27
+ "sideEffects": false,
28
+ "type": "module",
29
+ "exports": {
30
+ ".": {
31
+ "import": "./dist/index.js",
32
+ "require": "./dist/index.cjs"
33
+ },
34
+ "./components": {
35
+ "import": "./dist/components.js",
36
+ "require": "./dist/components.cjs"
37
+ },
38
+ "./generators": {
39
+ "import": "./dist/generators.js",
40
+ "require": "./dist/generators.cjs"
41
+ },
42
+ "./package.json": "./package.json"
43
+ },
44
+ "types": "./dist/index.d.ts",
45
+ "typesVersions": {
46
+ "*": {
47
+ "components": [
48
+ "./dist/components.d.ts"
49
+ ],
50
+ "generators": [
51
+ "./dist/generators.d.ts"
52
+ ]
53
+ }
54
+ },
55
+ "files": [
56
+ "src",
57
+ "dist",
58
+ "!/**/**.test.**",
59
+ "!/**/__tests__/**",
60
+ "!/**/__snapshots__/**"
61
+ ],
62
+ "size-limit": [
63
+ {
64
+ "path": "./dist/*.js",
65
+ "limit": "510 KiB",
66
+ "gzip": true
67
+ }
68
+ ],
69
+ "dependencies": {
70
+ "@kubb/fabric-core": "0.14.0",
71
+ "@kubb/react-fabric": "0.14.0",
72
+ "remeda": "^2.33.6",
73
+ "typescript": "5.9.3",
74
+ "@kubb/core": "4.37.2",
75
+ "@kubb/oas": "4.37.2",
76
+ "@kubb/plugin-oas": "4.37.2",
77
+ "@kubb/ast": "4.37.2"
78
+ },
79
+ "peerDependencies": {
80
+ "@kubb/react-fabric": "0.14.0"
81
+ },
82
+ "engines": {
83
+ "node": ">=20"
84
+ },
85
+ "publishConfig": {
86
+ "access": "public",
87
+ "registry": "https://registry.npmjs.org/"
88
+ },
89
+ "main": "./dist/index.cjs",
90
+ "module": "./dist/index.js",
91
+ "devDependencies": {
92
+ "@internals/utils": "0.0.0"
93
+ },
94
+ "scripts": {
95
+ "build": "tsdown && size-limit",
96
+ "clean": "npx rimraf ./dist",
97
+ "lint": "bun biome lint .",
98
+ "lint:fix": "bun biome lint --fix --unsafe .",
99
+ "release": "pnpm publish --no-git-check",
100
+ "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
101
+ "start": "tsdown --watch",
102
+ "test": "vitest --passWithNoTests",
103
+ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
104
+ }
105
+ }
@@ -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 };