@nestia/migrate 10.0.2 → 11.0.0-dev.20260305
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 -0
- package/README.md +93 -93
- package/package.json +32 -46
- package/src/NestiaMigrateApplication.ts +161 -159
- package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
- package/src/archivers/NestiaMigrateFileArchiver.ts +28 -28
- package/src/bundles/NEST_TEMPLATE.ts +48 -48
- 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 +125 -125
- package/src/executable/migrate.ts +7 -7
- package/src/factories/TypeLiteralFactory.ts +57 -57
- package/src/index.ts +4 -4
- package/src/module.ts +6 -2
- package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
- package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +347 -344
- package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +517 -514
- package/src/programmers/NestiaMigrateApiProgrammer.ts +107 -107
- package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +308 -309
- package/src/programmers/NestiaMigrateApiStartProgrammer.ts +197 -198
- 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 -406
- package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +65 -65
- package/src/programmers/NestiaMigrateNestProgrammer.ts +88 -88
- package/src/programmers/NestiaMigrateSchemaProgrammer.ts +465 -467
- package/src/structures/INestiaMigrateConfig.ts +19 -19
- package/src/structures/INestiaMigrateContext.ts +9 -9
- 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 +49 -49
- package/src/utils/MapUtil.ts +13 -13
- package/src/utils/SetupWizard.ts +12 -12
- package/src/utils/StringUtil.ts +114 -113
- package/src/utils/openapi-down-convert/RefVisitor.ts +134 -134
- package/src/utils/openapi-down-convert/converter.ts +536 -536
- package/lib/NestiaMigrateApplication.d.ts +0 -24
- package/lib/NestiaMigrateApplication.js +0 -18757
- package/lib/NestiaMigrateApplication.js.map +0 -1
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +0 -5
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +0 -46
- package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +0 -1
- package/lib/archivers/NestiaMigrateFileArchiver.d.ts +0 -8
- package/lib/archivers/NestiaMigrateFileArchiver.js +0 -36
- package/lib/archivers/NestiaMigrateFileArchiver.js.map +0 -1
- package/lib/bundles/NEST_TEMPLATE.d.ts +0 -1
- package/lib/bundles/NEST_TEMPLATE.js +0 -55
- package/lib/bundles/NEST_TEMPLATE.js.map +0 -1
- package/lib/bundles/SDK_TEMPLATE.d.ts +0 -1
- package/lib/bundles/SDK_TEMPLATE.js +0 -27
- package/lib/bundles/SDK_TEMPLATE.js.map +0 -1
- package/lib/executable/NestiaMigrateCommander.d.ts +0 -4
- package/lib/executable/NestiaMigrateCommander.js +0 -125
- package/lib/executable/NestiaMigrateCommander.js.map +0 -1
- package/lib/executable/NestiaMigrateInquirer.d.ts +0 -12
- package/lib/executable/NestiaMigrateInquirer.js +0 -94
- package/lib/executable/NestiaMigrateInquirer.js.map +0 -1
- package/lib/executable/migrate.d.ts +0 -2
- package/lib/executable/migrate.js +0 -9
- package/lib/executable/migrate.js.map +0 -1
- package/lib/factories/TypeLiteralFactory.d.ts +0 -4
- package/lib/factories/TypeLiteralFactory.js +0 -35
- package/lib/factories/TypeLiteralFactory.js.map +0 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -42
- package/lib/index.js.map +0 -1
- package/lib/index.mjs +0 -19359
- package/lib/index.mjs.map +0 -1
- package/lib/module.d.ts +0 -2
- package/lib/module.js +0 -19
- package/lib/module.js.map +0 -1
- package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +0 -13
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js +0 -40
- package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +0 -14
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +0 -179
- package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +0 -14
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +0 -226
- package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +0 -4
- package/lib/programmers/NestiaMigrateApiProgrammer.js +0 -82
- package/lib/programmers/NestiaMigrateApiProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +0 -14
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +0 -142
- package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +0 -4
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js +0 -80
- package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +0 -15
- package/lib/programmers/NestiaMigrateDtoProgrammer.js +0 -65
- package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +0 -14
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +0 -81
- package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +0 -4
- package/lib/programmers/NestiaMigrateE2eProgrammer.js +0 -32
- package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +0 -18
- package/lib/programmers/NestiaMigrateImportProgrammer.js +0 -65
- package/lib/programmers/NestiaMigrateImportProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +0 -12
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +0 -46
- package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +0 -15
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +0 -224
- package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +0 -5
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +0 -29
- package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +0 -4
- package/lib/programmers/NestiaMigrateNestProgrammer.js +0 -65
- package/lib/programmers/NestiaMigrateNestProgrammer.js.map +0 -1
- package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +0 -10
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js +0 -341
- package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +0 -1
- package/lib/structures/INestiaMigrateConfig.d.ts +0 -15
- package/lib/structures/INestiaMigrateConfig.js +0 -3
- package/lib/structures/INestiaMigrateConfig.js.map +0 -1
- package/lib/structures/INestiaMigrateContext.d.ts +0 -7
- package/lib/structures/INestiaMigrateContext.js +0 -3
- package/lib/structures/INestiaMigrateContext.js.map +0 -1
- package/lib/structures/INestiaMigrateController.d.ts +0 -7
- package/lib/structures/INestiaMigrateController.js +0 -3
- package/lib/structures/INestiaMigrateController.js.map +0 -1
- package/lib/structures/INestiaMigrateDto.d.ts +0 -7
- package/lib/structures/INestiaMigrateDto.js +0 -3
- package/lib/structures/INestiaMigrateDto.js.map +0 -1
- package/lib/structures/INestiaMigrateFile.d.ts +0 -5
- package/lib/structures/INestiaMigrateFile.js +0 -3
- package/lib/structures/INestiaMigrateFile.js.map +0 -1
- package/lib/structures/INestiaMigrateProgram.d.ts +0 -9
- package/lib/structures/INestiaMigrateProgram.js +0 -3
- package/lib/structures/INestiaMigrateProgram.js.map +0 -1
- package/lib/structures/INestiaMigrateSchema.d.ts +0 -4
- package/lib/structures/INestiaMigrateSchema.js +0 -3
- package/lib/structures/INestiaMigrateSchema.js.map +0 -1
- package/lib/utils/FilePrinter.d.ts +0 -9
- package/lib/utils/FilePrinter.js +0 -35
- package/lib/utils/FilePrinter.js.map +0 -1
- package/lib/utils/MapUtil.d.ts +0 -3
- package/lib/utils/MapUtil.js +0 -15
- package/lib/utils/MapUtil.js.map +0 -1
- package/lib/utils/SetupWizard.d.ts +0 -3
- package/lib/utils/SetupWizard.js +0 -18
- package/lib/utils/SetupWizard.js.map +0 -1
- package/lib/utils/StringUtil.d.ts +0 -6
- package/lib/utils/StringUtil.js +0 -108
- package/lib/utils/StringUtil.js.map +0 -1
- package/lib/utils/openapi-down-convert/RefVisitor.d.ts +0 -52
- package/lib/utils/openapi-down-convert/RefVisitor.js +0 -102
- package/lib/utils/openapi-down-convert/RefVisitor.js.map +0 -1
- package/lib/utils/openapi-down-convert/converter.d.ts +0 -146
- package/lib/utils/openapi-down-convert/converter.js +0 -441
- package/lib/utils/openapi-down-convert/converter.js.map +0 -1
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { IHttpMigrateRoute } from "@
|
|
2
|
-
|
|
3
|
-
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
4
|
-
import { MapUtil } from "../utils/MapUtil";
|
|
5
|
-
import { StringUtil } from "../utils/StringUtil";
|
|
6
|
-
|
|
7
|
-
export namespace NestiaMigrateControllerAnalyzer {
|
|
8
|
-
export const analyze = (
|
|
9
|
-
routes: IHttpMigrateRoute[],
|
|
10
|
-
): INestiaMigrateController[] => {
|
|
11
|
-
const collection: Map<string, INestiaMigrateController> = new Map();
|
|
12
|
-
for (const r of routes) {
|
|
13
|
-
const name: string =
|
|
14
|
-
r.operation()["x-samchon-controller"] ??
|
|
15
|
-
(r.accessor.length <= 1
|
|
16
|
-
? "__App"
|
|
17
|
-
: r.accessor.slice(0, -1).map(StringUtil.capitalize).join("")) +
|
|
18
|
-
"Controller";
|
|
19
|
-
MapUtil.take(collection)(name)(() => ({
|
|
20
|
-
name,
|
|
21
|
-
path: "@lazy",
|
|
22
|
-
location: "@lazy",
|
|
23
|
-
routes: [],
|
|
24
|
-
})).routes.push(r);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const controllers: INestiaMigrateController[] = [...collection.values()];
|
|
28
|
-
for (const col of controllers) {
|
|
29
|
-
const splitPath = (r: IHttpMigrateRoute): string[] =>
|
|
30
|
-
r.emendedPath.split("/");
|
|
31
|
-
const splitLocation = (r: IHttpMigrateRoute): string[] =>
|
|
32
|
-
splitPath(r).filter((s) => s.length !== 0 && s[0] !== ":");
|
|
33
|
-
|
|
34
|
-
const minPath: string[] = splitPath(col.routes[0]);
|
|
35
|
-
const minLocation: string[] = splitLocation(col.routes[0]);
|
|
36
|
-
for (const r of col.routes.slice(1)) {
|
|
37
|
-
minPath.splice(getSplitIndex(minPath, splitPath(r)));
|
|
38
|
-
minLocation.splice(getSplitIndex(minLocation, splitLocation(r)));
|
|
39
|
-
}
|
|
40
|
-
col.path = minPath.join("/");
|
|
41
|
-
col.location = ["src", "controllers", ...minLocation].join("/");
|
|
42
|
-
}
|
|
43
|
-
return controllers;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const getSplitIndex = (x: string[], y: string[]) => {
|
|
48
|
-
const n: number = Math.min(x.length, y.length);
|
|
49
|
-
for (let i: number = 0; i < n; ++i) if (x[i] !== y[i]) return i;
|
|
50
|
-
return n;
|
|
51
|
-
};
|
|
1
|
+
import { IHttpMigrateRoute } from "@typia/interface";
|
|
2
|
+
|
|
3
|
+
import { INestiaMigrateController } from "../structures/INestiaMigrateController";
|
|
4
|
+
import { MapUtil } from "../utils/MapUtil";
|
|
5
|
+
import { StringUtil } from "../utils/StringUtil";
|
|
6
|
+
|
|
7
|
+
export namespace NestiaMigrateControllerAnalyzer {
|
|
8
|
+
export const analyze = (
|
|
9
|
+
routes: IHttpMigrateRoute[],
|
|
10
|
+
): INestiaMigrateController[] => {
|
|
11
|
+
const collection: Map<string, INestiaMigrateController> = new Map();
|
|
12
|
+
for (const r of routes) {
|
|
13
|
+
const name: string =
|
|
14
|
+
r.operation()["x-samchon-controller"] ??
|
|
15
|
+
(r.accessor.length <= 1
|
|
16
|
+
? "__App"
|
|
17
|
+
: r.accessor.slice(0, -1).map(StringUtil.capitalize).join("")) +
|
|
18
|
+
"Controller";
|
|
19
|
+
MapUtil.take(collection)(name)(() => ({
|
|
20
|
+
name,
|
|
21
|
+
path: "@lazy",
|
|
22
|
+
location: "@lazy",
|
|
23
|
+
routes: [],
|
|
24
|
+
})).routes.push(r);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const controllers: INestiaMigrateController[] = [...collection.values()];
|
|
28
|
+
for (const col of controllers) {
|
|
29
|
+
const splitPath = (r: IHttpMigrateRoute): string[] =>
|
|
30
|
+
r.emendedPath.split("/");
|
|
31
|
+
const splitLocation = (r: IHttpMigrateRoute): string[] =>
|
|
32
|
+
splitPath(r).filter((s) => s.length !== 0 && s[0] !== ":");
|
|
33
|
+
|
|
34
|
+
const minPath: string[] = splitPath(col.routes[0]!);
|
|
35
|
+
const minLocation: string[] = splitLocation(col.routes[0]!);
|
|
36
|
+
for (const r of col.routes.slice(1)) {
|
|
37
|
+
minPath.splice(getSplitIndex(minPath, splitPath(r)));
|
|
38
|
+
minLocation.splice(getSplitIndex(minLocation, splitLocation(r)));
|
|
39
|
+
}
|
|
40
|
+
col.path = minPath.join("/");
|
|
41
|
+
col.location = ["src", "controllers", ...minLocation].join("/");
|
|
42
|
+
}
|
|
43
|
+
return controllers;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const getSplitIndex = (x: string[], y: string[]) => {
|
|
48
|
+
const n: number = Math.min(x.length, y.length);
|
|
49
|
+
for (let i: number = 0; i < n; ++i) if (x[i] !== y[i]) return i;
|
|
50
|
+
return n;
|
|
51
|
+
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { VariadicSingleton } from "tstl";
|
|
2
|
-
|
|
3
|
-
export namespace NestiaMigrateFileArchiver {
|
|
4
|
-
export const archive = async (props: {
|
|
5
|
-
mkdir: (path: string) => Promise<void>;
|
|
6
|
-
writeFile: (path: string, content: string) => Promise<void>;
|
|
7
|
-
root: string;
|
|
8
|
-
files: Record<string, string>;
|
|
9
|
-
}): Promise<void> => {
|
|
10
|
-
const mkdir = new VariadicSingleton(
|
|
11
|
-
async (location: string): Promise<void> => {
|
|
12
|
-
try {
|
|
13
|
-
await props.mkdir(`${props.root}/${location}`);
|
|
14
|
-
} catch {}
|
|
15
|
-
},
|
|
16
|
-
);
|
|
17
|
-
const iterate = async (location: string): Promise<void> => {
|
|
18
|
-
const sequence: string[] = location
|
|
19
|
-
.split("/")
|
|
20
|
-
.map((_str, i, entire) => entire.slice(0, i + 1).join("/"));
|
|
21
|
-
for (const s of sequence) await mkdir.get(s);
|
|
22
|
-
};
|
|
23
|
-
for (const [key, value] of Object.entries(props.files)) {
|
|
24
|
-
await iterate(key.split("/").slice(0, -1).join("/"));
|
|
25
|
-
await props.writeFile(`${props.root}/${key}`, value);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
1
|
+
import { VariadicSingleton } from "tstl";
|
|
2
|
+
|
|
3
|
+
export namespace NestiaMigrateFileArchiver {
|
|
4
|
+
export const archive = async (props: {
|
|
5
|
+
mkdir: (path: string) => Promise<void>;
|
|
6
|
+
writeFile: (path: string, content: string) => Promise<void>;
|
|
7
|
+
root: string;
|
|
8
|
+
files: Record<string, string>;
|
|
9
|
+
}): Promise<void> => {
|
|
10
|
+
const mkdir = new VariadicSingleton(
|
|
11
|
+
async (location: string): Promise<void> => {
|
|
12
|
+
try {
|
|
13
|
+
await props.mkdir(`${props.root}/${location}`);
|
|
14
|
+
} catch {}
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
const iterate = async (location: string): Promise<void> => {
|
|
18
|
+
const sequence: string[] = location
|
|
19
|
+
.split("/")
|
|
20
|
+
.map((_str, i, entire) => entire.slice(0, i + 1).join("/"));
|
|
21
|
+
for (const s of sequence) await mkdir.get(s);
|
|
22
|
+
};
|
|
23
|
+
for (const [key, value] of Object.entries(props.files)) {
|
|
24
|
+
await iterate(key.split("/").slice(0, -1).join("/"));
|
|
25
|
+
await props.writeFile(`${props.root}/${key}`, value);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|