@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,12 +1,16 @@
1
- import { FormatCheatSheet, TypeFactory } from "@typia/core";
2
- import { NamingConvention, OpenApiTypeChecker } from "@typia/utils";
3
- import ts from "typescript";
4
- import typia, { OpenApi } from "typia";
1
+ import { TypeScriptFactory } from "@nestia/factory";
2
+ import { FormatCheatSheet, TypeFactory } from "@nestia/factory";
3
+ import * as typiaUtils from "@typia/utils";
4
+ import ts from "../internal/ts";
5
+ import type { OpenApi } from "typia";
5
6
 
6
7
  import { FilePrinter } from "../utils/FilePrinter";
7
8
  import { StringUtil } from "../utils/StringUtil";
8
9
  import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
9
10
 
11
+ const { NamingConvention, OpenApiTypeChecker } =
12
+ (typiaUtils as { default?: typeof typiaUtils }).default ?? typiaUtils;
13
+
10
14
  export namespace NestiaMigrateSchemaProgrammer {
11
15
  /* -----------------------------------------------------------
12
16
  FACADE
@@ -86,7 +90,7 @@ export namespace NestiaMigrateSchemaProgrammer {
86
90
  // DETERMINE
87
91
  if (union.length === 0) return TypeFactory.keyword("any");
88
92
  else if (union.length === 1) return union[0]!;
89
- return ts.factory.createUnionTypeNode(union);
93
+ return TypeScriptFactory.createUnionTypeNode(union);
90
94
  };
91
95
 
92
96
  /* -----------------------------------------------------------
@@ -96,19 +100,19 @@ export namespace NestiaMigrateSchemaProgrammer {
96
100
  importer: NestiaMigrateImportProgrammer;
97
101
  schema: OpenApi.IJsonSchema.IConstant;
98
102
  }): ts.TypeNode => {
99
- return ts.factory.createLiteralTypeNode(
103
+ return TypeScriptFactory.createLiteralTypeNode(
100
104
  typeof props.schema.const === "boolean"
101
105
  ? props.schema.const === true
102
- ? ts.factory.createTrue()
103
- : ts.factory.createFalse()
106
+ ? TypeScriptFactory.createTrue()
107
+ : TypeScriptFactory.createFalse()
104
108
  : typeof props.schema.const === "number"
105
109
  ? props.schema.const < 0
106
- ? ts.factory.createPrefixUnaryExpression(
110
+ ? TypeScriptFactory.createPrefixUnaryExpression(
107
111
  ts.SyntaxKind.MinusToken,
108
- ts.factory.createNumericLiteral(-props.schema.const),
112
+ TypeScriptFactory.createNumericLiteral(-props.schema.const),
109
113
  )
110
- : ts.factory.createNumericLiteral(props.schema.const)
111
- : ts.factory.createStringLiteral(props.schema.const),
114
+ : TypeScriptFactory.createNumericLiteral(props.schema.const)
115
+ : TypeScriptFactory.createStringLiteral(props.schema.const),
112
116
  );
113
117
  };
114
118
 
@@ -165,7 +169,7 @@ export namespace NestiaMigrateSchemaProgrammer {
165
169
  );
166
170
  return intersection.length === 1
167
171
  ? intersection[0]!
168
- : ts.factory.createIntersectionTypeNode(intersection);
172
+ : TypeScriptFactory.createIntersectionTypeNode(intersection);
169
173
  };
170
174
 
171
175
  const writeString = (props: {
@@ -173,7 +177,7 @@ export namespace NestiaMigrateSchemaProgrammer {
173
177
  schema: OpenApi.IJsonSchema.IString;
174
178
  }): ts.TypeNode => {
175
179
  if (props.schema.format === "binary")
176
- return ts.factory.createTypeReferenceNode("File");
180
+ return TypeScriptFactory.createTypeReferenceNode("File");
177
181
 
178
182
  const intersection: ts.TypeNode[] = [TypeFactory.keyword("string")];
179
183
  if (props.schema.default !== undefined)
@@ -200,7 +204,7 @@ export namespace NestiaMigrateSchemaProgrammer {
200
204
  );
201
205
  return intersection.length === 1
202
206
  ? intersection[0]!
203
- : ts.factory.createIntersectionTypeNode(intersection);
207
+ : TypeScriptFactory.createIntersectionTypeNode(intersection);
204
208
  };
205
209
 
206
210
  /* -----------------------------------------------------------
@@ -212,7 +216,7 @@ export namespace NestiaMigrateSchemaProgrammer {
212
216
  schema: OpenApi.IJsonSchema.IArray;
213
217
  }): ts.TypeNode => {
214
218
  const intersection: ts.TypeNode[] = [
215
- ts.factory.createArrayTypeNode(
219
+ TypeScriptFactory.createArrayTypeNode(
216
220
  write({
217
221
  components: props.components,
218
222
  importer: props.importer,
@@ -228,7 +232,7 @@ export namespace NestiaMigrateSchemaProgrammer {
228
232
  intersection.push(props.importer.tag("UniqueItems"));
229
233
  return intersection.length === 1
230
234
  ? intersection[0]!
231
- : ts.factory.createIntersectionTypeNode(intersection);
235
+ : TypeScriptFactory.createIntersectionTypeNode(intersection);
232
236
  };
233
237
 
234
238
  const writeTuple = (props: {
@@ -236,7 +240,7 @@ export namespace NestiaMigrateSchemaProgrammer {
236
240
  importer: NestiaMigrateImportProgrammer;
237
241
  schema: OpenApi.IJsonSchema.ITuple;
238
242
  }): ts.TypeNode =>
239
- ts.factory.createTupleTypeNode([
243
+ TypeScriptFactory.createTupleTypeNode([
240
244
  ...props.schema.prefixItems.map((item) =>
241
245
  write({
242
246
  components: props.components,
@@ -247,7 +251,7 @@ export namespace NestiaMigrateSchemaProgrammer {
247
251
  ...(typeof props.schema.additionalItems === "object" &&
248
252
  props.schema.additionalItems !== null
249
253
  ? [
250
- ts.factory.createRestTypeNode(
254
+ TypeScriptFactory.createRestTypeNode(
251
255
  write({
252
256
  components: props.components,
253
257
  importer: props.importer,
@@ -257,9 +261,11 @@ export namespace NestiaMigrateSchemaProgrammer {
257
261
  ]
258
262
  : props.schema.additionalItems === true
259
263
  ? [
260
- ts.factory.createRestTypeNode(
261
- ts.factory.createArrayTypeNode(
262
- ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
264
+ TypeScriptFactory.createRestTypeNode(
265
+ TypeScriptFactory.createArrayTypeNode(
266
+ TypeScriptFactory.createKeywordTypeNode(
267
+ ts.SyntaxKind.AnyKeyword,
268
+ ),
263
269
  ),
264
270
  ),
265
271
  ]
@@ -272,12 +278,12 @@ export namespace NestiaMigrateSchemaProgrammer {
272
278
  schema: OpenApi.IJsonSchema.IObject;
273
279
  }): ts.TypeNode => {
274
280
  const regular = () =>
275
- ts.factory.createTypeLiteralNode(
281
+ TypeScriptFactory.createTypeLiteralNode(
276
282
  Object.entries(props.schema.properties ?? [])
277
283
  .map(([key, value], index) => [
278
284
  ...(index !== 0 &&
279
285
  (!!value.title?.length || !!value.description?.length)
280
- ? [ts.factory.createIdentifier("\n") as any]
286
+ ? [TypeScriptFactory.createIdentifier("\n") as any]
281
287
  : []),
282
288
  writeRegularProperty({
283
289
  components: props.components,
@@ -290,7 +296,7 @@ export namespace NestiaMigrateSchemaProgrammer {
290
296
  .flat(),
291
297
  );
292
298
  const dynamic = () =>
293
- ts.factory.createTypeLiteralNode([
299
+ TypeScriptFactory.createTypeLiteralNode([
294
300
  writeDynamicProperty({
295
301
  components: props.components,
296
302
  importer: props.importer,
@@ -299,7 +305,7 @@ export namespace NestiaMigrateSchemaProgrammer {
299
305
  ]);
300
306
  return !!props.schema.properties?.length &&
301
307
  typeof props.schema.additionalProperties === "object"
302
- ? ts.factory.createIntersectionTypeNode([regular(), dynamic()])
308
+ ? TypeScriptFactory.createIntersectionTypeNode([regular(), dynamic()])
303
309
  : typeof props.schema.additionalProperties === "object"
304
310
  ? dynamic()
305
311
  : regular();
@@ -318,26 +324,26 @@ export namespace NestiaMigrateSchemaProgrammer {
318
324
  schema: props.value,
319
325
  });
320
326
  return FilePrinter.description(
321
- ts.factory.createPropertySignature(
327
+ TypeScriptFactory.createPropertySignature(
322
328
  props.value.readOnly
323
- ? [ts.factory.createToken(ts.SyntaxKind.ReadonlyKeyword)]
329
+ ? [TypeScriptFactory.createToken(ts.SyntaxKind.ReadonlyKeyword)]
324
330
  : undefined,
325
331
  NamingConvention.variable(props.key)
326
- ? ts.factory.createIdentifier(props.key)
327
- : ts.factory.createStringLiteral(props.key),
332
+ ? TypeScriptFactory.createIdentifier(props.key)
333
+ : TypeScriptFactory.createStringLiteral(props.key),
328
334
  props.required.includes(props.key)
329
335
  ? undefined
330
- : ts.factory.createToken(ts.SyntaxKind.QuestionToken),
336
+ : TypeScriptFactory.createToken(ts.SyntaxKind.QuestionToken),
331
337
  props.required.includes(props.key)
332
338
  ? valueTypeNode
333
339
  : ts.isUnionTypeNode(valueTypeNode)
334
- ? ts.factory.createUnionTypeNode([
335
- ...valueTypeNode.types,
336
- ts.factory.createTypeReferenceNode("undefined"),
340
+ ? TypeScriptFactory.createUnionTypeNode([
341
+ ...(valueTypeNode.types ?? []),
342
+ TypeScriptFactory.createTypeReferenceNode("undefined"),
337
343
  ])
338
- : ts.factory.createUnionTypeNode([
344
+ : TypeScriptFactory.createUnionTypeNode([
339
345
  valueTypeNode,
340
- ts.factory.createTypeReferenceNode("undefined"),
346
+ TypeScriptFactory.createTypeReferenceNode("undefined"),
341
347
  ]),
342
348
  ),
343
349
  writeComment(props.value),
@@ -350,13 +356,13 @@ export namespace NestiaMigrateSchemaProgrammer {
350
356
  schema: OpenApi.IJsonSchema;
351
357
  }) =>
352
358
  FilePrinter.description(
353
- ts.factory.createIndexSignature(
359
+ TypeScriptFactory.createIndexSignature(
354
360
  undefined,
355
361
  [
356
- ts.factory.createParameterDeclaration(
362
+ TypeScriptFactory.createParameterDeclaration(
357
363
  undefined,
358
364
  undefined,
359
- ts.factory.createIdentifier("key"),
365
+ TypeScriptFactory.createIdentifier("key"),
360
366
  undefined,
361
367
  TypeFactory.keyword("string"),
362
368
  ),
@@ -390,7 +396,7 @@ export namespace NestiaMigrateSchemaProgrammer {
390
396
  importer: NestiaMigrateImportProgrammer;
391
397
  elements: OpenApi.IJsonSchema[];
392
398
  }): ts.UnionTypeNode =>
393
- ts.factory.createUnionTypeNode(
399
+ TypeScriptFactory.createUnionTypeNode(
394
400
  props.elements.map((schema) =>
395
401
  write({
396
402
  components: props.components,
@@ -400,7 +406,8 @@ export namespace NestiaMigrateSchemaProgrammer {
400
406
  ),
401
407
  );
402
408
  }
403
- const createNode = (text: string) => ts.factory.createTypeReferenceNode(text);
409
+ const createNode = (text: string) =>
410
+ TypeScriptFactory.createTypeReferenceNode(text);
404
411
 
405
412
  const writeComment = (schema: OpenApi.IJsonSchema): string => {
406
413
  interface IPlugin {
@@ -419,7 +426,7 @@ const writeComment = (schema: OpenApi.IJsonSchema): string => {
419
426
  value: undefined,
420
427
  });
421
428
  for (const [key, value] of Object.entries(schema))
422
- if (key.startsWith("x-") && typia.is<boolean | number | string>(value))
429
+ if (key.startsWith("x-") && isExtensionValue(value))
423
430
  plugins.push({
424
431
  key,
425
432
  value,
@@ -435,6 +442,11 @@ const writeComment = (schema: OpenApi.IJsonSchema): string => {
435
442
  ].join("\n");
436
443
  };
437
444
 
445
+ const isExtensionValue = (value: unknown): value is boolean | number | string =>
446
+ typeof value === "boolean" ||
447
+ typeof value === "number" ||
448
+ typeof value === "string";
449
+
438
450
  const eraseCommentTags = (description: string): string => {
439
451
  const lines: string[] = description.split("\n");
440
452
  return lines
@@ -1,4 +1,4 @@
1
- import ts from "typescript";
1
+ import ts from "../internal/ts";
2
2
 
3
3
  import { NestiaMigrateNestMethodProgrammer } from "../programmers/NestiaMigrateNestMethodProgrammer";
4
4
 
@@ -1,4 +1,5 @@
1
- import ts from "typescript";
1
+ import { TypeScriptFactory, TypeScriptPrinter } from "@nestia/factory";
2
+ import ts from "../internal/ts";
2
3
 
3
4
  export namespace FilePrinter {
4
5
  export const description = <Node extends ts.Node>(
@@ -27,23 +28,17 @@ export namespace FilePrinter {
27
28
  };
28
29
 
29
30
  export const newLine = () =>
30
- ts.factory.createExpressionStatement(ts.factory.createIdentifier("\n"));
31
+ TypeScriptFactory.createExpressionStatement(
32
+ TypeScriptFactory.createIdentifier("\n"),
33
+ );
31
34
 
32
35
  export const write = (props: {
33
36
  statements: ts.Statement[];
34
37
  top?: string;
35
38
  }): string => {
36
- const script: string = ts
37
- .createPrinter({
38
- newLine: ts.NewLineKind.LineFeed,
39
- })
40
- .printFile(
41
- ts.factory.createSourceFile(
42
- props.statements,
43
- ts.factory.createToken(ts.SyntaxKind.EndOfFileToken),
44
- ts.NodeFlags.None,
45
- ),
46
- );
47
- return (props.top ?? "") + script;
39
+ return TypeScriptPrinter.write({
40
+ statements: props.statements,
41
+ top: props.top,
42
+ });
48
43
  };
49
44
  }
@@ -8,11 +8,6 @@ export namespace StringUtil {
8
8
  .map((str) => normalize(str.trim()))
9
9
  .filter((str) => !!str.length);
10
10
 
11
- export const escapeDuplicate =
12
- (keep: string[]) =>
13
- (change: string): string =>
14
- keep.includes(change) ? escapeDuplicate(keep)(`_${change}`) : change;
15
-
16
11
  export const escapeNonVariable = (str: string): string => {
17
12
  str = escape(str);
18
13
  for (const [before, after] of VARIABLE_REPLACERS)
@@ -1,7 +0,0 @@
1
- import { OpenApi } from "@typia/interface";
2
- export interface INestiaMigrateDto {
3
- name: string;
4
- location: string;
5
- schema: OpenApi.IJsonSchema | null;
6
- children: INestiaMigrateDto[];
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=INestiaMigrateDto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"INestiaMigrateDto.js","sourceRoot":"","sources":["../../src/structures/INestiaMigrateDto.ts"],"names":[],"mappings":""}
@@ -1,9 +0,0 @@
1
- import { IHttpMigrateApplication, OpenApi } from "@typia/interface";
2
- import { INestiaMigrateConfig } from "./INestiaMigrateConfig";
3
- export interface INestiaMigrateProgram {
4
- mode: "nest" | "sdk";
5
- document: OpenApi.IDocument;
6
- config: INestiaMigrateConfig;
7
- files: Record<string, string>;
8
- errors: IHttpMigrateApplication.IError[];
9
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=INestiaMigrateProgram.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"INestiaMigrateProgram.js","sourceRoot":"","sources":["../../src/structures/INestiaMigrateProgram.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
1
- export interface INestiaMigrateSchema {
2
- name: string;
3
- children: INestiaMigrateSchema[];
4
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=INestiaMigrateSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"INestiaMigrateSchema.js","sourceRoot":"","sources":["../../src/structures/INestiaMigrateSchema.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export declare namespace SetupWizard {
2
- const setup: (output: string) => void;
3
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SetupWizard = void 0;
7
- const child_process_1 = __importDefault(require("child_process"));
8
- var SetupWizard;
9
- (function (SetupWizard) {
10
- SetupWizard.setup = (output) => {
11
- execute(output)("npm install");
12
- };
13
- const execute = (cwd) => (command, fake) => {
14
- console.log(fake !== null && fake !== void 0 ? fake : command);
15
- child_process_1.default.execSync(command, { cwd, stdio: "inherit" });
16
- };
17
- })(SetupWizard || (exports.SetupWizard = SetupWizard = {}));
18
- //# sourceMappingURL=SetupWizard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SetupWizard.js","sourceRoot":"","sources":["../../src/utils/SetupWizard.ts"],"names":[],"mappings":";;;;;;AAAA,kEAA+B;AAE/B,IAAiB,WAAW,CAS3B;AATD,WAAiB,WAAW;IACb,iBAAK,GAAG,CAAC,MAAc,EAAE,EAAE;QACtC,OAAO,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;IACjC,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,OAAe,EAAE,IAAa,EAAE,EAAE;QAClE,OAAO,CAAC,GAAG,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,OAAO,CAAC,CAAC;QAC7B,uBAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC,EATgB,WAAW,2BAAX,WAAW,QAS3B"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Recursively walk a JSON object and invoke a callback function on each `{
3
- * "$ref" : "path" }` object found
4
- */
5
- /**
6
- * Represents a JSON Reference object, such as `{"$ref":
7
- * "#/components/schemas/problemResponse" }`
8
- */
9
- export interface RefObject {
10
- $ref: string;
11
- }
12
- /** JsonNode represents a node within the OpenAPI object */
13
- export type JsonNode = object | [] | string | boolean | null | number;
14
- /** A JSON Schema object in an API def */
15
- export type SchemaObject = object;
16
- /** Function signature for the visitRefObjects callback */
17
- export type RefVisitor = (node: RefObject) => JsonNode;
18
- /** Function signature for the visitSchemaObjects callback */
19
- export type SchemaVisitor = (node: SchemaObject) => SchemaObject;
20
- /** /** Function signature for the walkObject callback */
21
- export type ObjectVisitor = (node: object) => JsonNode;
22
- /** Test if a JSON node is a `{ $ref: "uri" }` object */
23
- export declare function isRef(node: any): boolean;
24
- /**
25
- * Walk a JSON object and apply `schemaCallback` when a JSON schema is found.
26
- * JSON Schema objects are items in components/schemas or in an item named
27
- * `schema`
28
- *
29
- * @param node A node in the OpenAPI document
30
- * @param schemaCallback The function to call on JSON schema objects
31
- * @returns The modified (annotated) node
32
- */
33
- export declare function visitSchemaObjects(node: any, schemaCallback: SchemaVisitor): any;
34
- /**
35
- * Walk a JSON object and apply `refCallback` when a JSON `{$ref: url }` is
36
- * found
37
- *
38
- * @param node A node in the OpenAPI document
39
- * @param refCallback The function to call on JSON `$ref` objects
40
- * @returns The modified (annotated) node
41
- */
42
- export declare function visitRefObjects(node: any, refCallback: RefVisitor): any;
43
- /**
44
- * Walk a JSON object or array and apply objectCallback when a JSON object is
45
- * found
46
- *
47
- * @param node A node in the OpenAPI document
48
- * @param objectCallback The function to call on JSON objects
49
- * @param nav Tracks where we are in the original document
50
- * @returns The modified (annotated) node
51
- */
52
- export declare function walkObject(node: object, objectCallback: ObjectVisitor): JsonNode;
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isRef = isRef;
4
- exports.visitSchemaObjects = visitSchemaObjects;
5
- exports.visitRefObjects = visitRefObjects;
6
- exports.walkObject = walkObject;
7
- /** Test if a JSON node is a `{ $ref: "uri" }` object */
8
- function isRef(node) {
9
- return (node !== null &&
10
- typeof node === "object" &&
11
- node.hasOwnProperty("$ref") &&
12
- typeof node["$ref"] === "string");
13
- }
14
- /**
15
- * Walk a JSON object and apply `schemaCallback` when a JSON schema is found.
16
- * JSON Schema objects are items in components/schemas or in an item named
17
- * `schema`
18
- *
19
- * @param node A node in the OpenAPI document
20
- * @param schemaCallback The function to call on JSON schema objects
21
- * @returns The modified (annotated) node
22
- */
23
- function visitSchemaObjects(node, schemaCallback) {
24
- const objectVisitor = (node) => {
25
- if (node.hasOwnProperty("schema")) {
26
- const schema = node["schema"];
27
- if (schema != null && typeof schema === "object") {
28
- node["schema"] = schemaCallback(schema);
29
- }
30
- }
31
- else if (node.hasOwnProperty("schemas")) {
32
- const schemas = node["schemas"];
33
- if (schemas != null && typeof schemas === "object") {
34
- for (const schemaName in schemas) {
35
- const schema = schemas[schemaName];
36
- const newSchema = schemaCallback(schema);
37
- schemas[schemaName] = newSchema;
38
- }
39
- }
40
- }
41
- return node;
42
- };
43
- return walkObject(node, objectVisitor);
44
- }
45
- /**
46
- * Walk a JSON object and apply `refCallback` when a JSON `{$ref: url }` is
47
- * found
48
- *
49
- * @param node A node in the OpenAPI document
50
- * @param refCallback The function to call on JSON `$ref` objects
51
- * @returns The modified (annotated) node
52
- */
53
- function visitRefObjects(node, refCallback) {
54
- const objectVisitor = (node) => {
55
- if (isRef(node)) {
56
- return refCallback(node);
57
- }
58
- return node;
59
- };
60
- return walkObject(node, objectVisitor);
61
- }
62
- /**
63
- * Walk a JSON object or array and apply objectCallback when a JSON object is
64
- * found
65
- *
66
- * @param node A node in the OpenAPI document
67
- * @param objectCallback The function to call on JSON objects
68
- * @param nav Tracks where we are in the original document
69
- * @returns The modified (annotated) node
70
- */
71
- function walkObject(node, objectCallback) {
72
- return walkObj(node);
73
- function walkObj(node) {
74
- const object = objectCallback(node);
75
- if (object !== null && typeof object === "object") {
76
- const keys = [...Object.keys(node)]; // make copy since this code may re-enter objects
77
- for (const key of keys) {
78
- const val = node[key];
79
- if (Array.isArray(val)) {
80
- node[key] = walkArray(val);
81
- }
82
- else if (val !== null && typeof val === "object") {
83
- node[key] = walkObj(val);
84
- }
85
- }
86
- }
87
- return object;
88
- }
89
- function walkArray(array) {
90
- for (let index = 0; index < array.length; index += 1) {
91
- const val = array[index];
92
- if (val !== null && typeof val === "object") {
93
- array[index] = walkObj(val);
94
- }
95
- else if (Array.isArray(val)) {
96
- array[index] = walkArray(val);
97
- }
98
- }
99
- return array;
100
- }
101
- }
102
- //# sourceMappingURL=RefVisitor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RefVisitor.js","sourceRoot":"","sources":["../../../src/utils/openapi-down-convert/RefVisitor.ts"],"names":[],"mappings":";;AA8BA,sBAOC;AAWD,gDAuBC;AAUD,0CAQC;AAWD,gCAiCC;AAxGD,wDAAwD;AACxD,SAAgB,KAAK,CAAC,IAAS;IAC7B,OAAO,CACL,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,QAAQ,CACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAChC,IAAS,EACT,cAA6B;IAE7B,MAAM,aAAa,GAAG,CAAC,IAAS,EAAY,EAAE;QAC5C,IAAI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9B,IAAI,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;aAAM,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC;YAC1C,MAAM,OAAO,GAAG,IAAI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