ts-openapi-codegen 2.1.0-beta.6 → 2.1.0-beta.8

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.
Files changed (353) hide show
  1. package/README.md +3 -0
  2. package/README.rus.md +3 -0
  3. package/dist/cli/analyzeDiff/__tests__/analyzeDiff.cli.test.js +9 -0
  4. package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.js +9 -0
  5. package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.js +9 -0
  6. package/dist/cli/analyzeDiff/ignoreRules.d.ts +0 -6
  7. package/dist/cli/analyzeDiff/ignoreRules.d.ts.map +1 -1
  8. package/dist/cli/analyzeDiff/ignoreRules.js +2 -3
  9. package/dist/cli/analyzeUsage/analyzeUsage.d.ts +4 -0
  10. package/dist/cli/analyzeUsage/analyzeUsage.d.ts.map +1 -0
  11. package/dist/cli/analyzeUsage/analyzeUsage.js +60 -0
  12. package/dist/cli/analyzeUsage/core/Analyzer.d.ts +9 -0
  13. package/dist/cli/analyzeUsage/core/Analyzer.d.ts.map +1 -0
  14. package/dist/cli/analyzeUsage/core/Analyzer.js +29 -0
  15. package/dist/cli/analyzeUsage/core/ProjectContext.d.ts +10 -0
  16. package/dist/cli/analyzeUsage/core/ProjectContext.d.ts.map +1 -0
  17. package/dist/cli/analyzeUsage/core/ProjectContext.js +58 -0
  18. package/dist/cli/analyzeUsage/core/Scanner.d.ts +15 -0
  19. package/dist/cli/analyzeUsage/core/Scanner.d.ts.map +1 -0
  20. package/dist/cli/analyzeUsage/core/Scanner.js +115 -0
  21. package/dist/cli/analyzeUsage/rules/ClientRule.d.ts +6 -0
  22. package/dist/cli/analyzeUsage/rules/ClientRule.d.ts.map +1 -0
  23. package/dist/cli/analyzeUsage/rules/ClientRule.js +76 -0
  24. package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts +7 -0
  25. package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts.map +1 -0
  26. package/dist/cli/analyzeUsage/rules/CoverageRule.js +55 -0
  27. package/dist/cli/analyzeUsage/rules/DiagnosticsRule.d.ts +6 -0
  28. package/dist/cli/analyzeUsage/rules/DiagnosticsRule.d.ts.map +1 -0
  29. package/dist/cli/analyzeUsage/rules/DiagnosticsRule.js +63 -0
  30. package/dist/cli/analyzeUsage/rules/ImportRule.d.ts +6 -0
  31. package/dist/cli/analyzeUsage/rules/ImportRule.d.ts.map +1 -0
  32. package/dist/cli/analyzeUsage/rules/ImportRule.js +50 -0
  33. package/dist/cli/analyzeUsage/rules/ModelRule.d.ts +6 -0
  34. package/dist/cli/analyzeUsage/rules/ModelRule.d.ts.map +1 -0
  35. package/dist/cli/analyzeUsage/rules/ModelRule.js +34 -0
  36. package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts +6 -0
  37. package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts.map +1 -0
  38. package/dist/cli/analyzeUsage/rules/SchemaRule.js +46 -0
  39. package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts +7 -0
  40. package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts.map +1 -0
  41. package/dist/cli/analyzeUsage/rules/ServiceRule.js +86 -0
  42. package/dist/cli/analyzeUsage/types.d.ts +52 -0
  43. package/dist/cli/analyzeUsage/types.d.ts.map +1 -0
  44. package/dist/cli/analyzeUsage/types.js +2 -0
  45. package/dist/cli/analyzeUsage/utils/fuzzy.d.ts +5 -0
  46. package/dist/cli/analyzeUsage/utils/fuzzy.d.ts.map +1 -0
  47. package/dist/cli/analyzeUsage/utils/fuzzy.js +38 -0
  48. package/dist/cli/analyzeUsage/utils/report.d.ts +16 -0
  49. package/dist/cli/analyzeUsage/utils/report.d.ts.map +1 -0
  50. package/dist/cli/analyzeUsage/utils/report.js +85 -0
  51. package/dist/cli/checkAndUpdateConfig/__tests__/checkConfig.test.js +10 -20
  52. package/dist/cli/checkAndUpdateConfig/__tests__/updateConfig.test.js +10 -20
  53. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +2 -1
  54. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
  55. package/dist/cli/checkAndUpdateConfig/checkConfig.js +8 -4
  56. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +2 -1
  57. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
  58. package/dist/cli/checkAndUpdateConfig/updateConfig.js +6 -3
  59. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts.map +1 -1
  60. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -1
  61. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +19 -1
  62. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts +1 -1
  63. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts.map +1 -1
  64. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.js +1 -1
  65. package/dist/cli/generateOpenApiClient/__tests__/generateOpenApiClient.strict.test.js +18 -9
  66. package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts +2 -5
  67. package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
  68. package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +21 -17
  69. package/dist/cli/index.js +44 -11
  70. package/dist/cli/initOpenApiConfig/__tests__/init.test.js +4 -14
  71. package/dist/cli/initOpenApiConfig/__tests__/initConfig.test.js +3 -1
  72. package/dist/cli/initOpenApiConfig/init.d.ts +2 -1
  73. package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
  74. package/dist/cli/initOpenApiConfig/init.js +3 -3
  75. package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts +0 -1
  76. package/dist/cli/initOpenApiConfig/initCustomRequest.d.ts.map +1 -1
  77. package/dist/cli/initOpenApiConfig/initCustomRequest.js +1 -2
  78. package/dist/cli/initOpenApiConfig/utils/__tests__/buildConfig.test.js +2 -8
  79. package/dist/cli/initOpenApiConfig/utils/__tests__/validateSpecFiles.test.js +9 -0
  80. package/dist/cli/initOpenApiConfig/utils/buildConfig.d.ts.map +1 -1
  81. package/dist/cli/initOpenApiConfig/utils/buildConfig.js +0 -4
  82. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts.map +1 -1
  83. package/dist/cli/interactive/constants.d.ts +0 -4
  84. package/dist/cli/interactive/constants.d.ts.map +1 -1
  85. package/dist/cli/interactive/constants.js +1 -5
  86. package/dist/cli/previewChanges/previewChanges.d.ts +2 -1
  87. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
  88. package/dist/cli/previewChanges/previewChanges.js +6 -6
  89. package/dist/cli/previewChanges/utils/formatDiff.d.ts.map +1 -1
  90. package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -1
  91. package/dist/cli/previewChanges/utils/updateOutputPaths.js +5 -12
  92. package/dist/cli/schemas/analyzeUsage.d.ts +13 -0
  93. package/dist/cli/schemas/analyzeUsage.d.ts.map +1 -0
  94. package/dist/cli/schemas/analyzeUsage.js +41 -0
  95. package/dist/cli/schemas/generate.d.ts +10 -2
  96. package/dist/cli/schemas/generate.d.ts.map +1 -1
  97. package/dist/cli/schemas/generate.js +7 -2
  98. package/dist/cli/schemas/index.d.ts +2 -2
  99. package/dist/cli/schemas/index.d.ts.map +1 -1
  100. package/dist/cli/schemas/index.js +1 -1
  101. package/dist/cli/schemas/init.d.ts +0 -1
  102. package/dist/cli/schemas/init.d.ts.map +1 -1
  103. package/dist/cli/schemas/init.js +0 -1
  104. package/dist/cli/types.d.ts +6 -0
  105. package/dist/cli/types.d.ts.map +1 -0
  106. package/dist/cli/types.js +2 -0
  107. package/dist/common/Consts.d.ts +1 -0
  108. package/dist/common/Consts.d.ts.map +1 -1
  109. package/dist/common/Consts.js +7 -4
  110. package/dist/common/Logger.d.ts.map +1 -1
  111. package/dist/common/Logger.js +3 -3
  112. package/dist/common/LoggerMessages.d.ts +66 -12
  113. package/dist/common/LoggerMessages.d.ts.map +1 -1
  114. package/dist/common/LoggerMessages.js +72 -18
  115. package/dist/common/TEslintFixOptions.d.ts +20 -0
  116. package/dist/common/TEslintFixOptions.d.ts.map +1 -0
  117. package/dist/common/TEslintFixOptions.js +15 -0
  118. package/dist/common/TRawOptions.d.ts.map +1 -1
  119. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
  120. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +2 -4
  121. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
  122. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +1 -1
  123. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +0 -1
  124. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -1
  125. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +1 -2
  126. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +0 -2
  127. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
  128. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +1 -1
  129. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +0 -2
  130. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
  131. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +1 -1
  132. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +0 -2
  133. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -1
  134. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts +0 -2
  135. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts.map +1 -1
  136. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts +10 -4
  137. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts.map +1 -1
  138. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.js +15 -5
  139. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +18 -15
  140. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -1
  141. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +7 -1
  142. package/dist/common/VersionedSchema/CommonSchemas.d.ts +0 -2
  143. package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
  144. package/dist/common/VersionedSchema/CommonSchemas.js +4 -3
  145. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
  146. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +0 -1
  147. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +1 -1
  148. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +0 -1
  149. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
  150. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +1 -1
  151. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +0 -1
  152. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
  153. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +1 -1
  154. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +0 -1
  155. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
  156. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
  157. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +0 -1
  158. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +2 -2
  159. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
  160. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +2 -2
  161. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +0 -1
  162. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
  163. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +1 -1
  164. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +1 -2
  165. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
  166. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +9 -9
  167. package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.js +4 -16
  168. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -1
  169. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts +1 -1
  170. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts.map +1 -1
  171. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.js +1 -1
  172. package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts.map +1 -1
  173. package/dist/common/VersionedSchema/Utils/createTrivialMigration.js +1 -1
  174. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  175. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +1 -3
  176. package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts.map +1 -1
  177. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  178. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +2 -4
  179. package/dist/common/VersionedSchema/Utils/replaceInvalidKeysWithMappedNames.d.ts.map +1 -1
  180. package/dist/common/VersionedSchema/Utils/replaceInvalidKeysWithMappedNames.js +1 -1
  181. package/dist/common/VersionedSchema/Utils/validateAndSuggestKeyCorrections.d.ts.map +1 -1
  182. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +1 -1
  183. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -1
  184. package/dist/common/utils/__tests__/convertArrayToObject.test.js +0 -3
  185. package/dist/common/utils/__tests__/eslintFix.test.js +25 -67
  186. package/dist/common/utils/__tests__/extractEslintFixOptions.test.d.ts +2 -0
  187. package/dist/common/utils/__tests__/extractEslintFixOptions.test.d.ts.map +1 -0
  188. package/dist/common/utils/__tests__/extractEslintFixOptions.test.js +28 -0
  189. package/dist/common/utils/__tests__/format.test.js +26 -17
  190. package/dist/common/utils/__tests__/prepareTempTsConfig.test.d.ts +2 -0
  191. package/dist/common/utils/__tests__/prepareTempTsConfig.test.d.ts.map +1 -0
  192. package/dist/common/utils/__tests__/prepareTempTsConfig.test.js +78 -0
  193. package/dist/common/utils/codegenTempDir.d.ts +20 -0
  194. package/dist/common/utils/codegenTempDir.d.ts.map +1 -0
  195. package/dist/common/utils/codegenTempDir.js +42 -0
  196. package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
  197. package/dist/common/utils/convertArrayToObject.js +3 -10
  198. package/dist/common/utils/eslintFix.d.ts +48 -4
  199. package/dist/common/utils/eslintFix.d.ts.map +1 -1
  200. package/dist/common/utils/eslintFix.js +121 -15
  201. package/dist/common/utils/format.d.ts +1 -1
  202. package/dist/common/utils/format.d.ts.map +1 -1
  203. package/dist/common/utils/format.js +23 -11
  204. package/dist/common/utils/jsonPath.d.ts.map +1 -1
  205. package/dist/common/utils/prepareTempEslintConfig.d.ts +18 -0
  206. package/dist/common/utils/prepareTempEslintConfig.d.ts.map +1 -0
  207. package/dist/common/utils/prepareTempEslintConfig.js +55 -0
  208. package/dist/common/utils/prepareTempTsConfig.d.ts +23 -0
  209. package/dist/common/utils/prepareTempTsConfig.d.ts.map +1 -0
  210. package/dist/common/utils/prepareTempTsConfig.js +105 -0
  211. package/dist/core/Context.d.ts.map +1 -1
  212. package/dist/core/Context.js +2 -6
  213. package/dist/core/OpenApiClient.d.ts +19 -1
  214. package/dist/core/OpenApiClient.d.ts.map +1 -1
  215. package/dist/core/OpenApiClient.js +243 -22
  216. package/dist/core/WriteClient.d.ts +33 -5
  217. package/dist/core/WriteClient.d.ts.map +1 -1
  218. package/dist/core/WriteClient.js +60 -18
  219. package/dist/core/__tests__/WriteClient.test.js +1 -1
  220. package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
  221. package/dist/core/api/v2/parser/getOperationResponses.js +1 -3
  222. package/dist/core/api/v2/parser/getServiceName.d.ts +1 -1
  223. package/dist/core/api/v3/parser/getOperation.d.ts.map +1 -1
  224. package/dist/core/api/v3/parser/getOperationParameters.d.ts.map +1 -1
  225. package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
  226. package/dist/core/api/v3/parser/getOperationResponses.js +1 -3
  227. package/dist/core/api/v3/parser/getServiceName.d.ts +1 -1
  228. package/dist/core/governance/evaluateGovernanceRules.d.ts.map +1 -1
  229. package/dist/core/governance/evaluateGovernanceRules.js +1 -3
  230. package/dist/core/governance/loadGovernanceConfig.d.ts.map +1 -1
  231. package/dist/core/governance/loadGovernanceConfig.js +2 -4
  232. package/dist/core/plugins/GeneratorPlugin.model.d.ts.map +1 -1
  233. package/dist/core/plugins/applySemanticDiffPluginHooks.d.ts.map +1 -1
  234. package/dist/core/plugins/getBuiltinPlugins.d.ts.map +1 -1
  235. package/dist/core/plugins/loadGeneratorPlugins.d.ts.map +1 -1
  236. package/dist/core/plugins/loadGeneratorPlugins.js +1 -1
  237. package/dist/core/semanticDiff/__tests__/analyzeOpenApiDiff.test.js +7 -21
  238. package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts.map +1 -1
  239. package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts +0 -2
  240. package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts.map +1 -1
  241. package/dist/core/semanticDiff/semanticDiffReportSchema.js +3 -9
  242. package/dist/core/strict/validateOpenApiStrict.d.ts.map +1 -1
  243. package/dist/core/types/Consts.js +1 -1
  244. package/dist/core/types/base/ClientArtifacts.model.d.ts +3 -3
  245. package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
  246. package/dist/core/types/base/ExportedModel.model.d.ts +1 -1
  247. package/dist/core/types/base/ExportedModel.model.d.ts.map +1 -1
  248. package/dist/core/types/base/ExportedService.model.d.ts.map +1 -1
  249. package/dist/core/types/base/OutputPaths.model.d.ts.map +1 -1
  250. package/dist/core/types/base/PrefixArtifacts.model.d.ts.map +1 -1
  251. package/dist/core/types/base/PropertyGroup.model.d.ts +1 -1
  252. package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +1 -1
  253. package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -1
  254. package/dist/core/types/shared/Client.model.d.ts +1 -1
  255. package/dist/core/types/shared/Client.model.d.ts.map +1 -1
  256. package/dist/core/types/shared/Model.model.d.ts +1 -1
  257. package/dist/core/types/shared/Model.model.d.ts.map +1 -1
  258. package/dist/core/utils/__tests__/postProcessModelImports.test.js +1 -4
  259. package/dist/core/utils/__tests__/postProcessServiceImports.test.js +1 -4
  260. package/dist/core/utils/__tests__/prepareDtoModels.test.js +95 -0
  261. package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +27 -0
  262. package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +10 -27
  263. package/dist/core/utils/__tests__/writeClientServices.test.js +0 -1
  264. package/dist/core/utils/appendUniqueLinesToFile.js +1 -1
  265. package/dist/core/utils/applyDiffReportToClient.d.ts.map +1 -1
  266. package/dist/core/utils/applyDiffReportToClient.js +2 -2
  267. package/dist/core/utils/areEqual.d.ts +1 -1
  268. package/dist/core/utils/getOperationErrors.d.ts +2 -2
  269. package/dist/core/utils/getOperationErrors.d.ts.map +1 -1
  270. package/dist/core/utils/getOperationResults.d.ts +1 -1
  271. package/dist/core/utils/getPropertyGroupSimple.d.ts.map +1 -1
  272. package/dist/core/utils/getPropertyGroupSimple.js +1 -3
  273. package/dist/core/utils/isSubdirectory.d.ts.map +1 -1
  274. package/dist/core/utils/loadDiffReport.d.ts.map +1 -1
  275. package/dist/core/utils/loadDiffReport.js +5 -4
  276. package/dist/core/utils/modelHelpers.d.ts.map +1 -1
  277. package/dist/core/utils/normalizeString.d.ts.map +1 -1
  278. package/dist/core/utils/normalizeString.js +1 -5
  279. package/dist/core/utils/postProcessServiceImports.d.ts.map +1 -1
  280. package/dist/core/utils/postProcessServiceImports.js +1 -3
  281. package/dist/core/utils/precompileTemplates.js +4 -2
  282. package/dist/core/utils/prepareAlias.d.ts +1 -1
  283. package/dist/core/utils/prepareDtoModels.d.ts.map +1 -1
  284. package/dist/core/utils/prepareDtoModels.js +2 -8
  285. package/dist/core/utils/registerHandlebarHelpers.d.ts +1 -0
  286. package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
  287. package/dist/core/utils/registerHandlebarHelpers.js +3 -0
  288. package/dist/core/utils/registerHandlebarTemplates.d.ts +1 -0
  289. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  290. package/dist/core/utils/sortModelByName.d.ts +1 -1
  291. package/dist/core/utils/writeClientCore.d.ts +0 -2
  292. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  293. package/dist/core/utils/writeClientCore.js +19 -18
  294. package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
  295. package/dist/core/utils/writeClientCoreIndex.js +14 -4
  296. package/dist/core/utils/writeClientExecutor.d.ts +1 -2
  297. package/dist/core/utils/writeClientExecutor.d.ts.map +1 -1
  298. package/dist/core/utils/writeClientExecutor.js +6 -10
  299. package/dist/core/utils/writeClientFullIndex.js +4 -4
  300. package/dist/core/utils/writeClientModels.d.ts +1 -2
  301. package/dist/core/utils/writeClientModels.d.ts.map +1 -1
  302. package/dist/core/utils/writeClientModels.js +14 -16
  303. package/dist/core/utils/writeClientModelsIndex.d.ts +1 -1
  304. package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
  305. package/dist/core/utils/writeClientModelsIndex.js +14 -4
  306. package/dist/core/utils/writeClientSchemas.d.ts +1 -3
  307. package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
  308. package/dist/core/utils/writeClientSchemas.js +9 -14
  309. package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
  310. package/dist/core/utils/writeClientSchemasIndex.js +14 -4
  311. package/dist/core/utils/writeClientServices.d.ts +1 -4
  312. package/dist/core/utils/writeClientServices.d.ts.map +1 -1
  313. package/dist/core/utils/writeClientServices.js +9 -13
  314. package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
  315. package/dist/core/utils/writeClientServicesIndex.js +14 -4
  316. package/dist/core/utils/writeClientSimpleIndex.js +4 -4
  317. package/dist/templatesCompiled/cli/customRequest.d.ts +2 -6
  318. package/dist/templatesCompiled/cli/customRequest.d.ts.map +1 -1
  319. package/dist/templatesCompiled/cli/customRequest.js +8 -28
  320. package/dist/templatesCompiled/cli/customRequestExecutor.d.ts +0 -3
  321. package/dist/templatesCompiled/cli/customRequestExecutor.d.ts.map +1 -1
  322. package/dist/templatesCompiled/cli/customRequestExecutor.js +5 -28
  323. package/dist/templatesCompiled/client/core/axios/request.d.ts +2 -6
  324. package/dist/templatesCompiled/client/core/axios/request.d.ts.map +1 -1
  325. package/dist/templatesCompiled/client/core/axios/request.js +2 -22
  326. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts +2 -5
  327. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -1
  328. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.js +12 -42
  329. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts +0 -2
  330. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts.map +1 -1
  331. package/dist/templatesCompiled/client/core/executor/requestExecutor.js +3 -11
  332. package/dist/templatesCompiled/client/core/fetch/request.d.ts +2 -6
  333. package/dist/templatesCompiled/client/core/fetch/request.d.ts.map +1 -1
  334. package/dist/templatesCompiled/client/core/fetch/request.js +2 -22
  335. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts +0 -2
  336. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts.map +1 -1
  337. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +3 -11
  338. package/dist/templatesCompiled/client/core/node/request.d.ts +2 -6
  339. package/dist/templatesCompiled/client/core/node/request.d.ts.map +1 -1
  340. package/dist/templatesCompiled/client/core/node/request.js +2 -22
  341. package/dist/templatesCompiled/client/core/xhr/request.d.ts +2 -6
  342. package/dist/templatesCompiled/client/core/xhr/request.d.ts.map +1 -1
  343. package/dist/templatesCompiled/client/core/xhr/request.js +2 -22
  344. package/dist/templatesCompiled/client/exportService.d.ts +9 -11
  345. package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
  346. package/dist/templatesCompiled/client/exportService.js +64 -82
  347. package/dist/templatesCompiled/client/partials/header.d.ts +1 -0
  348. package/dist/templatesCompiled/client/partials/header.d.ts.map +1 -1
  349. package/dist/templatesCompiled/client/partials/header.js +11 -2
  350. package/dist/test/helpers/silenceLoggers.d.ts +11 -0
  351. package/dist/test/helpers/silenceLoggers.d.ts.map +1 -0
  352. package/dist/test/helpers/silenceLoggers.js +88 -0
  353. package/package.json +132 -135
@@ -11,51 +11,41 @@ const node_test_1 = require("node:test");
11
11
  const Consts_1 = require("../../../common/Consts");
12
12
  const HttpClient_enum_1 = require("../../../core/types/enums/HttpClient.enum");
13
13
  const updateConfig_1 = require("../updateConfig");
14
- class ProcessExitError extends Error {
15
- exitCode;
16
- constructor(exitCode) {
17
- super(`process.exit(${exitCode})`);
18
- this.exitCode = exitCode;
19
- this.name = 'ProcessExitError';
20
- }
21
- }
22
14
  const flatConfig = {
23
15
  input: './test/spec/v3.json',
24
16
  output: './test/generated',
25
17
  httpClient: HttpClient_enum_1.HttpClient.FETCH,
26
18
  };
27
- const mockProcessExit = () => node_test_1.mock.method(process, 'exit', (code) => {
28
- throw new ProcessExitError(Number(code ?? 0));
29
- });
30
19
  async function writeConfig(dir, content) {
31
20
  const configPath = (0, node_path_1.join)(dir, 'openapi.config.json');
32
21
  await (0, promises_1.writeFile)(configPath, JSON.stringify(content, null, 2), 'utf8');
33
22
  return configPath;
34
23
  }
35
24
  (0, node_test_1.describe)('@unit: updateConfig', () => {
36
- (0, node_test_1.test)('exits when options fail schema validation', async () => {
37
- const exitMock = mockProcessExit();
25
+ (0, node_test_1.test)('returns failure when options fail schema validation', async () => {
38
26
  const shutdownMock = node_test_1.mock.method(Consts_1.APP_LOGGER, 'shutdownLoggerAsync', async () => undefined);
39
27
  const errorMock = node_test_1.mock.method(Consts_1.APP_LOGGER, 'error', () => undefined);
40
- await node_assert_1.default.rejects(() => (0, updateConfig_1.updateConfig)({ openapiConfig: 123 }), ProcessExitError);
41
- exitMock.mock.restore();
28
+ const result = await (0, updateConfig_1.updateConfig)({ openapiConfig: 123 });
29
+ node_assert_1.default.strictEqual(result.success, false);
30
+ node_assert_1.default.ok(result.error);
42
31
  shutdownMock.mock.restore();
43
32
  errorMock.mock.restore();
44
33
  });
45
- (0, node_test_1.test)('exits when config file is missing', async () => {
34
+ (0, node_test_1.test)('returns failure when config file is missing', async () => {
46
35
  const dir = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'update-config-'));
47
36
  const configPath = (0, node_path_1.join)(dir, 'missing.json');
48
- const exitMock = mockProcessExit();
49
37
  const shutdownMock = node_test_1.mock.method(Consts_1.APP_LOGGER, 'shutdownLoggerAsync', async () => undefined);
50
- await node_assert_1.default.rejects(() => (0, updateConfig_1.updateConfig)({ openapiConfig: configPath }), ProcessExitError);
51
- exitMock.mock.restore();
38
+ const result = await (0, updateConfig_1.updateConfig)({ openapiConfig: configPath });
39
+ node_assert_1.default.strictEqual(result.success, false);
40
+ node_assert_1.default.ok(result.error);
52
41
  shutdownMock.mock.restore();
53
42
  });
54
43
  (0, node_test_1.test)('logs up to date when config is current', async () => {
55
44
  const dir = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'update-config-'));
56
45
  const configPath = await writeConfig(dir, flatConfig);
57
46
  const infoMock = node_test_1.mock.method(Consts_1.APP_LOGGER, 'info', () => undefined);
58
- await (0, updateConfig_1.updateConfig)({ openapiConfig: configPath });
47
+ const result = await (0, updateConfig_1.updateConfig)({ openapiConfig: configPath });
48
+ node_assert_1.default.strictEqual(result.success, true);
59
49
  node_assert_1.default.strictEqual(infoMock.mock.callCount(), 1);
60
50
  infoMock.mock.restore();
61
51
  });
@@ -1,4 +1,5 @@
1
1
  import { OptionValues } from 'commander';
2
+ import { CLICommandResult } from '../types';
2
3
  /**
3
4
  * Проверяет конфигурационный файл на корректность и актуальность.
4
5
  * Если обнаружены проблемы, предлагает действия для их исправления.
@@ -9,5 +10,5 @@ import { OptionValues } from 'commander';
9
10
  * @example
10
11
  * await checkConfig('./openapi-config.json');
11
12
  */
12
- export declare function checkConfig(options: OptionValues): Promise<void>;
13
+ export declare function checkConfig(options: OptionValues): Promise<CLICommandResult>;
13
14
  //# sourceMappingURL=checkConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkConfig.d.ts","sourceRoot":"","sources":["../../../src/cli/checkAndUpdateConfig/checkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAWzC;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgDtE"}
1
+ {"version":3,"file":"checkConfig.d.ts","sourceRoot":"","sources":["../../../src/cli/checkAndUpdateConfig/checkConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoDlF"}
@@ -24,14 +24,14 @@ async function checkConfig(options) {
24
24
  if (!validationResult.success) {
25
25
  Consts_1.APP_LOGGER.error(LoggerMessages_1.LOGGER_MESSAGES.ERROR.GENERIC(validationResult.errors.join('\n')));
26
26
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
27
- process.exit(1);
27
+ return { success: false, error: validationResult.errors.join('\n') };
28
28
  }
29
29
  const validatedOptions = validationResult.data;
30
30
  const configData = (0, loadConfigIfExists_1.loadConfigIfExists)(validatedOptions.openapiConfig);
31
31
  if (!configData) {
32
32
  Consts_1.APP_LOGGER.error(LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_NOT_FOUND(validatedOptions.openapiConfig || ''));
33
33
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
34
- process.exit(1);
34
+ return { success: false, error: LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_NOT_FOUND(validatedOptions.openapiConfig || '') };
35
35
  }
36
36
  try {
37
37
  const { isActualConfigVersion, hasDefaultValues, migratedData } = (0, validateAndMigrateConfigData_1.validateAndMigrateConfigData)(configData);
@@ -44,7 +44,8 @@ async function checkConfig(options) {
44
44
  warningMessage: LoggerMessages_1.LOGGER_MESSAGES.CONFIG.WARNING_OUTDATED_CONFIG,
45
45
  actionChoices: constants_1.ACTION_FOR_CONFIG_DATA_OPTIONS,
46
46
  });
47
- return;
47
+ await Consts_1.APP_LOGGER.shutdownLoggerAsync();
48
+ return { success: true };
48
49
  }
49
50
  // Если есть значения по умолчанию, предложить их удаление
50
51
  if (hasDefaultValues) {
@@ -55,11 +56,14 @@ async function checkConfig(options) {
55
56
  actionChoices: constants_1.ACTION_FOR_CONFIG_DATA_OPTIONS,
56
57
  });
57
58
  }
59
+ await Consts_1.APP_LOGGER.shutdownLoggerAsync();
60
+ return { success: true };
58
61
  }
59
62
  catch (error) {
60
63
  handleConfigError(LoggerMessages_1.LOGGER_MESSAGES.CONFIG.CHECKING_FAILED, error);
61
64
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
62
- process.exit(1);
65
+ const message = error instanceof Error ? error.message : String(error);
66
+ return { success: false, error: message };
63
67
  }
64
68
  }
65
69
  /**
@@ -1,4 +1,5 @@
1
1
  import { OptionValues } from 'commander';
2
+ import { CLICommandResult } from '../types';
2
3
  /**
3
4
  * Обновляет конфигурационный файл до актуальной версии.
4
5
  * Выполняет миграцию данных при необходимости.
@@ -9,5 +10,5 @@ import { OptionValues } from 'commander';
9
10
  * @example
10
11
  * await updateConfig('./openapi-config.json');
11
12
  */
12
- export declare function updateConfig(options: OptionValues): Promise<void>;
13
+ export declare function updateConfig(options: OptionValues): Promise<CLICommandResult>;
13
14
  //# sourceMappingURL=updateConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateConfig.d.ts","sourceRoot":"","sources":["../../../src/cli/checkAndUpdateConfig/updateConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAUzC;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvE"}
1
+ {"version":3,"file":"updateConfig.d.ts","sourceRoot":"","sources":["../../../src/cli/checkAndUpdateConfig/updateConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI5C;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuCnF"}
@@ -23,14 +23,14 @@ async function updateConfig(options) {
23
23
  if (!validationResult.success) {
24
24
  Consts_1.APP_LOGGER.error(LoggerMessages_1.LOGGER_MESSAGES.ERROR.GENERIC(validationResult.errors.join('\n')));
25
25
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
26
- process.exit(1);
26
+ return { success: false, error: validationResult.errors.join('\n') };
27
27
  }
28
28
  const validatedOptions = validationResult.data;
29
29
  const configData = (0, loadConfigIfExists_1.loadConfigIfExists)(validatedOptions.openapiConfig);
30
30
  if (!configData) {
31
31
  Consts_1.APP_LOGGER.error(LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_NOT_FOUND(validatedOptions.openapiConfig || ''));
32
32
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
33
- process.exit(1);
33
+ return { success: false, error: LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_NOT_FOUND(validatedOptions.openapiConfig || '') };
34
34
  }
35
35
  try {
36
36
  const { isActualConfigVersion, migratedData } = (0, validateAndMigrateConfigData_1.validateAndMigrateConfigData)(configData);
@@ -44,11 +44,14 @@ async function updateConfig(options) {
44
44
  isUpdating: true,
45
45
  });
46
46
  }
47
+ await Consts_1.APP_LOGGER.shutdownLoggerAsync();
48
+ return { success: true };
47
49
  }
48
50
  catch (error) {
49
51
  handleUpdateError(LoggerMessages_1.LOGGER_MESSAGES.CONFIG.UPDATING_FAILED, error);
50
52
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
51
- process.exit(1);
53
+ const message = error instanceof Error ? error.message : String(error);
54
+ return { success: false, error: message };
52
55
  }
53
56
  }
54
57
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"removeDefaultConfigValues.d.ts","sourceRoot":"","sources":["../../../../src/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACrC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAWrB"}
1
+ {"version":3,"file":"removeDefaultConfigValues.d.ts","sourceRoot":"","sources":["../../../../src/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAW9F"}
@@ -1 +1 @@
1
- {"version":3,"file":"validateAndMigrateConfigData.d.ts","sourceRoot":"","sources":["../../../../src/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAGnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,uBAAuB,CAmC7H"}
1
+ {"version":3,"file":"validateAndMigrateConfigData.d.ts","sourceRoot":"","sources":["../../../../src/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AA2BnD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,uBAAuB,CAmC7H"}
@@ -12,6 +12,24 @@ const OptionsVersionedSchemas_1 = require("../../../common/VersionedSchema/Optio
12
12
  const migrateDataToLatestSchemaVersion_1 = require("../../../common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion");
13
13
  const isInstanceOfMultiOptions_1 = require("../../../core/utils/isInstanceOfMultiOptions");
14
14
  const removeDefaultConfigValues_1 = require("./removeDefaultConfigValues");
15
+ const omitUndefinedValues = (data) => {
16
+ const result = {};
17
+ for (const [key, value] of Object.entries(data)) {
18
+ if (value === undefined) {
19
+ continue;
20
+ }
21
+ if (Array.isArray(value)) {
22
+ result[key] = value.map(item => (item && typeof item === 'object' && !Array.isArray(item) ? omitUndefinedValues(item) : item));
23
+ continue;
24
+ }
25
+ if (value && typeof value === 'object') {
26
+ result[key] = omitUndefinedValues(value);
27
+ continue;
28
+ }
29
+ result[key] = value;
30
+ }
31
+ return result;
32
+ };
15
33
  /**
16
34
  * Валидирует и мигрирует данные конфигурации до последней версии схемы.
17
35
  * Определяет тип конфигурации (одиночная или множественная опция) и применяет соответствующий план миграции.
@@ -31,7 +49,7 @@ function validateAndMigrateConfigData(configData) {
31
49
  if (isArrayFormat) {
32
50
  Consts_1.APP_LOGGER.warn(LoggerMessages_1.LOGGER_MESSAGES.CONFIG.ARRAY_DEPRECATED);
33
51
  }
34
- const normalizedData = (0, convertArrayToObject_1.convertArrayToObject)(configData);
52
+ const normalizedData = omitUndefinedValues((0, convertArrayToObject_1.convertArrayToObject)(configData));
35
53
  const isMultiOptions = (0, isInstanceOfMultiOptions_1.isInstanceOfMultioptions)(normalizedData);
36
54
  // Выбрать соответствующие схемы и планы миграции
37
55
  const migrationPlans = isMultiOptions ? MultiOptionsMigrationPlan_1.multiOptionsMigrationPlan : OptionsMigrationPlans_1.optionsMigrationPlans;
@@ -29,6 +29,6 @@ interface IWriteConfigFileOptions {
29
29
  * isUpdating: false,
30
30
  * });
31
31
  */
32
- export declare function writeConfigFile({ data, configPath, isUpdating, }: IWriteConfigFileOptions): Promise<void>;
32
+ export declare function writeConfigFile({ data, configPath, isUpdating }: IWriteConfigFileOptions): Promise<void>;
33
33
  export {};
34
34
  //# sourceMappingURL=writeConfigFile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeConfigFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/checkAndUpdateConfig/utils/writeConfigFile.ts"],"names":[],"mappings":"AAIA,UAAU,uBAAuB;IAC7B,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,UAAU,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,eAAe,CAAC,EAClC,IAAI,EACJ,UAAU,EACV,UAAU,GACb,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYzC"}
1
+ {"version":3,"file":"writeConfigFile.d.ts","sourceRoot":"","sources":["../../../../src/cli/checkAndUpdateConfig/utils/writeConfigFile.ts"],"names":[],"mappings":"AAIA,UAAU,uBAAuB;IAC7B,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,UAAU,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,eAAe,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9G"}
@@ -27,7 +27,7 @@ const writeExampleConfigFile_1 = require("./writeExampleConfigFile");
27
27
  * isUpdating: false,
28
28
  * });
29
29
  */
30
- async function writeConfigFile({ data, configPath, isUpdating, }) {
30
+ async function writeConfigFile({ data, configPath, isUpdating }) {
31
31
  const preparedData = await (0, prepareConfigData_1.prepareConfigData)(data);
32
32
  if (!preparedData) {
33
33
  throw new Error('Failed to prepare configuration data for writing');
@@ -7,6 +7,7 @@ const node_assert_1 = __importDefault(require("node:assert"));
7
7
  const node_fs_1 = require("node:fs");
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const node_test_1 = require("node:test");
10
+ const silenceLoggers_1 = require("../../../test/helpers/silenceLoggers");
10
11
  const generateOpenApiClient_1 = require("../generateOpenApiClient");
11
12
  const repoRoot = node_path_1.default.join(__dirname, '..', '..', '..', '..');
12
13
  const cliDefaults = {
@@ -35,23 +36,31 @@ function createTempDir(t, prefix) {
35
36
  return tempDir;
36
37
  }
37
38
  function runStrictGenerate(options) {
38
- return (0, generateOpenApiClient_1.runGenerateOpenApiClient)({
39
+ return (0, generateOpenApiClient_1.generateOpenApiClient)({
39
40
  ...cliDefaults,
40
41
  ...options,
41
42
  });
42
43
  }
43
44
  (0, node_test_1.describe)('@unit: generateOpenApiClient strict-openapi', () => {
44
- (0, node_test_1.test)('returns exit code 0 and writes report file when strict has no errors', async (t) => {
45
+ let restoreLoggers;
46
+ (0, node_test_1.beforeEach)(() => {
47
+ restoreLoggers = (0, silenceLoggers_1.installSilenceLoggers)();
48
+ });
49
+ (0, node_test_1.afterEach)(() => {
50
+ restoreLoggers?.();
51
+ restoreLoggers = undefined;
52
+ });
53
+ (0, node_test_1.test)('returns success and writes report file when strict has no errors', async (t) => {
45
54
  const tempDir = createTempDir(t, 'openapi-cli-strict-ok-');
46
55
  const reportFile = node_path_1.default.join(tempDir, 'strict-report.json');
47
56
  const outputDir = node_path_1.default.join(tempDir, 'generated');
48
- const exitCode = await runStrictGenerate({
57
+ const result = await runStrictGenerate({
49
58
  input: node_path_1.default.join(repoRoot, 'test/spec/lom/lom_api.yaml'),
50
59
  output: outputDir,
51
60
  strictOpenapi: true,
52
61
  reportFile,
53
62
  });
54
- node_assert_1.default.strictEqual(exitCode, 0);
63
+ node_assert_1.default.strictEqual(result.success, true);
55
64
  const report = JSON.parse((0, node_fs_1.readFileSync)(reportFile, 'utf8'));
56
65
  node_assert_1.default.ok(Array.isArray(report.issues));
57
66
  node_assert_1.default.ok(Array.isArray(report.governance.violations));
@@ -59,7 +68,7 @@ function runStrictGenerate(options) {
59
68
  node_assert_1.default.strictEqual(typeof report.summary.warnings, 'number');
60
69
  node_assert_1.default.strictEqual(typeof report.summary.info, 'number');
61
70
  });
62
- (0, node_test_1.test)('returns exit code 1 and writes report file when strict finds errors', async (t) => {
71
+ (0, node_test_1.test)('returns failure and writes report file when strict finds errors', async (t) => {
63
72
  const tempDir = createTempDir(t, 'openapi-cli-strict-error-');
64
73
  const inputSpec = node_path_1.default.join(tempDir, 'broken-openapi.json');
65
74
  const reportFile = node_path_1.default.join(tempDir, 'strict-report.json');
@@ -92,13 +101,13 @@ function runStrictGenerate(options) {
92
101
  schemas: {},
93
102
  },
94
103
  }));
95
- const exitCode = await runStrictGenerate({
104
+ const result = await runStrictGenerate({
96
105
  input: inputSpec,
97
106
  output: outputDir,
98
107
  strictOpenapi: true,
99
108
  reportFile,
100
109
  });
101
- node_assert_1.default.strictEqual(exitCode, 1);
110
+ node_assert_1.default.strictEqual(result.success, false);
102
111
  const report = JSON.parse((0, node_fs_1.readFileSync)(reportFile, 'utf8'));
103
112
  node_assert_1.default.ok(report.summary.errors > 0);
104
113
  node_assert_1.default.ok(report.issues.some(issue => issue.severity === 'error'));
@@ -137,14 +146,14 @@ function runStrictGenerate(options) {
137
146
  },
138
147
  },
139
148
  }));
140
- const exitCode = await runStrictGenerate({
149
+ const result = await runStrictGenerate({
141
150
  input: inputSpec,
142
151
  output: outputDir,
143
152
  strictOpenapi: true,
144
153
  reportFile,
145
154
  governanceConfig,
146
155
  });
147
- node_assert_1.default.strictEqual(exitCode, 0);
156
+ node_assert_1.default.strictEqual(result.success, true);
148
157
  const report = JSON.parse((0, node_fs_1.readFileSync)(reportFile, 'utf8'));
149
158
  node_assert_1.default.ok(!report.governance.violations.some(violation => violation.ruleId === 'REQUIRE_OPERATION_ID'));
150
159
  node_assert_1.default.ok(report.governance.violations.some(violation => violation.ruleId === 'NO_DEFAULT_WITHOUT_2XX' && violation.severity === 'error'));
@@ -1,11 +1,8 @@
1
1
  import { OptionValues } from 'commander';
2
+ import { CLICommandResult } from '../types';
2
3
  /**
3
4
  * Runs OpenAPI client generation and returns a process exit code.
4
5
  * Does not call `process.exit` — safe for in-process unit tests.
5
6
  */
6
- export declare function runGenerateOpenApiClient(options: OptionValues): Promise<number>;
7
- /**
8
- * CLI entry: runs generation and terminates the process with the resulting exit code.
9
- */
10
- export declare function generateOpenApiClient(options: OptionValues): Promise<void>;
7
+ export declare function generateOpenApiClient(options: OptionValues): Promise<CLICommandResult>;
11
8
  //# sourceMappingURL=generateOpenApiClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateOpenApiClient.d.ts","sourceRoot":"","sources":["../../../src/cli/generateOpenApiClient/generateOpenApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AA0BzC;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CA+FrF;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhF"}
1
+ {"version":3,"file":"generateOpenApiClient.d.ts","sourceRoot":"","sources":["../../../src/cli/generateOpenApiClient/generateOpenApiClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAezC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAY5C;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2G5F"}
@@ -33,7 +33,6 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.runGenerateOpenApiClient = runGenerateOpenApiClient;
37
36
  exports.generateOpenApiClient = generateOpenApiClient;
38
37
  const Consts_1 = require("../../common/Consts");
39
38
  const Enums_1 = require("../../common/Enums");
@@ -60,7 +59,7 @@ const generateCliFlatSchema = UnifiedVersionedSchemas_1.flatOptionsSchema.strict
60
59
  * Runs OpenAPI client generation and returns a process exit code.
61
60
  * Does not call `process.exit` — safe for in-process unit tests.
62
61
  */
63
- async function runGenerateOpenApiClient(options) {
62
+ async function generateOpenApiClient(options) {
64
63
  const { openapiConfig, ...clientOptions } = options;
65
64
  try {
66
65
  const validationResult = (0, validateZodOptions_1.validateZodOptions)(schemas_1.generateOptionsSchema, {
@@ -73,7 +72,7 @@ async function runGenerateOpenApiClient(options) {
73
72
  message: LoggerMessages_1.LOGGER_MESSAGES.ERROR.GENERIC(validationResult.errors.join('\n')),
74
73
  });
75
74
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
76
- return 1;
75
+ return { success: false, error: validationResult.errors.join('\n') };
77
76
  }
78
77
  const validatedOptions = validationResult.data;
79
78
  const hasMinimumRequiredOptions = !!validatedOptions.input && !!validatedOptions.output;
@@ -89,11 +88,16 @@ async function runGenerateOpenApiClient(options) {
89
88
  message: LoggerMessages_1.LOGGER_MESSAGES.ERROR.GENERIC(directOptionsValidationResult.errors.join('\n')),
90
89
  });
91
90
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
92
- return 1;
91
+ return { success: false, error: directOptionsValidationResult.errors.join('\n') };
93
92
  }
94
- await OpenAPI.generate(directOptionsValidationResult.data);
93
+ await OpenAPI.generate({
94
+ ...directOptionsValidationResult.data,
95
+ prettierConfigPath: validatedOptions.prettierConfigPath,
96
+ tsconfigPath: validatedOptions.tsconfigPath,
97
+ eslintConfigPath: validatedOptions.eslintConfigPath,
98
+ });
95
99
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
96
- return 0;
100
+ return { success: true };
97
101
  }
98
102
  const configData = (0, loadConfigIfExists_1.loadConfigIfExists)(validatedOptions.openapiConfig);
99
103
  if (!configData) {
@@ -102,7 +106,7 @@ async function runGenerateOpenApiClient(options) {
102
106
  message: `${LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_MISSING}\n${LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_MISSING_HINT}`,
103
107
  });
104
108
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
105
- return 1;
109
+ return { success: false, error: LoggerMessages_1.LOGGER_MESSAGES.CONFIG.FILE_MISSING };
106
110
  }
107
111
  if (Array.isArray(configData)) {
108
112
  Consts_1.APP_LOGGER.warn(LoggerMessages_1.LOGGER_MESSAGES.CONFIG.ARRAY_DEPRECATED);
@@ -120,7 +124,7 @@ async function runGenerateOpenApiClient(options) {
120
124
  message: LoggerMessages_1.LOGGER_MESSAGES.CONFIG.CONVERSION_FAILED,
121
125
  });
122
126
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
123
- return 1;
127
+ return { success: false, error: LoggerMessages_1.LOGGER_MESSAGES.CONFIG.CONVERSION_FAILED };
124
128
  }
125
129
  const { value } = migratedOptions;
126
130
  const mergedOptions = {
@@ -128,10 +132,17 @@ async function runGenerateOpenApiClient(options) {
128
132
  strictOpenapi: validatedOptions.strictOpenapi ?? value.strictOpenapi,
129
133
  reportFile: validatedOptions.reportFile ?? value.reportFile,
130
134
  governanceConfig: validatedOptions.governanceConfig ?? value.governanceConfig,
135
+ cache: validatedOptions.cache ?? value.cache,
136
+ cachePath: validatedOptions.cachePath ?? value.cachePath,
137
+ cacheStrategy: validatedOptions.cacheStrategy ?? value.cacheStrategy,
138
+ cacheDebug: validatedOptions.cacheDebug ?? value.cacheDebug,
139
+ prettierConfigPath: validatedOptions.prettierConfigPath ?? value.prettierConfigPath,
140
+ tsconfigPath: validatedOptions.tsconfigPath ?? value.tsconfigPath,
141
+ eslintConfigPath: validatedOptions.eslintConfigPath ?? value.eslintConfigPath,
131
142
  };
132
143
  await OpenAPI.generate(mergedOptions);
133
144
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
134
- return 0;
145
+ return { success: true };
135
146
  }
136
147
  catch (error) {
137
148
  const message = error instanceof Error ? error.message : String(error);
@@ -141,13 +152,6 @@ async function runGenerateOpenApiClient(options) {
141
152
  error,
142
153
  });
143
154
  await Consts_1.APP_LOGGER.shutdownLoggerAsync();
144
- return 1;
155
+ return { success: false, error: message };
145
156
  }
146
157
  }
147
- /**
148
- * CLI entry: runs generation and terminates the process with the resulting exit code.
149
- */
150
- async function generateOpenApiClient(options) {
151
- const exitCode = await runGenerateOpenApiClient(options);
152
- process.exit(exitCode);
153
- }
package/dist/cli/index.js CHANGED
@@ -16,6 +16,7 @@ const HttpClient_enum_1 = require("../core/types/enums/HttpClient.enum");
16
16
  const ModelsMode_enum_1 = require("../core/types/enums/ModelsMode.enum");
17
17
  const ValidationLibrary_enum_1 = require("../core/types/enums/ValidationLibrary.enum");
18
18
  const analyzeDiff_1 = require("./analyzeDiff/analyzeDiff");
19
+ const analyzeUsage_1 = require("./analyzeUsage/analyzeUsage");
19
20
  const checkConfig_1 = require("./checkAndUpdateConfig/checkConfig");
20
21
  const updateConfig_1 = require("./checkAndUpdateConfig/updateConfig");
21
22
  const generateOpenApiClient_1 = require("./generateOpenApiClient/generateOpenApiClient");
@@ -31,6 +32,12 @@ const updateNotifier = new UpdateNotifier_1.UpdateNotifier({
31
32
  packageVersion: APP_VERSION,
32
33
  });
33
34
  const program = new commander_1.Command();
35
+ const finishCommand = (result) => {
36
+ if (!result || !result.success) {
37
+ process.exit(1);
38
+ }
39
+ process.exit(0);
40
+ };
34
41
  program.version(APP_VERSION).name(APP_NAME).description(APP_DESCRIPTION).addHelpText('before', (0, utils_1.getCLIName)(APP_NAME));
35
42
  /**
36
43
  * generate - Команда для генерации кода на основе OpenAPI спецификации
@@ -60,7 +67,6 @@ program
60
67
  .option('--enumPrefix <value>', 'Prefix for enum model(default: "E")', 'E')
61
68
  .option('--typePrefix <value>', 'Prefix for type model(default: "T")', 'T')
62
69
  .option('--useCancelableRequest', 'Use cancelled promise as returned data type in request (default: false)')
63
- .option('--useRequestRaw [value]', 'Generate requestRaw methods and raw HTTP stack (default: true)', (value) => value === undefined || value === 'true' || value === true)
64
70
  .addOption(new commander_1.Option('-l, --logLevel <level>', 'Logging level').choices([...Object.values(Enums_1.ELogLevel)]).default(Enums_1.ELogLevel.ERROR))
65
71
  .addOption(new commander_1.Option('-t, --logTarget <target>', 'Target of logging').choices([...Object.values(Enums_1.ELogOutput)]).default(Enums_1.ELogOutput.CONSOLE))
66
72
  .option('-s, --sortByRequired', 'Property sorting strategy: simplified or extended')
@@ -70,13 +76,19 @@ program
70
76
  .option('--governance-config <value>', 'Path to governance rules JSON config file')
71
77
  .addOption(new commander_1.Option('--validationLibrary <value>', 'Validation library to use for schema validation').choices([...Object.values(ValidationLibrary_enum_1.ValidationLibrary)]).default(ValidationLibrary_enum_1.ValidationLibrary.NONE))
72
78
  .addOption(new commander_1.Option('--emptySchemaStrategy <value>', 'How to handle empty generated schemas').choices([...Object.values(EmptySchemaStrategy_enum_1.EmptySchemaStrategy)]).default(EmptySchemaStrategy_enum_1.EmptySchemaStrategy.KEEP))
73
- .option('--useProjectPrettier', 'Use project Prettier config for formatting generated code (default: false)')
74
- .option('--useEslintFix', 'Run ESLint --fix on generated files after writing (default: false)')
79
+ .option('--prettierConfigPath <value>', 'Path to Prettier config file for formatting generated code')
80
+ .option('--tsconfigPath <value>', 'Path to project tsconfig.json for batch ESLint fix (requires --eslintConfigPath)')
81
+ .option('--eslintConfigPath <value>', 'Path to project ESLint config for batch ESLint fix (requires --tsconfigPath)')
82
+ .option('--cache', 'Enable generation cache (default: disabled)')
83
+ .option('--cachePath <value>', 'Path to generation cache file relative to output directory (default: .openapi-codegen-cache.json)')
84
+ .addOption(new commander_1.Option('--cacheStrategy <value>', 'Cache strategy').choices(['content', 'entity']).default('entity'))
85
+ .option('--cacheDebug', 'Show cache hit/miss debug logs (default: false)')
75
86
  .hook('preAction', async () => {
76
87
  await updateNotifier.checkAndNotify();
77
88
  })
78
89
  .action(async (options) => {
79
- await (0, generateOpenApiClient_1.generateOpenApiClient)(options);
90
+ const result = await (0, generateOpenApiClient_1.generateOpenApiClient)(options);
91
+ finishCommand(result);
80
92
  });
81
93
  /**
82
94
  * check - Команда для проверки конфигурационного файла
@@ -90,7 +102,8 @@ program
90
102
  await updateNotifier.checkAndNotify();
91
103
  })
92
104
  .action(async (options) => {
93
- await (0, checkConfig_1.checkConfig)(options);
105
+ const result = await (0, checkConfig_1.checkConfig)(options);
106
+ finishCommand(result);
94
107
  });
95
108
  /**
96
109
  * update - Команда для обновления конфигурационного файла
@@ -104,7 +117,8 @@ program
104
117
  await updateNotifier.checkAndNotify();
105
118
  })
106
119
  .action(async (options) => {
107
- await (0, updateConfig_1.updateConfig)(options);
120
+ const result = await (0, updateConfig_1.updateConfig)(options);
121
+ finishCommand(result);
108
122
  });
109
123
  /**
110
124
  * init - Команда для инициализации конфигурационного файла
@@ -117,13 +131,13 @@ program
117
131
  .option('-sd, --specs-dir <value>', 'Путь до директории с файлами спецификации', './openapi')
118
132
  .option('--request <value>', 'Path to custom request file')
119
133
  .option('--useCancelableRequest', 'Use cancelled promise as returned data type in request (default: false)')
120
- .option('--useRequestRaw [value]', 'Generate requestRaw methods and raw HTTP stack (default: true)', (value) => value === undefined || value === true || value === 'true')
121
134
  .option('--useInteractiveMode', 'Использовать интерактивный режим команды. В терминале будут задаваться вопросы (default: false)')
122
135
  .hook('preAction', async () => {
123
136
  await updateNotifier.checkAndNotify();
124
137
  })
125
138
  .action(async (options) => {
126
- await (0, init_1.init)(options);
139
+ const result = await (0, init_1.init)(options);
140
+ finishCommand(result);
127
141
  });
128
142
  /**
129
143
  * preview-changes - Команда для предпросмотра изменений перед генерацией
@@ -140,7 +154,8 @@ program
140
154
  await updateNotifier.checkAndNotify();
141
155
  })
142
156
  .action(async (options) => {
143
- await (0, previewChanges_1.previewChanges)(options);
157
+ const result = await (0, previewChanges_1.previewChanges)(options);
158
+ finishCommand(result);
144
159
  });
145
160
  /**
146
161
  * analyze-diff - Команда для анализа изменений между двумя версиями OpenAPI спецификации
@@ -182,8 +197,26 @@ program
182
197
  })
183
198
  .action(async (options) => {
184
199
  const result = await (0, analyzeDiff_1.analyzeDiff)(options);
185
- await Consts_1.APP_LOGGER.shutdownLoggerAsync();
186
- process.exit((0, analyzeDiff_1.toAnalyzeDiffExitCode)(result));
200
+ finishCommand(result);
201
+ });
202
+ /**
203
+ * analyze-usage - Команда для анализа использования generated API в consumer-проекте
204
+ */
205
+ program
206
+ .command('analyze-usage')
207
+ .description('Analyzes generated API usage in a TypeScript consumer project and produces usage reports')
208
+ .addHelpText('before', (0, utils_1.getCLIName)(APP_NAME))
209
+ .option('-s, --sourcePath <value>', 'Path to generated API file')
210
+ .option('-p, --projectPath <value>', 'Root of your React/TS project')
211
+ .option('-t, --tsconfigPath <value>', 'Optional path to tsconfig.json')
212
+ .option('-o, --output <value>', 'Output report filename', 'api-report.json')
213
+ .option('-c, --check', 'CI mode (exit code 1 when errors are found)')
214
+ .hook('preAction', async () => {
215
+ await updateNotifier.checkAndNotify();
216
+ })
217
+ .action(async (options) => {
218
+ const result = await (0, analyzeUsage_1.analyzeUsage)(options);
219
+ finishCommand(result);
187
220
  });
188
221
  program.exitOverride();
189
222
  program.showSuggestionAfterError(false);
@@ -7,23 +7,13 @@ const node_assert_1 = __importDefault(require("node:assert"));
7
7
  const node_test_1 = require("node:test");
8
8
  const Consts_1 = require("../../../common/Consts");
9
9
  const init_1 = require("../init");
10
- class ProcessExitError extends Error {
11
- exitCode;
12
- constructor(exitCode) {
13
- super(`process.exit(${exitCode})`);
14
- this.exitCode = exitCode;
15
- this.name = 'ProcessExitError';
16
- }
17
- }
18
10
  (0, node_test_1.describe)('@unit: init', () => {
19
- (0, node_test_1.test)('exits when options fail schema validation', async () => {
20
- const exitMock = node_test_1.mock.method(process, 'exit', (code) => {
21
- throw new ProcessExitError(Number(code ?? 0));
22
- });
11
+ (0, node_test_1.test)('returns failure when options fail schema validation', async () => {
23
12
  const shutdownMock = node_test_1.mock.method(Consts_1.APP_LOGGER, 'shutdownLoggerAsync', async () => undefined);
24
13
  const errorMock = node_test_1.mock.method(Consts_1.APP_LOGGER, 'error', () => undefined);
25
- await node_assert_1.default.rejects(() => (0, init_1.init)({ specsDir: 123 }), ProcessExitError);
26
- exitMock.mock.restore();
14
+ const result = await (0, init_1.init)({ specsDir: 123 });
15
+ node_assert_1.default.strictEqual(result.success, false);
16
+ node_assert_1.default.ok(result.error);
27
17
  shutdownMock.mock.restore();
28
18
  errorMock.mock.restore();
29
19
  });
@@ -9,6 +9,7 @@ const node_os_1 = require("node:os");
9
9
  const node_path_1 = require("node:path");
10
10
  const node_test_1 = require("node:test");
11
11
  const Consts_1 = require("../../../common/Consts");
12
+ const silenceLoggers_1 = require("../../../test/helpers/silenceLoggers");
12
13
  const initConfig_1 = require("../initConfig");
13
14
  const registerHandlebarTemplates_1 = require("../utils/registerHandlebarTemplates");
14
15
  (0, node_test_1.describe)('@unit: initConfig', () => {
@@ -30,7 +31,8 @@ const registerHandlebarTemplates_1 = require("../utils/registerHandlebarTemplate
30
31
  warnMock.mock.restore();
31
32
  infoMock.mock.restore();
32
33
  });
33
- (0, node_test_1.test)('writes example config when no specs are found', async () => {
34
+ (0, node_test_1.test)('writes example config when no specs are found', async (t) => {
35
+ (0, silenceLoggers_1.silenceAppLogger)(t);
34
36
  const dir = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'init-config-'));
35
37
  const configPath = (0, node_path_1.join)(dir, 'new-openapi.config.json');
36
38
  const templates = (0, registerHandlebarTemplates_1.registerHandlebarTemplates)();