@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.
- package/LICENSE +21 -21
- package/README.md +93 -93
- package/lib/NestiaMigrateApplication.js +341 -341
- package/lib/bundles/NEST_TEMPLATE.js +48 -48
- package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
- package/lib/bundles/SDK_TEMPLATE.js +21 -21
- package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
- package/lib/index.mjs +469 -469
- package/lib/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/NestiaMigrateApplication.ts +168 -168
- package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
- package/src/bundles/NEST_TEMPLATE.ts +48 -48
- package/src/bundles/SDK_TEMPLATE.ts +21 -21
- package/src/executable/NestiaMigrateCommander.ts +104 -104
- package/src/executable/NestiaMigrateInquirer.ts +106 -106
- package/src/executable/bundle.js +125 -125
- package/src/factories/TypeLiteralFactory.ts +57 -57
- package/src/module.ts +7 -7
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +347 -347
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +517 -517
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +308 -308
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +197 -197
- package/src/programmers/NestiaMigrateDtoProgrammer.ts +98 -98
- package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +153 -153
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +48 -48
- package/src/programmers/NestiaMigrateImportProgrammer.ts +118 -118
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +69 -69
- package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +409 -409
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +465 -465
- package/src/programmers/index.ts +15 -15
- package/src/structures/INestiaMigrateContext.ts +9 -9
- package/src/structures/INestiaMigrateController.ts +8 -8
- package/src/structures/INestiaMigrateDto.ts +8 -8
- package/src/structures/INestiaMigrateProgram.ts +11 -11
- package/src/structures/index.ts +4 -4
- package/src/utils/FilePrinter.ts +49 -49
- package/src/utils/StringUtil.ts +114 -114
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { OpenApi } from "@typia/interface";
|
|
2
|
-
import ts from "typescript";
|
|
3
|
-
|
|
4
|
-
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
5
|
-
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
6
|
-
import { FilePrinter } from "../utils/FilePrinter";
|
|
7
|
-
import { StringUtil } from "../utils/StringUtil";
|
|
8
|
-
import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
|
|
9
|
-
import { NestiaMigrateNestMethodProgrammer } from "./NestiaMigrateNestMethodProgrammer";
|
|
10
|
-
|
|
11
|
-
export namespace NestiaMigrateNestControllerProgrammer {
|
|
12
|
-
export interface IProps {
|
|
13
|
-
config: INestiaMigrateConfig;
|
|
14
|
-
components: OpenApi.IComponents;
|
|
15
|
-
controller: INestiaMigrateController;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const write = (props: IProps): ts.Statement[] => {
|
|
19
|
-
const importer: NestiaMigrateImportProgrammer =
|
|
20
|
-
new NestiaMigrateImportProgrammer();
|
|
21
|
-
const $class = ts.factory.createClassDeclaration(
|
|
22
|
-
[
|
|
23
|
-
ts.factory.createDecorator(
|
|
24
|
-
ts.factory.createCallExpression(
|
|
25
|
-
ts.factory.createIdentifier(
|
|
26
|
-
importer.external({
|
|
27
|
-
type: "instance",
|
|
28
|
-
library: "@nestjs/common",
|
|
29
|
-
name: "Controller",
|
|
30
|
-
}),
|
|
31
|
-
),
|
|
32
|
-
[],
|
|
33
|
-
[ts.factory.createStringLiteral(props.controller.path)],
|
|
34
|
-
),
|
|
35
|
-
),
|
|
36
|
-
ts.factory.createToken(ts.SyntaxKind.ExportKeyword),
|
|
37
|
-
],
|
|
38
|
-
props.controller.name,
|
|
39
|
-
[],
|
|
40
|
-
[],
|
|
41
|
-
props.controller.routes
|
|
42
|
-
.map((route, index) => [
|
|
43
|
-
...(index !== 0 ? [FilePrinter.newLine() as any] : []),
|
|
44
|
-
(
|
|
45
|
-
props.config.programmer?.controllerMethod ??
|
|
46
|
-
NestiaMigrateNestMethodProgrammer.write
|
|
47
|
-
)({
|
|
48
|
-
config: props.config,
|
|
49
|
-
components: props.components,
|
|
50
|
-
controller: props.controller,
|
|
51
|
-
importer,
|
|
52
|
-
route,
|
|
53
|
-
}),
|
|
54
|
-
])
|
|
55
|
-
.flat(),
|
|
56
|
-
);
|
|
57
|
-
return [
|
|
58
|
-
...importer.toStatements(
|
|
59
|
-
(ref) =>
|
|
60
|
-
`${"../".repeat(
|
|
61
|
-
StringUtil.splitWithNormalization(props.controller.location)
|
|
62
|
-
.length - 1,
|
|
63
|
-
)}api/structures/${ref}`,
|
|
64
|
-
),
|
|
65
|
-
...(importer.empty() ? [] : [FilePrinter.newLine()]),
|
|
66
|
-
$class,
|
|
67
|
-
];
|
|
68
|
-
};
|
|
69
|
-
}
|
|
1
|
+
import { OpenApi } from "@typia/interface";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
|
|
4
|
+
import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
|
|
5
|
+
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
6
|
+
import { FilePrinter } from "../utils/FilePrinter";
|
|
7
|
+
import { StringUtil } from "../utils/StringUtil";
|
|
8
|
+
import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
|
|
9
|
+
import { NestiaMigrateNestMethodProgrammer } from "./NestiaMigrateNestMethodProgrammer";
|
|
10
|
+
|
|
11
|
+
export namespace NestiaMigrateNestControllerProgrammer {
|
|
12
|
+
export interface IProps {
|
|
13
|
+
config: INestiaMigrateConfig;
|
|
14
|
+
components: OpenApi.IComponents;
|
|
15
|
+
controller: INestiaMigrateController;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const write = (props: IProps): ts.Statement[] => {
|
|
19
|
+
const importer: NestiaMigrateImportProgrammer =
|
|
20
|
+
new NestiaMigrateImportProgrammer();
|
|
21
|
+
const $class = ts.factory.createClassDeclaration(
|
|
22
|
+
[
|
|
23
|
+
ts.factory.createDecorator(
|
|
24
|
+
ts.factory.createCallExpression(
|
|
25
|
+
ts.factory.createIdentifier(
|
|
26
|
+
importer.external({
|
|
27
|
+
type: "instance",
|
|
28
|
+
library: "@nestjs/common",
|
|
29
|
+
name: "Controller",
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
[],
|
|
33
|
+
[ts.factory.createStringLiteral(props.controller.path)],
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
ts.factory.createToken(ts.SyntaxKind.ExportKeyword),
|
|
37
|
+
],
|
|
38
|
+
props.controller.name,
|
|
39
|
+
[],
|
|
40
|
+
[],
|
|
41
|
+
props.controller.routes
|
|
42
|
+
.map((route, index) => [
|
|
43
|
+
...(index !== 0 ? [FilePrinter.newLine() as any] : []),
|
|
44
|
+
(
|
|
45
|
+
props.config.programmer?.controllerMethod ??
|
|
46
|
+
NestiaMigrateNestMethodProgrammer.write
|
|
47
|
+
)({
|
|
48
|
+
config: props.config,
|
|
49
|
+
components: props.components,
|
|
50
|
+
controller: props.controller,
|
|
51
|
+
importer,
|
|
52
|
+
route,
|
|
53
|
+
}),
|
|
54
|
+
])
|
|
55
|
+
.flat(),
|
|
56
|
+
);
|
|
57
|
+
return [
|
|
58
|
+
...importer.toStatements(
|
|
59
|
+
(ref) =>
|
|
60
|
+
`${"../".repeat(
|
|
61
|
+
StringUtil.splitWithNormalization(props.controller.location)
|
|
62
|
+
.length - 1,
|
|
63
|
+
)}api/structures/${ref}`,
|
|
64
|
+
),
|
|
65
|
+
...(importer.empty() ? [] : [FilePrinter.newLine()]),
|
|
66
|
+
$class,
|
|
67
|
+
];
|
|
68
|
+
};
|
|
69
|
+
}
|