@kubb/plugin-ts 4.12.3 → 4.12.4

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.
@@ -25,12 +25,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  }) : target, mod));
26
26
 
27
27
  //#endregion
28
- let __kubb_core_transformers = require("@kubb/core/transformers");
29
- __kubb_core_transformers = __toESM(__kubb_core_transformers);
30
- let __kubb_plugin_oas = require("@kubb/plugin-oas");
31
- let __kubb_react_fabric = require("@kubb/react-fabric");
32
- let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
33
- let __kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
28
+ let _kubb_core_transformers = require("@kubb/core/transformers");
29
+ _kubb_core_transformers = __toESM(_kubb_core_transformers);
30
+ let _kubb_plugin_oas = require("@kubb/plugin-oas");
31
+ let _kubb_react_fabric = require("@kubb/react-fabric");
32
+ let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
33
+ let _kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
34
34
  require("natural-orderby");
35
35
  let remeda = require("remeda");
36
36
  let typescript = require("typescript");
@@ -38,20 +38,20 @@ typescript = __toESM(typescript);
38
38
 
39
39
  //#region src/components/OasType.tsx
40
40
  function OasType({ name, typeName, api }) {
41
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [
42
- /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
41
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
42
+ /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
43
43
  name,
44
44
  isExportable: true,
45
45
  isIndexable: true,
46
46
  children: `export const ${name} = ${JSON.stringify(api, void 0, 2)} as const`
47
47
  }),
48
- /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)("br", {}),
49
- /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
48
+ /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
49
+ /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
50
50
  name: typeName,
51
51
  isExportable: true,
52
52
  isIndexable: true,
53
53
  isTypeOnly: true,
54
- children: /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.Type, {
54
+ children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Type, {
55
55
  name: typeName,
56
56
  export: true,
57
57
  children: `Infer<typeof ${name}>`
@@ -311,12 +311,12 @@ const typeKeywordMapper = {
311
311
  * @param options - Parsing options controlling output style, property handling, and custom mappers.
312
312
  * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.
313
313
  */
314
- const parse = (0, __kubb_plugin_oas.createParser)({
314
+ const parse = (0, _kubb_plugin_oas.createParser)({
315
315
  mapper: typeKeywordMapper,
316
316
  handlers: {
317
317
  union(tree, options) {
318
318
  const { current, schema, name } = tree;
319
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.union)) return void 0;
319
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.union)) return void 0;
320
320
  return typeKeywordMapper.union(current.args.map((it) => this.parse({
321
321
  schema,
322
322
  parent: current,
@@ -327,7 +327,7 @@ const parse = (0, __kubb_plugin_oas.createParser)({
327
327
  },
328
328
  and(tree, options) {
329
329
  const { current, schema, name } = tree;
330
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.and)) return void 0;
330
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.and)) return void 0;
331
331
  return typeKeywordMapper.and(current.args.map((it) => this.parse({
332
332
  schema,
333
333
  parent: current,
@@ -338,7 +338,7 @@ const parse = (0, __kubb_plugin_oas.createParser)({
338
338
  },
339
339
  array(tree, options) {
340
340
  const { current, schema, name } = tree;
341
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.array)) return void 0;
341
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.array)) return void 0;
342
342
  return typeKeywordMapper.array(current.args.items.map((it) => this.parse({
343
343
  schema,
344
344
  parent: current,
@@ -349,22 +349,22 @@ const parse = (0, __kubb_plugin_oas.createParser)({
349
349
  },
350
350
  enum(tree, options) {
351
351
  const { current } = tree;
352
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.enum)) return void 0;
352
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.enum)) return void 0;
353
353
  return typeKeywordMapper.enum(options.enumType === "asConst" ? `${current.args.typeName}Key` : current.args.typeName);
354
354
  },
355
355
  ref(tree, _options) {
356
356
  const { current } = tree;
357
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.ref)) return void 0;
357
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.ref)) return void 0;
358
358
  return typeKeywordMapper.ref(current.args.name);
359
359
  },
360
360
  blob(tree) {
361
361
  const { current } = tree;
362
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.blob)) return void 0;
362
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.blob)) return void 0;
363
363
  return typeKeywordMapper.blob();
364
364
  },
365
365
  tuple(tree, options) {
366
366
  const { current, schema, name } = tree;
367
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.tuple)) return void 0;
367
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.tuple)) return void 0;
368
368
  return typeKeywordMapper.tuple(current.args.items.map((it) => this.parse({
369
369
  schema,
370
370
  parent: current,
@@ -381,30 +381,30 @@ const parse = (0, __kubb_plugin_oas.createParser)({
381
381
  },
382
382
  const(tree, _options) {
383
383
  const { current } = tree;
384
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.const)) return void 0;
384
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.const)) return void 0;
385
385
  return typeKeywordMapper.const(current.args.name, current.args.format);
386
386
  },
387
387
  object(tree, options) {
388
388
  const { current, schema, name } = tree;
389
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.object)) return void 0;
389
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.object)) return void 0;
390
390
  const properties = Object.entries(current.args?.properties || {}).filter((item) => {
391
391
  const schemas = item[1];
392
392
  return schemas && typeof schemas.map === "function";
393
393
  }).map(([name$1, schemas]) => {
394
- const mappedName = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.name)?.args || name$1;
394
+ const mappedName = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.name)?.args || name$1;
395
395
  if (options.mapper?.[mappedName]) return options.mapper?.[mappedName];
396
- const isNullish = schemas.some((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.nullish);
397
- const isNullable = schemas.some((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.nullable);
398
- const isOptional = schemas.some((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.optional);
399
- const isReadonly = schemas.some((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.readOnly);
400
- const describeSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.describe);
401
- const deprecatedSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.deprecated);
402
- const defaultSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.default);
403
- const exampleSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.example);
404
- const schemaSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.schema);
405
- const minSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.min);
406
- const maxSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.max);
407
- const matchesSchema = schemas.find((schema$1) => schema$1.keyword === __kubb_plugin_oas.schemaKeywords.matches);
396
+ const isNullish = schemas.some((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.nullish);
397
+ const isNullable = schemas.some((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.nullable);
398
+ const isOptional = schemas.some((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.optional);
399
+ const isReadonly = schemas.some((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.readOnly);
400
+ const describeSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.describe);
401
+ const deprecatedSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.deprecated);
402
+ const defaultSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.default);
403
+ const exampleSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.example);
404
+ const schemaSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.schema);
405
+ const minSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.min);
406
+ const maxSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.max);
407
+ const matchesSchema = schemas.find((schema$1) => schema$1.keyword === _kubb_plugin_oas.schemaKeywords.matches);
408
408
  let type = schemas.map((it) => this.parse({
409
409
  schema,
410
410
  parent: current,
@@ -424,7 +424,7 @@ const parse = (0, __kubb_plugin_oas.createParser)({
424
424
  return appendJSDocToNode({
425
425
  node: propertyNode,
426
426
  comments: [
427
- describeSchema ? `@description ${__kubb_core_transformers.default.jsStringEscape(describeSchema.args)}` : void 0,
427
+ describeSchema ? `@description ${_kubb_core_transformers.default.jsStringEscape(describeSchema.args)}` : void 0,
428
428
  deprecatedSchema ? "@deprecated" : void 0,
429
429
  minSchema ? `@minLength ${minSchema.args}` : void 0,
430
430
  maxSchema ? `@maxLength ${maxSchema.args}` : void 0,
@@ -444,24 +444,24 @@ const parse = (0, __kubb_plugin_oas.createParser)({
444
444
  current: it,
445
445
  siblings: []
446
446
  }, options)).filter(Boolean).at(0);
447
- if (current.args?.additionalProperties.some((schema$1) => (0, __kubb_plugin_oas.isKeyword)(schema$1, __kubb_plugin_oas.schemaKeywords.nullable))) additionalProperties = createUnionDeclaration({ nodes: [additionalProperties, keywordTypeNodes.null] });
447
+ if (current.args?.additionalProperties.some((schema$1) => (0, _kubb_plugin_oas.isKeyword)(schema$1, _kubb_plugin_oas.schemaKeywords.nullable))) additionalProperties = createUnionDeclaration({ nodes: [additionalProperties, keywordTypeNodes.null] });
448
448
  additionalProperties = createIndexSignature(additionalProperties);
449
449
  }
450
450
  return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean));
451
451
  },
452
452
  datetime(tree) {
453
453
  const { current } = tree;
454
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.datetime)) return void 0;
454
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.datetime)) return void 0;
455
455
  return typeKeywordMapper.datetime();
456
456
  },
457
457
  date(tree) {
458
458
  const { current } = tree;
459
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.date)) return void 0;
459
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.date)) return void 0;
460
460
  return typeKeywordMapper.date(current.args.type);
461
461
  },
462
462
  time(tree) {
463
463
  const { current } = tree;
464
- if (!(0, __kubb_plugin_oas.isKeyword)(current, __kubb_plugin_oas.schemaKeywords.time)) return void 0;
464
+ if (!(0, _kubb_plugin_oas.isKeyword)(current, _kubb_plugin_oas.schemaKeywords.time)) return void 0;
465
465
  return typeKeywordMapper.time(current.args.type);
466
466
  }
467
467
  }
@@ -472,8 +472,8 @@ const parse = (0, __kubb_plugin_oas.createParser)({
472
472
  function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxType, enumType, mapper, description }) {
473
473
  const typeNodes = [];
474
474
  if (!tree.length) return "";
475
- const schemaFromTree = tree.find((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.schema);
476
- const enumSchemas = __kubb_plugin_oas.SchemaGenerator.deepSearch(tree, __kubb_plugin_oas.schemaKeywords.enum);
475
+ const schemaFromTree = tree.find((item) => item.keyword === _kubb_plugin_oas.schemaKeywords.schema);
476
+ const enumSchemas = _kubb_plugin_oas.SchemaGenerator.deepSearch(tree, _kubb_plugin_oas.schemaKeywords.enum);
477
477
  let type = tree.map((current, _index, siblings) => parse({
478
478
  name,
479
479
  schema,
@@ -494,10 +494,10 @@ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxT
494
494
  if (schema.type === "array") type = createArrayTypeNode(type);
495
495
  }
496
496
  }
497
- if (schemaFromTree && (0, __kubb_plugin_oas.isKeyword)(schemaFromTree, __kubb_plugin_oas.schemaKeywords.schema)) {
498
- const isNullish = tree.some((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.nullish);
499
- const isNullable = tree.some((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.nullable);
500
- const isOptional = tree.some((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.optional);
497
+ if (schemaFromTree && (0, _kubb_plugin_oas.isKeyword)(schemaFromTree, _kubb_plugin_oas.schemaKeywords.schema)) {
498
+ const isNullish = tree.some((item) => item.keyword === _kubb_plugin_oas.schemaKeywords.nullish);
499
+ const isNullable = tree.some((item) => item.keyword === _kubb_plugin_oas.schemaKeywords.nullable);
500
+ const isOptional = tree.some((item) => item.keyword === _kubb_plugin_oas.schemaKeywords.optional);
501
501
  if (isNullable) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.null] });
502
502
  if (isNullish && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
503
503
  if (isOptional && ["undefined", "questionTokenAndUndefined"].includes(optionalType)) type = createUnionDeclaration({ nodes: [type, keywordTypeNodes.undefined] });
@@ -513,7 +513,7 @@ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxT
513
513
  }) : type,
514
514
  syntax: useTypeGeneration ? "type" : "interface",
515
515
  comments: [
516
- description ? `@description ${__kubb_core_transformers.default.jsStringEscape(description)}` : void 0,
516
+ description ? `@description ${_kubb_core_transformers.default.jsStringEscape(description)}` : void 0,
517
517
  schema.deprecated ? "@deprecated" : void 0,
518
518
  schema.minLength ? `@minLength ${schema.minLength}` : void 0,
519
519
  schema.maxLength ? `@maxLength ${schema.maxLength}` : void 0,
@@ -523,12 +523,12 @@ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxT
523
523
  ]
524
524
  }));
525
525
  const enums = [...new Set(enumSchemas)].map((enumSchema) => {
526
- const name$1 = enumType === "asPascalConst" ? __kubb_core_transformers.default.pascalCase(enumSchema.args.name) : __kubb_core_transformers.default.camelCase(enumSchema.args.name);
526
+ const name$1 = enumType === "asPascalConst" ? _kubb_core_transformers.default.pascalCase(enumSchema.args.name) : _kubb_core_transformers.default.camelCase(enumSchema.args.name);
527
527
  const typeName = enumType === "asConst" ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName;
528
528
  const [nameNode, typeNode] = createEnumDeclaration({
529
529
  name: name$1,
530
530
  typeName,
531
- enums: enumSchema.args.items.map((item) => item.value === void 0 ? void 0 : [__kubb_core_transformers.default.trimQuotes(item.name?.toString()), item.value]).filter(Boolean),
531
+ enums: enumSchema.args.items.map((item) => item.value === void 0 ? void 0 : [_kubb_core_transformers.default.trimQuotes(item.name?.toString()), item.value]).filter(Boolean),
532
532
  type: enumType
533
533
  });
534
534
  return {
@@ -538,12 +538,12 @@ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxT
538
538
  typeName
539
539
  };
540
540
  });
541
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [enums.map(({ name: name$1, nameNode, typeName, typeNode }) => /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [nameNode && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
541
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [enums.map(({ name: name$1, nameNode, typeName, typeNode }) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [nameNode && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
542
542
  name: name$1,
543
543
  isExportable: true,
544
544
  isIndexable: true,
545
- children: (0, __kubb_fabric_core_parsers_typescript.print)(nameNode)
546
- }), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
545
+ children: (0, _kubb_fabric_core_parsers_typescript.print)(nameNode)
546
+ }), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
547
547
  name: typeName,
548
548
  isIndexable: true,
549
549
  isExportable: [
@@ -558,13 +558,13 @@ function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxT
558
558
  "literal",
559
559
  void 0
560
560
  ].includes(enumType),
561
- children: (0, __kubb_fabric_core_parsers_typescript.print)(typeNode)
562
- })] })), enums.every((item) => item.typeName !== name) && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
561
+ children: (0, _kubb_fabric_core_parsers_typescript.print)(typeNode)
562
+ })] })), enums.every((item) => item.typeName !== name) && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
563
563
  name: typedName,
564
564
  isTypeOnly: true,
565
565
  isExportable: true,
566
566
  isIndexable: true,
567
- children: (0, __kubb_fabric_core_parsers_typescript.print)(...typeNodes)
567
+ children: (0, _kubb_fabric_core_parsers_typescript.print)(...typeNodes)
568
568
  })] });
569
569
  }
570
570
 
@@ -629,4 +629,4 @@ Object.defineProperty(exports, 'modifiers', {
629
629
  return modifiers;
630
630
  }
631
631
  });
632
- //# sourceMappingURL=components-CaL9tu8t.cjs.map
632
+ //# sourceMappingURL=components-YKTwNDfu.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"components-CaL9tu8t.cjs","names":["File","Type","ts","modifiers","questionToken","initializer: ts.Expression","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createTypeReferenceNode","factory.createUnionDeclaration","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createNumericLiteral","factory.createStringLiteral","factory.createIdentifier","factory.createIntersectionDeclaration","propertyName","schemaKeywords","name","schema","factory.createPropertySignature","factory.appendJSDocToNode","transformers","additionalProperties: any","factory.createIndexSignature","typeNodes: ts.Node[]","schemaKeywords","SchemaGenerator","factory.createTypeReferenceNode","factory.createArrayTypeNode","factory.createUnionDeclaration","factory.createTypeDeclaration","factory.createOmitDeclaration","transformers","name","factory.createEnumDeclaration","File"],"sources":["../src/components/OasType.tsx","../src/factory.ts","../src/parser.ts","../src/components/Type.tsx"],"sourcesContent":["import type { OasTypes } from '@kubb/oas'\nimport { File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nexport function OasType({ name, typeName, api }: Props): KubbNode {\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n </File.Source>\n <br />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n","import { orderBy } from 'natural-orderby'\nimport { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes }: { nodes: Array<ts.TypeNode> }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n return factory.createArrayTypeNode(nodes.at(0)!)\n }\n\n return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)])\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // node: {...node}, with that ts.addSyntheticLeadingComment is appending\n return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the imports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(item) => (typeof item === 'object' ? item.propertyName : item)])\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n sortedName.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the exports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(propertyName) => (typeof propertyName === 'string' ? propertyName : propertyName.text)])\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n sortedName.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n}: {\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer)\n }\n\n if (key) {\n return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n type === 'asPascalConst' ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n} as const\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type ts from 'typescript'\nimport * as factory from './factory.ts'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[], rest?: ts.TypeNode, min?: number, max?: number) => {\n if (!nodes) {\n return undefined\n }\n\n if (max) {\n nodes = nodes.slice(0, max)\n\n if (nodes.length < max && rest) {\n nodes = [...nodes, ...Array(max - nodes.length).fill(rest)]\n }\n }\n\n if (min) {\n nodes = nodes.map((node, index) => (index >= min ? factory.createOptionalTypeNode(node) : node))\n }\n\n if (typeof max === 'undefined' && rest) {\n nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)))\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number | boolean, format?: 'string' | 'number' | 'boolean') => {\n if (name === null || name === undefined || name === '') {\n return undefined\n }\n\n if (format === 'boolean') {\n if (name === true) {\n return factory.createLiteralTypeNode(factory.createTrue())\n }\n\n return factory.createLiteralTypeNode(factory.createFalse())\n }\n\n if (format === 'number' && typeof name === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: () => factory.keywordTypeNodes.string,\n url: () => factory.keywordTypeNodes.string,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<ts.TypeNode | null | undefined>\n\ntype ParserOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n mapper?: Record<string, ts.PropertySignature>\n}\n\n/**\n * Recursively parses a schema tree node into a corresponding TypeScript AST node.\n *\n * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.\n *\n * @param current - The schema node to parse.\n * @param siblings - Sibling schema nodes, used for context in certain mappings.\n * @param name - The name of the schema or property being parsed.\n * @param options - Parsing options controlling output style, property handling, and custom mappers.\n * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.\n */\nexport const parse = createParser<ts.Node | null, ParserOptions>({\n mapper: typeKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.union)) return undefined\n\n return typeKeywordMapper.union(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.and)) return undefined\n\n return typeKeywordMapper.and(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n array(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.array)) return undefined\n\n return typeKeywordMapper.array(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n enum(tree, options) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.enum)) return undefined\n\n // Adding suffix to enum (see https://github.com/kubb-labs/kubb/issues/1873)\n return typeKeywordMapper.enum(options.enumType === 'asConst' ? `${current.args.typeName}Key` : current.args.typeName)\n },\n ref(tree, _options) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.ref)) return undefined\n\n return typeKeywordMapper.ref(current.args.name)\n },\n blob(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.blob)) return undefined\n\n return typeKeywordMapper.blob()\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.tuple)) return undefined\n\n return typeKeywordMapper.tuple(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n current.args.rest &&\n ((this.parse({ schema, parent: current, name, current: current.args.rest, siblings: [] }, options) ?? undefined) as ts.TypeNode | undefined),\n current.args.min,\n current.args.max,\n )\n },\n const(tree, _options) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.const)) return undefined\n\n return typeKeywordMapper.const(current.args.name, current.args.format)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.object)) return undefined\n\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return options.mapper?.[mappedName]\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min) as SchemaKeywordMapper['min'] | undefined\n const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max) as SchemaKeywordMapper['max'] | undefined\n const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches) as SchemaKeywordMapper['matches'] | undefined\n\n let type = schemas\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n name,\n current: it,\n siblings: schemas,\n },\n options,\n ),\n )\n .filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertyNode = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertyNode,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n minSchema ? `@minLength ${minSchema.args}` : undefined,\n maxSchema ? `@maxLength ${maxSchema.args}` : undefined,\n matchesSchema ? `@pattern ${matchesSchema.args}` : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n let additionalProperties: any\n\n if (current.args?.additionalProperties?.length) {\n additionalProperties = current.args.additionalProperties\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n additionalProperties = factory.createUnionDeclaration({\n nodes: [additionalProperties, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n additionalProperties = factory.createIndexSignature(additionalProperties)\n }\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n },\n datetime(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.datetime)) return undefined\n\n return typeKeywordMapper.datetime()\n },\n date(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.date)) return undefined\n\n return typeKeywordMapper.date(current.args.type)\n },\n time(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.time)) return undefined\n\n return typeKeywordMapper.time(current.args.type)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/fabric-core/parsers/typescript'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type ts from 'typescript'\nimport * as factory from '../factory.ts'\nimport { parse, typeKeywordMapper } from '../parser.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n name: string\n typedName: string\n schema: SchemaObject\n tree: Array<Schema>\n optionalType: PluginTs['resolvedOptions']['optionalType']\n enumType: PluginTs['resolvedOptions']['enumType']\n mapper: PluginTs['resolvedOptions']['mapper']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxType, enumType, mapper, description }: Props): KubbNode {\n const typeNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema)\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n\n let type =\n (tree\n .map((current, _index, siblings) =>\n parse(\n { name, schema, parent: undefined, current, siblings },\n {\n optionalType,\n enumType,\n mapper,\n },\n ),\n )\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n // Add a \"Key\" suffix to avoid collisions where necessary\n if (enumType === 'asConst' && enumSchemas.length > 0) {\n const isDirectEnum = schema.type === 'array' && schema.items !== undefined\n const isEnumOnly = 'enum' in schema && schema.enum\n\n if (isDirectEnum || isEnumOnly) {\n const enumSchema = enumSchemas[0]!\n const typeNameWithKey = `${enumSchema.args.typeName}Key`\n\n type = factory.createTypeReferenceNode(typeNameWithKey)\n\n if (schema.type === 'array') {\n type = factory.createArrayTypeNode(type)\n }\n }\n }\n\n if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n }\n\n const useTypeGeneration = syntaxType === 'type' || [factory.syntaxKind.union].includes(type.kind as typeof factory.syntaxKind.union) || !!keysToOmit?.length\n\n typeNodes.push(\n factory.createTypeDeclaration({\n name,\n isExportable: true,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n syntax: useTypeGeneration ? 'type' : 'interface',\n comments: [\n description ? `@description ${transformers.jsStringEscape(description)}` : undefined,\n schema.deprecated ? '@deprecated' : undefined,\n schema.minLength ? `@minLength ${schema.minLength}` : undefined,\n schema.maxLength ? `@maxLength ${schema.maxLength}` : undefined,\n schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n schema.default ? `@default ${schema.default}` : undefined,\n schema.example ? `@example ${schema.example}` : undefined,\n ],\n }),\n )\n\n const enums = [...new Set(enumSchemas)].map((enumSchema) => {\n const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)\n const typeName = enumType === 'asConst' ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name,\n typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as Array<[string, string]>,\n type: enumType,\n })\n\n return {\n nameNode,\n typeNode,\n name,\n typeName,\n }\n })\n\n return (\n <>\n {enums.map(({ name, nameNode, typeName, typeNode }) => (\n <>\n {nameNode && (\n <File.Source name={name} isExportable isIndexable>\n {print(nameNode)}\n </File.Source>\n )}\n {\n <File.Source\n name={typeName}\n isIndexable\n isExportable={['enum', 'asConst', 'constEnum', 'literal', undefined].includes(enumType)}\n isTypeOnly={['asConst', 'literal', undefined].includes(enumType)}\n >\n {print(typeNode)}\n </File.Source>\n }\n </>\n ))}\n {enums.every((item) => item.typeName !== name) && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {print(...typeNodes)}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,QAAQ,EAAE,MAAM,UAAU,OAAwB;AAChE,QACE;EACE,yDAACA,yBAAK;GAAa;GAAM;GAAa;aACnC,gBAAgB,KAAK,KAAK,KAAK,UAAU,KAAK,QAAW,EAAE,CAAC;IACjD;EACd,yDAAC,SAAK;EACN,yDAACA,yBAAK;GAAO,MAAM;GAAU;GAAa;GAAY;aACpD,yDAACC;IAAK,MAAM;IAAU;cACnB,gBAAgB,KAAK;KACjB;IACK;KACb;;;;;ACrBP,MAAM,EAAE,YAAY,YAAYC;AAIhC,MAAa,YAAY;CACvB,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,QAAQ,QAAQ,eAAeA,mBAAG,WAAW,cAAc;CAC3D,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,QAAQ,QAAQ,eAAeA,mBAAG,WAAW,cAAc;CAC5D;AAED,MAAa,aAAa,EACxB,OAAO,WAAW,WACnB;AAED,SAAS,kBAAkB,KAAsB;AAC/C,KAAI,CAAC,IAAI,UAAU,IAAI,MAAM,KAAK,IAChC,QAAO;CAET,MAAM,OAAOA,mBAAG,wBAAwB,KAAKA,mBAAG,aAAa,OAAO;AAEpE,QAAO,CAAC,CAAC,QAAQ,KAAK,SAASA,mBAAG,WAAW,cAAcA,mBAAG,wBAAwB,KAAK,KAAiC,KAAK;;AAGnI,SAAS,aAAa,MAAiD;AACrE,KAAI,OAAO,SAAS,SAClB,QAAO,kBAAkB,KAAK,GAAG,QAAQ,iBAAiB,KAAK,GAAG,QAAQ,oBAAoB,KAAK;AAErG,QAAO;;AAGT,MAAM,gBAAgB,QAAQ,YAAYA,mBAAG,WAAW,cAAc;AAEtE,SAAgB,oBA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,SAAS,SAAS;EACvF,YAAY;GAAC;GAAW;GAAW;GAAU,CAAC,SAAS,SAAS;6DAEzD,SAAS;GACJ,IAEf,CACH,EACD,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK,IAC5C,yDAACA,yBAAK;EAAO,MAAM;EAAW;EAAW;EAAa;6DAC7C,GAAG,UAAU;GACR,IAEf"}
1
+ {"version":3,"file":"components-YKTwNDfu.cjs","names":["File","Type","ts","modifiers","questionToken","initializer: ts.Expression","factory.createTypeLiteralNode","factory.createArrayDeclaration","factory.createOptionalTypeNode","factory.createRestTypeNode","factory.createArrayTypeNode","factory.createTupleTypeNode","factory.createTypeReferenceNode","factory.createUnionDeclaration","factory.createLiteralTypeNode","factory.createTrue","factory.createFalse","factory.createNumericLiteral","factory.createStringLiteral","factory.createIdentifier","factory.createIntersectionDeclaration","propertyName","schemaKeywords","name","schema","factory.createPropertySignature","factory.appendJSDocToNode","transformers","additionalProperties: any","factory.createIndexSignature","typeNodes: ts.Node[]","schemaKeywords","SchemaGenerator","factory.createTypeReferenceNode","factory.createArrayTypeNode","factory.createUnionDeclaration","factory.createTypeDeclaration","factory.createOmitDeclaration","transformers","name","factory.createEnumDeclaration","File"],"sources":["../src/components/OasType.tsx","../src/factory.ts","../src/parser.ts","../src/components/Type.tsx"],"sourcesContent":["import type { OasTypes } from '@kubb/oas'\nimport { File, Type } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n typeName: string\n api: OasTypes.OASDocument\n}\n\nexport function OasType({ name, typeName, api }: Props): KubbNode {\n return (\n <>\n <File.Source name={name} isExportable isIndexable>\n {`export const ${name} = ${JSON.stringify(api, undefined, 2)} as const`}\n </File.Source>\n <br />\n <File.Source name={typeName} isExportable isIndexable isTypeOnly>\n <Type name={typeName} export>\n {`Infer<typeof ${name}>`}\n </Type>\n </File.Source>\n </>\n )\n}\n","import { orderBy } from 'natural-orderby'\nimport { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes }: { nodes: Array<ts.TypeNode> }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n return factory.createArrayTypeNode(nodes.at(0)!)\n }\n\n return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)])\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // node: {...node}, with that ts.addSyntheticLeadingComment is appending\n return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the imports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(item) => (typeof item === 'object' ? item.propertyName : item)])\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n sortedName.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n // Sort the exports alphabetically for consistent output across platforms\n const sortedName = orderBy(name, [(propertyName) => (typeof propertyName === 'string' ? propertyName : propertyName.text)])\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n sortedName.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n}: {\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer)\n }\n\n if (key) {\n return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n type === 'asPascalConst' ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n} as const\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n","import transformers from '@kubb/core/transformers'\nimport type { SchemaKeywordMapper, SchemaMapper } from '@kubb/plugin-oas'\nimport { createParser, isKeyword, schemaKeywords } from '@kubb/plugin-oas'\nimport type ts from 'typescript'\nimport * as factory from './factory.ts'\n\nexport const typeKeywordMapper = {\n any: () => factory.keywordTypeNodes.any,\n unknown: () => factory.keywordTypeNodes.unknown,\n void: () => factory.keywordTypeNodes.void,\n number: () => factory.keywordTypeNodes.number,\n integer: () => factory.keywordTypeNodes.number,\n object: (nodes?: ts.TypeElement[]) => {\n if (!nodes || !nodes.length) {\n return factory.keywordTypeNodes.object\n }\n\n return factory.createTypeLiteralNode(nodes)\n },\n string: () => factory.keywordTypeNodes.string,\n boolean: () => factory.keywordTypeNodes.boolean,\n undefined: () => factory.keywordTypeNodes.undefined,\n nullable: undefined,\n null: () => factory.keywordTypeNodes.null,\n nullish: undefined,\n array: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createArrayDeclaration({ nodes })\n },\n tuple: (nodes?: ts.TypeNode[], rest?: ts.TypeNode, min?: number, max?: number) => {\n if (!nodes) {\n return undefined\n }\n\n if (max) {\n nodes = nodes.slice(0, max)\n\n if (nodes.length < max && rest) {\n nodes = [...nodes, ...Array(max - nodes.length).fill(rest)]\n }\n }\n\n if (min) {\n nodes = nodes.map((node, index) => (index >= min ? factory.createOptionalTypeNode(node) : node))\n }\n\n if (typeof max === 'undefined' && rest) {\n nodes.push(factory.createRestTypeNode(factory.createArrayTypeNode(rest)))\n }\n\n return factory.createTupleTypeNode(nodes)\n },\n enum: (name?: string) => {\n if (!name) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(name, undefined)\n },\n union: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createUnionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n const: (name?: string | number | boolean, format?: 'string' | 'number' | 'boolean') => {\n if (name === null || name === undefined || name === '') {\n return undefined\n }\n\n if (format === 'boolean') {\n if (name === true) {\n return factory.createLiteralTypeNode(factory.createTrue())\n }\n\n return factory.createLiteralTypeNode(factory.createFalse())\n }\n\n if (format === 'number' && typeof name === 'number') {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(name))\n }\n\n return factory.createLiteralTypeNode(factory.createStringLiteral(name.toString()))\n },\n datetime: () => factory.keywordTypeNodes.string,\n date: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n time: (type: 'date' | 'string' = 'string') =>\n type === 'string' ? factory.keywordTypeNodes.string : factory.createTypeReferenceNode(factory.createIdentifier('Date')),\n uuid: () => factory.keywordTypeNodes.string,\n url: () => factory.keywordTypeNodes.string,\n default: undefined,\n and: (nodes?: ts.TypeNode[]) => {\n if (!nodes) {\n return undefined\n }\n\n return factory.createIntersectionDeclaration({\n withParentheses: true,\n nodes,\n })\n },\n describe: undefined,\n min: undefined,\n max: undefined,\n optional: undefined,\n matches: () => factory.keywordTypeNodes.string,\n email: () => factory.keywordTypeNodes.string,\n firstName: undefined,\n lastName: undefined,\n password: undefined,\n phone: undefined,\n readOnly: undefined,\n writeOnly: undefined,\n ref: (propertyName?: string) => {\n if (!propertyName) {\n return undefined\n }\n\n return factory.createTypeReferenceNode(propertyName, undefined)\n },\n blob: () => factory.createTypeReferenceNode('Blob', []),\n deprecated: undefined,\n example: undefined,\n schema: undefined,\n catchall: undefined,\n name: undefined,\n interface: undefined,\n exclusiveMaximum: undefined,\n exclusiveMinimum: undefined,\n} satisfies SchemaMapper<ts.TypeNode | null | undefined>\n\ntype ParserOptions = {\n /**\n * @default `'questionToken'`\n */\n optionalType: 'questionToken' | 'undefined' | 'questionTokenAndUndefined'\n /**\n * Choose to use `enum`, `asConst`, `asPascalConst`, `constEnum`, or `literal` for enums.\n * - `enum`: TypeScript enum\n * - `asConst`: const with camelCase name (e.g., `petType`)\n * - `asPascalConst`: const with PascalCase name (e.g., `PetType`)\n * - `constEnum`: const enum\n * - `literal`: literal union type\n * @default `'asConst'`\n */\n enumType: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n mapper?: Record<string, ts.PropertySignature>\n}\n\n/**\n * Recursively parses a schema tree node into a corresponding TypeScript AST node.\n *\n * Maps OpenAPI schema keywords to TypeScript AST nodes using the `typeKeywordMapper`, handling complex types such as unions, intersections, arrays, tuples (with optional/rest elements and length constraints), enums, constants, references, and objects with property modifiers and documentation annotations.\n *\n * @param current - The schema node to parse.\n * @param siblings - Sibling schema nodes, used for context in certain mappings.\n * @param name - The name of the schema or property being parsed.\n * @param options - Parsing options controlling output style, property handling, and custom mappers.\n * @returns The generated TypeScript AST node, or `undefined` if the schema keyword is not mapped.\n */\nexport const parse = createParser<ts.Node | null, ParserOptions>({\n mapper: typeKeywordMapper,\n handlers: {\n union(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.union)) return undefined\n\n return typeKeywordMapper.union(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n and(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.and)) return undefined\n\n return typeKeywordMapper.and(\n current.args.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n array(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.array)) return undefined\n\n return typeKeywordMapper.array(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n )\n },\n enum(tree, options) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.enum)) return undefined\n\n // Adding suffix to enum (see https://github.com/kubb-labs/kubb/issues/1873)\n return typeKeywordMapper.enum(options.enumType === 'asConst' ? `${current.args.typeName}Key` : current.args.typeName)\n },\n ref(tree, _options) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.ref)) return undefined\n\n return typeKeywordMapper.ref(current.args.name)\n },\n blob(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.blob)) return undefined\n\n return typeKeywordMapper.blob()\n },\n tuple(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.tuple)) return undefined\n\n return typeKeywordMapper.tuple(\n current.args.items.map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options)).filter(Boolean) as ts.TypeNode[],\n current.args.rest &&\n ((this.parse({ schema, parent: current, name, current: current.args.rest, siblings: [] }, options) ?? undefined) as ts.TypeNode | undefined),\n current.args.min,\n current.args.max,\n )\n },\n const(tree, _options) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.const)) return undefined\n\n return typeKeywordMapper.const(current.args.name, current.args.format)\n },\n object(tree, options) {\n const { current, schema, name } = tree\n if (!isKeyword(current, schemaKeywords.object)) return undefined\n\n const properties = Object.entries(current.args?.properties || {})\n .filter((item) => {\n const schemas = item[1]\n return schemas && typeof schemas.map === 'function'\n })\n .map(([name, schemas]) => {\n const nameSchema = schemas.find((schema) => schema.keyword === schemaKeywords.name) as SchemaKeywordMapper['name']\n const mappedName = nameSchema?.args || name\n\n // custom mapper(pluginOptions)\n if (options.mapper?.[mappedName]) {\n return options.mapper?.[mappedName]\n }\n\n const isNullish = schemas.some((schema) => schema.keyword === schemaKeywords.nullish)\n const isNullable = schemas.some((schema) => schema.keyword === schemaKeywords.nullable)\n const isOptional = schemas.some((schema) => schema.keyword === schemaKeywords.optional)\n const isReadonly = schemas.some((schema) => schema.keyword === schemaKeywords.readOnly)\n const describeSchema = schemas.find((schema) => schema.keyword === schemaKeywords.describe) as SchemaKeywordMapper['describe'] | undefined\n const deprecatedSchema = schemas.find((schema) => schema.keyword === schemaKeywords.deprecated) as SchemaKeywordMapper['deprecated'] | undefined\n const defaultSchema = schemas.find((schema) => schema.keyword === schemaKeywords.default) as SchemaKeywordMapper['default'] | undefined\n const exampleSchema = schemas.find((schema) => schema.keyword === schemaKeywords.example) as SchemaKeywordMapper['example'] | undefined\n const schemaSchema = schemas.find((schema) => schema.keyword === schemaKeywords.schema) as SchemaKeywordMapper['schema'] | undefined\n const minSchema = schemas.find((schema) => schema.keyword === schemaKeywords.min) as SchemaKeywordMapper['min'] | undefined\n const maxSchema = schemas.find((schema) => schema.keyword === schemaKeywords.max) as SchemaKeywordMapper['max'] | undefined\n const matchesSchema = schemas.find((schema) => schema.keyword === schemaKeywords.matches) as SchemaKeywordMapper['matches'] | undefined\n\n let type = schemas\n .map((it) =>\n this.parse(\n {\n schema,\n parent: current,\n name,\n current: it,\n siblings: schemas,\n },\n options,\n ),\n )\n .filter(Boolean)[0] as ts.TypeNode\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(options.optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n const propertyNode = factory.createPropertySignature({\n questionToken: isOptional || isNullish ? ['questionToken', 'questionTokenAndUndefined'].includes(options.optionalType as string) : false,\n name: mappedName,\n type,\n readOnly: isReadonly,\n })\n\n return factory.appendJSDocToNode({\n node: propertyNode,\n comments: [\n describeSchema ? `@description ${transformers.jsStringEscape(describeSchema.args)}` : undefined,\n deprecatedSchema ? '@deprecated' : undefined,\n minSchema ? `@minLength ${minSchema.args}` : undefined,\n maxSchema ? `@maxLength ${maxSchema.args}` : undefined,\n matchesSchema ? `@pattern ${matchesSchema.args}` : undefined,\n defaultSchema ? `@default ${defaultSchema.args}` : undefined,\n exampleSchema ? `@example ${exampleSchema.args}` : undefined,\n schemaSchema?.args?.type || schemaSchema?.args?.format\n ? [`@type ${schemaSchema?.args?.type || 'unknown'}${!isOptional ? '' : ' | undefined'}`, schemaSchema?.args?.format].filter(Boolean).join(', ')\n : undefined,\n ].filter(Boolean),\n })\n })\n\n let additionalProperties: any\n\n if (current.args?.additionalProperties?.length) {\n additionalProperties = current.args.additionalProperties\n .map((it) => this.parse({ schema, parent: current, name, current: it, siblings: [] }, options))\n .filter(Boolean)\n .at(0) as ts.TypeNode\n\n const isNullable = current.args?.additionalProperties.some((schema) => isKeyword(schema, schemaKeywords.nullable))\n if (isNullable) {\n additionalProperties = factory.createUnionDeclaration({\n nodes: [additionalProperties, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n additionalProperties = factory.createIndexSignature(additionalProperties)\n }\n\n return typeKeywordMapper.object([...properties, additionalProperties].filter(Boolean))\n },\n datetime(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.datetime)) return undefined\n\n return typeKeywordMapper.datetime()\n },\n date(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.date)) return undefined\n\n return typeKeywordMapper.date(current.args.type)\n },\n time(tree) {\n const { current } = tree\n if (!isKeyword(current, schemaKeywords.time)) return undefined\n\n return typeKeywordMapper.time(current.args.type)\n },\n },\n})\n","import transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/fabric-core/parsers/typescript'\nimport type { SchemaObject } from '@kubb/oas'\nimport { isKeyword, type Schema, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type ts from 'typescript'\nimport * as factory from '../factory.ts'\nimport { parse, typeKeywordMapper } from '../parser.ts'\nimport type { PluginTs } from '../types.ts'\n\ntype Props = {\n name: string\n typedName: string\n schema: SchemaObject\n tree: Array<Schema>\n optionalType: PluginTs['resolvedOptions']['optionalType']\n enumType: PluginTs['resolvedOptions']['enumType']\n mapper: PluginTs['resolvedOptions']['mapper']\n syntaxType: PluginTs['resolvedOptions']['syntaxType']\n description?: string\n keysToOmit?: string[]\n}\n\nexport function Type({ name, typedName, tree, keysToOmit, schema, optionalType, syntaxType, enumType, mapper, description }: Props): KubbNode {\n const typeNodes: ts.Node[] = []\n\n if (!tree.length) {\n return ''\n }\n\n const schemaFromTree = tree.find((item) => item.keyword === schemaKeywords.schema)\n const enumSchemas = SchemaGenerator.deepSearch(tree, schemaKeywords.enum)\n\n let type =\n (tree\n .map((current, _index, siblings) =>\n parse(\n { name, schema, parent: undefined, current, siblings },\n {\n optionalType,\n enumType,\n mapper,\n },\n ),\n )\n .filter(Boolean)\n .at(0) as ts.TypeNode) || typeKeywordMapper.undefined()\n\n // Add a \"Key\" suffix to avoid collisions where necessary\n if (enumType === 'asConst' && enumSchemas.length > 0) {\n const isDirectEnum = schema.type === 'array' && schema.items !== undefined\n const isEnumOnly = 'enum' in schema && schema.enum\n\n if (isDirectEnum || isEnumOnly) {\n const enumSchema = enumSchemas[0]!\n const typeNameWithKey = `${enumSchema.args.typeName}Key`\n\n type = factory.createTypeReferenceNode(typeNameWithKey)\n\n if (schema.type === 'array') {\n type = factory.createArrayTypeNode(type)\n }\n }\n }\n\n if (schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.schema)) {\n const isNullish = tree.some((item) => item.keyword === schemaKeywords.nullish)\n const isNullable = tree.some((item) => item.keyword === schemaKeywords.nullable)\n const isOptional = tree.some((item) => item.keyword === schemaKeywords.optional)\n\n if (isNullable) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.null],\n }) as ts.TypeNode\n }\n\n if (isNullish && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n\n if (isOptional && ['undefined', 'questionTokenAndUndefined'].includes(optionalType as string)) {\n type = factory.createUnionDeclaration({\n nodes: [type, factory.keywordTypeNodes.undefined],\n }) as ts.TypeNode\n }\n }\n\n const useTypeGeneration = syntaxType === 'type' || [factory.syntaxKind.union].includes(type.kind as typeof factory.syntaxKind.union) || !!keysToOmit?.length\n\n typeNodes.push(\n factory.createTypeDeclaration({\n name,\n isExportable: true,\n type: keysToOmit?.length\n ? factory.createOmitDeclaration({\n keys: keysToOmit,\n type,\n nonNullable: true,\n })\n : type,\n syntax: useTypeGeneration ? 'type' : 'interface',\n comments: [\n description ? `@description ${transformers.jsStringEscape(description)}` : undefined,\n schema.deprecated ? '@deprecated' : undefined,\n schema.minLength ? `@minLength ${schema.minLength}` : undefined,\n schema.maxLength ? `@maxLength ${schema.maxLength}` : undefined,\n schema.pattern ? `@pattern ${schema.pattern}` : undefined,\n schema.default ? `@default ${schema.default}` : undefined,\n schema.example ? `@example ${schema.example}` : undefined,\n ],\n }),\n )\n\n const enums = [...new Set(enumSchemas)].map((enumSchema) => {\n const name = enumType === 'asPascalConst' ? transformers.pascalCase(enumSchema.args.name) : transformers.camelCase(enumSchema.args.name)\n const typeName = enumType === 'asConst' ? `${enumSchema.args.typeName}Key` : enumSchema.args.typeName\n\n const [nameNode, typeNode] = factory.createEnumDeclaration({\n name,\n typeName,\n enums: enumSchema.args.items\n .map((item) => (item.value === undefined ? undefined : [transformers.trimQuotes(item.name?.toString()), item.value]))\n .filter(Boolean) as unknown as Array<[string, string]>,\n type: enumType,\n })\n\n return {\n nameNode,\n typeNode,\n name,\n typeName,\n }\n })\n\n return (\n <>\n {enums.map(({ name, nameNode, typeName, typeNode }) => (\n <>\n {nameNode && (\n <File.Source name={name} isExportable isIndexable>\n {print(nameNode)}\n </File.Source>\n )}\n {\n <File.Source\n name={typeName}\n isIndexable\n isExportable={['enum', 'asConst', 'constEnum', 'literal', undefined].includes(enumType)}\n isTypeOnly={['asConst', 'literal', undefined].includes(enumType)}\n >\n {print(typeNode)}\n </File.Source>\n }\n </>\n ))}\n {enums.every((item) => item.typeName !== name) && (\n <File.Source name={typedName} isTypeOnly isExportable isIndexable>\n {print(...typeNodes)}\n </File.Source>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,QAAQ,EAAE,MAAM,UAAU,OAAwB;AAChE,QACE;EACE,wDAACA,wBAAK;GAAa;GAAM;GAAa;aACnC,gBAAgB,KAAK,KAAK,KAAK,UAAU,KAAK,QAAW,EAAE,CAAC;IACjD;EACd,wDAAC,SAAK;EACN,wDAACA,wBAAK;GAAO,MAAM;GAAU;GAAa;GAAY;aACpD,wDAACC;IAAK,MAAM;IAAU;cACnB,gBAAgB,KAAK;KACjB;IACK;KACb;;;;;ACrBP,MAAM,EAAE,YAAY,YAAYC;AAIhC,MAAa,YAAY;CACvB,OAAO,QAAQ,eAAeA,mBAAG,WAAW,aAAa;CACzD,Q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AO,aAAa,kBAAkBD,gCAAa,WAAW,WAAW,KAAK,KAAK,GAAGA,gCAAa,UAAU,WAAW,KAAK,KAAK;EACxI,MAAM,WAAW,aAAa,YAAY,GAAG,WAAW,KAAK,SAAS,OAAO,WAAW,KAAK;EAE7F,MAAM,CAAC,UAAU,YAAYE,sBAA8B;GACzD;GACA;GACA,OAAO,WAAW,KAAK,MACpB,KAAK,SAAU,KAAK,UAAU,SAAY,SAAY,CAACF,gCAAa,WAAW,KAAK,MAAM,UAAU,CAAC,EAAE,KAAK,MAAM,CAAE,CACpH,OAAO,QAAQ;GAClB,MAAM;GACP,CAAC;AAEF,SAAO;GACL;GACA;GACA;GACA;GACD;GACD;AAEF,QACE,+GACG,MAAM,KAAK,EAAE,cAAM,UAAU,UAAU,eACtC,+GACG,YACC,wDAACG,wBAAK;EAAO,MAAMF;EAAM;EAAa;4DAC7B,SAAS;GACJ,EAGd,wDAACE,wBAAK;EACJ,MAAM;EACN;EACA,cAAc;GAAC;GAAQ;GAAW;GAAa;GAAW;GAAU,CAAC,SAAS,SAAS;EACvF,YAAY;GAAC;GAAW;GAAW;GAAU,CAAC,SAAS,SAAS;4DAEzD,SAAS;GACJ,IAEf,CACH,EACD,MAAM,OAAO,SAAS,KAAK,aAAa,KAAK,IAC5C,wDAACA,wBAAK;EAAO,MAAM;EAAW;EAAW;EAAa;4DAC7C,GAAG,UAAU;GACR,IAEf"}
@@ -1,4 +1,4 @@
1
- const require_components = require('./components-CaL9tu8t.cjs');
1
+ const require_components = require('./components-YKTwNDfu.cjs');
2
2
 
3
3
  exports.OasType = require_components.OasType;
4
4
  exports.Type = require_components.Type;
@@ -1,4 +1,4 @@
1
- const require_plugin = require('./plugin-KCnzc1f5.cjs');
1
+ const require_plugin = require('./plugin-Bgktd6zB.cjs');
2
2
 
3
3
  exports.oasGenerator = require_plugin.oasGenerator;
4
4
  exports.typeGenerator = require_plugin.typeGenerator;
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_plugin = require('./plugin-KCnzc1f5.cjs');
1
+ const require_plugin = require('./plugin-Bgktd6zB.cjs');
2
2
 
3
3
  exports.pluginTs = require_plugin.pluginTs;
4
4
  exports.pluginTsName = require_plugin.pluginTsName;
@@ -1,48 +1,48 @@
1
- const require_components = require('./components-CaL9tu8t.cjs');
1
+ const require_components = require('./components-YKTwNDfu.cjs');
2
2
  let node_path = require("node:path");
3
3
  node_path = require_components.__toESM(node_path);
4
- let __kubb_core = require("@kubb/core");
5
- let __kubb_core_transformers = require("@kubb/core/transformers");
6
- __kubb_core_transformers = require_components.__toESM(__kubb_core_transformers);
7
- let __kubb_plugin_oas = require("@kubb/plugin-oas");
8
- let __kubb_core_hooks = require("@kubb/core/hooks");
9
- let __kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
10
- let __kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
11
- let __kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
12
- let __kubb_react_fabric = require("@kubb/react-fabric");
13
- let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
14
- let __kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
4
+ let _kubb_core = require("@kubb/core");
5
+ let _kubb_core_transformers = require("@kubb/core/transformers");
6
+ _kubb_core_transformers = require_components.__toESM(_kubb_core_transformers);
7
+ let _kubb_plugin_oas = require("@kubb/plugin-oas");
8
+ let _kubb_core_hooks = require("@kubb/core/hooks");
9
+ let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
10
+ let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
11
+ let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
12
+ let _kubb_react_fabric = require("@kubb/react-fabric");
13
+ let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
14
+ let _kubb_fabric_core_parsers_typescript = require("@kubb/fabric-core/parsers/typescript");
15
15
 
16
16
  //#region src/generators/oasGenerator.tsx
17
- const oasGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
17
+ const oasGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
18
18
  name: "oas",
19
19
  Operations({ plugin }) {
20
20
  const { options: { output }, key: pluginKey } = plugin;
21
- const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
22
- const oas = (0, __kubb_plugin_oas_hooks.useOas)();
21
+ const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
22
+ const oas = (0, _kubb_plugin_oas_hooks.useOas)();
23
23
  const file = pluginManager.getFile({
24
24
  name: "oas",
25
25
  extname: ".ts",
26
26
  pluginKey
27
27
  });
28
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
28
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
29
29
  baseName: file.baseName,
30
30
  path: file.path,
31
31
  meta: file.meta,
32
- banner: (0, __kubb_plugin_oas_utils.getBanner)({
32
+ banner: (0, _kubb_plugin_oas_utils.getBanner)({
33
33
  oas,
34
34
  output,
35
35
  config: pluginManager.config
36
36
  }),
37
- footer: (0, __kubb_plugin_oas_utils.getFooter)({
37
+ footer: (0, _kubb_plugin_oas_utils.getFooter)({
38
38
  oas,
39
39
  output
40
40
  }),
41
- children: [/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
41
+ children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
42
42
  name: ["Infer"],
43
43
  path: "@kubb/oas",
44
44
  isTypeOnly: true
45
- }), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.OasType, {
45
+ }), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.OasType, {
46
46
  name: "oas",
47
47
  typeName: "Oas",
48
48
  api: oas.api
@@ -103,28 +103,28 @@ function printCombinedSchema({ name, schemas, pluginManager }) {
103
103
  });
104
104
  return require_components.createTypeReferenceNode(require_components.createIdentifier(identifier), void 0);
105
105
  }) });
106
- return (0, __kubb_fabric_core_parsers_typescript.print)(require_components.createTypeAliasDeclaration({
106
+ return (0, _kubb_fabric_core_parsers_typescript.print)(require_components.createTypeAliasDeclaration({
107
107
  name,
108
108
  type: require_components.createTypeLiteralNode(Object.keys(properties).map((key) => {
109
109
  const type = properties[key];
110
110
  if (!type) return;
111
111
  return require_components.createPropertySignature({
112
- name: __kubb_core_transformers.default.pascalCase(key),
112
+ name: _kubb_core_transformers.default.pascalCase(key),
113
113
  type
114
114
  });
115
115
  }).filter(Boolean)),
116
116
  modifiers: [require_components.modifiers.export]
117
117
  }));
118
118
  }
119
- const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
119
+ const typeGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
120
120
  name: "typescript",
121
121
  Operation({ operation, generator, plugin }) {
122
122
  const { options, options: { mapper, enumType, syntaxType, optionalType } } = plugin;
123
- const mode = (0, __kubb_core_hooks.useMode)();
124
- const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
125
- const oas = (0, __kubb_plugin_oas_hooks.useOas)();
126
- const { getSchemas, getFile, getName, getGroup } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
127
- const schemaManager = (0, __kubb_plugin_oas_hooks.useSchemaManager)();
123
+ const mode = (0, _kubb_core_hooks.useMode)();
124
+ const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
125
+ const oas = (0, _kubb_plugin_oas_hooks.useOas)();
126
+ const { getSchemas, getFile, getName, getGroup } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
127
+ const schemaManager = (0, _kubb_plugin_oas_hooks.useSchemaManager)();
128
128
  const file = getFile(operation);
129
129
  const schemas = getSchemas(operation);
130
130
  const type = getName(operation, {
@@ -132,7 +132,7 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
132
132
  pluginKey: [pluginTsName]
133
133
  });
134
134
  const combinedSchemaName = operation.method === "get" ? `${type}Query` : `${type}Mutation`;
135
- const schemaGenerator = new __kubb_plugin_oas.SchemaGenerator(options, {
135
+ const schemaGenerator = new _kubb_plugin_oas.SchemaGenerator(options, {
136
136
  fabric: generator.context.fabric,
137
137
  oas,
138
138
  events: generator.context.events,
@@ -161,7 +161,7 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
161
161
  typedName: schemaManager.getName(name, { type: "type" }),
162
162
  file: schemaManager.getFile(options$1.operationName || name, { group })
163
163
  };
164
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
164
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
165
165
  root: file.path,
166
166
  path: imp.path,
167
167
  name: imp.name,
@@ -171,7 +171,7 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
171
171
  imp.name,
172
172
  imp.path,
173
173
  imp.isTypeOnly
174
- ].join("-"))), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.Type, {
174
+ ].join("-"))), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Type, {
175
175
  name: type$1.name,
176
176
  typedName: type$1.typedName,
177
177
  description,
@@ -184,20 +184,20 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
184
184
  syntaxType
185
185
  })] });
186
186
  };
187
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
187
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
188
188
  baseName: file.baseName,
189
189
  path: file.path,
190
190
  meta: file.meta,
191
- banner: (0, __kubb_plugin_oas_utils.getBanner)({
191
+ banner: (0, _kubb_plugin_oas_utils.getBanner)({
192
192
  oas,
193
193
  output: plugin.options.output,
194
194
  config: pluginManager.config
195
195
  }),
196
- footer: (0, __kubb_plugin_oas_utils.getFooter)({
196
+ footer: (0, _kubb_plugin_oas_utils.getFooter)({
197
197
  oas,
198
198
  output: plugin.options.output
199
199
  }),
200
- children: [operationSchemas.map(mapOperationSchema), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
200
+ children: [operationSchemas.map(mapOperationSchema), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
201
201
  name: combinedSchemaName,
202
202
  isExportable: true,
203
203
  isIndexable: true,
@@ -212,33 +212,33 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
212
212
  },
213
213
  Schema({ schema, plugin }) {
214
214
  const { options: { mapper, enumType, syntaxType, optionalType, output } } = plugin;
215
- const mode = (0, __kubb_core_hooks.useMode)();
216
- const oas = (0, __kubb_plugin_oas_hooks.useOas)();
217
- const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
218
- const { getName, getImports, getFile } = (0, __kubb_plugin_oas_hooks.useSchemaManager)();
215
+ const mode = (0, _kubb_core_hooks.useMode)();
216
+ const oas = (0, _kubb_plugin_oas_hooks.useOas)();
217
+ const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
218
+ const { getName, getImports, getFile } = (0, _kubb_plugin_oas_hooks.useSchemaManager)();
219
219
  const imports = getImports(schema.tree);
220
- const schemaFromTree = schema.tree.find((item) => item.keyword === __kubb_plugin_oas.schemaKeywords.schema);
220
+ const schemaFromTree = schema.tree.find((item) => item.keyword === _kubb_plugin_oas.schemaKeywords.schema);
221
221
  let typedName = getName(schema.name, { type: "type" });
222
- if (enumType === "asConst" && schemaFromTree && (0, __kubb_plugin_oas.isKeyword)(schemaFromTree, __kubb_plugin_oas.schemaKeywords.enum)) typedName = typedName += "Key";
222
+ if (enumType === "asConst" && schemaFromTree && (0, _kubb_plugin_oas.isKeyword)(schemaFromTree, _kubb_plugin_oas.schemaKeywords.enum)) typedName = typedName += "Key";
223
223
  const type = {
224
224
  name: getName(schema.name, { type: "function" }),
225
225
  typedName,
226
226
  file: getFile(schema.name)
227
227
  };
228
- return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
228
+ return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
229
229
  baseName: type.file.baseName,
230
230
  path: type.file.path,
231
231
  meta: type.file.meta,
232
- banner: (0, __kubb_plugin_oas_utils.getBanner)({
232
+ banner: (0, _kubb_plugin_oas_utils.getBanner)({
233
233
  oas,
234
234
  output,
235
235
  config: pluginManager.config
236
236
  }),
237
- footer: (0, __kubb_plugin_oas_utils.getFooter)({
237
+ footer: (0, _kubb_plugin_oas_utils.getFooter)({
238
238
  oas,
239
239
  output
240
240
  }),
241
- children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
241
+ children: [mode === "split" && imports.map((imp) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
242
242
  root: type.file.path,
243
243
  path: imp.path,
244
244
  name: imp.name,
@@ -247,7 +247,7 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
247
247
  schema.name,
248
248
  imp.path,
249
249
  imp.isTypeOnly
250
- ].join("-"))), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_components.Type, {
250
+ ].join("-"))), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_components.Type, {
251
251
  name: type.name,
252
252
  typedName: type.typedName,
253
253
  description: schema.value.description,
@@ -265,7 +265,7 @@ const typeGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
265
265
  //#endregion
266
266
  //#region src/plugin.ts
267
267
  const pluginTsName = "plugin-ts";
268
- const pluginTs = (0, __kubb_core.definePlugin)((options) => {
268
+ const pluginTs = (0, _kubb_core.definePlugin)((options) => {
269
269
  const { output = {
270
270
  path: "types",
271
271
  barrelType: "named"
@@ -288,10 +288,10 @@ const pluginTs = (0, __kubb_core.definePlugin)((options) => {
288
288
  mapper,
289
289
  usedEnumNames: {}
290
290
  },
291
- pre: [__kubb_plugin_oas.pluginOasName],
291
+ pre: [_kubb_plugin_oas.pluginOasName],
292
292
  resolvePath(baseName, pathMode, options$1) {
293
293
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
294
- if ((pathMode ?? (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
294
+ if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
295
295
  /**
296
296
  * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
297
297
  * Other plugins then need to call addOrAppend instead of just add from the fileManager class
@@ -300,22 +300,22 @@ const pluginTs = (0, __kubb_core.definePlugin)((options) => {
300
300
  if (group && (options$1?.group?.path || options$1?.group?.tag)) {
301
301
  const groupName = group?.name ? group.name : (ctx) => {
302
302
  if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
303
- return `${(0, __kubb_core_transformers.camelCase)(ctx.group)}Controller`;
303
+ return `${(0, _kubb_core_transformers.camelCase)(ctx.group)}Controller`;
304
304
  };
305
305
  return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
306
306
  }
307
307
  return node_path.default.resolve(root, output.path, baseName);
308
308
  },
309
309
  resolveName(name, type) {
310
- const resolvedName = (0, __kubb_core_transformers.pascalCase)(name, { isFile: type === "file" });
310
+ const resolvedName = (0, _kubb_core_transformers.pascalCase)(name, { isFile: type === "file" });
311
311
  if (type) return transformers$1?.name?.(resolvedName, type) || resolvedName;
312
312
  return resolvedName;
313
313
  },
314
314
  async install() {
315
315
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
316
- const mode = (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path));
316
+ const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
317
317
  const oas = await this.getOas();
318
- const schemaFiles = await new __kubb_plugin_oas.SchemaGenerator(this.plugin.options, {
318
+ const schemaFiles = await new _kubb_plugin_oas.SchemaGenerator(this.plugin.options, {
319
319
  fabric: this.fabric,
320
320
  oas,
321
321
  pluginManager: this.pluginManager,
@@ -328,7 +328,7 @@ const pluginTs = (0, __kubb_core.definePlugin)((options) => {
328
328
  output: output.path
329
329
  }).build(...generators);
330
330
  await this.upsertFile(...schemaFiles);
331
- const operationFiles = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
331
+ const operationFiles = await new _kubb_plugin_oas.OperationGenerator(this.plugin.options, {
332
332
  fabric: this.fabric,
333
333
  oas,
334
334
  pluginManager: this.pluginManager,
@@ -341,7 +341,7 @@ const pluginTs = (0, __kubb_core.definePlugin)((options) => {
341
341
  mode
342
342
  }).build(...generators);
343
343
  await this.upsertFile(...operationFiles);
344
- const barrelFiles = await (0, __kubb_core.getBarrelFiles)(this.fabric.files, {
344
+ const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
345
345
  type: output.barrelType ?? "named",
346
346
  root,
347
347
  output,
@@ -377,4 +377,4 @@ Object.defineProperty(exports, 'typeGenerator', {
377
377
  return typeGenerator;
378
378
  }
379
379
  });
380
- //# sourceMappingURL=plugin-KCnzc1f5.cjs.map
380
+ //# sourceMappingURL=plugin-Bgktd6zB.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-KCnzc1f5.cjs","names":["File","OasType","properties: Record<string, ts.TypeNode>","transformers","SchemaGenerator","options","type","File","Type","schemaKeywords","pluginOasName","path","options","groupName: Group['name']","transformers","SchemaGenerator","OperationGenerator"],"sources":["../src/generators/oasGenerator.tsx","../src/generators/typeGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { OasType } from '../components'\nimport type { PluginTs } from '../types.ts'\n\nexport const oasGenerator = createReactGenerator<PluginTs>({\n name: 'oas',\n Operations({ plugin }) {\n const {\n options: { output },\n key: pluginKey,\n } = plugin\n const pluginManager = usePluginManager()\n const oas = useOas()\n\n const file = pluginManager.getFile({ name: 'oas', extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['Infer']} path=\"@kubb/oas\" isTypeOnly />\n\n <OasType name={'oas'} typeName={'Oas'} api={oas.api} />\n </File>\n )\n },\n})\n","import type { PluginManager } from '@kubb/core'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/fabric-core/parsers/typescript'\nimport { isKeyword, type OperationSchemas, type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport type ts from 'typescript'\nimport { Type } from '../components'\nimport * as factory from '../factory.ts'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types'\n\nfunction printCombinedSchema({ name, schemas, pluginManager }: { name: string; schemas: OperationSchemas; pluginManager: PluginManager }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createUnionDeclaration({\n nodes: schemas.responses.map((res) => {\n const identifier = pluginManager.resolveName({\n name: res.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n if (schemas.request) {\n const identifier = pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.pathParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.queryParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.headerParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n const identifier = pluginManager.resolveName({\n name: error.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(\n Object.keys(properties)\n .map((key) => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature({\n name: transformers.pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport const typeGenerator = createReactGenerator<PluginTs>({\n name: 'typescript',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { mapper, enumType, syntaxType, optionalType },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const type = getName(operation, { type: 'function', pluginKey: [pluginTsName] })\n const combinedSchemaName = operation.method === 'get' ? `${type}Query` : `${type}Mutation`\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n events: generator.context.events,\n plugin,\n pluginManager,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaObject, description, keysToOmit, ...options }: OperationSchemaType) => {\n const tree = schemaGenerator.parse({ schemaObject, name })\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const type = {\n name: schemaManager.getName(name, { type: 'type' }),\n typedName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(options.operationName || name, { group }),\n }\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[name, imp.name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n keysToOmit={keysToOmit}\n syntaxType={syntaxType}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {operationSchemas.map(mapOperationSchema)}\n\n <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>\n {printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager })}\n </File.Source>\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const {\n options: { mapper, enumType, syntaxType, optionalType, output },\n } = plugin\n const mode = useMode()\n\n const oas = useOas()\n const pluginManager = usePluginManager()\n\n const { getName, getImports, getFile } = useSchemaManager()\n const imports = getImports(schema.tree)\n const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema)\n\n let typedName = getName(schema.name, { type: 'type' })\n\n if (enumType === 'asConst' && schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.enum)) {\n typedName = typedName += 'Key' //Suffix for avoiding collisions (https://github.com/kubb-labs/kubb/issues/1873)\n }\n\n const type = {\n name: getName(schema.name, { type: 'function' }),\n typedName,\n file: getFile(schema.name),\n }\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[schema.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 description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n syntaxType={syntaxType}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { oasGenerator, typeGenerator } from './generators'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = definePlugin<PluginTs>((options) => {\n const {\n output = { path: 'types', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = 'enum',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n emptySchemaType = unknownType,\n syntaxType = 'type',\n transformers = {},\n oasType = false,\n mapper = {},\n generators = [typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean),\n contentType,\n } = options\n\n const usedEnumNames = {}\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n dateType,\n optionalType,\n oasType,\n enumType,\n enumSuffix,\n unknownType,\n emptySchemaType,\n syntaxType,\n group,\n override,\n mapper,\n usedEnumNames,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAa,sEAA8C;CACzD,MAAM;CACN,WAAW,EAAE,UAAU;EACrB,MAAM,EACJ,SAAS,EAAE,UACX,KAAK,cACH;EACJ,MAAM,yDAAkC;EACxC,MAAM,2CAAc;EAEpB,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAO,SAAS;GAAO;GAAW,CAAC;AAE9E,SACE,0DAACA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,yDAACA,yBAAK;IAAO,MAAM,CAAC,QAAQ;IAAE,MAAK;IAAY;KAAa,EAE5D,yDAACC;IAAQ,MAAM;IAAO,UAAU;IAAO,KAAK,IAAI;KAAO;IAClD;;CAGZ,CAAC;;;;ACnBF,SAAS,oBAAoB,EAAE,MAAM,SAAS,iBAAoG;CAChJ,MAAMC,aAA0C,EAAE;AAElD,KAAI,QAAQ,SACV,YAAW,wDAA6C,EACtD,OAAO,QAAQ,UAAU,KAAK,QAAQ;EACpC,MAAM,aAAa,cAAc,YAAY;GAC3C,MAAM,IAAI;GACV,WAAW,CAAC,aAAa;GACzB,MAAM;GACP,CAAC;AAEF,wFAAgE,WAAW,EAAE,OAAU;GACvF,EACH,CAAC;AAGJ,KAAI,QAAQ,SAAS;EACnB,MAAM,aA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ACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"plugin-Bgktd6zB.cjs","names":["File","OasType","properties: Record<string, ts.TypeNode>","transformers","SchemaGenerator","options","type","File","Type","schemaKeywords","pluginOasName","path","options","groupName: Group['name']","transformers","SchemaGenerator","OperationGenerator"],"sources":["../src/generators/oasGenerator.tsx","../src/generators/typeGenerator.tsx","../src/plugin.ts"],"sourcesContent":["import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { OasType } from '../components'\nimport type { PluginTs } from '../types.ts'\n\nexport const oasGenerator = createReactGenerator<PluginTs>({\n name: 'oas',\n Operations({ plugin }) {\n const {\n options: { output },\n key: pluginKey,\n } = plugin\n const pluginManager = usePluginManager()\n const oas = useOas()\n\n const file = pluginManager.getFile({ name: 'oas', extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <File.Import name={['Infer']} path=\"@kubb/oas\" isTypeOnly />\n\n <OasType name={'oas'} typeName={'Oas'} api={oas.api} />\n </File>\n )\n },\n})\n","import type { PluginManager } from '@kubb/core'\nimport { useMode, usePluginManager } from '@kubb/core/hooks'\nimport transformers from '@kubb/core/transformers'\nimport { print } from '@kubb/fabric-core/parsers/typescript'\nimport { isKeyword, type OperationSchemas, type OperationSchema as OperationSchemaType, SchemaGenerator, schemaKeywords } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager, useSchemaManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport type ts from 'typescript'\nimport { Type } from '../components'\nimport * as factory from '../factory.ts'\nimport { pluginTsName } from '../plugin.ts'\nimport type { PluginTs } from '../types'\n\nfunction printCombinedSchema({ name, schemas, pluginManager }: { name: string; schemas: OperationSchemas; pluginManager: PluginManager }): string {\n const properties: Record<string, ts.TypeNode> = {}\n\n if (schemas.response) {\n properties['response'] = factory.createUnionDeclaration({\n nodes: schemas.responses.map((res) => {\n const identifier = pluginManager.resolveName({\n name: res.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n if (schemas.request) {\n const identifier = pluginManager.resolveName({\n name: schemas.request.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['request'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.pathParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.pathParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['pathParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.queryParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.queryParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['queryParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.headerParams) {\n const identifier = pluginManager.resolveName({\n name: schemas.headerParams.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n properties['headerParams'] = factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }\n\n if (schemas.errors) {\n properties['errors'] = factory.createUnionDeclaration({\n nodes: schemas.errors.map((error) => {\n const identifier = pluginManager.resolveName({\n name: error.name,\n pluginKey: [pluginTsName],\n type: 'function',\n })\n\n return factory.createTypeReferenceNode(factory.createIdentifier(identifier), undefined)\n }),\n })!\n }\n\n const namespaceNode = factory.createTypeAliasDeclaration({\n name,\n type: factory.createTypeLiteralNode(\n Object.keys(properties)\n .map((key) => {\n const type = properties[key]\n if (!type) {\n return undefined\n }\n\n return factory.createPropertySignature({\n name: transformers.pascalCase(key),\n type,\n })\n })\n .filter(Boolean),\n ),\n modifiers: [factory.modifiers.export],\n })\n\n return print(namespaceNode)\n}\n\nexport const typeGenerator = createReactGenerator<PluginTs>({\n name: 'typescript',\n Operation({ operation, generator, plugin }) {\n const {\n options,\n options: { mapper, enumType, syntaxType, optionalType },\n } = plugin\n\n const mode = useMode()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getSchemas, getFile, getName, getGroup } = useOperationManager(generator)\n const schemaManager = useSchemaManager()\n\n const file = getFile(operation)\n const schemas = getSchemas(operation)\n const type = getName(operation, { type: 'function', pluginKey: [pluginTsName] })\n const combinedSchemaName = operation.method === 'get' ? `${type}Query` : `${type}Mutation`\n const schemaGenerator = new SchemaGenerator(options, {\n fabric: generator.context.fabric,\n oas,\n events: generator.context.events,\n plugin,\n pluginManager,\n mode,\n override: options.override,\n })\n\n const operationSchemas = [schemas.pathParams, schemas.queryParams, schemas.headerParams, schemas.statusCodes, schemas.request, schemas.response]\n .flat()\n .filter(Boolean)\n\n const mapOperationSchema = ({ name, schema: schemaObject, description, keysToOmit, ...options }: OperationSchemaType) => {\n const tree = schemaGenerator.parse({ schemaObject, name })\n const imports = schemaManager.getImports(tree)\n const group = options.operation ? getGroup(options.operation) : undefined\n\n const type = {\n name: schemaManager.getName(name, { type: 'type' }),\n typedName: schemaManager.getName(name, { type: 'type' }),\n file: schemaManager.getFile(options.operationName || name, { group }),\n }\n\n return (\n <>\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[name, imp.name, imp.path, imp.isTypeOnly].join('-')} root={file.path} path={imp.path} name={imp.name} isTypeOnly />\n ))}\n <Type\n name={type.name}\n typedName={type.typedName}\n description={description}\n tree={tree}\n schema={schemaObject}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n keysToOmit={keysToOmit}\n syntaxType={syntaxType}\n />\n </>\n )\n }\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: plugin.options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: plugin.options.output })}\n >\n {operationSchemas.map(mapOperationSchema)}\n\n <File.Source name={combinedSchemaName} isExportable isIndexable isTypeOnly>\n {printCombinedSchema({ name: combinedSchemaName, schemas, pluginManager })}\n </File.Source>\n </File>\n )\n },\n Schema({ schema, plugin }) {\n const {\n options: { mapper, enumType, syntaxType, optionalType, output },\n } = plugin\n const mode = useMode()\n\n const oas = useOas()\n const pluginManager = usePluginManager()\n\n const { getName, getImports, getFile } = useSchemaManager()\n const imports = getImports(schema.tree)\n const schemaFromTree = schema.tree.find((item) => item.keyword === schemaKeywords.schema)\n\n let typedName = getName(schema.name, { type: 'type' })\n\n if (enumType === 'asConst' && schemaFromTree && isKeyword(schemaFromTree, schemaKeywords.enum)) {\n typedName = typedName += 'Key' //Suffix for avoiding collisions (https://github.com/kubb-labs/kubb/issues/1873)\n }\n\n const type = {\n name: getName(schema.name, { type: 'function' }),\n typedName,\n file: getFile(schema.name),\n }\n\n return (\n <File\n baseName={type.file.baseName}\n path={type.file.path}\n meta={type.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {mode === 'split' &&\n imports.map((imp) => (\n <File.Import key={[schema.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 description={schema.value.description}\n tree={schema.tree}\n schema={schema.value}\n mapper={mapper}\n enumType={enumType}\n optionalType={optionalType}\n syntaxType={syntaxType}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName, SchemaGenerator } from '@kubb/plugin-oas'\nimport { oasGenerator, typeGenerator } from './generators'\nimport type { PluginTs } from './types.ts'\n\nexport const pluginTsName = 'plugin-ts' satisfies PluginTs['name']\n\nexport const pluginTs = definePlugin<PluginTs>((options) => {\n const {\n output = { path: 'types', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n enumType = 'asConst',\n enumSuffix = 'enum',\n dateType = 'string',\n unknownType = 'any',\n optionalType = 'questionToken',\n emptySchemaType = unknownType,\n syntaxType = 'type',\n transformers = {},\n oasType = false,\n mapper = {},\n generators = [typeGenerator, oasType === 'infer' ? oasGenerator : undefined].filter(Boolean),\n contentType,\n } = options\n\n const usedEnumNames = {}\n\n return {\n name: pluginTsName,\n options: {\n output,\n transformers,\n dateType,\n optionalType,\n oasType,\n enumType,\n enumSuffix,\n unknownType,\n emptySchemaType,\n syntaxType,\n group,\n override,\n mapper,\n usedEnumNames,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = pascalCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n\n const schemaGenerator = new SchemaGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n include: undefined,\n override,\n mode,\n output: output.path,\n })\n\n const schemaFiles = await schemaGenerator.build(...generators)\n await this.upsertFile(...schemaFiles)\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const operationFiles = await operationGenerator.build(...generators)\n await this.upsertFile(...operationFiles)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,MAAa,qEAA8C;CACzD,MAAM;CACN,WAAW,EAAE,UAAU;EACrB,MAAM,EACJ,SAAS,EAAE,UACX,KAAK,cACH;EACJ,MAAM,wDAAkC;EACxC,MAAM,0CAAc;EAEpB,MAAM,OAAO,cAAc,QAAQ;GAAE,MAAM;GAAO,SAAS;GAAO;GAAW,CAAC;AAE9E,SACE,yDAACA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,8CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,8CAAkB;IAAE;IAAK;IAAQ,CAAC;cAElC,wDAACA,wBAAK;IAAO,MAAM,CAAC,QAAQ;IAAE,MAAK;IAAY;KAAa,EAE5D,wDAACC;IAAQ,MAAM;IAAO,UAAU;IAAO,KAAK,IAAI;KAAO;IAClD;;CAGZ,CAAC;;;;ACnBF,SAAS,oBAAoB,EAAE,MAAM,SAAS,iBAAoG;CAChJ,MAAMC,aAA0C,EAAE;AAElD,KAAI,QAAQ,SACV,YAAW,wDAA6C,EACtD,OAAO,QAAQ,UAAU,KAAK,QAAQ;EACpC,MAAM,aAAa,cAAc,YAAY;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;AACpE,SAAM,KAAK,WAAW,GAAG,eAAe;GAExC,MAAM,cAAc,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-ts",
3
- "version": "4.12.3",
3
+ "version": "4.12.4",
4
4
  "description": "TypeScript code generation plugin for Kubb, transforming OpenAPI schemas into TypeScript interfaces, types, and utility functions.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -64,17 +64,14 @@
64
64
  }
65
65
  ],
66
66
  "dependencies": {
67
- "@kubb/fabric-core": "0.7.0",
68
- "@kubb/react-fabric": "0.7.0",
67
+ "@kubb/fabric-core": "0.7.1",
68
+ "@kubb/react-fabric": "0.7.1",
69
69
  "natural-orderby": "^5.0.0",
70
70
  "remeda": "^2.32.0",
71
71
  "typescript": "5.9.3",
72
- "@kubb/core": "4.12.3",
73
- "@kubb/oas": "4.12.3",
74
- "@kubb/plugin-oas": "4.12.3"
75
- },
76
- "devDependencies": {
77
- "@kubb/plugin-oas": "4.12.3"
72
+ "@kubb/core": "4.12.4",
73
+ "@kubb/oas": "4.12.4",
74
+ "@kubb/plugin-oas": "4.12.4"
78
75
  },
79
76
  "peerDependencies": {
80
77
  "@kubb/react-fabric": "0.7.0",