@nestia/core 1.3.6 → 1.3.7
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/decorators/DynamicModule.d.ts +26 -26
- package/lib/decorators/DynamicModule.js +103 -103
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.d.ts +23 -23
- package/lib/decorators/EncryptedBody.js +128 -128
- package/lib/decorators/EncryptedController.d.ts +26 -26
- package/lib/decorators/EncryptedController.js +36 -36
- package/lib/decorators/EncryptedModule.d.ts +52 -52
- package/lib/decorators/EncryptedModule.js +161 -161
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.d.ts +78 -78
- package/lib/decorators/EncryptedRoute.js +209 -209
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/PlainBody.d.ts +22 -22
- package/lib/decorators/PlainBody.js +82 -82
- package/lib/decorators/TypedBody.d.ts +16 -16
- package/lib/decorators/TypedBody.js +45 -45
- package/lib/decorators/TypedParam.d.ts +31 -31
- package/lib/decorators/TypedParam.js +76 -76
- package/lib/decorators/TypedQuery.d.ts +14 -14
- package/lib/decorators/TypedQuery.js +109 -109
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.d.ts +72 -72
- package/lib/decorators/TypedRoute.js +185 -185
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/internal/EncryptedConstant.d.ts +1 -1
- package/lib/decorators/internal/EncryptedConstant.js +7 -7
- package/lib/decorators/internal/TransformError.d.ts +1 -1
- package/lib/decorators/internal/TransformError.js +10 -10
- package/lib/decorators/internal/get_path_and_stringify.d.ts +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +83 -83
- package/lib/decorators/internal/get_text_body.d.ts +3 -3
- package/lib/decorators/internal/get_text_body.js +62 -62
- package/lib/decorators/internal/headers_to_object.d.ts +3 -3
- package/lib/decorators/internal/headers_to_object.js +49 -49
- package/lib/decorators/internal/load_controller.d.ts +5 -5
- package/lib/decorators/internal/load_controller.js +151 -152
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/route_error.d.ts +3 -3
- package/lib/decorators/internal/route_error.js +88 -88
- package/lib/decorators/internal/validate_request_body.d.ts +3 -3
- package/lib/decorators/internal/validate_request_body.js +66 -66
- package/lib/index.d.ts +3 -3
- package/lib/index.js +31 -31
- package/lib/module.d.ts +12 -12
- package/lib/module.js +28 -28
- package/lib/options/INestiaTransformOptions.d.ts +4 -4
- package/lib/options/INestiaTransformOptions.js +2 -2
- package/lib/options/INestiaTransformProject.d.ts +5 -5
- package/lib/options/INestiaTransformProject.js +2 -2
- package/lib/options/IRequestBodyValidator.d.ts +16 -16
- package/lib/options/IRequestBodyValidator.js +2 -2
- package/lib/options/IResponseBodyStringifier.d.ts +20 -20
- package/lib/options/IResponseBodyStringifier.js +2 -2
- package/lib/programmers/TypedBodyProgrammer.d.ts +5 -5
- package/lib/programmers/TypedBodyProgrammer.js +58 -58
- package/lib/programmers/TypedBodyProgrammer.js.map +1 -1
- package/lib/programmers/TypedParamProgrammer.d.ts +5 -5
- package/lib/programmers/TypedParamProgrammer.js +110 -110
- package/lib/programmers/TypedParamProgrammer.js.map +1 -1
- package/lib/programmers/TypedQueryProgrammer.d.ts +5 -5
- package/lib/programmers/TypedQueryProgrammer.js +264 -264
- package/lib/programmers/TypedQueryProgrammer.js.map +1 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +5 -5
- package/lib/programmers/TypedRouteProgrammer.js +49 -49
- package/lib/programmers/TypedRouteProgrammer.js.map +1 -1
- package/lib/transform.d.ts +4 -4
- package/lib/transform.js +25 -25
- package/lib/transformers/FileTransformer.d.ts +5 -5
- package/lib/transformers/FileTransformer.js +40 -40
- package/lib/transformers/FileTransformer.js.map +1 -1
- package/lib/transformers/MethodDecoratorTransformer.d.ts +5 -5
- package/lib/transformers/MethodDecoratorTransformer.js +92 -92
- package/lib/transformers/MethodDecoratorTransformer.js.map +1 -1
- package/lib/transformers/MethodTransformer.d.ts +5 -5
- package/lib/transformers/MethodTransformer.js +62 -62
- package/lib/transformers/MethodTransformer.js.map +1 -1
- package/lib/transformers/NodeTransformer.d.ts +5 -5
- package/lib/transformers/NodeTransformer.js +21 -21
- package/lib/transformers/NodeTransformer.js.map +1 -1
- package/lib/transformers/ParameterDecoratorTransformer.d.ts +5 -5
- package/lib/transformers/ParameterDecoratorTransformer.js +68 -68
- package/lib/transformers/ParameterDecoratorTransformer.js.map +1 -1
- package/lib/transformers/ParameterTransformer.d.ts +5 -5
- package/lib/transformers/ParameterTransformer.js +34 -34
- package/lib/transformers/ParameterTransformer.js.map +1 -1
- package/lib/typings/Creator.d.ts +3 -3
- package/lib/typings/Creator.js +2 -2
- package/lib/utils/ExceptionManager.d.ts +64 -64
- package/lib/utils/ExceptionManager.js +112 -112
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/Singleton.d.ts +1 -1
- package/lib/utils/Singleton.js +23 -23
- package/lib/utils/SourceFinder.d.ts +9 -9
- package/lib/utils/SourceFinder.js +238 -238
- package/lib/utils/SourceFinder.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MethodTransformer.js","sourceRoot":"","sources":["../../src/transformers/MethodTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAG5B,2EAA0E;AAE1E,IAAiB,iBAAiB,CAwDjC;AAxDD,WAAiB,iBAAiB;IACjB,2BAAS,GAClB,UAAC,OAAgC;QACjC,OAAA,UAAC,MAA4B;YACzB,IAAM,UAAU,GACZ,oBAAE,CAAC,aAAa;gBACZ,CAAC,CAAC,oBAAE,CAAC,aAAa,CAAC,MAAM,CAAC;gBAC1B,CAAC,CAAE,MAAc,CAAC,UAAU,CAAC;YACrC,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA;gBAAE,OAAO,MAAM,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KAAK,CAAC;YACpB,MAAM,IAAI,KAAK,CACX,0DAA0D,CAC7D,CAAC;QACN,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;AATD,CASC,CAAC;AAEN,IAAM,QAAQ,GAAG,UAAC,MAAiB;IAC/B,OAAA,YAAY,CAAC,MAAM,CAAC,eAAe,EAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAC7C,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAChC;AAFD,CAEC,CAAC;AAEN,IAAM,YAAY,GACd,UAAC,IAAa;IACd,OAAA,UAAC,IAAY;QACT,OAAA,oBAAE,CAAC,aAAa,CAAC,IAAI,CAAC;YAClB,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAC5B,UAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,cAAI,IAAI,CAAE,CACrD;YACH,CAAC,CAAC,IAAI;IAJV,CAIU;AALd,CAKc,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace NodeTransformer {
|
|
4
|
-
const transform: (project: INestiaTransformProject) => (node: ts.Node) => ts.Node;
|
|
5
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
+
export declare namespace NodeTransformer {
|
|
4
|
+
const transform: (project: INestiaTransformProject) => (node: ts.Node) => ts.Node;
|
|
5
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
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.NodeTransformer = void 0;
|
|
7
|
-
var typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
var MethodTransformer_1 = require("./MethodTransformer");
|
|
9
|
-
var ParameterTransformer_1 = require("./ParameterTransformer");
|
|
10
|
-
var NodeTransformer;
|
|
11
|
-
(function (NodeTransformer) {
|
|
12
|
-
NodeTransformer.transform = function (project) {
|
|
13
|
-
return function (node) {
|
|
14
|
-
return typescript_1.default.isMethodDeclaration(node)
|
|
15
|
-
? MethodTransformer_1.MethodTransformer.transform(project)(node)
|
|
16
|
-
: typescript_1.default.isParameter(node)
|
|
17
|
-
? ParameterTransformer_1.ParameterTransformer.transform(project)(node)
|
|
18
|
-
: node;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
})(NodeTransformer
|
|
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.NodeTransformer = void 0;
|
|
7
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
var MethodTransformer_1 = require("./MethodTransformer");
|
|
9
|
+
var ParameterTransformer_1 = require("./ParameterTransformer");
|
|
10
|
+
var NodeTransformer;
|
|
11
|
+
(function (NodeTransformer) {
|
|
12
|
+
NodeTransformer.transform = function (project) {
|
|
13
|
+
return function (node) {
|
|
14
|
+
return typescript_1.default.isMethodDeclaration(node)
|
|
15
|
+
? MethodTransformer_1.MethodTransformer.transform(project)(node)
|
|
16
|
+
: typescript_1.default.isParameter(node)
|
|
17
|
+
? ParameterTransformer_1.ParameterTransformer.transform(project)(node)
|
|
18
|
+
: node;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
})(NodeTransformer || (exports.NodeTransformer = NodeTransformer = {}));
|
|
22
22
|
//# sourceMappingURL=NodeTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTransformer.js","sourceRoot":"","sources":["../../src/transformers/NodeTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAG5B,yDAAwD;AACxD,+DAA8D;AAE9D,IAAiB,eAAe,CAS/B;AATD,WAAiB,eAAe;IACf,yBAAS,GAClB,UAAC,OAAgC;QACjC,OAAA,UAAC,IAAa;YACV,OAAA,oBAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC;gBACxB,CAAC,CAAC,qCAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;gBAC5C,CAAC,CAAC,oBAAE,CAAC,WAAW,CAAC,IAAI,CAAC;oBACtB,CAAC,CAAC,2CAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;oBAC/C,CAAC,CAAC,IAAI;QAJV,CAIU;IALd,CAKc,CAAC;AACvB,CAAC,EATgB,eAAe,
|
|
1
|
+
{"version":3,"file":"NodeTransformer.js","sourceRoot":"","sources":["../../src/transformers/NodeTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAG5B,yDAAwD;AACxD,+DAA8D;AAE9D,IAAiB,eAAe,CAS/B;AATD,WAAiB,eAAe;IACf,yBAAS,GAClB,UAAC,OAAgC;QACjC,OAAA,UAAC,IAAa;YACV,OAAA,oBAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC;gBACxB,CAAC,CAAC,qCAAiB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;gBAC5C,CAAC,CAAC,oBAAE,CAAC,WAAW,CAAC,IAAI,CAAC;oBACtB,CAAC,CAAC,2CAAoB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC;oBAC/C,CAAC,CAAC,IAAI;QAJV,CAIU;IALd,CAKc,CAAC;AACvB,CAAC,EATgB,eAAe,+BAAf,eAAe,QAS/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace ParameterDecoratorTransformer {
|
|
4
|
-
const transform: (project: INestiaTransformProject) => (type: ts.Type) => (decorator: ts.Decorator) => ts.Decorator;
|
|
5
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
+
export declare namespace ParameterDecoratorTransformer {
|
|
4
|
+
const transform: (project: INestiaTransformProject) => (type: ts.Type) => (decorator: ts.Decorator) => ts.Decorator;
|
|
5
|
+
}
|
|
@@ -1,69 +1,69 @@
|
|
|
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.ParameterDecoratorTransformer = void 0;
|
|
7
|
-
var path_1 = __importDefault(require("path"));
|
|
8
|
-
var typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
var TypedBodyProgrammer_1 = require("../programmers/TypedBodyProgrammer");
|
|
10
|
-
var TypedParamProgrammer_1 = require("../programmers/TypedParamProgrammer");
|
|
11
|
-
var TypedQueryProgrammer_1 = require("../programmers/TypedQueryProgrammer");
|
|
12
|
-
var ParameterDecoratorTransformer;
|
|
13
|
-
(function (ParameterDecoratorTransformer) {
|
|
14
|
-
ParameterDecoratorTransformer.transform = function (project) {
|
|
15
|
-
return function (type) {
|
|
16
|
-
return function (decorator) {
|
|
17
|
-
var _a;
|
|
18
|
-
//----
|
|
19
|
-
// VALIDATIONS
|
|
20
|
-
//----
|
|
21
|
-
// CHECK DECORATOR
|
|
22
|
-
if (!typescript_1.default.isCallExpression(decorator.expression))
|
|
23
|
-
return decorator;
|
|
24
|
-
// SIGNATURE DECLARATION
|
|
25
|
-
var declaration = (_a = project.checker.getResolvedSignature(decorator.expression)) === null || _a === void 0 ? void 0 : _a.declaration;
|
|
26
|
-
if (declaration === undefined)
|
|
27
|
-
return decorator;
|
|
28
|
-
// FILE PATH
|
|
29
|
-
var file = path_1.default.resolve(declaration.getSourceFile().fileName);
|
|
30
|
-
if (file.indexOf(LIB_PATH) === -1 && file.indexOf(SRC_PATH) === -1)
|
|
31
|
-
return decorator;
|
|
32
|
-
//----
|
|
33
|
-
// TRANSFORMATION
|
|
34
|
-
//----
|
|
35
|
-
// FIND PROGRAMMER
|
|
36
|
-
var programmer = FUNCTORS[project.checker.getTypeAtLocation(declaration).symbol.name];
|
|
37
|
-
if (programmer === undefined)
|
|
38
|
-
return decorator;
|
|
39
|
-
// GET TYPE INFO
|
|
40
|
-
var typeNode = project.checker.typeToTypeNode(type, undefined, undefined);
|
|
41
|
-
if (typeNode === undefined)
|
|
42
|
-
return decorator;
|
|
43
|
-
// DO TRANSFORM
|
|
44
|
-
return typescript_1.default.factory.createDecorator(typescript_1.default.factory.updateCallExpression(decorator.expression, decorator.expression.expression, decorator.expression.typeArguments, programmer(project)(decorator.expression.expression)(decorator.expression.arguments)(type)));
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
})(ParameterDecoratorTransformer
|
|
49
|
-
var FUNCTORS = {
|
|
50
|
-
EncryptedBody: function (project) { return function (modulo) { return function (parameters) { return function (type) {
|
|
51
|
-
return parameters.length
|
|
52
|
-
? parameters
|
|
53
|
-
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(project)(modulo)(type)];
|
|
54
|
-
}; }; }; },
|
|
55
|
-
TypedBody: function (project) { return function (modulo) { return function (parameters) { return function (type) {
|
|
56
|
-
return parameters.length
|
|
57
|
-
? parameters
|
|
58
|
-
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(project)(modulo)(type)];
|
|
59
|
-
}; }; }; },
|
|
60
|
-
TypedParam: function (project) { return function () { return TypedParamProgrammer_1.TypedParamProgrammer.generate(project); }; },
|
|
61
|
-
TypedQuery: function (project) { return function (modulo) { return function (parameters) { return function (type) {
|
|
62
|
-
return parameters.length
|
|
63
|
-
? parameters
|
|
64
|
-
: [TypedQueryProgrammer_1.TypedQueryProgrammer.generate(project)(modulo)(type)];
|
|
65
|
-
}; }; }; },
|
|
66
|
-
};
|
|
67
|
-
var LIB_PATH = path_1.default.join("node_modules", "@nestia", "core", "lib", "decorators");
|
|
68
|
-
var SRC_PATH = path_1.default.resolve(path_1.default.join(__dirname, "..", "decorators"));
|
|
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.ParameterDecoratorTransformer = void 0;
|
|
7
|
+
var path_1 = __importDefault(require("path"));
|
|
8
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
9
|
+
var TypedBodyProgrammer_1 = require("../programmers/TypedBodyProgrammer");
|
|
10
|
+
var TypedParamProgrammer_1 = require("../programmers/TypedParamProgrammer");
|
|
11
|
+
var TypedQueryProgrammer_1 = require("../programmers/TypedQueryProgrammer");
|
|
12
|
+
var ParameterDecoratorTransformer;
|
|
13
|
+
(function (ParameterDecoratorTransformer) {
|
|
14
|
+
ParameterDecoratorTransformer.transform = function (project) {
|
|
15
|
+
return function (type) {
|
|
16
|
+
return function (decorator) {
|
|
17
|
+
var _a;
|
|
18
|
+
//----
|
|
19
|
+
// VALIDATIONS
|
|
20
|
+
//----
|
|
21
|
+
// CHECK DECORATOR
|
|
22
|
+
if (!typescript_1.default.isCallExpression(decorator.expression))
|
|
23
|
+
return decorator;
|
|
24
|
+
// SIGNATURE DECLARATION
|
|
25
|
+
var declaration = (_a = project.checker.getResolvedSignature(decorator.expression)) === null || _a === void 0 ? void 0 : _a.declaration;
|
|
26
|
+
if (declaration === undefined)
|
|
27
|
+
return decorator;
|
|
28
|
+
// FILE PATH
|
|
29
|
+
var file = path_1.default.resolve(declaration.getSourceFile().fileName);
|
|
30
|
+
if (file.indexOf(LIB_PATH) === -1 && file.indexOf(SRC_PATH) === -1)
|
|
31
|
+
return decorator;
|
|
32
|
+
//----
|
|
33
|
+
// TRANSFORMATION
|
|
34
|
+
//----
|
|
35
|
+
// FIND PROGRAMMER
|
|
36
|
+
var programmer = FUNCTORS[project.checker.getTypeAtLocation(declaration).symbol.name];
|
|
37
|
+
if (programmer === undefined)
|
|
38
|
+
return decorator;
|
|
39
|
+
// GET TYPE INFO
|
|
40
|
+
var typeNode = project.checker.typeToTypeNode(type, undefined, undefined);
|
|
41
|
+
if (typeNode === undefined)
|
|
42
|
+
return decorator;
|
|
43
|
+
// DO TRANSFORM
|
|
44
|
+
return typescript_1.default.factory.createDecorator(typescript_1.default.factory.updateCallExpression(decorator.expression, decorator.expression.expression, decorator.expression.typeArguments, programmer(project)(decorator.expression.expression)(decorator.expression.arguments)(type)));
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
})(ParameterDecoratorTransformer || (exports.ParameterDecoratorTransformer = ParameterDecoratorTransformer = {}));
|
|
49
|
+
var FUNCTORS = {
|
|
50
|
+
EncryptedBody: function (project) { return function (modulo) { return function (parameters) { return function (type) {
|
|
51
|
+
return parameters.length
|
|
52
|
+
? parameters
|
|
53
|
+
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(project)(modulo)(type)];
|
|
54
|
+
}; }; }; },
|
|
55
|
+
TypedBody: function (project) { return function (modulo) { return function (parameters) { return function (type) {
|
|
56
|
+
return parameters.length
|
|
57
|
+
? parameters
|
|
58
|
+
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(project)(modulo)(type)];
|
|
59
|
+
}; }; }; },
|
|
60
|
+
TypedParam: function (project) { return function () { return TypedParamProgrammer_1.TypedParamProgrammer.generate(project); }; },
|
|
61
|
+
TypedQuery: function (project) { return function (modulo) { return function (parameters) { return function (type) {
|
|
62
|
+
return parameters.length
|
|
63
|
+
? parameters
|
|
64
|
+
: [TypedQueryProgrammer_1.TypedQueryProgrammer.generate(project)(modulo)(type)];
|
|
65
|
+
}; }; }; },
|
|
66
|
+
};
|
|
67
|
+
var LIB_PATH = path_1.default.join("node_modules", "@nestia", "core", "lib", "decorators");
|
|
68
|
+
var SRC_PATH = path_1.default.resolve(path_1.default.join(__dirname, "..", "decorators"));
|
|
69
69
|
//# sourceMappingURL=ParameterDecoratorTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterDecoratorTransformer.js","sourceRoot":"","sources":["../../src/transformers/ParameterDecoratorTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AACxB,0DAA4B;AAG5B,0EAAyE;AACzE,4EAA2E;AAC3E,4EAA2E;AAE3E,IAAiB,6BAA6B,CAoD7C;AApDD,WAAiB,6BAA6B;IAC7B,uCAAS,GAClB,UAAC,OAAgC;QACjC,OAAA,UAAC,IAAa;YACd,OAAA,UAAC,SAAuB;;gBACpB,MAAM;gBACN,cAAc;gBACd,MAAM;gBACN,kBAAkB;gBAClB,IAAI,CAAC,oBAAE,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC;oBAAE,OAAO,SAAS,CAAC;gBAEjE,wBAAwB;gBACxB,IAAM,WAAW,GACb,MAAA,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAChC,SAAS,CAAC,UAAU,CACvB,0CAAE,WAAW,CAAC;gBACnB,IAAI,WAAW,KAAK,SAAS;oBAAE,OAAO,SAAS,CAAC;gBAEhD,YAAY;gBACZ,IAAM,IAAI,GAAW,cAAI,CAAC,OAAO,CAC7B,WAAW,CAAC,aAAa,EAAE,CAAC,QAAQ,CACvC,CAAC;gBACF,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAC9D,OAAO,SAAS,CAAC;gBAErB,MAAM;gBACN,iBAAiB;gBACjB,MAAM;gBACN,kBAAkB;gBAClB,IAAM,UAAU,GACZ,QAAQ,CACJ,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,IAAI,CAC7D,CAAC;gBACN,IAAI,UAAU,KAAK,SAAS;oBAAE,OAAO,SAAS,CAAC;gBAE/C,gBAAgB;gBAChB,IAAM,QAAQ,GACV,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;gBAC/D,IAAI,QAAQ,KAAK,SAAS;oBAAE,OAAO,SAAS,CAAC;gBAE7C,eAAe;gBACf,OAAO,oBAAE,CAAC,OAAO,CAAC,eAAe,CAC7B,oBAAE,CAAC,OAAO,CAAC,oBAAoB,CAC3B,SAAS,CAAC,UAAU,EACpB,SAAS,CAAC,UAAU,CAAC,UAAU,EAC/B,SAAS,CAAC,UAAU,CAAC,aAAa,EAClC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAChD,SAAS,CAAC,UAAU,CAAC,SAAS,CACjC,CAAC,IAAI,CAAC,CACV,CACJ,CAAC;YACN,CAAC;QA/CD,CA+CC;IAhDD,CAgDC,CAAC;AACV,CAAC,EApDgB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"ParameterDecoratorTransformer.js","sourceRoot":"","sources":["../../src/transformers/ParameterDecoratorTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAwB;AACxB,0DAA4B;AAG5B,0EAAyE;AACzE,4EAA2E;AAC3E,4EAA2E;AAE3E,IAAiB,6BAA6B,CAoD7C;AApDD,WAAiB,6BAA6B;IAC7B,uCAAS,GAClB,UAAC,OAAgC;QACjC,OAAA,UAAC,IAAa;YACd,OAAA,UAAC,SAAuB;;gBACpB,MAAM;gBACN,cAAc;gBACd,MAAM;gBACN,kBAAkB;gBAClB,IAAI,CAAC,oBAAE,CAAC,gBAAgB,CAAC,SAAS,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,CAAC;AAEF,IAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CACtB,cAAc,EACd,SAAS,EACT,MAAM,EACN,KAAK,EACL,YAAY,CACf,CAAC;AACF,IAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace ParameterTransformer {
|
|
4
|
-
const transform: (project: INestiaTransformProject) => (param: ts.ParameterDeclaration) => ts.ParameterDeclaration;
|
|
5
|
-
}
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { INestiaTransformProject } from "../options/INestiaTransformProject";
|
|
3
|
+
export declare namespace ParameterTransformer {
|
|
4
|
+
const transform: (project: INestiaTransformProject) => (param: ts.ParameterDeclaration) => ts.ParameterDeclaration;
|
|
5
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
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.ParameterTransformer = void 0;
|
|
7
|
-
var typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
var ParameterDecoratorTransformer_1 = require("./ParameterDecoratorTransformer");
|
|
9
|
-
var ParameterTransformer;
|
|
10
|
-
(function (ParameterTransformer) {
|
|
11
|
-
ParameterTransformer.transform = function (project) {
|
|
12
|
-
return function (param) {
|
|
13
|
-
// CHECK DECORATOR
|
|
14
|
-
var decorators = typescript_1.default.getDecorators
|
|
15
|
-
? typescript_1.default.getDecorators(param)
|
|
16
|
-
: param.decorators;
|
|
17
|
-
if (!(decorators === null || decorators === void 0 ? void 0 : decorators.length))
|
|
18
|
-
return param;
|
|
19
|
-
// GET TYPE INFO
|
|
20
|
-
var type = project.checker.getTypeAtLocation(param);
|
|
21
|
-
// WHEN LATEST TS VERSION
|
|
22
|
-
if (typescript_1.default.getDecorators !== undefined)
|
|
23
|
-
return typescript_1.default.factory.updateParameterDeclaration(param, (param.modifiers || []).map(function (mod) {
|
|
24
|
-
return typescript_1.default.isDecorator(mod)
|
|
25
|
-
? ParameterDecoratorTransformer_1.ParameterDecoratorTransformer.transform(project)(type)(mod)
|
|
26
|
-
: mod;
|
|
27
|
-
}), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
28
|
-
// eslint-disable-next-line
|
|
29
|
-
return typescript_1.default.factory.updateParameterDeclaration(param, decorators.map(function (deco) {
|
|
30
|
-
return ParameterDecoratorTransformer_1.ParameterDecoratorTransformer.transform(project)(type)(deco);
|
|
31
|
-
}), param.modifiers, param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
})(ParameterTransformer
|
|
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.ParameterTransformer = void 0;
|
|
7
|
+
var typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
var ParameterDecoratorTransformer_1 = require("./ParameterDecoratorTransformer");
|
|
9
|
+
var ParameterTransformer;
|
|
10
|
+
(function (ParameterTransformer) {
|
|
11
|
+
ParameterTransformer.transform = function (project) {
|
|
12
|
+
return function (param) {
|
|
13
|
+
// CHECK DECORATOR
|
|
14
|
+
var decorators = typescript_1.default.getDecorators
|
|
15
|
+
? typescript_1.default.getDecorators(param)
|
|
16
|
+
: param.decorators;
|
|
17
|
+
if (!(decorators === null || decorators === void 0 ? void 0 : decorators.length))
|
|
18
|
+
return param;
|
|
19
|
+
// GET TYPE INFO
|
|
20
|
+
var type = project.checker.getTypeAtLocation(param);
|
|
21
|
+
// WHEN LATEST TS VERSION
|
|
22
|
+
if (typescript_1.default.getDecorators !== undefined)
|
|
23
|
+
return typescript_1.default.factory.updateParameterDeclaration(param, (param.modifiers || []).map(function (mod) {
|
|
24
|
+
return typescript_1.default.isDecorator(mod)
|
|
25
|
+
? ParameterDecoratorTransformer_1.ParameterDecoratorTransformer.transform(project)(type)(mod)
|
|
26
|
+
: mod;
|
|
27
|
+
}), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
28
|
+
// eslint-disable-next-line
|
|
29
|
+
return typescript_1.default.factory.updateParameterDeclaration(param, decorators.map(function (deco) {
|
|
30
|
+
return ParameterDecoratorTransformer_1.ParameterDecoratorTransformer.transform(project)(type)(deco);
|
|
31
|
+
}), param.modifiers, param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer);
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
})(ParameterTransformer || (exports.ParameterTransformer = ParameterTransformer = {}));
|
|
35
35
|
//# sourceMappingURL=ParameterTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterTransformer.js","sourceRoot":"","sources":["../../src/transformers/ParameterTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAG5B,iFAAgF;AAEhF,IAAiB,oBAAoB,CA+CpC;AA/CD,WAAiB,oBAAoB;IACpB,8BAAS,GAClB,UAAC,OAAgC;QACjC,OAAA,UAAC,KAA8B;YAC3B,kBAAkB;YAClB,IAAM,UAAU,GACZ,oBAAE,CAAC,aAAa;gBACZ,CAAC,CAAC,oBAAE,CAAC,aAAa,CAAC,KAAK,CAAC;gBACzB,CAAC,CAAE,KAAa,CAAC,UAAU,CAAC;YACpC,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA;gBAAE,OAAO,KAAK,CAAC;YAEtC,gBAAgB;YAChB,IAAM,IAAI,GAAY,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;YAE/D,yBAAyB;YACzB,IAAI,oBAAE,CAAC,aAAa,KAAK,SAAS;gBAC9B,OAAO,oBAAE,CAAC,OAAO,CAAC,0BAA0B,CACxC,KAAK,EACL,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAC,GAAG;oBAC5B,OAAA,oBAAE,CAAC,WAAW,CAAC,GAAG,CAAC;wBACf,CAAC,CAAC,6DAA6B,CAAC,SAAS,CAAC,OAAO,CAAC,CAC5C,IAAI,CACP,CAAC,GAAG,CAAC;wBACR,CAAC,CAAC,GAAG;gBAJT,CAIS,CACZ,EACD,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,WAAW,CACpB,CAAC;YACN,2BAA2B;YAC3B,OAAQ,oBAAE,CAAC,OAAO,CAAC,0BAAkC,CACjD,KAAK,EACL,UAAU,CAAC,GAAG,CAAC,UAAC,IAAI;gBAChB,OAAA,6DAA6B,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAClD,IAAI,CACP;YAFD,CAEC,CACJ,EACA,KAAa,CAAC,SAAS,EACxB,KAAK,CAAC,cAAc,EACpB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,aAAa,EACnB,KAAK,CAAC,IAAI,EACV,KAAK,CAAC,WAAW,CACpB,CAAC;QACN,CAAC;IA3CD,CA2CC,CAAC;AACV,CAAC,EA/CgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ParameterTransformer.js","sourceRoot":"","sources":["../../src/transformers/ParameterTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAG5B,iFAAgF;AAEhF,IAAiB,oBAAoB,CA+CpC;AA/CD,WAAiB,oBAAoB;IACpB,8BAAS,GAClB,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AC,IAAI,EACV,KAAK,CAAC,WAAW,CACpB,CAAC;QACN,CAAC;IA3CD,CA2CC,CAAC;AACV,CAAC,EA/CgB,oBAAoB,oCAApB,oBAAoB,QA+CpC"}
|
package/lib/typings/Creator.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type Creator<T extends object> = {
|
|
2
|
-
new (...args: any[]): T;
|
|
3
|
-
};
|
|
1
|
+
export type Creator<T extends object> = {
|
|
2
|
+
new (...args: any[]): T;
|
|
3
|
+
};
|
package/lib/typings/Creator.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=Creator.js.map
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { HttpException } from "@nestjs/common";
|
|
2
|
-
import { Creator } from "../typings/Creator";
|
|
3
|
-
/**
|
|
4
|
-
* Exception manager for HTTP server.
|
|
5
|
-
*
|
|
6
|
-
* `ExceptionManager` is an utility class who can insert or erase custom error class with
|
|
7
|
-
* its convertion method to a regular {@link nest.HttpException} instance.
|
|
8
|
-
*
|
|
9
|
-
* If you define an API function through {@link TypedRoute} or {@link EncryptedRoute}
|
|
10
|
-
* instead of the basic router decorator functions like {@link nest.Get} or
|
|
11
|
-
* {@link nest.Post} and the API function throws a custom error whose class has been
|
|
12
|
-
* {@link ExceptionManager.insert inserted} in this `EntityManager`, the error would be
|
|
13
|
-
* automatically converted to the regular {@link nest.HttpException} instance by the
|
|
14
|
-
* {@link ExceptionManager.Closure} function.
|
|
15
|
-
*
|
|
16
|
-
* Therefore, with this `ExceptionManager` and {@link TypedRoute} or {@link EncryptedRoute},
|
|
17
|
-
* you can manage your custom error classes much systemtically. You can avoid 500 internal
|
|
18
|
-
* server error or hard coding implementation about the custom error classes.
|
|
19
|
-
*
|
|
20
|
-
* Below error classes are defaultly configured in this `ExceptionManager`
|
|
21
|
-
*
|
|
22
|
-
* - `typia.TypeGuardError`
|
|
23
|
-
* - `@nestia/fetcher.HttpError`
|
|
24
|
-
*
|
|
25
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
26
|
-
*/
|
|
27
|
-
export declare namespace ExceptionManager {
|
|
28
|
-
/**
|
|
29
|
-
* Insert an error class with converter.
|
|
30
|
-
*
|
|
31
|
-
* If you've inserted an duplicated error class, the closure would be overwritten.
|
|
32
|
-
*
|
|
33
|
-
* @param creator Target error class
|
|
34
|
-
* @param closure A closure function converting to the `HttpException` class
|
|
35
|
-
*/
|
|
36
|
-
function insert<T extends Error>(creator: Creator<T>, closure: Closure<T>): void;
|
|
37
|
-
/**
|
|
38
|
-
* Erase an error class.
|
|
39
|
-
*
|
|
40
|
-
* @param creator Target error class
|
|
41
|
-
* @returns Whether be erased or not
|
|
42
|
-
*/
|
|
43
|
-
function erase<T extends Error>(creator: Creator<T>): boolean;
|
|
44
|
-
function on(closure: (error: any) => any): void;
|
|
45
|
-
function off(closure: (error: any) => any): void;
|
|
46
|
-
/**
|
|
47
|
-
* Type of a closure function converting to the regular {@link nest.HttpException}.
|
|
48
|
-
*
|
|
49
|
-
* `ExceptionManager.Closure` is a type of closure function who are converting from
|
|
50
|
-
* custom error to the regular {@link nest.HttpException} instance. It would be used
|
|
51
|
-
* in the {@link ExceptionManager} with {@link TypedRoute} or {@link EncryptedRoute}.
|
|
52
|
-
*/
|
|
53
|
-
interface Closure<T extends Error> {
|
|
54
|
-
/**
|
|
55
|
-
* Error converter.
|
|
56
|
-
*
|
|
57
|
-
* Convert from custom error to the regular {@link nest.HttpException} instance.
|
|
58
|
-
*
|
|
59
|
-
* @param exception Custom error instance
|
|
60
|
-
* @return Regular {@link nest.HttpException} instance
|
|
61
|
-
*/
|
|
62
|
-
(exception: T): HttpException;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
import { HttpException } from "@nestjs/common";
|
|
2
|
+
import { Creator } from "../typings/Creator";
|
|
3
|
+
/**
|
|
4
|
+
* Exception manager for HTTP server.
|
|
5
|
+
*
|
|
6
|
+
* `ExceptionManager` is an utility class who can insert or erase custom error class with
|
|
7
|
+
* its convertion method to a regular {@link nest.HttpException} instance.
|
|
8
|
+
*
|
|
9
|
+
* If you define an API function through {@link TypedRoute} or {@link EncryptedRoute}
|
|
10
|
+
* instead of the basic router decorator functions like {@link nest.Get} or
|
|
11
|
+
* {@link nest.Post} and the API function throws a custom error whose class has been
|
|
12
|
+
* {@link ExceptionManager.insert inserted} in this `EntityManager`, the error would be
|
|
13
|
+
* automatically converted to the regular {@link nest.HttpException} instance by the
|
|
14
|
+
* {@link ExceptionManager.Closure} function.
|
|
15
|
+
*
|
|
16
|
+
* Therefore, with this `ExceptionManager` and {@link TypedRoute} or {@link EncryptedRoute},
|
|
17
|
+
* you can manage your custom error classes much systemtically. You can avoid 500 internal
|
|
18
|
+
* server error or hard coding implementation about the custom error classes.
|
|
19
|
+
*
|
|
20
|
+
* Below error classes are defaultly configured in this `ExceptionManager`
|
|
21
|
+
*
|
|
22
|
+
* - `typia.TypeGuardError`
|
|
23
|
+
* - `@nestia/fetcher.HttpError`
|
|
24
|
+
*
|
|
25
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
26
|
+
*/
|
|
27
|
+
export declare namespace ExceptionManager {
|
|
28
|
+
/**
|
|
29
|
+
* Insert an error class with converter.
|
|
30
|
+
*
|
|
31
|
+
* If you've inserted an duplicated error class, the closure would be overwritten.
|
|
32
|
+
*
|
|
33
|
+
* @param creator Target error class
|
|
34
|
+
* @param closure A closure function converting to the `HttpException` class
|
|
35
|
+
*/
|
|
36
|
+
function insert<T extends Error>(creator: Creator<T>, closure: Closure<T>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Erase an error class.
|
|
39
|
+
*
|
|
40
|
+
* @param creator Target error class
|
|
41
|
+
* @returns Whether be erased or not
|
|
42
|
+
*/
|
|
43
|
+
function erase<T extends Error>(creator: Creator<T>): boolean;
|
|
44
|
+
function on(closure: (error: any) => any): void;
|
|
45
|
+
function off(closure: (error: any) => any): void;
|
|
46
|
+
/**
|
|
47
|
+
* Type of a closure function converting to the regular {@link nest.HttpException}.
|
|
48
|
+
*
|
|
49
|
+
* `ExceptionManager.Closure` is a type of closure function who are converting from
|
|
50
|
+
* custom error to the regular {@link nest.HttpException} instance. It would be used
|
|
51
|
+
* in the {@link ExceptionManager} with {@link TypedRoute} or {@link EncryptedRoute}.
|
|
52
|
+
*/
|
|
53
|
+
interface Closure<T extends Error> {
|
|
54
|
+
/**
|
|
55
|
+
* Error converter.
|
|
56
|
+
*
|
|
57
|
+
* Convert from custom error to the regular {@link nest.HttpException} instance.
|
|
58
|
+
*
|
|
59
|
+
* @param exception Custom error instance
|
|
60
|
+
* @return Regular {@link nest.HttpException} instance
|
|
61
|
+
*/
|
|
62
|
+
(exception: T): HttpException;
|
|
63
|
+
}
|
|
64
|
+
}
|