@nestia/migrate 11.2.1 → 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,6 +1,7 @@
1
- import { IdentifierFactory, StatementFactory, TypeFactory } from "@typia/core";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import { IdentifierFactory, StatementFactory, TypeFactory } from "@nestia/factory";
2
3
  import { IHttpMigrateRoute } from "@typia/interface";
3
- import ts from "typescript";
4
+ import ts from "../internal/ts";
4
5
  import { OpenApi } from "typia";
5
6
 
6
7
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
@@ -27,15 +28,15 @@ export namespace NestiaMigrateApiSimulationProgrammer {
27
28
  : TypeFactory.keyword("void");
28
29
  return constant(
29
30
  "random",
30
- ts.factory.createArrowFunction(
31
+ TypeScriptFactory.createArrowFunction(
31
32
  undefined,
32
33
  undefined,
33
34
  [],
34
35
  output,
35
36
  undefined,
36
- ts.factory.createCallExpression(
37
+ TypeScriptFactory.createCallExpression(
37
38
  IdentifierFactory.access(
38
- ts.factory.createIdentifier(
39
+ TypeScriptFactory.createIdentifier(
39
40
  ctx.importer.external({
40
41
  type: "default",
41
42
  library: "typia",
@@ -53,14 +54,14 @@ export namespace NestiaMigrateApiSimulationProgrammer {
53
54
 
54
55
  export const simulate = (ctx: IContext): ts.VariableStatement => {
55
56
  const caller = () =>
56
- ts.factory.createCallExpression(
57
- ts.factory.createIdentifier("random"),
57
+ TypeScriptFactory.createCallExpression(
58
+ TypeScriptFactory.createIdentifier("random"),
58
59
  undefined,
59
60
  undefined,
60
61
  );
61
62
  return constant(
62
63
  "simulate",
63
- ts.factory.createArrowFunction(
64
+ TypeScriptFactory.createArrowFunction(
64
65
  undefined,
65
66
  undefined,
66
67
  NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(
@@ -71,12 +72,12 @@ export namespace NestiaMigrateApiSimulationProgrammer {
71
72
  ? "_connection"
72
73
  : undefined,
73
74
  ),
74
- ts.factory.createTypeReferenceNode(
75
+ TypeScriptFactory.createTypeReferenceNode(
75
76
  ctx.route.success ? "Response" : "void",
76
77
  ),
77
78
  undefined,
78
- ts.factory.createBlock(
79
- [...assert(ctx), ts.factory.createReturnStatement(caller())],
79
+ TypeScriptFactory.createBlock(
80
+ [...assert(ctx), TypeScriptFactory.createReturnStatement(caller())],
80
81
  true,
81
82
  ),
82
83
  ),
@@ -86,8 +87,11 @@ export namespace NestiaMigrateApiSimulationProgrammer {
86
87
  const assert = (ctx: IContext): ts.Statement[] => {
87
88
  const property = (key: string) =>
88
89
  ctx.config.keyword === true
89
- ? IdentifierFactory.access(ts.factory.createIdentifier("props"), key)
90
- : ts.factory.createIdentifier(key);
90
+ ? IdentifierFactory.access(
91
+ TypeScriptFactory.createIdentifier("props"),
92
+ key,
93
+ )
94
+ : TypeScriptFactory.createIdentifier(key);
91
95
  const parameters = [
92
96
  ...ctx.route.parameters.map((p) => ({
93
97
  category: "param",
@@ -129,9 +133,9 @@ export namespace NestiaMigrateApiSimulationProgrammer {
129
133
 
130
134
  const validator = StatementFactory.constant({
131
135
  name: "assert",
132
- value: ts.factory.createCallExpression(
136
+ value: TypeScriptFactory.createCallExpression(
133
137
  IdentifierFactory.access(
134
- ts.factory.createIdentifier(
138
+ TypeScriptFactory.createIdentifier(
135
139
  ctx.importer.external({
136
140
  type: "instance",
137
141
  library: `@nestia/fetcher`,
@@ -142,26 +146,26 @@ export namespace NestiaMigrateApiSimulationProgrammer {
142
146
  ),
143
147
  undefined,
144
148
  [
145
- ts.factory.createObjectLiteralExpression(
149
+ TypeScriptFactory.createObjectLiteralExpression(
146
150
  [
147
- ts.factory.createPropertyAssignment(
151
+ TypeScriptFactory.createPropertyAssignment(
148
152
  "method",
149
- ts.factory.createIdentifier("METADATA.method"),
153
+ TypeScriptFactory.createIdentifier("METADATA.method"),
150
154
  ),
151
- ts.factory.createPropertyAssignment(
155
+ TypeScriptFactory.createPropertyAssignment(
152
156
  "host",
153
- ts.factory.createIdentifier("connection.host"),
157
+ TypeScriptFactory.createIdentifier("connection.host"),
154
158
  ),
155
- ts.factory.createPropertyAssignment(
159
+ TypeScriptFactory.createPropertyAssignment(
156
160
  "path",
157
161
  NestiaMigrateApiNamespaceProgrammer.writePathCallExpression(
158
162
  ctx.config,
159
163
  ctx.route,
160
164
  ),
161
165
  ),
162
- ts.factory.createPropertyAssignment(
166
+ TypeScriptFactory.createPropertyAssignment(
163
167
  "contentType",
164
- ts.factory.createStringLiteral(
168
+ TypeScriptFactory.createStringLiteral(
165
169
  ctx.route.success?.type ?? "application/json",
166
170
  ),
167
171
  ),
@@ -171,30 +175,30 @@ export namespace NestiaMigrateApiSimulationProgrammer {
171
175
  ],
172
176
  ),
173
177
  });
174
- const individual = parameters
178
+ const individual: ts.Statement[] = parameters
175
179
  .map((p) =>
176
- ts.factory.createCallExpression(
180
+ TypeScriptFactory.createCallExpression(
177
181
  (() => {
178
182
  const base = IdentifierFactory.access(
179
- ts.factory.createIdentifier("assert"),
183
+ TypeScriptFactory.createIdentifier("assert"),
180
184
  p.category,
181
185
  );
182
186
  if (p.category !== "param") return base;
183
- return ts.factory.createCallExpression(base, undefined, [
184
- ts.factory.createStringLiteral(p.name),
187
+ return TypeScriptFactory.createCallExpression(base, undefined, [
188
+ TypeScriptFactory.createStringLiteral(p.name),
185
189
  ]);
186
190
  })(),
187
191
  undefined,
188
192
  [
189
- ts.factory.createArrowFunction(
193
+ TypeScriptFactory.createArrowFunction(
190
194
  undefined,
191
195
  undefined,
192
196
  [],
193
197
  undefined,
194
198
  undefined,
195
- ts.factory.createCallExpression(
199
+ TypeScriptFactory.createCallExpression(
196
200
  IdentifierFactory.access(
197
- ts.factory.createIdentifier(
201
+ TypeScriptFactory.createIdentifier(
198
202
  ctx.importer.external({
199
203
  type: "default",
200
204
  library: "typia",
@@ -206,7 +210,7 @@ export namespace NestiaMigrateApiSimulationProgrammer {
206
210
  undefined,
207
211
  [
208
212
  p.category === "headers"
209
- ? ts.factory.createIdentifier("connection.headers")
213
+ ? TypeScriptFactory.createIdentifier("connection.headers")
210
214
  : property(p.name),
211
215
  ],
212
216
  ),
@@ -214,7 +218,7 @@ export namespace NestiaMigrateApiSimulationProgrammer {
214
218
  ],
215
219
  ),
216
220
  )
217
- .map(ts.factory.createExpressionStatement);
221
+ .map(TypeScriptFactory.createExpressionStatement) as ts.Statement[];
218
222
  return [validator, tryAndCatch(ctx.importer, individual)];
219
223
  };
220
224
 
@@ -222,17 +226,17 @@ export namespace NestiaMigrateApiSimulationProgrammer {
222
226
  importer: NestiaMigrateImportProgrammer,
223
227
  individual: ts.Statement[],
224
228
  ) =>
225
- ts.factory.createTryStatement(
226
- ts.factory.createBlock(individual, true),
227
- ts.factory.createCatchClause(
229
+ TypeScriptFactory.createTryStatement(
230
+ TypeScriptFactory.createBlock(individual, true),
231
+ TypeScriptFactory.createCatchClause(
228
232
  "exp",
229
- ts.factory.createBlock(
233
+ TypeScriptFactory.createBlock(
230
234
  [
231
- ts.factory.createIfStatement(
232
- ts.factory.createLogicalNot(
233
- ts.factory.createCallExpression(
235
+ TypeScriptFactory.createIfStatement(
236
+ TypeScriptFactory.createLogicalNot(
237
+ TypeScriptFactory.createCallExpression(
234
238
  IdentifierFactory.access(
235
- ts.factory.createIdentifier(
239
+ TypeScriptFactory.createIdentifier(
236
240
  importer.external({
237
241
  type: "default",
238
242
  library: "typia",
@@ -242,7 +246,7 @@ export namespace NestiaMigrateApiSimulationProgrammer {
242
246
  "is",
243
247
  ),
244
248
  [
245
- ts.factory.createTypeReferenceNode(
249
+ TypeScriptFactory.createTypeReferenceNode(
246
250
  importer.external({
247
251
  type: "instance",
248
252
  library: "@nestia/fetcher",
@@ -250,32 +254,34 @@ export namespace NestiaMigrateApiSimulationProgrammer {
250
254
  }),
251
255
  ),
252
256
  ],
253
- [ts.factory.createIdentifier("exp")],
257
+ [TypeScriptFactory.createIdentifier("exp")],
254
258
  ),
255
259
  ),
256
- ts.factory.createThrowStatement(
257
- ts.factory.createIdentifier("exp"),
260
+ TypeScriptFactory.createThrowStatement(
261
+ TypeScriptFactory.createIdentifier("exp"),
258
262
  ),
259
263
  ),
260
- ts.factory.createReturnStatement(
261
- ts.factory.createAsExpression(
262
- ts.factory.createObjectLiteralExpression(
264
+ TypeScriptFactory.createReturnStatement(
265
+ TypeScriptFactory.createAsExpression(
266
+ TypeScriptFactory.createObjectLiteralExpression(
263
267
  [
264
- ts.factory.createPropertyAssignment(
268
+ TypeScriptFactory.createPropertyAssignment(
265
269
  "success",
266
- ts.factory.createFalse(),
270
+ TypeScriptFactory.createFalse(),
267
271
  ),
268
- ts.factory.createPropertyAssignment(
272
+ TypeScriptFactory.createPropertyAssignment(
269
273
  "status",
270
- ts.factory.createIdentifier("exp.status"),
274
+ TypeScriptFactory.createIdentifier("exp.status"),
271
275
  ),
272
- ts.factory.createPropertyAssignment(
276
+ TypeScriptFactory.createPropertyAssignment(
273
277
  "headers",
274
- ts.factory.createIdentifier("exp.headers"),
278
+ TypeScriptFactory.createIdentifier("exp.headers"),
275
279
  ),
276
- ts.factory.createPropertyAssignment(
280
+ TypeScriptFactory.createPropertyAssignment(
277
281
  "data",
278
- ts.factory.createIdentifier("exp.toJSON().message"),
282
+ TypeScriptFactory.createIdentifier(
283
+ "exp.toJSON().message",
284
+ ),
279
285
  ),
280
286
  ],
281
287
  true,
@@ -292,12 +298,12 @@ export namespace NestiaMigrateApiSimulationProgrammer {
292
298
  }
293
299
 
294
300
  const constant = (name: string, expression: ts.Expression) =>
295
- ts.factory.createVariableStatement(
296
- [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
297
- ts.factory.createVariableDeclarationList(
301
+ TypeScriptFactory.createVariableStatement(
302
+ [TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword)],
303
+ TypeScriptFactory.createVariableDeclarationList(
298
304
  [
299
- ts.factory.createVariableDeclaration(
300
- ts.factory.createIdentifier(name),
305
+ TypeScriptFactory.createVariableDeclaration(
306
+ TypeScriptFactory.createIdentifier(name),
301
307
  undefined,
302
308
  undefined,
303
309
  expression,
@@ -1,6 +1,7 @@
1
- import { IdentifierFactory, StatementFactory } from "@typia/core";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import { IdentifierFactory, StatementFactory } from "@nestia/factory";
2
3
  import { IHttpMigrateRoute } from "@typia/interface";
3
- import ts from "typescript";
4
+ import ts from "../internal/ts";
4
5
 
5
6
  import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
6
7
  import { FilePrinter } from "../utils/FilePrinter";
@@ -23,25 +24,25 @@ export namespace NestiaMigrateApiStartProgrammer {
23
24
  (name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`,
24
25
  ),
25
26
  FilePrinter.newLine(),
26
- ts.factory.createImportDeclaration(
27
+ TypeScriptFactory.createImportDeclaration(
27
28
  undefined,
28
- ts.factory.createImportClause(
29
+ TypeScriptFactory.createImportClause(
29
30
  false,
30
31
  undefined,
31
- ts.factory.createNamedImports([
32
- ts.factory.createImportSpecifier(
32
+ TypeScriptFactory.createNamedImports([
33
+ TypeScriptFactory.createImportSpecifier(
33
34
  false,
34
35
  undefined,
35
- ts.factory.createIdentifier("TestGlobal"),
36
+ TypeScriptFactory.createIdentifier("TestGlobal"),
36
37
  ),
37
38
  ]),
38
39
  ),
39
- ts.factory.createStringLiteral("./TestGlobal"),
40
+ TypeScriptFactory.createStringLiteral("./TestGlobal"),
40
41
  undefined,
41
42
  ),
42
43
  FilePrinter.newLine(),
43
44
  main,
44
- ts.factory.createExpressionStatement(writeStarter()),
45
+ TypeScriptFactory.createExpressionStatement(writeStarter()),
45
46
  ];
46
47
  return {
47
48
  "test/start.ts": FilePrinter.write({ statements }),
@@ -55,13 +56,13 @@ export namespace NestiaMigrateApiStartProgrammer {
55
56
  ): ts.VariableStatement =>
56
57
  StatementFactory.constant({
57
58
  name: "main",
58
- value: ts.factory.createArrowFunction(
59
- [ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
59
+ value: TypeScriptFactory.createArrowFunction(
60
+ [TypeScriptFactory.createToken(ts.SyntaxKind.AsyncKeyword)],
60
61
  undefined,
61
62
  [],
62
63
  undefined,
63
64
  undefined,
64
- ts.factory.createBlock(
65
+ TypeScriptFactory.createBlock(
65
66
  [
66
67
  writeConnection(ctx, importer),
67
68
  ...NestiaMigrateE2eFunctionProgrammer.writeBody({
@@ -80,31 +81,31 @@ export namespace NestiaMigrateApiStartProgrammer {
80
81
  ctx: INestiaMigrateContext,
81
82
  importer: NestiaMigrateImportProgrammer,
82
83
  ): ts.VariableStatement =>
83
- ts.factory.createVariableStatement(
84
+ TypeScriptFactory.createVariableStatement(
84
85
  undefined,
85
- ts.factory.createVariableDeclarationList(
86
+ TypeScriptFactory.createVariableDeclarationList(
86
87
  [
87
- ts.factory.createVariableDeclaration(
88
+ TypeScriptFactory.createVariableDeclaration(
88
89
  "connection",
89
90
  undefined,
90
- ts.factory.createTypeReferenceNode(
91
- ts.factory.createQualifiedName(
92
- ts.factory.createIdentifier(
91
+ TypeScriptFactory.createTypeReferenceNode(
92
+ TypeScriptFactory.createQualifiedName(
93
+ TypeScriptFactory.createIdentifier(
93
94
  importer.external({
94
95
  type: "default",
95
96
  library: "@ORGANIZATION/PROJECT-api",
96
97
  name: "api",
97
98
  }),
98
99
  ),
99
- ts.factory.createIdentifier("IConnection"),
100
+ TypeScriptFactory.createIdentifier("IConnection"),
100
101
  ),
101
102
  ),
102
- ts.factory.createObjectLiteralExpression(
103
+ TypeScriptFactory.createObjectLiteralExpression(
103
104
  [
104
- ts.factory.createSpreadAssignment(
105
- ts.factory.createCallExpression(
106
- ts.factory.createPropertyAccessExpression(
107
- ts.factory.createIdentifier("TestGlobal"),
105
+ TypeScriptFactory.createSpreadAssignment(
106
+ TypeScriptFactory.createCallExpression(
107
+ TypeScriptFactory.createPropertyAccessExpression(
108
+ TypeScriptFactory.createIdentifier("TestGlobal"),
108
109
  "connection",
109
110
  ),
110
111
  undefined,
@@ -113,9 +114,9 @@ export namespace NestiaMigrateApiStartProgrammer {
113
114
  ),
114
115
  ...(ctx.application.document().servers?.[0]?.url?.length
115
116
  ? [
116
- ts.factory.createPropertyAssignment(
117
+ TypeScriptFactory.createPropertyAssignment(
117
118
  "host",
118
- ts.factory.createStringLiteral(
119
+ TypeScriptFactory.createStringLiteral(
119
120
  ctx.application.document().servers![0]!.url,
120
121
  ),
121
122
  ),
@@ -123,9 +124,9 @@ export namespace NestiaMigrateApiStartProgrammer {
123
124
  : []),
124
125
  ...(ctx.config.simulate === true
125
126
  ? [
126
- ts.factory.createPropertyAssignment(
127
+ TypeScriptFactory.createPropertyAssignment(
127
128
  "simulate",
128
- ts.factory.createTrue(),
129
+ TypeScriptFactory.createTrue(),
129
130
  ),
130
131
  ]
131
132
  : []),
@@ -139,10 +140,10 @@ export namespace NestiaMigrateApiStartProgrammer {
139
140
  );
140
141
 
141
142
  const writeStarter = (): ts.CallExpression =>
142
- ts.factory.createCallExpression(
143
- ts.factory.createPropertyAccessExpression(
144
- ts.factory.createCallExpression(
145
- ts.factory.createIdentifier("main"),
143
+ TypeScriptFactory.createCallExpression(
144
+ TypeScriptFactory.createPropertyAccessExpression(
145
+ TypeScriptFactory.createCallExpression(
146
+ TypeScriptFactory.createIdentifier("main"),
146
147
  undefined,
147
148
  undefined,
148
149
  ),
@@ -150,34 +151,34 @@ export namespace NestiaMigrateApiStartProgrammer {
150
151
  ),
151
152
  undefined,
152
153
  [
153
- ts.factory.createArrowFunction(
154
+ TypeScriptFactory.createArrowFunction(
154
155
  undefined,
155
156
  undefined,
156
157
  [IdentifierFactory.parameter("exp")],
157
158
  undefined,
158
159
  undefined,
159
- ts.factory.createBlock(
160
+ TypeScriptFactory.createBlock(
160
161
  [
161
- ts.factory.createExpressionStatement(
162
- ts.factory.createCallExpression(
163
- ts.factory.createPropertyAccessExpression(
164
- ts.factory.createIdentifier("console"),
162
+ TypeScriptFactory.createExpressionStatement(
163
+ TypeScriptFactory.createCallExpression(
164
+ TypeScriptFactory.createPropertyAccessExpression(
165
+ TypeScriptFactory.createIdentifier("console"),
165
166
  "log",
166
167
  ),
167
168
  undefined,
168
- [ts.factory.createIdentifier("exp")],
169
+ [TypeScriptFactory.createIdentifier("exp")],
169
170
  ),
170
171
  ),
171
- ts.factory.createExpressionStatement(
172
- ts.factory.createCallExpression(
173
- ts.factory.createPropertyAccessExpression(
174
- ts.factory.createIdentifier("process"),
172
+ TypeScriptFactory.createExpressionStatement(
173
+ TypeScriptFactory.createCallExpression(
174
+ TypeScriptFactory.createPropertyAccessExpression(
175
+ TypeScriptFactory.createIdentifier("process"),
175
176
  "exit",
176
177
  ),
177
178
  undefined,
178
179
  [
179
- ts.factory.createPrefixMinus(
180
- ts.factory.createNumericLiteral("1"),
180
+ TypeScriptFactory.createPrefixMinus(
181
+ TypeScriptFactory.createNumericLiteral("1"),
181
182
  ),
182
183
  ],
183
184
  ),
@@ -1,6 +1,7 @@
1
+ import { TypeScriptFactory } from "@nestia/factory";
1
2
  import { OpenApi } from "@typia/interface";
2
3
  import { IPointer } from "tstl";
3
- import ts from "typescript";
4
+ import ts from "../internal/ts";
4
5
 
5
6
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
6
7
  import { FilePrinter } from "../utils/FilePrinter";
@@ -65,8 +66,8 @@ export namespace NestiaMigrateDtoProgrammer {
65
66
  (importer: NestiaMigrateImportProgrammer) =>
66
67
  (key: string, value: OpenApi.IJsonSchema) =>
67
68
  FilePrinter.description(
68
- ts.factory.createTypeAliasDeclaration(
69
- [ts.factory.createToken(ts.SyntaxKind.ExportKeyword)],
69
+ TypeScriptFactory.createTypeAliasDeclaration(
70
+ [TypeScriptFactory.createToken(ts.SyntaxKind.ExportKeyword)],
70
71
  key.split(".").at(-1)!,
71
72
  [],
72
73
  NestiaMigrateSchemaProgrammer.write({
@@ -1,6 +1,7 @@
1
- import { IdentifierFactory, LiteralFactory } from "@typia/core";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import { IdentifierFactory, LiteralFactory } from "@nestia/factory";
2
3
  import { IHttpMigrateRoute } from "@typia/interface";
3
- import ts from "typescript";
4
+ import ts from "../internal/ts";
4
5
  import { OpenApi } from "typia";
5
6
 
6
7
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
@@ -16,10 +17,10 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
16
17
  }
17
18
 
18
19
  export const write = (ctx: IContext): ts.FunctionDeclaration =>
19
- ts.factory.createFunctionDeclaration(
20
+ TypeScriptFactory.createFunctionDeclaration(
20
21
  [
21
- ts.factory.createModifier(ts.SyntaxKind.ExportKeyword),
22
- ts.factory.createModifier(ts.SyntaxKind.AsyncKeyword),
22
+ TypeScriptFactory.createModifier(ts.SyntaxKind.ExportKeyword),
23
+ TypeScriptFactory.createModifier(ts.SyntaxKind.AsyncKeyword),
23
24
  ],
24
25
  undefined,
25
26
  ["test", "api", ...ctx.route.accessor].join("_"),
@@ -27,30 +28,30 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
27
28
  [
28
29
  IdentifierFactory.parameter(
29
30
  "connection",
30
- ts.factory.createTypeReferenceNode(
31
- ts.factory.createQualifiedName(
32
- ts.factory.createIdentifier(
31
+ TypeScriptFactory.createTypeReferenceNode(
32
+ TypeScriptFactory.createQualifiedName(
33
+ TypeScriptFactory.createIdentifier(
33
34
  ctx.importer.external({
34
35
  type: "default",
35
36
  library: "@ORGANIZATION/PROJECT-api",
36
37
  name: "api",
37
38
  }),
38
39
  ),
39
- ts.factory.createIdentifier("IConnection"),
40
+ TypeScriptFactory.createIdentifier("IConnection"),
40
41
  ),
41
42
  ),
42
43
  ),
43
44
  ],
44
45
  undefined,
45
- ts.factory.createBlock(writeBody(ctx), true),
46
+ TypeScriptFactory.createBlock(writeBody(ctx), true),
46
47
  );
47
48
 
48
49
  export const writeBody = (ctx: IContext): ts.Statement[] => [
49
- ts.factory.createVariableStatement(
50
+ TypeScriptFactory.createVariableStatement(
50
51
  [],
51
- ts.factory.createVariableDeclarationList(
52
+ TypeScriptFactory.createVariableDeclarationList(
52
53
  [
53
- ts.factory.createVariableDeclaration(
54
+ TypeScriptFactory.createVariableDeclaration(
54
55
  "output",
55
56
  undefined,
56
57
  ctx.route.success
@@ -60,16 +61,16 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
60
61
  schema: ctx.route.success.schema,
61
62
  })
62
63
  : undefined,
63
- ts.factory.createAwaitExpression(writeCallExpressionn(ctx)),
64
+ TypeScriptFactory.createAwaitExpression(writeCallExpressionn(ctx)),
64
65
  ),
65
66
  ],
66
67
  ts.NodeFlags.Const,
67
68
  ),
68
69
  ),
69
- ts.factory.createExpressionStatement(
70
- ts.factory.createCallExpression(
71
- ts.factory.createPropertyAccessExpression(
72
- ts.factory.createIdentifier(
70
+ TypeScriptFactory.createExpressionStatement(
71
+ TypeScriptFactory.createCallExpression(
72
+ TypeScriptFactory.createPropertyAccessExpression(
73
+ TypeScriptFactory.createIdentifier(
73
74
  ctx.importer.external({
74
75
  type: "default",
75
76
  library: "typia",
@@ -79,26 +80,28 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
79
80
  "assert",
80
81
  ),
81
82
  undefined,
82
- [ts.factory.createIdentifier("output")],
83
+ [TypeScriptFactory.createIdentifier("output")],
83
84
  ),
84
85
  ),
85
86
  ];
86
87
 
87
88
  const writeCallExpressionn = (ctx: IContext): ts.CallExpression => {
88
- const fetch = ts.factory.createPropertyAccessExpression(
89
- ts.factory.createIdentifier("api.functional"),
90
- ts.factory.createIdentifier(ctx.route.accessor.join(".")),
89
+ const fetch = TypeScriptFactory.createPropertyAccessExpression(
90
+ TypeScriptFactory.createIdentifier("api.functional"),
91
+ TypeScriptFactory.createIdentifier(ctx.route.accessor.join(".")),
91
92
  );
92
- const connection = ts.factory.createIdentifier("connection");
93
+ const connection = TypeScriptFactory.createIdentifier("connection");
93
94
  if (
94
95
  ctx.route.parameters.length === 0 &&
95
96
  ctx.route.query === null &&
96
97
  ctx.route.body === null
97
98
  )
98
- return ts.factory.createCallExpression(fetch, undefined, [connection]);
99
+ return TypeScriptFactory.createCallExpression(fetch, undefined, [
100
+ connection,
101
+ ]);
99
102
 
100
- const random = ts.factory.createPropertyAccessExpression(
101
- ts.factory.createIdentifier(
103
+ const random = TypeScriptFactory.createPropertyAccessExpression(
104
+ TypeScriptFactory.createIdentifier(
102
105
  ctx.importer.external({
103
106
  type: "default",
104
107
  library: "typia",
@@ -108,7 +111,7 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
108
111
  "random",
109
112
  );
110
113
  if (ctx.config.keyword === true)
111
- return ts.factory.createCallExpression(fetch, undefined, [
114
+ return TypeScriptFactory.createCallExpression(fetch, undefined, [
112
115
  connection,
113
116
  LiteralFactory.write(
114
117
  Object.fromEntries(
@@ -116,7 +119,7 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
116
119
  .filter((x) => x !== null)
117
120
  .map(({ key, schema: value }) => [
118
121
  key,
119
- ts.factory.createCallExpression(
122
+ TypeScriptFactory.createCallExpression(
120
123
  random,
121
124
  [
122
125
  NestiaMigrateSchemaProgrammer.write({
@@ -131,12 +134,12 @@ export namespace NestiaMigrateE2eFunctionProgrammer {
131
134
  ),
132
135
  ),
133
136
  ]);
134
- return ts.factory.createCallExpression(fetch, undefined, [
137
+ return TypeScriptFactory.createCallExpression(fetch, undefined, [
135
138
  connection,
136
139
  ...[...ctx.route.parameters, ctx.route.query, ctx.route.body]
137
140
  .filter((p) => !!p)
138
141
  .map((p) =>
139
- ts.factory.createCallExpression(
142
+ TypeScriptFactory.createCallExpression(
140
143
  random,
141
144
  [
142
145
  NestiaMigrateSchemaProgrammer.write({
@@ -1,5 +1,5 @@
1
1
  import { IHttpMigrateRoute, OpenApi } from "@typia/interface";
2
- import ts from "typescript";
2
+ import ts from "../internal/ts";
3
3
 
4
4
  import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
5
5
  import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";