swagger-typescript-api 13.2.15 → 13.2.17

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.
@@ -1,12 +1,16 @@
1
- import { __export } from "./chunk-CTAAG5j7.js";
1
+ import { t as __exportAll } from "./chunk-DQk6qfdC.mjs";
2
2
  import * as module from "node:module";
3
3
  import { consola } from "consola";
4
- import lodash from "lodash";
4
+ import * as esToolkit from "es-toolkit";
5
+ import { compact, flattenDeep, isEqual, merge, omit, uniq } from "es-toolkit";
6
+ import * as esToolkitCompat from "es-toolkit/compat";
7
+ import { camelCase, get, startCase, upperFirst } from "es-toolkit/compat";
5
8
  import * as typescript from "typescript";
6
9
  import * as path$1 from "node:path";
7
10
  import path from "node:path";
8
11
  import { Biome, Distribution } from "@biomejs/js-api";
9
12
  import * as nanoid from "nanoid";
13
+ import * as crypto from "node:crypto";
10
14
  import * as swagger2openapi from "swagger2openapi";
11
15
  import * as YAML from "yaml";
12
16
  import * as url$1 from "node:url";
@@ -27,7 +31,7 @@ var CodeFormatter = class {
27
31
  type: "file",
28
32
  fileName: tempFileName
29
33
  }, { newLineCharacter: typescript.sys.newLine }, void 0)[0];
30
- 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);
34
+ if (fileTextChanges?.textChanges.length) return fileTextChanges.textChanges.reduceRight((content, { span, newText }) => `${content.slice(0, span.start)}${newText}${content.slice(span.start + span.length)}`, content);
31
35
  return content;
32
36
  };
33
37
  format = async (content) => {
@@ -83,8 +87,8 @@ var TsLanguageServiceHost = class {
83
87
  if (fileName === this.fileName) return this.content;
84
88
  return typescript.sys.readFile(fileName, encoding);
85
89
  }
86
- fileExists(path$2) {
87
- return typescript.sys.fileExists(path$2);
90
+ fileExists(path) {
91
+ return typescript.sys.fileExists(path);
88
92
  }
89
93
  };
90
94
 
@@ -100,14 +104,14 @@ var NameResolver = class {
100
104
  this.reserve(reservedNames);
101
105
  }
102
106
  reserve(names) {
103
- const fixedNames = lodash.uniq(lodash.compact(names));
104
- for (const name$1 of fixedNames) if (this.reservedNames.indexOf(name$1) === -1) this.reservedNames.push(name$1);
107
+ const fixedNames = uniq(compact(names));
108
+ for (const name of fixedNames) if (this.reservedNames.indexOf(name) === -1) this.reservedNames.push(name);
105
109
  }
106
110
  unreserve(names) {
107
- this.reservedNames = this.reservedNames.filter((reservedName) => !names.some((name$1) => name$1 === reservedName));
111
+ this.reservedNames = this.reservedNames.filter((reservedName) => !names.some((name) => name === reservedName));
108
112
  }
109
- isReserved(name$1) {
110
- return this.reservedNames.some((reservedName) => reservedName === name$1);
113
+ isReserved(name) {
114
+ return this.reservedNames.some((reservedName) => reservedName === name);
111
115
  }
112
116
  resolve(variants, resolver, extras, shouldReserve = true) {
113
117
  if (typeof resolver === "function") {
@@ -125,7 +129,7 @@ var NameResolver = class {
125
129
  }
126
130
  if (Array.isArray(variants)) {
127
131
  let usageName = null;
128
- const uniqVariants = lodash.uniq(lodash.compact(variants));
132
+ const uniqVariants = uniq(compact(variants));
129
133
  for (const variant of uniqVariants) if (!usageName && (!shouldReserve || !this.isReserved(variant))) usageName = variant;
130
134
  if (usageName) {
131
135
  shouldReserve && this.reserve([usageName]);
@@ -141,12 +145,9 @@ var NameResolver = class {
141
145
 
142
146
  //#endregion
143
147
  //#region src/util/random.ts
144
- const getRandomFloat = (min = 0, max = 1) => {
145
- return Math.random() * (max - min) + min;
146
- };
147
148
  const getRandomInt = (min = 0, max = 1) => {
148
149
  if (min === max) return min;
149
- return Math.round(getRandomFloat(min, max));
150
+ return Math.round(Math.random() * (max - min) + min);
150
151
  };
151
152
 
152
153
  //#endregion
@@ -176,116 +177,12 @@ var ComponentTypeNameResolver = class extends NameResolver {
176
177
  //#endregion
177
178
  //#region package.json
178
179
  var name = "swagger-typescript-api";
179
- var version = "13.2.15";
180
+ var version = "13.2.17";
180
181
  var description = "Generate the API client for Fetch or Axios from an OpenAPI Specification";
181
- var homepage = "https://github.com/acacode/swagger-typescript-api";
182
- var bugs = "https://github.com/acacode/swagger-typescript-api/issues";
183
- var repository = "github:acacode/swagger-typescript-api";
184
- var license = "MIT";
185
- var author = "Sergey Volkov <js2me@outlook.com>";
186
- var maintainers = ["Sora Morimoto <sora@morimoto.io>"];
187
- var type = "module";
188
- var exports = {
189
- ".": {
190
- "import": "./dist/index.js",
191
- "require": "./dist/index.cjs"
192
- },
193
- "./cli": {
194
- "import": "./dist/cli.js",
195
- "require": "./dist/cli.cjs"
196
- },
197
- "./package.json": "./package.json"
198
- };
199
- var main = "./dist/index.cjs";
200
- var module$1 = "./dist/index.js";
201
- var types = "./dist/index.d.cts";
202
- var bin = {
203
- "sta": "./dist/cli.js",
204
- "swagger-typescript-api": "./dist/cli.js"
205
- };
206
- var files = ["dist", "templates"];
207
- var scripts = {
208
- "build": "tsdown",
209
- "cli:help": "node index.js -h",
210
- "cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts",
211
- "cli:yaml": "node index.js -r -d -p ./swagger-test-cli.yaml -n swagger-test-cli.ts",
212
- "format": "biome format --write .",
213
- "format:check": "biome format .",
214
- "lint": "biome check",
215
- "prepack": "tsdown",
216
- "test": "vitest run",
217
- "typedoc": "typedoc"
218
- };
219
- var dependencies = {
220
- "@biomejs/js-api": "3.0.0",
221
- "@biomejs/wasm-nodejs": "2.2.5",
222
- "@types/lodash": "^4.17.20",
223
- "@types/swagger-schema-official": "^2.0.25",
224
- "c12": "^3.3.0",
225
- "citty": "^0.1.6",
226
- "consola": "^3.4.2",
227
- "eta": "^4.0.1",
228
- "lodash": "^4.17.21",
229
- "nanoid": "^5.1.6",
230
- "openapi-types": "^12.1.3",
231
- "swagger-schema-official": "2.0.0-bab6bed",
232
- "swagger2openapi": "^7.0.8",
233
- "typescript": "~5.9.3",
234
- "yaml": "^2.8.1"
235
- };
236
- var devDependencies = {
237
- "@biomejs/biome": "2.2.5",
238
- "@changesets/changelog-github": "0.5.1",
239
- "@changesets/cli": "2.29.7",
240
- "@tsconfig/node20": "20.1.6",
241
- "@tsconfig/strictest": "2.0.6",
242
- "@types/node": "24.7.0",
243
- "@types/swagger2openapi": "7.0.4",
244
- "axios": "1.12.2",
245
- "tsdown": "0.15.6",
246
- "typedoc": "0.28.13",
247
- "vitest": "3.2.4"
248
- };
249
- var packageManager = "yarn@4.10.3";
250
- var engines = { "node": ">=20" };
251
- var publishConfig = {
252
- "access": "public",
253
- "provenance": true,
254
- "registry": "https://registry.npmjs.org"
255
- };
256
- var typedocOptions = {
257
- "entryPoints": ["src/index.ts"],
258
- "skipErrorChecking": true
259
- };
260
- var package_default = {
261
- name,
262
- version,
263
- description,
264
- homepage,
265
- bugs,
266
- repository,
267
- license,
268
- author,
269
- maintainers,
270
- type,
271
- exports,
272
- main,
273
- module: module$1,
274
- types,
275
- bin,
276
- files,
277
- scripts,
278
- dependencies,
279
- devDependencies,
280
- packageManager,
281
- engines,
282
- publishConfig,
283
- typedocOptions
284
- };
285
182
 
286
183
  //#endregion
287
184
  //#region src/constants.ts
288
- var constants_exports = /* @__PURE__ */ __export({
185
+ var constants_exports = /* @__PURE__ */ __exportAll({
289
186
  DEFAULT_BODY_ARG_NAME: () => DEFAULT_BODY_ARG_NAME,
290
187
  FILE_PREFIX: () => FILE_PREFIX,
291
188
  HTTP_CLIENT: () => HTTP_CLIENT,
@@ -315,7 +212,7 @@ const HTTP_CLIENT = {
315
212
  FETCH: "fetch",
316
213
  AXIOS: "axios"
317
214
  };
318
- const PROJECT_VERSION = package_default.version;
215
+ const PROJECT_VERSION = version;
319
216
  const RESERVED_BODY_ARG_NAMES = [
320
217
  "data",
321
218
  "body",
@@ -349,16 +246,6 @@ const SCHEMA_TYPES$1 = {
349
246
  COMPLEX_UNKNOWN: "__unknown"
350
247
  };
351
248
 
352
- //#endregion
353
- //#region src/util/object-assign.ts
354
- const objectAssign = (target, updater) => {
355
- if (!updater) return;
356
- const update = typeof updater === "function" ? updater(target) : updater;
357
- const undefinedKeys = lodash.map(update, (value, key) => value === void 0 && key).filter((key) => typeof key === "string");
358
- Object.assign(target, lodash.merge(target, update));
359
- for (const key of undefinedKeys) target[key] = void 0;
360
- };
361
-
362
249
  //#endregion
363
250
  //#region src/configuration.ts
364
251
  const TsKeyword = {
@@ -559,11 +446,11 @@ var CodeGenConfig = class {
559
446
  BooleanValue: (content) => `${content}`,
560
447
  NumberValue: (content) => `${content}`,
561
448
  NullValue: () => "null",
562
- UnionType: (contents) => lodash.join(lodash.uniq(contents), ` ${this.Ts.Keyword.Union} `),
449
+ UnionType: (contents) => uniq(contents).join(` ${this.Ts.Keyword.Union} `),
563
450
  ExpressionGroup: (content) => content ? `(${content})` : "",
564
- IntersectionType: (contents) => lodash.join(lodash.uniq(contents), ` ${this.Ts.Keyword.Intersection} `),
451
+ IntersectionType: (contents) => uniq(contents).join(` ${this.Ts.Keyword.Intersection} `),
565
452
  RecordType: (key, value) => this.Ts.TypeWithGeneric(this.Ts.Keyword.Record, [key, value]),
566
- TypeField: ({ readonly, key, optional, value }) => lodash.compact([
453
+ TypeField: ({ readonly, key, optional, value }) => compact([
567
454
  readonly && "readonly ",
568
455
  key,
569
456
  optional && "?",
@@ -573,12 +460,12 @@ var CodeGenConfig = class {
573
460
  InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,
574
461
  EnumUsageKey: (enumStruct, key) => `${enumStruct}.${key}`,
575
462
  EnumField: (key, value) => `${key} = ${value}`,
576
- EnumFieldDescription: (description$1) => {
577
- if (description$1) return ` /** ${description$1} */`;
463
+ EnumFieldDescription: (description) => {
464
+ if (description) return ` /** ${description} */`;
578
465
  else return "";
579
466
  },
580
- EnumFieldsWrapper: (contents) => lodash.map(contents, ({ key, value, description: description$1 }) => {
581
- return [this.Ts.EnumFieldDescription(description$1), ` ${this.Ts.EnumField(key, value)}`].filter(Boolean).join("\n");
467
+ EnumFieldsWrapper: (contents) => contents.map(({ key, value, description }) => {
468
+ return compact([this.Ts.EnumFieldDescription(description), ` ${this.Ts.EnumField(key, value)}`]).join("\n");
582
469
  }).join(",\n"),
583
470
  ObjectWrapper: (content) => `{\n${content}\n}`,
584
471
  MultilineComment: (contents, formatFn) => [...contents.length === 1 ? [`/** ${contents[0]} */`] : [
@@ -668,13 +555,13 @@ var CodeGenConfig = class {
668
555
  }
669
556
  ];
670
557
  templateExtensions = [".eta", ".ejs"];
671
- constructor({ codeGenConstructs, primitiveTypeConstructs, constants, templateInfos, hooks,...otherConfig }) {
672
- objectAssign(this.Ts, codeGenConstructs);
673
- objectAssign(this.primitiveTypes, primitiveTypeConstructs);
558
+ constructor({ codeGenConstructs, primitiveTypeConstructs, constants, templateInfos, hooks, ...otherConfig }) {
559
+ Object.assign(this.Ts, codeGenConstructs);
560
+ Object.assign(this.primitiveTypes, primitiveTypeConstructs);
674
561
  this.defaultResponseType = this.Ts.Keyword.Void;
675
562
  this.update({
676
563
  ...otherConfig,
677
- hooks: lodash.merge(this.hooks, hooks || {}),
564
+ hooks: merge(this.hooks, hooks || {}),
678
565
  constants: {
679
566
  ...constants_exports,
680
567
  ...constants
@@ -690,7 +577,7 @@ var CodeGenConfig = class {
690
577
  this.componentTypeNameResolver = new ComponentTypeNameResolver(this, []);
691
578
  }
692
579
  update = (update) => {
693
- objectAssign(this, update);
580
+ Object.assign(this, update);
694
581
  if (this.enumNamesAsValues) this.extractEnums = true;
695
582
  };
696
583
  };
@@ -714,13 +601,11 @@ var SchemaComponentsMap = class {
714
601
  };
715
602
  createComponent($ref, rawTypeData) {
716
603
  const parsed = this.parseRef($ref);
717
- const typeName = parsed[parsed.length - 1];
718
- const componentName = parsed[parsed.length - 2];
719
604
  const componentSchema = {
720
605
  $ref,
721
- typeName,
606
+ typeName: parsed[parsed.length - 1],
722
607
  rawTypeData,
723
- componentName,
608
+ componentName: parsed[parsed.length - 2],
724
609
  typeData: null
725
610
  };
726
611
  const usageComponent = this.config.hooks.onCreateComponent(componentSchema) || componentSchema;
@@ -797,7 +682,7 @@ var SchemaFormatters = class {
797
682
  [SCHEMA_TYPES$1.ENUM]: (parsedSchema) => {
798
683
  return {
799
684
  ...parsedSchema,
800
- content: parsedSchema.$ref ? parsedSchema.typeName : this.config.Ts.UnionType(lodash.compact([...parsedSchema.content.map(({ value }) => `${value}`), parsedSchema.nullable && this.config.Ts.Keyword.Null])) || this.config.Ts.Keyword.Any
685
+ content: parsedSchema.$ref ? parsedSchema.typeName : this.config.Ts.UnionType(compact([...parsedSchema.content.map(({ value }) => `${value}`), parsedSchema.nullable && this.config.Ts.Keyword.Null])) || this.config.Ts.Keyword.Any
801
686
  };
802
687
  },
803
688
  [SCHEMA_TYPES$1.OBJECT]: (parsedSchema) => {
@@ -814,14 +699,14 @@ var SchemaFormatters = class {
814
699
  }
815
700
  };
816
701
  formatSchema = (parsedSchema, formatType = "base") => {
817
- const schemaType = lodash.get(parsedSchema, ["schemaType"]) || lodash.get(parsedSchema, ["$parsed", "schemaType"]);
818
- return lodash.get(this, [formatType, schemaType])?.(parsedSchema) || parsedSchema;
702
+ const schemaType = get(parsedSchema, ["schemaType"]) || get(parsedSchema, ["$parsed", "schemaType"]);
703
+ return get(this, [formatType, schemaType])?.(parsedSchema) || parsedSchema;
819
704
  };
820
- formatDescription = (description$1, inline) => {
821
- if (!description$1) return "";
822
- if (!description$1.includes("\n")) return description$1;
823
- if (inline) return lodash._(description$1).split(/\n/g).map((part) => part.trim()).compact().join(" ").valueOf();
824
- return description$1.replace(/\n$/g, "");
705
+ formatDescription = (description, inline) => {
706
+ if (!description) return "";
707
+ if (!description.includes("\n")) return description;
708
+ if (inline) return compact(description.split(/\n/g).map((part) => part.trim())).join(" ");
709
+ return description.replace(/\n$/g, "");
825
710
  };
826
711
  formatObjectContent = (content) => {
827
712
  const fields = [];
@@ -882,8 +767,8 @@ var MonoSchemaParser = class {
882
767
  var ArraySchemaParser = class extends MonoSchemaParser {
883
768
  parse() {
884
769
  let contentType;
885
- const { type: type$1, description: description$1, items } = this.schema || {};
886
- if (Array.isArray(items) && type$1 === SCHEMA_TYPES$1.ARRAY) {
770
+ const { type, description, items } = this.schema || {};
771
+ if (Array.isArray(items) && type === SCHEMA_TYPES$1.ARRAY) {
887
772
  const tupleContent = [];
888
773
  for (const item of items) tupleContent.push(this.schemaParserFabric.createSchemaParser({
889
774
  schema: item,
@@ -905,7 +790,7 @@ var ArraySchemaParser = class extends MonoSchemaParser {
905
790
  type: SCHEMA_TYPES$1.PRIMITIVE,
906
791
  typeIdentifier: this.config.Ts.Keyword.Type,
907
792
  name: this.typeName,
908
- description: this.schemaFormatters.formatDescription(description$1),
793
+ description: this.schemaFormatters.formatDescription(description),
909
794
  content: this.schemaUtils.safeAddNullToType(this.schema, contentType)
910
795
  };
911
796
  }
@@ -916,7 +801,7 @@ var ArraySchemaParser = class extends MonoSchemaParser {
916
801
  var ComplexSchemaParser = class extends MonoSchemaParser {
917
802
  parse() {
918
803
  const complexType = this.schemaUtils.getComplexType(this.schema);
919
- const simpleSchema = lodash.omit(lodash.clone(this.schema), lodash.keys(this.schemaParser._complexSchemaParsers));
804
+ const simpleSchema = omit(this.schema, Object.keys(this.schemaParser._complexSchemaParsers));
920
805
  const complexSchemaContent = this.schemaParser._complexSchemaParsers[complexType](this.schema);
921
806
  return {
922
807
  ...typeof this.schema === "object" ? this.schema : {},
@@ -926,8 +811,8 @@ var ComplexSchemaParser = class extends MonoSchemaParser {
926
811
  type: SCHEMA_TYPES$1.PRIMITIVE,
927
812
  typeIdentifier: this.config.Ts.Keyword.Type,
928
813
  name: this.typeName,
929
- description: this.schemaFormatters.formatDescription(this.schema.description || lodash.compact(lodash.map(this.schema[complexType], "description"))[0] || ""),
930
- content: this.config.Ts.IntersectionType(lodash.compact([this.config.Ts.ExpressionGroup(complexSchemaContent), this.schemaUtils.getInternalSchemaType(simpleSchema) === SCHEMA_TYPES$1.OBJECT && this.config.Ts.ExpressionGroup(this.schemaParserFabric.createSchemaParser({
814
+ description: this.schemaFormatters.formatDescription(this.schema.description || compact((this.schema[complexType] || []).map((item) => item?.description))[0] || ""),
815
+ content: this.config.Ts.IntersectionType(compact([this.config.Ts.ExpressionGroup(complexSchemaContent), this.schemaUtils.getInternalSchemaType(simpleSchema) === SCHEMA_TYPES$1.OBJECT && this.config.Ts.ExpressionGroup(this.schemaParserFabric.createSchemaParser({
931
816
  schema: simpleSchema,
932
817
  schemaPath: this.schemaPath
933
818
  }).getInlineParseContent())])) || this.config.Ts.Keyword.Any
@@ -940,7 +825,7 @@ var ComplexSchemaParser = class extends MonoSchemaParser {
940
825
  var DiscriminatorSchemaParser = class extends MonoSchemaParser {
941
826
  parse() {
942
827
  const ts = this.config.Ts;
943
- const { discriminator,...noDiscriminatorSchema } = this.schema;
828
+ const { discriminator, ...noDiscriminatorSchema } = this.schema;
944
829
  if (!discriminator.mapping) return this.schemaParserFabric.createSchemaParser({
945
830
  schema: noDiscriminatorSchema,
946
831
  typeName: this.typeName,
@@ -952,7 +837,7 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
952
837
  skipMappingType,
953
838
  abstractSchemaStruct
954
839
  });
955
- const schemaContent = ts.IntersectionType([abstractSchemaStruct?.content, discriminatorSchemaStruct?.content].filter(Boolean));
840
+ const schemaContent = ts.IntersectionType(compact([abstractSchemaStruct?.content, discriminatorSchemaStruct?.content]));
956
841
  return {
957
842
  ...typeof this.schema === "object" ? this.schema : {},
958
843
  $schemaPath: this.schemaPath.slice(),
@@ -973,7 +858,7 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
973
858
  this.typeName
974
859
  ]);
975
860
  const { discriminator } = this.schema;
976
- const mappingEntries = lodash.entries(discriminator.mapping);
861
+ const mappingEntries = Object.entries(discriminator.mapping || {});
977
862
  const ableToCreateMappingType = !skipMappingType && !!(abstractSchemaStruct?.typeName && mappingEntries.length);
978
863
  const mappingContents = [];
979
864
  let mappingTypeName;
@@ -1033,22 +918,24 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
1033
918
  };
1034
919
  createMappingPropertySchemaEnumKeys = ({ abstractSchemaStruct, discPropertyName }) => {
1035
920
  const ts = this.config.Ts;
1036
- let mappingPropertySchemaEnumKeysMap = {};
1037
- let mappingPropertySchema = lodash.get(abstractSchemaStruct?.component?.rawTypeData, ["properties", discPropertyName]);
921
+ const mappingPropertySchemaEnumKeysMap = {};
922
+ let mappingPropertySchema = get(abstractSchemaStruct?.component?.rawTypeData, ["properties", discPropertyName]);
1038
923
  if (this.schemaUtils.isRefSchema(mappingPropertySchema)) mappingPropertySchema = this.schemaUtils.getSchemaRefType(mappingPropertySchema);
1039
924
  const parsedEnum = mappingPropertySchema?.rawTypeData?.$parsed;
1040
- if (parsedEnum?.type === SCHEMA_TYPES$1.ENUM) mappingPropertySchemaEnumKeysMap = lodash.reduce(parsedEnum.enum, (acc, key, index) => {
1041
- const enumContent = parsedEnum.content?.[index];
1042
- if (this.config.generateUnionEnums) {
1043
- const literalValue = enumContent?.value ?? (key !== void 0 ? ts.StringValue(key) : void 0);
1044
- if (literalValue !== void 0) acc[key] = literalValue;
1045
- } else if (parsedEnum.typeName && enumContent?.key) acc[key] = ts.EnumUsageKey(parsedEnum.typeName, enumContent.key);
1046
- return acc;
1047
- }, {});
925
+ if (parsedEnum?.type === SCHEMA_TYPES$1.ENUM) {
926
+ const enumEntries = (parsedEnum.enum || []).map((key, index) => [key, index]);
927
+ for (const [key, index] of enumEntries) {
928
+ const enumContent = parsedEnum.content?.[index];
929
+ if (this.config.generateUnionEnums) {
930
+ const literalValue = enumContent?.value ?? (key !== void 0 ? ts.StringValue(key) : void 0);
931
+ if (literalValue !== void 0) mappingPropertySchemaEnumKeysMap[key] = literalValue;
932
+ } else if (parsedEnum.typeName && enumContent?.key) mappingPropertySchemaEnumKeysMap[key] = ts.EnumUsageKey(parsedEnum.typeName, enumContent.key);
933
+ }
934
+ }
1048
935
  return mappingPropertySchemaEnumKeysMap;
1049
936
  };
1050
937
  mutateMappingDependentSchema = ({ discPropertyName, abstractSchemaStruct, mappingSchema, refPath, mappingPropertySchemaEnumKeysMap }) => {
1051
- const complexSchemaKeys = lodash.keys(this.schemaParser._complexSchemaParsers);
938
+ const complexSchemaKeys = Object.keys(this.schemaParser._complexSchemaParsers);
1052
939
  if (mappingSchema.$ref && abstractSchemaStruct?.component?.$ref) {
1053
940
  const mappingRefSchema = this.schemaUtils.getSchemaRefType(mappingSchema)?.rawTypeData;
1054
941
  if (mappingRefSchema) {
@@ -1067,11 +954,11 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
1067
954
  }
1068
955
  };
1069
956
  createAbstractSchemaStruct = () => {
1070
- const { discriminator,...noDiscriminatorSchema } = this.schema;
1071
- const complexSchemaKeys = lodash.keys(this.schemaParser._complexSchemaParsers);
1072
- const schema = lodash.omit(structuredClone(noDiscriminatorSchema), complexSchemaKeys);
957
+ const { discriminator, ...noDiscriminatorSchema } = this.schema;
958
+ const complexSchemaKeys = Object.keys(this.schemaParser._complexSchemaParsers);
959
+ const schema = omit(structuredClone(noDiscriminatorSchema), complexSchemaKeys);
1073
960
  const schemaIsAny = this.schemaParserFabric.getInlineParseContent(structuredClone(schema)) === this.config.Ts.Keyword.Any;
1074
- if (!lodash.keys(schema).length || schemaIsAny) return null;
961
+ if (!Object.keys(schema).length || schemaIsAny) return null;
1075
962
  const typeName = this.schemaUtils.resolveTypeName(this.typeName, {
1076
963
  prefixes: this.config.extractingOptions.discriminatorAbstractPrefix,
1077
964
  resolver: this.config.extractingOptions.discriminatorAbstractResolver
@@ -1084,14 +971,13 @@ var DiscriminatorSchemaParser = class extends MonoSchemaParser {
1084
971
  ...schema,
1085
972
  internal: true
1086
973
  });
1087
- const content = this.schemaParserFabric.createSchemaParser({
1088
- schema: component,
1089
- schemaPath: this.schemaPath
1090
- }).getInlineParseContent();
1091
974
  return {
1092
975
  typeName,
1093
976
  component,
1094
- content
977
+ content: this.schemaParserFabric.createSchemaParser({
978
+ schema: component,
979
+ schemaPath: this.schemaPath
980
+ }).getInlineParseContent()
1095
981
  };
1096
982
  };
1097
983
  createComplexSchemaStruct = () => {
@@ -1141,9 +1027,9 @@ var EnumSchemaParser = class extends MonoSchemaParser {
1141
1027
  const refType = this.schemaUtils.getSchemaRefType(this.schema);
1142
1028
  const $ref = refType?.$ref || null;
1143
1029
  if (Array.isArray(this.schema.enum)) this.schema.enum = this.schema.enum.filter((key) => key != null);
1144
- if (Array.isArray(this.schema.enum) && Array.isArray(this.schema.enum[0])) return this.schemaParserFabric.parseSchema({ oneOf: this.schema.enum.map((enumNames$1) => ({
1030
+ if (Array.isArray(this.schema.enum) && Array.isArray(this.schema.enum[0])) return this.schemaParserFabric.parseSchema({ oneOf: this.schema.enum.map((enumNames) => ({
1145
1031
  type: "array",
1146
- items: enumNames$1.map((enumName) => ({
1032
+ items: enumNames.map((enumName) => ({
1147
1033
  type: "string",
1148
1034
  enum: [enumName]
1149
1035
  }))
@@ -1168,8 +1054,8 @@ var EnumSchemaParser = class extends MonoSchemaParser {
1168
1054
  default: return this.config.Ts.StringValue(value);
1169
1055
  }
1170
1056
  };
1171
- if (Array.isArray(enumNames) && lodash.size(enumNames)) content = enumNames.map((enumName, index) => {
1172
- const enumValue = lodash.get(this.schema.enum, index);
1057
+ if (Array.isArray(enumNames) && enumNames.length > 0) content = enumNames.map((enumName, index) => {
1058
+ const enumValue = get(this.schema.enum, index);
1173
1059
  const formattedKey = this.formatEnumKey({
1174
1060
  key: enumName,
1175
1061
  value: enumValue
@@ -1237,21 +1123,24 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
1237
1123
  }
1238
1124
  getObjectSchemaContent = (schema) => {
1239
1125
  const { properties, additionalProperties } = schema || {};
1240
- const propertiesContent = lodash.map(properties, (property, name$1) => {
1241
- const required = this.schemaUtils.isPropertyRequired(name$1, property, schema);
1242
- const rawTypeData = lodash.get(this.schemaUtils.getSchemaRefType(property), "rawTypeData", {});
1126
+ const propertiesContent = [];
1127
+ for (const [name, property] of Object.entries(properties || {})) {
1128
+ const required = this.schemaUtils.isPropertyRequired(name, property, schema);
1129
+ const rawTypeData = get(this.schemaUtils.getSchemaRefType(property), "rawTypeData", {});
1243
1130
  const nullable = !!(rawTypeData.nullable || property.nullable);
1244
- const fieldName = this.typeNameFormatter.isValidName(name$1) ? name$1 : this.config.Ts.StringValue(name$1);
1131
+ const fieldName = this.typeNameFormatter.isValidName(name) ? name : this.config.Ts.StringValue(name);
1245
1132
  const fieldValue = this.schemaParserFabric.createSchemaParser({
1246
1133
  schema: property,
1247
- schemaPath: [...this.schemaPath, name$1]
1134
+ schemaPath: [...this.schemaPath, name]
1248
1135
  }).getInlineParseContent();
1249
1136
  const readOnly = property.readOnly;
1250
- return {
1137
+ const complexType = this.schemaUtils.getComplexType(property);
1138
+ const rawDataComplexType = this.schemaUtils.getComplexType(rawTypeData);
1139
+ propertiesContent.push({
1251
1140
  ...property,
1252
1141
  $$raw: property,
1253
1142
  title: property.title,
1254
- description: property.description || lodash.compact(lodash.map(property[this.schemaUtils.getComplexType(property)], "description"))[0] || rawTypeData.description || lodash.compact(lodash.map(rawTypeData[this.schemaUtils.getComplexType(rawTypeData)], "description"))[0] || "",
1143
+ description: property.description || compact((property[complexType] || []).map((item) => item?.description))[0] || rawTypeData.description || compact((rawTypeData[rawDataComplexType] || []).map((item) => item?.description))[0] || "",
1255
1144
  isRequired: required,
1256
1145
  isNullable: nullable,
1257
1146
  name: fieldName,
@@ -1262,8 +1151,8 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
1262
1151
  key: fieldName,
1263
1152
  value: fieldValue
1264
1153
  })
1265
- };
1266
- });
1154
+ });
1155
+ }
1267
1156
  if (additionalProperties) {
1268
1157
  const propertyNamesSchema = this.schemaUtils.getSchemaPropertyNamesSchema(schema);
1269
1158
  let interfaceKeysContent;
@@ -1288,8 +1177,8 @@ var ObjectSchemaParser = class extends MonoSchemaParser {
1288
1177
  var PrimitiveSchemaParser = class extends MonoSchemaParser {
1289
1178
  parse() {
1290
1179
  let contentType = null;
1291
- const { additionalProperties, type: type$1, description: description$1, items } = this.schema || {};
1292
- if (type$1 === this.config.Ts.Keyword.Object && additionalProperties) {
1180
+ const { additionalProperties, type, description, items } = this.schema || {};
1181
+ if (type === this.config.Ts.Keyword.Object && additionalProperties) {
1293
1182
  const propertyNamesSchema = this.schemaUtils.getSchemaPropertyNamesSchema(this.schema);
1294
1183
  let recordKeysContent;
1295
1184
  let recordValuesContent;
@@ -1305,11 +1194,11 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
1305
1194
  else recordValuesContent = this.config.Ts.Keyword.Any;
1306
1195
  contentType = this.config.Ts.RecordType(recordKeysContent, recordValuesContent);
1307
1196
  }
1308
- if (Array.isArray(type$1) && type$1.length) contentType = this.schemaParser._complexSchemaParsers.oneOf({
1197
+ if (Array.isArray(type) && type.length) contentType = this.schemaParser._complexSchemaParsers.oneOf({
1309
1198
  ...typeof this.schema === "object" ? this.schema : {},
1310
- oneOf: type$1.map((type$2) => ({ type: type$2 }))
1199
+ oneOf: type.map((type) => ({ type }))
1311
1200
  });
1312
- if (Array.isArray(items) && type$1 === SCHEMA_TYPES$1.ARRAY) contentType = this.config.Ts.Tuple(items.map((item) => this.schemaParserFabric.createSchemaParser({
1201
+ if (Array.isArray(items) && type === SCHEMA_TYPES$1.ARRAY) contentType = this.config.Ts.Tuple(items.map((item) => this.schemaParserFabric.createSchemaParser({
1313
1202
  schema: item,
1314
1203
  schemaPath: this.schemaPath
1315
1204
  }).getInlineParseContent()));
@@ -1321,8 +1210,8 @@ var PrimitiveSchemaParser = class extends MonoSchemaParser {
1321
1210
  type: SCHEMA_TYPES$1.PRIMITIVE,
1322
1211
  typeIdentifier: this.config.Ts.Keyword.Type,
1323
1212
  name: this.typeName,
1324
- description: this.schemaFormatters.formatDescription(description$1),
1325
- content: type$1 === this.config.Ts.Keyword.Null ? type$1 : contentType || this.schemaUtils.getSchemaType(this.schema)
1213
+ description: this.schemaFormatters.formatDescription(description),
1214
+ content: type === this.config.Ts.Keyword.Null ? type : contentType || this.schemaUtils.getSchemaType(this.schema)
1326
1215
  };
1327
1216
  }
1328
1217
  };
@@ -1334,8 +1223,8 @@ var AllOfSchemaParser = class extends MonoSchemaParser {
1334
1223
  const ignoreTypes = [this.config.Ts.Keyword.Any];
1335
1224
  const combined = this.schema.allOf.map((childSchema) => this.schemaParserFabric.getInlineParseContent(this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema), null, this.schemaPath));
1336
1225
  const filtered = this.schemaUtils.filterSchemaContents(combined, (content) => !ignoreTypes.includes(content));
1337
- const type$1 = this.config.Ts.IntersectionType(filtered);
1338
- return this.schemaUtils.safeAddNullToType(this.schema, type$1);
1226
+ const type = this.config.Ts.IntersectionType(filtered);
1227
+ return this.schemaUtils.safeAddNullToType(this.schema, type);
1339
1228
  }
1340
1229
  };
1341
1230
 
@@ -1346,8 +1235,8 @@ var AnyOfSchemaParser = class extends MonoSchemaParser {
1346
1235
  const ignoreTypes = [this.config.Ts.Keyword.Any];
1347
1236
  const combined = this.schema.anyOf.map((childSchema) => this.schemaParserFabric.getInlineParseContent(this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema), null, this.schemaPath));
1348
1237
  const filtered = this.schemaUtils.filterSchemaContents(combined, (content) => !ignoreTypes.includes(content));
1349
- const type$1 = this.config.Ts.UnionType(filtered);
1350
- return this.schemaUtils.safeAddNullToType(this.schema, type$1);
1238
+ const type = this.config.Ts.UnionType(filtered);
1239
+ return this.schemaUtils.safeAddNullToType(this.schema, type);
1351
1240
  }
1352
1241
  };
1353
1242
 
@@ -1366,8 +1255,8 @@ var OneOfSchemaParser = class extends MonoSchemaParser {
1366
1255
  const ignoreTypes = [this.config.Ts.Keyword.Any];
1367
1256
  const combined = this.schema.oneOf.map((childSchema) => this.schemaParserFabric.getInlineParseContent(this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema), null, this.schemaPath));
1368
1257
  const filtered = this.schemaUtils.filterSchemaContents(combined, (content) => !ignoreTypes.includes(content));
1369
- const type$1 = this.config.Ts.UnionType(filtered);
1370
- return this.schemaUtils.safeAddNullToType(this.schema, type$1);
1258
+ const type = this.config.Ts.UnionType(filtered);
1259
+ return this.schemaUtils.safeAddNullToType(this.schema, type);
1371
1260
  }
1372
1261
  };
1373
1262
 
@@ -1456,7 +1345,7 @@ var SchemaParser = class {
1456
1345
  }
1457
1346
  schemaType = this.schemaUtils.getInternalSchemaType(this.schema);
1458
1347
  this.schemaPath.push(this.typeName);
1459
- lodash.merge(this.schema, this.config.hooks.onPreParseSchema(this.schema, this.typeName, schemaType));
1348
+ merge(this.schema, this.config.hooks.onPreParseSchema(this.schema, this.typeName, schemaType) || {});
1460
1349
  parsedSchema = this._baseSchemaParsers[schemaType](this.schema, this.typeName);
1461
1350
  this.schema.$parsed = this.config.hooks.onParseSchema(this.schema, parsedSchema) || parsedSchema;
1462
1351
  if (this.config.sortTypes && Array.isArray(this.schema.$parsed?.content)) this.schema.$parsed.content = this.schema.$parsed.content.sort(sortByProperty("name"));
@@ -1473,28 +1362,23 @@ var SchemaParser = class {
1473
1362
  return this.schemaFormatters.formatSchema(parsedSchema, "base").content;
1474
1363
  };
1475
1364
  extractSchemaFromResponseStruct = (responseStruct) => {
1476
- const { content,...extras } = responseStruct;
1477
- const firstResponse = lodash.first(lodash.values(content));
1478
- const firstSchema = lodash.get(firstResponse, "schema");
1365
+ const { content, ...extras } = responseStruct;
1366
+ const firstResponse = Object.values(content || {})[0];
1367
+ const firstSchema = get(firstResponse, "schema");
1479
1368
  if (!firstSchema) return;
1369
+ const { schema: _, ...restResponse } = firstResponse || {};
1480
1370
  return {
1481
1371
  ...extras,
1482
- ...lodash.omit(firstResponse, "schema"),
1372
+ ...restResponse,
1483
1373
  ...firstSchema
1484
1374
  };
1485
1375
  };
1486
1376
  };
1487
1377
 
1488
- //#endregion
1489
- //#region src/util/internal-case.ts
1490
- function internalCase(value) {
1491
- return lodash.camelCase(lodash.lowerCase(value));
1492
- }
1493
-
1494
1378
  //#endregion
1495
1379
  //#region src/util/pascal-case.ts
1496
1380
  function pascalCase(value) {
1497
- return lodash.upperFirst(lodash.camelCase(value));
1381
+ return upperFirst(camelCase(value));
1498
1382
  }
1499
1383
 
1500
1384
  //#endregion
@@ -1511,7 +1395,7 @@ var SchemaUtils = class {
1511
1395
  this.schemaWalker = schemaWalker;
1512
1396
  }
1513
1397
  getRequiredProperties = (schema) => {
1514
- return lodash.uniq(schema && Array.isArray(schema.required) && schema.required || []);
1398
+ return uniq(schema && Array.isArray(schema.required) && schema.required || []);
1515
1399
  };
1516
1400
  isRefSchema = (schema) => {
1517
1401
  return !!schema?.$ref;
@@ -1530,29 +1414,29 @@ var SchemaUtils = class {
1530
1414
  if (!this.isRefSchema(schema)) return null;
1531
1415
  return this.schemaComponentsMap.get(schema.$ref);
1532
1416
  };
1533
- isPropertyRequired = (name$1, propertySchema, rootSchema) => {
1417
+ isPropertyRequired = (name, propertySchema, rootSchema) => {
1534
1418
  if (propertySchema["x-omitempty"] === false) return true;
1535
- const isRequired = typeof propertySchema.required === "boolean" ? !!propertySchema.required : Array.isArray(rootSchema.required) ? rootSchema.required.includes(name$1) : !!rootSchema.required;
1419
+ const isRequired = typeof propertySchema.required === "boolean" ? !!propertySchema.required : Array.isArray(rootSchema.required) ? rootSchema.required.includes(name) : !!rootSchema.required;
1536
1420
  if (this.config.convertedFromSwagger2) return typeof propertySchema.nullable === this.config.Ts.Keyword.Undefined ? isRequired : !propertySchema.nullable;
1537
1421
  return isRequired;
1538
1422
  };
1539
- isNullMissingInType = (schema, type$1) => {
1423
+ isNullMissingInType = (schema, type) => {
1540
1424
  const { nullable, type: schemaType } = schema || {};
1541
- return (nullable || !!lodash.get(schema, "x-nullable") || schemaType === this.config.Ts.Keyword.Null) && typeof type$1 === "string" && !type$1.includes(` ${this.config.Ts.Keyword.Null}`) && !type$1.includes(`${this.config.Ts.Keyword.Null} `);
1425
+ return (nullable || !!get(schema, "x-nullable") || schemaType === this.config.Ts.Keyword.Null) && typeof type === "string" && !type.includes(` ${this.config.Ts.Keyword.Null}`) && !type.includes(`${this.config.Ts.Keyword.Null} `);
1542
1426
  };
1543
- safeAddNullToType = (schema, type$1) => {
1544
- if (this.isNullMissingInType(schema, type$1)) return this.config.Ts.UnionType([type$1, this.config.Ts.Keyword.Null]);
1545
- return type$1;
1427
+ safeAddNullToType = (schema, type) => {
1428
+ if (this.isNullMissingInType(schema, type)) return this.config.Ts.UnionType([type, this.config.Ts.Keyword.Null]);
1429
+ return type;
1546
1430
  };
1547
1431
  getSchemaPrimitiveType = (rawSchema) => {
1548
1432
  const schema = rawSchema || {};
1549
- if (schema.type) return internalCase(schema.type);
1433
+ if (schema.type) return camelCase(schema.type);
1550
1434
  if (schema.enum) {
1551
1435
  const enumFieldType = typeof schema.enum[0];
1552
1436
  if (enumFieldType === this.config.Ts.Keyword.Undefined) return;
1553
- return internalCase(enumFieldType);
1437
+ return camelCase(enumFieldType);
1554
1438
  }
1555
- if (lodash.keys(schema.properties).length) return SCHEMA_TYPES$1.OBJECT;
1439
+ if (Object.keys(schema.properties || {}).length) return SCHEMA_TYPES$1.OBJECT;
1556
1440
  if (schema.items) return SCHEMA_TYPES$1.ARRAY;
1557
1441
  return null;
1558
1442
  };
@@ -1565,10 +1449,10 @@ var SchemaUtils = class {
1565
1449
  };
1566
1450
  makeAddRequiredToChildSchema = (parentSchema, childSchema) => {
1567
1451
  if (!childSchema) return childSchema;
1568
- const required = lodash.uniq([...this.getRequiredProperties(parentSchema), ...this.getRequiredProperties(childSchema)]);
1452
+ const required = uniq([...this.getRequiredProperties(parentSchema), ...this.getRequiredProperties(childSchema)]);
1569
1453
  const refData = this.getSchemaRefType(childSchema);
1570
1454
  if (refData) {
1571
- const existedRequiredKeys = lodash.keys(refData.rawTypeData?.properties || {}).filter((key) => required.includes(key));
1455
+ const existedRequiredKeys = Object.keys(refData.rawTypeData?.properties || {}).filter((key) => required.includes(key));
1572
1456
  if (!existedRequiredKeys.length) return childSchema;
1573
1457
  return {
1574
1458
  ...childSchema,
@@ -1576,17 +1460,17 @@ var SchemaUtils = class {
1576
1460
  };
1577
1461
  }
1578
1462
  if (childSchema.properties) {
1579
- const existedRequiredKeys = lodash.keys(childSchema.properties).filter((key) => required.includes(key));
1463
+ const existedRequiredKeys = Object.keys(childSchema.properties).filter((key) => required.includes(key));
1580
1464
  if (!existedRequiredKeys.length) return childSchema;
1581
1465
  return {
1582
- required: lodash.uniq([...this.getRequiredProperties(childSchema), ...existedRequiredKeys]),
1466
+ required: uniq([...this.getRequiredProperties(childSchema), ...existedRequiredKeys]),
1583
1467
  ...childSchema
1584
1468
  };
1585
1469
  }
1586
1470
  return childSchema;
1587
1471
  };
1588
1472
  filterSchemaContents = (contents, filterFn) => {
1589
- return lodash.uniq(contents.filter((type$1) => filterFn(type$1)));
1473
+ return uniq(contents.filter((type) => filterFn(type)));
1590
1474
  };
1591
1475
  resolveTypeName = (typeName, { suffixes, resolver, prefixes, shouldReserve = true }) => {
1592
1476
  if (resolver) return this.config.componentTypeNameResolver.resolve([], (reserved) => {
@@ -1602,10 +1486,10 @@ var SchemaUtils = class {
1602
1486
  return SCHEMA_TYPES$1.COMPLEX_UNKNOWN;
1603
1487
  };
1604
1488
  getInternalSchemaType = (schema) => {
1605
- if (!lodash.isEmpty(schema.enum) || !lodash.isEmpty(this.getEnumNames(schema))) return SCHEMA_TYPES$1.ENUM;
1489
+ if (schema.enum && schema.enum.length > 0 || this.getEnumNames(schema) && this.getEnumNames(schema).length > 0) return SCHEMA_TYPES$1.ENUM;
1606
1490
  if (schema.discriminator) return SCHEMA_TYPES$1.DISCRIMINATOR;
1607
1491
  if (schema.allOf || schema.oneOf || schema.anyOf || schema.not) return SCHEMA_TYPES$1.COMPLEX;
1608
- if (!lodash.isEmpty(schema.properties)) return SCHEMA_TYPES$1.OBJECT;
1492
+ if (schema.properties && Object.keys(schema.properties).length > 0) return SCHEMA_TYPES$1.OBJECT;
1609
1493
  if (schema.type === SCHEMA_TYPES$1.ARRAY) return SCHEMA_TYPES$1.ARRAY;
1610
1494
  return SCHEMA_TYPES$1.PRIMITIVE;
1611
1495
  };
@@ -1618,7 +1502,7 @@ var SchemaUtils = class {
1618
1502
  else {
1619
1503
  const primitiveType = this.getSchemaPrimitiveType(schema);
1620
1504
  if (primitiveType == null) return this.config.Ts.Keyword.Any;
1621
- const typeAlias = lodash.get(this.config.primitiveTypes, [primitiveType, schema.format]) || lodash.get(this.config.primitiveTypes, [primitiveType, "$default"]) || this.config.primitiveTypes[primitiveType];
1505
+ const typeAlias = get(this.config.primitiveTypes, [primitiveType, schema.format]) || get(this.config.primitiveTypes, [primitiveType, "$default"]) || this.config.primitiveTypes[primitiveType];
1622
1506
  if (typeof typeAlias === "function") resultType = typeAlias(schema, this);
1623
1507
  else resultType = typeAlias || primitiveType;
1624
1508
  }
@@ -1626,9 +1510,9 @@ var SchemaUtils = class {
1626
1510
  return this.checkAndAddRequiredKeys(schema, this.safeAddNullToType(schema, resultType));
1627
1511
  };
1628
1512
  buildTypeNameFromPath = (schemaPath) => {
1629
- schemaPath = lodash.uniq(lodash.compact(schemaPath));
1513
+ schemaPath = uniq(compact(schemaPath || []));
1630
1514
  if (!schemaPath || !schemaPath[0]) return null;
1631
- return pascalCase(lodash.camelCase(lodash.uniq([schemaPath[0], schemaPath[schemaPath.length - 1]]).join("_")));
1515
+ return pascalCase(uniq([schemaPath[0], schemaPath[schemaPath.length - 1]]).join("_"));
1632
1516
  };
1633
1517
  isConstantSchema(schema) {
1634
1518
  return "const" in schema;
@@ -1671,7 +1555,7 @@ var SchemaParserFabric = class {
1671
1555
  schemaPath
1672
1556
  });
1673
1557
  };
1674
- createSchema = ({ content, linkedSchema = {}, linkedComponent, schemaPath,...otherSchemaProps }) => {
1558
+ createSchema = ({ content, linkedSchema = {}, linkedComponent, schemaPath, ...otherSchemaProps }) => {
1675
1559
  const parser = this.createSchemaParser({
1676
1560
  schema: linkedComponent || linkedSchema,
1677
1561
  schemaPath
@@ -1719,8 +1603,7 @@ var SchemaParserFabric = class {
1719
1603
 
1720
1604
  //#endregion
1721
1605
  //#region src/util/id.ts
1722
- const ALPHABET = "abcdefghijklmnopqrstuvwxyz0123456789";
1723
- const generateId = nanoid.customAlphabet(ALPHABET, 12);
1606
+ const generateId = () => crypto.randomUUID();
1724
1607
 
1725
1608
  //#endregion
1726
1609
  //#region src/schema-routes/util/specific-arg-name-resolver.ts
@@ -1765,7 +1648,7 @@ var SchemaRoutes = class {
1765
1648
  this.typeNameFormatter = typeNameFormatter;
1766
1649
  this.schemaComponentsMap = schemaComponentsMap;
1767
1650
  this.templatesWorker = templatesWorker;
1768
- this.FORM_DATA_TYPES = lodash.uniq([this.schemaUtils.getSchemaType({
1651
+ this.FORM_DATA_TYPES = uniq([this.schemaUtils.getSchemaType({
1769
1652
  type: "string",
1770
1653
  format: "file"
1771
1654
  }), this.schemaUtils.getSchemaType({
@@ -1773,49 +1656,50 @@ var SchemaRoutes = class {
1773
1656
  format: "binary"
1774
1657
  })]);
1775
1658
  }
1776
- createRequestsMap = (routeInfoByMethodsMap) => {
1777
- const parameters = lodash.get(routeInfoByMethodsMap, "parameters");
1778
- return lodash.reduce(routeInfoByMethodsMap, (acc, requestInfo, method) => {
1779
- if (method.startsWith("x-") || ["parameters", "$ref"].includes(method)) return acc;
1780
- acc[method] = {
1659
+ createRequestsMap = (routesByMethod) => {
1660
+ const parameters = get(routesByMethod, "parameters");
1661
+ const result = {};
1662
+ for (const [method, requestInfo] of Object.entries(routesByMethod)) {
1663
+ if (method.startsWith("x-") || ["parameters", "$ref"].includes(method)) continue;
1664
+ result[method] = {
1781
1665
  ...requestInfo,
1782
- parameters: lodash.compact(lodash.concat(parameters, requestInfo.parameters))
1666
+ parameters: compact([...parameters || [], ...requestInfo.parameters || []])
1783
1667
  };
1784
- return acc;
1785
- }, {});
1668
+ }
1669
+ return result;
1786
1670
  };
1787
- parseRouteName = (originalRouteName) => {
1788
- const routeName = this.config.hooks.onPreBuildRoutePath(originalRouteName) || originalRouteName;
1671
+ parseRouteName = (rawRoute) => {
1672
+ const routeName = this.config.hooks.onPreBuildRoutePath(rawRoute) || rawRoute;
1789
1673
  const pathParamMatches = (routeName || "").match(/({[\w[\\\]^`][-_.\w]*})|(:[\w[\\\]^`][-_.\w]*:?)/g);
1790
- const pathParams = lodash.reduce(pathParamMatches, (pathParams$1, match) => {
1674
+ const pathParams = [];
1675
+ for (const match of pathParamMatches || []) {
1791
1676
  const paramName = match.replace(/\{|\}|:/g, "");
1792
- if (!paramName) return pathParams$1;
1677
+ if (!paramName) continue;
1793
1678
  if (paramName.includes("-")) consola.warn("wrong path param name", paramName);
1794
- pathParams$1.push({
1679
+ pathParams.push({
1795
1680
  $match: match,
1796
- name: lodash.camelCase(paramName),
1681
+ name: camelCase(paramName),
1797
1682
  required: true,
1798
1683
  type: "string",
1799
1684
  description: "",
1800
1685
  schema: { type: "string" },
1801
1686
  in: "path"
1802
1687
  });
1803
- return pathParams$1;
1804
- }, []);
1805
- let fixedRoute = pathParams.reduce((fixedRoute$1, pathParam, i, arr) => {
1806
- const insertion = this.config.hooks.onInsertPathParam(pathParam.name, i, arr, fixedRoute$1) || pathParam.name;
1807
- return fixedRoute$1.replace(pathParam.$match, `\${${insertion}}`);
1688
+ }
1689
+ let fixedRoute = pathParams.reduce((fixedRoute, pathParam, i, arr) => {
1690
+ const insertion = this.config.hooks.onInsertPathParam(pathParam.name, i, arr, fixedRoute) || pathParam.name;
1691
+ return fixedRoute.replace(pathParam.$match, `\${${insertion}}`);
1808
1692
  }, routeName || "");
1809
1693
  const queryParamMatches = fixedRoute.match(/(\{\?.*\})/g);
1810
1694
  const queryParams = [];
1811
1695
  if (queryParamMatches?.length) {
1812
1696
  for (const match of queryParamMatches) fixedRoute = fixedRoute.replace(match, "");
1813
- const paramNames = lodash.uniq(queryParamMatches.join(",").replace(/(\{\?)|(\})|\s/g, "").split(","));
1697
+ const paramNames = uniq(queryParamMatches.join(",").replace(/(\{\?)|(\})|\s/g, "").split(","));
1814
1698
  for (const paramName of paramNames) {
1815
- if (paramName.includes("-")) consola.warn("wrong query param name", paramName);
1699
+ if (typeof paramName === "string" && paramName.includes("-")) consola.warn("wrong query param name", paramName);
1816
1700
  queryParams.push({
1817
1701
  $match: paramName,
1818
- name: lodash.camelCase(paramName),
1702
+ name: typeof paramName === "string" ? camelCase(paramName) : camelCase(String(paramName)),
1819
1703
  required: true,
1820
1704
  type: "string",
1821
1705
  description: "",
@@ -1825,7 +1709,7 @@ var SchemaRoutes = class {
1825
1709
  }
1826
1710
  }
1827
1711
  const result = {
1828
- originalRoute: originalRouteName || "",
1712
+ originalRoute: rawRoute || "",
1829
1713
  route: fixedRoute,
1830
1714
  pathParams,
1831
1715
  queryParams
@@ -1842,7 +1726,7 @@ var SchemaRoutes = class {
1842
1726
  formData: [],
1843
1727
  cookie: []
1844
1728
  };
1845
- lodash.each(parameters, (parameter) => {
1729
+ for (const parameter of parameters || []) {
1846
1730
  const refTypeInfo = this.schemaParserFabric.schemaUtils.getSchemaRefType(parameter);
1847
1731
  let routeParam = null;
1848
1732
  if (refTypeInfo?.rawTypeData.in && refTypeInfo.rawTypeData) {
@@ -1853,7 +1737,7 @@ var SchemaRoutes = class {
1853
1737
  };
1854
1738
  if (parameter?.required && !routeParam.required) routeParam.required = parameter.required;
1855
1739
  } else {
1856
- if (!parameter.in) return;
1740
+ if (!parameter.in) continue;
1857
1741
  if (!routeParams[parameter.in]) routeParams[parameter.in] = [];
1858
1742
  routeParam = {
1859
1743
  ...parameter,
@@ -1861,16 +1745,19 @@ var SchemaRoutes = class {
1861
1745
  };
1862
1746
  }
1863
1747
  if (routeParam.in === "path") {
1864
- if (!routeParam.name) return;
1865
- routeParam.name = lodash.camelCase(routeParam.name);
1748
+ if (!routeParam.name) continue;
1749
+ routeParam.name = camelCase(routeParam.name);
1866
1750
  }
1867
- if (routeParam) routeParams[routeParam.in].push(routeParam);
1868
- });
1751
+ routeParams[routeParam.in].push(routeParam);
1752
+ }
1869
1753
  for (const pathParam of pathParamsFromRouteName) if (!routeParams.path.some((parameter) => parameter.name === pathParam.name)) routeParams.path.push(pathParam);
1870
1754
  for (const queryParam of queryParamsFromRouteName) if (!routeParams.query.some((parameter) => parameter.name === queryParam.name)) routeParams.query.push(queryParam);
1871
1755
  return routeParams;
1872
1756
  };
1873
- getContentTypes = (requestInfo, extraContentTypes) => lodash.uniq(lodash.compact([...extraContentTypes || [], ...lodash.flatten(lodash.map(requestInfo, (requestInfoData) => requestInfoData && lodash.keys(requestInfoData.content)))]));
1757
+ getContentTypes = (requestInfo, extraContentTypes) => {
1758
+ const requestInfoArray = Array.isArray(requestInfo) ? requestInfo : Object.values(requestInfo || {});
1759
+ return uniq(compact([...extraContentTypes || [], ...flattenDeep(requestInfoArray.map((requestInfoData) => requestInfoData && Object.keys(requestInfoData?.content || {})))]));
1760
+ };
1874
1761
  getContentKind = (contentTypes) => {
1875
1762
  if (contentTypes.includes("application/vnd.api+json")) return CONTENT_KIND.JSON_API;
1876
1763
  if (contentTypes.some((contentType) => contentType.startsWith("application/json")) || contentTypes.some((contentType) => contentType.endsWith("+json"))) return CONTENT_KIND.JSON;
@@ -1882,7 +1769,7 @@ var SchemaRoutes = class {
1882
1769
  };
1883
1770
  isSuccessStatus = (status) => this.config.defaultResponseAsSuccess && status === "default" || +status >= this.config.successResponseStatusRange[0] && +status <= this.config.successResponseStatusRange[1] || status === "2xx";
1884
1771
  getSchemaFromRequestType = (requestInfo) => {
1885
- const content = lodash.get(requestInfo, "content");
1772
+ const content = get(requestInfo, "content");
1886
1773
  if (!content) return null;
1887
1774
  for (const dataType in content) if (content[dataType]?.schema) return {
1888
1775
  ...content[dataType].schema,
@@ -1896,13 +1783,13 @@ var SchemaRoutes = class {
1896
1783
  if (schema) {
1897
1784
  const content = this.schemaParserFabric.getInlineParseContent(schema, typeName, [operationId]);
1898
1785
  const foundedSchemaByName = parsedSchemas.find((parsedSchema) => this.typeNameFormatter.format(parsedSchema.name) === content);
1899
- const foundSchemaByContent = parsedSchemas.find((parsedSchema) => lodash.isEqual(parsedSchema.content, content));
1786
+ const foundSchemaByContent = parsedSchemas.find((parsedSchema) => isEqual(parsedSchema.content, content));
1900
1787
  const foundSchema = foundedSchemaByName || foundSchemaByContent;
1901
1788
  return foundSchema ? this.typeNameFormatter.format(foundSchema.name) : content;
1902
1789
  }
1903
1790
  if (refTypeInfo) {
1904
1791
  const typeNameWithoutOpId = refTypeInfo.typeName.replace(operationId, "");
1905
- if (parsedSchemas.find((schema$1) => schema$1.name === typeNameWithoutOpId)) return this.typeNameFormatter.format(typeNameWithoutOpId);
1792
+ if (parsedSchemas.find((schema) => schema.name === typeNameWithoutOpId)) return this.typeNameFormatter.format(typeNameWithoutOpId);
1906
1793
  switch (refTypeInfo.componentName) {
1907
1794
  case "schemas": return this.typeNameFormatter.format(refTypeInfo.typeName);
1908
1795
  case "responses":
@@ -1912,23 +1799,27 @@ var SchemaRoutes = class {
1912
1799
  }
1913
1800
  return defaultType || this.config.Ts.Keyword.Any;
1914
1801
  };
1915
- getRequestInfoTypes = ({ requestInfos, parsedSchemas, operationId, defaultType }) => lodash.reduce(requestInfos, (acc, requestInfo, status) => {
1916
- const contentTypes = this.getContentTypes([requestInfo]);
1917
- return [...acc, {
1918
- ...requestInfo || {},
1919
- contentTypes,
1920
- contentKind: this.getContentKind(contentTypes),
1921
- type: this.schemaParserFabric.schemaUtils.safeAddNullToType(requestInfo, this.getTypeFromRequestInfo({
1922
- requestInfo,
1923
- parsedSchemas,
1924
- operationId,
1925
- defaultType
1926
- })),
1927
- description: this.schemaParserFabric.schemaFormatters.formatDescription(requestInfo.description || "", true),
1928
- status: Number.isNaN(+status) ? status : +status,
1929
- isSuccess: this.isSuccessStatus(status)
1930
- }];
1931
- }, []);
1802
+ getRequestInfoTypes = ({ requestInfos, parsedSchemas, operationId, defaultType }) => {
1803
+ const result = [];
1804
+ for (const [status, requestInfo] of Object.entries(requestInfos || {})) {
1805
+ const contentTypes = this.getContentTypes([requestInfo], operationId);
1806
+ result.push({
1807
+ ...requestInfo || {},
1808
+ contentTypes,
1809
+ contentKind: this.getContentKind(contentTypes),
1810
+ type: this.schemaParserFabric.schemaUtils.safeAddNullToType(requestInfo, this.getTypeFromRequestInfo({
1811
+ requestInfo,
1812
+ parsedSchemas,
1813
+ operationId,
1814
+ defaultType
1815
+ })),
1816
+ description: this.schemaParserFabric.schemaFormatters.formatDescription(requestInfo.description || "", true),
1817
+ status: Number.isNaN(+status) ? status : +status,
1818
+ isSuccess: this.isSuccessStatus(status)
1819
+ });
1820
+ }
1821
+ return result;
1822
+ };
1932
1823
  getResponseBodyInfo = (routeInfo, parsedSchemas) => {
1933
1824
  const { produces, operationId, responses } = routeInfo;
1934
1825
  const contentTypes = this.getContentTypes(responses, [...produces || [], routeInfo["x-accepts"]]);
@@ -2037,13 +1928,12 @@ var SchemaRoutes = class {
2037
1928
  };
2038
1929
  return acc;
2039
1930
  }, {});
2040
- const fixedQueryParams = lodash.reduce(lodash.get(queryObjectSchema, "properties", {}), (acc, property, name$1) => {
2041
- if (name$1 && typeof property === "object") acc[name$1] = {
2042
- ...property,
2043
- in: "query"
2044
- };
2045
- return acc;
2046
- }, {});
1931
+ const fixedQueryParams = {};
1932
+ const queryObjectProperties = get(queryObjectSchema, "properties") || {};
1933
+ for (const [name, property] of Object.entries(queryObjectProperties)) if (name && typeof property === "object") fixedQueryParams[name] = {
1934
+ ...property,
1935
+ in: "query"
1936
+ };
2047
1937
  const schema = {
2048
1938
  ...queryObjectSchema,
2049
1939
  properties: {
@@ -2086,7 +1976,7 @@ var SchemaRoutes = class {
2086
1976
  successResponse.schema.contentKind = contentKind;
2087
1977
  if (successResponse.schema.typeData) successResponse.schema.typeData.isExtractedResponseBody = true;
2088
1978
  successResponse.type = this.schemaParserFabric.getInlineParseContent({ $ref: successResponse.schema.$ref });
2089
- if (idx > -1) lodash.assign(responseBodyInfo.responses[idx], {
1979
+ if (idx > -1) Object.assign(responseBodyInfo.responses[idx], {
2090
1980
  ...successResponse.schema,
2091
1981
  type: successResponse.type
2092
1982
  });
@@ -2099,18 +1989,18 @@ var SchemaRoutes = class {
2099
1989
  suffixes: this.config.extractingOptions.responseErrorSuffix,
2100
1990
  resolver: this.config.extractingOptions.responseErrorNameResolver
2101
1991
  });
2102
- const errorSchemas = responseBodyInfo.error.schemas.map(this.getSchemaFromRequestType).filter(Boolean);
1992
+ const errorSchemas = compact(responseBodyInfo.error.schemas.map(this.getSchemaFromRequestType));
2103
1993
  if (!errorSchemas.length) return;
2104
1994
  const schema = this.schemaParserFabric.parseSchema({
2105
1995
  oneOf: errorSchemas,
2106
- title: errorSchemas.map((schema$1) => schema$1.title).filter(Boolean).join(" "),
2107
- description: errorSchemas.map((schema$1) => schema$1.description).filter(Boolean).join("\n")
1996
+ title: compact(errorSchemas.map((schema) => schema.title)).join(" "),
1997
+ description: compact(errorSchemas.map((schema) => schema.description)).join("\n")
2108
1998
  }, null, [routeInfo.operationId]);
2109
1999
  const component = this.schemaComponentsMap.createComponent(this.schemaComponentsMap.createRef([
2110
2000
  "components",
2111
2001
  "schemas",
2112
2002
  typeName
2113
- ]), { ...schema });
2003
+ ]), schema);
2114
2004
  responseBodyInfo.error.schemas = [component];
2115
2005
  if (component.typeData) component.typeData.isExtractedResponseError = true;
2116
2006
  responseBodyInfo.error.type = this.typeNameFormatter.format(component.typeName);
@@ -2138,11 +2028,11 @@ var SchemaRoutes = class {
2138
2028
  parseRouteInfo = (rawRouteName, routeInfo, method, usageSchema, parsedSchemas) => {
2139
2029
  const { security: globalSecurity } = usageSchema;
2140
2030
  const { moduleNameIndex, moduleNameFirstTag, extractRequestParams } = this.config;
2141
- const { operationId, requestBody, security, parameters, summary, description: description$1, tags, responses, requestBodyName, produces, consumes,...otherInfo } = routeInfo;
2031
+ const { operationId, requestBody, security, parameters, summary, description, tags, responses, requestBodyName, produces, consumes, ...otherInfo } = routeInfo;
2142
2032
  const { route, pathParams: pathParamsFromRouteName, queryParams: queryParamsFromRouteName } = this.parseRouteName(rawRouteName);
2143
2033
  const routeId = generateId();
2144
2034
  const firstTag = tags && tags.length > 0 ? tags[0] : null;
2145
- const moduleName = moduleNameFirstTag && firstTag ? lodash.camelCase(firstTag) : lodash.camelCase(lodash.compact(route.split("/"))[moduleNameIndex]);
2035
+ const moduleName = moduleNameFirstTag && firstTag ? camelCase(firstTag) : camelCase(compact(route.split("/"))[moduleNameIndex] || "");
2146
2036
  let hasSecurity = !!globalSecurity?.length;
2147
2037
  if (security) hasSecurity = security.length > 0;
2148
2038
  const routeParams = this.getRouteParams(routeInfo, pathParamsFromRouteName, queryParamsFromRouteName);
@@ -2162,7 +2052,7 @@ var SchemaRoutes = class {
2162
2052
  route: rawRouteName,
2163
2053
  moduleName,
2164
2054
  responsesTypes: responseBodyInfo.responses,
2165
- description: description$1,
2055
+ description,
2166
2056
  tags,
2167
2057
  summary,
2168
2058
  responses,
@@ -2259,7 +2149,7 @@ var SchemaRoutes = class {
2259
2149
  };
2260
2150
  attachSchema = ({ usageSchema, parsedSchemas }) => {
2261
2151
  this.config.routeNameDuplicatesMap.clear();
2262
- const pathsEntries = lodash.entries(usageSchema.paths);
2152
+ const pathsEntries = Object.entries(usageSchema.paths || {});
2263
2153
  for (const [rawRouteName, routeInfoByMethodsMap] of pathsEntries) {
2264
2154
  const routeInfosMap = this.createRequestsMap(routeInfoByMethodsMap);
2265
2155
  for (const [method, routeInfo] of Object.entries(routeInfosMap)) {
@@ -2283,37 +2173,36 @@ var SchemaRoutes = class {
2283
2173
  } else modules.$outOfModule.push(route);
2284
2174
  return modules;
2285
2175
  }, { $outOfModule: [] });
2286
- const routeGroups = lodash.reduce(groupedRoutes, (acc, routesGroup, moduleName) => {
2287
- if (moduleName === "$outOfModule") acc.outOfModule = routesGroup;
2288
- else {
2289
- if (!acc.combined) acc.combined = [];
2290
- acc.combined.push({
2291
- moduleName,
2292
- routes: routesGroup.map((route) => {
2293
- const { original: originalName, usage: usageName } = route.routeName;
2294
- if (routesGroup.length > 1 && usageName !== originalName && !routesGroup.some(({ routeName, id }) => id !== route.id && originalName === routeName.original)) return {
2295
- ...route,
2296
- routeName: {
2297
- ...route.routeName,
2298
- usage: originalName
2299
- }
2300
- };
2301
- return route;
2302
- })
2303
- });
2304
- }
2305
- return acc;
2306
- }, {});
2176
+ const routeGroups = {
2177
+ outOfModule: void 0,
2178
+ combined: void 0
2179
+ };
2180
+ for (const [moduleName, routesGroup] of Object.entries(groupedRoutes)) if (moduleName === "$outOfModule") routeGroups.outOfModule = routesGroup;
2181
+ else {
2182
+ if (!routeGroups.combined) routeGroups.combined = [];
2183
+ routeGroups.combined.push({
2184
+ moduleName,
2185
+ routes: routesGroup.map((route) => {
2186
+ const { original: originalName, usage: usageName } = route.routeName;
2187
+ if (routesGroup.length > 1 && usageName !== originalName && !routesGroup.some(({ routeName, id }) => id !== route.id && originalName === routeName.original)) return {
2188
+ ...route,
2189
+ routeName: {
2190
+ ...route.routeName,
2191
+ usage: originalName
2192
+ }
2193
+ };
2194
+ return route;
2195
+ })
2196
+ });
2197
+ }
2307
2198
  if (this.config.sortRoutes) {
2308
2199
  if (routeGroups.outOfModule) routeGroups.outOfModule = this.sortRoutes(routeGroups.outOfModule);
2309
- if (routeGroups.combined) lodash.each(routeGroups.combined, (routeGroup) => {
2310
- routeGroup.routes = this.sortRoutes(routeGroup.routes);
2311
- });
2200
+ if (routeGroups.combined) for (const routeGroup of routeGroups.combined) routeGroup.routes = this.sortRoutes(routeGroup.routes);
2312
2201
  }
2313
2202
  return routeGroups;
2314
2203
  };
2315
2204
  sortRoutes = (routes) => {
2316
- return lodash.slice(routes).sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
2205
+ return routes.slice().sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
2317
2206
  };
2318
2207
  };
2319
2208
 
@@ -2328,8 +2217,8 @@ var SchemaWalker = class {
2328
2217
  this.config = config;
2329
2218
  this.swaggerSchemaResolver = swaggerSchemaResolver;
2330
2219
  }
2331
- addSchema = (name$1, schema) => {
2332
- this.schemas.set(name$1, structuredClone(schema));
2220
+ addSchema = (name, schema) => {
2221
+ this.schemas.set(name, structuredClone(schema));
2333
2222
  };
2334
2223
  _isLocalRef = (ref) => {
2335
2224
  return ref.startsWith("#");
@@ -2338,8 +2227,7 @@ var SchemaWalker = class {
2338
2227
  return ref.startsWith("http://") || ref.startsWith("https://");
2339
2228
  };
2340
2229
  _getRefDataFromSchema = (schema, ref) => {
2341
- const path$2 = ref.replace("#", "").split("/");
2342
- const refData = lodash.get(schema, path$2);
2230
+ const refData = get(schema, ref.replace("#", "").split("/"));
2343
2231
  if (refData) this.caches.set(ref, refData);
2344
2232
  return refData;
2345
2233
  };
@@ -2352,14 +2240,14 @@ var Request = class {
2352
2240
  constructor(config) {
2353
2241
  this.config = config;
2354
2242
  }
2355
- async download({ url: url$2, authToken,...options }) {
2243
+ async download({ url, authToken, ...options }) {
2356
2244
  const requestOptions = {};
2357
2245
  if (authToken) requestOptions.headers = { Authorization: authToken };
2358
- lodash.merge(requestOptions, options, this.config.requestOptions);
2246
+ merge(merge(requestOptions, options), this.config.requestOptions || {});
2359
2247
  try {
2360
- return await (await fetch(url$2, requestOptions)).text();
2248
+ return await (await fetch(url, requestOptions)).text();
2361
2249
  } catch (error) {
2362
- const message = `error while fetching data from URL "${url$2}"`;
2250
+ const message = `error while fetching data from URL "${url}"`;
2363
2251
  consola.error(message, error);
2364
2252
  return message;
2365
2253
  }
@@ -2378,21 +2266,21 @@ var SwaggerSchemaResolver = class {
2378
2266
  this.request = new Request(config);
2379
2267
  }
2380
2268
  async create() {
2381
- const { spec, patch, input, url: url$2, authorizationToken } = this.config;
2269
+ const { spec, patch, input, url, authorizationToken } = this.config;
2382
2270
  if (spec) return await this.convertSwaggerObject(spec, { patch });
2383
- const swaggerSchemaFile = await this.fetchSwaggerSchemaFile(input, url$2, authorizationToken);
2271
+ const swaggerSchemaFile = await this.fetchSwaggerSchemaFile(input, url, authorizationToken);
2384
2272
  const swaggerSchemaObject = this.processSwaggerSchemaFile(swaggerSchemaFile);
2385
2273
  return await this.convertSwaggerObject(swaggerSchemaObject, { patch });
2386
2274
  }
2387
2275
  convertSwaggerObject(swaggerSchema, converterOptions) {
2388
2276
  return new Promise((resolve) => {
2389
2277
  const result = structuredClone(swaggerSchema);
2390
- result.info = lodash.merge({
2278
+ result.info = merge({
2391
2279
  title: "No title",
2392
2280
  version: ""
2393
- }, result.info);
2281
+ }, result.info || {});
2394
2282
  if (!Object.hasOwn(result, "openapi")) {
2395
- result.paths = lodash.merge({}, result.paths);
2283
+ result.paths = merge({}, result.paths || {});
2396
2284
  swagger2openapi.convertObj(result, {
2397
2285
  ...converterOptions,
2398
2286
  resolveInternal: true,
@@ -2400,7 +2288,7 @@ var SwaggerSchemaResolver = class {
2400
2288
  refSiblings: "preserve",
2401
2289
  rbname: "requestBodyName"
2402
2290
  }, (err, options) => {
2403
- const parsedSwaggerSchema = lodash.get(err, "options.openapi", lodash.get(options, "openapi"));
2291
+ const parsedSwaggerSchema = get(err, "options.openapi") ?? get(options, "openapi");
2404
2292
  if (!parsedSwaggerSchema && err) throw err;
2405
2293
  this.config.update({ convertedFromSwagger2: true });
2406
2294
  resolve({
@@ -2435,23 +2323,21 @@ var SwaggerSchemaResolver = class {
2435
2323
  }
2436
2324
  }
2437
2325
  fixSwaggerSchema({ usageSchema, originalSchema }) {
2438
- const usagePaths = lodash.get(usageSchema, "paths");
2439
- const originalPaths = lodash.get(originalSchema, "paths");
2440
- lodash.each(usagePaths, (usagePathObject, route) => {
2441
- const originalPathObject = lodash.get(originalPaths, route);
2442
- lodash.each(usagePathObject, (usageRouteInfo, methodName) => {
2443
- const originalRouteInfo = lodash.get(originalPathObject, methodName);
2444
- const usageRouteParams = lodash.get(usageRouteInfo, "parameters", []);
2445
- const originalRouteParams = lodash.get(originalRouteInfo, "parameters", []);
2326
+ const usagePaths = get(usageSchema, "paths") || {};
2327
+ const originalPaths = get(originalSchema, "paths") || {};
2328
+ for (const [route, usagePathObject] of Object.entries(usagePaths)) {
2329
+ const originalPathObject = get(originalPaths, route) || {};
2330
+ for (const [methodName, usageRouteInfo] of Object.entries(usagePathObject)) {
2331
+ const originalRouteInfo = get(originalPathObject, methodName) || {};
2332
+ const usageRouteParams = get(usageRouteInfo, "parameters") || [];
2333
+ const originalRouteParams = get(originalRouteInfo, "parameters") || [];
2446
2334
  if (typeof usageRouteInfo === "object") {
2447
- usageRouteInfo.consumes = lodash.uniq(lodash.compact([...usageRouteInfo.consumes || [], ...originalRouteInfo.consumes || []]));
2448
- usageRouteInfo.produces = lodash.uniq(lodash.compact([...usageRouteInfo.produces || [], ...originalRouteInfo.produces || []]));
2335
+ usageRouteInfo.consumes = uniq(compact([...usageRouteInfo.consumes || [], ...originalRouteInfo.consumes || []]));
2336
+ usageRouteInfo.produces = uniq(compact([...usageRouteInfo.produces || [], ...originalRouteInfo.produces || []]));
2449
2337
  }
2450
- lodash.each(originalRouteParams, (originalRouteParam) => {
2451
- if (!usageRouteParams.find((param) => originalRouteParam.in === param.in && originalRouteParam.name === param.name)) usageRouteParams.push(originalRouteParam);
2452
- });
2453
- });
2454
- });
2338
+ for (const originalRouteParam of originalRouteParams) if (!usageRouteParams.find((param) => originalRouteParam.in === param.in && originalRouteParam.name === param.name)) usageRouteParams.push(originalRouteParam);
2339
+ }
2340
+ }
2455
2341
  }
2456
2342
  };
2457
2343
 
@@ -2471,21 +2357,19 @@ var TemplatesWorker = class {
2471
2357
  if (this.config.silent) consola.level = 0;
2472
2358
  }
2473
2359
  getTemplatePaths = (config) => {
2474
- const __dirname$1 = path$1.dirname(url$1.fileURLToPath(import.meta.url));
2475
- const baseTemplatesPath = path$1.resolve(__dirname$1, "../templates/base");
2476
- const defaultTemplatesPath = path$1.resolve(__dirname$1, "../templates/default");
2477
- const modularTemplatesPath = path$1.resolve(__dirname$1, "../templates/modular");
2478
- const originalTemplatesPath = config.modular ? modularTemplatesPath : defaultTemplatesPath;
2479
- const customTemplatesPath = config.templates && path$1.resolve(process.cwd(), config.templates);
2360
+ const __dirname = path$1.dirname(url$1.fileURLToPath(import.meta.url));
2361
+ const baseTemplatesPath = path$1.resolve(__dirname, "../templates/base");
2362
+ const defaultTemplatesPath = path$1.resolve(__dirname, "../templates/default");
2363
+ const modularTemplatesPath = path$1.resolve(__dirname, "../templates/modular");
2480
2364
  return {
2481
2365
  base: baseTemplatesPath,
2482
2366
  default: defaultTemplatesPath,
2483
2367
  modular: modularTemplatesPath,
2484
- original: originalTemplatesPath,
2485
- custom: customTemplatesPath
2368
+ original: config.modular ? modularTemplatesPath : defaultTemplatesPath,
2369
+ custom: config.templates && path$1.resolve(process.cwd(), config.templates)
2486
2370
  };
2487
2371
  };
2488
- cropExtension = (path$2) => this.config.templateExtensions.reduce((path$3, ext) => path$3.endsWith(ext) ? path$3.replace(ext, "") : path$3, path$2);
2372
+ cropExtension = (path) => this.config.templateExtensions.reduce((path, ext) => path.endsWith(ext) ? path.replace(ext, "") : path, path);
2489
2373
  getTemplateFullPath = (path_, fileName) => {
2490
2374
  const raw = path$1.resolve(path_, "./", this.cropExtension(fileName));
2491
2375
  return this.config.templateExtensions.map((extension) => `${raw}${extension}`).find((variant) => !!this.fileSystem.pathIsExist(variant));
@@ -2494,39 +2378,39 @@ var TemplatesWorker = class {
2494
2378
  if (packageOrPath.startsWith("./") || packageOrPath.startsWith("../")) return require(path$1.resolve(this.config.templatePaths.custom || this.config.templatePaths.original, packageOrPath));
2495
2379
  return require(packageOrPath);
2496
2380
  };
2497
- getTemplate = (name$1, fileName, path$2) => {
2381
+ getTemplate = (name, fileName, path) => {
2498
2382
  const { templatePaths } = this.config;
2499
- if (path$2) return this.fileSystem.getFileContent(path$2);
2383
+ if (path) return this.fileSystem.getFileContent(path);
2500
2384
  if (!fileName) return "";
2501
2385
  const customFullPath = templatePaths.custom && this.getTemplateFullPath(templatePaths.custom, fileName);
2502
2386
  let fileContent = customFullPath && this.fileSystem.getFileContent(customFullPath);
2503
2387
  if (fileContent) {
2504
- consola.info(`"${name$1.toLowerCase()}" template found in "${templatePaths.custom}"`);
2388
+ consola.info(`"${name.toLowerCase()}" template found in "${templatePaths.custom}"`);
2505
2389
  return fileContent;
2506
2390
  }
2507
2391
  const baseFullPath = this.getTemplateFullPath(templatePaths.base, fileName);
2508
2392
  if (baseFullPath) fileContent = this.fileSystem.getFileContent(baseFullPath);
2509
- else if (templatePaths.custom) consola.warn("Code generator will use the default template:", `"${name$1.toLowerCase()}"`, "template not found in", `"${templatePaths.custom}"`);
2510
- else consola.info(`Code generator will use the default template for "${name$1.toLowerCase()}"`);
2393
+ else if (templatePaths.custom) consola.warn("Code generator will use the default template:", `"${name.toLowerCase()}"`, "template not found in", `"${templatePaths.custom}"`);
2394
+ else consola.info(`Code generator will use the default template for "${name.toLowerCase()}"`);
2511
2395
  const originalFullPath = this.getTemplateFullPath(templatePaths.original, fileName);
2512
2396
  if (originalFullPath) fileContent = this.fileSystem.getFileContent(originalFullPath);
2513
2397
  return fileContent;
2514
2398
  };
2515
2399
  getTemplates = ({ templatePaths }) => {
2516
2400
  if (templatePaths.custom) consola.info(`try to read templates from directory "${templatePaths.custom}"`);
2517
- return lodash.reduce(this.config.templateInfos, (acc, { name: name$1, fileName }) => ({
2401
+ return this.config.templateInfos.reduce((acc, { name, fileName }) => ({
2518
2402
  ...acc,
2519
- [name$1]: this.getTemplate(name$1, fileName)
2403
+ [name]: this.getTemplate(name, fileName)
2520
2404
  }), {});
2521
2405
  };
2522
- findTemplateWithExt = (path$2) => {
2523
- const raw = this.cropExtension(path$2);
2406
+ findTemplateWithExt = (path) => {
2407
+ const raw = this.cropExtension(path);
2524
2408
  return this.config.templateExtensions.map((extension) => `${raw}${extension}`).find((variant) => this.fileSystem.pathIsExist(variant));
2525
2409
  };
2526
2410
  getTemplateContent = (path_) => {
2527
- const foundTemplatePathKey = lodash.keys(this.config.templatePaths).find((key) => path_.startsWith(`@${key}`));
2411
+ const foundTemplatePathKey = Object.keys(this.config.templatePaths).find((key) => path_.startsWith(`@${key}`));
2528
2412
  if (foundTemplatePathKey) {
2529
- const rawPath = path$1.resolve(path_.replace(`@${foundTemplatePathKey}`, lodash.get(this.config.templatePaths, foundTemplatePathKey)));
2413
+ const rawPath = path$1.resolve(path_.replace(`@${foundTemplatePathKey}`, get(this.config.templatePaths, foundTemplatePathKey)));
2530
2414
  const fixedPath = this.findTemplateWithExt(rawPath);
2531
2415
  if (fixedPath) return this.fileSystem.getFileContent(fixedPath);
2532
2416
  }
@@ -2541,7 +2425,7 @@ var TemplatesWorker = class {
2541
2425
  return eta.render(eta.compile(template, { async: false }), {
2542
2426
  ...this.getRenderTemplateData(),
2543
2427
  ...configuration
2544
- }, { includeFile: (path$2, configuration$1) => this.renderTemplate(this.getTemplateContent(path$2), configuration$1) });
2428
+ }, { includeFile: (path, configuration) => this.renderTemplate(this.getTemplateContent(path), configuration) });
2545
2429
  };
2546
2430
  };
2547
2431
 
@@ -2608,51 +2492,50 @@ var TypeNameFormatter = class {
2608
2492
  constructor(config) {
2609
2493
  this.config = config;
2610
2494
  }
2611
- format = (name$1, options = {}) => {
2495
+ format = (name, options = {}) => {
2612
2496
  const schemaType = options.type ?? "type-name";
2613
2497
  const typePrefix = schemaType === "enum-key" ? this.config.enumKeyPrefix : this.config.typePrefix;
2614
2498
  const typeSuffix = schemaType === "enum-key" ? this.config.enumKeySuffix : this.config.typeSuffix;
2615
- const hashKey = `${typePrefix}_${name$1}_${typeSuffix}`;
2616
- if (typeof name$1 !== "string") {
2617
- consola.warn("wrong model name", name$1);
2618
- return name$1;
2499
+ const hashKey = `${typePrefix}_${name}_${typeSuffix}`;
2500
+ if (typeof name !== "string") {
2501
+ consola.warn("wrong model name", name);
2502
+ return name;
2619
2503
  }
2620
- if (/^(?!\d)([A-Z0-9_]{1,})$/g.test(name$1)) return lodash.compact([
2504
+ if (/^(?!\d)([A-Z0-9_]{1,})$/g.test(name)) return compact([
2621
2505
  typePrefix,
2622
- name$1,
2506
+ name,
2623
2507
  typeSuffix
2624
2508
  ]).join("_");
2625
2509
  if (this.formattedModelNamesMap.has(hashKey)) return this.formattedModelNamesMap.get(hashKey);
2626
- const fixedModelName = this.fixModelName(name$1, { type: schemaType });
2627
- const formattedName = lodash.startCase(`${typePrefix}_${fixedModelName}_${typeSuffix}`).replace(/\s/g, "");
2628
- const formattedResultName = this.config.hooks.onFormatTypeName(formattedName, name$1, schemaType) || formattedName;
2510
+ const formattedName = startCase(`${typePrefix}_${this.fixModelName(name, { type: schemaType })}_${typeSuffix}`).replace(/\s/g, "");
2511
+ const formattedResultName = this.config.hooks.onFormatTypeName(formattedName, name, schemaType) || formattedName;
2629
2512
  this.formattedModelNamesMap.set(hashKey, formattedResultName);
2630
2513
  return formattedResultName;
2631
2514
  };
2632
- isValidName = (name$1) => /^([A-Za-z$_]{1,})$/g.test(name$1);
2633
- fixModelName = (name$1, options) => {
2634
- if (!this.isValidName(name$1)) {
2635
- if (!/^[a-zA-Z_$]/g.test(name$1)) return `${options.type === "enum-key" ? this.config.fixInvalidEnumKeyPrefix : this.config.fixInvalidTypeNamePrefix} ${name$1}`;
2636
- if (name$1.includes(".")) return name$1.replace(/Exclude_keyof[A-Za-z]+/g, () => "ExcludeKeys").replace(/%22~AND~%22/g, "And").replace(/%22~OR~%22/g, "Or").replace(/(\.?%22)|\./g, "_").replace(/__+$/, "");
2637
- if (name$1.includes("-")) return lodash.startCase(name$1).replace(/ /g, "");
2515
+ isValidName = (name) => /^([A-Za-z$_]{1,})$/g.test(name);
2516
+ fixModelName = (name, options) => {
2517
+ if (!this.isValidName(name)) {
2518
+ if (!/^[a-zA-Z_$]/g.test(name)) return `${options.type === "enum-key" ? this.config.fixInvalidEnumKeyPrefix : this.config.fixInvalidTypeNamePrefix} ${name}`;
2519
+ if (name.includes(".")) return name.replace(/Exclude_keyof[A-Za-z]+/g, () => "ExcludeKeys").replace(/%22~AND~%22/g, "And").replace(/%22~OR~%22/g, "Or").replace(/(\.?%22)|\./g, "_").replace(/__+$/, "");
2520
+ if (name.includes("-")) return startCase(name).replace(/ /g, "");
2638
2521
  }
2639
- return name$1;
2522
+ return name;
2640
2523
  };
2641
2524
  };
2642
2525
 
2643
2526
  //#endregion
2644
2527
  //#region src/util/file-system.ts
2645
2528
  var FileSystem = class {
2646
- getFileContent = (path$2) => {
2647
- return fs.readFileSync(path$2, { encoding: "utf8" });
2529
+ getFileContent = (path) => {
2530
+ return fs.readFileSync(path, { encoding: "utf8" });
2648
2531
  };
2649
- readDir = (path$2) => {
2650
- return fs.readdirSync(path$2);
2532
+ readDir = (path) => {
2533
+ return fs.readdirSync(path);
2651
2534
  };
2652
- pathIsDir = (path$2) => {
2653
- if (!path$2) return false;
2535
+ pathIsDir = (path) => {
2536
+ if (!path) return false;
2654
2537
  try {
2655
- return fs.statSync(path$2).isDirectory();
2538
+ return fs.statSync(path).isDirectory();
2656
2539
  } catch (e) {
2657
2540
  return false;
2658
2541
  }
@@ -2662,36 +2545,45 @@ var FileSystem = class {
2662
2545
  if (fileNameParts.length > 1) fileNameParts.pop();
2663
2546
  return fileNameParts.join(".");
2664
2547
  };
2665
- removeDir = (path$2) => {
2548
+ removeDir = (path) => {
2666
2549
  try {
2667
- if (typeof fs.rmSync === "function") fs.rmSync(path$2, { recursive: true });
2668
- else fs.rmdirSync(path$2, { recursive: true });
2550
+ if (typeof fs.rmSync === "function") fs.rmSync(path, { recursive: true });
2551
+ else fs.rmdirSync(path, { recursive: true });
2669
2552
  } catch (e) {
2670
2553
  consola.debug("failed to remove dir", e);
2671
2554
  }
2672
2555
  };
2673
- createDir = (path$2) => {
2556
+ createDir = (path) => {
2674
2557
  try {
2675
- fs.mkdirSync(path$2, { recursive: true });
2558
+ fs.mkdirSync(path, { recursive: true });
2676
2559
  } catch (e) {
2677
2560
  consola.debug("failed to create dir", e);
2678
2561
  }
2679
2562
  };
2680
- cleanDir = (path$2) => {
2681
- this.removeDir(path$2);
2682
- this.createDir(path$2);
2563
+ cleanDir = (path) => {
2564
+ this.removeDir(path);
2565
+ this.createDir(path);
2683
2566
  };
2684
- pathIsExist = (path$2) => {
2685
- return !!path$2 && fs.existsSync(path$2);
2567
+ pathIsExist = (path) => {
2568
+ return !!path && fs.existsSync(path);
2686
2569
  };
2687
2570
  createFile = ({ path: path_, fileName, content, withPrefix }) => {
2688
- const __dirname$1 = path$1.dirname(url$1.fileURLToPath(import.meta.url));
2689
- const absolutePath = path$1.resolve(__dirname$1, path_, `./${fileName}`);
2571
+ const __dirname = path$1.dirname(url$1.fileURLToPath(import.meta.url));
2572
+ const absolutePath = path$1.resolve(__dirname, path_, `./${fileName}`);
2690
2573
  const fileContent = `${withPrefix ? FILE_PREFIX : ""}${content}`;
2691
2574
  return fs.writeFileSync(absolutePath, fileContent);
2692
2575
  };
2693
2576
  };
2694
2577
 
2578
+ //#endregion
2579
+ //#region src/util/lodash-compat.ts
2580
+ function createLodashCompat() {
2581
+ return {
2582
+ ...esToolkit,
2583
+ ...esToolkitCompat
2584
+ };
2585
+ }
2586
+
2695
2587
  //#endregion
2696
2588
  //#region src/code-gen-process.ts
2697
2589
  const PATCHABLE_INSTANCES = [
@@ -2746,16 +2638,14 @@ var CodeGenProcess = class {
2746
2638
  if (this.config.swaggerSchema) swagger.usageSchema = this.config.swaggerSchema;
2747
2639
  if (this.config.originalSchema) swagger.originalSchema = this.config.originalSchema;
2748
2640
  this.schemaComponentsMap.clear();
2749
- lodash.each(swagger.usageSchema.components, (component, componentName) => lodash.each(component, (rawTypeData, typeName) => {
2750
- this.schemaComponentsMap.createComponent(this.schemaComponentsMap.createRef([
2751
- "components",
2752
- componentName,
2753
- typeName
2754
- ]), rawTypeData);
2755
- }));
2641
+ for (const [componentName, component] of Object.entries(swagger.usageSchema.components || {})) for (const [typeName, rawTypeData] of Object.entries(component)) this.schemaComponentsMap.createComponent(this.schemaComponentsMap.createRef([
2642
+ "components",
2643
+ componentName,
2644
+ typeName
2645
+ ]), rawTypeData);
2756
2646
  this.schemaComponentsMap.discriminatorsFirst();
2757
2647
  this.schemaComponentsMap.enumsFirst();
2758
- const parsedSchemas = this.schemaComponentsMap.filter(lodash.compact(["schemas", this.config.extractResponses && "responses"])).map((schemaComponent) => {
2648
+ const parsedSchemas = this.schemaComponentsMap.filter(compact(["schemas", this.config.extractResponses && "responses"])).map((schemaComponent) => {
2759
2649
  const parsed = this.schemaParserFabric.parseSchema(schemaComponent.rawTypeData, schemaComponent.typeName);
2760
2650
  schemaComponent.typeData = parsed;
2761
2651
  return parsed;
@@ -2789,8 +2679,8 @@ var CodeGenProcess = class {
2789
2679
  consola.debug(`path ${this.config.output} is not exist. creating dir by this path`);
2790
2680
  this.fileSystem.createDir(this.config.output);
2791
2681
  }
2792
- const files$1 = await this.generateOutputFiles({ configuration });
2793
- if (this.fileSystem.pathIsDir(this.config.output)) for (const file of files$1) {
2682
+ const files = await this.generateOutputFiles({ configuration });
2683
+ if (this.fileSystem.pathIsDir(this.config.output)) for (const file of files) {
2794
2684
  this.fileSystem.createFile({
2795
2685
  path: this.config.output,
2796
2686
  fileName: `${file.fileName}${file.fileExtension}`,
@@ -2800,7 +2690,7 @@ var CodeGenProcess = class {
2800
2690
  consola.success("api file", `"${file.fileName}${file.fileExtension}"`, `created in ${this.config.output}`);
2801
2691
  }
2802
2692
  return {
2803
- files: files$1,
2693
+ files,
2804
2694
  configuration,
2805
2695
  getTemplate: this.templatesWorker.getTemplate,
2806
2696
  renderTemplate: this.templatesWorker.renderTemplate,
@@ -2813,7 +2703,7 @@ var CodeGenProcess = class {
2813
2703
  utils: {
2814
2704
  Ts: this.config.Ts,
2815
2705
  formatDescription: this.schemaParserFabric.schemaFormatters.formatDescription,
2816
- internalCase,
2706
+ internalCase: camelCase,
2817
2707
  classNameCase: pascalCase,
2818
2708
  pascalCase,
2819
2709
  getInlineParseContent: this.schemaParserFabric.getInlineParseContent,
@@ -2830,7 +2720,7 @@ var CodeGenProcess = class {
2830
2720
  return ` * ${line}${eol ? "\n" : ""}`;
2831
2721
  },
2832
2722
  NameResolver,
2833
- _: lodash,
2723
+ _: createLodashCompat(),
2834
2724
  require: this.templatesWorker.requireFnFromTemplate
2835
2725
  },
2836
2726
  config: this.config
@@ -2839,7 +2729,7 @@ var CodeGenProcess = class {
2839
2729
  collectModelTypes = () => {
2840
2730
  const components = this.schemaComponentsMap.getComponents();
2841
2731
  let modelTypes = [];
2842
- const modelTypeComponents = lodash.compact(["schemas", this.config.extractResponses && "responses"]);
2732
+ const modelTypeComponents = compact(["schemas", this.config.extractResponses && "responses"]);
2843
2733
  const getSchemaComponentsCount = () => this.schemaComponentsMap.filter(...modelTypeComponents).length;
2844
2734
  let schemaComponentsCount = getSchemaComponentsCount();
2845
2735
  let processedCount = 0;
@@ -2861,14 +2751,14 @@ var CodeGenProcess = class {
2861
2751
  if (!typeInfo.typeData) typeInfo.typeData = this.schemaParserFabric.parseSchema(typeInfo.rawTypeData, typeInfo.typeName);
2862
2752
  const rawTypeData = typeInfo.typeData;
2863
2753
  const typeData = this.schemaParserFabric.schemaFormatters.base[rawTypeData.type] ? this.schemaParserFabric.schemaFormatters.base[rawTypeData.type](rawTypeData) : rawTypeData;
2864
- const { typeIdentifier, name: originalName, content, description: description$1 } = typeData;
2865
- const name$1 = this.typeNameFormatter.format(originalName);
2866
- if (name$1 === null) return null;
2754
+ const { typeIdentifier, name: originalName, content, description } = typeData;
2755
+ const name = this.typeNameFormatter.format(originalName);
2756
+ if (name === null) return null;
2867
2757
  const preparedModelType = {
2868
2758
  ...typeData,
2869
2759
  typeIdentifier,
2870
- name: name$1,
2871
- description: description$1,
2760
+ name,
2761
+ description,
2872
2762
  $content: rawTypeData.content,
2873
2763
  rawContent: rawTypeData.content,
2874
2764
  content,
@@ -2880,7 +2770,7 @@ var CodeGenProcess = class {
2880
2770
  generateOutputFiles = async ({ configuration }) => {
2881
2771
  const { modular, templatesToRender } = this.config;
2882
2772
  const output = modular ? await this.createMultipleFileInfos(templatesToRender, configuration) : await this.createSingleFileInfo(templatesToRender, configuration);
2883
- if (!lodash.isEmpty(configuration.extraTemplates)) for (const extraTemplate of configuration.extraTemplates) {
2773
+ if (configuration.extraTemplates?.length) for (const extraTemplate of configuration.extraTemplates) {
2884
2774
  const content = this.templatesWorker.renderTemplate(this.fileSystem.getFileContent(extraTemplate.path), configuration);
2885
2775
  output.push(...await this.createOutputFileInfo(configuration, extraTemplate.name, content));
2886
2776
  }
@@ -2930,7 +2820,7 @@ var CodeGenProcess = class {
2930
2820
  };
2931
2821
  createSingleFileInfo = async (templatesToRender, configuration) => {
2932
2822
  const { generateRouteTypes, generateClient } = configuration.config;
2933
- return await this.createOutputFileInfo(configuration, configuration.fileName, lodash.compact([
2823
+ return await this.createOutputFileInfo(configuration, configuration.fileName, compact([
2934
2824
  this.templatesWorker.renderTemplate(templatesToRender.dataContracts, configuration),
2935
2825
  generateRouteTypes && this.templatesWorker.renderTemplate(templatesToRender.routeTypes, configuration),
2936
2826
  generateClient && this.templatesWorker.renderTemplate(templatesToRender.httpClient, configuration),
@@ -2966,21 +2856,21 @@ var CodeGenProcess = class {
2966
2856
  createApiConfig = (swaggerSchema) => {
2967
2857
  const { info, servers, host, basePath, externalDocs, tags } = swaggerSchema;
2968
2858
  const server = servers?.[0] || { url: "" };
2969
- const { title = "No title", version: version$1 } = info || {};
2859
+ const { title = "No title", version } = info || {};
2970
2860
  const { url: serverUrl } = server;
2971
2861
  return {
2972
2862
  info: info || {},
2973
2863
  servers: servers || [],
2974
2864
  basePath,
2975
2865
  host,
2976
- externalDocs: lodash.merge({
2866
+ externalDocs: merge({
2977
2867
  url: "",
2978
2868
  description: ""
2979
- }, externalDocs),
2980
- tags: lodash.compact(tags),
2869
+ }, externalDocs || {}),
2870
+ tags: compact(tags || []),
2981
2871
  baseUrl: serverUrl,
2982
2872
  title,
2983
- version: version$1
2873
+ version
2984
2874
  };
2985
2875
  };
2986
2876
  injectClassInstance = (key, value) => {
@@ -2991,28 +2881,28 @@ var CodeGenProcess = class {
2991
2881
 
2992
2882
  //#endregion
2993
2883
  //#region types/index.ts
2994
- let RequestContentKind = /* @__PURE__ */ function(RequestContentKind$1) {
2995
- RequestContentKind$1["JSON"] = "JSON";
2996
- RequestContentKind$1["URL_ENCODED"] = "URL_ENCODED";
2997
- RequestContentKind$1["FORM_DATA"] = "FORM_DATA";
2998
- RequestContentKind$1["IMAGE"] = "IMAGE";
2999
- RequestContentKind$1["OTHER"] = "OTHER";
3000
- RequestContentKind$1["TEXT"] = "TEXT";
3001
- return RequestContentKind$1;
2884
+ let RequestContentKind = /* @__PURE__ */ function(RequestContentKind) {
2885
+ RequestContentKind["JSON"] = "JSON";
2886
+ RequestContentKind["URL_ENCODED"] = "URL_ENCODED";
2887
+ RequestContentKind["FORM_DATA"] = "FORM_DATA";
2888
+ RequestContentKind["IMAGE"] = "IMAGE";
2889
+ RequestContentKind["OTHER"] = "OTHER";
2890
+ RequestContentKind["TEXT"] = "TEXT";
2891
+ return RequestContentKind;
3002
2892
  }({});
3003
- let SCHEMA_TYPES = /* @__PURE__ */ function(SCHEMA_TYPES$2) {
3004
- SCHEMA_TYPES$2["ARRAY"] = "array";
3005
- SCHEMA_TYPES$2["OBJECT"] = "object";
3006
- SCHEMA_TYPES$2["ENUM"] = "enum";
3007
- SCHEMA_TYPES$2["REF"] = "$ref";
3008
- SCHEMA_TYPES$2["PRIMITIVE"] = "primitive";
3009
- SCHEMA_TYPES$2["COMPLEX"] = "complex";
3010
- SCHEMA_TYPES$2["COMPLEX_ONE_OF"] = "oneOf";
3011
- SCHEMA_TYPES$2["COMPLEX_ANY_OF"] = "anyOf";
3012
- SCHEMA_TYPES$2["COMPLEX_ALL_OF"] = "allOf";
3013
- SCHEMA_TYPES$2["COMPLEX_NOT"] = "not";
3014
- SCHEMA_TYPES$2["COMPLEX_UNKNOWN"] = "__unknown";
3015
- return SCHEMA_TYPES$2;
2893
+ let SCHEMA_TYPES = /* @__PURE__ */ function(SCHEMA_TYPES) {
2894
+ SCHEMA_TYPES["ARRAY"] = "array";
2895
+ SCHEMA_TYPES["OBJECT"] = "object";
2896
+ SCHEMA_TYPES["ENUM"] = "enum";
2897
+ SCHEMA_TYPES["REF"] = "$ref";
2898
+ SCHEMA_TYPES["PRIMITIVE"] = "primitive";
2899
+ SCHEMA_TYPES["COMPLEX"] = "complex";
2900
+ SCHEMA_TYPES["COMPLEX_ONE_OF"] = "oneOf";
2901
+ SCHEMA_TYPES["COMPLEX_ANY_OF"] = "anyOf";
2902
+ SCHEMA_TYPES["COMPLEX_ALL_OF"] = "allOf";
2903
+ SCHEMA_TYPES["COMPLEX_NOT"] = "not";
2904
+ SCHEMA_TYPES["COMPLEX_UNKNOWN"] = "__unknown";
2905
+ return SCHEMA_TYPES;
3016
2906
  }({});
3017
2907
 
3018
2908
  //#endregion
@@ -3030,7 +2920,7 @@ var TemplatesGenConfig = class {
3030
2920
  this.update(config);
3031
2921
  }
3032
2922
  update = (update) => {
3033
- objectAssign(this, update);
2923
+ Object.assign(this, update);
3034
2924
  };
3035
2925
  };
3036
2926
 
@@ -3145,13 +3035,5 @@ async function generateTemplates(config) {
3145
3035
  }
3146
3036
 
3147
3037
  //#endregion
3148
- //#region src/index.ts
3149
- async function generateApi(config) {
3150
- if (config.debug) consola.level = Number.MAX_SAFE_INTEGER;
3151
- if (config.silent) consola.level = 0;
3152
- return await new CodeGenProcess(config).start();
3153
- }
3154
-
3155
- //#endregion
3156
- export { CodeGenConfig, HTTP_CLIENT, RequestContentKind, SCHEMA_TYPES, TemplatesGenConfig, constants_exports, generateApi, generateTemplates, package_default };
3157
- //# sourceMappingURL=src-CsGSW_U0.js.map
3038
+ export { CodeGenProcess as a, constants_exports as c, version as d, SCHEMA_TYPES as i, description as l, TemplatesGenConfig as n, CodeGenConfig as o, RequestContentKind as r, HTTP_CLIENT as s, generateTemplates as t, name as u };
3039
+ //# sourceMappingURL=generate-templates-BO-5CKCm.mjs.map