@nestia/sdk 3.10.0 → 3.11.0-dev.20240812
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/NestiaSdkApplication.d.ts +1 -3
- package/lib/NestiaSdkApplication.js +138 -136
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.d.ts +2 -2
- package/lib/analyses/ConfigAnalyzer.js +39 -80
- package/lib/analyses/ConfigAnalyzer.js.map +1 -1
- package/lib/analyses/ExceptionAnalyzer.d.ts +0 -16
- package/lib/analyses/ExceptionAnalyzer.js +142 -105
- package/lib/analyses/ExceptionAnalyzer.js.map +1 -1
- package/lib/analyses/GenericAnalyzer.d.ts +1 -2
- package/lib/analyses/GenericAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts +6 -11
- package/lib/analyses/ImportAnalyzer.js +70 -42
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.d.ts +7 -1
- package/lib/analyses/ReflectControllerAnalyzer.js +28 -99
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +6 -2
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +72 -152
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +15 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +215 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +15 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +81 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -0
- package/lib/analyses/ReflectMetadataAnalyzer.d.ts +1 -3
- package/lib/analyses/ReflectMetadataAnalyzer.js +0 -4
- package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +6 -2
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +72 -48
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +15 -0
- package/lib/analyses/TypedHttpRouteAnalyzer.js +111 -0
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +10 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +9 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -0
- package/lib/decorators/OperationMetadata.d.ts +2 -0
- package/lib/decorators/OperationMetadata.js +10 -0
- package/lib/decorators/OperationMetadata.js.map +1 -0
- package/lib/executable/internal/NestiaConfigLoader.d.ts +1 -1
- package/lib/executable/internal/NestiaConfigLoader.js +33 -3
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/generates/CloneGenerator.d.ts +0 -5
- package/lib/generates/CloneGenerator.js +60 -60
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/E2eGenerator.d.ts +2 -3
- package/lib/generates/E2eGenerator.js +9 -8
- package/lib/generates/E2eGenerator.js.map +1 -1
- package/lib/generates/OpenAiGenerator.d.ts +2 -4
- package/lib/generates/OpenAiGenerator.js +13 -3
- package/lib/generates/OpenAiGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.d.ts +4 -4
- package/lib/generates/SdkGenerator.js +63 -73
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts +6 -18
- package/lib/generates/SwaggerGenerator.js +60 -235
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +5 -9
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +6 -4
- package/lib/generates/internal/SdkAliasCollection.js +33 -31
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +4 -1
- package/lib/generates/internal/SdkDistributionComposer.js +6 -6
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.d.ts +2 -4
- package/lib/generates/internal/SdkFileProgrammer.js +6 -6
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +0 -12
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +142 -97
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +4 -3
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +37 -59
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +4 -3
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +31 -48
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +7 -3
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +4 -3
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +7 -13
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +1 -2
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +11 -16
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +1 -2
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +7 -10
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +23 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -0
- package/lib/generates/internal/SwaggerOperationComposer.d.ts +12 -0
- package/lib/generates/internal/SwaggerOperationComposer.js +68 -0
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +18 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +99 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +9 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +91 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -0
- package/lib/structures/INestiaProject.d.ts +5 -5
- package/lib/structures/INestiaSdkInput.d.ts +20 -0
- package/lib/structures/{ISwaggerError.js → INestiaSdkInput.js} +1 -1
- package/lib/structures/INestiaSdkInput.js.map +1 -0
- package/lib/structures/IReflectApplication.d.ts +6 -0
- package/lib/structures/IReflectApplication.js +3 -0
- package/lib/structures/IReflectApplication.js.map +1 -0
- package/lib/structures/IReflectController.d.ts +3 -5
- package/lib/structures/IReflectHttpOperation.d.ts +13 -65
- package/lib/structures/IReflectHttpOperationException.d.ts +14 -0
- package/lib/structures/IReflectHttpOperationException.js +3 -0
- package/lib/structures/IReflectHttpOperationException.js.map +1 -0
- package/lib/structures/IReflectHttpOperationParameter.d.ts +35 -0
- package/lib/structures/IReflectHttpOperationParameter.js +3 -0
- package/lib/structures/IReflectHttpOperationParameter.js.map +1 -0
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +15 -0
- package/lib/structures/IReflectHttpOperationSuccess.js +3 -0
- package/lib/structures/IReflectHttpOperationSuccess.js.map +1 -0
- package/lib/structures/IReflectOperationError.d.ts +16 -0
- package/lib/structures/IReflectOperationError.js +23 -0
- package/lib/structures/IReflectOperationError.js.map +1 -0
- package/lib/structures/IReflectType.d.ts +4 -0
- package/lib/structures/{IErrorReport.js → IReflectType.js} +1 -1
- package/lib/structures/IReflectType.js.map +1 -0
- package/lib/structures/IReflectTypeImport.d.ts +4 -0
- package/lib/structures/{ISwaggerLazySchema.js → IReflectTypeImport.js} +1 -1
- package/lib/structures/IReflectTypeImport.js.map +1 -0
- package/lib/structures/IReflectWebSocketOperation.d.ts +8 -9
- package/lib/structures/IReflectWebSocketOperationParameter.d.ts +23 -0
- package/lib/structures/IReflectWebSocketOperationParameter.js +3 -0
- package/lib/structures/IReflectWebSocketOperationParameter.js.map +1 -0
- package/lib/structures/ITypedApplication.d.ts +7 -0
- package/lib/structures/{INormalizedInput.js → ITypedApplication.js} +1 -1
- package/lib/structures/ITypedApplication.js.map +1 -0
- package/lib/structures/ITypedHttpRoute.d.ts +14 -42
- package/lib/structures/ITypedHttpRouteException.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteException.js +3 -0
- package/lib/structures/ITypedHttpRouteException.js.map +1 -0
- package/lib/structures/ITypedHttpRouteParameter.d.ts +31 -0
- package/lib/structures/ITypedHttpRouteParameter.js +3 -0
- package/lib/structures/ITypedHttpRouteParameter.js.map +1 -0
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +19 -0
- package/lib/structures/{ISwaggerLazyProperty.js → ITypedHttpRouteSuccess.js} +1 -1
- package/lib/structures/ITypedHttpRouteSuccess.js.map +1 -0
- package/lib/structures/ITypedWebSocketRoute.d.ts +8 -44
- package/lib/structures/ITypedWebSocketRouteParameter.d.ts +2 -0
- package/lib/structures/ITypedWebSocketRouteParameter.js +3 -0
- package/lib/structures/ITypedWebSocketRouteParameter.js.map +1 -0
- package/lib/transform.d.ts +3 -0
- package/lib/transform.js +8 -0
- package/lib/transform.js.map +1 -0
- package/lib/transformers/IOperationMetadata.d.ts +36 -0
- package/lib/transformers/IOperationMetadata.js +3 -0
- package/lib/transformers/IOperationMetadata.js.map +1 -0
- package/lib/transformers/ISdkTransformerContext.d.ts +7 -0
- package/lib/transformers/ISdkTransformerContext.js +3 -0
- package/lib/transformers/ISdkTransformerContext.js.map +1 -0
- package/lib/transformers/SdkMetadataProgrammer.d.ts +11 -0
- package/lib/transformers/SdkMetadataProgrammer.js +159 -0
- package/lib/transformers/SdkMetadataProgrammer.js.map +1 -0
- package/lib/transformers/SdkTransformer.d.ts +4 -0
- package/lib/transformers/SdkTransformer.js +88 -0
- package/lib/transformers/SdkTransformer.js.map +1 -0
- package/lib/transformers/TextPlainValidator.d.ts +4 -0
- package/lib/transformers/TextPlainValidator.js +19 -0
- package/lib/transformers/TextPlainValidator.js.map +1 -0
- package/lib/utils/StringUtil.d.ts +1 -0
- package/lib/utils/StringUtil.js +1 -0
- package/lib/utils/StringUtil.js.map +1 -1
- package/package.json +8 -8
- package/src/NestiaSdkApplication.ts +173 -160
- package/src/analyses/ConfigAnalyzer.ts +50 -98
- package/src/analyses/ExceptionAnalyzer.ts +142 -142
- package/src/analyses/GenericAnalyzer.ts +3 -5
- package/src/analyses/ImportAnalyzer.ts +130 -115
- package/src/analyses/ReflectControllerAnalyzer.ts +63 -115
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +142 -278
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +319 -0
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +117 -0
- package/src/analyses/ReflectMetadataAnalyzer.ts +1 -18
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +143 -78
- package/src/analyses/TypedHttpRouteAnalyzer.ts +178 -0
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +18 -0
- package/src/decorators/OperationMetadata.ts +15 -0
- package/src/executable/internal/NestiaConfigLoader.ts +17 -3
- package/src/executable/internal/NestiaSdkCommand.ts +1 -4
- package/src/generates/CloneGenerator.ts +60 -59
- package/src/generates/E2eGenerator.ts +20 -21
- package/src/generates/OpenAiGenerator.ts +44 -45
- package/src/generates/SdkGenerator.ts +97 -125
- package/src/generates/SwaggerGenerator.ts +114 -416
- package/src/generates/internal/E2eFileProgrammer.ts +5 -14
- package/src/generates/internal/SdkAliasCollection.ts +33 -41
- package/src/generates/internal/SdkDistributionComposer.ts +9 -6
- package/src/generates/internal/SdkFileProgrammer.ts +11 -14
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +142 -142
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +20 -47
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +245 -275
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +7 -7
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +11 -23
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +197 -233
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +5 -15
- package/src/generates/internal/{SwaggerDescriptionGenerator.ts → SwaggerDescriptionComposer.ts} +25 -5
- package/src/generates/internal/SwaggerOperationComposer.ts +90 -0
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +173 -0
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +110 -0
- package/src/structures/INestiaProject.ts +5 -5
- package/src/structures/INestiaSdkInput.ts +25 -0
- package/src/structures/IReflectApplication.ts +8 -0
- package/src/structures/IReflectController.ts +3 -5
- package/src/structures/IReflectHttpOperation.ts +14 -76
- package/src/structures/IReflectHttpOperationException.ts +19 -0
- package/src/structures/IReflectHttpOperationParameter.ts +81 -0
- package/src/structures/IReflectHttpOperationSuccess.ts +22 -0
- package/src/structures/IReflectOperationError.ts +26 -0
- package/src/structures/IReflectType.ts +4 -0
- package/src/structures/IReflectTypeImport.ts +4 -0
- package/src/structures/IReflectWebSocketOperation.ts +9 -9
- package/src/structures/IReflectWebSocketOperationParameter.ts +38 -0
- package/src/structures/ITypedApplication.ts +8 -0
- package/src/structures/ITypedHttpRoute.ts +15 -45
- package/src/structures/ITypedHttpRouteException.ts +15 -0
- package/src/structures/ITypedHttpRouteParameter.ts +41 -0
- package/src/structures/ITypedHttpRouteSuccess.ts +22 -0
- package/src/structures/ITypedWebSocketRoute.ts +8 -56
- package/src/structures/ITypedWebSocketRouteParameter.ts +3 -0
- package/src/transform.ts +9 -0
- package/src/transformers/IOperationMetadata.ts +38 -0
- package/src/transformers/ISdkTransformerContext.ts +8 -0
- package/src/transformers/SdkMetadataProgrammer.ts +227 -0
- package/src/transformers/SdkTransformer.ts +168 -0
- package/src/transformers/TextPlainValidator.ts +17 -0
- package/src/utils/StringUtil.ts +3 -0
- package/lib/analyses/TypedControllerAnalyzer.d.ts +0 -8
- package/lib/analyses/TypedControllerAnalyzer.js +0 -77
- package/lib/analyses/TypedControllerAnalyzer.js.map +0 -1
- package/lib/analyses/TypedHttpOperationAnalyzer.d.ts +0 -15
- package/lib/analyses/TypedHttpOperationAnalyzer.js +0 -263
- package/lib/analyses/TypedHttpOperationAnalyzer.js.map +0 -1
- package/lib/analyses/TypedWebSocketOperationAnalyzer.d.ts +0 -15
- package/lib/analyses/TypedWebSocketOperationAnalyzer.js +0 -226
- package/lib/analyses/TypedWebSocketOperationAnalyzer.js.map +0 -1
- package/lib/generates/internal/SwaggerDescriptionGenerator.d.ts +0 -14
- package/lib/generates/internal/SwaggerDescriptionGenerator.js +0 -33
- package/lib/generates/internal/SwaggerDescriptionGenerator.js.map +0 -1
- package/lib/generates/internal/SwaggerSchemaGenerator.d.ts +0 -21
- package/lib/generates/internal/SwaggerSchemaGenerator.js +0 -289
- package/lib/generates/internal/SwaggerSchemaGenerator.js.map +0 -1
- package/lib/generates/internal/SwaggerSchemaValidator.d.ts +0 -7
- package/lib/generates/internal/SwaggerSchemaValidator.js +0 -191
- package/lib/generates/internal/SwaggerSchemaValidator.js.map +0 -1
- package/lib/structures/IErrorReport.d.ts +0 -6
- package/lib/structures/IErrorReport.js.map +0 -1
- package/lib/structures/INormalizedInput.d.ts +0 -19
- package/lib/structures/INormalizedInput.js.map +0 -1
- package/lib/structures/ISwaggerError.d.ts +0 -6
- package/lib/structures/ISwaggerError.js.map +0 -1
- package/lib/structures/ISwaggerLazyProperty.d.ts +0 -6
- package/lib/structures/ISwaggerLazyProperty.js.map +0 -1
- package/lib/structures/ISwaggerLazySchema.d.ts +0 -6
- package/lib/structures/ISwaggerLazySchema.js.map +0 -1
- package/lib/structures/ITypeTuple.d.ts +0 -5
- package/lib/structures/ITypeTuple.js +0 -3
- package/lib/structures/ITypeTuple.js.map +0 -1
- package/src/analyses/TypedControllerAnalyzer.ts +0 -92
- package/src/analyses/TypedHttpOperationAnalyzer.ts +0 -365
- package/src/analyses/TypedWebSocketOperationAnalyzer.ts +0 -375
- package/src/generates/internal/SwaggerSchemaGenerator.ts +0 -473
- package/src/generates/internal/SwaggerSchemaValidator.ts +0 -206
- package/src/structures/IErrorReport.ts +0 -6
- package/src/structures/INormalizedInput.ts +0 -20
- package/src/structures/ISwaggerError.ts +0 -8
- package/src/structures/ISwaggerLazyProperty.ts +0 -7
- package/src/structures/ISwaggerLazySchema.ts +0 -7
- package/src/structures/ITypeTuple.ts +0 -6
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
import { INestiaProject } from "../structures/INestiaProject";
|
|
3
|
-
import { IReflectController } from "../structures/IReflectController";
|
|
4
|
-
import { IReflectHttpOperation } from "../structures/IReflectHttpOperation";
|
|
5
|
-
import { ITypedHttpRoute } from "../structures/ITypedHttpRoute";
|
|
6
|
-
import { GenericAnalyzer } from "./GenericAnalyzer";
|
|
7
|
-
import { ImportAnalyzer } from "./ImportAnalyzer";
|
|
8
|
-
export declare namespace ExceptionAnalyzer {
|
|
9
|
-
const analyze: (project: INestiaProject) => (props: {
|
|
10
|
-
generics: GenericAnalyzer.Dictionary;
|
|
11
|
-
imports: ImportAnalyzer.Dictionary;
|
|
12
|
-
controller: IReflectController;
|
|
13
|
-
operation: IReflectHttpOperation;
|
|
14
|
-
declaration: ts.MethodDeclaration;
|
|
15
|
-
}) => Record<number | "2XX" | "3XX" | "4XX" | "5XX", ITypedHttpRoute.IOutput>;
|
|
16
|
-
}
|
|
@@ -1,107 +1,144 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
2
|
+
// import path from "path";
|
|
3
|
+
// import ts from "typescript";
|
|
4
|
+
// import { MetadataCollection } from "typia/lib/factories/MetadataCollection";
|
|
5
|
+
// import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
|
|
6
|
+
// import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
7
|
+
// import { INestiaProject } from "../structures/INestiaProject";
|
|
8
|
+
// import { IReflectController } from "../structures/IReflectController";
|
|
9
|
+
// import { IReflectHttpOperation } from "../structures/IReflectHttpOperation";
|
|
10
|
+
// import { ITypeTuple } from "../structures/ITypeTuple";
|
|
11
|
+
// import { ITypedHttpRoute } from "../structures/ITypedHttpRoute";
|
|
12
|
+
// import { GenericAnalyzer } from "./GenericAnalyzer";
|
|
13
|
+
// import { ImportAnalyzer } from "./ImportAnalyzer";
|
|
14
|
+
// export namespace ExceptionAnalyzer {
|
|
15
|
+
// export const analyze =
|
|
16
|
+
// (project: INestiaProject) =>
|
|
17
|
+
// (props: {
|
|
18
|
+
// generics: GenericAnalyzer.Dictionary;
|
|
19
|
+
// imports: ImportAnalyzer.Dictionary;
|
|
20
|
+
// controller: IReflectController;
|
|
21
|
+
// operation: IReflectHttpOperation;
|
|
22
|
+
// declaration: ts.MethodDeclaration;
|
|
23
|
+
// }): Record<
|
|
24
|
+
// number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
25
|
+
// ITypedHttpRoute.IOutput
|
|
26
|
+
// > => {
|
|
27
|
+
// const output: Record<
|
|
28
|
+
// number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
29
|
+
// ITypedHttpRoute.IOutput
|
|
30
|
+
// > = {} as any;
|
|
31
|
+
// for (const decorator of props.declaration.modifiers ?? [])
|
|
32
|
+
// if (ts.isDecorator(decorator))
|
|
33
|
+
// analyzeTyped(project)({
|
|
34
|
+
// ...props,
|
|
35
|
+
// output,
|
|
36
|
+
// decorator,
|
|
37
|
+
// });
|
|
38
|
+
// return output;
|
|
39
|
+
// };
|
|
40
|
+
// const analyzeTyped =
|
|
41
|
+
// (project: INestiaProject) =>
|
|
42
|
+
// (props: {
|
|
43
|
+
// generics: GenericAnalyzer.Dictionary;
|
|
44
|
+
// imports: ImportAnalyzer.Dictionary;
|
|
45
|
+
// controller: IReflectController;
|
|
46
|
+
// operation: IReflectHttpOperation;
|
|
47
|
+
// output: Record<
|
|
48
|
+
// number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
49
|
+
// ITypedHttpRoute.IOutput
|
|
50
|
+
// >;
|
|
51
|
+
// decorator: ts.Decorator;
|
|
52
|
+
// }): boolean => {
|
|
53
|
+
// // CHECK DECORATOR
|
|
54
|
+
// if (!ts.isCallExpression(props.decorator.expression)) return false;
|
|
55
|
+
// else if ((props.decorator.expression.typeArguments ?? []).length !== 1)
|
|
56
|
+
// return false;
|
|
57
|
+
// // CHECK SIGNATURE
|
|
58
|
+
// const signature: ts.Signature | undefined =
|
|
59
|
+
// project.checker.getResolvedSignature(props.decorator.expression);
|
|
60
|
+
// if (!signature || !signature.declaration) return false;
|
|
61
|
+
// else if (
|
|
62
|
+
// path
|
|
63
|
+
// .resolve(signature.declaration.getSourceFile().fileName)
|
|
64
|
+
// .indexOf(TYPED_EXCEPTION_PATH) === -1
|
|
65
|
+
// )
|
|
66
|
+
// return false;
|
|
67
|
+
// // GET TYPE INFO
|
|
68
|
+
// const status: string | null = getStatus(project.checker)(
|
|
69
|
+
// props.decorator.expression.arguments[0] ?? null,
|
|
70
|
+
// );
|
|
71
|
+
// if (status === null) return false;
|
|
72
|
+
// const node: ts.TypeNode = props.decorator.expression.typeArguments![0];
|
|
73
|
+
// const type: ts.Type = project.checker.getTypeFromTypeNode(node);
|
|
74
|
+
// if (type.isTypeParameter()) {
|
|
75
|
+
// project.errors.push({
|
|
76
|
+
// file: props.controller.file,
|
|
77
|
+
// controller: props.controller.name,
|
|
78
|
+
// function: props.operation.name,
|
|
79
|
+
// message: "TypedException() without generic argument specification.",
|
|
80
|
+
// });
|
|
81
|
+
// return false;
|
|
82
|
+
// }
|
|
83
|
+
// const tuple: ITypeTuple | null = ImportAnalyzer.analyze(project.checker)({
|
|
84
|
+
// generics: props.generics,
|
|
85
|
+
// imports: props.imports,
|
|
86
|
+
// type,
|
|
87
|
+
// });
|
|
88
|
+
// if (tuple === null) {
|
|
89
|
+
// project.errors.push({
|
|
90
|
+
// file: props.controller.file,
|
|
91
|
+
// controller: props.controller.name,
|
|
92
|
+
// function: props.operation.name,
|
|
93
|
+
// message: `TypeException() with unknown type on ${status} status.`,
|
|
94
|
+
// });
|
|
95
|
+
// return false;
|
|
96
|
+
// }
|
|
97
|
+
// // DO ASSIGN
|
|
98
|
+
// const matched: IReflectHttpOperation.IException[] = Object.entries(
|
|
99
|
+
// props.operation.exceptions,
|
|
100
|
+
// )
|
|
101
|
+
// .filter(([key]) => status === key)
|
|
102
|
+
// .map(([_key, value]) => value);
|
|
103
|
+
// for (const m of matched)
|
|
104
|
+
// props.output[m.status] = {
|
|
105
|
+
// type: tuple.type,
|
|
106
|
+
// typeName: tuple.typeName,
|
|
107
|
+
// contentType: "application/json",
|
|
108
|
+
// description: m.description,
|
|
109
|
+
// };
|
|
110
|
+
// return true;
|
|
111
|
+
// };
|
|
112
|
+
// const getStatus =
|
|
113
|
+
// (checker: ts.TypeChecker) =>
|
|
114
|
+
// (expression: ts.Expression | null): string | null => {
|
|
115
|
+
// if (expression === null) return null;
|
|
116
|
+
// const type: ts.Type = checker.getTypeAtLocation(expression);
|
|
117
|
+
// const result = MetadataFactory.analyze(checker)({
|
|
118
|
+
// escape: true,
|
|
119
|
+
// constant: true,
|
|
120
|
+
// absorb: true,
|
|
121
|
+
// })(new MetadataCollection())(type);
|
|
122
|
+
// if (false === result.success) return null;
|
|
123
|
+
// const meta: Metadata = result.data;
|
|
124
|
+
// if (meta.constants.length === 1)
|
|
125
|
+
// return meta.constants[0].values[0].value.toString();
|
|
126
|
+
// else if (meta.escaped && meta.escaped.returns.constants.length === 1)
|
|
127
|
+
// return meta.escaped.returns.constants[0].values[0].value.toString();
|
|
128
|
+
// else if (ts.isStringLiteral(expression)) return expression.text;
|
|
129
|
+
// else if (ts.isNumericLiteral(expression)) {
|
|
130
|
+
// const value: number = Number(expression.text.split("_").join(""));
|
|
131
|
+
// if (false === isNaN(value)) return value.toString();
|
|
132
|
+
// }
|
|
133
|
+
// return null;
|
|
134
|
+
// };
|
|
135
|
+
// }
|
|
136
|
+
// const TYPED_EXCEPTION_PATH = path.join(
|
|
137
|
+
// "node_modules",
|
|
138
|
+
// "@nestia",
|
|
139
|
+
// "core",
|
|
140
|
+
// "lib",
|
|
141
|
+
// "decorators",
|
|
142
|
+
// "TypedException.d.ts",
|
|
143
|
+
// );
|
|
107
144
|
//# sourceMappingURL=ExceptionAnalyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExceptionAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ExceptionAnalyzer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExceptionAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ExceptionAnalyzer.ts"],"names":[],"mappings":";AAAA,2BAA2B;AAC3B,+BAA+B;AAC/B,+EAA+E;AAC/E,yEAAyE;AACzE,kEAAkE;AAElE,iEAAiE;AACjE,yEAAyE;AACzE,+EAA+E;AAC/E,yDAAyD;AACzD,mEAAmE;AACnE,uDAAuD;AACvD,qDAAqD;AAErD,uCAAuC;AACvC,2BAA2B;AAC3B,mCAAmC;AACnC,gBAAgB;AAChB,8CAA8C;AAC9C,4CAA4C;AAC5C,wCAAwC;AACxC,0CAA0C;AAC1C,2CAA2C;AAC3C,kBAAkB;AAClB,gDAAgD;AAChD,gCAAgC;AAChC,aAAa;AACb,8BAA8B;AAC9B,kDAAkD;AAClD,kCAAkC;AAClC,uBAAuB;AACvB,mEAAmE;AACnE,yCAAyC;A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BAA0B;AAC1B,wBAAwB;AACxB,4CAA4C;AAC5C,mDAAmD;AAEnD,4CAA4C;AAC5C,yCAAyC;AACzC,+DAA+D;AAC/D,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,oDAAoD;AACpD,6EAA6E;AAC7E,+DAA+D;AAC/D,UAAU;AACV,qBAAqB;AACrB,SAAS;AACT,IAAI;AAEJ,0CAA0C;AAC1C,oBAAoB;AACpB,eAAe;AACf,YAAY;AACZ,WAAW;AACX,kBAAkB;AAClB,2BAA2B;AAC3B,KAAK"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
export declare namespace GenericAnalyzer {
|
|
3
|
-
|
|
4
|
-
function analyze(checker: ts.TypeChecker, classNode: ts.ClassDeclaration): Dictionary;
|
|
3
|
+
function analyze(checker: ts.TypeChecker, classNode: ts.ClassDeclaration): WeakMap<ts.Type, ts.Type>;
|
|
5
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/GenericAnalyzer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAE5B,IAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"GenericAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/GenericAnalyzer.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA4B;AAE5B,IAAiB,eAAe,CA8C/B;AA9CD,WAAiB,eAAe;IAC9B,SAAgB,OAAO,CACrB,OAAuB,EACvB,SAA8B;QAE9B,MAAM,IAAI,GAA8B,IAAI,OAAO,EAAE,CAAC;QACtD,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAPe,uBAAO,UAOtB,CAAA;IAED,SAAS,OAAO,CACd,OAAuB,EACvB,IAA+B,EAC/B,SAA8B;;QAE9B,IAAI,SAAS,CAAC,eAAe,KAAK,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
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { IReflectType } from "../structures/IReflectType";
|
|
3
|
+
import { IReflectTypeImport } from "../structures/IReflectTypeImport";
|
|
5
4
|
export declare namespace ImportAnalyzer {
|
|
6
5
|
interface IOutput {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
imports: IReflectTypeImport[];
|
|
7
|
+
type: IReflectType | null;
|
|
9
8
|
}
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
generics: GenericAnalyzer.Dictionary;
|
|
13
|
-
imports: Dictionary;
|
|
14
|
-
type: ts.Type;
|
|
15
|
-
}) => ITypeTuple | null;
|
|
9
|
+
const analyze: (checker: ts.TypeChecker, generics: WeakMap<ts.Type, ts.Type>, type: ts.Type) => IOutput;
|
|
10
|
+
const unique: (imports: IReflectTypeImport[]) => IReflectTypeImport[];
|
|
16
11
|
}
|
|
@@ -4,46 +4,65 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ImportAnalyzer = void 0;
|
|
7
|
-
const tstl_1 = require("tstl");
|
|
8
7
|
const typescript_1 = __importDefault(require("typescript"));
|
|
8
|
+
const MapUtil_1 = require("../utils/MapUtil");
|
|
9
9
|
var ImportAnalyzer;
|
|
10
10
|
(function (ImportAnalyzer) {
|
|
11
|
-
ImportAnalyzer.analyze = (checker
|
|
12
|
-
const
|
|
13
|
-
explore_escaped_name(checker)(Object.assign(Object.assign({}, props), { type }));
|
|
11
|
+
ImportAnalyzer.analyze = (checker, generics, type) => {
|
|
12
|
+
const imports = new Map();
|
|
14
13
|
try {
|
|
14
|
+
type = escape(checker, type);
|
|
15
15
|
return {
|
|
16
|
-
type
|
|
17
|
-
|
|
16
|
+
type: explore({
|
|
17
|
+
checker,
|
|
18
|
+
generics,
|
|
19
|
+
imports,
|
|
20
|
+
type,
|
|
21
|
+
}),
|
|
22
|
+
imports: [...imports].map(([file, instances]) => ({
|
|
23
|
+
file,
|
|
24
|
+
instances: Array.from(instances),
|
|
25
|
+
})),
|
|
18
26
|
};
|
|
19
27
|
}
|
|
20
28
|
catch (_a) {
|
|
21
|
-
return
|
|
29
|
+
return {
|
|
30
|
+
imports: [],
|
|
31
|
+
type: null,
|
|
32
|
+
};
|
|
22
33
|
}
|
|
23
34
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
ImportAnalyzer.unique = (imports) => {
|
|
36
|
+
const map = new Map();
|
|
37
|
+
imports.forEach(({ file, instances }) => {
|
|
38
|
+
const set = MapUtil_1.MapUtil.take(map, file, () => new Set());
|
|
39
|
+
instances.forEach((instance) => set.add(instance));
|
|
40
|
+
});
|
|
41
|
+
return [...map].map(([file, instances]) => ({
|
|
42
|
+
file,
|
|
43
|
+
instances: Array.from(instances),
|
|
44
|
+
}));
|
|
32
45
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
/* ---------------------------------------------------------
|
|
47
|
+
TYPE
|
|
48
|
+
--------------------------------------------------------- */
|
|
49
|
+
const escape = (checker, type) => {
|
|
50
|
+
if (type.symbol && getNameOfSymbol(type.symbol) === "Promise") {
|
|
51
|
+
const generic = checker.getTypeArguments(type);
|
|
52
|
+
if (generic.length !== 1)
|
|
53
|
+
throw new Error("Error on ImportAnalyzer.analyze(): invalid promise type.");
|
|
54
|
+
type = generic[0];
|
|
55
|
+
}
|
|
56
|
+
return type;
|
|
38
57
|
};
|
|
39
|
-
const
|
|
58
|
+
const getNameOfSymbol = (symbol) => {
|
|
40
59
|
var _a, _b;
|
|
41
|
-
return
|
|
60
|
+
return exploreName(symbol.escapedName.toString(), (_b = (_a = symbol.getDeclarations()) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.parent);
|
|
42
61
|
};
|
|
43
62
|
/* ---------------------------------------------------------
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
63
|
+
ESCAPED TEXT WITH IMPORT STATEMENTS
|
|
64
|
+
--------------------------------------------------------- */
|
|
65
|
+
const explore = (props) => {
|
|
47
66
|
var _a, _b, _c, _d;
|
|
48
67
|
//----
|
|
49
68
|
// CONDITIONAL BRANCHES
|
|
@@ -53,42 +72,51 @@ var ImportAnalyzer;
|
|
|
53
72
|
while (props.generics.has(type) === true)
|
|
54
73
|
type = props.generics.get(type);
|
|
55
74
|
// PRIMITIVE
|
|
56
|
-
const symbol = (_a = type.aliasSymbol) !== null && _a !== void 0 ? _a : type.
|
|
75
|
+
const symbol = (_a = type.aliasSymbol) !== null && _a !== void 0 ? _a : type.symbol;
|
|
57
76
|
// UNION OR INTERSECT
|
|
58
77
|
if (type.aliasSymbol === undefined && type.isUnionOrIntersection()) {
|
|
59
78
|
const joiner = type.isIntersection() ? " & " : " | ";
|
|
60
|
-
return
|
|
61
|
-
|
|
62
|
-
|
|
79
|
+
return {
|
|
80
|
+
name: type.types
|
|
81
|
+
.map((child) => explore(Object.assign(Object.assign({}, props), { type: child })))
|
|
82
|
+
.map(getEscapedText)
|
|
83
|
+
.join(joiner),
|
|
84
|
+
};
|
|
63
85
|
}
|
|
64
86
|
// NO SYMBOL
|
|
65
87
|
else if (symbol === undefined)
|
|
66
|
-
return
|
|
88
|
+
return {
|
|
89
|
+
name: props.checker.typeToString(type, undefined, typescript_1.default.TypeFormatFlags.NoTruncation),
|
|
90
|
+
};
|
|
67
91
|
//----
|
|
68
92
|
// SPECIALIZATION
|
|
69
93
|
//----
|
|
70
|
-
const name =
|
|
94
|
+
const name = getNameOfSymbol(symbol);
|
|
71
95
|
const sourceFile = (_c = (_b = symbol.declarations) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.getSourceFile();
|
|
72
96
|
if (sourceFile === undefined)
|
|
73
|
-
return name;
|
|
97
|
+
return { name };
|
|
74
98
|
else if (sourceFile.fileName.indexOf("typescript/lib") === -1) {
|
|
75
|
-
const set =
|
|
76
|
-
set.
|
|
99
|
+
const set = MapUtil_1.MapUtil.take(props.imports, sourceFile.fileName, () => new Set());
|
|
100
|
+
set.add(name.split(".")[0]);
|
|
77
101
|
}
|
|
78
102
|
// CHECK GENERIC
|
|
79
103
|
const generic = type.aliasSymbol
|
|
80
104
|
? (_d = type.aliasTypeArguments) !== null && _d !== void 0 ? _d : []
|
|
81
|
-
: checker.getTypeArguments(type);
|
|
105
|
+
: props.checker.getTypeArguments(type);
|
|
82
106
|
return generic.length
|
|
83
107
|
? name === "Promise"
|
|
84
|
-
?
|
|
85
|
-
:
|
|
86
|
-
|
|
87
|
-
.
|
|
88
|
-
|
|
108
|
+
? explore(Object.assign(Object.assign({}, props), { type: generic[0] }))
|
|
109
|
+
: {
|
|
110
|
+
name,
|
|
111
|
+
typeArguments: generic.map((child) => explore(Object.assign(Object.assign({}, props), { type: child }))),
|
|
112
|
+
}
|
|
113
|
+
: { name };
|
|
89
114
|
};
|
|
90
|
-
const
|
|
91
|
-
?
|
|
115
|
+
const exploreName = (name, decl) => decl && typescript_1.default.isModuleBlock(decl)
|
|
116
|
+
? exploreName(`${decl.parent.name.getFullText().trim()}.${name}`, decl.parent.parent)
|
|
92
117
|
: name;
|
|
118
|
+
const getEscapedText = (type) => type.typeArguments
|
|
119
|
+
? `${type.name}<${type.typeArguments.map(getEscapedText).join(", ")}>`
|
|
120
|
+
: type.name;
|
|
93
121
|
})(ImportAnalyzer || (exports.ImportAnalyzer = ImportAnalyzer = {}));
|
|
94
122
|
//# sourceMappingURL=ImportAnalyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ImportAnalyzer.ts"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"ImportAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ImportAn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|
|
2
|
+
import { INestiaSdkInput } from "../structures/INestiaSdkInput";
|
|
2
3
|
import { IReflectController } from "../structures/IReflectController";
|
|
3
4
|
export declare namespace ReflectControllerAnalyzer {
|
|
4
|
-
|
|
5
|
+
interface IProps {
|
|
6
|
+
project: INestiaProject;
|
|
7
|
+
controller: INestiaSdkInput.IController;
|
|
8
|
+
unique: WeakSet<Function>;
|
|
9
|
+
}
|
|
10
|
+
const analyze: (props: IProps) => IReflectController | null;
|
|
5
11
|
}
|