@kubb/plugin-ts 5.0.0-alpha.21 → 5.0.0-alpha.22

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 (60) hide show
  1. package/dist/{Type-oFwUfkZv.cjs → Type-Bf8raoQX.cjs} +24 -31
  2. package/dist/Type-Bf8raoQX.cjs.map +1 -0
  3. package/dist/{Type-B6fo0gSk.js → Type-BpXxT4l_.js} +24 -31
  4. package/dist/Type-BpXxT4l_.js.map +1 -0
  5. package/dist/{builderTs-Cd3juc2G.cjs → builderTs-COUg3xtQ.cjs} +16 -1
  6. package/dist/builderTs-COUg3xtQ.cjs.map +1 -0
  7. package/dist/{builderTs-DausqHpc.js → builderTs-DPpkJKd1.js} +16 -1
  8. package/dist/builderTs-DPpkJKd1.js.map +1 -0
  9. package/dist/builders.cjs +1 -1
  10. package/dist/builders.d.ts +16 -1
  11. package/dist/builders.js +1 -1
  12. package/dist/components.cjs +1 -1
  13. package/dist/components.d.ts +5 -1
  14. package/dist/components.js +1 -1
  15. package/dist/{generators-ByK18qUn.js → generators-DFDut8o-.js} +15 -11
  16. package/dist/generators-DFDut8o-.js.map +1 -0
  17. package/dist/{generators-aSsiTfUO.cjs → generators-DKd7MYbx.cjs} +15 -11
  18. package/dist/generators-DKd7MYbx.cjs.map +1 -0
  19. package/dist/generators.cjs +1 -1
  20. package/dist/generators.d.ts +1 -1
  21. package/dist/generators.js +1 -1
  22. package/dist/index.cjs +40 -3
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +20 -1
  25. package/dist/index.js +40 -3
  26. package/dist/index.js.map +1 -1
  27. package/dist/{printerTs-CFXc_LpP.cjs → printerTs-BcHudagv.cjs} +2 -3
  28. package/dist/{printerTs-CFXc_LpP.cjs.map → printerTs-BcHudagv.cjs.map} +1 -1
  29. package/dist/{printerTs-BgZucv4T.js → printerTs-CMBCOuqd.js} +2 -3
  30. package/dist/{printerTs-BgZucv4T.js.map → printerTs-CMBCOuqd.js.map} +1 -1
  31. package/dist/printers.cjs +1 -1
  32. package/dist/printers.d.ts +7 -1
  33. package/dist/printers.js +1 -1
  34. package/dist/{resolverTsLegacy-DLl854-P.js → resolverTsLegacy-CPiqqsO6.js} +3 -3
  35. package/dist/resolverTsLegacy-CPiqqsO6.js.map +1 -0
  36. package/dist/{resolverTsLegacy-sJ16Iqrl.cjs → resolverTsLegacy-CuR9XbKk.cjs} +3 -3
  37. package/dist/resolverTsLegacy-CuR9XbKk.cjs.map +1 -0
  38. package/dist/resolvers.cjs +1 -1
  39. package/dist/resolvers.d.ts +1 -1
  40. package/dist/resolvers.js +1 -1
  41. package/dist/{types-BcyuFDn9.d.ts → types-CRtcZOCz.d.ts} +34 -4
  42. package/package.json +3 -3
  43. package/src/builders/builderTs.ts +15 -0
  44. package/src/components/Enum.tsx +15 -11
  45. package/src/components/Type.tsx +16 -3
  46. package/src/generators/typeGenerator.tsx +6 -3
  47. package/src/generators/typeGeneratorLegacy.tsx +6 -3
  48. package/src/plugin.ts +21 -0
  49. package/src/presets.ts +17 -0
  50. package/src/printers/printerTs.ts +11 -3
  51. package/src/resolvers/resolverTs.ts +2 -2
  52. package/src/types.ts +33 -3
  53. package/dist/Type-B6fo0gSk.js.map +0 -1
  54. package/dist/Type-oFwUfkZv.cjs.map +0 -1
  55. package/dist/builderTs-Cd3juc2G.cjs.map +0 -1
  56. package/dist/builderTs-DausqHpc.js.map +0 -1
  57. package/dist/generators-ByK18qUn.js.map +0 -1
  58. package/dist/generators-aSsiTfUO.cjs.map +0 -1
  59. package/dist/resolverTsLegacy-DLl854-P.js.map +0 -1
  60. package/dist/resolverTsLegacy-sJ16Iqrl.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
2
  const require_casing = require("./casing-DHfdqpLi.cjs");
3
- const require_printerTs = require("./printerTs-CFXc_LpP.cjs");
3
+ const require_printerTs = require("./printerTs-BcHudagv.cjs");
4
4
  let _kubb_ast = require("@kubb/ast");
5
5
  let _kubb_react_fabric = require("@kubb/react-fabric");
6
6
  let _kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
@@ -13,11 +13,11 @@ let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
13
13
  * valid TypeScript identifier. The resolver normalizes it; for inline enum
14
14
  * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
15
15
  */
16
- function getEnumNames({ node, enumType, resolver }) {
16
+ function getEnumNames({ node, enumType, enumTypeSuffix, resolver }) {
17
17
  const resolved = resolver.default(node.name, "type");
18
18
  return {
19
19
  enumName: enumType === "asPascalConst" ? resolved : require_casing.camelCase(node.name),
20
- typeName: require_printerTs.ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? `${resolved}Key` : resolved,
20
+ typeName: require_printerTs.ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolved,
21
21
  refName: resolved
22
22
  };
23
23
  }
@@ -32,10 +32,11 @@ function getEnumNames({ node, enumType, resolver }) {
32
32
  * The emitted `File.Source` nodes carry the resolved names so that the barrel
33
33
  * index picks up the correct export identifiers.
34
34
  */
35
- function Enum({ node, enumType, enumKeyCasing, resolver }) {
36
- const { enumName, typeName, refName } = getEnumNames({
35
+ function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }) {
36
+ const { enumName, typeName } = getEnumNames({
37
37
  node,
38
38
  enumType,
39
+ enumTypeSuffix,
39
40
  resolver
40
41
  });
41
42
  const [nameNode, typeNode] = require_printerTs.createEnumDeclaration({
@@ -45,34 +46,23 @@ function Enum({ node, enumType, enumKeyCasing, resolver }) {
45
46
  type: enumType,
46
47
  enumKeyCasing
47
48
  });
48
- const needsRefAlias = require_printerTs.ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && refName !== typeName;
49
- return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
50
- nameNode && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
51
- name: enumName,
52
- isExportable: true,
53
- isIndexable: true,
54
- isTypeOnly: false,
55
- children: (0, _kubb_fabric_core_parsers_typescript.safePrint)(nameNode)
56
- }),
57
- /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
58
- name: typeName,
59
- isIndexable: true,
60
- isExportable: require_printerTs.ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
61
- isTypeOnly: require_printerTs.ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
62
- children: (0, _kubb_fabric_core_parsers_typescript.safePrint)(typeNode)
63
- }),
64
- needsRefAlias && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
65
- name: refName,
66
- isExportable: true,
67
- isIndexable: true,
68
- isTypeOnly: true,
69
- children: `export type ${refName} = ${typeName}`
70
- })
71
- ] });
49
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [nameNode && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
50
+ name: enumName,
51
+ isExportable: true,
52
+ isIndexable: true,
53
+ isTypeOnly: false,
54
+ children: (0, _kubb_fabric_core_parsers_typescript.safePrint)(nameNode)
55
+ }), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
56
+ name: typeName,
57
+ isIndexable: true,
58
+ isExportable: require_printerTs.ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
59
+ isTypeOnly: require_printerTs.ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
60
+ children: (0, _kubb_fabric_core_parsers_typescript.safePrint)(typeNode)
61
+ })] });
72
62
  }
73
63
  //#endregion
74
64
  //#region src/components/Type.tsx
75
- function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, description, resolver }) {
65
+ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumTypeSuffix, enumKeyCasing, description, resolver }) {
76
66
  const resolvedDescription = description || node?.description;
77
67
  const enumSchemaNodes = (0, _kubb_ast.collect)(node, { schema(n) {
78
68
  const enumNode = (0, _kubb_ast.narrowSchema)(n, _kubb_ast.schemaTypes.enum);
@@ -82,6 +72,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
82
72
  optionalType,
83
73
  arrayType,
84
74
  enumType,
75
+ enumTypeSuffix,
85
76
  typeName: name,
86
77
  syntaxType,
87
78
  description: resolvedDescription,
@@ -95,6 +86,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
95
86
  ...getEnumNames({
96
87
  node,
97
88
  enumType,
89
+ enumTypeSuffix,
98
90
  resolver
99
91
  })
100
92
  };
@@ -104,6 +96,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
104
96
  return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [shouldExportEnums && enums.map(({ node }) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(Enum, {
105
97
  node,
106
98
  enumType,
99
+ enumTypeSuffix,
107
100
  enumKeyCasing,
108
101
  resolver
109
102
  })), shouldExportType && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
@@ -128,4 +121,4 @@ Object.defineProperty(exports, "Type", {
128
121
  }
129
122
  });
130
123
 
131
- //# sourceMappingURL=Type-oFwUfkZv.cjs.map
124
+ //# sourceMappingURL=Type-Bf8raoQX.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Type-Bf8raoQX.cjs","names":["camelCase","ENUM_TYPES_WITH_KEY_SUFFIX","trimQuotes","File","ENUM_TYPES_WITH_RUNTIME_VALUE","ENUM_TYPES_WITH_TYPE_ONLY","schemaTypes","printerTs","File"],"sources":["../src/components/Enum.tsx","../src/components/Type.tsx"],"sourcesContent":["import { camelCase, trimQuotes } from '@internals/utils'\nimport type { EnumSchemaNode } from '@kubb/ast/types'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX, ENUM_TYPES_WITH_RUNTIME_VALUE, ENUM_TYPES_WITH_TYPE_ONLY } from '../constants.ts'\nimport * as factory from '../factory.ts'\nimport type { PluginTs, ResolverTs } from '../types.ts'\n\ntype Props = {\n node: EnumSchemaNode\n enumType: PluginTs['resolvedOptions']['enumType']\n enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n resolver: ResolverTs\n}\n\n/**\n * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.\n *\n * The raw `node.name` may be a YAML key such as `\"enumNames.Type\"` which is not a\n * valid TypeScript identifier. The resolver normalizes it; for inline enum\n * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.\n */\nexport function getEnumNames({\n node,\n enumType,\n enumTypeSuffix,\n resolver,\n}: {\n node: EnumSchemaNode\n enumType: PluginTs['resolvedOptions']['enumType']\n enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']\n resolver: ResolverTs\n}): {\n enumName: string\n typeName: string\n /**\n * The PascalCase name that `$ref` importers will use to reference this enum type.\n * For `asConst`/`asPascalConst` this differs from `typeName` (which has a `Key` suffix).\n */\n refName: string\n} {\n const resolved = resolver.default(node.name!, 'type')\n const enumName = enumType === 'asPascalConst' ? resolved : camelCase(node.name!)\n const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolved\n\n return { enumName, typeName, refName: resolved }\n}\n\n/**\n * Renders the enum declaration(s) for a single named `EnumSchemaNode`.\n *\n * Depending on `enumType` this may emit:\n * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias\n * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)\n * - A union literal type alias (`literal`)\n *\n * The emitted `File.Source` nodes carry the resolved names so that the barrel\n * index picks up the correct export identifiers.\n */\nexport function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }: Props): FabricReactNode {\n const { enumName, typeName } = getEnumNames({ node, enumType, enumTypeSuffix, resolver })\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name: enumName,\n typeName,\n enums: (node.namedEnumValues?.map((v) => [trimQuotes(v.name.toString()), v.value]) ??\n node.enumValues?.filter((v): v is NonNullable<typeof v> => v !== null && v !== undefined).map((v) => [trimQuotes(v.toString()), v]) ??\n []) as unknown as Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return (\n <>\n {nameNode && (\n <File.Source name={enumName} isExportable isIndexable isTypeOnly={false}>\n {safePrint(nameNode)}\n </File.Source>\n )}\n <File.Source name={typeName} isIndexable isExportable={ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType)} isTypeOnly={ENUM_TYPES_WITH_TYPE_ONLY.has(enumType)}>\n {safePrint(typeNode)}\n </File.Source>\n </>\n )\n}\n","import { collect, narrowSchema, schemaTypes } from '@kubb/ast'\nimport type { EnumSchemaNode, SchemaNode } from '@kubb/ast/types'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport { printerTs } from '../printers/printerTs.ts'\nimport type { PluginTs } from '../types.ts'\nimport { Enum, getEnumNames } from './Enum.tsx'\n\ntype Props = {\n name: string\n typedName: string\n node: SchemaNode\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n resolver: PluginTs['resolvedOptions']['resolver']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({\n name,\n typedName,\n node,\n keysToOmit,\n optionalType,\n arrayType,\n syntaxType,\n enumType,\n enumTypeSuffix,\n enumKeyCasing,\n description,\n resolver,\n}: Props): FabricReactNode {\n const resolvedDescription = description || node?.description\n const enumSchemaNodes = collect<EnumSchemaNode>(node, {\n schema(n): EnumSchemaNode | undefined {\n const enumNode = narrowSchema(n, schemaTypes.enum)\n if (enumNode?.name) return enumNode\n },\n })\n\n const printer = printerTs({\n optionalType,\n arrayType,\n enumType,\n enumTypeSuffix,\n typeName: name,\n syntaxType,\n description: resolvedDescription,\n keysToOmit,\n resolver,\n })\n const output = printer.print(node)\n\n if (!output) {\n return\n }\n\n const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node) => {\n return {\n node,\n ...getEnumNames({ node, enumType, enumTypeSuffix, resolver }),\n }\n })\n\n // Skip enum exports when using inlineLiteral\n const shouldExportEnums = enumType !== 'inlineLiteral'\n const shouldExportType = enumType === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n return (\n <>\n {shouldExportEnums &&\n enums.map(({ node }) => <Enum node={node} enumType={enumType} enumTypeSuffix={enumTypeSuffix} enumKeyCasing={enumKeyCasing} resolver={resolver} />)}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {output}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAgB,aAAa,EAC3B,MACA,UACA,gBACA,YAcA;CACA,MAAM,WAAW,SAAS,QAAQ,KAAK,MAAO,OAAO;AAIrD,QAAO;EAAE,UAHQ,aAAa,kBAAkB,WAAWA,eAAAA,UAAU,KAAK,KAAM;EAG7D,UAFFC,kBAAAA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UAAU,KAAM,QAAO;IAE9B,CAAC;CAaF,MAAM,SAXUC,kBAAAA,UAAU;EACxB;EACA;EACA;EACA;EACA,UAAU;EACV;EACA,aAAa;EACb;EACA;EACD,CAAC,CACqB,MAAM,KAAK;AAElC,KAAI,CAAC,OACH;CAGF,MAAM,QAAQ,CAAC,GAAG,IAAI,IAAI,gBAAgB,KAAK,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,SAAS;AACzF,SAAO;GACL;GACA,GAAG,aAAa;IAAE;IAAM;IAAU;IAAgB;IAAU,CAAC;GAC9D;GACD;CAGF,MAAM,oBAAoB,aAAa;CACvC,MAAM,mBAAmB,aAAa,mBAAmB,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK;AAEtG,QACE,iBAAA,GAAA,+BAAA,MAAA,+BAAA,UAAA,EAAA,UAAA,CACG,qBACC,MAAM,KAAK,EAAE,WAAW,iBAAA,GAAA,+BAAA,KAAC,MAAD;EAAY;EAAgB;EAA0B;EAA+B;EAAyB;EAAY,CAAA,CAAC,EACpJ,oBACC,iBAAA,GAAA,+BAAA,KAACC,mBAAAA,KAAK,QAAN;EAAa,MAAM;EAAW,YAAA;EAAW,cAAA;EAAa,aAAA;YACnD;EACW,CAAA,CAEf,EAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import "./chunk--u3MIqq1.js";
2
2
  import { t as camelCase } from "./casing-BJHFg-zZ.js";
3
- import { a as ENUM_TYPES_WITH_TYPE_ONLY, i as ENUM_TYPES_WITH_RUNTIME_VALUE, n as createEnumDeclaration, o as trimQuotes, r as ENUM_TYPES_WITH_KEY_SUFFIX, t as printerTs } from "./printerTs-BgZucv4T.js";
3
+ import { a as ENUM_TYPES_WITH_TYPE_ONLY, i as ENUM_TYPES_WITH_RUNTIME_VALUE, n as createEnumDeclaration, o as trimQuotes, r as ENUM_TYPES_WITH_KEY_SUFFIX, t as printerTs } from "./printerTs-CMBCOuqd.js";
4
4
  import { collect, narrowSchema, schemaTypes } from "@kubb/ast";
5
5
  import { File } from "@kubb/react-fabric";
6
6
  import { safePrint } from "@kubb/fabric-core/parsers/typescript";
@@ -13,11 +13,11 @@ import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
13
13
  * valid TypeScript identifier. The resolver normalizes it; for inline enum
14
14
  * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
15
15
  */
16
- function getEnumNames({ node, enumType, resolver }) {
16
+ function getEnumNames({ node, enumType, enumTypeSuffix, resolver }) {
17
17
  const resolved = resolver.default(node.name, "type");
18
18
  return {
19
19
  enumName: enumType === "asPascalConst" ? resolved : camelCase(node.name),
20
- typeName: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? `${resolved}Key` : resolved,
20
+ typeName: ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolved,
21
21
  refName: resolved
22
22
  };
23
23
  }
@@ -32,10 +32,11 @@ function getEnumNames({ node, enumType, resolver }) {
32
32
  * The emitted `File.Source` nodes carry the resolved names so that the barrel
33
33
  * index picks up the correct export identifiers.
34
34
  */
35
- function Enum({ node, enumType, enumKeyCasing, resolver }) {
36
- const { enumName, typeName, refName } = getEnumNames({
35
+ function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }) {
36
+ const { enumName, typeName } = getEnumNames({
37
37
  node,
38
38
  enumType,
39
+ enumTypeSuffix,
39
40
  resolver
40
41
  });
41
42
  const [nameNode, typeNode] = createEnumDeclaration({
@@ -45,34 +46,23 @@ function Enum({ node, enumType, enumKeyCasing, resolver }) {
45
46
  type: enumType,
46
47
  enumKeyCasing
47
48
  });
48
- const needsRefAlias = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && refName !== typeName;
49
- return /* @__PURE__ */ jsxs(Fragment, { children: [
50
- nameNode && /* @__PURE__ */ jsx(File.Source, {
51
- name: enumName,
52
- isExportable: true,
53
- isIndexable: true,
54
- isTypeOnly: false,
55
- children: safePrint(nameNode)
56
- }),
57
- /* @__PURE__ */ jsx(File.Source, {
58
- name: typeName,
59
- isIndexable: true,
60
- isExportable: ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
61
- isTypeOnly: ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
62
- children: safePrint(typeNode)
63
- }),
64
- needsRefAlias && /* @__PURE__ */ jsx(File.Source, {
65
- name: refName,
66
- isExportable: true,
67
- isIndexable: true,
68
- isTypeOnly: true,
69
- children: `export type ${refName} = ${typeName}`
70
- })
71
- ] });
49
+ return /* @__PURE__ */ jsxs(Fragment, { children: [nameNode && /* @__PURE__ */ jsx(File.Source, {
50
+ name: enumName,
51
+ isExportable: true,
52
+ isIndexable: true,
53
+ isTypeOnly: false,
54
+ children: safePrint(nameNode)
55
+ }), /* @__PURE__ */ jsx(File.Source, {
56
+ name: typeName,
57
+ isIndexable: true,
58
+ isExportable: ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType),
59
+ isTypeOnly: ENUM_TYPES_WITH_TYPE_ONLY.has(enumType),
60
+ children: safePrint(typeNode)
61
+ })] });
72
62
  }
73
63
  //#endregion
74
64
  //#region src/components/Type.tsx
75
- function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumKeyCasing, description, resolver }) {
65
+ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, syntaxType, enumType, enumTypeSuffix, enumKeyCasing, description, resolver }) {
76
66
  const resolvedDescription = description || node?.description;
77
67
  const enumSchemaNodes = collect(node, { schema(n) {
78
68
  const enumNode = narrowSchema(n, schemaTypes.enum);
@@ -82,6 +72,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
82
72
  optionalType,
83
73
  arrayType,
84
74
  enumType,
75
+ enumTypeSuffix,
85
76
  typeName: name,
86
77
  syntaxType,
87
78
  description: resolvedDescription,
@@ -95,6 +86,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
95
86
  ...getEnumNames({
96
87
  node,
97
88
  enumType,
89
+ enumTypeSuffix,
98
90
  resolver
99
91
  })
100
92
  };
@@ -104,6 +96,7 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
104
96
  return /* @__PURE__ */ jsxs(Fragment, { children: [shouldExportEnums && enums.map(({ node }) => /* @__PURE__ */ jsx(Enum, {
105
97
  node,
106
98
  enumType,
99
+ enumTypeSuffix,
107
100
  enumKeyCasing,
108
101
  resolver
109
102
  })), shouldExportType && /* @__PURE__ */ jsx(File.Source, {
@@ -117,4 +110,4 @@ function Type({ name, typedName, node, keysToOmit, optionalType, arrayType, synt
117
110
  //#endregion
118
111
  export { Enum as n, Type as t };
119
112
 
120
- //# sourceMappingURL=Type-B6fo0gSk.js.map
113
+ //# sourceMappingURL=Type-BpXxT4l_.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Type-BpXxT4l_.js","names":["factory.createEnumDeclaration"],"sources":["../src/components/Enum.tsx","../src/components/Type.tsx"],"sourcesContent":["import { camelCase, trimQuotes } from '@internals/utils'\nimport type { EnumSchemaNode } from '@kubb/ast/types'\nimport { safePrint } from '@kubb/fabric-core/parsers/typescript'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX, ENUM_TYPES_WITH_RUNTIME_VALUE, ENUM_TYPES_WITH_TYPE_ONLY } from '../constants.ts'\nimport * as factory from '../factory.ts'\nimport type { PluginTs, ResolverTs } from '../types.ts'\n\ntype Props = {\n node: EnumSchemaNode\n enumType: PluginTs['resolvedOptions']['enumType']\n enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n resolver: ResolverTs\n}\n\n/**\n * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.\n *\n * The raw `node.name` may be a YAML key such as `\"enumNames.Type\"` which is not a\n * valid TypeScript identifier. The resolver normalizes it; for inline enum\n * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.\n */\nexport function getEnumNames({\n node,\n enumType,\n enumTypeSuffix,\n resolver,\n}: {\n node: EnumSchemaNode\n enumType: PluginTs['resolvedOptions']['enumType']\n enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']\n resolver: ResolverTs\n}): {\n enumName: string\n typeName: string\n /**\n * The PascalCase name that `$ref` importers will use to reference this enum type.\n * For `asConst`/`asPascalConst` this differs from `typeName` (which has a `Key` suffix).\n */\n refName: string\n} {\n const resolved = resolver.default(node.name!, 'type')\n const enumName = enumType === 'asPascalConst' ? resolved : camelCase(node.name!)\n const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolved\n\n return { enumName, typeName, refName: resolved }\n}\n\n/**\n * Renders the enum declaration(s) for a single named `EnumSchemaNode`.\n *\n * Depending on `enumType` this may emit:\n * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias\n * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)\n * - A union literal type alias (`literal`)\n *\n * The emitted `File.Source` nodes carry the resolved names so that the barrel\n * index picks up the correct export identifiers.\n */\nexport function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }: Props): FabricReactNode {\n const { enumName, typeName } = getEnumNames({ node, enumType, enumTypeSuffix, resolver })\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name: enumName,\n typeName,\n enums: (node.namedEnumValues?.map((v) => [trimQuotes(v.name.toString()), v.value]) ??\n node.enumValues?.filter((v): v is NonNullable<typeof v> => v !== null && v !== undefined).map((v) => [trimQuotes(v.toString()), v]) ??\n []) as unknown as Array<[string, string]>,\n type: enumType,\n enumKeyCasing,\n })\n\n return (\n <>\n {nameNode && (\n <File.Source name={enumName} isExportable isIndexable isTypeOnly={false}>\n {safePrint(nameNode)}\n </File.Source>\n )}\n <File.Source name={typeName} isIndexable isExportable={ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType)} isTypeOnly={ENUM_TYPES_WITH_TYPE_ONLY.has(enumType)}>\n {safePrint(typeNode)}\n </File.Source>\n </>\n )\n}\n","import { collect, narrowSchema, schemaTypes } from '@kubb/ast'\nimport type { EnumSchemaNode, SchemaNode } from '@kubb/ast/types'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\nimport { printerTs } from '../printers/printerTs.ts'\nimport type { PluginTs } from '../types.ts'\nimport { Enum, getEnumNames } from './Enum.tsx'\n\ntype Props = {\n name: string\n typedName: string\n node: SchemaNode\n optionalType: PluginTs['resolvedOptions']['optionalType']\n arrayType: PluginTs['resolvedOptions']['arrayType']\n enumType: PluginTs['resolvedOptions']['enumType']\n enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']\n enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n resolver: PluginTs['resolvedOptions']['resolver']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({\n name,\n typedName,\n node,\n keysToOmit,\n optionalType,\n arrayType,\n syntaxType,\n enumType,\n enumTypeSuffix,\n enumKeyCasing,\n description,\n resolver,\n}: Props): FabricReactNode {\n const resolvedDescription = description || node?.description\n const enumSchemaNodes = collect<EnumSchemaNode>(node, {\n schema(n): EnumSchemaNode | undefined {\n const enumNode = narrowSchema(n, schemaTypes.enum)\n if (enumNode?.name) return enumNode\n },\n })\n\n const printer = printerTs({\n optionalType,\n arrayType,\n enumType,\n enumTypeSuffix,\n typeName: name,\n syntaxType,\n description: resolvedDescription,\n keysToOmit,\n resolver,\n })\n const output = printer.print(node)\n\n if (!output) {\n return\n }\n\n const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node) => {\n return {\n node,\n ...getEnumNames({ node, enumType, enumTypeSuffix, resolver }),\n }\n })\n\n // Skip enum exports when using inlineLiteral\n const shouldExportEnums = enumType !== 'inlineLiteral'\n const shouldExportType = enumType === 'inlineLiteral' || enums.every((item) => item.typeName !== name)\n\n return (\n <>\n {shouldExportEnums &&\n enums.map(({ node }) => <Enum node={node} enumType={enumType} enumTypeSuffix={enumTypeSuffix} enumKeyCasing={enumKeyCasing} resolver={resolver} />)}\n {shouldExportType && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {output}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAgB,aAAa,EAC3B,MACA,UACA,gBACA,YAcA;CACA,MAAM,WAAW,SAAS,QAAQ,KAAK,MAAO,OAAO;AAIrD,QAAO;EAAE,UAHQ,aAAa,kBAAkB,WAAW,UAAU,KAAK,KAAM;EAG7D,UAFF,2BAA2B,IAAI,SAAS,GAAG,SAAS,wBAAwB,MAAM,eAAe,GAAG;EAExF,SAAS;EAAU;;;;;;;;;;;;;AAclD,SAAgB,KAAK,EAAE,MAAM,UAAU,gBAAgB,eAAe,YAAoC;CACxG,MAAM,EAAE,UAAU,aAAa,aAAa;EAAE;EAAM;EAAU;EAAgB;EAAU,CAAC;CAEzF,MAAM,CAAC,UAAU,YAAYA,sBAA8B;EACzD,MAAM;EACN;EACA,OAAQ,KAAK,iBAAiB,KAAK,MAAM,CAAC,WAAW,EAAE,KAAK,UAAU,CAAC,EAAE,EAAE,MAAM,CAAC,IAChF,KAAK,YAAY,QAAQ,MAAkC,MAAM,QAAQ,MAAM,KAAA,EAAU,CAAC,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,IACnI,EAAE;EACJ,MAAM;EACN;EACD,CAAC;AAEF,QACE,qBAAA,UAAA,EAAA,UAAA,CACG,YACC,oBAAC,KAAK,QAAN;EAAa,MAAM;EAAU,cAAA;EAAa,aAAA;EAAY,YAAY;YAC/D,UAAU,SAAS;EACR,CAAA,EAEhB,oBAAC,KAAK,QAAN;EAAa,MAAM;EAAU,aAAA;EAAY,cAAc,8BAA8B,IAAI,SAAS;EAAE,YAAY,0BAA0B,IAAI,SAAS;YACpJ,UAAU,SAAS;EACR,CAAA,CACb,EAAA,CAAA;;;;AC7DP,SAAgB,KAAK,EACnB,MACA,WACA,MACA,YACA,cACA,WACA,YACA,UACA,gBACA,eACA,aACA,YACyB;CACzB,MAAM,sBAAsB,eAAe,MAAM;CACjD,MAAM,kBAAkB,QAAwB,MAAM,EACpD,OAAO,GAA+B;EACpC,MAAM,WAAW,aAAa,GAAG,YAAY,KAAK;AAClD,MAAI,UAAU,KAAM,QAAO;IAE9B,CAAC;CAaF,MAAM,SAXU,UAAU;EACxB;EACA;EACA;EACA;EACA,UAAU;EACV;EACA,aAAa;EACb;EACA;EACD,CAAC,CACqB,MAAM,KAAK;AAElC,KAAI,CAAC,OACH;CAGF,MAAM,QAAQ,CAAC,GAAG,IAAI,IAAI,gBAAgB,KAAK,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,SAAS;AACzF,SAAO;GACL;GACA,GAAG,aAAa;IAAE;IAAM;IAAU;IAAgB;IAAU,CAAC;GAC9D;GACD;CAGF,MAAM,oBAAoB,aAAa;CACvC,MAAM,mBAAmB,aAAa,mBAAmB,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK;AAEtG,QACE,qBAAA,UAAA,EAAA,UAAA,CACG,qBACC,MAAM,KAAK,EAAE,WAAW,oBAAC,MAAD;EAAY;EAAgB;EAA0B;EAA+B;EAAyB;EAAY,CAAA,CAAC,EACpJ,oBACC,oBAAC,KAAK,QAAN;EAAa,MAAM;EAAW,YAAA;EAAW,cAAA;EAAa,aAAA;YACnD;EACW,CAAA,CAEf,EAAA,CAAA"}
@@ -1,6 +1,21 @@
1
1
  require("./chunk-ByKO4r7w.cjs");
2
2
  let _kubb_ast = require("@kubb/ast");
3
3
  //#region src/builders/builderTs.ts
4
+ /**
5
+ * Default schema builder for `@kubb/plugin-ts`.
6
+ *
7
+ * Implements the `buildParams`, `buildData`, `buildResponses`, and `buildResponseUnion` helpers
8
+ * used by the TypeScript type generator to construct AST schema nodes for operation parameters,
9
+ * request bodies, and responses.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { builderTs } from '@kubb/plugin-ts'
14
+ *
15
+ * builderTs.buildData({ node, resolver })
16
+ * // → object schema with pathParams, queryParams, headerParams, data, url properties
17
+ * ```
18
+ */
4
19
  const builderTs = (0, require("@kubb/core").defineBuilder)(() => ({
5
20
  name: "default",
6
21
  buildParams({ params, node, resolver }) {
@@ -117,4 +132,4 @@ Object.defineProperty(exports, "builderTs", {
117
132
  }
118
133
  });
119
134
 
120
- //# sourceMappingURL=builderTs-Cd3juc2G.cjs.map
135
+ //# sourceMappingURL=builderTs-COUg3xtQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builderTs-COUg3xtQ.cjs","names":[],"sources":["../src/builders/builderTs.ts"],"sourcesContent":["import { createProperty, createSchema } from '@kubb/ast'\nimport { defineBuilder } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\n\n/**\n * Default schema builder for `@kubb/plugin-ts`.\n *\n * Implements the `buildParams`, `buildData`, `buildResponses`, and `buildResponseUnion` helpers\n * used by the TypeScript type generator to construct AST schema nodes for operation parameters,\n * request bodies, and responses.\n *\n * @example\n * ```ts\n * import { builderTs } from '@kubb/plugin-ts'\n *\n * builderTs.buildData({ node, resolver })\n * // → object schema with pathParams, queryParams, headerParams, data, url properties\n * ```\n */\nexport const builderTs = defineBuilder<PluginTs>(() => ({\n name: 'default',\n buildParams({ params, node, resolver }) {\n return createSchema({\n type: 'object',\n properties: params.map((param) =>\n createProperty({\n name: param.name,\n required: param.required,\n schema: createSchema({\n type: 'ref',\n name: resolver.resolveParamName(node, param),\n }),\n }),\n ),\n })\n },\n buildData({ node, resolver }) {\n const pathParams = node.parameters.filter((p) => p.in === 'path')\n const queryParams = node.parameters.filter((p) => p.in === 'query')\n const headerParams = node.parameters.filter((p) => p.in === 'header')\n\n return createSchema({\n type: 'object',\n deprecated: node.deprecated,\n properties: [\n createProperty({\n name: 'data',\n schema: node.requestBody?.schema\n ? createSchema({ type: 'ref', name: resolver.resolveDataTypedName(node), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'pathParams',\n required: pathParams.length > 0,\n schema: pathParams.length > 0 ? this.buildParams({ params: pathParams, node, resolver }) : createSchema({ type: 'never' }),\n }),\n createProperty({\n name: 'queryParams',\n schema:\n queryParams.length > 0\n ? createSchema({ ...this.buildParams({ params: queryParams, node, resolver }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'headerParams',\n schema:\n headerParams.length > 0\n ? createSchema({ ...this.buildParams({ params: headerParams, node, resolver }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'url',\n required: true,\n schema: createSchema({ type: 'url', path: node.path }),\n }),\n ],\n })\n },\n buildResponses({ node, resolver }) {\n if (node.responses.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'object',\n properties: node.responses.map((res) =>\n createProperty({\n name: String(res.statusCode),\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) }),\n }),\n ),\n })\n },\n buildResponseUnion({ node, resolver }) {\n const responsesWithSchema = node.responses.filter((res) => res.schema)\n\n if (responsesWithSchema.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'union',\n members: responsesWithSchema.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n },\n}))\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAa,aAAA,yBAAA,sBAA2C;CACtD,MAAM;CACN,YAAY,EAAE,QAAQ,MAAM,YAAY;AACtC,UAAA,GAAA,UAAA,cAAoB;GAClB,MAAM;GACN,YAAY,OAAO,KAAK,WAAA,GAAA,UAAA,gBACP;IACb,MAAM,MAAM;IACZ,UAAU,MAAM;IAChB,SAAA,GAAA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b,MAAM;KACN,UAAU;KACV,SAAA,GAAA,UAAA,cAAqB;MAAE,MAAM;MAAO,MAAM,KAAK;MAAM,CAAC;KACvD,CAAC;IACH;GACF,CAAC;;CAEJ,eAAe,EAAE,MAAM,YAAY;AACjC,MAAI,KAAK,UAAU,WAAW,EAC5B,QAAO;AAGT,UAAA,GAAA,UAAA,cAAoB;GAClB,MAAM;GACN,YAAY,KAAK,UAAU,KAAK,SAAA,GAAA,UAAA,gBACf;IACb,MAAM,OAAO,IAAI,WAAW;IAC5B,UAAU;IACV,SAAA,GAAA,UAAA,cAAqB;KAAE,MAAM;KAAO,MAAM,SAAS,+BAA+B,MAAM,IAAI,WAAW;KAAE,CAAC;IAC3G,CAAC,CACH;GACF,CAAC;;CAEJ,mBAAmB,EAAE,MAAM,YAAY;EACrC,MAAM,sBAAsB,KAAK,UAAU,QAAQ,QAAQ,IAAI,OAAO;AAEtE,MAAI,oBAAoB,WAAW,EACjC,QAAO;AAGT,UAAA,GAAA,UAAA,cAAoB;GAClB,MAAM;GACN,SAAS,oBAAoB,KAAK,SAAA,GAAA,UAAA,cAAqB;IAAE,MAAM;IAAO,MAAM,SAAS,+BAA+B,MAAM,IAAI,WAAW;IAAE,CAAC,CAAC;GAC9I,CAAC;;CAEL,EAAE"}
@@ -2,6 +2,21 @@ import "./chunk--u3MIqq1.js";
2
2
  import { createProperty, createSchema } from "@kubb/ast";
3
3
  import { defineBuilder } from "@kubb/core";
4
4
  //#region src/builders/builderTs.ts
5
+ /**
6
+ * Default schema builder for `@kubb/plugin-ts`.
7
+ *
8
+ * Implements the `buildParams`, `buildData`, `buildResponses`, and `buildResponseUnion` helpers
9
+ * used by the TypeScript type generator to construct AST schema nodes for operation parameters,
10
+ * request bodies, and responses.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { builderTs } from '@kubb/plugin-ts'
15
+ *
16
+ * builderTs.buildData({ node, resolver })
17
+ * // → object schema with pathParams, queryParams, headerParams, data, url properties
18
+ * ```
19
+ */
5
20
  const builderTs = defineBuilder(() => ({
6
21
  name: "default",
7
22
  buildParams({ params, node, resolver }) {
@@ -113,4 +128,4 @@ const builderTs = defineBuilder(() => ({
113
128
  //#endregion
114
129
  export { builderTs as t };
115
130
 
116
- //# sourceMappingURL=builderTs-DausqHpc.js.map
131
+ //# sourceMappingURL=builderTs-DPpkJKd1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builderTs-DPpkJKd1.js","names":[],"sources":["../src/builders/builderTs.ts"],"sourcesContent":["import { createProperty, createSchema } from '@kubb/ast'\nimport { defineBuilder } from '@kubb/core'\nimport type { PluginTs } from '../types.ts'\n\n/**\n * Default schema builder for `@kubb/plugin-ts`.\n *\n * Implements the `buildParams`, `buildData`, `buildResponses`, and `buildResponseUnion` helpers\n * used by the TypeScript type generator to construct AST schema nodes for operation parameters,\n * request bodies, and responses.\n *\n * @example\n * ```ts\n * import { builderTs } from '@kubb/plugin-ts'\n *\n * builderTs.buildData({ node, resolver })\n * // → object schema with pathParams, queryParams, headerParams, data, url properties\n * ```\n */\nexport const builderTs = defineBuilder<PluginTs>(() => ({\n name: 'default',\n buildParams({ params, node, resolver }) {\n return createSchema({\n type: 'object',\n properties: params.map((param) =>\n createProperty({\n name: param.name,\n required: param.required,\n schema: createSchema({\n type: 'ref',\n name: resolver.resolveParamName(node, param),\n }),\n }),\n ),\n })\n },\n buildData({ node, resolver }) {\n const pathParams = node.parameters.filter((p) => p.in === 'path')\n const queryParams = node.parameters.filter((p) => p.in === 'query')\n const headerParams = node.parameters.filter((p) => p.in === 'header')\n\n return createSchema({\n type: 'object',\n deprecated: node.deprecated,\n properties: [\n createProperty({\n name: 'data',\n schema: node.requestBody?.schema\n ? createSchema({ type: 'ref', name: resolver.resolveDataTypedName(node), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'pathParams',\n required: pathParams.length > 0,\n schema: pathParams.length > 0 ? this.buildParams({ params: pathParams, node, resolver }) : createSchema({ type: 'never' }),\n }),\n createProperty({\n name: 'queryParams',\n schema:\n queryParams.length > 0\n ? createSchema({ ...this.buildParams({ params: queryParams, node, resolver }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'headerParams',\n schema:\n headerParams.length > 0\n ? createSchema({ ...this.buildParams({ params: headerParams, node, resolver }), optional: true })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'url',\n required: true,\n schema: createSchema({ type: 'url', path: node.path }),\n }),\n ],\n })\n },\n buildResponses({ node, resolver }) {\n if (node.responses.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'object',\n properties: node.responses.map((res) =>\n createProperty({\n name: String(res.statusCode),\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) }),\n }),\n ),\n })\n },\n buildResponseUnion({ node, resolver }) {\n const responsesWithSchema = node.responses.filter((res) => res.schema)\n\n if (responsesWithSchema.length === 0) {\n return null\n }\n\n return createSchema({\n type: 'union',\n members: responsesWithSchema.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n },\n}))\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,MAAa,YAAY,qBAA+B;CACtD,MAAM;CACN,YAAY,EAAE,QAAQ,MAAM,YAAY;AACtC,SAAO,aAAa;GAClB,MAAM;GACN,YAAY,OAAO,KAAK,UACtB,eAAe;IACb,MAAM,MAAM;IACZ,UAAU,MAAM;IAChB,QAAQ,aAAa;KACnB,MAAM;KACN,MAAM,SAAS,iBAAiB,MAAM,MAAM;KAC7C,CAAC;IACH,CAAC,CACH;GACF,CAAC;;CAEJ,UAAU,EAAE,MAAM,YAAY;EAC5B,MAAM,aAAa,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,OAAO;EACjE,MAAM,cAAc,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,QAAQ;EACnE,MAAM,eAAe,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO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C3G,CAAC,CACH;GACF,CAAC;;CAEJ,mBAAmB,EAAE,MAAM,YAAY;EACrC,MAAM,sBAAsB,KAAK,UAAU,QAAQ,QAAQ,IAAI,OAAO;AAEtE,MAAI,oBAAoB,WAAW,EACjC,QAAO;AAGT,SAAO,aAAa;GAClB,MAAM;GACN,SAAS,oBAAoB,KAAK,QAAQ,aAAa;IAAE,MAAM;IAAO,MAAM,SAAS,+BAA+B,MAAM,IAAI,WAAW;IAAE,CAAC,CAAC;GAC9I,CAAC;;CAEL,EAAE"}
package/dist/builders.cjs CHANGED
@@ -1,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_builderTs = require("./builderTs-Cd3juc2G.cjs");
2
+ const require_builderTs = require("./builderTs-COUg3xtQ.cjs");
3
3
  exports.builderTs = require_builderTs.builderTs;
@@ -1,7 +1,22 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { t as BuilderTs } from "./types-BcyuFDn9.js";
2
+ import { t as BuilderTs } from "./types-CRtcZOCz.js";
3
3
 
4
4
  //#region src/builders/builderTs.d.ts
5
+ /**
6
+ * Default schema builder for `@kubb/plugin-ts`.
7
+ *
8
+ * Implements the `buildParams`, `buildData`, `buildResponses`, and `buildResponseUnion` helpers
9
+ * used by the TypeScript type generator to construct AST schema nodes for operation parameters,
10
+ * request bodies, and responses.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { builderTs } from '@kubb/plugin-ts'
15
+ *
16
+ * builderTs.buildData({ node, resolver })
17
+ * // → object schema with pathParams, queryParams, headerParams, data, url properties
18
+ * ```
19
+ */
5
20
  declare const builderTs: BuilderTs;
6
21
  //#endregion
7
22
  export { builderTs };
package/dist/builders.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as builderTs } from "./builderTs-DausqHpc.js";
1
+ import { t as builderTs } from "./builderTs-DPpkJKd1.js";
2
2
  export { builderTs };
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_Type = require("./Type-oFwUfkZv.cjs");
2
+ const require_Type = require("./Type-Bf8raoQX.cjs");
3
3
  exports.Enum = require_Type.Enum;
4
4
  exports.Type = require_Type.Type;
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { i as ResolverTs, r as PluginTs } from "./types-BcyuFDn9.js";
2
+ import { i as ResolverTs, r as PluginTs } from "./types-CRtcZOCz.js";
3
3
  import { EnumSchemaNode, SchemaNode } from "@kubb/ast/types";
4
4
  import { FabricReactNode } from "@kubb/react-fabric/types";
5
5
 
@@ -7,6 +7,7 @@ import { FabricReactNode } from "@kubb/react-fabric/types";
7
7
  type Props$1 = {
8
8
  node: EnumSchemaNode;
9
9
  enumType: PluginTs['resolvedOptions']['enumType'];
10
+ enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
10
11
  enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
11
12
  resolver: ResolverTs;
12
13
  };
@@ -31,6 +32,7 @@ type Props$1 = {
31
32
  declare function Enum({
32
33
  node,
33
34
  enumType,
35
+ enumTypeSuffix,
34
36
  enumKeyCasing,
35
37
  resolver
36
38
  }: Props$1): FabricReactNode;
@@ -43,6 +45,7 @@ type Props = {
43
45
  optionalType: PluginTs['resolvedOptions']['optionalType'];
44
46
  arrayType: PluginTs['resolvedOptions']['arrayType'];
45
47
  enumType: PluginTs['resolvedOptions']['enumType'];
48
+ enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
46
49
  enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
47
50
  syntaxType: PluginTs['resolvedOptions']['syntaxType'];
48
51
  resolver: PluginTs['resolvedOptions']['resolver'];
@@ -58,6 +61,7 @@ declare function Type({
58
61
  arrayType,
59
62
  syntaxType,
60
63
  enumType,
64
+ enumTypeSuffix,
61
65
  enumKeyCasing,
62
66
  description,
63
67
  resolver
@@ -1,2 +1,2 @@
1
- import { n as Enum, t as Type } from "./Type-B6fo0gSk.js";
1
+ import { n as Enum, t as Type } from "./Type-BpXxT4l_.js";
2
2
  export { Enum, Type };
@@ -1,9 +1,9 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { t as builderTs } from "./builderTs-DausqHpc.js";
2
+ import { t as builderTs } from "./builderTs-DPpkJKd1.js";
3
3
  import { n as pascalCase } from "./casing-BJHFg-zZ.js";
4
- import { r as ENUM_TYPES_WITH_KEY_SUFFIX } from "./printerTs-BgZucv4T.js";
5
- import { t as Type } from "./Type-B6fo0gSk.js";
6
- import { t as resolverTsLegacy } from "./resolverTsLegacy-DLl854-P.js";
4
+ import { r as ENUM_TYPES_WITH_KEY_SUFFIX } from "./printerTs-CMBCOuqd.js";
5
+ import { t as Type } from "./Type-BpXxT4l_.js";
6
+ import { t as resolverTsLegacy } from "./resolverTsLegacy-CPiqqsO6.js";
7
7
  import path from "node:path";
8
8
  import { caseParams, composeTransformers, createProperty, createSchema, narrowSchema, schemaTypes, transform } from "@kubb/ast";
9
9
  import { defineGenerator, getMode } from "@kubb/core";
@@ -14,7 +14,7 @@ const typeGenerator = defineGenerator({
14
14
  name: "typescript",
15
15
  type: "react",
16
16
  Operation({ node, adapter, options, config }) {
17
- const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options;
17
+ const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options;
18
18
  const root = path.resolve(config.root, config.output.path);
19
19
  const mode = getMode(path.resolve(root, output.path));
20
20
  const file = resolver.resolveFile({
@@ -57,6 +57,7 @@ const typeGenerator = defineGenerator({
57
57
  node: transformedNode,
58
58
  description,
59
59
  enumType,
60
+ enumTypeSuffix,
60
61
  enumKeyCasing,
61
62
  optionalType,
62
63
  arrayType,
@@ -135,7 +136,7 @@ const typeGenerator = defineGenerator({
135
136
  });
136
137
  },
137
138
  Schema({ node, adapter, options, config }) {
138
- const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options;
139
+ const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options;
139
140
  const root = path.resolve(config.root, config.output.path);
140
141
  const mode = getMode(path.resolve(root, output.path));
141
142
  if (!node.name) return;
@@ -152,7 +153,7 @@ const typeGenerator = defineGenerator({
152
153
  }).path
153
154
  }));
154
155
  const isEnumSchema = !!narrowSchema(node, schemaTypes.enum);
155
- const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : resolver.resolveTypedName(node.name);
156
+ const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolver.resolveTypedName(node.name);
156
157
  const type = {
157
158
  name: resolver.resolveName(node.name),
158
159
  typedName,
@@ -191,6 +192,7 @@ const typeGenerator = defineGenerator({
191
192
  typedName: type.typedName,
192
193
  node: transformedNode,
193
194
  enumType,
195
+ enumTypeSuffix,
194
196
  enumKeyCasing,
195
197
  optionalType,
196
198
  arrayType,
@@ -344,7 +346,7 @@ const typeGeneratorLegacy = defineGenerator({
344
346
  name: "typescript-legacy",
345
347
  type: "react",
346
348
  Operation({ node, adapter, options, config }) {
347
- const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options;
349
+ const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options;
348
350
  const root = path.resolve(config.root, config.output.path);
349
351
  const mode = getMode(path.resolve(root, output.path));
350
352
  const file = resolver.resolveFile({
@@ -387,6 +389,7 @@ const typeGeneratorLegacy = defineGenerator({
387
389
  node: transformedNode,
388
390
  description,
389
391
  enumType,
392
+ enumTypeSuffix,
390
393
  enumKeyCasing,
391
394
  optionalType,
392
395
  arrayType,
@@ -480,7 +483,7 @@ const typeGeneratorLegacy = defineGenerator({
480
483
  });
481
484
  },
482
485
  Schema({ node, adapter, options, config }) {
483
- const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options;
486
+ const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options;
484
487
  const root = path.resolve(config.root, config.output.path);
485
488
  const mode = getMode(path.resolve(root, output.path));
486
489
  if (!node.name) return;
@@ -497,7 +500,7 @@ const typeGeneratorLegacy = defineGenerator({
497
500
  }).path
498
501
  }));
499
502
  const isEnumSchema = !!narrowSchema(node, schemaTypes.enum);
500
- const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : resolver.resolveTypedName(node.name);
503
+ const typedName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolver.resolveTypedName(node.name);
501
504
  const type = {
502
505
  name: resolver.resolveName(node.name),
503
506
  typedName,
@@ -536,6 +539,7 @@ const typeGeneratorLegacy = defineGenerator({
536
539
  typedName: type.typedName,
537
540
  node: transformedNode,
538
541
  enumType,
542
+ enumTypeSuffix,
539
543
  enumKeyCasing,
540
544
  optionalType,
541
545
  arrayType,
@@ -548,4 +552,4 @@ const typeGeneratorLegacy = defineGenerator({
548
552
  //#endregion
549
553
  export { typeGenerator as n, typeGeneratorLegacy as t };
550
554
 
551
- //# sourceMappingURL=generators-ByK18qUn.js.map
555
+ //# sourceMappingURL=generators-DFDut8o-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-DFDut8o-.js","names":[],"sources":["../src/generators/typeGenerator.tsx","../src/generators/typeGeneratorLegacy.tsx"],"sourcesContent":["import path from 'node:path'\nimport { caseParams, composeTransformers, narrowSchema, schemaTypes, transform } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast/types'\nimport { defineGenerator, getMode } from '@kubb/core'\nimport { File } from '@kubb/react-fabric'\nimport { builderTs } from '../builders/builderTs.ts'\nimport { Type } from '../components/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../constants.ts'\nimport type { PluginTs } from '../types'\n\nexport const typeGenerator = defineGenerator<PluginTs>({\n name: 'typescript',\n type: 'react',\n Operation({ node, adapter, options, config }) {\n const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const file = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n\n const params = caseParams(node.parameters, paramsCasing)\n\n function renderSchemaType({\n node: schemaNode,\n name,\n typedName,\n description,\n keysToOmit,\n }: {\n node: SchemaNode | null\n name: string\n typedName: string\n description?: string\n keysToOmit?: Array<string>\n }) {\n if (!schemaNode) {\n return null\n }\n\n const transformedNode = transform(schemaNode, composeTransformers(...transformers))\n\n const imports = adapter.getImports(transformedNode, (schemaName) => ({\n name: resolver.default(schemaName, 'type'),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={name}\n typedName={typedName}\n node={transformedNode}\n description={description}\n enumType={enumType}\n enumTypeSuffix={enumTypeSuffix}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n keysToOmit={keysToOmit}\n />\n </>\n )\n }\n\n const paramTypes = params.map((param) =>\n renderSchemaType({\n node: param.schema,\n name: resolver.resolveParamName(node, param),\n typedName: resolver.resolveParamTypedName(node, param),\n }),\n )\n\n const requestType = node.requestBody?.schema\n ? renderSchemaType({\n node: node.requestBody.schema,\n name: resolver.resolveDataName(node),\n typedName: resolver.resolveDataTypedName(node),\n description: node.requestBody.description ?? node.requestBody.schema.description,\n keysToOmit: node.requestBody.keysToOmit,\n })\n : null\n\n const responseTypes = node.responses.map((res) =>\n renderSchemaType({\n node: res.schema,\n name: resolver.resolveResponseStatusName(node, res.statusCode),\n typedName: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n description: res.description,\n keysToOmit: res.keysToOmit,\n }),\n )\n\n const dataType = renderSchemaType({\n node: builderTs.buildData({ node: { ...node, parameters: params }, resolver }),\n name: resolver.resolveRequestConfigName(node),\n typedName: resolver.resolveRequestConfigTypedName(node),\n })\n\n const responsesType = renderSchemaType({\n node: builderTs.buildResponses({ node, resolver }),\n name: resolver.resolveResponsesName(node),\n typedName: resolver.resolveResponsesTypedName(node),\n })\n\n const responseType = renderSchemaType({\n node: builderTs.buildResponseUnion({ node, resolver }),\n name: resolver.resolveResponseName(node),\n typedName: resolver.resolveResponseTypedName(node),\n description: 'Union of all possible responses',\n })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.resolveBanner(adapter.rootNode, { output, config })}\n footer={resolver.resolveFooter(adapter.rootNode, { output, config })}\n >\n {paramTypes}\n {responseTypes}\n {requestType}\n {dataType}\n {responsesType}\n {responseType}\n </File>\n )\n },\n Schema({ node, adapter, options, config }) {\n const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n if (!node.name) {\n return\n }\n\n const transformedNode = transform(node, composeTransformers(...transformers))\n\n const imports = adapter.getImports(transformedNode, (schemaName) => ({\n name: resolver.default(schemaName, 'type'),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n const isEnumSchema = !!narrowSchema(node, schemaTypes.enum)\n\n const typedName =\n ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolver.resolveTypedName(node.name)\n\n const type = {\n name: resolver.resolveName(node.name),\n typedName,\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group }),\n } as const\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={resolver.resolveBanner(adapter.rootNode, { output, config })}\n footer={resolver.resolveFooter(adapter.rootNode, { output, config })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n node={transformedNode}\n enumType={enumType}\n enumTypeSuffix={enumTypeSuffix}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { pascalCase } from '@internals/utils'\nimport { caseParams, composeTransformers, createProperty, createSchema, narrowSchema, schemaTypes, transform } from '@kubb/ast'\nimport type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'\nimport { defineGenerator, getMode } from '@kubb/core'\nimport { File } from '@kubb/react-fabric'\nimport { Type } from '../components/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../constants.ts'\nimport { resolverTsLegacy } from '../resolvers/resolverTsLegacy.ts'\nimport type { PluginTs, ResolverTs } from '../types'\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ParameterNode>\n parentName?: string\n}\n\nfunction buildGroupedParamsSchema({ params, parentName }: BuildGroupedParamsSchemaOptions): SchemaNode {\n return createSchema({\n type: 'object',\n properties: params.map((param) => {\n let schema = param.schema\n if (narrowSchema(schema, 'enum') && !schema.name && parentName) {\n schema = { ...schema, name: pascalCase([parentName, param.name, 'enum'].join(' ')) }\n }\n return createProperty({\n name: param.name,\n required: param.required,\n schema,\n })\n }),\n })\n}\n\ntype BuildOperationSchemaOptions = {\n node: OperationNode\n resolver: ResolverTs\n}\n\nfunction buildLegacyResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\n const isGet = node.method.toLowerCase() === 'get'\n const successResponses = node.responses.filter((res) => {\n const code = Number(res.statusCode)\n return !Number.isNaN(code) && code >= 200 && code < 300\n })\n const errorResponses = node.responses.filter((res) => res.statusCode === 'default' || Number(res.statusCode) >= 400)\n\n const responseSchema =\n successResponses.length > 0\n ? successResponses.length === 1\n ? createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, successResponses[0]!.statusCode) })\n : createSchema({\n type: 'union',\n members: successResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n : createSchema({ type: 'any' })\n\n const errorsSchema =\n errorResponses.length > 0\n ? errorResponses.length === 1\n ? createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, errorResponses[0]!.statusCode) })\n : createSchema({\n type: 'union',\n members: errorResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n : createSchema({ type: 'any' })\n\n const properties = [createProperty({ name: 'Response', required: true, schema: responseSchema })]\n\n if (!isGet && node.requestBody?.schema) {\n properties.push(\n createProperty({\n name: 'Request',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveDataTypedName(node) }),\n }),\n )\n }\n\n if (node.parameters.some((p) => p.in === 'query') && resolver.resolveQueryParamsTypedName) {\n properties.push(\n createProperty({\n name: 'QueryParams',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveQueryParamsTypedName(node) }),\n }),\n )\n }\n\n if (node.parameters.some((p) => p.in === 'path') && resolver.resolvePathParamsTypedName) {\n properties.push(\n createProperty({\n name: 'PathParams',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolvePathParamsTypedName(node) }),\n }),\n )\n }\n\n if (node.parameters.some((p) => p.in === 'header') && resolver.resolveHeaderParamsTypedName) {\n properties.push(\n createProperty({\n name: 'HeaderParams',\n required: true,\n schema: createSchema({ type: 'ref', name: resolver.resolveHeaderParamsTypedName(node) }),\n }),\n )\n }\n\n properties.push(createProperty({ name: 'Errors', required: true, schema: errorsSchema }))\n\n return createSchema({ type: 'object', properties })\n}\n\nfunction buildLegacyResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {\n const successResponses = node.responses.filter((res) => {\n const code = Number(res.statusCode)\n return !Number.isNaN(code) && code >= 200 && code < 300\n })\n\n if (successResponses.length === 0) {\n return createSchema({ type: 'any' })\n }\n\n if (successResponses.length === 1) {\n return createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, successResponses[0]!.statusCode) })\n }\n\n return createSchema({\n type: 'union',\n members: successResponses.map((res) => createSchema({ type: 'ref', name: resolver.resolveResponseStatusTypedName(node, res.statusCode) })),\n })\n}\n\nfunction nameUnnamedEnums(node: SchemaNode, parentName: string): SchemaNode {\n return transform(node, {\n schema(n) {\n const enumNode = narrowSchema(n, 'enum')\n if (enumNode && !enumNode.name) {\n return { ...enumNode, name: pascalCase([parentName, 'enum'].join(' ')) }\n }\n return undefined\n },\n property(p) {\n const enumNode = narrowSchema(p.schema, 'enum')\n if (enumNode && !enumNode.name) {\n return {\n ...p,\n schema: { ...enumNode, name: pascalCase([parentName, p.name, 'enum'].join(' ')) },\n }\n }\n return undefined\n },\n })\n}\n\nexport const typeGeneratorLegacy = defineGenerator<PluginTs>({\n name: 'typescript-legacy',\n type: 'react',\n Operation({ node, adapter, options, config }) {\n const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const file = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n const params = caseParams(node.parameters, paramsCasing)\n\n function renderSchemaType({\n node: schemaNode,\n name,\n typedName,\n description,\n keysToOmit,\n }: {\n node: SchemaNode | null\n name: string\n typedName: string\n description?: string\n keysToOmit?: Array<string>\n }) {\n if (!schemaNode) {\n return null\n }\n\n const transformedNode = transform(schemaNode, composeTransformers(...transformers))\n\n const imports = adapter.getImports(transformedNode, (schemaName) => ({\n name: resolver.default(schemaName, 'type'),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => <File.Import key={[name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />)}\n <Type\n name={name}\n typedName={typedName}\n node={transformedNode}\n description={description}\n enumType={enumType}\n enumTypeSuffix={enumTypeSuffix}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n keysToOmit={keysToOmit}\n />\n </>\n )\n }\n\n const pathParams = params.filter((p) => p.in === 'path')\n const queryParams = params.filter((p) => p.in === 'query')\n const headerParams = params.filter((p) => p.in === 'header')\n\n const responseTypes = node.responses.map((res) => {\n const responseName = resolver.resolveResponseStatusName(node, res.statusCode)\n const baseResponseName = resolverTsLegacy.resolveResponseStatusName(node, res.statusCode)\n\n return renderSchemaType({\n node: res.schema ? nameUnnamedEnums(res.schema, baseResponseName) : res.schema,\n name: responseName,\n typedName: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n description: res.description,\n keysToOmit: res.keysToOmit,\n })\n })\n\n const requestType = node.requestBody?.schema\n ? renderSchemaType({\n node: nameUnnamedEnums(node.requestBody.schema, resolverTsLegacy.resolveDataName(node)),\n name: resolver.resolveDataName(node),\n typedName: resolver.resolveDataTypedName(node),\n description: node.requestBody.description ?? node.requestBody.schema.description,\n keysToOmit: node.requestBody.keysToOmit,\n })\n : null\n\n const legacyParamTypes = [\n pathParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: pathParams, parentName: resolverTsLegacy.resolvePathParamsName!(node) }),\n name: resolver.resolvePathParamsName!(node),\n typedName: resolver.resolvePathParamsTypedName!(node),\n })\n : null,\n queryParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: queryParams, parentName: resolverTsLegacy.resolveQueryParamsName!(node) }),\n name: resolver.resolveQueryParamsName!(node),\n typedName: resolver.resolveQueryParamsTypedName!(node),\n })\n : null,\n headerParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: headerParams, parentName: resolverTsLegacy.resolveHeaderParamsName!(node) }),\n name: resolver.resolveHeaderParamsName!(node),\n typedName: resolver.resolveHeaderParamsTypedName!(node),\n })\n : null,\n ]\n\n const legacyResponsesType = renderSchemaType({\n node: buildLegacyResponsesSchemaNode({ node, resolver }),\n name: resolver.resolveResponsesName(node),\n typedName: resolver.resolveResponsesTypedName(node),\n })\n\n const legacyResponseType = renderSchemaType({\n node: buildLegacyResponseUnionSchemaNode({ node, resolver }),\n name: resolver.resolveResponseName(node),\n typedName: resolver.resolveResponseTypedName(node),\n })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={resolver.resolveBanner(adapter.rootNode, { output, config })}\n footer={resolver.resolveFooter(adapter.rootNode, { output, config })}\n >\n {legacyParamTypes}\n {responseTypes}\n {requestType}\n {legacyResponseType}\n {legacyResponsesType}\n </File>\n )\n },\n Schema({ node, adapter, options, config }) {\n const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options\n\n const root = path.resolve(config.root, config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n if (!node.name) {\n return\n }\n\n const transformedNode = transform(node, composeTransformers(...transformers))\n\n const imports = adapter.getImports(transformedNode, (schemaName) => ({\n name: resolver.default(schemaName, 'type'),\n path: resolver.resolveFile({ name: schemaName, extname: '.ts' }, { root, output, group }).path,\n }))\n\n const isEnumSchema = !!narrowSchema(node, schemaTypes.enum)\n\n const typedName =\n ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolver.resolveTypedName(node.name)\n\n const type = {\n name: resolver.resolveName(node.name),\n typedName,\n file: resolver.resolveFile({ name: node.name, extname: '.ts' }, { root, output, group }),\n } as const\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={resolver.resolveBanner(adapter.rootNode, { output, config })}\n footer={resolver.resolveFooter(adapter.rootNode, { output, config })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[node.name, imp.path, imp.isTypeOnly].join('-')} root={type.file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n node={transformedNode}\n enumType={enumType}\n enumTypeSuffix={enumTypeSuffix}\n enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,gBAAgB,gBAA0B;CACrD,MAAM;CACN,MAAM;CACN,UAAU,EAAE,MAAM,SAAS,SAAS,UAAU;EAC5C,MAAM,EAAE,UAAU,gBAAgB,eAAe,cAAc,WAAW,YAAY,cAAc,OAAO,QAAQ,UAAU,eAAe,EAAE,KAAK;EAEnJ,MAAM,OAAO,KAAK,QAAQ,OAAO,MAAM,OAAO,OAAO,KAAK;EAC1D,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;EAErD,MAAM,OAAO,SAAS,YAAY;GAAE,MAAM,KAAK;GAAa,SAAS;GAAO,KAAK,KAAK,KAAK,MAAM;GAAW,MAAM,KAAK;GAAM,EAAE;GAAE;GAAM;GAAQ;GAAO,CAAC;EAEvJ,MAAM,SAAS,WAAW,KAAK,YAA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