nestia 2.1.10 → 2.1.13
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/IConfiguration.d.ts.map +1 -1
- package/lib/NestiaApplication.d.ts.map +1 -1
- package/lib/NestiaApplication.js +12 -10
- package/lib/analyses/ControllerAnalyzer.d.ts.map +1 -1
- package/lib/analyses/ControllerAnalyzer.js +11 -5
- package/lib/analyses/GenericAnalyzer.d.ts.map +1 -1
- package/lib/analyses/GenericAnalyzer.js +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts.map +1 -1
- package/lib/analyses/ImportAnalyzer.js +13 -4
- package/lib/analyses/ReflectAnalyzer.d.ts.map +1 -1
- package/lib/analyses/ReflectAnalyzer.js +19 -12
- package/lib/analyses/SourceFinder.d.ts.map +1 -1
- package/lib/executable/internal/CompilerOptions.d.ts.map +1 -1
- package/lib/executable/internal/CompilerOptions.js +3 -6
- package/lib/executable/internal/NestiaCommand.d.ts.map +1 -1
- package/lib/executable/internal/NestiaCommand.js +6 -6
- package/lib/executable/internal/NestiaConfig.d.ts.map +1 -1
- package/lib/executable/internal/NestiaConfig.js +6 -6
- package/lib/executable/nestia.js +0 -0
- package/lib/factories/TypeFactry.d.ts.map +1 -1
- package/lib/factories/TypeFactry.js +9 -4
- package/lib/generates/FileGenerator.d.ts.map +1 -1
- package/lib/generates/FileGenerator.js +27 -20
- package/lib/generates/FunctionGenerator.d.ts.map +1 -1
- package/lib/generates/FunctionGenerator.js +63 -48
- package/lib/generates/SdkGenerator.d.ts.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts.map +1 -1
- package/lib/generates/SwaggerGenerator.js +67 -72
- package/lib/structures/IController.d.ts.map +1 -1
- package/lib/structures/IMetadata.d.ts.map +1 -1
- package/lib/structures/IRoute.d.ts.map +1 -1
- package/lib/structures/ISwagger.d.ts +5 -0
- package/lib/structures/ISwagger.d.ts.map +1 -1
- package/lib/structures/IType.d.ts.map +1 -1
- package/lib/structures/MethodType.d.ts.map +1 -1
- package/lib/structures/MethodType.js +7 -1
- package/lib/structures/TypeEntry.d.ts.map +1 -1
- package/lib/structures/TypeEntry.js +3 -3
- package/lib/utils/ArrayUtil.d.ts.map +1 -1
- package/lib/utils/DirectoryUtil.d.ts.map +1 -1
- package/lib/utils/ImportDictionary.d.ts.map +1 -1
- package/lib/utils/ImportDictionary.js +4 -1
- package/lib/utils/MapUtil.d.ts.map +1 -1
- package/lib/utils/StringUtil.d.ts.map +1 -1
- package/package.json +9 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IConfiguration.d.ts","sourceRoot":"","sources":["../src/IConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,cAAc;
|
|
1
|
+
{"version":3,"file":"IConfiguration.d.ts","sourceRoot":"","sources":["../src/IConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC,MAAM,CAAC;IAEjD;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;IAErC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC;CACrC;AACD,yBAAiB,cAAc,CAAC;IAC5B;;;OAGG;IACH,UAAiB,MAAM;QACnB;;WAEG;QACH,OAAO,EAAE,MAAM,EAAE,CAAC;QAElB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB;IAED;;OAEG;IACH,UAAiB,QAAQ;QACrB;;;;;;WAMG;QACH,MAAM,EAAE,MAAM,CAAC;KAClB;CACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaApplication.d.ts","sourceRoot":"","sources":["../src/NestiaApplication.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,qBAAa,iBAAiB;
|
|
1
|
+
{"version":3,"file":"NestiaApplication.d.ts","sourceRoot":"","sources":["../src/NestiaApplication.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIlD,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IACzC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAE9B;gBAEiB,MAAM,EAAE,cAAc;IAmC5B,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAsBvB,QAAQ;IAuDtB,OAAO,CAAC,OAAO;YA0BD,eAAe;CAchC"}
|
package/lib/NestiaApplication.js
CHANGED
|
@@ -249,7 +249,7 @@ var NestiaApplication = /** @class */ (function () {
|
|
|
249
249
|
_f = [[]];
|
|
250
250
|
return [4 /*yield*/, ReflectAnalyzer_1.ReflectAnalyzer.analyze(unique, file)];
|
|
251
251
|
case 5:
|
|
252
|
-
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [_j.sent()]), false]))]));
|
|
252
|
+
_d.apply(_c, _e.concat([__spreadArray.apply(void 0, _f.concat([__read.apply(void 0, [(_j.sent())]), false]))]));
|
|
253
253
|
_j.label = 6;
|
|
254
254
|
case 6:
|
|
255
255
|
fileList_1_1 = fileList_1.next();
|
|
@@ -298,10 +298,13 @@ var NestiaApplication = /** @class */ (function () {
|
|
|
298
298
|
NestiaApplication.prototype.prepare = function () {
|
|
299
299
|
var _this = this;
|
|
300
300
|
// CONSTRUCT OPTIONS
|
|
301
|
-
var predicator = this.config_
|
|
302
|
-
|
|
301
|
+
var predicator = this.config_
|
|
302
|
+
.compilerOptions
|
|
303
|
+
? function () {
|
|
304
|
+
return CompilerOptions_1.CompilerOptions.emend(_this.config_.compilerOptions, !!_this.config_.assert);
|
|
305
|
+
}
|
|
303
306
|
: function () {
|
|
304
|
-
_this.config_.compilerOptions = CompilerOptions_1.CompilerOptions.DEFAULT_OPTIONS;
|
|
307
|
+
_this.config_.compilerOptions = (CompilerOptions_1.CompilerOptions.DEFAULT_OPTIONS);
|
|
305
308
|
return [false, false];
|
|
306
309
|
};
|
|
307
310
|
// MOUNT TS-NODE
|
|
@@ -310,9 +313,7 @@ var NestiaApplication = /** @class */ (function () {
|
|
|
310
313
|
emit: false,
|
|
311
314
|
compiler: transformed ? "ttypescript" : "typescript",
|
|
312
315
|
compilerOptions: this.config_.compilerOptions,
|
|
313
|
-
require: absoluted
|
|
314
|
-
? ["tsconfig-paths/register"]
|
|
315
|
-
: undefined
|
|
316
|
+
require: absoluted ? ["tsconfig-paths/register"] : undefined,
|
|
316
317
|
});
|
|
317
318
|
};
|
|
318
319
|
NestiaApplication.prototype.is_not_excluded = function (file) {
|
|
@@ -322,17 +323,18 @@ var NestiaApplication = /** @class */ (function () {
|
|
|
322
323
|
switch (_b.label) {
|
|
323
324
|
case 0:
|
|
324
325
|
if (!this.config_.output) return [3 /*break*/, 3];
|
|
325
|
-
_a = file.indexOf(path_1.default.join(this.config_.output, "functional")) ===
|
|
326
|
+
_a = file.indexOf(path_1.default.join(this.config_.output, "functional")) ===
|
|
327
|
+
-1;
|
|
326
328
|
if (!_a) return [3 /*break*/, 2];
|
|
327
329
|
return [4 /*yield*/, this.bundle_checker_.get()];
|
|
328
330
|
case 1:
|
|
329
331
|
_a = (_b.sent())(file) === false;
|
|
330
332
|
_b.label = 2;
|
|
331
|
-
case 2: return [2 /*return*/, _a];
|
|
333
|
+
case 2: return [2 /*return*/, (_a)];
|
|
332
334
|
case 3: return [4 /*yield*/, fs_1.default.promises.readFile(file, "utf8")];
|
|
333
335
|
case 4:
|
|
334
336
|
content = _b.sent();
|
|
335
|
-
return [2 /*return*/, content.indexOf(" * @nestia Generated by Nestia - https://github.com/samchon/nestia") === -1];
|
|
337
|
+
return [2 /*return*/, (content.indexOf(" * @nestia Generated by Nestia - https://github.com/samchon/nestia") === -1)];
|
|
336
338
|
}
|
|
337
339
|
});
|
|
338
340
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ControllerAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAM9C,yBAAiB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ControllerAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ControllerAnalyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAM9C,yBAAiB,kBAAkB,CAAC;IAChC,SAAgB,OAAO,CACnB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,UAAU,EAAE,WAAW,GACxB,MAAM,EAAE,CAcV;CA6KJ"}
|
|
@@ -63,7 +63,8 @@ var ControllerAnalyzer;
|
|
|
63
63
|
var ret = [];
|
|
64
64
|
typescript_1.default.forEachChild(sourceFile, function (node) {
|
|
65
65
|
var _a;
|
|
66
|
-
if (typescript_1.default.isClassDeclaration(node) &&
|
|
66
|
+
if (typescript_1.default.isClassDeclaration(node) &&
|
|
67
|
+
((_a = node.name) === null || _a === void 0 ? void 0 : _a.escapedText) === controller.name) {
|
|
67
68
|
// ANALYZE THE CONTROLLER
|
|
68
69
|
ret.push.apply(ret, __spreadArray([], __read(_Analyze_controller(checker, controller, node)), false));
|
|
69
70
|
return;
|
|
@@ -123,7 +124,9 @@ var ControllerAnalyzer;
|
|
|
123
124
|
throw new Error("Error on ControllerAnalyzer._Analyze_function(): unable to get the signature from the ".concat(controller.name, ".").concat(func.name, "()."));
|
|
124
125
|
var importDict = new HashMap_1.HashMap();
|
|
125
126
|
// EXPLORE CHILDREN TYPES
|
|
126
|
-
var parameters = func.parameters.map(function (param) {
|
|
127
|
+
var parameters = func.parameters.map(function (param) {
|
|
128
|
+
return _Analyze_parameter(checker, genericDict, importDict, controller, func.name, param, signature.getParameters()[param.index]);
|
|
129
|
+
});
|
|
127
130
|
var output = ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, signature.getReturnType());
|
|
128
131
|
var imports = importDict
|
|
129
132
|
.toJSON()
|
|
@@ -138,7 +141,9 @@ var ControllerAnalyzer;
|
|
|
138
141
|
try {
|
|
139
142
|
for (var _e = (e_3 = void 0, __values(func.paths)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
140
143
|
var filePath = _f.value;
|
|
141
|
-
var path = path_1.default.join(controllerPath, filePath)
|
|
144
|
+
var path = path_1.default.join(controllerPath, filePath)
|
|
145
|
+
.split("\\")
|
|
146
|
+
.join("/");
|
|
142
147
|
pathList.push(_Normalize_path(path));
|
|
143
148
|
}
|
|
144
149
|
}
|
|
@@ -175,14 +180,15 @@ var ControllerAnalyzer;
|
|
|
175
180
|
var type = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
|
|
176
181
|
var name = symbol.getEscapedName().toString();
|
|
177
182
|
// VALIDATE PARAMETERS
|
|
178
|
-
if ((param.category === "query" || param.category === "body") &&
|
|
183
|
+
if ((param.category === "query" || param.category === "body") &&
|
|
184
|
+
param.field !== undefined)
|
|
179
185
|
throw new Error("Error on ".concat(controller.name, ".").concat(funcName, "(): parameter ").concat(name, " is specifying a field ").concat(param.field, " of the request ").concat(param.category, " message, however, Nestia does not support the field specialization for the request ").concat(param.category, " message. Erase the ").concat(controller.name, ".").concat(funcName, "()#").concat(name, " parameter and re-define a new decorator accepting full structured message."));
|
|
180
186
|
return {
|
|
181
187
|
name: name,
|
|
182
188
|
category: param.category,
|
|
183
189
|
field: param.field,
|
|
184
190
|
encrypted: param.encrypted,
|
|
185
|
-
type: ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, type)
|
|
191
|
+
type: ImportAnalyzer_1.ImportAnalyzer.analyze(checker, genericDict, importDict, type),
|
|
186
192
|
};
|
|
187
193
|
}
|
|
188
194
|
})(ControllerAnalyzer = exports.ControllerAnalyzer || (exports.ControllerAnalyzer = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/GenericAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,yBAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"GenericAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/GenericAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,yBAAiB,eAAe,CAAC;IAC7B,KAAY,UAAU,GAAG,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAEnD,SAAgB,OAAO,CACnB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,SAAS,EAAE,EAAE,CAAC,gBAAgB,GAC/B,UAAU,CAIZ;CAwCJ"}
|
|
@@ -42,7 +42,7 @@ var GenericAnalyzer;
|
|
|
42
42
|
var parameters = superNode.typeParameters || [];
|
|
43
43
|
parameters.forEach(function (param, index) {
|
|
44
44
|
var paramType = checker.getTypeAtLocation(param);
|
|
45
|
-
var usageType =
|
|
45
|
+
var usageType = usages[index] !== undefined
|
|
46
46
|
? checker.getTypeAtLocation(usages[index])
|
|
47
47
|
: checker.getTypeAtLocation(param.default);
|
|
48
48
|
dict.set(paramType, usageType);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ImportAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,yBAAiB,cAAc,
|
|
1
|
+
{"version":3,"file":"ImportAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ImportAnalyzer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,yBAAiB,cAAc,CAAC;IAC5B,UAAiB,OAAO;QACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC/B,KAAK,EAAE,MAAM,CAAC;KACjB;IAED,KAAY,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAE1D,SAAgB,OAAO,CACnB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,WAAW,EAAE,eAAe,CAAC,UAAU,EACvC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,EAAE,CAAC,IAAI,GACd,KAAK,CAUP;CAqHJ"}
|
|
@@ -11,7 +11,7 @@ var ImportAnalyzer;
|
|
|
11
11
|
function analyze(checker, genericDict, importDict, type) {
|
|
12
12
|
return {
|
|
13
13
|
metadata: get_type(checker, type),
|
|
14
|
-
escapedText: explore_escaped_name(checker, genericDict, importDict, type)
|
|
14
|
+
escapedText: explore_escaped_name(checker, genericDict, importDict, type),
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
ImportAnalyzer.analyze = analyze;
|
|
@@ -48,9 +48,14 @@ var ImportAnalyzer;
|
|
|
48
48
|
if (symbol === undefined)
|
|
49
49
|
return checker.typeToString(type, undefined, undefined);
|
|
50
50
|
// UNION OR INTERSECT
|
|
51
|
-
else if (type.aliasSymbol === undefined &&
|
|
51
|
+
else if (type.aliasSymbol === undefined &&
|
|
52
|
+
type.isUnionOrIntersection()) {
|
|
52
53
|
var joiner = type.isIntersection() ? " & " : " | ";
|
|
53
|
-
return type.types
|
|
54
|
+
return type.types
|
|
55
|
+
.map(function (child) {
|
|
56
|
+
return explore_escaped_name(checker, genericDict, importDict, child);
|
|
57
|
+
})
|
|
58
|
+
.join(joiner);
|
|
54
59
|
}
|
|
55
60
|
//----
|
|
56
61
|
// SPECIALIZATION
|
|
@@ -66,7 +71,11 @@ var ImportAnalyzer;
|
|
|
66
71
|
return generic.length
|
|
67
72
|
? name === "Promise"
|
|
68
73
|
? explore_escaped_name(checker, genericDict, importDict, generic[0])
|
|
69
|
-
: "".concat(name, "<").concat(generic
|
|
74
|
+
: "".concat(name, "<").concat(generic
|
|
75
|
+
.map(function (child) {
|
|
76
|
+
return explore_escaped_name(checker, genericDict, importDict, child);
|
|
77
|
+
})
|
|
78
|
+
.join(", "), ">")
|
|
70
79
|
: name;
|
|
71
80
|
}
|
|
72
81
|
function explore_name(name, decl) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReflectAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ReflectAnalyzer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"ReflectAnalyzer.d.ts","sourceRoot":"","sources":["../../src/analyses/ReflectAnalyzer.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAOxD,yBAAiB,eAAe,CAAC;IAC7B,SAAsB,OAAO,CACzB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,EACpB,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,EAAE,CAAC,CAexB;CAkPJ"}
|
|
@@ -149,7 +149,8 @@ var ReflectAnalyzer;
|
|
|
149
149
|
// VALIDATIONS
|
|
150
150
|
//----
|
|
151
151
|
// MUST BE TYPE OF A CREATOR WHO HAS THE CONSTRUCTOR
|
|
152
|
-
if (!(creator instanceof Function &&
|
|
152
|
+
if (!(creator instanceof Function &&
|
|
153
|
+
creator.constructor instanceof Function))
|
|
153
154
|
return null;
|
|
154
155
|
// MUST HAVE THOSE MATADATA
|
|
155
156
|
else if (ArrayUtil_1.ArrayUtil.has(Reflect.getMetadataKeys(creator), "path", "host", "scope:options") === false)
|
|
@@ -163,13 +164,14 @@ var ReflectAnalyzer;
|
|
|
163
164
|
file: file,
|
|
164
165
|
name: name,
|
|
165
166
|
paths: paths,
|
|
166
|
-
functions: []
|
|
167
|
+
functions: [],
|
|
167
168
|
};
|
|
168
169
|
try {
|
|
169
170
|
// PARSE CHILDREN DATA
|
|
170
171
|
for (var _b = __values(_Get_prototype_entries(creator)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
171
172
|
var tuple = _c.value;
|
|
172
|
-
var child = _Analyze_function.apply(void 0, __spreadArray([creator.prototype,
|
|
173
|
+
var child = _Analyze_function.apply(void 0, __spreadArray([creator.prototype,
|
|
174
|
+
meta], __read(tuple), false));
|
|
173
175
|
if (child !== null)
|
|
174
176
|
meta.functions.push(child);
|
|
175
177
|
}
|
|
@@ -186,7 +188,10 @@ var ReflectAnalyzer;
|
|
|
186
188
|
}
|
|
187
189
|
function _Get_prototype_entries(creator) {
|
|
188
190
|
var keyList = Object.getOwnPropertyNames(creator.prototype);
|
|
189
|
-
var entries = keyList.map(function (key) { return [
|
|
191
|
+
var entries = keyList.map(function (key) { return [
|
|
192
|
+
key,
|
|
193
|
+
creator.prototype[key],
|
|
194
|
+
]; });
|
|
190
195
|
var parent = Object.getPrototypeOf(creator);
|
|
191
196
|
if (parent.prototype !== undefined)
|
|
192
197
|
entries.push.apply(entries, __spreadArray([], __read(_Get_prototype_entries(parent)), false));
|
|
@@ -213,7 +218,8 @@ var ReflectAnalyzer;
|
|
|
213
218
|
if (!(proto instanceof Function))
|
|
214
219
|
return null;
|
|
215
220
|
// MUST HAVE THOSE METADATE
|
|
216
|
-
else if (ArrayUtil_1.ArrayUtil.has(Reflect.getMetadataKeys(proto), "path", "method") ===
|
|
221
|
+
else if (ArrayUtil_1.ArrayUtil.has(Reflect.getMetadataKeys(proto), "path", "method") ===
|
|
222
|
+
false)
|
|
217
223
|
return null;
|
|
218
224
|
//----
|
|
219
225
|
// CONSTRUCTION
|
|
@@ -224,8 +230,8 @@ var ReflectAnalyzer;
|
|
|
224
230
|
method: METHODS[Reflect.getMetadata("method", proto)],
|
|
225
231
|
paths: _Get_paths(Reflect.getMetadata("path", proto)),
|
|
226
232
|
parameters: [],
|
|
227
|
-
encrypted: Reflect.hasMetadata("__interceptors__", proto)
|
|
228
|
-
|
|
233
|
+
encrypted: Reflect.hasMetadata("__interceptors__", proto) &&
|
|
234
|
+
((_e = (_d = Reflect.getMetadata("__interceptors__", proto)[0]) === null || _d === void 0 ? void 0 : _d.constructor) === null || _e === void 0 ? void 0 : _e.name) === "EncryptedRouteInterceptor",
|
|
229
235
|
};
|
|
230
236
|
// PARSE CHILDREN DATA
|
|
231
237
|
var nestParameters = Reflect.getMetadata("__routeArguments__", classProto.constructor, name);
|
|
@@ -305,19 +311,20 @@ var ReflectAnalyzer;
|
|
|
305
311
|
category: type,
|
|
306
312
|
index: param.index,
|
|
307
313
|
field: param.data,
|
|
308
|
-
encrypted: false
|
|
314
|
+
encrypted: false,
|
|
309
315
|
};
|
|
310
316
|
}
|
|
311
317
|
function _Analyze_custom_parameter(param) {
|
|
312
318
|
if (param.factory === undefined)
|
|
313
319
|
return null;
|
|
314
|
-
else if (param.factory.name === "EncryptedBody" ||
|
|
320
|
+
else if (param.factory.name === "EncryptedBody" ||
|
|
321
|
+
param.factory.name === "PlainBody") {
|
|
315
322
|
return {
|
|
316
323
|
category: "body",
|
|
317
324
|
index: param.index,
|
|
318
325
|
name: param.name,
|
|
319
326
|
field: param.data,
|
|
320
|
-
encrypted: param.factory.name === "EncryptedBody"
|
|
327
|
+
encrypted: param.factory.name === "EncryptedBody",
|
|
321
328
|
};
|
|
322
329
|
}
|
|
323
330
|
else if (param.factory.name === "TypedParam")
|
|
@@ -326,7 +333,7 @@ var ReflectAnalyzer;
|
|
|
326
333
|
category: "param",
|
|
327
334
|
index: param.index,
|
|
328
335
|
field: param.data,
|
|
329
|
-
encrypted: false
|
|
336
|
+
encrypted: false,
|
|
330
337
|
};
|
|
331
338
|
else
|
|
332
339
|
return null;
|
|
@@ -343,7 +350,7 @@ var ReflectAnalyzer;
|
|
|
343
350
|
undefined,
|
|
344
351
|
undefined,
|
|
345
352
|
undefined,
|
|
346
|
-
undefined
|
|
353
|
+
undefined,
|
|
347
354
|
];
|
|
348
355
|
})(ReflectAnalyzer = exports.ReflectAnalyzer || (exports.ReflectAnalyzer = {}));
|
|
349
356
|
//# sourceMappingURL=ReflectAnalyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFinder.d.ts","sourceRoot":"","sources":["../../src/analyses/SourceFinder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,yBAAiB,YAAY,
|
|
1
|
+
{"version":3,"file":"SourceFinder.d.ts","sourceRoot":"","sources":["../../src/analyses/SourceFinder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,yBAAiB,YAAY,CAAC;IAC1B,SAAsB,IAAI,CACtB,KAAK,EAAE,cAAc,CAAC,MAAM,GAC7B,OAAO,CAAC,MAAM,EAAE,CAAC,CAOnB;CA0CJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompilerOptions.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/CompilerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,yBAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"CompilerOptions.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/CompilerOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,yBAAiB,eAAe,CAAC;IAYtB,MAAM,eAAe;;;;;;;;KAI3B,CAAC;IAEF,SAAgB,KAAK,CACjB,OAAO,EAAE,EAAE,CAAC,eAAe,EAC3B,MAAM,EAAE,OAAO,GAChB,CAAC,OAAO,EAAE,OAAO,CAAC,CAmCpB;CAUJ"}
|
|
@@ -46,14 +46,11 @@ var CompilerOptions;
|
|
|
46
46
|
DEFAULT VALUES
|
|
47
47
|
----------------------------------------------------------- */
|
|
48
48
|
var ESSENTIAL_OPTIONS = {
|
|
49
|
-
types: [
|
|
50
|
-
"node",
|
|
51
|
-
"reflect-metadata"
|
|
52
|
-
],
|
|
49
|
+
types: ["node", "reflect-metadata"],
|
|
53
50
|
noEmit: true,
|
|
54
51
|
esModuleInterop: true,
|
|
55
52
|
experimentalDecorators: true,
|
|
56
|
-
emitDecoratorMetadata: true
|
|
53
|
+
emitDecoratorMetadata: true,
|
|
57
54
|
};
|
|
58
55
|
CompilerOptions.DEFAULT_OPTIONS = __assign(__assign({}, ESSENTIAL_OPTIONS), { target: "es5", module: "commonjs" });
|
|
59
56
|
function emend(options, assert) {
|
|
@@ -93,7 +90,7 @@ var CompilerOptions;
|
|
|
93
90
|
};
|
|
94
91
|
if (assert === true)
|
|
95
92
|
emplace({
|
|
96
|
-
transform: "typescript-is/lib/transform-inline/transformer"
|
|
93
|
+
transform: "typescript-is/lib/transform-inline/transformer",
|
|
97
94
|
});
|
|
98
95
|
if (options.paths && Object.entries(options.paths).length !== 0)
|
|
99
96
|
emplace({ transform: "typescript-transform-paths" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaCommand.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/NestiaCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NestiaCommand.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/NestiaCommand.ts"],"names":[],"mappings":"AAqBA,yBAAiB,aAAa,CAAC;IAC3B,SAAgB,GAAG,CACf,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,GAAE,OAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAWf;IAED,SAAgB,OAAO,CACnB,QAAQ,EAAE,MAAM,EAAE,EAClB,IAAI,GAAE,OAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAef;CAgGJ"}
|
|
@@ -97,7 +97,7 @@ var NestiaCommand;
|
|
|
97
97
|
function sdk(elements, pure) {
|
|
98
98
|
if (pure === void 0) { pure = true; }
|
|
99
99
|
return main(function (app) { return app.sdk(); }, {
|
|
100
|
-
assign: function (config, output) { return config.output = output; },
|
|
100
|
+
assign: function (config, output) { return (config.output = output); },
|
|
101
101
|
validate: function (config) { return !!config.output; },
|
|
102
102
|
location: function (config) { return config.output; },
|
|
103
103
|
}, elements, pure);
|
|
@@ -112,7 +112,9 @@ var NestiaCommand;
|
|
|
112
112
|
else
|
|
113
113
|
config.swagger.output = output;
|
|
114
114
|
},
|
|
115
|
-
validate: function (config) {
|
|
115
|
+
validate: function (config) {
|
|
116
|
+
return !!config.swagger && !!config.swagger.output;
|
|
117
|
+
},
|
|
116
118
|
location: function (config) { return config.swagger.output; },
|
|
117
119
|
}, elements, pure);
|
|
118
120
|
}
|
|
@@ -166,7 +168,7 @@ var NestiaCommand;
|
|
|
166
168
|
switch (_b.label) {
|
|
167
169
|
case 0: return [4 /*yield*/, get_nestia_config(output.validate)];
|
|
168
170
|
case 1:
|
|
169
|
-
config = (_a = _b.sent()) !== null && _a !== void 0 ? _a : parse_cli(include, command, output);
|
|
171
|
+
config = (_a = (_b.sent())) !== null && _a !== void 0 ? _a : parse_cli(include, command, output);
|
|
170
172
|
if (!(fs_1.default.existsSync("tsconfig.json") === true)) return [3 /*break*/, 3];
|
|
171
173
|
return [4 /*yield*/, fs_1.default.promises.readFile("tsconfig.json", "utf8")];
|
|
172
174
|
case 2:
|
|
@@ -216,9 +218,7 @@ var NestiaCommand;
|
|
|
216
218
|
var config = {
|
|
217
219
|
input: {
|
|
218
220
|
include: include,
|
|
219
|
-
exclude: command.exclude
|
|
220
|
-
? [command.exclude]
|
|
221
|
-
: undefined
|
|
221
|
+
exclude: command.exclude ? [command.exclude] : undefined,
|
|
222
222
|
},
|
|
223
223
|
};
|
|
224
224
|
output.assign(config, command.out);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestiaConfig.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/NestiaConfig.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,yBAAiB,YAAY,
|
|
1
|
+
{"version":3,"file":"NestiaConfig.d.ts","sourceRoot":"","sources":["../../../src/executable/internal/NestiaConfig.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,yBAAiB,YAAY,CAAC;IAC1B,SAAgB,GAAG,IAAI,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAEpD;CAuCJ"}
|
|
@@ -209,8 +209,8 @@ var NestiaConfig;
|
|
|
209
209
|
if ((0, typescript_is_1.is)(config.input, function (object) { function _string(object) { ; if (typeof object !== "string")
|
|
210
210
|
return {};
|
|
211
211
|
else
|
|
212
|
-
return null; } return _string(object); }) === false
|
|
213
|
-
|
|
212
|
+
return null; } return _string(object); }) === false &&
|
|
213
|
+
(0, typescript_is_1.is)(config.input, function (object) { function _string(object) { ; if (typeof object !== "string")
|
|
214
214
|
return {};
|
|
215
215
|
else
|
|
216
216
|
return null; } function sa__string_ea_2(object) { ; if (!Array.isArray(object))
|
|
@@ -218,8 +218,8 @@ var NestiaConfig;
|
|
|
218
218
|
var error = _string(object[i]);
|
|
219
219
|
if (error)
|
|
220
220
|
return error;
|
|
221
|
-
} return null; } return sa__string_ea_2(object); }) === false
|
|
222
|
-
|
|
221
|
+
} return null; } return sa__string_ea_2(object); }) === false &&
|
|
222
|
+
(0, typescript_is_1.is)(config.input, function (object) { function _string(object) { ; if (typeof object !== "string")
|
|
223
223
|
return {};
|
|
224
224
|
else
|
|
225
225
|
return null; } function sa__string_ea_3(object) { ; if (!Array.isArray(object))
|
|
@@ -256,8 +256,8 @@ var NestiaConfig;
|
|
|
256
256
|
runner.register({
|
|
257
257
|
emit: false,
|
|
258
258
|
compilerOptions: {
|
|
259
|
-
noEmit: true
|
|
260
|
-
}
|
|
259
|
+
noEmit: true,
|
|
260
|
+
},
|
|
261
261
|
});
|
|
262
262
|
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require(path_1.default.resolve("nestia.config.ts"))); })];
|
|
263
263
|
case 1:
|
package/lib/executable/nestia.js
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeFactry.d.ts","sourceRoot":"","sources":["../../src/factories/TypeFactry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,yBAAiB,WAAW,
|
|
1
|
+
{"version":3,"file":"TypeFactry.d.ts","sourceRoot":"","sources":["../../src/factories/TypeFactry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,yBAAiB,WAAW,CAAC;IACzB,SAAgB,MAAM,CAClB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,IAAI,EAAE,EAAE,CAAC,IAAI,GACd,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAOpB;IAED,SAAgB,WAAW,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,OAAO,CAElD;IAmCD,SAAgB,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,MAAM,CAiCxE;CAiBJ"}
|
|
@@ -19,7 +19,7 @@ var TypeFactory;
|
|
|
19
19
|
function get_function(node) {
|
|
20
20
|
return typescript_1.default.isFunctionLike(node)
|
|
21
21
|
? node
|
|
22
|
-
:
|
|
22
|
+
: typescript_1.default.isPropertyAssignment(node) || typescript_1.default.isPropertyDeclaration(node)
|
|
23
23
|
? typescript_1.default.isFunctionLike(node.initializer)
|
|
24
24
|
? node.initializer
|
|
25
25
|
: null
|
|
@@ -47,9 +47,12 @@ var TypeFactory;
|
|
|
47
47
|
if (symbol === undefined)
|
|
48
48
|
return checker.typeToString(type, undefined, undefined);
|
|
49
49
|
// UNION OR INTERSECT
|
|
50
|
-
else if (type.aliasSymbol === undefined &&
|
|
50
|
+
else if (type.aliasSymbol === undefined &&
|
|
51
|
+
type.isUnionOrIntersection()) {
|
|
51
52
|
var joiner = type.isIntersection() ? " & " : " | ";
|
|
52
|
-
return type.types
|
|
53
|
+
return type.types
|
|
54
|
+
.map(function (child) { return full_name(checker, child); })
|
|
55
|
+
.join(joiner);
|
|
53
56
|
}
|
|
54
57
|
//----
|
|
55
58
|
// SPECIALIZATION
|
|
@@ -60,7 +63,9 @@ var TypeFactory;
|
|
|
60
63
|
return generic.length
|
|
61
64
|
? name === "Promise"
|
|
62
65
|
? full_name(checker, generic[0])
|
|
63
|
-
: "".concat(name, "<").concat(generic
|
|
66
|
+
: "".concat(name, "<").concat(generic
|
|
67
|
+
.map(function (child) { return full_name(checker, child); })
|
|
68
|
+
.join(", "), ">")
|
|
64
69
|
: name;
|
|
65
70
|
}
|
|
66
71
|
TypeFactory.full_name = full_name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/FileGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,yBAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"FileGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/FileGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAI9C,yBAAiB,aAAa,CAAC;IAI3B,SAAsB,QAAQ,CAC1B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAUf;CAkHJ"}
|
|
@@ -148,10 +148,10 @@ var FileGenerator;
|
|
|
148
148
|
}
|
|
149
149
|
function relocate(directory) {
|
|
150
150
|
var e_3, _a;
|
|
151
|
-
if (directory.parent !== null
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
if (directory.parent !== null &&
|
|
152
|
+
directory.directories.empty() &&
|
|
153
|
+
directory.routes.length === 1 &&
|
|
154
|
+
directory.name === directory.routes[0].name) {
|
|
155
155
|
directory.parent.routes.push(directory.routes[0]);
|
|
156
156
|
directory.parent.directories.erase(directory.name);
|
|
157
157
|
}
|
|
@@ -254,12 +254,18 @@ var FileGenerator;
|
|
|
254
254
|
});
|
|
255
255
|
// FINALIZE THE CONTENT
|
|
256
256
|
if (directory.routes.length !== 0) {
|
|
257
|
-
primitived = directory.routes.some(function (route) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
257
|
+
primitived = directory.routes.some(function (route) {
|
|
258
|
+
return route.output.escapedText !== "void" ||
|
|
259
|
+
route.parameters.some(function (param) { return param.category !== "param"; });
|
|
260
|
+
});
|
|
261
|
+
asserted = config.assert === true &&
|
|
262
|
+
directory.routes.some(function (route) { return route.parameters.length !== 0; });
|
|
263
|
+
json = config.json === true &&
|
|
264
|
+
directory.routes.some(function (route) {
|
|
265
|
+
return route.method === "POST" ||
|
|
266
|
+
route.method === "PUT" ||
|
|
267
|
+
route.method === "PATCH";
|
|
268
|
+
});
|
|
263
269
|
fetcher = ["Fetcher"];
|
|
264
270
|
if (primitived)
|
|
265
271
|
fetcher.push("Primitive");
|
|
@@ -275,13 +281,13 @@ var FileGenerator;
|
|
|
275
281
|
head.push("", importDict.toScript(outDir));
|
|
276
282
|
content.push.apply(content, __spreadArray(__spreadArray(__spreadArray([], __read(head), false), [""], false), __read(content.splice(0, content.length)), false));
|
|
277
283
|
}
|
|
278
|
-
script = "/**\n"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
284
|
+
script = "/**\n" +
|
|
285
|
+
" * @packageDocumentation\n" +
|
|
286
|
+
" * @module ".concat(directory.module, "\n") +
|
|
287
|
+
" * @nestia Generated by Nestia - https://github.com/samchon/nestia \n" +
|
|
288
|
+
" */\n" +
|
|
289
|
+
"//================================================================\n" +
|
|
290
|
+
content.join("\n");
|
|
285
291
|
return [4 /*yield*/, fs_1.default.promises.writeFile("".concat(outDir, "/index.ts"), script, "utf8")];
|
|
286
292
|
case 12:
|
|
287
293
|
_e.sent();
|
|
@@ -297,9 +303,10 @@ var Directory = /** @class */ (function () {
|
|
|
297
303
|
this.name = name;
|
|
298
304
|
this.directories = new HashMap_1.HashMap();
|
|
299
305
|
this.routes = [];
|
|
300
|
-
this.module =
|
|
301
|
-
|
|
302
|
-
|
|
306
|
+
this.module =
|
|
307
|
+
this.parent !== null
|
|
308
|
+
? "".concat(this.parent.module, ".").concat(name)
|
|
309
|
+
: "api.".concat(name);
|
|
303
310
|
}
|
|
304
311
|
return Directory;
|
|
305
312
|
}());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/FunctionGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,yBAAiB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"FunctionGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/FunctionGenerator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,yBAAiB,iBAAiB,CAAC;IAC/B,SAAgB,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAYtE;CAkOJ"}
|