@nestia/core 11.2.1 → 12.0.0-dev.20260521.1
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/MIGRATION.md +169 -0
- package/lib/adaptors/WebSocketAdaptor.js +7 -3
- package/lib/adaptors/WebSocketAdaptor.js.map +1 -1
- package/lib/decorators/DynamicModule.js.map +1 -1
- package/lib/decorators/EncryptedBody.js.map +1 -1
- package/lib/decorators/EncryptedController.js.map +1 -1
- package/lib/decorators/EncryptedModule.js.map +1 -1
- package/lib/decorators/EncryptedRoute.js.map +1 -1
- package/lib/decorators/HumanRoute.js.map +1 -1
- package/lib/decorators/NoTransformConfigurationError.js +5 -2
- package/lib/decorators/NoTransformConfigurationError.js.map +1 -1
- package/lib/decorators/PlainBody.js.map +1 -1
- package/lib/decorators/SwaggerCustomizer.js.map +1 -1
- package/lib/decorators/SwaggerExample.js.map +1 -1
- package/lib/decorators/TypedBody.js.map +1 -1
- package/lib/decorators/TypedException.js.map +1 -1
- package/lib/decorators/TypedFormData.js.map +1 -1
- package/lib/decorators/TypedHeaders.js.map +1 -1
- package/lib/decorators/TypedParam.js +5 -2
- package/lib/decorators/TypedParam.js.map +1 -1
- package/lib/decorators/TypedQuery.js.map +1 -1
- package/lib/decorators/TypedRoute.js.map +1 -1
- package/lib/decorators/WebSocketRoute.js.map +1 -1
- package/lib/decorators/doNotThrowTransformError.js.map +1 -1
- package/lib/decorators/internal/get_path_and_querify.js +5 -2
- package/lib/decorators/internal/get_path_and_querify.js.map +1 -1
- package/lib/decorators/internal/get_path_and_stringify.js +5 -2
- package/lib/decorators/internal/get_path_and_stringify.js.map +1 -1
- package/lib/decorators/internal/get_text_body.js.map +1 -1
- package/lib/decorators/internal/headers_to_object.js.map +1 -1
- package/lib/decorators/internal/is_request_body_undefined.js.map +1 -1
- package/lib/decorators/internal/load_controller.js +48 -16
- package/lib/decorators/internal/load_controller.js.map +1 -1
- package/lib/decorators/internal/route_error.js +3 -3
- package/lib/decorators/internal/route_error.js.map +1 -1
- package/lib/decorators/internal/validate_request_body.js +5 -2
- package/lib/decorators/internal/validate_request_body.js.map +1 -1
- package/lib/decorators/internal/validate_request_form_data.js +5 -2
- package/lib/decorators/internal/validate_request_form_data.js.map +1 -1
- package/lib/decorators/internal/validate_request_headers.js +5 -2
- package/lib/decorators/internal/validate_request_headers.js.map +1 -1
- package/lib/decorators/internal/validate_request_query.js +30 -4
- package/lib/decorators/internal/validate_request_query.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/transform.d.ts +10 -5
- package/lib/transform.js +64 -28
- package/lib/transform.js.map +1 -1
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/ExceptionManager.js.map +1 -1
- package/lib/utils/Singleton.js.map +1 -1
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/native/cmd/ttsc-nestia/main.go +11 -0
- package/native/go.mod +32 -0
- package/native/go.sum +54 -0
- package/native/plugin/plan.go +102 -0
- package/native/transform/ast.go +32 -0
- package/native/transform/build.go +413 -0
- package/native/transform/cleanup.go +408 -0
- package/native/transform/cleanup_test.go +76 -0
- package/native/transform/commonjs_import_alias_test.go +49 -0
- package/native/transform/core_dispatch_test.go +127 -0
- package/native/transform/core_querify.go +227 -0
- package/native/transform/core_transform.go +1713 -0
- package/native/transform/core_websocket.go +115 -0
- package/native/transform/exports.go +13 -0
- package/native/transform/path_rewrite.go +285 -0
- package/native/transform/path_rewrite_test.go +243 -0
- package/native/transform/printer.go +244 -0
- package/native/transform/rewrite.go +662 -0
- package/native/transform/rewrite_test.go +118 -0
- package/native/transform/rewrite_unique_base_test.go +48 -0
- package/native/transform/run.go +72 -0
- package/native/transform/transform.go +376 -0
- package/native/transform/typia_fast.go +326 -0
- package/native/transform/typia_replacement.go +24 -0
- package/native/transform.cjs +43 -0
- package/package.json +28 -22
- package/src/decorators/NoTransformConfigurationError.ts +5 -2
- package/src/decorators/internal/load_controller.ts +50 -19
- package/src/decorators/internal/validate_request_query.ts +21 -2
- package/src/transform.ts +101 -35
- package/lib/decorators/internal/NoTransformConfigureError.d.ts +0 -1
- package/lib/decorators/internal/NoTransformConfigureError.js +0 -7
- package/lib/decorators/internal/NoTransformConfigureError.js.map +0 -1
- package/lib/options/INestiaTransformOptions.d.ts +0 -13
- package/lib/options/INestiaTransformOptions.js +0 -3
- package/lib/options/INestiaTransformOptions.js.map +0 -1
- package/lib/options/INestiaTransformProject.d.ts +0 -5
- package/lib/options/INestiaTransformProject.js +0 -3
- package/lib/options/INestiaTransformProject.js.map +0 -1
- package/lib/programmers/PlainBodyProgrammer.d.ts +0 -9
- package/lib/programmers/PlainBodyProgrammer.js +0 -58
- package/lib/programmers/PlainBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedBodyProgrammer.d.ts +0 -9
- package/lib/programmers/TypedBodyProgrammer.js +0 -94
- package/lib/programmers/TypedBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedFormDataBodyProgrammer.d.ts +0 -9
- package/lib/programmers/TypedFormDataBodyProgrammer.js +0 -65
- package/lib/programmers/TypedFormDataBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedHeadersProgrammer.d.ts +0 -9
- package/lib/programmers/TypedHeadersProgrammer.js +0 -38
- package/lib/programmers/TypedHeadersProgrammer.js.map +0 -1
- package/lib/programmers/TypedParamProgrammer.d.ts +0 -10
- package/lib/programmers/TypedParamProgrammer.js +0 -32
- package/lib/programmers/TypedParamProgrammer.js.map +0 -1
- package/lib/programmers/TypedQueryBodyProgrammer.d.ts +0 -9
- package/lib/programmers/TypedQueryBodyProgrammer.js +0 -74
- package/lib/programmers/TypedQueryBodyProgrammer.js.map +0 -1
- package/lib/programmers/TypedQueryProgrammer.d.ts +0 -9
- package/lib/programmers/TypedQueryProgrammer.js +0 -75
- package/lib/programmers/TypedQueryProgrammer.js.map +0 -1
- package/lib/programmers/TypedQueryRouteProgrammer.d.ts +0 -9
- package/lib/programmers/TypedQueryRouteProgrammer.js +0 -75
- package/lib/programmers/TypedQueryRouteProgrammer.js.map +0 -1
- package/lib/programmers/TypedRouteProgrammer.d.ts +0 -9
- package/lib/programmers/TypedRouteProgrammer.js +0 -79
- package/lib/programmers/TypedRouteProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js +0 -39
- package/lib/programmers/http/HttpAssertQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpIsQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js +0 -36
- package/lib/programmers/http/HttpIsQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpQuerifyProgrammer.js +0 -50
- package/lib/programmers/http/HttpQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.d.ts +0 -9
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js +0 -40
- package/lib/programmers/http/HttpValidateQuerifyProgrammer.js.map +0 -1
- package/lib/programmers/internal/CoreMetadataUtil.d.ts +0 -5
- package/lib/programmers/internal/CoreMetadataUtil.js +0 -19
- package/lib/programmers/internal/CoreMetadataUtil.js.map +0 -1
- package/lib/transformers/FileTransformer.d.ts +0 -5
- package/lib/transformers/FileTransformer.js +0 -80
- package/lib/transformers/FileTransformer.js.map +0 -1
- package/lib/transformers/MethodTransformer.d.ts +0 -8
- package/lib/transformers/MethodTransformer.js +0 -58
- package/lib/transformers/MethodTransformer.js.map +0 -1
- package/lib/transformers/NodeTransformer.d.ts +0 -8
- package/lib/transformers/NodeTransformer.js +0 -24
- package/lib/transformers/NodeTransformer.js.map +0 -1
- package/lib/transformers/ParameterDecoratorTransformer.d.ts +0 -9
- package/lib/transformers/ParameterDecoratorTransformer.js +0 -104
- package/lib/transformers/ParameterDecoratorTransformer.js.map +0 -1
- package/lib/transformers/ParameterTransformer.d.ts +0 -8
- package/lib/transformers/ParameterTransformer.js +0 -37
- package/lib/transformers/ParameterTransformer.js.map +0 -1
- package/lib/transformers/TypedRouteTransformer.d.ts +0 -9
- package/lib/transformers/TypedRouteTransformer.js +0 -68
- package/lib/transformers/TypedRouteTransformer.js.map +0 -1
- package/lib/transformers/WebSocketRouteTransformer.d.ts +0 -9
- package/lib/transformers/WebSocketRouteTransformer.js +0 -72
- package/lib/transformers/WebSocketRouteTransformer.js.map +0 -1
- package/src/decorators/internal/NoTransformConfigureError.ts +0 -2
- package/src/options/INestiaTransformOptions.ts +0 -34
- package/src/options/INestiaTransformProject.ts +0 -10
- package/src/programmers/PlainBodyProgrammer.ts +0 -72
- package/src/programmers/TypedBodyProgrammer.ts +0 -148
- package/src/programmers/TypedFormDataBodyProgrammer.ts +0 -118
- package/src/programmers/TypedHeadersProgrammer.ts +0 -65
- package/src/programmers/TypedParamProgrammer.ts +0 -33
- package/src/programmers/TypedQueryBodyProgrammer.ts +0 -113
- package/src/programmers/TypedQueryProgrammer.ts +0 -115
- package/src/programmers/TypedQueryRouteProgrammer.ts +0 -107
- package/src/programmers/TypedRouteProgrammer.ts +0 -103
- package/src/programmers/http/HttpAssertQuerifyProgrammer.ts +0 -74
- package/src/programmers/http/HttpIsQuerifyProgrammer.ts +0 -77
- package/src/programmers/http/HttpQuerifyProgrammer.ts +0 -110
- package/src/programmers/http/HttpValidateQuerifyProgrammer.ts +0 -78
- package/src/programmers/internal/CoreMetadataUtil.ts +0 -21
- package/src/transformers/FileTransformer.ts +0 -109
- package/src/transformers/MethodTransformer.ts +0 -103
- package/src/transformers/NodeTransformer.ts +0 -23
- package/src/transformers/ParameterDecoratorTransformer.ts +0 -143
- package/src/transformers/ParameterTransformer.ts +0 -57
- package/src/transformers/TypedRouteTransformer.ts +0 -85
- package/src/transformers/WebSocketRouteTransformer.ts +0 -120
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CoreMetadataUtil.js","sourceRoot":"","sources":["../../../src/programmers/internal/CoreMetadataUtil.ts"],"names":[],"mappings":";;;AAEA,IAAiB,gBAAgB,CAkBhC;AAlBD,WAAiB,gBAAgB;IAClB,wBAAO,GAAG,CACrB,IAAoB,EAC6B,EAAE,CACnD,IAAI,GAAG,CAAC;QACN,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAClC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACpC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAW,CAAC,CAAC,CAAC,EAAE,CAAC;KACxD,CAAC,CAAC;IAEQ,wBAAO,GAAG,CAAC,IAAoB,EAAW,EAAE,CACvD,iBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI;QAChB,IAAI,CAAC,MAAM,CAAC,MAAM;QAClB,IAAI,CAAC,MAAM,CAAC,MAAM;QAClB,IAAI,CAAC,OAAO,CAAC,MAAM;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM;QAChB,IAAI,CAAC,OAAO,CAAC,MAAM;QACrB,CAAC,CAAC;AACN,CAAC,EAlBgB,gBAAgB,gCAAhB,gBAAgB,QAkBhC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace FileTransformer {
|
|
4
|
-
const transform: (context: Omit<INestiaTransformContext, "importer" | "transformer">) => (transformer: ts.TransformationContext) => (file: ts.SourceFile) => ts.SourceFile;
|
|
5
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.FileTransformer = void 0;
|
|
7
|
-
const core_1 = require("@typia/core");
|
|
8
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
const NodeTransformer_1 = require("./NodeTransformer");
|
|
10
|
-
var FileTransformer;
|
|
11
|
-
(function (FileTransformer) {
|
|
12
|
-
FileTransformer.transform = (context) => (transformer) => (file) => {
|
|
13
|
-
if (file.isDeclarationFile)
|
|
14
|
-
return file;
|
|
15
|
-
const importer = new core_1.ImportProgrammer({
|
|
16
|
-
internalPrefix: "nestia_core_transform",
|
|
17
|
-
});
|
|
18
|
-
file = typescript_1.default.visitEachChild(file, (node) => iterate_node({
|
|
19
|
-
context: Object.assign(Object.assign({}, context), { transformer,
|
|
20
|
-
importer }),
|
|
21
|
-
file,
|
|
22
|
-
node,
|
|
23
|
-
}), transformer);
|
|
24
|
-
const index = find_import_injection_index(file);
|
|
25
|
-
return typescript_1.default.factory.updateSourceFile(file, [
|
|
26
|
-
...file.statements.slice(0, index),
|
|
27
|
-
...importer.toStatements(),
|
|
28
|
-
...file.statements.slice(index),
|
|
29
|
-
], false, file.referencedFiles, file.typeReferenceDirectives, file.hasNoDefaultLib, file.libReferenceDirectives);
|
|
30
|
-
};
|
|
31
|
-
const iterate_node = (props) => {
|
|
32
|
-
var _a;
|
|
33
|
-
return typescript_1.default.visitEachChild((_a = try_transform_node(props)) !== null && _a !== void 0 ? _a : props.node, (child) => iterate_node({
|
|
34
|
-
context: props.context,
|
|
35
|
-
file: props.file,
|
|
36
|
-
node: child,
|
|
37
|
-
}), props.context.transformer);
|
|
38
|
-
};
|
|
39
|
-
const try_transform_node = (props) => {
|
|
40
|
-
var _a;
|
|
41
|
-
var _b;
|
|
42
|
-
try {
|
|
43
|
-
return NodeTransformer_1.NodeTransformer.transform(props);
|
|
44
|
-
}
|
|
45
|
-
catch (exp) {
|
|
46
|
-
// ONLY ACCEPT TRANSFORMER-ERROR
|
|
47
|
-
if (!isTransformerError(exp))
|
|
48
|
-
throw exp;
|
|
49
|
-
// AVOID SPECIAL BUG OF TYPESCRIPT COMPILER API
|
|
50
|
-
(_a = (_b = props.node).parent) !== null && _a !== void 0 ? _a : (_b.parent = props.file);
|
|
51
|
-
// REPORT DIAGNOSTIC
|
|
52
|
-
const diagnostic = typescript_1.default.createDiagnosticForNode(props.node, {
|
|
53
|
-
key: exp.code,
|
|
54
|
-
category: typescript_1.default.DiagnosticCategory.Error,
|
|
55
|
-
message: exp.message,
|
|
56
|
-
code: `(${exp.code})`,
|
|
57
|
-
});
|
|
58
|
-
props.context.extras.addDiagnostic(diagnostic);
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const find_import_injection_index = (file) => {
|
|
63
|
-
let i = 0;
|
|
64
|
-
for (; i < file.statements.length; ++i) {
|
|
65
|
-
const stmt = file.statements[i];
|
|
66
|
-
if (typescript_1.default.isExpressionStatement(stmt) &&
|
|
67
|
-
typescript_1.default.isStringLiteralLike(stmt.expression) &&
|
|
68
|
-
stmt.expression.text.startsWith("use "))
|
|
69
|
-
continue;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
return i;
|
|
73
|
-
};
|
|
74
|
-
})(FileTransformer || (exports.FileTransformer = FileTransformer = {}));
|
|
75
|
-
const isTransformerError = (error) => typeof error === "object" &&
|
|
76
|
-
error !== null &&
|
|
77
|
-
error.constructor.name === "TransformerError" &&
|
|
78
|
-
typeof error.code === "string" &&
|
|
79
|
-
typeof error.message === "string";
|
|
80
|
-
//# sourceMappingURL=FileTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileTransformer.js","sourceRoot":"","sources":["../../src/transformers/FileTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAiE;AACjE,4DAA4B;AAG5B,uDAAoD;AAEpD,IAAiB,eAAe,CA+F/B;AA/FD,WAA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SAAS;YACX,MAAM;QACR,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;AACJ,CAAC,EA/FgB,eAAe,+BAAf,eAAe,QA+F/B;AAED,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAA6B,EAAE,CACnE,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,kBAAkB;IAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;IAC9B,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace MethodTransformer {
|
|
4
|
-
const transform: (props: {
|
|
5
|
-
context: INestiaTransformContext;
|
|
6
|
-
method: ts.MethodDeclaration;
|
|
7
|
-
}) => ts.MethodDeclaration;
|
|
8
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MethodTransformer = void 0;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const TypedRouteTransformer_1 = require("./TypedRouteTransformer");
|
|
9
|
-
const WebSocketRouteTransformer_1 = require("./WebSocketRouteTransformer");
|
|
10
|
-
var MethodTransformer;
|
|
11
|
-
(function (MethodTransformer) {
|
|
12
|
-
MethodTransformer.transform = (props) => {
|
|
13
|
-
const decorators = typescript_1.default.getDecorators
|
|
14
|
-
? typescript_1.default.getDecorators(props.method)
|
|
15
|
-
: props.method.decorators;
|
|
16
|
-
if (!(decorators === null || decorators === void 0 ? void 0 : decorators.length))
|
|
17
|
-
return props.method;
|
|
18
|
-
const signature = props.context.checker.getSignatureFromDeclaration(props.method);
|
|
19
|
-
const original = signature && props.context.checker.getReturnTypeOfSignature(signature);
|
|
20
|
-
const type = original && get_escaped_type(props.context.checker)(original);
|
|
21
|
-
if (type === undefined)
|
|
22
|
-
return props.method;
|
|
23
|
-
const operator = (decorator) => {
|
|
24
|
-
decorator = TypedRouteTransformer_1.TypedRouteTransformer.transform({
|
|
25
|
-
context: props.context,
|
|
26
|
-
decorator,
|
|
27
|
-
type,
|
|
28
|
-
});
|
|
29
|
-
decorator = WebSocketRouteTransformer_1.WebSocketRouteTransformer.validate({
|
|
30
|
-
context: props.context,
|
|
31
|
-
method: props.method,
|
|
32
|
-
decorator,
|
|
33
|
-
});
|
|
34
|
-
return decorator;
|
|
35
|
-
};
|
|
36
|
-
if (typescript_1.default.getDecorators !== undefined)
|
|
37
|
-
return typescript_1.default.factory.updateMethodDeclaration(props.method, (props.method.modifiers || []).map((mod) => typescript_1.default.isDecorator(mod) ? operator(mod) : mod), props.method.asteriskToken, props.method.name, props.method.questionToken, props.method.typeParameters, props.method.parameters, props.method.type, props.method.body);
|
|
38
|
-
// eslint-disable-next-line
|
|
39
|
-
return typescript_1.default.factory.updateMethodDeclaration(props.method, decorators.map(operator), props.method.modifiers, props.method.asteriskToken, props.method.name, props.method.questionToken, props.method.typeParameters, props.method.parameters, props.method.type, props.method.body);
|
|
40
|
-
};
|
|
41
|
-
})(MethodTransformer || (exports.MethodTransformer = MethodTransformer = {}));
|
|
42
|
-
const get_escaped_type = (checker) => (type) => {
|
|
43
|
-
const symbol = type.getSymbol() || type.aliasSymbol;
|
|
44
|
-
return symbol && get_name(symbol) === "Promise"
|
|
45
|
-
? escape_promise(checker)(type)
|
|
46
|
-
: type;
|
|
47
|
-
};
|
|
48
|
-
const escape_promise = (checker) => (type) => {
|
|
49
|
-
const generic = checker.getTypeArguments(type);
|
|
50
|
-
if (generic.length !== 1)
|
|
51
|
-
throw new Error("Error on ImportAnalyzer.analyze(): invalid promise type.");
|
|
52
|
-
return generic[0];
|
|
53
|
-
};
|
|
54
|
-
const get_name = (symbol) => explore_name(symbol.getDeclarations()[0].parent)(symbol.escapedName.toString());
|
|
55
|
-
const explore_name = (decl) => (name) => typescript_1.default.isModuleBlock(decl)
|
|
56
|
-
? explore_name(decl.parent.parent)(`${decl.parent.name.getFullText().trim()}.${name}`)
|
|
57
|
-
: name;
|
|
58
|
-
//# sourceMappingURL=MethodTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MethodTransformer.js","sourceRoot":"","sources":["../../src/transformers/MethodTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAG5B,mEAAgE;AAChE,2EAAwE;AAExE,IAAiB,iBAAiB,CA4DjC;AA5DD,WAAiB,iBAAiB;IACnB,2BAAS,GAAG,CAAC,KAGzB,EAAwB,EAAE;QACzB,MAAM,UAAU,GAAwC,oBAAE,CAAC,aAAa;YACtE,CAAC,CAAC,oBAAE,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;YAChC,CAAC,CAAE,KAAK,CAAC,MAAc,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC;QAE7C,MAAM,SAAS,GACb,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClE,MAAM,QAAQ,GACZ,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC;QACzE,MAAM,IAAI,GACR,QAAQ,IAAI,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC;QAEhE,IAAI,IAAI,KAAK,SAAS;YAAE,OAAO,KAAK,CAAC,MAAM,CAAC;QAE5C,MAAM,QAAQ,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,CAAC,CAC9B,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CACnD;IACH,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NodeTransformer = void 0;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const MethodTransformer_1 = require("./MethodTransformer");
|
|
9
|
-
const ParameterTransformer_1 = require("./ParameterTransformer");
|
|
10
|
-
var NodeTransformer;
|
|
11
|
-
(function (NodeTransformer) {
|
|
12
|
-
NodeTransformer.transform = (props) => typescript_1.default.isMethodDeclaration(props.node)
|
|
13
|
-
? MethodTransformer_1.MethodTransformer.transform({
|
|
14
|
-
context: props.context,
|
|
15
|
-
method: props.node,
|
|
16
|
-
})
|
|
17
|
-
: typescript_1.default.isParameter(props.node)
|
|
18
|
-
? ParameterTransformer_1.ParameterTransformer.transform({
|
|
19
|
-
context: props.context,
|
|
20
|
-
param: props.node,
|
|
21
|
-
})
|
|
22
|
-
: props.node;
|
|
23
|
-
})(NodeTransformer || (exports.NodeTransformer = NodeTransformer = {}));
|
|
24
|
-
//# sourceMappingURL=NodeTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTransformer.js","sourceRoot":"","sources":["../../src/transformers/NodeTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAG5B,2DAAwD;AACxD,iEAA8D;AAE9D,IAAiB,eAAe,CAgB/B;AAhBD,WAAiB,eAAe;IACjB,yBAAS,GAAG,CAAC,KAGzB,EAAW,EAAE,CACZ,oBAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC;QAChC,CAAC,CAAC,qCAAiB,CAAC,SAAS,CAAC;YAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,MAAM,EAAE,KAAK,CAAC,IAAI;SACnB,CAAC;QACJ,CAAC,CAAC,oBAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;YAC1B,CAAC,CAAC,2CAAoB,CAAC,SAAS,CAAC;gBAC7B,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,IAAI;aAClB,CAAC;YACJ,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;AACrB,CAAC,EAhBgB,eAAe,+BAAf,eAAe,QAgB/B"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace ParameterDecoratorTransformer {
|
|
4
|
-
const transform: (props: {
|
|
5
|
-
context: INestiaTransformContext;
|
|
6
|
-
type: ts.Type;
|
|
7
|
-
decorator: ts.Decorator;
|
|
8
|
-
}) => ts.Decorator;
|
|
9
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ParameterDecoratorTransformer = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
const PlainBodyProgrammer_1 = require("../programmers/PlainBodyProgrammer");
|
|
10
|
-
const TypedBodyProgrammer_1 = require("../programmers/TypedBodyProgrammer");
|
|
11
|
-
const TypedFormDataBodyProgrammer_1 = require("../programmers/TypedFormDataBodyProgrammer");
|
|
12
|
-
const TypedHeadersProgrammer_1 = require("../programmers/TypedHeadersProgrammer");
|
|
13
|
-
const TypedParamProgrammer_1 = require("../programmers/TypedParamProgrammer");
|
|
14
|
-
const TypedQueryBodyProgrammer_1 = require("../programmers/TypedQueryBodyProgrammer");
|
|
15
|
-
const TypedQueryProgrammer_1 = require("../programmers/TypedQueryProgrammer");
|
|
16
|
-
var ParameterDecoratorTransformer;
|
|
17
|
-
(function (ParameterDecoratorTransformer) {
|
|
18
|
-
ParameterDecoratorTransformer.transform = (props) => {
|
|
19
|
-
var _a;
|
|
20
|
-
//----
|
|
21
|
-
// VALIDATIONS
|
|
22
|
-
//----
|
|
23
|
-
// CHECK DECORATOR
|
|
24
|
-
if (!typescript_1.default.isCallExpression(props.decorator.expression))
|
|
25
|
-
return props.decorator;
|
|
26
|
-
// SIGNATURE DECLARATION
|
|
27
|
-
const declaration = (_a = props.context.checker.getResolvedSignature(props.decorator.expression)) === null || _a === void 0 ? void 0 : _a.declaration;
|
|
28
|
-
if (declaration === undefined)
|
|
29
|
-
return props.decorator;
|
|
30
|
-
// FILE PATH
|
|
31
|
-
const file = path_1.default.resolve(declaration.getSourceFile().fileName);
|
|
32
|
-
if (file.indexOf(LIB_PATH) === -1 && file.indexOf(MONO_PATH) === -1)
|
|
33
|
-
return props.decorator;
|
|
34
|
-
//----
|
|
35
|
-
// TRANSFORMATION
|
|
36
|
-
//----
|
|
37
|
-
// FIND PROGRAMMER
|
|
38
|
-
const programmer = FUNCTORS[getName(props.context.checker.getTypeAtLocation(declaration).symbol)];
|
|
39
|
-
if (programmer === undefined)
|
|
40
|
-
return props.decorator;
|
|
41
|
-
// GET TYPE INFO
|
|
42
|
-
const typeNode = props.context.checker.typeToTypeNode(props.type, undefined, undefined);
|
|
43
|
-
if (typeNode === undefined)
|
|
44
|
-
return props.decorator;
|
|
45
|
-
// DO TRANSFORM
|
|
46
|
-
return typescript_1.default.factory.createDecorator(typescript_1.default.factory.updateCallExpression(props.decorator.expression, props.decorator.expression.expression, props.decorator.expression.typeArguments, programmer({
|
|
47
|
-
context: props.context,
|
|
48
|
-
modulo: props.decorator.expression.expression,
|
|
49
|
-
arguments: props.decorator.expression.arguments,
|
|
50
|
-
type: props.type,
|
|
51
|
-
})));
|
|
52
|
-
};
|
|
53
|
-
})(ParameterDecoratorTransformer || (exports.ParameterDecoratorTransformer = ParameterDecoratorTransformer = {}));
|
|
54
|
-
const FUNCTORS = {
|
|
55
|
-
EncryptedBody: (props) => props.arguments.length
|
|
56
|
-
? props.arguments
|
|
57
|
-
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(props)],
|
|
58
|
-
TypedBody: (props) => props.arguments.length
|
|
59
|
-
? props.arguments
|
|
60
|
-
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(props)],
|
|
61
|
-
TypedHeaders: (props) => props.arguments.length
|
|
62
|
-
? props.arguments
|
|
63
|
-
: [TypedHeadersProgrammer_1.TypedHeadersProgrammer.generate(props)],
|
|
64
|
-
TypedParam: (props) => props.arguments.length !== 1
|
|
65
|
-
? props.arguments
|
|
66
|
-
: TypedParamProgrammer_1.TypedParamProgrammer.generate(props),
|
|
67
|
-
TypedQuery: (props) => props.arguments.length
|
|
68
|
-
? props.arguments
|
|
69
|
-
: [TypedQueryProgrammer_1.TypedQueryProgrammer.generate(props)],
|
|
70
|
-
"TypedQuery.Body": (props) => props.arguments.length
|
|
71
|
-
? props.arguments
|
|
72
|
-
: [TypedQueryBodyProgrammer_1.TypedQueryBodyProgrammer.generate(props)],
|
|
73
|
-
"TypedFormData.Body": (props) => props.arguments.length === 0
|
|
74
|
-
? [
|
|
75
|
-
typescript_1.default.factory.createIdentifier("undefined"),
|
|
76
|
-
TypedFormDataBodyProgrammer_1.TypedFormDataBodyProgrammer.generate(props),
|
|
77
|
-
]
|
|
78
|
-
: props.arguments.length === 1
|
|
79
|
-
? [props.arguments[0], TypedFormDataBodyProgrammer_1.TypedFormDataBodyProgrammer.generate(props)]
|
|
80
|
-
: props.arguments,
|
|
81
|
-
PlainBody: (props) => props.arguments.length
|
|
82
|
-
? props.arguments
|
|
83
|
-
: [PlainBodyProgrammer_1.PlainBodyProgrammer.generate(props)],
|
|
84
|
-
"WebSocketRoute.Header": (props) => props.arguments.length
|
|
85
|
-
? props.arguments
|
|
86
|
-
: [TypedBodyProgrammer_1.TypedBodyProgrammer.generate(props)],
|
|
87
|
-
"WebSocketRoute.Param": (props) => props.arguments.length !== 1
|
|
88
|
-
? props.arguments
|
|
89
|
-
: TypedParamProgrammer_1.TypedParamProgrammer.generate(props),
|
|
90
|
-
"WebSocketRoute.Query": (props) => props.arguments.length
|
|
91
|
-
? props.arguments
|
|
92
|
-
: [TypedQueryProgrammer_1.TypedQueryProgrammer.generate(props)],
|
|
93
|
-
};
|
|
94
|
-
const LIB_PATH = path_1.default.join("@nestia", "core", "lib", "decorators");
|
|
95
|
-
const MONO_PATH = path_1.default.join("packages", "core", "src", "decorators");
|
|
96
|
-
const getName = (symbol) => {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
const parent = (_b = (_a = symbol.getDeclarations()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.parent;
|
|
99
|
-
return parent ? exploreName(parent)(symbol.escapedName.toString()) : "__type";
|
|
100
|
-
};
|
|
101
|
-
const exploreName = (decl) => (name) => typescript_1.default.isModuleBlock(decl)
|
|
102
|
-
? exploreName(decl.parent.parent)(`${decl.parent.name.getFullText().trim()}.${name}`)
|
|
103
|
-
: name;
|
|
104
|
-
//# sourceMappingURL=ParameterDecoratorTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterDecoratorTransformer.js","sourceRoot":"","sources":["../../src/transformers/ParameterDecoratorTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4DAA4B;AAG5B,4EAAyE;AACzE,4EAAyE;AACzE,4FAAyF;AACzF,kFAA+E;AAC/E,8EAA2E;AAC3E,sFAAmF;AACnF,8EAA2E;AAE3E,IAAiB,6BAA6B,CAuD7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0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace ParameterTransformer {
|
|
4
|
-
const transform: (props: {
|
|
5
|
-
context: INestiaTransformContext;
|
|
6
|
-
param: ts.ParameterDeclaration;
|
|
7
|
-
}) => ts.ParameterDeclaration;
|
|
8
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ParameterTransformer = void 0;
|
|
7
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
-
const ParameterDecoratorTransformer_1 = require("./ParameterDecoratorTransformer");
|
|
9
|
-
var ParameterTransformer;
|
|
10
|
-
(function (ParameterTransformer) {
|
|
11
|
-
ParameterTransformer.transform = (props) => {
|
|
12
|
-
// CHECK DECORATOR
|
|
13
|
-
const decorators = typescript_1.default.getDecorators
|
|
14
|
-
? typescript_1.default.getDecorators(props.param)
|
|
15
|
-
: props.param.decorators;
|
|
16
|
-
if (!(decorators === null || decorators === void 0 ? void 0 : decorators.length))
|
|
17
|
-
return props.param;
|
|
18
|
-
// GET TYPE INFO
|
|
19
|
-
const type = props.context.checker.getTypeAtLocation(props.param);
|
|
20
|
-
// WHEN LATEST TS VERSION
|
|
21
|
-
if (typescript_1.default.getDecorators !== undefined)
|
|
22
|
-
return typescript_1.default.factory.updateParameterDeclaration(props.param, (props.param.modifiers || []).map((mod) => typescript_1.default.isDecorator(mod)
|
|
23
|
-
? ParameterDecoratorTransformer_1.ParameterDecoratorTransformer.transform({
|
|
24
|
-
context: props.context,
|
|
25
|
-
decorator: mod,
|
|
26
|
-
type,
|
|
27
|
-
})
|
|
28
|
-
: mod), props.param.dotDotDotToken, props.param.name, props.param.questionToken, props.param.type, props.param.initializer);
|
|
29
|
-
// eslint-disable-next-line
|
|
30
|
-
return typescript_1.default.factory.updateParameterDeclaration(props.param, decorators.map((deco) => ParameterDecoratorTransformer_1.ParameterDecoratorTransformer.transform({
|
|
31
|
-
context: props.context,
|
|
32
|
-
decorator: deco,
|
|
33
|
-
type,
|
|
34
|
-
})), props.param.modifiers, props.param.dotDotDotToken, props.param.name, props.param.questionToken, props.param.type, props.param.initializer);
|
|
35
|
-
};
|
|
36
|
-
})(ParameterTransformer || (exports.ParameterTransformer = ParameterTransformer = {}));
|
|
37
|
-
//# sourceMappingURL=ParameterTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterTransformer.js","sourceRoot":"","sources":["../../src/transformers/ParameterTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAG5B,mFAAgF;AAEhF,IAAiB,oBAAoB,CAmDpC;AAnDD,WAAiB,oBAAoB;IACtB,8BAAS,GAAG,CAAC,KAGzB,EAA2B,EAAE;QAC5B,kBAAkB;QAClB,MAAM,UAAU,GAAwC,oBAAE,CAAC,aAAa;YACtE,CAAC,CAAC,oBAAE,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC;YAC/B,CAAC,CAAE,KAAK,CAAC,KAAa,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,CAAA;YAAE,OAAO,KAAK,CAAC,KAAK,CAAC;QAE5C,gBAAgB;QAChB,MAAM,IAAI,GAAY,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE3E,yBAAyB;QACzB,IAAI,oBAAE,CAAC,aAAa,KAAK,SAAS;YAChC,OAAO,oBAAE,CAAC,OAAO,CAAC,0BAA0B,CAC1C,KAAK,CAAC,KAAK,EACX,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACxC,oBAAE,CAAC,WAAW,CAAC,GAAG,CAAC;gBACjB,CAAC,CAAC,6DAA6B,CAAC,SAAS,CAAC;oBACtC,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,SAAS,EAAE,GAAG;oBACd,IAAI;iBACL,CAAC;gBACJ,CAAC,CAAC,GAAG,CACR,EACD,KAAK,CAAC,KAAK,CAAC,cAAc,EAC1B,KAAK,CAAC,KAAK,CAAC,IAAI,EAChB,KAAK,CAAC,KAAK,CAAC,aAAa,EACzB,KAAK,CAAC,KAAK,CAAC,IAAI,EAChB,KAAK,CAAC,KAAK,CAAC,WAAW,CACxB,CAAC;QACJ,2BAA2B;QAC3B,OAAQ,oBAAE,CAAC,OAAO,CAAC,0BAAkC,CACnD,KAAK,CAAC,KAAK,EACX,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACtB,6DAA6B,CAAC,SAAS,CAAC;YACtC,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,SAAS,EAAE,IAAI;YACf,IAAI;SACL,CAAC,CACH,EACA,KAAK,CAAC,KAAa,CAAC,SAAS,EAC9B,KAAK,CAAC,KAAK,CAAC,cAAc,EAC1B,KAAK,CAAC,KAAK,CAAC,IAAI,EAChB,KAAK,CAAC,KAAK,CAAC,aAAa,EACzB,KAAK,CAAC,KAAK,CAAC,IAAI,EAChB,KAAK,CAAC,KAAK,CAAC,WAAW,CACxB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EAnDgB,oBAAoB,oCAApB,oBAAoB,QAmDpC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace TypedRouteTransformer {
|
|
4
|
-
const transform: (props: {
|
|
5
|
-
context: INestiaTransformContext;
|
|
6
|
-
decorator: ts.Decorator;
|
|
7
|
-
type: ts.Type;
|
|
8
|
-
}) => ts.Decorator;
|
|
9
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TypedRouteTransformer = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
const TypedQueryRouteProgrammer_1 = require("../programmers/TypedQueryRouteProgrammer");
|
|
10
|
-
const TypedRouteProgrammer_1 = require("../programmers/TypedRouteProgrammer");
|
|
11
|
-
var TypedRouteTransformer;
|
|
12
|
-
(function (TypedRouteTransformer) {
|
|
13
|
-
TypedRouteTransformer.transform = (props) => {
|
|
14
|
-
if (!typescript_1.default.isCallExpression(props.decorator.expression))
|
|
15
|
-
return props.decorator;
|
|
16
|
-
// CHECK SIGNATURE
|
|
17
|
-
const signature = props.context.checker.getResolvedSignature(props.decorator.expression);
|
|
18
|
-
if (!signature || !signature.declaration)
|
|
19
|
-
return props.decorator;
|
|
20
|
-
// CHECK TO BE TRANSFORMED
|
|
21
|
-
const modulo = (() => {
|
|
22
|
-
var _a;
|
|
23
|
-
// CHECK FILENAME
|
|
24
|
-
const location = path_1.default.resolve(signature.declaration.getSourceFile().fileName);
|
|
25
|
-
if (LIB_PATHS.every((str) => location.indexOf(str) === -1))
|
|
26
|
-
return null;
|
|
27
|
-
// CHECK DUPLICATE BOOSTER
|
|
28
|
-
if (props.decorator.expression.arguments.length >= 2)
|
|
29
|
-
return false;
|
|
30
|
-
else if (props.decorator.expression.arguments.length === 1) {
|
|
31
|
-
const last = props.decorator.expression.arguments[props.decorator.expression.arguments.length - 1];
|
|
32
|
-
const type = props.context.checker.getTypeAtLocation(last);
|
|
33
|
-
if (isObject(props.context.checker)(type))
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
return ((_a = location.split(path_1.default.sep).at(-1)) === null || _a === void 0 ? void 0 : _a.split(".")[0]) === "TypedQuery"
|
|
37
|
-
? "TypedQuery"
|
|
38
|
-
: "TypedRoute";
|
|
39
|
-
})();
|
|
40
|
-
if (modulo === null)
|
|
41
|
-
return props.decorator;
|
|
42
|
-
// CHECK TYPE NODE
|
|
43
|
-
const typeNode = props.context.checker.typeToTypeNode(props.type, undefined, undefined);
|
|
44
|
-
if (typeNode === undefined)
|
|
45
|
-
return props.decorator;
|
|
46
|
-
// DO TRANSFORM
|
|
47
|
-
return typescript_1.default.factory.createDecorator(typescript_1.default.factory.updateCallExpression(props.decorator.expression, props.decorator.expression.expression, props.decorator.expression.typeArguments, [
|
|
48
|
-
...props.decorator.expression.arguments,
|
|
49
|
-
(modulo === "TypedQuery"
|
|
50
|
-
? TypedQueryRouteProgrammer_1.TypedQueryRouteProgrammer
|
|
51
|
-
: TypedRouteProgrammer_1.TypedRouteProgrammer).generate({
|
|
52
|
-
context: props.context,
|
|
53
|
-
type: props.type,
|
|
54
|
-
modulo: props.decorator.expression.expression,
|
|
55
|
-
}),
|
|
56
|
-
]));
|
|
57
|
-
};
|
|
58
|
-
const isObject = (checker) => (type) => (type.getFlags() & typescript_1.default.TypeFlags.Object) !== 0 &&
|
|
59
|
-
!checker.isTupleType(type) &&
|
|
60
|
-
!checker.isArrayType(type) &&
|
|
61
|
-
!checker.isArrayLikeType(type);
|
|
62
|
-
const CLASSES = ["EncryptedRoute", "TypedRoute", "TypedQuery"];
|
|
63
|
-
const LIB_PATHS = CLASSES.map((cla) => [
|
|
64
|
-
path_1.default.join("@nestia", "core", "lib", "decorators", `${cla}.d.ts`),
|
|
65
|
-
path_1.default.join("packages", "core", "src", "decorators", `${cla}.ts`),
|
|
66
|
-
]).flat();
|
|
67
|
-
})(TypedRouteTransformer || (exports.TypedRouteTransformer = TypedRouteTransformer = {}));
|
|
68
|
-
//# sourceMappingURL=TypedRouteTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TypedRouteTransformer.js","sourceRoot":"","sources":["../../src/transformers/TypedRouteTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4DAA4B;AAG5B,wFAAqF;AACrF,8EAA2E;AAE3E,IAAiB,qBAAqB,CA6ErC;AA7ED,WAAiB,qBAAqB;IACvB,+BAAS,GAAG,CAAC,KAIzB,EAAgB,EAAE;QACjB,IAAI,CAAC,oBAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;YAClD,OAAO,KAAK,CAAC,SAAS,CAAC;QAEzB,kBAAkB;QAClB,MAAM,SAAS,GACb,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACzE,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC,SAAS,CAAC;QAEjE,0BAA0B;QAC1B,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;;YACnB,iBAAiB;YACjB,MAAM,QAAQ,GAAW,cAAI,CAAC,OAAO,CACnC,SAAS,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,QAAQ,CAC/C,CAAC;YACF,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;gBAAE,OAAO,IAAI,CAAC;YAExE,0BAA0B;YAC1B,IAAI,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC;gBAAE,OAAO,KAAK,CAAC;iBAC9D,IAAI,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3D,MAAM,IAAI,GACR,KAAK,CAA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ACvB,CAAC,QAAQ,CAAC;gBACT,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU;aAC9C,CAAC;SACH,CACF,CACF,CAAC;IACJ,CAAC,CAAC;IAEF,MAAM,QAAQ,GACZ,CAAC,OAAuB,EAAE,EAAE,CAC5B,CAAC,IAAa,EAAW,EAAE,CACzB,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,oBAAE,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC;QAC7C,CAAE,OAAe,CAAC,WAAW,CAAC,IAAI,CAAC;QACnC,CAAE,OAAe,CAAC,WAAW,CAAC,IAAI,CAAC;QACnC,CAAE,OAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAa,CAAC,gBAAgB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IACzE,MAAM,SAAS,GAAa,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QAC/C,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,GAAG,OAAO,CAAC;QAChE,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,GAAG,KAAK,CAAC;KAChE,CAAC,CAAC,IAAI,EAAE,CAAC;AACZ,CAAC,EA7EgB,qBAAqB,qCAArB,qBAAqB,QA6ErC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaTransformContext } from "../options/INestiaTransformProject";
|
|
3
|
-
export declare namespace WebSocketRouteTransformer {
|
|
4
|
-
const validate: (props: {
|
|
5
|
-
context: INestiaTransformContext;
|
|
6
|
-
decorator: ts.Decorator;
|
|
7
|
-
method: ts.MethodDeclaration;
|
|
8
|
-
}) => ts.Decorator;
|
|
9
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WebSocketRouteTransformer = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
-
var WebSocketRouteTransformer;
|
|
10
|
-
(function (WebSocketRouteTransformer) {
|
|
11
|
-
WebSocketRouteTransformer.validate = (props) => {
|
|
12
|
-
if (!typescript_1.default.isCallExpression(props.decorator.expression))
|
|
13
|
-
return props.decorator;
|
|
14
|
-
// CHECK SIGNATURE
|
|
15
|
-
const signature = props.context.checker.getResolvedSignature(props.decorator.expression);
|
|
16
|
-
if (!signature || !signature.declaration)
|
|
17
|
-
return props.decorator;
|
|
18
|
-
else if (isLocated(signature) === false)
|
|
19
|
-
return props.decorator;
|
|
20
|
-
const errors = [];
|
|
21
|
-
let accepted = false;
|
|
22
|
-
const report = (node, message) => {
|
|
23
|
-
errors.push(typescript_1.default.createDiagnosticForNode(node, {
|
|
24
|
-
category: typescript_1.default.DiagnosticCategory.Error,
|
|
25
|
-
key: "nestia.core.WebSocketRoute",
|
|
26
|
-
code: "(nestia.core.WebSocketRoute)",
|
|
27
|
-
message,
|
|
28
|
-
}));
|
|
29
|
-
};
|
|
30
|
-
props.method.parameters.forEach((param) => {
|
|
31
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
32
|
-
const paramDecos = ((_a = param.modifiers) !== null && _a !== void 0 ? _a : []).filter((m) => typescript_1.default.isDecorator(m));
|
|
33
|
-
const category = (() => {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
if (paramDecos.length !== 1)
|
|
36
|
-
return null;
|
|
37
|
-
const decorator = paramDecos[0];
|
|
38
|
-
const signature = typescript_1.default.isCallExpression(decorator.expression)
|
|
39
|
-
? props.context.checker.getResolvedSignature(decorator.expression)
|
|
40
|
-
: undefined;
|
|
41
|
-
if (signature === undefined || isLocated(signature) === false)
|
|
42
|
-
return null;
|
|
43
|
-
return ((_b = (_a = decorator.expression.getText().split(".").at(-1)) === null || _a === void 0 ? void 0 : _a.split("(")[0]) !== null && _b !== void 0 ? _b : null);
|
|
44
|
-
})();
|
|
45
|
-
if (category === null)
|
|
46
|
-
report(param, `parameter ${JSON.stringify(param.name.getText())} is not decorated with nested function of WebSocketRoute module.`);
|
|
47
|
-
else if (category === "Acceptor") {
|
|
48
|
-
accepted = true;
|
|
49
|
-
if (((_d = (_c = (_b = param.type) === null || _b === void 0 ? void 0 : _b.getText().split("<")[0]) === null || _c === void 0 ? void 0 : _c.split(".").at(-1)) === null || _d === void 0 ? void 0 : _d.startsWith("WebSocketAcceptor")) !== true)
|
|
50
|
-
report(param, `parameter ${JSON.stringify(param.name.getText())} must have WebSocketAcceptor<Header, Provider, Listener> type.`);
|
|
51
|
-
}
|
|
52
|
-
else if (category === "Driver") {
|
|
53
|
-
if (((_g = (_f = (_e = param.type) === null || _e === void 0 ? void 0 : _e.getText().split("<")[0]) === null || _f === void 0 ? void 0 : _f.split(".").at(-1)) === null || _g === void 0 ? void 0 : _g.startsWith("Driver")) !== true)
|
|
54
|
-
report(param, `parameter ${JSON.stringify(param.name.getText())} must have Driver<Listener> type.`);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
if (accepted === false)
|
|
58
|
-
report(props.method, `method ${JSON.stringify(props.method.name.getText())} must have at least one parameter decorated by @WebSocketRoute.Acceptor().`);
|
|
59
|
-
for (const e of errors)
|
|
60
|
-
props.context.extras.addDiagnostic(e);
|
|
61
|
-
return props.decorator;
|
|
62
|
-
};
|
|
63
|
-
})(WebSocketRouteTransformer || (exports.WebSocketRouteTransformer = WebSocketRouteTransformer = {}));
|
|
64
|
-
const isLocated = (signature) => {
|
|
65
|
-
if (!signature.declaration)
|
|
66
|
-
return false;
|
|
67
|
-
const location = path_1.default.resolve(signature.declaration.getSourceFile().fileName);
|
|
68
|
-
return (location.indexOf(LIB_PATH) !== -1 || location.indexOf(MONO_PATH) !== -1);
|
|
69
|
-
};
|
|
70
|
-
const LIB_PATH = path_1.default.join("@nestia", "core", "lib", "decorators", `WebSocketRoute.d.ts`);
|
|
71
|
-
const MONO_PATH = path_1.default.join("packages", "core", "src", "decorators", `WebSocketRoute.ts`);
|
|
72
|
-
//# sourceMappingURL=WebSocketRouteTransformer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebSocketRouteTransformer.js","sourceRoot":"","sources":["../../src/transformers/WebSocketRouteTransformer.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,4DAA4B;AAI5B,IAAiB,yBAAyB,CAyFzC;AAzFD,WAAiB,yBAAyB;IAC3B,kCAAQ,GAAG,CAAC,KAIxB,EAAgB,EAAE;QACjB,IAAI,CAAC,oBAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;YAClD,OAAO,KAAK,CAAC,SAAS,CAAC;QAEzB,kBAAkB;QAClB,MAAM,SAAS,GACb,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACzE,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC,SAAS,CAAC;aAC5D,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC,SAAS,CAAC;QAEhE,MAAM,MAAM,GAAgC,EAAE,CAAC;QAC/C,IAAI,QAAQ,GAAY,KAAK,CAAC;QAE9B,MAAM,MAAM,GAAG,CAAC,IAAa,EAAE,OAAe,EAAE,EAAE;YAChD,MAAM,CAAC,IAAI,CACR,oBAAU,CAAC,uB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CAAC;AACJ,CAAC,EAzFgB,yBAAyB,yCAAzB,yBAAyB,QAyFzC;AAED,MAAM,SAAS,GAAG,CAAC,SAAuB,EAAE,EAAE;IAC5C,IAAI,CAAC,SAAS,CAAC,WAAW;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,QAAQ,GAAW,cAAI,CAAC,OAAO,CACnC,SAAS,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,QAAQ,CAC/C,CAAC;IACF,OAAO,CACL,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CACxE,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CACxB,SAAS,EACT,MAAM,EACN,KAAK,EACL,YAAY,EACZ,qBAAqB,CACtB,CAAC;AACF,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CACzB,UAAU,EACV,MAAM,EACN,KAAK,EACL,YAAY,EACZ,mBAAmB,CACpB,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface INestiaTransformOptions {
|
|
2
|
-
validate?: INestiaTransformOptions.Validate;
|
|
3
|
-
stringify?: INestiaTransformOptions.Stringify | null;
|
|
4
|
-
llm?: boolean | INestiaTransformOptions.ILlm;
|
|
5
|
-
throws?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export namespace INestiaTransformOptions {
|
|
8
|
-
export type Validate =
|
|
9
|
-
// NORMAL
|
|
10
|
-
| "assert"
|
|
11
|
-
| "is"
|
|
12
|
-
| "validate"
|
|
13
|
-
// STRICT
|
|
14
|
-
| "assertEquals"
|
|
15
|
-
| "equals"
|
|
16
|
-
| "validateEquals"
|
|
17
|
-
// CLONE
|
|
18
|
-
| "assertClone"
|
|
19
|
-
| "validateClone"
|
|
20
|
-
// PRUNE
|
|
21
|
-
| "assertPrune"
|
|
22
|
-
| "validatePrune";
|
|
23
|
-
|
|
24
|
-
export type Stringify =
|
|
25
|
-
| "stringify"
|
|
26
|
-
| "assert"
|
|
27
|
-
| "is"
|
|
28
|
-
| "validate"
|
|
29
|
-
| "validate.log";
|
|
30
|
-
|
|
31
|
-
export interface ILlm {
|
|
32
|
-
strict?: boolean;
|
|
33
|
-
}
|
|
34
|
-
}
|