@nestia/migrate 12.0.0-rc.1 → 12.0.0-rc.3

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 (59) hide show
  1. package/LICENSE +21 -21
  2. package/lib/_virtual/_tstl.mjs +2 -2
  3. package/lib/archivers/NestiaMigrateFileArchiver2.mjs +2 -2
  4. package/lib/archivers/NestiaMigrateFileArchiver2.mjs.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/NEST_TEMPLATE2.mjs +47 -47
  8. package/lib/bundles/NEST_TEMPLATE2.mjs.map +1 -1
  9. package/lib/bundles/SDK_TEMPLATE.js +20 -20
  10. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  11. package/lib/bundles/SDK_TEMPLATE2.mjs +20 -20
  12. package/lib/bundles/SDK_TEMPLATE2.mjs.map +1 -1
  13. package/lib/programmers/NestiaMigrateApiProgrammer2.mjs +4 -4
  14. package/lib/programmers/NestiaMigrateApiProgrammer2.mjs.map +1 -1
  15. package/package.json +6 -6
  16. package/src/NestiaMigrateApplication.ts +196 -196
  17. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
  18. package/src/archivers/NestiaMigrateFileArchiver.ts +28 -28
  19. package/src/bundles/NEST_TEMPLATE.ts +47 -47
  20. package/src/bundles/SDK_TEMPLATE.ts +20 -20
  21. package/src/executable/NestiaMigrateCommander.ts +115 -115
  22. package/src/executable/NestiaMigrateInquirer.ts +106 -106
  23. package/src/executable/bundle.js +323 -349
  24. package/src/executable/migrate.ts +7 -7
  25. package/src/factories/ExpressionFactory.ts +23 -23
  26. package/src/factories/FormatCheatSheet.ts +71 -71
  27. package/src/factories/IdentifierFactory.ts +84 -84
  28. package/src/factories/LiteralFactory.ts +54 -54
  29. package/src/factories/StatementFactory.ts +56 -56
  30. package/src/factories/TypeFactory.ts +27 -27
  31. package/src/factories/TypeLiteralFactory.ts +62 -62
  32. package/src/index.ts +4 -4
  33. package/src/internal/ts.ts +75 -75
  34. package/src/module.ts +6 -6
  35. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
  36. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +358 -358
  37. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +511 -511
  38. package/src/programmers/NestiaMigrateApiProgrammer.ts +108 -108
  39. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +309 -309
  40. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +198 -198
  41. package/src/programmers/NestiaMigrateDtoProgrammer.ts +117 -117
  42. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +155 -155
  43. package/src/programmers/NestiaMigrateE2eProgrammer.ts +48 -48
  44. package/src/programmers/NestiaMigrateImportProgrammer.ts +119 -119
  45. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +70 -70
  46. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +402 -402
  47. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +64 -64
  48. package/src/programmers/NestiaMigrateNestProgrammer.ts +89 -89
  49. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +475 -475
  50. package/src/programmers/index.ts +15 -15
  51. package/src/structures/INestiaMigrateConfig.ts +19 -19
  52. package/src/structures/INestiaMigrateContext.ts +9 -9
  53. package/src/structures/INestiaMigrateController.ts +8 -8
  54. package/src/structures/INestiaMigrateFile.ts +5 -5
  55. package/src/structures/index.ts +4 -4
  56. package/src/utils/FilePrinter.ts +44 -44
  57. package/src/utils/MapUtil.ts +13 -13
  58. package/src/utils/StringUtil.ts +109 -109
  59. package/README.md +0 -93
@@ -1,70 +1,70 @@
1
- import { SyntaxKind, factory } from "@ttsc/factory";
2
- import { OpenApi } from "@typia/interface";
3
-
4
- import ts from "../internal/ts";
5
- import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
6
- import { INestiaMigrateController } from "../structures/INestiaMigrateController";
7
- import { FilePrinter } from "../utils/FilePrinter";
8
- import { StringUtil } from "../utils/StringUtil";
9
- import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
10
- import { NestiaMigrateNestMethodProgrammer } from "./NestiaMigrateNestMethodProgrammer";
11
-
12
- export namespace NestiaMigrateNestControllerProgrammer {
13
- export interface IProps {
14
- config: INestiaMigrateConfig;
15
- components: OpenApi.IComponents;
16
- controller: INestiaMigrateController;
17
- }
18
-
19
- export const write = (props: IProps): ts.Statement[] => {
20
- const importer: NestiaMigrateImportProgrammer =
21
- new NestiaMigrateImportProgrammer();
22
- const $class = factory.createClassDeclaration(
23
- [
24
- factory.createDecorator(
25
- factory.createCallExpression(
26
- factory.createIdentifier(
27
- importer.external({
28
- type: "instance",
29
- library: "@nestjs/common",
30
- name: "Controller",
31
- }),
32
- ),
33
- [],
34
- [factory.createStringLiteral(props.controller.path)],
35
- ),
36
- ),
37
- factory.createToken(SyntaxKind.ExportKeyword),
38
- ],
39
- props.controller.name,
40
- [],
41
- [],
42
- props.controller.routes
43
- .map((route, index) => [
44
- ...(index !== 0 ? [FilePrinter.newLine() as any] : []),
45
- (
46
- props.config.programmer?.controllerMethod ??
47
- NestiaMigrateNestMethodProgrammer.write
48
- )({
49
- config: props.config,
50
- components: props.components,
51
- controller: props.controller,
52
- importer,
53
- route,
54
- }),
55
- ])
56
- .flat(),
57
- );
58
- return [
59
- ...importer.toStatements(
60
- (ref) =>
61
- `${"../".repeat(
62
- StringUtil.splitWithNormalization(props.controller.location)
63
- .length - 1,
64
- )}api/structures/${ref}`,
65
- ),
66
- ...(importer.empty() ? [] : [FilePrinter.newLine()]),
67
- $class,
68
- ];
69
- };
70
- }
1
+ import { SyntaxKind, factory } from "@ttsc/factory";
2
+ import { OpenApi } from "@typia/interface";
3
+
4
+ import ts from "../internal/ts";
5
+ import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
6
+ import { INestiaMigrateController } from "../structures/INestiaMigrateController";
7
+ import { FilePrinter } from "../utils/FilePrinter";
8
+ import { StringUtil } from "../utils/StringUtil";
9
+ import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
10
+ import { NestiaMigrateNestMethodProgrammer } from "./NestiaMigrateNestMethodProgrammer";
11
+
12
+ export namespace NestiaMigrateNestControllerProgrammer {
13
+ export interface IProps {
14
+ config: INestiaMigrateConfig;
15
+ components: OpenApi.IComponents;
16
+ controller: INestiaMigrateController;
17
+ }
18
+
19
+ export const write = (props: IProps): ts.Statement[] => {
20
+ const importer: NestiaMigrateImportProgrammer =
21
+ new NestiaMigrateImportProgrammer();
22
+ const $class = factory.createClassDeclaration(
23
+ [
24
+ factory.createDecorator(
25
+ factory.createCallExpression(
26
+ factory.createIdentifier(
27
+ importer.external({
28
+ type: "instance",
29
+ library: "@nestjs/common",
30
+ name: "Controller",
31
+ }),
32
+ ),
33
+ [],
34
+ [factory.createStringLiteral(props.controller.path)],
35
+ ),
36
+ ),
37
+ factory.createToken(SyntaxKind.ExportKeyword),
38
+ ],
39
+ props.controller.name,
40
+ [],
41
+ [],
42
+ props.controller.routes
43
+ .map((route, index) => [
44
+ ...(index !== 0 ? [FilePrinter.newLine() as any] : []),
45
+ (
46
+ props.config.programmer?.controllerMethod ??
47
+ NestiaMigrateNestMethodProgrammer.write
48
+ )({
49
+ config: props.config,
50
+ components: props.components,
51
+ controller: props.controller,
52
+ importer,
53
+ route,
54
+ }),
55
+ ])
56
+ .flat(),
57
+ );
58
+ return [
59
+ ...importer.toStatements(
60
+ (ref) =>
61
+ `${"../".repeat(
62
+ StringUtil.splitWithNormalization(props.controller.location)
63
+ .length - 1,
64
+ )}api/structures/${ref}`,
65
+ ),
66
+ ...(importer.empty() ? [] : [FilePrinter.newLine()]),
67
+ $class,
68
+ ];
69
+ };
70
+ }