@kubb/plugin-ts 5.0.0-alpha.13 → 5.0.0-alpha.14
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/components.d.ts +1 -1
- package/dist/{generators-CX3cSSdF.cjs → generators-B6JGhHkV.cjs} +28 -22
- package/dist/generators-B6JGhHkV.cjs.map +1 -0
- package/dist/{generators-dCqW0ECC.js → generators-BTTcjgbY.js} +29 -23
- package/dist/generators-BTTcjgbY.js.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-B5pSjbZv.d.ts +51 -0
- package/dist/index.cjs +10 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +10 -15
- package/dist/index.js.map +1 -1
- package/dist/{resolvers-CH7hINyz.js → resolvers-C_vYX56l.js} +3 -1
- package/dist/resolvers-C_vYX56l.js.map +1 -0
- package/dist/{resolvers-ebHaaCyw.cjs → resolvers-DDZC7d43.cjs} +3 -1
- package/dist/resolvers-DDZC7d43.cjs.map +1 -0
- package/dist/resolvers.cjs +1 -1
- package/dist/resolvers.d.ts +2 -51
- package/dist/resolvers.js +1 -1
- package/dist/{types-BSRhtbGl.d.ts → types-D9zzvE0V.d.ts} +38 -21
- package/package.json +5 -5
- package/src/generators/typeGenerator.tsx +16 -12
- package/src/generators/utils.ts +13 -6
- package/src/index.ts +2 -1
- package/src/plugin.ts +52 -67
- package/src/resolvers/resolverTs.ts +1 -0
- package/src/resolvers/resolverTsLegacy.ts +1 -0
- package/src/types.ts +37 -20
- package/dist/generators-CX3cSSdF.cjs.map +0 -1
- package/dist/generators-dCqW0ECC.js.map +0 -1
- package/dist/resolvers-CH7hINyz.js.map +0 -1
- package/dist/resolvers-ebHaaCyw.cjs.map +0 -1
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { n as PluginTs, r as ResolverTs } from "./types-
|
|
2
|
+
import { n as PluginTs, r as ResolverTs } from "./types-D9zzvE0V.js";
|
|
3
3
|
import { EnumSchemaNode, SchemaNode } from "@kubb/ast/types";
|
|
4
4
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
@@ -17,10 +17,10 @@ function buildParamsSchema({ params, node, resolver }) {
|
|
|
17
17
|
type: "object",
|
|
18
18
|
properties: params.map((param) => (0, _kubb_ast.createProperty)({
|
|
19
19
|
name: param.name,
|
|
20
|
+
required: param.required,
|
|
20
21
|
schema: (0, _kubb_ast.createSchema)({
|
|
21
22
|
type: "ref",
|
|
22
|
-
name: resolver.resolveParamName(node, param)
|
|
23
|
-
optional: !param.required
|
|
23
|
+
name: resolver.resolveParamName(node, param)
|
|
24
24
|
})
|
|
25
25
|
}))
|
|
26
26
|
});
|
|
@@ -54,14 +54,12 @@ function buildDataSchemaNode({ node, resolver }) {
|
|
|
54
54
|
}),
|
|
55
55
|
(0, _kubb_ast.createProperty)({
|
|
56
56
|
name: "pathParams",
|
|
57
|
+
required: pathParams.length > 0,
|
|
57
58
|
schema: pathParams.length > 0 ? buildParamsSchema({
|
|
58
59
|
params: pathParams,
|
|
59
60
|
node,
|
|
60
61
|
resolver
|
|
61
|
-
}) : (0, _kubb_ast.createSchema)({
|
|
62
|
-
type: "never",
|
|
63
|
-
optional: true
|
|
64
|
-
})
|
|
62
|
+
}) : (0, _kubb_ast.createSchema)({ type: "never" })
|
|
65
63
|
}),
|
|
66
64
|
(0, _kubb_ast.createProperty)({
|
|
67
65
|
name: "queryParams",
|
|
@@ -93,6 +91,7 @@ function buildDataSchemaNode({ node, resolver }) {
|
|
|
93
91
|
}),
|
|
94
92
|
(0, _kubb_ast.createProperty)({
|
|
95
93
|
name: "url",
|
|
94
|
+
required: true,
|
|
96
95
|
schema: (0, _kubb_ast.createSchema)({
|
|
97
96
|
type: "url",
|
|
98
97
|
path: node.path
|
|
@@ -112,6 +111,7 @@ function buildResponsesSchemaNode({ node, resolver }) {
|
|
|
112
111
|
type: "object",
|
|
113
112
|
properties: node.responses.map((res) => (0, _kubb_ast.createProperty)({
|
|
114
113
|
name: String(res.statusCode),
|
|
114
|
+
required: true,
|
|
115
115
|
schema: (0, _kubb_ast.createSchema)({
|
|
116
116
|
type: "ref",
|
|
117
117
|
name: resolver.resolveResponseStatusTypedName(node, res.statusCode)
|
|
@@ -144,10 +144,7 @@ function buildGroupedParamsSchema({ params, parentName }) {
|
|
|
144
144
|
return (0, _kubb_ast.createSchema)({
|
|
145
145
|
type: "object",
|
|
146
146
|
properties: params.map((param) => {
|
|
147
|
-
let schema =
|
|
148
|
-
...param.schema,
|
|
149
|
-
optional: !param.required
|
|
150
|
-
};
|
|
147
|
+
let schema = param.schema;
|
|
151
148
|
if ((0, _kubb_ast.narrowSchema)(schema, "enum") && !schema.name && parentName) schema = {
|
|
152
149
|
...schema,
|
|
153
150
|
name: require_casing.pascalCase([
|
|
@@ -158,6 +155,7 @@ function buildGroupedParamsSchema({ params, parentName }) {
|
|
|
158
155
|
};
|
|
159
156
|
return (0, _kubb_ast.createProperty)({
|
|
160
157
|
name: param.name,
|
|
158
|
+
required: param.required,
|
|
161
159
|
schema
|
|
162
160
|
});
|
|
163
161
|
})
|
|
@@ -199,10 +197,12 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
199
197
|
}) : (0, _kubb_ast.createSchema)({ type: "any" });
|
|
200
198
|
const properties = [(0, _kubb_ast.createProperty)({
|
|
201
199
|
name: "Response",
|
|
200
|
+
required: true,
|
|
202
201
|
schema: responseSchema
|
|
203
202
|
})];
|
|
204
203
|
if (!isGet && node.requestBody?.schema) properties.push((0, _kubb_ast.createProperty)({
|
|
205
204
|
name: "Request",
|
|
205
|
+
required: true,
|
|
206
206
|
schema: (0, _kubb_ast.createSchema)({
|
|
207
207
|
type: "ref",
|
|
208
208
|
name: resolver.resolveDataTypedName(node)
|
|
@@ -210,6 +210,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
210
210
|
}));
|
|
211
211
|
if (node.parameters.some((p) => p.in === "query") && resolver.resolveQueryParamsTypedName) properties.push((0, _kubb_ast.createProperty)({
|
|
212
212
|
name: "QueryParams",
|
|
213
|
+
required: true,
|
|
213
214
|
schema: (0, _kubb_ast.createSchema)({
|
|
214
215
|
type: "ref",
|
|
215
216
|
name: resolver.resolveQueryParamsTypedName(node)
|
|
@@ -217,6 +218,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
217
218
|
}));
|
|
218
219
|
if (node.parameters.some((p) => p.in === "path") && resolver.resolvePathParamsTypedName) properties.push((0, _kubb_ast.createProperty)({
|
|
219
220
|
name: "PathParams",
|
|
221
|
+
required: true,
|
|
220
222
|
schema: (0, _kubb_ast.createSchema)({
|
|
221
223
|
type: "ref",
|
|
222
224
|
name: resolver.resolvePathParamsTypedName(node)
|
|
@@ -224,6 +226,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
224
226
|
}));
|
|
225
227
|
if (node.parameters.some((p) => p.in === "header") && resolver.resolveHeaderParamsTypedName) properties.push((0, _kubb_ast.createProperty)({
|
|
226
228
|
name: "HeaderParams",
|
|
229
|
+
required: true,
|
|
227
230
|
schema: (0, _kubb_ast.createSchema)({
|
|
228
231
|
type: "ref",
|
|
229
232
|
name: resolver.resolveHeaderParamsTypedName(node)
|
|
@@ -231,6 +234,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
231
234
|
}));
|
|
232
235
|
properties.push((0, _kubb_ast.createProperty)({
|
|
233
236
|
name: "Errors",
|
|
237
|
+
required: true,
|
|
234
238
|
schema: errorsSchema
|
|
235
239
|
}));
|
|
236
240
|
return (0, _kubb_ast.createSchema)({
|
|
@@ -299,7 +303,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
299
303
|
name: "typescript",
|
|
300
304
|
type: "react",
|
|
301
305
|
Operation({ node, adapter, options }) {
|
|
302
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy } = options;
|
|
306
|
+
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy, transformers = [] } = options;
|
|
303
307
|
const { mode, getFile, resolveBanner, resolveFooter } = (0, _kubb_core_hooks.useKubb)();
|
|
304
308
|
const file = getFile({
|
|
305
309
|
name: node.operationId,
|
|
@@ -310,7 +314,8 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
310
314
|
const params = (0, _kubb_ast.applyParamsCasing)(node.parameters, paramsCasing);
|
|
311
315
|
function renderSchemaType({ node: schemaNode, name, typedName, description, keysToOmit }) {
|
|
312
316
|
if (!schemaNode) return null;
|
|
313
|
-
const
|
|
317
|
+
const transformedNode = (0, _kubb_ast.transform)(schemaNode, (0, _kubb_ast.composeTransformers)(...transformers));
|
|
318
|
+
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
314
319
|
name: resolver.default(schemaName, "type"),
|
|
315
320
|
path: getFile({
|
|
316
321
|
name: schemaName,
|
|
@@ -330,7 +335,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
330
335
|
].join("-"))), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_Type.Type, {
|
|
331
336
|
name,
|
|
332
337
|
typedName,
|
|
333
|
-
node:
|
|
338
|
+
node: transformedNode,
|
|
334
339
|
description,
|
|
335
340
|
enumType,
|
|
336
341
|
enumKeyCasing,
|
|
@@ -344,7 +349,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
344
349
|
}
|
|
345
350
|
const responseTypes = legacy ? node.responses.map((res) => {
|
|
346
351
|
const responseName = resolver.resolveResponseStatusName(node, res.statusCode);
|
|
347
|
-
const baseResponseName =
|
|
352
|
+
const baseResponseName = baseResolver.resolveResponseStatusName(node, res.statusCode);
|
|
348
353
|
return renderSchemaType({
|
|
349
354
|
node: res.schema ? nameUnnamedEnums(res.schema, baseResponseName) : res.schema,
|
|
350
355
|
name: responseName,
|
|
@@ -360,7 +365,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
360
365
|
keysToOmit: res.keysToOmit
|
|
361
366
|
}));
|
|
362
367
|
const requestType = node.requestBody?.schema ? renderSchemaType({
|
|
363
|
-
node: legacy ? nameUnnamedEnums(node.requestBody.schema,
|
|
368
|
+
node: legacy ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(node)) : node.requestBody.schema,
|
|
364
369
|
name: resolver.resolveDataName(node),
|
|
365
370
|
typedName: resolver.resolveDataTypedName(node),
|
|
366
371
|
description: node.requestBody.description ?? node.requestBody.schema.description,
|
|
@@ -374,7 +379,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
374
379
|
pathParams.length > 0 ? renderSchemaType({
|
|
375
380
|
node: buildGroupedParamsSchema({
|
|
376
381
|
params: pathParams,
|
|
377
|
-
parentName:
|
|
382
|
+
parentName: baseResolver.resolvePathParamsName(node)
|
|
378
383
|
}),
|
|
379
384
|
name: resolver.resolvePathParamsName(node),
|
|
380
385
|
typedName: resolver.resolvePathParamsTypedName(node)
|
|
@@ -382,7 +387,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
382
387
|
queryParams.length > 0 ? renderSchemaType({
|
|
383
388
|
node: buildGroupedParamsSchema({
|
|
384
389
|
params: queryParams,
|
|
385
|
-
parentName:
|
|
390
|
+
parentName: baseResolver.resolveQueryParamsName(node)
|
|
386
391
|
}),
|
|
387
392
|
name: resolver.resolveQueryParamsName(node),
|
|
388
393
|
typedName: resolver.resolveQueryParamsTypedName(node)
|
|
@@ -390,7 +395,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
390
395
|
headerParams.length > 0 ? renderSchemaType({
|
|
391
396
|
node: buildGroupedParamsSchema({
|
|
392
397
|
params: headerParams,
|
|
393
|
-
parentName:
|
|
398
|
+
parentName: baseResolver.resolveHeaderParamsName(node)
|
|
394
399
|
}),
|
|
395
400
|
name: resolver.resolveHeaderParamsName(node),
|
|
396
401
|
typedName: resolver.resolveHeaderParamsTypedName(node)
|
|
@@ -488,10 +493,11 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
488
493
|
});
|
|
489
494
|
},
|
|
490
495
|
Schema({ node, adapter, options }) {
|
|
491
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy } = options;
|
|
496
|
+
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy, transformers = [] } = options;
|
|
492
497
|
const { mode, getFile, resolveBanner, resolveFooter } = (0, _kubb_core_hooks.useKubb)();
|
|
493
498
|
if (!node.name) return;
|
|
494
|
-
const
|
|
499
|
+
const transformedNode = (0, _kubb_ast.transform)(node, (0, _kubb_ast.composeTransformers)(...transformers));
|
|
500
|
+
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
495
501
|
name: resolver.default(schemaName, "type"),
|
|
496
502
|
path: getFile({
|
|
497
503
|
name: schemaName,
|
|
@@ -528,7 +534,7 @@ const typeGenerator = (0, _kubb_core.defineGenerator)({
|
|
|
528
534
|
].join("-"))), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_Type.Type, {
|
|
529
535
|
name: type.name,
|
|
530
536
|
typedName: type.typedName,
|
|
531
|
-
node,
|
|
537
|
+
node: transformedNode,
|
|
532
538
|
enumType,
|
|
533
539
|
enumKeyCasing,
|
|
534
540
|
optionalType,
|
|
@@ -548,4 +554,4 @@ Object.defineProperty(exports, "typeGenerator", {
|
|
|
548
554
|
}
|
|
549
555
|
});
|
|
550
556
|
|
|
551
|
-
//# sourceMappingURL=generators-
|
|
557
|
+
//# sourceMappingURL=generators-B6JGhHkV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-B6JGhHkV.cjs","names":["pascalCase","File","Type","ENUM_TYPES_WITH_KEY_SUFFIX"],"sources":["../src/generators/utils.ts","../src/generators/typeGenerator.tsx"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { createProperty, createSchema, narrowSchema, transform } from '@kubb/ast'\nimport type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'\nimport type { ResolverTs } from '../types.ts'\n\ntype BuildParamsSchemaOptions = {\n params: Array<ParameterNode>\n node: OperationNode\n resolver: ResolverTs\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).\n * Each property is a `ref` schema pointing to the individually-resolved parameter type.\n * The ref name includes the parameter location so generated type names follow\n * the `<OperationId><Location><ParamName>` convention.\n */\nexport function buildParamsSchema({ params, node, resolver }: BuildParamsSchemaOptions): SchemaNode {\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\ntype BuildOperationSchemaOptions = {\n node: OperationNode\n resolver: ResolverTs\n}\n\n/**\n * Builds an `ObjectSchemaNode` representing the `<OperationId>RequestConfig` type:\n * - `data` → request body ref (optional) or `never`\n * - `pathParams` → inline object of path param refs, or `never`\n * - `queryParams` → inline object of query param refs (optional), or `never`\n * - `headerParams` → inline object of header param refs (optional), or `never`\n * - `url` → Express-style template literal (plugin-ts extension, handled by printer)\n */\nexport function buildDataSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {\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({\n type: 'ref',\n name: resolver.resolveDataTypedName(node),\n optional: true,\n })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'pathParams',\n required: pathParams.length > 0,\n schema: pathParams.length > 0 ? buildParamsSchema({ params: pathParams, node, resolver }) : createSchema({ type: 'never' }),\n }),\n createProperty({\n name: 'queryParams',\n schema:\n queryParams.length > 0\n ? createSchema({ ...buildParamsSchema({ 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({ ...buildParamsSchema({ 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\n/**\n * Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.\n * Numeric status codes produce unquoted numeric keys (e.g. `200:`).\n * All responses are included; those without a schema are represented as a ref to a `never` type.\n */\nexport function buildResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\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({\n type: 'ref',\n name: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n }),\n }),\n ),\n })\n}\n\n/**\n * Builds a `UnionSchemaNode` representing `<OperationId>Response` — all response types in union format.\n * Returns `null` when the operation has no responses with schemas.\n */\nexport function buildResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\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) =>\n createSchema({\n type: 'ref',\n name: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n }),\n ),\n })\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ParameterNode>\n /**\n * Parent type name (e.g. `FindPetsByStatusQueryParams`) used to derive enum names\n * for inline enum properties (e.g. `FindPetsByStatusQueryParamsStatusEnum`).\n */\n parentName?: string\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a grouped parameters type (path/query/header) in legacy mode.\n * Each property directly embeds the parameter's schema inline (not a ref).\n * Used to generate `<OperationId>PathParams`, `<OperationId>QueryParams`, `<OperationId>HeaderParams`.\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function 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\n/**\n * Builds the legacy wrapper `ObjectSchemaNode` for `<OperationId>Mutation` / `<OperationId>Query`.\n * Structure: `{ Response, Request?, QueryParams?, PathParams?, HeaderParams?, Errors }`.\n * Mirrors the v4 naming convention where this type acts as a namespace for the operation's shapes.\n *\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function 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\n/**\n * Builds the legacy response union for `<OperationId>MutationResponse` / `<OperationId>QueryResponse`.\n * In legacy mode this is the **success** response only (not the full union including errors).\n * Returns an `any` schema when there is no success response, matching v4 behavior.\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function 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\n/**\n * Names unnamed enum nodes within a schema tree based on the parent type name.\n * Used in legacy mode to ensure inline enums in response/request schemas get\n * extracted as named enum declarations (e.g. `DeletePet200Enum`).\n *\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function nameUnnamedEnums(node: SchemaNode, parentName: string): SchemaNode {\n return transform(node, {\n schema(n) {\n if (n.type === 'enum' && !n.name) {\n return { ...n, 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","import { applyParamsCasing, composeTransformers, transform } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast/types'\nimport { defineGenerator } from '@kubb/core'\nimport { useKubb } from '@kubb/core/hooks'\nimport { File } from '@kubb/react-fabric'\nimport { Type } from '../components/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../constants.ts'\nimport type { PluginTs } from '../types'\nimport {\n buildDataSchemaNode,\n buildGroupedParamsSchema,\n buildLegacyResponsesSchemaNode,\n buildLegacyResponseUnionSchemaNode,\n buildParamsSchema,\n buildResponsesSchemaNode,\n buildResponseUnionSchemaNode,\n nameUnnamedEnums,\n} from './utils.ts'\n\nexport const typeGenerator = defineGenerator<PluginTs>({\n name: 'typescript',\n type: 'react',\n Operation({ node, adapter, options }) {\n const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy, transformers = [] } = options\n const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\n\n const file = getFile({\n name: node.operationId,\n extname: '.ts',\n mode,\n options: {\n group: group ? (group.type === 'tag' ? { tag: node.tags[0] ?? 'default' } : { path: node.path }) : undefined,\n },\n })\n const params = applyParamsCasing(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: getFile({ name: schemaName, extname: '.ts', mode }).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 legacy={legacy}\n />\n </>\n )\n }\n\n const responseTypes = legacy\n ? node.responses.map((res) => {\n const responseName = resolver.resolveResponseStatusName(node, res.statusCode)\n const baseResponseName = baseResolver.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 : 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 requestType = node.requestBody?.schema\n ? renderSchemaType({\n node: legacy ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(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 if (legacy) {\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 legacyParamTypes = [\n pathParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: pathParams, parentName: baseResolver.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: baseResolver.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: baseResolver.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 baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {legacyParamTypes}\n {responseTypes}\n {requestType}\n {legacyResponseType}\n {legacyResponsesType}\n </File>\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 queryParamsList = params.filter((p) => p.in === 'query')\n const queryParamsType =\n queryParamsList.length > 0\n ? renderSchemaType({\n node: buildParamsSchema({ params: queryParamsList, node, resolver }),\n name: resolver.resolveQueryParamsName!(node),\n typedName: resolver.resolveQueryParamsTypedName!(node),\n })\n : null\n\n const dataType = renderSchemaType({\n node: buildDataSchemaNode({ node: { ...node, parameters: params }, resolver }),\n name: resolver.resolveRequestConfigName(node),\n typedName: resolver.resolveRequestConfigTypedName(node),\n })\n\n const responsesType = renderSchemaType({\n node: buildResponsesSchemaNode({ node, resolver }),\n name: resolver.resolveResponsesName(node),\n typedName: resolver.resolveResponsesTypedName(node),\n })\n\n const responseType = renderSchemaType({\n node: buildResponseUnionSchemaNode({ 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 baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {paramTypes}\n {queryParamsType}\n {responseTypes}\n {requestType}\n {dataType}\n {responsesType}\n {responseType}\n </File>\n )\n },\n Schema({ node, adapter, options }) {\n const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy, transformers = [] } = options\n const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\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: getFile({ name: schemaName, extname: '.ts', mode }).path,\n }))\n\n const isEnumSchema = node.type === '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: getFile({ name: node.name, extname: '.ts', mode }),\n } as const\n\n return (\n <File baseName={type.file.baseName} path={type.file.path} meta={type.file.meta} banner={resolveBanner()} footer={resolveFooter()}>\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 legacy={legacy}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,kBAAkB,EAAE,QAAQ,MAAM,YAAkD;AAClG,SAAA,GAAA,UAAA,cAAoB;EAClB,MAAM;EACN,YAAY,OAAO,KAAK,WAAA,GAAA,UAAA,gBACP;GACb,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,SAAA,GAAA,UAAA,cAAqB;IACnB,MAAM;IACN,MAAM,SAAS,iBAAiB,MAAM,MAAM;IAC7C,CAAC;GACH,CAAC,CACH;EACF,CAAC;;;;;;;;;;AAgBJ,SAAgB,oBAAoB,EAAE,MAAM,YAAqD;CAC/F,MAAM,aAAa,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,OAAO;CACjE,MAAM,cAAc,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,QAAQ;CACnE,MAAM,eAAe,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,SAAS;AAErE,SAAA,GAAA,UAAA,cAAoB;EAClB,MAAM;EACN,YAAY,KAAK;EACjB,YAAY;iCACK;IACb,MAAM;IACN,QAAQ,KAAK,aAAa,UAAA,GAAA,UAAA,cACT;KACX,MAAM;KACN,MAAM,SAAS,qBAAqB,KAAK;KACzC,UAAU;KACX,CAAC,IAAA,GAAA,UAAA,cACW;KAAE,MAAM;KAAS,UAAU;KAAM,CAAC;IACpD,CAAC;iCACa;IACb,MAAM;IACN,UAAU,WAAW,SAAS;IAC9B,QAAQ,WAAW,SAAS,IAAI,kBAAkB;KAAE,QAAQ;KAAY;KAAM;KAAU,CAAC,IAAA,GAAA,UAAA,cAAgB,EAAE,MAAM,SAAS,CAAC;IAC5H,CAAC;iCACa;IACb,MAAM;IACN,QACE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AQ,YAAY,OAAO;GAC1C,MAAM,QAAQ;IAAE,MAAM;IAAY,SAAS;IAAO;IAAM,CAAC,CAAC;GAC3D,EAAE;EAEH,MAAM,eAAe,KAAK,SAAS;EAEnC,MAAM,YAAYE,aAAAA,2BAA2B,IAAI,SAAS,IAAI,eAAe,SAAS,wBAAwB,KAAK,GAAG,SAAS,iBAAiB,KAAK,KAAK;EAE1J,MAAM,OAAO;GACX,MAAM,SAAS,YAAY,KAAK,KAAK;GACrC;GACA,MAAM,QAAQ;IAAE,MAAM,KAAK;IAAM,SAAS;IAAO;IAAM,CAAC;GACzD;AAED,SACE,iBAAA,GAAA,+BAAA,MAACF,mBAAAA,MAAD;GAAM,UAAU,KAAK,KAAK;GAAU,MAAM,KAAK,KAAK;GAAM,MAAM,KAAK,KAAK;GAAM,QAAQ,eAAe;GAAE,QAAQ,eAAe;aAAhI,CACG,SAAS,WACR,QAAQ,KAAK,QACX,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;IAAmE,MAAM,KAAK,KAAK;IAAM,MAAM,IAAI;IAAM,MAAM,IAAI;IAAM,YAAA;IAAa,EAApH;IAAC,KAAK;IAAM,IAAI;IAAM,IAAI;IAAW,CAAC,KAAK,IAAI,CAAqE,CACtI,EACJ,iBAAA,GAAA,+BAAA,KAACC,aAAAA,MAAD;IACE,MAAM,KAAK;IACX,WAAW,KAAK;IAChB,MAAM;IACI;IACK;IACD;IACH;IACC;IACF;IACF;IACR,CAAA,CACG;;;CAGZ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { n as pascalCase } from "./casing-Cp-jbC_k.js";
|
|
3
3
|
import { r as ENUM_TYPES_WITH_KEY_SUFFIX, t as Type } from "./Type-C8EHVKjc.js";
|
|
4
|
-
import { applyParamsCasing, createProperty, createSchema, narrowSchema, transform } from "@kubb/ast";
|
|
4
|
+
import { applyParamsCasing, composeTransformers, createProperty, createSchema, narrowSchema, transform } from "@kubb/ast";
|
|
5
5
|
import { defineGenerator } from "@kubb/core";
|
|
6
6
|
import { useKubb } from "@kubb/core/hooks";
|
|
7
7
|
import { File } from "@kubb/react-fabric";
|
|
@@ -18,10 +18,10 @@ function buildParamsSchema({ params, node, resolver }) {
|
|
|
18
18
|
type: "object",
|
|
19
19
|
properties: params.map((param) => createProperty({
|
|
20
20
|
name: param.name,
|
|
21
|
+
required: param.required,
|
|
21
22
|
schema: createSchema({
|
|
22
23
|
type: "ref",
|
|
23
|
-
name: resolver.resolveParamName(node, param)
|
|
24
|
-
optional: !param.required
|
|
24
|
+
name: resolver.resolveParamName(node, param)
|
|
25
25
|
})
|
|
26
26
|
}))
|
|
27
27
|
});
|
|
@@ -55,14 +55,12 @@ function buildDataSchemaNode({ node, resolver }) {
|
|
|
55
55
|
}),
|
|
56
56
|
createProperty({
|
|
57
57
|
name: "pathParams",
|
|
58
|
+
required: pathParams.length > 0,
|
|
58
59
|
schema: pathParams.length > 0 ? buildParamsSchema({
|
|
59
60
|
params: pathParams,
|
|
60
61
|
node,
|
|
61
62
|
resolver
|
|
62
|
-
}) : createSchema({
|
|
63
|
-
type: "never",
|
|
64
|
-
optional: true
|
|
65
|
-
})
|
|
63
|
+
}) : createSchema({ type: "never" })
|
|
66
64
|
}),
|
|
67
65
|
createProperty({
|
|
68
66
|
name: "queryParams",
|
|
@@ -94,6 +92,7 @@ function buildDataSchemaNode({ node, resolver }) {
|
|
|
94
92
|
}),
|
|
95
93
|
createProperty({
|
|
96
94
|
name: "url",
|
|
95
|
+
required: true,
|
|
97
96
|
schema: createSchema({
|
|
98
97
|
type: "url",
|
|
99
98
|
path: node.path
|
|
@@ -113,6 +112,7 @@ function buildResponsesSchemaNode({ node, resolver }) {
|
|
|
113
112
|
type: "object",
|
|
114
113
|
properties: node.responses.map((res) => createProperty({
|
|
115
114
|
name: String(res.statusCode),
|
|
115
|
+
required: true,
|
|
116
116
|
schema: createSchema({
|
|
117
117
|
type: "ref",
|
|
118
118
|
name: resolver.resolveResponseStatusTypedName(node, res.statusCode)
|
|
@@ -145,10 +145,7 @@ function buildGroupedParamsSchema({ params, parentName }) {
|
|
|
145
145
|
return createSchema({
|
|
146
146
|
type: "object",
|
|
147
147
|
properties: params.map((param) => {
|
|
148
|
-
let schema =
|
|
149
|
-
...param.schema,
|
|
150
|
-
optional: !param.required
|
|
151
|
-
};
|
|
148
|
+
let schema = param.schema;
|
|
152
149
|
if (narrowSchema(schema, "enum") && !schema.name && parentName) schema = {
|
|
153
150
|
...schema,
|
|
154
151
|
name: pascalCase([
|
|
@@ -159,6 +156,7 @@ function buildGroupedParamsSchema({ params, parentName }) {
|
|
|
159
156
|
};
|
|
160
157
|
return createProperty({
|
|
161
158
|
name: param.name,
|
|
159
|
+
required: param.required,
|
|
162
160
|
schema
|
|
163
161
|
});
|
|
164
162
|
})
|
|
@@ -200,10 +198,12 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
200
198
|
}) : createSchema({ type: "any" });
|
|
201
199
|
const properties = [createProperty({
|
|
202
200
|
name: "Response",
|
|
201
|
+
required: true,
|
|
203
202
|
schema: responseSchema
|
|
204
203
|
})];
|
|
205
204
|
if (!isGet && node.requestBody?.schema) properties.push(createProperty({
|
|
206
205
|
name: "Request",
|
|
206
|
+
required: true,
|
|
207
207
|
schema: createSchema({
|
|
208
208
|
type: "ref",
|
|
209
209
|
name: resolver.resolveDataTypedName(node)
|
|
@@ -211,6 +211,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
211
211
|
}));
|
|
212
212
|
if (node.parameters.some((p) => p.in === "query") && resolver.resolveQueryParamsTypedName) properties.push(createProperty({
|
|
213
213
|
name: "QueryParams",
|
|
214
|
+
required: true,
|
|
214
215
|
schema: createSchema({
|
|
215
216
|
type: "ref",
|
|
216
217
|
name: resolver.resolveQueryParamsTypedName(node)
|
|
@@ -218,6 +219,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
218
219
|
}));
|
|
219
220
|
if (node.parameters.some((p) => p.in === "path") && resolver.resolvePathParamsTypedName) properties.push(createProperty({
|
|
220
221
|
name: "PathParams",
|
|
222
|
+
required: true,
|
|
221
223
|
schema: createSchema({
|
|
222
224
|
type: "ref",
|
|
223
225
|
name: resolver.resolvePathParamsTypedName(node)
|
|
@@ -225,6 +227,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
225
227
|
}));
|
|
226
228
|
if (node.parameters.some((p) => p.in === "header") && resolver.resolveHeaderParamsTypedName) properties.push(createProperty({
|
|
227
229
|
name: "HeaderParams",
|
|
230
|
+
required: true,
|
|
228
231
|
schema: createSchema({
|
|
229
232
|
type: "ref",
|
|
230
233
|
name: resolver.resolveHeaderParamsTypedName(node)
|
|
@@ -232,6 +235,7 @@ function buildLegacyResponsesSchemaNode({ node, resolver }) {
|
|
|
232
235
|
}));
|
|
233
236
|
properties.push(createProperty({
|
|
234
237
|
name: "Errors",
|
|
238
|
+
required: true,
|
|
235
239
|
schema: errorsSchema
|
|
236
240
|
}));
|
|
237
241
|
return createSchema({
|
|
@@ -300,7 +304,7 @@ const typeGenerator = defineGenerator({
|
|
|
300
304
|
name: "typescript",
|
|
301
305
|
type: "react",
|
|
302
306
|
Operation({ node, adapter, options }) {
|
|
303
|
-
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy } = options;
|
|
307
|
+
const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy, transformers = [] } = options;
|
|
304
308
|
const { mode, getFile, resolveBanner, resolveFooter } = useKubb();
|
|
305
309
|
const file = getFile({
|
|
306
310
|
name: node.operationId,
|
|
@@ -311,7 +315,8 @@ const typeGenerator = defineGenerator({
|
|
|
311
315
|
const params = applyParamsCasing(node.parameters, paramsCasing);
|
|
312
316
|
function renderSchemaType({ node: schemaNode, name, typedName, description, keysToOmit }) {
|
|
313
317
|
if (!schemaNode) return null;
|
|
314
|
-
const
|
|
318
|
+
const transformedNode = transform(schemaNode, composeTransformers(...transformers));
|
|
319
|
+
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
315
320
|
name: resolver.default(schemaName, "type"),
|
|
316
321
|
path: getFile({
|
|
317
322
|
name: schemaName,
|
|
@@ -331,7 +336,7 @@ const typeGenerator = defineGenerator({
|
|
|
331
336
|
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
332
337
|
name,
|
|
333
338
|
typedName,
|
|
334
|
-
node:
|
|
339
|
+
node: transformedNode,
|
|
335
340
|
description,
|
|
336
341
|
enumType,
|
|
337
342
|
enumKeyCasing,
|
|
@@ -345,7 +350,7 @@ const typeGenerator = defineGenerator({
|
|
|
345
350
|
}
|
|
346
351
|
const responseTypes = legacy ? node.responses.map((res) => {
|
|
347
352
|
const responseName = resolver.resolveResponseStatusName(node, res.statusCode);
|
|
348
|
-
const baseResponseName =
|
|
353
|
+
const baseResponseName = baseResolver.resolveResponseStatusName(node, res.statusCode);
|
|
349
354
|
return renderSchemaType({
|
|
350
355
|
node: res.schema ? nameUnnamedEnums(res.schema, baseResponseName) : res.schema,
|
|
351
356
|
name: responseName,
|
|
@@ -361,7 +366,7 @@ const typeGenerator = defineGenerator({
|
|
|
361
366
|
keysToOmit: res.keysToOmit
|
|
362
367
|
}));
|
|
363
368
|
const requestType = node.requestBody?.schema ? renderSchemaType({
|
|
364
|
-
node: legacy ? nameUnnamedEnums(node.requestBody.schema,
|
|
369
|
+
node: legacy ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(node)) : node.requestBody.schema,
|
|
365
370
|
name: resolver.resolveDataName(node),
|
|
366
371
|
typedName: resolver.resolveDataTypedName(node),
|
|
367
372
|
description: node.requestBody.description ?? node.requestBody.schema.description,
|
|
@@ -375,7 +380,7 @@ const typeGenerator = defineGenerator({
|
|
|
375
380
|
pathParams.length > 0 ? renderSchemaType({
|
|
376
381
|
node: buildGroupedParamsSchema({
|
|
377
382
|
params: pathParams,
|
|
378
|
-
parentName:
|
|
383
|
+
parentName: baseResolver.resolvePathParamsName(node)
|
|
379
384
|
}),
|
|
380
385
|
name: resolver.resolvePathParamsName(node),
|
|
381
386
|
typedName: resolver.resolvePathParamsTypedName(node)
|
|
@@ -383,7 +388,7 @@ const typeGenerator = defineGenerator({
|
|
|
383
388
|
queryParams.length > 0 ? renderSchemaType({
|
|
384
389
|
node: buildGroupedParamsSchema({
|
|
385
390
|
params: queryParams,
|
|
386
|
-
parentName:
|
|
391
|
+
parentName: baseResolver.resolveQueryParamsName(node)
|
|
387
392
|
}),
|
|
388
393
|
name: resolver.resolveQueryParamsName(node),
|
|
389
394
|
typedName: resolver.resolveQueryParamsTypedName(node)
|
|
@@ -391,7 +396,7 @@ const typeGenerator = defineGenerator({
|
|
|
391
396
|
headerParams.length > 0 ? renderSchemaType({
|
|
392
397
|
node: buildGroupedParamsSchema({
|
|
393
398
|
params: headerParams,
|
|
394
|
-
parentName:
|
|
399
|
+
parentName: baseResolver.resolveHeaderParamsName(node)
|
|
395
400
|
}),
|
|
396
401
|
name: resolver.resolveHeaderParamsName(node),
|
|
397
402
|
typedName: resolver.resolveHeaderParamsTypedName(node)
|
|
@@ -489,10 +494,11 @@ const typeGenerator = defineGenerator({
|
|
|
489
494
|
});
|
|
490
495
|
},
|
|
491
496
|
Schema({ node, adapter, options }) {
|
|
492
|
-
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy } = options;
|
|
497
|
+
const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy, transformers = [] } = options;
|
|
493
498
|
const { mode, getFile, resolveBanner, resolveFooter } = useKubb();
|
|
494
499
|
if (!node.name) return;
|
|
495
|
-
const
|
|
500
|
+
const transformedNode = transform(node, composeTransformers(...transformers));
|
|
501
|
+
const imports = adapter.getImports(transformedNode, (schemaName) => ({
|
|
496
502
|
name: resolver.default(schemaName, "type"),
|
|
497
503
|
path: getFile({
|
|
498
504
|
name: schemaName,
|
|
@@ -529,7 +535,7 @@ const typeGenerator = defineGenerator({
|
|
|
529
535
|
].join("-"))), /* @__PURE__ */ jsx(Type, {
|
|
530
536
|
name: type.name,
|
|
531
537
|
typedName: type.typedName,
|
|
532
|
-
node,
|
|
538
|
+
node: transformedNode,
|
|
533
539
|
enumType,
|
|
534
540
|
enumKeyCasing,
|
|
535
541
|
optionalType,
|
|
@@ -544,4 +550,4 @@ const typeGenerator = defineGenerator({
|
|
|
544
550
|
//#endregion
|
|
545
551
|
export { typeGenerator as t };
|
|
546
552
|
|
|
547
|
-
//# sourceMappingURL=generators-
|
|
553
|
+
//# sourceMappingURL=generators-BTTcjgbY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-BTTcjgbY.js","names":[],"sources":["../src/generators/utils.ts","../src/generators/typeGenerator.tsx"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { createProperty, createSchema, narrowSchema, transform } from '@kubb/ast'\nimport type { OperationNode, ParameterNode, SchemaNode } from '@kubb/ast/types'\nimport type { ResolverTs } from '../types.ts'\n\ntype BuildParamsSchemaOptions = {\n params: Array<ParameterNode>\n node: OperationNode\n resolver: ResolverTs\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a group of parameters (path/query/header).\n * Each property is a `ref` schema pointing to the individually-resolved parameter type.\n * The ref name includes the parameter location so generated type names follow\n * the `<OperationId><Location><ParamName>` convention.\n */\nexport function buildParamsSchema({ params, node, resolver }: BuildParamsSchemaOptions): SchemaNode {\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\ntype BuildOperationSchemaOptions = {\n node: OperationNode\n resolver: ResolverTs\n}\n\n/**\n * Builds an `ObjectSchemaNode` representing the `<OperationId>RequestConfig` type:\n * - `data` → request body ref (optional) or `never`\n * - `pathParams` → inline object of path param refs, or `never`\n * - `queryParams` → inline object of query param refs (optional), or `never`\n * - `headerParams` → inline object of header param refs (optional), or `never`\n * - `url` → Express-style template literal (plugin-ts extension, handled by printer)\n */\nexport function buildDataSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode {\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({\n type: 'ref',\n name: resolver.resolveDataTypedName(node),\n optional: true,\n })\n : createSchema({ type: 'never', optional: true }),\n }),\n createProperty({\n name: 'pathParams',\n required: pathParams.length > 0,\n schema: pathParams.length > 0 ? buildParamsSchema({ params: pathParams, node, resolver }) : createSchema({ type: 'never' }),\n }),\n createProperty({\n name: 'queryParams',\n schema:\n queryParams.length > 0\n ? createSchema({ ...buildParamsSchema({ 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({ ...buildParamsSchema({ 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\n/**\n * Builds an `ObjectSchemaNode` representing `<OperationId>Responses` — keyed by HTTP status code.\n * Numeric status codes produce unquoted numeric keys (e.g. `200:`).\n * All responses are included; those without a schema are represented as a ref to a `never` type.\n */\nexport function buildResponsesSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\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({\n type: 'ref',\n name: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n }),\n }),\n ),\n })\n}\n\n/**\n * Builds a `UnionSchemaNode` representing `<OperationId>Response` — all response types in union format.\n * Returns `null` when the operation has no responses with schemas.\n */\nexport function buildResponseUnionSchemaNode({ node, resolver }: BuildOperationSchemaOptions): SchemaNode | null {\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) =>\n createSchema({\n type: 'ref',\n name: resolver.resolveResponseStatusTypedName(node, res.statusCode),\n }),\n ),\n })\n}\n\ntype BuildGroupedParamsSchemaOptions = {\n params: Array<ParameterNode>\n /**\n * Parent type name (e.g. `FindPetsByStatusQueryParams`) used to derive enum names\n * for inline enum properties (e.g. `FindPetsByStatusQueryParamsStatusEnum`).\n */\n parentName?: string\n}\n\n/**\n * Builds an `ObjectSchemaNode` for a grouped parameters type (path/query/header) in legacy mode.\n * Each property directly embeds the parameter's schema inline (not a ref).\n * Used to generate `<OperationId>PathParams`, `<OperationId>QueryParams`, `<OperationId>HeaderParams`.\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function 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\n/**\n * Builds the legacy wrapper `ObjectSchemaNode` for `<OperationId>Mutation` / `<OperationId>Query`.\n * Structure: `{ Response, Request?, QueryParams?, PathParams?, HeaderParams?, Errors }`.\n * Mirrors the v4 naming convention where this type acts as a namespace for the operation's shapes.\n *\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function 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\n/**\n * Builds the legacy response union for `<OperationId>MutationResponse` / `<OperationId>QueryResponse`.\n * In legacy mode this is the **success** response only (not the full union including errors).\n * Returns an `any` schema when there is no success response, matching v4 behavior.\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function 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\n/**\n * Names unnamed enum nodes within a schema tree based on the parent type name.\n * Used in legacy mode to ensure inline enums in response/request schemas get\n * extracted as named enum declarations (e.g. `DeletePet200Enum`).\n *\n * @deprecated Legacy only — will be removed in v6.\n */\nexport function nameUnnamedEnums(node: SchemaNode, parentName: string): SchemaNode {\n return transform(node, {\n schema(n) {\n if (n.type === 'enum' && !n.name) {\n return { ...n, 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","import { applyParamsCasing, composeTransformers, transform } from '@kubb/ast'\nimport type { SchemaNode } from '@kubb/ast/types'\nimport { defineGenerator } from '@kubb/core'\nimport { useKubb } from '@kubb/core/hooks'\nimport { File } from '@kubb/react-fabric'\nimport { Type } from '../components/Type.tsx'\nimport { ENUM_TYPES_WITH_KEY_SUFFIX } from '../constants.ts'\nimport type { PluginTs } from '../types'\nimport {\n buildDataSchemaNode,\n buildGroupedParamsSchema,\n buildLegacyResponsesSchemaNode,\n buildLegacyResponseUnionSchemaNode,\n buildParamsSchema,\n buildResponsesSchemaNode,\n buildResponseUnionSchemaNode,\n nameUnnamedEnums,\n} from './utils.ts'\n\nexport const typeGenerator = defineGenerator<PluginTs>({\n name: 'typescript',\n type: 'react',\n Operation({ node, adapter, options }) {\n const { enumType, enumKeyCasing, optionalType, arrayType, syntaxType, paramsCasing, group, resolver, baseResolver, legacy, transformers = [] } = options\n const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\n\n const file = getFile({\n name: node.operationId,\n extname: '.ts',\n mode,\n options: {\n group: group ? (group.type === 'tag' ? { tag: node.tags[0] ?? 'default' } : { path: node.path }) : undefined,\n },\n })\n const params = applyParamsCasing(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: getFile({ name: schemaName, extname: '.ts', mode }).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 legacy={legacy}\n />\n </>\n )\n }\n\n const responseTypes = legacy\n ? node.responses.map((res) => {\n const responseName = resolver.resolveResponseStatusName(node, res.statusCode)\n const baseResponseName = baseResolver.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 : 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 requestType = node.requestBody?.schema\n ? renderSchemaType({\n node: legacy ? nameUnnamedEnums(node.requestBody.schema, baseResolver.resolveDataName(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 if (legacy) {\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 legacyParamTypes = [\n pathParams.length > 0\n ? renderSchemaType({\n node: buildGroupedParamsSchema({ params: pathParams, parentName: baseResolver.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: baseResolver.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: baseResolver.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 baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {legacyParamTypes}\n {responseTypes}\n {requestType}\n {legacyResponseType}\n {legacyResponsesType}\n </File>\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 queryParamsList = params.filter((p) => p.in === 'query')\n const queryParamsType =\n queryParamsList.length > 0\n ? renderSchemaType({\n node: buildParamsSchema({ params: queryParamsList, node, resolver }),\n name: resolver.resolveQueryParamsName!(node),\n typedName: resolver.resolveQueryParamsTypedName!(node),\n })\n : null\n\n const dataType = renderSchemaType({\n node: buildDataSchemaNode({ node: { ...node, parameters: params }, resolver }),\n name: resolver.resolveRequestConfigName(node),\n typedName: resolver.resolveRequestConfigTypedName(node),\n })\n\n const responsesType = renderSchemaType({\n node: buildResponsesSchemaNode({ node, resolver }),\n name: resolver.resolveResponsesName(node),\n typedName: resolver.resolveResponsesTypedName(node),\n })\n\n const responseType = renderSchemaType({\n node: buildResponseUnionSchemaNode({ 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 baseName={file.baseName} path={file.path} meta={file.meta} banner={resolveBanner()} footer={resolveFooter()}>\n {paramTypes}\n {queryParamsType}\n {responseTypes}\n {requestType}\n {dataType}\n {responsesType}\n {responseType}\n </File>\n )\n },\n Schema({ node, adapter, options }) {\n const { enumType, enumKeyCasing, syntaxType, optionalType, arrayType, resolver, legacy, transformers = [] } = options\n const { mode, getFile, resolveBanner, resolveFooter } = useKubb<PluginTs>()\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: getFile({ name: schemaName, extname: '.ts', mode }).path,\n }))\n\n const isEnumSchema = node.type === '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: getFile({ name: node.name, extname: '.ts', mode }),\n } as const\n\n return (\n <File baseName={type.file.baseName} path={type.file.path} meta={type.file.meta} banner={resolveBanner()} footer={resolveFooter()}>\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 legacy={legacy}\n />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAgB,kBAAkB,EAAE,QAAQ,MAAM,YAAkD;AAClG,QAAO,aAAa;EAClB,MAAM;EACN,YAAY,OAAO,KAAK,UACtB,eAAe;GACb,MAAM,MAAM;GACZ,UAAU,MAAM;GAChB,QAAQ,aAAa;IACnB,MAAM;IACN,MAAM,SAAS,iBAAiB,MAAM,MAAM;IAC7C,CAAC;GACH,CAAC,CACH;EACF,CAAC;;;;;;;;;;AAgBJ,SAAgB,oBAAoB,EAAE,MAAM,YAAqD;CAC/F,MAAM,aAAa,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,OAAO;CACjE,MAAM,cAAc,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,QAAQ;CACnE,MAAM,eAAe,KAAK,WAAW,QAAQ,MAAM,EAAE,OAAO,SAAS;AAErE,QAAO,aAAa;EAClB,MAAM;EACN,YAAY,KAAK;EACjB,YAAY;GACV,eAA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AAO;IAAM,CAAC;GACzD;AAED,SACE,qBAAC,MAAD;GAAM,UAAU,KAAK,KAAK;GAAU,MAAM,KAAK,KAAK;GAAM,MAAM,KAAK,KAAK;GAAM,QAAQ,eAAe;GAAE,QAAQ,eAAe;aAAhI,CACG,SAAS,WACR,QAAQ,KAAK,QACX,oBAAC,KAAK,QAAN;IAAmE,MAAM,KAAK,KAAK;IAAM,MAAM,IAAI;IAAM,MAAM,IAAI;IAAM,YAAA;IAAa,EAApH;IAAC,KAAK;IAAM,IAAI;IAAM,IAAI;IAAW,CAAC,KAAK,IAAI,CAAqE,CACtI,EACJ,oBAAC,MAAD;IACE,MAAM,KAAK;IACX,WAAW,KAAK;IAChB,MAAM;IACI;IACK;IACD;IACH;IACC;IACF;IACF;IACR,CAAA,CACG;;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
package/dist/generators.d.ts
CHANGED
package/dist/generators.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as typeGenerator } from "./generators-
|
|
1
|
+
import { t as typeGenerator } from "./generators-BTTcjgbY.js";
|
|
2
2
|
export { typeGenerator };
|