@nestia/migrate 12.0.0-rc.2 → 12.0.0-rc.4
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.
- package/LICENSE +21 -21
- package/lib/NestiaMigrateApplication.js +9 -44
- package/lib/NestiaMigrateApplication.js.map +1 -1
- package/lib/NestiaMigrateApplication.mjs +90 -3
- package/lib/NestiaMigrateApplication.mjs.map +1 -1
- package/lib/_virtual/_rolldown/runtime.mjs +13 -0
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs +45 -3
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.mjs.map +1 -1
- package/lib/archivers/NestiaMigrateFileArchiver.js +4 -0
- package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
- package/lib/archivers/NestiaMigrateFileArchiver.mjs +25 -3
- package/lib/archivers/NestiaMigrateFileArchiver.mjs.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +51 -49
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.mjs +58 -3
- package/lib/bundles/NEST_TEMPLATE.mjs.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +20 -20
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.mjs +28 -3
- package/lib/bundles/SDK_TEMPLATE.mjs.map +1 -1
- package/lib/executable/NestiaMigrateCommander.mjs +80 -3
- package/lib/executable/NestiaMigrateCommander.mjs.map +1 -1
- package/lib/executable/NestiaMigrateInquirer.mjs +59 -3
- package/lib/executable/NestiaMigrateInquirer.mjs.map +1 -1
- package/lib/executable/migrate.mjs +9 -3
- package/lib/executable/migrate.mjs.map +1 -1
- package/lib/factories/ExpressionFactory.mjs +10 -3
- package/lib/factories/ExpressionFactory.mjs.map +1 -1
- package/lib/factories/FormatCheatSheet.mjs +31 -3
- package/lib/factories/FormatCheatSheet.mjs.map +1 -1
- package/lib/factories/IdentifierFactory.mjs +22 -3
- package/lib/factories/IdentifierFactory.mjs.map +1 -1
- package/lib/factories/LiteralFactory.mjs +31 -3
- package/lib/factories/LiteralFactory.mjs.map +1 -1
- package/lib/factories/StatementFactory.mjs +12 -3
- package/lib/factories/StatementFactory.mjs.map +1 -1
- package/lib/factories/TypeFactory.mjs +21 -3
- package/lib/factories/TypeFactory.mjs.map +1 -1
- package/lib/factories/TypeLiteralFactory.js +2 -37
- package/lib/factories/TypeLiteralFactory.js.map +1 -1
- package/lib/factories/TypeLiteralFactory.mjs +17 -3
- package/lib/factories/TypeLiteralFactory.mjs.map +1 -1
- package/lib/index.mjs +24 -2
- package/lib/index.mjs.map +1 -1
- package/lib/internal/ts.mjs +6 -2
- package/lib/internal/ts.mjs.map +1 -1
- package/lib/module.mjs +43 -2
- package/lib/module.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer.mjs +36 -3
- package/lib/programmers/NestiaMigrateApiFileProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +2 -37
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs +106 -3
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs +139 -3
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.js +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.mjs +71 -3
- package/lib/programmers/NestiaMigrateApiProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs +102 -3
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs +50 -3
- package/lib/programmers/NestiaMigrateApiStartProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer.mjs +53 -3
- package/lib/programmers/NestiaMigrateDtoProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs +58 -3
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.js +11 -4
- package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.mjs +35 -3
- package/lib/programmers/NestiaMigrateE2eProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.js +12 -5
- package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.mjs +50 -3
- package/lib/programmers/NestiaMigrateImportProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +4 -3
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.mjs +31 -3
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs +128 -3
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.mjs +18 -3
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.js +25 -4
- package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.mjs +60 -3
- package/lib/programmers/NestiaMigrateNestProgrammer.mjs.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js +14 -49
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs +199 -3
- package/lib/programmers/NestiaMigrateSchemaProgrammer.mjs.map +1 -1
- package/lib/programmers/index.mjs +16 -2
- package/lib/structures/INestiaMigrateConfig.mjs +0 -3
- package/lib/structures/INestiaMigrateContext.mjs +0 -3
- package/lib/structures/INestiaMigrateController.mjs +0 -3
- package/lib/structures/INestiaMigrateFile.mjs +0 -3
- package/lib/structures/index.mjs +0 -2
- package/lib/utils/FilePrinter.mjs +20 -3
- package/lib/utils/FilePrinter.mjs.map +1 -1
- package/lib/utils/MapUtil.mjs +15 -3
- package/lib/utils/MapUtil.mjs.map +1 -1
- package/lib/utils/StringUtil.mjs +100 -3
- package/lib/utils/StringUtil.mjs.map +1 -1
- package/package.json +8 -12
- package/src/NestiaMigrateApplication.ts +192 -196
- package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
- package/src/archivers/NestiaMigrateFileArchiver.ts +32 -28
- package/src/bundles/NEST_TEMPLATE.ts +51 -49
- package/src/bundles/SDK_TEMPLATE.ts +20 -20
- package/src/executable/NestiaMigrateCommander.ts +115 -115
- package/src/executable/NestiaMigrateInquirer.ts +106 -106
- package/src/executable/bundle.js +396 -349
- package/src/executable/migrate.ts +7 -7
- package/src/factories/ExpressionFactory.ts +23 -23
- package/src/factories/FormatCheatSheet.ts +71 -71
- package/src/factories/IdentifierFactory.ts +84 -84
- package/src/factories/LiteralFactory.ts +54 -54
- package/src/factories/StatementFactory.ts +56 -56
- package/src/factories/TypeFactory.ts +27 -27
- package/src/factories/TypeLiteralFactory.ts +59 -62
- package/src/index.ts +4 -4
- package/src/internal/ts.ts +75 -75
- package/src/module.ts +6 -6
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +355 -358
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +511 -511
- package/src/programmers/NestiaMigrateApiProgrammer.ts +108 -108
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +309 -309
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +198 -198
- package/src/programmers/NestiaMigrateDtoProgrammer.ts +117 -117
- package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +155 -155
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +62 -48
- package/src/programmers/NestiaMigrateImportProgrammer.ts +127 -119
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +66 -70
- package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +402 -402
- package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +64 -64
- package/src/programmers/NestiaMigrateNestProgrammer.ts +110 -89
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +472 -475
- package/src/programmers/index.ts +15 -15
- package/src/structures/INestiaMigrateConfig.ts +19 -19
- package/src/structures/INestiaMigrateContext.ts +9 -9
- package/src/structures/INestiaMigrateController.ts +8 -8
- package/src/structures/INestiaMigrateFile.ts +5 -5
- package/src/structures/index.ts +4 -4
- package/src/utils/FilePrinter.ts +44 -44
- package/src/utils/MapUtil.ts +13 -13
- package/src/utils/StringUtil.ts +109 -109
- package/README.md +0 -93
- package/lib/NestiaMigrateApplication2.mjs +0 -153
- package/lib/NestiaMigrateApplication2.mjs.map +0 -1
- package/lib/_virtual/ExpressionFactory.mjs +0 -4
- package/lib/_virtual/ExpressionFactory.mjs.map +0 -1
- package/lib/_virtual/FilePrinter.mjs +0 -4
- package/lib/_virtual/FilePrinter.mjs.map +0 -1
- package/lib/_virtual/FormatCheatSheet.mjs +0 -4
- package/lib/_virtual/FormatCheatSheet.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateConfig.mjs +0 -4
- package/lib/_virtual/INestiaMigrateConfig.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateContext.mjs +0 -4
- package/lib/_virtual/INestiaMigrateContext.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateController.mjs +0 -4
- package/lib/_virtual/INestiaMigrateController.mjs.map +0 -1
- package/lib/_virtual/INestiaMigrateFile.mjs +0 -4
- package/lib/_virtual/INestiaMigrateFile.mjs.map +0 -1
- package/lib/_virtual/IdentifierFactory.mjs +0 -4
- package/lib/_virtual/IdentifierFactory.mjs.map +0 -1
- package/lib/_virtual/LiteralFactory.mjs +0 -4
- package/lib/_virtual/LiteralFactory.mjs.map +0 -1
- package/lib/_virtual/MapUtil.mjs +0 -4
- package/lib/_virtual/MapUtil.mjs.map +0 -1
- package/lib/_virtual/NEST_TEMPLATE.mjs +0 -4
- package/lib/_virtual/NEST_TEMPLATE.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiFileProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiFileProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiFunctionProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiFunctionProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiNamespaceProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiNamespaceProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiSimulationProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiSimulationProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApiStartProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApiStartProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateApplication.mjs +0 -4
- package/lib/_virtual/NestiaMigrateApplication.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateCommander.mjs +0 -4
- package/lib/_virtual/NestiaMigrateCommander.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateControllerAnalyzer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateControllerAnalyzer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateDtoProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateDtoProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateE2eFileProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateE2eFileProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateE2eProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateE2eProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateFileArchiver.mjs +0 -4
- package/lib/_virtual/NestiaMigrateFileArchiver.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateImportProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateImportProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateInquirer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateInquirer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestControllerProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestControllerProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestMethodProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestMethodProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestModuleProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestModuleProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateNestProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateNestProgrammer.mjs.map +0 -1
- package/lib/_virtual/NestiaMigrateSchemaProgrammer.mjs +0 -4
- package/lib/_virtual/NestiaMigrateSchemaProgrammer.mjs.map +0 -1
- package/lib/_virtual/SDK_TEMPLATE.mjs +0 -4
- package/lib/_virtual/SDK_TEMPLATE.mjs.map +0 -1
- package/lib/_virtual/StatementFactory.mjs +0 -4
- package/lib/_virtual/StatementFactory.mjs.map +0 -1
- package/lib/_virtual/StringUtil.mjs +0 -4
- package/lib/_virtual/StringUtil.mjs.map +0 -1
- package/lib/_virtual/TypeFactory.mjs +0 -4
- package/lib/_virtual/TypeFactory.mjs.map +0 -1
- package/lib/_virtual/TypeLiteralFactory.mjs +0 -4
- package/lib/_virtual/TypeLiteralFactory.mjs.map +0 -1
- package/lib/_virtual/_commander.mjs +0 -7
- package/lib/_virtual/_commander.mjs.map +0 -1
- package/lib/_virtual/_commonjsHelpers.mjs +0 -35
- package/lib/_virtual/_commonjsHelpers.mjs.map +0 -1
- package/lib/_virtual/_inquirer.mjs +0 -7
- package/lib/_virtual/_inquirer.mjs.map +0 -1
- package/lib/_virtual/_node_child_process.mjs +0 -7
- package/lib/_virtual/_node_child_process.mjs.map +0 -1
- package/lib/_virtual/_node_fs.mjs +0 -7
- package/lib/_virtual/_node_fs.mjs.map +0 -1
- package/lib/_virtual/_node_path.mjs +0 -7
- package/lib/_virtual/_node_path.mjs.map +0 -1
- package/lib/_virtual/_prettier-plugin-jsdoc.mjs +0 -7
- package/lib/_virtual/_prettier-plugin-jsdoc.mjs.map +0 -1
- package/lib/_virtual/_prettier.mjs +0 -7
- package/lib/_virtual/_prettier.mjs.map +0 -1
- package/lib/_virtual/_tstl.mjs +0 -7
- package/lib/_virtual/_tstl.mjs.map +0 -1
- package/lib/_virtual/factory.mjs +0 -7
- package/lib/_virtual/factory.mjs.map +0 -1
- package/lib/_virtual/index.mjs +0 -4
- package/lib/_virtual/index.mjs.map +0 -1
- package/lib/_virtual/index2.mjs +0 -4
- package/lib/_virtual/index2.mjs.map +0 -1
- package/lib/_virtual/index3.mjs +0 -4
- package/lib/_virtual/index3.mjs.map +0 -1
- package/lib/_virtual/index4.mjs +0 -4
- package/lib/_virtual/index4.mjs.map +0 -1
- package/lib/_virtual/migrate.mjs +0 -4
- package/lib/_virtual/migrate.mjs.map +0 -1
- package/lib/_virtual/module.mjs +0 -4
- package/lib/_virtual/module.mjs.map +0 -1
- package/lib/_virtual/prettier-plugin-sort-imports.mjs +0 -7
- package/lib/_virtual/prettier-plugin-sort-imports.mjs.map +0 -1
- package/lib/_virtual/ts.mjs +0 -4
- package/lib/_virtual/ts.mjs.map +0 -1
- package/lib/_virtual/utils.mjs +0 -7
- package/lib/_virtual/utils.mjs.map +0 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer2.mjs +0 -53
- package/lib/analyzers/NestiaMigrateControllerAnalyzer2.mjs.map +0 -1
- package/lib/archivers/NestiaMigrateFileArchiver2.mjs +0 -40
- package/lib/archivers/NestiaMigrateFileArchiver2.mjs.map +0 -1
- package/lib/bundles/NEST_TEMPLATE2.mjs +0 -66
- package/lib/bundles/NEST_TEMPLATE2.mjs.map +0 -1
- package/lib/bundles/SDK_TEMPLATE2.mjs +0 -38
- package/lib/bundles/SDK_TEMPLATE2.mjs.map +0 -1
- package/lib/executable/NestiaMigrateCommander2.mjs +0 -148
- package/lib/executable/NestiaMigrateCommander2.mjs.map +0 -1
- package/lib/executable/NestiaMigrateInquirer2.mjs +0 -93
- package/lib/executable/NestiaMigrateInquirer2.mjs.map +0 -1
- package/lib/executable/migrate2.mjs +0 -13
- package/lib/executable/migrate2.mjs.map +0 -1
- package/lib/factories/ExpressionFactory2.mjs +0 -20
- package/lib/factories/ExpressionFactory2.mjs.map +0 -1
- package/lib/factories/FormatCheatSheet2.mjs +0 -37
- package/lib/factories/FormatCheatSheet2.mjs.map +0 -1
- package/lib/factories/IdentifierFactory2.mjs +0 -56
- package/lib/factories/IdentifierFactory2.mjs.map +0 -1
- package/lib/factories/LiteralFactory2.mjs +0 -56
- package/lib/factories/LiteralFactory2.mjs.map +0 -1
- package/lib/factories/StatementFactory2.mjs +0 -26
- package/lib/factories/StatementFactory2.mjs.map +0 -1
- package/lib/factories/TypeFactory2.mjs +0 -31
- package/lib/factories/TypeFactory2.mjs.map +0 -1
- package/lib/factories/TypeLiteralFactory2.mjs +0 -72
- package/lib/factories/TypeLiteralFactory2.mjs.map +0 -1
- package/lib/index2.mjs +0 -53
- package/lib/index2.mjs.map +0 -1
- package/lib/internal/ts2.mjs +0 -10
- package/lib/internal/ts2.mjs.map +0 -1
- package/lib/module2.mjs +0 -38
- package/lib/module2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer2.mjs +0 -49
- package/lib/programmers/NestiaMigrateApiFileProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer2.mjs +0 -234
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer2.mjs +0 -238
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiProgrammer2.mjs +0 -92
- package/lib/programmers/NestiaMigrateApiProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer2.mjs +0 -156
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer2.mjs +0 -88
- package/lib/programmers/NestiaMigrateApiStartProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer2.mjs +0 -90
- package/lib/programmers/NestiaMigrateDtoProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer2.mjs +0 -88
- package/lib/programmers/NestiaMigrateE2eFileProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer2.mjs +0 -41
- package/lib/programmers/NestiaMigrateE2eProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateImportProgrammer2.mjs +0 -72
- package/lib/programmers/NestiaMigrateImportProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer2.mjs +0 -52
- package/lib/programmers/NestiaMigrateNestControllerProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer2.mjs +0 -229
- package/lib/programmers/NestiaMigrateNestMethodProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer2.mjs +0 -32
- package/lib/programmers/NestiaMigrateNestModuleProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateNestProgrammer2.mjs +0 -78
- package/lib/programmers/NestiaMigrateNestProgrammer2.mjs.map +0 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer2.mjs +0 -388
- package/lib/programmers/NestiaMigrateSchemaProgrammer2.mjs.map +0 -1
- package/lib/programmers/index.mjs.map +0 -1
- package/lib/programmers/index2.mjs +0 -71
- package/lib/programmers/index2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateConfig.mjs.map +0 -1
- package/lib/structures/INestiaMigrateConfig2.mjs +0 -6
- package/lib/structures/INestiaMigrateConfig2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateContext.mjs.map +0 -1
- package/lib/structures/INestiaMigrateContext2.mjs +0 -6
- package/lib/structures/INestiaMigrateContext2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateController.mjs.map +0 -1
- package/lib/structures/INestiaMigrateController2.mjs +0 -6
- package/lib/structures/INestiaMigrateController2.mjs.map +0 -1
- package/lib/structures/INestiaMigrateFile.mjs.map +0 -1
- package/lib/structures/INestiaMigrateFile2.mjs +0 -6
- package/lib/structures/INestiaMigrateFile2.mjs.map +0 -1
- package/lib/structures/index.mjs.map +0 -1
- package/lib/structures/index2.mjs +0 -38
- package/lib/structures/index2.mjs.map +0 -1
- package/lib/utils/FilePrinter2.mjs +0 -28
- package/lib/utils/FilePrinter2.mjs.map +0 -1
- package/lib/utils/MapUtil2.mjs +0 -18
- package/lib/utils/MapUtil2.mjs.map +0 -1
- package/lib/utils/StringUtil2.mjs +0 -110
- package/lib/utils/StringUtil2.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/migrate",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.4",
|
|
4
4
|
"description": "Migration program from swagger to NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -35,28 +35,24 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://nestia.io",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@rollup/plugin-commonjs": "^29.0.0",
|
|
39
|
-
"@rollup/plugin-esm-shim": "^0.1.8",
|
|
40
|
-
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
41
38
|
"@types/inquirer": "^9.0.7",
|
|
42
39
|
"@types/node": "^25.3.3",
|
|
43
40
|
"js-yaml": "^4.1.0",
|
|
44
41
|
"rimraf": "^6.1.3",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"typescript": "7.0.1-rc"
|
|
42
|
+
"rolldown": "^1.1.5",
|
|
43
|
+
"typescript": "^7.0.2"
|
|
48
44
|
},
|
|
49
45
|
"dependencies": {
|
|
50
46
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
51
|
-
"@ttsc/factory": "^0.
|
|
52
|
-
"@typia/interface": "^13.0.
|
|
53
|
-
"@typia/utils": "^13.0.
|
|
47
|
+
"@ttsc/factory": "^0.18.1",
|
|
48
|
+
"@typia/interface": "^13.0.1",
|
|
49
|
+
"@typia/utils": "^13.0.1",
|
|
54
50
|
"commander": "10.0.0",
|
|
55
51
|
"inquirer": "8.2.5",
|
|
56
52
|
"prettier": "^3.8.1",
|
|
57
53
|
"prettier-plugin-jsdoc": "^1.8.0",
|
|
58
54
|
"tstl": "^3.0.0",
|
|
59
|
-
"typia": "^13.0.
|
|
55
|
+
"typia": "^13.0.1"
|
|
60
56
|
},
|
|
61
57
|
"files": [
|
|
62
58
|
"lib",
|
|
@@ -71,7 +67,7 @@
|
|
|
71
67
|
"access": "public"
|
|
72
68
|
},
|
|
73
69
|
"scripts": {
|
|
74
|
-
"build": "rimraf lib && ttsc && tsc --emitDeclarationOnly &&
|
|
70
|
+
"build": "rimraf lib && ttsc && tsc --emitDeclarationOnly && rolldown -c && node ../../deploy/verify-package-exports.cjs --esm",
|
|
75
71
|
"bundle": "node src/executable/bundle.js",
|
|
76
72
|
"dev": "rimraf lib && ttsc --watch",
|
|
77
73
|
"test": "node lib/test"
|
|
@@ -1,196 +1,192 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IHttpMigrateApplication,
|
|
3
|
-
IHttpMigrateRoute,
|
|
4
|
-
OpenApi,
|
|
5
|
-
OpenApiV3,
|
|
6
|
-
OpenApiV3_1,
|
|
7
|
-
OpenApiV3_2,
|
|
8
|
-
SwaggerV2,
|
|
9
|
-
} from "@typia/interface";
|
|
10
|
-
import type { IValidation } from "@typia/interface";
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import { NEST_TEMPLATE } from "./bundles/NEST_TEMPLATE";
|
|
14
|
-
import { SDK_TEMPLATE } from "./bundles/SDK_TEMPLATE";
|
|
15
|
-
import { NestiaMigrateApiProgrammer } from "./programmers/NestiaMigrateApiProgrammer";
|
|
16
|
-
import { NestiaMigrateApiStartProgrammer } from "./programmers/NestiaMigrateApiStartProgrammer";
|
|
17
|
-
import { NestiaMigrateE2eProgrammer } from "./programmers/NestiaMigrateE2eProgrammer";
|
|
18
|
-
import { NestiaMigrateNestProgrammer } from "./programmers/NestiaMigrateNestProgrammer";
|
|
19
|
-
import { INestiaMigrateConfig } from "./structures/INestiaMigrateConfig";
|
|
20
|
-
import { INestiaMigrateContext } from "./structures/INestiaMigrateContext";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
key.startsWith("
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
),
|
|
103
|
-
...
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
value.split(`@ORGANIZATION/PROJECT`).join(slug),
|
|
194
|
-
]),
|
|
195
|
-
);
|
|
196
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
IHttpMigrateApplication,
|
|
3
|
+
IHttpMigrateRoute,
|
|
4
|
+
OpenApi,
|
|
5
|
+
OpenApiV3,
|
|
6
|
+
OpenApiV3_1,
|
|
7
|
+
OpenApiV3_2,
|
|
8
|
+
SwaggerV2,
|
|
9
|
+
} from "@typia/interface";
|
|
10
|
+
import type { IValidation } from "@typia/interface";
|
|
11
|
+
import { HttpMigration, OpenApiConverter } from "@typia/utils";
|
|
12
|
+
|
|
13
|
+
import { NEST_TEMPLATE } from "./bundles/NEST_TEMPLATE";
|
|
14
|
+
import { SDK_TEMPLATE } from "./bundles/SDK_TEMPLATE";
|
|
15
|
+
import { NestiaMigrateApiProgrammer } from "./programmers/NestiaMigrateApiProgrammer";
|
|
16
|
+
import { NestiaMigrateApiStartProgrammer } from "./programmers/NestiaMigrateApiStartProgrammer";
|
|
17
|
+
import { NestiaMigrateE2eProgrammer } from "./programmers/NestiaMigrateE2eProgrammer";
|
|
18
|
+
import { NestiaMigrateNestProgrammer } from "./programmers/NestiaMigrateNestProgrammer";
|
|
19
|
+
import { INestiaMigrateConfig } from "./structures/INestiaMigrateConfig";
|
|
20
|
+
import { INestiaMigrateContext } from "./structures/INestiaMigrateContext";
|
|
21
|
+
|
|
22
|
+
export class NestiaMigrateApplication {
|
|
23
|
+
private readonly data_: IHttpMigrateApplication;
|
|
24
|
+
|
|
25
|
+
/* -----------------------------------------------------------
|
|
26
|
+
CONSTRUCTORS
|
|
27
|
+
----------------------------------------------------------- */
|
|
28
|
+
public constructor(public readonly document: OpenApi.IDocument) {
|
|
29
|
+
this.data_ = HttpMigration.application(document);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public static assert(
|
|
33
|
+
document:
|
|
34
|
+
| SwaggerV2.IDocument
|
|
35
|
+
| OpenApiV3.IDocument
|
|
36
|
+
| OpenApiV3_1.IDocument
|
|
37
|
+
| OpenApiV3_2.IDocument
|
|
38
|
+
| OpenApi.IDocument,
|
|
39
|
+
): NestiaMigrateApplication {
|
|
40
|
+
return new NestiaMigrateApplication(
|
|
41
|
+
OpenApiConverter.upgradeDocument(document),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static validate(
|
|
46
|
+
document:
|
|
47
|
+
| SwaggerV2.IDocument
|
|
48
|
+
| OpenApiV3.IDocument
|
|
49
|
+
| OpenApiV3_1.IDocument
|
|
50
|
+
| OpenApiV3_2.IDocument
|
|
51
|
+
| OpenApi.IDocument,
|
|
52
|
+
): IValidation<NestiaMigrateApplication> {
|
|
53
|
+
try {
|
|
54
|
+
return {
|
|
55
|
+
success: true,
|
|
56
|
+
data: new NestiaMigrateApplication(
|
|
57
|
+
OpenApiConverter.upgradeDocument(document),
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
} catch (exp) {
|
|
61
|
+
const message: string = exp instanceof Error ? exp.message : String(exp);
|
|
62
|
+
return {
|
|
63
|
+
success: false,
|
|
64
|
+
data: document,
|
|
65
|
+
errors: [
|
|
66
|
+
{
|
|
67
|
+
path: "$input",
|
|
68
|
+
expected:
|
|
69
|
+
"SwaggerV2.IDocument | OpenApiV3.IDocument | OpenApiV3_1.IDocument | OpenApiV3_2.IDocument | OpenApi.IDocument",
|
|
70
|
+
value: message,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* -----------------------------------------------------------
|
|
78
|
+
ACCESSORS
|
|
79
|
+
----------------------------------------------------------- */
|
|
80
|
+
public getData(): IHttpMigrateApplication {
|
|
81
|
+
return this.data_;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public nest(config: INestiaMigrateConfig): Record<string, string> {
|
|
85
|
+
const context: INestiaMigrateContext = createContext(
|
|
86
|
+
"nest",
|
|
87
|
+
this.data_,
|
|
88
|
+
config,
|
|
89
|
+
);
|
|
90
|
+
const files: Record<string, string> = {
|
|
91
|
+
...Object.fromEntries(
|
|
92
|
+
Object.entries(NEST_TEMPLATE).filter(
|
|
93
|
+
([key]) =>
|
|
94
|
+
key.startsWith("packages/api/src/structures") === false &&
|
|
95
|
+
key.startsWith("packages/api/src/functional") === false &&
|
|
96
|
+
key.startsWith("packages/backend/src/controllers") === false &&
|
|
97
|
+
key.startsWith("packages/backend/test/features") === false,
|
|
98
|
+
),
|
|
99
|
+
),
|
|
100
|
+
...NestiaMigrateNestProgrammer.write(context),
|
|
101
|
+
...NestiaMigrateApiProgrammer.write(context),
|
|
102
|
+
...(config.e2e ? NestiaMigrateE2eProgrammer.write(context) : {}),
|
|
103
|
+
...(config.keyword === false
|
|
104
|
+
? {
|
|
105
|
+
"packages/backend/nestia.config.ts": NEST_TEMPLATE[
|
|
106
|
+
"packages/backend/nestia.config.ts"
|
|
107
|
+
]!.replace("keyword: true", "keyword: false"),
|
|
108
|
+
}
|
|
109
|
+
: {}),
|
|
110
|
+
};
|
|
111
|
+
return config.package ? renameSlug(config.package, files) : files;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public sdk(config: INestiaMigrateConfig): Record<string, string> {
|
|
115
|
+
const context: INestiaMigrateContext = createContext(
|
|
116
|
+
"sdk",
|
|
117
|
+
this.data_,
|
|
118
|
+
config,
|
|
119
|
+
);
|
|
120
|
+
const files: Record<string, string> = {
|
|
121
|
+
...Object.fromEntries(
|
|
122
|
+
Object.entries(SDK_TEMPLATE).filter(
|
|
123
|
+
([key]) =>
|
|
124
|
+
key.startsWith("src/structures") === false &&
|
|
125
|
+
key.startsWith("src/functional") === false &&
|
|
126
|
+
key.startsWith("test/features") === false,
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
...NestiaMigrateApiProgrammer.write(context),
|
|
130
|
+
...NestiaMigrateApiStartProgrammer.write(context),
|
|
131
|
+
...(config.e2e ? NestiaMigrateE2eProgrammer.write(context) : {}),
|
|
132
|
+
"swagger.json": JSON.stringify(this.document, null, 2),
|
|
133
|
+
};
|
|
134
|
+
return config.package ? renameSlug(config.package, files) : files;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const createContext = (
|
|
139
|
+
mode: "nest" | "sdk",
|
|
140
|
+
application: IHttpMigrateApplication,
|
|
141
|
+
config: INestiaMigrateConfig,
|
|
142
|
+
): INestiaMigrateContext => {
|
|
143
|
+
const routes: IHttpMigrateRoute[] = escapeConflictingAccessors(
|
|
144
|
+
application.routes
|
|
145
|
+
.filter((r) => r.method !== "query")
|
|
146
|
+
.map((r) => ({
|
|
147
|
+
...r,
|
|
148
|
+
accessor: [...r.accessor],
|
|
149
|
+
})),
|
|
150
|
+
);
|
|
151
|
+
return {
|
|
152
|
+
mode,
|
|
153
|
+
application: {
|
|
154
|
+
...application,
|
|
155
|
+
routes,
|
|
156
|
+
},
|
|
157
|
+
config,
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const escapeConflictingAccessors = (
|
|
162
|
+
routes: IHttpMigrateRoute[],
|
|
163
|
+
): IHttpMigrateRoute[] => {
|
|
164
|
+
for (const route of routes)
|
|
165
|
+
while (true) {
|
|
166
|
+
const neighbor: IHttpMigrateRoute | undefined = routes.find(
|
|
167
|
+
(candidate) =>
|
|
168
|
+
candidate !== route &&
|
|
169
|
+
candidate.accessor.length < route.accessor.length &&
|
|
170
|
+
route.accessor
|
|
171
|
+
.slice(0, candidate.accessor.length)
|
|
172
|
+
.every((value, index) => value === candidate.accessor[index]),
|
|
173
|
+
);
|
|
174
|
+
if (neighbor === undefined) break;
|
|
175
|
+
|
|
176
|
+
const index: number = neighbor.accessor.length - 1;
|
|
177
|
+
route.accessor[index] = `_${route.accessor[index]}`;
|
|
178
|
+
}
|
|
179
|
+
return routes;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const renameSlug = (
|
|
183
|
+
slug: string,
|
|
184
|
+
files: Record<string, string>,
|
|
185
|
+
): Record<string, string> => {
|
|
186
|
+
return Object.fromEntries(
|
|
187
|
+
Object.entries(files).map(([key, value]) => [
|
|
188
|
+
key,
|
|
189
|
+
value.split(`@ORGANIZATION/PROJECT`).join(slug),
|
|
190
|
+
]),
|
|
191
|
+
);
|
|
192
|
+
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { IHttpMigrateRoute } from "@typia/interface";
|
|
2
|
-
|
|
3
|
-
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
4
|
-
import { MapUtil } from "../utils/MapUtil";
|
|
5
|
-
import { StringUtil } from "../utils/StringUtil";
|
|
6
|
-
|
|
7
|
-
export namespace NestiaMigrateControllerAnalyzer {
|
|
8
|
-
export const analyze = (
|
|
9
|
-
routes: IHttpMigrateRoute[],
|
|
10
|
-
): INestiaMigrateController[] => {
|
|
11
|
-
const collection: Map<string, INestiaMigrateController> = new Map();
|
|
12
|
-
for (const r of routes) {
|
|
13
|
-
const name: string =
|
|
14
|
-
r.operation()["x-samchon-controller"] ??
|
|
15
|
-
(r.accessor.length <= 1
|
|
16
|
-
? "__App"
|
|
17
|
-
: r.accessor.slice(0, -1).map(StringUtil.capitalize).join("")) +
|
|
18
|
-
"Controller";
|
|
19
|
-
MapUtil.take(collection)(name)(() => ({
|
|
20
|
-
name,
|
|
21
|
-
path: "@lazy",
|
|
22
|
-
location: "@lazy",
|
|
23
|
-
routes: [],
|
|
24
|
-
})).routes.push(r);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const controllers: INestiaMigrateController[] = [...collection.values()];
|
|
28
|
-
for (const col of controllers) {
|
|
29
|
-
const splitPath = (r: IHttpMigrateRoute): string[] =>
|
|
30
|
-
r.emendedPath.split("/");
|
|
31
|
-
const splitLocation = (r: IHttpMigrateRoute): string[] =>
|
|
32
|
-
splitPath(r).filter((s) => s.length !== 0 && s[0] !== ":");
|
|
33
|
-
|
|
34
|
-
const minPath: string[] = splitPath(col.routes[0]!);
|
|
35
|
-
const minLocation: string[] = splitLocation(col.routes[0]!);
|
|
36
|
-
for (const r of col.routes.slice(1)) {
|
|
37
|
-
minPath.splice(getSplitIndex(minPath, splitPath(r)));
|
|
38
|
-
minLocation.splice(getSplitIndex(minLocation, splitLocation(r)));
|
|
39
|
-
}
|
|
40
|
-
col.path = minPath.join("/");
|
|
41
|
-
col.location = ["src", "controllers", ...minLocation].join("/");
|
|
42
|
-
}
|
|
43
|
-
return controllers;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const getSplitIndex = (x: string[], y: string[]) => {
|
|
48
|
-
const n: number = Math.min(x.length, y.length);
|
|
49
|
-
for (let i: number = 0; i < n; ++i) if (x[i] !== y[i]) return i;
|
|
50
|
-
return n;
|
|
51
|
-
};
|
|
1
|
+
import { IHttpMigrateRoute } from "@typia/interface";
|
|
2
|
+
|
|
3
|
+
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
4
|
+
import { MapUtil } from "../utils/MapUtil";
|
|
5
|
+
import { StringUtil } from "../utils/StringUtil";
|
|
6
|
+
|
|
7
|
+
export namespace NestiaMigrateControllerAnalyzer {
|
|
8
|
+
export const analyze = (
|
|
9
|
+
routes: IHttpMigrateRoute[],
|
|
10
|
+
): INestiaMigrateController[] => {
|
|
11
|
+
const collection: Map<string, INestiaMigrateController> = new Map();
|
|
12
|
+
for (const r of routes) {
|
|
13
|
+
const name: string =
|
|
14
|
+
r.operation()["x-samchon-controller"] ??
|
|
15
|
+
(r.accessor.length <= 1
|
|
16
|
+
? "__App"
|
|
17
|
+
: r.accessor.slice(0, -1).map(StringUtil.capitalize).join("")) +
|
|
18
|
+
"Controller";
|
|
19
|
+
MapUtil.take(collection)(name)(() => ({
|
|
20
|
+
name,
|
|
21
|
+
path: "@lazy",
|
|
22
|
+
location: "@lazy",
|
|
23
|
+
routes: [],
|
|
24
|
+
})).routes.push(r);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const controllers: INestiaMigrateController[] = [...collection.values()];
|
|
28
|
+
for (const col of controllers) {
|
|
29
|
+
const splitPath = (r: IHttpMigrateRoute): string[] =>
|
|
30
|
+
r.emendedPath.split("/");
|
|
31
|
+
const splitLocation = (r: IHttpMigrateRoute): string[] =>
|
|
32
|
+
splitPath(r).filter((s) => s.length !== 0 && s[0] !== ":");
|
|
33
|
+
|
|
34
|
+
const minPath: string[] = splitPath(col.routes[0]!);
|
|
35
|
+
const minLocation: string[] = splitLocation(col.routes[0]!);
|
|
36
|
+
for (const r of col.routes.slice(1)) {
|
|
37
|
+
minPath.splice(getSplitIndex(minPath, splitPath(r)));
|
|
38
|
+
minLocation.splice(getSplitIndex(minLocation, splitLocation(r)));
|
|
39
|
+
}
|
|
40
|
+
col.path = minPath.join("/");
|
|
41
|
+
col.location = ["src", "controllers", ...minLocation].join("/");
|
|
42
|
+
}
|
|
43
|
+
return controllers;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const getSplitIndex = (x: string[], y: string[]) => {
|
|
48
|
+
const n: number = Math.min(x.length, y.length);
|
|
49
|
+
for (let i: number = 0; i < n; ++i) if (x[i] !== y[i]) return i;
|
|
50
|
+
return n;
|
|
51
|
+
};
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { VariadicSingleton } from "tstl";
|
|
2
|
-
|
|
3
|
-
export namespace NestiaMigrateFileArchiver {
|
|
4
|
-
export const archive = async (props: {
|
|
5
|
-
mkdir: (path: string) => Promise<void>;
|
|
6
|
-
writeFile: (path: string, content: string) => Promise<void>;
|
|
7
|
-
root: string;
|
|
8
|
-
files: Record<string, string>;
|
|
9
|
-
}): Promise<void> => {
|
|
10
|
-
const mkdir = new VariadicSingleton(
|
|
11
|
-
async (location: string): Promise<void> => {
|
|
12
|
-
try {
|
|
13
|
-
await props.mkdir(`${props.root}/${location}`);
|
|
14
|
-
} catch {}
|
|
15
|
-
},
|
|
16
|
-
);
|
|
17
|
-
const iterate = async (location: string): Promise<void> => {
|
|
18
|
-
const sequence: string[] = location
|
|
19
|
-
.split("/")
|
|
20
|
-
.map((_str, i, entire) => entire.slice(0, i + 1).join("/"));
|
|
21
|
-
for (const s of sequence) await mkdir.get(s);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { VariadicSingleton } from "tstl";
|
|
2
|
+
|
|
3
|
+
export namespace NestiaMigrateFileArchiver {
|
|
4
|
+
export const archive = async (props: {
|
|
5
|
+
mkdir: (path: string) => Promise<void>;
|
|
6
|
+
writeFile: (path: string, content: string) => Promise<void>;
|
|
7
|
+
root: string;
|
|
8
|
+
files: Record<string, string>;
|
|
9
|
+
}): Promise<void> => {
|
|
10
|
+
const mkdir = new VariadicSingleton(
|
|
11
|
+
async (location: string): Promise<void> => {
|
|
12
|
+
try {
|
|
13
|
+
await props.mkdir(`${props.root}/${location}`);
|
|
14
|
+
} catch {}
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
const iterate = async (location: string): Promise<void> => {
|
|
18
|
+
const sequence: string[] = location
|
|
19
|
+
.split("/")
|
|
20
|
+
.map((_str, i, entire) => entire.slice(0, i + 1).join("/"));
|
|
21
|
+
for (const s of sequence) await mkdir.get(s);
|
|
22
|
+
};
|
|
23
|
+
// The file set may lead with a nested path (the monorepo template's
|
|
24
|
+
// first key is `.github/workflows/build.yml`), so the archive root must
|
|
25
|
+
// exist before the per-directory mkdir walk below it.
|
|
26
|
+
await mkdir.get("");
|
|
27
|
+
for (const [key, value] of Object.entries(props.files)) {
|
|
28
|
+
await iterate(key.split("/").slice(0, -1).join("/"));
|
|
29
|
+
await props.writeFile(`${props.root}/${key}`, value);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|