swagger-typescript-api 13.0.11 → 13.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-R4CYI34W.js → chunk-O6K2HOIW.js} +2 -2
- package/dist/chunk-O6K2HOIW.js.map +1 -0
- package/dist/{chunk-3OGOYA5P.cjs → chunk-T7GDAZLY.cjs} +2 -2
- package/dist/chunk-T7GDAZLY.cjs.map +1 -0
- package/dist/cli.cjs +9 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +9 -9
- package/dist/cli.js.map +1 -1
- package/dist/lib.cjs +4 -4
- package/dist/lib.js +1 -1
- package/dist/types.d.cts +1818 -0
- package/dist/types.d.ts +1818 -0
- package/package.json +9 -10
- package/cli/index.d.ts +0 -35
- package/dist/chunk-3OGOYA5P.cjs.map +0 -1
- package/dist/chunk-R4CYI34W.js.map +0 -1
- package/index.d.ts +0 -784
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/code-gen-process.js","../src/code-formatter.js","../src/configuration.js","../src/util/name-resolver.js","../src/util/random.js","../src/component-type-name-resolver.js","../src/constants.js","../package.json","../src/util/object-assign.js","../src/schema-components-map.js","../src/schema-parser/schema-parser-fabric.js","../src/schema-parser/schema-formatters.js","../src/schema-parser/schema-parser.js","../src/util/sort-by-property.js","../src/schema-parser/base-schema-parsers/array.js","../src/schema-parser/mono-schema-parser.js","../src/schema-parser/base-schema-parsers/complex.js","../src/schema-parser/base-schema-parsers/discriminator.js","../src/schema-parser/base-schema-parsers/enum.js","../src/schema-parser/util/enum-key-resolver.js","../src/schema-parser/base-schema-parsers/object.js","../src/schema-parser/base-schema-parsers/primitive.js","../src/schema-parser/complex-schema-parsers/all-of.js","../src/schema-parser/complex-schema-parsers/any-of.js","../src/schema-parser/complex-schema-parsers/not.js","../src/schema-parser/complex-schema-parsers/one-of.js","../src/schema-parser/schema-utils.js","../src/util/internal-case.js","../src/util/pascal-case.js","../src/schema-routes/schema-routes.js","../src/util/id.js","../src/schema-routes/util/specific-arg-name-resolver.js","../src/schema-walker.js","../src/swagger-schema-resolver.js","../src/util/request.js","../src/templates-worker.js","../src/translators/javascript.js","../src/translators/translator.js","../src/type-name-formatter.js","../src/util/file-system.js","../src/util/logger.js","../src/commands/generate-templates/templates-gen-process.js","../src/commands/generate-templates/configuration.js","../src/commands/generate-templates/index.js","../src/index.js"],"names":["_","ts","prettier","CodeFormatter","config","content","tempFileName","host","TsLanguageServiceHost","fileTextChanges","span","newText","code","removeUnusedImports","prettierFormat","fileName","tsconfig","encoding","path","cosmiconfigSync","NameResolver","logger","reservedNames","getFallbackName","names","fixedNames","name","reservedName","variants","resolver","extras","shouldReserve","usageName","variant","uniqVariants","getRandomFloat","min","max","getRandomInt","ComponentTypeNameResolver","randomVariant","variantCounter","dirtyResolvedName","fallbackName","constants_exports","__export","DEFAULT_BODY_ARG_NAME","FILE_PREFIX","HTTP_CLIENT","PRETTIER_OPTIONS","PROJECT_VERSION","RESERVED_BODY_ARG_NAMES","RESERVED_HEADER_ARG_NAMES","RESERVED_PATH_ARG_NAMES","RESERVED_QUERY_ARG_NAMES","RESERVED_REQ_PARAMS_ARG_NAMES","SCHEMA_TYPES","package_default","objectAssign","target","updaterFn","update","undefinedKeys","value","key","TsKeyword","TsCodeGenKeyword","CodeGenConfig","routePath","routeData","pathParam","schema","originalSchema","typeName","schemaType","parsedSchema","codeGenProcess","apiConfig","rawType","rawTypeName","routeInfo","templateRouteName","contents","readonly","optional","enumStruct","formatFn","part","genericArgs","values","prettierOptions","getDefaultPrettierOptions","codeGenConstructs","primitiveTypeConstructs","constants","templateInfos","hooks","otherConfig","SchemaComponentsMap","paths","ref","$ref","rawTypeData","parsed","componentName","componentSchema","usageComponent","refIndex","componentNames","it","c","SchemaFormatters","schemaParser","formatType","description","inline","prettified","fields","extraSpace","result","routeNameFromTemplate","sortByProperty","propertyName","o1","o2","MonoSchemaParser","schemaPath","ArraySchemaParser","contentType","type","items","tupleContent","item","ComplexSchemaParser","complexType","simpleSchema","complexSchemaContent","DiscriminatorSchemaParser","discriminator","noDiscriminatorSchema","skipMappingType","abstractSchemaStruct","discriminatorSchemaStruct","schemaContent","refPath","mappingEntries","ableToCreateMappingType","mappingContents","mappingTypeName","mappingPropertySchemaEnumKeysMap","generatedTypeName","component","createMappingContent","mappingSchema","mappingKey","mappingUsageKey","discPropertyName","mappingPropertySchema","acc","index","enumKey","complexSchemaKeys","mappingRefSchema","schemaKey","schemaPropertyName","schemaProperty","schemaIsAny","EnumKeyResolver","generatedVariant","EnumSchemaParser","args","pathTypeName","customComponent","refType","enumNames","enumName","keyType","formatValue","enumValue","formattedKey","formatted","ObjectSchemaParser","contentProperties","properties","additionalProperties","propertiesContent","property","required","nullable","fieldName","fieldValue","readOnly","PrimitiveSchemaParser","fieldType","AllOfSchemaParser","ignoreTypes","combined","childSchema","filtered","AnyOfSchemaParser","NotSchemaParser","OneOfSchemaParser","internalCase","pascalCase","SchemaUtils","schemaComponentsMap","typeNameFormatter","schemaWalker","propertySchema","rootSchema","isRequired","rawSchema","enumFieldType","resultType","parentSchema","refData","existedRequiredKeys","filterFn","suffixes","prefixes","reserved","prefix","suffix","refTypeInfo","primitiveType","typeAlias","SchemaParser","schemaParserFabric","responseStruct","firstResponse","firstSchema","SchemaParserFabric","templatesWorker","linkedSchema","linkedComponent","otherSchemaProps","parser","schemaCopy","customAlphabet","ALPHABET","generateId","SpecificArgNameResolver","CONTENT_KIND","SchemaRoutes","routeInfoByMethodsMap","parameters","requestInfo","method","originalRouteName","routeName","pathParamMatches","pathParams","match","paramName","fixedRoute","i","arr","insertion","queryParamMatches","queryParams","pathParamsFromRouteName","queryParamsFromRouteName","routeParams","parameter","routeParam","queryParam","extraContentTypes","requestInfoData","contentTypes","status","dataType","parsedSchemas","operationId","defaultType","foundedSchemaByName","foundSchemaByContent","foundSchema","typeNameWithoutOpId","requestInfos","produces","responses","responseInfos","successResponse","response","errorResponses","handleResponseHeaders","src","headerTypes","k","v","params","objectSchema","schemaPart","requestBody","consumes","requestBodyName","contentKind","queryObjectSchema","pathArgsSchemas","extractRequestParams","pathArgSchema","fixedQueryParams","fixedSchema","responseBodyInfo","idx","errorSchemas","rawRouteInfo","moduleName","routeNameDuplicatesMap","templatesToRender","routeNameTemplate","duplicateIdentifier","duplicates","routeNameInfo","rawRouteName","usageSchema","globalSecurity","moduleNameIndex","moduleNameFirstTag","security","summary","tags","otherInfo","route","routeId","firstTag","hasSecurity","pathArgs","pathArgsNames","arg","pathObjectSchema","headersObjectSchema","requestBodyInfo","requestParamsSchema","queryType","pathType","headersType","nameResolver","specificArgs","pathArg","pathsEntries","routeInfosMap","parsedRouteInfo","processedRouteInfo","groupedRoutes","modules","routeGroups","routesGroup","originalName","id","routeGroup","routes","routeA","routeB","SchemaWalker","schemas","address","swaggerSchemaObject","pathToSchema","swaggerSchemaFile","yaml","converter","Request","url","disableStrictSSL","authToken","options","requestOptions","undiciGlobalDispatcher","newDispatcher","error","message","SwaggerSchemaResolver","fileSystem","spec","patch","input","disableProxy","authorizationToken","swaggerSchema","converterOptions","resolve","err","parsedSwaggerSchema","pathToSwagger","urlToSwagger","file","usagePaths","originalPaths","usagePathObject","originalPathObject","usageRouteInfo","methodName","originalRouteInfo","usageRouteParams","originalRouteParams","originalRouteParam","param","Eta","TemplatesWorker","getRenderTemplateData","__dirname","baseTemplatesPath","defaultTemplatesPath","modularTemplatesPath","originalTemplatesPath","customTemplatesPath","ext","raw","extension","packageOrPath","templatePaths","customFullPath","fileContent","baseFullPath","originalFullPath","foundTemplatePathKey","rawPath","fixedPath","customPath","originalPath","template","configuration","Translator","JavascriptTranslator","fileNameFull","output","fileNames","originalSourceFileGet","sourceFileName","languageVersion","onError","shouldCreateNewSourceFile","compiled","jsFileName","dtsFileName","sourceContent","tsImportRows","line","declarationContent","TypeNameFormatter","typePrefix","typeSuffix","hashKey","fixedModelName","formattedName","formattedResultName","fs","dirname","emojify","Logger","emojiName","messages","emoji","trace","logFn","FileSystem","fileNameParts","e","withPrefix","absolutePath","PATCHABLE_INSTANCES","CodeGenProcess","swagger","schemaComponent","rawConfiguration","files","eol","components","modelTypes","modelTypeComponents","getSchemaComponentsCount","schemaComponentsCount","processedCount","modelType","typeInfo","typeData","typeIdentifier","preparedModelType","modular","extraTemplate","fileInfo","generateRouteTypes","generateClient","modularApiFileInfos","outOfModuleRouteContent","outOfModuleApiContent","routeModuleContent","apiModuleContent","fileExtension","info","servers","basePath","externalDocs","server","title","version","serverUrl","instanceKey","TemplatesGenConfig","TemplatesGenProcess","templates","outputPath","templateName","templateEjsPath","templateEtaPath","templateEjsPathExist","templateEtaPathExist","outputFiles","baseTemplates","httpClientTemplates","apiTemplatesPath","apiTemplates","usingHttpClientTemplate","httpClientTemplateContent","templateContent","importsRegExp1","importsRegExp2","importsRegExp3","dir","pathToFile","generateTemplates","generateApi"],"mappings":"6FAAA,OAAOA,MAAO,SACd,OAAOC,OAAQ,aCDf,OAAOD,OAAO,SACd,OAAOE,OAAc,WACrB,OAAOD,MAAQ,aAEf,IAAME,GAAN,KAAoB,CAIlB,OAEA,YAAY,CAAE,OAAAC,CAAO,EAAG,CACtB,KAAK,OAASA,CAChB,CAEA,oBAAuBC,GAAY,CACjC,IAAMC,EAAe,UAEfC,EAAO,IAAIC,GAAsBF,EAAcD,CAAO,EAGtDI,EAFkBR,EAAG,sBAAsBM,CAAI,EAEb,gBACtC,CAAE,KAAM,OAAQ,SAAUD,CAAa,EACvC,CAAE,iBAAkBL,EAAG,IAAI,OAAQ,CACrC,EAAE,CAAC,EAEH,OAAIQ,GAAiB,YAAY,OACxBT,GAAE,YACPS,EAAgB,YAChB,CAACJ,EAAS,CAAE,KAAAK,EAAM,QAAAC,CAAQ,IACxB,GAAGN,EAAQ,MAAM,EAAGK,EAAK,KAAK,CAAC,GAAGC,CAAO,GAAGN,EAAQ,MAClDK,EAAK,MAAQA,EAAK,MACpB,CAAC,GACHL,CACF,EAGKA,CACT,EAMA,eAAiB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AAeC,GAAkBrgB,EAAQ,CAEvC,OAAO,MADgB,IAAIgf,GAAoBhf,CAAM,EACzB,MAAM,CACpC,CCDA,eAAesgB,GAAY,CAAE,KAAAhf,EAAM,SAAAxB,EAAU,GAAGE,CAAO,EAAG,CAMxD,OAAO,MALgB,IAAI0c,GAAe,CACxC,GAAG1c,EACH,SAAUsB,EACV,gBAAiBxB,CACnB,CAAC,EAC2B,MAAM,CACpC","sourcesContent":["import _ from \"lodash\";\nimport ts from \"typescript\";\nimport { CodeFormatter } from \"./code-formatter.js\";\nimport { CodeGenConfig } from \"./configuration.js\";\nimport { SchemaComponentsMap } from \"./schema-components-map.js\";\nimport { SchemaParserFabric } from \"./schema-parser/schema-parser-fabric.js\";\nimport { SchemaRoutes } from \"./schema-routes/schema-routes.js\";\nimport { SchemaWalker } from \"./schema-walker.js\";\nimport { SwaggerSchemaResolver } from \"./swagger-schema-resolver.js\";\nimport { TemplatesWorker } from \"./templates-worker.js\";\nimport { JavascriptTranslator } from \"./translators/javascript.js\";\nimport { TypeNameFormatter } from \"./type-name-formatter.js\";\nimport { FileSystem } from \"./util/file-system.js\";\nimport { internalCase } from \"./util/internal-case.js\";\nimport { Logger } from \"./util/logger.js\";\nimport { NameResolver } from \"./util/name-resolver.js\";\nimport { pascalCase } from \"./util/pascal-case.js\";\nimport { sortByProperty } from \"./util/sort-by-property.js\";\n\nconst PATCHABLE_INSTANCES = [\n \"schemaWalker\",\n \"swaggerSchemaResolver\",\n \"schemaComponentsMap\",\n \"typeNameFormatter\",\n \"templatesWorker\",\n \"codeFormatter\",\n \"schemaParserFabric\",\n \"schemaRoutes\",\n \"javascriptTranslator\",\n];\n\nclass CodeGenProcess {\n /** @type {CodeGenConfig} */\n config;\n /** @type {SwaggerSchemaResolver} */\n swaggerSchemaResolver;\n /** @type {SchemaComponentsMap} */\n schemaComponentsMap;\n /** @type {Logger} */\n logger;\n /** @type {TypeNameFormatter} */\n typeNameFormatter;\n /** @type {SchemaParserFabric} */\n schemaParserFabric;\n /** @type {SchemaRoutes} */\n schemaRoutes;\n /** @type {FileSystem} */\n fileSystem;\n /** @type {CodeFormatter} */\n codeFormatter;\n /** type {TemplatesWorker} */\n templatesWorker;\n /** @type {SchemaWalker} */\n schemaWalker;\n /** @type {JavascriptTranslator} */\n javascriptTranslator;\n\n /**\n *\n * @param config {Partial<import(\"../index.d.ts\").GenerateApiConfiguration['config']>}\n */\n constructor(config) {\n this.config = new CodeGenConfig(config);\n this.logger = new Logger(this);\n this.fileSystem = new FileSystem(this);\n this.schemaWalker = new SchemaWalker(this);\n this.swaggerSchemaResolver = new SwaggerSchemaResolver(this);\n this.schemaComponentsMap = new SchemaComponentsMap(this);\n this.typeNameFormatter = new TypeNameFormatter(this);\n this.templatesWorker = new TemplatesWorker(this);\n this.codeFormatter = new CodeFormatter(this);\n this.schemaParserFabric = new SchemaParserFabric(this);\n this.schemaRoutes = new SchemaRoutes(this);\n this.javascriptTranslator = new JavascriptTranslator(this);\n this.config.componentTypeNameResolver.logger = this.logger;\n }\n\n async start() {\n this.config.update({\n templatePaths: this.templatesWorker.getTemplatePaths(this.config),\n });\n this.config.update({\n templatesToRender: this.templatesWorker.getTemplates(this.config),\n });\n\n const swagger = await this.swaggerSchemaResolver.create();\n\n this.swaggerSchemaResolver.fixSwaggerSchema(swagger);\n\n this.config.update({\n swaggerSchema: swagger.usageSchema,\n originalSchema: swagger.originalSchema,\n });\n\n this.schemaWalker.addSchema(\"$usage\", swagger.usageSchema);\n this.schemaWalker.addSchema(\"$original\", swagger.originalSchema);\n\n this.logger.event(\"start generating your typescript api\");\n\n this.config.update(\n this.config.hooks.onInit(this.config, this) || this.config,\n );\n\n this.schemaComponentsMap.clear();\n\n _.each(swagger.usageSchema.components, (component, componentName) =>\n _.each(component, (rawTypeData, typeName) => {\n this.schemaComponentsMap.createComponent(\n this.schemaComponentsMap.createRef([\n \"components\",\n componentName,\n typeName,\n ]),\n rawTypeData,\n );\n }),\n );\n\n /**\n * @type {SchemaComponent[]}\n */\n const componentsToParse = this.schemaComponentsMap.filter(\n _.compact([\"schemas\", this.config.extractResponses && \"responses\"]),\n );\n\n const parsedSchemas = componentsToParse.map((schemaComponent) => {\n const parsed = this.schemaParserFabric.parseSchema(\n schemaComponent.rawTypeData,\n schemaComponent.typeName,\n );\n schemaComponent.typeData = parsed;\n return parsed;\n });\n\n this.schemaRoutes.attachSchema({\n usageSchema: swagger.usageSchema,\n parsedSchemas,\n });\n\n const rawConfiguration = {\n apiConfig: this.createApiConfig(swagger.usageSchema),\n config: this.config,\n modelTypes: this.collectModelTypes(),\n hasSecurityRoutes: this.schemaRoutes.hasSecurityRoutes,\n hasQueryRoutes: this.schemaRoutes.hasQueryRoutes,\n hasFormDataRoutes: this.schemaRoutes.hasFormDataRoutes,\n generateResponses: this.config.generateResponses,\n routes: this.schemaRoutes.getGroupedRoutes(),\n extraTemplates: this.config.extraTemplates,\n fileName: this.config.fileName,\n translateToJavaScript: this.config.toJS,\n customTranslator: this.config.customTranslator\n ? new this.config.customTranslator(this)\n : null,\n utils: this.getRenderTemplateData().utils,\n };\n\n const configuration =\n this.config.hooks.onPrepareConfig(rawConfiguration) || rawConfiguration;\n\n if (this.fileSystem.pathIsExist(this.config.output)) {\n if (this.config.cleanOutput) {\n this.logger.debug(`cleaning dir ${this.config.output}`);\n this.fileSystem.cleanDir(this.config.output);\n }\n } else {\n this.logger.debug(\n `path ${this.config.output} is not exist. creating dir by this path`,\n );\n this.fileSystem.createDir(this.config.output);\n }\n\n const files = await this.generateOutputFiles({\n configuration: configuration,\n });\n\n const isDirPath = this.fileSystem.pathIsDir(this.config.output);\n\n if (isDirPath) {\n files.forEach((file) => {\n this.fileSystem.createFile({\n path: this.config.output,\n fileName: `${file.fileName}${file.fileExtension}`,\n content: file.fileContent,\n withPrefix: true,\n });\n\n this.logger.success(\n \"api file\",\n `\"${file.fileName}${file.fileExtension}\"`,\n `created in ${this.config.output}`,\n );\n });\n }\n\n return {\n files,\n configuration,\n getTemplate: this.templatesWorker.getTemplate,\n renderTemplate: this.templatesWorker.renderTemplate,\n createFile: this.fileSystem.createFile,\n formatTSContent: this.codeFormatter.formatCode,\n };\n }\n\n getRenderTemplateData = () => {\n return {\n utils: {\n Ts: this.config.Ts,\n formatDescription:\n this.schemaParserFabric.schemaFormatters.formatDescription,\n internalCase: internalCase,\n classNameCase: pascalCase,\n pascalCase: pascalCase,\n getInlineParseContent: this.schemaParserFabric.getInlineParseContent,\n getParseContent: this.schemaParserFabric.getParseContent,\n getComponentByRef: this.schemaComponentsMap.get,\n parseSchema: this.schemaParserFabric.parseSchema,\n checkAndAddNull: this.schemaParserFabric.schemaUtils.safeAddNullToType,\n safeAddNullToType:\n this.schemaParserFabric.schemaUtils.safeAddNullToType,\n isNeedToAddNull:\n this.schemaParserFabric.schemaUtils.isNullMissingInType,\n inlineExtraFormatters: this.schemaParserFabric.schemaFormatters.inline,\n formatters: this.schemaParserFabric.schemaFormatters.base,\n formatModelName: this.typeNameFormatter.format,\n fmtToJSDocLine: function fmtToJSDocLine(line, { eol = true }) {\n return ` * ${line}${eol ? \"\\n\" : \"\"}`;\n },\n NameResolver: NameResolver,\n _,\n require: this.templatesWorker.requireFnFromTemplate,\n },\n config: this.config,\n };\n };\n\n collectModelTypes = () => {\n const components = this.schemaComponentsMap.getComponents();\n let modelTypes = [];\n\n const modelTypeComponents = _.compact([\n \"schemas\",\n this.config.extractResponses && \"responses\",\n ]);\n\n const getSchemaComponentsCount = () =>\n this.schemaComponentsMap.filter(...modelTypeComponents).length;\n\n let schemaComponentsCount = getSchemaComponentsCount();\n let processedCount = 0;\n\n while (processedCount < schemaComponentsCount) {\n modelTypes = [];\n processedCount = 0;\n for (const component of components) {\n if (modelTypeComponents.includes(component.componentName)) {\n const modelType = this.prepareModelType(component);\n if (modelType) {\n modelTypes.push(modelType);\n }\n processedCount++;\n }\n }\n schemaComponentsCount = getSchemaComponentsCount();\n }\n\n if (this.config.sortTypes) {\n return modelTypes.sort(sortByProperty(\"name\"));\n }\n\n return modelTypes;\n };\n\n prepareModelType = (typeInfo) => {\n if (typeInfo.$prepared) return typeInfo.$prepared;\n\n if (!typeInfo.typeData) {\n typeInfo.typeData = this.schemaParserFabric.parseSchema(\n typeInfo.rawTypeData,\n typeInfo.typeName,\n );\n }\n const rawTypeData = typeInfo.typeData;\n const typeData = this.schemaParserFabric.schemaFormatters.base[\n rawTypeData.type\n ]\n ? this.schemaParserFabric.schemaFormatters.base[rawTypeData.type](\n rawTypeData,\n )\n : rawTypeData;\n let { typeIdentifier, name: originalName, content, description } = typeData;\n const name = this.typeNameFormatter.format(originalName);\n\n if (name === null) return null;\n\n const preparedModelType = {\n ...typeData,\n typeIdentifier,\n name,\n description,\n $content: rawTypeData.content,\n rawContent: rawTypeData.content,\n content: content,\n typeData,\n };\n\n typeInfo.$prepared = preparedModelType;\n\n return preparedModelType;\n };\n\n /**\n *\n * @param configuration\n * @returns {Promise<TranslatorIO[]>}\n */\n generateOutputFiles = async ({ configuration }) => {\n const { modular, templatesToRender } = this.config;\n\n const output = modular\n ? await this.createMultipleFileInfos(templatesToRender, configuration)\n : await this.createSingleFileInfo(templatesToRender, configuration);\n\n if (!_.isEmpty(configuration.extraTemplates)) {\n for (const extraTemplate of configuration.extraTemplates) {\n const content = this.templatesWorker.renderTemplate(\n this.fileSystem.getFileContent(extraTemplate.path),\n configuration,\n );\n output.push(\n ...(await this.createOutputFileInfo(\n configuration,\n extraTemplate.name,\n content,\n )),\n );\n }\n }\n\n return output.filter((fileInfo) => !!fileInfo && !!fileInfo.fileContent);\n };\n\n /**\n * @param templatesToRender\n * @param configuration\n * @returns {Promise<TranslatorIO[]>}\n */\n createMultipleFileInfos = async (templatesToRender, configuration) => {\n const { routes } = configuration;\n const { fileNames, generateRouteTypes, generateClient } =\n configuration.config;\n /**\n * @type {TranslatorIO[]}\n */\n const modularApiFileInfos = [];\n\n if (routes.$outOfModule) {\n if (generateRouteTypes) {\n const outOfModuleRouteContent = this.templatesWorker.renderTemplate(\n templatesToRender.routeTypes,\n {\n ...configuration,\n route: configuration.routes.$outOfModule,\n },\n );\n\n modularApiFileInfos.push(\n ...(await this.createOutputFileInfo(\n configuration,\n fileNames.outOfModuleApi,\n outOfModuleRouteContent,\n )),\n );\n }\n if (generateClient) {\n const outOfModuleApiContent = this.templatesWorker.renderTemplate(\n templatesToRender.api,\n {\n ...configuration,\n route: configuration.routes.$outOfModule,\n },\n );\n\n modularApiFileInfos.push(\n ...(await this.createOutputFileInfo(\n configuration,\n fileNames.outOfModuleApi,\n outOfModuleApiContent,\n )),\n );\n }\n }\n\n if (routes.combined) {\n for (const route of routes.combined) {\n if (generateRouteTypes) {\n const routeModuleContent = this.templatesWorker.renderTemplate(\n templatesToRender.routeTypes,\n {\n ...configuration,\n route,\n },\n );\n\n modularApiFileInfos.push(\n ...(await this.createOutputFileInfo(\n configuration,\n pascalCase(`${route.moduleName}_Route`),\n routeModuleContent,\n )),\n );\n }\n\n if (generateClient) {\n const apiModuleContent = this.templatesWorker.renderTemplate(\n templatesToRender.api,\n {\n ...configuration,\n route,\n },\n );\n\n modularApiFileInfos.push(\n ...(await this.createOutputFileInfo(\n configuration,\n pascalCase(route.moduleName),\n apiModuleContent,\n )),\n );\n }\n }\n }\n\n return [\n ...(await this.createOutputFileInfo(\n configuration,\n fileNames.dataContracts,\n this.templatesWorker.renderTemplate(\n templatesToRender.dataContracts,\n configuration,\n ),\n )),\n ...(generateClient\n ? await this.createOutputFileInfo(\n configuration,\n fileNames.httpClient,\n this.templatesWorker.renderTemplate(\n templatesToRender.httpClient,\n configuration,\n ),\n )\n : []),\n ...modularApiFileInfos,\n ];\n };\n\n /**\n *\n * @param templatesToRender\n * @param configuration\n * @returns {Promise<TranslatorIO[]>}\n */\n createSingleFileInfo = async (templatesToRender, configuration) => {\n const { generateRouteTypes, generateClient } = configuration.config;\n\n return await this.createOutputFileInfo(\n configuration,\n configuration.fileName,\n _.compact([\n this.templatesWorker.renderTemplate(\n templatesToRender.dataContracts,\n configuration,\n ),\n generateRouteTypes &&\n this.templatesWorker.renderTemplate(\n templatesToRender.routeTypes,\n configuration,\n ),\n generateClient &&\n this.templatesWorker.renderTemplate(\n templatesToRender.httpClient,\n configuration,\n ),\n generateClient &&\n this.templatesWorker.renderTemplate(\n templatesToRender.api,\n configuration,\n ),\n ]).join(\"\\n\"),\n );\n };\n\n /**\n *\n * @param configuration\n * @param fileNameFull\n * @param content\n * @returns {Promise<TranslatorIO[]>}\n */\n createOutputFileInfo = async (configuration, fileNameFull, content) => {\n const fileName = this.fileSystem.cropExtension(fileNameFull);\n const fileExtension = ts.Extension.Ts;\n\n if (configuration.translateToJavaScript) {\n this.logger.debug(\"using js translator for\", fileName);\n return await this.javascriptTranslator.translate({\n fileName: fileName,\n fileExtension: fileExtension,\n fileContent: content,\n });\n }\n\n if (configuration.customTranslator) {\n this.logger.debug(\"using custom translator for\", fileName);\n return await configuration.customTranslator.translate({\n fileName: fileName,\n fileExtension: fileExtension,\n fileContent: content,\n });\n }\n\n this.logger.debug(\"generating output for\", `${fileName}${fileExtension}`);\n\n return [\n {\n fileName,\n fileExtension: fileExtension,\n fileContent: await this.codeFormatter.formatCode(content),\n },\n ];\n };\n\n createApiConfig = (swaggerSchema) => {\n const { info, servers, host, basePath, externalDocs, tags } = swaggerSchema;\n const server = servers?.[0] || { url: \"\" };\n const { title = \"No title\", version } = info || {};\n const { url: serverUrl } = server;\n\n return {\n info: info || {},\n servers: servers || [],\n basePath,\n host,\n externalDocs: _.merge(\n {\n url: \"\",\n description: \"\",\n },\n externalDocs,\n ),\n tags: _.compact(tags),\n baseUrl: serverUrl,\n title,\n version,\n };\n };\n\n injectClassInstance = (key, value) => {\n this[key] = value;\n PATCHABLE_INSTANCES.forEach((instanceKey) => {\n if (instanceKey !== key && key in this[instanceKey]) {\n this[instanceKey][key] = value;\n }\n });\n };\n}\n\nexport { CodeGenProcess };\n","import _ from \"lodash\";\nimport prettier from \"prettier\";\nimport ts from \"typescript\";\n\nclass CodeFormatter {\n /**\n * @type {CodeGenConfig}\n */\n config;\n\n constructor({ config }) {\n this.config = config;\n }\n\n removeUnusedImports = (content) => {\n const tempFileName = \"file.ts\";\n\n const host = new TsLanguageServiceHost(tempFileName, content);\n const languageService = ts.createLanguageService(host);\n\n const fileTextChanges = languageService.organizeImports(\n { type: \"file\", fileName: tempFileName },\n { newLineCharacter: ts.sys.newLine },\n )[0];\n\n if (fileTextChanges?.textChanges.length) {\n return _.reduceRight(\n fileTextChanges.textChanges,\n (content, { span, newText }) =>\n `${content.slice(0, span.start)}${newText}${content.slice(\n span.start + span.length,\n )}`,\n content,\n );\n }\n\n return content;\n };\n\n /**\n * @param content\n * @returns {Promise<string>}\n */\n prettierFormat = async (content) => {\n const formatted = await prettier.format(\n content,\n this.config.prettierOptions,\n );\n return formatted;\n };\n\n formatCode = async (\n code,\n { removeUnusedImports = true, prettierFormat = true } = {},\n ) => {\n if (removeUnusedImports) {\n code = this.removeUnusedImports(code);\n }\n if (prettierFormat) {\n code = await this.prettierFormat(code);\n }\n return code;\n };\n}\n\nclass TsLanguageServiceHost {\n constructor(fileName, content) {\n const tsconfig = ts.findConfigFile(fileName, ts.sys.fileExists);\n\n Object.assign(this, {\n fileName,\n content,\n compilerOptions: tsconfig\n ? ts.convertCompilerOptionsFromJson(\n ts.readConfigFile(tsconfig, ts.sys.readFile).config.compilerOptions,\n ).options\n : ts.getDefaultCompilerOptions(),\n });\n }\n\n getNewLine() {\n return \"newLine\" in ts.sys ? ts.sys.newLine : \"\\n\";\n }\n getScriptFileNames() {\n return [this.fileName];\n }\n getCompilationSettings() {\n return this.compilerOptions;\n }\n getDefaultLibFileName() {\n return ts.getDefaultLibFileName(this.getCompilationSettings());\n }\n getCurrentDirectory() {\n return process.cwd();\n }\n getScriptVersion() {\n return ts.version;\n }\n getScriptSnapshot() {\n return ts.ScriptSnapshot.fromString(this.content);\n }\n readFile(fileName, encoding) {\n if (fileName === this.fileName) {\n return this.content;\n }\n\n return ts.sys.readFile(fileName, encoding);\n }\n fileExists(path) {\n return ts.sys.fileExists(path);\n }\n}\n\nexport { CodeFormatter };\n","import { cosmiconfigSync } from \"cosmiconfig\";\nimport _ from \"lodash\";\nimport ts from \"typescript\";\nimport { ComponentTypeNameResolver } from \"./component-type-name-resolver.js\";\nimport * as CONSTANTS from \"./constants.js\";\nimport { objectAssign } from \"./util/object-assign.js\";\n\nconst TsKeyword = {\n Number: \"number\",\n String: \"string\",\n Boolean: \"boolean\",\n Any: \"any\",\n Void: \"void\",\n Unknown: \"unknown\",\n Null: \"null\",\n Undefined: \"undefined\",\n Object: \"object\",\n File: \"File\",\n Date: \"Date\",\n Type: \"type\",\n Enum: \"enum\",\n Interface: \"interface\",\n Array: \"Array\",\n Record: \"Record\",\n Intersection: \"&\",\n Union: \"|\",\n};\n\nconst TsCodeGenKeyword = {\n UtilRequiredKeys: \"UtilRequiredKeys\",\n};\n\n/**\n * @type {GenerateApiConfiguration[\"config\"]}}\n */\nclass CodeGenConfig {\n version = CONSTANTS.PROJECT_VERSION;\n /** CLI flag */\n templates = \"\";\n /** CLI flag */\n generateResponses = false;\n /** CLI flag */\n defaultResponseAsSuccess = false;\n /** CLI flag */\n generateRouteTypes = false;\n /** CLI flag */\n generateClient = true;\n /** CLI flag */\n generateUnionEnums = false;\n /** CLI flag */\n addReadonly = false;\n enumNamesAsValues = false;\n /** parsed swagger schema from getSwaggerObject() */\n\n /** parsed swagger schema ref */\n swaggerSchema = null;\n /** original (converted to json) swagger schema ref */\n originalSchema = null;\n\n /** { \"#/components/schemas/Foo\": @TypeInfo, ... } */\n componentsMap = {};\n /** flag for catching conversion from swagger 2.0 */\n convertedFromSwagger2 = false;\n\n /** url index from paths used for merging into modules */\n moduleNameIndex = 0;\n\n /** use the first tag for the module name */\n moduleNameFirstTag = false;\n disableStrictSSL = false;\n disableProxy = false;\n extractRequestParams = false;\n extractRequestBody = false;\n extractResponseBody = false;\n extractResponseError = false;\n extractResponses = false;\n extractEnums = false;\n fileNames = {\n dataContracts: \"data-contracts\",\n routeTypes: \"route-types\",\n httpClient: \"http-client\",\n outOfModuleApi: \"Common\",\n };\n routeNameDuplicatesMap = new Map();\n prettierOptions = { ...CONSTANTS.PRETTIER_OPTIONS };\n hooks = {\n onPreBuildRoutePath: (routePath) => void 0,\n onBuildRoutePath: (routeData) => void 0,\n onInsertPathParam: (pathParam) => void 0,\n onCreateComponent: (schema) => schema,\n onPreParseSchema: (originalSchema, typeName, schemaType) => void 0,\n onParseSchema: (originalSchema, parsedSchema) => parsedSchema,\n onCreateRoute: (routeData) => routeData,\n onInit: (config, codeGenProcess) => config,\n onPrepareConfig: (apiConfig) => apiConfig,\n onCreateRequestParams: (rawType) => {},\n onCreateRouteName: () => {},\n onFormatTypeName: (typeName, rawTypeName, schemaType) => {},\n onFormatRouteName: (routeInfo, templateRouteName) => {},\n };\n defaultResponseType;\n singleHttpClient = false;\n httpClientType = CONSTANTS.HTTP_CLIENT.FETCH;\n unwrapResponseData = false;\n disableThrowOnError = false;\n sortTypes = false;\n sortRoutes = false;\n templatePaths = {\n /** `templates/base` */\n base: \"\",\n /** `templates/default` */\n default: \"\",\n /** `templates/modular` */\n modular: \"\",\n /** usage path if `--templates` option is not set */\n original: \"\",\n /** custom path to templates (`--templates`) */\n custom: \"\",\n };\n /** Record<templateName, templateContent> */\n templatesToRender = {\n api: \"\",\n dataContracts: \"\",\n dataContractJsDoc: \"\",\n interfaceDataContract: \"\",\n typeDataContract: \"\",\n enumDataContract: \"\",\n objectFieldJsDoc: \"\",\n httpClient: \"\",\n routeTypes: \"\",\n routeName: \"\",\n };\n /**\n * @type {Record<string, (...args: any[]) => MonoSchemaParser>}\n */\n schemaParsers = {};\n toJS = false;\n silent = false;\n typePrefix = \"\";\n typeSuffix = \"\";\n enumKeyPrefix = \"\";\n enumKeySuffix = \"\";\n patch = false;\n /** @type {ComponentTypeNameResolver} */\n componentTypeNameResolver;\n /** name of the main exported class */\n apiClassName = \"Api\";\n debug = false;\n anotherArrayType = false;\n internalTemplateOptions = {\n addUtilRequiredKeysType: false,\n };\n extraTemplates = [];\n input = \"\";\n modular = false;\n output = \"\";\n url = \"\";\n cleanOutput = false;\n spec = null;\n fileName = \"Api.ts\";\n authorizationToken = void 0;\n requestOptions = null;\n\n jsPrimitiveTypes = [];\n jsEmptyTypes = [];\n fixInvalidTypeNamePrefix = \"Type\";\n fixInvalidEnumKeyPrefix = \"Value\";\n\n enumKeyResolverName = \"Value\";\n typeNameResolverName = \"ComponentType\";\n specificArgNameResolverName = \"arg\";\n\n successResponseStatusRange = [200, 299];\n\n /** @type {ExtractingOptions} */\n extractingOptions = {\n requestBodySuffix: [\"Payload\", \"Body\", \"Input\"],\n requestParamsSuffix: [\"Params\"],\n responseBodySuffix: [\"Data\", \"Result\", \"Output\"],\n responseErrorSuffix: [\n \"Error\",\n \"Fail\",\n \"Fails\",\n \"ErrorData\",\n \"HttpError\",\n \"BadResponse\",\n ],\n enumSuffix: [\"Enum\"],\n discriminatorMappingSuffix: [\"Mapping\", \"Mapper\", \"MapType\"],\n discriminatorAbstractPrefix: [\n \"Base\",\n \"Abstract\",\n \"Discriminator\",\n \"Internal\",\n \"Polymorph\",\n ],\n };\n\n compilerTsConfig = {\n module: ts.ModuleKind.ESNext,\n noImplicitReturns: true,\n alwaysStrict: true,\n target: ts.ScriptTarget.ESNext,\n declaration: true,\n noImplicitAny: false,\n sourceMap: false,\n removeComments: false,\n disableSizeLimit: true,\n esModuleInterop: true,\n emitDecoratorMetadata: true,\n skipLibCheck: true,\n };\n customTranslator;\n\n Ts = {\n Keyword: _.cloneDeep(TsKeyword),\n CodeGenKeyword: _.cloneDeep(TsCodeGenKeyword),\n /**\n * $A[] or Array<$A>\n */\n ArrayType: (content) => {\n if (this.anotherArrayType) {\n return this.Ts.TypeWithGeneric(this.Ts.Keyword.Array, [content]);\n }\n\n return `${this.Ts.ExpressionGroup(content)}[]`;\n },\n /**\n * \"$A\"\n */\n StringValue: (content) => `\"${content}\"`,\n /**\n * $A\n */\n BooleanValue: (content) => `${content}`,\n /**\n * $A\n */\n NumberValue: (content) => `${content}`,\n /**\n * $A\n */\n NullValue: (content) => \"null\",\n /**\n * $A1 | $A2\n */\n UnionType: (contents) =>\n _.join(_.uniq(contents), ` ${this.Ts.Keyword.Union} `),\n /**\n * ($A1)\n */\n ExpressionGroup: (content) => (content ? `(${content})` : \"\"),\n /**\n * $A1 & $A2\n */\n IntersectionType: (contents) =>\n _.join(_.uniq(contents), ` ${this.Ts.Keyword.Intersection} `),\n /**\n * Record<$A1, $A2>\n */\n RecordType: (key, value) =>\n this.Ts.TypeWithGeneric(this.Ts.Keyword.Record, [key, value]),\n /**\n * readonly $key?:$value\n */\n TypeField: ({ readonly, key, optional, value }) =>\n _.compact([\n readonly && \"readonly \",\n key,\n optional && \"?\",\n \": \",\n value,\n ]).join(\"\"),\n /**\n * [key: $A1]: $A2\n */\n InterfaceDynamicField: (key, value) => `[key: ${key}]: ${value}`,\n\n /**\n * EnumName.EnumKey\n */\n EnumUsageKey: (enumStruct, key) => `${enumStruct}.${key}`,\n /**\n * $A1 = $A2\n */\n EnumField: (key, value) => `${key} = ${value}`,\n /**\n * $A0.key = $A0.value,\n * $A1.key = $A1.value,\n * $AN.key = $AN.value,\n */\n EnumFieldsWrapper: (contents) =>\n _.map(\n contents,\n ({ key, value }) => ` ${this.Ts.EnumField(key, value)}`,\n ).join(\",\\n\"),\n /**\n * {\\n $A \\n}\n */\n ObjectWrapper: (content) => `{\\n${content}\\n}`,\n /**\n * /** $A *\\/\n */\n MultilineComment: (contents, formatFn) =>\n [\n ...(contents.length === 1\n ? [`/** ${contents[0]} */`]\n : [\"/**\", ...contents.map((content) => ` * ${content}`), \" */\"]),\n ].map((part) => `${formatFn ? formatFn(part) : part}\\n`),\n /**\n * $A1<...$A2.join(,)>\n */\n TypeWithGeneric: (typeName, genericArgs) => {\n return `${typeName}${\n genericArgs.length ? `<${genericArgs.join(\",\")}>` : \"\"\n }`;\n },\n /**\n * [$A1, $A2, ...$AN]\n */\n Tuple: (values) => {\n return `[${values.join(\", \")}]`;\n },\n };\n\n /**\n * swagger schema type -> typescript type\n * https://json-schema.org/understanding-json-schema/reference/string.html#dates-and-times\n * @type {Record<string, string | ((schema: any, parser: SchemaParser) => string) | ({ $default: string } & Record<string, string | ((schema: any, parser: SchemaParser) => string)>)>}\n */\n primitiveTypes = {\n integer: () => this.Ts.Keyword.Number,\n number: () => this.Ts.Keyword.Number,\n boolean: () => this.Ts.Keyword.Boolean,\n object: () => this.Ts.Keyword.Object,\n file: () => this.Ts.Keyword.File,\n string: {\n $default: () => this.Ts.Keyword.String,\n\n /** formats */\n binary: () => this.Ts.Keyword.File,\n file: () => this.Ts.Keyword.File,\n \"date-time\": () => this.Ts.Keyword.String,\n time: () => this.Ts.Keyword.String,\n date: () => this.Ts.Keyword.String,\n duration: () => this.Ts.Keyword.String,\n email: () => this.Ts.Keyword.String,\n \"idn-email\": () => this.Ts.Keyword.String,\n \"idn-hostname\": () => this.Ts.Keyword.String,\n ipv4: () => this.Ts.Keyword.String,\n ipv6: () => this.Ts.Keyword.String,\n uuid: () => this.Ts.Keyword.String,\n uri: () => this.Ts.Keyword.String,\n \"uri-reference\": () => this.Ts.Keyword.String,\n \"uri-template\": () => this.Ts.Keyword.String,\n \"json-pointer\": () => this.Ts.Keyword.String,\n \"relative-json-pointer\": () => this.Ts.Keyword.String,\n regex: () => this.Ts.Keyword.String,\n },\n };\n\n templateInfos = [\n { name: \"api\", fileName: \"api\" },\n { name: \"dataContracts\", fileName: \"data-contracts\" },\n { name: \"dataContractJsDoc\", fileName: \"data-contract-jsdoc\" },\n { name: \"interfaceDataContract\", fileName: \"interface-data-contract\" },\n { name: \"typeDataContract\", fileName: \"type-data-contract\" },\n { name: \"enumDataContract\", fileName: \"enum-data-contract\" },\n { name: \"objectFieldJsDoc\", fileName: \"object-field-jsdoc\" },\n { name: \"httpClient\", fileName: \"http-client\" },\n { name: \"routeTypes\", fileName: \"route-types\" },\n { name: \"routeName\", fileName: \"route-name\" },\n ];\n\n templateExtensions = [\".eta\", \".ejs\"];\n\n /**\n * @param config {Partial<GenerateApiConfiguration['config']>}\n */\n constructor({\n prettierOptions = getDefaultPrettierOptions(),\n codeGenConstructs,\n primitiveTypeConstructs,\n constants,\n templateInfos,\n hooks,\n ...otherConfig\n }) {\n objectAssign(this.Ts, codeGenConstructs);\n objectAssign(this.primitiveTypes, primitiveTypeConstructs);\n\n this.defaultResponseType = this.Ts.Keyword.Void;\n\n this.update({\n ...otherConfig,\n prettierOptions:\n prettierOptions === undefined\n ? getDefaultPrettierOptions()\n : prettierOptions,\n hooks: _.merge(this.hooks, hooks || {}),\n constants: {\n ...CONSTANTS,\n ...constants,\n },\n templateInfos: templateInfos || this.templateInfos,\n });\n\n this.jsPrimitiveTypes = [\n this.Ts.Keyword.Number,\n this.Ts.Keyword.String,\n this.Ts.Keyword.Boolean,\n ];\n this.jsEmptyTypes = [this.Ts.Keyword.Null, this.Ts.Keyword.Undefined];\n this.componentTypeNameResolver = new ComponentTypeNameResolver(\n this,\n null,\n [],\n );\n }\n\n /**\n *\n * @param update {Partial<GenerateApiConfiguration[\"config\"]>}\n */\n update = (update) => {\n objectAssign(this, update);\n };\n}\n\nconst getDefaultPrettierOptions = () => {\n const prettier = cosmiconfigSync(\"prettier\", {\n searchStrategy: \"global\",\n }).search();\n\n if (prettier) {\n return {\n ...prettier.config,\n parser: \"typescript\",\n };\n }\n\n return { ...CONSTANTS.PRETTIER_OPTIONS };\n};\n\nexport { CodeGenConfig };\n","import _ from \"lodash\";\n\nclass NameResolver {\n reservedNames = [];\n getFallbackName = null;\n\n /** @type {CodeGenConfig} */\n config;\n /** @type {Logger} */\n logger;\n\n /**\n * @param {CodeGenConfig} config;\n * @param {Logger} logger;\n * @param {string[]} reservedNames\n */\n constructor(config, logger, reservedNames, getFallbackName) {\n this.config = config;\n this.logger = logger;\n this.getFallbackName = getFallbackName;\n this.reserve(reservedNames);\n }\n\n /**\n * @param {string[]} names\n */\n reserve(names) {\n const fixedNames = _.uniq(_.compact(names));\n for (const name of fixedNames) {\n if (this.reservedNames.indexOf(name) === -1) {\n this.reservedNames.push(name);\n }\n }\n }\n\n unreserve(names) {\n this.reservedNames.filter(\n (reservedName) => !names.some((name) => name === reservedName),\n );\n }\n\n isReserved(name) {\n return _.some(this.reservedNames, (reservedName) => reservedName === name);\n }\n\n /**\n *\n * @param {(string[])} variants\n * @param {(reserved: string[]) => string)} [resolver]\n * @param {any} [extras]\n * @returns {string | null}\n */\n resolve(variants, resolver, extras, shouldReserve = true) {\n if (typeof resolver === \"function\") {\n let usageName = null;\n while (usageName === null) {\n const variant = resolver(variants, extras);\n\n if (variant === undefined) {\n this.logger.warn(\n \"unable to resolve name. current reserved names: \",\n this.reservedNames,\n );\n return null;\n }\n if (!shouldReserve || !this.isReserved(variant)) {\n usageName = variant;\n }\n }\n\n shouldReserve && this.reserve([usageName]);\n return usageName;\n } else if (Array.isArray(variants)) {\n let usageName = null;\n const uniqVariants = _.uniq(_.compact(variants));\n\n _.forEach(uniqVariants, (variant) => {\n if (!usageName && (!shouldReserve || !this.isReserved(variant))) {\n usageName = variant;\n }\n });\n\n if (usageName) {\n shouldReserve && this.reserve([usageName]);\n return usageName;\n }\n\n this.logger.debug(\n \"trying to resolve name with using fallback name generator using variants\",\n variants,\n );\n return this.resolve(variants, this.getFallbackName, extras);\n }\n\n this.logger.debug(\n \"problem with reserving names. current reserved names: \",\n this.reservedNames,\n );\n return null;\n }\n}\n\nexport { NameResolver };\n","const getRandomFloat = (min = 0, max = 1) => {\n return Math.random() * (max - min) + min;\n};\n\nconst getRandomInt = (min = 0, max = 1) => {\n if (min === max) return min;\n\n return Math.round(getRandomFloat(min, max));\n};\n\nexport { getRandomInt, getRandomFloat };\n","import { NameResolver } from \"./util/name-resolver.js\";\nimport { getRandomInt } from \"./util/random.js\";\n\nclass ComponentTypeNameResolver extends NameResolver {\n counter = 1;\n fallbackNameCounter = 1;\n countersByVariant = new Map();\n\n /**\n * @param {CodeGenConfig} config;\n * @param {Logger} logger;\n * @param {string[]} reservedNames\n */\n constructor(config, logger, reservedNames) {\n super(config, logger, reservedNames, (variants) => {\n const randomVariant = variants[getRandomInt(0, variants.length - 1)];\n if (randomVariant) {\n if (!this.countersByVariant.has(randomVariant)) {\n this.countersByVariant.set(randomVariant, 0);\n }\n const variantCounter = this.countersByVariant.get(randomVariant) + 1;\n this.countersByVariant.set(randomVariant, variantCounter);\n const dirtyResolvedName = `${randomVariant}${variantCounter}`;\n this.logger.debug(\n \"generated dirty resolved type name for component - \",\n dirtyResolvedName,\n );\n return dirtyResolvedName;\n }\n\n const fallbackName = `${this.config.componentTypeNameResolver}${this\n .fallbackNameCounter++}`;\n this.logger.debug(\n \"generated fallback type name for component - \",\n fallbackName,\n );\n return fallbackName;\n });\n }\n}\n\nexport { ComponentTypeNameResolver };\n","import packageJson from \"../package.json\";\n\nconst DEFAULT_BODY_ARG_NAME = \"data\";\n\nconst FILE_PREFIX = `/* eslint-disable */\n/* tslint:disable */\n/*\n * ---------------------------------------------------------------\n * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##\n * ## ##\n * ## AUTHOR: acacode ##\n * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##\n * ---------------------------------------------------------------\n */\n\n`;\n\nconst HTTP_CLIENT = {\n FETCH: \"fetch\",\n AXIOS: \"axios\",\n};\n\nconst PRETTIER_OPTIONS = {\n printWidth: 120,\n tabWidth: 2,\n trailingComma: \"all\",\n parser: \"typescript\",\n};\n\nconst PROJECT_VERSION = packageJson.version;\n\nconst RESERVED_BODY_ARG_NAMES = [\"data\", \"body\", \"reqBody\"];\n\nconst RESERVED_HEADER_ARG_NAMES = [\"headers\", \"headersParams\"];\n\nconst RESERVED_PATH_ARG_NAMES = [\"path\", \"pathParams\"];\n\nconst RESERVED_QUERY_ARG_NAMES = [\"query\", \"queryParams\", \"queryArg\"];\n\nconst RESERVED_REQ_PARAMS_ARG_NAMES = [\n \"params\",\n \"requestParams\",\n \"reqParams\",\n \"httpParams\",\n];\n\nconst SCHEMA_TYPES = {\n ARRAY: \"array\",\n OBJECT: \"object\",\n ENUM: \"enum\",\n REF: \"$ref\",\n PRIMITIVE: \"primitive\",\n COMPLEX: \"complex\",\n DISCRIMINATOR: \"discriminator\",\n COMPLEX_ONE_OF: \"oneOf\",\n COMPLEX_ANY_OF: \"anyOf\",\n COMPLEX_ALL_OF: \"allOf\",\n COMPLEX_NOT: \"not\",\n COMPLEX_UNKNOWN: \"__unknown\",\n};\n\nexport {\n DEFAULT_BODY_ARG_NAME,\n FILE_PREFIX,\n HTTP_CLIENT,\n PRETTIER_OPTIONS,\n PROJECT_VERSION,\n RESERVED_BODY_ARG_NAMES,\n RESERVED_HEADER_ARG_NAMES,\n RESERVED_PATH_ARG_NAMES,\n RESERVED_QUERY_ARG_NAMES,\n RESERVED_REQ_PARAMS_ARG_NAMES,\n SCHEMA_TYPES,\n};\n","{\n \"name\": \"swagger-typescript-api\",\n \"version\": \"13.0.13\",\n \"description\": \"Generate the API client for Fetch or Axios from an OpenAPI Specification\",\n \"homepage\": \"https://github.com/acacode/swagger-typescript-api\",\n \"bugs\": \"https://github.com/acacode/swagger-typescript-api/issues\",\n \"repository\": \"github:acacode/swagger-typescript-api\",\n \"license\": \"MIT\",\n \"author\": \"Sergey Volkov <js2me@outlook.com>\",\n \"contributors\": [\n \"Sora Morimoto <sora@morimoto.io>\"\n ],\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": {\n \"types\": \"./dist/types.d.ts\",\n \"default\": \"./dist/lib.js\"\n },\n \"require\": {\n \"types\": \"./dist/types.d.cts\",\n \"default\": \"./dist/lib.cjs\"\n }\n }\n },\n \"main\": \"./dist/lib.cjs\",\n \"module\": \"./dist/lib.js\",\n \"types\": \"./dist/types.d.cts\",\n \"bin\": {\n \"sta\": \"./dist/cli.js\",\n \"swagger-typescript-api\": \"./dist/cli.js\"\n },\n \"files\": [\n \"dist\",\n \"templates\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"ci\": \"biome ci .\",\n \"cli:help\": \"node index.js -h\",\n \"cli:json\": \"node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts\",\n \"cli:yaml\": \"node index.js -r -d -p ./swagger-test-cli.yaml -n swagger-test-cli.ts\",\n \"format\": \"biome format --write .\",\n \"format:check\": \"biome format .\",\n \"test\": \"vitest run\"\n },\n \"dependencies\": {\n \"@types/swagger-schema-official\": \"^2.0.25\",\n \"cosmiconfig\": \"^9.0.0\",\n \"didyoumean\": \"^1.2.2\",\n \"eta\": \"^2.2.0\",\n \"js-yaml\": \"^4.1.0\",\n \"lodash\": \"^4.17.21\",\n \"nanoid\": \"^3.3.7\",\n \"node-emoji\": \"^2.1.3\",\n \"prettier\": \"~3.3.3\",\n \"swagger-schema-official\": \"2.0.0-bab6bed\",\n \"swagger2openapi\": \"^7.0.8\",\n \"typescript\": \"~5.5.3\"\n },\n \"devDependencies\": {\n \"@biomejs/biome\": \"1.8.3\",\n \"@tsconfig/node18\": \"18.2.4\",\n \"@tsconfig/strictest\": \"2.0.5\",\n \"@types/didyoumean\": \"1.2.2\",\n \"@types/js-yaml\": \"4.0.9\",\n \"@types/lodash\": \"4.17.6\",\n \"@types/node\": \"20.14.10\",\n \"@types/swagger2openapi\": \"7.0.4\",\n \"axios\": \"1.7.2\",\n \"shx\": \"0.3.4\",\n \"tsup\": \"8.1.0\",\n \"vitest\": \"2.0.3\"\n },\n \"packageManager\": \"yarn@4.3.1\",\n \"engines\": {\n \"node\": \">=18.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org\"\n }\n}\n","import _ from \"lodash\";\n\nconst objectAssign = (target, updaterFn) => {\n if (!updaterFn) return;\n const update =\n typeof updaterFn === \"function\" ? updaterFn(target) : updaterFn;\n const undefinedKeys = _.map(\n update,\n (value, key) => value === undefined && key,\n ).filter(Boolean);\n Object.assign(target, _.merge(target, update));\n undefinedKeys.forEach((key) => {\n target[key] = undefined;\n });\n};\n\nexport { objectAssign };\n","import _ from \"lodash\";\n\nclass SchemaComponentsMap {\n /** @type {SchemaComponent[]} */\n _data = [];\n /** @type {CodeGenConfig} */\n config;\n\n constructor({ config }) {\n this.config = config;\n }\n\n clear() {\n this._data = [];\n }\n\n createRef = (paths) => {\n return [\"#\", ...paths].join(\"/\");\n };\n\n parseRef = (ref) => {\n return ref.split(\"/\");\n };\n\n createComponent($ref, rawTypeData) {\n const parsed = this.parseRef($ref);\n const typeName = parsed[parsed.length - 1];\n const componentName = parsed[parsed.length - 2];\n const componentSchema = {\n $ref,\n typeName,\n rawTypeData,\n componentName,\n /** result from schema parser */\n typeData: null,\n };\n\n const usageComponent =\n this.config.hooks.onCreateComponent(componentSchema) || componentSchema;\n\n const refIndex = this._data.findIndex((c) => c.$ref === $ref);\n\n if (refIndex === -1) {\n this._data.push(usageComponent);\n } else {\n this._data[refIndex] = usageComponent;\n }\n\n return usageComponent;\n }\n\n /**\n * @returns {SchemaComponent[]}\n */\n getComponents() {\n return this._data;\n }\n\n /**\n * @params {...string[]} componentNames\n * @returns {SchemaComponent[]}\n */\n filter(...componentNames) {\n return _.filter(this._data, (it) =>\n componentNames.some((componentName) =>\n _.startsWith(it.$ref, `#/components/${componentName}`),\n ),\n );\n }\n\n get($ref) {\n return this._data.find((c) => c.$ref === $ref) || null;\n }\n}\n\nexport { SchemaComponentsMap };\n","import _ from \"lodash\";\nimport { SchemaFormatters } from \"./schema-formatters.js\";\nimport { SchemaParser } from \"./schema-parser.js\";\nimport { SchemaUtils } from \"./schema-utils.js\";\n\nclass SchemaParserFabric {\n /** @type {CodeGenConfig} */\n config;\n /** @type {Logger} */\n logger;\n /** @type {SchemaComponentsMap} */\n schemaComponentsMap;\n /** @type {TypeNameFormatter} */\n typeNameFormatter;\n /** @type {SchemaFormatters} */\n schemaFormatters;\n /** @type {TemplatesWorker} */\n templatesWorker;\n /** @type {SchemaUtils} */\n schemaUtils;\n /** @type {SchemaWalker} */\n schemaWalker;\n\n constructor({\n config,\n logger,\n templatesWorker,\n schemaComponentsMap,\n typeNameFormatter,\n schemaWalker,\n }) {\n this.config = config;\n this.logger = logger;\n this.schemaComponentsMap = schemaComponentsMap;\n this.typeNameFormatter = typeNameFormatter;\n this.templatesWorker = templatesWorker;\n this.schemaWalker = schemaWalker;\n this.schemaUtils = new SchemaUtils(this);\n this.schemaFormatters = new SchemaFormatters(this);\n }\n\n createSchemaParser = ({ schema, typeName, schemaPath }) => {\n return new SchemaParser(this, { schema, typeName, schemaPath });\n };\n\n /**\n *\n * @param content schema content\n * @param linkedSchema link content to attached schema\n * @param linkedComponent link content and other schema props to attached component\n * @param schemaPath\n * @param otherSchemaProps\n * @returns {{}}\n */\n createSchema = ({\n content,\n linkedSchema = {},\n linkedComponent,\n schemaPath,\n ...otherSchemaProps\n }) => {\n const parser = this.createSchemaParser({\n schema: linkedComponent || linkedSchema,\n schemaPath,\n });\n const parsed = parser.parseSchema();\n parsed.content = content;\n Object.assign(parsed, otherSchemaProps);\n if (linkedComponent) {\n linkedComponent.typeData = parsed;\n }\n return parser.schema;\n };\n\n createParsedComponent = ({ typeName, schema, schemaPath }) => {\n const schemaCopy = _.cloneDeep(schema);\n const customComponent = this.schemaComponentsMap.createComponent(\n this.schemaComponentsMap.createRef([\"components\", \"schemas\", typeName]),\n schemaCopy,\n );\n const parsed = this.parseSchema(schemaCopy, null, schemaPath);\n\n parsed.name = typeName;\n customComponent.typeData = parsed;\n\n return customComponent;\n };\n\n /**\n *\n * @param schema {any}\n * @param typeName {null | string}\n * @param [schemaPath] {string[]}\n * @return {Record<string, any>}\n */\n parseSchema = (schema, typeName = null, schemaPath = []) => {\n const schemaParser = this.createSchemaParser({\n schema,\n typeName,\n schemaPath,\n });\n return schemaParser.parseSchema();\n };\n\n /**\n *\n * @param schema {any}\n * @param typeName {null | string}\n * @param [schemaPath] {string[]}\n * @return {Record<string, any>}\n */\n getInlineParseContent = (schema, typeName, schemaPath) => {\n const parser = this.createSchemaParser({ schema, typeName, schemaPath });\n return parser.getInlineParseContent();\n };\n\n /**\n *\n * @param schema {any}\n * @param typeName {null | string}\n * @param [schemaPath] {string[]}\n * @return {Record<string, any>}\n */\n getParseContent = (schema, typeName, schemaPath) => {\n const parser = this.createSchemaParser({ schema, typeName, schemaPath });\n return parser.getParseContent();\n };\n}\n\nexport { SchemaParserFabric };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../constants.js\";\n\nclass SchemaFormatters {\n /** @type {CodeGenConfig} */\n config;\n /** @type {Logger} */\n logger;\n /** @type {TemplatesWorker} */\n templatesWorker;\n /** @type {SchemaUtils} */\n schemaUtils;\n\n /**\n * @param schemaParser {SchemaParser | SchemaParserFabric}\n */\n constructor(schemaParser) {\n this.config = schemaParser.config;\n this.logger = schemaParser.logger;\n this.schemaUtils = schemaParser.schemaUtils;\n this.templatesWorker = schemaParser.templatesWorker;\n }\n\n base = {\n [SCHEMA_TYPES.ENUM]: (parsedSchema) => {\n if (this.config.generateUnionEnums) {\n return {\n ...parsedSchema,\n $content: parsedSchema.content,\n content: this.config.Ts.UnionType(\n _.map(parsedSchema.content, ({ value }) => value),\n ),\n };\n }\n\n return {\n ...parsedSchema,\n $content: parsedSchema.content,\n content: this.config.Ts.EnumFieldsWrapper(parsedSchema.content),\n };\n },\n [SCHEMA_TYPES.OBJECT]: (parsedSchema) => {\n if (parsedSchema.nullable)\n return this.inline[SCHEMA_TYPES.OBJECT](parsedSchema);\n return {\n ...parsedSchema,\n $content: parsedSchema.content,\n content: this.formatObjectContent(parsedSchema.content),\n };\n },\n [SCHEMA_TYPES.PRIMITIVE]: (parsedSchema) => {\n return {\n ...parsedSchema,\n $content: parsedSchema.content,\n };\n },\n };\n inline = {\n [SCHEMA_TYPES.ENUM]: (parsedSchema) => {\n return {\n ...parsedSchema,\n content: parsedSchema.$ref\n ? parsedSchema.typeName\n : this.config.Ts.UnionType(\n _.compact([\n ..._.map(parsedSchema.content, ({ value }) => `${value}`),\n parsedSchema.nullable && this.config.Ts.Keyword.Null,\n ]),\n ) || this.config.Ts.Keyword.Any,\n };\n },\n [SCHEMA_TYPES.OBJECT]: (parsedSchema) => {\n if (_.isString(parsedSchema.content)) {\n return {\n ...parsedSchema,\n typeIdentifier: this.config.Ts.Keyword.Type,\n content: this.schemaUtils.safeAddNullToType(parsedSchema.content),\n };\n }\n\n return {\n ...parsedSchema,\n typeIdentifier: this.config.Ts.Keyword.Type,\n content: this.schemaUtils.safeAddNullToType(\n parsedSchema,\n parsedSchema.content.length\n ? this.config.Ts.ObjectWrapper(\n this.formatObjectContent(parsedSchema.content),\n )\n : this.config.Ts.RecordType(\n this.config.Ts.Keyword.String,\n this.config.Ts.Keyword.Any,\n ),\n ),\n };\n },\n };\n\n /**\n * @param parsedSchema {Record<string, any>}\n * @param formatType {\"base\" | \"inline\"}\n */\n formatSchema = (parsedSchema, formatType = \"base\") => {\n const schemaType =\n _.get(parsedSchema, [\"schemaType\"]) ||\n _.get(parsedSchema, [\"$parsed\", \"schemaType\"]);\n const formatterFn = _.get(this, [formatType, schemaType]);\n return formatterFn?.(parsedSchema) || parsedSchema;\n };\n\n formatDescription = (description, inline) => {\n if (!description) return \"\";\n\n let prettified = description;\n\n prettified = _.replace(prettified, /\\*\\//g, \"*/\");\n\n const hasMultipleLines = _.includes(prettified, \"\\n\");\n\n if (!hasMultipleLines) return prettified;\n\n if (inline) {\n return _(prettified)\n .split(/\\n/g)\n .map((part) => _.trim(part))\n .compact()\n .join(\" \")\n .valueOf();\n }\n\n return _.replace(prettified, /\\n$/g, \"\");\n };\n\n formatObjectContent = (content) => {\n const fields = [];\n\n for (const part of content) {\n const extraSpace = \" \";\n const result = `${extraSpace}${part.field},\\n`;\n\n const renderedJsDoc = this.templatesWorker.renderTemplate(\n this.config.templatesToRender.dataContractJsDoc,\n {\n data: part,\n },\n );\n\n const routeNameFromTemplate = renderedJsDoc\n .split(\"\\n\")\n .map((c) => `${extraSpace}${c}`)\n .join(\"\\n\");\n\n if (routeNameFromTemplate) {\n fields.push(`${routeNameFromTemplate}${result}`);\n } else {\n fields.push(`${result}`);\n }\n }\n\n return fields.join(\"\");\n };\n}\n\nexport { SchemaFormatters };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../constants.js\";\nimport { sortByProperty } from \"../util/sort-by-property.js\";\nimport { ArraySchemaParser } from \"./base-schema-parsers/array.js\";\nimport { ComplexSchemaParser } from \"./base-schema-parsers/complex.js\";\nimport { DiscriminatorSchemaParser } from \"./base-schema-parsers/discriminator.js\";\nimport { EnumSchemaParser } from \"./base-schema-parsers/enum.js\";\nimport { ObjectSchemaParser } from \"./base-schema-parsers/object.js\";\nimport { PrimitiveSchemaParser } from \"./base-schema-parsers/primitive.js\";\nimport { AllOfSchemaParser } from \"./complex-schema-parsers/all-of.js\";\nimport { AnyOfSchemaParser } from \"./complex-schema-parsers/any-of.js\";\nimport { NotSchemaParser } from \"./complex-schema-parsers/not.js\";\nimport { OneOfSchemaParser } from \"./complex-schema-parsers/one-of.js\";\nimport { SchemaFormatters } from \"./schema-formatters.js\";\nimport { SchemaUtils } from \"./schema-utils.js\";\n\nclass SchemaParser {\n /** @type {SchemaParserFabric} */\n schemaParserFabric;\n /** @type {CodeGenConfig} */\n config;\n /** @type {Logger} */\n logger;\n /** @type {SchemaComponentsMap} */\n schemaComponentsMap;\n /** @type {TypeNameFormatter} */\n typeNameFormatter;\n /** @type {SchemaFormatters} */\n schemaFormatters;\n /** @type {SchemaUtils} */\n schemaUtils;\n /** @type {TemplatesWorker} */\n templatesWorker;\n /** @type {SchemaWalker} */\n schemaWalker;\n\n typeName;\n schema;\n schemaPath = [];\n\n constructor(schemaParserFabric, { typeName, schema, schemaPath } = {}) {\n this.schemaParserFabric = schemaParserFabric;\n this.config = schemaParserFabric.config;\n this.logger = schemaParserFabric.logger;\n this.templatesWorker = schemaParserFabric.templatesWorker;\n this.schemaComponentsMap = schemaParserFabric.schemaComponentsMap;\n this.typeNameFormatter = schemaParserFabric.typeNameFormatter;\n this.schemaWalker = schemaParserFabric.schemaWalker;\n this.schemaFormatters = schemaParserFabric.schemaFormatters;\n this.schemaUtils = schemaParserFabric.schemaUtils;\n\n this.typeName = typeName || null;\n this.schema = schema;\n this.schemaPath = [...(schemaPath || [])];\n }\n\n _complexSchemaParsers = {\n [SCHEMA_TYPES.COMPLEX_ONE_OF]: (schema) => {\n const SchemaParser =\n this.config.schemaParsers.complexOneOf || OneOfSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n null,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.COMPLEX_ALL_OF]: (schema) => {\n const SchemaParser =\n this.config.schemaParsers.complexAllOf || AllOfSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n null,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.COMPLEX_ANY_OF]: (schema) => {\n const SchemaParser =\n this.config.schemaParsers.complexAnyOf || AnyOfSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n null,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.COMPLEX_NOT]: (schema) => {\n const SchemaParser =\n this.config.schemaParsers.complexNot || NotSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n null,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n };\n\n _baseSchemaParsers = {\n [SCHEMA_TYPES.ENUM]: (schema, typeName) => {\n const SchemaParser = this.config.schemaParsers.enum || EnumSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n typeName,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.OBJECT]: (schema, typeName) => {\n const SchemaParser =\n this.config.schemaParsers.object || ObjectSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n typeName,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.COMPLEX]: (schema, typeName) => {\n const SchemaParser =\n this.config.schemaParsers.complex || ComplexSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n typeName,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.PRIMITIVE]: (schema, typeName) => {\n const SchemaParser =\n this.config.schemaParsers.primitive || PrimitiveSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n typeName,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.DISCRIMINATOR]: (schema, typeName) => {\n const SchemaParser =\n this.config.schemaParsers.discriminator || DiscriminatorSchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n typeName,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n [SCHEMA_TYPES.ARRAY]: (schema, typeName) => {\n const SchemaParser = this.config.schemaParsers.array || ArraySchemaParser;\n const schemaParser = new SchemaParser(\n this,\n schema,\n typeName,\n this.schemaPath,\n );\n return schemaParser.parse();\n },\n };\n\n /**\n * @return {Record<string, any>}\n */\n parseSchema = () => {\n if (!this.schema)\n return this._baseSchemaParsers[SCHEMA_TYPES.PRIMITIVE](\n null,\n this.typeName,\n );\n\n let schemaType = null;\n let parsedSchema = null;\n\n if (typeof this.schema === \"string\") {\n return this.schema;\n }\n\n if (!this.schema.$parsed) {\n if (!this.typeName && this.schemaUtils.isRefSchema(this.schema)) {\n this.typeName = this.schemaUtils.getSchemaType(this.schema);\n }\n\n //#region swagger schemas fixes\n\n // schema has items but don't have array type\n if (\n this.schema.items &&\n !Array.isArray(this.schema.items) &&\n !this.schema.type\n ) {\n this.schema.type = SCHEMA_TYPES.ARRAY;\n }\n // schema is enum with one null value\n if (\n Array.isArray(this.schema.enum) &&\n this.schema.enum.length === 1 &&\n this.schema.enum[0] == null\n ) {\n this.logger.debug(\"invalid enum schema\", this.schema);\n this.schema = { type: this.config.Ts.Keyword.Null };\n }\n // schema is response schema\n if (\"content\" in this.schema && typeof this.schema.content === \"object\") {\n const schema = this.extractSchemaFromResponseStruct(this.schema);\n const schemaParser = this.schemaParserFabric.createSchemaParser({\n schema,\n typeName: this.typeName,\n schemaPath: this.schemaPath,\n });\n this.schema.$parsed = schemaParser.parseSchema();\n return this.schema.$parsed;\n }\n\n //#endregion\n\n schemaType = this.schemaUtils.getInternalSchemaType(this.schema);\n\n this.schemaPath.push(this.typeName);\n\n _.merge(\n this.schema,\n this.config.hooks.onPreParseSchema(\n this.schema,\n this.typeName,\n schemaType,\n ),\n );\n parsedSchema = this._baseSchemaParsers[schemaType](\n this.schema,\n this.typeName,\n );\n this.schema.$parsed =\n this.config.hooks.onParseSchema(this.schema, parsedSchema) ||\n parsedSchema;\n\n if (\n this.config.sortTypes &&\n Array.isArray(this.schema.$parsed?.content)\n ) {\n this.schema.$parsed.content = this.schema.$parsed.content.sort(\n sortByProperty(\"name\"),\n );\n }\n }\n\n this.schemaPath.pop();\n\n return this.schema.$parsed;\n };\n\n getInlineParseContent = () => {\n const parsedSchema = this.parseSchema();\n const formattedSchema = this.schemaFormatters.formatSchema(\n parsedSchema,\n \"inline\",\n );\n return formattedSchema.content;\n };\n\n getParseContent = () => {\n const parsedSchema = this.parseSchema();\n const formattedSchema = this.schemaFormatters.formatSchema(\n parsedSchema,\n \"base\",\n );\n return formattedSchema.content;\n };\n\n extractSchemaFromResponseStruct = (responseStruct) => {\n const { content, ...extras } = responseStruct;\n\n const firstResponse = _.first(_.values(content));\n const firstSchema = _.get(firstResponse, \"schema\");\n\n if (!firstSchema) return;\n\n return {\n ...extras,\n ..._.omit(firstResponse, \"schema\"),\n ...firstSchema,\n };\n };\n}\n\nexport { SchemaParser };\n","/**\n * @param propertyName {string}\n * @returns {(o1: Record<string, any>, o2: Record<string, any>) => 1 | -1 | 0}\n */\nconst sortByProperty = (propertyName) => (o1, o2) => {\n if (o1[propertyName] > o2[propertyName]) {\n return 1;\n }\n if (o1[propertyName] < o2[propertyName]) {\n return -1;\n }\n return 0;\n};\n\nexport { sortByProperty };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../../constants.js\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\nclass ArraySchemaParser extends MonoSchemaParser {\n parse() {\n let contentType;\n const { type, description, items } = this.schema || {};\n\n if (_.isArray(items) && type === SCHEMA_TYPES.ARRAY) {\n const tupleContent = [];\n for (const item of items) {\n tupleContent.push(\n this.schemaParserFabric\n .createSchemaParser({ schema: item, schemaPath: this.schemaPath })\n .getInlineParseContent(),\n );\n }\n contentType = this.config.Ts.Tuple(tupleContent);\n } else {\n const content = this.schemaParserFabric\n .createSchemaParser({ schema: items, schemaPath: this.schemaPath })\n .getInlineParseContent();\n contentType = this.config.Ts.ArrayType(content);\n }\n\n return {\n ...(_.isObject(this.schema) ? this.schema : {}),\n $schemaPath: this.schemaPath.slice(),\n $parsedSchema: true,\n schemaType: SCHEMA_TYPES.PRIMITIVE,\n type: SCHEMA_TYPES.PRIMITIVE,\n typeIdentifier: this.config.Ts.Keyword.Type,\n name: this.typeName,\n description: this.schemaFormatters.formatDescription(description),\n content: this.schemaUtils.safeAddNullToType(this.schema, contentType),\n };\n }\n}\n\nexport { ArraySchemaParser };\n","class MonoSchemaParser {\n schema;\n typeName;\n schemaPath;\n\n /** @type {Logger} */\n logger;\n /** @type {SchemaParser} */\n schemaParser;\n /** @type {SchemaParserFabric} */\n schemaParserFabric;\n /** @type {TypeNameFormatter} */\n typeNameFormatter;\n /** @type {SchemaComponentsMap} */\n schemaComponentsMap;\n /** @type {SchemaUtils} */\n schemaUtils;\n /** @type {CodeGenConfig} */\n config;\n /** @type {SchemaFormatters} */\n schemaFormatters;\n\n constructor(schemaParser, schema, typeName = null, schemaPath = []) {\n this.schemaParser = schemaParser;\n this.schemaParserFabric = schemaParser.schemaParserFabric;\n this.logger = schemaParser.logger;\n this.schema = schema;\n this.typeName = typeName;\n this.typeNameFormatter = schemaParser.typeNameFormatter;\n this.schemaPath = schemaPath;\n this.schemaComponentsMap = this.schemaParser.schemaComponentsMap;\n this.schemaUtils = this.schemaParser.schemaUtils;\n this.config = this.schemaParser.config;\n this.schemaFormatters = this.schemaParser.schemaFormatters;\n }\n\n parse() {\n throw new Error(\"not implemented\");\n }\n\n buildTypeNameFromPath = () => {\n return this.schemaUtils.buildTypeNameFromPath(this.schemaPath);\n };\n}\n\nexport { MonoSchemaParser };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../../constants.js\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\nclass ComplexSchemaParser extends MonoSchemaParser {\n parse() {\n const complexType = this.schemaUtils.getComplexType(this.schema);\n const simpleSchema = _.omit(\n _.clone(this.schema),\n _.keys(this.schemaParser._complexSchemaParsers),\n );\n const complexSchemaContent = this.schemaParser._complexSchemaParsers[\n complexType\n ](this.schema);\n\n return {\n ...(_.isObject(this.schema) ? this.schema : {}),\n $schemaPath: this.schemaPath.slice(),\n $parsedSchema: true,\n schemaType: SCHEMA_TYPES.COMPLEX,\n type: SCHEMA_TYPES.PRIMITIVE,\n typeIdentifier: this.config.Ts.Keyword.Type,\n name: this.typeName,\n description: this.schemaFormatters.formatDescription(\n this.schema.description ||\n _.compact(_.map(this.schema[complexType], \"description\"))[0] ||\n \"\",\n ),\n content:\n this.config.Ts.IntersectionType(\n _.compact([\n this.config.Ts.ExpressionGroup(complexSchemaContent),\n this.schemaUtils.getInternalSchemaType(simpleSchema) ===\n SCHEMA_TYPES.OBJECT &&\n this.config.Ts.ExpressionGroup(\n this.schemaParserFabric\n .createSchemaParser({\n schema: simpleSchema,\n schemaPath: this.schemaPath,\n })\n .getInlineParseContent(),\n ),\n ]),\n ) || this.config.Ts.Keyword.Any,\n };\n }\n}\n\nexport { ComplexSchemaParser };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../../constants.js\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\nclass DiscriminatorSchemaParser extends MonoSchemaParser {\n parse() {\n const ts = this.config.Ts;\n const { discriminator, ...noDiscriminatorSchema } = this.schema;\n\n if (!discriminator.mapping) {\n return this.schemaParserFabric\n .createSchemaParser({\n schema: noDiscriminatorSchema,\n typeName: this.typeName,\n schemaPath: this.schemaPath,\n })\n .parseSchema();\n }\n\n // https://github.com/acacode/swagger-typescript-api/issues/456\n // const skipMappingType = !!noDiscriminatorSchema.oneOf;\n const skipMappingType = false;\n\n const abstractSchemaStruct = this.createAbstractSchemaStruct();\n // const complexSchemaStruct = this.createComplexSchemaStruct();\n const discriminatorSchemaStruct = this.createDiscriminatorSchema({\n skipMappingType,\n abstractSchemaStruct,\n });\n\n const schemaContent = ts.IntersectionType(\n [\n abstractSchemaStruct?.content,\n discriminatorSchemaStruct?.content,\n ].filter(Boolean),\n );\n\n return {\n ...(_.isObject(this.schema) ? this.schema : {}),\n $schemaPath: this.schemaPath.slice(),\n $parsedSchema: true,\n schemaType: SCHEMA_TYPES.COMPLEX,\n type: SCHEMA_TYPES.PRIMITIVE,\n typeIdentifier: ts.Keyword.Type,\n name: this.typeName,\n description: this.schemaFormatters.formatDescription(\n this.schema.description,\n ),\n content: schemaContent,\n };\n }\n\n createDiscriminatorSchema = ({ skipMappingType, abstractSchemaStruct }) => {\n const ts = this.config.Ts;\n\n const refPath = this.schemaComponentsMap.createRef([\n \"components\",\n \"schemas\",\n this.typeName,\n ]);\n const { discriminator } = this.schema;\n const mappingEntries = _.entries(discriminator.mapping);\n const ableToCreateMappingType =\n !skipMappingType &&\n !!(abstractSchemaStruct?.typeName && mappingEntries.length);\n const mappingContents = [];\n let mappingTypeName;\n\n /** { mapping_key: SchemaEnum.MappingKey, ... } */\n const mappingPropertySchemaEnumKeysMap =\n this.createMappingPropertySchemaEnumKeys({\n abstractSchemaStruct,\n discPropertyName: discriminator.propertyName,\n });\n\n if (ableToCreateMappingType) {\n const rawTypeName = `${abstractSchemaStruct.typeName}_${discriminator.propertyName}`;\n const generatedTypeName = this.schemaUtils.resolveTypeName(rawTypeName, {\n suffixes: this.config.extractingOptions.discriminatorMappingSuffix,\n resolver:\n this.config.extractingOptions.discriminatorMappingNameResolver,\n });\n\n const content = ts.IntersectionType([\n ts.ObjectWrapper(\n ts.TypeField({\n key: ts.StringValue(discriminator.propertyName),\n value: \"Key\",\n }),\n ),\n \"Type\",\n ]);\n\n const component = this.schemaParserFabric.createParsedComponent({\n typeName: generatedTypeName,\n schema: {\n type: \"object\",\n properties: {},\n genericArgs: [{ name: \"Key\" }, { name: \"Type\" }],\n internal: true,\n },\n });\n\n component.typeData.content = content;\n\n mappingTypeName = this.typeNameFormatter.format(component.typeName);\n }\n\n /** returns (GenericType<\"mapping_key\", MappingType>) or ({ discriminatorProperty: \"mapping_key\" } & MappingType) */\n const createMappingContent = (mappingSchema, mappingKey) => {\n const content = this.schemaParserFabric\n .createSchemaParser({\n schema: mappingSchema,\n schemaPath: this.schemaPath,\n })\n .getInlineParseContent();\n\n const mappingUsageKey =\n mappingPropertySchemaEnumKeysMap[mappingKey] ||\n ts.StringValue(mappingKey);\n\n if (ableToCreateMappingType) {\n return ts.TypeWithGeneric(mappingTypeName, [mappingUsageKey, content]);\n } else {\n return ts.ExpressionGroup(\n ts.IntersectionType([\n ts.ObjectWrapper(\n ts.TypeField({\n key: discriminator.propertyName,\n value: mappingUsageKey,\n }),\n ),\n content,\n ]),\n );\n }\n };\n\n for (const [mappingKey, schema] of mappingEntries) {\n const mappingSchema =\n typeof schema === \"string\" ? { $ref: schema } : schema;\n\n this.mutateMappingDependentSchema({\n discPropertyName: discriminator.propertyName,\n abstractSchemaStruct,\n mappingSchema,\n refPath,\n mappingPropertySchemaEnumKeysMap,\n });\n\n mappingContents.push(createMappingContent(mappingSchema, mappingKey));\n }\n\n if (skipMappingType) return null;\n\n const content = ts.ExpressionGroup(ts.UnionType(mappingContents));\n\n return {\n content,\n };\n };\n\n createMappingPropertySchemaEnumKeys = ({\n abstractSchemaStruct,\n discPropertyName,\n }) => {\n const ts = this.config.Ts;\n\n let mappingPropertySchemaEnumKeysMap = {};\n let mappingPropertySchema = _.get(\n abstractSchemaStruct?.component?.rawTypeData,\n [\"properties\", discPropertyName],\n );\n if (this.schemaUtils.isRefSchema(mappingPropertySchema)) {\n mappingPropertySchema = this.schemaUtils.getSchemaRefType(\n mappingPropertySchema,\n );\n }\n\n if (\n mappingPropertySchema?.rawTypeData?.$parsed?.type === SCHEMA_TYPES.ENUM\n ) {\n mappingPropertySchemaEnumKeysMap = _.reduce(\n mappingPropertySchema.rawTypeData.$parsed.enum,\n (acc, key, index) => {\n const enumKey =\n mappingPropertySchema.rawTypeData.$parsed.content[index].key;\n acc[key] = ts.EnumUsageKey(\n mappingPropertySchema.rawTypeData.$parsed.typeName,\n enumKey,\n );\n return acc;\n },\n {},\n );\n }\n\n return mappingPropertySchemaEnumKeysMap;\n };\n\n mutateMappingDependentSchema = ({\n discPropertyName,\n abstractSchemaStruct,\n mappingSchema,\n refPath,\n mappingPropertySchemaEnumKeysMap,\n }) => {\n const complexSchemaKeys = _.keys(this.schemaParser._complexSchemaParsers);\n // override parent dependencies\n if (mappingSchema.$ref && abstractSchemaStruct?.component?.$ref) {\n const mappingRefSchema =\n this.schemaUtils.getSchemaRefType(mappingSchema)?.rawTypeData;\n if (mappingRefSchema) {\n complexSchemaKeys.forEach((schemaKey) => {\n if (_.isArray(mappingRefSchema[schemaKey])) {\n mappingRefSchema[schemaKey] = mappingRefSchema[schemaKey].map(\n (schema) => {\n if (schema.$ref === refPath) {\n return {\n ...schema,\n $ref: abstractSchemaStruct.component.$ref,\n };\n }\n if (\n this.schemaUtils.getInternalSchemaType(schema) ===\n SCHEMA_TYPES.OBJECT\n ) {\n for (const schemaPropertyName in schema.properties) {\n const schemaProperty =\n schema.properties[schemaPropertyName];\n if (\n schemaPropertyName === discPropertyName &&\n this.schemaUtils.getInternalSchemaType(schemaProperty) ===\n SCHEMA_TYPES.ENUM &&\n schemaProperty.enum.length === 1 &&\n mappingPropertySchemaEnumKeysMap[schemaProperty.enum[0]]\n ) {\n schema.properties[schemaPropertyName] =\n this.schemaParserFabric.createSchema({\n content:\n mappingPropertySchemaEnumKeysMap[\n schemaProperty.enum[0]\n ],\n });\n }\n }\n }\n return schema;\n },\n );\n }\n });\n }\n }\n };\n\n createAbstractSchemaStruct = () => {\n // eslint-disable-next-line no-unused-vars\n const { discriminator, ...noDiscriminatorSchema } = this.schema;\n const complexSchemaKeys = _.keys(this.schemaParser._complexSchemaParsers);\n const schema = _.omit(_.clone(noDiscriminatorSchema), complexSchemaKeys);\n const schemaIsAny =\n this.schemaParserFabric.getInlineParseContent(_.cloneDeep(schema)) ===\n this.config.Ts.Keyword.Any;\n const schemaIsEmpty = !_.keys(schema).length;\n\n if (schemaIsEmpty || schemaIsAny) return null;\n\n const typeName = this.schemaUtils.resolveTypeName(this.typeName, {\n prefixes: this.config.extractingOptions.discriminatorAbstractPrefix,\n resolver: this.config.extractingOptions.discriminatorAbstractResolver,\n });\n const component = this.schemaComponentsMap.createComponent(\n this.schemaComponentsMap.createRef([\"components\", \"schemas\", typeName]),\n {\n ...schema,\n internal: true,\n },\n );\n const content = this.schemaParserFabric\n .createSchemaParser({ schema: component, schemaPath: this.schemaPath })\n .getInlineParseContent();\n\n return {\n typeName,\n component,\n content,\n };\n };\n\n createComplexSchemaStruct = () => {\n const ts = this.config.Ts;\n const complexType = this.schemaUtils.getComplexType(this.schema);\n\n if (complexType === SCHEMA_TYPES.COMPLEX_UNKNOWN) return null;\n\n return {\n content: ts.ExpressionGroup(\n this.schemaParser._complexSchemaParsers[complexType](this.schema),\n ),\n };\n };\n}\n\nexport { DiscriminatorSchemaParser };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../../constants.js\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\nimport { EnumKeyResolver } from \"../util/enum-key-resolver.js\";\n\nclass EnumSchemaParser extends MonoSchemaParser {\n /** @type {EnumKeyResolver} */\n enumKeyResolver;\n\n constructor(...args) {\n super(...args);\n this.enumKeyResolver = new EnumKeyResolver(this.config, this.logger, []);\n }\n\n extractEnum = (pathTypeName) => {\n const generatedTypeName = this.schemaUtils.resolveTypeName(pathTypeName, {\n suffixes: this.config.extractingOptions.enumSuffix,\n resolver: this.config.extractingOptions.enumNameResolver,\n });\n const customComponent = this.schemaComponentsMap.createComponent(\n this.schemaComponentsMap.createRef([\n \"components\",\n \"schemas\",\n generatedTypeName,\n ]),\n {\n ...this.schema,\n },\n );\n return this.schemaParserFabric.parseSchema(customComponent);\n };\n\n parse() {\n const pathTypeName = this.buildTypeNameFromPath();\n\n if (this.config.extractEnums && !this.typeName && pathTypeName != null) {\n return this.extractEnum(pathTypeName);\n }\n\n const refType = this.schemaUtils.getSchemaRefType(this.schema);\n const $ref = refType?.$ref || null;\n\n // fix schema when enum has length 1+ but value is []\n if (Array.isArray(this.schema.enum)) {\n this.schema.enum = this.schema.enum.filter((key) => key != null);\n }\n\n if (Array.isArray(this.schema.enum) && Array.isArray(this.schema.enum[0])) {\n return this.schemaParserFabric.parseSchema(\n {\n oneOf: this.schema.enum.map((enumNames) => ({\n type: \"array\",\n items: enumNames.map((enumName) => ({\n type: \"string\",\n enum: [enumName],\n })),\n })),\n },\n this.typeName,\n this.schemaPath,\n );\n }\n\n const keyType = this.schemaUtils.getSchemaType(this.schema);\n const enumNames = this.schemaUtils.getEnumNames(this.schema);\n let content = null;\n\n const formatValue = (value) => {\n if (value === null) {\n return this.config.Ts.NullValue(value);\n }\n if (\n _.includes(keyType, this.schemaUtils.getSchemaType({ type: \"number\" }))\n ) {\n return this.config.Ts.NumberValue(value);\n }\n if (\n _.includes(keyType, this.schemaUtils.getSchemaType({ type: \"boolean\" }))\n ) {\n return this.config.Ts.BooleanValue(value);\n }\n\n return this.config.Ts.StringValue(value);\n };\n\n if (_.isArray(enumNames) && _.size(enumNames)) {\n content = _.map(enumNames, (enumName, index) => {\n const enumValue = _.get(this.schema.enum, index);\n const formattedKey = this.formatEnumKey({\n key: enumName,\n value: enumValue,\n });\n\n if (this.config.enumNamesAsValues || _.isUndefined(enumValue)) {\n return {\n key: formattedKey,\n type: this.config.Ts.Keyword.String,\n value: this.config.Ts.StringValue(enumName),\n };\n }\n\n return {\n key: formattedKey,\n type: keyType,\n value: formatValue(enumValue),\n };\n });\n } else {\n content = _.map(this.schema.enum, (value) => {\n return {\n key: this.formatEnumKey({ value }),\n type: keyType,\n value: formatValue(value),\n };\n });\n }\n\n return {\n ...(_.isObject(this.schema) ? this.schema : {}),\n $ref: $ref,\n typeName: this.typeName || ($ref && refType.typeName) || null,\n $parsedSchema: true,\n schemaType: SCHEMA_TYPES.ENUM,\n type: SCHEMA_TYPES.ENUM,\n keyType: keyType,\n typeIdentifier: this.config.generateUnionEnums\n ? this.config.Ts.Keyword.Type\n : this.config.Ts.Keyword.Enum,\n name: this.typeName,\n description: this.schemaFormatters.formatDescription(\n this.schema.description,\n ),\n content,\n };\n }\n\n formatEnumKey = ({ key, value }) => {\n let formatted;\n\n if (key) {\n formatted = this.typeNameFormatter.format(key, {\n type: \"enum-key\",\n });\n }\n\n if (!formatted) {\n formatted = this.typeNameFormatter.format(`${value}`, {\n type: \"enum-key\",\n });\n }\n\n return this.enumKeyResolver.resolve([formatted]);\n };\n}\n\nexport { EnumSchemaParser };\n","import { NameResolver } from \"../../util/name-resolver.js\";\n\nclass EnumKeyResolver extends NameResolver {\n counter = 1;\n /**\n * @param {CodeGenConfig} config;\n * @param {Logger} logger;\n * @param {string[]} reservedNames\n */\n constructor(config, logger, reservedNames) {\n super(config, logger, reservedNames, (variants) => {\n const generatedVariant =\n (variants[0] && `${variants[0]}${this.counter++}`) ||\n `${this.config.enumKeyResolverName}${this.counter++}`;\n this.logger.debug(\n \"generated fallback type name for enum key - \",\n generatedVariant,\n );\n return generatedVariant;\n });\n }\n}\n\nexport { EnumKeyResolver };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../../constants.js\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\nclass ObjectSchemaParser extends MonoSchemaParser {\n parse() {\n const contentProperties = this.getObjectSchemaContent(this.schema);\n\n return {\n ...(_.isObject(this.schema) ? this.schema : {}),\n $schemaPath: this.schemaPath.slice(),\n $parsedSchema: true,\n schemaType: SCHEMA_TYPES.OBJECT,\n type: SCHEMA_TYPES.OBJECT,\n typeIdentifier: this.config.Ts.Keyword.Interface,\n name: this.typeName,\n description: this.schemaFormatters.formatDescription(\n this.schema.description,\n ),\n allFieldsAreOptional: !_.some(\n _.values(contentProperties),\n (part) => part.isRequired,\n ),\n content: contentProperties,\n };\n }\n\n getObjectSchemaContent = (schema) => {\n const { properties, additionalProperties } = schema || {};\n\n const propertiesContent = _.map(properties, (property, name) => {\n const required = this.schemaUtils.isPropertyRequired(\n name,\n property,\n schema,\n );\n const rawTypeData = _.get(\n this.schemaUtils.getSchemaRefType(property),\n \"rawTypeData\",\n {},\n );\n const nullable = !!(rawTypeData.nullable || property.nullable);\n const fieldName = this.typeNameFormatter.isValidName(name)\n ? name\n : this.config.Ts.StringValue(name);\n const fieldValue = this.schemaParserFabric\n .createSchemaParser({\n schema: property,\n schemaPath: [...this.schemaPath, name],\n })\n .getInlineParseContent();\n const readOnly = property.readOnly;\n\n return {\n ...property,\n $$raw: property,\n title: property.title,\n description:\n property.description ||\n _.compact(\n _.map(\n property[this.schemaUtils.getComplexType(property)],\n \"description\",\n ),\n )[0] ||\n rawTypeData.description ||\n _.compact(\n _.map(\n rawTypeData[this.schemaUtils.getComplexType(rawTypeData)],\n \"description\",\n ),\n )[0] ||\n \"\",\n isRequired: required,\n isNullable: nullable,\n name: fieldName,\n value: fieldValue,\n field: this.config.Ts.TypeField({\n readonly: readOnly && this.config.addReadonly,\n optional: !required,\n key: fieldName,\n value: fieldValue,\n }),\n };\n });\n\n if (additionalProperties) {\n propertiesContent.push({\n $$raw: { additionalProperties },\n description: \"\",\n isRequired: false,\n field: this.config.Ts.InterfaceDynamicField(\n this.config.Ts.Keyword.String,\n this.config.Ts.Keyword.Any,\n ),\n });\n }\n\n return propertiesContent;\n };\n}\n\nexport { ObjectSchemaParser };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../../constants.js\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\nclass PrimitiveSchemaParser extends MonoSchemaParser {\n parse() {\n let contentType = null;\n const { additionalProperties, type, description, items } =\n this.schema || {};\n\n if (type === this.config.Ts.Keyword.Object && additionalProperties) {\n const fieldType = _.isObject(additionalProperties)\n ? this.schemaParserFabric\n .createSchemaParser({\n schema: additionalProperties,\n schemaPath: this.schemaPath,\n })\n .getInlineParseContent()\n : this.config.Ts.Keyword.Any;\n contentType = this.config.Ts.RecordType(\n this.config.Ts.Keyword.String,\n fieldType,\n );\n }\n\n if (_.isArray(type) && type.length) {\n contentType = this.schemaParser._complexSchemaParsers.oneOf({\n ...(_.isObject(this.schema) ? this.schema : {}),\n oneOf: type.map((type) => ({ type })),\n });\n }\n\n if (_.isArray(items) && type === SCHEMA_TYPES.ARRAY) {\n contentType = this.config.Ts.Tuple(\n items.map((item) =>\n this.schemaParserFabric\n .createSchemaParser({ schema: item, schemaPath: this.schemaPath })\n .getInlineParseContent(),\n ),\n );\n }\n\n return {\n ...(_.isObject(this.schema) ? this.schema : {}),\n $schemaPath: this.schemaPath.slice(),\n $parsedSchema: true,\n schemaType: SCHEMA_TYPES.PRIMITIVE,\n type: SCHEMA_TYPES.PRIMITIVE,\n typeIdentifier: this.config.Ts.Keyword.Type,\n name: this.typeName,\n description: this.schemaFormatters.formatDescription(description),\n // TODO: probably it should be refactored. `type === 'null'` is not flexible\n content:\n type === this.config.Ts.Keyword.Null\n ? type\n : contentType || this.schemaUtils.getSchemaType(this.schema),\n };\n }\n}\n\nexport { PrimitiveSchemaParser };\n","import _ from \"lodash\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\n// T1 & T2\nclass AllOfSchemaParser extends MonoSchemaParser {\n parse() {\n const ignoreTypes = [this.config.Ts.Keyword.Any];\n const combined = _.map(this.schema.allOf, (childSchema) =>\n this.schemaParserFabric.getInlineParseContent(\n this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema),\n null,\n this.schemaPath,\n ),\n );\n const filtered = this.schemaUtils.filterSchemaContents(\n combined,\n (content) => !ignoreTypes.includes(content),\n );\n\n const type = this.config.Ts.IntersectionType(filtered);\n\n return this.schemaUtils.safeAddNullToType(this.schema, type);\n }\n}\n\nexport { AllOfSchemaParser };\n","import _ from \"lodash\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\n// T1 | T2\nclass AnyOfSchemaParser extends MonoSchemaParser {\n parse() {\n const ignoreTypes = [this.config.Ts.Keyword.Any];\n const combined = _.map(this.schema.anyOf, (childSchema) =>\n this.schemaParserFabric.getInlineParseContent(\n this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema),\n null,\n this.schemaPath,\n ),\n );\n\n const filtered = this.schemaUtils.filterSchemaContents(\n combined,\n (content) => !ignoreTypes.includes(content),\n );\n\n const type = this.config.Ts.UnionType(filtered);\n\n return this.schemaUtils.safeAddNullToType(this.schema, type);\n }\n}\n\nexport { AnyOfSchemaParser };\n","import { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\nclass NotSchemaParser extends MonoSchemaParser {\n parse() {\n return this.config.Ts.Keyword.Any;\n }\n}\n\nexport { NotSchemaParser };\n","import _ from \"lodash\";\nimport { MonoSchemaParser } from \"../mono-schema-parser.js\";\n\n// T1 | T2\nclass OneOfSchemaParser extends MonoSchemaParser {\n parse() {\n const ignoreTypes = [this.config.Ts.Keyword.Any];\n const combined = _.map(this.schema.oneOf, (childSchema) =>\n this.schemaParserFabric.getInlineParseContent(\n this.schemaUtils.makeAddRequiredToChildSchema(this.schema, childSchema),\n null,\n this.schemaPath,\n ),\n );\n\n const filtered = this.schemaUtils.filterSchemaContents(\n combined,\n (content) => !ignoreTypes.includes(content),\n );\n\n const type = this.config.Ts.UnionType(filtered);\n\n return this.schemaUtils.safeAddNullToType(this.schema, type);\n }\n}\n\nexport { OneOfSchemaParser };\n","import _ from \"lodash\";\nimport { SCHEMA_TYPES } from \"../constants.js\";\nimport { internalCase } from \"../util/internal-case.js\";\nimport { pascalCase } from \"../util/pascal-case.js\";\n\nclass SchemaUtils {\n /** @type {CodeGenConfig} */\n config;\n /** @type {SchemaComponentsMap} */\n schemaComponentsMap;\n /** @type {TypeNameFormatter} */\n typeNameFormatter;\n /** @type {SchemaWalker} */\n schemaWalker;\n\n constructor({\n config,\n schemaComponentsMap,\n typeNameFormatter,\n schemaWalker,\n }) {\n this.config = config;\n this.schemaComponentsMap = schemaComponentsMap;\n this.typeNameFormatter = typeNameFormatter;\n this.schemaWalker = schemaWalker;\n }\n\n getRequiredProperties = (schema) => {\n return _.uniq(\n (schema && _.isArray(schema.required) && schema.required) || [],\n );\n };\n\n isRefSchema = (schema) => {\n return !!schema?.$ref;\n };\n\n getEnumNames = (schema) => {\n return (\n schema[\"x-enumNames\"] ||\n schema.xEnumNames ||\n schema[\"x-enumnames\"] ||\n schema[\"x-enum-varnames\"]\n );\n };\n\n getSchemaRefType = (schema) => {\n if (!this.isRefSchema(schema)) return null;\n // const resolved = this.schemaWalker.findByRef(schema.$ref);\n return this.schemaComponentsMap.get(schema.$ref);\n };\n\n isPropertyRequired = (name, propertySchema, rootSchema) => {\n if (propertySchema[\"x-omitempty\"] === false) {\n return true;\n }\n\n const isRequired = _.isBoolean(propertySchema.required)\n ? !!propertySchema.required\n : _.isArray(rootSchema.required)\n ? rootSchema.required.includes(name)\n : !!rootSchema.required;\n\n if (this.config.convertedFromSwagger2) {\n return typeof propertySchema.nullable === this.config.Ts.Keyword.Undefined\n ? isRequired\n : !propertySchema.nullable;\n }\n return isRequired;\n };\n\n isNullMissingInType = (schema, type) => {\n const { nullable, type: schemaType } = schema || {};\n return (\n (nullable ||\n !!_.get(schema, \"x-nullable\") ||\n schemaType === this.config.Ts.Keyword.Null) &&\n _.isString(type) &&\n !type.includes(` ${this.config.Ts.Keyword.Null}`) &&\n !type.includes(`${this.config.Ts.Keyword.Null} `)\n );\n };\n\n safeAddNullToType = (schema, type) => {\n if (this.isNullMissingInType(schema, type)) {\n return this.config.Ts.UnionType([type, this.config.Ts.Keyword.Null]);\n }\n return type;\n };\n\n getSchemaPrimitiveType = (rawSchema) => {\n const schema = rawSchema || {};\n\n if (schema.type) {\n return internalCase(schema.type);\n }\n if (schema.enum) {\n const enumFieldType = typeof schema.enum[0];\n if (enumFieldType === this.config.Ts.Keyword.Undefined) return;\n\n return internalCase(enumFieldType);\n }\n if (_.keys(schema.properties).length) {\n return SCHEMA_TYPES.OBJECT;\n }\n if (schema.items) {\n return SCHEMA_TYPES.ARRAY;\n }\n\n return null;\n };\n\n checkAndAddRequiredKeys = (schema, resultType) => {\n if (\"$$requiredKeys\" in schema && schema.$$requiredKeys.length) {\n this.config.update({\n internalTemplateOptions: {\n addUtilRequiredKeysType: true,\n },\n });\n return this.config.Ts.TypeWithGeneric(\n this.config.Ts.CodeGenKeyword.UtilRequiredKeys,\n [\n resultType,\n this.config.Ts.UnionType(\n schema.$$requiredKeys.map(this.config.Ts.StringValue),\n ),\n ],\n );\n }\n\n return resultType;\n };\n\n makeAddRequiredToChildSchema = (parentSchema, childSchema) => {\n if (!childSchema) return childSchema;\n\n const required = _.uniq([\n ...this.getRequiredProperties(parentSchema),\n ...this.getRequiredProperties(childSchema),\n ]);\n\n const refData = this.getSchemaRefType(childSchema);\n\n if (refData) {\n const refObjectProperties = _.keys(refData.rawTypeData?.properties || {});\n const existedRequiredKeys = refObjectProperties.filter((key) =>\n required.includes(key),\n );\n\n if (!existedRequiredKeys.length) return childSchema;\n\n return {\n ...childSchema,\n $$requiredKeys: existedRequiredKeys,\n };\n } else if (childSchema.properties) {\n const childSchemaProperties = _.keys(childSchema.properties);\n const existedRequiredKeys = childSchemaProperties.filter((key) =>\n required.includes(key),\n );\n\n if (!existedRequiredKeys.length) return childSchema;\n\n return {\n required: _.uniq([\n ...this.getRequiredProperties(childSchema),\n ...existedRequiredKeys,\n ]),\n ...childSchema,\n };\n }\n\n return childSchema;\n };\n\n filterSchemaContents = (contents, filterFn) => {\n return _.uniq(_.filter(contents, (type) => filterFn(type)));\n };\n\n resolveTypeName = (\n typeName,\n { suffixes, resolver, prefixes, shouldReserve = true },\n ) => {\n if (resolver) {\n return this.config.componentTypeNameResolver.resolve(null, (reserved) => {\n return resolver(pascalCase(typeName), reserved);\n });\n } else {\n return this.config.componentTypeNameResolver.resolve(\n [\n ...(prefixes || []).map((prefix) =>\n pascalCase(`${prefix} ${typeName}`),\n ),\n ...(suffixes || []).map((suffix) =>\n pascalCase(`${typeName} ${suffix}`),\n ),\n ],\n shouldReserve,\n );\n }\n };\n\n getComplexType = (schema) => {\n if (schema.oneOf) return SCHEMA_TYPES.COMPLEX_ONE_OF;\n if (schema.allOf) return SCHEMA_TYPES.COMPLEX_ALL_OF;\n if (schema.anyOf) return SCHEMA_TYPES.COMPLEX_ANY_OF;\n // TODO :(\n if (schema.not) return SCHEMA_TYPES.COMPLEX_NOT;\n\n return SCHEMA_TYPES.COMPLEX_UNKNOWN;\n };\n\n getInternalSchemaType = (schema) => {\n if (!_.isEmpty(schema.enum) || !_.isEmpty(this.getEnumNames(schema))) {\n return SCHEMA_TYPES.ENUM;\n }\n if (schema.discriminator) {\n return SCHEMA_TYPES.DISCRIMINATOR;\n }\n if (schema.allOf || schema.oneOf || schema.anyOf || schema.not) {\n return SCHEMA_TYPES.COMPLEX;\n }\n if (!_.isEmpty(schema.properties)) {\n return SCHEMA_TYPES.OBJECT;\n }\n if (schema.type === SCHEMA_TYPES.ARRAY) {\n return SCHEMA_TYPES.ARRAY;\n }\n\n return SCHEMA_TYPES.PRIMITIVE;\n };\n\n getSchemaType = (schema) => {\n if (!schema) return this.config.Ts.Keyword.Any;\n\n const refTypeInfo = this.getSchemaRefType(schema);\n\n if (refTypeInfo) {\n return this.checkAndAddRequiredKeys(\n schema,\n this.safeAddNullToType(\n schema,\n this.typeNameFormatter.format(refTypeInfo.typeName),\n ),\n );\n }\n\n let resultType;\n\n if (this.isConstantSchema(schema)) {\n resultType = this.formatJsValue(schema.const);\n } else {\n const primitiveType = this.getSchemaPrimitiveType(schema);\n\n if (primitiveType == null) {\n return this.config.Ts.Keyword.Any;\n }\n\n const typeAlias =\n _.get(this.config.primitiveTypes, [primitiveType, schema.format]) ||\n _.get(this.config.primitiveTypes, [primitiveType, \"$default\"]) ||\n this.config.primitiveTypes[primitiveType];\n\n if (_.isFunction(typeAlias)) {\n resultType = typeAlias(schema, this);\n } else {\n resultType = typeAlias || primitiveType;\n }\n }\n\n if (!resultType) {\n return this.config.Ts.Keyword.Any;\n }\n\n return this.checkAndAddRequiredKeys(\n schema,\n this.safeAddNullToType(schema, resultType),\n );\n };\n\n buildTypeNameFromPath = (schemaPath) => {\n schemaPath = _.uniq(_.compact(schemaPath));\n\n if (!schemaPath || !schemaPath[0]) return null;\n\n return pascalCase(\n _.camelCase(\n _.uniq([schemaPath[0], schemaPath[schemaPath.length - 1]]).join(\"_\"),\n ),\n );\n };\n\n isConstantSchema(schema) {\n return \"const\" in schema;\n }\n\n formatJsValue = (value) => {\n switch (typeof value) {\n case \"string\": {\n return this.config.Ts.StringValue(value);\n }\n case \"boolean\": {\n return this.config.Ts.BooleanValue(value);\n }\n case \"number\": {\n return this.config.Ts.NumberValue(value);\n }\n default: {\n if (value === null) {\n return this.config.Ts.NullValue(value);\n }\n\n return this.config.Ts.Keyword.Any;\n }\n }\n };\n}\n\nexport { SchemaUtils };\n","import _ from \"lodash\";\n\nfunction internalCase(value) {\n return _.camelCase(_.lowerCase(value));\n}\n\nexport { internalCase };\n","import _ from \"lodash\";\n\nfunction pascalCase(value) {\n return _.upperFirst(_.camelCase(value));\n}\n\nexport { pascalCase };\n","import _ from \"lodash\";\nimport {\n DEFAULT_BODY_ARG_NAME,\n RESERVED_BODY_ARG_NAMES,\n RESERVED_HEADER_ARG_NAMES,\n RESERVED_PATH_ARG_NAMES,\n RESERVED_QUERY_ARG_NAMES,\n} from \"../constants.js\";\nimport { generateId } from \"../util/id.js\";\nimport { SpecificArgNameResolver } from \"./util/specific-arg-name-resolver.js\";\n\nconst CONTENT_KIND = {\n JSON: \"JSON\",\n URL_ENCODED: \"URL_ENCODED\",\n FORM_DATA: \"FORM_DATA\",\n IMAGE: \"IMAGE\",\n OTHER: \"OTHER\",\n TEXT: \"TEXT\",\n};\n\nclass SchemaRoutes {\n /**\n * @type {CodeGenConfig}\n */\n config;\n /**\n * @type {SchemaParserFabric}\n */\n schemaParserFabric;\n /**\n * @type {SchemaUtils}\n */\n schemaUtils;\n /**\n * @type {TypeNameFormatter}\n */\n typeNameFormatter;\n /**\n * @type {SchemaComponentsMap}\n */\n schemaComponentsMap;\n /**\n * @type {Logger}\n */\n logger;\n /**\n * @type {TemplatesWorker}\n */\n templatesWorker;\n\n FORM_DATA_TYPES = [];\n\n routes = [];\n hasSecurityRoutes = false;\n hasQueryRoutes = false;\n hasFormDataRoutes = false;\n\n constructor({\n config,\n schemaParserFabric,\n schemaComponentsMap,\n logger,\n templatesWorker,\n typeNameFormatter,\n }) {\n this.config = config;\n this.schemaParserFabric = schemaParserFabric;\n this.schemaUtils = this.schemaParserFabric.schemaUtils;\n this.typeNameFormatter = typeNameFormatter;\n this.schemaComponentsMap = schemaComponentsMap;\n this.logger = logger;\n this.templatesWorker = templatesWorker;\n\n this.FORM_DATA_TYPES = _.uniq([\n this.schemaUtils.getSchemaType({ type: \"string\", format: \"file\" }),\n this.schemaUtils.getSchemaType({ type: \"string\", format: \"binary\" }),\n ]);\n }\n\n createRequestsMap = (routeInfoByMethodsMap) => {\n const parameters = _.get(routeInfoByMethodsMap, \"parameters\");\n\n return _.reduce(\n routeInfoByMethodsMap,\n (acc, requestInfo, method) => {\n if (\n _.startsWith(method, \"x-\") ||\n [\"parameters\", \"$ref\"].includes(method)\n ) {\n return acc;\n }\n\n acc[method] = {\n ...requestInfo,\n parameters: _.compact(_.concat(parameters, requestInfo.parameters)),\n };\n\n return acc;\n },\n {},\n );\n };\n\n parseRouteName = (originalRouteName) => {\n const routeName =\n this.config.hooks.onPreBuildRoutePath(originalRouteName) ||\n originalRouteName;\n\n const pathParamMatches = (routeName || \"\").match(\n /({(([A-z]){1}([a-zA-Z0-9]-?_?\\.?)+)([0-9]+)?})|(:(([A-z]){1}([a-zA-Z0-9]-?_?\\.?)+)([0-9]+)?:?)/g,\n );\n\n // used in case when path parameters is not declared in requestInfo.parameters (\"in\": \"path\")\n const pathParams = _.reduce(\n pathParamMatches,\n (pathParams, match) => {\n const paramName = _.replace(match, /\\{|\\}|:/g, \"\");\n\n if (!paramName) return pathParams;\n\n if (_.includes(paramName, \"-\")) {\n this.logger.warn(\"wrong path param name\", paramName);\n }\n\n pathParams.push({\n $match: match,\n name: _.camelCase(paramName),\n required: true,\n type: \"string\",\n description: \"\",\n schema: {\n type: \"string\",\n },\n in: \"path\",\n });\n\n return pathParams;\n },\n [],\n );\n\n let fixedRoute = _.reduce(\n pathParams,\n (fixedRoute, pathParam, i, arr) => {\n const insertion =\n this.config.hooks.onInsertPathParam(\n pathParam.name,\n i,\n arr,\n fixedRoute,\n ) || pathParam.name;\n return _.replace(fixedRoute, pathParam.$match, `\\${${insertion}}`);\n },\n routeName || \"\",\n );\n\n const queryParamMatches = fixedRoute.match(/(\\{\\?.*\\})/g);\n const queryParams = [];\n\n if (queryParamMatches?.length) {\n queryParamMatches.forEach((match) => {\n fixedRoute = fixedRoute.replace(match, \"\");\n });\n\n _.uniq(\n queryParamMatches\n .join(\",\")\n .replace(/(\\{\\?)|(\\})|\\s/g, \"\")\n .split(\",\"),\n ).forEach((paramName) => {\n if (_.includes(paramName, \"-\")) {\n this.logger.warn(\"wrong query param name\", paramName);\n }\n\n queryParams.push({\n $match: paramName,\n name: _.camelCase(paramName),\n required: true,\n type: \"string\",\n description: \"\",\n schema: {\n type: \"string\",\n },\n in: \"query\",\n });\n });\n }\n\n const result = {\n originalRoute: originalRouteName || \"\",\n route: fixedRoute,\n pathParams,\n queryParams,\n };\n\n return this.config.hooks.onBuildRoutePath(result) || result;\n };\n\n getRouteParams = (\n routeInfo,\n pathParamsFromRouteName,\n queryParamsFromRouteName,\n ) => {\n const { parameters } = routeInfo;\n\n const routeParams = {\n path: [],\n header: [],\n body: [],\n query: [],\n formData: [],\n cookie: [],\n };\n\n _.each(parameters, (parameter) => {\n const refTypeInfo =\n this.schemaParserFabric.schemaUtils.getSchemaRefType(parameter);\n let routeParam = null;\n\n if (refTypeInfo?.rawTypeData.in && refTypeInfo.rawTypeData) {\n if (!routeParams[refTypeInfo.rawTypeData.in]) {\n routeParams[refTypeInfo.rawTypeData.in] = [];\n }\n\n routeParam = {\n ...refTypeInfo.rawTypeData,\n ...(refTypeInfo.rawTypeData.schema || {}),\n };\n } else {\n if (!parameter.in) return;\n\n if (!routeParams[parameter.in]) {\n routeParams[parameter.in] = [];\n }\n\n routeParam = {\n ...parameter,\n ...(parameter.schema || {}),\n };\n }\n\n if (routeParam.in === \"path\") {\n if (!routeParam.name) return;\n\n routeParam.name = _.camelCase(routeParam.name);\n }\n\n if (routeParam) {\n routeParams[routeParam.in].push(routeParam);\n }\n });\n\n // used in case when path parameters is not declared in requestInfo.parameters (\"in\": \"path\")\n _.each(pathParamsFromRouteName, (pathParam) => {\n const alreadyExist = _.some(\n routeParams.path,\n (parameter) => parameter.name === pathParam.name,\n );\n\n if (!alreadyExist) {\n routeParams.path.push(pathParam);\n }\n });\n // used in case when path parameters is not declared in requestInfo.parameters (\"in\": \"path\")\n _.each(queryParamsFromRouteName, (queryParam) => {\n const alreadyExist = _.some(\n routeParams.query,\n (parameter) => parameter.name === queryParam.name,\n );\n\n if (!alreadyExist) {\n routeParams.query.push(queryParam);\n }\n });\n\n return routeParams;\n };\n\n getContentTypes = (requestInfo, extraContentTypes) =>\n _.uniq(\n _.compact([\n ...(extraContentTypes || []),\n ..._.flatten(\n _.map(\n requestInfo,\n (requestInfoData) =>\n requestInfoData && _.keys(requestInfoData.content),\n ),\n ),\n ]),\n );\n\n getContentKind = (contentTypes) => {\n if (\n _.some(contentTypes, (contentType) =>\n _.startsWith(contentType, \"application/json\"),\n ) ||\n _.some(contentTypes, (contentType) => _.endsWith(contentType, \"+json\"))\n ) {\n return CONTENT_KIND.JSON;\n }\n\n if (contentTypes.includes(\"application/x-www-form-urlencoded\")) {\n return CONTENT_KIND.URL_ENCODED;\n }\n\n if (contentTypes.includes(\"multipart/form-data\")) {\n return CONTENT_KIND.FORM_DATA;\n }\n\n if (\n _.some(contentTypes, (contentType) => _.includes(contentType, \"image/\"))\n ) {\n return CONTENT_KIND.IMAGE;\n }\n\n if (\n _.some(contentTypes, (contentType) => _.startsWith(contentType, \"text/\"))\n ) {\n return CONTENT_KIND.TEXT;\n }\n\n return CONTENT_KIND.OTHER;\n };\n\n isSuccessStatus = (status) =>\n (this.config.defaultResponseAsSuccess && status === \"default\") ||\n (+status >= this.config.successResponseStatusRange[0] &&\n +status <= this.config.successResponseStatusRange[1]) ||\n status === \"2xx\";\n\n getSchemaFromRequestType = (requestInfo) => {\n const content = _.get(requestInfo, \"content\");\n\n if (!content) return null;\n\n /* content: { \"multipart/form-data\": { schema: {...} }, \"application/json\": { schema: {...} } } */\n\n /* for example: dataType = \"multipart/form-data\" */\n for (const dataType in content) {\n if (content[dataType]?.schema) {\n return {\n ...content[dataType].schema,\n dataType,\n };\n }\n }\n\n return null;\n };\n\n getTypeFromRequestInfo = ({\n requestInfo,\n parsedSchemas,\n operationId,\n defaultType,\n typeName,\n }) => {\n // TODO: make more flexible pick schema without content type\n const schema = this.getSchemaFromRequestType(requestInfo);\n const refTypeInfo =\n this.schemaParserFabric.schemaUtils.getSchemaRefType(requestInfo);\n\n if (schema) {\n const content = this.schemaParserFabric.getInlineParseContent(\n schema,\n typeName,\n [operationId],\n );\n const foundedSchemaByName = _.find(\n parsedSchemas,\n (parsedSchema) =>\n this.typeNameFormatter.format(parsedSchema.name) === content,\n );\n const foundSchemaByContent = _.find(parsedSchemas, (parsedSchema) =>\n _.isEqual(parsedSchema.content, content),\n );\n\n const foundSchema = foundedSchemaByName || foundSchemaByContent;\n\n return foundSchema\n ? this.typeNameFormatter.format(foundSchema.name)\n : content;\n }\n\n if (refTypeInfo) {\n // const refTypeWithoutOpId = refType.replace(operationId, '');\n // const foundedSchemaByName = _.find(parsedSchemas, ({ name }) => name === refType || name === refTypeWithoutOpId)\n\n // TODO:HACK fix problem of swagger2opeanpi\n const typeNameWithoutOpId = _.replace(\n refTypeInfo.typeName,\n operationId,\n \"\",\n );\n if (\n _.find(parsedSchemas, (schema) => schema.name === typeNameWithoutOpId)\n ) {\n return this.typeNameFormatter.format(typeNameWithoutOpId);\n }\n\n switch (refTypeInfo.componentName) {\n case \"schemas\":\n return this.typeNameFormatter.format(refTypeInfo.typeName);\n case \"responses\":\n case \"requestBodies\":\n return this.schemaParserFabric.getInlineParseContent(\n this.getSchemaFromRequestType(refTypeInfo.rawTypeData),\n refTypeInfo.typeName || null,\n [operationId],\n );\n default:\n return this.schemaParserFabric.getInlineParseContent(\n refTypeInfo.rawTypeData,\n refTypeInfo.typeName || null,\n [operationId],\n );\n }\n }\n\n return defaultType || this.config.Ts.Keyword.Any;\n };\n\n getRequestInfoTypes = ({\n requestInfos,\n parsedSchemas,\n operationId,\n defaultType,\n }) =>\n _.reduce(\n requestInfos,\n (acc, requestInfo, status) => {\n const contentTypes = this.getContentTypes([requestInfo]);\n\n return [\n ...acc,\n {\n ...(requestInfo || {}),\n contentTypes: contentTypes,\n contentKind: this.getContentKind(contentTypes),\n type: this.schemaParserFabric.schemaUtils.safeAddNullToType(\n requestInfo,\n this.getTypeFromRequestInfo({\n requestInfo,\n parsedSchemas,\n operationId,\n defaultType,\n }),\n ),\n description:\n this.schemaParserFabric.schemaFormatters.formatDescription(\n requestInfo.description || \"\",\n true,\n ),\n status: _.isNaN(+status) ? status : +status,\n isSuccess: this.isSuccessStatus(status),\n },\n ];\n },\n [],\n );\n\n getResponseBodyInfo = (routeInfo, parsedSchemas) => {\n const { produces, operationId, responses } = routeInfo;\n\n const contentTypes = this.getContentTypes(responses, [\n ...(produces || []),\n routeInfo[\"x-accepts\"],\n ]);\n\n const responseInfos = this.getRequestInfoTypes({\n requestInfos: responses,\n parsedSchemas,\n operationId,\n defaultType: this.config.defaultResponseType,\n });\n\n const successResponse = responseInfos.find(\n (response) => response.isSuccess,\n );\n const errorResponses = responseInfos.filter(\n (response) =>\n !response.isSuccess && response.type !== this.config.Ts.Keyword.Any,\n );\n\n const handleResponseHeaders = (src) => {\n if (!src) {\n return \"headers: {},\";\n }\n const headerTypes = Object.fromEntries(\n Object.entries(src).map(([k, v]) => {\n return [k, this.schemaUtils.getSchemaType(v)];\n }),\n );\n const r = `headers: { ${Object.entries(headerTypes)\n .map(([k, v]) => `\"${k}\": ${v}`)\n .join(\",\")} },`;\n return r;\n };\n\n return {\n contentTypes,\n responses: responseInfos,\n success: {\n schema: successResponse,\n type: successResponse?.type || this.config.Ts.Keyword.Any,\n },\n error: {\n schemas: errorResponses,\n type:\n this.config.Ts.UnionType(\n errorResponses.map((response) => response.type),\n ) || this.config.Ts.Keyword.Any,\n },\n full: {\n types:\n this.config.Ts.UnionType(\n responseInfos.map(\n (response) => `{\n data: ${response.type}, status: ${response.status}, statusCode: ${\n response.status\n }, statusText: \"${response.description}\", ${handleResponseHeaders(\n response.headers,\n )} config: {} }`,\n ),\n ) || this.config.Ts.Keyword.Any,\n },\n };\n };\n\n convertRouteParamsIntoObject = (params) => {\n return _.reduce(\n params,\n (objectSchema, schemaPart) => {\n if (!schemaPart || !schemaPart.name) return objectSchema;\n\n let usageName = `${schemaPart.name}`;\n\n if (usageName.includes(\".\")) {\n usageName = _.camelCase(usageName);\n }\n\n return {\n ...objectSchema,\n properties: {\n ...objectSchema.properties,\n [usageName]: {\n ...schemaPart,\n ...(schemaPart.schema || {}),\n $origName: schemaPart.name,\n name: usageName,\n },\n },\n };\n },\n {\n properties: {},\n type: \"object\",\n },\n );\n };\n\n getRequestBodyInfo = (routeInfo, routeParams, parsedSchemas, routeName) => {\n const { requestBody, consumes, requestBodyName, operationId } = routeInfo;\n let schema = null;\n let content = null;\n\n const contentTypes = this.getContentTypes(\n [requestBody],\n [...(consumes || []), routeInfo[\"x-contentType\"]],\n );\n let contentKind = this.getContentKind(contentTypes);\n\n let typeName = null;\n\n if (this.config.extractRequestBody) {\n typeName = this.schemaUtils.resolveTypeName(routeName.usage, {\n suffixes: this.config.extractingOptions.requestBodySuffix,\n resolver: this.config.extractingOptions.requestBodyNameResolver,\n });\n }\n\n if (routeParams.formData.length) {\n contentKind = CONTENT_KIND.FORM_DATA;\n schema = this.convertRouteParamsIntoObject(routeParams.formData);\n content = this.schemaParserFabric.getInlineParseContent(\n schema,\n typeName,\n [operationId],\n );\n } else if (contentKind === CONTENT_KIND.FORM_DATA) {\n schema = this.getSchemaFromRequestType(requestBody);\n content = this.schemaParserFabric.getInlineParseContent(\n schema,\n typeName,\n [operationId],\n );\n } else if (requestBody) {\n schema = this.getSchemaFromRequestType(requestBody);\n content = this.schemaParserFabric.schemaUtils.safeAddNullToType(\n requestBody,\n this.getTypeFromRequestInfo({\n requestInfo: requestBody,\n parsedSchemas,\n operationId,\n typeName,\n }),\n );\n\n // TODO: Refactor that.\n // It needed for cases when swagger schema is not declared request body type as form data\n // but request body data type contains form data types like File\n if (\n this.FORM_DATA_TYPES.some((dataType) =>\n _.includes(content, `: ${dataType}`),\n )\n ) {\n contentKind = CONTENT_KIND.FORM_DATA;\n }\n }\n\n if (schema && !schema.$ref && this.config.extractRequestBody) {\n schema = this.schemaParserFabric.createParsedComponent({\n schema,\n typeName,\n schemaPath: [operationId],\n });\n content = this.schemaParserFabric.getInlineParseContent({\n $ref: schema.$ref,\n });\n }\n\n return {\n paramName: requestBodyName || requestBody?.name || DEFAULT_BODY_ARG_NAME,\n contentTypes,\n contentKind,\n schema,\n type: content,\n required:\n requestBody &&\n (typeof requestBody.required === \"undefined\" || !!requestBody.required),\n };\n };\n\n createRequestParamsSchema = ({\n queryParams,\n queryObjectSchema,\n pathArgsSchemas,\n extractRequestParams,\n routeName,\n }) => {\n if (!queryParams || !queryParams.length) return null;\n\n const pathParams = _.reduce(\n pathArgsSchemas,\n (acc, pathArgSchema) => {\n if (pathArgSchema.name) {\n acc[pathArgSchema.name] = {\n ...pathArgSchema,\n in: \"path\",\n };\n }\n\n return acc;\n },\n {},\n );\n\n const fixedQueryParams = _.reduce(\n _.get(queryObjectSchema, \"properties\", {}),\n (acc, property, name) => {\n if (name && _.isObject(property)) {\n acc[name] = {\n ...property,\n in: \"query\",\n };\n }\n\n return acc;\n },\n {},\n );\n\n const schema = {\n ...queryObjectSchema,\n properties: {\n ...fixedQueryParams,\n ...pathParams,\n },\n };\n\n const fixedSchema = this.config.hooks.onCreateRequestParams(schema);\n\n if (fixedSchema) return fixedSchema;\n\n if (extractRequestParams) {\n const generatedTypeName = this.schemaUtils.resolveTypeName(\n routeName.usage,\n {\n suffixes: this.config.extractingOptions.requestParamsSuffix,\n resolver: this.config.extractingOptions.requestParamsNameResolver,\n },\n );\n\n return this.schemaParserFabric.createParsedComponent({\n typeName: generatedTypeName,\n schema: schema,\n });\n }\n\n return schema;\n };\n\n extractResponseBodyIfItNeeded = (routeInfo, responseBodyInfo, routeName) => {\n if (\n responseBodyInfo.responses.length &&\n responseBodyInfo.success &&\n responseBodyInfo.success.schema\n ) {\n const typeName = this.schemaUtils.resolveTypeName(routeName.usage, {\n suffixes: this.config.extractingOptions.responseBodySuffix,\n resolver: this.config.extractingOptions.responseBodyNameResolver,\n });\n\n const idx = responseBodyInfo.responses.indexOf(\n responseBodyInfo.success.schema,\n );\n\n let successResponse = responseBodyInfo.success;\n\n if (successResponse.schema && !successResponse.schema.$ref) {\n const schema = this.getSchemaFromRequestType(successResponse.schema);\n successResponse.schema = this.schemaParserFabric.createParsedComponent({\n schema,\n typeName,\n schemaPath: [routeInfo.operationId],\n });\n successResponse.type = this.schemaParserFabric.getInlineParseContent({\n $ref: successResponse.schema.$ref,\n });\n\n if (idx > -1) {\n _.assign(responseBodyInfo.responses[idx], {\n ...successResponse.schema,\n type: successResponse.type,\n });\n }\n }\n }\n };\n\n extractResponseErrorIfItNeeded = (routeInfo, responseBodyInfo, routeName) => {\n if (\n responseBodyInfo.responses.length &&\n responseBodyInfo.error.schemas &&\n responseBodyInfo.error.schemas.length\n ) {\n const typeName = this.schemaUtils.resolveTypeName(routeName.usage, {\n suffixes: this.config.extractingOptions.responseErrorSuffix,\n resolver: this.config.extractingOptions.responseErrorNameResolver,\n });\n\n const errorSchemas = responseBodyInfo.error.schemas\n .map(this.getSchemaFromRequestType)\n .filter(Boolean);\n\n if (!errorSchemas.length) return;\n\n const schema = this.schemaParserFabric.parseSchema(\n {\n oneOf: errorSchemas,\n title: errorSchemas\n .map((schema) => schema.title)\n .filter(Boolean)\n .join(\" \"),\n description: errorSchemas\n .map((schema) => schema.description)\n .filter(Boolean)\n .join(\"\\n\"),\n },\n null,\n [routeInfo.operationId],\n );\n const component = this.schemaComponentsMap.createComponent(\n this.schemaComponentsMap.createRef([\"components\", \"schemas\", typeName]),\n { ...schema },\n );\n responseBodyInfo.error.schemas = [component];\n responseBodyInfo.error.type = this.typeNameFormatter.format(\n component.typeName,\n );\n }\n };\n\n getRouteName = (rawRouteInfo) => {\n const { moduleName } = rawRouteInfo;\n const { routeNameDuplicatesMap, templatesToRender } = this.config;\n const routeNameTemplate = templatesToRender.routeName;\n\n const routeNameFromTemplate = this.templatesWorker.renderTemplate(\n routeNameTemplate,\n {\n routeInfo: rawRouteInfo,\n },\n );\n\n const routeName =\n this.config.hooks.onFormatRouteName(\n rawRouteInfo,\n routeNameFromTemplate,\n ) || routeNameFromTemplate;\n\n const duplicateIdentifier = `${moduleName}|${routeName}`;\n\n if (routeNameDuplicatesMap.has(duplicateIdentifier)) {\n routeNameDuplicatesMap.set(\n duplicateIdentifier,\n routeNameDuplicatesMap.get(duplicateIdentifier) + 1,\n );\n\n this.logger.warn(\n `Module \"${moduleName}\" already has method \"${routeName}()\"`,\n `\\nThis method has been renamed to \"${\n routeName + routeNameDuplicatesMap.get(duplicateIdentifier)\n }()\" to solve conflict names.`,\n );\n } else {\n routeNameDuplicatesMap.set(duplicateIdentifier, 1);\n }\n\n const duplicates = routeNameDuplicatesMap.get(duplicateIdentifier);\n\n const routeNameInfo = {\n usage: routeName + (duplicates > 1 ? duplicates : \"\"),\n original: routeName,\n duplicate: duplicates > 1,\n };\n\n return (\n this.config.hooks.onCreateRouteName(routeNameInfo, rawRouteInfo) ||\n routeNameInfo\n );\n };\n\n parseRouteInfo = (\n rawRouteName,\n routeInfo,\n method,\n usageSchema,\n parsedSchemas,\n ) => {\n const { security: globalSecurity } = usageSchema;\n const { moduleNameIndex, moduleNameFirstTag, extractRequestParams } =\n this.config;\n const {\n operationId,\n requestBody,\n security,\n // eslint-disable-next-line no-unused-vars\n parameters,\n summary,\n description,\n tags,\n responses,\n // eslint-disable-next-line no-unused-vars\n requestBodyName,\n produces,\n consumes,\n ...otherInfo\n } = routeInfo;\n const {\n route,\n pathParams: pathParamsFromRouteName,\n queryParams: queryParamsFromRouteName,\n } = this.parseRouteName(rawRouteName);\n\n const routeId = generateId();\n const firstTag = tags && tags.length > 0 ? tags[0] : null;\n const moduleName =\n moduleNameFirstTag && firstTag\n ? _.camelCase(firstTag)\n : _.camelCase(_.compact(_.split(route, \"/\"))[moduleNameIndex]);\n let hasSecurity = !!globalSecurity?.length;\n if (security) {\n hasSecurity = security.length > 0;\n }\n\n const routeParams = this.getRouteParams(\n routeInfo,\n pathParamsFromRouteName,\n queryParamsFromRouteName,\n );\n\n const pathArgs = routeParams.path.map((pathArgSchema) => ({\n name: pathArgSchema.name,\n optional: !pathArgSchema.required,\n // mark it as any for now, because \"getInlineParseContent\" breaks type names of extracted enums\n type: this.config.Ts.Keyword.Any,\n description: pathArgSchema.description,\n }));\n const pathArgsNames = pathArgs.map((arg) => arg.name);\n\n const responseBodyInfo = this.getResponseBodyInfo(routeInfo, parsedSchemas);\n\n const rawRouteInfo = {\n ...otherInfo,\n pathArgs,\n operationId,\n method,\n route: rawRouteName,\n moduleName,\n responsesTypes: responseBodyInfo.responses,\n description,\n tags,\n summary,\n responses,\n produces,\n requestBody,\n consumes,\n security,\n };\n\n const queryObjectSchema = this.convertRouteParamsIntoObject(\n routeParams.query,\n );\n const pathObjectSchema = this.convertRouteParamsIntoObject(\n routeParams.path,\n );\n const headersObjectSchema = this.convertRouteParamsIntoObject(\n routeParams.header,\n );\n\n const routeName = this.getRouteName(rawRouteInfo);\n\n const requestBodyInfo = this.getRequestBodyInfo(\n routeInfo,\n routeParams,\n parsedSchemas,\n routeName,\n );\n\n const requestParamsSchema = this.createRequestParamsSchema({\n queryParams: routeParams.query,\n pathArgsSchemas: routeParams.path,\n queryObjectSchema,\n extractRequestParams,\n routeName,\n });\n\n if (this.config.extractResponseBody) {\n this.extractResponseBodyIfItNeeded(\n routeInfo,\n responseBodyInfo,\n routeName,\n );\n }\n if (this.config.extractResponseError) {\n this.extractResponseErrorIfItNeeded(\n routeInfo,\n responseBodyInfo,\n routeName,\n );\n }\n\n const typeName = this.schemaUtils.resolveTypeName(routeName.usage, {\n suffixes: this.config.extractingOptions.requestParamsSuffix,\n resolver: this.config.extractingOptions.requestParamsNameResolver,\n shouldReserve: false,\n });\n\n const queryType = routeParams.query.length\n ? this.schemaParserFabric.getInlineParseContent(queryObjectSchema, null, [\n typeName,\n ])\n : null;\n const pathType = routeParams.path.length\n ? this.schemaParserFabric.getInlineParseContent(pathObjectSchema, null, [\n typeName,\n ])\n : null;\n const headersType = routeParams.header.length\n ? this.schemaParserFabric.getInlineParseContent(\n headersObjectSchema,\n null,\n [typeName],\n )\n : null;\n\n const nameResolver = new SpecificArgNameResolver(\n this.config,\n this.logger,\n pathArgsNames,\n );\n\n const specificArgs = {\n query: queryType\n ? {\n name: nameResolver.resolve(RESERVED_QUERY_ARG_NAMES),\n optional: this.schemaParserFabric.parseSchema(\n queryObjectSchema,\n null,\n [routeName.usage],\n ).allFieldsAreOptional,\n type: queryType,\n }\n : void 0,\n body: requestBodyInfo.type\n ? {\n name: nameResolver.resolve([\n requestBodyInfo.paramName,\n ...RESERVED_BODY_ARG_NAMES,\n ]),\n optional: !requestBodyInfo.required,\n type: requestBodyInfo.type,\n }\n : void 0,\n pathParams: pathType\n ? {\n name: nameResolver.resolve(RESERVED_PATH_ARG_NAMES),\n optional: this.schemaParserFabric.parseSchema(\n pathObjectSchema,\n null,\n [routeName.usage],\n ).allFieldsAreOptional,\n type: pathType,\n }\n : void 0,\n headers: headersType\n ? {\n name: nameResolver.resolve(RESERVED_HEADER_ARG_NAMES),\n optional: this.schemaParserFabric.parseSchema(\n headersObjectSchema,\n null,\n [routeName.usage],\n ).allFieldsAreOptional,\n type: headersType,\n }\n : void 0,\n };\n\n pathArgs.forEach((pathArg, i) => {\n pathArg.type = this.schemaParserFabric.getInlineParseContent(\n routeParams.path[i].schema,\n null,\n [typeName],\n );\n });\n\n return {\n id: routeId,\n namespace: _.replace(moduleName, /^(\\d)/, \"v$1\"),\n routeName,\n routeParams,\n requestBodyInfo,\n responseBodyInfo,\n specificArgs,\n queryObjectSchema,\n pathObjectSchema,\n headersObjectSchema,\n responseBodySchema: responseBodyInfo.success.schema,\n requestBodySchema: requestBodyInfo.schema,\n specificArgNameResolver: nameResolver,\n request: {\n contentTypes: requestBodyInfo.contentTypes,\n parameters: pathArgs,\n path: route,\n formData: requestBodyInfo.contentKind === CONTENT_KIND.FORM_DATA,\n isQueryBody: requestBodyInfo.contentKind === CONTENT_KIND.URL_ENCODED,\n security: hasSecurity,\n method: method,\n requestParams: requestParamsSchema,\n\n payload: specificArgs.body,\n query: specificArgs.query,\n pathParams: specificArgs.pathParams,\n headers: specificArgs.headers,\n },\n response: {\n contentTypes: responseBodyInfo.contentTypes,\n type: responseBodyInfo.success.type,\n errorType: responseBodyInfo.error.type,\n fullTypes: responseBodyInfo.full.types,\n },\n raw: rawRouteInfo,\n };\n };\n\n attachSchema = ({ usageSchema, parsedSchemas }) => {\n this.config.routeNameDuplicatesMap.clear();\n\n const pathsEntries = _.entries(usageSchema.paths);\n\n _.forEach(pathsEntries, ([rawRouteName, routeInfoByMethodsMap]) => {\n const routeInfosMap = this.createRequestsMap(routeInfoByMethodsMap);\n\n _.forEach(routeInfosMap, (routeInfo, method) => {\n const parsedRouteInfo = this.parseRouteInfo(\n rawRouteName,\n routeInfo,\n method,\n usageSchema,\n parsedSchemas,\n );\n const processedRouteInfo =\n this.config.hooks.onCreateRoute(parsedRouteInfo);\n if (processedRouteInfo !== false) {\n const route = processedRouteInfo || parsedRouteInfo;\n\n if (!this.hasSecurityRoutes && route.security) {\n this.hasSecurityRoutes = route.security;\n }\n if (!this.hasQueryRoutes && route.hasQuery) {\n this.hasQueryRoutes = route.hasQuery;\n }\n if (!this.hasFormDataRoutes && route.hasFormDataParams) {\n this.hasFormDataRoutes = route.hasFormDataParams;\n }\n\n this.routes.push(route);\n }\n });\n });\n };\n\n getGroupedRoutes = () => {\n const groupedRoutes = this.routes.reduce(\n (modules, route) => {\n if (route.namespace) {\n if (!modules[route.namespace]) {\n modules[route.namespace] = [];\n }\n\n modules[route.namespace].push(route);\n } else {\n modules.$outOfModule.push(route);\n }\n\n return modules;\n },\n {\n $outOfModule: [],\n },\n );\n\n const routeGroups = _.reduce(\n groupedRoutes,\n (acc, routesGroup, moduleName) => {\n if (moduleName === \"$outOfModule\") {\n acc.outOfModule = routesGroup;\n } else {\n if (!acc.combined) acc.combined = [];\n\n acc.combined.push({\n moduleName,\n routes: _.map(routesGroup, (route) => {\n const { original: originalName, usage: usageName } =\n route.routeName;\n\n // TODO: https://github.com/acacode/swagger-typescript-api/issues/152\n // TODO: refactor\n if (\n routesGroup.length > 1 &&\n usageName !== originalName &&\n !_.some(\n routesGroup,\n ({ routeName, id }) =>\n id !== route.id && originalName === routeName.original,\n )\n ) {\n return {\n ...route,\n routeName: {\n ...route.routeName,\n usage: originalName,\n },\n };\n }\n\n return route;\n }),\n });\n }\n return acc;\n },\n {},\n );\n\n if (this.config.sortRoutes) {\n if (routeGroups.outOfModule) {\n routeGroups.outOfModule = this.sortRoutes(routeGroups.outOfModule);\n }\n if (routeGroups.combined) {\n _.each(routeGroups.combined, (routeGroup) => {\n routeGroup.routes = this.sortRoutes(routeGroup.routes);\n });\n }\n }\n\n return routeGroups;\n };\n\n sortRoutes = (routes) => {\n return _.slice(routes).sort((routeA, routeB) =>\n routeA.routeName.usage.localeCompare(routeB.routeName.usage),\n );\n };\n}\n\nexport { SchemaRoutes };\n","import { customAlphabet } from \"nanoid\";\n\nconst ALPHABET = \"abcdefghijklmnopqrstuvwxyz0123456789\";\n\nconst generateId = customAlphabet(ALPHABET, 12);\n\nexport { generateId };\n","import { NameResolver } from \"../../util/name-resolver.js\";\n\nclass SpecificArgNameResolver extends NameResolver {\n counter = 1;\n /**\n * @param {CodeGenConfig} config;\n * @param {Logger} logger;\n * @param {string[]} reservedNames\n */\n constructor(config, logger, reservedNames) {\n super(config, logger, reservedNames, (variants) => {\n const generatedVariant =\n (variants[0] && `${variants[0]}${this.counter++}`) ||\n `${this.config.specificArgNameResolverName}${this.counter++}`;\n this.logger.debug(\n \"generated fallback type name for specific arg - \",\n generatedVariant,\n );\n return generatedVariant;\n });\n }\n}\n\nexport { SpecificArgNameResolver };\n","import _ from \"lodash\";\n\n// TODO: WIP\n// this class will be needed to walk by schema everywhere\nclass SchemaWalker {\n /** @type {Logger} */\n logger;\n /** @type {CodeGenConfig} */\n config;\n /** @type {SwaggerSchemaResolver} */\n swaggerSchemaResolver;\n /** @type {Map<string, Record<string, any>>} */\n schemas = new Map();\n /** @type {Map<string, Record<string, any>>} */\n caches = new Map();\n\n constructor({ config, logger }) {\n this.logger = logger;\n this.config = config;\n }\n\n /**\n * @param name {string}\n * @param schema {Record<string, any>}\n */\n addSchema = (name, schema) => {\n this.schemas.set(name, _.cloneDeep(schema));\n };\n\n /**\n * @param ref {string}\n * @returns {any}\n */\n findByRef = (ref) => {\n this.logger.debug(\"try to resolve ref by path\", ref);\n\n if (this.caches.has(ref)) {\n return this.caches.get(ref);\n }\n\n const schemas = Array.from(this.schemas.values());\n if (this._isLocalRef(ref)) {\n for (const schema of schemas) {\n const refData = this._getRefDataFromSchema(schema, ref);\n if (refData) {\n return refData;\n }\n }\n } else if (this._isRemoteRef(ref)) {\n this.logger.debug(\"remote refs not supported\", ref);\n return null;\n } else {\n const [address, path] = path.split(\"#\");\n let swaggerSchemaObject;\n\n if (this.schemas.has(address)) {\n swaggerSchemaObject = this.schemas.get(address);\n } else {\n const pathToSchema = path.resolve(process.cwd(), address);\n const swaggerSchemaFile =\n this.swaggerSchemaResolver.getSwaggerSchemaByPath(pathToSchema);\n swaggerSchemaObject =\n this.swaggerSchemaResolver.processSwaggerSchemaFile(\n swaggerSchemaFile,\n );\n this.schemas.set(address, swaggerSchemaObject);\n }\n\n return this._getRefDataFromSchema(swaggerSchemaObject, path);\n }\n };\n\n _isLocalRef = (ref) => {\n return ref.startsWith(\"#\");\n };\n\n _isRemoteRef = (ref) => {\n return ref.startsWith(\"http://\") || ref.startsWith(\"https://\");\n };\n\n _getRefDataFromSchema = (schema, ref) => {\n const path = ref.replace(\"#\", \"\").split(\"/\");\n const refData = _.get(schema, path);\n if (refData) {\n this.caches.set(ref, refData);\n }\n return refData;\n };\n}\n\nexport { SchemaWalker };\n","import yaml from \"js-yaml\";\nimport _ from \"lodash\";\nimport converter from \"swagger2openapi\";\nimport { Request } from \"./util/request.js\";\n\nclass SwaggerSchemaResolver {\n /**\n * @type {CodeGenConfig}\n */\n config;\n /**\n * @type {Logger}\n */\n logger;\n /**\n * @type {FileSystem}\n */\n fileSystem;\n /**\n * @type {Request}\n */\n request;\n\n constructor({ config, logger, fileSystem }) {\n this.config = config;\n this.logger = logger;\n this.fileSystem = fileSystem;\n this.request = new Request(config, logger);\n }\n\n /**\n *\n * @returns {Promise<{usageSchema: Record<string, *>, originalSchema: Record<string, *>}>}\n */\n async create() {\n const {\n spec,\n patch,\n input,\n url,\n disableStrictSSL,\n disableProxy,\n authorizationToken,\n } = this.config;\n\n if (this.config.spec) {\n return await this.convertSwaggerObject(spec, { patch });\n }\n\n const swaggerSchemaFile = await this.fetchSwaggerSchemaFile(\n input,\n url,\n disableStrictSSL,\n disableProxy,\n authorizationToken,\n );\n const swaggerSchemaObject =\n this.processSwaggerSchemaFile(swaggerSchemaFile);\n return await this.convertSwaggerObject(swaggerSchemaObject, { patch });\n }\n\n /**\n *\n * @param swaggerSchema {Record<string, any>}\n * @param converterOptions {{ patch?: boolean }}\n * @returns {Promise<{ usageSchema: Record<string, any>, originalSchema: Record<string, any>}>}\n */\n convertSwaggerObject(swaggerSchema, converterOptions) {\n return new Promise((resolve) => {\n const result = _.cloneDeep(swaggerSchema);\n result.info = _.merge(\n {\n title: \"No title\",\n version: \"\",\n },\n result.info,\n );\n\n if (!result.openapi) {\n result.paths = _.merge({}, result.paths);\n\n converter.convertObj(\n result,\n {\n ...converterOptions,\n warnOnly: true,\n refSiblings: \"preserve\",\n rbname: \"requestBodyName\",\n },\n (err, options) => {\n const parsedSwaggerSchema = _.get(\n err,\n \"options.openapi\",\n _.get(options, \"openapi\"),\n );\n if (!parsedSwaggerSchema && err) {\n throw new Error(err);\n }\n this.config.update({ convertedFromSwagger2: true });\n resolve({\n usageSchema: parsedSwaggerSchema,\n originalSchema: result,\n });\n },\n );\n } else {\n resolve({\n usageSchema: result,\n originalSchema: _.cloneDeep(result),\n });\n }\n });\n }\n\n getSwaggerSchemaByPath = (pathToSwagger) => {\n this.logger.log(`try to get swagger by path \"${pathToSwagger}\"`);\n return this.fileSystem.getFileContent(pathToSwagger);\n };\n\n async fetchSwaggerSchemaFile(\n pathToSwagger,\n urlToSwagger,\n disableStrictSSL,\n disableProxy,\n authToken,\n ) {\n if (this.fileSystem.pathIsExist(pathToSwagger)) {\n return this.getSwaggerSchemaByPath(pathToSwagger);\n } else {\n this.logger.log(`try to get swagger by URL \"${urlToSwagger}\"`);\n return await this.request.download({\n url: urlToSwagger,\n disableStrictSSL,\n authToken,\n disableProxy,\n });\n }\n }\n\n processSwaggerSchemaFile(file) {\n if (typeof file !== \"string\") return file;\n\n try {\n return JSON.parse(file);\n } catch (e) {\n return yaml.load(file);\n }\n }\n\n fixSwaggerSchema({ usageSchema, originalSchema }) {\n const usagePaths = _.get(usageSchema, \"paths\");\n const originalPaths = _.get(originalSchema, \"paths\");\n\n // walk by routes\n _.each(usagePaths, (usagePathObject, route) => {\n const originalPathObject = _.get(originalPaths, route);\n\n // walk by methods\n _.each(usagePathObject, (usageRouteInfo, methodName) => {\n const originalRouteInfo = _.get(originalPathObject, methodName);\n const usageRouteParams = _.get(usageRouteInfo, \"parameters\", []);\n const originalRouteParams = _.get(originalRouteInfo, \"parameters\", []);\n\n if (typeof usageRouteInfo === \"object\") {\n usageRouteInfo.consumes = _.uniq(\n _.compact([\n ...(usageRouteInfo.consumes || []),\n ...(originalRouteInfo.consumes || []),\n ]),\n );\n usageRouteInfo.produces = _.uniq(\n _.compact([\n ...(usageRouteInfo.produces || []),\n ...(originalRouteInfo.produces || []),\n ]),\n );\n }\n\n _.each(originalRouteParams, (originalRouteParam) => {\n const existUsageParam = _.find(\n usageRouteParams,\n (param) =>\n originalRouteParam.in === param.in &&\n originalRouteParam.name === param.name,\n );\n if (!existUsageParam) {\n usageRouteParams.push(originalRouteParam);\n }\n });\n });\n });\n }\n}\n\nexport { SwaggerSchemaResolver };\n","import _ from \"lodash\";\n\nclass Request {\n /**\n * @type {CodeGenConfig}\n */\n config;\n /**\n * @type {Logger}\n */\n logger;\n\n constructor(config, logger) {\n this.config = config;\n this.logger = logger;\n }\n\n /**\n * @param url {string}\n * @param disableStrictSSL\n * @param authToken\n * @param options {Partial<RequestInit>}\n * @return {Promise<string>}\n */\n async download({ url, disableStrictSSL, authToken, ...options }) {\n /**\n * @type {Partial<RequestInit>}\n */\n const requestOptions = {};\n\n if (disableStrictSSL && !_.startsWith(url, \"http://\")) {\n const undiciGlobalDispatcher =\n global[Symbol.for(\"undici.globalDispatcher.1\")];\n if (!undiciGlobalDispatcher) {\n throw new Error(\"Could not find the global Undici dispatcher\");\n }\n const newDispatcher = new undiciGlobalDispatcher.constructor({\n connect: {\n rejectUnauthorized: false,\n },\n });\n global[unidiciGlobalDispatcherSymbol] = newDispatcher;\n }\n if (authToken) {\n requestOptions.headers = {\n Authorization: authToken,\n };\n }\n\n _.merge(requestOptions, options, this.config.requestOptions);\n\n try {\n const response = await fetch(url, requestOptions);\n return await response.text();\n } catch (error) {\n const message = `error while fetching data from URL \"${url}\"`;\n this.logger.error(message, \"response\" in error ? error.response : error);\n return message;\n }\n }\n}\n\nexport { Request };\n","import { resolve } from \"node:path\";\nimport path from \"node:path\";\nimport url from \"node:url\";\nimport * as Eta from \"eta\";\nimport _ from \"lodash\";\n\nclass TemplatesWorker {\n /**\n * @type {CodeGenConfig}\n */\n config;\n\n /**\n * @type {Logger}\n */\n logger;\n\n /**\n * @type {FileSystem}\n */\n fileSystem;\n\n getRenderTemplateData;\n\n constructor({ config, logger, fileSystem, getRenderTemplateData }) {\n this.config = config;\n this.logger = logger;\n this.fileSystem = fileSystem;\n this.getRenderTemplateData = getRenderTemplateData;\n }\n\n /**\n *\n * @param config {CodeGenConfig}\n * @returns {CodeGenConfig.templatePaths}\n */\n getTemplatePaths = (config) => {\n const __dirname = path.dirname(url.fileURLToPath(import.meta.url));\n const baseTemplatesPath = resolve(__dirname, \"../templates/base\");\n const defaultTemplatesPath = resolve(__dirname, \"../templates/default\");\n const modularTemplatesPath = resolve(__dirname, \"../templates/modular\");\n const originalTemplatesPath = config.modular\n ? modularTemplatesPath\n : defaultTemplatesPath;\n const customTemplatesPath =\n (config.templates && resolve(process.cwd(), config.templates)) || null;\n\n return {\n /** `templates/base` */\n base: baseTemplatesPath,\n /** `templates/default` */\n default: defaultTemplatesPath,\n /** `templates/modular` */\n modular: modularTemplatesPath,\n /** usage path if `--templates` option is not set */\n original: originalTemplatesPath,\n /** custom path to templates (`--templates`) */\n custom: customTemplatesPath,\n };\n };\n\n cropExtension = (path) =>\n this.config.templateExtensions.reduce(\n (path, ext) => (_.endsWith(path, ext) ? path.replace(ext, \"\") : path),\n path,\n );\n\n getTemplateFullPath = (path, fileName) => {\n const raw = resolve(path, \"./\", this.cropExtension(fileName));\n const pathVariants = this.config.templateExtensions.map(\n (extension) => `${raw}${extension}`,\n );\n\n return pathVariants.find(\n (variant) => !!this.fileSystem.pathIsExist(variant),\n );\n };\n\n requireFnFromTemplate = async (packageOrPath) => {\n const isPath =\n _.startsWith(packageOrPath, \"./\") || _.startsWith(packageOrPath, \"../\");\n\n if (isPath) {\n return await import(\n path.resolve(\n this.config.templatePaths.custom ||\n this.config.templatePaths.original,\n packageOrPath,\n )\n );\n }\n\n return await import(packageOrPath);\n };\n\n getTemplate = ({ fileName, name, path }) => {\n const { templatePaths } = this.config;\n\n if (path) {\n return this.fileSystem.getFileContent(path);\n }\n\n if (!fileName) return \"\";\n\n const customFullPath =\n templatePaths.custom &&\n this.getTemplateFullPath(templatePaths.custom, fileName);\n let fileContent =\n customFullPath && this.fileSystem.getFileContent(customFullPath);\n\n if (fileContent) {\n this.logger.log(\n `\"${_.lowerCase(name)}\" template found in \"${templatePaths.custom}\"`,\n );\n return fileContent;\n }\n\n const baseFullPath = this.getTemplateFullPath(templatePaths.base, fileName);\n\n if (baseFullPath) {\n fileContent = this.fileSystem.getFileContent(baseFullPath);\n } else {\n if (templatePaths.custom) {\n this.logger.warn(\n `\"${_.lowerCase(name)}\" template not found in \"${\n templatePaths.custom\n }\"`,\n \"\\nCode generator will use the default template\",\n );\n } else {\n this.logger.log(\n `Code generator will use the default template for \"${_.lowerCase(\n name,\n )}\"`,\n );\n }\n }\n\n const originalFullPath = this.getTemplateFullPath(\n templatePaths.original,\n fileName,\n );\n\n if (originalFullPath) {\n fileContent = this.fileSystem.getFileContent(originalFullPath);\n }\n\n return fileContent;\n };\n\n getTemplates = ({ templatePaths }) => {\n if (templatePaths.custom) {\n this.logger.log(\n `try to read templates from directory \"${templatePaths.custom}\"`,\n );\n }\n\n return _.reduce(\n this.config.templateInfos,\n (acc, { fileName, name }) => ({\n ...acc,\n [name]: this.getTemplate({ fileName, name }),\n }),\n {},\n );\n };\n\n findTemplateWithExt = (path) => {\n const raw = this.cropExtension(path);\n const pathVariants = this.config.templateExtensions.map(\n (extension) => `${raw}${extension}`,\n );\n return pathVariants.find((variant) => this.fileSystem.pathIsExist(variant));\n };\n\n getTemplateContent = (path) => {\n const foundTemplatePathKey = _.keys(this.config.templatePaths).find((key) =>\n _.startsWith(path, `@${key}`),\n );\n\n const rawPath = resolve(\n _.replace(\n path,\n `@${foundTemplatePathKey}`,\n this.config.templatePaths[foundTemplatePathKey],\n ),\n );\n const fixedPath = this.findTemplateWithExt(rawPath);\n\n if (fixedPath) {\n return this.fileSystem.getFileContent(fixedPath);\n }\n\n const customPath =\n this.config.templatePaths.custom &&\n this.findTemplateWithExt(resolve(this.config.templatePaths.custom, path));\n\n if (customPath) {\n return this.fileSystem.getFileContent(customPath);\n }\n\n const originalPath = this.findTemplateWithExt(\n resolve(this.config.templatePaths.original, path),\n );\n\n if (originalPath) {\n return this.fileSystem.getFileContent(originalPath);\n }\n\n return \"\";\n };\n\n /**\n * @param template\n * @param configuration\n * @param options\n * @returns {Promise<string|string|void>}\n */\n renderTemplate = (template, configuration, options) => {\n if (!template) return \"\";\n\n return Eta.render(\n template,\n {\n ...this.getRenderTemplateData(),\n ...configuration,\n },\n {\n async: false,\n ...(options || {}),\n includeFile: (path, configuration, options) => {\n return this.renderTemplate(\n this.getTemplateContent(path),\n configuration,\n options,\n );\n },\n },\n );\n };\n}\n\nexport { TemplatesWorker };\n","import ts from \"typescript\";\nimport { Translator } from \"./translator.js\";\n\nclass JavascriptTranslator extends Translator {\n /**\n * @param {TranslatorIO} input\n * @returns {Record<string, string>}\n */\n compileTSCode = (input) => {\n const fileNameFull = `${input.fileName}${input.fileExtension}`;\n const output = {};\n const host = ts.createCompilerHost(this.config.compilerTsConfig, true);\n const fileNames = [fileNameFull];\n const originalSourceFileGet = host.getSourceFile.bind(host);\n host.getSourceFile = (\n sourceFileName,\n languageVersion,\n onError,\n shouldCreateNewSourceFile,\n ) => {\n if (sourceFileName !== fileNameFull)\n return originalSourceFileGet(\n sourceFileName,\n languageVersion,\n onError,\n shouldCreateNewSourceFile,\n );\n\n return ts.createSourceFile(\n sourceFileName,\n input.fileContent,\n languageVersion,\n true,\n ts.ScriptKind.TS,\n );\n };\n\n host.writeFile = (fileName, contents) => {\n output[fileName] = contents;\n };\n\n ts.createProgram(fileNames, this.config.compilerTsConfig, host).emit();\n\n return output;\n };\n\n translate = async (input) => {\n const compiled = this.compileTSCode(input);\n\n const jsFileName = `${input.fileName}${ts.Extension.Js}`;\n const dtsFileName = `${input.fileName}${ts.Extension.Dts}`;\n const sourceContent = compiled[jsFileName];\n const tsImportRows = input.fileContent\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"import \"));\n const declarationContent = compiled[dtsFileName]\n .split(\"\\n\")\n .map((line) => {\n if (line.startsWith(\"import \")) {\n return tsImportRows.shift();\n }\n return line;\n })\n .join(\"\\n\");\n\n return [\n {\n fileName: input.fileName,\n fileExtension: ts.Extension.Js,\n fileContent: await this.codeFormatter.formatCode(sourceContent),\n },\n {\n fileName: input.fileName,\n fileExtension: ts.Extension.Dts,\n fileContent: await this.codeFormatter.formatCode(declarationContent),\n },\n ];\n };\n}\n\nexport { JavascriptTranslator };\n","/**\n * @typedef {{ fileName: string, fileExtension: string, fileContent: string }} TranslatorIO\n */\n\nclass Translator {\n /** @type {Logger} */\n logger;\n /** @type {CodeGenConfig} */\n config;\n /** @type {CodeFormatter} */\n codeFormatter;\n\n /**\n * @param codeGenProcess\n */\n constructor(codeGenProcess) {\n this.logger = codeGenProcess.logger;\n this.config = codeGenProcess.config;\n this.codeFormatter = codeGenProcess.codeFormatter;\n }\n\n /**\n *\n * @param input {TranslatorIO}\n * @return {Promise<TranslatorIO[]>}\n */\n // eslint-disable-next-line no-unused-vars\n translate(input) {\n throw new Error(\"not implemented\");\n }\n}\n\nexport { Translator };\n","import _ from \"lodash\";\n\n/**\n * @typedef {\"enum-key\" | \"type-name\"} FormattingSchemaType\n */\n\nclass TypeNameFormatter {\n /** @type {Map<string, string>} */\n formattedModelNamesMap = new Map();\n\n /** @type {CodeGenConfig} */\n config;\n\n /** @type {Logger} */\n logger;\n\n constructor({ config, logger }) {\n this.config = config;\n this.logger = logger;\n }\n\n /**\n * @param name\n * @param options {{ type?: FormattingSchemaType }}\n * @return {string}\n */\n format = (name, options) => {\n options = options || {};\n\n /**\n * @type {FormattingSchemaType}\n */\n const schemaType = options.type || \"type-name\";\n\n const typePrefix =\n schemaType === \"enum-key\"\n ? this.config.enumKeyPrefix\n : this.config.typePrefix;\n const typeSuffix =\n schemaType === \"enum-key\"\n ? this.config.enumKeySuffix\n : this.config.typeSuffix;\n\n const hashKey = `${typePrefix}_${name}_${typeSuffix}`;\n\n if (typeof name !== \"string\") {\n this.logger.warn(\"wrong name of the model name\", name);\n return name;\n }\n\n // constant names like LEFT_ARROW, RIGHT_FORWARD, ETC_KEY, _KEY_NUM_\n if (/^([A-Z_]{1,})$/g.test(name)) {\n return _.compact([typePrefix, name, typeSuffix]).join(\"_\");\n }\n\n if (this.formattedModelNamesMap.has(hashKey)) {\n return this.formattedModelNamesMap.get(hashKey);\n }\n\n const fixedModelName = this.fixModelName(name, { type: schemaType });\n\n const formattedName = _.replace(\n _.startCase(`${typePrefix}_${fixedModelName}_${typeSuffix}`),\n /\\s/g,\n \"\",\n );\n const formattedResultName =\n this.config.hooks.onFormatTypeName(formattedName, name, schemaType) ||\n formattedName;\n\n this.formattedModelNamesMap.set(hashKey, formattedResultName);\n\n return formattedResultName;\n };\n\n isValidName = (name) => /^([A-Za-z$_]{1,})$/g.test(name);\n\n /**\n * @param name\n * @param options {{ type?: FormattingSchemaType }}\n * @return {string}\n */\n fixModelName = (name, options) => {\n const { type } = options || {};\n\n if (!this.isValidName(name)) {\n if (!/^[a-zA-Z_$]/g.test(name)) {\n const fixPrefix =\n type === \"enum-key\"\n ? this.config.fixInvalidEnumKeyPrefix\n : this.config.fixInvalidTypeNamePrefix;\n name = `${fixPrefix} ${name}`;\n }\n\n // specific replaces for TSOA 3.x\n if (name.includes(\".\"))\n name = name\n .replace(/Exclude_keyof[A-Za-z]+/g, () => \"ExcludeKeys\")\n .replace(/%22~AND~%22/g, \"And\")\n .replace(/%22~OR~%22/g, \"Or\")\n .replace(/(\\.?%22)|\\./g, \"_\")\n .replace(/__+$/, \"\");\n\n if (name.includes(\"-\")) name = _.startCase(name).replace(/ /g, \"\");\n }\n\n return name;\n };\n}\n\nexport { TypeNameFormatter };\n","import fs from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport url from \"node:url\";\nimport _ from \"lodash\";\nimport { Logger } from \"./logger.js\";\n\nconst FILE_PREFIX = `/* eslint-disable */\n/* tslint:disable */\n/*\n * ---------------------------------------------------------------\n * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##\n * ## ##\n * ## AUTHOR: acacode ##\n * ## SOURCE: https://github.com/acacode/swagger-typescript-api ##\n * ---------------------------------------------------------------\n */\n\n`;\n\nclass FileSystem {\n /** @type {Logger} */\n logger;\n\n constructor({ logger = new Logger(\"file-system\") } = {}) {\n this.logger = logger;\n }\n\n getFileContent = (path) => {\n return fs.readFileSync(path, { encoding: \"utf8\" });\n };\n\n readDir = (path) => {\n return fs.readdirSync(path);\n };\n\n pathIsDir = (path) => {\n if (!path) return false;\n\n try {\n const stat = fs.statSync(path);\n return stat.isDirectory();\n } catch (e) {\n return false;\n }\n };\n\n cropExtension = (fileName) => {\n const fileNameParts = _.split(fileName, \".\");\n\n if (fileNameParts.length > 1) {\n fileNameParts.pop();\n }\n\n return fileNameParts.join(\".\");\n };\n\n removeDir = (path) => {\n try {\n if (typeof fs.rmSync === \"function\") {\n fs.rmSync(path, { recursive: true });\n } else {\n fs.rmdirSync(path, { recursive: true });\n }\n } catch (e) {\n this.logger.debug(\"failed to remove dir\", e);\n }\n };\n\n createDir = (path) => {\n try {\n fs.mkdirSync(path, { recursive: true });\n } catch (e) {\n this.logger.debug(\"failed to create dir\", e);\n }\n };\n\n cleanDir = (path) => {\n this.removeDir(path);\n this.createDir(path);\n };\n\n pathIsExist = (path) => {\n return !!path && fs.existsSync(path);\n };\n\n createFile = ({ path, fileName, content, withPrefix }) => {\n const __dirname = dirname(url.fileURLToPath(import.meta.url));\n const absolutePath = resolve(__dirname, path, `./${fileName}`);\n const fileContent = `${withPrefix ? FILE_PREFIX : \"\"}${content}`;\n\n return fs.writeFileSync(absolutePath, fileContent, _.noop);\n };\n}\n\nexport { FileSystem };\n","import _ from \"lodash\";\nimport { emojify } from \"node-emoji\";\n\nclass Logger {\n firstLog = true;\n /**\n * @type {CodeGenConfig}\n */\n config;\n\n constructor({ config }) {\n this.config = config;\n }\n\n createLogMessage = ({ type, emojiName, messages }) => {\n if (this.config.silent) return;\n\n const emoji = emojify(emojiName);\n\n if (this.firstLog) {\n this.firstLog = false;\n this.log(\n `swagger-typescript-api(${this.config.version}),${\n process.env.npm_config_user_agent || `nodejs(${process.version})`\n },debug mode ${this.config.debug ? \"ENABLED\" : \"DISABLED\"}`,\n );\n }\n\n if (type === \"debug\" || this.config.debug) {\n const trace = new Error().stack\n .split(\"\\n\")\n .splice(3)\n .filter(\n (line) =>\n !line.includes(\"swagger-typescript-api\\\\node_modules\") &&\n !line.includes(\"swagger-typescript-api/node_modules\"),\n )\n .slice(0, 10);\n const logFn = console[type] || console.log;\n logFn(`${emoji} [${type}]`, new Date().toISOString());\n if (this.config.debugExtras && Array.isArray(this.config.debugExtras)) {\n logFn(`[${this.config.debugExtras.join(\" \")}]`);\n }\n logFn(\n \"[message]\",\n ..._.map(messages, (message) =>\n _.startsWith(message, \"\\n\")\n ? `\\n ${message.replace(/\\n/, \"\")}`\n : message,\n ),\n );\n logFn(trace.join(\"\\n\") + \"\\n---\");\n return;\n }\n\n console[type](\n emoji,\n \" \",\n ..._.map(messages, (message) =>\n _.startsWith(message, \"\\n\")\n ? `\\n${emoji} ${message.replace(/\\n/, \"\")}`\n : message,\n ),\n );\n };\n\n /**\n *\n * @param messages {any[]}\n */\n log = (...messages) =>\n this.createLogMessage({\n type: \"log\",\n emojiName: \":sparkles:\",\n messages,\n });\n\n /**\n *\n * @param messages {any[]}\n * @return {void}\n */\n event = (...messages) =>\n this.createLogMessage({\n type: \"log\",\n emojiName: \":star:\",\n messages,\n });\n\n /**\n *\n * @param messages {any[]}\n * @return {void}\n */\n success = (...messages) =>\n this.createLogMessage({\n type: \"log\",\n emojiName: \":white_check_mark:\",\n messages,\n });\n\n /**\n *\n * @param messages {any[]}\n * @return {void}\n */\n warn = (...messages) =>\n this.createLogMessage({\n type: \"warn\",\n emojiName: \":exclamation:\",\n messages,\n });\n\n /**\n *\n * @param messages {any[]}\n * @return {void}\n */\n error = (...messages) =>\n this.createLogMessage({\n type: \"error\",\n emojiName: \":no_entry:\",\n messages,\n });\n\n /**\n *\n * @param messages {any[]}\n * @return {void}\n */\n debug = (...messages) => {\n if (!this.config.debug) return;\n\n this.createLogMessage({\n type: \"debug\",\n emojiName: \":black_large_square:\",\n messages,\n });\n };\n}\n\nexport { Logger };\n","import path from \"node:path\";\nimport url from \"node:url\";\nimport { FileSystem } from \"../../util/file-system.js\";\nimport { Logger } from \"../../util/logger.js\";\nimport { TemplatesGenConfig } from \"./configuration.js\";\n\nconst __dirname = path.dirname(url.fileURLToPath(import.meta.url));\n\nclass TemplatesGenProcess {\n /**\n * @type {TemplatesGenConfig}\n */\n config;\n /**\n * @type {FileSystem}\n */\n fileSystem;\n /**\n * @type {Logger}\n */\n logger;\n\n rootDir = path.resolve(__dirname, \"../../../\");\n\n paths = {\n baseTemplates: \"templates/base\",\n httpClientTemplates: \"templates/base/http-clients\",\n moduleApiTemplates: \"templates/modular\",\n defaultApiTemplates: \"templates/default\",\n };\n\n importTemplatePrefixes = [\"@base\", \"@modular\", \"@default\"];\n\n constructor(config) {\n this.config = new TemplatesGenConfig(config);\n this.logger = new Logger(this);\n this.fileSystem = new FileSystem(this);\n }\n\n /**\n * @return {Promise<GenerateTemplatesOutput>}\n */\n async start() {\n this.logger.event(\n 'start generating source templates \".ejs\" for code generator',\n );\n\n const templates = this.getTemplates();\n\n if (this.config.output) {\n this.logger.log(\"preparing output directory for source templates\");\n const outputPath = path.resolve(process.cwd(), this.config.output);\n\n if (this.fileSystem.pathIsExist(outputPath)) {\n if (this.config.cleanOutput) {\n this.fileSystem.cleanDir(outputPath);\n }\n } else {\n this.fileSystem.createDir(outputPath);\n }\n\n templates.forEach((template) => {\n const templateName = this.fileSystem.cropExtension(template.name);\n const templateEjsPath = path.resolve(outputPath, `${templateName}.ejs`);\n const templateEtaPath = path.resolve(outputPath, `${templateName}.eta`);\n const templateEjsPathExist =\n this.fileSystem.pathIsExist(templateEjsPath);\n const templateEtaPathExist =\n this.fileSystem.pathIsExist(templateEtaPath);\n\n const templateNotExist = !templateEjsPathExist && !templateEtaPathExist;\n\n if (templateNotExist) {\n this.fileSystem.createFile({\n path: outputPath,\n fileName: template.name,\n content: template.content,\n withPrefix: false,\n });\n } else if (this.config.rewrite) {\n if (templateEjsPathExist) {\n this.fileSystem.createFile({\n path: outputPath,\n fileName: `${templateName}.ejs`,\n content: template.content,\n withPrefix: false,\n });\n } else if (templateEtaPathExist) {\n this.fileSystem.createFile({\n path: outputPath,\n fileName: `${templateName}.eta`,\n content: template.content,\n withPrefix: false,\n });\n }\n }\n });\n\n this.logger.success(\n `source templates has been successfully created in \"${outputPath}\"`,\n );\n }\n\n return {\n files: templates,\n configuration: this.config,\n createFile: this.fileSystem.createFile,\n };\n }\n\n getTemplates = () => {\n const outputFiles = [];\n const baseTemplates = this.getTemplateNamesFromDir(\n this.paths.baseTemplates,\n );\n const httpClientTemplates = this.getTemplateNamesFromDir(\n this.paths.httpClientTemplates,\n );\n const apiTemplatesPath = this.config.modular\n ? this.paths.moduleApiTemplates\n : this.paths.defaultApiTemplates;\n const apiTemplates = this.getTemplateNamesFromDir(apiTemplatesPath);\n\n const usingHttpClientTemplate = httpClientTemplates.find((template) =>\n template.startsWith(`${this.config.httpClientType}-`),\n );\n\n let httpClientTemplateContent = \"\";\n\n if (usingHttpClientTemplate) {\n httpClientTemplateContent = this.fixTemplateContent(\n this.getTemplateContent(\n `${this.paths.httpClientTemplates}/${usingHttpClientTemplate}`,\n ),\n );\n }\n\n for (const fileName of baseTemplates) {\n const templateContent =\n (fileName === \"http-client.ejs\" && httpClientTemplateContent) ||\n this.fixTemplateContent(\n this.getTemplateContent(`${this.paths.baseTemplates}/${fileName}`),\n );\n\n outputFiles.push({\n name: fileName,\n content: templateContent,\n });\n }\n\n for (const fileName of apiTemplates) {\n outputFiles.push({\n name: fileName,\n content: this.fixTemplateContent(\n this.getTemplateContent(`${apiTemplatesPath}/${fileName}`),\n ),\n });\n }\n\n return outputFiles;\n };\n\n fixTemplateContent = (content) => {\n // includeFile(\"@base/\n const importsRegExp1 = new RegExp(\n `includeFile\\\\(\"(${this.importTemplatePrefixes\n .map((v) => `(${v})`)\n .join(\"|\")})/`,\n \"g\",\n );\n // includeFile(`@base/\n const importsRegExp2 = new RegExp(\n `includeFile\\\\(\\`(${this.importTemplatePrefixes\n .map((v) => `(${v})`)\n .join(\"|\")})/`,\n \"g\",\n );\n // includeFile('@base/\n const importsRegExp3 = new RegExp(\n `includeFile\\\\('(${this.importTemplatePrefixes\n .map((v) => `(${v})`)\n .join(\"|\")})/`,\n \"g\",\n );\n\n return content\n .replace(importsRegExp1, 'includeFile(\"./')\n .replace(importsRegExp2, \"includeFile(`./\")\n .replace(importsRegExp3, \"includeFile('./\");\n };\n\n getTemplateNamesFromDir = (dir) => {\n return this.fileSystem\n .readDir(path.resolve(this.rootDir, dir))\n .filter((file) => file.endsWith(\".ejs\"));\n };\n\n getTemplateContent = (pathToFile) => {\n return this.fileSystem.getFileContent(\n path.resolve(this.rootDir, pathToFile),\n );\n };\n}\n\nexport { TemplatesGenProcess };\n","import { HTTP_CLIENT, PROJECT_VERSION } from \"../../constants.js\";\nimport { objectAssign } from \"../../util/object-assign.js\";\n\n/**\n * @type {GenerateTemplatesParams}}\n */\nclass TemplatesGenConfig {\n cleanOutput = false;\n output = undefined;\n httpClientType = HTTP_CLIENT.FETCH;\n modular = false;\n silent = false;\n version = PROJECT_VERSION;\n rewrite = false;\n\n /**\n * @param config {GenerateTemplatesParams}\n */\n constructor(config) {\n this.update(config);\n }\n\n /**\n * @param update {Partial<GenerateTemplatesParams>}\n */\n update = (update) => {\n objectAssign(this, update);\n };\n}\n\nexport { TemplatesGenConfig };\n","#!/usr/bin/env node\n\nimport { TemplatesGenProcess } from \"./templates-gen-process.js\";\n\nasync function generateTemplates(config) {\n const codeGenProcess = new TemplatesGenProcess(config);\n return await codeGenProcess.start();\n}\n\nexport { generateTemplates };\n","#!/usr/bin/env node\n\nimport { CodeGenProcess } from \"./code-gen-process.js\";\nimport { generateTemplates } from \"./commands/generate-templates/index.js\";\nimport * as constants from \"./constants.js\";\n\nasync function generateApi({ name, prettier, ...config }) {\n const codeGenProcess = new CodeGenProcess({\n ...config,\n fileName: name,\n prettierOptions: prettier,\n });\n return await codeGenProcess.start();\n}\n\nexport { constants, generateApi, generateTemplates };\n"]}
|