ts-openapi-codegen 2.1.0-beta.7 → 2.1.0-beta.9

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 (333) hide show
  1. package/README.md +7 -0
  2. package/README.rus.md +7 -0
  3. package/dist/cli/analyzeDiff/__tests__/analyzeDiff.cli.test.js +31 -24
  4. package/dist/cli/analyzeDiff/__tests__/analyzeDiffLomMiracles.test.d.ts +2 -0
  5. package/dist/cli/analyzeDiff/__tests__/analyzeDiffLomMiracles.test.d.ts.map +1 -0
  6. package/dist/cli/analyzeDiff/__tests__/analyzeDiffLomMiracles.test.js +47 -0
  7. package/dist/cli/analyzeDiff/__tests__/analyzeDiffRenameAndInvalidRegex.test.js +8 -7
  8. package/dist/cli/analyzeDiff/__tests__/analyzeDiffTypeCoercion.test.js +8 -7
  9. package/dist/cli/analyzeDiff/analyzeDiff.d.ts +14 -2
  10. package/dist/cli/analyzeDiff/analyzeDiff.d.ts.map +1 -1
  11. package/dist/cli/analyzeDiff/analyzeDiff.js +56 -13
  12. package/dist/cli/analyzeDiff/ciSummary.d.ts +6 -3
  13. package/dist/cli/analyzeDiff/ciSummary.d.ts.map +1 -1
  14. package/dist/cli/analyzeDiff/ciSummary.js +10 -6
  15. package/dist/cli/analyzeDiff/ignoreRules.d.ts +0 -6
  16. package/dist/cli/analyzeDiff/ignoreRules.d.ts.map +1 -1
  17. package/dist/cli/analyzeDiff/ignoreRules.js +2 -3
  18. package/dist/cli/analyzeDiff/report.d.ts +0 -1
  19. package/dist/cli/analyzeDiff/report.d.ts.map +1 -1
  20. package/dist/cli/analyzeDiff/report.js +1 -3
  21. package/dist/cli/analyzeDiff/writeLegacyReport.d.ts +2 -0
  22. package/dist/cli/analyzeDiff/writeLegacyReport.d.ts.map +1 -1
  23. package/dist/cli/analyzeDiff/writeLegacyReport.js +2 -0
  24. package/dist/cli/analyzeUsage/analyzeUsage.d.ts +2 -2
  25. package/dist/cli/analyzeUsage/analyzeUsage.d.ts.map +1 -1
  26. package/dist/cli/analyzeUsage/analyzeUsage.js +10 -12
  27. package/dist/cli/analyzeUsage/core/ProjectContext.d.ts +1 -1
  28. package/dist/cli/analyzeUsage/core/ProjectContext.d.ts.map +1 -1
  29. package/dist/cli/analyzeUsage/core/ProjectContext.js +5 -10
  30. package/dist/cli/analyzeUsage/core/Scanner.d.ts +8 -0
  31. package/dist/cli/analyzeUsage/core/Scanner.d.ts.map +1 -1
  32. package/dist/cli/analyzeUsage/core/Scanner.js +10 -0
  33. package/dist/cli/analyzeUsage/rules/ClientRule.d.ts +10 -2
  34. package/dist/cli/analyzeUsage/rules/ClientRule.d.ts.map +1 -1
  35. package/dist/cli/analyzeUsage/rules/ClientRule.js +29 -21
  36. package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts +2 -2
  37. package/dist/cli/analyzeUsage/rules/CoverageRule.d.ts.map +1 -1
  38. package/dist/cli/analyzeUsage/rules/CoverageRule.js +16 -24
  39. package/dist/cli/analyzeUsage/rules/DiagnosticsRule.d.ts.map +1 -1
  40. package/dist/cli/analyzeUsage/rules/DiagnosticsRule.js +4 -1
  41. package/dist/cli/analyzeUsage/rules/ImportRule.d.ts +2 -2
  42. package/dist/cli/analyzeUsage/rules/ImportRule.d.ts.map +1 -1
  43. package/dist/cli/analyzeUsage/rules/ImportRule.js +9 -11
  44. package/dist/cli/analyzeUsage/rules/ModelRule.d.ts +2 -2
  45. package/dist/cli/analyzeUsage/rules/ModelRule.d.ts.map +1 -1
  46. package/dist/cli/analyzeUsage/rules/ModelRule.js +4 -8
  47. package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts +2 -2
  48. package/dist/cli/analyzeUsage/rules/SchemaRule.d.ts.map +1 -1
  49. package/dist/cli/analyzeUsage/rules/SchemaRule.js +8 -10
  50. package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts +10 -2
  51. package/dist/cli/analyzeUsage/rules/ServiceRule.d.ts.map +1 -1
  52. package/dist/cli/analyzeUsage/rules/ServiceRule.js +27 -23
  53. package/dist/cli/analyzeUsage/types.d.ts +4 -4
  54. package/dist/cli/analyzeUsage/types.d.ts.map +1 -1
  55. package/dist/cli/analyzeUsage/utils/fuzzy.d.ts.map +1 -1
  56. package/dist/cli/analyzeUsage/utils/report.d.ts +1 -1
  57. package/dist/cli/analyzeUsage/utils/report.d.ts.map +1 -1
  58. package/dist/cli/analyzeUsage/utils/report.js +8 -8
  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 +1 -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/generateOpenApiClient.d.ts.map +1 -1
  66. package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +9 -1
  67. package/dist/cli/index.js +3 -2
  68. package/dist/cli/initOpenApiConfig/utils/__tests__/buildConfig.test.js +2 -8
  69. package/dist/cli/initOpenApiConfig/utils/registerHandlebarTemplates.d.ts.map +1 -1
  70. package/dist/cli/interactive/constants.d.ts +0 -4
  71. package/dist/cli/interactive/constants.d.ts.map +1 -1
  72. package/dist/cli/interactive/constants.js +1 -5
  73. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
  74. package/dist/cli/previewChanges/utils/formatDiff.d.ts.map +1 -1
  75. package/dist/cli/previewChanges/utils/updateOutputPaths.d.ts.map +1 -1
  76. package/dist/cli/previewChanges/utils/updateOutputPaths.js +5 -12
  77. package/dist/cli/schemas/analyzeUsage.d.ts.map +1 -1
  78. package/dist/cli/schemas/analyzeUsage.js +4 -1
  79. package/dist/cli/schemas/generate.d.ts +3 -2
  80. package/dist/cli/schemas/generate.d.ts.map +1 -1
  81. package/dist/cli/schemas/generate.js +3 -2
  82. package/dist/common/Consts.d.ts.map +1 -1
  83. package/dist/common/Consts.js +1 -2
  84. package/dist/common/Logger.d.ts.map +1 -1
  85. package/dist/common/Logger.js +1 -1
  86. package/dist/common/LoggerMessages.d.ts +15 -3
  87. package/dist/common/LoggerMessages.d.ts.map +1 -1
  88. package/dist/common/LoggerMessages.js +18 -7
  89. package/dist/common/TEslintFixOptions.d.ts +20 -0
  90. package/dist/common/TEslintFixOptions.d.ts.map +1 -0
  91. package/dist/common/TEslintFixOptions.js +15 -0
  92. package/dist/common/TRawOptions.d.ts.map +1 -1
  93. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -1
  94. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +2 -4
  95. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
  96. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +1 -1
  97. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -1
  98. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +1 -2
  99. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
  100. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +1 -1
  101. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
  102. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +1 -1
  103. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV4.d.ts.map +1 -1
  104. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts +3 -2
  105. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.d.ts.map +1 -1
  106. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV5.js +10 -4
  107. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +4 -4
  108. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -1
  109. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +7 -1
  110. package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
  111. package/dist/common/VersionedSchema/CommonSchemas.js +4 -2
  112. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +1 -1
  113. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
  114. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +1 -1
  115. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +1 -1
  116. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
  117. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
  118. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +2 -2
  119. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
  120. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +2 -2
  121. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +1 -1
  122. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +1 -1
  123. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -1
  124. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +3 -2
  125. package/dist/common/VersionedSchema/Utils/__tests__/allUtils.test.js +4 -16
  126. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -1
  127. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts +1 -1
  128. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts.map +1 -1
  129. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.js +1 -1
  130. package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts.map +1 -1
  131. package/dist/common/VersionedSchema/Utils/createTrivialMigration.js +1 -1
  132. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  133. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +1 -3
  134. package/dist/common/VersionedSchema/Utils/getLatestVersionFromMigrationPlans.d.ts.map +1 -1
  135. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  136. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +1 -3
  137. package/dist/common/VersionedSchema/Utils/replaceInvalidKeysWithMappedNames.d.ts.map +1 -1
  138. package/dist/common/VersionedSchema/Utils/replaceInvalidKeysWithMappedNames.js +1 -1
  139. package/dist/common/VersionedSchema/Utils/validateAndSuggestKeyCorrections.d.ts.map +1 -1
  140. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +1 -1
  141. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -1
  142. package/dist/common/utils/__tests__/eslintFix.test.js +25 -67
  143. package/dist/common/utils/__tests__/extractEslintFixOptions.test.d.ts +2 -0
  144. package/dist/common/utils/__tests__/extractEslintFixOptions.test.d.ts.map +1 -0
  145. package/dist/common/utils/__tests__/extractEslintFixOptions.test.js +28 -0
  146. package/dist/common/utils/__tests__/format.test.js +26 -17
  147. package/dist/common/utils/__tests__/prepareTempTsConfig.test.d.ts +2 -0
  148. package/dist/common/utils/__tests__/prepareTempTsConfig.test.d.ts.map +1 -0
  149. package/dist/common/utils/__tests__/prepareTempTsConfig.test.js +78 -0
  150. package/dist/common/utils/codegenTempDir.d.ts +20 -0
  151. package/dist/common/utils/codegenTempDir.d.ts.map +1 -0
  152. package/dist/common/utils/codegenTempDir.js +42 -0
  153. package/dist/common/utils/convertArrayToObject.d.ts.map +1 -1
  154. package/dist/common/utils/convertArrayToObject.js +3 -8
  155. package/dist/common/utils/eslintFix.d.ts +48 -4
  156. package/dist/common/utils/eslintFix.d.ts.map +1 -1
  157. package/dist/common/utils/eslintFix.js +121 -15
  158. package/dist/common/utils/format.d.ts +1 -1
  159. package/dist/common/utils/format.d.ts.map +1 -1
  160. package/dist/common/utils/format.js +23 -11
  161. package/dist/common/utils/jsonPath.d.ts.map +1 -1
  162. package/dist/common/utils/prepareTempEslintConfig.d.ts +18 -0
  163. package/dist/common/utils/prepareTempEslintConfig.d.ts.map +1 -0
  164. package/dist/common/utils/prepareTempEslintConfig.js +55 -0
  165. package/dist/common/utils/prepareTempTsConfig.d.ts +23 -0
  166. package/dist/common/utils/prepareTempTsConfig.d.ts.map +1 -0
  167. package/dist/common/utils/prepareTempTsConfig.js +105 -0
  168. package/dist/core/Context.d.ts.map +1 -1
  169. package/dist/core/Context.js +2 -6
  170. package/dist/core/OpenApiClient.d.ts +15 -0
  171. package/dist/core/OpenApiClient.d.ts.map +1 -1
  172. package/dist/core/OpenApiClient.js +68 -10
  173. package/dist/core/WriteClient.d.ts +73 -17
  174. package/dist/core/WriteClient.d.ts.map +1 -1
  175. package/dist/core/WriteClient.js +72 -18
  176. package/dist/core/__tests__/WriteClient.test.js +1 -1
  177. package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
  178. package/dist/core/api/v2/parser/getOperationResponses.js +1 -3
  179. package/dist/core/api/v2/parser/getServiceName.d.ts +1 -1
  180. package/dist/core/api/v3/parser/getOperation.d.ts.map +1 -1
  181. package/dist/core/api/v3/parser/getOperationParameters.d.ts.map +1 -1
  182. package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
  183. package/dist/core/api/v3/parser/getOperationResponses.js +1 -3
  184. package/dist/core/api/v3/parser/getServiceName.d.ts +1 -1
  185. package/dist/core/governance/evaluateGovernanceRules.d.ts.map +1 -1
  186. package/dist/core/governance/evaluateGovernanceRules.js +1 -3
  187. package/dist/core/governance/loadGovernanceConfig.d.ts.map +1 -1
  188. package/dist/core/governance/loadGovernanceConfig.js +2 -4
  189. package/dist/core/plugins/GeneratorPlugin.model.d.ts.map +1 -1
  190. package/dist/core/plugins/applySemanticDiffPluginHooks.d.ts.map +1 -1
  191. package/dist/core/semanticDiff/__tests__/analyzeOpenApiDiff.test.js +79 -21
  192. package/dist/core/semanticDiff/__tests__/semanticDiffReportSchema.test.js +20 -1
  193. package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts +58 -6
  194. package/dist/core/semanticDiff/analyzeOpenApiDiff.d.ts.map +1 -1
  195. package/dist/core/semanticDiff/analyzeOpenApiDiff.js +47 -19
  196. package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts +9 -1
  197. package/dist/core/semanticDiff/semanticDiffReportSchema.d.ts.map +1 -1
  198. package/dist/core/semanticDiff/semanticDiffReportSchema.js +137 -53
  199. package/dist/core/strict/validateOpenApiStrict.d.ts.map +1 -1
  200. package/dist/core/types/Consts.js +1 -1
  201. package/dist/core/types/DiffReport.model.d.ts +101 -0
  202. package/dist/core/types/DiffReport.model.d.ts.map +1 -0
  203. package/dist/core/types/DiffReport.model.js +5 -0
  204. package/dist/core/types/base/ClientArtifacts.model.d.ts +3 -3
  205. package/dist/core/types/base/ClientArtifacts.model.d.ts.map +1 -1
  206. package/dist/core/types/base/ExportedModel.model.d.ts +1 -1
  207. package/dist/core/types/base/ExportedModel.model.d.ts.map +1 -1
  208. package/dist/core/types/base/ExportedService.model.d.ts.map +1 -1
  209. package/dist/core/types/base/OutputPaths.model.d.ts.map +1 -1
  210. package/dist/core/types/base/PrefixArtifacts.model.d.ts.map +1 -1
  211. package/dist/core/types/base/PropertyGroup.model.d.ts +1 -1
  212. package/dist/core/types/base/SimpleClientArtifacts.model.d.ts +1 -1
  213. package/dist/core/types/base/SimpleClientArtifacts.model.d.ts.map +1 -1
  214. package/dist/core/types/shared/Model.model.d.ts +36 -0
  215. package/dist/core/types/shared/Model.model.d.ts.map +1 -1
  216. package/dist/core/utils/__tests__/applyDiffReportToClient.test.js +182 -0
  217. package/dist/core/utils/__tests__/buildMiraclesFromSemanticChanges.test.d.ts +2 -0
  218. package/dist/core/utils/__tests__/buildMiraclesFromSemanticChanges.test.d.ts.map +1 -0
  219. package/dist/core/utils/__tests__/buildMiraclesFromSemanticChanges.test.js +77 -0
  220. package/dist/core/utils/__tests__/expandOpenApiRefsForSemanticDiff.test.d.ts +2 -0
  221. package/dist/core/utils/__tests__/expandOpenApiRefsForSemanticDiff.test.d.ts.map +1 -0
  222. package/dist/core/utils/__tests__/expandOpenApiRefsForSemanticDiff.test.js +159 -0
  223. package/dist/core/utils/__tests__/loadDiffReport.test.js +131 -0
  224. package/dist/core/utils/__tests__/modelHelpers.test.js +27 -9
  225. package/dist/core/utils/__tests__/postProcessModelImports.test.js +1 -4
  226. package/dist/core/utils/__tests__/postProcessServiceImports.test.js +1 -4
  227. package/dist/core/utils/__tests__/prepareDtoModels.test.js +74 -2
  228. package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +27 -0
  229. package/dist/core/utils/__tests__/resolveClassesModeTypes.test.d.ts +2 -0
  230. package/dist/core/utils/__tests__/resolveClassesModeTypes.test.d.ts.map +1 -0
  231. package/dist/core/utils/__tests__/resolveClassesModeTypes.test.js +111 -0
  232. package/dist/core/utils/__tests__/semanticChangesToDiffEntries.test.d.ts +2 -0
  233. package/dist/core/utils/__tests__/semanticChangesToDiffEntries.test.d.ts.map +1 -0
  234. package/dist/core/utils/__tests__/semanticChangesToDiffEntries.test.js +68 -0
  235. package/dist/core/utils/__tests__/serviceHelpers.test.js +10 -11
  236. package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +10 -27
  237. package/dist/core/utils/__tests__/templateRendering.test.js +71 -0
  238. package/dist/core/utils/adapters/__tests__/semanticToStructural.test.d.ts +2 -0
  239. package/dist/core/utils/adapters/__tests__/semanticToStructural.test.d.ts.map +1 -0
  240. package/dist/core/utils/adapters/__tests__/semanticToStructural.test.js +63 -0
  241. package/dist/core/utils/adapters/extractMiraclesFromSemantic.d.ts +10 -0
  242. package/dist/core/utils/adapters/extractMiraclesFromSemantic.d.ts.map +1 -0
  243. package/dist/core/utils/adapters/extractMiraclesFromSemantic.js +13 -0
  244. package/dist/core/utils/adapters/index.d.ts +4 -0
  245. package/dist/core/utils/adapters/index.d.ts.map +1 -0
  246. package/dist/core/utils/adapters/index.js +8 -0
  247. package/dist/core/utils/adapters/semanticToStructural.d.ts +12 -0
  248. package/dist/core/utils/adapters/semanticToStructural.d.ts.map +1 -0
  249. package/dist/core/utils/adapters/semanticToStructural.js +36 -0
  250. package/dist/core/utils/appendUniqueLinesToFile.js +1 -1
  251. package/dist/core/utils/applyDiffReportToClient.d.ts +13 -1
  252. package/dist/core/utils/applyDiffReportToClient.d.ts.map +1 -1
  253. package/dist/core/utils/applyDiffReportToClient.js +189 -109
  254. package/dist/core/utils/areEqual.d.ts +1 -1
  255. package/dist/core/utils/buildMiraclesFromSemanticChanges.d.ts +25 -0
  256. package/dist/core/utils/buildMiraclesFromSemanticChanges.d.ts.map +1 -0
  257. package/dist/core/utils/buildMiraclesFromSemanticChanges.js +146 -0
  258. package/dist/core/utils/expandOpenApiRefsForSemanticDiff.d.ts +23 -0
  259. package/dist/core/utils/expandOpenApiRefsForSemanticDiff.d.ts.map +1 -0
  260. package/dist/core/utils/expandOpenApiRefsForSemanticDiff.js +163 -0
  261. package/dist/core/utils/getOpenApiSpec.d.ts +18 -0
  262. package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
  263. package/dist/core/utils/getOpenApiSpec.js +35 -0
  264. package/dist/core/utils/getOperationErrors.d.ts +2 -2
  265. package/dist/core/utils/getOperationErrors.d.ts.map +1 -1
  266. package/dist/core/utils/getOperationResults.d.ts +1 -1
  267. package/dist/core/utils/getPropertyGroupSimple.d.ts.map +1 -1
  268. package/dist/core/utils/getPropertyGroupSimple.js +1 -3
  269. package/dist/core/utils/isSubdirectory.d.ts.map +1 -1
  270. package/dist/core/utils/loadDiffReport.d.ts +11 -30
  271. package/dist/core/utils/loadDiffReport.d.ts.map +1 -1
  272. package/dist/core/utils/loadDiffReport.js +69 -3
  273. package/dist/core/utils/loadSemanticOpenApiSpec.d.ts +15 -0
  274. package/dist/core/utils/loadSemanticOpenApiSpec.d.ts.map +1 -0
  275. package/dist/core/utils/loadSemanticOpenApiSpec.js +61 -0
  276. package/dist/core/utils/modelHelpers.d.ts +13 -5
  277. package/dist/core/utils/modelHelpers.d.ts.map +1 -1
  278. package/dist/core/utils/modelHelpers.js +28 -23
  279. package/dist/core/utils/normalizeString.d.ts.map +1 -1
  280. package/dist/core/utils/normalizeString.js +1 -5
  281. package/dist/core/utils/postProcessServiceImports.d.ts.map +1 -1
  282. package/dist/core/utils/postProcessServiceImports.js +1 -3
  283. package/dist/core/utils/precompileTemplates.js +1 -0
  284. package/dist/core/utils/prepareAlias.d.ts +1 -1
  285. package/dist/core/utils/prepareDtoModels.d.ts +5 -0
  286. package/dist/core/utils/prepareDtoModels.d.ts.map +1 -1
  287. package/dist/core/utils/prepareDtoModels.js +56 -13
  288. package/dist/core/utils/registerHandlebarHelpers.d.ts +1 -0
  289. package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
  290. package/dist/core/utils/registerHandlebarHelpers.js +3 -0
  291. package/dist/core/utils/registerHandlebarTemplates.d.ts +1 -0
  292. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  293. package/dist/core/utils/resolveClassesModeTypes.d.ts +8 -0
  294. package/dist/core/utils/resolveClassesModeTypes.d.ts.map +1 -0
  295. package/dist/core/utils/resolveClassesModeTypes.js +77 -0
  296. package/dist/core/utils/semanticChangesToDiffEntries.d.ts +37 -0
  297. package/dist/core/utils/semanticChangesToDiffEntries.d.ts.map +1 -0
  298. package/dist/core/utils/semanticChangesToDiffEntries.js +99 -0
  299. package/dist/core/utils/semanticPointerToJsonPath.d.ts +7 -0
  300. package/dist/core/utils/semanticPointerToJsonPath.d.ts.map +1 -0
  301. package/dist/core/utils/semanticPointerToJsonPath.js +67 -0
  302. package/dist/core/utils/serviceHelpers.d.ts +6 -7
  303. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  304. package/dist/core/utils/serviceHelpers.js +8 -25
  305. package/dist/core/utils/sortModelByName.d.ts +1 -1
  306. package/dist/core/utils/writeClientExecutor.d.ts +1 -2
  307. package/dist/core/utils/writeClientExecutor.d.ts.map +1 -1
  308. package/dist/core/utils/writeClientExecutor.js +2 -6
  309. package/dist/core/utils/writeClientModels.d.ts +1 -2
  310. package/dist/core/utils/writeClientModels.d.ts.map +1 -1
  311. package/dist/core/utils/writeClientModels.js +4 -6
  312. package/dist/core/utils/writeClientSchemas.d.ts +1 -3
  313. package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
  314. package/dist/core/utils/writeClientSchemas.js +2 -7
  315. package/dist/core/utils/writeClientServices.d.ts +15 -16
  316. package/dist/core/utils/writeClientServices.d.ts.map +1 -1
  317. package/dist/core/utils/writeClientServices.js +6 -13
  318. package/dist/templatesCompiled/client/exportModels.d.ts +17 -11
  319. package/dist/templatesCompiled/client/exportModels.d.ts.map +1 -1
  320. package/dist/templatesCompiled/client/exportModels.js +96 -49
  321. package/dist/templatesCompiled/client/exportService.d.ts +13 -10
  322. package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
  323. package/dist/templatesCompiled/client/exportService.js +95 -67
  324. package/dist/templatesCompiled/client/partials/header.d.ts +1 -0
  325. package/dist/templatesCompiled/client/partials/header.d.ts.map +1 -1
  326. package/dist/templatesCompiled/client/partials/header.js +11 -2
  327. package/package.json +130 -136
  328. package/dist/cli/analyzeDiff/buildLegacyReport.d.ts +0 -17
  329. package/dist/cli/analyzeDiff/buildLegacyReport.d.ts.map +0 -1
  330. package/dist/cli/analyzeDiff/buildLegacyReport.js +0 -54
  331. package/dist/cli/analyzeDiff/diffEngine.d.ts +0 -54
  332. package/dist/cli/analyzeDiff/diffEngine.d.ts.map +0 -1
  333. package/dist/cli/analyzeDiff/diffEngine.js +0 -209
package/package.json CHANGED
@@ -1,139 +1,133 @@
1
1
  {
2
- "name": "ts-openapi-codegen",
3
- "version": "2.1.0-beta.7",
4
- "description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
5
- "author": "Alexey Zverev",
6
- "homepage": "https://github.com/ozonophore/openapi-codegen.git",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/ozonophore/openapi-codegen.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/ozonophore/openapi-codegen.git"
13
- },
14
- "license": "MIT",
15
- "languageName": "node",
16
- "keywords": [
17
- "openapi",
18
- "swagger",
19
- "codegen",
20
- "generator",
21
- "client",
22
- "typescript",
23
- "yaml",
24
- "json",
25
- "fetch",
26
- "xhr",
27
- "node",
28
- "axios"
29
- ],
30
- "maintainers": [
31
- {
32
- "name": "Alexey Zverev",
33
- "email": "ozonophore@gmail.com"
34
- }
35
- ],
36
- "main": "dist/index.js",
37
- "module": "dist/index.js",
38
- "types": "dist/index.d.ts",
39
- "bin": {
40
- "openapi-codegen-cli": "dist/cli/index.js"
41
- },
42
- "directories": {
43
- "example": "example"
44
- },
45
- "files": [
46
- "dist"
47
- ],
48
- "scripts": {
49
- "clean": "shx rm -rf ./dist ./generated ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
50
- "build": "tsc -p .",
51
- "build:hbs": "tsx ./src/core/utils/precompileTemplates.ts",
52
- "release": "npm run build:hbs && npm run build",
53
- "run": "node ./test/index.js",
54
- "test:unit": "node --experimental-test-coverage --import tsx --test-name-pattern \"@unit\" --test \"**/*.test.ts\"",
55
- "test:update": "UPDATE_SNAPSHOTS=true npm run test:unit",
56
- "test:coverage": "node --experimental-test-coverage --import tsx --test-name-pattern \"@unit\" --test \"**/*.test.ts\"",
57
- "eslint": "eslint \"./src/**/*.ts\"",
58
- "eslint:fix": "eslint \"./src/**/*.ts\" --fix",
59
- "prettier": "prettier \"./src/**/*.ts\" \"./types/index.d.ts\" --check",
60
- "prettier:fix": "prettier \"./src/**/*.ts\" \"./types/index.d.ts\" --write",
61
- "prepublish": "npm run clean && npm run release",
62
- "codecov": "codecov --token=89a9fe76-2714-4b5b-83e3-9d809615064d",
63
- "find-deadcode": "knip"
64
- },
65
- "dependencies": {
66
- "@apidevtools/swagger-parser": "12.0.0",
67
- "boxen": "^5.1.2",
68
- "camelcase": "6.2.0",
69
- "chalk": "^4.1.2",
70
- "commander": "9.0.0",
71
- "configstore": "^5.0.1",
72
- "deep-diff": "^1.0.2",
73
- "diff": "^8.0.2",
74
- "enquirer": "^2.4.1",
75
- "fast-deep-equal": "^3.1.3",
76
- "figlet": "^1.8.0",
77
- "handlebars": "4.7.6",
78
- "joi": ">=17.13.3",
79
- "json-schema": "0.4.0",
80
- "leven": "^4.0.0",
81
- "semver": "^7.7.1",
82
- "ts-morph": "^28.0.0",
83
- "winston": "^3.17.0",
84
- "winston-daily-rotate-file": "^5.0.0",
85
- "zod": ">=4.3.2"
86
- },
87
- "devDependencies": {
88
- "@babel/cli": "7.14.8",
89
- "@babel/core": "7.14.8",
90
- "@babel/preset-env": "7.14.9",
91
- "@babel/preset-typescript": "7.14.5",
92
- "@eslint/compat": "^1.3.0",
93
- "@eslint/eslintrc": "^3.3.1",
94
- "@eslint/js": "^9.29.0",
95
- "@types/axios": "^0.14.0",
96
- "@types/configstore": "^6.0.2",
97
- "@types/deep-diff": "^1.0.5",
98
- "@types/express": "4.17.13",
99
- "@types/figlet": "^1.5.8",
100
- "@types/glob": "^8.1.0",
101
- "@types/json-schema": "^7.0.15",
102
- "@types/node": "^22.5.1",
103
- "@types/node-fetch": "2.5.12",
104
- "@types/prettier": "3.0.0",
105
- "@types/qs": "6.9.7",
106
- "@types/semver": "^7.7.0",
107
- "@types/winston": "^2.4.4",
108
- "@typescript-eslint/eslint-plugin": "^8.34.1",
109
- "@typescript-eslint/parser": "^8.34.1",
110
- "abort-controller": "^3.0.0",
111
- "axios": "1.8.2",
112
- "codecov": "3.8.3",
113
- "eslint": "^9.29.0",
114
- "eslint-config-prettier": "^10.1.5",
115
- "eslint-plugin-jsdoc": "^51.0.3",
116
- "eslint-plugin-lodash": "^8.0.0",
117
- "eslint-plugin-prettier": "^5.5.0",
118
- "eslint-plugin-simple-import-sort": "^12.1.1",
119
- "express": "4.17.1",
120
- "form-data": "4.0.0",
121
- "glob": "7.1.7",
122
- "globals": "^16.2.0",
123
- "knip": "^5.77.1",
124
- "node-fetch": "2.6.1",
125
- "prettier": "^3.4.2",
126
- "puppeteer": "10.1.0",
127
- "qs": "6.10.1",
128
- "shx": "^0.4.0",
129
- "tsx": "^4.20.3",
130
- "typescript": "^5.8.3",
131
- "zod": "^4.3.2"
132
- },
133
- "peerDependencies": {
134
- "axios": ">=1.8.2",
135
- "joi": ">=17.13.3",
136
- "prettier": ">=3.4.2",
137
- "zod": ">=4.3.2"
2
+ "name": "ts-openapi-codegen",
3
+ "version": "2.1.0-beta.9",
4
+ "description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
5
+ "author": "Alexey Zverev",
6
+ "homepage": "https://github.com/ozonophore/openapi-codegen.git",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ozonophore/openapi-codegen.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/ozonophore/openapi-codegen.git"
13
+ },
14
+ "license": "MIT",
15
+ "languageName": "node",
16
+ "keywords": [
17
+ "openapi",
18
+ "swagger",
19
+ "codegen",
20
+ "generator",
21
+ "client",
22
+ "typescript",
23
+ "yaml",
24
+ "json",
25
+ "fetch",
26
+ "xhr",
27
+ "node",
28
+ "axios"
29
+ ],
30
+ "maintainers": [
31
+ {
32
+ "name": "Alexey Zverev",
33
+ "email": "ozonophore@gmail.com"
138
34
  }
35
+ ],
36
+ "main": "dist/index.js",
37
+ "module": "dist/index.js",
38
+ "types": "dist/index.d.ts",
39
+ "bin": {
40
+ "openapi-codegen-cli": "dist/cli/index.js"
41
+ },
42
+ "directories": {
43
+ "example": "example"
44
+ },
45
+ "files": [
46
+ "dist"
47
+ ],
48
+ "scripts": {
49
+ "clean": "shx rm -rf ./dist ./generated ./test/generated ./test/e2e/generated ./samples/generated ./coverage ./node_modules/.cache",
50
+ "build": "tsc -p .",
51
+ "build:hbs": "tsx ./src/core/utils/precompileTemplates.ts",
52
+ "release": "npm run build:hbs && npm run build",
53
+ "run": "node ./test/index.js",
54
+ "test:unit": "node --experimental-test-coverage --import tsx --test-name-pattern \"@unit\" --test \"**/*.test.ts\"",
55
+ "test:update": "UPDATE_SNAPSHOTS=true npm run test:unit",
56
+ "test:coverage": "node --experimental-test-coverage --import tsx --test-name-pattern \"@unit\" --test \"**/*.test.ts\"",
57
+ "eslint": "eslint \"./src/**/*.ts\"",
58
+ "eslint:fix": "eslint \"./src/**/*.ts\" --fix",
59
+ "prettier": "prettier \"./src/**/*.ts\" --check",
60
+ "prettier:fix": "prettier \"./src/**/*.ts\" --write",
61
+ "prepublish": "npm run clean && npm run release",
62
+ "codecov": "codecov --token=89a9fe76-2714-4b5b-83e3-9d809615064d",
63
+ "checkTypes": "tsc --noEmit",
64
+ "find-deadcode:dev": "knip",
65
+ "find-deadcode": "knip --production --strict",
66
+ "prepare": "husky"
67
+ },
68
+ "dependencies": {
69
+ "@apidevtools/swagger-parser": "12.0.0",
70
+ "boxen": "^5.1.2",
71
+ "camelcase": "6.2.0",
72
+ "chalk": "^4.1.2",
73
+ "commander": "9.0.0",
74
+ "configstore": "^5.0.1",
75
+ "diff": "^8.0.2",
76
+ "enquirer": "^2.4.1",
77
+ "fast-deep-equal": "^3.1.3",
78
+ "figlet": "^1.8.0",
79
+ "handlebars": "4.7.6",
80
+ "json-schema": "0.4.0",
81
+ "leven": "^4.0.0",
82
+ "semver": "^7.7.1",
83
+ "ts-morph": "^28.0.0",
84
+ "typescript": "^5.8.3",
85
+ "winston": "^3.17.0",
86
+ "winston-daily-rotate-file": "^5.0.0",
87
+ "zod": ">=4.3.2"
88
+ },
89
+ "devDependencies": {
90
+ "@eslint/compat": "^1.3.0",
91
+ "@eslint/eslintrc": "^3.3.1",
92
+ "@eslint/js": "^9.29.0",
93
+ "@types/axios": "^0.14.0",
94
+ "@types/configstore": "^6.0.2",
95
+ "@types/figlet": "^1.5.8",
96
+ "@types/glob": "^8.1.0",
97
+ "@types/json-schema": "^7.0.15",
98
+ "@types/node": "^22.5.1",
99
+ "@types/node-fetch": "2.5.12",
100
+ "@types/prettier": "3.0.0",
101
+ "@types/qs": "6.9.7",
102
+ "@types/semver": "^7.7.0",
103
+ "@types/winston": "^2.4.4",
104
+ "@typescript-eslint/eslint-plugin": "^8.34.1",
105
+ "@typescript-eslint/parser": "^8.34.1",
106
+ "abort-controller": "^3.0.0",
107
+ "axios": "1.8.2",
108
+ "codecov": "3.8.3",
109
+ "eslint": "^9.29.0",
110
+ "eslint-config-prettier": "^10.1.5",
111
+ "eslint-plugin-jsdoc": "^51.0.3",
112
+ "eslint-plugin-lodash": "^8.0.0",
113
+ "eslint-plugin-simple-import-sort": "^12.1.1",
114
+ "form-data": "4.0.0",
115
+ "glob": "7.1.7",
116
+ "globals": "^16.2.0",
117
+ "husky": "^9.1.7",
118
+ "knip": "^5.77.1",
119
+ "lint-staged": "^16.4.0",
120
+ "node-fetch": "2.6.1",
121
+ "prettier": "^3.4.2",
122
+ "qs": "6.10.1",
123
+ "shx": "^0.4.0",
124
+ "tsx": "^4.20.3",
125
+ "typescript": "^5.8.3",
126
+ "zod": "^4.3.2"
127
+ },
128
+ "peerDependencies": {
129
+ "axios": ">=1.8.2",
130
+ "prettier": ">=3.4.2",
131
+ "zod": ">=4.3.2"
132
+ }
139
133
  }
@@ -1,17 +0,0 @@
1
- import type { DiffReport, IgnoreRule, JsonValue } from './types';
2
- type BuildLegacyReportParams = {
3
- baseLabel: string;
4
- targetLabel: string;
5
- oldSpec: JsonValue;
6
- newSpec: JsonValue;
7
- ignoreRules: IgnoreRule[];
8
- };
9
- /**
10
- * Собирает legacy diff-отчет по сравнению двух спецификаций.
11
- */
12
- export declare function buildLegacyReport(params: BuildLegacyReportParams): {
13
- report: DiffReport;
14
- ignored: number;
15
- };
16
- export {};
17
- //# sourceMappingURL=buildLegacyReport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildLegacyReport.d.ts","sourceRoot":"","sources":["../../../src/cli/analyzeDiff/buildLegacyReport.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAa,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE5E,KAAK,uBAAuB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,EAAE,SAAS,CAAC;IACnB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CA6C1G"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.buildLegacyReport = buildLegacyReport;
7
- const crypto_1 = __importDefault(require("crypto"));
8
- const diffEngine_1 = require("./diffEngine");
9
- const ignoreRules_1 = require("./ignoreRules");
10
- const miracles_1 = require("./miracles");
11
- /**
12
- * Собирает legacy diff-отчет по сравнению двух спецификаций.
13
- */
14
- function buildLegacyReport(params) {
15
- const { baseLabel, targetLabel, oldSpec, newSpec, ignoreRules } = params;
16
- const normalizedOld = (0, diffEngine_1.normalizeForDiff)(oldSpec);
17
- const normalizedNew = (0, diffEngine_1.normalizeForDiff)(newSpec);
18
- const baseHash = crypto_1.default.createHash('sha256').update(JSON.stringify(normalizedOld)).digest('hex');
19
- const targetHash = crypto_1.default.createHash('sha256').update(JSON.stringify(normalizedNew)).digest('hex');
20
- const entries = (0, diffEngine_1.withDiffType)((0, diffEngine_1.collectDiffEntries)(normalizedOld, normalizedNew));
21
- const { filtered, ignored } = (0, ignoreRules_1.applyIgnoreRules)(entries, ignoreRules);
22
- const breakingCount = filtered.filter(entry => entry.severity === 'breaking').length;
23
- const stabilityScore = filtered.length === 0 ? 100 : Math.round(((filtered.length - breakingCount) / filtered.length) * 100);
24
- const stats = {
25
- totalChanges: filtered.length,
26
- added: filtered.filter(entry => entry.action === 'added').length,
27
- removed: filtered.filter(entry => entry.action === 'removed').length,
28
- changed: filtered.filter(entry => entry.action === 'changed').length,
29
- ignored: ignored || undefined,
30
- stabilityScore,
31
- };
32
- const breaking = filtered.filter(entry => entry.severity === 'breaking');
33
- const warnings = filtered.filter(entry => entry.severity === 'warning');
34
- const info = filtered.filter(entry => entry.severity === 'info');
35
- const report = {
36
- version: '1.0.0',
37
- timestamp: new Date().toISOString(),
38
- metadata: {
39
- base: baseLabel,
40
- target: targetLabel,
41
- baseHash,
42
- targetHash,
43
- },
44
- stats,
45
- diff: {
46
- breaking,
47
- warnings,
48
- info,
49
- all: filtered,
50
- },
51
- miracles: (0, miracles_1.buildMiracles)(entries, normalizedOld, normalizedNew),
52
- };
53
- return { report, ignored };
54
- }
@@ -1,54 +0,0 @@
1
- import { Diff } from 'deep-diff';
2
- import type { DiffAction, DiffEntry, JsonValue } from './types';
3
- /**
4
- * Проверяет, содержит ли путь сегменты, указывающие на полиморфную схему (oneOf/anyOf).
5
- * @param segments сегменты json-path
6
- * @returns true если встречены полиморфные сегменты
7
- */
8
- export declare const hasPolymorphicSegment: (segments: (string | number)[]) => boolean;
9
- /**
10
- * Классифицирует серьёзность изменения по действию (added/removed/changed).
11
- * @param action действие изменения
12
- * @returns уровень серьёзности
13
- */
14
- export declare const classifySeverity: (action: DiffAction) => "info" | "warning" | "breaking";
15
- /**
16
- * Строит единичную запись отличия из набора сегментов пути и значений.
17
- * Добавляет заметку при полиморфных изменениях.
18
- * @param action действие изменения
19
- * @param segments сегменты пути
20
- * @param from предыдущее значение
21
- * @param to новое значение
22
- * @returns готовая запись DiffEntry
23
- */
24
- export declare const buildDiffEntry: (action: DiffAction, segments: (string | number)[], from?: JsonValue, to?: JsonValue) => DiffEntry;
25
- /**
26
- * Пытается классифицировать тип изменения по структуре json-path и самой записи.
27
- * Возвращает семантические коды типа изменения (METHOD_REMOVED, PROPERTY_ADDED и т.д.).
28
- * @param entry запись diff
29
- * @returns код типа изменения или undefined
30
- */
31
- export declare const classifyDiffType: (entry: DiffEntry) => string | undefined;
32
- /**
33
- * Добавляет поле type к каждой записи diff, вычисленное через classifyDiffType, если отсутствует.
34
- * @param entries массив записей diff
35
- * @returns массив записей с полем type
36
- */
37
- export declare const withDiffType: (entries: DiffEntry[]) => DiffEntry[];
38
- /**
39
- * Преобразует единичный объект отличия из deep-diff в один или несколько DiffEntry.
40
- * Обрабатывает массивные/индексные отличия (kind 'A') рекурсивно.
41
- * @param difference объект отличия от deep-diff
42
- * @returns массив DiffEntry
43
- */
44
- export declare const diffToEntries: (difference: Diff<unknown, unknown>) => DiffEntry[];
45
- /**
46
- * Собирает все записи отличий между двумя JSON-структурами: старой и новой.
47
- * Выполняет глубокое сравнение и маппинг на DiffEntry.
48
- * @param oldValue старая версия спецификации
49
- * @param newValue новая версия спецификации
50
- * @returns массив DiffEntry
51
- */
52
- export declare const collectDiffEntries: (oldValue: JsonValue, newValue: JsonValue) => DiffEntry[];
53
- export declare const normalizeForDiff: (value: JsonValue) => JsonValue;
54
- //# sourceMappingURL=diffEngine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diffEngine.d.ts","sourceRoot":"","sources":["../../../src/cli/analyzeDiff/diffEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,WAAW,CAAC;AAMnD,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAG,OAErE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,UAAU,oCAUlD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,OAAO,SAAS,EAAE,KAAK,SAAS,KAAG,SAoBpH,CAAC;AA0BF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,KAAG,MAAM,GAAG,SAwC5D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,SAAS,EAAE,KAAG,SAAS,EAK5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,YAAY,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,KAAG,SAAS,EA8B3E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,SAAS,EAAE,UAAU,SAAS,KAAG,SAAS,EAMtF,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,OAAO,SAAS,KAAG,SAGnD,CAAC"}
@@ -1,209 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.normalizeForDiff = exports.collectDiffEntries = exports.diffToEntries = exports.withDiffType = exports.classifyDiffType = exports.buildDiffEntry = exports.classifySeverity = exports.hasPolymorphicSegment = void 0;
7
- const deep_diff_1 = require("deep-diff");
8
- const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
9
- const jsonPath_1 = require("../../common/utils/jsonPath");
10
- const normalizeObject_1 = require("../../common/utils/normalizeObject");
11
- const miracles_1 = require("./miracles");
12
- /**
13
- * Проверяет, содержит ли путь сегменты, указывающие на полиморфную схему (oneOf/anyOf).
14
- * @param segments сегменты json-path
15
- * @returns true если встречены полиморфные сегменты
16
- */
17
- const hasPolymorphicSegment = (segments) => {
18
- return segments.includes('oneOf') || segments.includes('anyOf');
19
- };
20
- exports.hasPolymorphicSegment = hasPolymorphicSegment;
21
- /**
22
- * Классифицирует серьёзность изменения по действию (added/removed/changed).
23
- * @param action действие изменения
24
- * @returns уровень серьёзности
25
- */
26
- const classifySeverity = (action) => {
27
- if (action === 'removed') {
28
- return 'breaking';
29
- }
30
- if (action === 'changed') {
31
- return 'warning';
32
- }
33
- return 'info';
34
- };
35
- exports.classifySeverity = classifySeverity;
36
- /**
37
- * Строит единичную запись отличия из набора сегментов пути и значений.
38
- * Добавляет заметку при полиморфных изменениях.
39
- * @param action действие изменения
40
- * @param segments сегменты пути
41
- * @param from предыдущее значение
42
- * @param to новое значение
43
- * @returns готовая запись DiffEntry
44
- */
45
- const buildDiffEntry = (action, segments, from, to) => {
46
- const path = (0, jsonPath_1.toJsonPath)(segments);
47
- if ((0, exports.hasPolymorphicSegment)(segments)) {
48
- return {
49
- action: 'changed',
50
- path,
51
- from,
52
- to,
53
- severity: 'warning',
54
- note: 'Manual review required: polymorphic schema change',
55
- type: 'POLYMORPHIC_CHANGE',
56
- };
57
- }
58
- return {
59
- action,
60
- path,
61
- from,
62
- to,
63
- severity: (0, exports.classifySeverity)(action),
64
- };
65
- };
66
- exports.buildDiffEntry = buildDiffEntry;
67
- /**
68
- * Возвращает имя корневой схемы из сегментов пути, если путь указывает на components.schemas или definitions.
69
- * @param segments сегменты json-path
70
- * @returns имя схемы или null
71
- */
72
- const getSchemaRootName = (segments) => {
73
- const s = segments.map(String);
74
- if (s[0] === 'components' && s[1] === 'schemas')
75
- return s[2] ?? null;
76
- if (s[0] === 'definitions')
77
- return s[1] ?? null;
78
- return null;
79
- };
80
- /**
81
- * Извлекает имя свойства из сегментов пути (ищет 'properties' и следующий сегмент).
82
- * @param segments сегменты json-path
83
- * @returns имя свойства или null
84
- */
85
- const getPropertyNameFromSegments = (segments) => {
86
- const s = segments.map(String);
87
- const propsIndex = s.indexOf('properties');
88
- if (propsIndex === -1)
89
- return null;
90
- return s[propsIndex + 1] ?? null;
91
- };
92
- /**
93
- * Пытается классифицировать тип изменения по структуре json-path и самой записи.
94
- * Возвращает семантические коды типа изменения (METHOD_REMOVED, PROPERTY_ADDED и т.д.).
95
- * @param entry запись diff
96
- * @returns код типа изменения или undefined
97
- */
98
- const classifyDiffType = (entry) => {
99
- const segments = (0, jsonPath_1.parseJsonPath)(entry.path);
100
- const s = segments.map(String);
101
- if (s[0] === 'paths') {
102
- const hasMethod = s.length >= 3;
103
- const isMethodRoot = s.length === 3;
104
- if (hasMethod && isMethodRoot) {
105
- if (entry.action === 'removed')
106
- return 'METHOD_REMOVED';
107
- if (entry.action === 'added')
108
- return 'METHOD_ADDED';
109
- return 'METHOD_CHANGED';
110
- }
111
- return 'PATH_CHANGED';
112
- }
113
- const schemaName = getSchemaRootName(s);
114
- if (schemaName) {
115
- const isSchemaRoot = s.length <= 3;
116
- if (isSchemaRoot) {
117
- if (entry.action === 'removed')
118
- return 'SCHEMA_REMOVED';
119
- if (entry.action === 'added')
120
- return 'SCHEMA_ADDED';
121
- return 'SCHEMA_CHANGED';
122
- }
123
- const propertyName = getPropertyNameFromSegments(s);
124
- if (propertyName) {
125
- const fromType = (0, miracles_1.getTypeSignature)((entry.from ?? {}));
126
- const toType = (0, miracles_1.getTypeSignature)((entry.to ?? {}));
127
- if (entry.action === 'changed' && fromType && toType && fromType !== toType) {
128
- return 'TYPE_CHANGED';
129
- }
130
- if (entry.action === 'removed')
131
- return 'PROPERTY_REMOVED';
132
- if (entry.action === 'added')
133
- return 'PROPERTY_ADDED';
134
- return 'PROPERTY_CHANGED';
135
- }
136
- return 'SCHEMA_CHANGED';
137
- }
138
- return undefined;
139
- };
140
- exports.classifyDiffType = classifyDiffType;
141
- /**
142
- * Добавляет поле type к каждой записи diff, вычисленное через classifyDiffType, если отсутствует.
143
- * @param entries массив записей diff
144
- * @returns массив записей с полем type
145
- */
146
- const withDiffType = (entries) => {
147
- return entries.map(entry => ({
148
- ...entry,
149
- type: entry.type ?? (0, exports.classifyDiffType)(entry),
150
- }));
151
- };
152
- exports.withDiffType = withDiffType;
153
- /**
154
- * Преобразует единичный объект отличия из deep-diff в один или несколько DiffEntry.
155
- * Обрабатывает массивные/индексные отличия (kind 'A') рекурсивно.
156
- * @param difference объект отличия от deep-diff
157
- * @returns массив DiffEntry
158
- */
159
- const diffToEntries = (difference) => {
160
- if (difference.kind === 'A') {
161
- const segments = [...(difference.path ?? []), difference.index];
162
- const item = difference.item;
163
- if (item.kind === 'A') {
164
- return (0, exports.diffToEntries)({ ...item, path: segments });
165
- }
166
- if (item.kind === 'N') {
167
- return [(0, exports.buildDiffEntry)('added', segments, undefined, item.rhs)];
168
- }
169
- if (item.kind === 'D') {
170
- return [(0, exports.buildDiffEntry)('removed', segments, item.lhs, undefined)];
171
- }
172
- if (item.kind === 'E') {
173
- return [(0, exports.buildDiffEntry)('changed', segments, item.lhs, item.rhs)];
174
- }
175
- return [];
176
- }
177
- const segments = difference.path ?? [];
178
- if (difference.kind === 'N') {
179
- return [(0, exports.buildDiffEntry)('added', segments, undefined, difference.rhs)];
180
- }
181
- if (difference.kind === 'D') {
182
- return [(0, exports.buildDiffEntry)('removed', segments, difference.lhs, undefined)];
183
- }
184
- if (difference.kind === 'E') {
185
- return [(0, exports.buildDiffEntry)('changed', segments, difference.lhs, difference.rhs)];
186
- }
187
- return [];
188
- };
189
- exports.diffToEntries = diffToEntries;
190
- /**
191
- * Собирает все записи отличий между двумя JSON-структурами: старой и новой.
192
- * Выполняет глубокое сравнение и маппинг на DiffEntry.
193
- * @param oldValue старая версия спецификации
194
- * @param newValue новая версия спецификации
195
- * @returns массив DiffEntry
196
- */
197
- const collectDiffEntries = (oldValue, newValue) => {
198
- if ((0, fast_deep_equal_1.default)(oldValue, newValue)) {
199
- return [];
200
- }
201
- const differences = (0, deep_diff_1.diff)(oldValue, newValue) ?? [];
202
- return differences.flatMap(exports.diffToEntries);
203
- };
204
- exports.collectDiffEntries = collectDiffEntries;
205
- const normalizeForDiff = (value) => {
206
- // обёртка вокруг normalizeObject, если нужно
207
- return (0, normalizeObject_1.normalizeObject)(value);
208
- };
209
- exports.normalizeForDiff = normalizeForDiff;