nestia 2.1.5 → 2.1.8
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/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Automatic `SDK` and `Swagger` generator for the `NestJS`, evolved than ever.
|
|
|
8
8
|
[](https://github.com/samchon/nestia/wiki)
|
|
9
9
|
|
|
10
10
|
- Github: https://github.com/samchon/nestia
|
|
11
|
-
- NPM: https://www.npmjs.com/
|
|
11
|
+
- NPM: https://www.npmjs.com/package/nestia
|
|
12
12
|
- Guide Documents: https://github.com/samchon/nestia/wiki
|
|
13
13
|
|
|
14
14
|
`nestia` is an evolved `SDK` and `Swagger` generator, which analyzes your `NestJS` server code in the compilation level. With `nestia` and compilation level analyzer, you don't need to write any swagger or class-validator decorators. All you need to do is use the `nestia` CLI as shown below.
|
package/lib/executable/nestia.js
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwaggerGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/SwaggerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"SwaggerGenerator.d.ts","sourceRoot":"","sources":["../../src/generates/SwaggerGenerator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAS5B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAM9C,yBAAiB,gBAAgB,CACjC;IACI,SAAsB,QAAQ,CAEtB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,MAAM,EAAE,cAAc,CAAC,QAAQ,EAC/B,SAAS,EAAE,MAAM,EAAE,GACpB,OAAO,CAAC,IAAI,CAAC,CAsCnB;CAgOJ"}
|
|
@@ -80,11 +80,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
80
80
|
exports.SwaggerGenerator = void 0;
|
|
81
81
|
var fs_1 = __importDefault(require("fs"));
|
|
82
82
|
var path_1 = __importDefault(require("path"));
|
|
83
|
+
var VariadicSingleton_1 = require("tstl/thread/VariadicSingleton");
|
|
83
84
|
var CommentFactory_1 = require("typescript-json/lib/factories/CommentFactory");
|
|
84
|
-
var MetadataCollection_1 = require("typescript-json/lib/
|
|
85
|
+
var MetadataCollection_1 = require("typescript-json/lib/storages/MetadataCollection");
|
|
85
86
|
var MetadataFactory_1 = require("typescript-json/lib/factories/MetadataFactory");
|
|
86
87
|
var SchemaFactory_1 = require("typescript-json/lib/factories/SchemaFactory");
|
|
87
88
|
var MapUtil_1 = require("../utils/MapUtil");
|
|
89
|
+
var Singleton_1 = require("tstl/thread/Singleton");
|
|
88
90
|
var SwaggerGenerator;
|
|
89
91
|
(function (SwaggerGenerator) {
|
|
90
92
|
function generate(checker, config, routeList) {
|
|
@@ -210,8 +212,7 @@ var SwaggerGenerator;
|
|
|
210
212
|
|| !!route.parameters.find(function (param) { return param.encrypted === true; });
|
|
211
213
|
return {
|
|
212
214
|
tags: tags,
|
|
213
|
-
|
|
214
|
-
summary: encrypted ? "encrypted" : undefined,
|
|
215
|
+
summary: encrypted ? "encrypted</font>" : undefined,
|
|
215
216
|
parameters: route.parameters
|
|
216
217
|
.filter(function (param) { return param.category !== "body"; })
|
|
217
218
|
.map(function (param) { return generate_parameter(checker, collection, route, param); }),
|
|
@@ -238,7 +239,8 @@ var SwaggerGenerator;
|
|
|
238
239
|
}
|
|
239
240
|
function generate_request_body(checker, collection, route, parameter) {
|
|
240
241
|
return {
|
|
241
|
-
description:
|
|
242
|
+
description: warning.get(parameter.encrypted).get("request")
|
|
243
|
+
+ (get_parametric_description(route, "param", parameter.name) || ""),
|
|
242
244
|
content: {
|
|
243
245
|
"application/json": {
|
|
244
246
|
schema: generate_schema(checker, collection, parameter.type.metadata)
|
|
@@ -256,9 +258,10 @@ var SwaggerGenerator;
|
|
|
256
258
|
var schema = generate_schema(checker, collection, route.output.metadata);
|
|
257
259
|
var success = (_a = {},
|
|
258
260
|
_a[status] = {
|
|
259
|
-
description:
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
description: warning.get(route.encrypted).get("response", route.method)
|
|
262
|
+
+ (get_parametric_description(route, "return")
|
|
263
|
+
|| get_parametric_description(route, "returns")
|
|
264
|
+
|| ""),
|
|
262
265
|
content: route.output.escapedText === "void" ? undefined :
|
|
263
266
|
{
|
|
264
267
|
"application/json": {
|
|
@@ -312,4 +315,17 @@ var SwaggerGenerator;
|
|
|
312
315
|
: undefined;
|
|
313
316
|
}
|
|
314
317
|
})(SwaggerGenerator = exports.SwaggerGenerator || (exports.SwaggerGenerator = {}));
|
|
318
|
+
var warning = new VariadicSingleton_1.VariadicSingleton(function (encrypted) {
|
|
319
|
+
if (encrypted === false)
|
|
320
|
+
return new Singleton_1.Singleton(function () { return ""; });
|
|
321
|
+
return new VariadicSingleton_1.VariadicSingleton(function (type, method) {
|
|
322
|
+
var summary = type === "request"
|
|
323
|
+
? "Request body must be encrypted."
|
|
324
|
+
: "Response data have been encrypted.";
|
|
325
|
+
var component = type === "request"
|
|
326
|
+
? "[EncryptedBody](https://github.com/samchon/nestia-helper#encryptedbody)"
|
|
327
|
+
: "[EncryptedRoute.".concat(method[0].toUpperCase(), ".").concat(method.substring(1).toLowerCase(), "](https://github.com/samchon/nestia-helper#encryptedroute)");
|
|
328
|
+
return "## Warning\n".concat(summary, "\n\nThe ").concat(type, " body data would be encrypted as \"AES-128(256) / CBC mode / PKCS#5 Padding / Base64 Encoding\", through the ").concat(component, " component.\n\nTherefore, just utilize this swagger editor only for referencing. If you need to call the real API, using [SDK](https://github.com/samchon/nestia#software-development-kit) would be much better.\n\n-----------------\n\n");
|
|
329
|
+
});
|
|
330
|
+
});
|
|
315
331
|
//# sourceMappingURL=SwaggerGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISwagger.d.ts","sourceRoot":"","sources":["../../src/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,CAAC;QACzB,SAAS,EAAE,aAAa,CAAC;QACzB,WAAW,CAAC,EAAE,YAAY,CAAC;QAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;KACpB;IAED,UAAiB,KAAK;QAElB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACjB;IACD,UAAiB,UAAU;QAEvB,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,WAAW,CAAC;QACpB,QAAQ,EAAE,IAAI,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACvB;IACD,UAAiB,YAAY;QAEzB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,YAAY,CAAC;QACtB,QAAQ,EAAE,IAAI,CAAC;KAClB;IACD,KAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EACzC;QACI,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,YAAY,CAAC;KAC1B,CAAC,CAAC;IAEH,UAAiB,YAAY;QAEzB,kBAAkB,EAAE;YAChB,MAAM,EAAE,WAAW,CAAC;SACvB,CAAC;KACL;CAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestia",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "Automatic SDK and Document generator for the NestJS",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"tsconfig-paths": "^3.14.1",
|
|
42
42
|
"tstl": "^2.5.6",
|
|
43
43
|
"ttypescript": "^1.5.13",
|
|
44
|
-
"typescript": "^4.
|
|
44
|
+
"typescript": "^4.7.2",
|
|
45
45
|
"typescript-is": "^0.19.0",
|
|
46
|
-
"typescript-json": "^2.1.
|
|
46
|
+
"typescript-json": "^2.1.3",
|
|
47
47
|
"typescript-transform-paths": "^3.3.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/glob": "^7.2.0",
|
|
52
52
|
"@types/node": "^17.0.23",
|
|
53
53
|
"@types/reflect-metadata": "^0.1.0",
|
|
54
|
-
"nestia-helper": "^2.
|
|
54
|
+
"nestia-helper": "^2.1.1",
|
|
55
55
|
"rimraf": "^3.0.2"
|
|
56
56
|
}
|
|
57
57
|
}
|