@nestia/migrate 12.0.0-dev.20260601.1 → 12.0.0-dev.20260612.2

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 (50) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +93 -93
  3. package/lib/NestiaMigrateApplication.js +19 -1
  4. package/lib/NestiaMigrateApplication.js.map +1 -1
  5. package/lib/bundles/NEST_TEMPLATE.js +47 -47
  6. package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
  7. package/lib/bundles/SDK_TEMPLATE.js +20 -20
  8. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  9. package/lib/index.mjs +94 -77
  10. package/lib/index.mjs.map +1 -1
  11. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +6 -2
  12. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  13. package/package.json +5 -5
  14. package/src/NestiaMigrateApplication.ts +196 -167
  15. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
  16. package/src/archivers/NestiaMigrateFileArchiver.ts +28 -28
  17. package/src/bundles/NEST_TEMPLATE.ts +47 -47
  18. package/src/bundles/SDK_TEMPLATE.ts +20 -20
  19. package/src/executable/NestiaMigrateCommander.ts +115 -115
  20. package/src/executable/NestiaMigrateInquirer.ts +106 -106
  21. package/src/executable/bundle.js +349 -349
  22. package/src/executable/migrate.ts +7 -7
  23. package/src/factories/TypeLiteralFactory.ts +63 -63
  24. package/src/index.ts +4 -4
  25. package/src/internal/ts.ts +94 -94
  26. package/src/module.ts +6 -6
  27. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +58 -58
  28. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +373 -369
  29. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +528 -528
  30. package/src/programmers/NestiaMigrateApiProgrammer.ts +108 -108
  31. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +314 -314
  32. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +198 -198
  33. package/src/programmers/NestiaMigrateDtoProgrammer.ts +99 -99
  34. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +156 -156
  35. package/src/programmers/NestiaMigrateE2eProgrammer.ts +48 -48
  36. package/src/programmers/NestiaMigrateImportProgrammer.ts +119 -119
  37. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +70 -70
  38. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +414 -414
  39. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +66 -66
  40. package/src/programmers/NestiaMigrateNestProgrammer.ts +89 -89
  41. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +477 -477
  42. package/src/programmers/index.ts +15 -15
  43. package/src/structures/INestiaMigrateConfig.ts +19 -19
  44. package/src/structures/INestiaMigrateContext.ts +9 -9
  45. package/src/structures/INestiaMigrateController.ts +8 -8
  46. package/src/structures/INestiaMigrateFile.ts +5 -5
  47. package/src/structures/index.ts +4 -4
  48. package/src/utils/FilePrinter.ts +44 -44
  49. package/src/utils/MapUtil.ts +13 -13
  50. package/src/utils/StringUtil.ts +109 -109
@@ -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,19 +1,19 @@
1
- import ts from "../internal/ts";
2
-
3
- import { NestiaMigrateNestMethodProgrammer } from "../programmers/NestiaMigrateNestMethodProgrammer";
4
-
5
- export interface INestiaMigrateConfig {
6
- simulate: boolean;
7
- e2e: boolean;
8
- package?: string;
9
- keyword?: boolean;
10
- author?: {
11
- tag: string;
12
- value: string;
13
- };
14
- programmer?: {
15
- controllerMethod?: (
16
- ctx: NestiaMigrateNestMethodProgrammer.IContext,
17
- ) => ts.MethodDeclaration;
18
- };
19
- }
1
+ import ts from "../internal/ts";
2
+
3
+ import { NestiaMigrateNestMethodProgrammer } from "../programmers/NestiaMigrateNestMethodProgrammer";
4
+
5
+ export interface INestiaMigrateConfig {
6
+ simulate: boolean;
7
+ e2e: boolean;
8
+ package?: string;
9
+ keyword?: boolean;
10
+ author?: {
11
+ tag: string;
12
+ value: string;
13
+ };
14
+ programmer?: {
15
+ controllerMethod?: (
16
+ ctx: NestiaMigrateNestMethodProgrammer.IContext,
17
+ ) => ts.MethodDeclaration;
18
+ };
19
+ }
@@ -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,5 +1,5 @@
1
- export interface INestiaMigrateFile {
2
- location: string;
3
- file: string;
4
- content: string;
5
- }
1
+ export interface INestiaMigrateFile {
2
+ location: string;
3
+ file: string;
4
+ content: string;
5
+ }
@@ -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,44 +1,44 @@
1
- import { TypeScriptFactory, TypeScriptPrinter } from "@nestia/factory";
2
- import ts from "../internal/ts";
3
-
4
- export namespace FilePrinter {
5
- export const description = <Node extends ts.Node>(
6
- node: Node,
7
- comment: string,
8
- ): Node => {
9
- if (comment.length === 0) return node;
10
- ts.addSyntheticLeadingComment(
11
- node,
12
- ts.SyntaxKind.MultiLineCommentTrivia,
13
- [
14
- "*",
15
- ...comment
16
- .split("\r\n")
17
- .join("\n")
18
- .split("\n")
19
- .map(
20
- (str) =>
21
- ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`,
22
- ),
23
- "",
24
- ].join("\n"),
25
- true,
26
- );
27
- return node;
28
- };
29
-
30
- export const newLine = () =>
31
- TypeScriptFactory.createExpressionStatement(
32
- TypeScriptFactory.createIdentifier("\n"),
33
- );
34
-
35
- export const write = (props: {
36
- statements: ts.Statement[];
37
- top?: string;
38
- }): string => {
39
- return TypeScriptPrinter.write({
40
- statements: props.statements,
41
- top: props.top,
42
- });
43
- };
44
- }
1
+ import { TypeScriptFactory, TypeScriptPrinter } from "@nestia/factory";
2
+ import ts from "../internal/ts";
3
+
4
+ export namespace FilePrinter {
5
+ export const description = <Node extends ts.Node>(
6
+ node: Node,
7
+ comment: string,
8
+ ): Node => {
9
+ if (comment.length === 0) return node;
10
+ ts.addSyntheticLeadingComment(
11
+ node,
12
+ ts.SyntaxKind.MultiLineCommentTrivia,
13
+ [
14
+ "*",
15
+ ...comment
16
+ .split("\r\n")
17
+ .join("\n")
18
+ .split("\n")
19
+ .map(
20
+ (str) =>
21
+ ` * ${str.split("*/").join("*\\\\/").split("*\\/").join("*\\\\/")}`,
22
+ ),
23
+ "",
24
+ ].join("\n"),
25
+ true,
26
+ );
27
+ return node;
28
+ };
29
+
30
+ export const newLine = () =>
31
+ TypeScriptFactory.createExpressionStatement(
32
+ TypeScriptFactory.createIdentifier("\n"),
33
+ );
34
+
35
+ export const write = (props: {
36
+ statements: ts.Statement[];
37
+ top?: string;
38
+ }): string => {
39
+ return TypeScriptPrinter.write({
40
+ statements: props.statements,
41
+ top: props.top,
42
+ });
43
+ };
44
+ }
@@ -1,13 +1,13 @@
1
- export namespace MapUtil {
2
- export const take =
3
- <Key, T>(dict: Map<Key, T>) =>
4
- (key: Key) =>
5
- (generator: () => T): T => {
6
- const oldbie: T | undefined = dict.get(key);
7
- if (oldbie) return oldbie;
8
-
9
- const value: T = generator();
10
- dict.set(key, value);
11
- return value;
12
- };
13
- }
1
+ export namespace MapUtil {
2
+ export const take =
3
+ <Key, T>(dict: Map<Key, T>) =>
4
+ (key: Key) =>
5
+ (generator: () => T): T => {
6
+ const oldbie: T | undefined = dict.get(key);
7
+ if (oldbie) return oldbie;
8
+
9
+ const value: T = generator();
10
+ dict.set(key, value);
11
+ return value;
12
+ };
13
+ }
@@ -1,109 +1,109 @@
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 escapeNonVariable = (str: string): string => {
12
- str = escape(str);
13
- for (const [before, after] of VARIABLE_REPLACERS)
14
- str = str.split(before).join(after);
15
- for (let i: number = 0; i <= 9; ++i)
16
- if (str[0] === i.toString()) {
17
- str = "_" + str;
18
- break;
19
- }
20
- if (str === "") return "_empty_";
21
- return str;
22
- };
23
- }
24
-
25
- const escape = (str: string): string => {
26
- str = str.trim();
27
- if (RESERVED.has(str)) return `_${str}`;
28
- else if (str.length !== 0 && "0" <= str[0]! && str[0]! <= "9")
29
- str = `_${str}`;
30
- return str;
31
- };
32
-
33
- const normalize = (str: string): string =>
34
- escape(str.split(".").join("_").split("-").join("_"));
35
-
36
- const RESERVED: Set<string> = new Set([
37
- "break",
38
- "case",
39
- "catch",
40
- "class",
41
- "const",
42
- "continue",
43
- "debugger",
44
- "default",
45
- "delete",
46
- "do",
47
- "else",
48
- "enum",
49
- "export",
50
- "extends",
51
- "false",
52
- "finally",
53
- "for",
54
- "function",
55
- "if",
56
- "import",
57
- "in",
58
- "instanceof",
59
- "module",
60
- "new",
61
- "null",
62
- "package",
63
- "public",
64
- "private",
65
- "protected",
66
- "return",
67
- "super",
68
- "switch",
69
- "this",
70
- "throw",
71
- "true",
72
- "try",
73
- "typeof",
74
- "var",
75
- "void",
76
- "while",
77
- "with",
78
- ]);
79
-
80
- const VARIABLE_REPLACERS: [string, string][] = [
81
- ["`", "_backquote_"],
82
- ["!", "_exclamation_"],
83
- ["@", "_at_"],
84
- ["#", "_hash_"],
85
- ["$", "_dollar_"],
86
- ["%", "_percent_"],
87
- ["^", "_caret_"],
88
- ["&", "_and_"],
89
- ["*", "_star_"],
90
- ["(", "_lparen_"],
91
- [")", "_rparen_"],
92
- ["-", "_"],
93
- ["+", "_plus_"],
94
- ["|", "_or_"],
95
- ["{", "_blt_"],
96
- ["}", "_bgt_"],
97
- ["<", "_lt_"],
98
- [">", "_gt_"],
99
- ["[", "_alt_"],
100
- ["]", "_agt_"],
101
- [",", "_comma_"],
102
- ["'", "_singlequote_"],
103
- ['"', "_doublequote_"],
104
- [" ", "_space_"],
105
- ["?", "_question_"],
106
- [":", "_colon_"],
107
- [";", "_semicolon_"],
108
- ["...", "_rest_"],
109
- ];
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 escapeNonVariable = (str: string): string => {
12
+ str = escape(str);
13
+ for (const [before, after] of VARIABLE_REPLACERS)
14
+ str = str.split(before).join(after);
15
+ for (let i: number = 0; i <= 9; ++i)
16
+ if (str[0] === i.toString()) {
17
+ str = "_" + str;
18
+ break;
19
+ }
20
+ if (str === "") return "_empty_";
21
+ return str;
22
+ };
23
+ }
24
+
25
+ const escape = (str: string): string => {
26
+ str = str.trim();
27
+ if (RESERVED.has(str)) return `_${str}`;
28
+ else if (str.length !== 0 && "0" <= str[0]! && str[0]! <= "9")
29
+ str = `_${str}`;
30
+ return str;
31
+ };
32
+
33
+ const normalize = (str: string): string =>
34
+ escape(str.split(".").join("_").split("-").join("_"));
35
+
36
+ const RESERVED: Set<string> = new Set([
37
+ "break",
38
+ "case",
39
+ "catch",
40
+ "class",
41
+ "const",
42
+ "continue",
43
+ "debugger",
44
+ "default",
45
+ "delete",
46
+ "do",
47
+ "else",
48
+ "enum",
49
+ "export",
50
+ "extends",
51
+ "false",
52
+ "finally",
53
+ "for",
54
+ "function",
55
+ "if",
56
+ "import",
57
+ "in",
58
+ "instanceof",
59
+ "module",
60
+ "new",
61
+ "null",
62
+ "package",
63
+ "public",
64
+ "private",
65
+ "protected",
66
+ "return",
67
+ "super",
68
+ "switch",
69
+ "this",
70
+ "throw",
71
+ "true",
72
+ "try",
73
+ "typeof",
74
+ "var",
75
+ "void",
76
+ "while",
77
+ "with",
78
+ ]);
79
+
80
+ const VARIABLE_REPLACERS: [string, string][] = [
81
+ ["`", "_backquote_"],
82
+ ["!", "_exclamation_"],
83
+ ["@", "_at_"],
84
+ ["#", "_hash_"],
85
+ ["$", "_dollar_"],
86
+ ["%", "_percent_"],
87
+ ["^", "_caret_"],
88
+ ["&", "_and_"],
89
+ ["*", "_star_"],
90
+ ["(", "_lparen_"],
91
+ [")", "_rparen_"],
92
+ ["-", "_"],
93
+ ["+", "_plus_"],
94
+ ["|", "_or_"],
95
+ ["{", "_blt_"],
96
+ ["}", "_bgt_"],
97
+ ["<", "_lt_"],
98
+ [">", "_gt_"],
99
+ ["[", "_alt_"],
100
+ ["]", "_agt_"],
101
+ [",", "_comma_"],
102
+ ["'", "_singlequote_"],
103
+ ['"', "_doublequote_"],
104
+ [" ", "_space_"],
105
+ ["?", "_question_"],
106
+ [":", "_colon_"],
107
+ [";", "_semicolon_"],
108
+ ["...", "_rest_"],
109
+ ];