@nestia/migrate 0.17.5 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/MigrateApplication.d.ts +5 -5
- package/lib/MigrateApplication.js +79 -79
- package/lib/MigrateApplication.js.map +1 -1
- package/lib/analyzers/MigrateAnalyzer.d.ts +2 -2
- package/lib/analyzers/MigrateAnalyzer.js +2 -2
- package/lib/analyzers/MigrateAnalyzer.js.map +1 -1
- package/lib/analyzers/MigrateControllerAnalyzer.d.ts +3 -3
- package/lib/analyzers/MigrateControllerAnalyzer.js.map +1 -1
- package/lib/archivers/MigrateFileArchiver.d.ts +2 -2
- package/lib/archivers/MigrateFileArchiver.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/executable/bundle.js.map +1 -1
- package/lib/module.d.ts +2 -2
- package/lib/module.js +2 -2
- package/lib/module.js.map +1 -1
- package/lib/programmers/MigrateApiFileProgrammer.d.ts +4 -4
- package/lib/programmers/MigrateApiFileProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiFunctionProgrammer.d.ts +4 -4
- package/lib/programmers/MigrateApiFunctionProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiNamespaceProgrammer.d.ts +4 -4
- package/lib/programmers/MigrateApiNamespaceProgrammer.js.map +1 -1
- package/lib/programmers/MigrateApiProgrammer.d.ts +3 -3
- 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.d.ts +3 -3
- package/lib/programmers/MigrateApiStartProgrammer.js.map +1 -1
- package/lib/programmers/MigrateE2eFileProgrammer.d.ts +3 -3
- package/lib/programmers/MigrateE2eFileProgrammer.js.map +1 -1
- package/lib/programmers/MigrateE2eProgrammer.d.ts +3 -3
- package/lib/programmers/MigrateE2eProgrammer.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/MigrateNestModuleProgrammer.d.ts +2 -2
- package/lib/programmers/MigrateNestModuleProgrammer.js.map +1 -1
- package/lib/programmers/MigrateNestProgrammer.d.ts +3 -3
- package/lib/programmers/MigrateNestProgrammer.js.map +1 -1
- package/lib/structures/IHttpMigrateController.d.ts +7 -0
- package/lib/structures/IHttpMigrateController.js +3 -0
- package/lib/structures/IHttpMigrateController.js.map +1 -0
- package/lib/structures/{IMigrateDto.d.ts → IHttpMigrateDto.d.ts} +2 -2
- package/lib/structures/{IMigrateDto.js → IHttpMigrateDto.js} +1 -1
- package/lib/structures/IHttpMigrateDto.js.map +1 -0
- package/lib/structures/{IMigrateFile.d.ts → IHttpMigrateFile.d.ts} +1 -1
- package/lib/structures/{IMigrateRoute.js → IHttpMigrateFile.js} +1 -1
- package/lib/structures/IHttpMigrateFile.js.map +1 -0
- package/lib/structures/{IMigrateProgram.d.ts → IHttpMigrateProgram.d.ts} +5 -5
- package/lib/structures/{IMigrateProgram.js → IHttpMigrateProgram.js} +1 -1
- package/lib/structures/IHttpMigrateProgram.js.map +1 -0
- package/lib/structures/IHttpMigrateRoute.d.ts +1 -0
- package/lib/structures/{IMigrateFile.js → IHttpMigrateRoute.js} +1 -1
- package/lib/structures/IHttpMigrateRoute.js.map +1 -0
- package/lib/structures/IHttpMigrateSchema.d.ts +4 -0
- package/lib/structures/{IMigrateController.js → IHttpMigrateSchema.js} +1 -1
- package/lib/structures/IHttpMigrateSchema.js.map +1 -0
- package/package.json +5 -5
- package/src/MigrateApplication.ts +7 -7
- package/src/analyzers/MigrateAnalyzer.ts +10 -6
- package/src/analyzers/MigrateControllerAnalyzer.ts +7 -5
- package/src/archivers/MigrateFileArchiver.ts +2 -2
- package/src/bundles/NEST_TEMPLATE.ts +2 -2
- package/src/bundles/SDK_TEMPLATE.ts +1 -1
- package/src/executable/bundle.ts +22 -21
- package/src/module.ts +2 -2
- package/src/programmers/MigrateApiFileProgrammer.ts +4 -4
- package/src/programmers/MigrateApiFunctionProgrammer.ts +8 -8
- package/src/programmers/MigrateApiNamespaceProgrammer.ts +9 -9
- package/src/programmers/MigrateApiProgrammer.ts +4 -4
- package/src/programmers/MigrateApiSimulatationProgrammer.ts +4 -4
- package/src/programmers/MigrateApiStartProgrammer.ts +7 -7
- package/src/programmers/MigrateE2eFileProgrammer.ts +4 -4
- package/src/programmers/MigrateE2eProgrammer.ts +5 -5
- package/src/programmers/MigrateNestControllerProgrammer.ts +2 -2
- package/src/programmers/MigrateNestMethodProgrammer.ts +5 -5
- package/src/programmers/MigrateNestModuleProgrammer.ts +4 -2
- package/src/programmers/MigrateNestProgrammer.ts +6 -7
- package/src/structures/IHttpMigrateController.ts +8 -0
- package/src/structures/{IMigrateDto.ts → IHttpMigrateDto.ts} +2 -2
- package/src/structures/{IMigrateFile.ts → IHttpMigrateFile.ts} +1 -1
- package/src/structures/{IMigrateProgram.ts → IHttpMigrateProgram.ts} +5 -5
- package/src/structures/IHttpMigrateRoute.ts +1 -0
- package/src/structures/IHttpMigrateSchema.ts +4 -0
- package/lib/structures/IMigrateController.d.ts +0 -7
- package/lib/structures/IMigrateController.js.map +0 -1
- package/lib/structures/IMigrateDto.js.map +0 -1
- package/lib/structures/IMigrateFile.js.map +0 -1
- package/lib/structures/IMigrateProgram.js.map +0 -1
- package/lib/structures/IMigrateRoute.d.ts +0 -1
- package/lib/structures/IMigrateRoute.js.map +0 -1
- package/lib/structures/IMigrateSchema.d.ts +0 -4
- package/lib/structures/IMigrateSchema.js +0 -3
- package/lib/structures/IMigrateSchema.js.map +0 -1
- package/src/structures/IMigrateController.ts +0 -8
- package/src/structures/IMigrateRoute.ts +0 -1
- package/src/structures/IMigrateSchema.ts +0 -4
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IHttpMigrateProgram.js","sourceRoot":"","sources":["../../src/structures/IHttpMigrateProgram.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { IHttpMigrateRoute } from "@samchon/openapi";
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IHttpMigrateRoute.js","sourceRoot":"","sources":["../../src/structures/IHttpMigrateRoute.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"IHttpMigrateSchema.js","sourceRoot":"","sources":["../../src/structures/IHttpMigrateSchema.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nestia/migrate",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.18.0",
|
4
4
|
"description": "Migration program from swagger to NestJS",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"typings": "lib/index.d.ts",
|
@@ -37,9 +37,9 @@
|
|
37
37
|
"homepage": "https://nestia.io",
|
38
38
|
"devDependencies": {
|
39
39
|
"@nestia/benchmark": "^0.2.3",
|
40
|
-
"@nestia/core": "^3.
|
40
|
+
"@nestia/core": "^3.13.0",
|
41
41
|
"@nestia/e2e": "^0.7.0",
|
42
|
-
"@nestia/fetcher": "^3.
|
42
|
+
"@nestia/fetcher": "^3.13.0",
|
43
43
|
"@nestjs/common": "^10.3.8",
|
44
44
|
"@nestjs/core": "^10.3.8",
|
45
45
|
"@nestjs/platform-express": "^10.3.8",
|
@@ -65,13 +65,13 @@
|
|
65
65
|
"typescript-transform-paths": "^3.4.6"
|
66
66
|
},
|
67
67
|
"dependencies": {
|
68
|
-
"@samchon/openapi": "^0.
|
68
|
+
"@samchon/openapi": "^1.0.0",
|
69
69
|
"commander": "10.0.0",
|
70
70
|
"inquirer": "8.2.5",
|
71
71
|
"prettier": "^3.2.5",
|
72
72
|
"tstl": "^3.0.0",
|
73
73
|
"typescript": "^5.5.4",
|
74
|
-
"typia": "^6.
|
74
|
+
"typia": "^6.10.0"
|
75
75
|
},
|
76
76
|
"files": [
|
77
77
|
"lib",
|
@@ -8,8 +8,8 @@ import { MigrateApiProgrammer } from "./programmers/MigrateApiProgrammer";
|
|
8
8
|
import { MigrateApiStartProgrammer } from "./programmers/MigrateApiStartProgrammer";
|
9
9
|
import { MigrateE2eProgrammer } from "./programmers/MigrateE2eProgrammer";
|
10
10
|
import { MigrateNestProgrammer } from "./programmers/MigrateNestProgrammer";
|
11
|
-
import {
|
12
|
-
import {
|
11
|
+
import { IHttpMigrateFile } from "./structures/IHttpMigrateFile";
|
12
|
+
import { IHttpMigrateProgram } from "./structures/IHttpMigrateProgram";
|
13
13
|
|
14
14
|
export class MigrateApplication {
|
15
15
|
private constructor(public readonly document: OpenApi.IDocument) {}
|
@@ -31,7 +31,7 @@ export class MigrateApplication {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
public nest(config: MigrateApplication.IConfig): MigrateApplication.IOutput {
|
34
|
-
const program:
|
34
|
+
const program: IHttpMigrateProgram = MigrateAnalyzer.analyze({
|
35
35
|
mode: "nest",
|
36
36
|
document: this.document,
|
37
37
|
simulate: config.simulate,
|
@@ -50,7 +50,7 @@ export class MigrateApplication {
|
|
50
50
|
}
|
51
51
|
|
52
52
|
public sdk(config: MigrateApplication.IConfig): MigrateApplication.IOutput {
|
53
|
-
const program:
|
53
|
+
const program: IHttpMigrateProgram = MigrateAnalyzer.analyze({
|
54
54
|
mode: "sdk",
|
55
55
|
document: this.document,
|
56
56
|
simulate: config.simulate,
|
@@ -75,9 +75,9 @@ export class MigrateApplication {
|
|
75
75
|
}
|
76
76
|
export namespace MigrateApplication {
|
77
77
|
export interface IOutput {
|
78
|
-
program:
|
79
|
-
files:
|
80
|
-
errors:
|
78
|
+
program: IHttpMigrateProgram;
|
79
|
+
files: IHttpMigrateFile[];
|
80
|
+
errors: IHttpMigrateProgram.IError[];
|
81
81
|
}
|
82
82
|
export interface IConfig {
|
83
83
|
simulate: boolean;
|
@@ -1,14 +1,18 @@
|
|
1
|
-
import {
|
1
|
+
import { HttpMigration, IHttpMigrateApplication } from "@samchon/openapi";
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { IHttpMigrateProgram } from "../structures/IHttpMigrateProgram";
|
4
4
|
|
5
5
|
export namespace MigrateAnalyzer {
|
6
|
-
export const analyze = (
|
7
|
-
|
6
|
+
export const analyze = (
|
7
|
+
props: IHttpMigrateProgram.IProps,
|
8
|
+
): IHttpMigrateProgram => {
|
9
|
+
const application: IHttpMigrateApplication = HttpMigration.application(
|
10
|
+
props.document,
|
11
|
+
);
|
8
12
|
return {
|
9
13
|
...props,
|
10
|
-
routes:
|
11
|
-
errors:
|
14
|
+
routes: application.routes,
|
15
|
+
errors: application.errors,
|
12
16
|
};
|
13
17
|
};
|
14
18
|
}
|
@@ -1,12 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import { IHttpMigrateRoute } from "@samchon/openapi";
|
2
2
|
|
3
|
-
import {
|
3
|
+
import { IHttpMigrateController } from "../structures/IHttpMigrateController";
|
4
4
|
import { MapUtil } from "../utils/MapUtil";
|
5
5
|
import { StringUtil } from "../utils/StringUtil";
|
6
6
|
|
7
7
|
export namespace MigrateControllerAnalyzer {
|
8
|
-
export const analyze = (
|
9
|
-
|
8
|
+
export const analyze = (
|
9
|
+
routes: IHttpMigrateRoute[],
|
10
|
+
): IHttpMigrateController[] => {
|
11
|
+
const endpoints: Map<string, IHttpMigrateRoute[]> = new Map();
|
10
12
|
for (const r of routes) {
|
11
13
|
const location: string = r.emendedPath
|
12
14
|
.split("/")
|
@@ -14,7 +16,7 @@ export namespace MigrateControllerAnalyzer {
|
|
14
16
|
.join("/");
|
15
17
|
MapUtil.take(endpoints)(location)(() => []).push(r);
|
16
18
|
}
|
17
|
-
const total:
|
19
|
+
const total: IHttpMigrateController[] = [...endpoints.entries()]
|
18
20
|
.filter(([_l, routes]) => !!routes.length)
|
19
21
|
.map(([path, routes]) => {
|
20
22
|
const name: string =
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { IHttpMigrateFile } from "../structures/IHttpMigrateFile";
|
2
2
|
|
3
3
|
export namespace MigrateFileArchiver {
|
4
4
|
export interface IOperator {
|
@@ -9,7 +9,7 @@ export namespace MigrateFileArchiver {
|
|
9
9
|
export const archive =
|
10
10
|
(operator: IOperator) =>
|
11
11
|
(output: string) =>
|
12
|
-
async (files:
|
12
|
+
async (files: IHttpMigrateFile[]): Promise<void> => {
|
13
13
|
const visited: Set<string> = new Set();
|
14
14
|
for (const f of files) {
|
15
15
|
await mkdir(operator.mkdir)(output)(visited)(f.location);
|
@@ -52,7 +52,7 @@ export const NEST_TEMPLATE = [
|
|
52
52
|
{
|
53
53
|
"location": "",
|
54
54
|
"file": "package.json",
|
55
|
-
"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 \"benchmark\": \"node bin/test/benchmark\",\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 && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\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 \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"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/benchmark\": \"^0.2.3\",\r\n \"@nestia/e2e\": \"^0.7.0\",\r\n \"@nestia/sdk\": \"^3.
|
55
|
+
"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 \"benchmark\": \"node bin/test/benchmark\",\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 && nestia all && rimraf packages/api/lib && tsc -p packages/api/tsconfig.json && rollup -c packages/api/rollup.config.js\",\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 \"webpack:test\": \"npm run webpack && node bin/test/webpack.js\",\r\n \"------------------------DEPLOYS------------------------\": \"\",\r\n \"package:api\": \"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/benchmark\": \"^0.2.3\",\r\n \"@nestia/e2e\": \"^0.7.0\",\r\n \"@nestia/sdk\": \"^3.13.0\",\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/cli\": \"^0.11.21\",\r\n \"@types/cli-progress\": \"^3.11.5\",\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\": \"^8.1.0\",\r\n \"@typescript-eslint/parser\": \"^8.1.0\",\r\n \"chalk\": \"^4.1.2\",\r\n \"cli\": \"^1.0.1\",\r\n \"cli-progress\": \"^3.12.0\",\r\n \"copy-webpack-plugin\": \"^11.0.0\",\r\n \"eslint-plugin-deprecation\": \"^3.0.0\",\r\n \"express\": \"^4.18.2\",\r\n \"nestia\": \"^6.1.0\",\r\n \"prettier\": \"^3.2.4\",\r\n \"prettier-plugin-prisma\": \"^5.0.0\",\r\n \"rimraf\": \"^3.0.2\",\r\n \"rollup\": \"^4.18.0\",\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.2.1\",\r\n \"typescript\": \"5.5.4\",\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\": \"^3.13.0\",\r\n \"@nestia/fetcher\": \"^3.13.0\",\r\n \"@nestjs/common\": \"^10.4.1\",\r\n \"@nestjs/core\": \"^10.4.1\",\r\n \"@nestjs/platform-express\": \"^10.4.1\",\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 \"tgrid\": \"^1.0.2\",\r\n \"tstl\": \"^3.0.0\",\r\n \"typia\": \"^6.10.0\",\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}\r\n"
|
56
56
|
},
|
57
57
|
{
|
58
58
|
"location": "packages/api",
|
@@ -67,7 +67,7 @@ export const NEST_TEMPLATE = [
|
|
67
67
|
{
|
68
68
|
"location": "packages/api",
|
69
69
|
"file": "package.json",
|
70
|
-
"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 \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\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 \"package.json\",\r\n \"swagger.json\",\r\n \"openai.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.
|
70
|
+
"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 \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\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 \"package.json\",\r\n \"swagger.json\",\r\n \"openai.json\",\r\n \"README.md\"\r\n ],\r\n \"dependencies\": {\r\n \"@nestia/fetcher\": \"^3.13.0\",\r\n \"tgrid\": \"^1.0.3\",\r\n \"typia\": \"^6.10.0\"\r\n }\r\n}"
|
71
71
|
},
|
72
72
|
{
|
73
73
|
"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 \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\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\": \"^3.
|
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 \"module\": \"lib/index.mjs\",\r\n \"typings\": \"lib/index.d.ts\",\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\": \"^3.13.0\",\r\n \"tgrid\": \"^1.0.3\",\r\n \"typia\": \"^6.10.0\"\r\n },\r\n \"devDependencies\": {\r\n \"@nestia/e2e\": \"^0.7.0\",\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 \"chalk\": \"4.1.2\",\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.2.1\",\r\n \"typescript\": \"5.5.4\",\r\n \"typescript-transform-paths\": \"^3.4.6\"\r\n }\r\n}\r\n"
|
31
31
|
},
|
32
32
|
{
|
33
33
|
"location": "",
|
package/src/executable/bundle.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import cp from "child_process";
|
2
2
|
import fs from "fs";
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { IHttpMigrateFile } from "../structures/IHttpMigrateFile";
|
5
5
|
|
6
6
|
const ROOT: string = `${__dirname}/../..`;
|
7
7
|
const ASSETS: string = `${ROOT}/assets`;
|
@@ -36,27 +36,28 @@ const bundle = async (props: {
|
|
36
36
|
await fs.promises.rm(`${template}/${location}`, { recursive: true });
|
37
37
|
};
|
38
38
|
|
39
|
-
const iterate =
|
40
|
-
|
41
|
-
|
42
|
-
const
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
39
|
+
const iterate =
|
40
|
+
(collection: IHttpMigrateFile[]) => async (location: string) => {
|
41
|
+
const directory: string[] = await fs.promises.readdir(location);
|
42
|
+
for (const file of directory) {
|
43
|
+
const absolute: string = location + "/" + file;
|
44
|
+
const stats: fs.Stats = await fs.promises.stat(absolute);
|
45
|
+
if (stats.isDirectory()) await iterate(collection)(absolute);
|
46
|
+
else {
|
47
|
+
const content: string = await fs.promises.readFile(absolute, "utf-8");
|
48
|
+
collection.push({
|
49
|
+
location: (() => {
|
50
|
+
const str: string = location.replace(template, "");
|
51
|
+
return str[0] === "/" ? str.substring(1) : str;
|
52
|
+
})(),
|
53
|
+
file,
|
54
|
+
content,
|
55
|
+
});
|
56
|
+
}
|
55
57
|
}
|
56
|
-
}
|
57
|
-
};
|
58
|
+
};
|
58
59
|
|
59
|
-
const archive = async (collection:
|
60
|
+
const archive = async (collection: IHttpMigrateFile[]): Promise<void> => {
|
60
61
|
const name: string = `${props.mode.toUpperCase()}_TEMPLATE`;
|
61
62
|
const body: string = JSON.stringify(collection, null, 2);
|
62
63
|
const content: string = `export const ${name} = ${body}`;
|
@@ -71,7 +72,7 @@ const bundle = async (props: {
|
|
71
72
|
);
|
72
73
|
};
|
73
74
|
|
74
|
-
const collection:
|
75
|
+
const collection: IHttpMigrateFile[] = [];
|
75
76
|
await clone();
|
76
77
|
await iterate(collection)(template);
|
77
78
|
await archive(collection);
|
package/src/module.ts
CHANGED
@@ -4,5 +4,5 @@ export * from "./analyzers/MigrateAnalyzer";
|
|
4
4
|
|
5
5
|
export * from "./archivers/MigrateFileArchiver";
|
6
6
|
|
7
|
-
export * from "./structures/
|
8
|
-
export * from "./structures/
|
7
|
+
export * from "./structures/IHttpMigrateProgram";
|
8
|
+
export * from "./structures/IHttpMigrateSchema";
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import { IHttpMigrateRoute, OpenApi } from "@samchon/openapi";
|
2
2
|
import ts from "typescript";
|
3
3
|
|
4
|
-
import {
|
4
|
+
import { IHttpMigrateProgram } from "../structures/IHttpMigrateProgram";
|
5
5
|
import { MigrateApiFunctionProgrammer } from "./MigrateApiFunctionProgrammer";
|
6
6
|
import { MigrateApiNamespaceProgrammer } from "./MigrateApiNamespaceProgrammer";
|
7
7
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -9,11 +9,11 @@ import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
|
9
9
|
export namespace MigrateApiFileProgrammer {
|
10
10
|
export interface IProps {
|
11
11
|
namespace: string[];
|
12
|
-
routes:
|
12
|
+
routes: IHttpMigrateRoute[];
|
13
13
|
children: Set<string>;
|
14
14
|
}
|
15
15
|
export const write =
|
16
|
-
(config:
|
16
|
+
(config: IHttpMigrateProgram.IConfig) =>
|
17
17
|
(components: OpenApi.IComponents) =>
|
18
18
|
(props: IProps): ts.Statement[] => {
|
19
19
|
const importer: MigrateImportProgrammer = new MigrateImportProgrammer();
|
@@ -2,18 +2,18 @@ import { OpenApi } from "@samchon/openapi";
|
|
2
2
|
import ts from "typescript";
|
3
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
4
4
|
|
5
|
-
import {
|
6
|
-
import {
|
5
|
+
import { IHttpMigrateProgram } from "../structures/IHttpMigrateProgram";
|
6
|
+
import { IHttpMigrateRoute } from "../structures/IHttpMigrateRoute";
|
7
7
|
import { FilePrinter } from "../utils/FilePrinter";
|
8
8
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
9
9
|
import { MigrateSchemaProgrammer } from "./MigrateSchemaProgrammer";
|
10
10
|
|
11
11
|
export namespace MigrateApiFunctionProgrammer {
|
12
12
|
export const write =
|
13
|
-
(config:
|
13
|
+
(config: IHttpMigrateProgram.IConfig) =>
|
14
14
|
(components: OpenApi.IComponents) =>
|
15
15
|
(importer: MigrateImportProgrammer) =>
|
16
|
-
(route:
|
16
|
+
(route: IHttpMigrateRoute): ts.FunctionDeclaration =>
|
17
17
|
FilePrinter.description(
|
18
18
|
ts.factory.createFunctionDeclaration(
|
19
19
|
[
|
@@ -39,7 +39,7 @@ export namespace MigrateApiFunctionProgrammer {
|
|
39
39
|
export const writeParameterDeclarations =
|
40
40
|
(components: OpenApi.IComponents) =>
|
41
41
|
(importer: MigrateImportProgrammer) =>
|
42
|
-
(route:
|
42
|
+
(route: IHttpMigrateRoute): ts.ParameterDeclaration[] => [
|
43
43
|
IdentifierFactory.parameter(
|
44
44
|
"connection",
|
45
45
|
ts.factory.createTypeReferenceNode(
|
@@ -85,7 +85,7 @@ export namespace MigrateApiFunctionProgrammer {
|
|
85
85
|
: []),
|
86
86
|
];
|
87
87
|
|
88
|
-
const writeDescription = (route:
|
88
|
+
const writeDescription = (route: IHttpMigrateRoute): string =>
|
89
89
|
[
|
90
90
|
route.comment(),
|
91
91
|
`@path ${route.emendedPath}`,
|
@@ -93,9 +93,9 @@ export namespace MigrateApiFunctionProgrammer {
|
|
93
93
|
].join("\n");
|
94
94
|
|
95
95
|
const writeBody =
|
96
|
-
(config:
|
96
|
+
(config: IHttpMigrateProgram.IConfig) =>
|
97
97
|
(importer: MigrateImportProgrammer) =>
|
98
|
-
(route:
|
98
|
+
(route: IHttpMigrateRoute): ts.Statement[] => {
|
99
99
|
const encrypted: boolean = !!route.success?.["x-nestia-encrypted"];
|
100
100
|
const contentType: string = route.body?.type ?? "application/json";
|
101
101
|
|
@@ -5,8 +5,8 @@ import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
|
5
5
|
import { LiteralFactory } from "typia/lib/factories/LiteralFactory";
|
6
6
|
import { TypeFactory } from "typia/lib/factories/TypeFactory";
|
7
7
|
|
8
|
-
import {
|
9
|
-
import {
|
8
|
+
import { IHttpMigrateProgram } from "../structures/IHttpMigrateProgram";
|
9
|
+
import { IHttpMigrateRoute } from "../structures/IHttpMigrateRoute";
|
10
10
|
import { FilePrinter } from "../utils/FilePrinter";
|
11
11
|
import { MigrateApiSimulatationProgrammer } from "./MigrateApiSimulatationProgrammer";
|
12
12
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -14,10 +14,10 @@ import { MigrateSchemaProgrammer } from "./MigrateSchemaProgrammer";
|
|
14
14
|
|
15
15
|
export namespace MigrateApiNamespaceProgrammer {
|
16
16
|
export const write =
|
17
|
-
(config:
|
17
|
+
(config: IHttpMigrateProgram.IConfig) =>
|
18
18
|
(components: OpenApi.IComponents) =>
|
19
19
|
(importer: MigrateImportProgrammer) =>
|
20
|
-
(route:
|
20
|
+
(route: IHttpMigrateRoute): ts.ModuleDeclaration => {
|
21
21
|
const types = writeTypes(components)(importer)(route);
|
22
22
|
return ts.factory.createModuleDeclaration(
|
23
23
|
[ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
|
@@ -43,7 +43,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
43
43
|
);
|
44
44
|
};
|
45
45
|
|
46
|
-
export const writePathCallExpression = (route:
|
46
|
+
export const writePathCallExpression = (route: IHttpMigrateRoute) =>
|
47
47
|
ts.factory.createCallExpression(
|
48
48
|
ts.factory.createIdentifier(`${route.accessor.at(-1)!}.path`),
|
49
49
|
undefined,
|
@@ -56,7 +56,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
56
56
|
const writeTypes =
|
57
57
|
(components: OpenApi.IComponents) =>
|
58
58
|
(importer: MigrateImportProgrammer) =>
|
59
|
-
(route:
|
59
|
+
(route: IHttpMigrateRoute): ts.TypeAliasDeclaration[] => {
|
60
60
|
const array: ts.TypeAliasDeclaration[] = [];
|
61
61
|
const declare = (name: string, type: ts.TypeNode) =>
|
62
62
|
array.push(
|
@@ -101,7 +101,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
101
101
|
const writeMetadata =
|
102
102
|
(components: OpenApi.IComponents) =>
|
103
103
|
(importer: MigrateImportProgrammer) =>
|
104
|
-
(route:
|
104
|
+
(route: IHttpMigrateRoute): ts.VariableStatement =>
|
105
105
|
constant("METADATA")(
|
106
106
|
ts.factory.createAsExpression(
|
107
107
|
ts.factory.createObjectLiteralExpression(
|
@@ -166,7 +166,7 @@ export namespace MigrateApiNamespaceProgrammer {
|
|
166
166
|
const writePath =
|
167
167
|
(components: OpenApi.IComponents) =>
|
168
168
|
(importer: MigrateImportProgrammer) =>
|
169
|
-
(route:
|
169
|
+
(route: IHttpMigrateRoute): ts.VariableStatement => {
|
170
170
|
const out = (body: ts.ConciseBody) =>
|
171
171
|
constant("path")(
|
172
172
|
ts.factory.createArrowFunction(
|
@@ -395,7 +395,7 @@ const constant = (name: string) => (expression: ts.Expression) =>
|
|
395
395
|
ts.NodeFlags.Const,
|
396
396
|
),
|
397
397
|
);
|
398
|
-
const getPath = (route:
|
398
|
+
const getPath = (route: IHttpMigrateRoute) => "/" + route.emendedPath;
|
399
399
|
const local = (name: string) => (type: string) => (expression: ts.Expression) =>
|
400
400
|
ts.factory.createVariableStatement(
|
401
401
|
[],
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { HashMap, hash } from "tstl";
|
2
2
|
import ts from "typescript";
|
3
3
|
|
4
|
-
import {
|
5
|
-
import {
|
4
|
+
import { IHttpMigrateFile } from "../structures/IHttpMigrateFile";
|
5
|
+
import { IHttpMigrateProgram } from "../structures/IHttpMigrateProgram";
|
6
6
|
import { FilePrinter } from "../utils/FilePrinter";
|
7
7
|
import { MigrateApiFileProgrammer } from "./MigrateApiFileProgrammer";
|
8
8
|
import { MigrateDtoProgrammer } from "./MigrateDtoProgrammer";
|
9
9
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
10
10
|
|
11
11
|
export namespace MigrateApiProgrammer {
|
12
|
-
export const write = (program:
|
12
|
+
export const write = (program: IHttpMigrateProgram): IHttpMigrateFile[] => {
|
13
13
|
const dict: HashMap<string[], MigrateApiFileProgrammer.IProps> =
|
14
14
|
new HashMap(
|
15
15
|
(x) => hash(x.join(".")),
|
@@ -39,7 +39,7 @@ export namespace MigrateApiProgrammer {
|
|
39
39
|
}
|
40
40
|
|
41
41
|
// DO GENERATE
|
42
|
-
const output:
|
42
|
+
const output: IHttpMigrateFile[] = [...dict].map(({ second: props }) => ({
|
43
43
|
location: `src/${program.mode === "nest" ? "api/" : ""}functional/${props.namespace.join("/")}`,
|
44
44
|
file: "index.ts",
|
45
45
|
content: FilePrinter.write({
|
@@ -4,7 +4,7 @@ import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
|
4
4
|
import { StatementFactory } from "typia/lib/factories/StatementFactory";
|
5
5
|
import { TypeFactory } from "typia/lib/factories/TypeFactory";
|
6
6
|
|
7
|
-
import {
|
7
|
+
import { IHttpMigrateRoute } from "../structures/IHttpMigrateRoute";
|
8
8
|
import { MigrateApiFunctionProgrammer } from "./MigrateApiFunctionProgrammer";
|
9
9
|
import { MigrateApiNamespaceProgrammer } from "./MigrateApiNamespaceProgrammer";
|
10
10
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
@@ -14,7 +14,7 @@ export namespace MigrateApiSimulatationProgrammer {
|
|
14
14
|
export const random =
|
15
15
|
(components: OpenApi.IComponents) =>
|
16
16
|
(importer: MigrateImportProgrammer) =>
|
17
|
-
(route:
|
17
|
+
(route: IHttpMigrateRoute) => {
|
18
18
|
const output = route.success
|
19
19
|
? MigrateSchemaProgrammer.write(components)(importer)(
|
20
20
|
route.success.schema,
|
@@ -66,7 +66,7 @@ export namespace MigrateApiSimulatationProgrammer {
|
|
66
66
|
export const simulate =
|
67
67
|
(components: OpenApi.IComponents) =>
|
68
68
|
(importer: MigrateImportProgrammer) =>
|
69
|
-
(route:
|
69
|
+
(route: IHttpMigrateRoute): ts.VariableStatement => {
|
70
70
|
const caller = () =>
|
71
71
|
ts.factory.createCallExpression(
|
72
72
|
ts.factory.createIdentifier("random"),
|
@@ -115,7 +115,7 @@ export namespace MigrateApiSimulatationProgrammer {
|
|
115
115
|
const assert =
|
116
116
|
(components: OpenApi.IComponents) =>
|
117
117
|
(importer: MigrateImportProgrammer) =>
|
118
|
-
(route:
|
118
|
+
(route: IHttpMigrateRoute): ts.Statement[] => {
|
119
119
|
const parameters = [
|
120
120
|
...route.parameters.map((p) => ({
|
121
121
|
category: "param",
|
@@ -3,15 +3,15 @@ import ts from "typescript";
|
|
3
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
4
4
|
import { StatementFactory } from "typia/lib/factories/StatementFactory";
|
5
5
|
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
6
|
+
import { IHttpMigrateFile } from "../structures/IHttpMigrateFile";
|
7
|
+
import { IHttpMigrateProgram } from "../structures/IHttpMigrateProgram";
|
8
|
+
import { IHttpMigrateRoute } from "../structures/IHttpMigrateRoute";
|
9
9
|
import { FilePrinter } from "../utils/FilePrinter";
|
10
10
|
import { MigrateE2eFunctionProgrammer } from "./MigrateE2eFileProgrammer";
|
11
11
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
12
12
|
|
13
13
|
export namespace MigrateApiStartProgrammer {
|
14
|
-
export const write = (program:
|
14
|
+
export const write = (program: IHttpMigrateProgram): IHttpMigrateFile => {
|
15
15
|
const importer: MigrateImportProgrammer = new MigrateImportProgrammer();
|
16
16
|
const main: ts.VariableStatement = writeMain(program)(program.document)(
|
17
17
|
importer,
|
@@ -49,10 +49,10 @@ export namespace MigrateApiStartProgrammer {
|
|
49
49
|
};
|
50
50
|
|
51
51
|
const writeMain =
|
52
|
-
(config:
|
52
|
+
(config: IHttpMigrateProgram.IConfig) =>
|
53
53
|
(document: OpenApi.IDocument) =>
|
54
54
|
(importer: MigrateImportProgrammer) =>
|
55
|
-
(route:
|
55
|
+
(route: IHttpMigrateRoute): ts.VariableStatement =>
|
56
56
|
StatementFactory.constant(
|
57
57
|
"main",
|
58
58
|
ts.factory.createArrowFunction(
|
@@ -74,7 +74,7 @@ export namespace MigrateApiStartProgrammer {
|
|
74
74
|
);
|
75
75
|
|
76
76
|
const writeConnection =
|
77
|
-
(config:
|
77
|
+
(config: IHttpMigrateProgram.IConfig) =>
|
78
78
|
(document: OpenApi.IDocument) =>
|
79
79
|
(importer: MigrateImportProgrammer): ts.VariableStatement =>
|
80
80
|
ts.factory.createVariableStatement(
|
@@ -2,7 +2,7 @@ import { OpenApi } from "@samchon/openapi";
|
|
2
2
|
import ts from "typescript";
|
3
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
4
4
|
|
5
|
-
import {
|
5
|
+
import { IHttpMigrateRoute } from "../structures/IHttpMigrateRoute";
|
6
6
|
import { MigrateImportProgrammer } from "./MigrateImportProgrammer";
|
7
7
|
import { MigrateSchemaProgrammer } from "./MigrateSchemaProgrammer";
|
8
8
|
|
@@ -10,7 +10,7 @@ export namespace MigrateE2eFunctionProgrammer {
|
|
10
10
|
export const write =
|
11
11
|
(components: OpenApi.IComponents) =>
|
12
12
|
(importer: MigrateImportProgrammer) =>
|
13
|
-
(route:
|
13
|
+
(route: IHttpMigrateRoute): ts.FunctionDeclaration =>
|
14
14
|
ts.factory.createFunctionDeclaration(
|
15
15
|
[
|
16
16
|
ts.factory.createModifier(ts.SyntaxKind.ExportKeyword),
|
@@ -43,7 +43,7 @@ export namespace MigrateE2eFunctionProgrammer {
|
|
43
43
|
export const writeBody =
|
44
44
|
(components: OpenApi.IComponents) =>
|
45
45
|
(importer: MigrateImportProgrammer) =>
|
46
|
-
(route:
|
46
|
+
(route: IHttpMigrateRoute): ts.Statement[] => [
|
47
47
|
ts.factory.createVariableStatement(
|
48
48
|
[],
|
49
49
|
ts.factory.createVariableDeclarationList(
|
@@ -85,7 +85,7 @@ export namespace MigrateE2eFunctionProgrammer {
|
|
85
85
|
const writeCallExpressionn =
|
86
86
|
(components: OpenApi.IComponents) =>
|
87
87
|
(importer: MigrateImportProgrammer) =>
|
88
|
-
(route:
|
88
|
+
(route: IHttpMigrateRoute): ts.CallExpression =>
|
89
89
|
ts.factory.createCallExpression(
|
90
90
|
ts.factory.createPropertyAccessExpression(
|
91
91
|
ts.factory.createIdentifier("api.functional"),
|