@nestia/migrate 10.0.2 → 11.0.0-dev.20260305

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +93 -93
  3. package/package.json +32 -46
  4. package/src/NestiaMigrateApplication.ts +161 -159
  5. package/src/analyzers/NestiaMigrateControllerAnalyzer.ts +51 -51
  6. package/src/archivers/NestiaMigrateFileArchiver.ts +28 -28
  7. package/src/bundles/NEST_TEMPLATE.ts +48 -48
  8. package/src/bundles/SDK_TEMPLATE.ts +21 -21
  9. package/src/executable/NestiaMigrateCommander.ts +98 -98
  10. package/src/executable/NestiaMigrateInquirer.ts +106 -106
  11. package/src/executable/bundle.js +125 -125
  12. package/src/executable/migrate.ts +7 -7
  13. package/src/factories/TypeLiteralFactory.ts +57 -57
  14. package/src/index.ts +4 -4
  15. package/src/module.ts +6 -2
  16. package/src/programmers/NestiaMigrateApiFileProgrammer.ts +55 -55
  17. package/src/programmers/NestiaMigrateApiFunctionProgrammer.ts +347 -344
  18. package/src/programmers/NestiaMigrateApiNamespaceProgrammer.ts +517 -514
  19. package/src/programmers/NestiaMigrateApiProgrammer.ts +107 -107
  20. package/src/programmers/NestiaMigrateApiSimulationProgrammer.ts +308 -309
  21. package/src/programmers/NestiaMigrateApiStartProgrammer.ts +197 -198
  22. package/src/programmers/NestiaMigrateDtoProgrammer.ts +98 -98
  23. package/src/programmers/NestiaMigrateE2eFileProgrammer.ts +153 -153
  24. package/src/programmers/NestiaMigrateE2eProgrammer.ts +48 -48
  25. package/src/programmers/NestiaMigrateImportProgrammer.ts +118 -118
  26. package/src/programmers/NestiaMigrateNestControllerProgrammer.ts +69 -69
  27. package/src/programmers/NestiaMigrateNestMethodProgrammer.ts +409 -406
  28. package/src/programmers/NestiaMigrateNestModuleProgrammer.ts +65 -65
  29. package/src/programmers/NestiaMigrateNestProgrammer.ts +88 -88
  30. package/src/programmers/NestiaMigrateSchemaProgrammer.ts +465 -467
  31. package/src/structures/INestiaMigrateConfig.ts +19 -19
  32. package/src/structures/INestiaMigrateContext.ts +9 -9
  33. package/src/structures/INestiaMigrateController.ts +8 -8
  34. package/src/structures/INestiaMigrateDto.ts +8 -8
  35. package/src/structures/INestiaMigrateFile.ts +5 -5
  36. package/src/structures/INestiaMigrateProgram.ts +11 -11
  37. package/src/structures/INestiaMigrateSchema.ts +4 -4
  38. package/src/utils/FilePrinter.ts +49 -49
  39. package/src/utils/MapUtil.ts +13 -13
  40. package/src/utils/SetupWizard.ts +12 -12
  41. package/src/utils/StringUtil.ts +114 -113
  42. package/src/utils/openapi-down-convert/RefVisitor.ts +134 -134
  43. package/src/utils/openapi-down-convert/converter.ts +536 -536
  44. package/lib/NestiaMigrateApplication.d.ts +0 -24
  45. package/lib/NestiaMigrateApplication.js +0 -18757
  46. package/lib/NestiaMigrateApplication.js.map +0 -1
  47. package/lib/analyzers/NestiaMigrateControllerAnalyzer.d.ts +0 -5
  48. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js +0 -46
  49. package/lib/analyzers/NestiaMigrateControllerAnalyzer.js.map +0 -1
  50. package/lib/archivers/NestiaMigrateFileArchiver.d.ts +0 -8
  51. package/lib/archivers/NestiaMigrateFileArchiver.js +0 -36
  52. package/lib/archivers/NestiaMigrateFileArchiver.js.map +0 -1
  53. package/lib/bundles/NEST_TEMPLATE.d.ts +0 -1
  54. package/lib/bundles/NEST_TEMPLATE.js +0 -55
  55. package/lib/bundles/NEST_TEMPLATE.js.map +0 -1
  56. package/lib/bundles/SDK_TEMPLATE.d.ts +0 -1
  57. package/lib/bundles/SDK_TEMPLATE.js +0 -27
  58. package/lib/bundles/SDK_TEMPLATE.js.map +0 -1
  59. package/lib/executable/NestiaMigrateCommander.d.ts +0 -4
  60. package/lib/executable/NestiaMigrateCommander.js +0 -125
  61. package/lib/executable/NestiaMigrateCommander.js.map +0 -1
  62. package/lib/executable/NestiaMigrateInquirer.d.ts +0 -12
  63. package/lib/executable/NestiaMigrateInquirer.js +0 -94
  64. package/lib/executable/NestiaMigrateInquirer.js.map +0 -1
  65. package/lib/executable/migrate.d.ts +0 -2
  66. package/lib/executable/migrate.js +0 -9
  67. package/lib/executable/migrate.js.map +0 -1
  68. package/lib/factories/TypeLiteralFactory.d.ts +0 -4
  69. package/lib/factories/TypeLiteralFactory.js +0 -35
  70. package/lib/factories/TypeLiteralFactory.js.map +0 -1
  71. package/lib/index.d.ts +0 -3
  72. package/lib/index.js +0 -42
  73. package/lib/index.js.map +0 -1
  74. package/lib/index.mjs +0 -19359
  75. package/lib/index.mjs.map +0 -1
  76. package/lib/module.d.ts +0 -2
  77. package/lib/module.js +0 -19
  78. package/lib/module.js.map +0 -1
  79. package/lib/programmers/NestiaMigrateApiFileProgrammer.d.ts +0 -13
  80. package/lib/programmers/NestiaMigrateApiFileProgrammer.js +0 -40
  81. package/lib/programmers/NestiaMigrateApiFileProgrammer.js.map +0 -1
  82. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.d.ts +0 -14
  83. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js +0 -179
  84. package/lib/programmers/NestiaMigrateApiFunctionProgrammer.js.map +0 -1
  85. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.d.ts +0 -14
  86. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js +0 -226
  87. package/lib/programmers/NestiaMigrateApiNamespaceProgrammer.js.map +0 -1
  88. package/lib/programmers/NestiaMigrateApiProgrammer.d.ts +0 -4
  89. package/lib/programmers/NestiaMigrateApiProgrammer.js +0 -82
  90. package/lib/programmers/NestiaMigrateApiProgrammer.js.map +0 -1
  91. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.d.ts +0 -14
  92. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js +0 -142
  93. package/lib/programmers/NestiaMigrateApiSimulationProgrammer.js.map +0 -1
  94. package/lib/programmers/NestiaMigrateApiStartProgrammer.d.ts +0 -4
  95. package/lib/programmers/NestiaMigrateApiStartProgrammer.js +0 -80
  96. package/lib/programmers/NestiaMigrateApiStartProgrammer.js.map +0 -1
  97. package/lib/programmers/NestiaMigrateDtoProgrammer.d.ts +0 -15
  98. package/lib/programmers/NestiaMigrateDtoProgrammer.js +0 -65
  99. package/lib/programmers/NestiaMigrateDtoProgrammer.js.map +0 -1
  100. package/lib/programmers/NestiaMigrateE2eFileProgrammer.d.ts +0 -14
  101. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js +0 -81
  102. package/lib/programmers/NestiaMigrateE2eFileProgrammer.js.map +0 -1
  103. package/lib/programmers/NestiaMigrateE2eProgrammer.d.ts +0 -4
  104. package/lib/programmers/NestiaMigrateE2eProgrammer.js +0 -32
  105. package/lib/programmers/NestiaMigrateE2eProgrammer.js.map +0 -1
  106. package/lib/programmers/NestiaMigrateImportProgrammer.d.ts +0 -18
  107. package/lib/programmers/NestiaMigrateImportProgrammer.js +0 -65
  108. package/lib/programmers/NestiaMigrateImportProgrammer.js.map +0 -1
  109. package/lib/programmers/NestiaMigrateNestControllerProgrammer.d.ts +0 -12
  110. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js +0 -46
  111. package/lib/programmers/NestiaMigrateNestControllerProgrammer.js.map +0 -1
  112. package/lib/programmers/NestiaMigrateNestMethodProgrammer.d.ts +0 -15
  113. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js +0 -224
  114. package/lib/programmers/NestiaMigrateNestMethodProgrammer.js.map +0 -1
  115. package/lib/programmers/NestiaMigrateNestModuleProgrammer.d.ts +0 -5
  116. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js +0 -29
  117. package/lib/programmers/NestiaMigrateNestModuleProgrammer.js.map +0 -1
  118. package/lib/programmers/NestiaMigrateNestProgrammer.d.ts +0 -4
  119. package/lib/programmers/NestiaMigrateNestProgrammer.js +0 -65
  120. package/lib/programmers/NestiaMigrateNestProgrammer.js.map +0 -1
  121. package/lib/programmers/NestiaMigrateSchemaProgrammer.d.ts +0 -10
  122. package/lib/programmers/NestiaMigrateSchemaProgrammer.js +0 -341
  123. package/lib/programmers/NestiaMigrateSchemaProgrammer.js.map +0 -1
  124. package/lib/structures/INestiaMigrateConfig.d.ts +0 -15
  125. package/lib/structures/INestiaMigrateConfig.js +0 -3
  126. package/lib/structures/INestiaMigrateConfig.js.map +0 -1
  127. package/lib/structures/INestiaMigrateContext.d.ts +0 -7
  128. package/lib/structures/INestiaMigrateContext.js +0 -3
  129. package/lib/structures/INestiaMigrateContext.js.map +0 -1
  130. package/lib/structures/INestiaMigrateController.d.ts +0 -7
  131. package/lib/structures/INestiaMigrateController.js +0 -3
  132. package/lib/structures/INestiaMigrateController.js.map +0 -1
  133. package/lib/structures/INestiaMigrateDto.d.ts +0 -7
  134. package/lib/structures/INestiaMigrateDto.js +0 -3
  135. package/lib/structures/INestiaMigrateDto.js.map +0 -1
  136. package/lib/structures/INestiaMigrateFile.d.ts +0 -5
  137. package/lib/structures/INestiaMigrateFile.js +0 -3
  138. package/lib/structures/INestiaMigrateFile.js.map +0 -1
  139. package/lib/structures/INestiaMigrateProgram.d.ts +0 -9
  140. package/lib/structures/INestiaMigrateProgram.js +0 -3
  141. package/lib/structures/INestiaMigrateProgram.js.map +0 -1
  142. package/lib/structures/INestiaMigrateSchema.d.ts +0 -4
  143. package/lib/structures/INestiaMigrateSchema.js +0 -3
  144. package/lib/structures/INestiaMigrateSchema.js.map +0 -1
  145. package/lib/utils/FilePrinter.d.ts +0 -9
  146. package/lib/utils/FilePrinter.js +0 -35
  147. package/lib/utils/FilePrinter.js.map +0 -1
  148. package/lib/utils/MapUtil.d.ts +0 -3
  149. package/lib/utils/MapUtil.js +0 -15
  150. package/lib/utils/MapUtil.js.map +0 -1
  151. package/lib/utils/SetupWizard.d.ts +0 -3
  152. package/lib/utils/SetupWizard.js +0 -18
  153. package/lib/utils/SetupWizard.js.map +0 -1
  154. package/lib/utils/StringUtil.d.ts +0 -6
  155. package/lib/utils/StringUtil.js +0 -108
  156. package/lib/utils/StringUtil.js.map +0 -1
  157. package/lib/utils/openapi-down-convert/RefVisitor.d.ts +0 -52
  158. package/lib/utils/openapi-down-convert/RefVisitor.js +0 -102
  159. package/lib/utils/openapi-down-convert/RefVisitor.js.map +0 -1
  160. package/lib/utils/openapi-down-convert/converter.d.ts +0 -146
  161. package/lib/utils/openapi-down-convert/converter.js +0 -441
  162. package/lib/utils/openapi-down-convert/converter.js.map +0 -1
@@ -1,226 +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.NestiaMigrateApiNamespaceProgrammer = void 0;
7
- const typescript_1 = __importDefault(require("typescript"));
8
- const ExpressionFactory_1 = require("typia/lib/factories/ExpressionFactory");
9
- const IdentifierFactory_1 = require("typia/lib/factories/IdentifierFactory");
10
- const LiteralFactory_1 = require("typia/lib/factories/LiteralFactory");
11
- const TypeFactory_1 = require("typia/lib/factories/TypeFactory");
12
- const FilePrinter_1 = require("../utils/FilePrinter");
13
- const NestiaMigrateApiSimulationProgrammer_1 = require("./NestiaMigrateApiSimulationProgrammer");
14
- const NestiaMigrateSchemaProgrammer_1 = require("./NestiaMigrateSchemaProgrammer");
15
- var NestiaMigrateApiNamespaceProgrammer;
16
- (function (NestiaMigrateApiNamespaceProgrammer) {
17
- NestiaMigrateApiNamespaceProgrammer.write = (ctx) => {
18
- const types = writeTypes(ctx);
19
- return typescript_1.default.factory.createModuleDeclaration([typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createIdentifier(ctx.route.accessor.at(-1)), typescript_1.default.factory.createModuleBlock([
20
- ...types,
21
- ...(types.length ? [FilePrinter_1.FilePrinter.newLine()] : []),
22
- writeMetadata(ctx),
23
- FilePrinter_1.FilePrinter.newLine(),
24
- writePathFunction(ctx),
25
- ...(ctx.config.simulate === true
26
- ? [
27
- NestiaMigrateApiSimulationProgrammer_1.NestiaMigrateApiSimulationProgrammer.random(ctx),
28
- NestiaMigrateApiSimulationProgrammer_1.NestiaMigrateApiSimulationProgrammer.simulate(ctx),
29
- ]
30
- : []),
31
- ]), typescript_1.default.NodeFlags.Namespace);
32
- };
33
- NestiaMigrateApiNamespaceProgrammer.writePathCallExpression = (config, route) => typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(`${route.accessor.at(-1)}.path`), undefined, route.parameters.length === 0 && route.query === null
34
- ? []
35
- : config.keyword === true
36
- ? [typescript_1.default.factory.createIdentifier("props")]
37
- : [...route.parameters, ...(route.query ? [route.query] : [])].map((p) => typescript_1.default.factory.createIdentifier(p.key)));
38
- const writeTypes = (ctx) => {
39
- const array = [];
40
- const declare = (name, type) => array.push(typescript_1.default.factory.createTypeAliasDeclaration([typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], name, undefined, type));
41
- if (ctx.config.keyword === true &&
42
- (ctx.route.parameters.length > 0 || ctx.route.query || ctx.route.body))
43
- declare("Props", NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
44
- components: ctx.components,
45
- importer: ctx.importer,
46
- schema: {
47
- type: "object",
48
- properties: Object.fromEntries([
49
- ...ctx.route.parameters.map((p) => [
50
- p.key,
51
- Object.assign(Object.assign({}, p.schema), { description: p.parameter().description }),
52
- ]),
53
- ...(ctx.route.query
54
- ? [
55
- [
56
- ctx.route.query.key,
57
- Object.assign(Object.assign({}, ctx.route.query.schema), { title: ctx.route.query.title(), description: ctx.route.query.description() }),
58
- ],
59
- ]
60
- : []),
61
- ...(ctx.route.body
62
- ? [
63
- [
64
- ctx.route.body.key,
65
- Object.assign(Object.assign({}, ctx.route.body.schema), { description: ctx.route.body.description() }),
66
- ],
67
- ]
68
- : []),
69
- ]),
70
- required: [
71
- ...ctx.route.parameters.map((p) => p.key),
72
- ...(ctx.route.query ? [ctx.route.query.key] : []),
73
- ...(ctx.route.body ? [ctx.route.body.key] : []),
74
- ],
75
- },
76
- }));
77
- if (ctx.route.headers)
78
- declare("Headers", NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
79
- components: ctx.components,
80
- importer: ctx.importer,
81
- schema: ctx.route.headers.schema,
82
- }));
83
- if (ctx.route.query)
84
- declare("Query", NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
85
- components: ctx.components,
86
- importer: ctx.importer,
87
- schema: ctx.route.query.schema,
88
- }));
89
- if (ctx.route.body)
90
- declare("Body", NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
91
- components: ctx.components,
92
- importer: ctx.importer,
93
- schema: ctx.route.body.schema,
94
- }));
95
- if (ctx.route.success)
96
- declare("Response", NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
97
- components: ctx.components,
98
- importer: ctx.importer,
99
- schema: ctx.route.success.schema,
100
- }));
101
- return array;
102
- };
103
- const writeMetadata = (ctx) => {
104
- var _a, _b, _c, _d;
105
- return constant("METADATA", typescript_1.default.factory.createAsExpression(typescript_1.default.factory.createObjectLiteralExpression([
106
- typescript_1.default.factory.createPropertyAssignment("method", typescript_1.default.factory.createStringLiteral(ctx.route.method.toUpperCase())),
107
- typescript_1.default.factory.createPropertyAssignment("path", typescript_1.default.factory.createStringLiteral(getPath(ctx.route))),
108
- typescript_1.default.factory.createPropertyAssignment("request", ctx.route.body
109
- ? LiteralFactory_1.LiteralFactory.write({
110
- type: ctx.route.body.type,
111
- encrypted: !!ctx.route.body["x-nestia-encrypted"],
112
- })
113
- : typescript_1.default.factory.createNull()),
114
- typescript_1.default.factory.createPropertyAssignment("response", ctx.route.method.toUpperCase() !== "HEAD"
115
- ? LiteralFactory_1.LiteralFactory.write({
116
- type: (_b = (_a = ctx.route.success) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "application/json",
117
- encrypted: !!((_c = ctx.route.success) === null || _c === void 0 ? void 0 : _c["x-nestia-encrypted"]),
118
- })
119
- : typescript_1.default.factory.createNull()),
120
- ...(((_d = ctx.route.success) === null || _d === void 0 ? void 0 : _d.type) === "application/x-www-form-urlencoded"
121
- ? [
122
- typescript_1.default.factory.createPropertyAssignment("parseQuery", typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier(`${ctx.importer.external({
123
- type: "default",
124
- library: "typia",
125
- name: "typia",
126
- })}.http.createAssertQuery`), [
127
- NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
128
- components: ctx.components,
129
- importer: ctx.importer,
130
- schema: ctx.route.success.schema,
131
- }),
132
- ], undefined)),
133
- ]
134
- : []),
135
- ], true), typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createIdentifier("const"))));
136
- };
137
- const writePathFunction = (ctx) => {
138
- const empty = ctx.route.parameters.length === 0 && ctx.route.query === null;
139
- const property = (key) => ctx.config.keyword === true
140
- ? IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier("props"), key)
141
- : typescript_1.default.factory.createIdentifier(key);
142
- const out = (body) => constant("path", typescript_1.default.factory.createArrowFunction([], [], empty
143
- ? []
144
- : ctx.config.keyword === true
145
- ? [
146
- IdentifierFactory_1.IdentifierFactory.parameter("props", ctx.route.body
147
- ? typescript_1.default.factory.createTypeReferenceNode("Omit", [
148
- typescript_1.default.factory.createTypeReferenceNode("Props"),
149
- typescript_1.default.factory.createLiteralTypeNode(typescript_1.default.factory.createStringLiteral(ctx.route.body.key)),
150
- ])
151
- : typescript_1.default.factory.createTypeReferenceNode("Props")),
152
- ]
153
- : [
154
- ...ctx.route.parameters.map((p) => IdentifierFactory_1.IdentifierFactory.parameter(p.key, NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
155
- components: ctx.components,
156
- importer: ctx.importer,
157
- schema: p.schema,
158
- }))),
159
- ...(ctx.route.query
160
- ? [
161
- IdentifierFactory_1.IdentifierFactory.parameter(ctx.route.query.key, typescript_1.default.factory.createTypeReferenceNode(`${ctx.route.accessor.at(-1)}.Query`)),
162
- ]
163
- : []),
164
- ], undefined, undefined, body));
165
- const template = () => {
166
- const path = getPath(ctx.route);
167
- const split = path.split(":");
168
- if (split.length === 1)
169
- return typescript_1.default.factory.createStringLiteral(path);
170
- return typescript_1.default.factory.createTemplateExpression(typescript_1.default.factory.createTemplateHead(split[0]), split.slice(1).map((s, i, arr) => {
171
- const name = s.split("/")[0];
172
- return typescript_1.default.factory.createTemplateSpan(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("encodeURIComponent"), undefined, [
173
- typescript_1.default.factory.createBinaryExpression(property(ctx.route.parameters.find((p) => p.name === name).key), typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.QuestionQuestionToken), typescript_1.default.factory.createStringLiteral("null")),
174
- ]), (i !== arr.length - 1
175
- ? typescript_1.default.factory.createTemplateMiddle
176
- : typescript_1.default.factory.createTemplateTail)(s.substring(name.length)));
177
- }));
178
- };
179
- if (!ctx.route.query)
180
- return out(template());
181
- const computeName = (str) => ctx.route.parameters.find((p) => p.key === str) !== undefined
182
- ? computeName("_" + str)
183
- : str;
184
- const variables = computeName("variables");
185
- return out(typescript_1.default.factory.createBlock([
186
- local({
187
- name: variables,
188
- type: "URLSearchParams",
189
- expression: typescript_1.default.factory.createNewExpression(typescript_1.default.factory.createIdentifier("URLSearchParams"), [], []),
190
- }),
191
- typescript_1.default.factory.createForOfStatement(undefined, typescript_1.default.factory.createVariableDeclarationList([
192
- typescript_1.default.factory.createVariableDeclaration(typescript_1.default.factory.createArrayBindingPattern([
193
- typescript_1.default.factory.createBindingElement(undefined, undefined, typescript_1.default.factory.createIdentifier("key"), undefined),
194
- typescript_1.default.factory.createBindingElement(undefined, undefined, typescript_1.default.factory.createIdentifier("value"), undefined),
195
- ]), undefined, undefined, undefined),
196
- ], typescript_1.default.NodeFlags.Const), typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("Object.entries"), undefined, [
197
- typescript_1.default.factory.createAsExpression(property(ctx.route.query.key), TypeFactory_1.TypeFactory.keyword("any")),
198
- ]), typescript_1.default.factory.createIfStatement(typescript_1.default.factory.createStrictEquality(typescript_1.default.factory.createIdentifier("undefined"), typescript_1.default.factory.createIdentifier("value")), typescript_1.default.factory.createContinueStatement(), typescript_1.default.factory.createIfStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("Array.isArray"), undefined, [typescript_1.default.factory.createIdentifier("value")]), typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("value"), typescript_1.default.factory.createIdentifier("forEach")), undefined, [
199
- typescript_1.default.factory.createArrowFunction(undefined, undefined, [IdentifierFactory_1.IdentifierFactory.parameter("elem")], undefined, undefined, typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(variables), "append"), undefined, [
200
- typescript_1.default.factory.createIdentifier("key"),
201
- typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("String"), undefined, [typescript_1.default.factory.createIdentifier("elem")]),
202
- ])),
203
- ])), typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(variables), "set"), undefined, [
204
- typescript_1.default.factory.createIdentifier("key"),
205
- typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("String"), undefined, [typescript_1.default.factory.createIdentifier("value")]),
206
- ]))))),
207
- local({
208
- name: "location",
209
- type: "string",
210
- expression: template(),
211
- }),
212
- typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createConditionalExpression(typescript_1.default.factory.createStrictEquality(ExpressionFactory_1.ExpressionFactory.number(0), IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(variables), "size")), undefined, typescript_1.default.factory.createIdentifier("location"), undefined, typescript_1.default.factory.createTemplateExpression(typescript_1.default.factory.createTemplateHead(""), [
213
- typescript_1.default.factory.createTemplateSpan(typescript_1.default.factory.createIdentifier("location"), typescript_1.default.factory.createTemplateMiddle("?")),
214
- typescript_1.default.factory.createTemplateSpan(typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(variables), "toString"), undefined, undefined), typescript_1.default.factory.createTemplateTail("")),
215
- ]))),
216
- ], true));
217
- };
218
- })(NestiaMigrateApiNamespaceProgrammer || (exports.NestiaMigrateApiNamespaceProgrammer = NestiaMigrateApiNamespaceProgrammer = {}));
219
- const constant = (name, expression) => typescript_1.default.factory.createVariableStatement([typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createVariableDeclarationList([
220
- typescript_1.default.factory.createVariableDeclaration(name, undefined, undefined, expression),
221
- ], typescript_1.default.NodeFlags.Const));
222
- const getPath = (route) => (route.emendedPath.startsWith("/") ? "" : "/") + route.emendedPath;
223
- const local = (props) => typescript_1.default.factory.createVariableStatement([], typescript_1.default.factory.createVariableDeclarationList([
224
- typescript_1.default.factory.createVariableDeclaration(props.name, undefined, typescript_1.default.factory.createTypeReferenceNode(props.type), props.expression),
225
- ], typescript_1.default.NodeFlags.Const));
226
- //# sourceMappingURL=NestiaMigrateApiNamespaceProgrammer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NestiaMigrateApiNamespaceProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateApiNamespaceProgrammer.ts"],"names":[],"mappings":";;;;;;AACA,4DAA4B;AAC5B,6EAA0E;AAC1E,6EAA0E;AAC1E,uEAAoE;AACpE,iEAA8D;AAG9D,sDAAmD;AACnD,iGAA8F;AAE9F,mFAAgF;AAEhF,IAAiB,mCAAmC,CA6cnD;AA7cD,WAAiB,mCAAmC;IAQrC,yCAAK,GAAG,CAAC,GAAa,EAAwB,EAAE;QAC3D,MAAM,KAAK,GAA8B,UAAU,CAAC,G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O,CAAC,yBAAyB,CAClC,IAAI,EACJ,SAAS,EACT,SAAS,EACT,UAAU,CACX;CACF,EACD,oBAAE,CAAC,SAAS,CAAC,KAAK,CACnB,CACF,CAAC;AAEJ,MAAM,OAAO,GAAG,CAAC,KAAwB,EAAE,EAAE,CAC3C,CAAC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC;AAErE,MAAM,KAAK,GAAG,CAAC,KAId,EAAE,EAAE,CACH,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CAChC,EAAE,EACF,oBAAE,CAAC,OAAO,CAAC,6BAA6B,CACtC;IACE,oBAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC,KAAK,CAAC,IAAI,EACV,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,EAC9C,KAAK,CAAC,UAAU,CACjB;CACF,EACD,oBAAE,CAAC,SAAS,CAAC,KAAK,CACnB,CACF,CAAC"}
@@ -1,4 +0,0 @@
1
- import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
2
- export declare namespace NestiaMigrateApiProgrammer {
3
- const write: (ctx: INestiaMigrateContext) => Record<string, string>;
4
- }
@@ -1,82 +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.NestiaMigrateApiProgrammer = void 0;
7
- const tstl_1 = require("tstl");
8
- const typescript_1 = __importDefault(require("typescript"));
9
- const FilePrinter_1 = require("../utils/FilePrinter");
10
- const NestiaMigrateApiFileProgrammer_1 = require("./NestiaMigrateApiFileProgrammer");
11
- const NestiaMigrateDtoProgrammer_1 = require("./NestiaMigrateDtoProgrammer");
12
- const NestiaMigrateImportProgrammer_1 = require("./NestiaMigrateImportProgrammer");
13
- var NestiaMigrateApiProgrammer;
14
- (function (NestiaMigrateApiProgrammer) {
15
- NestiaMigrateApiProgrammer.write = (ctx) => {
16
- const dict = new tstl_1.HashMap((x) => (0, tstl_1.hash)(x.join(".")), (x, y) => x.length === y.length && x.join(".") === y.join("."));
17
- for (const route of ctx.application.routes) {
18
- const namespace = route.accessor.slice(0, -1);
19
- let last = dict.take(namespace, () => ({
20
- config: ctx.config,
21
- components: ctx.application.document().components,
22
- namespace,
23
- routes: [],
24
- children: new Set(),
25
- }));
26
- last.routes.push(route);
27
- namespace.forEach((_s, i, array) => {
28
- const partial = namespace.slice(0, array.length - i - 1);
29
- const props = dict.take(partial, () => ({
30
- config: ctx.config,
31
- components: ctx.application.document().components,
32
- namespace: partial,
33
- children: new Set(),
34
- routes: [],
35
- }));
36
- props.children.add(last.namespace.at(-1));
37
- last = props;
38
- });
39
- }
40
- // DO GENERATE
41
- const files = Object.fromEntries(dict.toJSON().map(({ second: value }) => [
42
- `src/${ctx.mode === "nest" ? "api/" : ""}functional/${[...value.namespace, "index.ts"].join("/")}`,
43
- FilePrinter_1.FilePrinter.write({
44
- statements: NestiaMigrateApiFileProgrammer_1.NestiaMigrateApiFileProgrammer.write(Object.assign(Object.assign({}, value), { config: ctx.config, components: ctx.application.document().components })),
45
- }),
46
- ]));
47
- if (ctx.mode === "sdk")
48
- for (const [key, value] of NestiaMigrateDtoProgrammer_1.NestiaMigrateDtoProgrammer.compose({
49
- config: ctx.config,
50
- components: ctx.application.document().components,
51
- }).entries())
52
- files[`src/structures/${key}.ts`] = FilePrinter_1.FilePrinter.write({
53
- statements: writeDtoFile(key, value),
54
- });
55
- return files;
56
- };
57
- const writeDtoFile = (key, modulo) => {
58
- const importer = new NestiaMigrateImportProgrammer_1.NestiaMigrateImportProgrammer();
59
- const statements = iterate(importer, modulo);
60
- if (statements.length === 0)
61
- return [];
62
- return [
63
- ...importer.toStatements((name) => `./${name}`, key),
64
- ...(importer.empty() ? [] : [FilePrinter_1.FilePrinter.newLine()]),
65
- ...statements,
66
- ];
67
- };
68
- const iterate = (importer, modulo) => {
69
- const output = [];
70
- if (modulo.programmer !== null)
71
- output.push(modulo.programmer(importer));
72
- if (modulo.children.size !== 0) {
73
- const internal = [];
74
- for (const child of modulo.children.values())
75
- internal.push(...iterate(importer, child));
76
- output.push(typescript_1.default.factory.createModuleDeclaration([typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createIdentifier(modulo.name), typescript_1.default.factory.createModuleBlock(internal), typescript_1.default.NodeFlags.Namespace));
77
- }
78
- output.push(FilePrinter_1.FilePrinter.newLine());
79
- return output;
80
- };
81
- })(NestiaMigrateApiProgrammer || (exports.NestiaMigrateApiProgrammer = NestiaMigrateApiProgrammer = {}));
82
- //# sourceMappingURL=NestiaMigrateApiProgrammer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NestiaMigrateApiProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateApiProgrammer.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAqC;AACrC,4DAA4B;AAG5B,sDAAmD;AACnD,qFAAkF;AAClF,6EAA0E;AAC1E,mFAAgF;AAEhF,IAAiB,0BAA0B,CAiG1C;AAjGD,WAAiB,0BAA0B;IAC5B,gCAAK,GAAG,CAAC,GAA0B,EAA0B,EAAE;QAC1E,MAAM,IAAI,GACR,IAAI,cAAO,CACT,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAI,EAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACxB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAC/D,CAAC;QACJ,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,WAAW,CAAC,MAAM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@@
1
- import { IHttpMigrateRoute, OpenApi } from "@samchon/openapi";
2
- import ts from "typescript";
3
- import { INestiaMigrateConfig } from "../structures/INestiaMigrateConfig";
4
- import { NestiaMigrateImportProgrammer } from "./NestiaMigrateImportProgrammer";
5
- export declare namespace NestiaMigrateApiSimulationProgrammer {
6
- interface IContext {
7
- config: INestiaMigrateConfig;
8
- components: OpenApi.IComponents;
9
- importer: NestiaMigrateImportProgrammer;
10
- route: IHttpMigrateRoute;
11
- }
12
- const random: (ctx: IContext) => ts.VariableStatement;
13
- const simulate: (ctx: IContext) => ts.VariableStatement;
14
- }
@@ -1,142 +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.NestiaMigrateApiSimulationProgrammer = void 0;
7
- const typescript_1 = __importDefault(require("typescript"));
8
- const IdentifierFactory_1 = require("typia/lib/factories/IdentifierFactory");
9
- const StatementFactory_1 = require("typia/lib/factories/StatementFactory");
10
- const TypeFactory_1 = require("typia/lib/factories/TypeFactory");
11
- const NestiaMigrateApiFunctionProgrammer_1 = require("./NestiaMigrateApiFunctionProgrammer");
12
- const NestiaMigrateApiNamespaceProgrammer_1 = require("./NestiaMigrateApiNamespaceProgrammer");
13
- const NestiaMigrateSchemaProgrammer_1 = require("./NestiaMigrateSchemaProgrammer");
14
- var NestiaMigrateApiSimulationProgrammer;
15
- (function (NestiaMigrateApiSimulationProgrammer) {
16
- NestiaMigrateApiSimulationProgrammer.random = (ctx) => {
17
- const output = ctx.route.success
18
- ? NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
19
- components: ctx.components,
20
- importer: ctx.importer,
21
- schema: ctx.route.success.schema,
22
- })
23
- : TypeFactory_1.TypeFactory.keyword("void");
24
- return constant("random", typescript_1.default.factory.createArrowFunction(undefined, undefined, [], output, undefined, typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(ctx.importer.external({
25
- type: "default",
26
- library: "typia",
27
- name: "typia",
28
- })), "random"), [output], undefined)));
29
- };
30
- NestiaMigrateApiSimulationProgrammer.simulate = (ctx) => {
31
- const caller = () => typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("random"), undefined, undefined);
32
- return constant("simulate", typescript_1.default.factory.createArrowFunction(undefined, undefined, NestiaMigrateApiFunctionProgrammer_1.NestiaMigrateApiFunctionProgrammer.writeParameterDeclarations(ctx, ctx.route.parameters.length === 0 &&
33
- ctx.route.query === null &&
34
- ctx.route.body === null
35
- ? "_connection"
36
- : undefined), typescript_1.default.factory.createTypeReferenceNode(ctx.route.success ? "Response" : "void"), undefined, typescript_1.default.factory.createBlock([...assert(ctx), typescript_1.default.factory.createReturnStatement(caller())], true)));
37
- };
38
- const assert = (ctx) => {
39
- var _a, _b;
40
- const property = (key) => ctx.config.keyword === true
41
- ? IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier("props"), key)
42
- : typescript_1.default.factory.createIdentifier(key);
43
- const parameters = [
44
- ...ctx.route.parameters.map((p) => ({
45
- category: "param",
46
- name: p.key,
47
- schema: NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
48
- components: ctx.components,
49
- importer: ctx.importer,
50
- schema: p.schema,
51
- }),
52
- })),
53
- ...(ctx.route.query
54
- ? [
55
- {
56
- category: "query",
57
- name: ctx.route.query.key,
58
- schema: NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
59
- components: ctx.components,
60
- importer: ctx.importer,
61
- schema: ctx.route.query.schema,
62
- }),
63
- },
64
- ]
65
- : []),
66
- ...(ctx.route.body
67
- ? [
68
- {
69
- category: "body",
70
- name: ctx.route.body.key,
71
- schema: NestiaMigrateSchemaProgrammer_1.NestiaMigrateSchemaProgrammer.write({
72
- components: ctx.components,
73
- importer: ctx.importer,
74
- schema: ctx.route.body.schema,
75
- }),
76
- },
77
- ]
78
- : []),
79
- ];
80
- if (parameters.length === 0)
81
- return [];
82
- const validator = StatementFactory_1.StatementFactory.constant({
83
- name: "assert",
84
- value: typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(ctx.importer.external({
85
- type: "instance",
86
- library: `@nestia/fetcher/lib/NestiaSimulator`,
87
- name: "NestiaSimulator",
88
- })), "assert"), undefined, [
89
- typescript_1.default.factory.createObjectLiteralExpression([
90
- typescript_1.default.factory.createPropertyAssignment("method", typescript_1.default.factory.createIdentifier("METADATA.method")),
91
- typescript_1.default.factory.createPropertyAssignment("host", typescript_1.default.factory.createIdentifier("connection.host")),
92
- typescript_1.default.factory.createPropertyAssignment("path", NestiaMigrateApiNamespaceProgrammer_1.NestiaMigrateApiNamespaceProgrammer.writePathCallExpression(ctx.config, ctx.route)),
93
- typescript_1.default.factory.createPropertyAssignment("contentType", typescript_1.default.factory.createStringLiteral((_b = (_a = ctx.route.success) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "application/json")),
94
- ], true),
95
- ]),
96
- });
97
- const individual = parameters
98
- .map((p) => typescript_1.default.factory.createCallExpression((() => {
99
- const base = IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier("assert"), p.category);
100
- if (p.category !== "param")
101
- return base;
102
- return typescript_1.default.factory.createCallExpression(base, undefined, [
103
- typescript_1.default.factory.createStringLiteral(p.name),
104
- ]);
105
- })(), undefined, [
106
- typescript_1.default.factory.createArrowFunction(undefined, undefined, [], undefined, undefined, typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(ctx.importer.external({
107
- type: "default",
108
- library: "typia",
109
- name: "typia",
110
- })), "assert"), undefined, [
111
- p.category === "headers"
112
- ? typescript_1.default.factory.createIdentifier("connection.headers")
113
- : property(p.name),
114
- ])),
115
- ]))
116
- .map(typescript_1.default.factory.createExpressionStatement);
117
- return [validator, tryAndCatch(ctx.importer, individual)];
118
- };
119
- const tryAndCatch = (importer, individual) => typescript_1.default.factory.createTryStatement(typescript_1.default.factory.createBlock(individual, true), typescript_1.default.factory.createCatchClause("exp", typescript_1.default.factory.createBlock([
120
- typescript_1.default.factory.createIfStatement(typescript_1.default.factory.createLogicalNot(typescript_1.default.factory.createCallExpression(IdentifierFactory_1.IdentifierFactory.access(typescript_1.default.factory.createIdentifier(importer.external({
121
- type: "default",
122
- library: "typia",
123
- name: "typia",
124
- })), "is"), [
125
- typescript_1.default.factory.createTypeReferenceNode(importer.external({
126
- type: "instance",
127
- library: "@nestia/fetcher",
128
- name: "HttpError",
129
- })),
130
- ], [typescript_1.default.factory.createIdentifier("exp")])), typescript_1.default.factory.createThrowStatement(typescript_1.default.factory.createIdentifier("exp"))),
131
- typescript_1.default.factory.createReturnStatement(typescript_1.default.factory.createAsExpression(typescript_1.default.factory.createObjectLiteralExpression([
132
- typescript_1.default.factory.createPropertyAssignment("success", typescript_1.default.factory.createFalse()),
133
- typescript_1.default.factory.createPropertyAssignment("status", typescript_1.default.factory.createIdentifier("exp.status")),
134
- typescript_1.default.factory.createPropertyAssignment("headers", typescript_1.default.factory.createIdentifier("exp.headers")),
135
- typescript_1.default.factory.createPropertyAssignment("data", typescript_1.default.factory.createIdentifier("exp.toJSON().message")),
136
- ], true), TypeFactory_1.TypeFactory.keyword("any"))),
137
- ], true)), undefined);
138
- })(NestiaMigrateApiSimulationProgrammer || (exports.NestiaMigrateApiSimulationProgrammer = NestiaMigrateApiSimulationProgrammer = {}));
139
- const constant = (name, expression) => typescript_1.default.factory.createVariableStatement([typescript_1.default.factory.createModifier(typescript_1.default.SyntaxKind.ExportKeyword)], typescript_1.default.factory.createVariableDeclarationList([
140
- typescript_1.default.factory.createVariableDeclaration(typescript_1.default.factory.createIdentifier(name), undefined, undefined, expression),
141
- ], typescript_1.default.NodeFlags.Const));
142
- //# sourceMappingURL=NestiaMigrateApiSimulationProgrammer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NestiaMigrateApiSimulationProgrammer.js","sourceRoot":"","sources":["../../src/programmers/NestiaMigrateApiSimulationProgrammer.ts"],"names":[],"mappings":";;;;;;AACA,4DAA4B;AAC5B,6EAA0E;AAC1E,2EAAwE;AACxE,iEAA8D;AAG9D,6FAA0F;AAC1F,+FAA4F;AAE5F,mFAAgF;AAEhF,IAAiB,oCAAoC,CAwRpD;AAxRD,WAAiB,oCAAoC;IAQtC,2CAAM,GAAG,CAAC,GAAa,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO;YAC9B,CAAC,CAAC,6DAA6B,CAAC,KAAK,CAAC;gBAClC,UAAU,EAAE,GAAG,CAAC,UAAU;gBAC1B,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM;aACjC,CAAC;YACJ,CAAC,CAAC,yBAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,QAAQ,CACb,QAAQ,EACR,oBAAE,CAAC,OAAO,CAAC,mBAAmB,CAC5B,SAAS,EACT,SAAS,EACT,EAAE,EACF,MAAM,EACN,SAAS,EACT,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAC7B,qCAAiB,CAAC,MAAM,CACtB,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CACzB,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,OAAO;SACd,CAAC,CACH,EACD,QAAQ,CACT,EACD,CAAC,MAAM,CAAC,EACR,SAAS,CACV,CACF,CACF,CAAC;IACJ,CAAC,CAAC;IAEW,6CAAQ,GAAG,CAAC,GAAa,EAAwB,EAAE;QAC9D,MAAM,MAAM,GAAG,GAAG,EAAE,CAClB,oBAAE,CAAC,OAAO,CAAC,oBAAo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CAAC,gBAAgB,CAAC,sBAAsB,CAAC,CACpD;SACF,EACD,IAAI,CACL,EACD,yBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAC3B,CACF;KACF,EACD,IAAI,CACL,CACF,EACD,SAAS,CACV,CAAC;AACN,CAAC,EAxRgB,oCAAoC,oDAApC,oCAAoC,QAwRpD;AAED,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,UAAyB,EAAE,EAAE,CAC3D,oBAAE,CAAC,OAAO,CAAC,uBAAuB,CAChC,CAAC,oBAAE,CAAC,OAAO,CAAC,cAAc,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,EACxD,oBAAE,CAAC,OAAO,CAAC,6BAA6B,CACtC;IACE,oBAAE,CAAC,OAAO,CAAC,yBAAyB,CAClC,oBAAE,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,EACjC,SAAS,EACT,SAAS,EACT,UAAU,CACX;CACF,EACD,oBAAE,CAAC,SAAS,CAAC,KAAK,CACnB,CACF,CAAC"}
@@ -1,4 +0,0 @@
1
- import { INestiaMigrateContext } from "../structures/INestiaMigrateContext";
2
- export declare namespace NestiaMigrateApiStartProgrammer {
3
- const write: (context: INestiaMigrateContext) => Record<string, string>;
4
- }
@@ -1,80 +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.NestiaMigrateApiStartProgrammer = void 0;
7
- const typescript_1 = __importDefault(require("typescript"));
8
- const IdentifierFactory_1 = require("typia/lib/factories/IdentifierFactory");
9
- const StatementFactory_1 = require("typia/lib/factories/StatementFactory");
10
- const FilePrinter_1 = require("../utils/FilePrinter");
11
- const NestiaMigrateE2eFileProgrammer_1 = require("./NestiaMigrateE2eFileProgrammer");
12
- const NestiaMigrateImportProgrammer_1 = require("./NestiaMigrateImportProgrammer");
13
- var NestiaMigrateApiStartProgrammer;
14
- (function (NestiaMigrateApiStartProgrammer) {
15
- NestiaMigrateApiStartProgrammer.write = (context) => {
16
- const importer = new NestiaMigrateImportProgrammer_1.NestiaMigrateImportProgrammer();
17
- const main = writeMain(context, importer, pick(context.application.routes));
18
- const statements = [
19
- ...importer.toStatements((name) => `@ORGANIZATION/PROJECT-api/lib/structures/${name}`),
20
- FilePrinter_1.FilePrinter.newLine(),
21
- typescript_1.default.factory.createImportDeclaration(undefined, typescript_1.default.factory.createImportClause(false, undefined, typescript_1.default.factory.createNamedImports([
22
- typescript_1.default.factory.createImportSpecifier(false, undefined, typescript_1.default.factory.createIdentifier("TestGlobal")),
23
- ])), typescript_1.default.factory.createStringLiteral("./TestGlobal"), undefined),
24
- FilePrinter_1.FilePrinter.newLine(),
25
- main,
26
- typescript_1.default.factory.createExpressionStatement(writeStarter()),
27
- ];
28
- return {
29
- "test/start.ts": FilePrinter_1.FilePrinter.write({ statements }),
30
- };
31
- };
32
- const writeMain = (ctx, importer, route) => StatementFactory_1.StatementFactory.constant({
33
- name: "main",
34
- value: typescript_1.default.factory.createArrowFunction([typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.AsyncKeyword)], undefined, [], undefined, undefined, typescript_1.default.factory.createBlock([
35
- writeConnection(ctx, importer),
36
- ...NestiaMigrateE2eFileProgrammer_1.NestiaMigrateE2eFunctionProgrammer.writeBody({
37
- config: ctx.config,
38
- components: ctx.application.document().components,
39
- importer,
40
- route,
41
- }),
42
- ], true)),
43
- });
44
- const writeConnection = (ctx, importer) => {
45
- var _a, _b, _c;
46
- return typescript_1.default.factory.createVariableStatement(undefined, typescript_1.default.factory.createVariableDeclarationList([
47
- typescript_1.default.factory.createVariableDeclaration("connection", undefined, typescript_1.default.factory.createTypeReferenceNode(typescript_1.default.factory.createQualifiedName(typescript_1.default.factory.createIdentifier(importer.external({
48
- type: "default",
49
- library: "@ORGANIZATION/PROJECT-api",
50
- name: "api",
51
- })), typescript_1.default.factory.createIdentifier("IConnection"))), typescript_1.default.factory.createObjectLiteralExpression([
52
- typescript_1.default.factory.createSpreadAssignment(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("TestGlobal"), "connection"), undefined, undefined)),
53
- ...(((_c = (_b = (_a = ctx.application.document().servers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.url) === null || _c === void 0 ? void 0 : _c.length)
54
- ? [
55
- typescript_1.default.factory.createPropertyAssignment("host", typescript_1.default.factory.createStringLiteral(ctx.application.document().servers[0].url)),
56
- ]
57
- : []),
58
- ...(ctx.config.simulate === true
59
- ? [
60
- typescript_1.default.factory.createPropertyAssignment("simulate", typescript_1.default.factory.createTrue()),
61
- ]
62
- : []),
63
- ], true)),
64
- ], typescript_1.default.NodeFlags.Const));
65
- };
66
- const writeStarter = () => typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createIdentifier("main"), undefined, undefined), "catch"), undefined, [
67
- typescript_1.default.factory.createArrowFunction(undefined, undefined, [IdentifierFactory_1.IdentifierFactory.parameter("exp")], undefined, undefined, typescript_1.default.factory.createBlock([
68
- typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("console"), "log"), undefined, [typescript_1.default.factory.createIdentifier("exp")])),
69
- typescript_1.default.factory.createExpressionStatement(typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createPropertyAccessExpression(typescript_1.default.factory.createIdentifier("process"), "exit"), undefined, [
70
- typescript_1.default.factory.createPrefixMinus(typescript_1.default.factory.createNumericLiteral("1")),
71
- ])),
72
- ], true)),
73
- ]);
74
- })(NestiaMigrateApiStartProgrammer || (exports.NestiaMigrateApiStartProgrammer = NestiaMigrateApiStartProgrammer = {}));
75
- const pick = (array) => {
76
- const rand = Math.random() * array.length;
77
- const index = Math.min(array.length - 1, Math.floor(rand));
78
- return array[index];
79
- };
80
- //# sourceMappingURL=NestiaMigrateApiStartProgrammer.js.map