@nestia/migrate 6.0.5 → 7.0.0-dev.20250605
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/README.md +92 -92
 - package/lib/NestiaMigrateApplication.d.ts +23 -0
 - package/lib/NestiaMigrateApplication.js +17522 -0
 - package/lib/NestiaMigrateApplication.js.map +1 -0
 - package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +5 -0
 - package/lib/analyzers/{MigrateControllerAnalyzer.js → NestiaMigrateControllerAnalyzer.js} +10 -10
 - package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -0
 - package/lib/archivers/NestiaMigrateFileArchiver.d.ts +8 -0
 - package/lib/archivers/NestiaMigrateFileArchiver.js +36 -0
 - package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -0
 - package/lib/bundles/NEST_TEMPLATE.d.ts +1 -5
 - package/lib/bundles/NEST_TEMPLATE.js +50 -242
 - package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
 - package/lib/bundles/SDK_TEMPLATE.d.ts +1 -5
 - package/lib/bundles/SDK_TEMPLATE.js +23 -107
 - package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
 - package/lib/{internal/MigrateCommander.d.ts → executable/NestiaMigrateCommander.d.ts} +1 -1
 - package/lib/{internal/MigrateCommander.js → executable/NestiaMigrateCommander.js} +23 -21
 - package/lib/executable/NestiaMigrateCommander.js.map +1 -0
 - package/lib/{internal/MigrateInquirer.d.ts → executable/NestiaMigrateInquirer.d.ts} +2 -1
 - package/lib/{internal/MigrateInquirer.js → executable/NestiaMigrateInquirer.js} +22 -9
 - package/lib/executable/NestiaMigrateInquirer.js.map +1 -0
 - package/lib/executable/migrate.js +2 -2
 - package/lib/executable/migrate.js.map +1 -1
 - package/lib/index.mjs +10042 -694
 - package/lib/index.mjs.map +1 -1
 - package/lib/module.d.ts +2 -5
 - package/lib/module.js +2 -5
 - package/lib/module.js.map +1 -1
 - package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +13 -0
 - package/lib/programmers/NestiaMigrateApiFileProgrammer.js +40 -0
 - package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +14 -0
 - package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +132 -0
 - package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +14 -0
 - package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +237 -0
 - package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +4 -0
 - package/lib/programmers/{MigrateApiProgrammer.js → NestiaMigrateApiProgrammer.js} +31 -30
 - package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +14 -0
 - package/lib/programmers/{MigrateApiSimulationProgrammer.js → NestiaMigrateApiSimulationProgrammer.js} +54 -36
 - package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +4 -0
 - package/lib/programmers/{MigrateApiStartProgrammer.js → NestiaMigrateApiStartProgrammer.js} +23 -20
 - package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +15 -0
 - package/lib/programmers/{MigrateDtoProgrammer.js → NestiaMigrateDtoProgrammer.js} +21 -12
 - package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +14 -0
 - package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +81 -0
 - package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +4 -0
 - package/lib/programmers/NestiaMigrateE2eProgrammer.js +32 -0
 - package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -0
 - package/lib/programmers/{MigrateImportProgrammer.d.ts → NestiaMigrateImportProgrammer.d.ts} +1 -1
 - package/lib/programmers/{MigrateImportProgrammer.js → NestiaMigrateImportProgrammer.js} +4 -4
 - package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +12 -0
 - package/lib/programmers/{MigrateNestControllerProgrammer.js → NestiaMigrateNestControllerProgrammer.js} +20 -13
 - package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +15 -0
 - package/lib/programmers/{MigrateNestMethodProgrammer.js → NestiaMigrateNestMethodProgrammer.js} +85 -69
 - package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +5 -0
 - package/lib/programmers/{MigrateNestModuleProgrammer.js → NestiaMigrateNestModuleProgrammer.js} +6 -6
 - package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +4 -0
 - package/lib/programmers/NestiaMigrateNestProgrammer.js +65 -0
 - package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -0
 - package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +10 -0
 - package/lib/programmers/NestiaMigrateSchemaProgrammer.js +414 -0
 - package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -0
 - package/lib/structures/INestiaMigrateConfig.d.ts +10 -0
 - package/lib/structures/{IHttpMigrateFile.js → INestiaMigrateConfig.js} +1 -1
 - package/lib/structures/INestiaMigrateConfig.js.map +1 -0
 - package/lib/structures/INestiaMigrateContext.d.ts +9 -0
 - package/lib/structures/INestiaMigrateContext.js +3 -0
 - package/lib/structures/INestiaMigrateContext.js.map +1 -0
 - package/lib/structures/INestiaMigrateController.d.ts +7 -0
 - package/lib/structures/{IHttpMigrateController.js → INestiaMigrateController.js} +1 -1
 - package/lib/structures/INestiaMigrateController.js.map +1 -0
 - package/lib/structures/{IHttpMigrateDto.d.ts → INestiaMigrateDto.d.ts} +2 -2
 - package/lib/structures/{IHttpMigrateRoute.js → INestiaMigrateDto.js} +1 -1
 - package/lib/structures/INestiaMigrateDto.js.map +1 -0
 - package/lib/structures/{IHttpMigrateFile.d.ts → INestiaMigrateFile.d.ts} +1 -1
 - package/lib/structures/{IHttpMigrateDto.js → INestiaMigrateFile.js} +1 -1
 - package/lib/structures/INestiaMigrateFile.js.map +1 -0
 - package/lib/structures/INestiaMigrateProgram.d.ts +9 -0
 - package/lib/structures/INestiaMigrateProgram.js +3 -0
 - package/lib/structures/INestiaMigrateProgram.js.map +1 -0
 - package/lib/structures/INestiaMigrateSchema.d.ts +4 -0
 - package/lib/structures/{IHttpMigrateProgram.js → INestiaMigrateSchema.js} +1 -1
 - package/lib/structures/INestiaMigrateSchema.js.map +1 -0
 - package/lib/utils/openapi-down-convert/converter.js +2 -2
 - package/package.json +8 -8
 - package/src/NestiaMigrateApplication.ts +144 -0
 - package/src/analyzers/{MigrateControllerAnalyzer.ts → NestiaMigrateControllerAnalyzer.ts} +51 -51
 - package/src/archivers/NestiaMigrateFileArchiver.ts +28 -0
 - package/src/bundles/NEST_TEMPLATE.ts +50 -242
 - package/src/bundles/SDK_TEMPLATE.ts +23 -107
 - package/src/{internal/MigrateCommander.ts → executable/NestiaMigrateCommander.ts} +98 -94
 - package/src/{internal/MigrateInquirer.ts → executable/NestiaMigrateInquirer.ts} +106 -89
 - package/src/executable/bundle.js +129 -127
 - package/src/executable/migrate.ts +7 -7
 - package/src/factories/TypeLiteralFactory.ts +57 -57
 - package/src/index.ts +4 -4
 - package/src/module.ts +2 -8
 - package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -0
 - package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +256 -0
 - package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +524 -0
 - package/src/programmers/NestiaMigrateApiProgrammer.ts +107 -0
 - package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +340 -0
 - package/src/programmers/NestiaMigrateApiStartProgrammer.ts +198 -0
 - package/src/programmers/NestiaMigrateDtoProgrammer.ts +101 -0
 - package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +153 -0
 - package/src/programmers/NestiaMigrateE2eProgrammer.ts +46 -0
 - package/src/programmers/{MigrateImportProgrammer.ts → NestiaMigrateImportProgrammer.ts} +118 -118
 - package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +66 -0
 - package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +406 -0
 - package/src/programmers/{MigrateNestModuleProgrammer.ts → NestiaMigrateNestModuleProgrammer.ts} +65 -65
 - package/src/programmers/NestiaMigrateNestProgrammer.ts +88 -0
 - package/src/programmers/NestiaMigrateSchemaProgrammer.ts +475 -0
 - package/src/structures/INestiaMigrateConfig.ts +10 -0
 - package/src/structures/INestiaMigrateContext.ts +15 -0
 - package/src/structures/INestiaMigrateController.ts +8 -0
 - package/src/structures/{IHttpMigrateDto.ts → INestiaMigrateDto.ts} +8 -8
 - package/src/structures/{IHttpMigrateFile.ts → INestiaMigrateFile.ts} +5 -5
 - package/src/structures/INestiaMigrateProgram.ts +11 -0
 - package/src/structures/INestiaMigrateSchema.ts +4 -0
 - package/src/utils/FilePrinter.ts +38 -38
 - package/src/utils/MapUtil.ts +13 -13
 - package/src/utils/OpenApiTypeChecker.ts +73 -73
 - package/src/utils/SetupWizard.ts +12 -12
 - package/src/utils/StringUtil.ts +113 -113
 - package/src/utils/openapi-down-convert/RefVisitor.ts +139 -139
 - package/src/utils/openapi-down-convert/converter.ts +527 -527
 - package/lib/MigrateApplication.d.ts +0 -28
 - package/lib/MigrateApplication.js +0 -7994
 - package/lib/MigrateApplication.js.map +0 -1
 - package/lib/analyzers/MigrateApplicationAnalyzer.d.ts +0 -4
 - package/lib/analyzers/MigrateApplicationAnalyzer.js +0 -12
 - package/lib/analyzers/MigrateApplicationAnalyzer.js.map +0 -1
 - package/lib/analyzers/MigrateControllerAnalyzer.d.ts +0 -7
 - package/lib/analyzers/MigrateControllerAnalyzer.js.map +0 -1
 - package/lib/archivers/MigrateFileArchiver.d.ts +0 -8
 - package/lib/archivers/MigrateFileArchiver.js +0 -35
 - package/lib/archivers/MigrateFileArchiver.js.map +0 -1
 - package/lib/internal/MigrateCommander.js.map +0 -1
 - package/lib/internal/MigrateInquirer.js.map +0 -1
 - package/lib/programmers/MigrateApiFileProgrammer.d.ts +0 -11
 - package/lib/programmers/MigrateApiFileProgrammer.js +0 -30
 - package/lib/programmers/MigrateApiFileProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateApiFunctionProgrammer.d.ts +0 -9
 - package/lib/programmers/MigrateApiFunctionProgrammer.js +0 -102
 - package/lib/programmers/MigrateApiFunctionProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateApiNamespaceProgrammer.d.ts +0 -9
 - package/lib/programmers/MigrateApiNamespaceProgrammer.js +0 -142
 - package/lib/programmers/MigrateApiNamespaceProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateApiProgrammer.d.ts +0 -5
 - package/lib/programmers/MigrateApiProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateApiSimulationProgrammer.d.ts +0 -8
 - package/lib/programmers/MigrateApiSimulationProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateApiStartProgrammer.d.ts +0 -5
 - package/lib/programmers/MigrateApiStartProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateDtoProgrammer.d.ts +0 -11
 - package/lib/programmers/MigrateDtoProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateE2eFileProgrammer.d.ts +0 -8
 - package/lib/programmers/MigrateE2eFileProgrammer.js +0 -45
 - package/lib/programmers/MigrateE2eFileProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateE2eProgrammer.d.ts +0 -5
 - package/lib/programmers/MigrateE2eProgrammer.js +0 -25
 - package/lib/programmers/MigrateE2eProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateImportProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateNestControllerProgrammer.d.ts +0 -7
 - package/lib/programmers/MigrateNestControllerProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateNestMethodProgrammer.d.ts +0 -9
 - package/lib/programmers/MigrateNestMethodProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateNestModuleProgrammer.d.ts +0 -5
 - package/lib/programmers/MigrateNestModuleProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateNestProgrammer.d.ts +0 -5
 - package/lib/programmers/MigrateNestProgrammer.js +0 -69
 - package/lib/programmers/MigrateNestProgrammer.js.map +0 -1
 - package/lib/programmers/MigrateSchemaProgrammer.d.ts +0 -6
 - package/lib/programmers/MigrateSchemaProgrammer.js +0 -335
 - package/lib/programmers/MigrateSchemaProgrammer.js.map +0 -1
 - package/lib/structures/IHttpMigrateController.d.ts +0 -7
 - package/lib/structures/IHttpMigrateController.js.map +0 -1
 - package/lib/structures/IHttpMigrateDto.js.map +0 -1
 - package/lib/structures/IHttpMigrateFile.js.map +0 -1
 - package/lib/structures/IHttpMigrateProgram.d.ts +0 -33
 - package/lib/structures/IHttpMigrateProgram.js.map +0 -1
 - package/lib/structures/IHttpMigrateRoute.d.ts +0 -1
 - package/lib/structures/IHttpMigrateRoute.js.map +0 -1
 - package/lib/structures/IHttpMigrateSchema.d.ts +0 -4
 - package/lib/structures/IHttpMigrateSchema.js +0 -3
 - package/lib/structures/IHttpMigrateSchema.js.map +0 -1
 - package/src/MigrateApplication.ts +0 -124
 - package/src/analyzers/MigrateApplicationAnalyzer.ts +0 -18
 - package/src/archivers/MigrateFileArchiver.ts +0 -38
 - package/src/programmers/MigrateApiFileProgrammer.ts +0 -51
 - package/src/programmers/MigrateApiFunctionProgrammer.ts +0 -213
 - package/src/programmers/MigrateApiNamespaceProgrammer.ts +0 -418
 - package/src/programmers/MigrateApiProgrammer.ts +0 -104
 - package/src/programmers/MigrateApiSimulationProgrammer.ts +0 -324
 - package/src/programmers/MigrateApiStartProgrammer.ts +0 -194
 - package/src/programmers/MigrateDtoProgrammer.ts +0 -87
 - package/src/programmers/MigrateE2eFileProgrammer.ts +0 -117
 - package/src/programmers/MigrateE2eProgrammer.ts +0 -34
 - package/src/programmers/MigrateNestControllerProgrammer.ts +0 -57
 - package/src/programmers/MigrateNestMethodProgrammer.ts +0 -397
 - package/src/programmers/MigrateNestProgrammer.ts +0 -82
 - package/src/programmers/MigrateSchemaProgrammer.ts +0 -378
 - package/src/structures/IHttpMigrateController.ts +0 -8
 - package/src/structures/IHttpMigrateProgram.ts +0 -35
 - package/src/structures/IHttpMigrateRoute.ts +0 -1
 - package/src/structures/IHttpMigrateSchema.ts +0 -4
 
| 
         @@ -0,0 +1,340 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { IHttpMigrateRoute, OpenApi } from "@samchon/openapi";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import ts from "typescript";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { StatementFactory } from "typia/lib/factories/StatementFactory";
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { TypeFactory } from "typia/lib/factories/TypeFactory";
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
         
     | 
| 
      
 8 
     | 
    
         
            +
            import { NestiaMigrateApiFunctionProgrammer } from "./NestiaMigrateApiFunctionProgrammer";
         
     | 
| 
      
 9 
     | 
    
         
            +
            import { NestiaMigrateApiNamespaceProgrammer } from "./NestiaMigrateApiNamespaceProgrammer";
         
     | 
| 
      
 10 
     | 
    
         
            +
            import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
         
     | 
| 
      
 11 
     | 
    
         
            +
            import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            export namespace NestiaMigrateApiSimulationProgrammer {
         
     | 
| 
      
 14 
     | 
    
         
            +
              export interface IContext {
         
     | 
| 
      
 15 
     | 
    
         
            +
                config: INestiaMigrateConfig;
         
     | 
| 
      
 16 
     | 
    
         
            +
                components: OpenApi.IComponents;
         
     | 
| 
      
 17 
     | 
    
         
            +
                importer: NestiaMigrateImportProgrammer;
         
     | 
| 
      
 18 
     | 
    
         
            +
                route: IHttpMigrateRoute;
         
     | 
| 
      
 19 
     | 
    
         
            +
              }
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              export const random = (ctx: IContext) => {
         
     | 
| 
      
 22 
     | 
    
         
            +
                const output = ctx.route.success
         
     | 
| 
      
 23 
     | 
    
         
            +
                  ? NestiaMigrateSchemaProgrammer.write({
         
     | 
| 
      
 24 
     | 
    
         
            +
                      components: ctx.components,
         
     | 
| 
      
 25 
     | 
    
         
            +
                      importer: ctx.importer,
         
     | 
| 
      
 26 
     | 
    
         
            +
                      schema: ctx.route.success.schema,
         
     | 
| 
      
 27 
     | 
    
         
            +
                    })
         
     | 
| 
      
 28 
     | 
    
         
            +
                  : TypeFactory.keyword("void");
         
     | 
| 
      
 29 
     | 
    
         
            +
                return constant(
         
     | 
| 
      
 30 
     | 
    
         
            +
                  "random",
         
     | 
| 
      
 31 
     | 
    
         
            +
                  ts.factory.createArrowFunction(
         
     | 
| 
      
 32 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 33 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 34 
     | 
    
         
            +
                    [
         
     | 
| 
      
 35 
     | 
    
         
            +
                      ts.factory.createParameterDeclaration(
         
     | 
| 
      
 36 
     | 
    
         
            +
                        undefined,
         
     | 
| 
      
 37 
     | 
    
         
            +
                        undefined,
         
     | 
| 
      
 38 
     | 
    
         
            +
                        "g",
         
     | 
| 
      
 39 
     | 
    
         
            +
                        ts.factory.createToken(ts.SyntaxKind.QuestionToken),
         
     | 
| 
      
 40 
     | 
    
         
            +
                        ts.factory.createTypeReferenceNode(
         
     | 
| 
      
 41 
     | 
    
         
            +
                          ts.factory.createIdentifier("Partial"),
         
     | 
| 
      
 42 
     | 
    
         
            +
                          [
         
     | 
| 
      
 43 
     | 
    
         
            +
                            ts.factory.createTypeReferenceNode(
         
     | 
| 
      
 44 
     | 
    
         
            +
                              `${ctx.importer.external({
         
     | 
| 
      
 45 
     | 
    
         
            +
                                type: "default",
         
     | 
| 
      
 46 
     | 
    
         
            +
                                library: "typia",
         
     | 
| 
      
 47 
     | 
    
         
            +
                                name: "typia",
         
     | 
| 
      
 48 
     | 
    
         
            +
                              })}.IRandomGenerator`,
         
     | 
| 
      
 49 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 50 
     | 
    
         
            +
                          ],
         
     | 
| 
      
 51 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 52 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 53 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 54 
     | 
    
         
            +
                    output,
         
     | 
| 
      
 55 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 56 
     | 
    
         
            +
                    ts.factory.createCallExpression(
         
     | 
| 
      
 57 
     | 
    
         
            +
                      IdentifierFactory.access(
         
     | 
| 
      
 58 
     | 
    
         
            +
                        ts.factory.createIdentifier(
         
     | 
| 
      
 59 
     | 
    
         
            +
                          ctx.importer.external({
         
     | 
| 
      
 60 
     | 
    
         
            +
                            type: "default",
         
     | 
| 
      
 61 
     | 
    
         
            +
                            library: "typia",
         
     | 
| 
      
 62 
     | 
    
         
            +
                            name: "typia",
         
     | 
| 
      
 63 
     | 
    
         
            +
                          }),
         
     | 
| 
      
 64 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 65 
     | 
    
         
            +
                        "random",
         
     | 
| 
      
 66 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 67 
     | 
    
         
            +
                      [output],
         
     | 
| 
      
 68 
     | 
    
         
            +
                      [ts.factory.createIdentifier("g")],
         
     | 
| 
      
 69 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 70 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 71 
     | 
    
         
            +
                );
         
     | 
| 
      
 72 
     | 
    
         
            +
              };
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
              export const simulate = (ctx: IContext): ts.VariableStatement => {
         
     | 
| 
      
 75 
     | 
    
         
            +
                const caller = () =>
         
     | 
| 
      
 76 
     | 
    
         
            +
                  ts.factory.createCallExpression(
         
     | 
| 
      
 77 
     | 
    
         
            +
                    ts.factory.createIdentifier("random"),
         
     | 
| 
      
 78 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 79 
     | 
    
         
            +
                    [
         
     | 
| 
      
 80 
     | 
    
         
            +
                      ts.factory.createConditionalExpression(
         
     | 
| 
      
 81 
     | 
    
         
            +
                        ts.factory.createLogicalAnd(
         
     | 
| 
      
 82 
     | 
    
         
            +
                          ts.factory.createStrictEquality(
         
     | 
| 
      
 83 
     | 
    
         
            +
                            ts.factory.createStringLiteral("object"),
         
     | 
| 
      
 84 
     | 
    
         
            +
                            ts.factory.createTypeOfExpression(
         
     | 
| 
      
 85 
     | 
    
         
            +
                              ts.factory.createIdentifier("connection.simulate"),
         
     | 
| 
      
 86 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 87 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 88 
     | 
    
         
            +
                          ts.factory.createStrictInequality(
         
     | 
| 
      
 89 
     | 
    
         
            +
                            ts.factory.createNull(),
         
     | 
| 
      
 90 
     | 
    
         
            +
                            ts.factory.createIdentifier("connection.simulate"),
         
     | 
| 
      
 91 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 92 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 93 
     | 
    
         
            +
                        undefined,
         
     | 
| 
      
 94 
     | 
    
         
            +
                        ts.factory.createIdentifier("connection.simulate"),
         
     | 
| 
      
 95 
     | 
    
         
            +
                        undefined,
         
     | 
| 
      
 96 
     | 
    
         
            +
                        ts.factory.createIdentifier("undefined"),
         
     | 
| 
      
 97 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 98 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 99 
     | 
    
         
            +
                  );
         
     | 
| 
      
 100 
     | 
    
         
            +
                return constant(
         
     | 
| 
      
 101 
     | 
    
         
            +
                  "simulate",
         
     | 
| 
      
 102 
     | 
    
         
            +
                  ts.factory.createArrowFunction(
         
     | 
| 
      
 103 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 104 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 105 
     | 
    
         
            +
                    NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx),
         
     | 
| 
      
 106 
     | 
    
         
            +
                    ts.factory.createTypeReferenceNode(
         
     | 
| 
      
 107 
     | 
    
         
            +
                      ctx.route.success ? "Response" : "void",
         
     | 
| 
      
 108 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 109 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 110 
     | 
    
         
            +
                    ts.factory.createBlock(
         
     | 
| 
      
 111 
     | 
    
         
            +
                      [...assert(ctx), ts.factory.createReturnStatement(caller())],
         
     | 
| 
      
 112 
     | 
    
         
            +
                      true,
         
     | 
| 
      
 113 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 114 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 115 
     | 
    
         
            +
                );
         
     | 
| 
      
 116 
     | 
    
         
            +
              };
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
              const assert = (ctx: IContext): ts.Statement[] => {
         
     | 
| 
      
 119 
     | 
    
         
            +
                const property = (key: string) =>
         
     | 
| 
      
 120 
     | 
    
         
            +
                  ctx.config.keyword === true
         
     | 
| 
      
 121 
     | 
    
         
            +
                    ? IdentifierFactory.access(ts.factory.createIdentifier("props"), key)
         
     | 
| 
      
 122 
     | 
    
         
            +
                    : ts.factory.createIdentifier(key);
         
     | 
| 
      
 123 
     | 
    
         
            +
                const parameters = [
         
     | 
| 
      
 124 
     | 
    
         
            +
                  ...ctx.route.parameters.map((p) => ({
         
     | 
| 
      
 125 
     | 
    
         
            +
                    category: "param",
         
     | 
| 
      
 126 
     | 
    
         
            +
                    name: p.key,
         
     | 
| 
      
 127 
     | 
    
         
            +
                    schema: NestiaMigrateSchemaProgrammer.write({
         
     | 
| 
      
 128 
     | 
    
         
            +
                      components: ctx.components,
         
     | 
| 
      
 129 
     | 
    
         
            +
                      importer: ctx.importer,
         
     | 
| 
      
 130 
     | 
    
         
            +
                      schema: p.schema,
         
     | 
| 
      
 131 
     | 
    
         
            +
                    }),
         
     | 
| 
      
 132 
     | 
    
         
            +
                  })),
         
     | 
| 
      
 133 
     | 
    
         
            +
                  ...(ctx.route.query
         
     | 
| 
      
 134 
     | 
    
         
            +
                    ? [
         
     | 
| 
      
 135 
     | 
    
         
            +
                        {
         
     | 
| 
      
 136 
     | 
    
         
            +
                          category: "query",
         
     | 
| 
      
 137 
     | 
    
         
            +
                          name: ctx.route.query.key,
         
     | 
| 
      
 138 
     | 
    
         
            +
                          schema: NestiaMigrateSchemaProgrammer.write({
         
     | 
| 
      
 139 
     | 
    
         
            +
                            components: ctx.components,
         
     | 
| 
      
 140 
     | 
    
         
            +
                            importer: ctx.importer,
         
     | 
| 
      
 141 
     | 
    
         
            +
                            schema: ctx.route.query.schema,
         
     | 
| 
      
 142 
     | 
    
         
            +
                          }),
         
     | 
| 
      
 143 
     | 
    
         
            +
                        },
         
     | 
| 
      
 144 
     | 
    
         
            +
                      ]
         
     | 
| 
      
 145 
     | 
    
         
            +
                    : []),
         
     | 
| 
      
 146 
     | 
    
         
            +
                  ...(ctx.route.body
         
     | 
| 
      
 147 
     | 
    
         
            +
                    ? [
         
     | 
| 
      
 148 
     | 
    
         
            +
                        {
         
     | 
| 
      
 149 
     | 
    
         
            +
                          category: "body",
         
     | 
| 
      
 150 
     | 
    
         
            +
                          name: ctx.route.body.key,
         
     | 
| 
      
 151 
     | 
    
         
            +
                          schema: NestiaMigrateSchemaProgrammer.write({
         
     | 
| 
      
 152 
     | 
    
         
            +
                            components: ctx.components,
         
     | 
| 
      
 153 
     | 
    
         
            +
                            importer: ctx.importer,
         
     | 
| 
      
 154 
     | 
    
         
            +
                            schema: ctx.route.body.schema,
         
     | 
| 
      
 155 
     | 
    
         
            +
                          }),
         
     | 
| 
      
 156 
     | 
    
         
            +
                        },
         
     | 
| 
      
 157 
     | 
    
         
            +
                      ]
         
     | 
| 
      
 158 
     | 
    
         
            +
                    : []),
         
     | 
| 
      
 159 
     | 
    
         
            +
                ];
         
     | 
| 
      
 160 
     | 
    
         
            +
                if (parameters.length === 0) return [];
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                const validator = StatementFactory.constant({
         
     | 
| 
      
 163 
     | 
    
         
            +
                  name: "assert",
         
     | 
| 
      
 164 
     | 
    
         
            +
                  value: ts.factory.createCallExpression(
         
     | 
| 
      
 165 
     | 
    
         
            +
                    IdentifierFactory.access(
         
     | 
| 
      
 166 
     | 
    
         
            +
                      ts.factory.createIdentifier(
         
     | 
| 
      
 167 
     | 
    
         
            +
                        ctx.importer.external({
         
     | 
| 
      
 168 
     | 
    
         
            +
                          type: "instance",
         
     | 
| 
      
 169 
     | 
    
         
            +
                          library: `@nestia/fetcher/lib/NestiaSimulator`,
         
     | 
| 
      
 170 
     | 
    
         
            +
                          name: "NestiaSimulator",
         
     | 
| 
      
 171 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 172 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 173 
     | 
    
         
            +
                      "assert",
         
     | 
| 
      
 174 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 175 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 176 
     | 
    
         
            +
                    [
         
     | 
| 
      
 177 
     | 
    
         
            +
                      ts.factory.createObjectLiteralExpression(
         
     | 
| 
      
 178 
     | 
    
         
            +
                        [
         
     | 
| 
      
 179 
     | 
    
         
            +
                          ts.factory.createPropertyAssignment(
         
     | 
| 
      
 180 
     | 
    
         
            +
                            "method",
         
     | 
| 
      
 181 
     | 
    
         
            +
                            ts.factory.createIdentifier("METADATA.method"),
         
     | 
| 
      
 182 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 183 
     | 
    
         
            +
                          ts.factory.createPropertyAssignment(
         
     | 
| 
      
 184 
     | 
    
         
            +
                            "host",
         
     | 
| 
      
 185 
     | 
    
         
            +
                            ts.factory.createIdentifier("connection.host"),
         
     | 
| 
      
 186 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 187 
     | 
    
         
            +
                          ts.factory.createPropertyAssignment(
         
     | 
| 
      
 188 
     | 
    
         
            +
                            "path",
         
     | 
| 
      
 189 
     | 
    
         
            +
                            NestiaMigrateApiNamespaceProgrammer.writePathCallExpression(
         
     | 
| 
      
 190 
     | 
    
         
            +
                              ctx.config,
         
     | 
| 
      
 191 
     | 
    
         
            +
                              ctx.route,
         
     | 
| 
      
 192 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 193 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 194 
     | 
    
         
            +
                          ts.factory.createPropertyAssignment(
         
     | 
| 
      
 195 
     | 
    
         
            +
                            "contentType",
         
     | 
| 
      
 196 
     | 
    
         
            +
                            ts.factory.createStringLiteral(
         
     | 
| 
      
 197 
     | 
    
         
            +
                              ctx.route.success?.type ?? "application/json",
         
     | 
| 
      
 198 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 199 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 200 
     | 
    
         
            +
                        ],
         
     | 
| 
      
 201 
     | 
    
         
            +
                        true,
         
     | 
| 
      
 202 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 203 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 204 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 205 
     | 
    
         
            +
                });
         
     | 
| 
      
 206 
     | 
    
         
            +
                const individual = parameters
         
     | 
| 
      
 207 
     | 
    
         
            +
                  .map((p) =>
         
     | 
| 
      
 208 
     | 
    
         
            +
                    ts.factory.createCallExpression(
         
     | 
| 
      
 209 
     | 
    
         
            +
                      (() => {
         
     | 
| 
      
 210 
     | 
    
         
            +
                        const base = IdentifierFactory.access(
         
     | 
| 
      
 211 
     | 
    
         
            +
                          ts.factory.createIdentifier("assert"),
         
     | 
| 
      
 212 
     | 
    
         
            +
                          p.category,
         
     | 
| 
      
 213 
     | 
    
         
            +
                        );
         
     | 
| 
      
 214 
     | 
    
         
            +
                        if (p.category !== "param") return base;
         
     | 
| 
      
 215 
     | 
    
         
            +
                        return ts.factory.createCallExpression(base, undefined, [
         
     | 
| 
      
 216 
     | 
    
         
            +
                          ts.factory.createStringLiteral(p.name),
         
     | 
| 
      
 217 
     | 
    
         
            +
                        ]);
         
     | 
| 
      
 218 
     | 
    
         
            +
                      })(),
         
     | 
| 
      
 219 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 220 
     | 
    
         
            +
                      [
         
     | 
| 
      
 221 
     | 
    
         
            +
                        ts.factory.createArrowFunction(
         
     | 
| 
      
 222 
     | 
    
         
            +
                          undefined,
         
     | 
| 
      
 223 
     | 
    
         
            +
                          undefined,
         
     | 
| 
      
 224 
     | 
    
         
            +
                          [],
         
     | 
| 
      
 225 
     | 
    
         
            +
                          undefined,
         
     | 
| 
      
 226 
     | 
    
         
            +
                          undefined,
         
     | 
| 
      
 227 
     | 
    
         
            +
                          ts.factory.createCallExpression(
         
     | 
| 
      
 228 
     | 
    
         
            +
                            IdentifierFactory.access(
         
     | 
| 
      
 229 
     | 
    
         
            +
                              ts.factory.createIdentifier(
         
     | 
| 
      
 230 
     | 
    
         
            +
                                ctx.importer.external({
         
     | 
| 
      
 231 
     | 
    
         
            +
                                  type: "default",
         
     | 
| 
      
 232 
     | 
    
         
            +
                                  library: "typia",
         
     | 
| 
      
 233 
     | 
    
         
            +
                                  name: "typia",
         
     | 
| 
      
 234 
     | 
    
         
            +
                                }),
         
     | 
| 
      
 235 
     | 
    
         
            +
                              ),
         
     | 
| 
      
 236 
     | 
    
         
            +
                              "assert",
         
     | 
| 
      
 237 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 238 
     | 
    
         
            +
                            undefined,
         
     | 
| 
      
 239 
     | 
    
         
            +
                            [
         
     | 
| 
      
 240 
     | 
    
         
            +
                              p.category === "headers"
         
     | 
| 
      
 241 
     | 
    
         
            +
                                ? ts.factory.createIdentifier("connection.headers")
         
     | 
| 
      
 242 
     | 
    
         
            +
                                : property(p.name),
         
     | 
| 
      
 243 
     | 
    
         
            +
                            ],
         
     | 
| 
      
 244 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 245 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 246 
     | 
    
         
            +
                      ],
         
     | 
| 
      
 247 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 248 
     | 
    
         
            +
                  )
         
     | 
| 
      
 249 
     | 
    
         
            +
                  .map(ts.factory.createExpressionStatement);
         
     | 
| 
      
 250 
     | 
    
         
            +
                return [validator, tryAndCatch(ctx.importer, individual)];
         
     | 
| 
      
 251 
     | 
    
         
            +
              };
         
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
      
 253 
     | 
    
         
            +
              const tryAndCatch = (
         
     | 
| 
      
 254 
     | 
    
         
            +
                importer: NestiaMigrateImportProgrammer,
         
     | 
| 
      
 255 
     | 
    
         
            +
                individual: ts.Statement[],
         
     | 
| 
      
 256 
     | 
    
         
            +
              ) =>
         
     | 
| 
      
 257 
     | 
    
         
            +
                ts.factory.createTryStatement(
         
     | 
| 
      
 258 
     | 
    
         
            +
                  ts.factory.createBlock(individual, true),
         
     | 
| 
      
 259 
     | 
    
         
            +
                  ts.factory.createCatchClause(
         
     | 
| 
      
 260 
     | 
    
         
            +
                    "exp",
         
     | 
| 
      
 261 
     | 
    
         
            +
                    ts.factory.createBlock(
         
     | 
| 
      
 262 
     | 
    
         
            +
                      [
         
     | 
| 
      
 263 
     | 
    
         
            +
                        ts.factory.createIfStatement(
         
     | 
| 
      
 264 
     | 
    
         
            +
                          ts.factory.createLogicalNot(
         
     | 
| 
      
 265 
     | 
    
         
            +
                            ts.factory.createCallExpression(
         
     | 
| 
      
 266 
     | 
    
         
            +
                              IdentifierFactory.access(
         
     | 
| 
      
 267 
     | 
    
         
            +
                                ts.factory.createIdentifier(
         
     | 
| 
      
 268 
     | 
    
         
            +
                                  importer.external({
         
     | 
| 
      
 269 
     | 
    
         
            +
                                    type: "default",
         
     | 
| 
      
 270 
     | 
    
         
            +
                                    library: "typia",
         
     | 
| 
      
 271 
     | 
    
         
            +
                                    name: "typia",
         
     | 
| 
      
 272 
     | 
    
         
            +
                                  }),
         
     | 
| 
      
 273 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 274 
     | 
    
         
            +
                                "is",
         
     | 
| 
      
 275 
     | 
    
         
            +
                              ),
         
     | 
| 
      
 276 
     | 
    
         
            +
                              [
         
     | 
| 
      
 277 
     | 
    
         
            +
                                ts.factory.createTypeReferenceNode(
         
     | 
| 
      
 278 
     | 
    
         
            +
                                  importer.external({
         
     | 
| 
      
 279 
     | 
    
         
            +
                                    type: "instance",
         
     | 
| 
      
 280 
     | 
    
         
            +
                                    library: "@nestia/fetcher",
         
     | 
| 
      
 281 
     | 
    
         
            +
                                    name: "HttpError",
         
     | 
| 
      
 282 
     | 
    
         
            +
                                  }),
         
     | 
| 
      
 283 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 284 
     | 
    
         
            +
                              ],
         
     | 
| 
      
 285 
     | 
    
         
            +
                              [ts.factory.createIdentifier("exp")],
         
     | 
| 
      
 286 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 287 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 288 
     | 
    
         
            +
                          ts.factory.createThrowStatement(
         
     | 
| 
      
 289 
     | 
    
         
            +
                            ts.factory.createIdentifier("exp"),
         
     | 
| 
      
 290 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 291 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 292 
     | 
    
         
            +
                        ts.factory.createReturnStatement(
         
     | 
| 
      
 293 
     | 
    
         
            +
                          ts.factory.createAsExpression(
         
     | 
| 
      
 294 
     | 
    
         
            +
                            ts.factory.createObjectLiteralExpression(
         
     | 
| 
      
 295 
     | 
    
         
            +
                              [
         
     | 
| 
      
 296 
     | 
    
         
            +
                                ts.factory.createPropertyAssignment(
         
     | 
| 
      
 297 
     | 
    
         
            +
                                  "success",
         
     | 
| 
      
 298 
     | 
    
         
            +
                                  ts.factory.createFalse(),
         
     | 
| 
      
 299 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 300 
     | 
    
         
            +
                                ts.factory.createPropertyAssignment(
         
     | 
| 
      
 301 
     | 
    
         
            +
                                  "status",
         
     | 
| 
      
 302 
     | 
    
         
            +
                                  ts.factory.createIdentifier("exp.status"),
         
     | 
| 
      
 303 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 304 
     | 
    
         
            +
                                ts.factory.createPropertyAssignment(
         
     | 
| 
      
 305 
     | 
    
         
            +
                                  "headers",
         
     | 
| 
      
 306 
     | 
    
         
            +
                                  ts.factory.createIdentifier("exp.headers"),
         
     | 
| 
      
 307 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 308 
     | 
    
         
            +
                                ts.factory.createPropertyAssignment(
         
     | 
| 
      
 309 
     | 
    
         
            +
                                  "data",
         
     | 
| 
      
 310 
     | 
    
         
            +
                                  ts.factory.createIdentifier("exp.toJSON().message"),
         
     | 
| 
      
 311 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 312 
     | 
    
         
            +
                              ],
         
     | 
| 
      
 313 
     | 
    
         
            +
                              true,
         
     | 
| 
      
 314 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 315 
     | 
    
         
            +
                            TypeFactory.keyword("any"),
         
     | 
| 
      
 316 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 317 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 318 
     | 
    
         
            +
                      ],
         
     | 
| 
      
 319 
     | 
    
         
            +
                      true,
         
     | 
| 
      
 320 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 321 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 322 
     | 
    
         
            +
                  undefined,
         
     | 
| 
      
 323 
     | 
    
         
            +
                );
         
     | 
| 
      
 324 
     | 
    
         
            +
            }
         
     | 
| 
      
 325 
     | 
    
         
            +
             
     | 
| 
      
 326 
     | 
    
         
            +
            const constant = (name: string, expression: ts.Expression) =>
         
     | 
| 
      
 327 
     | 
    
         
            +
              ts.factory.createVariableStatement(
         
     | 
| 
      
 328 
     | 
    
         
            +
                [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
         
     | 
| 
      
 329 
     | 
    
         
            +
                ts.factory.createVariableDeclarationList(
         
     | 
| 
      
 330 
     | 
    
         
            +
                  [
         
     | 
| 
      
 331 
     | 
    
         
            +
                    ts.factory.createVariableDeclaration(
         
     | 
| 
      
 332 
     | 
    
         
            +
                      ts.factory.createIdentifier(name),
         
     | 
| 
      
 333 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 334 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 335 
     | 
    
         
            +
                      expression,
         
     | 
| 
      
 336 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 337 
     | 
    
         
            +
                  ],
         
     | 
| 
      
 338 
     | 
    
         
            +
                  ts.NodeFlags.Const,
         
     | 
| 
      
 339 
     | 
    
         
            +
                ),
         
     | 
| 
      
 340 
     | 
    
         
            +
              );
         
     | 
| 
         @@ -0,0 +1,198 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { IHttpMigrateRoute } from "@samchon/openapi";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import ts from "typescript";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { StatementFactory } from "typia/lib/factories/StatementFactory";
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
         
     | 
| 
      
 7 
     | 
    
         
            +
            import { FilePrinter } from "../utils/FilePrinter";
         
     | 
| 
      
 8 
     | 
    
         
            +
            import { NestiaMigrateE2eFunctionProgrammer } from "./NestiaMigrateE2eFileProgrammer";
         
     | 
| 
      
 9 
     | 
    
         
            +
            import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            export namespace NestiaMigrateApiStartProgrammer {
         
     | 
| 
      
 12 
     | 
    
         
            +
              export const write = (
         
     | 
| 
      
 13 
     | 
    
         
            +
                context: INestiaMigrateContext,
         
     | 
| 
      
 14 
     | 
    
         
            +
              ): Record<string, string> => {
         
     | 
| 
      
 15 
     | 
    
         
            +
                const importer: NestiaMigrateImportProgrammer =
         
     | 
| 
      
 16 
     | 
    
         
            +
                  new NestiaMigrateImportProgrammer();
         
     | 
| 
      
 17 
     | 
    
         
            +
                const main: ts.VariableStatement = writeMain(
         
     | 
| 
      
 18 
     | 
    
         
            +
                  context,
         
     | 
| 
      
 19 
     | 
    
         
            +
                  importer,
         
     | 
| 
      
 20 
     | 
    
         
            +
                  pick(context.routes),
         
     | 
| 
      
 21 
     | 
    
         
            +
                );
         
     | 
| 
      
 22 
     | 
    
         
            +
                const statements: ts.Statement[] = [
         
     | 
| 
      
 23 
     | 
    
         
            +
                  ...importer.toStatements(
         
     | 
| 
      
 24 
     | 
    
         
            +
                    (name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`,
         
     | 
| 
      
 25 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 26 
     | 
    
         
            +
                  FilePrinter.newLine(),
         
     | 
| 
      
 27 
     | 
    
         
            +
                  ts.factory.createImportDeclaration(
         
     | 
| 
      
 28 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 29 
     | 
    
         
            +
                    ts.factory.createImportClause(
         
     | 
| 
      
 30 
     | 
    
         
            +
                      false,
         
     | 
| 
      
 31 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 32 
     | 
    
         
            +
                      ts.factory.createNamedImports([
         
     | 
| 
      
 33 
     | 
    
         
            +
                        ts.factory.createImportSpecifier(
         
     | 
| 
      
 34 
     | 
    
         
            +
                          false,
         
     | 
| 
      
 35 
     | 
    
         
            +
                          undefined,
         
     | 
| 
      
 36 
     | 
    
         
            +
                          ts.factory.createIdentifier("TestGlobal"),
         
     | 
| 
      
 37 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 38 
     | 
    
         
            +
                      ]),
         
     | 
| 
      
 39 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 40 
     | 
    
         
            +
                    ts.factory.createStringLiteral("./TestGlobal"),
         
     | 
| 
      
 41 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 42 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 43 
     | 
    
         
            +
                  FilePrinter.newLine(),
         
     | 
| 
      
 44 
     | 
    
         
            +
                  main,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  ts.factory.createExpressionStatement(writeStarter()),
         
     | 
| 
      
 46 
     | 
    
         
            +
                ];
         
     | 
| 
      
 47 
     | 
    
         
            +
                return {
         
     | 
| 
      
 48 
     | 
    
         
            +
                  "test/start.ts": FilePrinter.write({ statements }),
         
     | 
| 
      
 49 
     | 
    
         
            +
                };
         
     | 
| 
      
 50 
     | 
    
         
            +
              };
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
              const writeMain = (
         
     | 
| 
      
 53 
     | 
    
         
            +
                ctx: INestiaMigrateContext,
         
     | 
| 
      
 54 
     | 
    
         
            +
                importer: NestiaMigrateImportProgrammer,
         
     | 
| 
      
 55 
     | 
    
         
            +
                route: IHttpMigrateRoute,
         
     | 
| 
      
 56 
     | 
    
         
            +
              ): ts.VariableStatement =>
         
     | 
| 
      
 57 
     | 
    
         
            +
                StatementFactory.constant({
         
     | 
| 
      
 58 
     | 
    
         
            +
                  name: "main",
         
     | 
| 
      
 59 
     | 
    
         
            +
                  value: ts.factory.createArrowFunction(
         
     | 
| 
      
 60 
     | 
    
         
            +
                    [ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
         
     | 
| 
      
 61 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 62 
     | 
    
         
            +
                    [],
         
     | 
| 
      
 63 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 64 
     | 
    
         
            +
                    undefined,
         
     | 
| 
      
 65 
     | 
    
         
            +
                    ts.factory.createBlock(
         
     | 
| 
      
 66 
     | 
    
         
            +
                      [
         
     | 
| 
      
 67 
     | 
    
         
            +
                        writeConnection(ctx, importer),
         
     | 
| 
      
 68 
     | 
    
         
            +
                        ...NestiaMigrateE2eFunctionProgrammer.writeBody({
         
     | 
| 
      
 69 
     | 
    
         
            +
                          config: ctx.config,
         
     | 
| 
      
 70 
     | 
    
         
            +
                          components: ctx.document.components,
         
     | 
| 
      
 71 
     | 
    
         
            +
                          importer,
         
     | 
| 
      
 72 
     | 
    
         
            +
                          route,
         
     | 
| 
      
 73 
     | 
    
         
            +
                        }),
         
     | 
| 
      
 74 
     | 
    
         
            +
                      ],
         
     | 
| 
      
 75 
     | 
    
         
            +
                      true,
         
     | 
| 
      
 76 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 77 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 78 
     | 
    
         
            +
                });
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
              const writeConnection = (
         
     | 
| 
      
 81 
     | 
    
         
            +
                ctx: INestiaMigrateContext,
         
     | 
| 
      
 82 
     | 
    
         
            +
                importer: NestiaMigrateImportProgrammer,
         
     | 
| 
      
 83 
     | 
    
         
            +
              ): ts.VariableStatement =>
         
     | 
| 
      
 84 
     | 
    
         
            +
                ts.factory.createVariableStatement(
         
     | 
| 
      
 85 
     | 
    
         
            +
                  undefined,
         
     | 
| 
      
 86 
     | 
    
         
            +
                  ts.factory.createVariableDeclarationList(
         
     | 
| 
      
 87 
     | 
    
         
            +
                    [
         
     | 
| 
      
 88 
     | 
    
         
            +
                      ts.factory.createVariableDeclaration(
         
     | 
| 
      
 89 
     | 
    
         
            +
                        "connection",
         
     | 
| 
      
 90 
     | 
    
         
            +
                        undefined,
         
     | 
| 
      
 91 
     | 
    
         
            +
                        ts.factory.createTypeReferenceNode(
         
     | 
| 
      
 92 
     | 
    
         
            +
                          ts.factory.createQualifiedName(
         
     | 
| 
      
 93 
     | 
    
         
            +
                            ts.factory.createIdentifier(
         
     | 
| 
      
 94 
     | 
    
         
            +
                              importer.external({
         
     | 
| 
      
 95 
     | 
    
         
            +
                                type: "default",
         
     | 
| 
      
 96 
     | 
    
         
            +
                                library: "@ORGANIZATION/PROJECT-api",
         
     | 
| 
      
 97 
     | 
    
         
            +
                                name: "api",
         
     | 
| 
      
 98 
     | 
    
         
            +
                              }),
         
     | 
| 
      
 99 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 100 
     | 
    
         
            +
                            ts.factory.createIdentifier("IConnection"),
         
     | 
| 
      
 101 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 102 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 103 
     | 
    
         
            +
                        ts.factory.createObjectLiteralExpression(
         
     | 
| 
      
 104 
     | 
    
         
            +
                          [
         
     | 
| 
      
 105 
     | 
    
         
            +
                            ts.factory.createSpreadAssignment(
         
     | 
| 
      
 106 
     | 
    
         
            +
                              ts.factory.createCallExpression(
         
     | 
| 
      
 107 
     | 
    
         
            +
                                ts.factory.createPropertyAccessExpression(
         
     | 
| 
      
 108 
     | 
    
         
            +
                                  ts.factory.createIdentifier("TestGlobal"),
         
     | 
| 
      
 109 
     | 
    
         
            +
                                  "connection",
         
     | 
| 
      
 110 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 111 
     | 
    
         
            +
                                undefined,
         
     | 
| 
      
 112 
     | 
    
         
            +
                                undefined,
         
     | 
| 
      
 113 
     | 
    
         
            +
                              ),
         
     | 
| 
      
 114 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 115 
     | 
    
         
            +
                            ...(ctx.document.servers?.[0]?.url?.length
         
     | 
| 
      
 116 
     | 
    
         
            +
                              ? [
         
     | 
| 
      
 117 
     | 
    
         
            +
                                  ts.factory.createPropertyAssignment(
         
     | 
| 
      
 118 
     | 
    
         
            +
                                    "host",
         
     | 
| 
      
 119 
     | 
    
         
            +
                                    ts.factory.createStringLiteral(
         
     | 
| 
      
 120 
     | 
    
         
            +
                                      ctx.document.servers[0].url,
         
     | 
| 
      
 121 
     | 
    
         
            +
                                    ),
         
     | 
| 
      
 122 
     | 
    
         
            +
                                  ),
         
     | 
| 
      
 123 
     | 
    
         
            +
                                ]
         
     | 
| 
      
 124 
     | 
    
         
            +
                              : []),
         
     | 
| 
      
 125 
     | 
    
         
            +
                            ...(ctx.config.simulate === true
         
     | 
| 
      
 126 
     | 
    
         
            +
                              ? [
         
     | 
| 
      
 127 
     | 
    
         
            +
                                  ts.factory.createPropertyAssignment(
         
     | 
| 
      
 128 
     | 
    
         
            +
                                    "simulate",
         
     | 
| 
      
 129 
     | 
    
         
            +
                                    ts.factory.createTrue(),
         
     | 
| 
      
 130 
     | 
    
         
            +
                                  ),
         
     | 
| 
      
 131 
     | 
    
         
            +
                                ]
         
     | 
| 
      
 132 
     | 
    
         
            +
                              : []),
         
     | 
| 
      
 133 
     | 
    
         
            +
                          ],
         
     | 
| 
      
 134 
     | 
    
         
            +
                          true,
         
     | 
| 
      
 135 
     | 
    
         
            +
                        ),
         
     | 
| 
      
 136 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 137 
     | 
    
         
            +
                    ],
         
     | 
| 
      
 138 
     | 
    
         
            +
                    ts.NodeFlags.Const,
         
     | 
| 
      
 139 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 140 
     | 
    
         
            +
                );
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
              const writeStarter = (): ts.CallExpression =>
         
     | 
| 
      
 143 
     | 
    
         
            +
                ts.factory.createCallExpression(
         
     | 
| 
      
 144 
     | 
    
         
            +
                  ts.factory.createPropertyAccessExpression(
         
     | 
| 
      
 145 
     | 
    
         
            +
                    ts.factory.createCallExpression(
         
     | 
| 
      
 146 
     | 
    
         
            +
                      ts.factory.createIdentifier("main"),
         
     | 
| 
      
 147 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 148 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 149 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 150 
     | 
    
         
            +
                    "catch",
         
     | 
| 
      
 151 
     | 
    
         
            +
                  ),
         
     | 
| 
      
 152 
     | 
    
         
            +
                  undefined,
         
     | 
| 
      
 153 
     | 
    
         
            +
                  [
         
     | 
| 
      
 154 
     | 
    
         
            +
                    ts.factory.createArrowFunction(
         
     | 
| 
      
 155 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 156 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 157 
     | 
    
         
            +
                      [IdentifierFactory.parameter("exp")],
         
     | 
| 
      
 158 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 159 
     | 
    
         
            +
                      undefined,
         
     | 
| 
      
 160 
     | 
    
         
            +
                      ts.factory.createBlock(
         
     | 
| 
      
 161 
     | 
    
         
            +
                        [
         
     | 
| 
      
 162 
     | 
    
         
            +
                          ts.factory.createExpressionStatement(
         
     | 
| 
      
 163 
     | 
    
         
            +
                            ts.factory.createCallExpression(
         
     | 
| 
      
 164 
     | 
    
         
            +
                              ts.factory.createPropertyAccessExpression(
         
     | 
| 
      
 165 
     | 
    
         
            +
                                ts.factory.createIdentifier("console"),
         
     | 
| 
      
 166 
     | 
    
         
            +
                                "log",
         
     | 
| 
      
 167 
     | 
    
         
            +
                              ),
         
     | 
| 
      
 168 
     | 
    
         
            +
                              undefined,
         
     | 
| 
      
 169 
     | 
    
         
            +
                              [ts.factory.createIdentifier("exp")],
         
     | 
| 
      
 170 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 171 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 172 
     | 
    
         
            +
                          ts.factory.createExpressionStatement(
         
     | 
| 
      
 173 
     | 
    
         
            +
                            ts.factory.createCallExpression(
         
     | 
| 
      
 174 
     | 
    
         
            +
                              ts.factory.createPropertyAccessExpression(
         
     | 
| 
      
 175 
     | 
    
         
            +
                                ts.factory.createIdentifier("process"),
         
     | 
| 
      
 176 
     | 
    
         
            +
                                "exit",
         
     | 
| 
      
 177 
     | 
    
         
            +
                              ),
         
     | 
| 
      
 178 
     | 
    
         
            +
                              undefined,
         
     | 
| 
      
 179 
     | 
    
         
            +
                              [
         
     | 
| 
      
 180 
     | 
    
         
            +
                                ts.factory.createPrefixMinus(
         
     | 
| 
      
 181 
     | 
    
         
            +
                                  ts.factory.createNumericLiteral("1"),
         
     | 
| 
      
 182 
     | 
    
         
            +
                                ),
         
     | 
| 
      
 183 
     | 
    
         
            +
                              ],
         
     | 
| 
      
 184 
     | 
    
         
            +
                            ),
         
     | 
| 
      
 185 
     | 
    
         
            +
                          ),
         
     | 
| 
      
 186 
     | 
    
         
            +
                        ],
         
     | 
| 
      
 187 
     | 
    
         
            +
                        true,
         
     | 
| 
      
 188 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 189 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 190 
     | 
    
         
            +
                  ],
         
     | 
| 
      
 191 
     | 
    
         
            +
                );
         
     | 
| 
      
 192 
     | 
    
         
            +
            }
         
     | 
| 
      
 193 
     | 
    
         
            +
             
     | 
| 
      
 194 
     | 
    
         
            +
            const pick = <T>(array: T[]): T => {
         
     | 
| 
      
 195 
     | 
    
         
            +
              const rand: number = Math.random() * array.length;
         
     | 
| 
      
 196 
     | 
    
         
            +
              const index: number = Math.min(array.length - 1, Math.floor(rand));
         
     | 
| 
      
 197 
     | 
    
         
            +
              return array[index];
         
     | 
| 
      
 198 
     | 
    
         
            +
            };
         
     | 
| 
         @@ -0,0 +1,101 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            import { OpenApi } from "@samchon/openapi";
         
     | 
| 
      
 2 
     | 
    
         
            +
            import { IPointer } from "tstl";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import ts from "typescript";
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
         
     | 
| 
      
 6 
     | 
    
         
            +
            import { FilePrinter } from "../utils/FilePrinter";
         
     | 
| 
      
 7 
     | 
    
         
            +
            import { MapUtil } from "../utils/MapUtil";
         
     | 
| 
      
 8 
     | 
    
         
            +
            import { StringUtil } from "../utils/StringUtil";
         
     | 
| 
      
 9 
     | 
    
         
            +
            import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
         
     | 
| 
      
 10 
     | 
    
         
            +
            import { NestiaMigrateSchemaProgrammer } from "./NestiaMigrateSchemaProgrammer";
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            export namespace NestiaMigrateDtoProgrammer {
         
     | 
| 
      
 13 
     | 
    
         
            +
              export interface IModule {
         
     | 
| 
      
 14 
     | 
    
         
            +
                name: string;
         
     | 
| 
      
 15 
     | 
    
         
            +
                children: Map<string, IModule>;
         
     | 
| 
      
 16 
     | 
    
         
            +
                programmer:
         
     | 
| 
      
 17 
     | 
    
         
            +
                  | null
         
     | 
| 
      
 18 
     | 
    
         
            +
                  | ((importer: NestiaMigrateImportProgrammer) => ts.TypeAliasDeclaration);
         
     | 
| 
      
 19 
     | 
    
         
            +
              }
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              export const compose = (props: {
         
     | 
| 
      
 22 
     | 
    
         
            +
                config: INestiaMigrateConfig;
         
     | 
| 
      
 23 
     | 
    
         
            +
                components: OpenApi.IComponents;
         
     | 
| 
      
 24 
     | 
    
         
            +
              }): Map<string, IModule> => {
         
     | 
| 
      
 25 
     | 
    
         
            +
                const dict: Map<string, IModule> = new Map();
         
     | 
| 
      
 26 
     | 
    
         
            +
                for (const [key, value] of Object.entries(props.components.schemas ?? {})) {
         
     | 
| 
      
 27 
     | 
    
         
            +
                  const emendedKey: string = key
         
     | 
| 
      
 28 
     | 
    
         
            +
                    .split("/")
         
     | 
| 
      
 29 
     | 
    
         
            +
                    .filter((str) => str.length !== 0)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    .map(StringUtil.escapeNonVariable)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    .join("");
         
     | 
| 
      
 32 
     | 
    
         
            +
                  prepare(dict)(emendedKey)((importer) =>
         
     | 
| 
      
 33 
     | 
    
         
            +
                    writeAlias(props.config)(props.components)(importer)(emendedKey, value),
         
     | 
| 
      
 34 
     | 
    
         
            +
                  );
         
     | 
| 
      
 35 
     | 
    
         
            +
                }
         
     | 
| 
      
 36 
     | 
    
         
            +
                return dict;
         
     | 
| 
      
 37 
     | 
    
         
            +
              };
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              const prepare =
         
     | 
| 
      
 40 
     | 
    
         
            +
                (dict: Map<string, IModule>) =>
         
     | 
| 
      
 41 
     | 
    
         
            +
                (name: string) =>
         
     | 
| 
      
 42 
     | 
    
         
            +
                (
         
     | 
| 
      
 43 
     | 
    
         
            +
                  programmer: (
         
     | 
| 
      
 44 
     | 
    
         
            +
                    importer: NestiaMigrateImportProgrammer,
         
     | 
| 
      
 45 
     | 
    
         
            +
                  ) => ts.TypeAliasDeclaration,
         
     | 
| 
      
 46 
     | 
    
         
            +
                ) => {
         
     | 
| 
      
 47 
     | 
    
         
            +
                  const accessors: string[] = name.split(".");
         
     | 
| 
      
 48 
     | 
    
         
            +
                  const modulo: IPointer<IModule> = { value: null! };
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  accessors.forEach((acc, i) => {
         
     | 
| 
      
 51 
     | 
    
         
            +
                    modulo.value = MapUtil.take(dict)(acc)(() => ({
         
     | 
| 
      
 52 
     | 
    
         
            +
                      name: acc,
         
     | 
| 
      
 53 
     | 
    
         
            +
                      children: new Map(),
         
     | 
| 
      
 54 
     | 
    
         
            +
                      programmer: null,
         
     | 
| 
      
 55 
     | 
    
         
            +
                    }));
         
     | 
| 
      
 56 
     | 
    
         
            +
                    if (i === accessors.length - 1) modulo.value.programmer = programmer;
         
     | 
| 
      
 57 
     | 
    
         
            +
                    dict = modulo.value.children;
         
     | 
| 
      
 58 
     | 
    
         
            +
                  });
         
     | 
| 
      
 59 
     | 
    
         
            +
                  return modulo!;
         
     | 
| 
      
 60 
     | 
    
         
            +
                };
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              const writeAlias =
         
     | 
| 
      
 63 
     | 
    
         
            +
                (config: INestiaMigrateConfig) =>
         
     | 
| 
      
 64 
     | 
    
         
            +
                (components: OpenApi.IComponents) =>
         
     | 
| 
      
 65 
     | 
    
         
            +
                (importer: NestiaMigrateImportProgrammer) =>
         
     | 
| 
      
 66 
     | 
    
         
            +
                (key: string, value: OpenApi.IJsonSchema) =>
         
     | 
| 
      
 67 
     | 
    
         
            +
                  FilePrinter.description(
         
     | 
| 
      
 68 
     | 
    
         
            +
                    ts.factory.createTypeAliasDeclaration(
         
     | 
| 
      
 69 
     | 
    
         
            +
                      [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
         
     | 
| 
      
 70 
     | 
    
         
            +
                      key.split(".").at(-1)!,
         
     | 
| 
      
 71 
     | 
    
         
            +
                      [],
         
     | 
| 
      
 72 
     | 
    
         
            +
                      NestiaMigrateSchemaProgrammer.write({
         
     | 
| 
      
 73 
     | 
    
         
            +
                        components,
         
     | 
| 
      
 74 
     | 
    
         
            +
                        importer,
         
     | 
| 
      
 75 
     | 
    
         
            +
                        schema: value,
         
     | 
| 
      
 76 
     | 
    
         
            +
                      }),
         
     | 
| 
      
 77 
     | 
    
         
            +
                    ),
         
     | 
| 
      
 78 
     | 
    
         
            +
                    writeComment(config)(value, key.indexOf(".") === -1),
         
     | 
| 
      
 79 
     | 
    
         
            +
                  );
         
     | 
| 
      
 80 
     | 
    
         
            +
            }
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            const writeComment =
         
     | 
| 
      
 83 
     | 
    
         
            +
              (config: INestiaMigrateConfig) =>
         
     | 
| 
      
 84 
     | 
    
         
            +
              (schema: OpenApi.IJsonSchema, top: boolean): string =>
         
     | 
| 
      
 85 
     | 
    
         
            +
                [
         
     | 
| 
      
 86 
     | 
    
         
            +
                  ...(schema.description?.length ? [schema.description] : []),
         
     | 
| 
      
 87 
     | 
    
         
            +
                  ...(schema.description?.length &&
         
     | 
| 
      
 88 
     | 
    
         
            +
                  (schema.title !== undefined || schema.deprecated === true)
         
     | 
| 
      
 89 
     | 
    
         
            +
                    ? [""]
         
     | 
| 
      
 90 
     | 
    
         
            +
                    : []),
         
     | 
| 
      
 91 
     | 
    
         
            +
                  ...(schema.title !== undefined ? [`@title ${schema.title}`] : []),
         
     | 
| 
      
 92 
     | 
    
         
            +
                  ...(schema.deprecated === true ? [`@deprecated`] : []),
         
     | 
| 
      
 93 
     | 
    
         
            +
                  ...(top
         
     | 
| 
      
 94 
     | 
    
         
            +
                    ? [
         
     | 
| 
      
 95 
     | 
    
         
            +
                        `@${config.author?.tag ?? "nestia"} ${config.author?.value ?? "Generated by Nestia - https://github.com/samchon/nestia"}`,
         
     | 
| 
      
 96 
     | 
    
         
            +
                      ]
         
     | 
| 
      
 97 
     | 
    
         
            +
                    : []),
         
     | 
| 
      
 98 
     | 
    
         
            +
                ]
         
     | 
| 
      
 99 
     | 
    
         
            +
                  .join("\n")
         
     | 
| 
      
 100 
     | 
    
         
            +
                  .split("*/")
         
     | 
| 
      
 101 
     | 
    
         
            +
                  .join("*\\/");
         
     |