ts-openapi-codegen 2.0.0-beta.7 → 2.0.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 (281) hide show
  1. package/README.md +104 -0
  2. package/README.rus.md +104 -0
  3. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +2 -1
  4. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -1
  5. package/dist/cli/checkAndUpdateConfig/checkConfig.js +14 -6
  6. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +2 -1
  7. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -1
  8. package/dist/cli/checkAndUpdateConfig/updateConfig.js +13 -5
  9. package/dist/cli/generateOpenApiClient/generateOpenApiClient.d.ts.map +1 -1
  10. package/dist/cli/generateOpenApiClient/generateOpenApiClient.js +4 -5
  11. package/dist/cli/index.js +5 -5
  12. package/dist/cli/initOpenApiConfig/init.d.ts.map +1 -1
  13. package/dist/cli/initOpenApiConfig/init.js +5 -13
  14. package/dist/cli/initOpenApiConfig/initConfig.js +3 -3
  15. package/dist/cli/previewChanges/previewChanges.d.ts.map +1 -1
  16. package/dist/cli/previewChanges/previewChanges.js +12 -5
  17. package/dist/cli/schemas/base.d.ts +6 -1
  18. package/dist/cli/schemas/base.d.ts.map +1 -1
  19. package/dist/cli/schemas/base.js +10 -6
  20. package/dist/cli/schemas/checkConfig.d.ts +1 -1
  21. package/dist/cli/schemas/generate.d.ts +1 -25
  22. package/dist/cli/schemas/generate.d.ts.map +1 -1
  23. package/dist/cli/schemas/generate.js +21 -32
  24. package/dist/cli/schemas/index.d.ts +2 -1
  25. package/dist/cli/schemas/index.d.ts.map +1 -1
  26. package/dist/cli/schemas/index.js +1 -0
  27. package/dist/cli/schemas/init.d.ts +5 -5
  28. package/dist/cli/schemas/init.d.ts.map +1 -1
  29. package/dist/cli/schemas/init.js +4 -5
  30. package/dist/cli/schemas/previewChanges.d.ts +9 -0
  31. package/dist/cli/schemas/previewChanges.d.ts.map +1 -0
  32. package/dist/cli/schemas/previewChanges.js +11 -0
  33. package/dist/cli/schemas/updateConfig.d.ts +1 -1
  34. package/dist/common/Consts.d.ts +2 -0
  35. package/dist/common/Consts.d.ts.map +1 -1
  36. package/dist/common/Consts.js +4 -1
  37. package/dist/common/LoggerMessages.js +1 -1
  38. package/dist/common/TRawOptions.d.ts +1 -1
  39. package/dist/common/TRawOptions.d.ts.map +1 -1
  40. package/dist/common/Validation/formatZodError.d.ts +10 -0
  41. package/dist/common/Validation/formatZodError.d.ts.map +1 -0
  42. package/dist/{cli/validation/errorFormatter.js → common/Validation/formatZodError.js} +14 -13
  43. package/dist/common/Validation/index.d.ts +3 -0
  44. package/dist/common/Validation/index.d.ts.map +1 -0
  45. package/dist/{cli/validation → common/Validation}/index.js +2 -2
  46. package/dist/{cli/validation/validateCLIOptions.d.ts → common/Validation/validateZodOptions.d.ts} +4 -4
  47. package/dist/common/Validation/validateZodOptions.d.ts.map +1 -0
  48. package/dist/{cli/validation/validateCLIOptions.js → common/Validation/validateZodOptions.js} +7 -10
  49. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +6 -1
  50. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -1
  51. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +8 -14
  52. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts +28 -0
  53. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.d.ts.map +1 -0
  54. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.js +25 -0
  55. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts +36 -6
  56. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.d.ts.map +1 -1
  57. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.js +33 -37
  58. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts +37 -6
  59. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.d.ts.map +1 -1
  60. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV2.js +30 -37
  61. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts +40 -0
  62. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.d.ts.map +1 -0
  63. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV3.js +36 -0
  64. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts +65 -0
  65. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.d.ts.map +1 -0
  66. package/dist/common/VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas.js +31 -0
  67. package/dist/common/VersionedSchema/CommonSchemas.d.ts +53 -30
  68. package/dist/common/VersionedSchema/CommonSchemas.d.ts.map +1 -1
  69. package/dist/common/VersionedSchema/CommonSchemas.js +47 -72
  70. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts +25 -5
  71. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.d.ts.map +1 -1
  72. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV1.js +34 -17
  73. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts +25 -5
  74. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.d.ts.map +1 -1
  75. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV2.js +28 -19
  76. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts +25 -1
  77. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.d.ts.map +1 -1
  78. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV3.js +29 -2
  79. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts +25 -5
  80. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.d.ts.map +1 -1
  81. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV4.js +30 -14
  82. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts +23 -5
  83. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.d.ts.map +1 -1
  84. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsSchemaV5.js +33 -18
  85. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts +3 -2
  86. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.d.ts.map +1 -1
  87. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas.js +18 -11
  88. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts +22 -5
  89. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.d.ts.map +1 -1
  90. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV1.js +30 -12
  91. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts +22 -5
  92. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.d.ts.map +1 -1
  93. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV2.js +27 -13
  94. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts +22 -1
  95. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.d.ts.map +1 -1
  96. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV3.js +28 -2
  97. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts +22 -5
  98. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.d.ts.map +1 -1
  99. package/dist/common/VersionedSchema/OptionsVersioned/OptionsSchemaV4.js +31 -12
  100. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts +3 -2
  101. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.d.ts.map +1 -1
  102. package/dist/common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas.js +15 -9
  103. package/dist/common/VersionedSchema/Types.d.ts +5 -5
  104. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  105. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts +16 -0
  106. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.d.ts.map +1 -0
  107. package/dist/common/VersionedSchema/Utils/__mocks__/compatibilityCases.js +85 -0
  108. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts +2 -0
  109. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.d.ts.map +1 -0
  110. package/dist/common/VersionedSchema/Utils/__tests__/compareShapes.test.js +23 -0
  111. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts +2 -0
  112. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.d.ts.map +1 -0
  113. package/dist/common/VersionedSchema/Utils/__tests__/migrateDataToLatestSchemaVersion.test.js +75 -0
  114. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts +12 -0
  115. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.d.ts.map +1 -0
  116. package/dist/common/VersionedSchema/Utils/buildVersionedSchema.js +13 -0
  117. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts +16 -0
  118. package/dist/common/VersionedSchema/Utils/compareShapes.d.ts.map +1 -0
  119. package/dist/common/VersionedSchema/Utils/compareShapes.js +30 -0
  120. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +2 -1
  121. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  122. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.js +5 -5
  123. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +2 -2
  124. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -1
  125. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +15 -7
  126. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts +2 -2
  127. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.d.ts.map +1 -1
  128. package/dist/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.js +16 -3
  129. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.d.ts.map +1 -1
  130. package/dist/common/VersionedSchema/Utils/getUniqueObjectKeys.js +19 -2
  131. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +2 -1
  132. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  133. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +10 -9
  134. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts +4 -0
  135. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.d.ts.map +1 -0
  136. package/dist/common/VersionedSchema/refinements/dependentOptionsRefinement.js +43 -0
  137. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts +4 -0
  138. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.d.ts.map +1 -0
  139. package/dist/common/VersionedSchema/refinements/singleOrMultiRefinement.js +21 -0
  140. package/dist/core/Context.d.ts +6 -5
  141. package/dist/core/Context.d.ts.map +1 -1
  142. package/dist/core/Context.js +69 -26
  143. package/dist/core/OpenApiClient.d.ts.map +1 -1
  144. package/dist/core/OpenApiClient.js +12 -8
  145. package/dist/core/WriteClient.d.ts.map +1 -1
  146. package/dist/core/WriteClient.js +4 -0
  147. package/dist/core/__tests__/WriteClient.test.js +3 -0
  148. package/dist/core/api/v2/Parser.d.ts +1 -1
  149. package/dist/core/api/v2/Parser.d.ts.map +1 -1
  150. package/dist/core/api/v2/Parser.js +2 -2
  151. package/dist/core/api/v2/parser/getModel.d.ts.map +1 -1
  152. package/dist/core/api/v2/parser/getModel.js +2 -5
  153. package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
  154. package/dist/core/api/v2/parser/getModelProperties.js +1 -3
  155. package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
  156. package/dist/core/api/v2/parser/getModels.js +1 -2
  157. package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
  158. package/dist/core/api/v2/parser/getOperationParameter.js +2 -5
  159. package/dist/core/api/v2/parser/getOperationParameters.js +1 -1
  160. package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
  161. package/dist/core/api/v2/parser/getOperationResponse.js +1 -3
  162. package/dist/core/api/v2/parser/getOperationResponses.js +1 -1
  163. package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
  164. package/dist/core/api/v2/parser/getServices.js +4 -3
  165. package/dist/core/api/v2/parser/getType.d.ts.map +1 -1
  166. package/dist/core/api/v2/parser/getType.js +2 -2
  167. package/dist/core/api/v3/Parser.d.ts +1 -1
  168. package/dist/core/api/v3/Parser.d.ts.map +1 -1
  169. package/dist/core/api/v3/Parser.js +2 -2
  170. package/dist/core/api/v3/parser/getModel.d.ts.map +1 -1
  171. package/dist/core/api/v3/parser/getModel.js +2 -5
  172. package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
  173. package/dist/core/api/v3/parser/getModelProperties.js +1 -3
  174. package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
  175. package/dist/core/api/v3/parser/getModels.js +1 -2
  176. package/dist/core/api/v3/parser/getOperation.js +1 -1
  177. package/dist/core/api/v3/parser/getOperationParameter.d.ts.map +1 -1
  178. package/dist/core/api/v3/parser/getOperationParameter.js +2 -5
  179. package/dist/core/api/v3/parser/getOperationParameters.js +1 -1
  180. package/dist/core/api/v3/parser/getOperationRequestBody.d.ts.map +1 -1
  181. package/dist/core/api/v3/parser/getOperationRequestBody.js +1 -3
  182. package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
  183. package/dist/core/api/v3/parser/getOperationResponse.js +1 -3
  184. package/dist/core/api/v3/parser/getOperationResponses.js +1 -1
  185. package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
  186. package/dist/core/api/v3/parser/getServices.js +4 -3
  187. package/dist/core/api/v3/parser/getType.js +2 -2
  188. package/dist/core/index.d.ts.map +1 -1
  189. package/dist/core/index.js +2 -0
  190. package/dist/core/types/base/Templates.model.d.ts +3 -0
  191. package/dist/core/types/base/Templates.model.d.ts.map +1 -1
  192. package/dist/core/utils/__mocks__/templates.d.ts.map +1 -1
  193. package/dist/core/utils/__mocks__/templates.js +3 -0
  194. package/dist/core/utils/__tests__/isSubdirectory.test.js +2 -2
  195. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  196. package/dist/core/utils/registerHandlebarTemplates.js +9 -3
  197. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  198. package/dist/core/utils/serviceHelpers.js +32 -6
  199. package/dist/core/utils/validateRawOptions.d.ts +3 -0
  200. package/dist/core/utils/validateRawOptions.d.ts.map +1 -0
  201. package/dist/core/utils/validateRawOptions.js +15 -0
  202. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  203. package/dist/core/utils/writeClientCore.js +5 -3
  204. package/dist/templatesCompiled/client/core/ApiError.js +1 -1
  205. package/dist/templatesCompiled/client/core/CancelablePromise.d.ts +1 -0
  206. package/dist/templatesCompiled/client/core/CancelablePromise.d.ts.map +1 -1
  207. package/dist/templatesCompiled/client/core/CancelablePromise.js +9 -2
  208. package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts +1 -0
  209. package/dist/templatesCompiled/client/core/HttpStatusCode.d.ts.map +1 -1
  210. package/dist/templatesCompiled/client/core/HttpStatusCode.js +9 -2
  211. package/dist/templatesCompiled/client/core/executor/createExecutorAdapter.d.ts.map +1 -0
  212. package/dist/templatesCompiled/client/core/{createExecutorAdapter.js → executor/createExecutorAdapter.js} +3 -3
  213. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts +8 -0
  214. package/dist/templatesCompiled/client/core/executor/requestExecutor.d.ts.map +1 -0
  215. package/dist/templatesCompiled/client/core/executor/requestExecutor.js +18 -0
  216. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts +8 -0
  217. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.d.ts.map +1 -0
  218. package/dist/templatesCompiled/client/core/interceptors/apiErrorInterceptor.js +18 -0
  219. package/dist/templatesCompiled/client/core/{request-executor.d.ts → interceptors/interceptors.d.ts} +2 -1
  220. package/dist/templatesCompiled/client/core/interceptors/interceptors.d.ts.map +1 -0
  221. package/dist/templatesCompiled/client/core/interceptors/interceptors.js +18 -0
  222. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts +8 -0
  223. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.d.ts.map +1 -0
  224. package/dist/templatesCompiled/client/core/interceptors/withInterceptors.js +18 -0
  225. package/dist/templatesCompiled/client/exportClient.d.ts.map +1 -1
  226. package/dist/templatesCompiled/client/exportClient.js +14 -10
  227. package/dist/templatesCompiled/client/exportService.js +1 -1
  228. package/dist/templatesCompiled/client/indexCore.js +2 -2
  229. package/dist/templatesCompiled/client/indexFull.js +2 -2
  230. package/dist/templatesCompiled/client/partials/exportComposition.d.ts +2 -0
  231. package/dist/templatesCompiled/client/partials/exportComposition.d.ts.map +1 -1
  232. package/dist/templatesCompiled/client/partials/exportComposition.js +17 -9
  233. package/package.json +1 -1
  234. package/dist/cli/validation/errorFormatter.d.ts +0 -6
  235. package/dist/cli/validation/errorFormatter.d.ts.map +0 -1
  236. package/dist/cli/validation/index.d.ts +0 -3
  237. package/dist/cli/validation/index.d.ts.map +0 -1
  238. package/dist/cli/validation/validateCLIOptions.d.ts.map +0 -1
  239. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts +0 -6
  240. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.d.ts.map +0 -1
  241. package/dist/common/VersionedSchema/Utils/getErrorFieldsFromValidation.js +0 -7
  242. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts +0 -6
  243. package/dist/common/VersionedSchema/Utils/joiHandlers.d.ts.map +0 -1
  244. package/dist/common/VersionedSchema/Utils/joiHandlers.js +0 -59
  245. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts +0 -3
  246. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.d.ts.map +0 -1
  247. package/dist/common/VersionedSchema/Utils/mergeObjectSchemas.js +0 -12
  248. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts +0 -3
  249. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.d.ts.map +0 -1
  250. package/dist/common/VersionedSchema/Utils/traverseObjectStructure.js +0 -31
  251. package/dist/common/schemas/configSchemas.d.ts +0 -91
  252. package/dist/common/schemas/configSchemas.d.ts.map +0 -1
  253. package/dist/common/schemas/configSchemas.js +0 -131
  254. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts +0 -19
  255. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
  256. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.js +0 -14
  257. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts +0 -2
  258. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
  259. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.js +0 -38
  260. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts +0 -2
  261. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
  262. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.js +0 -20
  263. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts +0 -2
  264. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
  265. package/dist/common/utils/__tests__/mergeObjectSchemas.test.js +0 -35
  266. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts +0 -2
  267. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
  268. package/dist/common/utils/__tests__/migrationForMultiOptions.test.js +0 -112
  269. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts +0 -2
  270. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +0 -1
  271. package/dist/common/utils/__tests__/migrationForOptions.test.js +0 -56
  272. package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts +0 -2
  273. package/dist/core/utils/__tests__/getRelativeModelPath.test.d.ts.map +0 -1
  274. package/dist/core/utils/__tests__/getRelativeModelPath.test.js +0 -21
  275. package/dist/core/utils/getRelativeModelPath.d.ts +0 -9
  276. package/dist/core/utils/getRelativeModelPath.d.ts.map +0 -1
  277. package/dist/core/utils/getRelativeModelPath.js +0 -37
  278. package/dist/templatesCompiled/client/core/createExecutorAdapter.d.ts.map +0 -1
  279. package/dist/templatesCompiled/client/core/request-executor.d.ts.map +0 -1
  280. package/dist/templatesCompiled/client/core/request-executor.js +0 -11
  281. /package/dist/templatesCompiled/client/core/{createExecutorAdapter.d.ts → executor/createExecutorAdapter.d.ts} +0 -0
@@ -2,52 +2,41 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateOptionsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const Consts_1 = require("../../common/Consts");
6
- const configSchemas_1 = require("../../common/schemas/configSchemas");
7
- const loadConfigIfExists_1 = require("../../common/utils/loadConfigIfExists");
8
5
  const base_1 = require("./base");
9
- /**
10
- * Преобразует пустые строки в undefined для опциональных полей
11
- * Это нужно, потому что Commander.js передает пустые строки для опций без значений
12
- */
13
- const emptyStringToUndefined = zod_1.z.preprocess((val) => (val === '' ? undefined : val), zod_1.z.string().min(1).optional());
14
- /**
15
- * Схема для команды generate
16
- * Основана на baseFlatOptionsSchema, но с добавлением:
17
- * - openapiConfig (из baseCLIOptionsSchema)
18
- * - опциональными input/output (валидируются условно)
19
- */
20
- exports.generateOptionsSchema = base_1.baseCLIOptionsSchema
21
- .merge(configSchemas_1.baseFlatOptionsSchema)
22
- .extend({
23
- input: emptyStringToUndefined,
24
- output: emptyStringToUndefined,
6
+ exports.generateOptionsSchema = zod_1.z
7
+ .object({
8
+ ...base_1.baseCLIOptionsSchema.shape,
9
+ input: base_1.emptyStringToUndefined,
10
+ output: base_1.emptyStringToUndefined,
25
11
  })
26
12
  .superRefine((data, ctx) => {
27
- // Проверка: если excludeCoreServiceFiles === true, request не должен быть указан
28
- if (data.excludeCoreServiceFiles === true && data.request) {
13
+ const hasInput = !!data.input;
14
+ const hasCongigPath = !!data.openapiConfig;
15
+ if (hasInput && hasCongigPath) {
29
16
  ctx.addIssue({
30
- code: zod_1.z.ZodIssueCode.custom,
31
- message: '"--request" can only be used when "excludeCoreServiceFiles" is false',
32
- path: ['request'],
17
+ code: 'custom',
18
+ message: 'Use either openapiConfig or input/output, but not both options.',
19
+ path: ['openapiConfig'],
33
20
  });
34
21
  }
35
- // Проверка: input и output обязательны, если конфиг-файл не существует или пуст
36
- const configPath = data.openapiConfig || Consts_1.DEFAULT_OPENAPI_CONFIG_FILENAME;
37
- const configData = (0, loadConfigIfExists_1.loadConfigIfExists)(configPath);
38
- // Если конфиг не существует или пуст, требуем input и output
39
- const needsInputOutput = !configData || (Array.isArray(configData) && configData.length === 0) || (typeof configData === 'object' && Object.keys(configData).length === 0);
40
- if (needsInputOutput) {
22
+ if (!hasInput && !hasCongigPath) {
23
+ ctx.addIssue({
24
+ code: 'custom',
25
+ message: 'You must specify either openapiConfig or input/output',
26
+ path: ['input'],
27
+ });
28
+ }
29
+ if (hasInput && !hasCongigPath) {
41
30
  if (!data.input || data.input.trim() === '') {
42
31
  ctx.addIssue({
43
- code: zod_1.z.ZodIssueCode.custom,
32
+ code: 'custom',
44
33
  message: '"--input" is required when no valid config file is provided',
45
34
  path: ['input'],
46
35
  });
47
36
  }
48
37
  if (!data.output || data.output.trim() === '') {
49
38
  ctx.addIssue({
50
- code: zod_1.z.ZodIssueCode.custom,
39
+ code: 'custom',
51
40
  message: '"--output" is required when no valid config file is provided',
52
41
  path: ['output'],
53
42
  });
@@ -2,6 +2,7 @@ export * from './base';
2
2
  export * from './checkConfig';
3
3
  export * from './generate';
4
4
  export * from './init';
5
+ export * from './previewChanges';
5
6
  export * from './updateConfig';
6
- export type CLIOptions = import('./generate').GenerateOptions | import('./checkConfig').CheckConfigOptions | import('./updateConfig').UpdateConfigOptions | import('./init').InitOptions;
7
+ export type CLIOptions = import('./generate').GenerateOptions | import('./checkConfig').CheckConfigOptions | import('./updateConfig').UpdateConfigOptions | import('./init').InitOptions | import('./previewChanges').TPreviewChangesOptions;
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAG/B,MAAM,MAAM,UAAU,GAAG,OAAO,YAAY,EAAE,eAAe,GAAG,OAAO,eAAe,EAAE,kBAAkB,GAAG,OAAO,gBAAgB,EAAE,mBAAmB,GAAG,OAAO,QAAQ,EAAE,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAG/B,MAAM,MAAM,UAAU,GAChB,OAAO,YAAY,EAAE,eAAe,GACpC,OAAO,eAAe,EAAE,kBAAkB,GAC1C,OAAO,gBAAgB,EAAE,mBAAmB,GAC5C,OAAO,QAAQ,EAAE,WAAW,GAC5B,OAAO,kBAAkB,EAAE,sBAAsB,CAAC"}
@@ -18,4 +18,5 @@ __exportStar(require("./base"), exports);
18
18
  __exportStar(require("./checkConfig"), exports);
19
19
  __exportStar(require("./generate"), exports);
20
20
  __exportStar(require("./init"), exports);
21
+ __exportStar(require("./previewChanges"), exports);
21
22
  __exportStar(require("./updateConfig"), exports);
@@ -1,10 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  export declare const initOptionsSchema: z.ZodObject<{
3
- openapiConfig: z.ZodDefault<z.ZodOptional<z.ZodString>>;
4
- specsDir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
5
- request: z.ZodDefault<z.ZodOptional<z.ZodString>>;
6
- useCancelableRequest: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
7
- useInteractiveMode: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
3
+ openapiConfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
4
+ specsDir: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
5
+ request: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
6
+ useCancelableRequest: z.ZodOptional<z.ZodBoolean>;
7
+ useInteractiveMode: z.ZodOptional<z.ZodBoolean>;
8
8
  }, z.core.$strip>;
9
9
  export type InitOptions = z.infer<typeof initOptionsSchema>;
10
10
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,iBAAiB;;;;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;iBAK5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -2,11 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initOptionsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const Consts_1 = require("../../common/Consts");
6
5
  const base_1 = require("./base");
7
6
  exports.initOptionsSchema = base_1.baseCLIOptionsSchema.extend({
8
- specsDir: zod_1.z.string().min(1).optional().default(Consts_1.DEFAULT_SPECS_DIR),
9
- request: zod_1.z.string().min(1).optional().default(Consts_1.DEFAULT_CUSTOM_REQUEST_PATH),
10
- useCancelableRequest: zod_1.z.boolean().optional().default(false),
11
- useInteractiveMode: zod_1.z.boolean().optional().default(false),
7
+ specsDir: base_1.emptyStringToUndefined,
8
+ request: base_1.emptyStringToUndefined,
9
+ useCancelableRequest: zod_1.z.boolean().optional(),
10
+ useInteractiveMode: zod_1.z.boolean().optional(),
12
11
  });
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ export declare const previewChangesSchema: z.ZodObject<{
3
+ generatedDir: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
4
+ previewDir: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
5
+ diffDir: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
6
+ openapiConfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
7
+ }, z.core.$strip>;
8
+ export type TPreviewChangesOptions = z.infer<typeof previewChangesSchema>;
9
+ //# sourceMappingURL=previewChanges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"previewChanges.d.ts","sourceRoot":"","sources":["../../../src/cli/schemas/previewChanges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB;;;;;iBAK/B,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.previewChangesSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const base_1 = require("./base");
6
+ exports.previewChangesSchema = zod_1.z.object({
7
+ ...base_1.baseCLIOptionsSchema.shape,
8
+ generatedDir: base_1.emptyStringToUndefined,
9
+ previewDir: base_1.emptyStringToUndefined,
10
+ diffDir: base_1.emptyStringToUndefined,
11
+ });
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const updateConfigOptionsSchema: z.ZodObject<{
3
- openapiConfig: z.ZodDefault<z.ZodOptional<z.ZodString>>;
3
+ openapiConfig: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodOptional<z.ZodString>>;
4
4
  }, z.core.$strip>;
5
5
  export type UpdateConfigOptions = z.infer<typeof updateConfigOptionsSchema>;
6
6
  //# sourceMappingURL=updateConfig.d.ts.map
@@ -6,4 +6,6 @@ export declare const APP_LOGGER: Logger;
6
6
  export declare const DEFAULT_SPECS_DIR = "openapi/";
7
7
  export declare const DEFAULT_CUSTOM_REQUEST_PATH = "./src/custom/request.ts";
8
8
  export declare const DEFAULT_OUTPUT_API_DIR = "./generated";
9
+ export declare const DEFAULT_PREVIEW_CHANGES_DIR = "./.ts-openapi-codegen-preview-changes";
10
+ export declare const DEFAULT_DIFF_CHANGES_DIR = "./.ts-openapi-codegen-diff-changes";
9
11
  //# sourceMappingURL=Consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Consts.d.ts","sourceRoot":"","sources":["../../src/common/Consts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,eAAO,MAAM,6BAA6B,EAAE,kBAqB3C,CAAC;AAEF,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,eAAO,MAAM,2BAA2B,4BAA4B,CAAA;AAEpE,eAAO,MAAM,sBAAsB,gBAAgB,CAAC"}
1
+ {"version":3,"file":"Consts.d.ts","sourceRoot":"","sources":["../../src/common/Consts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,eAAO,MAAM,6BAA6B,EAAE,kBAsB3C,CAAC;AAEF,eAAO,MAAM,UAAU,QAIrB,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,eAAO,MAAM,2BAA2B,4BAA4B,CAAA;AAEpE,eAAO,MAAM,sBAAsB,gBAAgB,CAAC;AAEpD,eAAO,MAAM,2BAA2B,0CAA0C,CAAC;AAEnF,eAAO,MAAM,wBAAwB,uCAAuC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_OUTPUT_API_DIR = exports.DEFAULT_CUSTOM_REQUEST_PATH = exports.DEFAULT_SPECS_DIR = exports.APP_LOGGER = exports.COMMON_DEFAULT_OPTIONS_VALUES = exports.DEFAULT_OPENAPI_CONFIG_FILENAME = void 0;
3
+ exports.DEFAULT_DIFF_CHANGES_DIR = exports.DEFAULT_PREVIEW_CHANGES_DIR = exports.DEFAULT_OUTPUT_API_DIR = exports.DEFAULT_CUSTOM_REQUEST_PATH = exports.DEFAULT_SPECS_DIR = exports.APP_LOGGER = exports.COMMON_DEFAULT_OPTIONS_VALUES = exports.DEFAULT_OPENAPI_CONFIG_FILENAME = void 0;
4
4
  const HttpClient_enum_1 = require("../core/types/enums/HttpClient.enum");
5
5
  const ValidationLibrary_enum_1 = require("../core/types/enums/ValidationLibrary.enum");
6
6
  const Enums_1 = require("./Enums");
@@ -16,6 +16,7 @@ exports.COMMON_DEFAULT_OPTIONS_VALUES = {
16
16
  httpClient: HttpClient_enum_1.HttpClient.FETCH,
17
17
  useOptions: false,
18
18
  useUnionTypes: false,
19
+ includeSchemasFiles: false,
19
20
  excludeCoreServiceFiles: false,
20
21
  request: '',
21
22
  interfacePrefix: 'I',
@@ -36,3 +37,5 @@ exports.APP_LOGGER = new Logger_1.Logger({
36
37
  exports.DEFAULT_SPECS_DIR = 'openapi/';
37
38
  exports.DEFAULT_CUSTOM_REQUEST_PATH = './src/custom/request.ts';
38
39
  exports.DEFAULT_OUTPUT_API_DIR = './generated';
40
+ exports.DEFAULT_PREVIEW_CHANGES_DIR = './.ts-openapi-codegen-preview-changes';
41
+ exports.DEFAULT_DIFF_CHANGES_DIR = './.ts-openapi-codegen-diff-changes';
@@ -10,7 +10,7 @@ exports.LOGGER_MESSAGES = {
10
10
  GENERATION: {
11
11
  STARTED: (count) => `Generation has begun. Total number of specification files: ${count}`,
12
12
  FINISHED: 'Generation has been finished',
13
- FINISHED_WITH_DURATION: (duration) => `Generation completed in ${duration} ms`,
13
+ FINISHED_WITH_DURATION: (duration) => `Generation completed in ${duration} sec`,
14
14
  DURATION_FOR_FILE: (file, duration) => `Duration for "${file}": ${duration} sec`,
15
15
  NO_OPTIONS: 'No options provided for generation',
16
16
  },
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { flatOptionsSchema, rawOptionsSchema } from "./schemas/configSchemas";
2
+ import { flatOptionsSchema, rawOptionsSchema } from './VersionedSchema/AllVersionedSchemas/UnifiedVersionedSchemas';
3
3
  export type TRawOptions = z.infer<typeof rawOptionsSchema>;
4
4
  export type TFlatOptions = z.infer<typeof flatOptionsSchema>;
5
5
  export type TStrictFlatOptions = {
@@ -1 +1 @@
1
- {"version":3,"file":"TRawOptions.d.ts","sourceRoot":"","sources":["../../src/common/TRawOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE9E,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG;KAC5B,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAC"}
1
+ {"version":3,"file":"TRawOptions.d.ts","sourceRoot":"","sources":["../../src/common/TRawOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAC,gBAAgB,EAAE,MAAM,+DAA+D,CAAC;AAEnH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,MAAM,MAAM,kBAAkB,GAAG;KAC5B,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ZodError } from 'zod';
2
+ /**
3
+ * Форматирует Zod ошибку в читаемое сообщение для CLI
4
+ */
5
+ export declare function formatZodError(error: ZodError): string[];
6
+ /**
7
+ * Форматирует путь к полю в читаемый формат
8
+ */
9
+ export declare function formatZodPath(path: (string | number | symbol)[]): string;
10
+ //# sourceMappingURL=formatZodError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatZodError.d.ts","sourceRoot":"","sources":["../../../src/common/Validation/formatZodError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAE/B;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,EAAE,CAYxD;AAkFD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CA2BxE"}
@@ -1,24 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatZodErrorForCLI = formatZodErrorForCLI;
3
+ exports.formatZodError = formatZodError;
4
+ exports.formatZodPath = formatZodPath;
4
5
  /**
5
6
  * Форматирует Zod ошибку в читаемое сообщение для CLI
6
7
  */
7
- function formatZodErrorForCLI(error) {
8
+ function formatZodError(error) {
8
9
  if (!error || error.issues.length === 0) {
9
- return 'Validation error occurred';
10
+ return [];
10
11
  }
11
12
  const messages = [];
12
13
  for (const issue of error.issues) {
13
- messages.push(formatIssue(issue));
14
+ messages.push(formatZodIssue(issue));
14
15
  }
15
- return messages.join('\n');
16
+ return messages;
16
17
  }
17
18
  /**
18
19
  * Форматирует отдельную Zod issue в читаемое сообщение
19
20
  */
20
- function formatIssue(issue) {
21
- const path = formatPath(issue.path);
21
+ function formatZodIssue(issue) {
22
+ const path = formatZodPath(issue.path);
22
23
  const message = issue.message;
23
24
  // Если issue имеет кастомное сообщение, используем его
24
25
  if (issue.code === 'custom') {
@@ -27,7 +28,7 @@ function formatIssue(issue) {
27
28
  // Форматируем стандартные ошибки с использованием type guards
28
29
  if (issue.code === 'invalid_type') {
29
30
  if ('received' in issue && issue.received === 'undefined') {
30
- const fieldName = formatPath(issue.path).replace(/^--/, '');
31
+ const fieldName = formatZodPath(issue.path).replace(/^--/, '');
31
32
  return `${path}: "${fieldName}" is required`;
32
33
  }
33
34
  if ('expected' in issue && 'received' in issue) {
@@ -35,7 +36,7 @@ function formatIssue(issue) {
35
36
  }
36
37
  }
37
38
  if (issue.code === 'invalid_format' && 'format' in issue) {
38
- const fieldName = formatPath(issue.path).replace(/^--/, '');
39
+ const fieldName = formatZodPath(issue.path).replace(/^--/, '');
39
40
  const format = issue.format;
40
41
  if (format === 'email') {
41
42
  return `${path}: "${fieldName}" must be a valid email`;
@@ -46,7 +47,7 @@ function formatIssue(issue) {
46
47
  return `${path}: "${fieldName}" has invalid format: ${format}`;
47
48
  }
48
49
  if (issue.code === 'too_small' && 'minimum' in issue && 'type' in issue) {
49
- const fieldName = formatPath(issue.path).replace(/^--/, '');
50
+ const fieldName = formatZodPath(issue.path).replace(/^--/, '');
50
51
  const type = issue.type;
51
52
  const minimum = issue.minimum;
52
53
  if (type === 'string') {
@@ -60,7 +61,7 @@ function formatIssue(issue) {
60
61
  }
61
62
  }
62
63
  if (issue.code === 'too_big' && 'maximum' in issue && 'type' in issue) {
63
- const fieldName = formatPath(issue.path).replace(/^--/, '');
64
+ const fieldName = formatZodPath(issue.path).replace(/^--/, '');
64
65
  const type = issue.type;
65
66
  const maximum = issue.maximum;
66
67
  if (type === 'string') {
@@ -74,7 +75,7 @@ function formatIssue(issue) {
74
75
  }
75
76
  }
76
77
  if (issue.code === 'invalid_value') {
77
- const fieldName = formatPath(issue.path).replace(/^--/, '');
78
+ const fieldName = formatZodPath(issue.path).replace(/^--/, '');
78
79
  return `${path}: "${fieldName}" has invalid value`;
79
80
  }
80
81
  if (issue.code === 'unrecognized_keys' && 'keys' in issue) {
@@ -86,7 +87,7 @@ function formatIssue(issue) {
86
87
  /**
87
88
  * Форматирует путь к полю в читаемый формат
88
89
  */
89
- function formatPath(path) {
90
+ function formatZodPath(path) {
90
91
  if (path.length === 0) {
91
92
  return 'root';
92
93
  }
@@ -0,0 +1,3 @@
1
+ export * from './formatZodError';
2
+ export * from './validateZodOptions';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/common/Validation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./errorFormatter"), exports);
18
- __exportStar(require("./validateCLIOptions"), exports);
17
+ __exportStar(require("./formatZodError"), exports);
18
+ __exportStar(require("./validateZodOptions"), exports);
@@ -7,21 +7,21 @@ export type ValidationResult<T> = {
7
7
  data: T;
8
8
  } | {
9
9
  success: false;
10
- error: string;
10
+ errors: string[];
11
11
  };
12
12
  /**
13
13
  * Валидирует данные с помощью Zod схемы и возвращает отформатированный результат
14
14
  */
15
- export declare function validateCLIOptions<T>(schema: ZodSchema<T>, data: unknown): ValidationResult<T>;
15
+ export declare function validateZodOptions<T>(schema: ZodSchema<T>, data: unknown): ValidationResult<T>;
16
16
  /**
17
17
  * Валидирует данные с помощью Zod схемы и возвращает raw результат
18
18
  * (полезно когда нужен доступ к ZodError для дополнительной обработки)
19
19
  */
20
- export declare function validateCLIOptionsRaw<T>(schema: ZodSchema<T>, data: unknown): {
20
+ export declare function validateZodOptionsRaw<T>(schema: ZodSchema<T>, data: unknown): {
21
21
  success: true;
22
22
  data: T;
23
23
  } | {
24
24
  success: false;
25
25
  error: ZodError;
26
26
  };
27
- //# sourceMappingURL=validateCLIOptions.d.ts.map
27
+ //# sourceMappingURL=validateZodOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateZodOptions.d.ts","sourceRoot":"","sources":["../../../src/common/Validation/validateZodOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAI1C;;GAEG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEpG;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAc9F;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAQ9I"}
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateCLIOptions = validateCLIOptions;
4
- exports.validateCLIOptionsRaw = validateCLIOptionsRaw;
3
+ exports.validateZodOptions = validateZodOptions;
4
+ exports.validateZodOptionsRaw = validateZodOptionsRaw;
5
5
  const zod_1 = require("zod");
6
- const errorFormatter_1 = require("./errorFormatter");
6
+ const formatZodError_1 = require("./formatZodError");
7
7
  /**
8
8
  * Валидирует данные с помощью Zod схемы и возвращает отформатированный результат
9
9
  */
10
- function validateCLIOptions(schema, data) {
10
+ function validateZodOptions(schema, data) {
11
11
  try {
12
12
  const result = schema.parse(data);
13
13
  return { success: true, data: result };
@@ -16,20 +16,17 @@ function validateCLIOptions(schema, data) {
16
16
  if (error instanceof zod_1.ZodError) {
17
17
  return {
18
18
  success: false,
19
- error: (0, errorFormatter_1.formatZodErrorForCLI)(error),
19
+ errors: (0, formatZodError_1.formatZodError)(error),
20
20
  };
21
21
  }
22
- return {
23
- success: false,
24
- error: error instanceof Error ? error.message : 'Unknown validation error',
25
- };
22
+ throw new Error(error instanceof Error ? error.message : 'Unknown validation error');
26
23
  }
27
24
  }
28
25
  /**
29
26
  * Валидирует данные с помощью Zod схемы и возвращает raw результат
30
27
  * (полезно когда нужен доступ к ZodError для дополнительной обработки)
31
28
  */
32
- function validateCLIOptionsRaw(schema, data) {
29
+ function validateZodOptionsRaw(schema, data) {
33
30
  const result = schema.safeParse(data);
34
31
  if (result.success) {
35
32
  return { success: true, data: result.data };
@@ -1,8 +1,13 @@
1
+ import { z } from 'zod';
1
2
  import { VersionedSchema } from '../Types';
2
3
  /**
3
4
  * Unified array of all versioned schemas with prefixed versions.
4
5
  * This allows migration from any old schema version to the latest unified schema.
5
6
  * Reuses existing schema arrays to avoid code duplication.
7
+ *
8
+ * ВАЖНО!
9
+ * После обновления allVersionedSchemas необходимо обновить файл compatibilityCases
10
+ * src/common/VersionedSchema/Utils/__mocks__/compatibilityCases.ts
6
11
  */
7
- export declare const allVersionedSchemas: VersionedSchema<Record<string, any>>[];
12
+ export declare const allVersionedSchemas: VersionedSchema<z.ZodTypeAny>[];
8
13
  //# sourceMappingURL=AllVersionedSchemas.d.ts.map
@@ -1 +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;AAiB3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAkBrE,CAAC"}
1
+ {"version":3,"file":"AllVersionedSchemas.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAgB3C;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,EAS9D,CAAC"}
@@ -4,8 +4,7 @@ exports.allVersionedSchemas = void 0;
4
4
  const Enums_1 = require("../Enums");
5
5
  const MultiOptionsVersionedSchemas_1 = require("../MultiOptionsVersioned/MultiOptionsVersionedSchemas");
6
6
  const OptionsVersionedSchemas_1 = require("../OptionsVersioned/OptionsVersionedSchemas");
7
- const UnifiedOptionsSchemaV1_1 = require("./UnifiedOptionsSchemaV1");
8
- const UnifiedOptionsSchemaV2_1 = require("./UnifiedOptionsSchemaV2");
7
+ const UnifiedVersionedSchemas_1 = require("./UnifiedVersionedSchemas");
9
8
  /**
10
9
  * Adds a prefix to all version strings in a versioned schema array.
11
10
  */
@@ -19,21 +18,16 @@ function addVersionPrefix(schemas, prefix) {
19
18
  * Unified array of all versioned schemas with prefixed versions.
20
19
  * This allows migration from any old schema version to the latest unified schema.
21
20
  * Reuses existing schema arrays to avoid code duplication.
21
+ *
22
+ * ВАЖНО!
23
+ * После обновления allVersionedSchemas необходимо обновить файл compatibilityCases
24
+ * src/common/VersionedSchema/Utils/__mocks__/compatibilityCases.ts
22
25
  */
23
26
  exports.allVersionedSchemas = [
24
27
  // OPTIONS schemas with prefix
25
- ...addVersionPrefix(OptionsVersionedSchemas_1.optionsVersionedSchemas, 'OPTIONS'),
28
+ ...addVersionPrefix(OptionsVersionedSchemas_1.optionsVersionedSchemas, Enums_1.EVersionedSchemaType.OPTIONS),
26
29
  // MULTI_OPTIONS schemas with prefix
27
- ...addVersionPrefix(MultiOptionsVersionedSchemas_1.multiOptionsVersionedSchema, 'MULTI_OPTIONS'),
30
+ ...addVersionPrefix(MultiOptionsVersionedSchemas_1.multiOptionsVersionedSchema, Enums_1.EVersionedSchemaType.MULTI_OPTIONS),
28
31
  // UNIFIED_OPTIONS schemas (latest)
29
- {
30
- version: 'UNIFIED_v1',
31
- schema: UnifiedOptionsSchemaV1_1.unifiedOptionsSchemaV1,
32
- type: Enums_1.EVersionedSchemaType.UNIFIED_OPTIONS,
33
- },
34
- {
35
- version: 'UNIFIED_v2',
36
- schema: UnifiedOptionsSchemaV2_1.unifiedOptionsSchemaV2,
37
- type: Enums_1.EVersionedSchemaType.UNIFIED_OPTIONS,
38
- }
32
+ ...addVersionPrefix(UnifiedVersionedSchemas_1.unifiedVersionedSchemas, Enums_1.EVersionedSchemaType.UNIFIED_OPTIONS)
39
33
  ];
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ import { HttpClient } from '../../../core/types/enums/HttpClient.enum';
3
+ import { ELogLevel, ELogOutput } from '../../Enums';
4
+ export declare const unifiedOptionsShape: z.ZodObject<{
5
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
6
+ input: z.ZodString;
7
+ request: z.ZodOptional<z.ZodString>;
8
+ sortByRequired: z.ZodOptional<z.ZodBoolean>;
9
+ useSeparatedIndexes: z.ZodOptional<z.ZodBoolean>;
10
+ useCancelableRequest: z.ZodOptional<z.ZodBoolean>;
11
+ interfacePrefix: z.ZodOptional<z.ZodString>;
12
+ enumPrefix: z.ZodOptional<z.ZodString>;
13
+ typePrefix: z.ZodOptional<z.ZodString>;
14
+ output: z.ZodString;
15
+ outputCore: z.ZodOptional<z.ZodString>;
16
+ outputServices: z.ZodOptional<z.ZodString>;
17
+ outputModels: z.ZodOptional<z.ZodString>;
18
+ outputSchemas: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strip>>>;
20
+ input: z.ZodOptional<z.ZodString>;
21
+ output: z.ZodOptional<z.ZodString>;
22
+ httpClient: z.ZodEnum<typeof HttpClient>;
23
+ }, z.core.$strip>;
24
+ export declare const debugSettingsShape: z.ZodObject<{
25
+ logLevel: z.ZodOptional<z.ZodEnum<typeof ELogLevel>>;
26
+ logTarget: z.ZodOptional<z.ZodEnum<typeof ELogOutput>>;
27
+ }, z.core.$strip>;
28
+ //# sourceMappingURL=UnifiedBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UnifiedBase.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/UnifiedBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,2CAA2C,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAapD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;iBAK9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debugSettingsShape = exports.unifiedOptionsShape = void 0;
4
+ const zod_1 = require("zod");
5
+ const HttpClient_enum_1 = require("../../../core/types/enums/HttpClient.enum");
6
+ const Enums_1 = require("../../Enums");
7
+ const CommonSchemas_1 = require("../CommonSchemas");
8
+ const unifiedItemSchema = zod_1.z
9
+ .object({
10
+ ...CommonSchemas_1.outputPathsSchema.shape,
11
+ ...CommonSchemas_1.additionalParametersSchemaV2.shape,
12
+ ...CommonSchemas_1.experimentalParametersSchemaV2.shape,
13
+ input: zod_1.z.string().min(1),
14
+ request: zod_1.z.string().optional(),
15
+ });
16
+ exports.unifiedOptionsShape = zod_1.z.object({
17
+ items: zod_1.z.array(unifiedItemSchema).min(1).optional(),
18
+ input: zod_1.z.string().optional(),
19
+ output: zod_1.z.string().optional(),
20
+ httpClient: zod_1.z.enum(HttpClient_enum_1.HttpClient),
21
+ });
22
+ exports.debugSettingsShape = zod_1.z.object({
23
+ logLevel: zod_1.z.enum(Enums_1.ELogLevel).optional(),
24
+ logTarget: zod_1.z.enum(Enums_1.ELogOutput).optional(),
25
+ });
@@ -1,7 +1,37 @@
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>;
1
+ import { z } from 'zod';
2
+ export declare const unifiedOptionsSchemaV1: z.ZodObject<{
3
+ sortByRequired: z.ZodOptional<z.ZodBoolean>;
4
+ useSeparatedIndexes: z.ZodOptional<z.ZodBoolean>;
5
+ useCancelableRequest: z.ZodOptional<z.ZodBoolean>;
6
+ request: z.ZodOptional<z.ZodString>;
7
+ interfacePrefix: z.ZodOptional<z.ZodString>;
8
+ enumPrefix: z.ZodOptional<z.ZodString>;
9
+ typePrefix: z.ZodOptional<z.ZodString>;
10
+ useOptions: z.ZodOptional<z.ZodBoolean>;
11
+ useUnionTypes: z.ZodOptional<z.ZodBoolean>;
12
+ excludeCoreServiceFiles: z.ZodOptional<z.ZodBoolean>;
13
+ includeSchemasFiles: z.ZodOptional<z.ZodBoolean>;
14
+ outputCore: z.ZodOptional<z.ZodString>;
15
+ outputServices: z.ZodOptional<z.ZodString>;
16
+ outputModels: z.ZodOptional<z.ZodString>;
17
+ outputSchemas: z.ZodOptional<z.ZodString>;
18
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
19
+ input: z.ZodString;
20
+ request: z.ZodOptional<z.ZodString>;
21
+ sortByRequired: z.ZodOptional<z.ZodBoolean>;
22
+ useSeparatedIndexes: z.ZodOptional<z.ZodBoolean>;
23
+ useCancelableRequest: z.ZodOptional<z.ZodBoolean>;
24
+ interfacePrefix: z.ZodOptional<z.ZodString>;
25
+ enumPrefix: z.ZodOptional<z.ZodString>;
26
+ typePrefix: z.ZodOptional<z.ZodString>;
27
+ output: z.ZodString;
28
+ outputCore: z.ZodOptional<z.ZodString>;
29
+ outputServices: z.ZodOptional<z.ZodString>;
30
+ outputModels: z.ZodOptional<z.ZodString>;
31
+ outputSchemas: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>>>;
33
+ input: z.ZodOptional<z.ZodString>;
34
+ output: z.ZodOptional<z.ZodString>;
35
+ httpClient: z.ZodEnum<typeof import("../../..").HttpClient>;
36
+ }, z.core.$strip>;
7
37
  //# sourceMappingURL=UnifiedOptionsSchemaV1.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnifiedOptionsSchemaV1.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAgBtB;;;GAGG;AACH,eAAO,MAAM,sBAAsB,uBA4BZ,CAAC"}
1
+ {"version":3,"file":"UnifiedOptionsSchemaV1.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/UnifiedOptionsSchemaV1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAOtB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMjC,CAAC"}