ts-openapi-codegen 1.0.0-beta.8 → 2.0.0-beta.0

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 (375) hide show
  1. package/README.md +221 -123
  2. package/README.rus.md +725 -0
  3. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +12 -0
  4. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -0
  5. package/dist/cli/checkAndUpdateConfig/checkConfig.js +66 -0
  6. package/dist/cli/checkAndUpdateConfig/constants.d.ts +13 -0
  7. package/dist/cli/checkAndUpdateConfig/constants.d.ts.map +1 -0
  8. package/dist/cli/checkAndUpdateConfig/constants.js +29 -0
  9. package/dist/cli/checkAndUpdateConfig/types.d.ts +20 -0
  10. package/dist/cli/checkAndUpdateConfig/types.d.ts.map +1 -0
  11. package/dist/cli/checkAndUpdateConfig/types.js +12 -0
  12. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +12 -0
  13. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -0
  14. package/dist/cli/checkAndUpdateConfig/updateConfig.js +56 -0
  15. package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.d.ts +2 -0
  16. package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.d.ts.map +1 -0
  17. package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.js +11 -0
  18. package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.d.ts +14 -0
  19. package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.d.ts.map +1 -0
  20. package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.js +30 -0
  21. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts +17 -0
  22. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts.map +1 -0
  23. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.js +29 -0
  24. package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.d.ts +2 -0
  25. package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.d.ts.map +1 -0
  26. package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.js +11 -0
  27. package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts +29 -0
  28. package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts.map +1 -0
  29. package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.js +49 -0
  30. package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts +6 -0
  31. package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts.map +1 -0
  32. package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.js +22 -0
  33. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts +17 -0
  34. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -0
  35. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +53 -0
  36. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts +34 -0
  37. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts.map +1 -0
  38. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.js +41 -0
  39. package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts +6 -0
  40. package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts.map +1 -0
  41. package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.js +18 -0
  42. package/dist/cli/generate/runGenerateOpenApi.d.ts +2 -2
  43. package/dist/cli/generate/runGenerateOpenApi.d.ts.map +1 -1
  44. package/dist/cli/generate/runGenerateOpenApi.js +20 -37
  45. package/dist/cli/index.d.ts +1 -0
  46. package/dist/cli/index.js +56 -30
  47. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts.map +1 -1
  48. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.js +11 -18
  49. package/dist/cli/interactive/confirmDialog.d.ts +17 -0
  50. package/dist/cli/interactive/confirmDialog.d.ts.map +1 -0
  51. package/dist/cli/interactive/confirmDialog.js +36 -0
  52. package/dist/cli/interactive/constants.d.ts +7 -0
  53. package/dist/cli/interactive/constants.d.ts.map +1 -0
  54. package/dist/cli/interactive/constants.js +25 -0
  55. package/dist/cli/interactive/selectDialog.d.ts +17 -0
  56. package/dist/cli/interactive/selectDialog.d.ts.map +1 -0
  57. package/dist/cli/interactive/selectDialog.js +43 -0
  58. package/dist/cli/interactive/types.d.ts +40 -0
  59. package/dist/cli/interactive/types.d.ts.map +1 -0
  60. package/dist/cli/interactive/types.js +12 -0
  61. package/dist/common/Consts.d.ts +4 -0
  62. package/dist/common/Consts.d.ts.map +1 -1
  63. package/dist/common/Consts.js +31 -1
  64. package/dist/common/Enums.d.ts +4 -0
  65. package/dist/common/Enums.d.ts.map +1 -1
  66. package/dist/common/Enums.js +6 -1
  67. package/dist/common/Logger.d.ts +1 -1
  68. package/dist/common/Logger.d.ts.map +1 -1
  69. package/dist/common/Logger.js +7 -39
  70. package/dist/common/LoggerMessages.d.ts +64 -0
  71. package/dist/common/LoggerMessages.d.ts.map +1 -0
  72. package/dist/common/LoggerMessages.js +82 -0
  73. package/dist/common/TRawOptions.d.ts +40 -0
  74. package/dist/common/TRawOptions.d.ts.map +1 -0
  75. package/dist/common/UpdateNotifier.d.ts +36 -2
  76. package/dist/common/UpdateNotifier.d.ts.map +1 -1
  77. package/dist/common/UpdateNotifier.js +150 -57
  78. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts +8 -0
  79. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -0
  80. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +31 -0
  81. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +8 -0
  82. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -0
  83. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +33 -0
  84. package/dist/common/VersionedSchema/Enums.d.ts +2 -1
  85. package/dist/common/VersionedSchema/Enums.d.ts.map +1 -1
  86. package/dist/common/VersionedSchema/Enums.js +1 -0
  87. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
  88. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +10 -19
  89. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
  90. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +10 -10
  91. package/dist/common/VersionedSchema/Types.d.ts +10 -0
  92. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  93. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts +3 -0
  94. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts.map +1 -0
  95. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.js +28 -0
  96. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts +7 -0
  97. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts.map +1 -0
  98. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.js +42 -0
  99. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts +3 -0
  100. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts.map +1 -0
  101. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.js +10 -0
  102. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts +11 -0
  103. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts.map +1 -0
  104. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.js +19 -0
  105. package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts +7 -0
  106. package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts.map +1 -0
  107. package/dist/common/VersionedSchema/Utils/createTrivialMigration.js +15 -0
  108. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +1 -7
  109. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  110. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +3 -0
  111. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -0
  112. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +14 -0
  113. package/dist/common/VersionedSchema/Utils/getKeyByMapValue.d.ts +2 -0
  114. package/dist/common/VersionedSchema/Utils/getKeyByMapValue.d.ts.map +1 -0
  115. package/dist/common/VersionedSchema/Utils/getKeyByMapValue.js +11 -0
  116. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +5 -2
  117. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  118. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +31 -17
  119. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +1 -0
  120. package/dist/common/utils/__tests__/convertArrayToObject.test.d.ts.map +1 -0
  121. package/dist/common/{__tests__ → utils/__tests__}/convertArrayToObject.test.js +14 -14
  122. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +1 -0
  123. package/dist/common/{__tests__ → utils/__tests__}/determineBestMatchingSchemaVersion.test.js +5 -5
  124. package/dist/common/utils/__tests__/generateKeyMappingForInvalidKeys.test.d.ts.map +1 -0
  125. package/dist/common/{__tests__ → utils/__tests__}/generateKeyMappingForInvalidKeys.test.js +4 -4
  126. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +1 -0
  127. package/dist/common/{__tests__ → utils/__tests__}/getUniqueKeysFromSchemas.test.js +4 -4
  128. package/dist/common/utils/__tests__/getUniqueObjectKeys.test.d.ts.map +1 -0
  129. package/dist/common/{__tests__ → utils/__tests__}/getUniqueObjectKeys.test.js +5 -5
  130. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +1 -0
  131. package/dist/common/{__tests__ → utils/__tests__}/mergeObjectSchemas.test.js +5 -5
  132. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +1 -0
  133. package/dist/common/{__tests__ → utils/__tests__}/migrationForMultiOptions.test.js +21 -15
  134. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +1 -0
  135. package/dist/common/{__tests__ → utils/__tests__}/migrationForOptions.test.js +13 -9
  136. package/dist/common/utils/__tests__/pathHelpers.test.d.ts.map +1 -0
  137. package/dist/{core → common}/utils/__tests__/pathHelpers.test.js +8 -8
  138. package/dist/common/utils/__tests__/replaceInvalidKeysWithMappedNames.test.d.ts.map +1 -0
  139. package/dist/common/{__tests__ → utils/__tests__}/replaceInvalidKeysWithMappedNames.test.js +5 -5
  140. package/dist/common/utils/__tests__/validateAndSuggestKeyCorrections.test.d.ts.map +1 -0
  141. package/dist/common/{__tests__ → utils/__tests__}/validateAndSuggestKeyCorrections.test.js +5 -5
  142. package/dist/common/utils/convertArrayToObject.d.ts +2 -0
  143. package/dist/common/utils/convertArrayToObject.d.ts.map +1 -0
  144. package/dist/common/{Utils.js → utils/convertArrayToObject.js} +0 -20
  145. package/dist/{core/utils/fileSystem.d.ts → common/utils/fileSystemHelpers.d.ts} +8 -5
  146. package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -0
  147. package/dist/common/utils/fileSystemHelpers.js +85 -0
  148. package/dist/common/utils/format.d.ts +3 -0
  149. package/dist/common/utils/format.d.ts.map +1 -0
  150. package/dist/{core → common}/utils/format.js +2 -2
  151. package/dist/common/utils/loadConfigIfExists.d.ts +2 -0
  152. package/dist/common/utils/loadConfigIfExists.d.ts.map +1 -0
  153. package/dist/common/utils/loadConfigIfExists.js +22 -0
  154. package/dist/common/utils/pathHelpers.d.ts +6 -0
  155. package/dist/common/utils/pathHelpers.d.ts.map +1 -0
  156. package/dist/{core → common}/utils/pathHelpers.js +16 -20
  157. package/dist/common/utils/safeHasOwn.d.ts +2 -0
  158. package/dist/common/utils/safeHasOwn.d.ts.map +1 -0
  159. package/dist/common/utils/safeHasOwn.js +9 -0
  160. package/dist/core/Context.d.ts.map +1 -1
  161. package/dist/core/Context.js +3 -3
  162. package/dist/core/OpenApiClient.d.ts +13 -0
  163. package/dist/core/OpenApiClient.d.ts.map +1 -0
  164. package/dist/core/OpenApiClient.js +175 -0
  165. package/dist/core/WriteClient.d.ts +1 -1
  166. package/dist/core/WriteClient.d.ts.map +1 -1
  167. package/dist/core/WriteClient.js +20 -20
  168. package/dist/core/__tests__/WriteClient.test.js +61 -60
  169. package/dist/core/api/v2/Parser.d.ts.map +1 -1
  170. package/dist/core/api/v2/Parser.js +2 -9
  171. package/dist/core/api/v2/parser/__tests__/getServer.test.js +2 -2
  172. package/dist/core/api/v2/parser/__tests__/getType.test.js +3 -3
  173. package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
  174. package/dist/core/api/v2/parser/getModelProperties.js +2 -5
  175. package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
  176. package/dist/core/api/v2/parser/getModels.js +2 -1
  177. package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
  178. package/dist/core/api/v2/parser/getOperationParameter.js +2 -1
  179. package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
  180. package/dist/core/api/v2/parser/getOperationResponse.js +2 -5
  181. package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
  182. package/dist/core/api/v2/parser/getOperationResponses.js +2 -5
  183. package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
  184. package/dist/core/api/v2/parser/getServices.js +2 -5
  185. package/dist/core/api/v2/parser/getType.js +4 -4
  186. package/dist/core/api/v3/Parser.d.ts +1 -1
  187. package/dist/core/api/v3/Parser.d.ts.map +1 -1
  188. package/dist/core/api/v3/Parser.js +2 -9
  189. package/dist/core/api/v3/parser/__tests__/getServer.test.js +3 -3
  190. package/dist/core/api/v3/parser/__tests__/getType.test.js +3 -3
  191. package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
  192. package/dist/core/api/v3/parser/getModelProperties.js +2 -5
  193. package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
  194. package/dist/core/api/v3/parser/getModels.js +2 -1
  195. package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
  196. package/dist/core/api/v3/parser/getOperationResponse.js +2 -5
  197. package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
  198. package/dist/core/api/v3/parser/getOperationResponses.js +2 -5
  199. package/dist/core/api/v3/parser/getServer.d.ts.map +1 -1
  200. package/dist/core/api/v3/parser/getServer.js +2 -5
  201. package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
  202. package/dist/core/api/v3/parser/getServices.js +2 -5
  203. package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
  204. package/dist/core/api/v3/parser/getType.js +5 -13
  205. package/dist/core/index.d.ts +2 -2
  206. package/dist/core/index.d.ts.map +1 -1
  207. package/dist/core/index.js +6 -161
  208. package/dist/core/types/Consts.d.ts +5 -1
  209. package/dist/core/types/Consts.d.ts.map +1 -1
  210. package/dist/core/types/Consts.js +6 -2
  211. package/dist/core/types/base/Root.model.d.ts +1 -0
  212. package/dist/core/types/base/Root.model.d.ts.map +1 -1
  213. package/dist/core/utils/__tests__/escapeDescription.test.js +3 -3
  214. package/dist/core/utils/__tests__/escapeName.test.js +2 -2
  215. package/dist/core/utils/__tests__/flatMap.test.js +2 -2
  216. package/dist/core/utils/__tests__/getAbsolutePath.test.js +6 -6
  217. package/dist/core/utils/__tests__/getClassName.test.js +2 -2
  218. package/dist/core/utils/__tests__/getComment.test.js +2 -2
  219. package/dist/core/utils/__tests__/getEnumFromDescription.test.js +2 -2
  220. package/dist/core/utils/__tests__/getFileName.test.js +2 -2
  221. package/dist/core/utils/__tests__/getGatheringRefs.test.js +2 -2
  222. package/dist/core/utils/__tests__/getMappedType.test.js +2 -2
  223. package/dist/core/utils/__tests__/getModelNames.test.js +2 -2
  224. package/dist/core/utils/__tests__/getOpenApiVersion.test.js +2 -2
  225. package/dist/core/utils/__tests__/getOperationName.test.js +2 -2
  226. package/dist/core/utils/__tests__/getOperationParameterName.test.js +2 -2
  227. package/dist/core/utils/__tests__/getOperationPath.test.js +2 -2
  228. package/dist/core/utils/__tests__/getOperationResponseCode.test.js +2 -2
  229. package/dist/core/utils/__tests__/getPattern.test.js +2 -2
  230. package/dist/core/utils/__tests__/getRefFromSchema.test.js +2 -2
  231. package/dist/core/utils/__tests__/getRefs.test.js +2 -2
  232. package/dist/core/utils/__tests__/getRelativeModelPath.test.js +3 -3
  233. package/dist/core/utils/__tests__/getServiceClassName.test.js +2 -2
  234. package/dist/core/utils/__tests__/getServiceNames.test.js +2 -2
  235. package/dist/core/utils/__tests__/getServiceVersion.test.js +2 -2
  236. package/dist/core/utils/__tests__/isString.test.js +2 -2
  237. package/dist/core/utils/__tests__/isSubdirectory.test.js +10 -10
  238. package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +2 -2
  239. package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +2 -2
  240. package/dist/core/utils/__tests__/replaceString.test.js +2 -2
  241. package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +360 -51
  242. package/dist/core/utils/__tests__/sort.test.js +2 -2
  243. package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +11 -11
  244. package/dist/core/utils/__tests__/sortByRequiredSimple.test.js +11 -11
  245. package/dist/core/utils/__tests__/sortModelsByName.test.js +2 -2
  246. package/dist/core/utils/__tests__/sortServicesByName.test.js +2 -2
  247. package/dist/core/utils/__tests__/stripNamespace.test.js +2 -2
  248. package/dist/core/utils/__tests__/unique.test.js +2 -2
  249. package/dist/core/utils/__tests__/writeClientCore.test.js +52 -50
  250. package/dist/core/utils/__tests__/writeClientFullIndex.test.js +39 -37
  251. package/dist/core/utils/__tests__/writeClientModels.test.js +65 -63
  252. package/dist/core/utils/__tests__/writeClientSchemas.test.js +65 -63
  253. package/dist/core/utils/__tests__/writeClientServices.test.js +60 -58
  254. package/dist/core/utils/appendUniqueLinesToFile.js +4 -4
  255. package/dist/core/utils/createNormalizedRef.js +2 -2
  256. package/dist/core/utils/getAbsolutePath.js +3 -3
  257. package/dist/core/utils/getModelNameWithPrefix.d.ts +3 -0
  258. package/dist/core/utils/getModelNameWithPrefix.d.ts.map +1 -0
  259. package/dist/core/utils/getModelNameWithPrefix.js +15 -0
  260. package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
  261. package/dist/core/utils/getOpenApiSpec.js +4 -4
  262. package/dist/core/utils/getOutputPaths.d.ts.map +1 -1
  263. package/dist/core/utils/getOutputPaths.js +6 -6
  264. package/dist/core/utils/getPattern.d.ts.map +1 -1
  265. package/dist/core/utils/getPattern.js +2 -1
  266. package/dist/core/utils/getRelativeModelPath.d.ts.map +1 -1
  267. package/dist/core/utils/getRelativeModelPath.js +2 -6
  268. package/dist/core/utils/isSubdirectory.d.ts.map +1 -1
  269. package/dist/core/utils/isSubdirectory.js +4 -3
  270. package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +1 -1
  271. package/dist/core/utils/mapPathToTargetDirSafe.js +11 -12
  272. package/dist/core/utils/modelHelpers.d.ts.map +1 -1
  273. package/dist/core/utils/modelHelpers.js +18 -6
  274. package/dist/core/utils/normalizeString.d.ts +2 -0
  275. package/dist/core/utils/normalizeString.d.ts.map +1 -0
  276. package/dist/core/utils/normalizeString.js +14 -0
  277. package/dist/core/utils/normalizedAbsolutePath.js +3 -3
  278. package/dist/core/utils/parseRef.d.ts.map +1 -1
  279. package/dist/core/utils/parseRef.js +7 -10
  280. package/dist/core/utils/precompileTemplates.js +14 -10
  281. package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
  282. package/dist/core/utils/registerHandlebarHelpers.js +24 -0
  283. package/dist/core/utils/replaceString.d.ts.map +1 -1
  284. package/dist/core/utils/replaceString.js +2 -1
  285. package/dist/core/utils/resolveRefPath.d.ts.map +1 -1
  286. package/dist/core/utils/resolveRefPath.js +3 -3
  287. package/dist/core/utils/resolveRefToImportPath.d.ts +8 -2
  288. package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -1
  289. package/dist/core/utils/resolveRefToImportPath.js +91 -31
  290. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  291. package/dist/core/utils/serviceHelpers.js +2 -1
  292. package/dist/core/utils/stripNamespace.js +5 -5
  293. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  294. package/dist/core/utils/writeClientCore.js +12 -12
  295. package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
  296. package/dist/core/utils/writeClientCoreIndex.js +2 -2
  297. package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
  298. package/dist/core/utils/writeClientFullIndex.js +4 -4
  299. package/dist/core/utils/writeClientModels.d.ts.map +1 -1
  300. package/dist/core/utils/writeClientModels.js +7 -7
  301. package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
  302. package/dist/core/utils/writeClientModelsIndex.js +2 -2
  303. package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
  304. package/dist/core/utils/writeClientSchemas.js +7 -7
  305. package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
  306. package/dist/core/utils/writeClientSchemasIndex.js +2 -2
  307. package/dist/core/utils/writeClientServices.d.ts.map +1 -1
  308. package/dist/core/utils/writeClientServices.js +5 -5
  309. package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
  310. package/dist/core/utils/writeClientServicesIndex.js +2 -2
  311. package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -1
  312. package/dist/core/utils/writeClientSimpleIndex.js +4 -4
  313. package/dist/templatesCompiled/client/exportModel.js +4 -4
  314. package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
  315. package/dist/templatesCompiled/client/exportService.js +12 -13
  316. package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
  317. package/dist/templatesCompiled/client/indexFull.js +35 -29
  318. package/dist/templatesCompiled/client/partials/parameters.d.ts +3 -2
  319. package/dist/templatesCompiled/client/partials/parameters.d.ts.map +1 -1
  320. package/dist/templatesCompiled/client/partials/parameters.js +25 -20
  321. package/dist/templatesCompiled/client/partials/parametersDefinition.d.ts +4 -2
  322. package/dist/templatesCompiled/client/partials/parametersDefinition.d.ts.map +1 -1
  323. package/dist/templatesCompiled/client/partials/parametersDefinition.js +31 -10
  324. package/package.json +15 -13
  325. package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts +0 -5
  326. package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts.map +0 -1
  327. package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.js +0 -45
  328. package/dist/common/Options.d.ts +0 -26
  329. package/dist/common/Options.d.ts.map +0 -1
  330. package/dist/common/Utils.d.ts +0 -3
  331. package/dist/common/Utils.d.ts.map +0 -1
  332. package/dist/common/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
  333. package/dist/common/__tests__/convertArrayToObject.test.d.ts.map +0 -1
  334. package/dist/common/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
  335. package/dist/common/__tests__/generateKeyMappingForInvalidKeys.test.d.ts.map +0 -1
  336. package/dist/common/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
  337. package/dist/common/__tests__/getUniqueObjectKeys.test.d.ts.map +0 -1
  338. package/dist/common/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
  339. package/dist/common/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
  340. package/dist/common/__tests__/migrationForOptions.test.d.ts.map +0 -1
  341. package/dist/common/__tests__/replaceInvalidKeysWithMappedNames.test.d.ts.map +0 -1
  342. package/dist/common/__tests__/validateAndSuggestKeyCorrections.test.d.ts.map +0 -1
  343. package/dist/core/utils/__tests__/getRelativeModelImportPath.test.d.ts +0 -2
  344. package/dist/core/utils/__tests__/getRelativeModelImportPath.test.d.ts.map +0 -1
  345. package/dist/core/utils/__tests__/getRelativeModelImportPath.test.js +0 -82
  346. package/dist/core/utils/__tests__/pathHelpers.test.d.ts.map +0 -1
  347. package/dist/core/utils/fileSystem.d.ts.map +0 -1
  348. package/dist/core/utils/fileSystem.js +0 -26
  349. package/dist/core/utils/format.d.ts +0 -2
  350. package/dist/core/utils/format.d.ts.map +0 -1
  351. package/dist/core/utils/getRelativeModelImportPath.d.ts +0 -9
  352. package/dist/core/utils/getRelativeModelImportPath.d.ts.map +0 -1
  353. package/dist/core/utils/getRelativeModelImportPath.js +0 -45
  354. package/dist/core/utils/isDirectory.d.ts +0 -2
  355. package/dist/core/utils/isDirectory.d.ts.map +0 -1
  356. package/dist/core/utils/isDirectory.js +0 -13
  357. package/dist/core/utils/pathHelpers.d.ts +0 -7
  358. package/dist/core/utils/pathHelpers.d.ts.map +0 -1
  359. package/dist/core/utils/prepareOptions.d.ts +0 -8
  360. package/dist/core/utils/prepareOptions.d.ts.map +0 -1
  361. package/dist/core/utils/prepareOptions.js +0 -31
  362. /package/dist/common/{Options.js → TRawOptions.js} +0 -0
  363. /package/dist/common/{__tests__ → utils/__tests__}/__mock__/mockJoiSchema.d.ts +0 -0
  364. /package/dist/common/{__tests__ → utils/__tests__}/__mock__/mockJoiSchema.js +0 -0
  365. /package/dist/common/{__tests__ → utils/__tests__}/convertArrayToObject.test.d.ts +0 -0
  366. /package/dist/common/{__tests__ → utils/__tests__}/determineBestMatchingSchemaVersion.test.d.ts +0 -0
  367. /package/dist/common/{__tests__ → utils/__tests__}/generateKeyMappingForInvalidKeys.test.d.ts +0 -0
  368. /package/dist/common/{__tests__ → utils/__tests__}/getUniqueKeysFromSchemas.test.d.ts +0 -0
  369. /package/dist/common/{__tests__ → utils/__tests__}/getUniqueObjectKeys.test.d.ts +0 -0
  370. /package/dist/common/{__tests__ → utils/__tests__}/mergeObjectSchemas.test.d.ts +0 -0
  371. /package/dist/common/{__tests__ → utils/__tests__}/migrationForMultiOptions.test.d.ts +0 -0
  372. /package/dist/common/{__tests__ → utils/__tests__}/migrationForOptions.test.d.ts +0 -0
  373. /package/dist/{core → common}/utils/__tests__/pathHelpers.test.d.ts +0 -0
  374. /package/dist/common/{__tests__ → utils/__tests__}/replaceInvalidKeysWithMappedNames.test.d.ts +0 -0
  375. /package/dist/common/{__tests__ → utils/__tests__}/validateAndSuggestKeyCorrections.test.d.ts +0 -0
@@ -9,11 +9,70 @@ const chalk_1 = __importDefault(require("chalk"));
9
9
  const child_process_1 = require("child_process");
10
10
  const configstore_1 = __importDefault(require("configstore"));
11
11
  const semver_1 = __importDefault(require("semver"));
12
+ const util_1 = require("util");
12
13
  const Enums_1 = require("./Enums");
13
14
  const Logger_1 = require("./Logger");
15
+ const execAsync = (0, util_1.promisify)(child_process_1.exec);
14
16
  // one week
15
17
  const UPDATE_CHECK_INTERVAL = 1000 * 60 * 60 * 24 * 7;
16
18
  const INCLUDED_RELEASE_TYPES = ['major', 'minor'];
19
+ /**
20
+ * Default implementation for fetching package version from npm registry
21
+ */
22
+ class NpmUpdateChecker {
23
+ packageName;
24
+ constructor(packageName) {
25
+ this.packageName = packageName;
26
+ }
27
+ async fetchLatestVersion() {
28
+ try {
29
+ // We get all versions of the package
30
+ const { stdout } = await execAsync(`npm view ${this.packageName} versions --json`, {
31
+ timeout: 5000, // 5 seconds timeout
32
+ });
33
+ const versions = JSON.parse(stdout);
34
+ if (!Array.isArray(versions) || versions.length === 0) {
35
+ return null;
36
+ }
37
+ // Filtering stable versions (excluding pre-release: alpha, beta, rc, etc.)
38
+ const stableVersions = versions.filter(version => {
39
+ const parsed = semver_1.default.parse(version);
40
+ return parsed && !parsed.prerelease.length;
41
+ });
42
+ if (stableVersions.length === 0) {
43
+ // If there are no stable versions, we return the latest of all
44
+ return versions[versions.length - 1];
45
+ }
46
+ // We sort the stable versions and return the latest one.
47
+ stableVersions.sort((a, b) => semver_1.default.compare(a, b));
48
+ return stableVersions[stableVersions.length - 1];
49
+ }
50
+ catch {
51
+ return null;
52
+ }
53
+ }
54
+ }
55
+ /**
56
+ * Default implementation for console notifications
57
+ */
58
+ class ConsoleNotificationService {
59
+ notify(updateInfo) {
60
+ const { packageName, currentVersion, latestVersion } = updateInfo;
61
+ const scriptText = chalk_1.default.yellowBright(`npm i -D ${packageName}@${latestVersion}`);
62
+ const message = `
63
+ An update is available: ${chalk_1.default.gray(currentVersion)} -> ${chalk_1.default.greenBright(latestVersion)}
64
+ Run ${scriptText} to update
65
+ `;
66
+ console.log((0, boxen_1.default)(message, {
67
+ borderColor: 'cyanBright',
68
+ margin: 1,
69
+ padding: 1,
70
+ title: 'Pay attention',
71
+ titleAlignment: 'center',
72
+ textAlignment: 'center',
73
+ }));
74
+ }
75
+ }
17
76
  /**
18
77
  * A class for tracking the release of a newer version of the generator
19
78
  */
@@ -23,20 +82,33 @@ class UpdateNotifier {
23
82
  _configStore = null;
24
83
  _packageStoreInfo = null;
25
84
  _logger;
26
- constructor(packageName, packageVersion) {
27
- this._logger = new Logger_1.Logger({
28
- instanceId: '',
29
- level: Enums_1.ELogLevel.INFO,
30
- logOutput: Enums_1.ELogOutput.CONSOLE,
31
- });
32
- if (!packageName || !packageVersion) {
85
+ _updateChecker;
86
+ _notificationService;
87
+ _checkInterval;
88
+ _enabled;
89
+ constructor(options) {
90
+ this._packageName = options.packageName;
91
+ this._packageVersion = options.packageVersion;
92
+ this._logger =
93
+ options.logger ??
94
+ new Logger_1.Logger({
95
+ instanceId: '',
96
+ level: Enums_1.ELogLevel.INFO,
97
+ logOutput: Enums_1.ELogOutput.CONSOLE,
98
+ });
99
+ this._updateChecker = options.updateChecker ?? new NpmUpdateChecker(this._packageName);
100
+ this._notificationService = options.notificationService ?? new ConsoleNotificationService();
101
+ this._checkInterval = options.checkInterval ?? UPDATE_CHECK_INTERVAL;
102
+ this._enabled = options.enabled ?? true;
103
+ if (!this._packageName || !this._packageVersion) {
33
104
  this._logger.warn(`
34
105
  The necessary parameters for checking the version are not specified.
35
- Current values packageName: ${packageName}, packageVersion: ${packageVersion}
106
+ Current values packageName: ${this._packageName}, packageVersion: ${this._packageVersion}
36
107
  `);
37
108
  }
38
- this._packageName = packageName;
39
- this._packageVersion = packageVersion;
109
+ if (!this._enabled) {
110
+ return;
111
+ }
40
112
  try {
41
113
  this._configStore = new configstore_1.default(`-${this._packageName}`, {
42
114
  lastUpdateCheck: Date.now(),
@@ -49,72 +121,93 @@ class UpdateNotifier {
49
121
  /**
50
122
  * Requests the latest version of the generator via npm
51
123
  */
52
- fetchNpmPackageInfo() {
53
- try {
54
- const latestVersion = (0, child_process_1.execSync)(`npm view ${this._packageName} version`).toString().trim();
55
- const releaseType = semver_1.default.diff(this._packageVersion, latestVersion);
56
- return {
57
- currentVersion: this._packageVersion,
58
- differenceType: releaseType,
59
- latestVersion,
60
- packageName: this._packageName,
61
- };
62
- }
63
- catch {
124
+ async fetchNpmPackageInfo() {
125
+ const latestVersion = await this._updateChecker.fetchLatestVersion();
126
+ if (!latestVersion) {
64
127
  this._logger.warn("Couldn't get information about the latest current version");
65
128
  return null;
66
129
  }
130
+ const releaseType = semver_1.default.diff(this._packageVersion, latestVersion);
131
+ return {
132
+ currentVersion: this._packageVersion,
133
+ differenceType: releaseType,
134
+ latestVersion,
135
+ packageName: this._packageName,
136
+ };
67
137
  }
68
138
  /**
69
139
  * Checks for updates and writes useful information to the cache
70
140
  */
71
- checkUpdate() {
72
- if (!this._configStore) {
73
- return;
74
- }
75
- this._packageStoreInfo = this._configStore.get('package_store_info');
76
- if (this._packageStoreInfo) {
77
- this._packageStoreInfo.currentVersion = this._packageVersion;
78
- // clean cache
79
- this._configStore.delete('package_store_info');
80
- }
81
- if (Date.now() - this._configStore.get('lastUpdateCheck') < UPDATE_CHECK_INTERVAL) {
141
+ async checkUpdate() {
142
+ if (!this._configStore || !this._enabled) {
82
143
  return;
83
144
  }
84
- const fetchInfo = this.fetchNpmPackageInfo();
85
- this._configStore.set('lastUpdateCheck', Date.now());
145
+ const fetchInfo = await this.fetchNpmPackageInfo();
146
+ // We update lastUpdateCheck ONLY if we find a suitable update (major/minor)
147
+ // This ensures that the check will be repeated until a suitable version is found
86
148
  if (fetchInfo?.differenceType && INCLUDED_RELEASE_TYPES.includes(fetchInfo.differenceType)) {
87
149
  this._configStore.set('package_store_info', fetchInfo);
150
+ this._configStore.set('lastUpdateCheck', Date.now());
151
+ this._packageStoreInfo = fetchInfo;
88
152
  }
153
+ // If no suitable update found, we don't update lastUpdateCheck,
154
+ // so the check will happen again on next run
89
155
  }
90
156
  /**
91
157
  * Checks for updates and notifies about the possibility to install a new version.
158
+ * This method waits for the check to complete before returning.
92
159
  */
93
- checkAndNotify() {
94
- if (!this._configStore) {
95
- this._logger.warn("Couldn't get information about the latest current version");
96
- this._logger.shutdownLogger();
160
+ async checkAndNotify() {
161
+ if (!this._configStore || !this._enabled) {
97
162
  return;
98
163
  }
99
- this.checkUpdate();
100
- if (!this._packageStoreInfo || !semver_1.default.gt(this._packageStoreInfo.latestVersion, this._packageStoreInfo.currentVersion)) {
101
- return;
164
+ try {
165
+ // First, check if we have cached update info
166
+ const cachedInfo = this._configStore.get('package_store_info');
167
+ if (cachedInfo) {
168
+ // Update current version in cache
169
+ cachedInfo.currentVersion = this._packageVersion;
170
+ // Check if we need to show notification
171
+ if (semver_1.default.gt(cachedInfo.latestVersion, cachedInfo.currentVersion)) {
172
+ this._notificationService.notify(cachedInfo);
173
+ // Remove from cache after showing, so we don't show it again
174
+ this._configStore.delete('package_store_info');
175
+ return;
176
+ }
177
+ else {
178
+ // Version is already up to date, clear cache
179
+ this._configStore.delete('package_store_info');
180
+ }
181
+ }
182
+ // Check if we need to perform a new check
183
+ const lastCheck = this._configStore.get('lastUpdateCheck');
184
+ if (Date.now() - lastCheck < this._checkInterval) {
185
+ // return;
186
+ }
187
+ // Perform update check and WAIT for it to complete
188
+ await this.checkUpdate();
189
+ // After check, see if we have info to show
190
+ if (this._packageStoreInfo && semver_1.default.gt(this._packageStoreInfo.latestVersion, this._packageStoreInfo.currentVersion)) {
191
+ this._notificationService.notify(this._packageStoreInfo);
192
+ // Remove from cache after showing
193
+ this._configStore.delete('package_store_info');
194
+ }
102
195
  }
103
- const { packageName, currentVersion, latestVersion } = this._packageStoreInfo;
104
- const scriptText = chalk_1.default.yellowBright(`npm i -D ${packageName}@${latestVersion}`);
105
- const message = `
106
- An update is available: ${chalk_1.default.gray(currentVersion)} -> ${chalk_1.default.greenBright(latestVersion)}}
107
- Run ${scriptText} to update
108
- `;
109
- console.log((0, boxen_1.default)(message, {
110
- borderColor: 'cyanBright',
111
- margin: 1,
112
- padding: 1,
113
- title: 'Pay attention',
114
- titleAlignment: 'center',
115
- textAlignment: 'center',
116
- }));
117
- this._logger.shutdownLogger();
196
+ catch (error) {
197
+ // Silently fail - update check should not break the main flow
198
+ this._logger.warn(`Update check failed: ${error instanceof Error ? error.message : String(error)}`);
199
+ }
200
+ // REMOVED shutdownLogger() - Logger lifecycle should be managed at application level
201
+ }
202
+ /**
203
+ * Synchronous version for backward compatibility
204
+ * @deprecated Use checkAndNotify() instead
205
+ */
206
+ checkAndNotifySync() {
207
+ // For backward compatibility, but should be removed
208
+ this.checkAndNotify().catch(() => {
209
+ // Ignore errors in sync version
210
+ });
118
211
  }
119
212
  }
120
213
  exports.UpdateNotifier = UpdateNotifier;
@@ -0,0 +1,8 @@
1
+ import { SchemaMigrationPlan } from '../Types';
2
+ /**
3
+ * Unified migration plan that includes all migrations from all schema types.
4
+ * Migrates from any old version to the latest UNIFIED_v1 schema.
5
+ * Reuses existing migration plans to avoid code duplication.
6
+ */
7
+ export declare const allMigrationPlans: SchemaMigrationPlan<Record<string, any>, Record<string, any>>[];
8
+ //# sourceMappingURL=AllMigrationPlans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllMigrationPlans.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAc/C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAY5F,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allMigrationPlans = void 0;
4
+ const MultiOptionsMigrationPlan_1 = require("../MultiOptionsVersioned/MultiOptionsMigrationPlan");
5
+ const OptionsMigrationPlans_1 = require("../OptionsVersioned/OptionsMigrationPlans");
6
+ const createTrivialMigration_1 = require("../Utils/createTrivialMigration");
7
+ /**
8
+ * Adds a prefix to all version strings in a migration plan array.
9
+ */
10
+ function addVersionPrefixToMigrationPlans(plans, prefix) {
11
+ return plans.map(plan => ({
12
+ ...plan,
13
+ fromVersion: `${prefix}_${plan.fromVersion}`,
14
+ toVersion: `${prefix}_${plan.toVersion}`,
15
+ }));
16
+ }
17
+ /**
18
+ * Unified migration plan that includes all migrations from all schema types.
19
+ * Migrates from any old version to the latest UNIFIED_v1 schema.
20
+ * Reuses existing migration plans to avoid code duplication.
21
+ */
22
+ exports.allMigrationPlans = [
23
+ // ===== OPTIONS migrations (with prefix) =====
24
+ ...addVersionPrefixToMigrationPlans(OptionsMigrationPlans_1.optionsMigrationPlans, 'OPTIONS'),
25
+ // Migration from OPTIONS v4 to UNIFIED v1
26
+ (0, createTrivialMigration_1.createTrivialMigration)('OPTIONS_v4', 'UNIFIED_v1', 'Migrate from OPTIONS to UNIFIED schema'),
27
+ // ===== MULTI_OPTIONS migrations (with prefix) =====
28
+ ...addVersionPrefixToMigrationPlans(MultiOptionsMigrationPlan_1.multiOptionsMigrationPlan, 'MULTI_OPTIONS'),
29
+ // Migration from MULTI_OPTIONS v5 to UNIFIED v1
30
+ (0, createTrivialMigration_1.createTrivialMigration)('MULTI_OPTIONS_v5', 'UNIFIED_v1', 'Migrate from MULTI_OPTIONS to UNIFIED schema'),
31
+ ];
@@ -0,0 +1,8 @@
1
+ import { VersionedSchema } from '../Types';
2
+ /**
3
+ * Unified array of all versioned schemas with prefixed versions.
4
+ * This allows migration from any old schema version to the latest unified schema.
5
+ * Reuses existing schema arrays to avoid code duplication.
6
+ */
7
+ export declare const allVersionedSchemas: VersionedSchema<Record<string, any>>[];
8
+ //# sourceMappingURL=AllVersionedSchemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllVersionedSchemas.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAgB3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAarE,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allVersionedSchemas = void 0;
4
+ const Enums_1 = require("../Enums");
5
+ const MultiOptionsVersionedSchemas_1 = require("../MultiOptionsVersioned/MultiOptionsVersionedSchemas");
6
+ const OptionsVersionedSchemas_1 = require("../OptionsVersioned/OptionsVersionedSchemas");
7
+ const UnifiedOptionsSchemaV1_1 = require("../UnifiedOptionsVersioned/UnifiedOptionsSchemaV1");
8
+ /**
9
+ * Adds a prefix to all version strings in a versioned schema array.
10
+ */
11
+ function addVersionPrefix(schemas, prefix) {
12
+ return schemas.map(schema => ({
13
+ ...schema,
14
+ version: `${prefix}_${schema.version}`,
15
+ }));
16
+ }
17
+ /**
18
+ * Unified array of all versioned schemas with prefixed versions.
19
+ * This allows migration from any old schema version to the latest unified schema.
20
+ * Reuses existing schema arrays to avoid code duplication.
21
+ */
22
+ exports.allVersionedSchemas = [
23
+ // OPTIONS schemas with prefix
24
+ ...addVersionPrefix(OptionsVersionedSchemas_1.optionsVersionedSchemas, 'OPTIONS'),
25
+ // MULTI_OPTIONS schemas with prefix
26
+ ...addVersionPrefix(MultiOptionsVersionedSchemas_1.multiOptionsVersionedSchema, 'MULTI_OPTIONS'),
27
+ // UNIFIED_OPTIONS schemas (latest)
28
+ {
29
+ version: 'UNIFIED_v1',
30
+ schema: UnifiedOptionsSchemaV1_1.unifiedOptionsSchemaV1,
31
+ type: Enums_1.EVersionedSchemaType.UNIFIED_OPTIONS,
32
+ },
33
+ ];
@@ -1,5 +1,6 @@
1
1
  export declare enum EVersionedSchemaType {
2
2
  OPTIONS = "OPTIONS",
3
- MULTI_OPTIONS = "MULTI_OPTIONS"
3
+ MULTI_OPTIONS = "MULTI_OPTIONS",
4
+ UNIFIED_OPTIONS = "UNIFIED_OPTIONS"
4
5
  }
5
6
  //# sourceMappingURL=Enums.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Enums.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/Enums.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC5B,OAAO,YAAY;IACnB,aAAa,kBAAkB;CAClC"}
1
+ {"version":3,"file":"Enums.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/Enums.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC5B,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC"}
@@ -5,4 +5,5 @@ var EVersionedSchemaType;
5
5
  (function (EVersionedSchemaType) {
6
6
  EVersionedSchemaType["OPTIONS"] = "OPTIONS";
7
7
  EVersionedSchemaType["MULTI_OPTIONS"] = "MULTI_OPTIONS";
8
+ EVersionedSchemaType["UNIFIED_OPTIONS"] = "UNIFIED_OPTIONS";
8
9
  })(EVersionedSchemaType || (exports.EVersionedSchemaType = EVersionedSchemaType = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"MultiOptionsMigrationPlan.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAoCpG,CAAC"}
1
+ {"version":3,"file":"MultiOptionsMigrationPlan.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EA0BpG,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.multiOptionsMigrationPlan = void 0;
4
+ const createDefaultFieldsMigration_1 = require("../Utils/createDefaultFieldsMigration");
4
5
  /**
5
6
  * Migration plan for multi options models.
6
7
  */
@@ -13,14 +14,9 @@ exports.multiOptionsMigrationPlan = [
13
14
  httpClient: client,
14
15
  }),
15
16
  },
16
- {
17
- fromVersion: 'v2',
18
- toVersion: 'v3',
19
- migrate: oldVersion => ({
20
- ...oldVersion,
21
- useCancelableRequest: false,
22
- }),
23
- },
17
+ (0, createDefaultFieldsMigration_1.createDefaultFieldsMigration)('v2', 'v3', {
18
+ useCancelableRequest: false,
19
+ }),
24
20
  {
25
21
  fromVersion: 'v3',
26
22
  toVersion: 'v4',
@@ -29,15 +25,10 @@ exports.multiOptionsMigrationPlan = [
29
25
  items: items.map((el) => ({ ...el, input, output, outputCore, outputServices, outputModels, outputSchemas })),
30
26
  }),
31
27
  },
32
- {
33
- fromVersion: 'v4',
34
- toVersion: 'v5',
35
- migrate: oldVersion => ({
36
- ...oldVersion,
37
- excludeCoreServiceFiles: false,
38
- includeSchemasFiles: false,
39
- sortByRequired: false,
40
- useSeparatedIndexes: false,
41
- }),
42
- },
28
+ (0, createDefaultFieldsMigration_1.createDefaultFieldsMigration)('v4', 'v5', {
29
+ excludeCoreServiceFiles: false,
30
+ includeSchemasFiles: false,
31
+ sortByRequired: false,
32
+ useSeparatedIndexes: false,
33
+ }),
43
34
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"OptionsMigrationPlans.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAgBhG,CAAC"}
1
+ {"version":3,"file":"OptionsMigrationPlans.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAehG,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.optionsMigrationPlans = void 0;
4
+ const createDefaultFieldsMigration_1 = require("../Utils/createDefaultFieldsMigration");
4
5
  /**
5
6
  * Migration plan for option models.
6
7
  */
@@ -10,14 +11,13 @@ exports.optionsMigrationPlans = [
10
11
  toVersion: 'v2',
11
12
  migrate: ({ client, ...otherProps }) => ({ ...otherProps, httpClient: client }),
12
13
  },
13
- {
14
- fromVersion: 'v2',
15
- toVersion: 'v3',
16
- migrate: oldVersion => ({ ...oldVersion, useCancelableRequest: false }),
17
- },
18
- {
19
- fromVersion: 'v3',
20
- toVersion: 'v4',
21
- migrate: oldVersion => ({ ...oldVersion, excludeCoreServiceFiles: false, includeSchemasFiles: false, sortByRequired: false, useSeparatedIndexes: false }),
22
- },
14
+ (0, createDefaultFieldsMigration_1.createDefaultFieldsMigration)('v2', 'v3', {
15
+ useCancelableRequest: false,
16
+ }),
17
+ (0, createDefaultFieldsMigration_1.createDefaultFieldsMigration)('v3', 'v4', {
18
+ excludeCoreServiceFiles: false,
19
+ includeSchemasFiles: false,
20
+ sortByRequired: false,
21
+ useSeparatedIndexes: false,
22
+ }),
23
23
  ];
@@ -9,6 +9,16 @@ export type SchemaMigrationPlan<From, To> = {
9
9
  fromVersion: string;
10
10
  toVersion: string;
11
11
  migrate: (input: From) => To;
12
+ /**
13
+ * Optional description of what this migration does.
14
+ * Helps with debugging and documentation.
15
+ */
16
+ description?: string;
12
17
  };
13
18
  export type TraverseHandler<T> = (value: any, recurse: (v: any) => void, result: T) => boolean;
19
+ export type VersionMatchResult = {
20
+ lastVersionIndex: number;
21
+ latestVersion: string;
22
+ firstVersion: string;
23
+ };
14
24
  //# sourceMappingURL=Types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/Types.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,mBAAmB,CAAC,IAAI,EAAE,EAAE,IAAI;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;CAChC,CAAA;AAGD,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC"}
1
+ {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/Types.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;IAC7B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACtB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,IAAI,EAAE,EAAE,IAAI;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,EAAE,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;AAE/F,MAAM,MAAM,kBAAkB,GAAG;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SchemaMigrationPlan } from "../Types";
2
+ export declare const unifiedOptionsMigrationPlan: SchemaMigrationPlan<Record<string, any>, Record<string, any>>[];
3
+ //# sourceMappingURL=UnifiedOptionsMigrationPlan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnifiedOptionsMigrationPlan.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,2BAA2B,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAwBtG,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unifiedOptionsMigrationPlan = void 0;
4
+ exports.unifiedOptionsMigrationPlan = [
5
+ // Migration from OPTIONS v4 to UNIFIED_OPTIONS v1
6
+ // OPTIONS v4 already has input/output structure, so we just pass it through
7
+ // Unified schema supports this format directly
8
+ {
9
+ fromVersion: 'OPTIONS_v4',
10
+ toVersion: 'UNIFIED_v1',
11
+ migrate: (oldVersion) => {
12
+ // OPTIONS v4 structure is already compatible with unified schema
13
+ // Just return as-is, unified schema will handle input/output
14
+ return { ...oldVersion };
15
+ },
16
+ },
17
+ // Migration from MULTI_OPTIONS v5 to UNIFIED_OPTIONS v1
18
+ // MULTI_OPTIONS v5 has items array, which unified schema also supports
19
+ {
20
+ fromVersion: 'MULTI_OPTIONS_v5',
21
+ toVersion: 'UNIFIED_v1',
22
+ migrate: (oldVersion) => {
23
+ // MULTI_OPTIONS v5 structure with items is already compatible
24
+ // Just return as-is, unified schema will handle items
25
+ return { ...oldVersion };
26
+ },
27
+ },
28
+ ];
@@ -0,0 +1,7 @@
1
+ import Joi from 'joi';
2
+ /**
3
+ * Unified options schema that supports both single and multi-item configurations.
4
+ * Use either 'items' array for multiple specs OR 'input'/'output' for single spec.
5
+ */
6
+ export declare const unifiedOptionsSchemaV1: Joi.ObjectSchema<any>;
7
+ //# sourceMappingURL=UnifiedOptionsSchemaV1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnifiedOptionsSchemaV1.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAqBtB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,uBA6BZ,CAAC"}
@@ -0,0 +1,42 @@
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.unifiedOptionsSchemaV1 = void 0;
7
+ const joi_1 = __importDefault(require("joi"));
8
+ const core_1 = require("../../../core");
9
+ const CommonSchemas_1 = require("../CommonSchemas");
10
+ const mergeObjectSchemas_1 = require("../Utils/mergeObjectSchemas");
11
+ const itemSchema = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.object({
12
+ input: joi_1.default.string().required().description('Путь, URL или строка OpenAPI спецификации'),
13
+ httpClient: joi_1.default.string().valid(...Object.values(core_1.HttpClient)).optional(),
14
+ }), CommonSchemas_1.outputPathsSchema, CommonSchemas_1.additionalParametersSchemaV2, CommonSchemas_1.experimentalParametersSchemaV2);
15
+ /**
16
+ * Unified options schema that supports both single and multi-item configurations.
17
+ * Use either 'items' array for multiple specs OR 'input'/'output' for single spec.
18
+ */
19
+ exports.unifiedOptionsSchemaV1 = (0, mergeObjectSchemas_1.mergeObjectSchemas)(joi_1.default.object({
20
+ // Multi-item configuration
21
+ items: joi_1.default.array()
22
+ .items(itemSchema)
23
+ .min(1)
24
+ .optional()
25
+ .description('Массив спецификаций для генерации'),
26
+ // Single-item configuration (mutually exclusive with items)
27
+ input: joi_1.default.string()
28
+ .when('items', {
29
+ is: joi_1.default.exist(),
30
+ then: joi_1.default.forbidden(),
31
+ otherwise: joi_1.default.required(),
32
+ })
33
+ .description('Путь, URL или строка OpenAPI спецификации'),
34
+ output: joi_1.default.string()
35
+ .when('items', {
36
+ is: joi_1.default.exist(),
37
+ then: joi_1.default.forbidden(),
38
+ otherwise: joi_1.default.required(),
39
+ })
40
+ .description('Выходная директория'),
41
+ }), CommonSchemas_1.outputPathsSchema, // outputCore, outputServices, etc. for single-item mode
42
+ CommonSchemas_1.specialParametersSchemasV2, CommonSchemas_1.additionalParametersSchemaV2, CommonSchemas_1.experimentalParametersSchemaV2).xor('items', 'input');
@@ -0,0 +1,3 @@
1
+ import { VersionedSchema } from "../Types";
2
+ export declare const unifiedOptionsVersionedSchemas: VersionedSchema<Record<string, any>>[];
3
+ //# sourceMappingURL=UnifiedOptionsVersionedSchemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnifiedOptionsVersionedSchemas.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,eAAO,MAAM,8BAA8B,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAI/E,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unifiedOptionsVersionedSchemas = void 0;
4
+ const Enums_1 = require("../Enums");
5
+ const UnifiedOptionsSchemaV1_1 = require("./UnifiedOptionsSchemaV1");
6
+ exports.unifiedOptionsVersionedSchemas = [{
7
+ version: 'v1',
8
+ schema: UnifiedOptionsSchemaV1_1.unifiedOptionsSchemaV1,
9
+ type: Enums_1.EVersionedSchemaType.UNIFIED_OPTIONS,
10
+ }];
@@ -0,0 +1,11 @@
1
+ import { SchemaMigrationPlan } from "../Types";
2
+ /**
3
+ * Creates a simple migration plan that adds optional fields.
4
+ * Use this when migration only adds optional fields.
5
+ * @param fromVersion
6
+ * @param toVersion
7
+ * @param defaultFields
8
+ * @returns
9
+ */
10
+ export declare function createDefaultFieldsMigration<From extends Record<string, any>>(fromVersion: string, toVersion: string, defaultFields: Record<string, any>): SchemaMigrationPlan<From, From>;
11
+ //# sourceMappingURL=createDefaultFieldsMigration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDefaultFieldsMigration.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/createDefaultFieldsMigration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzE,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAOjC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDefaultFieldsMigration = createDefaultFieldsMigration;
4
+ /**
5
+ * Creates a simple migration plan that adds optional fields.
6
+ * Use this when migration only adds optional fields.
7
+ * @param fromVersion
8
+ * @param toVersion
9
+ * @param defaultFields
10
+ * @returns
11
+ */
12
+ function createDefaultFieldsMigration(fromVersion, toVersion, defaultFields) {
13
+ return {
14
+ fromVersion,
15
+ toVersion,
16
+ migrate: (oldVersion) => ({ ...oldVersion, ...defaultFields }),
17
+ description: `Adds default values for new optional fields: ${Object.keys(defaultFields).join(', ')}`,
18
+ };
19
+ }