@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.
- package/dist/{Type-oFwUfkZv.cjs → Type-Bf8raoQX.cjs} +24 -31
- package/dist/Type-Bf8raoQX.cjs.map +1 -0
- package/dist/{Type-B6fo0gSk.js → Type-BpXxT4l_.js} +24 -31
- package/dist/Type-BpXxT4l_.js.map +1 -0
- package/dist/{builderTs-Cd3juc2G.cjs → builderTs-COUg3xtQ.cjs} +16 -1
- package/dist/builderTs-COUg3xtQ.cjs.map +1 -0
- package/dist/{builderTs-DausqHpc.js → builderTs-DPpkJKd1.js} +16 -1
- package/dist/builderTs-DPpkJKd1.js.map +1 -0
- package/dist/builders.cjs +1 -1
- package/dist/builders.d.ts +16 -1
- package/dist/builders.js +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.d.ts +5 -1
- package/dist/components.js +1 -1
- package/dist/{generators-ByK18qUn.js → generators-DFDut8o-.js} +15 -11
- package/dist/generators-DFDut8o-.js.map +1 -0
- package/dist/{generators-aSsiTfUO.cjs → generators-DKd7MYbx.cjs} +15 -11
- package/dist/generators-DKd7MYbx.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +40 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +40 -3
- package/dist/index.js.map +1 -1
- package/dist/{printerTs-CFXc_LpP.cjs → printerTs-BcHudagv.cjs} +2 -3
- package/dist/{printerTs-CFXc_LpP.cjs.map → printerTs-BcHudagv.cjs.map} +1 -1
- package/dist/{printerTs-BgZucv4T.js → printerTs-CMBCOuqd.js} +2 -3
- package/dist/{printerTs-BgZucv4T.js.map → printerTs-CMBCOuqd.js.map} +1 -1
- package/dist/printers.cjs +1 -1
- package/dist/printers.d.ts +7 -1
- package/dist/printers.js +1 -1
- package/dist/{resolverTsLegacy-DLl854-P.js → resolverTsLegacy-CPiqqsO6.js} +3 -3
- package/dist/resolverTsLegacy-CPiqqsO6.js.map +1 -0
- package/dist/{resolverTsLegacy-sJ16Iqrl.cjs → resolverTsLegacy-CuR9XbKk.cjs} +3 -3
- package/dist/resolverTsLegacy-CuR9XbKk.cjs.map +1 -0
- package/dist/resolvers.cjs +1 -1
- package/dist/resolvers.d.ts +1 -1
- package/dist/resolvers.js +1 -1
- package/dist/{types-BcyuFDn9.d.ts → types-CRtcZOCz.d.ts} +34 -4
- package/package.json +3 -3
- package/src/builders/builderTs.ts +15 -0
- package/src/components/Enum.tsx +15 -11
- package/src/components/Type.tsx +16 -3
- package/src/generators/typeGenerator.tsx +6 -3
- package/src/generators/typeGeneratorLegacy.tsx +6 -3
- package/src/plugin.ts +21 -0
- package/src/presets.ts +17 -0
- package/src/printers/printerTs.ts +11 -3
- package/src/resolvers/resolverTs.ts +2 -2
- package/src/types.ts +33 -3
- package/dist/Type-B6fo0gSk.js.map +0 -1
- package/dist/Type-oFwUfkZv.cjs.map +0 -1
- package/dist/builderTs-Cd3juc2G.cjs.map +0 -1
- package/dist/builderTs-DausqHpc.js.map +0 -1
- package/dist/generators-ByK18qUn.js.map +0 -1
- package/dist/generators-aSsiTfUO.cjs.map +0 -1
- package/dist/resolverTsLegacy-DLl854-P.js.map +0 -1
- package/dist/resolverTsLegacy-sJ16Iqrl.cjs.map +0 -1
package/src/components/Enum.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import type { PluginTs, ResolverTs } from '../types.ts'
|
|
|
10
10
|
type Props = {
|
|
11
11
|
node: EnumSchemaNode
|
|
12
12
|
enumType: PluginTs['resolvedOptions']['enumType']
|
|
13
|
+
enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']
|
|
13
14
|
enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']
|
|
14
15
|
resolver: ResolverTs
|
|
15
16
|
}
|
|
@@ -21,7 +22,17 @@ type Props = {
|
|
|
21
22
|
* valid TypeScript identifier. The resolver normalizes it; for inline enum
|
|
22
23
|
* properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
|
|
23
24
|
*/
|
|
24
|
-
export function getEnumNames({
|
|
25
|
+
export function getEnumNames({
|
|
26
|
+
node,
|
|
27
|
+
enumType,
|
|
28
|
+
enumTypeSuffix,
|
|
29
|
+
resolver,
|
|
30
|
+
}: {
|
|
31
|
+
node: EnumSchemaNode
|
|
32
|
+
enumType: PluginTs['resolvedOptions']['enumType']
|
|
33
|
+
enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']
|
|
34
|
+
resolver: ResolverTs
|
|
35
|
+
}): {
|
|
25
36
|
enumName: string
|
|
26
37
|
typeName: string
|
|
27
38
|
/**
|
|
@@ -32,7 +43,7 @@ export function getEnumNames({ node, enumType, resolver }: { node: EnumSchemaNod
|
|
|
32
43
|
} {
|
|
33
44
|
const resolved = resolver.default(node.name!, 'type')
|
|
34
45
|
const enumName = enumType === 'asPascalConst' ? resolved : camelCase(node.name!)
|
|
35
|
-
const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ?
|
|
46
|
+
const typeName = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolved
|
|
36
47
|
|
|
37
48
|
return { enumName, typeName, refName: resolved }
|
|
38
49
|
}
|
|
@@ -48,8 +59,8 @@ export function getEnumNames({ node, enumType, resolver }: { node: EnumSchemaNod
|
|
|
48
59
|
* The emitted `File.Source` nodes carry the resolved names so that the barrel
|
|
49
60
|
* index picks up the correct export identifiers.
|
|
50
61
|
*/
|
|
51
|
-
export function Enum({ node, enumType, enumKeyCasing, resolver }: Props): FabricReactNode {
|
|
52
|
-
const { enumName, typeName
|
|
62
|
+
export function Enum({ node, enumType, enumTypeSuffix, enumKeyCasing, resolver }: Props): FabricReactNode {
|
|
63
|
+
const { enumName, typeName } = getEnumNames({ node, enumType, enumTypeSuffix, resolver })
|
|
53
64
|
|
|
54
65
|
const [nameNode, typeNode] = factory.createEnumDeclaration({
|
|
55
66
|
name: enumName,
|
|
@@ -61,8 +72,6 @@ export function Enum({ node, enumType, enumKeyCasing, resolver }: Props): Fabric
|
|
|
61
72
|
enumKeyCasing,
|
|
62
73
|
})
|
|
63
74
|
|
|
64
|
-
const needsRefAlias = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && refName !== typeName
|
|
65
|
-
|
|
66
75
|
return (
|
|
67
76
|
<>
|
|
68
77
|
{nameNode && (
|
|
@@ -73,11 +82,6 @@ export function Enum({ node, enumType, enumKeyCasing, resolver }: Props): Fabric
|
|
|
73
82
|
<File.Source name={typeName} isIndexable isExportable={ENUM_TYPES_WITH_RUNTIME_VALUE.has(enumType)} isTypeOnly={ENUM_TYPES_WITH_TYPE_ONLY.has(enumType)}>
|
|
74
83
|
{safePrint(typeNode)}
|
|
75
84
|
</File.Source>
|
|
76
|
-
{needsRefAlias && (
|
|
77
|
-
<File.Source name={refName} isExportable isIndexable isTypeOnly>
|
|
78
|
-
{`export type ${refName} = ${typeName}`}
|
|
79
|
-
</File.Source>
|
|
80
|
-
)}
|
|
81
85
|
</>
|
|
82
86
|
)
|
|
83
87
|
}
|
package/src/components/Type.tsx
CHANGED
|
@@ -13,6 +13,7 @@ type Props = {
|
|
|
13
13
|
optionalType: PluginTs['resolvedOptions']['optionalType']
|
|
14
14
|
arrayType: PluginTs['resolvedOptions']['arrayType']
|
|
15
15
|
enumType: PluginTs['resolvedOptions']['enumType']
|
|
16
|
+
enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix']
|
|
16
17
|
enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing']
|
|
17
18
|
syntaxType: PluginTs['resolvedOptions']['syntaxType']
|
|
18
19
|
resolver: PluginTs['resolvedOptions']['resolver']
|
|
@@ -29,6 +30,7 @@ export function Type({
|
|
|
29
30
|
arrayType,
|
|
30
31
|
syntaxType,
|
|
31
32
|
enumType,
|
|
33
|
+
enumTypeSuffix,
|
|
32
34
|
enumKeyCasing,
|
|
33
35
|
description,
|
|
34
36
|
resolver,
|
|
@@ -41,7 +43,17 @@ export function Type({
|
|
|
41
43
|
},
|
|
42
44
|
})
|
|
43
45
|
|
|
44
|
-
const printer = printerTs({
|
|
46
|
+
const printer = printerTs({
|
|
47
|
+
optionalType,
|
|
48
|
+
arrayType,
|
|
49
|
+
enumType,
|
|
50
|
+
enumTypeSuffix,
|
|
51
|
+
typeName: name,
|
|
52
|
+
syntaxType,
|
|
53
|
+
description: resolvedDescription,
|
|
54
|
+
keysToOmit,
|
|
55
|
+
resolver,
|
|
56
|
+
})
|
|
45
57
|
const output = printer.print(node)
|
|
46
58
|
|
|
47
59
|
if (!output) {
|
|
@@ -51,7 +63,7 @@ export function Type({
|
|
|
51
63
|
const enums = [...new Map(enumSchemaNodes.map((n) => [n.name, n])).values()].map((node) => {
|
|
52
64
|
return {
|
|
53
65
|
node,
|
|
54
|
-
...getEnumNames({ node, enumType, resolver }),
|
|
66
|
+
...getEnumNames({ node, enumType, enumTypeSuffix, resolver }),
|
|
55
67
|
}
|
|
56
68
|
})
|
|
57
69
|
|
|
@@ -61,7 +73,8 @@ export function Type({
|
|
|
61
73
|
|
|
62
74
|
return (
|
|
63
75
|
<>
|
|
64
|
-
{shouldExportEnums &&
|
|
76
|
+
{shouldExportEnums &&
|
|
77
|
+
enums.map(({ node }) => <Enum node={node} enumType={enumType} enumTypeSuffix={enumTypeSuffix} enumKeyCasing={enumKeyCasing} resolver={resolver} />)}
|
|
65
78
|
{shouldExportType && (
|
|
66
79
|
<File.Source name={typedName} isTypeOnly isExportable isIndexable>
|
|
67
80
|
{output}
|
|
@@ -12,7 +12,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
|
|
|
12
12
|
name: 'typescript',
|
|
13
13
|
type: 'react',
|
|
14
14
|
Operation({ node, adapter, options, config }) {
|
|
15
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options
|
|
15
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options
|
|
16
16
|
|
|
17
17
|
const root = path.resolve(config.root, config.output.path)
|
|
18
18
|
const mode = getMode(path.resolve(root, output.path))
|
|
@@ -55,6 +55,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
|
|
|
55
55
|
node={transformedNode}
|
|
56
56
|
description={description}
|
|
57
57
|
enumType={enumType}
|
|
58
|
+
enumTypeSuffix={enumTypeSuffix}
|
|
58
59
|
enumKeyCasing={enumKeyCasing}
|
|
59
60
|
optionalType={optionalType}
|
|
60
61
|
arrayType={arrayType}
|
|
@@ -131,7 +132,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
|
|
|
131
132
|
)
|
|
132
133
|
},
|
|
133
134
|
Schema({ node, adapter, options, config }) {
|
|
134
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options
|
|
135
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options
|
|
135
136
|
|
|
136
137
|
const root = path.resolve(config.root, config.output.path)
|
|
137
138
|
const mode = getMode(path.resolve(root, output.path))
|
|
@@ -149,7 +150,8 @@ export const typeGenerator = defineGenerator<PluginTs>({
|
|
|
149
150
|
|
|
150
151
|
const isEnumSchema = !!narrowSchema(node, schemaTypes.enum)
|
|
151
152
|
|
|
152
|
-
const typedName =
|
|
153
|
+
const typedName =
|
|
154
|
+
ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolver.resolveTypedName(node.name)
|
|
153
155
|
|
|
154
156
|
const type = {
|
|
155
157
|
name: resolver.resolveName(node.name),
|
|
@@ -174,6 +176,7 @@ export const typeGenerator = defineGenerator<PluginTs>({
|
|
|
174
176
|
typedName={type.typedName}
|
|
175
177
|
node={transformedNode}
|
|
176
178
|
enumType={enumType}
|
|
179
|
+
enumTypeSuffix={enumTypeSuffix}
|
|
177
180
|
enumKeyCasing={enumKeyCasing}
|
|
178
181
|
optionalType={optionalType}
|
|
179
182
|
arrayType={arrayType}
|
|
@@ -157,7 +157,7 @@ export const typeGeneratorLegacy = defineGenerator<PluginTs>({
|
|
|
157
157
|
name: 'typescript-legacy',
|
|
158
158
|
type: 'react',
|
|
159
159
|
Operation({ node, adapter, options, config }) {
|
|
160
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options
|
|
160
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, output, resolver, transformers = [] } = options
|
|
161
161
|
|
|
162
162
|
const root = path.resolve(config.root, config.output.path)
|
|
163
163
|
const mode = getMode(path.resolve(root, output.path))
|
|
@@ -199,6 +199,7 @@ export const typeGeneratorLegacy = defineGenerator<PluginTs>({
|
|
|
199
199
|
node={transformedNode}
|
|
200
200
|
description={description}
|
|
201
201
|
enumType={enumType}
|
|
202
|
+
enumTypeSuffix={enumTypeSuffix}
|
|
202
203
|
enumKeyCasing={enumKeyCasing}
|
|
203
204
|
optionalType={optionalType}
|
|
204
205
|
arrayType={arrayType}
|
|
@@ -290,7 +291,7 @@ export const typeGeneratorLegacy = defineGenerator<PluginTs>({
|
|
|
290
291
|
)
|
|
291
292
|
},
|
|
292
293
|
Schema({ node, adapter, options, config }) {
|
|
293
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options
|
|
294
|
+
const { enumType, enumTypeSuffix, enumKeyCasing, syntaxType, optionalType, arrayType, output, group, resolver, transformers = [] } = options
|
|
294
295
|
|
|
295
296
|
const root = path.resolve(config.root, config.output.path)
|
|
296
297
|
const mode = getMode(path.resolve(root, output.path))
|
|
@@ -308,7 +309,8 @@ export const typeGeneratorLegacy = defineGenerator<PluginTs>({
|
|
|
308
309
|
|
|
309
310
|
const isEnumSchema = !!narrowSchema(node, schemaTypes.enum)
|
|
310
311
|
|
|
311
|
-
const typedName =
|
|
312
|
+
const typedName =
|
|
313
|
+
ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node, enumTypeSuffix) : resolver.resolveTypedName(node.name)
|
|
312
314
|
|
|
313
315
|
const type = {
|
|
314
316
|
name: resolver.resolveName(node.name),
|
|
@@ -333,6 +335,7 @@ export const typeGeneratorLegacy = defineGenerator<PluginTs>({
|
|
|
333
335
|
typedName={type.typedName}
|
|
334
336
|
node={transformedNode}
|
|
335
337
|
enumType={enumType}
|
|
338
|
+
enumTypeSuffix={enumTypeSuffix}
|
|
336
339
|
enumKeyCasing={enumKeyCasing}
|
|
337
340
|
optionalType={optionalType}
|
|
338
341
|
arrayType={arrayType}
|
package/src/plugin.ts
CHANGED
|
@@ -4,8 +4,27 @@ import { createPlugin, getBarrelFiles, renderOperation, renderSchema } from '@ku
|
|
|
4
4
|
import { getPreset } from './presets.ts'
|
|
5
5
|
import type { PluginTs } from './types.ts'
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Canonical plugin name for `@kubb/plugin-ts`, used to identify the plugin in driver lookups and warnings.
|
|
9
|
+
*/
|
|
7
10
|
export const pluginTsName = 'plugin-ts' satisfies PluginTs['name']
|
|
8
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The `@kubb/plugin-ts` plugin factory.
|
|
14
|
+
*
|
|
15
|
+
* Generates TypeScript type declarations from an OpenAPI/AST `RootNode`.
|
|
16
|
+
* Walks schemas and operations, delegates rendering to the active generators,
|
|
17
|
+
* and writes barrel files based on `output.barrelType`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { pluginTs } from '@kubb/plugin-ts'
|
|
22
|
+
*
|
|
23
|
+
* export default defineConfig({
|
|
24
|
+
* plugins: [pluginTs({ output: { path: 'types' }, enumType: 'asConst' })],
|
|
25
|
+
* })
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
9
28
|
export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
10
29
|
const {
|
|
11
30
|
output = { path: 'types', barrelType: 'named' },
|
|
@@ -14,6 +33,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
|
14
33
|
include,
|
|
15
34
|
override = [],
|
|
16
35
|
enumType = 'asConst',
|
|
36
|
+
enumTypeSuffix = 'Key',
|
|
17
37
|
enumKeyCasing = 'none',
|
|
18
38
|
optionalType = 'questionToken',
|
|
19
39
|
arrayType = 'array',
|
|
@@ -42,6 +62,7 @@ export const pluginTs = createPlugin<PluginTs>((options) => {
|
|
|
42
62
|
group,
|
|
43
63
|
arrayType,
|
|
44
64
|
enumType,
|
|
65
|
+
enumTypeSuffix,
|
|
45
66
|
enumKeyCasing,
|
|
46
67
|
syntaxType,
|
|
47
68
|
paramsCasing,
|
package/src/presets.ts
CHANGED
|
@@ -4,6 +4,12 @@ import { typeGenerator, typeGeneratorLegacy } from './generators/index.ts'
|
|
|
4
4
|
import { resolverTs, resolverTsLegacy } from './resolvers/index.ts'
|
|
5
5
|
import type { PluginTs, ResolverTs } from './types.ts'
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Built-in preset registry for `@kubb/plugin-ts`.
|
|
9
|
+
*
|
|
10
|
+
* - `default` — uses `resolverTs` and `typeGenerator` (current naming conventions).
|
|
11
|
+
* - `kubbV4` — uses `resolverTsLegacy` and `typeGeneratorLegacy` (Kubb v4 naming conventions).
|
|
12
|
+
*/
|
|
7
13
|
export const presets = definePresets<ResolverTs>({
|
|
8
14
|
default: definePreset('default', { resolvers: [resolverTs], generators: [typeGenerator] }),
|
|
9
15
|
kubbV4: definePreset('kubbV4', { resolvers: [resolverTsLegacy], generators: [typeGeneratorLegacy] }),
|
|
@@ -15,6 +21,17 @@ type GetPresetOptions = {
|
|
|
15
21
|
generators: Array<Generator<PluginTs>>
|
|
16
22
|
}
|
|
17
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Resolves a compatibility preset for `plugin-ts`, merging user-supplied resolvers,
|
|
26
|
+
* transformers, and generators on top of the built-in preset defaults.
|
|
27
|
+
*
|
|
28
|
+
* `resolverTs` is always prepended to the resolver list as the baseline.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const preset = getPreset('kubbV4', { resolvers: [], transformers: [], generators: [] })
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
18
35
|
export function getPreset(preset: CompatibilityPreset, { resolvers, transformers, generators }: GetPresetOptions) {
|
|
19
36
|
return getCorePreset({
|
|
20
37
|
preset,
|
|
@@ -22,6 +22,12 @@ type TsOptions = {
|
|
|
22
22
|
* @default `'inlineLiteral'`
|
|
23
23
|
*/
|
|
24
24
|
enumType: PluginTs['resolvedOptions']['enumType']
|
|
25
|
+
/**
|
|
26
|
+
* Suffix appended to the generated type alias name when `enumType` is `asConst` or `asPascalConst`.
|
|
27
|
+
*
|
|
28
|
+
* @default `'Key'`
|
|
29
|
+
*/
|
|
30
|
+
enumTypeSuffix?: PluginTs['resolvedOptions']['enumTypeSuffix']
|
|
25
31
|
/**
|
|
26
32
|
* Controls whether a `type` alias or `interface` declaration is emitted.
|
|
27
33
|
* @default `'type'`
|
|
@@ -264,10 +270,12 @@ export const printerTs = definePrinter<TsPrinter>((options) => {
|
|
|
264
270
|
return factory.createUnionDeclaration({ withParentheses: true, nodes: literalNodes }) ?? undefined
|
|
265
271
|
}
|
|
266
272
|
|
|
267
|
-
const resolvedName =
|
|
268
|
-
|
|
273
|
+
const resolvedName =
|
|
274
|
+
ENUM_TYPES_WITH_KEY_SUFFIX.has(this.options.enumType) && this.options.enumTypeSuffix
|
|
275
|
+
? this.options.resolver.resolveEnumKeyTypedName(node as unknown as SchemaNode, this.options.enumTypeSuffix)
|
|
276
|
+
: this.options.resolver.default(node.name, 'type')
|
|
269
277
|
|
|
270
|
-
return factory.createTypeReferenceNode(
|
|
278
|
+
return factory.createTypeReferenceNode(resolvedName, undefined)
|
|
271
279
|
},
|
|
272
280
|
union(node) {
|
|
273
281
|
const members = node.members ?? []
|
|
@@ -76,8 +76,8 @@ export const resolverTs = defineResolver<PluginTs>(() => {
|
|
|
76
76
|
resolveResponseTypedName(node) {
|
|
77
77
|
return this.resolveTypedName(`${node.operationId} Response`)
|
|
78
78
|
},
|
|
79
|
-
resolveEnumKeyTypedName(node) {
|
|
80
|
-
return `${this.resolveTypedName(node.name ?? '')}
|
|
79
|
+
resolveEnumKeyTypedName(node, enumTypeSuffix = 'key') {
|
|
80
|
+
return `${this.resolveTypedName(node.name ?? '')}${enumTypeSuffix}`
|
|
81
81
|
},
|
|
82
82
|
resolvePathParamsName(_node) {
|
|
83
83
|
throw new Error("resolvePathParamsName is only available with compatibilityPreset: 'kubbV4'. Use resolveParamName per individual parameter instead.")
|
package/src/types.ts
CHANGED
|
@@ -135,12 +135,14 @@ export type ResolverTs = Resolver & {
|
|
|
135
135
|
resolveResponseTypedName(node: OperationNode): string
|
|
136
136
|
/**
|
|
137
137
|
* Resolves the TypeScript type alias name for an enum schema's key variant.
|
|
138
|
-
* Appends
|
|
138
|
+
* Appends `enumTypeSuffix` (default `'Key'`) after applying the default naming convention.
|
|
139
139
|
*
|
|
140
140
|
* @example
|
|
141
|
-
* resolver.resolveEnumKeyTypedName(node)
|
|
141
|
+
* resolver.resolveEnumKeyTypedName(node, 'Key') // → 'PetStatusKey'
|
|
142
|
+
* resolver.resolveEnumKeyTypedName(node, 'Value') // → 'PetStatusValue'
|
|
143
|
+
* resolver.resolveEnumKeyTypedName(node, '') // → 'PetStatus'
|
|
142
144
|
*/
|
|
143
|
-
resolveEnumKeyTypedName(node: SchemaNode): string
|
|
145
|
+
resolveEnumKeyTypedName(node: SchemaNode, enumTypeSuffix: string): string
|
|
144
146
|
/**
|
|
145
147
|
* Resolves the variable/function name for an operation's grouped path parameters type.
|
|
146
148
|
* Only available with `compatibilityPreset: 'kubbV4'`.
|
|
@@ -197,12 +199,18 @@ export type ResolverTs = Resolver & {
|
|
|
197
199
|
resolveHeaderParamsTypedName?(node: OperationNode): string
|
|
198
200
|
}
|
|
199
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Options for building a grouped parameter schema (`pathParams`, `queryParams`, `headerParams`).
|
|
204
|
+
*/
|
|
200
205
|
type BuildParamsSchemaOptions = {
|
|
201
206
|
params: Array<ParameterNode>
|
|
202
207
|
node: OperationNode
|
|
203
208
|
resolver: ResolverTs
|
|
204
209
|
}
|
|
205
210
|
|
|
211
|
+
/**
|
|
212
|
+
* Options for building an operation-level schema (`data`, `responses`, `responseUnion`).
|
|
213
|
+
*/
|
|
206
214
|
type BuildOperationSchemaOptions = {
|
|
207
215
|
node: OperationNode
|
|
208
216
|
resolver: ResolverTs
|
|
@@ -213,9 +221,21 @@ type BuildOperationSchemaOptions = {
|
|
|
213
221
|
* Extends the base `Builder` with schema-building helpers used by the v5 type generator.
|
|
214
222
|
*/
|
|
215
223
|
export type BuilderTs = Builder & {
|
|
224
|
+
/**
|
|
225
|
+
* Builds an object schema that groups the given parameters by name.
|
|
226
|
+
*/
|
|
216
227
|
buildParams(options: BuildParamsSchemaOptions): SchemaNode
|
|
228
|
+
/**
|
|
229
|
+
* Builds the combined data schema containing `pathParams`, `queryParams`, `headerParams`, `data`, and `url`.
|
|
230
|
+
*/
|
|
217
231
|
buildData(options: BuildOperationSchemaOptions): SchemaNode
|
|
232
|
+
/**
|
|
233
|
+
* Builds an object schema that maps each response status code to its type reference, or `null` when there are no responses.
|
|
234
|
+
*/
|
|
218
235
|
buildResponses(options: BuildOperationSchemaOptions): SchemaNode | null
|
|
236
|
+
/**
|
|
237
|
+
* Builds a union schema of all response status types, or `null` when no responses have a schema.
|
|
238
|
+
*/
|
|
219
239
|
buildResponseUnion(options: BuildOperationSchemaOptions): SchemaNode | null
|
|
220
240
|
}
|
|
221
241
|
|
|
@@ -258,6 +278,15 @@ export type Options = {
|
|
|
258
278
|
* @note In Kubb v5, 'inlineLiteral' becomes the default.
|
|
259
279
|
*/
|
|
260
280
|
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral'
|
|
281
|
+
/**
|
|
282
|
+
* Suffix appended to the generated type alias name when `enumType` is `asConst` or `asPascalConst`.
|
|
283
|
+
*
|
|
284
|
+
* Only affects the type alias — the const object name is unchanged.
|
|
285
|
+
*
|
|
286
|
+
* @default 'Key'
|
|
287
|
+
* @example enumTypeSuffix: 'Value' → `export type PetStatusValue = …`
|
|
288
|
+
*/
|
|
289
|
+
enumTypeSuffix?: string
|
|
261
290
|
/**
|
|
262
291
|
* Choose the casing for enum key names.
|
|
263
292
|
* - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
|
|
@@ -344,6 +373,7 @@ type ResolvedOptions = {
|
|
|
344
373
|
output: Output
|
|
345
374
|
group: Options['group']
|
|
346
375
|
enumType: NonNullable<Options['enumType']>
|
|
376
|
+
enumTypeSuffix: NonNullable<Options['enumTypeSuffix']>
|
|
347
377
|
enumKeyCasing: NonNullable<Options['enumKeyCasing']>
|
|
348
378
|
optionalType: NonNullable<Options['optionalType']>
|
|
349
379
|
arrayType: NonNullable<Options['arrayType']>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Type-B6fo0gSk.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 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({ node, enumType, resolver }: { node: EnumSchemaNode; enumType: PluginTs['resolvedOptions']['enumType']; resolver: ResolverTs }): {\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) ? `${resolved}Key` : 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, enumKeyCasing, resolver }: Props): FabricReactNode {\n const { enumName, typeName, refName } = getEnumNames({ node, enumType, 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 const needsRefAlias = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && refName !== typeName\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 {needsRefAlias && (\n <File.Source name={refName} isExportable isIndexable isTypeOnly>\n {`export type ${refName} = ${typeName}`}\n </File.Source>\n )}\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 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 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({ optionalType, arrayType, enumType, typeName: name, syntaxType, description: resolvedDescription, keysToOmit, resolver })\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, 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 && enums.map(({ node }) => <Enum node={node} enumType={enumType} 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":";;;;;;;;;;;;;;;AAuBA,SAAgB,aAAa,EAAE,MAAM,UAAU,YAQ7C;CACA,MAAM,WAAW,SAAS,QAAQ,KAAK,MAAO,OAAO;AAIrD,QAAO;EAAE,UAHQ,aAAa,kBAAkB,WAAW,UAAU,KAAK,KAAM;EAG7D,UAFF,2BAA2B,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO;EAElD,SAAS;EAAU;;;;;;;;;;;;;AAclD,SAAgB,KAAK,EAAE,MAAM,UAAU,eAAe,YAAoC;CACxF,MAAM,EAAE,UAAU,UAAU,YAAY,aAAa;EAAE;EAAM;EAAU;EAAU,CAAC;CAElF,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;CAEF,MAAM,gBAAgB,2BAA2B,IAAI,SAAS,IAAI,YAAY;AAE9E,QACE,qBAAA,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AA,CAAC,EACxI,oBACC,oBAAC,KAAK,QAAN;EAAa,MAAM;EAAW,YAAA;EAAW,cAAA;EAAa,aAAA;YACnD;EACW,CAAA,CAEf,EAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Type-oFwUfkZv.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 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({ node, enumType, resolver }: { node: EnumSchemaNode; enumType: PluginTs['resolvedOptions']['enumType']; resolver: ResolverTs }): {\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) ? `${resolved}Key` : 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, enumKeyCasing, resolver }: Props): FabricReactNode {\n const { enumName, typeName, refName } = getEnumNames({ node, enumType, 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 const needsRefAlias = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && refName !== typeName\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 {needsRefAlias && (\n <File.Source name={refName} isExportable isIndexable isTypeOnly>\n {`export type ${refName} = ${typeName}`}\n </File.Source>\n )}\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 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 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({ optionalType, arrayType, enumType, typeName: name, syntaxType, description: resolvedDescription, keysToOmit, resolver })\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, 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 && enums.map(({ node }) => <Enum node={node} enumType={enumType} 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":";;;;;;;;;;;;;;;AAuBA,SAAgB,aAAa,EAAE,MAAM,UAAU,YAQ7C;CACA,MAAM,WAAW,SAAS,QAAQ,KAAK,MAAO,OAAO;AAIrD,QAAO;EAAE,UAHQ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,SAAgB,KAAK,EACnB,MACA,WACA,MACA,YACA,cACA,WACA,YACA,UACA,eACA,aACA,YACyB;CACzB,MAAM,sBAAsB,eAAe,MAAM;CACjD,MAAM,mBAAA,GAAA,UAAA,SAA0C,MAAM,EACpD,OAAO,GAA+B;EACpC,MAAM,YAAA,GAAA,UAAA,cAAwB,GAAGG,UAAAA,YAAY,KAAK;AAClD,MAAI,UAAU,KAAM,QAAO;IAE9B,CAAC;CAGF,MAAM,SADUC,kBAAAA,UAAU;EAAE;EAAc;EAAW;EAAU,UAAU;EAAM;EAAY,aAAa;EAAqB;EAAY;EAAU,CAAC,CAC7H,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;IAAU,CAAC;GAC9C;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,qBAAqB,MAAM,KAAK,EAAE,WAAW,iBAAA,GAAA,+BAAA,KAAC,MAAD;EAAY;EAAgB;EAAyB;EAAyB;EAAY,CAAA,CAAC,EACxI,oBACC,iBAAA,GAAA,+BAAA,KAACC,mBAAAA,KAAK,QAAN;EAAa,MAAM;EAAW,YAAA;EAAW,cAAA;EAAa,aAAA;YACnD;EACW,CAAA,CAEf,EAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builderTs-Cd3juc2G.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\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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CAAC,IAAA,GAAA,UAAA,cACjF;MAAE,MAAM;MAAS,UAAU;MAAM,CAAC;KACtD,CAAC;kCACa;KACb,MAAM;KACN,QACE,aAAa,SAAS,KAAA,GAAA,UAAA,cACL;MAAE,GAAG,KAAK,YAAY;OAAE,QAAQ;OAAc;OAAM;OAAU,CAAC;MAAE,UAAU;MAAM,CAAC,IAAA,GAAA,UAAA,cAClF;MAAE,MAAM;MAAS,UAAU;MAAM,CAAC;KACtD,CAAC;kCACa;KACb,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builderTs-DausqHpc.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\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":";;;;AAIA,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,SAAS;AAErE,SAAO,aAAa;GAClB,MAAM;GACN,YAAY,KAAK;GACjB,YAAY;IACV,eAAe;KACb,MAAM;KACN,QAAQ,KAAK,aAAa,SACtB,aAAa;MAAE,MAAM;MAAO,MAAM,SAAS,qBAAqB,KAAK;MAAE,UAAU;MAAM,CAAC,GACxF,aAAa;MAAE,MAAM;MAAS,UAAU;MAAM,CAAC;KACpD,CAAC;IACF,eAAe;KACb,MAAM;KACN,UAAU,WAAW,SAAS;KAC9B,QAAQ,WAAW,SAAS,IAAI,KAAK,YAAY;MAAE,QAAQ;MAAY;MAAM;MAAU,CAAC,GAAG,aAAa,EAAE,MAAM,SAAS,CAAC;KAC3H,CAAC;IACF,eAAe;KACb,MAAM;KACN,QACE,YAAY,SAAS,IACjB,aAAa;MAAE,GAAG,KAAK,YAAY;OAAE,QAAQ;OAAa;OAAM;OAAU,CAAC;MAAE,UAAU;MAAM,CAAC,GAC9F,aAAa;MAAE,MAAM;MAAS,UAAU;MAAM,CAAC;KACtD,CAAC;IACF,eAAe;KACb,MAAM;KACN,QACE,aAAa,SAAS,IAClB,aAAa;MAAE,GAAG,KAAK,YAAY;OAAE,QAAQ;OAAc;OAAM;OAAU,CAAC;MAAE,UAAU;MAAM,CAAC,GAC/F,aAAa;MAAE,MAAM;MAAS,UAAU;MAAM,CAAC;KACtD,CAAC;IACF,eAAe;KACb,MAAM;KACN,UAAU;KACV,QAAQ,aAAa;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,SAAO,aAAa;GAClB,MAAM;GACN,YAAY,KAAK,UAAU,KAAK,QAC9B,eAAe;IACb,MAAM,OAAO,IAAI,WAAW;IAC5B,UAAU;IACV,QAAQ,aAAa;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,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-ByK18qUn.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, 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 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, 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 = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : 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 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, 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 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, 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 = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : 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 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,eAAe,cAAc,WAAW,YAAY,cAAc,OAAO,QAAQ,UAAU,eAAe,EAAE,KAAK;EAEnI,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,YAAY,aAAa;EAExD,SAAS,iBAAiB,EACxB,MAAM,YACN,MACA,WACA,aACA,cAOC;AACD,OAAI,CAAC,WACH,QAAO;GAGT,MAAM,kBAAkB,UAAU,YAAY,oBAAoB,GAAG,aAAa,CAAC;GAEnF,MAAM,UAAU,QAAQ,WAAW,kBAAkB,gBAAgB;IACnE,MAAM,SAAS,QAAQ,YAAY,OAAO;IAC1C,MAAM,SAAS,YA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AAW,KAAK;IAChB,MAAM;IACI;IACK;IACD;IACH;IACC;IACF;IACV,CAAA,CACG;;;CAGZ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-aSsiTfUO.cjs","names":["path","File","Type","builderTs","schemaTypes","ENUM_TYPES_WITH_KEY_SUFFIX","pascalCase","path","File","Type","resolverTsLegacy","schemaTypes","ENUM_TYPES_WITH_KEY_SUFFIX"],"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, 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 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, 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 = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : 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 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, 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 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, 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 = ENUM_TYPES_WITH_KEY_SUFFIX.has(enumType) && isEnumSchema ? resolver.resolveEnumKeyTypedName(node) : 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 enumKeyCasing={enumKeyCasing}\n optionalType={optionalType}\n arrayType={arrayType}\n syntaxType={syntaxType}\n resolver={resolver}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAUA,MAAa,iBAAA,GAAA,WAAA,iBAA0C;CACrD,MAAM;CACN,MAAM;CACN,UAAU,EAAE,MAAM,SAAS,SAAS,UAAU;EAC5C,MAAM,EAAE,UAAU,eAAe,cAAc,WAAW,YAAY,cAAc,OAAO,QAAQ,UAAU,eAAe,EAAE,KAAK;EAEnI,MAAM,OAAOA,UAAAA,QAAK,QAAQ,OAAO,MAAM,OAAO,OAAO,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