@nestia/migrate 12.0.0-rc.3 → 12.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 (317) hide show
  1. package/lib/NestiaMigrateApplication.js +9 -44
  2. package/lib/NestiaMigrateApplication.js.map +1 -1
  3. package/lib/NestiaMigrateApplication.mjs +90 -3
  4. package/lib/NestiaMigrateApplication.mjs.map +1 -1
  5. package/lib/_virtual/_rolldown/runtime.mjs +13 -0
  6. package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +45 -3
  7. package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs.map +1 -1
  8. package/lib/archivers/NestiaMigrateFileArchiver.js +4 -0
  9. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  10. package/lib/archivers/NestiaMigrateFileArchiver.mjs +25 -3
  11. package/lib/archivers/NestiaMigrateFileArchiver.mjs.map +1 -1
  12. package/lib/bundles/NEST_TEMPLATE.js +47 -44
  13. package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
  14. package/lib/bundles/NEST_TEMPLATE.mjs +59 -3
  15. package/lib/bundles/NEST_TEMPLATE.mjs.map +1 -1
  16. package/lib/bundles/SDK_TEMPLATE.js +7 -8
  17. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  18. package/lib/bundles/SDK_TEMPLATE.mjs +27 -3
  19. package/lib/bundles/SDK_TEMPLATE.mjs.map +1 -1
  20. package/lib/executable/NestiaMigrateCommander.mjs +80 -3
  21. package/lib/executable/NestiaMigrateCommander.mjs.map +1 -1
  22. package/lib/executable/NestiaMigrateInquirer.mjs +59 -3
  23. package/lib/executable/NestiaMigrateInquirer.mjs.map +1 -1
  24. package/lib/executable/migrate.mjs +9 -3
  25. package/lib/executable/migrate.mjs.map +1 -1
  26. package/lib/factories/ExpressionFactory.mjs +10 -3
  27. package/lib/factories/ExpressionFactory.mjs.map +1 -1
  28. package/lib/factories/FormatCheatSheet.mjs +31 -3
  29. package/lib/factories/FormatCheatSheet.mjs.map +1 -1
  30. package/lib/factories/IdentifierFactory.mjs +22 -3
  31. package/lib/factories/IdentifierFactory.mjs.map +1 -1
  32. package/lib/factories/LiteralFactory.mjs +31 -3
  33. package/lib/factories/LiteralFactory.mjs.map +1 -1
  34. package/lib/factories/StatementFactory.mjs +12 -3
  35. package/lib/factories/StatementFactory.mjs.map +1 -1
  36. package/lib/factories/TypeFactory.mjs +21 -3
  37. package/lib/factories/TypeFactory.mjs.map +1 -1
  38. package/lib/factories/TypeLiteralFactory.js +2 -37
  39. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  40. package/lib/factories/TypeLiteralFactory.mjs +17 -3
  41. package/lib/factories/TypeLiteralFactory.mjs.map +1 -1
  42. package/lib/index.mjs +24 -2
  43. package/lib/index.mjs.map +1 -1
  44. package/lib/internal/ts.mjs +6 -2
  45. package/lib/internal/ts.mjs.map +1 -1
  46. package/lib/module.mjs +43 -2
  47. package/lib/module.mjs.map +1 -1
  48. package/lib/programmers/NestiaMigrateApiFileProgrammer.mjs +36 -3
  49. package/lib/programmers/NestiaMigrateApiFileProgrammer.mjs.map +1 -1
  50. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +2 -37
  51. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  52. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs +106 -3
  53. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs.map +1 -1
  54. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs +139 -3
  55. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs.map +1 -1
  56. package/lib/programmers/NestiaMigrateApiProgrammer.js +1 -1
  57. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  58. package/lib/programmers/NestiaMigrateApiProgrammer.mjs +71 -3
  59. package/lib/programmers/NestiaMigrateApiProgrammer.mjs.map +1 -1
  60. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs +102 -3
  61. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs.map +1 -1
  62. package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +50 -3
  63. package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs.map +1 -1
  64. package/lib/programmers/NestiaMigrateDtoProgrammer.mjs +53 -3
  65. package/lib/programmers/NestiaMigrateDtoProgrammer.mjs.map +1 -1
  66. package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs +58 -3
  67. package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs.map +1 -1
  68. package/lib/programmers/NestiaMigrateE2eProgrammer.js +11 -4
  69. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  70. package/lib/programmers/NestiaMigrateE2eProgrammer.mjs +35 -3
  71. package/lib/programmers/NestiaMigrateE2eProgrammer.mjs.map +1 -1
  72. package/lib/programmers/NestiaMigrateImportProgrammer.js +12 -5
  73. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  74. package/lib/programmers/NestiaMigrateImportProgrammer.mjs +50 -3
  75. package/lib/programmers/NestiaMigrateImportProgrammer.mjs.map +1 -1
  76. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +4 -3
  77. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  78. package/lib/programmers/NestiaMigrateNestControllerProgrammer.mjs +31 -3
  79. package/lib/programmers/NestiaMigrateNestControllerProgrammer.mjs.map +1 -1
  80. package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs +128 -3
  81. package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs.map +1 -1
  82. package/lib/programmers/NestiaMigrateNestModuleProgrammer.mjs +18 -3
  83. package/lib/programmers/NestiaMigrateNestModuleProgrammer.mjs.map +1 -1
  84. package/lib/programmers/NestiaMigrateNestProgrammer.js +25 -4
  85. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  86. package/lib/programmers/NestiaMigrateNestProgrammer.mjs +60 -3
  87. package/lib/programmers/NestiaMigrateNestProgrammer.mjs.map +1 -1
  88. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +14 -49
  89. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  90. package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +199 -3
  91. package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs.map +1 -1
  92. package/lib/programmers/index.mjs +16 -2
  93. package/lib/structures/INestiaMigrateConfig.mjs +0 -3
  94. package/lib/structures/INestiaMigrateContext.mjs +0 -3
  95. package/lib/structures/INestiaMigrateController.mjs +0 -3
  96. package/lib/structures/INestiaMigrateFile.mjs +0 -3
  97. package/lib/structures/index.mjs +0 -2
  98. package/lib/utils/FilePrinter.mjs +20 -3
  99. package/lib/utils/FilePrinter.mjs.map +1 -1
  100. package/lib/utils/MapUtil.mjs +15 -3
  101. package/lib/utils/MapUtil.mjs.map +1 -1
  102. package/lib/utils/StringUtil.mjs +100 -3
  103. package/lib/utils/StringUtil.mjs.map +1 -1
  104. package/package.json +10 -14
  105. package/src/NestiaMigrateApplication.ts +8 -12
  106. package/src/archivers/NestiaMigrateFileArchiver.ts +4 -0
  107. package/src/bundles/NEST_TEMPLATE.ts +47 -44
  108. package/src/bundles/SDK_TEMPLATE.ts +7 -8
  109. package/src/executable/bundle.js +95 -23
  110. package/src/factories/TypeLiteralFactory.ts +1 -4
  111. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +1 -4
  112. package/src/programmers/NestiaMigrateApiProgrammer.ts +1 -1
  113. package/src/programmers/NestiaMigrateE2eProgrammer.ts +19 -5
  114. package/src/programmers/NestiaMigrateImportProgrammer.ts +21 -13
  115. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +4 -8
  116. package/src/programmers/NestiaMigrateNestProgrammer.ts +28 -7
  117. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +1 -4
  118. package/lib/NestiaMigrateApplication2.mjs +0 -153
  119. package/lib/NestiaMigrateApplication2.mjs.map +0 -1
  120. package/lib/_virtual/ExpressionFactory.mjs +0 -4
  121. package/lib/_virtual/ExpressionFactory.mjs.map +0 -1
  122. package/lib/_virtual/FilePrinter.mjs +0 -4
  123. package/lib/_virtual/FilePrinter.mjs.map +0 -1
  124. package/lib/_virtual/FormatCheatSheet.mjs +0 -4
  125. package/lib/_virtual/FormatCheatSheet.mjs.map +0 -1
  126. package/lib/_virtual/INestiaMigrateConfig.mjs +0 -4
  127. package/lib/_virtual/INestiaMigrateConfig.mjs.map +0 -1
  128. package/lib/_virtual/INestiaMigrateContext.mjs +0 -4
  129. package/lib/_virtual/INestiaMigrateContext.mjs.map +0 -1
  130. package/lib/_virtual/INestiaMigrateController.mjs +0 -4
  131. package/lib/_virtual/INestiaMigrateController.mjs.map +0 -1
  132. package/lib/_virtual/INestiaMigrateFile.mjs +0 -4
  133. package/lib/_virtual/INestiaMigrateFile.mjs.map +0 -1
  134. package/lib/_virtual/IdentifierFactory.mjs +0 -4
  135. package/lib/_virtual/IdentifierFactory.mjs.map +0 -1
  136. package/lib/_virtual/LiteralFactory.mjs +0 -4
  137. package/lib/_virtual/LiteralFactory.mjs.map +0 -1
  138. package/lib/_virtual/MapUtil.mjs +0 -4
  139. package/lib/_virtual/MapUtil.mjs.map +0 -1
  140. package/lib/_virtual/NEST_TEMPLATE.mjs +0 -4
  141. package/lib/_virtual/NEST_TEMPLATE.mjs.map +0 -1
  142. package/lib/_virtual/NestiaMigrateApiFileProgrammer.mjs +0 -4
  143. package/lib/_virtual/NestiaMigrateApiFileProgrammer.mjs.map +0 -1
  144. package/lib/_virtual/NestiaMigrateApiFunctionProgrammer.mjs +0 -4
  145. package/lib/_virtual/NestiaMigrateApiFunctionProgrammer.mjs.map +0 -1
  146. package/lib/_virtual/NestiaMigrateApiNamespaceProgrammer.mjs +0 -4
  147. package/lib/_virtual/NestiaMigrateApiNamespaceProgrammer.mjs.map +0 -1
  148. package/lib/_virtual/NestiaMigrateApiProgrammer.mjs +0 -4
  149. package/lib/_virtual/NestiaMigrateApiProgrammer.mjs.map +0 -1
  150. package/lib/_virtual/NestiaMigrateApiSimulationProgrammer.mjs +0 -4
  151. package/lib/_virtual/NestiaMigrateApiSimulationProgrammer.mjs.map +0 -1
  152. package/lib/_virtual/NestiaMigrateApiStartProgrammer.mjs +0 -4
  153. package/lib/_virtual/NestiaMigrateApiStartProgrammer.mjs.map +0 -1
  154. package/lib/_virtual/NestiaMigrateApplication.mjs +0 -4
  155. package/lib/_virtual/NestiaMigrateApplication.mjs.map +0 -1
  156. package/lib/_virtual/NestiaMigrateCommander.mjs +0 -4
  157. package/lib/_virtual/NestiaMigrateCommander.mjs.map +0 -1
  158. package/lib/_virtual/NestiaMigrateControllerAnalyzer.mjs +0 -4
  159. package/lib/_virtual/NestiaMigrateControllerAnalyzer.mjs.map +0 -1
  160. package/lib/_virtual/NestiaMigrateDtoProgrammer.mjs +0 -4
  161. package/lib/_virtual/NestiaMigrateDtoProgrammer.mjs.map +0 -1
  162. package/lib/_virtual/NestiaMigrateE2eFileProgrammer.mjs +0 -4
  163. package/lib/_virtual/NestiaMigrateE2eFileProgrammer.mjs.map +0 -1
  164. package/lib/_virtual/NestiaMigrateE2eProgrammer.mjs +0 -4
  165. package/lib/_virtual/NestiaMigrateE2eProgrammer.mjs.map +0 -1
  166. package/lib/_virtual/NestiaMigrateFileArchiver.mjs +0 -4
  167. package/lib/_virtual/NestiaMigrateFileArchiver.mjs.map +0 -1
  168. package/lib/_virtual/NestiaMigrateImportProgrammer.mjs +0 -4
  169. package/lib/_virtual/NestiaMigrateImportProgrammer.mjs.map +0 -1
  170. package/lib/_virtual/NestiaMigrateInquirer.mjs +0 -4
  171. package/lib/_virtual/NestiaMigrateInquirer.mjs.map +0 -1
  172. package/lib/_virtual/NestiaMigrateNestControllerProgrammer.mjs +0 -4
  173. package/lib/_virtual/NestiaMigrateNestControllerProgrammer.mjs.map +0 -1
  174. package/lib/_virtual/NestiaMigrateNestMethodProgrammer.mjs +0 -4
  175. package/lib/_virtual/NestiaMigrateNestMethodProgrammer.mjs.map +0 -1
  176. package/lib/_virtual/NestiaMigrateNestModuleProgrammer.mjs +0 -4
  177. package/lib/_virtual/NestiaMigrateNestModuleProgrammer.mjs.map +0 -1
  178. package/lib/_virtual/NestiaMigrateNestProgrammer.mjs +0 -4
  179. package/lib/_virtual/NestiaMigrateNestProgrammer.mjs.map +0 -1
  180. package/lib/_virtual/NestiaMigrateSchemaProgrammer.mjs +0 -4
  181. package/lib/_virtual/NestiaMigrateSchemaProgrammer.mjs.map +0 -1
  182. package/lib/_virtual/SDK_TEMPLATE.mjs +0 -4
  183. package/lib/_virtual/SDK_TEMPLATE.mjs.map +0 -1
  184. package/lib/_virtual/StatementFactory.mjs +0 -4
  185. package/lib/_virtual/StatementFactory.mjs.map +0 -1
  186. package/lib/_virtual/StringUtil.mjs +0 -4
  187. package/lib/_virtual/StringUtil.mjs.map +0 -1
  188. package/lib/_virtual/TypeFactory.mjs +0 -4
  189. package/lib/_virtual/TypeFactory.mjs.map +0 -1
  190. package/lib/_virtual/TypeLiteralFactory.mjs +0 -4
  191. package/lib/_virtual/TypeLiteralFactory.mjs.map +0 -1
  192. package/lib/_virtual/_commander.mjs +0 -7
  193. package/lib/_virtual/_commander.mjs.map +0 -1
  194. package/lib/_virtual/_commonjsHelpers.mjs +0 -35
  195. package/lib/_virtual/_commonjsHelpers.mjs.map +0 -1
  196. package/lib/_virtual/_inquirer.mjs +0 -7
  197. package/lib/_virtual/_inquirer.mjs.map +0 -1
  198. package/lib/_virtual/_node_child_process.mjs +0 -7
  199. package/lib/_virtual/_node_child_process.mjs.map +0 -1
  200. package/lib/_virtual/_node_fs.mjs +0 -7
  201. package/lib/_virtual/_node_fs.mjs.map +0 -1
  202. package/lib/_virtual/_node_path.mjs +0 -7
  203. package/lib/_virtual/_node_path.mjs.map +0 -1
  204. package/lib/_virtual/_prettier-plugin-jsdoc.mjs +0 -7
  205. package/lib/_virtual/_prettier-plugin-jsdoc.mjs.map +0 -1
  206. package/lib/_virtual/_prettier.mjs +0 -7
  207. package/lib/_virtual/_prettier.mjs.map +0 -1
  208. package/lib/_virtual/_tstl.mjs +0 -7
  209. package/lib/_virtual/_tstl.mjs.map +0 -1
  210. package/lib/_virtual/factory.mjs +0 -7
  211. package/lib/_virtual/factory.mjs.map +0 -1
  212. package/lib/_virtual/index.mjs +0 -4
  213. package/lib/_virtual/index.mjs.map +0 -1
  214. package/lib/_virtual/index2.mjs +0 -4
  215. package/lib/_virtual/index2.mjs.map +0 -1
  216. package/lib/_virtual/index3.mjs +0 -4
  217. package/lib/_virtual/index3.mjs.map +0 -1
  218. package/lib/_virtual/index4.mjs +0 -4
  219. package/lib/_virtual/index4.mjs.map +0 -1
  220. package/lib/_virtual/migrate.mjs +0 -4
  221. package/lib/_virtual/migrate.mjs.map +0 -1
  222. package/lib/_virtual/module.mjs +0 -4
  223. package/lib/_virtual/module.mjs.map +0 -1
  224. package/lib/_virtual/prettier-plugin-sort-imports.mjs +0 -7
  225. package/lib/_virtual/prettier-plugin-sort-imports.mjs.map +0 -1
  226. package/lib/_virtual/ts.mjs +0 -4
  227. package/lib/_virtual/ts.mjs.map +0 -1
  228. package/lib/_virtual/utils.mjs +0 -7
  229. package/lib/_virtual/utils.mjs.map +0 -1
  230. package/lib/analyzers/NestiaMigrateControllerAnalyzer2.mjs +0 -53
  231. package/lib/analyzers/NestiaMigrateControllerAnalyzer2.mjs.map +0 -1
  232. package/lib/archivers/NestiaMigrateFileArchiver2.mjs +0 -40
  233. package/lib/archivers/NestiaMigrateFileArchiver2.mjs.map +0 -1
  234. package/lib/bundles/NEST_TEMPLATE2.mjs +0 -66
  235. package/lib/bundles/NEST_TEMPLATE2.mjs.map +0 -1
  236. package/lib/bundles/SDK_TEMPLATE2.mjs +0 -38
  237. package/lib/bundles/SDK_TEMPLATE2.mjs.map +0 -1
  238. package/lib/executable/NestiaMigrateCommander2.mjs +0 -148
  239. package/lib/executable/NestiaMigrateCommander2.mjs.map +0 -1
  240. package/lib/executable/NestiaMigrateInquirer2.mjs +0 -93
  241. package/lib/executable/NestiaMigrateInquirer2.mjs.map +0 -1
  242. package/lib/executable/migrate2.mjs +0 -13
  243. package/lib/executable/migrate2.mjs.map +0 -1
  244. package/lib/factories/ExpressionFactory2.mjs +0 -20
  245. package/lib/factories/ExpressionFactory2.mjs.map +0 -1
  246. package/lib/factories/FormatCheatSheet2.mjs +0 -37
  247. package/lib/factories/FormatCheatSheet2.mjs.map +0 -1
  248. package/lib/factories/IdentifierFactory2.mjs +0 -56
  249. package/lib/factories/IdentifierFactory2.mjs.map +0 -1
  250. package/lib/factories/LiteralFactory2.mjs +0 -56
  251. package/lib/factories/LiteralFactory2.mjs.map +0 -1
  252. package/lib/factories/StatementFactory2.mjs +0 -26
  253. package/lib/factories/StatementFactory2.mjs.map +0 -1
  254. package/lib/factories/TypeFactory2.mjs +0 -31
  255. package/lib/factories/TypeFactory2.mjs.map +0 -1
  256. package/lib/factories/TypeLiteralFactory2.mjs +0 -72
  257. package/lib/factories/TypeLiteralFactory2.mjs.map +0 -1
  258. package/lib/index2.mjs +0 -53
  259. package/lib/index2.mjs.map +0 -1
  260. package/lib/internal/ts2.mjs +0 -10
  261. package/lib/internal/ts2.mjs.map +0 -1
  262. package/lib/module2.mjs +0 -38
  263. package/lib/module2.mjs.map +0 -1
  264. package/lib/programmers/NestiaMigrateApiFileProgrammer2.mjs +0 -49
  265. package/lib/programmers/NestiaMigrateApiFileProgrammer2.mjs.map +0 -1
  266. package/lib/programmers/NestiaMigrateApiFunctionProgrammer2.mjs +0 -234
  267. package/lib/programmers/NestiaMigrateApiFunctionProgrammer2.mjs.map +0 -1
  268. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer2.mjs +0 -238
  269. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer2.mjs.map +0 -1
  270. package/lib/programmers/NestiaMigrateApiProgrammer2.mjs +0 -92
  271. package/lib/programmers/NestiaMigrateApiProgrammer2.mjs.map +0 -1
  272. package/lib/programmers/NestiaMigrateApiSimulationProgrammer2.mjs +0 -156
  273. package/lib/programmers/NestiaMigrateApiSimulationProgrammer2.mjs.map +0 -1
  274. package/lib/programmers/NestiaMigrateApiStartProgrammer2.mjs +0 -88
  275. package/lib/programmers/NestiaMigrateApiStartProgrammer2.mjs.map +0 -1
  276. package/lib/programmers/NestiaMigrateDtoProgrammer2.mjs +0 -90
  277. package/lib/programmers/NestiaMigrateDtoProgrammer2.mjs.map +0 -1
  278. package/lib/programmers/NestiaMigrateE2eFileProgrammer2.mjs +0 -88
  279. package/lib/programmers/NestiaMigrateE2eFileProgrammer2.mjs.map +0 -1
  280. package/lib/programmers/NestiaMigrateE2eProgrammer2.mjs +0 -41
  281. package/lib/programmers/NestiaMigrateE2eProgrammer2.mjs.map +0 -1
  282. package/lib/programmers/NestiaMigrateImportProgrammer2.mjs +0 -72
  283. package/lib/programmers/NestiaMigrateImportProgrammer2.mjs.map +0 -1
  284. package/lib/programmers/NestiaMigrateNestControllerProgrammer2.mjs +0 -52
  285. package/lib/programmers/NestiaMigrateNestControllerProgrammer2.mjs.map +0 -1
  286. package/lib/programmers/NestiaMigrateNestMethodProgrammer2.mjs +0 -229
  287. package/lib/programmers/NestiaMigrateNestMethodProgrammer2.mjs.map +0 -1
  288. package/lib/programmers/NestiaMigrateNestModuleProgrammer2.mjs +0 -32
  289. package/lib/programmers/NestiaMigrateNestModuleProgrammer2.mjs.map +0 -1
  290. package/lib/programmers/NestiaMigrateNestProgrammer2.mjs +0 -78
  291. package/lib/programmers/NestiaMigrateNestProgrammer2.mjs.map +0 -1
  292. package/lib/programmers/NestiaMigrateSchemaProgrammer2.mjs +0 -388
  293. package/lib/programmers/NestiaMigrateSchemaProgrammer2.mjs.map +0 -1
  294. package/lib/programmers/index.mjs.map +0 -1
  295. package/lib/programmers/index2.mjs +0 -71
  296. package/lib/programmers/index2.mjs.map +0 -1
  297. package/lib/structures/INestiaMigrateConfig.mjs.map +0 -1
  298. package/lib/structures/INestiaMigrateConfig2.mjs +0 -6
  299. package/lib/structures/INestiaMigrateConfig2.mjs.map +0 -1
  300. package/lib/structures/INestiaMigrateContext.mjs.map +0 -1
  301. package/lib/structures/INestiaMigrateContext2.mjs +0 -6
  302. package/lib/structures/INestiaMigrateContext2.mjs.map +0 -1
  303. package/lib/structures/INestiaMigrateController.mjs.map +0 -1
  304. package/lib/structures/INestiaMigrateController2.mjs +0 -6
  305. package/lib/structures/INestiaMigrateController2.mjs.map +0 -1
  306. package/lib/structures/INestiaMigrateFile.mjs.map +0 -1
  307. package/lib/structures/INestiaMigrateFile2.mjs +0 -6
  308. package/lib/structures/INestiaMigrateFile2.mjs.map +0 -1
  309. package/lib/structures/index.mjs.map +0 -1
  310. package/lib/structures/index2.mjs +0 -38
  311. package/lib/structures/index2.mjs.map +0 -1
  312. package/lib/utils/FilePrinter2.mjs +0 -28
  313. package/lib/utils/FilePrinter2.mjs.map +0 -1
  314. package/lib/utils/MapUtil2.mjs +0 -18
  315. package/lib/utils/MapUtil2.mjs.map +0 -1
  316. package/lib/utils/StringUtil2.mjs +0 -110
  317. package/lib/utils/StringUtil2.mjs.map +0 -1
@@ -1,3 +1,139 @@
1
- export { NestiaMigrateApiNamespaceProgrammer } from './NestiaMigrateApiNamespaceProgrammer2.mjs';
2
- export { __exports as default } from '../_virtual/NestiaMigrateApiNamespaceProgrammer.mjs';
3
- //# sourceMappingURL=NestiaMigrateApiNamespaceProgrammer.mjs.map
1
+ import { FilePrinter } from "../utils/FilePrinter.mjs";
2
+ import { TypeFactory } from "../factories/TypeFactory.mjs";
3
+ import { IdentifierFactory } from "../factories/IdentifierFactory.mjs";
4
+ import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer.mjs";
5
+ import { ExpressionFactory } from "../factories/ExpressionFactory.mjs";
6
+ import { LiteralFactory } from "../factories/LiteralFactory.mjs";
7
+ import { NestiaMigrateApiSimulationProgrammer } from "./NestiaMigrateApiSimulationProgrammer.mjs";
8
+ import { NodeFlags, SyntaxKind, factory } from "@ttsc/factory";
9
+ //#region src/programmers/NestiaMigrateApiNamespaceProgrammer.ts
10
+ let NestiaMigrateApiNamespaceProgrammer;
11
+ (function(_NestiaMigrateApiNamespaceProgrammer) {
12
+ _NestiaMigrateApiNamespaceProgrammer.write = (ctx) => {
13
+ const types = writeTypes(ctx);
14
+ return factory.createModuleDeclaration([factory.createToken(SyntaxKind.ExportKeyword)], factory.createIdentifier(ctx.route.accessor.at(-1)), factory.createModuleBlock([
15
+ ...types,
16
+ ...types.length ? [FilePrinter.newLine()] : [],
17
+ writeMetadata(ctx),
18
+ FilePrinter.newLine(),
19
+ writePathFunction(ctx),
20
+ ...ctx.config.simulate === true ? [NestiaMigrateApiSimulationProgrammer.random(ctx), NestiaMigrateApiSimulationProgrammer.simulate(ctx)] : []
21
+ ]), NodeFlags.Namespace);
22
+ };
23
+ _NestiaMigrateApiNamespaceProgrammer.writePathCallExpression = (config, route) => factory.createCallExpression(factory.createIdentifier(`${route.accessor.at(-1)}.path`), void 0, route.parameters.length === 0 && route.query === null ? [] : config.keyword === true ? [factory.createIdentifier("props")] : [...route.parameters, ...route.query ? [route.query] : []].map((p) => factory.createIdentifier(p.key)));
24
+ const writeTypes = (ctx) => {
25
+ const array = [];
26
+ const declare = (name, type) => array.push(factory.createTypeAliasDeclaration([factory.createModifier(SyntaxKind.ExportKeyword)], name, void 0, type));
27
+ if (ctx.config.keyword === true && (ctx.route.parameters.length > 0 || ctx.route.query || ctx.route.body)) declare("Props", NestiaMigrateSchemaProgrammer.write({
28
+ components: ctx.components,
29
+ importer: ctx.importer,
30
+ schema: {
31
+ type: "object",
32
+ properties: Object.fromEntries([
33
+ ...ctx.route.parameters.map((p) => [p.key, {
34
+ ...p.schema,
35
+ description: p.parameter().description
36
+ }]),
37
+ ...ctx.route.query ? [[ctx.route.query.key, {
38
+ ...ctx.route.query.schema,
39
+ title: ctx.route.query.title(),
40
+ description: ctx.route.query.description()
41
+ }]] : [],
42
+ ...ctx.route.body ? [[ctx.route.body.key, {
43
+ ...ctx.route.body.schema,
44
+ description: ctx.route.body.description()
45
+ }]] : []
46
+ ]),
47
+ required: [
48
+ ...ctx.route.parameters.map((p) => p.key),
49
+ ...ctx.route.query ? [ctx.route.query.key] : [],
50
+ ...ctx.route.body ? [ctx.route.body.key] : []
51
+ ]
52
+ }
53
+ }));
54
+ if (ctx.route.headers) declare("Headers", NestiaMigrateSchemaProgrammer.write({
55
+ components: ctx.components,
56
+ importer: ctx.importer,
57
+ schema: ctx.route.headers.schema
58
+ }));
59
+ if (ctx.route.query) declare("Query", NestiaMigrateSchemaProgrammer.write({
60
+ components: ctx.components,
61
+ importer: ctx.importer,
62
+ schema: ctx.route.query.schema
63
+ }));
64
+ if (ctx.route.body) declare("Body", NestiaMigrateSchemaProgrammer.write({
65
+ components: ctx.components,
66
+ importer: ctx.importer,
67
+ schema: ctx.route.body.schema
68
+ }));
69
+ if (ctx.route.success) declare("Response", NestiaMigrateSchemaProgrammer.write({
70
+ components: ctx.components,
71
+ importer: ctx.importer,
72
+ schema: ctx.route.success.schema
73
+ }));
74
+ return array;
75
+ };
76
+ const writeMetadata = (ctx) => constant("METADATA", factory.createAsExpression(factory.createObjectLiteralExpression([
77
+ factory.createPropertyAssignment("method", factory.createStringLiteral(ctx.route.method.toUpperCase())),
78
+ factory.createPropertyAssignment("path", factory.createStringLiteral(getPath(ctx.route))),
79
+ factory.createPropertyAssignment("request", ctx.route.body ? LiteralFactory.write({
80
+ type: ctx.route.body.type,
81
+ encrypted: !!ctx.route.body["x-nestia-encrypted"]
82
+ }) : factory.createNull()),
83
+ factory.createPropertyAssignment("response", ctx.route.method.toUpperCase() !== "HEAD" ? LiteralFactory.write({
84
+ type: ctx.route.success?.type ?? "application/json",
85
+ encrypted: !!ctx.route.success?.["x-nestia-encrypted"]
86
+ }) : factory.createNull()),
87
+ ...ctx.route.success?.type === "application/x-www-form-urlencoded" ? [factory.createPropertyAssignment("parseQuery", factory.createCallExpression(factory.createIdentifier(`${ctx.importer.external({
88
+ type: "default",
89
+ library: "typia",
90
+ name: "typia"
91
+ })}.http.createAssertQuery`), [NestiaMigrateSchemaProgrammer.write({
92
+ components: ctx.components,
93
+ importer: ctx.importer,
94
+ schema: ctx.route.success.schema
95
+ })], void 0))] : []
96
+ ], true), factory.createTypeReferenceNode(factory.createIdentifier("const"))));
97
+ const writePathFunction = (ctx) => {
98
+ const empty = ctx.route.parameters.length === 0 && ctx.route.query === null;
99
+ const property = (key) => ctx.config.keyword === true ? IdentifierFactory.access(factory.createIdentifier("props"), key) : factory.createIdentifier(key);
100
+ const out = (body) => constant("path", factory.createArrowFunction([], [], empty ? [] : ctx.config.keyword === true ? [IdentifierFactory.parameter("props", ctx.route.body ? factory.createTypeReferenceNode("Omit", [factory.createTypeReferenceNode("Props"), factory.createLiteralTypeNode(factory.createStringLiteral(ctx.route.body.key))]) : factory.createTypeReferenceNode("Props"))] : [...ctx.route.parameters.map((p) => IdentifierFactory.parameter(p.key, NestiaMigrateSchemaProgrammer.write({
101
+ components: ctx.components,
102
+ importer: ctx.importer,
103
+ schema: p.schema
104
+ }))), ...ctx.route.query ? [IdentifierFactory.parameter(ctx.route.query.key, factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Query`))] : []], void 0, void 0, body));
105
+ const template = () => {
106
+ const path = getPath(ctx.route);
107
+ const split = path.split(":");
108
+ if (split.length === 1) return factory.createStringLiteral(path);
109
+ return factory.createTemplateExpression(factory.createTemplateHead(split[0]), split.slice(1).map((s, i, arr) => {
110
+ const name = s.split("/")[0];
111
+ return factory.createTemplateSpan(factory.createCallExpression(factory.createIdentifier("encodeURIComponent"), void 0, [factory.createBinaryExpression(property(ctx.route.parameters.find((p) => p.name === name).key), factory.createToken(SyntaxKind.QuestionQuestionToken), factory.createStringLiteral("null"))]), (i !== arr.length - 1 ? factory.createTemplateMiddle : factory.createTemplateTail)(s.substring(name.length)));
112
+ }));
113
+ };
114
+ if (!ctx.route.query) return out(template());
115
+ const computeName = (str) => ctx.route.parameters.find((p) => p.key === str) !== void 0 ? computeName("_" + str) : str;
116
+ const variables = computeName("variables");
117
+ return out(factory.createBlock([
118
+ local({
119
+ name: variables,
120
+ type: "URLSearchParams",
121
+ expression: factory.createNewExpression(factory.createIdentifier("URLSearchParams"), [], [])
122
+ }),
123
+ factory.createForOfStatement(void 0, factory.createVariableDeclarationList([factory.createVariableDeclaration(factory.createArrayBindingPattern([factory.createBindingElement(void 0, void 0, factory.createIdentifier("key"), void 0), factory.createBindingElement(void 0, void 0, factory.createIdentifier("value"), void 0)]), void 0, void 0, void 0)], NodeFlags.Const), factory.createCallExpression(factory.createIdentifier("Object.entries"), void 0, [factory.createAsExpression(property(ctx.route.query.key), TypeFactory.keyword("any"))]), factory.createIfStatement(factory.createStrictEquality(factory.createIdentifier("undefined"), factory.createIdentifier("value")), factory.createContinueStatement(), factory.createIfStatement(factory.createCallExpression(factory.createIdentifier("Array.isArray"), void 0, [factory.createIdentifier("value")]), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("value"), factory.createIdentifier("forEach")), void 0, [factory.createArrowFunction(void 0, void 0, [IdentifierFactory.parameter("elem")], void 0, void 0, factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(variables), "append"), void 0, [factory.createIdentifier("key"), factory.createCallExpression(factory.createIdentifier("String"), void 0, [factory.createIdentifier("elem")])]))])), factory.createExpressionStatement(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(variables), "set"), void 0, [factory.createIdentifier("key"), factory.createCallExpression(factory.createIdentifier("String"), void 0, [factory.createIdentifier("value")])]))))),
124
+ local({
125
+ name: "location",
126
+ type: "string",
127
+ expression: template()
128
+ }),
129
+ factory.createReturnStatement(factory.createConditionalExpression(factory.createStrictEquality(ExpressionFactory.number(0), IdentifierFactory.access(factory.createIdentifier(variables), "size")), void 0, factory.createIdentifier("location"), void 0, factory.createTemplateExpression(factory.createTemplateHead(""), [factory.createTemplateSpan(factory.createIdentifier("location"), factory.createTemplateMiddle("?")), factory.createTemplateSpan(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(variables), "toString"), void 0, void 0), factory.createTemplateTail(""))])))
130
+ ], true));
131
+ };
132
+ })(NestiaMigrateApiNamespaceProgrammer || (NestiaMigrateApiNamespaceProgrammer = {}));
133
+ const constant = (name, expression) => factory.createVariableStatement([factory.createModifier(SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([factory.createVariableDeclaration(name, void 0, void 0, expression)], NodeFlags.Const));
134
+ const getPath = (route) => (route.emendedPath.startsWith("/") ? "" : "/") + route.emendedPath;
135
+ const local = (props) => factory.createVariableStatement([], factory.createVariableDeclarationList([factory.createVariableDeclaration(props.name, void 0, factory.createTypeReferenceNode(props.type), props.expression)], NodeFlags.Const));
136
+ //#endregion
137
+ export { NestiaMigrateApiNamespaceProgrammer };
138
+
139
+ //# sourceMappingURL=NestiaMigrateApiNamespaceProgrammer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateApiNamespaceProgrammer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"NestiaMigrateApiNamespaceProgrammer.mjs","names":[],"sources":[],"mappings":""}
@@ -36,7 +36,7 @@ var NestiaMigrateApiProgrammer;
36
36
  }
37
37
  // DO GENERATE
38
38
  const files = Object.fromEntries(dict.toJSON().map(({ second: value }) => [
39
- `src/${ctx.mode === "nest" ? "api/" : ""}functional/${[...value.namespace, "index.ts"].join("/")}`,
39
+ `${ctx.mode === "nest" ? "packages/api/src" : "src"}/functional/${[...value.namespace, "index.ts"].join("/")}`,
40
40
  FilePrinter_1.FilePrinter.write({
41
41
  statements: NestiaMigrateApiFileProgrammer_1.NestiaMigrateApiFileProgrammer.write(Object.assign(Object.assign({}, value), { config: ctx.config, components: ctx.application.document().components })),
42
42
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateApiProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateApiProgr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iProgrammer.mjs';
3
- //# sourceMappingURL=NestiaMigrateApiProgrammer.mjs.map
1
+ import { FilePrinter } from "../utils/FilePrinter.mjs";
2
+ import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer.mjs";
3
+ import { NestiaMigrateApiFileProgrammer } from "./NestiaMigrateApiFileProgrammer.mjs";
4
+ import { NestiaMigrateDtoProgrammer } from "./NestiaMigrateDtoProgrammer.mjs";
5
+ import { NodeFlags, SyntaxKind, factory } from "@ttsc/factory";
6
+ import { HashMap, hash } from "tstl";
7
+ //#region src/programmers/NestiaMigrateApiProgrammer.ts
8
+ let NestiaMigrateApiProgrammer;
9
+ (function(_NestiaMigrateApiProgrammer) {
10
+ _NestiaMigrateApiProgrammer.write = (ctx) => {
11
+ const dict = new HashMap((x) => hash(x.join(".")), (x, y) => x.length === y.length && x.join(".") === y.join("."));
12
+ for (const route of ctx.application.routes) {
13
+ const namespace = route.accessor.slice(0, -1);
14
+ let last = dict.take(namespace, () => ({
15
+ config: ctx.config,
16
+ components: ctx.application.document().components,
17
+ namespace,
18
+ routes: [],
19
+ children: /* @__PURE__ */ new Set()
20
+ }));
21
+ last.routes.push(route);
22
+ namespace.forEach((_s, i, array) => {
23
+ const partial = namespace.slice(0, array.length - i - 1);
24
+ const props = dict.take(partial, () => ({
25
+ config: ctx.config,
26
+ components: ctx.application.document().components,
27
+ namespace: partial,
28
+ children: /* @__PURE__ */ new Set(),
29
+ routes: []
30
+ }));
31
+ props.children.add(last.namespace.at(-1));
32
+ last = props;
33
+ });
34
+ }
35
+ const files = Object.fromEntries(dict.toJSON().map(({ second: value }) => [`${ctx.mode === "nest" ? "packages/api/src" : "src"}/functional/${[...value.namespace, "index.ts"].join("/")}`, FilePrinter.write({ statements: NestiaMigrateApiFileProgrammer.write({
36
+ ...value,
37
+ config: ctx.config,
38
+ components: ctx.application.document().components
39
+ }) })]));
40
+ if (ctx.mode === "sdk") for (const [key, value] of NestiaMigrateDtoProgrammer.compose({
41
+ config: ctx.config,
42
+ components: ctx.application.document().components
43
+ }).entries()) files[`src/structures/${key}.ts`] = FilePrinter.write({ statements: writeDtoFile(key, value) });
44
+ return files;
45
+ };
46
+ const writeDtoFile = (key, modulo) => {
47
+ const importer = new NestiaMigrateImportProgrammer();
48
+ const statements = iterate(importer, modulo);
49
+ if (statements.length === 0) return [];
50
+ return [
51
+ ...importer.toStatements((name) => `./${name}`, key),
52
+ ...importer.empty() ? [] : [FilePrinter.newLine()],
53
+ ...statements
54
+ ];
55
+ };
56
+ const iterate = (importer, modulo) => {
57
+ const output = [];
58
+ if (modulo.programmer !== null) output.push(modulo.programmer(importer));
59
+ if (modulo.children.size !== 0) {
60
+ const internal = [];
61
+ for (const child of modulo.children.values()) internal.push(...iterate(importer, child));
62
+ output.push(factory.createModuleDeclaration([factory.createModifier(SyntaxKind.ExportKeyword)], factory.createIdentifier(modulo.name), factory.createModuleBlock(internal), NodeFlags.Namespace));
63
+ }
64
+ output.push(FilePrinter.newLine());
65
+ return output;
66
+ };
67
+ })(NestiaMigrateApiProgrammer || (NestiaMigrateApiProgrammer = {}));
68
+ //#endregion
69
+ export { NestiaMigrateApiProgrammer };
70
+
71
+ //# sourceMappingURL=NestiaMigrateApiProgrammer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateApiProgrammer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"NestiaMigrateApiProgrammer.mjs","names":[],"sources":[],"mappings":""}
@@ -1,3 +1,102 @@
1
- export { NestiaMigrateApiSimulationProgrammer } from './NestiaMigrateApiSimulationProgrammer2.mjs';
2
- export { __exports as default } from '../_virtual/NestiaMigrateApiSimulationProgrammer.mjs';
3
- //# sourceMappingURL=NestiaMigrateApiSimulationProgrammer.mjs.map
1
+ import { TypeFactory } from "../factories/TypeFactory.mjs";
2
+ import { IdentifierFactory } from "../factories/IdentifierFactory.mjs";
3
+ import { StatementFactory } from "../factories/StatementFactory.mjs";
4
+ import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer.mjs";
5
+ import { NestiaMigrateApiFunctionProgrammer } from "./NestiaMigrateApiFunctionProgrammer.mjs";
6
+ import { NestiaMigrateApiNamespaceProgrammer } from "./NestiaMigrateApiNamespaceProgrammer.mjs";
7
+ import { NodeFlags, SyntaxKind, factory } from "@ttsc/factory";
8
+ //#region src/programmers/NestiaMigrateApiSimulationProgrammer.ts
9
+ let NestiaMigrateApiSimulationProgrammer;
10
+ (function(_NestiaMigrateApiSimulationProgrammer) {
11
+ _NestiaMigrateApiSimulationProgrammer.random = (ctx) => {
12
+ const output = ctx.route.success ? NestiaMigrateSchemaProgrammer.write({
13
+ components: ctx.components,
14
+ importer: ctx.importer,
15
+ schema: ctx.route.success.schema
16
+ }) : TypeFactory.keyword("void");
17
+ return constant("random", factory.createArrowFunction(void 0, void 0, [], output, void 0, factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
18
+ type: "default",
19
+ library: "typia",
20
+ name: "typia"
21
+ })), "random"), [output], void 0)));
22
+ };
23
+ _NestiaMigrateApiSimulationProgrammer.simulate = (ctx) => {
24
+ const caller = () => factory.createCallExpression(factory.createIdentifier("random"), void 0, void 0);
25
+ return constant("simulate", factory.createArrowFunction(void 0, void 0, NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx, ctx.route.parameters.length === 0 && ctx.route.query === null && ctx.route.body === null ? "_connection" : void 0), factory.createTypeReferenceNode(ctx.route.success ? "Response" : "void"), void 0, factory.createBlock([...assert(ctx), factory.createReturnStatement(caller())], true)));
26
+ };
27
+ const assert = (ctx) => {
28
+ const property = (key) => ctx.config.keyword === true ? IdentifierFactory.access(factory.createIdentifier("props"), key) : factory.createIdentifier(key);
29
+ const parameters = [
30
+ ...ctx.route.parameters.map((p) => ({
31
+ category: "param",
32
+ name: p.key,
33
+ schema: NestiaMigrateSchemaProgrammer.write({
34
+ components: ctx.components,
35
+ importer: ctx.importer,
36
+ schema: p.schema
37
+ })
38
+ })),
39
+ ...ctx.route.query ? [{
40
+ category: "query",
41
+ name: ctx.route.query.key,
42
+ schema: NestiaMigrateSchemaProgrammer.write({
43
+ components: ctx.components,
44
+ importer: ctx.importer,
45
+ schema: ctx.route.query.schema
46
+ })
47
+ }] : [],
48
+ ...ctx.route.body ? [{
49
+ category: "body",
50
+ name: ctx.route.body.key,
51
+ schema: NestiaMigrateSchemaProgrammer.write({
52
+ components: ctx.components,
53
+ importer: ctx.importer,
54
+ schema: ctx.route.body.schema
55
+ })
56
+ }] : []
57
+ ];
58
+ if (parameters.length === 0) return [];
59
+ const validator = StatementFactory.constant({
60
+ name: "assert",
61
+ value: factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
62
+ type: "instance",
63
+ library: `@nestia/fetcher`,
64
+ name: "NestiaSimulator"
65
+ })), "assert"), void 0, [factory.createObjectLiteralExpression([
66
+ factory.createPropertyAssignment("method", factory.createIdentifier("METADATA.method")),
67
+ factory.createPropertyAssignment("host", factory.createIdentifier("connection.host")),
68
+ factory.createPropertyAssignment("path", NestiaMigrateApiNamespaceProgrammer.writePathCallExpression(ctx.config, ctx.route)),
69
+ factory.createPropertyAssignment("contentType", factory.createStringLiteral(ctx.route.success?.type ?? "application/json"))
70
+ ], true)])
71
+ });
72
+ const individual = parameters.map((p) => factory.createCallExpression((() => {
73
+ const base = IdentifierFactory.access(factory.createIdentifier("assert"), p.category);
74
+ if (p.category !== "param") return base;
75
+ return factory.createCallExpression(base, void 0, [factory.createStringLiteral(p.name)]);
76
+ })(), void 0, [factory.createArrowFunction(void 0, void 0, [], void 0, void 0, factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(ctx.importer.external({
77
+ type: "default",
78
+ library: "typia",
79
+ name: "typia"
80
+ })), "assert"), void 0, [p.category === "headers" ? factory.createIdentifier("connection.headers") : property(p.name)]))])).map(factory.createExpressionStatement);
81
+ return [validator, tryAndCatch(ctx.importer, individual)];
82
+ };
83
+ const tryAndCatch = (importer, individual) => factory.createTryStatement(factory.createBlock(individual, true), factory.createCatchClause("exp", factory.createBlock([factory.createIfStatement(factory.createLogicalNot(factory.createCallExpression(IdentifierFactory.access(factory.createIdentifier(importer.external({
84
+ type: "default",
85
+ library: "typia",
86
+ name: "typia"
87
+ })), "is"), [factory.createTypeReferenceNode(importer.external({
88
+ type: "instance",
89
+ library: "@nestia/fetcher",
90
+ name: "HttpError"
91
+ }))], [factory.createIdentifier("exp")])), factory.createThrowStatement(factory.createIdentifier("exp"))), factory.createReturnStatement(factory.createAsExpression(factory.createObjectLiteralExpression([
92
+ factory.createPropertyAssignment("success", factory.createFalse()),
93
+ factory.createPropertyAssignment("status", factory.createIdentifier("exp.status")),
94
+ factory.createPropertyAssignment("headers", factory.createIdentifier("exp.headers")),
95
+ factory.createPropertyAssignment("data", factory.createIdentifier("exp.toJSON().message"))
96
+ ], true), TypeFactory.keyword("any")))], true)), void 0);
97
+ })(NestiaMigrateApiSimulationProgrammer || (NestiaMigrateApiSimulationProgrammer = {}));
98
+ const constant = (name, expression) => factory.createVariableStatement([factory.createModifier(SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([factory.createVariableDeclaration(factory.createIdentifier(name), void 0, void 0, expression)], NodeFlags.Const));
99
+ //#endregion
100
+ export { NestiaMigrateApiSimulationProgrammer };
101
+
102
+ //# sourceMappingURL=NestiaMigrateApiSimulationProgrammer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateApiSimulationProgrammer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"NestiaMigrateApiSimulationProgrammer.mjs","names":[],"sources":[],"mappings":""}
@@ -1,3 +1,50 @@
1
- export { NestiaMigrateApiStartProgrammer } from './NestiaMigrateApiStartProgrammer2.mjs';
2
- export { __exports as default } from '../_virtual/NestiaMigrateApiStartProgrammer.mjs';
3
- //# sourceMappingURL=NestiaMigrateApiStartProgrammer.mjs.map
1
+ import { FilePrinter } from "../utils/FilePrinter.mjs";
2
+ import { IdentifierFactory } from "../factories/IdentifierFactory.mjs";
3
+ import { StatementFactory } from "../factories/StatementFactory.mjs";
4
+ import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer.mjs";
5
+ import { NestiaMigrateE2eFunctionProgrammer } from "./NestiaMigrateE2eFileProgrammer.mjs";
6
+ import { NodeFlags, SyntaxKind, factory } from "@ttsc/factory";
7
+ //#region src/programmers/NestiaMigrateApiStartProgrammer.ts
8
+ let NestiaMigrateApiStartProgrammer;
9
+ (function(_NestiaMigrateApiStartProgrammer) {
10
+ _NestiaMigrateApiStartProgrammer.write = (context) => {
11
+ const importer = new NestiaMigrateImportProgrammer();
12
+ const main = writeMain(context, importer, pick(context.application.routes));
13
+ const statements = [
14
+ ...importer.toStatements((name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`),
15
+ FilePrinter.newLine(),
16
+ factory.createImportDeclaration(void 0, factory.createImportClause(false, void 0, factory.createNamedImports([factory.createImportSpecifier(false, void 0, factory.createIdentifier("TestGlobal"))])), factory.createStringLiteral("./TestGlobal")),
17
+ FilePrinter.newLine(),
18
+ main,
19
+ factory.createExpressionStatement(writeStarter())
20
+ ];
21
+ return { "test/start.ts": FilePrinter.write({ statements }) };
22
+ };
23
+ const writeMain = (ctx, importer, route) => StatementFactory.constant({
24
+ name: "main",
25
+ value: factory.createArrowFunction([factory.createToken(SyntaxKind.AsyncKeyword)], void 0, [], void 0, void 0, factory.createBlock([writeConnection(ctx, importer), ...NestiaMigrateE2eFunctionProgrammer.writeBody({
26
+ config: ctx.config,
27
+ components: ctx.application.document().components,
28
+ importer,
29
+ route
30
+ })], true))
31
+ });
32
+ const writeConnection = (ctx, importer) => factory.createVariableStatement(void 0, factory.createVariableDeclarationList([factory.createVariableDeclaration("connection", void 0, factory.createTypeReferenceNode(factory.createQualifiedName(factory.createIdentifier(importer.external({
33
+ type: "default",
34
+ library: "@ORGANIZATION/PROJECT-api",
35
+ name: "api"
36
+ })), factory.createIdentifier("IConnection"))), factory.createObjectLiteralExpression([
37
+ factory.createSpreadAssignment(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("TestGlobal"), "connection"), void 0, void 0)),
38
+ ...ctx.application.document().servers?.[0]?.url?.length ? [factory.createPropertyAssignment("host", factory.createStringLiteral(ctx.application.document().servers[0].url))] : [],
39
+ ...ctx.config.simulate === true ? [factory.createPropertyAssignment("simulate", factory.createTrue())] : []
40
+ ], true))], NodeFlags.Const));
41
+ const writeStarter = () => factory.createCallExpression(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("main"), void 0, void 0), "catch"), void 0, [factory.createArrowFunction(void 0, void 0, [IdentifierFactory.parameter("exp")], void 0, void 0, factory.createBlock([factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("console"), "log"), void 0, [factory.createIdentifier("exp")])), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("process"), "exit"), void 0, [factory.createPrefixMinus(factory.createNumericLiteral("1"))]))], true))]);
42
+ })(NestiaMigrateApiStartProgrammer || (NestiaMigrateApiStartProgrammer = {}));
43
+ const pick = (array) => {
44
+ const rand = Math.random() * array.length;
45
+ return array[Math.min(array.length - 1, Math.floor(rand))];
46
+ };
47
+ //#endregion
48
+ export { NestiaMigrateApiStartProgrammer };
49
+
50
+ //# sourceMappingURL=NestiaMigrateApiStartProgrammer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateApiStartProgrammer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"NestiaMigrateApiStartProgrammer.mjs","names":[],"sources":[],"mappings":""}
@@ -1,3 +1,53 @@
1
- export { NestiaMigrateDtoProgrammer } from './NestiaMigrateDtoProgrammer2.mjs';
2
- export { __exports as default } from '../_virtual/NestiaMigrateDtoProgrammer.mjs';
3
- //# sourceMappingURL=NestiaMigrateDtoProgrammer.mjs.map
1
+ import { FilePrinter } from "../utils/FilePrinter.mjs";
2
+ import { StringUtil } from "../utils/StringUtil.mjs";
3
+ import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer.mjs";
4
+ import { MapUtil } from "../utils/MapUtil.mjs";
5
+ import { SyntaxKind, factory } from "@ttsc/factory";
6
+ //#region src/programmers/NestiaMigrateDtoProgrammer.ts
7
+ let NestiaMigrateDtoProgrammer;
8
+ (function(_NestiaMigrateDtoProgrammer) {
9
+ _NestiaMigrateDtoProgrammer.compose = (props) => {
10
+ const dict = /* @__PURE__ */ new Map();
11
+ for (const [key, value] of Object.entries(props.components.schemas ?? {})) {
12
+ const emendedKey = key.split("/").filter((str) => str.length !== 0).map(StringUtil.escapeNonVariable).join("");
13
+ prepare(dict)(emendedKey)((importer) => writeAlias(props.config)(props.components)(importer)(emendedKey, value));
14
+ }
15
+ return dict;
16
+ };
17
+ const prepare = (dict) => (name) => (programmer) => {
18
+ const accessors = name.split(".");
19
+ const modulo = { value: null };
20
+ accessors.forEach((acc, i) => {
21
+ modulo.value = MapUtil.take(dict)(acc)(() => ({
22
+ name: acc,
23
+ children: /* @__PURE__ */ new Map(),
24
+ programmer: null
25
+ }));
26
+ if (i === accessors.length - 1) modulo.value.programmer = programmer;
27
+ dict = modulo.value.children;
28
+ });
29
+ return modulo;
30
+ };
31
+ const writeAlias = (config) => (components) => (importer) => (key, value) => FilePrinter.description(factory.createTypeAliasDeclaration([factory.createToken(SyntaxKind.ExportKeyword)], key.split(".").at(-1), [], NestiaMigrateSchemaProgrammer.write({
32
+ components,
33
+ importer,
34
+ schema: value
35
+ })), writeComment(config)(value, key.indexOf(".") === -1));
36
+ })(NestiaMigrateDtoProgrammer || (NestiaMigrateDtoProgrammer = {}));
37
+ const writeComment = (config) => (schema, top) => {
38
+ const plugins = [];
39
+ for (const [key, value] of Object.entries(schema)) if (key.startsWith("x-") && isExtensionValue(value)) plugins.push(`@${key} ${String(value)}`);
40
+ return [
41
+ ...schema.description?.length ? [schema.description] : [],
42
+ ...schema.description?.length && (schema.title !== void 0 || schema.deprecated === true || plugins.length !== 0) ? [""] : [],
43
+ ...schema.title !== void 0 ? [`@title ${schema.title}`] : [],
44
+ ...schema.deprecated === true ? [`@deprecated`] : [],
45
+ ...plugins,
46
+ ...top ? [`@${config.author?.tag ?? "nestia"} ${config.author?.value ?? "Generated by Nestia - https://github.com/samchon/nestia"}`] : []
47
+ ].join("\n");
48
+ };
49
+ const isExtensionValue = (value) => typeof value === "boolean" || typeof value === "number" || typeof value === "string";
50
+ //#endregion
51
+ export { NestiaMigrateDtoProgrammer };
52
+
53
+ //# sourceMappingURL=NestiaMigrateDtoProgrammer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateDtoProgrammer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"NestiaMigrateDtoProgrammer.mjs","names":[],"sources":[],"mappings":""}
@@ -1,3 +1,58 @@
1
- export { NestiaMigrateE2eFunctionProgrammer } from './NestiaMigrateE2eFileProgrammer2.mjs';
2
- export { __exports as default } from '../_virtual/NestiaMigrateE2eFileProgrammer.mjs';
3
- //# sourceMappingURL=NestiaMigrateE2eFileProgrammer.mjs.map
1
+ import { IdentifierFactory } from "../factories/IdentifierFactory.mjs";
2
+ import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer.mjs";
3
+ import { LiteralFactory } from "../factories/LiteralFactory.mjs";
4
+ import { NodeFlags, SyntaxKind, factory } from "@ttsc/factory";
5
+ //#region src/programmers/NestiaMigrateE2eFileProgrammer.ts
6
+ let NestiaMigrateE2eFunctionProgrammer;
7
+ (function(_NestiaMigrateE2eFunctionProgrammer) {
8
+ _NestiaMigrateE2eFunctionProgrammer.write = (ctx) => factory.createFunctionDeclaration([factory.createModifier(SyntaxKind.ExportKeyword), factory.createModifier(SyntaxKind.AsyncKeyword)], void 0, [
9
+ "test",
10
+ "api",
11
+ ...ctx.route.accessor
12
+ ].join("_"), void 0, [IdentifierFactory.parameter("connection", factory.createTypeReferenceNode(factory.createQualifiedName(factory.createIdentifier(ctx.importer.external({
13
+ type: "default",
14
+ library: "@ORGANIZATION/PROJECT-api",
15
+ name: "api"
16
+ })), factory.createIdentifier("IConnection"))))], void 0, factory.createBlock(writeBody(ctx), true));
17
+ const writeBody = _NestiaMigrateE2eFunctionProgrammer.writeBody = (ctx) => [factory.createVariableStatement([], factory.createVariableDeclarationList([factory.createVariableDeclaration("output", void 0, ctx.route.success ? NestiaMigrateSchemaProgrammer.write({
18
+ components: ctx.components,
19
+ importer: ctx.importer,
20
+ schema: ctx.route.success.schema
21
+ }) : void 0, factory.createAwaitExpression(writeCallExpressionn(ctx)))], NodeFlags.Const)), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier(ctx.importer.external({
22
+ type: "default",
23
+ library: "typia",
24
+ name: "typia"
25
+ })), "assert"), void 0, [factory.createIdentifier("output")]))];
26
+ const writeCallExpressionn = (ctx) => {
27
+ const fetch = factory.createPropertyAccessExpression(factory.createIdentifier("api.functional"), factory.createIdentifier(ctx.route.accessor.join(".")));
28
+ const connection = factory.createIdentifier("connection");
29
+ if (ctx.route.parameters.length === 0 && ctx.route.query === null && ctx.route.body === null) return factory.createCallExpression(fetch, void 0, [connection]);
30
+ const random = factory.createPropertyAccessExpression(factory.createIdentifier(ctx.importer.external({
31
+ type: "default",
32
+ library: "typia",
33
+ name: "typia"
34
+ })), "random");
35
+ if (ctx.config.keyword === true) return factory.createCallExpression(fetch, void 0, [connection, LiteralFactory.write(Object.fromEntries([
36
+ ...ctx.route.parameters,
37
+ ctx.route.query,
38
+ ctx.route.body
39
+ ].filter((x) => x !== null).map(({ key, schema: value }) => [key, factory.createCallExpression(random, [NestiaMigrateSchemaProgrammer.write({
40
+ components: ctx.components,
41
+ importer: ctx.importer,
42
+ schema: value
43
+ })], void 0)])))]);
44
+ return factory.createCallExpression(fetch, void 0, [connection, ...[
45
+ ...ctx.route.parameters,
46
+ ctx.route.query,
47
+ ctx.route.body
48
+ ].filter((p) => !!p).map((p) => factory.createCallExpression(random, [NestiaMigrateSchemaProgrammer.write({
49
+ components: ctx.components,
50
+ importer: ctx.importer,
51
+ schema: p.schema
52
+ })], void 0))]);
53
+ };
54
+ })(NestiaMigrateE2eFunctionProgrammer || (NestiaMigrateE2eFunctionProgrammer = {}));
55
+ //#endregion
56
+ export { NestiaMigrateE2eFunctionProgrammer };
57
+
58
+ //# sourceMappingURL=NestiaMigrateE2eFileProgrammer.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateE2eFileProgrammer.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"NestiaMigrateE2eFileProgrammer.mjs","names":[],"sources":[],"mappings":""}
@@ -7,9 +7,9 @@ const NestiaMigrateImportProgrammer_1 = require("./NestiaMigrateImportProgrammer
7
7
  var NestiaMigrateE2eProgrammer;
8
8
  (function (NestiaMigrateE2eProgrammer) {
9
9
  NestiaMigrateE2eProgrammer.write = (ctx) => Object.fromEntries(ctx.application.routes
10
- .map((r) => writeFile(ctx.config, ctx.application.document().components, r))
10
+ .map((r) => writeFile(ctx.mode, ctx.config, ctx.application.document().components, r))
11
11
  .map((r) => [`${r.location}/${r.file}`, r.content]));
12
- const writeFile = (config, components, route) => {
12
+ const writeFile = (mode, config, components, route) => {
13
13
  const importer = new NestiaMigrateImportProgrammer_1.NestiaMigrateImportProgrammer();
14
14
  const func = NestiaMigrateE2eFileProgrammer_1.NestiaMigrateE2eFunctionProgrammer.write({
15
15
  config,
@@ -18,12 +18,19 @@ var NestiaMigrateE2eProgrammer;
18
18
  route,
19
19
  });
20
20
  const statements = [
21
- ...importer.toStatements((name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`),
21
+ // The monorepo template consumes the api workspace package through its
22
+ // package name, while the single-package sdk template keeps resolving
23
+ // the built `lib` paths through tsconfig path mappings.
24
+ ...importer.toStatements((name) => mode === "nest"
25
+ ? "@ORGANIZATION/PROJECT-api"
26
+ : `@ORGANIZATION/PROJECT-api/lib/structures/${name}`),
22
27
  FilePrinter_1.FilePrinter.newLine(),
23
28
  func,
24
29
  ];
25
30
  return {
26
- location: `test/features/api`,
31
+ location: mode === "nest"
32
+ ? `packages/backend/test/features/api`
33
+ : `test/features/api`,
27
34
  file: `${["test", "api", ...route.accessor].join("_")}.ts`,
28
35
  content: FilePrinter_1.FilePrinter.write({ statements }),
29
36
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NestiaMigrateE2eProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateE2eProgrammer.ts"],"names":[],"mappings":";;;AAMA,sDAAmD;AACnD,qFAAsF;AACtF,mFAAgF;AAEhF,IAAiB,0BAA0B,CAqC1C;AArCD,WAAiB,0BAA0B;IAC5B,gCAAK,GAAG,CAAC,GAA0B,EAA0B,EAAE,CAC1E,MAAM,CAAC,WAAW,CAChB,GAAG,CAAC,WAAW,CAAC,MAAM;SACnB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACT,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC,CAChE;SACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CACtD,CAAC;IAEJ,MAAM,SAAS,GAAG,CAChB,MAA4B,EAC5B,UAA+B,EAC/B,KAAwB,EACJ,EAAE;QACtB,MAAM,QAAQ,GACZ,IAAI,6DAA6B,EAAE,CAAC;QACtC,MAAM,IAAI,GACR,mEAAkC,CAAC,KAAK,CAAC;YACvC,MAAM;YACN,UAAU;YACV,QAAQ;YACR,KAAK;SACN,CAAC,CAAC;QACL,MAAM,UAAU,GAAmB;YACjC,GAAG,QAAQ,CAAC,YAAY,CACtB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