@nestia/migrate 0.6.1 → 0.6.2
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.
- package/lib/MigrateApplication.d.ts +1 -1
- package/lib/MigrateApplication.js +46 -27
- package/lib/MigrateApplication.js.map +1 -1
- package/lib/analyzers/ControllerAnalyzer.js +11 -2
- package/lib/analyzers/ControllerAnalyzer.js.map +1 -1
- package/lib/analyzers/MethodAnalyzer.js +18 -5
- package/lib/analyzers/MethodAnalyzer.js.map +1 -1
- package/lib/archivers/FileArchiver.d.ts +3 -3
- package/lib/archivers/FileArchiver.js +16 -7
- package/lib/archivers/FileArchiver.js.map +1 -1
- package/lib/executable/migrate.js +16 -7
- package/lib/executable/migrate.js.map +1 -1
- package/lib/programmers/ApiFileProgrammer.d.ts +17 -0
- package/lib/programmers/ApiFileProgrammer.js +28 -0
- package/lib/programmers/ApiFileProgrammer.js.map +1 -0
- package/lib/programmers/ApiFunctionProgrammer.d.ts +13 -0
- package/lib/programmers/ApiFunctionProgrammer.js +85 -0
- package/lib/programmers/ApiFunctionProgrammer.js.map +1 -0
- package/lib/programmers/ApiNamespaceProgrammer.d.ts +13 -0
- package/lib/programmers/ApiNamespaceProgrammer.js +134 -0
- package/lib/programmers/ApiNamespaceProgrammer.js.map +1 -0
- package/lib/programmers/ApiProgrammer.d.ts +5 -0
- package/lib/programmers/ApiProgrammer.js +62 -0
- package/lib/programmers/ApiProgrammer.js.map +1 -0
- package/lib/programmers/DtoProgrammer.js +2 -2
- package/lib/programmers/DtoProgrammer.js.map +1 -1
- package/lib/programmers/ImportProgrammer.d.ts +2 -1
- package/lib/programmers/ImportProgrammer.js +19 -4
- package/lib/programmers/ImportProgrammer.js.map +1 -1
- package/lib/programmers/NestControllerProgrammer.js +2 -1
- package/lib/programmers/NestControllerProgrammer.js.map +1 -1
- package/lib/programmers/NestMethodProgrammer.js +33 -18
- package/lib/programmers/NestMethodProgrammer.js.map +1 -1
- package/lib/programmers/NestProgrammer.d.ts +1 -1
- package/lib/programmers/NestProgrammer.js +5 -5
- package/lib/programmers/NestProgrammer.js.map +1 -1
- package/lib/programmers/SchemaProgrammer.d.ts +1 -1
- package/lib/programmers/SchemaProgrammer.js +17 -17
- package/lib/programmers/SchemaProgrammer.js.map +1 -1
- package/lib/structures/IMigrateRoute.d.ts +13 -4
- package/lib/utils/SetupWizard.js +0 -3
- package/lib/utils/SetupWizard.js.map +1 -1
- package/lib/utils/StringUtil.d.ts +1 -0
- package/lib/utils/StringUtil.js +4 -2
- package/lib/utils/StringUtil.js.map +1 -1
- package/package.json +1 -1
- package/src/MigrateApplication.ts +36 -31
- package/src/analyzers/ControllerAnalyzer.ts +19 -3
- package/src/analyzers/MethodAnalyzer.ts +18 -5
- package/src/archivers/FileArchiver.ts +10 -7
- package/src/executable/migrate.ts +7 -7
- package/src/programmers/ApiFileProgrammer.ts +51 -0
- package/src/programmers/ApiFunctionProgrammer.ts +177 -0
- package/src/programmers/ApiNamespaceProgrammer.ts +395 -0
- package/src/programmers/ApiProgrammer.ts +68 -0
- package/src/programmers/DtoProgrammer.ts +3 -3
- package/src/programmers/ImportProgrammer.ts +37 -21
- package/src/programmers/NestControllerProgrammer.ts +2 -1
- package/src/programmers/NestMethodProgrammer.ts +39 -22
- package/src/programmers/NestProgrammer.ts +1 -1
- package/src/programmers/SchemaProgrammer.ts +22 -25
- package/src/structures/IMigrateRoute.ts +13 -5
- package/src/utils/SetupWizard.ts +0 -3
- package/src/utils/StringUtil.ts +11 -2
- package/lib/analyzers/RouteAnalyzer.d.ts +0 -0
- package/lib/analyzers/RouteAnalyzer.js +0 -2
- package/lib/analyzers/RouteAnalyzer.js.map +0 -1
- package/src/analyzers/RouteAnalyzer.ts +0 -0
@@ -5,7 +5,13 @@ import { FilePrinter } from "../utils/FilePrinter";
|
|
5
5
|
import { MapUtil } from "../utils/MapUtil";
|
6
6
|
|
7
7
|
export class ImportProgrammer {
|
8
|
-
private external_: Map<
|
8
|
+
private external_: Map<
|
9
|
+
string,
|
10
|
+
{
|
11
|
+
default: string | null;
|
12
|
+
instances: Set<string>;
|
13
|
+
}
|
14
|
+
> = new Map();
|
9
15
|
private dtos_: Set<string> = new Set();
|
10
16
|
|
11
17
|
public constructor() {}
|
@@ -15,10 +21,14 @@ export class ImportProgrammer {
|
|
15
21
|
}
|
16
22
|
|
17
23
|
public external(props: ImportProgrammer.IProps): string {
|
18
|
-
MapUtil.take(this.external_)(props.library)(() =>
|
19
|
-
|
20
|
-
|
21
|
-
|
24
|
+
const element = MapUtil.take(this.external_)(props.library)(() => ({
|
25
|
+
default: null,
|
26
|
+
instances: new Set(),
|
27
|
+
}));
|
28
|
+
const name: string = props.name.split(".")[0];
|
29
|
+
if (props.type === "default") element.default = props.name;
|
30
|
+
else element.instances.add(name);
|
31
|
+
return name;
|
22
32
|
}
|
23
33
|
|
24
34
|
public dto(name: string): ts.TypeReferenceNode {
|
@@ -29,8 +39,9 @@ export class ImportProgrammer {
|
|
29
39
|
|
30
40
|
public tag(type: string, arg: number | string): ts.TypeReferenceNode {
|
31
41
|
this.external({
|
42
|
+
type: "instance",
|
32
43
|
library: "typia",
|
33
|
-
|
44
|
+
name: "tags",
|
34
45
|
});
|
35
46
|
return ts.factory.createTypeReferenceNode(`tags.${type}`, [
|
36
47
|
ts.factory.createLiteralTypeNode(
|
@@ -46,25 +57,29 @@ export class ImportProgrammer {
|
|
46
57
|
current?: string,
|
47
58
|
): ts.Statement[] {
|
48
59
|
return [
|
49
|
-
...[...this.external_.entries()].map(([library,
|
50
|
-
ts.factory.createImportDeclaration(
|
60
|
+
...[...this.external_.entries()].map(([library, props]) => {
|
61
|
+
return ts.factory.createImportDeclaration(
|
51
62
|
undefined,
|
52
63
|
ts.factory.createImportClause(
|
53
64
|
false,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
65
|
+
props.default !== null
|
66
|
+
? ts.factory.createIdentifier(props.default)
|
67
|
+
: undefined,
|
68
|
+
props.instances.size
|
69
|
+
? ts.factory.createNamedImports(
|
70
|
+
[...props.instances].map((i) =>
|
71
|
+
ts.factory.createImportSpecifier(
|
72
|
+
false,
|
73
|
+
undefined,
|
74
|
+
ts.factory.createIdentifier(i),
|
75
|
+
),
|
76
|
+
),
|
77
|
+
)
|
78
|
+
: undefined,
|
64
79
|
),
|
65
80
|
ts.factory.createStringLiteral(library),
|
66
|
-
)
|
67
|
-
),
|
81
|
+
);
|
82
|
+
}),
|
68
83
|
...(this.external_.size && this.dtos_.size ? [FilePrinter.enter()] : []),
|
69
84
|
...[...this.dtos_]
|
70
85
|
.filter(
|
@@ -92,7 +107,8 @@ export class ImportProgrammer {
|
|
92
107
|
}
|
93
108
|
export namespace ImportProgrammer {
|
94
109
|
export interface IProps {
|
110
|
+
type: "default" | "instance";
|
95
111
|
library: string;
|
96
|
-
|
112
|
+
name: string;
|
97
113
|
}
|
98
114
|
}
|
@@ -18,8 +18,9 @@ export namespace NestControllerProgrammer {
|
|
18
18
|
ts.factory.createCallExpression(
|
19
19
|
ts.factory.createIdentifier(
|
20
20
|
importer.external({
|
21
|
+
type: "instance",
|
21
22
|
library: "@nestjs/common",
|
22
|
-
|
23
|
+
name: "Controller",
|
23
24
|
}),
|
24
25
|
),
|
25
26
|
[],
|
@@ -17,7 +17,7 @@ export namespace NestMethodProgrammer {
|
|
17
17
|
(importer: ImportProgrammer) =>
|
18
18
|
(route: IMigrateRoute): ts.MethodDeclaration => {
|
19
19
|
const output: ts.TypeNode = route.success
|
20
|
-
? SchemaProgrammer.write(
|
20
|
+
? SchemaProgrammer.write(components)(importer)(route.success.schema)
|
21
21
|
: TypeFactory.keyword("void");
|
22
22
|
|
23
23
|
const method: ts.MethodDeclaration = ts.factory.createMethodDeclaration(
|
@@ -30,7 +30,7 @@ export namespace NestMethodProgrammer {
|
|
30
30
|
route.name,
|
31
31
|
undefined,
|
32
32
|
undefined,
|
33
|
-
writeParameters(
|
33
|
+
writeParameters(components)(importer)(route),
|
34
34
|
ts.factory.createTypeReferenceNode("Promise", [output]),
|
35
35
|
ts.factory.createBlock(
|
36
36
|
[
|
@@ -46,12 +46,15 @@ export namespace NestMethodProgrammer {
|
|
46
46
|
),
|
47
47
|
ts.factory.createReturnStatement(
|
48
48
|
ts.factory.createCallExpression(
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
IdentifierFactory.access(
|
50
|
+
ts.factory.createIdentifier(
|
51
|
+
importer.external({
|
52
|
+
type: "default",
|
53
|
+
library: "typia",
|
54
|
+
name: "typia",
|
55
|
+
}),
|
56
|
+
),
|
57
|
+
)("random"),
|
55
58
|
[output],
|
56
59
|
undefined,
|
57
60
|
),
|
@@ -60,9 +63,17 @@ export namespace NestMethodProgrammer {
|
|
60
63
|
true,
|
61
64
|
),
|
62
65
|
);
|
63
|
-
return FilePrinter.description(method, route
|
66
|
+
return FilePrinter.description(method, writeDescription(route));
|
64
67
|
};
|
65
68
|
|
69
|
+
const writeDescription = (method: IMigrateRoute): string =>
|
70
|
+
[
|
71
|
+
...(method.description?.length ? [method.description.length, ""] : []),
|
72
|
+
...(method.deprecated ? ["@deprecated"] : []),
|
73
|
+
...method.tags.map((value) => `@tag ${value}`),
|
74
|
+
"@nestia Generated by Nestia - https://github.com/samchon/nestia",
|
75
|
+
].join("\n");
|
76
|
+
|
66
77
|
const writeMethodDecorators =
|
67
78
|
(components: ISwaggerComponents) =>
|
68
79
|
(importer: ImportProgrammer) =>
|
@@ -71,7 +82,11 @@ export namespace NestMethodProgrammer {
|
|
71
82
|
(lib: string) =>
|
72
83
|
(instance: string): ts.Identifier =>
|
73
84
|
ts.factory.createIdentifier(
|
74
|
-
importer.external({
|
85
|
+
importer.external({
|
86
|
+
type: "instance",
|
87
|
+
library: lib,
|
88
|
+
name: instance,
|
89
|
+
}),
|
75
90
|
);
|
76
91
|
const router = (instance: string) =>
|
77
92
|
ts.factory.createDecorator(
|
@@ -116,7 +131,7 @@ export namespace NestMethodProgrammer {
|
|
116
131
|
ts.factory.createDecorator(
|
117
132
|
ts.factory.createCallExpression(
|
118
133
|
external("@nestia/core")("TypedException"),
|
119
|
-
[SchemaProgrammer.write(
|
134
|
+
[SchemaProgrammer.write(components)(importer)(value.schema)],
|
120
135
|
[
|
121
136
|
isNaN(Number(key))
|
122
137
|
? ts.factory.createStringLiteral(key)
|
@@ -132,8 +147,8 @@ export namespace NestMethodProgrammer {
|
|
132
147
|
};
|
133
148
|
|
134
149
|
const writeParameters =
|
135
|
-
(importer: ImportProgrammer) =>
|
136
150
|
(components: ISwaggerComponents) =>
|
151
|
+
(importer: ImportProgrammer) =>
|
137
152
|
(route: IMigrateRoute): ts.ParameterDeclaration[] => [
|
138
153
|
...route.parameters.map(({ key, schema: value }) =>
|
139
154
|
ts.factory.createParameterDeclaration(
|
@@ -142,8 +157,9 @@ export namespace NestMethodProgrammer {
|
|
142
157
|
ts.factory.createCallExpression(
|
143
158
|
ts.factory.createIdentifier(
|
144
159
|
importer.external({
|
160
|
+
type: "instance",
|
145
161
|
library: "@nestia/core",
|
146
|
-
|
162
|
+
name: "TypedParam",
|
147
163
|
}),
|
148
164
|
),
|
149
165
|
undefined,
|
@@ -154,21 +170,21 @@ export namespace NestMethodProgrammer {
|
|
154
170
|
undefined,
|
155
171
|
StringUtil.normalize(key),
|
156
172
|
undefined,
|
157
|
-
SchemaProgrammer.write(
|
173
|
+
SchemaProgrammer.write(components)(importer)(value),
|
158
174
|
),
|
159
175
|
),
|
160
176
|
...(route.headers
|
161
177
|
? [
|
162
178
|
writeDtoParameter({ method: "TypedHeaders", variable: "headers" })(
|
163
|
-
|
164
|
-
)(
|
179
|
+
components,
|
180
|
+
)(importer)(route.headers.schema),
|
165
181
|
]
|
166
182
|
: []),
|
167
183
|
...(route.query
|
168
184
|
? [
|
169
185
|
writeDtoParameter({ method: "TypedQuery", variable: "query" })(
|
170
|
-
|
171
|
-
)(
|
186
|
+
components,
|
187
|
+
)(importer)(route.query.schema),
|
172
188
|
]
|
173
189
|
: []),
|
174
190
|
...(route.body
|
@@ -178,15 +194,15 @@ export namespace NestMethodProgrammer {
|
|
178
194
|
? "EncryptedBody"
|
179
195
|
: "TypedBody",
|
180
196
|
variable: "body",
|
181
|
-
})(
|
197
|
+
})(components)(importer)(route.body.schema),
|
182
198
|
]
|
183
199
|
: []),
|
184
200
|
];
|
185
201
|
|
186
202
|
const writeDtoParameter =
|
187
203
|
(accessor: { method: string; variable: string }) =>
|
188
|
-
(importer: ImportProgrammer) =>
|
189
204
|
(components: ISwaggerComponents) =>
|
205
|
+
(importer: ImportProgrammer) =>
|
190
206
|
(schema: ISwaggerSchema): ts.ParameterDeclaration =>
|
191
207
|
ts.factory.createParameterDeclaration(
|
192
208
|
[
|
@@ -194,8 +210,9 @@ export namespace NestMethodProgrammer {
|
|
194
210
|
ts.factory.createCallExpression(
|
195
211
|
ts.factory.createIdentifier(
|
196
212
|
importer.external({
|
213
|
+
type: "instance",
|
197
214
|
library: "@nestia/core",
|
198
|
-
|
215
|
+
name: accessor.method,
|
199
216
|
}),
|
200
217
|
),
|
201
218
|
undefined,
|
@@ -206,6 +223,6 @@ export namespace NestMethodProgrammer {
|
|
206
223
|
undefined,
|
207
224
|
StringUtil.normalize(accessor.variable),
|
208
225
|
undefined,
|
209
|
-
SchemaProgrammer.write(
|
226
|
+
SchemaProgrammer.write(components)(importer)(schema),
|
210
227
|
);
|
211
228
|
}
|
@@ -8,7 +8,7 @@ import { ImportProgrammer } from "./ImportProgrammer";
|
|
8
8
|
import { NestControllerProgrammer } from "./NestControllerProgrammer";
|
9
9
|
import { NestModuleProgrammer } from "./NestModuleProgrammer";
|
10
10
|
|
11
|
-
export namespace
|
11
|
+
export namespace NestProgrammer {
|
12
12
|
export const write = (program: IMigrateProgram): IMigrateFile[] =>
|
13
13
|
[
|
14
14
|
{
|
@@ -15,8 +15,8 @@ export namespace SchemaProgrammer {
|
|
15
15
|
FACADE
|
16
16
|
----------------------------------------------------------- */
|
17
17
|
export const write =
|
18
|
-
(importer: ImportProgrammer) =>
|
19
18
|
(components: ISwaggerComponents) =>
|
19
|
+
(importer: ImportProgrammer) =>
|
20
20
|
(schema: ISwaggerSchema): ts.TypeNode => {
|
21
21
|
const union: ts.TypeNode[] = [];
|
22
22
|
if (SwaggerTypeChecker.isUnknown(schema))
|
@@ -36,16 +36,16 @@ export namespace SchemaProgrammer {
|
|
36
36
|
else if (SwaggerTypeChecker.isString(schema))
|
37
37
|
return writeString(importer)(schema);
|
38
38
|
else if (SwaggerTypeChecker.isArray(schema))
|
39
|
-
return writeArray(
|
39
|
+
return writeArray(components)(importer)(schema);
|
40
40
|
else if (SwaggerTypeChecker.isObject(schema))
|
41
|
-
return writeObject(
|
41
|
+
return writeObject(components)(importer)(schema);
|
42
42
|
else if (SwaggerTypeChecker.isReference(schema))
|
43
43
|
return writeReference(importer)(schema);
|
44
44
|
// NESTED UNION
|
45
45
|
else if (SwaggerTypeChecker.isAnyOf(schema))
|
46
|
-
return writeUnion(
|
46
|
+
return writeUnion(components)(importer)(schema.anyOf);
|
47
47
|
else if (SwaggerTypeChecker.isOneOf(schema))
|
48
|
-
return writeUnion(
|
48
|
+
return writeUnion(components)(importer)(schema.oneOf);
|
49
49
|
else return TypeFactory.keyword("any");
|
50
50
|
})();
|
51
51
|
union.push(type);
|
@@ -141,12 +141,12 @@ export namespace SchemaProgrammer {
|
|
141
141
|
INSTANCES
|
142
142
|
----------------------------------------------------------- */
|
143
143
|
const writeArray =
|
144
|
-
(importer: ImportProgrammer) =>
|
145
144
|
(components: ISwaggerComponents) =>
|
145
|
+
(importer: ImportProgrammer) =>
|
146
146
|
(schema: ISwaggerSchema.IArray): ts.TypeNode => {
|
147
147
|
const intersection: ts.TypeNode[] = [
|
148
148
|
ts.factory.createArrayTypeNode(
|
149
|
-
write(
|
149
|
+
write(components)(importer)(schema.items),
|
150
150
|
),
|
151
151
|
];
|
152
152
|
if (schema.minItems !== undefined)
|
@@ -159,13 +159,13 @@ export namespace SchemaProgrammer {
|
|
159
159
|
};
|
160
160
|
|
161
161
|
const writeObject =
|
162
|
-
(importer: ImportProgrammer) =>
|
163
162
|
(components: ISwaggerComponents) =>
|
163
|
+
(importer: ImportProgrammer) =>
|
164
164
|
(schema: ISwaggerSchema.IObject): ts.TypeNode => {
|
165
165
|
const regular = () =>
|
166
166
|
ts.factory.createTypeLiteralNode(
|
167
167
|
Object.entries(schema.properties ?? []).map(([key, value]) =>
|
168
|
-
writeRegularProperty(
|
168
|
+
writeRegularProperty(components)(importer)(schema.required ?? [])(
|
169
169
|
key,
|
170
170
|
value,
|
171
171
|
),
|
@@ -173,24 +173,21 @@ export namespace SchemaProgrammer {
|
|
173
173
|
);
|
174
174
|
const dynamic = () =>
|
175
175
|
ts.factory.createTypeLiteralNode([
|
176
|
-
writeDynamicProperty(
|
176
|
+
writeDynamicProperty(components)(importer)(
|
177
177
|
schema.additionalProperties as ISwaggerSchema,
|
178
178
|
),
|
179
179
|
]);
|
180
|
-
return
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
: regular(),
|
187
|
-
writeComment(schema),
|
188
|
-
);
|
180
|
+
return !!schema.properties?.length &&
|
181
|
+
typeof schema.additionalProperties === "object"
|
182
|
+
? ts.factory.createIntersectionTypeNode([regular(), dynamic()])
|
183
|
+
: typeof schema.additionalProperties === "object"
|
184
|
+
? dynamic()
|
185
|
+
: regular();
|
189
186
|
};
|
190
187
|
|
191
188
|
const writeRegularProperty =
|
192
|
-
(importer: ImportProgrammer) =>
|
193
189
|
(components: ISwaggerComponents) =>
|
190
|
+
(importer: ImportProgrammer) =>
|
194
191
|
(required: string[]) =>
|
195
192
|
(key: string, value: ISwaggerSchema) =>
|
196
193
|
FilePrinter.description(
|
@@ -202,14 +199,14 @@ export namespace SchemaProgrammer {
|
|
202
199
|
required.includes(key)
|
203
200
|
? undefined
|
204
201
|
: ts.factory.createToken(ts.SyntaxKind.QuestionToken),
|
205
|
-
write(
|
202
|
+
write(components)(importer)(value),
|
206
203
|
),
|
207
204
|
writeComment(value),
|
208
205
|
);
|
209
206
|
|
210
207
|
const writeDynamicProperty =
|
211
|
-
(importer: ImportProgrammer) =>
|
212
208
|
(components: ISwaggerComponents) =>
|
209
|
+
(importer: ImportProgrammer) =>
|
213
210
|
(value: ISwaggerSchema) =>
|
214
211
|
FilePrinter.description(
|
215
212
|
ts.factory.createIndexSignature(
|
@@ -223,7 +220,7 @@ export namespace SchemaProgrammer {
|
|
223
220
|
TypeFactory.keyword("string"),
|
224
221
|
),
|
225
222
|
],
|
226
|
-
write(
|
223
|
+
write(components)(importer)(value),
|
227
224
|
),
|
228
225
|
writeComment(value),
|
229
226
|
);
|
@@ -237,10 +234,10 @@ export namespace SchemaProgrammer {
|
|
237
234
|
UNIONS
|
238
235
|
----------------------------------------------------------- */
|
239
236
|
const writeUnion =
|
240
|
-
(importer: ImportProgrammer) =>
|
241
237
|
(components: ISwaggerComponents) =>
|
238
|
+
(importer: ImportProgrammer) =>
|
242
239
|
(elements: ISwaggerSchema[]): ts.UnionTypeNode =>
|
243
|
-
ts.factory.createUnionTypeNode(elements.map(write(
|
240
|
+
ts.factory.createUnionTypeNode(elements.map(write(components)(importer)));
|
244
241
|
}
|
245
242
|
const createNode = (text: string) => ts.factory.createTypeReferenceNode(text);
|
246
243
|
const writeComment = (schema: ISwaggerSchema): string =>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
import { IJsDocTagInfo } from "typia/lib/schemas/metadata/IJsDocTagInfo";
|
2
|
-
|
3
1
|
import { ISwaggerSchema } from "./ISwaggeSchema";
|
4
2
|
|
5
3
|
export interface IMigrateRoute {
|
@@ -7,13 +5,14 @@ export interface IMigrateRoute {
|
|
7
5
|
path: string;
|
8
6
|
method: string;
|
9
7
|
parameters: IMigrateRoute.IParameter[];
|
10
|
-
headers:
|
11
|
-
query:
|
8
|
+
headers: IMigrateRoute.IHeaders | null;
|
9
|
+
query: IMigrateRoute.IQuery | null;
|
12
10
|
body: IMigrateRoute.IBody | null;
|
13
11
|
success: IMigrateRoute.IBody | null;
|
14
12
|
exceptions: Record<string, IMigrateRoute.IException>;
|
15
13
|
description?: string;
|
16
|
-
|
14
|
+
tags: string[];
|
15
|
+
deprecated: boolean;
|
17
16
|
}
|
18
17
|
export namespace IMigrateRoute {
|
19
18
|
export interface IParameter {
|
@@ -21,7 +20,16 @@ export namespace IMigrateRoute {
|
|
21
20
|
schema: ISwaggerSchema;
|
22
21
|
description?: string;
|
23
22
|
}
|
23
|
+
export interface IHeaders {
|
24
|
+
key: string;
|
25
|
+
schema: ISwaggerSchema;
|
26
|
+
}
|
27
|
+
export interface IQuery {
|
28
|
+
key: string;
|
29
|
+
schema: ISwaggerSchema;
|
30
|
+
}
|
24
31
|
export interface IBody {
|
32
|
+
key: string;
|
25
33
|
type:
|
26
34
|
| "text/plain"
|
27
35
|
| "application/json"
|
package/src/utils/SetupWizard.ts
CHANGED
@@ -3,9 +3,6 @@ import cp from "child_process";
|
|
3
3
|
export namespace SetupWizard {
|
4
4
|
export const setup = (output: string) => {
|
5
5
|
execute(output)("npm install");
|
6
|
-
execute(output)("npx nestia e2e", "npm run build:sdk");
|
7
|
-
execute(output)("npm run build:test");
|
8
|
-
execute(output)("npm run test");
|
9
6
|
};
|
10
7
|
|
11
8
|
const execute = (cwd: string) => (command: string, fake?: string) => {
|
package/src/utils/StringUtil.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import { NamingConvention } from "typia/lib/utils/NamingConvention";
|
2
|
+
|
1
3
|
export namespace StringUtil {
|
2
4
|
export const capitalize = (str: string) =>
|
3
5
|
str[0].toUpperCase() + str.slice(1).toLowerCase();
|
@@ -5,12 +7,14 @@ export namespace StringUtil {
|
|
5
7
|
export const pascal = (path: string) =>
|
6
8
|
splitWithNormalization(path)
|
7
9
|
.filter((str) => str[0] !== "{")
|
8
|
-
.map(
|
10
|
+
.map(NamingConvention.pascal)
|
9
11
|
.join("");
|
10
12
|
|
11
13
|
export const camel = (path: string) =>
|
12
14
|
splitWithNormalization(path)
|
13
|
-
.map((str, i) =>
|
15
|
+
.map((str, i) =>
|
16
|
+
i === 0 ? NamingConvention.camel(str) : NamingConvention.pascal(str),
|
17
|
+
)
|
14
18
|
.join("");
|
15
19
|
|
16
20
|
export const splitWithNormalization = (path: string) =>
|
@@ -48,4 +52,9 @@ export namespace StringUtil {
|
|
48
52
|
.filter((str) => str[0] !== "{" || str[str.length - 1] === "}")
|
49
53
|
.join("/");
|
50
54
|
};
|
55
|
+
|
56
|
+
export const escapeDuplicate =
|
57
|
+
(keep: string[]) =>
|
58
|
+
(change: string): string =>
|
59
|
+
keep.includes(change) ? escapeDuplicate(keep)(`_${change}`) : change;
|
51
60
|
}
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"RouteAnalyzer.js","sourceRoot":"","sources":["../../src/analyzers/RouteAnalyzer.ts"],"names":[],"mappings":""}
|
File without changes
|