@nestia/migrate 11.2.0 → 12.0.0-dev.20260520.1

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 (119) hide show
  1. package/lib/NestiaMigrateApplication.d.ts +1 -12
  2. package/lib/NestiaMigrateApplication.js +22 -24873
  3. package/lib/NestiaMigrateApplication.js.map +1 -1
  4. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +1 -1
  5. package/lib/archivers/NestiaMigrateFileArchiver.js.map +1 -1
  6. package/lib/bundles/NEST_TEMPLATE.js +5 -5
  7. package/lib/bundles/NEST_TEMPLATE.js.map +1 -1
  8. package/lib/bundles/SDK_TEMPLATE.js +4 -4
  9. package/lib/bundles/SDK_TEMPLATE.js.map +1 -1
  10. package/lib/executable/NestiaMigrateCommander.js +14 -5
  11. package/lib/executable/NestiaMigrateCommander.js.map +1 -1
  12. package/lib/executable/NestiaMigrateInquirer.js.map +1 -1
  13. package/lib/factories/TypeLiteralFactory.d.ts +1 -1
  14. package/lib/factories/TypeLiteralFactory.js +49 -13
  15. package/lib/factories/TypeLiteralFactory.js.map +1 -1
  16. package/lib/index.js.map +1 -1
  17. package/lib/index.mjs +177 -24588
  18. package/lib/index.mjs.map +1 -1
  19. package/lib/internal/ts.d.ts +32 -0
  20. package/lib/internal/ts.js +37 -0
  21. package/lib/internal/ts.js.map +1 -0
  22. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +1 -1
  23. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +2 -5
  24. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +1 -1
  25. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +1 -1
  26. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +87 -49
  27. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +1 -1
  28. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +2 -2
  29. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +80 -82
  30. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +1 -1
  31. package/lib/programmers/NestiaMigrateApiProgrammer.js +3 -2
  32. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +1 -1
  33. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +2 -2
  34. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +39 -37
  35. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +1 -1
  36. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +33 -35
  37. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +1 -1
  38. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +1 -1
  39. package/lib/programmers/NestiaMigrateDtoProgrammer.js +17 -19
  40. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +1 -1
  41. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +1 -1
  42. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +26 -23
  43. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +1 -1
  44. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +1 -1
  45. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +1 -1
  46. package/lib/programmers/NestiaMigrateImportProgrammer.js +11 -14
  47. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +1 -1
  48. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +1 -1
  49. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +16 -18
  50. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +1 -1
  51. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +1 -1
  52. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +128 -132
  53. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +1 -1
  54. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +1 -1
  55. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +10 -9
  56. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +1 -1
  57. package/lib/programmers/NestiaMigrateNestProgrammer.js +3 -2
  58. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +1 -1
  59. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +2 -2
  60. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +114 -81
  61. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +1 -1
  62. package/lib/structures/INestiaMigrateConfig.d.ts +1 -1
  63. package/lib/utils/FilePrinter.d.ts +2 -2
  64. package/lib/utils/FilePrinter.js +8 -10
  65. package/lib/utils/FilePrinter.js.map +1 -1
  66. package/lib/utils/MapUtil.js.map +1 -1
  67. package/lib/utils/StringUtil.d.ts +0 -1
  68. package/lib/utils/StringUtil.js +0 -1
  69. package/lib/utils/StringUtil.js.map +1 -1
  70. package/package.json +9 -11
  71. package/src/NestiaMigrateApplication.ts +29 -30
  72. package/src/bundles/NEST_TEMPLATE.ts +5 -5
  73. package/src/bundles/SDK_TEMPLATE.ts +4 -4
  74. package/src/executable/NestiaMigrateCommander.ts +15 -4
  75. package/src/executable/bundle.js +237 -4
  76. package/src/factories/TypeLiteralFactory.ts +22 -16
  77. package/src/internal/ts.ts +94 -0
  78. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +7 -4
  79. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +88 -68
  80. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +122 -111
  81. package/src/programmers/NestiaMigrateApiProgrammer.ts +6 -5
  82. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +67 -61
  83. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +46 -45
  84. package/src/programmers/NestiaMigrateDtoProgrammer.ts +4 -3
  85. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +33 -30
  86. package/src/programmers/NestiaMigrateE2eProgrammer.ts +1 -1
  87. package/src/programmers/NestiaMigrateImportProgrammer.ts +20 -19
  88. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +8 -7
  89. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +82 -77
  90. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +18 -17
  91. package/src/programmers/NestiaMigrateNestProgrammer.ts +6 -5
  92. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +54 -42
  93. package/src/structures/INestiaMigrateConfig.ts +1 -1
  94. package/src/utils/FilePrinter.ts +9 -14
  95. package/src/utils/StringUtil.ts +0 -5
  96. package/lib/structures/INestiaMigrateDto.d.ts +0 -7
  97. package/lib/structures/INestiaMigrateDto.js +0 -3
  98. package/lib/structures/INestiaMigrateDto.js.map +0 -1
  99. package/lib/structures/INestiaMigrateProgram.d.ts +0 -9
  100. package/lib/structures/INestiaMigrateProgram.js +0 -3
  101. package/lib/structures/INestiaMigrateProgram.js.map +0 -1
  102. package/lib/structures/INestiaMigrateSchema.d.ts +0 -4
  103. package/lib/structures/INestiaMigrateSchema.js +0 -3
  104. package/lib/structures/INestiaMigrateSchema.js.map +0 -1
  105. package/lib/utils/SetupWizard.d.ts +0 -3
  106. package/lib/utils/SetupWizard.js +0 -18
  107. package/lib/utils/SetupWizard.js.map +0 -1
  108. package/lib/utils/openapi-down-convert/RefVisitor.d.ts +0 -52
  109. package/lib/utils/openapi-down-convert/RefVisitor.js +0 -102
  110. package/lib/utils/openapi-down-convert/RefVisitor.js.map +0 -1
  111. package/lib/utils/openapi-down-convert/converter.d.ts +0 -146
  112. package/lib/utils/openapi-down-convert/converter.js +0 -441
  113. package/lib/utils/openapi-down-convert/converter.js.map +0 -1
  114. package/src/structures/INestiaMigrateDto.ts +0 -8
  115. package/src/structures/INestiaMigrateProgram.ts +0 -11
  116. package/src/structures/INestiaMigrateSchema.ts +0 -4
  117. package/src/utils/SetupWizard.ts +0 -12
  118. package/src/utils/openapi-down-convert/RefVisitor.ts +0 -134
  119. package/src/utils/openapi-down-convert/converter.ts +0 -536
@@ -1,4 +1,5 @@
1
- import ts from "typescript";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import ts from "../internal/ts";
2
3
 
3
4
  import { TypeLiteralFactory } from "../factories/TypeLiteralFactory";
4
5
  import { FilePrinter } from "../utils/FilePrinter";
@@ -28,11 +29,11 @@ export class NestiaMigrateImportProgrammer {
28
29
  public dto(name: string, namespace?: string): ts.TypeReferenceNode {
29
30
  const file: string = name.split(".")[0]!;
30
31
  this.dtos_.add(file);
31
- return ts.factory.createTypeReferenceNode(
32
+ return TypeScriptFactory.createTypeReferenceNode(
32
33
  namespace?.length
33
- ? ts.factory.createQualifiedName(
34
- ts.factory.createIdentifier(namespace),
35
- ts.factory.createIdentifier(file),
34
+ ? TypeScriptFactory.createQualifiedName(
35
+ TypeScriptFactory.createIdentifier(namespace),
36
+ TypeScriptFactory.createIdentifier(file),
36
37
  )
37
38
  : name,
38
39
  );
@@ -44,7 +45,7 @@ export class NestiaMigrateImportProgrammer {
44
45
  library: "typia",
45
46
  name: "tags",
46
47
  });
47
- return ts.factory.createTypeReferenceNode(
48
+ return TypeScriptFactory.createTypeReferenceNode(
48
49
  `${instance}.${type}`,
49
50
  arg === undefined ? [] : [TypeLiteralFactory.generate(arg)],
50
51
  );
@@ -56,26 +57,26 @@ export class NestiaMigrateImportProgrammer {
56
57
  ): ts.Statement[] {
57
58
  return [
58
59
  ...[...this.external_.entries()].map(([library, props]) =>
59
- ts.factory.createImportDeclaration(
60
+ TypeScriptFactory.createImportDeclaration(
60
61
  undefined,
61
- ts.factory.createImportClause(
62
+ TypeScriptFactory.createImportClause(
62
63
  false,
63
64
  props.default !== null
64
- ? ts.factory.createIdentifier(props.default)
65
+ ? TypeScriptFactory.createIdentifier(props.default)
65
66
  : undefined,
66
67
  props.instances.size
67
- ? ts.factory.createNamedImports(
68
+ ? TypeScriptFactory.createNamedImports(
68
69
  [...props.instances].map((i) =>
69
- ts.factory.createImportSpecifier(
70
+ TypeScriptFactory.createImportSpecifier(
70
71
  false,
71
72
  undefined,
72
- ts.factory.createIdentifier(i),
73
+ TypeScriptFactory.createIdentifier(i),
73
74
  ),
74
75
  ),
75
76
  )
76
77
  : undefined,
77
78
  ),
78
- ts.factory.createStringLiteral(library),
79
+ TypeScriptFactory.createStringLiteral(library),
79
80
  ),
80
81
  ),
81
82
  ...(this.external_.size && this.dtos_.size
@@ -86,20 +87,20 @@ export class NestiaMigrateImportProgrammer {
86
87
  current ? (name) => name !== current!.split(".")[0] : () => true,
87
88
  )
88
89
  .map((i) =>
89
- ts.factory.createImportDeclaration(
90
+ TypeScriptFactory.createImportDeclaration(
90
91
  undefined,
91
- ts.factory.createImportClause(
92
+ TypeScriptFactory.createImportClause(
92
93
  false,
93
94
  undefined,
94
- ts.factory.createNamedImports([
95
- ts.factory.createImportSpecifier(
95
+ TypeScriptFactory.createNamedImports([
96
+ TypeScriptFactory.createImportSpecifier(
96
97
  false,
97
98
  undefined,
98
- ts.factory.createIdentifier(i),
99
+ TypeScriptFactory.createIdentifier(i),
99
100
  ),
100
101
  ]),
101
102
  ),
102
- ts.factory.createStringLiteral(dtoPath(i)),
103
+ TypeScriptFactory.createStringLiteral(dtoPath(i)),
103
104
  ),
104
105
  ),
105
106
  ];
@@ -1,5 +1,6 @@
1
+ import { TypeScriptFactory } from "@nestia/factory";
1
2
  import { OpenApi } from "@typia/interface";
2
- import ts from "typescript";
3
+ import ts from "../internal/ts";
3
4
 
4
5
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
5
6
  import { INestiaMigrateController } from "../structures/INestiaMigrateController";
@@ -18,11 +19,11 @@ export namespace NestiaMigrateNestControllerProgrammer {
18
19
  export const write = (props: IProps): ts.Statement[] => {
19
20
  const importer: NestiaMigrateImportProgrammer =
20
21
  new NestiaMigrateImportProgrammer();
21
- const $class = ts.factory.createClassDeclaration(
22
+ const $class = TypeScriptFactory.createClassDeclaration(
22
23
  [
23
- ts.factory.createDecorator(
24
- ts.factory.createCallExpression(
25
- ts.factory.createIdentifier(
24
+ TypeScriptFactory.createDecorator(
25
+ TypeScriptFactory.createCallExpression(
26
+ TypeScriptFactory.createIdentifier(
26
27
  importer.external({
27
28
  type: "instance",
28
29
  library: "@nestjs/common",
@@ -30,10 +31,10 @@ export namespace NestiaMigrateNestControllerProgrammer {
30
31
  }),
31
32
  ),
32
33
  [],
33
- [ts.factory.createStringLiteral(props.controller.path)],
34
+ [TypeScriptFactory.createStringLiteral(props.controller.path)],
34
35
  ),
35
36
  ),
36
- ts.factory.createToken(ts.SyntaxKind.ExportKeyword),
37
+ TypeScriptFactory.createToken(ts.SyntaxKind.ExportKeyword),
37
38
  ],
38
39
  props.controller.name,
39
40
  [],
@@ -1,11 +1,12 @@
1
+ import { TypeScriptFactory } from "@nestia/factory";
1
2
  import {
2
3
  ExpressionFactory,
3
4
  IdentifierFactory,
4
5
  LiteralFactory,
5
6
  TypeFactory,
6
- } from "@typia/core";
7
+ } from "@nestia/factory";
7
8
  import { IHttpMigrateRoute } from "@typia/interface";
8
- import ts from "typescript";
9
+ import ts from "../internal/ts";
9
10
  import { OpenApi } from "typia";
10
11
 
11
12
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
@@ -33,50 +34,51 @@ export namespace NestiaMigrateNestMethodProgrammer {
33
34
  })
34
35
  : TypeFactory.keyword("void");
35
36
 
36
- const method: ts.MethodDeclaration = ts.factory.createMethodDeclaration(
37
- [
38
- ...writeMethodDecorators(ctx),
39
- ts.factory.createToken(ts.SyntaxKind.PublicKeyword),
40
- ts.factory.createToken(ts.SyntaxKind.AsyncKeyword),
41
- ],
42
- undefined,
43
- ctx.route.accessor.at(-1)!,
44
- undefined,
45
- undefined,
46
- writeParameters(ctx),
47
- ts.factory.createTypeReferenceNode("Promise", [output]),
48
- ts.factory.createBlock(
37
+ const method: ts.MethodDeclaration =
38
+ TypeScriptFactory.createMethodDeclaration(
49
39
  [
50
- ...[
51
- ...ctx.route.parameters.map((p) => p.key),
52
- ...(ctx.route.headers ? ["headers"] : []),
53
- ...(ctx.route.query ? ["query"] : []),
54
- ...(ctx.route.body ? ["body"] : []),
55
- ].map((str) =>
56
- ts.factory.createExpressionStatement(
57
- ts.factory.createIdentifier(str),
40
+ ...writeMethodDecorators(ctx),
41
+ TypeScriptFactory.createToken(ts.SyntaxKind.PublicKeyword),
42
+ TypeScriptFactory.createToken(ts.SyntaxKind.AsyncKeyword),
43
+ ],
44
+ undefined,
45
+ ctx.route.accessor.at(-1)!,
46
+ undefined,
47
+ undefined,
48
+ writeParameters(ctx),
49
+ TypeScriptFactory.createTypeReferenceNode("Promise", [output]),
50
+ TypeScriptFactory.createBlock(
51
+ [
52
+ ...[
53
+ ...ctx.route.parameters.map((p) => p.key),
54
+ ...(ctx.route.headers ? ["headers"] : []),
55
+ ...(ctx.route.query ? ["query"] : []),
56
+ ...(ctx.route.body ? ["body"] : []),
57
+ ].map((str) =>
58
+ TypeScriptFactory.createExpressionStatement(
59
+ TypeScriptFactory.createIdentifier(str),
60
+ ),
58
61
  ),
59
- ),
60
- ts.factory.createReturnStatement(
61
- ts.factory.createCallExpression(
62
- IdentifierFactory.access(
63
- ts.factory.createIdentifier(
64
- ctx.importer.external({
65
- type: "default",
66
- library: "typia",
67
- name: "typia",
68
- }),
62
+ TypeScriptFactory.createReturnStatement(
63
+ TypeScriptFactory.createCallExpression(
64
+ IdentifierFactory.access(
65
+ TypeScriptFactory.createIdentifier(
66
+ ctx.importer.external({
67
+ type: "default",
68
+ library: "typia",
69
+ name: "typia",
70
+ }),
71
+ ),
72
+ "random",
69
73
  ),
70
- "random",
74
+ [output],
75
+ undefined,
71
76
  ),
72
- [output],
73
- undefined,
74
77
  ),
75
- ),
76
- ],
77
- true,
78
- ),
79
- );
78
+ ],
79
+ true,
80
+ ),
81
+ );
80
82
  return FilePrinter.description(
81
83
  method,
82
84
  writeDescription(ctx.config, ctx.route),
@@ -94,7 +96,7 @@ export namespace NestiaMigrateNestMethodProgrammer {
94
96
 
95
97
  const writeMethodDecorators = (ctx: IContext): ts.Decorator[] => {
96
98
  const external = (lib: string, instance: string): ts.Identifier =>
97
- ts.factory.createIdentifier(
99
+ TypeScriptFactory.createIdentifier(
98
100
  ctx.importer.external({
99
101
  type: "instance",
100
102
  library: lib,
@@ -114,8 +116,8 @@ export namespace NestiaMigrateNestMethodProgrammer {
114
116
  // HUMAN-ONLY
115
117
  if (ctx.route.operation()["x-samchon-human"] === true)
116
118
  decorators.push(
117
- ts.factory.createDecorator(
118
- ts.factory.createCallExpression(
119
+ TypeScriptFactory.createDecorator(
120
+ TypeScriptFactory.createCallExpression(
119
121
  external("@nestia/core", "HumanRoute"),
120
122
  undefined,
121
123
  undefined,
@@ -130,15 +132,15 @@ export namespace NestiaMigrateNestMethodProgrammer {
130
132
  .filter((str) => !!str.length)
131
133
  .join("/");
132
134
  const router = (instance: string) =>
133
- ts.factory.createDecorator(
134
- ts.factory.createCallExpression(
135
+ TypeScriptFactory.createDecorator(
136
+ TypeScriptFactory.createCallExpression(
135
137
  IdentifierFactory.access(
136
138
  external("@nestia/core", instance),
137
139
  StringUtil.capitalize(ctx.route.method),
138
140
  ),
139
141
  [],
140
142
  localPath.length
141
- ? [ts.factory.createStringLiteral(localPath)]
143
+ ? [TypeScriptFactory.createStringLiteral(localPath)]
142
144
  : undefined,
143
145
  ),
144
146
  );
@@ -146,11 +148,11 @@ export namespace NestiaMigrateNestMethodProgrammer {
146
148
  decorators.push(router("EncryptedRoute"));
147
149
  else if (ctx.route.success?.type === "text/plain")
148
150
  decorators.push(
149
- ts.factory.createDecorator(
150
- ts.factory.createCallExpression(
151
+ TypeScriptFactory.createDecorator(
152
+ TypeScriptFactory.createCallExpression(
151
153
  external("@nestjs/common", StringUtil.capitalize(ctx.route.method)),
152
154
  [],
153
- [ts.factory.createStringLiteral(ctx.route.path)],
155
+ [TypeScriptFactory.createStringLiteral(ctx.route.path)],
154
156
  ),
155
157
  ),
156
158
  );
@@ -158,11 +160,11 @@ export namespace NestiaMigrateNestMethodProgrammer {
158
160
  decorators.push(router("TypedQuery"));
159
161
  else if (ctx.route.method === "head")
160
162
  decorators.push(
161
- ts.factory.createDecorator(
162
- ts.factory.createCallExpression(
163
+ TypeScriptFactory.createDecorator(
164
+ TypeScriptFactory.createCallExpression(
163
165
  external("@nestjs/common", "Head"),
164
166
  [],
165
- [ts.factory.createStringLiteral(ctx.route.path)],
167
+ [TypeScriptFactory.createStringLiteral(ctx.route.path)],
166
168
  ),
167
169
  ),
168
170
  );
@@ -173,8 +175,8 @@ export namespace NestiaMigrateNestMethodProgrammer {
173
175
  decorators.push(router("TypedRoute"));
174
176
  for (const [key, value] of Object.entries(ctx.route.exceptions ?? {}))
175
177
  decorators.push(
176
- ts.factory.createDecorator(
177
- ts.factory.createCallExpression(
178
+ TypeScriptFactory.createDecorator(
179
+ TypeScriptFactory.createCallExpression(
178
180
  external("@nestia/core", "TypedException"),
179
181
  [
180
182
  NestiaMigrateSchemaProgrammer.write({
@@ -185,11 +187,11 @@ export namespace NestiaMigrateNestMethodProgrammer {
185
187
  ],
186
188
  [
187
189
  isNaN(Number(key))
188
- ? ts.factory.createStringLiteral(key)
190
+ ? TypeScriptFactory.createStringLiteral(key)
189
191
  : ExpressionFactory.number(Number(key)),
190
192
  ...(value.response().description?.length
191
193
  ? [
192
- ts.factory.createStringLiteral(
194
+ TypeScriptFactory.createStringLiteral(
193
195
  value.response().description!,
194
196
  ),
195
197
  ]
@@ -203,12 +205,12 @@ export namespace NestiaMigrateNestMethodProgrammer {
203
205
 
204
206
  const writeParameters = (ctx: IContext): ts.ParameterDeclaration[] => [
205
207
  ...ctx.route.parameters.map((p) =>
206
- ts.factory.createParameterDeclaration(
208
+ TypeScriptFactory.createParameterDeclaration(
207
209
  [
208
210
  ...writeExampleDecorators("Parameter")(ctx.importer)(p.parameter()),
209
- ts.factory.createDecorator(
210
- ts.factory.createCallExpression(
211
- ts.factory.createIdentifier(
211
+ TypeScriptFactory.createDecorator(
212
+ TypeScriptFactory.createCallExpression(
213
+ TypeScriptFactory.createIdentifier(
212
214
  ctx.importer.external({
213
215
  type: "instance",
214
216
  library: "@nestia/core",
@@ -216,7 +218,7 @@ export namespace NestiaMigrateNestMethodProgrammer {
216
218
  }),
217
219
  ),
218
220
  undefined,
219
- [ts.factory.createStringLiteral(p.key)],
221
+ [TypeScriptFactory.createStringLiteral(p.key)],
220
222
  ),
221
223
  ),
222
224
  ],
@@ -276,14 +278,14 @@ export namespace NestiaMigrateNestMethodProgrammer {
276
278
  arguments:
277
279
  ctx.route.body.type === "multipart/form-data"
278
280
  ? [
279
- ts.factory.createArrowFunction(
281
+ TypeScriptFactory.createArrowFunction(
280
282
  undefined,
281
283
  undefined,
282
284
  [],
283
285
  undefined,
284
286
  undefined,
285
- ts.factory.createCallExpression(
286
- ts.factory.createIdentifier(
287
+ TypeScriptFactory.createCallExpression(
288
+ TypeScriptFactory.createIdentifier(
287
289
  ctx.importer.external({
288
290
  type: "default",
289
291
  library: "multer",
@@ -324,7 +326,7 @@ export namespace NestiaMigrateNestMethodProgrammer {
324
326
  example?: any;
325
327
  examples?: Record<string, any>;
326
328
  }): ts.ParameterDeclaration => {
327
- const instance = ts.factory.createIdentifier(
329
+ const instance = TypeScriptFactory.createIdentifier(
328
330
  importer.external({
329
331
  type: "instance",
330
332
  library: "@nestia/core",
@@ -334,11 +336,11 @@ export namespace NestiaMigrateNestMethodProgrammer {
334
336
  : accessor.method[0],
335
337
  }),
336
338
  );
337
- return ts.factory.createParameterDeclaration(
339
+ return TypeScriptFactory.createParameterDeclaration(
338
340
  [
339
341
  ...writeExampleDecorators("Parameter")(importer)(props),
340
- ts.factory.createDecorator(
341
- ts.factory.createCallExpression(
342
+ TypeScriptFactory.createDecorator(
343
+ TypeScriptFactory.createCallExpression(
342
344
  typeof accessor.method === "string"
343
345
  ? instance
344
346
  : IdentifierFactory.access(instance, accessor.method[1]),
@@ -350,7 +352,7 @@ export namespace NestiaMigrateNestMethodProgrammer {
350
352
  undefined,
351
353
  accessor.variable,
352
354
  props.required === false
353
- ? ts.factory.createToken(ts.SyntaxKind.QuestionToken)
355
+ ? TypeScriptFactory.createToken(ts.SyntaxKind.QuestionToken)
354
356
  : undefined,
355
357
  NestiaMigrateSchemaProgrammer.write({
356
358
  components,
@@ -369,10 +371,10 @@ export namespace NestiaMigrateNestMethodProgrammer {
369
371
  }): ts.Decorator[] => [
370
372
  ...(media.example !== undefined
371
373
  ? [
372
- ts.factory.createDecorator(
373
- ts.factory.createCallExpression(
374
+ TypeScriptFactory.createDecorator(
375
+ TypeScriptFactory.createCallExpression(
374
376
  IdentifierFactory.access(
375
- ts.factory.createIdentifier(
377
+ TypeScriptFactory.createIdentifier(
376
378
  importer.external({
377
379
  type: "instance",
378
380
  library: "@nestia/core",
@@ -388,10 +390,10 @@ export namespace NestiaMigrateNestMethodProgrammer {
388
390
  ]
389
391
  : []),
390
392
  ...Object.entries(media.examples ?? {}).map(([key, value]) =>
391
- ts.factory.createDecorator(
392
- ts.factory.createCallExpression(
393
+ TypeScriptFactory.createDecorator(
394
+ TypeScriptFactory.createCallExpression(
393
395
  IdentifierFactory.access(
394
- ts.factory.createIdentifier(
396
+ TypeScriptFactory.createIdentifier(
395
397
  importer.external({
396
398
  type: "instance",
397
399
  library: "@nestia/core",
@@ -401,7 +403,10 @@ export namespace NestiaMigrateNestMethodProgrammer {
401
403
  kind,
402
404
  ),
403
405
  [],
404
- [ts.factory.createStringLiteral(key), LiteralFactory.write(value)],
406
+ [
407
+ TypeScriptFactory.createStringLiteral(key),
408
+ LiteralFactory.write(value),
409
+ ],
405
410
  ),
406
411
  ),
407
412
  ),
@@ -1,4 +1,5 @@
1
- import ts from "typescript";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import ts from "../internal/ts";
2
3
 
3
4
  import { INestiaMigrateController } from "../structures/INestiaMigrateController";
4
5
  import { FilePrinter } from "../utils/FilePrinter";
@@ -13,20 +14,20 @@ export namespace NestiaMigrateNestModuleProgrammer {
13
14
  $import(`${c.location.replace("src/", "./")}/${c.name}`)(c.name),
14
15
  ),
15
16
  ...(controllers.length ? [FilePrinter.newLine()] : []),
16
- ts.factory.createClassDeclaration(
17
+ TypeScriptFactory.createClassDeclaration(
17
18
  [
18
- ts.factory.createDecorator(
19
- ts.factory.createCallExpression(
20
- ts.factory.createIdentifier("Module"),
19
+ TypeScriptFactory.createDecorator(
20
+ TypeScriptFactory.createCallExpression(
21
+ TypeScriptFactory.createIdentifier("Module"),
21
22
  undefined,
22
23
  [
23
- ts.factory.createObjectLiteralExpression(
24
+ TypeScriptFactory.createObjectLiteralExpression(
24
25
  [
25
- ts.factory.createPropertyAssignment(
26
- ts.factory.createIdentifier("controllers"),
27
- ts.factory.createArrayLiteralExpression(
26
+ TypeScriptFactory.createPropertyAssignment(
27
+ TypeScriptFactory.createIdentifier("controllers"),
28
+ TypeScriptFactory.createArrayLiteralExpression(
28
29
  controllers.map((c) =>
29
- ts.factory.createIdentifier(c.name),
30
+ TypeScriptFactory.createIdentifier(c.name),
30
31
  ),
31
32
  true,
32
33
  ),
@@ -37,7 +38,7 @@ export namespace NestiaMigrateNestModuleProgrammer {
37
38
  ],
38
39
  ),
39
40
  ),
40
- ts.factory.createToken(ts.SyntaxKind.ExportKeyword),
41
+ TypeScriptFactory.createToken(ts.SyntaxKind.ExportKeyword),
41
42
  ],
42
43
  "MyModule",
43
44
  undefined,
@@ -48,18 +49,18 @@ export namespace NestiaMigrateNestModuleProgrammer {
48
49
  }
49
50
 
50
51
  const $import = (file: string) => (instance: string) =>
51
- ts.factory.createImportDeclaration(
52
+ TypeScriptFactory.createImportDeclaration(
52
53
  undefined,
53
- ts.factory.createImportClause(
54
+ TypeScriptFactory.createImportClause(
54
55
  false,
55
56
  undefined,
56
- ts.factory.createNamedImports([
57
- ts.factory.createImportSpecifier(
57
+ TypeScriptFactory.createNamedImports([
58
+ TypeScriptFactory.createImportSpecifier(
58
59
  false,
59
60
  undefined,
60
- ts.factory.createIdentifier(instance),
61
+ TypeScriptFactory.createIdentifier(instance),
61
62
  ),
62
63
  ]),
63
64
  ),
64
- ts.factory.createStringLiteral(file),
65
+ TypeScriptFactory.createStringLiteral(file),
65
66
  );
@@ -1,4 +1,5 @@
1
- import ts from "typescript";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import ts from "../internal/ts";
2
3
 
3
4
  import { NestiaMigrateControllerAnalyzer } from "../analyzers/NestiaMigrateControllerAnalyzer";
4
5
  import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
@@ -74,10 +75,10 @@ export namespace NestiaMigrateNestProgrammer {
74
75
  for (const child of modulo.children.values())
75
76
  internal.push(...iterate(importer)(child));
76
77
  output.push(
77
- ts.factory.createModuleDeclaration(
78
- [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
79
- ts.factory.createIdentifier(modulo.name),
80
- ts.factory.createModuleBlock(internal),
78
+ TypeScriptFactory.createModuleDeclaration(
79
+ [TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword)],
80
+ TypeScriptFactory.createIdentifier(modulo.name),
81
+ TypeScriptFactory.createModuleBlock(internal),
81
82
  ts.NodeFlags.Namespace,
82
83
  ),
83
84
  );