@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,79 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { n as getBanner, r as camelCase, t as getFooter } from "./getFooter-Pw3tLCiV.js";
3
+ //#region src/generators/createGenerator.ts
4
+ function createGenerator(generator) {
5
+ return {
6
+ type: "core",
7
+ version: generator.version ?? "1",
8
+ async operations() {
9
+ return [];
10
+ },
11
+ async operation() {
12
+ return [];
13
+ },
14
+ async schema() {
15
+ return [];
16
+ },
17
+ ...generator
18
+ };
19
+ }
20
+ //#endregion
21
+ //#region src/generators/createReactGenerator.ts
22
+ /****
23
+ * Creates a generator that uses React component functions to generate files for OpenAPI operations and schemas.
24
+ *
25
+ * The returned generator exposes async methods for generating files from operations, a single operation, or a schema, using the corresponding React components if provided. If a component is not defined, the method returns an empty array.
26
+ *
27
+ * @returns A generator object with async methods for operations, operation, and schema file generation.
28
+ */
29
+ function createReactGenerator(generator) {
30
+ return {
31
+ type: "react",
32
+ version: generator.version ?? "1",
33
+ Operations() {
34
+ return null;
35
+ },
36
+ Operation() {
37
+ return null;
38
+ },
39
+ Schema() {
40
+ return null;
41
+ },
42
+ ...generator
43
+ };
44
+ }
45
+ //#endregion
46
+ //#region src/generators/jsonGenerator.ts
47
+ const jsonGenerator = createGenerator({
48
+ name: "plugin-oas",
49
+ async schema({ schema, generator }) {
50
+ const { pluginManager, plugin } = generator.context;
51
+ return [{
52
+ ...pluginManager.getFile({
53
+ name: camelCase(schema.name),
54
+ extname: ".json",
55
+ mode: "split",
56
+ pluginKey: plugin.key
57
+ }),
58
+ sources: [{
59
+ name: camelCase(schema.name),
60
+ isExportable: false,
61
+ isIndexable: false,
62
+ value: JSON.stringify(schema.value)
63
+ }],
64
+ banner: getBanner({
65
+ oas: generator.context.oas,
66
+ output: plugin.options.output,
67
+ config: pluginManager.config
68
+ }),
69
+ format: getFooter({
70
+ oas: generator.context.oas,
71
+ output: plugin.options.output
72
+ })
73
+ }];
74
+ }
75
+ });
76
+ //#endregion
77
+ export { createReactGenerator as n, createGenerator as r, jsonGenerator as t };
78
+
79
+ //# sourceMappingURL=generators-D7C3CXsN.js.map
@@ -0,0 +1,2 @@
1
+ import { n as createReactGenerator, r as createGenerator, t as jsonGenerator } from "./generators-D7C3CXsN.js";
2
+ export { createGenerator, createReactGenerator, jsonGenerator };
@@ -0,0 +1,112 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import path from "node:path";
3
+ import { isFunction } from "remeda";
4
+ //#region ../../internals/utils/src/casing.ts
5
+ /**
6
+ * Shared implementation for camelCase and PascalCase conversion.
7
+ * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
8
+ * and capitalizes each word according to `pascal`.
9
+ *
10
+ * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
11
+ */
12
+ function toCamelOrPascal(text, pascal) {
13
+ return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
14
+ if (word.length > 1 && word === word.toUpperCase()) return word;
15
+ if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
16
+ return word.charAt(0).toUpperCase() + word.slice(1);
17
+ }).join("").replace(/[^a-zA-Z0-9]/g, "");
18
+ }
19
+ /**
20
+ * Splits `text` on `.` and applies `transformPart` to each segment.
21
+ * The last segment receives `isLast = true`, all earlier segments receive `false`.
22
+ * Segments are joined with `/` to form a file path.
23
+ */
24
+ function applyToFileParts(text, transformPart) {
25
+ const parts = text.split(".");
26
+ return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
27
+ }
28
+ /**
29
+ * Converts `text` to camelCase.
30
+ * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
31
+ *
32
+ * @example
33
+ * camelCase('hello-world') // 'helloWorld'
34
+ * camelCase('pet.petId', { isFile: true }) // 'pet/petId'
35
+ */
36
+ function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
37
+ if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
38
+ prefix,
39
+ suffix
40
+ } : {}));
41
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
42
+ }
43
+ /**
44
+ * Converts `text` to PascalCase.
45
+ * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.
46
+ *
47
+ * @example
48
+ * pascalCase('hello-world') // 'HelloWorld'
49
+ * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'
50
+ */
51
+ function pascalCase(text, { isFile, prefix = "", suffix = "" } = {}) {
52
+ if (isFile) return applyToFileParts(text, (part, isLast) => isLast ? pascalCase(part, {
53
+ prefix,
54
+ suffix
55
+ }) : camelCase(part));
56
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true);
57
+ }
58
+ //#endregion
59
+ //#region src/utils/getBanner.ts
60
+ /**
61
+ * Generate a default banner for files created by Kubb
62
+ * @returns A string with the default banner
63
+ */
64
+ function getDefaultBanner({ title, description, version, config }) {
65
+ try {
66
+ let source = "";
67
+ if ("path" in config.input) source = path.basename(config.input.path);
68
+ else if ("data" in config.input) source = "text content";
69
+ let banner = "/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n";
70
+ if (config.output.defaultBanner === "simple") {
71
+ banner += "*/\n";
72
+ return banner;
73
+ }
74
+ if (source) banner += `* Source: ${source}\n`;
75
+ if (title) banner += `* Title: ${title}\n`;
76
+ if (description) {
77
+ const formattedDescription = description.replace(/\n/gm, "\n* ");
78
+ banner += `* Description: ${formattedDescription}\n`;
79
+ }
80
+ if (version) banner += `* OpenAPI spec version: ${version}\n`;
81
+ banner += "*/\n";
82
+ return banner;
83
+ } catch (_error) {
84
+ return "/**\n* Generated by Kubb (https://kubb.dev/).\n* Do not edit manually.\n*/";
85
+ }
86
+ }
87
+ function getBanner({ output, oas, config }) {
88
+ let banner = "";
89
+ if (config?.output?.defaultBanner !== false && config) {
90
+ const { title, description, version } = oas.api?.info || {};
91
+ banner = getDefaultBanner({
92
+ title,
93
+ description,
94
+ version,
95
+ config
96
+ });
97
+ }
98
+ if (!output.banner) return banner;
99
+ if (isFunction(output.banner)) return `${output.banner(oas)}\n${banner}`;
100
+ return `${output.banner}\n${banner}`;
101
+ }
102
+ //#endregion
103
+ //#region src/utils/getFooter.ts
104
+ function getFooter({ output, oas }) {
105
+ if (!output.footer) return;
106
+ if (isFunction(output.footer)) return output.footer(oas);
107
+ return output.footer;
108
+ }
109
+ //#endregion
110
+ export { pascalCase as i, getBanner as n, camelCase as r, getFooter as t };
111
+
112
+ //# sourceMappingURL=getFooter-Pw3tLCiV.js.map
@@ -0,0 +1,200 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { useFabric } from "@kubb/react-fabric";
3
+ import { usePlugin, usePluginManager } from "@kubb/core/hooks";
4
+ //#region src/hooks/useOas.ts
5
+ function useOas() {
6
+ const { meta } = useFabric();
7
+ return meta.oas;
8
+ }
9
+ //#endregion
10
+ //#region src/hooks/useOperationManager.ts
11
+ /**
12
+ * `useOperationManager` returns helper functions to get the operation file and operation name.
13
+ */
14
+ function useOperationManager(generator) {
15
+ const plugin = usePlugin();
16
+ const pluginManager = usePluginManager();
17
+ const getName = (operation, { prefix = "", suffix = "", pluginKey = plugin.key, type }) => {
18
+ return pluginManager.resolveName({
19
+ name: `${prefix} ${operation.getOperationId()} ${suffix}`,
20
+ pluginKey,
21
+ type
22
+ });
23
+ };
24
+ const getGroup = (operation) => {
25
+ return {
26
+ tag: operation.getTags().at(0)?.name,
27
+ path: operation.path
28
+ };
29
+ };
30
+ const getSchemas = (operation, params) => {
31
+ if (!generator) throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`);
32
+ return generator.getSchemas(operation, { resolveName: (name) => pluginManager.resolveName({
33
+ name,
34
+ pluginKey: params?.pluginKey,
35
+ type: params?.type
36
+ }) });
37
+ };
38
+ const getFile = (operation, { prefix, suffix, pluginKey = plugin.key, extname = ".ts" } = {}) => {
39
+ const name = getName(operation, {
40
+ type: "file",
41
+ pluginKey,
42
+ prefix,
43
+ suffix
44
+ });
45
+ const group = getGroup(operation);
46
+ const file = pluginManager.getFile({
47
+ name,
48
+ extname,
49
+ pluginKey,
50
+ options: {
51
+ type: "file",
52
+ pluginKey,
53
+ group
54
+ }
55
+ });
56
+ return {
57
+ ...file,
58
+ meta: {
59
+ ...file.meta,
60
+ name,
61
+ pluginKey,
62
+ group
63
+ }
64
+ };
65
+ };
66
+ const groupSchemasByName = (operation, { pluginKey = plugin.key, type }) => {
67
+ if (!generator) throw new Error(`useOperationManager: 'generator' parameter is required but was not provided`);
68
+ const schemas = generator.getSchemas(operation);
69
+ const errors = (schemas.errors || []).reduce((prev, acc) => {
70
+ if (!acc.statusCode) return prev;
71
+ prev[acc.statusCode] = pluginManager.resolveName({
72
+ name: acc.name,
73
+ pluginKey,
74
+ type
75
+ });
76
+ return prev;
77
+ }, {});
78
+ const responses = (schemas.responses || []).reduce((prev, acc) => {
79
+ if (!acc.statusCode) return prev;
80
+ prev[acc.statusCode] = pluginManager.resolveName({
81
+ name: acc.name,
82
+ pluginKey,
83
+ type
84
+ });
85
+ return prev;
86
+ }, {});
87
+ return {
88
+ request: schemas.request?.name ? pluginManager.resolveName({
89
+ name: schemas.request.name,
90
+ pluginKey,
91
+ type
92
+ }) : void 0,
93
+ parameters: {
94
+ path: schemas.pathParams?.name ? pluginManager.resolveName({
95
+ name: schemas.pathParams.name,
96
+ pluginKey,
97
+ type
98
+ }) : void 0,
99
+ query: schemas.queryParams?.name ? pluginManager.resolveName({
100
+ name: schemas.queryParams.name,
101
+ pluginKey,
102
+ type
103
+ }) : void 0,
104
+ header: schemas.headerParams?.name ? pluginManager.resolveName({
105
+ name: schemas.headerParams.name,
106
+ pluginKey,
107
+ type
108
+ }) : void 0
109
+ },
110
+ responses: {
111
+ ...responses,
112
+ ["default"]: pluginManager.resolveName({
113
+ name: schemas.response.name,
114
+ pluginKey,
115
+ type
116
+ }),
117
+ ...errors
118
+ },
119
+ errors
120
+ };
121
+ };
122
+ return {
123
+ getName,
124
+ getFile,
125
+ getSchemas,
126
+ groupSchemasByName,
127
+ getGroup
128
+ };
129
+ }
130
+ //#endregion
131
+ //#region src/hooks/useRootNode.ts
132
+ /**
133
+ * Returns the universal `@kubb/ast` `RootNode` produced by the configured adapter.
134
+ *
135
+ * Use this hook inside generator components when you want to consume the
136
+ * format-agnostic AST directly instead of going through `useOas()`.
137
+ *
138
+ * Returns `undefined` when no adapter was configured (legacy OAS-only mode).
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * function MyComponent() {
143
+ * const rootNode = useRootNode()
144
+ * if (!rootNode) return null
145
+ * return <>{rootNode.schemas.map(s => <Schema key={s.name} node={s} />)}</>
146
+ * }
147
+ * ```
148
+ */
149
+ function useRootNode() {
150
+ const { meta } = useFabric();
151
+ return meta.pluginManager?.rootNode;
152
+ }
153
+ //#endregion
154
+ //#region src/hooks/useSchemaManager.ts
155
+ /**
156
+ * `useSchemaManager` returns helper functions to get the schema file and schema name.
157
+ */
158
+ function useSchemaManager() {
159
+ const plugin = usePlugin();
160
+ const pluginManager = usePluginManager();
161
+ const getName = (name, { pluginKey = plugin.key, type }) => {
162
+ return pluginManager.resolveName({
163
+ name,
164
+ pluginKey,
165
+ type
166
+ });
167
+ };
168
+ const getFile = (name, { mode = "split", pluginKey = plugin.key, extname = ".ts", group } = {}) => {
169
+ const resolvedName = mode === "single" ? "" : getName(name, {
170
+ type: "file",
171
+ pluginKey
172
+ });
173
+ const file = pluginManager.getFile({
174
+ name: resolvedName,
175
+ extname,
176
+ pluginKey,
177
+ options: {
178
+ type: "file",
179
+ pluginKey,
180
+ group
181
+ }
182
+ });
183
+ return {
184
+ ...file,
185
+ meta: {
186
+ ...file.meta,
187
+ name: resolvedName,
188
+ pluginKey
189
+ }
190
+ };
191
+ };
192
+ return {
193
+ getName,
194
+ getFile
195
+ };
196
+ }
197
+ //#endregion
198
+ export { useOas, useOperationManager, useRootNode, useSchemaManager };
199
+
200
+ //# sourceMappingURL=hooks.js.map