swagger-typescript-api 13.2.5 → 13.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # swagger-typescript-api
2
2
 
3
+ ## 13.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1306](https://github.com/acacode/swagger-typescript-api/pull/1306) [`fe125cb`](https://github.com/acacode/swagger-typescript-api/commit/fe125cb6820621447f2cbf35c8bc0604fcc466dd) Thanks [@js2me](https://github.com/js2me)! - better extracting description for request body extacting types
8
+
3
9
  ## 13.2.5
4
10
 
5
11
  ### Patch Changes
package/dist/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_src = require('./src-B15eFEWm.cjs');
2
+ const require_src = require('./src-CKol_ydn.cjs');
3
3
  const node_path = require_src.__toESM(require("node:path"));
4
4
  const c12 = require_src.__toESM(require("c12"));
5
5
  const citty = require_src.__toESM(require("citty"));
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-DW0ilIpJ.js";
2
+ import { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, generateApi, generateTemplates, package_default } from "./src-AKvd7SbK.js";
3
3
  import * as path$1 from "node:path";
4
4
  import { loadConfig } from "c12";
5
5
  import { defineCommand, runMain } from "citty";
package/dist/lib.cjs CHANGED
@@ -1,4 +1,4 @@
1
- const require_src = require('./src-B15eFEWm.cjs');
1
+ const require_src = require('./src-CKol_ydn.cjs');
2
2
 
3
3
  Object.defineProperty(exports, 'constants', {
4
4
  enumerable: true,
package/dist/lib.d.cts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { OpenAPI } from "openapi-types";
2
+ import * as typescript$1 from "typescript";
2
3
  import * as typescript from "typescript";
3
4
  import * as lodash19 from "lodash";
5
+ import * as lodash14 from "lodash";
4
6
  import lodash from "lodash";
5
7
  import * as swagger_schema_official16 from "swagger-schema-official";
6
8
  import * as eta20 from "eta";
@@ -339,14 +341,7 @@ declare class SchemaRoutes {
339
341
  };
340
342
  };
341
343
  convertRouteParamsIntoObject: (params: any) => any;
342
- getRequestBodyInfo: (routeInfo: any, routeParams: any, parsedSchemas: any, routeName: any) => {
343
- paramName: any;
344
- contentTypes: any[];
345
- contentKind: string;
346
- schema: any;
347
- type: any;
348
- required: any;
349
- };
344
+ getRequestBodyInfo: (routeInfo: any, routeParams: any, parsedSchemas: any, routeName: any) => any;
350
345
  createRequestParamsSchema: ({
351
346
  queryParams,
352
347
  queryObjectSchema,
@@ -386,7 +381,7 @@ declare class JavascriptTranslator extends Translator {
386
381
  compileTSCode: (input: TranslatorIO) => Record<string, string>;
387
382
  translate: (input: any) => Promise<{
388
383
  fileName: any;
389
- fileExtension: typescript.Extension;
384
+ fileExtension: typescript$1.Extension;
390
385
  fileContent: string;
391
386
  }[]>;
392
387
  }
@@ -1592,7 +1587,7 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1592
1587
  eol?: boolean | undefined;
1593
1588
  }) => string;
1594
1589
  NameResolver: typeof NameResolver;
1595
- _: lodash19.LoDashStatic;
1590
+ _: lodash14.LoDashStatic;
1596
1591
  require: (packageOrPath: string) => Promise<any>;
1597
1592
  };
1598
1593
  };
package/dist/lib.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { __export } from "./chunk-Cl8Af3a2.js";
2
1
  import * as lodash19 from "lodash";
2
+ import * as lodash14 from "lodash";
3
3
  import lodash from "lodash";
4
+ import * as typescript$1 from "typescript";
4
5
  import * as typescript from "typescript";
5
6
  import * as eta20 from "eta";
6
7
  import { OpenAPI } from "openapi-types";
@@ -338,14 +339,7 @@ declare class SchemaRoutes {
338
339
  };
339
340
  };
340
341
  convertRouteParamsIntoObject: (params: any) => any;
341
- getRequestBodyInfo: (routeInfo: any, routeParams: any, parsedSchemas: any, routeName: any) => {
342
- paramName: any;
343
- contentTypes: any[];
344
- contentKind: string;
345
- schema: any;
346
- type: any;
347
- required: any;
348
- };
342
+ getRequestBodyInfo: (routeInfo: any, routeParams: any, parsedSchemas: any, routeName: any) => any;
349
343
  createRequestParamsSchema: ({
350
344
  queryParams,
351
345
  queryObjectSchema,
@@ -385,7 +379,7 @@ declare class JavascriptTranslator extends Translator {
385
379
  compileTSCode: (input: TranslatorIO) => Record<string, string>;
386
380
  translate: (input: any) => Promise<{
387
381
  fileName: any;
388
- fileExtension: typescript.Extension;
382
+ fileExtension: typescript$1.Extension;
389
383
  fileContent: string;
390
384
  }[]>;
391
385
  }
@@ -1591,7 +1585,7 @@ declare function generateApi(config: Partial<GenerateApiConfiguration["config"]>
1591
1585
  eol?: boolean | undefined;
1592
1586
  }) => string;
1593
1587
  NameResolver: typeof NameResolver;
1594
- _: lodash19.LoDashStatic;
1588
+ _: lodash14.LoDashStatic;
1595
1589
  require: (packageOrPath: string) => Promise<any>;
1596
1590
  };
1597
1591
  };
package/dist/lib.js CHANGED
@@ -1,3 +1,3 @@
1
- import { constants_exports, generateApi, generateTemplates } from "./src-DW0ilIpJ.js";
1
+ import { constants_exports, generateApi, generateTemplates } from "./src-AKvd7SbK.js";
2
2
 
3
3
  export { constants_exports as constants, generateApi, generateTemplates };
@@ -1,13 +1,20 @@
1
1
  import { __export } from "./chunk-Cl8Af3a2.js";
2
2
  import { consola } from "consola";
3
3
  import lodash from "lodash";
4
+ import * as typescript$3 from "typescript";
5
+ import * as typescript$2 from "typescript";
6
+ import * as typescript$1 from "typescript";
4
7
  import * as typescript from "typescript";
8
+ import * as path$3 from "node:path";
9
+ import * as path$2 from "node:path";
5
10
  import * as path$1 from "node:path";
6
11
  import path from "node:path";
7
12
  import { Biome, Distribution } from "@biomejs/js-api";
13
+ import * as nanoid$1 from "nanoid";
8
14
  import * as nanoid from "nanoid";
9
15
  import * as yaml from "js-yaml";
10
16
  import * as swagger2openapi from "swagger2openapi";
17
+ import * as url$2 from "node:url";
11
18
  import * as url$1 from "node:url";
12
19
  import url from "node:url";
13
20
  import * as Eta from "eta";
@@ -22,11 +29,11 @@ var CodeFormatter = class {
22
29
  removeUnusedImports = (content) => {
23
30
  const tempFileName = "file.ts";
24
31
  const host = new TsLanguageServiceHost(tempFileName, content);
25
- const languageService = typescript.createLanguageService(host);
32
+ const languageService = typescript$3.createLanguageService(host);
26
33
  const fileTextChanges = languageService.organizeImports({
27
34
  type: "file",
28
35
  fileName: tempFileName
29
- }, { newLineCharacter: typescript.sys.newLine }, void 0)[0];
36
+ }, { newLineCharacter: typescript$3.sys.newLine }, void 0)[0];
30
37
  if (fileTextChanges?.textChanges.length) return fileTextChanges.textChanges.reduceRight((content$1, { span, newText }) => `${content$1.slice(0, span.start)}${newText}${content$1.slice(span.start + span.length)}`, content);
31
38
  return content;
32
39
  };
@@ -37,8 +44,8 @@ var CodeFormatter = class {
37
44
  files: { maxSize: Number.MAX_SAFE_INTEGER },
38
45
  formatter: { indentStyle: "space" }
39
46
  });
40
- const formatted = biome.formatContent(biomeProject.projectKey, content, { filePath: path$1.format({
41
- name: nanoid.nanoid(),
47
+ const formatted = biome.formatContent(biomeProject.projectKey, content, { filePath: path$3.format({
48
+ name: nanoid$1.nanoid(),
42
49
  ext: "ts"
43
50
  }) });
44
51
  return formatted.content;
@@ -56,11 +63,11 @@ var TsLanguageServiceHost = class {
56
63
  constructor(fileName, content) {
57
64
  this.fileName = fileName;
58
65
  this.content = content;
59
- const tsconfig = typescript.findConfigFile(fileName, typescript.sys.fileExists);
60
- this.compilerOptions = tsconfig ? typescript.convertCompilerOptionsFromJson(typescript.readConfigFile(tsconfig, typescript.sys.readFile).config.compilerOptions, "").options : typescript.getDefaultCompilerOptions();
66
+ const tsconfig = typescript$3.findConfigFile(fileName, typescript$3.sys.fileExists);
67
+ this.compilerOptions = tsconfig ? typescript$3.convertCompilerOptionsFromJson(typescript$3.readConfigFile(tsconfig, typescript$3.sys.readFile).config.compilerOptions, "").options : typescript$3.getDefaultCompilerOptions();
61
68
  }
62
69
  getNewLine() {
63
- return "newLine" in typescript.sys ? typescript.sys.newLine : "\n";
70
+ return "newLine" in typescript$3.sys ? typescript$3.sys.newLine : "\n";
64
71
  }
65
72
  getScriptFileNames() {
66
73
  return [this.fileName];
@@ -69,23 +76,23 @@ var TsLanguageServiceHost = class {
69
76
  return this.compilerOptions;
70
77
  }
71
78
  getDefaultLibFileName() {
72
- return typescript.getDefaultLibFileName(this.getCompilationSettings());
79
+ return typescript$3.getDefaultLibFileName(this.getCompilationSettings());
73
80
  }
74
81
  getCurrentDirectory() {
75
82
  return process.cwd();
76
83
  }
77
84
  getScriptVersion() {
78
- return typescript.version;
85
+ return typescript$3.version;
79
86
  }
80
87
  getScriptSnapshot() {
81
- return typescript.ScriptSnapshot.fromString(this.content);
88
+ return typescript$3.ScriptSnapshot.fromString(this.content);
82
89
  }
83
90
  readFile(fileName, encoding) {
84
91
  if (fileName === this.fileName) return this.content;
85
- return typescript.sys.readFile(fileName, encoding);
92
+ return typescript$3.sys.readFile(fileName, encoding);
86
93
  }
87
- fileExists(path$2) {
88
- return typescript.sys.fileExists(path$2);
94
+ fileExists(path$4) {
95
+ return typescript$3.sys.fileExists(path$4);
89
96
  }
90
97
  };
91
98
 
@@ -155,7 +162,7 @@ const getRandomInt = (min = 0, max = 1) => {
155
162
  var ComponentTypeNameResolver = class extends NameResolver {
156
163
  counter = 1;
157
164
  fallbackNameCounter = 1;
158
- countersByVariant = /* @__PURE__ */ new Map();
165
+ countersByVariant = new Map();
159
166
  constructor(config, reservedNames) {
160
167
  super(config, reservedNames, (variants) => {
161
168
  const randomVariant = variants[getRandomInt(0, variants.length - 1)];
@@ -177,7 +184,7 @@ var ComponentTypeNameResolver = class extends NameResolver {
177
184
  //#endregion
178
185
  //#region package.json
179
186
  var name = "swagger-typescript-api";
180
- var version = "13.2.5";
187
+ var version = "13.2.6";
181
188
  var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
182
189
  var homepage = "https://github.com/acacode/swagger-typescript-api";
183
190
  var bugs = "https://github.com/acacode/swagger-typescript-api/issues";
@@ -239,11 +246,11 @@ var devDependencies = {
239
246
  "@tsconfig/strictest": "2.0.5",
240
247
  "@types/js-yaml": "4.0.9",
241
248
  "@types/lodash": "4.17.18",
242
- "@types/node": "24.0.3",
249
+ "@types/node": "24.0.4",
243
250
  "@types/swagger2openapi": "7.0.4",
244
251
  "axios": "1.10.0",
245
252
  "openapi-types": "12.1.3",
246
- "tsdown": "0.12.8",
253
+ "tsdown": "0.12.9",
247
254
  "typedoc": "0.28.5",
248
255
  "vitest": "3.2.4"
249
256
  };
@@ -426,7 +433,7 @@ var CodeGenConfig = class {
426
433
  httpClient: "http-client",
427
434
  outOfModuleApi: "Common"
428
435
  };
429
- routeNameDuplicatesMap = /* @__PURE__ */ new Map();
436
+ routeNameDuplicatesMap = new Map();
430
437
  hooks = {
431
438
  onPreBuildRoutePath: (_routePath) => void 0,
432
439
  onBuildRoutePath: (_routeData) => void 0,
@@ -536,10 +543,10 @@ var CodeGenConfig = class {
536
543
  ]
537
544
  };
538
545
  compilerTsConfig = {
539
- module: typescript.ModuleKind.ESNext,
546
+ module: typescript$2.ModuleKind.ESNext,
540
547
  noImplicitReturns: true,
541
548
  alwaysStrict: true,
542
- target: typescript.ScriptTarget.ESNext,
549
+ target: typescript$2.ScriptTarget.ESNext,
543
550
  declaration: true,
544
551
  noImplicitAny: false,
545
552
  sourceMap: false,
@@ -2036,7 +2043,9 @@ var SchemaRoutes = class {
2036
2043
  if (schema?.typeData) schema.typeData.isExtractedRequestBody = true;
2037
2044
  content = this.schemaParserFabric.getInlineParseContent({ $ref: schema.$ref });
2038
2045
  }
2046
+ if (schema && schema.typeData && !schema.typeData.description && requestBody?.description) schema.typeData.description = requestBody.description;
2039
2047
  return {
2048
+ ...requestBody || {},
2040
2049
  paramName: requestBodyName || requestBody?.name || DEFAULT_BODY_ARG_NAME,
2041
2050
  contentTypes,
2042
2051
  contentKind,
@@ -2218,6 +2227,7 @@ var SchemaRoutes = class {
2218
2227
  type: queryType
2219
2228
  } : void 0,
2220
2229
  body: requestBodyInfo.type ? {
2230
+ ...requestBodyInfo,
2221
2231
  name: nameResolver.resolve([requestBodyInfo.paramName, ...RESERVED_BODY_ARG_NAMES]),
2222
2232
  optional: !requestBodyInfo.required,
2223
2233
  type: requestBodyInfo.type
@@ -2338,8 +2348,8 @@ var SchemaRoutes = class {
2338
2348
  var SchemaWalker = class {
2339
2349
  config;
2340
2350
  swaggerSchemaResolver;
2341
- schemas = /* @__PURE__ */ new Map();
2342
- caches = /* @__PURE__ */ new Map();
2351
+ schemas = new Map();
2352
+ caches = new Map();
2343
2353
  constructor(config, swaggerSchemaResolver) {
2344
2354
  this.config = config;
2345
2355
  this.swaggerSchemaResolver = swaggerSchemaResolver;
@@ -2354,8 +2364,8 @@ var SchemaWalker = class {
2354
2364
  return ref.startsWith("http://") || ref.startsWith("https://");
2355
2365
  };
2356
2366
  _getRefDataFromSchema = (schema, ref) => {
2357
- const path$2 = ref.replace("#", "").split("/");
2358
- const refData = lodash.get(schema, path$2);
2367
+ const path$4 = ref.replace("#", "").split("/");
2368
+ const refData = lodash.get(schema, path$4);
2359
2369
  if (refData) this.caches.set(ref, refData);
2360
2370
  return refData;
2361
2371
  };
@@ -2368,15 +2378,15 @@ var Request = class {
2368
2378
  constructor(config) {
2369
2379
  this.config = config;
2370
2380
  }
2371
- async download({ url: url$2, authToken,...options }) {
2381
+ async download({ url: url$3, authToken,...options }) {
2372
2382
  const requestOptions = {};
2373
2383
  if (authToken) requestOptions.headers = { Authorization: authToken };
2374
2384
  lodash.merge(requestOptions, options, this.config.requestOptions);
2375
2385
  try {
2376
- const response = await fetch(url$2, requestOptions);
2386
+ const response = await fetch(url$3, requestOptions);
2377
2387
  return await response.text();
2378
2388
  } catch (error) {
2379
- const message = `error while fetching data from URL "${url$2}"`;
2389
+ const message = `error while fetching data from URL "${url$3}"`;
2380
2390
  consola.error(message, error);
2381
2391
  return message;
2382
2392
  }
@@ -2395,9 +2405,9 @@ var SwaggerSchemaResolver = class {
2395
2405
  this.request = new Request(config);
2396
2406
  }
2397
2407
  async create() {
2398
- const { spec, patch, input, url: url$2, authorizationToken } = this.config;
2408
+ const { spec, patch, input, url: url$3, authorizationToken } = this.config;
2399
2409
  if (spec) return await this.convertSwaggerObject(spec, { patch });
2400
- const swaggerSchemaFile = await this.fetchSwaggerSchemaFile(input, url$2, authorizationToken);
2410
+ const swaggerSchemaFile = await this.fetchSwaggerSchemaFile(input, url$3, authorizationToken);
2401
2411
  const swaggerSchemaObject = this.processSwaggerSchemaFile(swaggerSchemaFile);
2402
2412
  return await this.convertSwaggerObject(swaggerSchemaObject, { patch });
2403
2413
  }
@@ -2487,12 +2497,12 @@ var TemplatesWorker = class {
2487
2497
  if (this.config.silent) consola.level = 0;
2488
2498
  }
2489
2499
  getTemplatePaths = (config) => {
2490
- const __dirname$1 = path$1.dirname(url$1.fileURLToPath(import.meta.url));
2491
- const baseTemplatesPath = path$1.resolve(__dirname$1, "../templates/base");
2492
- const defaultTemplatesPath = path$1.resolve(__dirname$1, "../templates/default");
2493
- const modularTemplatesPath = path$1.resolve(__dirname$1, "../templates/modular");
2500
+ const __dirname$1 = path$2.dirname(url$2.fileURLToPath(import.meta.url));
2501
+ const baseTemplatesPath = path$2.resolve(__dirname$1, "../templates/base");
2502
+ const defaultTemplatesPath = path$2.resolve(__dirname$1, "../templates/default");
2503
+ const modularTemplatesPath = path$2.resolve(__dirname$1, "../templates/modular");
2494
2504
  const originalTemplatesPath = config.modular ? modularTemplatesPath : defaultTemplatesPath;
2495
- const customTemplatesPath = config.templates && path$1.resolve(process.cwd(), config.templates);
2505
+ const customTemplatesPath = config.templates && path$2.resolve(process.cwd(), config.templates);
2496
2506
  return {
2497
2507
  base: baseTemplatesPath,
2498
2508
  default: defaultTemplatesPath,
@@ -2501,20 +2511,20 @@ var TemplatesWorker = class {
2501
2511
  custom: customTemplatesPath
2502
2512
  };
2503
2513
  };
2504
- cropExtension = (path$2) => this.config.templateExtensions.reduce((path$3, ext) => path$3.endsWith(ext) ? path$3.replace(ext, "") : path$3, path$2);
2514
+ cropExtension = (path$4) => this.config.templateExtensions.reduce((path$5, ext) => path$5.endsWith(ext) ? path$5.replace(ext, "") : path$5, path$4);
2505
2515
  getTemplateFullPath = (path_, fileName) => {
2506
- const raw = path$1.resolve(path_, "./", this.cropExtension(fileName));
2516
+ const raw = path$2.resolve(path_, "./", this.cropExtension(fileName));
2507
2517
  const pathVariants = this.config.templateExtensions.map((extension) => `${raw}${extension}`);
2508
2518
  return pathVariants.find((variant) => !!this.fileSystem.pathIsExist(variant));
2509
2519
  };
2510
2520
  requireFnFromTemplate = async (packageOrPath) => {
2511
2521
  const isPath = packageOrPath.startsWith("./") || packageOrPath.startsWith("../");
2512
- if (isPath) return await import(path$1.resolve(this.config.templatePaths.custom || this.config.templatePaths.original, packageOrPath));
2522
+ if (isPath) return await import(path$2.resolve(this.config.templatePaths.custom || this.config.templatePaths.original, packageOrPath));
2513
2523
  return await import(packageOrPath);
2514
2524
  };
2515
- getTemplate = (name$1, fileName, path$2) => {
2525
+ getTemplate = (name$1, fileName, path$4) => {
2516
2526
  const { templatePaths } = this.config;
2517
- if (path$2) return this.fileSystem.getFileContent(path$2);
2527
+ if (path$4) return this.fileSystem.getFileContent(path$4);
2518
2528
  if (!fileName) return "";
2519
2529
  const customFullPath = templatePaths.custom && this.getTemplateFullPath(templatePaths.custom, fileName);
2520
2530
  let fileContent = customFullPath && this.fileSystem.getFileContent(customFullPath);
@@ -2537,21 +2547,21 @@ var TemplatesWorker = class {
2537
2547
  [name$1]: this.getTemplate(name$1, fileName)
2538
2548
  }), {});
2539
2549
  };
2540
- findTemplateWithExt = (path$2) => {
2541
- const raw = this.cropExtension(path$2);
2550
+ findTemplateWithExt = (path$4) => {
2551
+ const raw = this.cropExtension(path$4);
2542
2552
  const pathVariants = this.config.templateExtensions.map((extension) => `${raw}${extension}`);
2543
2553
  return pathVariants.find((variant) => this.fileSystem.pathIsExist(variant));
2544
2554
  };
2545
2555
  getTemplateContent = (path_) => {
2546
2556
  const foundTemplatePathKey = lodash.keys(this.config.templatePaths).find((key) => path_.startsWith(`@${key}`));
2547
2557
  if (foundTemplatePathKey) {
2548
- const rawPath = path$1.resolve(path_.replace(`@${foundTemplatePathKey}`, lodash.get(this.config.templatePaths, foundTemplatePathKey)));
2558
+ const rawPath = path$2.resolve(path_.replace(`@${foundTemplatePathKey}`, lodash.get(this.config.templatePaths, foundTemplatePathKey)));
2549
2559
  const fixedPath = this.findTemplateWithExt(rawPath);
2550
2560
  if (fixedPath) return this.fileSystem.getFileContent(fixedPath);
2551
2561
  }
2552
- const customPath = this.config.templatePaths.custom && this.findTemplateWithExt(path$1.resolve(this.config.templatePaths.custom, path_));
2562
+ const customPath = this.config.templatePaths.custom && this.findTemplateWithExt(path$2.resolve(this.config.templatePaths.custom, path_));
2553
2563
  if (customPath) return this.fileSystem.getFileContent(customPath);
2554
- const originalPath = this.findTemplateWithExt(path$1.resolve(this.config.templatePaths.original, path_));
2564
+ const originalPath = this.findTemplateWithExt(path$2.resolve(this.config.templatePaths.original, path_));
2555
2565
  if (originalPath) return this.fileSystem.getFileContent(originalPath);
2556
2566
  return "";
2557
2567
  };
@@ -2563,8 +2573,8 @@ var TemplatesWorker = class {
2563
2573
  }, {
2564
2574
  async: false,
2565
2575
  ...options,
2566
- includeFile: (path$2, configuration$1, options$1 = {}) => {
2567
- return this.renderTemplate(this.getTemplateContent(path$2), configuration$1, options$1);
2576
+ includeFile: (path$4, configuration$1, options$1 = {}) => {
2577
+ return this.renderTemplate(this.getTemplateContent(path$4), configuration$1, options$1);
2568
2578
  }
2569
2579
  });
2570
2580
  };
@@ -2590,23 +2600,23 @@ var JavascriptTranslator = class extends Translator {
2590
2600
  compileTSCode = (input) => {
2591
2601
  const fileNameFull = `${input.fileName}${input.fileExtension}`;
2592
2602
  const output = {};
2593
- const host = typescript.createCompilerHost(this.config.compilerTsConfig, true);
2603
+ const host = typescript$1.createCompilerHost(this.config.compilerTsConfig, true);
2594
2604
  const fileNames = [fileNameFull];
2595
2605
  const originalSourceFileGet = host.getSourceFile.bind(host);
2596
2606
  host.getSourceFile = (sourceFileName, languageVersion, onError, shouldCreateNewSourceFile) => {
2597
2607
  if (sourceFileName !== fileNameFull) return originalSourceFileGet(sourceFileName, languageVersion, onError, shouldCreateNewSourceFile);
2598
- return typescript.createSourceFile(sourceFileName, input.fileContent, languageVersion, true, typescript.ScriptKind.TS);
2608
+ return typescript$1.createSourceFile(sourceFileName, input.fileContent, languageVersion, true, typescript$1.ScriptKind.TS);
2599
2609
  };
2600
2610
  host.writeFile = (fileName, contents) => {
2601
2611
  output[fileName] = contents;
2602
2612
  };
2603
- typescript.createProgram(fileNames, this.config.compilerTsConfig, host).emit();
2613
+ typescript$1.createProgram(fileNames, this.config.compilerTsConfig, host).emit();
2604
2614
  return output;
2605
2615
  };
2606
2616
  translate = async (input) => {
2607
2617
  const compiled = this.compileTSCode(input);
2608
- const jsFileName = `${input.fileName}${typescript.Extension.Js}`;
2609
- const dtsFileName = `${input.fileName}${typescript.Extension.Dts}`;
2618
+ const jsFileName = `${input.fileName}${typescript$1.Extension.Js}`;
2619
+ const dtsFileName = `${input.fileName}${typescript$1.Extension.Dts}`;
2610
2620
  const sourceContent = compiled[jsFileName];
2611
2621
  const tsImportRows = input.fileContent.split("\n").filter((line) => line.startsWith("import "));
2612
2622
  const declarationContent = compiled[dtsFileName].split("\n").map((line) => {
@@ -2615,11 +2625,11 @@ var JavascriptTranslator = class extends Translator {
2615
2625
  }).join("\n");
2616
2626
  return [{
2617
2627
  fileName: input.fileName,
2618
- fileExtension: typescript.Extension.Js,
2628
+ fileExtension: typescript$1.Extension.Js,
2619
2629
  fileContent: await this.codeFormatter.formatCode(sourceContent)
2620
2630
  }, {
2621
2631
  fileName: input.fileName,
2622
- fileExtension: typescript.Extension.Dts,
2632
+ fileExtension: typescript$1.Extension.Dts,
2623
2633
  fileContent: await this.codeFormatter.formatCode(declarationContent)
2624
2634
  }];
2625
2635
  };
@@ -2628,7 +2638,7 @@ var JavascriptTranslator = class extends Translator {
2628
2638
  //#endregion
2629
2639
  //#region src/type-name-formatter.ts
2630
2640
  var TypeNameFormatter = class {
2631
- formattedModelNamesMap = /* @__PURE__ */ new Map();
2641
+ formattedModelNamesMap = new Map();
2632
2642
  config;
2633
2643
  constructor(config) {
2634
2644
  this.config = config;
@@ -2671,16 +2681,16 @@ var TypeNameFormatter = class {
2671
2681
  //#endregion
2672
2682
  //#region src/util/file-system.ts
2673
2683
  var FileSystem = class {
2674
- getFileContent = (path$2) => {
2675
- return fs.readFileSync(path$2, { encoding: "utf8" });
2684
+ getFileContent = (path$4) => {
2685
+ return fs.readFileSync(path$4, { encoding: "utf8" });
2676
2686
  };
2677
- readDir = (path$2) => {
2678
- return fs.readdirSync(path$2);
2687
+ readDir = (path$4) => {
2688
+ return fs.readdirSync(path$4);
2679
2689
  };
2680
- pathIsDir = (path$2) => {
2681
- if (!path$2) return false;
2690
+ pathIsDir = (path$4) => {
2691
+ if (!path$4) return false;
2682
2692
  try {
2683
- const stat = fs.statSync(path$2);
2693
+ const stat = fs.statSync(path$4);
2684
2694
  return stat.isDirectory();
2685
2695
  } catch (e) {
2686
2696
  return false;
@@ -2691,27 +2701,27 @@ var FileSystem = class {
2691
2701
  if (fileNameParts.length > 1) fileNameParts.pop();
2692
2702
  return fileNameParts.join(".");
2693
2703
  };
2694
- removeDir = (path$2) => {
2704
+ removeDir = (path$4) => {
2695
2705
  try {
2696
- if (typeof fs.rmSync === "function") fs.rmSync(path$2, { recursive: true });
2697
- else fs.rmdirSync(path$2, { recursive: true });
2706
+ if (typeof fs.rmSync === "function") fs.rmSync(path$4, { recursive: true });
2707
+ else fs.rmdirSync(path$4, { recursive: true });
2698
2708
  } catch (e) {
2699
2709
  consola.debug("failed to remove dir", e);
2700
2710
  }
2701
2711
  };
2702
- createDir = (path$2) => {
2712
+ createDir = (path$4) => {
2703
2713
  try {
2704
- fs.mkdirSync(path$2, { recursive: true });
2714
+ fs.mkdirSync(path$4, { recursive: true });
2705
2715
  } catch (e) {
2706
2716
  consola.debug("failed to create dir", e);
2707
2717
  }
2708
2718
  };
2709
- cleanDir = (path$2) => {
2710
- this.removeDir(path$2);
2711
- this.createDir(path$2);
2719
+ cleanDir = (path$4) => {
2720
+ this.removeDir(path$4);
2721
+ this.createDir(path$4);
2712
2722
  };
2713
- pathIsExist = (path$2) => {
2714
- return !!path$2 && fs.existsSync(path$2);
2723
+ pathIsExist = (path$4) => {
2724
+ return !!path$4 && fs.existsSync(path$4);
2715
2725
  };
2716
2726
  createFile = ({ path: path_, fileName, content, withPrefix }) => {
2717
2727
  const __dirname$1 = path$1.dirname(url$1.fileURLToPath(import.meta.url));
@@ -3159,4 +3169,4 @@ async function generateApi(config) {
3159
3169
 
3160
3170
  //#endregion
3161
3171
  export { CodeGenConfig, HTTP_CLIENT, TemplatesGenConfig, constants_exports, generateApi, generateTemplates, package_default };
3162
- //# sourceMappingURL=src-DW0ilIpJ.js.map
3172
+ //# sourceMappingURL=src-AKvd7SbK.js.map