@nestia/migrate 0.12.0 → 0.13.0-dev.20240411
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/lib/MigrateApplication.d.ts +3 -4
- package/lib/MigrateApplication.js +5160 -947
- package/lib/MigrateApplication.js.map +1 -1
- package/lib/analyzers/MigrateControllerAnalyzer.js +2 -1
- package/lib/analyzers/MigrateControllerAnalyzer.js.map +1 -1
- package/lib/analyzers/MigrateMethodAnalyzer.d.ts +2 -2
- package/lib/analyzers/MigrateMethodAnalyzer.js +60 -143
- package/lib/analyzers/MigrateMethodAnalyzer.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +2 -2
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +1 -1
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/factories/TypeLiteralFactory.d.ts +4 -0
- package/lib/factories/TypeLiteralFactory.js +35 -0
- package/lib/factories/TypeLiteralFactory.js.map +1 -0
- package/lib/internal/MigrateCommander.js +2 -2
- package/lib/internal/MigrateCommander.js.map +1 -1
- package/lib/module.d.ts +0 -6
- package/lib/module.js +0 -6
- package/lib/module.js.map +1 -1
- package/lib/programmers/MigrateApiFileProgrammer.d.ts +2 -2
- package/lib/programmers/MigrateApiFileProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiFunctionProgrammer.d.ts +3 -3
- package/lib/programmers/MigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiNamespaceProgrammer.d.ts +2 -2
- package/lib/programmers/MigrateApiNamespaceProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiProgrammer.js +2 -2
- package/lib/programmers/MigrateApiProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiSimulatationProgrammer.d.ts +3 -3
- package/lib/programmers/MigrateApiSimulatationProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiStartProgrammer.js +8 -8
- package/lib/programmers/MigrateApiStartProgrammer.js.map +1 -1
- package/lib/programmers/MigrateDtoProgrammer.d.ts +2 -2
- package/lib/programmers/MigrateDtoProgrammer.js.map +1 -1
- package/lib/programmers/MigrateE2eFileProgrammer.d.ts +3 -3
- package/lib/programmers/MigrateE2eFileProgrammer.js.map +1 -1
- package/lib/programmers/MigrateE2eProgrammer.js +1 -1
- package/lib/programmers/MigrateE2eProgrammer.js.map +1 -1
- package/lib/programmers/MigrateImportProgrammer.d.ts +1 -1
- package/lib/programmers/MigrateImportProgrammer.js +2 -4
- package/lib/programmers/MigrateImportProgrammer.js.map +1 -1
- package/lib/programmers/MigrateNestControllerProgrammer.d.ts +2 -2
- package/lib/programmers/MigrateNestControllerProgrammer.js.map +1 -1
- package/lib/programmers/MigrateNestMethodProgrammer.d.ts +2 -2
- package/lib/programmers/MigrateNestMethodProgrammer.js.map +1 -1
- package/lib/programmers/MigrateNestProgrammer.js +2 -2
- package/lib/programmers/MigrateNestProgrammer.js.map +1 -1
- package/lib/programmers/MigrateSchemaProgrammer.d.ts +2 -3
- package/lib/programmers/MigrateSchemaProgrammer.js +151 -28
- package/lib/programmers/MigrateSchemaProgrammer.js.map +1 -1
- package/lib/structures/IMigrateDto.d.ts +2 -2
- package/lib/structures/IMigrateProgram.d.ts +3 -4
- package/lib/structures/IMigrateRoute.d.ts +6 -6
- package/lib/utils/OpenApiTypeChecker.d.ts +15 -0
- package/lib/utils/OpenApiTypeChecker.js +28 -0
- package/lib/utils/OpenApiTypeChecker.js.map +1 -0
- package/package.json +4 -3
- package/src/MigrateApplication.ts +81 -86
- package/src/analyzers/MigrateControllerAnalyzer.ts +7 -5
- package/src/analyzers/MigrateMethodAnalyzer.ts +103 -179
- package/src/bundles/NEST_TEMPLATE.ts +2 -2
- package/src/bundles/SDK_TEMPLATE.ts +1 -1
- package/src/factories/TypeLiteralFactory.ts +57 -0
- package/src/internal/MigrateCommander.ts +4 -4
- package/src/module.ts +0 -6
- package/src/programmers/MigrateApiFileProgrammer.ts +2 -2
- package/src/programmers/MigrateApiFunctionProgrammer.ts +3 -3
- package/src/programmers/MigrateApiNamespaceProgrammer.ts +5 -5
- package/src/programmers/MigrateApiProgrammer.ts +4 -2
- package/src/programmers/MigrateApiSimulatationProgrammer.ts +4 -4
- package/src/programmers/MigrateApiStartProgrammer.ts +8 -8
- package/src/programmers/MigrateDtoProgrammer.ts +5 -6
- package/src/programmers/MigrateE2eFileProgrammer.ts +4 -4
- package/src/programmers/MigrateE2eProgrammer.ts +3 -3
- package/src/programmers/MigrateImportProgrammer.ts +117 -121
- package/src/programmers/MigrateNestControllerProgrammer.ts +2 -2
- package/src/programmers/MigrateNestMethodProgrammer.ts +6 -7
- package/src/programmers/MigrateNestProgrammer.ts +2 -2
- package/src/programmers/MigrateSchemaProgrammer.ts +355 -263
- package/src/structures/IMigrateDto.ts +2 -2
- package/src/structures/IMigrateProgram.ts +4 -4
- package/src/structures/IMigrateRoute.ts +6 -6
- package/src/utils/OpenApiTypeChecker.ts +73 -0
- package/lib/structures/ISwagger.d.ts +0 -18
- package/lib/structures/ISwagger.js +0 -3
- package/lib/structures/ISwagger.js.map +0 -1
- package/lib/structures/ISwaggerComponents.d.ts +0 -12
- package/lib/structures/ISwaggerComponents.js +0 -3
- package/lib/structures/ISwaggerComponents.js.map +0 -1
- package/lib/structures/ISwaggerInfo.d.ts +0 -71
- package/lib/structures/ISwaggerInfo.js +0 -3
- package/lib/structures/ISwaggerInfo.js.map +0 -1
- package/lib/structures/ISwaggerRoute.d.ts +0 -15
- package/lib/structures/ISwaggerRoute.js +0 -3
- package/lib/structures/ISwaggerRoute.js.map +0 -1
- package/lib/structures/ISwaggerRouteBodyContent.d.ts +0 -14
- package/lib/structures/ISwaggerRouteBodyContent.js +0 -3
- package/lib/structures/ISwaggerRouteBodyContent.js.map +0 -1
- package/lib/structures/ISwaggerRouteHeader.d.ts +0 -0
- package/lib/structures/ISwaggerRouteHeader.js +0 -2
- package/lib/structures/ISwaggerRouteHeader.js.map +0 -1
- package/lib/structures/ISwaggerRouteParameter.d.ts +0 -13
- package/lib/structures/ISwaggerRouteParameter.js +0 -3
- package/lib/structures/ISwaggerRouteParameter.js.map +0 -1
- package/lib/structures/ISwaggerRouteRequestBody.d.ts +0 -11
- package/lib/structures/ISwaggerRouteRequestBody.js +0 -3
- package/lib/structures/ISwaggerRouteRequestBody.js.map +0 -1
- package/lib/structures/ISwaggerRouteResponse.d.ts +0 -10
- package/lib/structures/ISwaggerRouteResponse.js +0 -3
- package/lib/structures/ISwaggerRouteResponse.js.map +0 -1
- package/lib/structures/ISwaggerSchema.d.ts +0 -75
- package/lib/structures/ISwaggerSchema.js +0 -3
- package/lib/structures/ISwaggerSchema.js.map +0 -1
- package/lib/structures/ISwaggerSecurityScheme.d.ts +0 -40
- package/lib/structures/ISwaggerSecurityScheme.js +0 -3
- package/lib/structures/ISwaggerSecurityScheme.js.map +0 -1
- package/lib/structures/ISwaggerV20.d.ts +0 -8
- package/lib/structures/ISwaggerV20.js +0 -3
- package/lib/structures/ISwaggerV20.js.map +0 -1
- package/lib/structures/ISwaggerV31.d.ts +0 -9
- package/lib/structures/ISwaggerV31.js +0 -3
- package/lib/structures/ISwaggerV31.js.map +0 -1
- package/lib/utils/OpenApiConverter.d.ts +0 -5
- package/lib/utils/OpenApiConverter.js +0 -1568
- package/lib/utils/OpenApiConverter.js.map +0 -1
- package/lib/utils/SwaggerComponentsExplorer.d.ts +0 -9
- package/lib/utils/SwaggerComponentsExplorer.js +0 -29
- package/lib/utils/SwaggerComponentsExplorer.js.map +0 -1
- package/lib/utils/SwaggerTypeChecker.d.ts +0 -16
- package/lib/utils/SwaggerTypeChecker.js +0 -34
- package/lib/utils/SwaggerTypeChecker.js.map +0 -1
- package/src/structures/ISwagger.ts +0 -23
- package/src/structures/ISwaggerComponents.ts +0 -13
- package/src/structures/ISwaggerInfo.ts +0 -80
- package/src/structures/ISwaggerRoute.ts +0 -20
- package/src/structures/ISwaggerRouteBodyContent.ts +0 -15
- package/src/structures/ISwaggerRouteHeader.ts +0 -0
- package/src/structures/ISwaggerRouteParameter.ts +0 -14
- package/src/structures/ISwaggerRouteRequestBody.ts +0 -12
- package/src/structures/ISwaggerRouteResponse.ts +0 -11
- package/src/structures/ISwaggerSchema.ts +0 -90
- package/src/structures/ISwaggerSecurityScheme.ts +0 -47
- package/src/structures/ISwaggerV20.ts +0 -10
- package/src/structures/ISwaggerV31.ts +0 -10
- package/src/utils/OpenApiConverter.ts +0 -19
- package/src/utils/SwaggerComponentsExplorer.ts +0 -43
- package/src/utils/SwaggerTypeChecker.ts +0 -67
@@ -47,7 +47,7 @@ export const NEST_TEMPLATE = [
|
|
47
47
|
{
|
48
48
|
"location": "",
|
49
49
|
"file": "package.json",
|
50
|
-
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.
|
50
|
+
"content": "{\r\n \"private\": true,\r\n \"name\": \"@ORGANIZATION/PROJECT\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"Starter kit of Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"scripts\": {\r\n \"test\": \"node bin/test\",\r\n \"test:webpack\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------BUILDS------------------------\": \"\",\r\n \"build\": \"npm run build:sdk && npm run build:main && npm run build:test\",\r\n \"build:api\": \"rimraf packages/api/lib && npm run build:sdk && tsc -p packages/api/tsconfig.json\",\r\n \"build:main\": \"rimraf lib && tsc\",\r\n \"build:sdk\": \"rimraf src/api/functional && nestia sdk\",\r\n \"build:swagger\": \"npx nestia swagger\",\r\n \"build:test\": \"rimraf bin && tsc -p test/tsconfig.json\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"eslint\": \"eslint src && eslint test\",\r\n \"eslint:fix\": \"eslint --fix src && eslint --fix test\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"prettier\": \"prettier src --write && prettier test --write\",\r\n \"------------------------WEBPACK------------------------\": \"\",\r\n \"webpack\": \"rimraf dist && webpack\",\r\n \"webpack:start\": \"cd dist && node dist/server\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"npm run build:swagger && npm run build:api && cd packages/api && npm publish\",\r\n \"start\": \"node lib/executable/server\",\r\n \"start:swagger\": \"ts-node src/executable/swagger.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia-start\"\r\n },\r\n \"keywords\": [\r\n \"nestia\",\r\n \"template\",\r\n \"boilerplate\"\r\n ],\r\n \"author\": \"AUTHOR\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia-start/issues\"\r\n },\r\n \"homepage\": \"https://github.com/samchon/nestia-start#readme\",\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.3\",\r\n \"@nestia/sdk\": \"^2.6.4\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/cli\": \"^0.11.21\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"^8.2.5\",\r\n \"@types/node\": \"^18.11.0\",\r\n \"@types/uuid\": \"^8.3.4\",\r\n \"@typescript-eslint/eslint-plugin\": \"^6.19.1\",\r\n \"@typescript-eslint/parser\": \"^6.19.1\",\r\n \"chalk\": \"^4.1.0\",\r\n \"cli\": \"^1.0.1\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^2.0.0\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^5.3.0\",\r\n \"prettier\": \"^3.2.4\",\r\n \"prettier-plugin-prisma\": \"^5.0.0\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"source-map-support\": \"^0.5.21\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-loader\": \"^9.5.1\",\r\n \"ts-node\": \"^10.9.1\",\r\n \"ts-patch\": \"^3.0.2\",\r\n \"typescript\": \"^5.3.2\",\r\n \"typescript-transform-paths\": \"^3.4.6\",\r\n \"webpack\": \"^5.89.0\",\r\n \"webpack-cli\": \"^5.1.4\",\r\n \"write-file-webpack-plugin\": \"^4.5.1\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/core\": \"^2.6.4\",\r\n \"@nestia/fetcher\": \"^2.6.4\",\r\n \"@nestjs/common\": \"^10.3.7\",\r\n \"@nestjs/core\": \"^10.3.7\",\r\n \"@nestjs/platform-express\": \"^10.3.7\",\r\n \"commander\": \"10.0.0\",\r\n \"dotenv\": \"^16.3.1\",\r\n \"dotenv-expand\": \"^10.0.0\",\r\n \"inquirer\": \"8.2.5\",\r\n \"serialize-error\": \"^4.1.0\",\r\n \"tstl\": \"^3.0.0\",\r\n \"typia\": \"^5.5.10\",\r\n \"uuid\": \"^9.0.0\"\r\n },\r\n \"stackblitz\": {\r\n \"startCommand\": \"npm run prepare && npm run build:test && npm run test\"\r\n }\r\n}"
|
51
51
|
},
|
52
52
|
{
|
53
53
|
"location": "packages/api",
|
@@ -62,7 +62,7 @@ export const NEST_TEMPLATE = [
|
|
62
62
|
{
|
63
63
|
"location": "packages/api",
|
64
64
|
"file": "package.json",
|
65
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"npm run build:sdk && npm run compile\",\r\n \"build:sdk\": \"rimraf ../../src/api/functional && cd ../.. && npx nestia sdk && cd packages/api\",\r\n \"compile\": \"rimraf lib && tsc\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"prepare\": \"ts-patch install && typia patch\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.6.
|
65
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"scripts\": {\r\n \"build\": \"npm run build:sdk && npm run compile\",\r\n \"build:sdk\": \"rimraf ../../src/api/functional && cd ../.. && npx nestia sdk && cd packages/api\",\r\n \"compile\": \"rimraf lib && tsc\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"prepare\": \"ts-patch install && typia patch\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"devDependencies\": {\r\n \"rimraf\": \"^5.0.5\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\"\r\n },\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.6.4\",\r\n \"typia\": \"^5.5.10\"\r\n }\r\n}"
|
66
66
|
},
|
67
67
|
{
|
68
68
|
"location": "packages/api",
|
@@ -27,7 +27,7 @@ export const SDK_TEMPLATE = [
|
|
27
27
|
{
|
28
28
|
"location": "",
|
29
29
|
"file": "package.json",
|
30
|
-
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"exports\": {\r\n \".\": {\r\n \"types\": \"./lib/index.d.ts\",\r\n \"require\": \"./lib/index.js\",\r\n \"import\": \"./lib/index.mjs\"\r\n }\r\n },\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc && rollup -c\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"hello\": \"node hello\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"ts-node test/start.ts\",\r\n \"swagger\": \"ts-node test/swagger.ts\",\r\n \"test\": \"ts-node test/index.ts\",\r\n \"test:simulate\": \"ts-node test/index.ts --simulate true\",\r\n \"test:manual\": \"ts-node test/manual.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.6.
|
30
|
+
"content": "{\r\n \"name\": \"@ORGANIZATION/PROJECT-api\",\r\n \"version\": \"0.1.0\",\r\n \"description\": \"SDK library generated by Nestia\",\r\n \"main\": \"lib/index.js\",\r\n \"typings\": \"lib/index.d.ts\",\r\n \"exports\": {\r\n \".\": {\r\n \"types\": \"./lib/index.d.ts\",\r\n \"require\": \"./lib/index.js\",\r\n \"import\": \"./lib/index.mjs\"\r\n }\r\n },\r\n \"scripts\": {\r\n \"build\": \"rimraf lib && tsc && rollup -c\",\r\n \"build:test\": \"rimraf bin && tsc --project test/tsconfig.json\",\r\n \"deploy\": \"npm run build && npm publish\",\r\n \"dev\": \"npm run build:test -- --watch\",\r\n \"hello\": \"node hello\",\r\n \"prepare\": \"ts-patch install && typia patch\",\r\n \"start\": \"ts-node test/start.ts\",\r\n \"swagger\": \"ts-node test/swagger.ts\",\r\n \"test\": \"ts-node test/index.ts\",\r\n \"test:simulate\": \"ts-node test/index.ts --simulate true\",\r\n \"test:manual\": \"ts-node test/manual.ts\"\r\n },\r\n \"repository\": {\r\n \"type\": \"git\",\r\n \"url\": \"https://github.com/samchon/nestia\"\r\n },\r\n \"author\": \"Jeongho Nam\",\r\n \"license\": \"MIT\",\r\n \"bugs\": {\r\n \"url\": \"https://github.com/samchon/nestia/issues\"\r\n },\r\n \"homepage\": \"https://nestia.io\",\r\n \"files\": [\r\n \"lib\",\r\n \"swagger.json\",\r\n \"package.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^2.6.4\",\r\n \"typia\": \"^5.5.10\"\r\n },\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.4.2\",\r\n \"@rollup/plugin-terser\": \"^0.4.4\",\r\n \"@rollup/plugin-typescript\": \"^11.1.6\",\r\n \"@trivago/prettier-plugin-sort-imports\": \"^4.3.0\",\r\n \"@types/express\": \"^4.17.21\",\r\n \"@types/inquirer\": \"8.2.5\",\r\n \"@types/swagger-ui-express\": \"^4.1.6\",\r\n \"commander\": \"^10.0.0\",\r\n \"express\": \"^4.19.2\",\r\n \"inquirer\": \"8.2.5\",\r\n \"prettier\": \"^3.2.5\",\r\n \"rimraf\": \"^5.0.5\",\r\n \"rollup\": \"^4.13.2\",\r\n \"swagger-ui-express\": \"^5.0.0\",\r\n \"ts-node\": \"^10.9.2\",\r\n \"ts-patch\": \"^3.1.2\",\r\n \"typescript\": \"^5.3.3\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n }\r\n}"
|
31
31
|
},
|
32
32
|
{
|
33
33
|
"location": "",
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import ts from "typescript";
|
2
|
+
import { Escaper } from "typia/lib/utils/Escaper";
|
3
|
+
|
4
|
+
export namespace TypeLiteralFactory {
|
5
|
+
export const generate = (value: any): ts.TypeNode =>
|
6
|
+
typeof value === "boolean"
|
7
|
+
? generateBoolean(value)
|
8
|
+
: typeof value === "number"
|
9
|
+
? generateNumber(value)
|
10
|
+
: typeof value === "string"
|
11
|
+
? generatestring(value)
|
12
|
+
: typeof value === "object"
|
13
|
+
? value === null
|
14
|
+
? generateNull()
|
15
|
+
: Array.isArray(value)
|
16
|
+
? generateTuple(value)
|
17
|
+
: generateObject(value)
|
18
|
+
: ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword);
|
19
|
+
|
20
|
+
const generatestring = (str: string) =>
|
21
|
+
ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(str));
|
22
|
+
|
23
|
+
const generateNumber = (num: number) =>
|
24
|
+
ts.factory.createLiteralTypeNode(
|
25
|
+
num < 0
|
26
|
+
? ts.factory.createPrefixUnaryExpression(
|
27
|
+
ts.SyntaxKind.MinusToken,
|
28
|
+
ts.factory.createNumericLiteral(-num),
|
29
|
+
)
|
30
|
+
: ts.factory.createNumericLiteral(num),
|
31
|
+
);
|
32
|
+
|
33
|
+
const generateBoolean = (bool: boolean) =>
|
34
|
+
ts.factory.createLiteralTypeNode(
|
35
|
+
bool ? ts.factory.createTrue() : ts.factory.createFalse(),
|
36
|
+
);
|
37
|
+
|
38
|
+
const generateNull = () =>
|
39
|
+
ts.factory.createLiteralTypeNode(ts.factory.createNull());
|
40
|
+
|
41
|
+
const generateTuple = (items: any[]) =>
|
42
|
+
ts.factory.createTupleTypeNode(items.map(generate));
|
43
|
+
|
44
|
+
const generateObject = (obj: object) =>
|
45
|
+
ts.factory.createTypeLiteralNode(
|
46
|
+
Object.entries(obj).map(([key, value]) =>
|
47
|
+
ts.factory.createPropertySignature(
|
48
|
+
undefined,
|
49
|
+
Escaper.variable(key)
|
50
|
+
? ts.factory.createIdentifier(key)
|
51
|
+
: ts.factory.createStringLiteral(key),
|
52
|
+
undefined,
|
53
|
+
generate(value),
|
54
|
+
),
|
55
|
+
),
|
56
|
+
);
|
57
|
+
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import fs from "fs";
|
2
3
|
import path from "path";
|
3
4
|
import { format } from "prettier";
|
@@ -5,7 +6,6 @@ import { IValidation } from "typia";
|
|
5
6
|
|
6
7
|
import { MigrateApplication } from "../MigrateApplication";
|
7
8
|
import { MigrateFileArchiver } from "../archivers/MigrateFileArchiver";
|
8
|
-
import { ISwagger } from "../structures/ISwagger";
|
9
9
|
import { MigrateInquirer } from "./MigrateInquirer";
|
10
10
|
|
11
11
|
export namespace MigrateCommander {
|
@@ -23,19 +23,19 @@ export namespace MigrateCommander {
|
|
23
23
|
halt("Output directory's parent is not a directory.");
|
24
24
|
|
25
25
|
// READ SWAGGER
|
26
|
-
const
|
26
|
+
const document: OpenApi.IDocument = (() => {
|
27
27
|
if (fs.existsSync(options.input) === false)
|
28
28
|
halt("Unable to find the input swagger.json file.");
|
29
29
|
const stats: fs.Stats = fs.statSync(options.input);
|
30
30
|
if (stats.isFile() === false)
|
31
31
|
halt("The input swagger.json is not a file.");
|
32
32
|
const content: string = fs.readFileSync(options.input, "utf-8");
|
33
|
-
const swagger:
|
33
|
+
const swagger: OpenApi.IDocument = JSON.parse(content);
|
34
34
|
return swagger;
|
35
35
|
})();
|
36
36
|
|
37
37
|
const result: IValidation<MigrateApplication> =
|
38
|
-
await MigrateApplication.create(
|
38
|
+
await MigrateApplication.create(document);
|
39
39
|
if (result.success === false) {
|
40
40
|
console.log(result.errors);
|
41
41
|
throw new Error(
|
package/src/module.ts
CHANGED
@@ -4,11 +4,5 @@ export * from "./analyzers/MigrateAnalyzer";
|
|
4
4
|
|
5
5
|
export * from "./archivers/MigrateFileArchiver";
|
6
6
|
|
7
|
-
export * from "./structures/ISwagger";
|
8
|
-
export * from "./structures/ISwaggerComponents";
|
9
|
-
export * from "./structures/ISwaggerInfo";
|
10
|
-
export * from "./structures/ISwaggerRoute";
|
11
|
-
export * from "./structures/ISwaggerSecurityScheme";
|
12
|
-
export * from "./structures/ISwaggerSchema";
|
13
7
|
export * from "./structures/IMigrateProgram";
|
14
8
|
export * from "./structures/IMigrateSchema";
|
@@ -1,9 +1,9 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
|
3
4
|
import { IMigrateController } from "../structures/IMigrateController";
|
4
5
|
import { IMigrateProgram } from "../structures/IMigrateProgram";
|
5
6
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
6
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
7
7
|
import { MigrateApiFunctionProgrammer } from "./MigrateApiFunctionProgrammer";
|
8
8
|
import { MigrateApiNamespaceProgrammer } from "./MigrateApiNamespaceProgrammer";
|
9
9
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -22,7 +22,7 @@ export namespace MigrateApiFileProgrammer {
|
|
22
22
|
|
23
23
|
export const write =
|
24
24
|
(config: IMigrateProgram.IConfig) =>
|
25
|
-
(components:
|
25
|
+
(components: OpenApi.IComponents) =>
|
26
26
|
(props: IProps): ts.Statement[] => {
|
27
27
|
const importer: MigrateImportProgrammer = new MigrateImportProgrammer();
|
28
28
|
const statements: ts.Statement[] = props.entries
|
@@ -1,10 +1,10 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
3
4
|
|
4
5
|
import { IMigrateController } from "../structures/IMigrateController";
|
5
6
|
import { IMigrateProgram } from "../structures/IMigrateProgram";
|
6
7
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
7
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
8
8
|
import { FilePrinter } from "../utils/FilePrinter";
|
9
9
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
10
10
|
import { MigrateSchemaProgrammer } from "./MigrateSchemaProgrammer";
|
@@ -18,7 +18,7 @@ export namespace MigrateApiFunctionProgrammer {
|
|
18
18
|
|
19
19
|
export const write =
|
20
20
|
(config: IMigrateProgram.IConfig) =>
|
21
|
-
(components:
|
21
|
+
(components: OpenApi.IComponents) =>
|
22
22
|
(importer: MigrateImportProgrammer) =>
|
23
23
|
(props: IProps): ts.FunctionDeclaration =>
|
24
24
|
FilePrinter.description(
|
@@ -42,7 +42,7 @@ export namespace MigrateApiFunctionProgrammer {
|
|
42
42
|
);
|
43
43
|
|
44
44
|
export const writeParameterDeclarations =
|
45
|
-
(components:
|
45
|
+
(components: OpenApi.IComponents) =>
|
46
46
|
(importer: MigrateImportProgrammer) =>
|
47
47
|
(props: IProps): ts.ParameterDeclaration[] => [
|
48
48
|
IdentifierFactory.parameter(
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
|
3
4
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
@@ -7,7 +8,6 @@ import { TypeFactory } from "typia/lib/factories/TypeFactory";
|
|
7
8
|
import { IMigrateController } from "../structures/IMigrateController";
|
8
9
|
import { IMigrateProgram } from "../structures/IMigrateProgram";
|
9
10
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
10
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
11
11
|
import { FilePrinter } from "../utils/FilePrinter";
|
12
12
|
import { MigrateApiSimulatationProgrammer } from "./MigrateApiSimulatationProgrammer";
|
13
13
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -22,7 +22,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
22
22
|
|
23
23
|
export const write =
|
24
24
|
(config: IMigrateProgram.IConfig) =>
|
25
|
-
(components:
|
25
|
+
(components: OpenApi.IComponents) =>
|
26
26
|
(importer: MigrateImportProgrammer) =>
|
27
27
|
(props: IProps): ts.ModuleDeclaration => {
|
28
28
|
const types = writeTypes(components)(importer)(props.route);
|
@@ -65,7 +65,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
65
65
|
);
|
66
66
|
|
67
67
|
const writeTypes =
|
68
|
-
(components:
|
68
|
+
(components: OpenApi.IComponents) =>
|
69
69
|
(importer: MigrateImportProgrammer) =>
|
70
70
|
(route: IMigrateRoute): ts.TypeAliasDeclaration[] => {
|
71
71
|
const array: ts.TypeAliasDeclaration[] = [];
|
@@ -110,7 +110,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
110
110
|
};
|
111
111
|
|
112
112
|
const writeMetadata =
|
113
|
-
(components:
|
113
|
+
(components: OpenApi.IComponents) =>
|
114
114
|
(importer: MigrateImportProgrammer) =>
|
115
115
|
(props: IProps): ts.VariableStatement =>
|
116
116
|
constant("METADATA")(
|
@@ -178,7 +178,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
178
178
|
);
|
179
179
|
|
180
180
|
const writePath =
|
181
|
-
(components:
|
181
|
+
(components: OpenApi.IComponents) =>
|
182
182
|
(importer: MigrateImportProgrammer) =>
|
183
183
|
(props: IProps): ts.VariableStatement => {
|
184
184
|
const out = (body: ts.ConciseBody) =>
|
@@ -58,14 +58,16 @@ export namespace MigrateApiProgrammer {
|
|
58
58
|
file: "index.ts",
|
59
59
|
content: FilePrinter.write({
|
60
60
|
statements: MigrateApiFileProgrammer.write(program)(
|
61
|
-
program.
|
61
|
+
program.document.components,
|
62
62
|
)(props),
|
63
63
|
}),
|
64
64
|
}));
|
65
65
|
if (program.mode === "sdk")
|
66
66
|
output.push(
|
67
67
|
...[
|
68
|
-
...MigrateDtoProgrammer.compose(
|
68
|
+
...MigrateDtoProgrammer.compose(
|
69
|
+
program.document.components,
|
70
|
+
).entries(),
|
69
71
|
].map(([key, value]) => ({
|
70
72
|
location: "src/structures",
|
71
73
|
file: `${key}.ts`,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
3
4
|
import { StatementFactory } from "typia/lib/factories/StatementFactory";
|
@@ -5,7 +6,6 @@ import { TypeFactory } from "typia/lib/factories/TypeFactory";
|
|
5
6
|
|
6
7
|
import { IMigrateController } from "../structures/IMigrateController";
|
7
8
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
8
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
9
9
|
import { MigrateApiFunctionProgrammer } from "./MigrateApiFunctionProgrammer";
|
10
10
|
import { MigrateApiNamespaceProgrammer } from "./MigrateApiNamespaceProgrammer";
|
11
11
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -18,7 +18,7 @@ export namespace MigrateApiSimulatationProgrammer {
|
|
18
18
|
alias: string;
|
19
19
|
}
|
20
20
|
export const random =
|
21
|
-
(components:
|
21
|
+
(components: OpenApi.IComponents) =>
|
22
22
|
(importer: MigrateImportProgrammer) =>
|
23
23
|
(props: IProps) => {
|
24
24
|
const output = props.route.success
|
@@ -70,7 +70,7 @@ export namespace MigrateApiSimulatationProgrammer {
|
|
70
70
|
};
|
71
71
|
|
72
72
|
export const simulate =
|
73
|
-
(components:
|
73
|
+
(components: OpenApi.IComponents) =>
|
74
74
|
(importer: MigrateImportProgrammer) =>
|
75
75
|
(props: IProps): ts.VariableStatement => {
|
76
76
|
const caller = () =>
|
@@ -121,7 +121,7 @@ export namespace MigrateApiSimulatationProgrammer {
|
|
121
121
|
};
|
122
122
|
|
123
123
|
const assert =
|
124
|
-
(components:
|
124
|
+
(components: OpenApi.IComponents) =>
|
125
125
|
(importer: MigrateImportProgrammer) =>
|
126
126
|
(props: IProps): ts.Statement[] => {
|
127
127
|
const parameters = [
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
3
4
|
import { StatementFactory } from "typia/lib/factories/StatementFactory";
|
@@ -5,7 +6,6 @@ import { StatementFactory } from "typia/lib/factories/StatementFactory";
|
|
5
6
|
import { IMigrateFile } from "../structures/IMigrateFile";
|
6
7
|
import { IMigrateProgram } from "../structures/IMigrateProgram";
|
7
8
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
8
|
-
import { ISwagger } from "../structures/ISwagger";
|
9
9
|
import { FilePrinter } from "../utils/FilePrinter";
|
10
10
|
import { MigrateE2eFunctionProgrammer } from "./MigrateE2eFileProgrammer";
|
11
11
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -13,7 +13,7 @@ import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
|
13
13
|
export namespace MigrateApiStartProgrammer {
|
14
14
|
export const write = (program: IMigrateProgram): IMigrateFile => {
|
15
15
|
const importer: MigrateImportProgrammer = new MigrateImportProgrammer();
|
16
|
-
const main: ts.VariableStatement = writeMain(program)(program.
|
16
|
+
const main: ts.VariableStatement = writeMain(program)(program.document)(
|
17
17
|
importer,
|
18
18
|
)(pick(program.controllers.map((c) => c.routes).flat()));
|
19
19
|
const statements: ts.Statement[] = [
|
@@ -50,7 +50,7 @@ export namespace MigrateApiStartProgrammer {
|
|
50
50
|
|
51
51
|
const writeMain =
|
52
52
|
(config: IMigrateProgram.IConfig) =>
|
53
|
-
(
|
53
|
+
(document: OpenApi.IDocument) =>
|
54
54
|
(importer: MigrateImportProgrammer) =>
|
55
55
|
(route: IMigrateRoute): ts.VariableStatement =>
|
56
56
|
StatementFactory.constant(
|
@@ -63,8 +63,8 @@ export namespace MigrateApiStartProgrammer {
|
|
63
63
|
undefined,
|
64
64
|
ts.factory.createBlock(
|
65
65
|
[
|
66
|
-
writeConnection(config)(
|
67
|
-
...MigrateE2eFunctionProgrammer.writeBody(
|
66
|
+
writeConnection(config)(document)(importer),
|
67
|
+
...MigrateE2eFunctionProgrammer.writeBody(document.components)(
|
68
68
|
importer,
|
69
69
|
)(route),
|
70
70
|
],
|
@@ -75,7 +75,7 @@ export namespace MigrateApiStartProgrammer {
|
|
75
75
|
|
76
76
|
const writeConnection =
|
77
77
|
(config: IMigrateProgram.IConfig) =>
|
78
|
-
(
|
78
|
+
(document: OpenApi.IDocument) =>
|
79
79
|
(importer: MigrateImportProgrammer): ts.VariableStatement =>
|
80
80
|
ts.factory.createVariableStatement(
|
81
81
|
undefined,
|
@@ -108,12 +108,12 @@ export namespace MigrateApiStartProgrammer {
|
|
108
108
|
undefined,
|
109
109
|
),
|
110
110
|
),
|
111
|
-
...(
|
111
|
+
...(document.servers?.[0]?.url?.length
|
112
112
|
? [
|
113
113
|
ts.factory.createPropertyAssignment(
|
114
114
|
"host",
|
115
115
|
ts.factory.createStringLiteral(
|
116
|
-
|
116
|
+
document.servers[0].url,
|
117
117
|
),
|
118
118
|
),
|
119
119
|
]
|
@@ -1,8 +1,7 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import { IPointer } from "tstl";
|
2
3
|
import ts from "typescript";
|
3
4
|
|
4
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
5
|
-
import { ISwaggerSchema } from "../structures/ISwaggerSchema";
|
6
5
|
import { FilePrinter } from "../utils/FilePrinter";
|
7
6
|
import { MapUtil } from "../utils/MapUtil";
|
8
7
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -18,7 +17,7 @@ export namespace MigrateDtoProgrammer {
|
|
18
17
|
}
|
19
18
|
|
20
19
|
export const compose = (
|
21
|
-
components:
|
20
|
+
components: OpenApi.IComponents,
|
22
21
|
): Map<string, IModule> => {
|
23
22
|
const dict: Map<string, IModule> = new Map();
|
24
23
|
for (const [key, value] of Object.entries(components.schemas ?? {}))
|
@@ -52,9 +51,9 @@ export namespace MigrateDtoProgrammer {
|
|
52
51
|
};
|
53
52
|
|
54
53
|
const writeAlias =
|
55
|
-
(components:
|
54
|
+
(components: OpenApi.IComponents) =>
|
56
55
|
(importer: MigrateImportProgrammer) =>
|
57
|
-
(key: string, value:
|
56
|
+
(key: string, value: OpenApi.IJsonSchema) =>
|
58
57
|
FilePrinter.description(
|
59
58
|
ts.factory.createTypeAliasDeclaration(
|
60
59
|
[ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
|
@@ -66,7 +65,7 @@ export namespace MigrateDtoProgrammer {
|
|
66
65
|
);
|
67
66
|
}
|
68
67
|
|
69
|
-
const writeComment = (schema:
|
68
|
+
const writeComment = (schema: OpenApi.IJsonSchema): string =>
|
70
69
|
[
|
71
70
|
...(schema.description?.length ? [schema.description] : []),
|
72
71
|
...(schema.description?.length &&
|
@@ -1,14 +1,14 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
3
4
|
|
4
5
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
5
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
6
6
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
7
7
|
import { MigrateSchemaProgrammer } from "./MigrateSchemaProgrammer";
|
8
8
|
|
9
9
|
export namespace MigrateE2eFunctionProgrammer {
|
10
10
|
export const write =
|
11
|
-
(components:
|
11
|
+
(components: OpenApi.IComponents) =>
|
12
12
|
(importer: MigrateImportProgrammer) =>
|
13
13
|
(route: IMigrateRoute): ts.FunctionDeclaration =>
|
14
14
|
ts.factory.createFunctionDeclaration(
|
@@ -41,7 +41,7 @@ export namespace MigrateE2eFunctionProgrammer {
|
|
41
41
|
);
|
42
42
|
|
43
43
|
export const writeBody =
|
44
|
-
(components:
|
44
|
+
(components: OpenApi.IComponents) =>
|
45
45
|
(importer: MigrateImportProgrammer) =>
|
46
46
|
(route: IMigrateRoute): ts.Statement[] => [
|
47
47
|
ts.factory.createVariableStatement(
|
@@ -83,7 +83,7 @@ export namespace MigrateE2eFunctionProgrammer {
|
|
83
83
|
];
|
84
84
|
|
85
85
|
const writeCallExpressionn =
|
86
|
-
(components:
|
86
|
+
(components: OpenApi.IComponents) =>
|
87
87
|
(importer: MigrateImportProgrammer) =>
|
88
88
|
(route: IMigrateRoute): ts.CallExpression =>
|
89
89
|
ts.factory.createCallExpression(
|
@@ -1,9 +1,9 @@
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
1
2
|
import ts from "typescript";
|
2
3
|
|
3
4
|
import { IMigrateFile } from "../structures/IMigrateFile";
|
4
5
|
import { IMigrateProgram } from "../structures/IMigrateProgram";
|
5
6
|
import { IMigrateRoute } from "../structures/IMigrateRoute";
|
6
|
-
import { ISwaggerComponents } from "../structures/ISwaggerComponents";
|
7
7
|
import { FilePrinter } from "../utils/FilePrinter";
|
8
8
|
import { MigrateE2eFunctionProgrammer } from "./MigrateE2eFileProgrammer";
|
9
9
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -11,11 +11,11 @@ import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
|
11
11
|
export namespace MigrateE2eProgrammer {
|
12
12
|
export const write = (program: IMigrateProgram): IMigrateFile[] =>
|
13
13
|
program.controllers
|
14
|
-
.map((c) => c.routes.map(writeFile(program.
|
14
|
+
.map((c) => c.routes.map(writeFile(program.document.components)))
|
15
15
|
.flat();
|
16
16
|
|
17
17
|
const writeFile =
|
18
|
-
(components:
|
18
|
+
(components: OpenApi.IComponents) =>
|
19
19
|
(route: IMigrateRoute): IMigrateFile => {
|
20
20
|
const importer: MigrateImportProgrammer = new MigrateImportProgrammer();
|
21
21
|
const func: ts.FunctionDeclaration =
|