@nestia/migrate 11.0.0-dev.20260316 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/lib/NestiaMigrateApplication.js +341 -341
  4. package/lib/bundles/NEST_TEMPLATE.js +48 -48
  5. package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
  6. package/lib/bundles/SDK_TEMPLATE.js +21 -21
  7. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  8. package/lib/index.mjs +469 -469
  9. package/lib/index.mjs.map +1 -1
  10. package/package.json +5 -5
  11. package/src/NestiaMigrateApplication.ts +168 -168
  12. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
  13. package/src/bundles/NEST_TEMPLATE.ts +48 -48
  14. package/src/bundles/SDK_TEMPLATE.ts +21 -21
  15. package/src/executable/NestiaMigrateCommander.ts +104 -104
  16. package/src/executable/NestiaMigrateInquirer.ts +106 -106
  17. package/src/executable/bundle.js +125 -125
  18. package/src/factories/TypeLiteralFactory.ts +57 -57
  19. package/src/module.ts +7 -7
  20. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
  21. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +347 -347
  22. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +517 -517
  23. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +308 -308
  24. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +197 -197
  25. package/src/programmers/NestiaMigrateDtoProgrammer.ts +98 -98
  26. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +153 -153
  27. package/src/programmers/NestiaMigrateE2eProgrammer.ts +48 -48
  28. package/src/programmers/NestiaMigrateImportProgrammer.ts +118 -118
  29. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +69 -69
  30. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +409 -409
  31. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +465 -465
  32. package/src/programmers/index.ts +15 -15
  33. package/src/structures/INestiaMigrateContext.ts +9 -9
  34. package/src/structures/INestiaMigrateController.ts +8 -8
  35. package/src/structures/INestiaMigrateDto.ts +8 -8
  36. package/src/structures/INestiaMigrateProgram.ts +11 -11
  37. package/src/structures/index.ts +4 -4
  38. package/src/utils/FilePrinter.ts +49 -49
  39. package/src/utils/StringUtil.ts +114 -114
@@ -1,15 +1,15 @@
1
- export * from "./NestiaMigrateApiFileProgrammer";
2
- export * from "./NestiaMigrateApiFunctionProgrammer";
3
- export * from "./NestiaMigrateApiNamespaceProgrammer";
4
- export * from "./NestiaMigrateApiProgrammer";
5
- export * from "./NestiaMigrateApiSimulationProgrammer";
6
- export * from "./NestiaMigrateApiStartProgrammer";
7
- export * from "./NestiaMigrateDtoProgrammer";
8
- export * from "./NestiaMigrateE2eFileProgrammer";
9
- export * from "./NestiaMigrateE2eProgrammer";
10
- export * from "./NestiaMigrateImportProgrammer";
11
- export * from "./NestiaMigrateNestControllerProgrammer";
12
- export * from "./NestiaMigrateNestMethodProgrammer";
13
- export * from "./NestiaMigrateNestModuleProgrammer";
14
- export * from "./NestiaMigrateNestProgrammer";
15
- export * from "./NestiaMigrateSchemaProgrammer";
1
+ export * from "./NestiaMigrateApiFileProgrammer";
2
+ export * from "./NestiaMigrateApiFunctionProgrammer";
3
+ export * from "./NestiaMigrateApiNamespaceProgrammer";
4
+ export * from "./NestiaMigrateApiProgrammer";
5
+ export * from "./NestiaMigrateApiSimulationProgrammer";
6
+ export * from "./NestiaMigrateApiStartProgrammer";
7
+ export * from "./NestiaMigrateDtoProgrammer";
8
+ export * from "./NestiaMigrateE2eFileProgrammer";
9
+ export * from "./NestiaMigrateE2eProgrammer";
10
+ export * from "./NestiaMigrateImportProgrammer";
11
+ export * from "./NestiaMigrateNestControllerProgrammer";
12
+ export * from "./NestiaMigrateNestMethodProgrammer";
13
+ export * from "./NestiaMigrateNestModuleProgrammer";
14
+ export * from "./NestiaMigrateNestProgrammer";
15
+ export * from "./NestiaMigrateSchemaProgrammer";
@@ -1,9 +1,9 @@
1
- import { IHttpMigrateApplication } from "@typia/interface";
2
-
3
- import { INestiaMigrateConfig } from "./INestiaMigrateConfig";
4
-
5
- export interface INestiaMigrateContext {
6
- mode: "nest" | "sdk";
7
- application: IHttpMigrateApplication;
8
- config: INestiaMigrateConfig;
9
- }
1
+ import { IHttpMigrateApplication } from "@typia/interface";
2
+
3
+ import { INestiaMigrateConfig } from "./INestiaMigrateConfig";
4
+
5
+ export interface INestiaMigrateContext {
6
+ mode: "nest" | "sdk";
7
+ application: IHttpMigrateApplication;
8
+ config: INestiaMigrateConfig;
9
+ }
@@ -1,8 +1,8 @@
1
- import { IHttpMigrateRoute } from "@typia/interface";
2
-
3
- export interface INestiaMigrateController {
4
- name: string;
5
- path: string;
6
- location: string;
7
- routes: IHttpMigrateRoute[];
8
- }
1
+ import { IHttpMigrateRoute } from "@typia/interface";
2
+
3
+ export interface INestiaMigrateController {
4
+ name: string;
5
+ path: string;
6
+ location: string;
7
+ routes: IHttpMigrateRoute[];
8
+ }
@@ -1,8 +1,8 @@
1
- import { OpenApi } from "@typia/interface";
2
-
3
- export interface INestiaMigrateDto {
4
- name: string;
5
- location: string;
6
- schema: OpenApi.IJsonSchema | null;
7
- children: INestiaMigrateDto[];
8
- }
1
+ import { OpenApi } from "@typia/interface";
2
+
3
+ export interface INestiaMigrateDto {
4
+ name: string;
5
+ location: string;
6
+ schema: OpenApi.IJsonSchema | null;
7
+ children: INestiaMigrateDto[];
8
+ }
@@ -1,11 +1,11 @@
1
- import { IHttpMigrateApplication, OpenApi } from "@typia/interface";
2
-
3
- import { INestiaMigrateConfig } from "./INestiaMigrateConfig";
4
-
5
- export interface INestiaMigrateProgram {
6
- mode: "nest" | "sdk";
7
- document: OpenApi.IDocument;
8
- config: INestiaMigrateConfig;
9
- files: Record<string, string>;
10
- errors: IHttpMigrateApplication.IError[];
11
- }
1
+ import { IHttpMigrateApplication, OpenApi } from "@typia/interface";
2
+
3
+ import { INestiaMigrateConfig } from "./INestiaMigrateConfig";
4
+
5
+ export interface INestiaMigrateProgram {
6
+ mode: "nest" | "sdk";
7
+ document: OpenApi.IDocument;
8
+ config: INestiaMigrateConfig;
9
+ files: Record<string, string>;
10
+ errors: IHttpMigrateApplication.IError[];
11
+ }
@@ -1,4 +1,4 @@
1
- export * from "./INestiaMigrateConfig";
2
- export * from "./INestiaMigrateContext";
3
- export * from "./INestiaMigrateController";
4
- export * from "./INestiaMigrateFile";
1
+ export * from "./INestiaMigrateConfig";
2
+ export * from "./INestiaMigrateContext";
3
+ export * from "./INestiaMigrateController";
4
+ export * from "./INestiaMigrateFile";
@@ -1,49 +1,49 @@
1
- import ts from "typescript";
2
-
3
- export namespace FilePrinter {
4
- export const description = <Node extends ts.Node>(
5
- node: Node,
6
- comment: string,
7
- ): Node => {
8
- if (comment.length === 0) return node;
9
- ts.addSyntheticLeadingComment(
10
- node,
11
- ts.SyntaxKind.MultiLineCommentTrivia,
12
- [
13
- "*",
14
- ...comment
15
- .split("\r\n")
16
- .join("\n")
17
- .split("\n")
18
- .map(
19
- (str) =>
20
- ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`,
21
- ),
22
- "",
23
- ].join("\n"),
24
- true,
25
- );
26
- return node;
27
- };
28
-
29
- export const newLine = () =>
30
- ts.factory.createExpressionStatement(ts.factory.createIdentifier("\n"));
31
-
32
- export const write = (props: {
33
- statements: ts.Statement[];
34
- top?: string;
35
- }): string => {
36
- const script: string = ts
37
- .createPrinter({
38
- newLine: ts.NewLineKind.LineFeed,
39
- })
40
- .printFile(
41
- ts.factory.createSourceFile(
42
- props.statements,
43
- ts.factory.createToken(ts.SyntaxKind.EndOfFileToken),
44
- ts.NodeFlags.None,
45
- ),
46
- );
47
- return (props.top ?? "") + script;
48
- };
49
- }
1
+ import ts from "typescript";
2
+
3
+ export namespace FilePrinter {
4
+ export const description = <Node extends ts.Node>(
5
+ node: Node,
6
+ comment: string,
7
+ ): Node => {
8
+ if (comment.length === 0) return node;
9
+ ts.addSyntheticLeadingComment(
10
+ node,
11
+ ts.SyntaxKind.MultiLineCommentTrivia,
12
+ [
13
+ "*",
14
+ ...comment
15
+ .split("\r\n")
16
+ .join("\n")
17
+ .split("\n")
18
+ .map(
19
+ (str) =>
20
+ ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`,
21
+ ),
22
+ "",
23
+ ].join("\n"),
24
+ true,
25
+ );
26
+ return node;
27
+ };
28
+
29
+ export const newLine = () =>
30
+ ts.factory.createExpressionStatement(ts.factory.createIdentifier("\n"));
31
+
32
+ export const write = (props: {
33
+ statements: ts.Statement[];
34
+ top?: string;
35
+ }): string => {
36
+ const script: string = ts
37
+ .createPrinter({
38
+ newLine: ts.NewLineKind.LineFeed,
39
+ })
40
+ .printFile(
41
+ ts.factory.createSourceFile(
42
+ props.statements,
43
+ ts.factory.createToken(ts.SyntaxKind.EndOfFileToken),
44
+ ts.NodeFlags.None,
45
+ ),
46
+ );
47
+ return (props.top ?? "") + script;
48
+ };
49
+ }
@@ -1,114 +1,114 @@
1
- export namespace StringUtil {
2
- export const capitalize = (str: string) =>
3
- str[0]!.toUpperCase() + str.slice(1).toLowerCase();
4
-
5
- export const splitWithNormalization = (path: string) =>
6
- path
7
- .split("/")
8
- .map((str) => normalize(str.trim()))
9
- .filter((str) => !!str.length);
10
-
11
- export const escapeDuplicate =
12
- (keep: string[]) =>
13
- (change: string): string =>
14
- keep.includes(change) ? escapeDuplicate(keep)(`_${change}`) : change;
15
-
16
- export const escapeNonVariable = (str: string): string => {
17
- str = escape(str);
18
- for (const [before, after] of VARIABLE_REPLACERS)
19
- str = str.split(before).join(after);
20
- for (let i: number = 0; i <= 9; ++i)
21
- if (str[0] === i.toString()) {
22
- str = "_" + str;
23
- break;
24
- }
25
- if (str === "") return "_empty_";
26
- return str;
27
- };
28
- }
29
-
30
- const escape = (str: string): string => {
31
- str = str.trim();
32
- if (RESERVED.has(str)) return `_${str}`;
33
- else if (str.length !== 0 && "0" <= str[0]! && str[0]! <= "9")
34
- str = `_${str}`;
35
- return str;
36
- };
37
-
38
- const normalize = (str: string): string =>
39
- escape(str.split(".").join("_").split("-").join("_"));
40
-
41
- const RESERVED: Set<string> = new Set([
42
- "break",
43
- "case",
44
- "catch",
45
- "class",
46
- "const",
47
- "continue",
48
- "debugger",
49
- "default",
50
- "delete",
51
- "do",
52
- "else",
53
- "enum",
54
- "export",
55
- "extends",
56
- "false",
57
- "finally",
58
- "for",
59
- "function",
60
- "if",
61
- "import",
62
- "in",
63
- "instanceof",
64
- "module",
65
- "new",
66
- "null",
67
- "package",
68
- "public",
69
- "private",
70
- "protected",
71
- "return",
72
- "super",
73
- "switch",
74
- "this",
75
- "throw",
76
- "true",
77
- "try",
78
- "typeof",
79
- "var",
80
- "void",
81
- "while",
82
- "with",
83
- ]);
84
-
85
- const VARIABLE_REPLACERS: [string, string][] = [
86
- ["`", "_backquote_"],
87
- ["!", "_exclamation_"],
88
- ["@", "_at_"],
89
- ["#", "_hash_"],
90
- ["$", "_dollar_"],
91
- ["%", "_percent_"],
92
- ["^", "_caret_"],
93
- ["&", "_and_"],
94
- ["*", "_star_"],
95
- ["(", "_lparen_"],
96
- [")", "_rparen_"],
97
- ["-", "_"],
98
- ["+", "_plus_"],
99
- ["|", "_or_"],
100
- ["{", "_blt_"],
101
- ["}", "_bgt_"],
102
- ["<", "_lt_"],
103
- [">", "_gt_"],
104
- ["[", "_alt_"],
105
- ["]", "_agt_"],
106
- [",", "_comma_"],
107
- ["'", "_singlequote_"],
108
- ['"', "_doublequote_"],
109
- [" ", "_space_"],
110
- ["?", "_question_"],
111
- [":", "_colon_"],
112
- [";", "_semicolon_"],
113
- ["...", "_rest_"],
114
- ];
1
+ export namespace StringUtil {
2
+ export const capitalize = (str: string) =>
3
+ str[0]!.toUpperCase() + str.slice(1).toLowerCase();
4
+
5
+ export const splitWithNormalization = (path: string) =>
6
+ path
7
+ .split("/")
8
+ .map((str) => normalize(str.trim()))
9
+ .filter((str) => !!str.length);
10
+
11
+ export const escapeDuplicate =
12
+ (keep: string[]) =>
13
+ (change: string): string =>
14
+ keep.includes(change) ? escapeDuplicate(keep)(`_${change}`) : change;
15
+
16
+ export const escapeNonVariable = (str: string): string => {
17
+ str = escape(str);
18
+ for (const [before, after] of VARIABLE_REPLACERS)
19
+ str = str.split(before).join(after);
20
+ for (let i: number = 0; i <= 9; ++i)
21
+ if (str[0] === i.toString()) {
22
+ str = "_" + str;
23
+ break;
24
+ }
25
+ if (str === "") return "_empty_";
26
+ return str;
27
+ };
28
+ }
29
+
30
+ const escape = (str: string): string => {
31
+ str = str.trim();
32
+ if (RESERVED.has(str)) return `_${str}`;
33
+ else if (str.length !== 0 && "0" <= str[0]! && str[0]! <= "9")
34
+ str = `_${str}`;
35
+ return str;
36
+ };
37
+
38
+ const normalize = (str: string): string =>
39
+ escape(str.split(".").join("_").split("-").join("_"));
40
+
41
+ const RESERVED: Set<string> = new Set([
42
+ "break",
43
+ "case",
44
+ "catch",
45
+ "class",
46
+ "const",
47
+ "continue",
48
+ "debugger",
49
+ "default",
50
+ "delete",
51
+ "do",
52
+ "else",
53
+ "enum",
54
+ "export",
55
+ "extends",
56
+ "false",
57
+ "finally",
58
+ "for",
59
+ "function",
60
+ "if",
61
+ "import",
62
+ "in",
63
+ "instanceof",
64
+ "module",
65
+ "new",
66
+ "null",
67
+ "package",
68
+ "public",
69
+ "private",
70
+ "protected",
71
+ "return",
72
+ "super",
73
+ "switch",
74
+ "this",
75
+ "throw",
76
+ "true",
77
+ "try",
78
+ "typeof",
79
+ "var",
80
+ "void",
81
+ "while",
82
+ "with",
83
+ ]);
84
+
85
+ const VARIABLE_REPLACERS: [string, string][] = [
86
+ ["`", "_backquote_"],
87
+ ["!", "_exclamation_"],
88
+ ["@", "_at_"],
89
+ ["#", "_hash_"],
90
+ ["$", "_dollar_"],
91
+ ["%", "_percent_"],
92
+ ["^", "_caret_"],
93
+ ["&", "_and_"],
94
+ ["*", "_star_"],
95
+ ["(", "_lparen_"],
96
+ [")", "_rparen_"],
97
+ ["-", "_"],
98
+ ["+", "_plus_"],
99
+ ["|", "_or_"],
100
+ ["{", "_blt_"],
101
+ ["}", "_bgt_"],
102
+ ["<", "_lt_"],
103
+ [">", "_gt_"],
104
+ ["[", "_alt_"],
105
+ ["]", "_agt_"],
106
+ [",", "_comma_"],
107
+ ["'", "_singlequote_"],
108
+ ['"', "_doublequote_"],
109
+ [" ", "_space_"],
110
+ ["?", "_question_"],
111
+ [":", "_colon_"],
112
+ [";", "_semicolon_"],
113
+ ["...", "_rest_"],
114
+ ];