@nestia/migrate 7.0.0-dev.20250608 → 7.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/README.md +92 -92
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +1 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
- package/lib/bundles/NEST_TEMPLATE.js +47 -47
- 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 +69 -69
- package/lib/index.mjs.map +1 -1
- package/lib/utils/openapi-down-convert/converter.js +2 -2
- package/package.json +7 -7
- package/src/NestiaMigrateApplication.ts +144 -144
- package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
- package/src/archivers/NestiaMigrateFileArchiver.ts +28 -28
- package/src/bundles/NEST_TEMPLATE.ts +47 -47
- package/src/bundles/SDK_TEMPLATE.ts +21 -21
- package/src/executable/NestiaMigrateCommander.ts +98 -98
- package/src/executable/NestiaMigrateInquirer.ts +106 -106
- package/src/executable/bundle.js +129 -129
- package/src/executable/migrate.ts +7 -7
- package/src/factories/TypeLiteralFactory.ts +57 -57
- package/src/index.ts +4 -4
- package/src/module.ts +2 -2
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +256 -256
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +515 -515
- package/src/programmers/NestiaMigrateApiProgrammer.ts +107 -107
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +340 -340
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +198 -198
- package/src/programmers/NestiaMigrateDtoProgrammer.ts +101 -101
- package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +153 -153
- package/src/programmers/NestiaMigrateE2eProgrammer.ts +46 -46
- package/src/programmers/NestiaMigrateImportProgrammer.ts +118 -118
- package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +66 -66
- package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +406 -406
- package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +65 -65
- package/src/programmers/NestiaMigrateNestProgrammer.ts +88 -88
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +475 -475
- package/src/structures/INestiaMigrateConfig.ts +10 -10
- package/src/structures/INestiaMigrateContext.ts +15 -15
- package/src/structures/INestiaMigrateController.ts +8 -8
- package/src/structures/INestiaMigrateDto.ts +8 -8
- package/src/structures/INestiaMigrateFile.ts +5 -5
- package/src/structures/INestiaMigrateProgram.ts +11 -11
- package/src/structures/INestiaMigrateSchema.ts +4 -4
- package/src/utils/FilePrinter.ts +38 -38
- package/src/utils/MapUtil.ts +13 -13
- package/src/utils/OpenApiTypeChecker.ts +73 -73
- package/src/utils/SetupWizard.ts +12 -12
- package/src/utils/StringUtil.ts +113 -113
- package/src/utils/openapi-down-convert/RefVisitor.ts +139 -139
- package/src/utils/openapi-down-convert/converter.ts +527 -527
@@ -1,66 +1,66 @@
|
|
1
|
-
import { OpenApi } from "@samchon/openapi";
|
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
|
-
NestiaMigrateNestMethodProgrammer.write({
|
45
|
-
config: props.config,
|
46
|
-
components: props.components,
|
47
|
-
controller: props.controller,
|
48
|
-
importer,
|
49
|
-
route,
|
50
|
-
}),
|
51
|
-
])
|
52
|
-
.flat(),
|
53
|
-
);
|
54
|
-
return [
|
55
|
-
...importer.toStatements(
|
56
|
-
(ref) =>
|
57
|
-
`${"../".repeat(
|
58
|
-
StringUtil.splitWithNormalization(props.controller.location)
|
59
|
-
.length - 1,
|
60
|
-
)}api/structures/${ref}`,
|
61
|
-
),
|
62
|
-
...(importer.empty() ? [] : [FilePrinter.newLine()]),
|
63
|
-
$class,
|
64
|
-
];
|
65
|
-
};
|
66
|
-
}
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
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
|
+
NestiaMigrateNestMethodProgrammer.write({
|
45
|
+
config: props.config,
|
46
|
+
components: props.components,
|
47
|
+
controller: props.controller,
|
48
|
+
importer,
|
49
|
+
route,
|
50
|
+
}),
|
51
|
+
])
|
52
|
+
.flat(),
|
53
|
+
);
|
54
|
+
return [
|
55
|
+
...importer.toStatements(
|
56
|
+
(ref) =>
|
57
|
+
`${"../".repeat(
|
58
|
+
StringUtil.splitWithNormalization(props.controller.location)
|
59
|
+
.length - 1,
|
60
|
+
)}api/structures/${ref}`,
|
61
|
+
),
|
62
|
+
...(importer.empty() ? [] : [FilePrinter.newLine()]),
|
63
|
+
$class,
|
64
|
+
];
|
65
|
+
};
|
66
|
+
}
|