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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/README.md +221 -123
  2. package/README.rus.md +725 -0
  3. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts +12 -0
  4. package/dist/cli/checkAndUpdateConfig/checkConfig.d.ts.map +1 -0
  5. package/dist/cli/checkAndUpdateConfig/checkConfig.js +66 -0
  6. package/dist/cli/checkAndUpdateConfig/constants.d.ts +13 -0
  7. package/dist/cli/checkAndUpdateConfig/constants.d.ts.map +1 -0
  8. package/dist/cli/checkAndUpdateConfig/constants.js +29 -0
  9. package/dist/cli/checkAndUpdateConfig/types.d.ts +20 -0
  10. package/dist/cli/checkAndUpdateConfig/types.d.ts.map +1 -0
  11. package/dist/cli/checkAndUpdateConfig/types.js +12 -0
  12. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts +12 -0
  13. package/dist/cli/checkAndUpdateConfig/updateConfig.d.ts.map +1 -0
  14. package/dist/cli/checkAndUpdateConfig/updateConfig.js +56 -0
  15. package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.d.ts +2 -0
  16. package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.d.ts.map +1 -0
  17. package/dist/cli/checkAndUpdateConfig/utils/generateConfigExample.js +11 -0
  18. package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.d.ts +14 -0
  19. package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.d.ts.map +1 -0
  20. package/dist/cli/checkAndUpdateConfig/utils/prepareConfigData.js +30 -0
  21. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts +17 -0
  22. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.d.ts.map +1 -0
  23. package/dist/cli/checkAndUpdateConfig/utils/removeDefaultConfigValues.js +29 -0
  24. package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.d.ts +2 -0
  25. package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.d.ts.map +1 -0
  26. package/dist/cli/checkAndUpdateConfig/utils/rewriteConfigFile.js +11 -0
  27. package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts +29 -0
  28. package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.d.ts.map +1 -0
  29. package/dist/cli/checkAndUpdateConfig/utils/selectConfigAction.js +49 -0
  30. package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts +6 -0
  31. package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.d.ts.map +1 -0
  32. package/dist/cli/checkAndUpdateConfig/utils/updateExistingConfigFile.js +22 -0
  33. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts +17 -0
  34. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.d.ts.map +1 -0
  35. package/dist/cli/checkAndUpdateConfig/utils/validateAndMigrateConfigData.js +53 -0
  36. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts +34 -0
  37. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.d.ts.map +1 -0
  38. package/dist/cli/checkAndUpdateConfig/utils/writeConfigFile.js +41 -0
  39. package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts +6 -0
  40. package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.d.ts.map +1 -0
  41. package/dist/cli/checkAndUpdateConfig/utils/writeExampleConfigFile.js +18 -0
  42. package/dist/cli/generate/runGenerateOpenApi.d.ts +2 -2
  43. package/dist/cli/generate/runGenerateOpenApi.d.ts.map +1 -1
  44. package/dist/cli/generate/runGenerateOpenApi.js +12 -14
  45. package/dist/cli/index.d.ts +1 -0
  46. package/dist/cli/index.js +56 -30
  47. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.d.ts.map +1 -1
  48. package/dist/cli/initOpenApiConfig/runInitOpenapiConfig.js +11 -18
  49. package/dist/cli/interactive/confirmDialog.d.ts +17 -0
  50. package/dist/cli/interactive/confirmDialog.d.ts.map +1 -0
  51. package/dist/cli/interactive/confirmDialog.js +36 -0
  52. package/dist/cli/interactive/constants.d.ts +7 -0
  53. package/dist/cli/interactive/constants.d.ts.map +1 -0
  54. package/dist/cli/interactive/constants.js +25 -0
  55. package/dist/cli/interactive/selectDialog.d.ts +17 -0
  56. package/dist/cli/interactive/selectDialog.d.ts.map +1 -0
  57. package/dist/cli/interactive/selectDialog.js +43 -0
  58. package/dist/cli/interactive/types.d.ts +40 -0
  59. package/dist/cli/interactive/types.d.ts.map +1 -0
  60. package/dist/cli/interactive/types.js +12 -0
  61. package/dist/common/Consts.d.ts +23 -0
  62. package/dist/common/Consts.d.ts.map +1 -1
  63. package/dist/common/Consts.js +28 -1
  64. package/dist/common/Enums.d.ts +4 -0
  65. package/dist/common/Enums.d.ts.map +1 -1
  66. package/dist/common/Enums.js +6 -1
  67. package/dist/common/Logger.d.ts +1 -1
  68. package/dist/common/Logger.d.ts.map +1 -1
  69. package/dist/common/Logger.js +5 -38
  70. package/dist/common/UpdateNotifier.d.ts +36 -2
  71. package/dist/common/UpdateNotifier.d.ts.map +1 -1
  72. package/dist/common/UpdateNotifier.js +150 -57
  73. package/dist/common/VersionedSchema/Types.d.ts +5 -0
  74. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  75. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts +1 -7
  76. package/dist/common/VersionedSchema/Utils/determineBestMatchingSchemaVersion.d.ts.map +1 -1
  77. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts +3 -0
  78. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.d.ts.map +1 -0
  79. package/dist/common/VersionedSchema/Utils/getCurrentErrorMessage.js +14 -0
  80. package/dist/common/VersionedSchema/Utils/getKeyByMapValue.d.ts +2 -0
  81. package/dist/common/VersionedSchema/Utils/getKeyByMapValue.d.ts.map +1 -0
  82. package/dist/common/VersionedSchema/Utils/getKeyByMapValue.js +11 -0
  83. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts +5 -2
  84. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  85. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +22 -15
  86. package/dist/common/utils/__tests__/__mock__/mockJoiSchema.d.ts.map +1 -0
  87. package/dist/common/utils/__tests__/convertArrayToObject.test.d.ts.map +1 -0
  88. package/dist/common/{__tests__ → utils/__tests__}/convertArrayToObject.test.js +14 -14
  89. package/dist/common/utils/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +1 -0
  90. package/dist/common/{__tests__ → utils/__tests__}/determineBestMatchingSchemaVersion.test.js +5 -5
  91. package/dist/common/utils/__tests__/generateKeyMappingForInvalidKeys.test.d.ts.map +1 -0
  92. package/dist/common/{__tests__ → utils/__tests__}/generateKeyMappingForInvalidKeys.test.js +4 -4
  93. package/dist/common/utils/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +1 -0
  94. package/dist/common/{__tests__ → utils/__tests__}/getUniqueKeysFromSchemas.test.js +4 -4
  95. package/dist/common/utils/__tests__/getUniqueObjectKeys.test.d.ts.map +1 -0
  96. package/dist/common/{__tests__ → utils/__tests__}/getUniqueObjectKeys.test.js +5 -5
  97. package/dist/common/utils/__tests__/mergeObjectSchemas.test.d.ts.map +1 -0
  98. package/dist/common/{__tests__ → utils/__tests__}/mergeObjectSchemas.test.js +5 -5
  99. package/dist/common/utils/__tests__/migrationForMultiOptions.test.d.ts.map +1 -0
  100. package/dist/common/{__tests__ → utils/__tests__}/migrationForMultiOptions.test.js +21 -15
  101. package/dist/common/utils/__tests__/migrationForOptions.test.d.ts.map +1 -0
  102. package/dist/common/{__tests__ → utils/__tests__}/migrationForOptions.test.js +13 -9
  103. package/dist/common/utils/__tests__/pathHelpers.test.d.ts.map +1 -0
  104. package/dist/{core → common}/utils/__tests__/pathHelpers.test.js +8 -8
  105. package/dist/common/utils/__tests__/replaceInvalidKeysWithMappedNames.test.d.ts.map +1 -0
  106. package/dist/common/{__tests__ → utils/__tests__}/replaceInvalidKeysWithMappedNames.test.js +5 -5
  107. package/dist/common/utils/__tests__/validateAndSuggestKeyCorrections.test.d.ts.map +1 -0
  108. package/dist/common/{__tests__ → utils/__tests__}/validateAndSuggestKeyCorrections.test.js +5 -5
  109. package/dist/common/utils/convertArrayToObject.d.ts +2 -0
  110. package/dist/common/utils/convertArrayToObject.d.ts.map +1 -0
  111. package/dist/common/{Utils.js → utils/convertArrayToObject.js} +0 -20
  112. package/dist/{core/utils/fileSystem.d.ts → common/utils/fileSystemHelpers.d.ts} +8 -5
  113. package/dist/common/utils/fileSystemHelpers.d.ts.map +1 -0
  114. package/dist/common/utils/fileSystemHelpers.js +85 -0
  115. package/dist/common/utils/format.d.ts +3 -0
  116. package/dist/common/utils/format.d.ts.map +1 -0
  117. package/dist/{core → common}/utils/format.js +2 -2
  118. package/dist/common/utils/loadConfigIfExists.d.ts +2 -0
  119. package/dist/common/utils/loadConfigIfExists.d.ts.map +1 -0
  120. package/dist/common/utils/loadConfigIfExists.js +22 -0
  121. package/dist/common/utils/pathHelpers.d.ts +6 -0
  122. package/dist/common/utils/pathHelpers.d.ts.map +1 -0
  123. package/dist/{core → common}/utils/pathHelpers.js +16 -20
  124. package/dist/common/utils/safeHasOwn.d.ts +2 -0
  125. package/dist/common/utils/safeHasOwn.d.ts.map +1 -0
  126. package/dist/common/utils/safeHasOwn.js +9 -0
  127. package/dist/core/Context.d.ts.map +1 -1
  128. package/dist/core/Context.js +3 -3
  129. package/dist/core/WriteClient.d.ts.map +1 -1
  130. package/dist/core/WriteClient.js +18 -18
  131. package/dist/core/__tests__/WriteClient.test.js +61 -60
  132. package/dist/core/api/v2/Parser.d.ts.map +1 -1
  133. package/dist/core/api/v2/Parser.js +2 -9
  134. package/dist/core/api/v2/parser/__tests__/getServer.test.js +2 -2
  135. package/dist/core/api/v2/parser/__tests__/getType.test.js +3 -3
  136. package/dist/core/api/v2/parser/getModelProperties.d.ts.map +1 -1
  137. package/dist/core/api/v2/parser/getModelProperties.js +2 -5
  138. package/dist/core/api/v2/parser/getModels.d.ts.map +1 -1
  139. package/dist/core/api/v2/parser/getModels.js +2 -1
  140. package/dist/core/api/v2/parser/getOperationParameter.d.ts.map +1 -1
  141. package/dist/core/api/v2/parser/getOperationParameter.js +2 -1
  142. package/dist/core/api/v2/parser/getOperationResponse.d.ts.map +1 -1
  143. package/dist/core/api/v2/parser/getOperationResponse.js +2 -5
  144. package/dist/core/api/v2/parser/getOperationResponses.d.ts.map +1 -1
  145. package/dist/core/api/v2/parser/getOperationResponses.js +2 -5
  146. package/dist/core/api/v2/parser/getServices.d.ts.map +1 -1
  147. package/dist/core/api/v2/parser/getServices.js +2 -5
  148. package/dist/core/api/v2/parser/getType.js +4 -4
  149. package/dist/core/api/v3/Parser.d.ts +1 -1
  150. package/dist/core/api/v3/Parser.d.ts.map +1 -1
  151. package/dist/core/api/v3/Parser.js +2 -9
  152. package/dist/core/api/v3/parser/__tests__/getServer.test.js +3 -3
  153. package/dist/core/api/v3/parser/__tests__/getType.test.js +3 -3
  154. package/dist/core/api/v3/parser/getModelProperties.d.ts.map +1 -1
  155. package/dist/core/api/v3/parser/getModelProperties.js +2 -5
  156. package/dist/core/api/v3/parser/getModels.d.ts.map +1 -1
  157. package/dist/core/api/v3/parser/getModels.js +2 -1
  158. package/dist/core/api/v3/parser/getOperationResponse.d.ts.map +1 -1
  159. package/dist/core/api/v3/parser/getOperationResponse.js +2 -5
  160. package/dist/core/api/v3/parser/getOperationResponses.d.ts.map +1 -1
  161. package/dist/core/api/v3/parser/getOperationResponses.js +2 -5
  162. package/dist/core/api/v3/parser/getServer.d.ts.map +1 -1
  163. package/dist/core/api/v3/parser/getServer.js +2 -5
  164. package/dist/core/api/v3/parser/getServices.d.ts.map +1 -1
  165. package/dist/core/api/v3/parser/getServices.js +2 -5
  166. package/dist/core/api/v3/parser/getType.d.ts.map +1 -1
  167. package/dist/core/api/v3/parser/getType.js +5 -13
  168. package/dist/core/index.d.ts +4 -0
  169. package/dist/core/index.d.ts.map +1 -1
  170. package/dist/core/index.js +34 -27
  171. package/dist/core/types/Consts.d.ts +5 -1
  172. package/dist/core/types/Consts.d.ts.map +1 -1
  173. package/dist/core/types/Consts.js +6 -2
  174. package/dist/core/types/base/Root.model.d.ts +1 -0
  175. package/dist/core/types/base/Root.model.d.ts.map +1 -1
  176. package/dist/core/utils/__tests__/escapeDescription.test.js +3 -3
  177. package/dist/core/utils/__tests__/escapeName.test.js +2 -2
  178. package/dist/core/utils/__tests__/flatMap.test.js +2 -2
  179. package/dist/core/utils/__tests__/getAbsolutePath.test.js +6 -6
  180. package/dist/core/utils/__tests__/getClassName.test.js +2 -2
  181. package/dist/core/utils/__tests__/getComment.test.js +2 -2
  182. package/dist/core/utils/__tests__/getEnumFromDescription.test.js +2 -2
  183. package/dist/core/utils/__tests__/getFileName.test.js +2 -2
  184. package/dist/core/utils/__tests__/getGatheringRefs.test.js +2 -2
  185. package/dist/core/utils/__tests__/getMappedType.test.js +2 -2
  186. package/dist/core/utils/__tests__/getModelNames.test.js +2 -2
  187. package/dist/core/utils/__tests__/getOpenApiVersion.test.js +2 -2
  188. package/dist/core/utils/__tests__/getOperationName.test.js +2 -2
  189. package/dist/core/utils/__tests__/getOperationParameterName.test.js +2 -2
  190. package/dist/core/utils/__tests__/getOperationPath.test.js +2 -2
  191. package/dist/core/utils/__tests__/getOperationResponseCode.test.js +2 -2
  192. package/dist/core/utils/__tests__/getPattern.test.js +2 -2
  193. package/dist/core/utils/__tests__/getRefFromSchema.test.js +2 -2
  194. package/dist/core/utils/__tests__/getRefs.test.js +2 -2
  195. package/dist/core/utils/__tests__/getRelativeModelPath.test.js +3 -3
  196. package/dist/core/utils/__tests__/getServiceClassName.test.js +2 -2
  197. package/dist/core/utils/__tests__/getServiceNames.test.js +2 -2
  198. package/dist/core/utils/__tests__/getServiceVersion.test.js +2 -2
  199. package/dist/core/utils/__tests__/isString.test.js +2 -2
  200. package/dist/core/utils/__tests__/isSubdirectory.test.js +10 -10
  201. package/dist/core/utils/__tests__/registerHandlebarHelpers.test.js +2 -2
  202. package/dist/core/utils/__tests__/registerHandlebarTemplates.test.js +2 -2
  203. package/dist/core/utils/__tests__/replaceString.test.js +2 -2
  204. package/dist/core/utils/__tests__/resolveRefToImportPath.test.js +360 -51
  205. package/dist/core/utils/__tests__/sort.test.js +2 -2
  206. package/dist/core/utils/__tests__/sortByRequiredExtended.test.js +11 -11
  207. package/dist/core/utils/__tests__/sortByRequiredSimple.test.js +11 -11
  208. package/dist/core/utils/__tests__/sortModelsByName.test.js +2 -2
  209. package/dist/core/utils/__tests__/sortServicesByName.test.js +2 -2
  210. package/dist/core/utils/__tests__/stripNamespace.test.js +2 -2
  211. package/dist/core/utils/__tests__/unique.test.js +2 -2
  212. package/dist/core/utils/__tests__/writeClientCore.test.js +52 -50
  213. package/dist/core/utils/__tests__/writeClientFullIndex.test.js +39 -37
  214. package/dist/core/utils/__tests__/writeClientModels.test.js +65 -63
  215. package/dist/core/utils/__tests__/writeClientSchemas.test.js +65 -63
  216. package/dist/core/utils/__tests__/writeClientServices.test.js +60 -58
  217. package/dist/core/utils/appendUniqueLinesToFile.js +4 -4
  218. package/dist/core/utils/createNormalizedRef.js +2 -2
  219. package/dist/core/utils/getAbsolutePath.js +3 -3
  220. package/dist/core/utils/getModelNameWithPrefix.d.ts +3 -0
  221. package/dist/core/utils/getModelNameWithPrefix.d.ts.map +1 -0
  222. package/dist/core/utils/getModelNameWithPrefix.js +15 -0
  223. package/dist/core/utils/getOpenApiSpec.d.ts.map +1 -1
  224. package/dist/core/utils/getOpenApiSpec.js +4 -4
  225. package/dist/core/utils/getOutputPaths.d.ts.map +1 -1
  226. package/dist/core/utils/getOutputPaths.js +6 -6
  227. package/dist/core/utils/getPattern.d.ts.map +1 -1
  228. package/dist/core/utils/getPattern.js +2 -1
  229. package/dist/core/utils/getRelativeModelPath.d.ts.map +1 -1
  230. package/dist/core/utils/getRelativeModelPath.js +2 -6
  231. package/dist/core/utils/isSubdirectory.d.ts.map +1 -1
  232. package/dist/core/utils/isSubdirectory.js +4 -3
  233. package/dist/core/utils/mapPathToTargetDirSafe.d.ts.map +1 -1
  234. package/dist/core/utils/mapPathToTargetDirSafe.js +11 -12
  235. package/dist/core/utils/modelHelpers.d.ts.map +1 -1
  236. package/dist/core/utils/modelHelpers.js +18 -6
  237. package/dist/core/utils/normalizeString.d.ts +2 -0
  238. package/dist/core/utils/normalizeString.d.ts.map +1 -0
  239. package/dist/core/utils/normalizeString.js +14 -0
  240. package/dist/core/utils/normalizedAbsolutePath.js +3 -3
  241. package/dist/core/utils/parseRef.d.ts.map +1 -1
  242. package/dist/core/utils/parseRef.js +7 -10
  243. package/dist/core/utils/precompileTemplates.js +14 -10
  244. package/dist/core/utils/registerHandlebarHelpers.d.ts.map +1 -1
  245. package/dist/core/utils/registerHandlebarHelpers.js +24 -0
  246. package/dist/core/utils/replaceString.d.ts.map +1 -1
  247. package/dist/core/utils/replaceString.js +2 -1
  248. package/dist/core/utils/resolveRefPath.d.ts.map +1 -1
  249. package/dist/core/utils/resolveRefPath.js +3 -3
  250. package/dist/core/utils/resolveRefToImportPath.d.ts +8 -2
  251. package/dist/core/utils/resolveRefToImportPath.d.ts.map +1 -1
  252. package/dist/core/utils/resolveRefToImportPath.js +91 -31
  253. package/dist/core/utils/serviceHelpers.d.ts.map +1 -1
  254. package/dist/core/utils/serviceHelpers.js +2 -1
  255. package/dist/core/utils/stripNamespace.js +5 -5
  256. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  257. package/dist/core/utils/writeClientCore.js +12 -12
  258. package/dist/core/utils/writeClientCoreIndex.d.ts.map +1 -1
  259. package/dist/core/utils/writeClientCoreIndex.js +2 -2
  260. package/dist/core/utils/writeClientFullIndex.d.ts.map +1 -1
  261. package/dist/core/utils/writeClientFullIndex.js +4 -4
  262. package/dist/core/utils/writeClientModels.d.ts.map +1 -1
  263. package/dist/core/utils/writeClientModels.js +7 -7
  264. package/dist/core/utils/writeClientModelsIndex.d.ts.map +1 -1
  265. package/dist/core/utils/writeClientModelsIndex.js +2 -2
  266. package/dist/core/utils/writeClientSchemas.d.ts.map +1 -1
  267. package/dist/core/utils/writeClientSchemas.js +7 -7
  268. package/dist/core/utils/writeClientSchemasIndex.d.ts.map +1 -1
  269. package/dist/core/utils/writeClientSchemasIndex.js +2 -2
  270. package/dist/core/utils/writeClientServices.d.ts.map +1 -1
  271. package/dist/core/utils/writeClientServices.js +5 -5
  272. package/dist/core/utils/writeClientServicesIndex.d.ts.map +1 -1
  273. package/dist/core/utils/writeClientServicesIndex.js +2 -2
  274. package/dist/core/utils/writeClientSimpleIndex.d.ts.map +1 -1
  275. package/dist/core/utils/writeClientSimpleIndex.js +4 -4
  276. package/dist/templatesCompiled/client/exportModel.js +4 -4
  277. package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
  278. package/dist/templatesCompiled/client/exportService.js +12 -13
  279. package/dist/templatesCompiled/client/indexFull.d.ts.map +1 -1
  280. package/dist/templatesCompiled/client/indexFull.js +35 -29
  281. package/dist/templatesCompiled/client/partials/parameters.d.ts +3 -2
  282. package/dist/templatesCompiled/client/partials/parameters.d.ts.map +1 -1
  283. package/dist/templatesCompiled/client/partials/parameters.js +25 -20
  284. package/dist/templatesCompiled/client/partials/parametersDefinition.d.ts +4 -2
  285. package/dist/templatesCompiled/client/partials/parametersDefinition.d.ts.map +1 -1
  286. package/dist/templatesCompiled/client/partials/parametersDefinition.js +31 -10
  287. package/package.json +15 -13
  288. package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts +0 -5
  289. package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.d.ts.map +0 -1
  290. package/dist/cli/chekOpenApiConfig/chekOpenApiConfig.js +0 -45
  291. package/dist/common/Utils.d.ts +0 -3
  292. package/dist/common/Utils.d.ts.map +0 -1
  293. package/dist/common/__tests__/__mock__/mockJoiSchema.d.ts.map +0 -1
  294. package/dist/common/__tests__/convertArrayToObject.test.d.ts.map +0 -1
  295. package/dist/common/__tests__/determineBestMatchingSchemaVersion.test.d.ts.map +0 -1
  296. package/dist/common/__tests__/generateKeyMappingForInvalidKeys.test.d.ts.map +0 -1
  297. package/dist/common/__tests__/getUniqueKeysFromSchemas.test.d.ts.map +0 -1
  298. package/dist/common/__tests__/getUniqueObjectKeys.test.d.ts.map +0 -1
  299. package/dist/common/__tests__/mergeObjectSchemas.test.d.ts.map +0 -1
  300. package/dist/common/__tests__/migrationForMultiOptions.test.d.ts.map +0 -1
  301. package/dist/common/__tests__/migrationForOptions.test.d.ts.map +0 -1
  302. package/dist/common/__tests__/replaceInvalidKeysWithMappedNames.test.d.ts.map +0 -1
  303. package/dist/common/__tests__/validateAndSuggestKeyCorrections.test.d.ts.map +0 -1
  304. package/dist/core/utils/__tests__/getRelativeModelImportPath.test.d.ts +0 -2
  305. package/dist/core/utils/__tests__/getRelativeModelImportPath.test.d.ts.map +0 -1
  306. package/dist/core/utils/__tests__/getRelativeModelImportPath.test.js +0 -82
  307. package/dist/core/utils/__tests__/pathHelpers.test.d.ts.map +0 -1
  308. package/dist/core/utils/fileSystem.d.ts.map +0 -1
  309. package/dist/core/utils/fileSystem.js +0 -26
  310. package/dist/core/utils/format.d.ts +0 -2
  311. package/dist/core/utils/format.d.ts.map +0 -1
  312. package/dist/core/utils/getRelativeModelImportPath.d.ts +0 -9
  313. package/dist/core/utils/getRelativeModelImportPath.d.ts.map +0 -1
  314. package/dist/core/utils/getRelativeModelImportPath.js +0 -45
  315. package/dist/core/utils/isDirectory.d.ts +0 -2
  316. package/dist/core/utils/isDirectory.d.ts.map +0 -1
  317. package/dist/core/utils/isDirectory.js +0 -13
  318. package/dist/core/utils/pathHelpers.d.ts +0 -7
  319. package/dist/core/utils/pathHelpers.d.ts.map +0 -1
  320. /package/dist/common/{__tests__ → utils/__tests__}/__mock__/mockJoiSchema.d.ts +0 -0
  321. /package/dist/common/{__tests__ → utils/__tests__}/__mock__/mockJoiSchema.js +0 -0
  322. /package/dist/common/{__tests__ → utils/__tests__}/convertArrayToObject.test.d.ts +0 -0
  323. /package/dist/common/{__tests__ → utils/__tests__}/determineBestMatchingSchemaVersion.test.d.ts +0 -0
  324. /package/dist/common/{__tests__ → utils/__tests__}/generateKeyMappingForInvalidKeys.test.d.ts +0 -0
  325. /package/dist/common/{__tests__ → utils/__tests__}/getUniqueKeysFromSchemas.test.d.ts +0 -0
  326. /package/dist/common/{__tests__ → utils/__tests__}/getUniqueObjectKeys.test.d.ts +0 -0
  327. /package/dist/common/{__tests__ → utils/__tests__}/mergeObjectSchemas.test.d.ts +0 -0
  328. /package/dist/common/{__tests__ → utils/__tests__}/migrationForMultiOptions.test.d.ts +0 -0
  329. /package/dist/common/{__tests__ → utils/__tests__}/migrationForOptions.test.d.ts +0 -0
  330. /package/dist/{core → common}/utils/__tests__/pathHelpers.test.d.ts +0 -0
  331. /package/dist/common/{__tests__ → utils/__tests__}/replaceInvalidKeysWithMappedNames.test.d.ts +0 -0
  332. /package/dist/common/{__tests__ → utils/__tests__}/validateAndSuggestKeyCorrections.test.d.ts +0 -0
@@ -2,44 +2,104 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolveRefToImportPath = resolveRefToImportPath;
4
4
  const path_1 = require("path");
5
- const isDirectory_1 = require("./isDirectory");
6
- const isFileName_1 = require("./isFileName");
5
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
7
7
  const mapPathToTargetDirSafe_1 = require("./mapPathToTargetDirSafe");
8
8
  const parseRef_1 = require("./parseRef");
9
- const pathHelpers_1 = require("./pathHelpers");
10
9
  const stripNamespace_1 = require("./stripNamespace");
11
- function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, outputModelsPath, }) {
12
- const absOutputModelsPath = (0, path_1.resolve)(outputModelsPath);
13
- const sourceRoot = (0, isDirectory_1.isDirectory)(mainSpecPath) ? mainSpecPath : (0, path_1.dirname)(mainSpecPath);
10
+ /**
11
+ * Resolves model path and returns relative path or fallback name.
12
+ * Returns fallback if the path is outside outputModelsPath, otherwise returns relative path.
13
+ */
14
+ function resolveModelPath(absModelPath, absOutputModelsPath, fallbackName) {
15
+ if (!absModelPath.startsWith(absOutputModelsPath + '/') && absModelPath !== absOutputModelsPath) {
16
+ return `./${fallbackName}`;
17
+ }
18
+ return (0, pathHelpers_1.relativeHelper)(absOutputModelsPath, absModelPath);
19
+ }
20
+ /**
21
+ * Resolves fragment reference (LOCAL_FRAGMENT or EXTERNAL_FILE_FRAGMENT).
22
+ * Both types use the same logic: resolve model path based on parent file location.
23
+ */
24
+ function resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath) {
25
+ const cleanParentForLocal = (0, stripNamespace_1.stripNamespace)(parentFilePath || mainSpecPath);
26
+ const parentDirInSource = (0, pathHelpers_1.dirNameHelper)(cleanParentForLocal);
27
+ const parentDirInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(parentDirInSource, sourceRoot, outputModelsPath);
28
+ const modelFilePathInOutput = (0, pathHelpers_1.resolveHelper)(parentDirInOutput, modelName);
29
+ const absModelPath = (0, pathHelpers_1.resolveHelper)(modelFilePathInOutput);
30
+ return resolveModelPath(absModelPath, absOutputModelsPath, modelName);
31
+ }
32
+ /**
33
+ * Resolves external file or absolute path reference.
34
+ * Maps the target file path to output directory and returns relative path or fallback.
35
+ */
36
+ function resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath) {
37
+ const targetPathInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(targetFileAbs, sourceRoot, outputModelsPath);
38
+ const absTargetPath = (0, pathHelpers_1.resolveHelper)(targetPathInOutput);
39
+ const fallbackName = (0, stripNamespace_1.stripNamespace)((0, path_1.basename)(targetFileAbs));
40
+ return resolveModelPath(absTargetPath, absOutputModelsPath, fallbackName);
41
+ }
42
+ /**
43
+ * Prepares parent directory for resolving relative references.
44
+ * Handles both file and directory paths.
45
+ */
46
+ function prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot) {
47
+ const parentParsed = parentFilePath ? (0, parseRef_1.parseRef)(parentFilePath) : null;
48
+ const parentRaw = parentParsed?.filePath ? parentParsed.filePath : '';
49
+ const parentClean = (0, stripNamespace_1.stripNamespace)(parentRaw);
50
+ let parentDirForResolve = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(sourceRoot) ? (0, pathHelpers_1.dirNameHelper)(sourceRoot) : sourceRoot;
51
+ if (parentClean) {
52
+ parentDirForResolve = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(parentRaw) ? (0, pathHelpers_1.dirNameHelper)(parentClean) : parentClean;
53
+ }
54
+ return parentDirForResolve.endsWith('/') ? parentDirForResolve : parentDirForResolve + '/';
55
+ }
56
+ /**
57
+ * Removes parent basename prefix from reference value if present.
58
+ * This handles cases where refValuePath starts with parent directory name.
59
+ */
60
+ function removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep) {
61
+ const baseNameParent = (0, path_1.basename)(parentDirForResolveWithSep);
62
+ const baseNameParentWithSep = baseNameParent.endsWith('/') ? baseNameParent : baseNameParent + '/';
63
+ return refValueClean.startsWith(baseNameParentWithSep)
64
+ ? refValueClean.replace(baseNameParentWithSep, '')
65
+ : refValueClean;
66
+ }
67
+ /**
68
+ * Resolves $ref reference to import path for generated code.
69
+ * Handles HTTP URLs, local fragments, external file fragments, external files, and absolute paths.
70
+ */
71
+ function resolveRefToImportPath({ mainSpecPath, parentFilePath, refValuePath, outputModelsPath }) {
72
+ const absOutputModelsPath = (0, pathHelpers_1.resolveHelper)(outputModelsPath);
73
+ const sourceRoot = fileSystemHelpers_1.fileSystemHelpers.isDirectory(mainSpecPath) ? mainSpecPath : (0, pathHelpers_1.dirNameHelper)(mainSpecPath);
14
74
  const parsed = (0, parseRef_1.parseRef)(refValuePath);
15
- // KEY CASE: internal link (#/components/schemas/Xxx)
75
+ // HTTP URLs are returned as-is
76
+ if (parsed.type === parseRef_1.RefType.HTTP_URL) {
77
+ return refValuePath;
78
+ }
79
+ // LOCAL_FRAGMENT: reference to component in the same file (e.g., #/components/schemas/User)
16
80
  if (parsed.type === parseRef_1.RefType.LOCAL_FRAGMENT) {
17
- // stripNamespace transform "#/components/schemas/AccountField" → "AccountField"
18
81
  const modelName = (0, stripNamespace_1.stripNamespace)(refValuePath);
19
- // Determinarea de unde provine legătura (pentru o cale relativă)
20
- const cleanParent = (0, stripNamespace_1.stripNamespace)(parentFilePath || mainSpecPath);
21
- const parentDirInSource = (0, path_1.dirname)(cleanParent);
22
- const parentDirInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(parentDirInSource, sourceRoot, outputModelsPath);
23
- // Crearea căii către fișierul model
24
- const modelFilePathInOutput = (0, path_1.resolve)(parentDirInOutput, modelName);
25
- const absModelPath = (0, path_1.resolve)(modelFilePathInOutput);
26
- if (!absModelPath.startsWith(absOutputModelsPath + '/') && absModelPath !== absOutputModelsPath) {
27
- return `./${modelName}`;
28
- }
29
- const relativePath = (0, path_1.relative)(absOutputModelsPath, absModelPath);
30
- return `./${relativePath.replace(/\\/g, '/')}`;
82
+ return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
31
83
  }
32
- // Restul cazurilor sunt legături externe (funcționează ca înainte)
33
- const parentClean = (0, stripNamespace_1.stripNamespace)(parentFilePath || '') || '';
84
+ // EXTERNAL_FILE_FRAGMENT: reference to component in external file (e.g., ./file.yaml#/components/schemas/User)
85
+ if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE_FRAGMENT) {
86
+ const refFileRaw = parsed?.fragment ? parsed.fragment : '';
87
+ const modelName = (0, stripNamespace_1.stripNamespace)(refFileRaw || '') || '';
88
+ return resolveFragmentRef(modelName, parentFilePath, mainSpecPath, sourceRoot, outputModelsPath, absOutputModelsPath);
89
+ }
90
+ // Prepare parent directory for resolving relative references
91
+ // This is used for both EXTERNAL_FILE and ABSOLUTE_PATH (default case)
92
+ const parentDirForResolveWithSep = prepareParentDirForResolve(parentFilePath, mainSpecPath, sourceRoot);
34
93
  const refValueClean = (0, stripNamespace_1.stripNamespace)(refValuePath || '') || refValuePath;
35
- const parentDirForResolve = parentClean ? (0, path_1.dirname)(parentClean) : sourceRoot;
36
- const targetFileAbs = (0, isFileName_1.isFileName)(refValueClean) ? (0, pathHelpers_1.joinToDir)(parentDirForResolve, refValueClean) : (0, path_1.resolve)(parentDirForResolve, refValueClean);
37
- const targetPathInOutput = (0, mapPathToTargetDirSafe_1.mapPathToTargetDirSafe)(targetFileAbs, sourceRoot, outputModelsPath);
38
- const absTargetPath = (0, path_1.resolve)(targetPathInOutput);
39
- if (!absTargetPath.startsWith(absOutputModelsPath + '/') && absTargetPath !== absOutputModelsPath) {
40
- const fallbackName = (0, stripNamespace_1.stripNamespace)((0, path_1.basename)(targetFileAbs));
41
- return `./${fallbackName}`;
94
+ const currentRefValue = removeParentBasenamePrefix(refValueClean, parentDirForResolveWithSep);
95
+ // EXTERNAL_FILE: reference to external file (e.g., ./file.yaml)
96
+ if (parsed.type === parseRef_1.RefType.EXTERNAL_FILE) {
97
+ const targetFileAbs = (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, currentRefValue);
98
+ return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
42
99
  }
43
- const relativePath = (0, path_1.relative)(absOutputModelsPath, absTargetPath);
44
- return `./${relativePath.replace(/\\/g, '/')}`;
100
+ // ABSOLUTE_PATH (default case): absolute path reference
101
+ const targetFileAbs = fileSystemHelpers_1.fileSystemHelpers.isPathToFile(refValueClean)
102
+ ? (0, pathHelpers_1.joinHelper)(parentDirForResolveWithSep, refValueClean)
103
+ : (0, pathHelpers_1.resolveHelper)(parentDirForResolveWithSep, refValueClean);
104
+ return resolveExternalFileOrAbsolutePath(targetFileAbs, sourceRoot, outputModelsPath, absOutputModelsPath);
45
105
  }
@@ -1 +1 @@
1
- {"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiChE"}
1
+ {"version":3,"file":"serviceHelpers.d.ts","sourceRoot":"","sources":["../../../src/core/utils/serviceHelpers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAK7D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAOhH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAWxG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,GAAG,IAAI,CAMvF;AAcD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiChE"}
@@ -4,6 +4,7 @@ exports.forEachOperationInPath = forEachOperationInPath;
4
4
  exports.ensureService = ensureService;
5
5
  exports.mergeOperationImportsIntoService = mergeOperationImportsIntoService;
6
6
  exports.finalizeServiceImports = finalizeServiceImports;
7
+ const safeHasOwn_1 = require("../../common/utils/safeHasOwn");
7
8
  const unique_1 = require("./unique");
8
9
  const SUPPORTED_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'patch'];
9
10
  /**
@@ -14,7 +15,7 @@ const SUPPORTED_METHODS = ['get', 'put', 'post', 'delete', 'options', 'head', 'p
14
15
  */
15
16
  function forEachOperationInPath(pathObj, cb) {
16
17
  for (const method in pathObj) {
17
- if (!Object.prototype.hasOwnProperty.call(pathObj, method))
18
+ if (!(0, safeHasOwn_1.safeHasOwn)(pathObj, method))
18
19
  continue;
19
20
  if (SUPPORTED_METHODS.includes(method) && pathObj[method]) {
20
21
  cb(method, pathObj[method]);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stripNamespace = stripNamespace;
4
4
  const path_1 = require("path");
5
- const pathHelpers_1 = require("../utils/pathHelpers");
5
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
6
6
  const getClassName_1 = require("./getClassName");
7
7
  const getMappedType_1 = require("./getMappedType");
8
8
  /**
@@ -15,10 +15,10 @@ function stripNamespace(value) {
15
15
  }
16
16
  if (!value.match(/^(http:\/\/|https:\/\/|#\/)/g) && !(0, getMappedType_1.hasMappedType)(value) && !value.match(/^array\[[a-z]+\]$/g)) {
17
17
  const foundFile = value.match(/^(.*)#/);
18
- const directoryName = foundFile ? (0, pathHelpers_1.dirName)(foundFile[1]) : (0, pathHelpers_1.dirName)(value);
18
+ const directoryName = foundFile ? (0, pathHelpers_1.dirNameHelper)(foundFile[1]) : (0, pathHelpers_1.dirNameHelper)(value);
19
19
  const extName = (0, path_1.extname)(value);
20
20
  const baseName = extName.toLowerCase().match(/(\.json|\.yaml|\.yml)$/g) ? (0, getClassName_1.getClassName)((0, path_1.basename)(value, extName)) : (0, getClassName_1.getClassName)((0, path_1.basename)(value));
21
- return directoryName ? (0, pathHelpers_1.join)(directoryName, baseName) : baseName;
21
+ return directoryName ? (0, pathHelpers_1.joinHelper)(directoryName, baseName) : baseName;
22
22
  }
23
23
  const clearValue = value
24
24
  .trim()
@@ -35,7 +35,7 @@ function stripNamespace(value) {
35
35
  .replace(/^#\/parameters\//, '')
36
36
  .replace(/^#\/responses\//, '')
37
37
  .replace(/^#\/securityDefinitions\//, '');
38
- const directoryName = (0, pathHelpers_1.dirName)(clearValue);
38
+ const directoryName = (0, pathHelpers_1.dirNameHelper)(clearValue);
39
39
  const baseName = (0, getClassName_1.getClassName)((0, path_1.basename)(clearValue));
40
- return directoryName ? (0, pathHelpers_1.join)(directoryName, baseName) : baseName;
40
+ return directoryName ? (0, pathHelpers_1.joinHelper)(directoryName, baseName) : baseName;
41
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientCore.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;;GAOG;AACH,UAAU,gBAAgB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjG"}
1
+ {"version":3,"file":"writeClientCore.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;;GAOG;AACH,UAAU,gBAAgB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgCjG"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientCore = writeClientCore;
4
- const path_1 = require("path");
5
- const fileSystem_1 = require("./fileSystem");
4
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
5
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
6
6
  /**
7
7
  * Generate OpenAPI core files, this includes the basic boilerplate code to handle requests.
8
8
  * @param client Client object, containing, models, schemas and services
@@ -22,22 +22,22 @@ async function writeClientCore(options) {
22
22
  useSeparatedIndexes,
23
23
  };
24
24
  this.logger.info("The recording of the kernel files begins");
25
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'OpenAPI.ts'), templates.core.settings(context));
26
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'ApiError.ts'), templates.core.apiError({}));
27
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'ApiRequestOptions.ts'), templates.core.apiRequestOptions({}));
28
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'ApiResult.ts'), templates.core.apiResult({}));
25
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'OpenAPI.ts'), templates.core.settings(context));
26
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiError.ts'), templates.core.apiError({}));
27
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiRequestOptions.ts'), templates.core.apiRequestOptions({}));
28
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'ApiResult.ts'), templates.core.apiResult({}));
29
29
  if (useCancelableRequest) {
30
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'CancelablePromise.ts'), templates.core.cancelablePromise({}));
30
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'CancelablePromise.ts'), templates.core.cancelablePromise({}));
31
31
  }
32
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'HttpStatusCode.ts'), templates.core.httpStatusCode({}));
33
- await fileSystem_1.fileSystem.writeFile((0, path_1.resolve)(outputCorePath, 'request.ts'), templates.core.request(context));
32
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'HttpStatusCode.ts'), templates.core.httpStatusCode({}));
33
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile((0, pathHelpers_1.resolveHelper)(outputCorePath, 'request.ts'), templates.core.request(context));
34
34
  if (request) {
35
- const requestFile = (0, path_1.resolve)(process.cwd(), request);
36
- const requestFileExists = await fileSystem_1.fileSystem.exists(requestFile);
35
+ const requestFile = (0, pathHelpers_1.resolveHelper)(process.cwd(), request);
36
+ const requestFileExists = await fileSystemHelpers_1.fileSystemHelpers.exists(requestFile);
37
37
  if (!requestFileExists) {
38
38
  throw new Error(`Custom request file "${requestFile}" does not exists`);
39
39
  }
40
- await fileSystem_1.fileSystem.copyFile(requestFile, (0, path_1.resolve)(outputCorePath, 'request.ts'));
40
+ await fileSystemHelpers_1.fileSystemHelpers.copyFile(requestFile, (0, pathHelpers_1.resolveHelper)(outputCorePath, 'request.ts'));
41
41
  }
42
42
  this.logger.info("The writing of the kernel files has been completed successfully");
43
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientCoreIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCoreIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcnF"}
1
+ {"version":3,"file":"writeClientCoreIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientCoreIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcnF"}
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientCoreIndex = writeClientCoreIndex;
4
- const path_1 = require("path");
4
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
5
  const appendUniqueLinesToFile_1 = require("./appendUniqueLinesToFile");
6
6
  async function writeClientCoreIndex(options) {
7
7
  const { templates, outputCorePath, useCancelableRequest, useSeparatedIndexes } = options;
8
8
  if (!useSeparatedIndexes) {
9
9
  return;
10
10
  }
11
- const filePath = (0, path_1.resolve)(outputCorePath, 'index.ts');
11
+ const filePath = (0, pathHelpers_1.resolveHelper)(outputCorePath, 'index.ts');
12
12
  this.logger.info(`Data has been written to a file: ${filePath}`);
13
13
  const content = templates.indexes.core({ useCancelableRequest });
14
14
  await (0, appendUniqueLinesToFile_1.appendUniqueLinesToFile)(filePath, content);
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientFullIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientFullIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrG"}
1
+ {"version":3,"file":"writeClientFullIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientFullIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBrG"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientFullIndex = writeClientFullIndex;
4
- const path_1 = require("path");
5
- const fileSystem_1 = require("./fileSystem");
4
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
6
  /**
7
7
  * Generate the OpenAPI client index file using the Handlebar template and write it to disk.
8
8
  * The index file just contains all the exports you need to use the client as a standalone
@@ -10,9 +10,9 @@ const fileSystem_1 = require("./fileSystem");
10
10
  */
11
11
  async function writeClientFullIndex(options) {
12
12
  const { templates, outputPath, core, models, schemas, services } = options;
13
- const resolvePathIndex = (0, path_1.resolve)(outputPath, 'index.ts');
13
+ const resolvePathIndex = (0, pathHelpers_1.resolveHelper)(outputPath, 'index.ts');
14
14
  this.logger.info(`Data has been written to a file: ${resolvePathIndex}`);
15
- await fileSystem_1.fileSystem.writeFile(resolvePathIndex, templates.indexes.full({
15
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile(resolvePathIndex, templates.indexes.full({
16
16
  core,
17
17
  models,
18
18
  schemas,
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientModels.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModels.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,kBAAkB;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrG"}
1
+ {"version":3,"file":"writeClientModels.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModels.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,kBAAkB;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCrG"}
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientModels = writeClientModels;
4
4
  const fs_1 = require("fs");
5
- const pathHelpers_1 = require("../utils/pathHelpers");
6
- const fileSystem_1 = require("./fileSystem");
7
- const format_1 = require("./format");
5
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
+ const format_1 = require("../../common/utils/format");
7
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
8
8
  /**
9
9
  * Generate Models using the Handlebar template and write to disk.
10
10
  * @param models Array of Models to write
@@ -21,13 +21,13 @@ async function writeClientModels(options) {
21
21
  if (!modelFolderPath) {
22
22
  return;
23
23
  }
24
- const dir = (0, pathHelpers_1.dirName)(modelFolderPath);
24
+ const dir = (0, pathHelpers_1.dirNameHelper)(modelFolderPath);
25
25
  if (dir) {
26
- const directory = (0, pathHelpers_1.resolve)(outputModelsPath, dir);
26
+ const directory = (0, pathHelpers_1.resolveHelper)(outputModelsPath, dir);
27
27
  this.logger.info(`A directory is being created: ${directory}`);
28
28
  (0, fs_1.mkdirSync)(directory, { recursive: true });
29
29
  }
30
- const file = (0, pathHelpers_1.resolve)(outputModelsPath, `${modelFolderPath}.ts`);
30
+ const file = (0, pathHelpers_1.resolveHelper)(outputModelsPath, `${modelFolderPath}.ts`);
31
31
  this.logger.info(`The recording of the file data begins: ${file}`);
32
32
  const templateResult = templates.exports.model({
33
33
  ...model,
@@ -35,7 +35,7 @@ async function writeClientModels(options) {
35
35
  useUnionTypes,
36
36
  });
37
37
  const formattedValue = await (0, format_1.format)(templateResult);
38
- await fileSystem_1.fileSystem.writeFile(file, formattedValue);
38
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
39
39
  this.logger.info(`File recording completed: ${file}`);
40
40
  }
41
41
  this.logger.info('Model file recording completed successfully');
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientModelsIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModelsIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcrF"}
1
+ {"version":3,"file":"writeClientModelsIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientModelsIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcrF"}
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientModelsIndex = writeClientModelsIndex;
4
- const path_1 = require("path");
4
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
5
  const appendUniqueLinesToFile_1 = require("./appendUniqueLinesToFile");
6
6
  async function writeClientModelsIndex(options) {
7
7
  const { models, templates, outputModelsPath, useSeparatedIndexes } = options;
8
8
  if (!useSeparatedIndexes) {
9
9
  return;
10
10
  }
11
- const filePath = (0, path_1.resolve)(outputModelsPath, 'index.ts');
11
+ const filePath = (0, pathHelpers_1.resolveHelper)(outputModelsPath, 'index.ts');
12
12
  this.logger.info(`Data has been written to a file: ${filePath}`);
13
13
  const content = templates.indexes.models({ models });
14
14
  await (0, appendUniqueLinesToFile_1.appendUniqueLinesToFile)(filePath, content);
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvG"}
1
+ {"version":3,"file":"writeClientSchemas.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemas.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD;;;;;;GAMG;AACH,UAAU,mBAAmB;IACzB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BvG"}
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientSchemas = writeClientSchemas;
4
4
  const fs_1 = require("fs");
5
- const pathHelpers_1 = require("../utils/pathHelpers");
6
- const fileSystem_1 = require("./fileSystem");
7
- const format_1 = require("./format");
5
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
+ const format_1 = require("../../common/utils/format");
7
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
8
8
  /**
9
9
  * Generate Schemas using the Handlebar template and write to disk.
10
10
  * @param models Array of Models to write
@@ -18,13 +18,13 @@ async function writeClientSchemas(options) {
18
18
  this.logger.info('The recording of model validation schema files begins.');
19
19
  for (const model of models) {
20
20
  const modelFolderPath = model?.path;
21
- const dir = (0, pathHelpers_1.dirName)(modelFolderPath);
21
+ const dir = (0, pathHelpers_1.dirNameHelper)(modelFolderPath);
22
22
  if (dir) {
23
- const directory = (0, pathHelpers_1.resolve)(outputSchemasPath, dir);
23
+ const directory = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, dir);
24
24
  this.logger.info(`A directory is being created: ${directory}`);
25
25
  (0, fs_1.mkdirSync)(directory, { recursive: true });
26
26
  }
27
- const file = (0, pathHelpers_1.resolve)(outputSchemasPath, `${modelFolderPath}Schema.ts`);
27
+ const file = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, `${modelFolderPath}Schema.ts`);
28
28
  this.logger.info(`The recording of the file data begins: ${file}`);
29
29
  const templateResult = templates.exports.schema({
30
30
  ...model,
@@ -32,7 +32,7 @@ async function writeClientSchemas(options) {
32
32
  useUnionTypes,
33
33
  });
34
34
  const formattedValue = await (0, format_1.format)(templateResult);
35
- await fileSystem_1.fileSystem.writeFile(file, formattedValue);
35
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
36
36
  this.logger.info(`File recording completed: ${file}`);
37
37
  }
38
38
  this.logger.info('The recording of model validation schema files has been completed successfully');
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientSchemasIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemasIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBActF"}
1
+ {"version":3,"file":"writeClientSchemasIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSchemasIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBActF"}
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientSchemasIndex = writeClientSchemasIndex;
4
- const path_1 = require("path");
4
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
5
  const appendUniqueLinesToFile_1 = require("./appendUniqueLinesToFile");
6
6
  async function writeClientSchemasIndex(options) {
7
7
  const { models, templates, outputSchemasPath, useSeparatedIndexes } = options;
8
8
  if (!useSeparatedIndexes) {
9
9
  return;
10
10
  }
11
- const filePath = (0, path_1.resolve)(outputSchemasPath, 'index.ts');
11
+ const filePath = (0, pathHelpers_1.resolveHelper)(outputSchemasPath, 'index.ts');
12
12
  this.logger.info(`Data has been written to a file: ${filePath}`);
13
13
  const content = templates.indexes.schemas({ schemas: models });
14
14
  await (0, appendUniqueLinesToFile_1.appendUniqueLinesToFile)(filePath, content);
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientServices.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServices.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,KAAK,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,UAAU,oBAAoB;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BzG"}
1
+ {"version":3,"file":"writeClientServices.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServices.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,KAAK,mBAAmB,GAAG,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,eAAe,CAAC,CAAC;AAEzE;;;;;;;;GAQG;AACH,UAAU,oBAAoB;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,WAAW,EAAE,mBAAmB,CAAC;IACjC,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BzG"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientServices = writeClientServices;
4
- const path_1 = require("path");
5
- const fileSystem_1 = require("./fileSystem");
6
- const format_1 = require("./format");
4
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
5
+ const format_1 = require("../../common/utils/format");
6
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
7
7
  /**
8
8
  * Generate Services using the Handlebar template and write to disk.
9
9
  * @param services Array of Services to write
@@ -17,7 +17,7 @@ async function writeClientServices(options) {
17
17
  const { services, templates, outputPaths, httpClient, useUnionTypes, useOptions, useCancelableRequest } = options;
18
18
  this.logger.info('Recording of service files begins');
19
19
  for (const service of services) {
20
- const file = (0, path_1.resolve)(outputPaths.outputServices, `${service.name}.ts`);
20
+ const file = (0, pathHelpers_1.resolveHelper)(outputPaths.outputServices, `${service.name}.ts`);
21
21
  this.logger.info(`The recording of the file data begins: ${file}`);
22
22
  const templateResult = templates.exports.service({
23
23
  ...service,
@@ -29,7 +29,7 @@ async function writeClientServices(options) {
29
29
  useCancelableRequest,
30
30
  });
31
31
  const formattedValue = await (0, format_1.format)(templateResult);
32
- await fileSystem_1.fileSystem.writeFile(file, formattedValue);
32
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile(file, formattedValue);
33
33
  this.logger.info(`File recording completed: ${file}`);
34
34
  }
35
35
  this.logger.info('Service file recording completed successfully');
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientServicesIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServicesIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcvF"}
1
+ {"version":3,"file":"writeClientServicesIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientServicesIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,UAAU,aAAa;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,iBAcvF"}
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientServicesIndex = writeClientServicesIndex;
4
- const path_1 = require("path");
4
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
5
  const appendUniqueLinesToFile_1 = require("./appendUniqueLinesToFile");
6
6
  async function writeClientServicesIndex(options) {
7
7
  const { services, templates, outputServices, useSeparatedIndexes } = options;
8
8
  if (!useSeparatedIndexes) {
9
9
  return;
10
10
  }
11
- const filePath = (0, path_1.resolve)(outputServices, 'index.ts');
11
+ const filePath = (0, pathHelpers_1.resolveHelper)(outputServices, 'index.ts');
12
12
  this.logger.info(`Data has been written to a file: ${filePath}`);
13
13
  const content = templates.indexes.services({ services });
14
14
  await (0, appendUniqueLinesToFile_1.appendUniqueLinesToFile)(filePath, content);
@@ -1 +1 @@
1
- {"version":3,"file":"writeClientSimpleIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSimpleIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7G"}
1
+ {"version":3,"file":"writeClientSimpleIndex.d.ts","sourceRoot":"","sources":["../../../src/core/utils/writeClientSimpleIndex.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG7C;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7G"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeClientSimpleIndex = writeClientSimpleIndex;
4
- const path_1 = require("path");
5
- const fileSystem_1 = require("./fileSystem");
4
+ const pathHelpers_1 = require("../../common/utils/pathHelpers");
5
+ const fileSystemHelpers_1 = require("../../common/utils/fileSystemHelpers");
6
6
  /**
7
7
  * Generate the OpenAPI client index file using the Handlebar template and write it to disk.
8
8
  * The index file just contains all the exports you need to use the client as a standalone
@@ -10,9 +10,9 @@ const fileSystem_1 = require("./fileSystem");
10
10
  */
11
11
  async function writeClientSimpleIndex(options) {
12
12
  const { templates, outputPath, core, models, schemas, services } = options;
13
- const resolvePathIndex = (0, path_1.resolve)(outputPath, 'index.ts');
13
+ const resolvePathIndex = (0, pathHelpers_1.resolveHelper)(outputPath, 'index.ts');
14
14
  this.logger.info(`The recording of the file data begins: ${resolvePathIndex}`);
15
- await fileSystem_1.fileSystem.writeFile(resolvePathIndex, templates.indexes.simple({
15
+ await fileSystemHelpers_1.fileSystemHelpers.writeFile(resolvePathIndex, templates.indexes.simple({
16
16
  core,
17
17
  models,
18
18
  schemas,
@@ -16,17 +16,17 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
16
16
  return "\n"
17
17
  + ((stack1 = lookupProperty(helpers, "each").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "imports"), { "name": "each", "hash": {}, "fn": container.program(2, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 7, "column": 9 } } })) != null ? stack1 : "");
18
18
  }, "2": function (container, depth0, helpers, partials, data) {
19
- var stack1, alias1 = container.strict, alias2 = container.lambda, lookupProperty = container.lookupProperty || function (parent, propertyName) {
19
+ var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty = container.lookupProperty || function (parent, propertyName) {
20
20
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
21
21
  return parent[propertyName];
22
22
  }
23
23
  return undefined;
24
24
  };
25
25
  return "import type { "
26
- + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 6, "column": 17 }, "end": { "line": 6, "column": 21 } }), depth0)) != null ? stack1 : "")
27
- + ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "alias"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 6, "column": 24 }, "end": { "line": 6, "column": 59 } } })) != null ? stack1 : "")
26
+ + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 6, "column": 17 }, "end": { "line": 6, "column": 21 } }), depth0)) != null ? stack1 : "")
27
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "alias"), { "name": "if", "hash": {}, "fn": container.program(3, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 6, "column": 24 }, "end": { "line": 6, "column": 59 } } })) != null ? stack1 : "")
28
28
  + " } from '"
29
- + ((stack1 = alias2(alias1(depth0, "path", { "start": { "line": 6, "column": 71 }, "end": { "line": 6, "column": 75 } }), depth0)) != null ? stack1 : "")
29
+ + ((stack1 = lookupProperty(helpers, "normalizePath").call(alias1, lookupProperty(depth0, "path"), { "name": "normalizePath", "hash": {}, "data": data, "loc": { "start": { "line": 6, "column": 68 }, "end": { "line": 6, "column": 92 } } })) != null ? stack1 : "")
30
30
  + "';\n";
31
31
  }, "3": function (container, depth0, helpers, partials, data) {
32
32
  var stack1;
@@ -1 +1 @@
1
- {"version":3,"file":"exportService.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/client/exportService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAsNoD"}
1
+ {"version":3,"file":"exportService.d.ts","sourceRoot":"","sources":["../../../src/templatesCompiled/client/exportService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAqNoD"}