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
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.determineBestMatchingSchemaVersion = determineBestMatchingSchemaVersion;
4
- const getErrorFieldsFromValidation_1 = require("./getErrorFieldsFromValidation");
4
+ const validateZodOptions_1 = require("../../Validation/validateZodOptions");
5
5
  const getUniqueKeysFromSchemas_1 = require("./getUniqueKeysFromSchemas");
6
6
  const getUniqueObjectKeys_1 = require("./getUniqueObjectKeys");
7
7
  // Determining the most appropriate schema version
@@ -12,8 +12,8 @@ function determineBestMatchingSchemaVersion(inputData, versionedSchemas) {
12
12
  const inputKeys = (0, getUniqueObjectKeys_1.getUniqueObjectKeys)(inputData);
13
13
  const matchingSchemas = versionedSchemas
14
14
  .map(({ schema, version }, idx) => {
15
- const { error } = schema.validate(inputData, { allowUnknown: true });
16
- const errorFields = (0, getErrorFieldsFromValidation_1.getErrorFieldsFromValidation)(error).filter(err => err.type !== 'any.only');
15
+ const validationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(schema, inputData);
16
+ const errorFields = !validationResult.success ? validationResult.error.issues.filter(err => err.code !== 'invalid_value') : [];
17
17
  return errorFields.length === 0 ? { version, index: idx } : null;
18
18
  })
19
19
  .filter((match) => match !== null);
@@ -27,8 +27,8 @@ function determineBestMatchingSchemaVersion(inputData, versionedSchemas) {
27
27
  }
28
28
  const schemaMatches = versionedSchemas.map(({ schema, version }, idx) => {
29
29
  const schemaKeys = (0, getUniqueKeysFromSchemas_1.getUniqueKeysFromSchemas)([schema]);
30
- const { error } = schema.validate(inputData, { allowUnknown: true });
31
- const errorFields = (0, getErrorFieldsFromValidation_1.getErrorFieldsFromValidation)(error).filter(err => err.type !== 'any.only');
30
+ const validationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(schema, inputData);
31
+ const errorFields = !validationResult.success ? validationResult.error.issues.filter(err => err.code !== 'invalid_value') : [];
32
32
  const matchingKeys = inputKeys.filter(key => schemaKeys.has(key));
33
33
  return { index: idx, version, errorFields, matchingKeys };
34
34
  });
@@ -1,3 +1,3 @@
1
- import Joi from "joi";
2
- export declare function getCurrentErrorMessage(error: Joi.ValidationError, replaicingKeysMap: Map<string, string>): void;
1
+ import { z } from 'zod';
2
+ export declare function getCurrentErrorMessage(error: z.ZodError, replaicingKeysMap: Map<string, string>): void;
3
3
  //# sourceMappingURL=getCurrentErrorMessage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCurrentErrorMessage.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getCurrentErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAKtB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,QAQxG"}
1
+ {"version":3,"file":"getCurrentErrorMessage.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getCurrentErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,QAqB/F"}
@@ -1,14 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCurrentErrorMessage = getCurrentErrorMessage;
4
- const getErrorFieldsFromValidation_1 = require("./getErrorFieldsFromValidation");
4
+ const formatZodError_1 = require("../../Validation/formatZodError");
5
5
  const getKeyByMapValue_1 = require("./getKeyByMapValue");
6
6
  function getCurrentErrorMessage(error, replaicingKeysMap) {
7
- const { path } = (0, getErrorFieldsFromValidation_1.getErrorFieldsFromValidation)(error)[0];
8
- const reverseKey = (0, getKeyByMapValue_1.getKeyByMapValue)(replaicingKeysMap, path);
9
- let currentMessage = error.message;
10
- if (reverseKey) {
11
- currentMessage = error.message.replace(path, reverseKey);
7
+ if (!error || error.issues.length === 0) {
8
+ return;
12
9
  }
13
- throw new Error(currentMessage);
10
+ const messages = new Set();
11
+ error.issues.forEach(issue => {
12
+ const path = (0, formatZodError_1.formatZodPath)(issue.path);
13
+ const reverseKey = (0, getKeyByMapValue_1.getKeyByMapValue)(replaicingKeysMap, path);
14
+ let currentMessage = issue.message;
15
+ if (reverseKey) {
16
+ currentMessage = error.message.replace(path, reverseKey);
17
+ }
18
+ messages.add(currentMessage);
19
+ });
20
+ const result = Array.from(messages.values());
21
+ throw new Error(result.join('\n'));
14
22
  }
@@ -1,8 +1,8 @@
1
- import Joi from 'joi';
1
+ import { z } from 'zod';
2
2
  /**
3
3
  * Get all the unique parameter keys of all Joi schemes in the array
4
4
  * @param schemas array of joi schemes
5
5
  * @returns All the unique parameter keys of all Joi schemes in the array
6
6
  */
7
- export declare function getUniqueKeysFromSchemas(schemas: Joi.Schema[]): Set<string>;
7
+ export declare function getUniqueKeysFromSchemas(schemas: z.ZodTypeAny[]): Set<string>;
8
8
  //# sourceMappingURL=getUniqueKeysFromSchemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUniqueKeysFromSchemas.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AAKtB;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,eAQ7D"}
1
+ {"version":3,"file":"getUniqueKeysFromSchemas.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getUniqueKeysFromSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAQ7E"}
@@ -1,8 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUniqueKeysFromSchemas = getUniqueKeysFromSchemas;
4
- const joiHandlers_1 = require("./joiHandlers");
5
- const traverseObjectStructure_1 = require("./traverseObjectStructure");
4
+ const zod_1 = require("zod");
5
+ function collectKeys(schema, result) {
6
+ if (!(schema instanceof zod_1.z.ZodObject)) {
7
+ return;
8
+ }
9
+ const shape = schema.shape;
10
+ for (const key of Object.keys(shape)) {
11
+ result.add(key);
12
+ const fieldSchema = shape[key];
13
+ // если поле — вложенный объект, идём глубже
14
+ if (fieldSchema instanceof zod_1.z.ZodObject) {
15
+ collectKeys(fieldSchema, result);
16
+ }
17
+ }
18
+ }
6
19
  /**
7
20
  * Get all the unique parameter keys of all Joi schemes in the array
8
21
  * @param schemas array of joi schemes
@@ -11,7 +24,7 @@ const traverseObjectStructure_1 = require("./traverseObjectStructure");
11
24
  function getUniqueKeysFromSchemas(schemas) {
12
25
  const result = new Set();
13
26
  for (const schema of schemas) {
14
- (0, traverseObjectStructure_1.traverseObjectStructure)(schema, [joiHandlers_1.handleJoiSchema, joiHandlers_1.handleJoiDescription], result);
27
+ collectKeys(schema, result);
15
28
  }
16
29
  return result;
17
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getUniqueObjectKeys.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getUniqueObjectKeys.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAKhE"}
1
+ {"version":3,"file":"getUniqueObjectKeys.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/getUniqueObjectKeys.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAKhE"}
@@ -1,7 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUniqueObjectKeys = getUniqueObjectKeys;
4
- const traverseObjectStructure_1 = require("./traverseObjectStructure");
4
+ function collectUniqueObjectKeys(root, result) {
5
+ const recurse = (v) => collectUniqueObjectKeys(v, result);
6
+ if (root && typeof root === 'object') {
7
+ if (Array.isArray(root)) {
8
+ for (const item of root) {
9
+ recurse(item);
10
+ }
11
+ }
12
+ else {
13
+ for (const key of Object.keys(root)) {
14
+ if (result instanceof Set) {
15
+ result.add(key);
16
+ }
17
+ recurse(root[key]);
18
+ }
19
+ }
20
+ }
21
+ }
5
22
  /**
6
23
  * Get unique keys from object properties (set of options)
7
24
  * @param rawInput object properties (set of options)
@@ -9,6 +26,6 @@ const traverseObjectStructure_1 = require("./traverseObjectStructure");
9
26
  */
10
27
  function getUniqueObjectKeys(rawInput) {
11
28
  const result = new Set();
12
- (0, traverseObjectStructure_1.traverseObjectStructure)(rawInput, [], result);
29
+ collectUniqueObjectKeys(rawInput, result);
13
30
  return Array.from(result);
14
31
  }
@@ -1,10 +1,11 @@
1
+ import { z } from 'zod';
1
2
  import { EMigrationMode } from '../../Enums';
2
3
  import { EVersionedSchemaType } from '../Enums';
3
4
  import { SchemaMigrationPlan, VersionedSchema, VersionMatchResult } from '../Types';
4
5
  type MigrateToLatestProps = {
5
6
  rawInput: Record<string, any>;
6
7
  migrationPlans: SchemaMigrationPlan<Record<string, any>, Record<string, any>>[];
7
- versionedSchemas: VersionedSchema<Record<string, any>>[];
8
+ versionedSchemas: VersionedSchema<z.ZodTypeAny>[];
8
9
  migrationMode: EMigrationMode;
9
10
  };
10
11
  type MigrateToLatestResult = {
@@ -1 +1 @@
1
- {"version":3,"file":"migrateDataToLatestSchemaVersion.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AASpF,KAAK,oBAAoB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAChF,gBAAgB,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IACzD,aAAa,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,cAAc,EAAE,kBAAkB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,CAAC;CACpC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,IAAI,CAiElK"}
1
+ {"version":3,"file":"migrateDataToLatestSchemaVersion.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AASpF,KAAK,oBAAoB,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,cAAc,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAChF,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;IAClD,aAAa,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,cAAc,EAAE,kBAAkB,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,oBAAoB,CAAC;CACpC,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,gBAAgB,EAAE,aAAa,EAAE,EAAE,oBAAoB,GAAG,qBAAqB,GAAG,IAAI,CAiElK"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.migrateDataToLatestSchemaVersion = migrateDataToLatestSchemaVersion;
4
4
  const Enums_1 = require("../../Enums");
5
+ const validateZodOptions_1 = require("../../Validation/validateZodOptions");
5
6
  const determineBestMatchingSchemaVersion_1 = require("./determineBestMatchingSchemaVersion");
6
7
  const generateKeyMappingForInvalidKeys_1 = require("./generateKeyMappingForInvalidKeys");
7
8
  const getCurrentErrorMessage_1 = require("./getCurrentErrorMessage");
@@ -23,9 +24,9 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
23
24
  const actualSchema = versionedSchemas[actualVersionIndex];
24
25
  for (let idx = guessedVersion.lastVersionIndex; idx < versionedSchemas.length - 1; idx++) {
25
26
  const currentVersionSchema = versionedSchemas[idx];
26
- const { error: firstError } = currentVersionSchema.schema.validate(currentData);
27
- if (firstError) {
28
- (0, getCurrentErrorMessage_1.getCurrentErrorMessage)(firstError, replacingKeysMap);
27
+ const firstValidationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(currentVersionSchema.schema, currentData);
28
+ if (!firstValidationResult.success) {
29
+ (0, getCurrentErrorMessage_1.getCurrentErrorMessage)(firstValidationResult.error, replacingKeysMap);
29
30
  }
30
31
  const fromVersion = currentVersionSchema.version;
31
32
  const migrationPlan = migrationPlans.find(p => p.fromVersion === fromVersion);
@@ -37,10 +38,10 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
37
38
  }
38
39
  const toVersion = versionedSchemas[idx + 1].version;
39
40
  const migratedRaw = migrationPlan.migrate(currentData);
40
- const { error } = versionedSchemas[idx + 1].schema.validate(migratedRaw, { allowUnknown: false });
41
- if (error) {
41
+ const validationResult = (0, validateZodOptions_1.validateZodOptions)(versionedSchemas[idx + 1].schema, migratedRaw);
42
+ if (!validationResult.success) {
42
43
  throw new Error(`Migration from ${fromVersion} to ${toVersion} failed validation. ` +
43
- `Error: ${error.message}. ` +
44
+ `Error: ${validationResult.errors.join('\n')}. ` +
44
45
  `Migration description: ${migrationPlan.description || 'No description provided'}.`);
45
46
  }
46
47
  currentData = { ...migratedRaw };
@@ -49,9 +50,9 @@ function migrateDataToLatestSchemaVersion({ rawInput, migrationPlans, versionedS
49
50
  console.warn('Для выполнения генерации OpenApi потребовалось мигрировать схему Ваших данных на актуальную. Для обновленмя конфигурации в файле используйте команду `npm name_cli_tool update-config`');
50
51
  }
51
52
  }
52
- const { error } = actualSchema.schema.validate(currentData, { allowUnknown: false });
53
- if (error) {
54
- (0, getCurrentErrorMessage_1.getCurrentErrorMessage)(error, replacingKeysMap);
53
+ const validationResult = (0, validateZodOptions_1.validateZodOptionsRaw)(actualSchema.schema, currentData);
54
+ if (!validationResult.success) {
55
+ (0, getCurrentErrorMessage_1.getCurrentErrorMessage)(validationResult.error, replacingKeysMap);
55
56
  }
56
57
  return { value: currentData, guessedVersion, schemaVersion: actualSchema.version, schemaType: actualSchema.type };
57
58
  }
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ import { TRawOptions } from "../../TRawOptions";
3
+ export declare function dependentOptionsRefinement(data: TRawOptions, ctx: z.RefinementCtx): void;
4
+ //# sourceMappingURL=dependentOptionsRefinement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependentOptionsRefinement.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/refinements/dependentOptionsRefinement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,QA2C7E"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dependentOptionsRefinement = dependentOptionsRefinement;
4
+ function dependentOptionsRefinement(data, ctx) {
5
+ // Проверка: либо items, либо input+output должны быть указаны
6
+ const hasItems = data.items && data.items.length > 0;
7
+ const hasInputOutput = !!(data.input && data.output);
8
+ if (!hasItems && !hasInputOutput) {
9
+ ctx.addIssue({
10
+ code: 'custom',
11
+ message: 'Either "items" array or "input" + "output" must be provided',
12
+ path: [],
13
+ });
14
+ }
15
+ // Если есть items, то input и output в корне не должны быть указаны
16
+ if (hasItems && hasInputOutput) {
17
+ ctx.addIssue({
18
+ code: 'custom',
19
+ message: 'Cannot use both "items" array and "input"/"output" at the root level',
20
+ path: ['items'],
21
+ });
22
+ }
23
+ // Валидация: если excludeCoreServiceFiles === true, request не должен быть указан
24
+ if (data.excludeCoreServiceFiles === true && data.request) {
25
+ ctx.addIssue({
26
+ code: 'custom',
27
+ message: '"request" can only be used when "excludeCoreServiceFiles" is false',
28
+ path: ['request'],
29
+ });
30
+ }
31
+ // Валидация для каждого элемента в items
32
+ if (hasItems && data.items) {
33
+ data.items.forEach((item, index) => {
34
+ if (item.request && data.excludeCoreServiceFiles === true) {
35
+ ctx.addIssue({
36
+ code: 'custom',
37
+ message: '"request" in items can only be used when "excludeCoreServiceFiles" is false',
38
+ path: ['items', index, 'request'],
39
+ });
40
+ }
41
+ });
42
+ }
43
+ }
@@ -0,0 +1,4 @@
1
+ import { z } from 'zod';
2
+ import { unifiedOptionsShape } from '../AllVersionedSchemas/UnifiedBase';
3
+ export declare function singleOrMultiRefinement(data: z.infer<typeof unifiedOptionsShape>, ctx: z.RefinementCtx): void;
4
+ //# sourceMappingURL=singleOrMultiRefinement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"singleOrMultiRefinement.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/refinements/singleOrMultiRefinement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,aAAa,QAmBtG"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.singleOrMultiRefinement = singleOrMultiRefinement;
4
+ function singleOrMultiRefinement(data, ctx) {
5
+ const hasItems = !!data.items?.length;
6
+ const hasSingle = !!data.input;
7
+ if (hasItems && hasSingle) {
8
+ ctx.addIssue({
9
+ code: 'custom',
10
+ message: 'Use either items or input/output, but not both options.',
11
+ path: ['items'],
12
+ });
13
+ }
14
+ if (!hasItems && !hasSingle) {
15
+ ctx.addIssue({
16
+ code: 'custom',
17
+ message: 'You must specify either items or input/output',
18
+ path: ['input'],
19
+ });
20
+ }
21
+ }
@@ -33,28 +33,29 @@ export declare class Context {
33
33
  prefix: PrefixArtifacts;
34
34
  private _sortByRequired;
35
35
  private specRoot;
36
+ private entryFile?;
36
37
  private virtualFiles;
37
38
  constructor({ input, output, prefix, sortByRequired }: TContextProps);
38
39
  addRefs(refs: RefsLike): Context;
39
40
  values(...types: string[]): Record<string, any>;
40
- get($ref: string): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type;
41
+ get($ref: string, parentSourceFile?: string): JSONSchema4Type | JSONSchema6Type | JSONSchema7Type;
41
42
  paths(...types: string[]): string[];
42
- exists($ref: string): boolean;
43
+ exists($ref: string, parentSourceFile?: string): boolean;
43
44
  fileName(): string;
44
45
  get output(): OutputPaths;
45
46
  get sortByRequired(): boolean;
46
47
  get root(): $Root | undefined;
47
48
  private canonicalizeRef;
48
49
  private mapSourceToOutput;
49
- private registerRef;
50
- private walkSchema;
50
+ private walkSchemaForFragments;
51
51
  initializeVirtualFileMap(rootSchema: unknown, entryFile: string): void;
52
52
  getVirtualFiles(): VirtualFileMap;
53
53
  getAllCanonicalRefs(): string[];
54
- resolveCanonicalRef(canonicalRef: string): {
54
+ resolveCanonicalRef(canonicalRef: string, parentSourceFile?: string): {
55
55
  outputFile: string;
56
56
  fragment?: string;
57
57
  } | undefined;
58
+ private normalizeRefForLookup;
58
59
  }
59
60
  export {};
60
61
  //# sourceMappingURL=Context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/core/Context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAIhF,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAKhD,KAAK,aAAa,GAAG;IACjB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,KAAK,QAAQ,GAAG;IACZ,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,eAAe,GAAG,eAAe,GAAG,eAAe,CAAC;IAC7E,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAA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IAAI,cAAc;IAIjC,mBAAmB,IAAI,MAAM,EAAE;IAgB/B,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,GACpE;QACI,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB,GACD,SAAS;IAef,OAAO,CAAC,qBAAqB;CAyBhC"}
@@ -5,6 +5,7 @@ const path_1 = require("path");
5
5
  const pathHelpers_1 = require("../common/utils/pathHelpers");
6
6
  const getFileName_1 = require("./utils/getFileName");
7
7
  const isString_1 = require("./utils/isString");
8
+ const normalizeRef_1 = require("./utils/normalizeRef");
8
9
  const parseRef_1 = require("./utils/parseRef");
9
10
  /**
10
11
  * A Context wich can share a data between methods
@@ -20,6 +21,7 @@ class Context {
20
21
  };
21
22
  _sortByRequired = false;
22
23
  specRoot;
24
+ entryFile;
23
25
  virtualFiles = new Map();
24
26
  constructor({ input, output, prefix, sortByRequired }) {
25
27
  this._output = output;
@@ -48,11 +50,12 @@ class Context {
48
50
  }
49
51
  return this._refs.values(...types);
50
52
  }
51
- get($ref) {
53
+ get($ref, parentSourceFile) {
52
54
  if (!this._refs) {
53
55
  throw new Error('Context must be initialized');
54
56
  }
55
- return this._refs.get($ref);
57
+ const normalizedRef = this.normalizeRefForLookup($ref, parentSourceFile);
58
+ return this._refs.get(normalizedRef);
56
59
  }
57
60
  paths(...types) {
58
61
  if (!this._refs) {
@@ -60,11 +63,12 @@ class Context {
60
63
  }
61
64
  return this._refs.paths(...types);
62
65
  }
63
- exists($ref) {
66
+ exists($ref, parentSourceFile) {
64
67
  if (!this._refs) {
65
68
  throw new Error('Context must be initialized');
66
69
  }
67
- return this._refs.exists($ref);
70
+ const normalizedRef = this.normalizeRefForLookup($ref, parentSourceFile);
71
+ return this._refs.exists(normalizedRef);
68
72
  }
69
73
  fileName() {
70
74
  if (!this._root) {
@@ -107,38 +111,36 @@ class Context {
107
111
  const baseName = (0, path_1.basename)(relative).replace(/\.(yaml|yml|json)$/i, '.ts');
108
112
  return (0, pathHelpers_1.resolveHelper)(this.output.outputModels, dir, baseName);
109
113
  }
110
- registerRef(ref, parentSourceFile) {
111
- const { sourceFile, fragment } = this.canonicalizeRef(ref, parentSourceFile);
112
- let entry = this.virtualFiles.get(sourceFile);
113
- if (!entry) {
114
- entry = {
115
- sourceFile,
116
- outputFile: this.mapSourceToOutput(sourceFile),
117
- fragments: new Set(),
118
- };
119
- this.virtualFiles.set(sourceFile, entry);
120
- }
121
- if (fragment) {
122
- entry.fragments.add(fragment);
123
- }
124
- }
125
- walkSchema(obj, parentSourceFile) {
114
+ walkSchemaForFragments(obj, parentSourceFile) {
126
115
  if (!obj || typeof obj !== 'object')
127
116
  return;
128
117
  if (typeof obj.$ref === 'string') {
129
- this.registerRef(obj.$ref, parentSourceFile);
118
+ const { sourceFile, fragment } = this.canonicalizeRef(obj.$ref, parentSourceFile);
119
+ let entry = this.virtualFiles.get(sourceFile);
120
+ if (!entry) {
121
+ entry = {
122
+ sourceFile,
123
+ outputFile: this.mapSourceToOutput(sourceFile),
124
+ fragments: new Set(),
125
+ };
126
+ this.virtualFiles.set(sourceFile, entry);
127
+ }
128
+ if (fragment) {
129
+ entry.fragments.add(fragment);
130
+ }
130
131
  }
131
132
  if (Array.isArray(obj)) {
132
- obj.forEach(item => this.walkSchema(item, parentSourceFile));
133
+ obj.forEach(item => this.walkSchemaForFragments(item, parentSourceFile));
133
134
  return;
134
135
  }
135
136
  for (const value of Object.values(obj)) {
136
- this.walkSchema(value, parentSourceFile);
137
+ this.walkSchemaForFragments(value, parentSourceFile);
137
138
  }
138
139
  }
139
140
  initializeVirtualFileMap(rootSchema, entryFile) {
140
141
  this.specRoot = (0, pathHelpers_1.normalizeHelper)((0, pathHelpers_1.dirNameHelper)(entryFile));
141
142
  const normalizedEntry = (0, pathHelpers_1.normalizeHelper)(entryFile);
143
+ this.entryFile = normalizedEntry;
142
144
  // Гарантируем, что entry файл тоже есть в карте
143
145
  if (!this.virtualFiles.has(normalizedEntry)) {
144
146
  this.virtualFiles.set(normalizedEntry, {
@@ -147,7 +149,26 @@ class Context {
147
149
  fragments: new Set(),
148
150
  });
149
151
  }
150
- this.walkSchema(rootSchema, normalizedEntry);
152
+ // 🔴 Вместо ручного обхода, использовать resolved.paths() от SwaggerParser
153
+ // это даст нам все файлы, которые парсер разрешил
154
+ const allPaths = this._refs?.paths() || [];
155
+ for (const refPath of allPaths) {
156
+ const normalizedPath = (0, pathHelpers_1.normalizeHelper)(refPath);
157
+ if (!this.virtualFiles.has(normalizedPath)) {
158
+ this.virtualFiles.set(normalizedPath, {
159
+ sourceFile: normalizedPath,
160
+ outputFile: this.mapSourceToOutput(normalizedPath),
161
+ fragments: new Set(),
162
+ });
163
+ }
164
+ }
165
+ // Обходим каждый файл чтобы найти $ref с фрагментами (#)
166
+ for (const [sourceFile] of this.virtualFiles) {
167
+ const schema = this._refs?.get(sourceFile);
168
+ if (schema && typeof schema === 'object') {
169
+ this.walkSchemaForFragments(schema, sourceFile);
170
+ }
171
+ }
151
172
  }
152
173
  getVirtualFiles() {
153
174
  return this.virtualFiles;
@@ -166,8 +187,9 @@ class Context {
166
187
  }
167
188
  return result;
168
189
  }
169
- resolveCanonicalRef(canonicalRef) {
170
- const parsed = (0, parseRef_1.parseRef)(canonicalRef);
190
+ resolveCanonicalRef(canonicalRef, parentSourceFile) {
191
+ const normalizedRef = this.normalizeRefForLookup(canonicalRef, parentSourceFile);
192
+ const parsed = (0, parseRef_1.parseRef)(normalizedRef);
171
193
  const sourceFile = (0, pathHelpers_1.normalizeHelper)(parsed.filePath ?? '');
172
194
  const file = this.virtualFiles.get(sourceFile);
173
195
  if (!file)
@@ -177,5 +199,26 @@ class Context {
177
199
  fragment: parsed.fragment,
178
200
  };
179
201
  }
202
+ normalizeRefForLookup(ref, parentSourceFile) {
203
+ if (!ref)
204
+ return ref;
205
+ // Prefer explicit parent if provided
206
+ if (parentSourceFile) {
207
+ const normalizedParent = (0, path_1.isAbsolute)(parentSourceFile)
208
+ ? parentSourceFile
209
+ : (0, pathHelpers_1.resolveHelper)(this.specRoot, parentSourceFile);
210
+ return (0, normalizeRef_1.normalizeRef)(ref, normalizedParent);
211
+ }
212
+ // If we can fall back to entry file, normalize relative refs against it
213
+ if (this.entryFile) {
214
+ const parsed = (0, parseRef_1.parseRef)(ref);
215
+ if (parsed.type === parseRef_1.RefType.LOCAL_FRAGMENT ||
216
+ parsed.type === parseRef_1.RefType.EXTERNAL_FILE ||
217
+ parsed.type === parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT) {
218
+ return (0, normalizeRef_1.normalizeRef)(ref, this.entryFile);
219
+ }
220
+ }
221
+ return ref;
222
+ }
180
223
  }
181
224
  exports.Context = Context;
@@ -1 +1 @@
1
- {"version":3,"file":"OpenApiClient.d.ts","sourceRoot":"","sources":["../../src/core/OpenApiClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,WAAW,EAAsB,MAAM,uBAAuB,CAAC;AAetF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,aAAa;IACtB,OAAO,CAAC,YAAY,CAA4B;IAEhD,IAAW,WAAW,gBAKrB;IAED,OAAO,CAAC,gBAAgB;IAgDxB,OAAO,CAAC,gBAAgB;YAyBV,sBAAsB;YAUtB,oBAAoB;YAmCpB,cAAc;IAkFtB,QAAQ,CAAC,UAAU,EAAE,WAAW;CAWzC"}
1
+ {"version":3,"file":"OpenApiClient.d.ts","sourceRoot":"","sources":["../../src/core/OpenApiClient.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,WAAW,EAAsB,MAAM,uBAAuB,CAAC;AAetF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,qBAAa,aAAa;IACtB,OAAO,CAAC,YAAY,CAA4B;IAEhD,IAAW,WAAW,gBAKrB;IAED,OAAO,CAAC,gBAAgB;IAmDxB,OAAO,CAAC,gBAAgB;YA0BV,sBAAsB;YAUtB,oBAAoB;YAmCpB,cAAc;IAkFtB,QAAQ,CAAC,UAAU,EAAE,WAAW;CAWzC"}
@@ -29,9 +29,11 @@ class OpenApiClient {
29
29
  // Для items: Наследуем глобальный request, если не переопределён
30
30
  return rawOptions.items.map(item => ({
31
31
  ...item,
32
+ httpClient: rawOptions.httpClient,
32
33
  request: item.request ?? rawOptions.request, // ?? для fallback на глобальный
33
34
  useOptions: rawOptions.useOptions,
34
35
  useUnionTypes: rawOptions.useUnionTypes,
36
+ includeSchemasFiles: rawOptions.includeSchemasFiles,
35
37
  excludeCoreServiceFiles: rawOptions.excludeCoreServiceFiles,
36
38
  interfacePrefix: rawOptions.interfacePrefix,
37
39
  enumPrefix: rawOptions.enumPrefix,
@@ -57,6 +59,7 @@ class OpenApiClient {
57
59
  httpClient: rawOptions.httpClient,
58
60
  useOptions: rawOptions.useOptions,
59
61
  useUnionTypes: rawOptions.useUnionTypes,
62
+ includeSchemasFiles: rawOptions.includeSchemasFiles,
60
63
  excludeCoreServiceFiles: rawOptions.excludeCoreServiceFiles,
61
64
  request: rawOptions.request,
62
65
  interfacePrefix: rawOptions.interfacePrefix,
@@ -83,6 +86,7 @@ class OpenApiClient {
83
86
  httpClient: item.httpClient || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.httpClient,
84
87
  useOptions: item.useOptions ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useOptions,
85
88
  useUnionTypes: item.useUnionTypes ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.useUnionTypes,
89
+ includeSchemasFiles: item.includeSchemasFiles ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.includeSchemasFiles,
86
90
  excludeCoreServiceFiles: item.excludeCoreServiceFiles ?? Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.excludeCoreServiceFiles,
87
91
  request: item.request || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.request,
88
92
  interfacePrefix: item.interfacePrefix || Consts_1.COMMON_DEFAULT_OPTIONS_VALUES.interfacePrefix,
@@ -110,16 +114,16 @@ class OpenApiClient {
110
114
  }
111
115
  this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.STARTED(items.length));
112
116
  try {
113
- const start = process.hrtime();
117
+ const start = process.hrtime.bigint();
114
118
  for (const option of items) {
115
119
  await this.cleanOutputDirectories(option);
116
120
  }
117
121
  for (const option of items) {
118
- const fileStart = process.hrtime();
122
+ const fileStart = process.hrtime.bigint();
119
123
  await this.generateSingle(option);
120
- const [fileSeconds, fileNanoseconds] = process.hrtime(fileStart);
121
- const fileDuration = fileSeconds + fileNanoseconds / 1e6;
122
- this.writeClient.logger.info(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.DURATION_FOR_FILE(option.input, fileDuration.toFixed(2)));
124
+ const fileEnd = process.hrtime.bigint();
125
+ const fileDurationInSeconds = Number(fileEnd - fileStart) / 1e9;
126
+ this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.DURATION_FOR_FILE(option.input, fileDurationInSeconds.toFixed(3)));
123
127
  }
124
128
  if (items[0]?.useSeparatedIndexes) {
125
129
  await this.writeClient.combineAndWrightSimple();
@@ -128,9 +132,9 @@ class OpenApiClient {
128
132
  await this.writeClient.combineAndWrite();
129
133
  }
130
134
  this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED);
131
- const [seconds, nanoseconds] = process.hrtime(start);
132
- const durationInMs = seconds + nanoseconds / 1e6;
133
- this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED_WITH_DURATION(durationInMs.toFixed(2)));
135
+ const end = process.hrtime.bigint();
136
+ const durationInSeconds = Number(end - start) / 1e9;
137
+ this.writeClient.logger.forceInfo(LoggerMessages_1.LOGGER_MESSAGES.GENERATION.FINISHED_WITH_DURATION(durationInSeconds.toFixed(3)));
134
138
  }
135
139
  catch (error) {
136
140
  this.writeClient.logger.error(LoggerMessages_1.L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AAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACzC,CAAC;AAEF,KAAK,yBAAyB,GAAG,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,sBAAsB,GAAG,qBAAqB,CAAC,CAAC;AAEnJ;;GAEG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAuD;IACrE,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,CAAC,EAAE,MAAM;IAU3B;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA0G5D;;;OAGG;IACH,6BAA6B,CAAC,MAAM,EAAE,yBAAyB;IAUzD,eAAe;IAKf,sBAAsB;IAK5B,IAAW,MAAM,WAEhB;IAED,OAAO,CAAC,yBAAyB;IAyCjC,OAAO,CAAC,mBAAmB;YA4Db,gBAAgB;YAUhB,uBAAuB;IAMrC,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,aAAa;IAId,eAAe,yBAAmB;IAClC,oBAAoB,8BAAwB;IAC5C,oBAAoB,8BAAwB;IAC5C,iBAAiB,2BAAqB;IACtC,sBAAsB,gCAA0B;IAChD,kBAAkB,4BAAsB;IACxC,uBAAuB,iCAA2B;IAClD,mBAAmB,6BAAuB;IAC1C,wBAAwB,kCAA4B;IACpD,sBAAsB,gCAA0B;IAChD,mBAAmB,6BAAuB;CACpD"}
@@ -41,7 +41,11 @@ class WriteClient {
41
41
  async writeClient(options) {
42
42
  const { client, templates, outputPaths, httpClient, useOptions, useUnionTypes, excludeCoreServiceFiles = false, request, useCancelableRequest = false, useSeparatedIndexes = false, validationLibrary = ValidationLibrary_enum_1.ValidationLibrary.NONE, } = options;
43
43
  if (!excludeCoreServiceFiles) {
44
+ const executorPath = (0, pathHelpers_1.resolveHelper)(outputPaths.outputCore, 'executor');
45
+ const interceptorsPath = (0, pathHelpers_1.resolveHelper)(outputPaths.outputCore, 'interceptors');
44
46
  await fileSystemHelpers_1.fileSystemHelpers.mkdir(outputPaths.outputCore);
47
+ await fileSystemHelpers_1.fileSystemHelpers.mkdir(executorPath);
48
+ await fileSystemHelpers_1.fileSystemHelpers.mkdir(interceptorsPath);
45
49
  await this.writeClientCore({ client, templates, outputCorePath: outputPaths.outputCore, httpClient, request, useCancelableRequest });
46
50
  await this.writeClientCoreIndex({
47
51
  templates,