@nestia/sdk 3.10.0 → 3.11.0-dev.20240813
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 +34 -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 +18 -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,96 +1,161 @@
|
|
|
1
1
|
import { ranges } from "tstl";
|
|
2
2
|
|
|
3
|
-
import { IErrorReport } from "../structures/IErrorReport";
|
|
4
3
|
import { INestiaProject } from "../structures/INestiaProject";
|
|
5
4
|
import { IReflectController } from "../structures/IReflectController";
|
|
5
|
+
import { IReflectTypeImport } from "../structures/IReflectTypeImport";
|
|
6
6
|
import { IReflectWebSocketOperation } from "../structures/IReflectWebSocketOperation";
|
|
7
|
+
import { IReflectWebSocketOperationParameter } from "../structures/IReflectWebSocketOperationParameter";
|
|
8
|
+
import { IOperationMetadata } from "../transformers/IOperationMetadata";
|
|
9
|
+
import { StringUtil } from "../utils/StringUtil";
|
|
10
|
+
import { ImportAnalyzer } from "./ImportAnalyzer";
|
|
7
11
|
import { PathAnalyzer } from "./PathAnalyzer";
|
|
8
12
|
import { ReflectMetadataAnalyzer } from "./ReflectMetadataAnalyzer";
|
|
9
13
|
|
|
10
14
|
export namespace ReflectWebSocketOperationAnalyzer {
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
export interface IProps {
|
|
16
|
+
project: INestiaProject;
|
|
17
|
+
controller: IReflectController;
|
|
18
|
+
function: Function;
|
|
19
|
+
name: string;
|
|
20
|
+
metadata: IOperationMetadata;
|
|
21
|
+
}
|
|
22
|
+
export const analyze = (ctx: IProps): IReflectWebSocketOperation | null => {
|
|
23
|
+
const route: { paths: string[] } | undefined = Reflect.getMetadata(
|
|
24
|
+
"nestia/WebSocketRoute",
|
|
25
|
+
ctx.function,
|
|
26
|
+
);
|
|
27
|
+
if (route === undefined) return null;
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
// @todo -> detailing is required
|
|
30
|
+
const errors: string[] = [];
|
|
31
|
+
const preconfigured: IReflectWebSocketOperationParameter.IPreconfigured[] =
|
|
32
|
+
(
|
|
26
33
|
(Reflect.getMetadata(
|
|
27
34
|
"nestia/WebSocketRoute/Parameters",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
) ?? []) as
|
|
35
|
+
ctx.controller.class.prototype,
|
|
36
|
+
ctx.name,
|
|
37
|
+
) ?? []) as IReflectWebSocketOperationParameter[]
|
|
31
38
|
).sort((a, b) => a.index - b.index);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
39
|
+
if (preconfigured.find((p) => (p.category === "acceptor") === undefined))
|
|
40
|
+
errors.push("@WebSocketRoute.Acceptor() is essentially required");
|
|
41
|
+
if (preconfigured.length !== ctx.function.length)
|
|
42
|
+
errors.push(
|
|
43
|
+
[
|
|
44
|
+
"Every parameters must be one of below:",
|
|
45
|
+
" - @WebSocketRoute.Acceptor()",
|
|
46
|
+
" - @WebSocketRoute.Driver()",
|
|
47
|
+
" - @WebSocketRoute.Header()",
|
|
48
|
+
" - @WebSocketRoute.Param()",
|
|
49
|
+
" - @WebSocketRoute.Query()",
|
|
50
|
+
].join("\n"),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const imports: IReflectTypeImport[] = [];
|
|
54
|
+
const parameters: IReflectWebSocketOperationParameter[] = preconfigured
|
|
55
|
+
.map((p) => {
|
|
56
|
+
// METADATA INFO
|
|
57
|
+
const matched: IOperationMetadata.IParameter | undefined =
|
|
58
|
+
ctx.metadata.parameters.find((m) => p.index === m.index);
|
|
59
|
+
|
|
60
|
+
// VALIDATE PARAMETER
|
|
61
|
+
if (matched === undefined)
|
|
62
|
+
return errors.push(
|
|
63
|
+
`Unable to find parameter type of the ${p.index} (th).`,
|
|
64
|
+
);
|
|
65
|
+
else if (matched.type === null)
|
|
66
|
+
return errors.push(
|
|
67
|
+
`Failed to analyze the parameter type of the ${JSON.stringify(matched.name)}.`,
|
|
68
|
+
);
|
|
69
|
+
else if (
|
|
70
|
+
p.category === "param" &&
|
|
71
|
+
!(p as IReflectWebSocketOperationParameter.IParam).field?.length
|
|
72
|
+
)
|
|
73
|
+
return errors.push(`@WebSocketRoute.Param() must have a field name.`);
|
|
74
|
+
else if (
|
|
75
|
+
p.category === "acceptor" &&
|
|
76
|
+
matched.type?.typeArguments?.length !== 3
|
|
77
|
+
)
|
|
78
|
+
return `@WebSocketRoute.Acceptor() must have three type arguments.`;
|
|
79
|
+
else if (
|
|
80
|
+
p.category === "driver" &&
|
|
81
|
+
matched.type?.typeArguments?.length !== 1
|
|
82
|
+
)
|
|
83
|
+
return errors.push(
|
|
84
|
+
`@WebSocketRoute.Driver() must have one type argument.`,
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// COMPLETE COMPOSITION
|
|
88
|
+
imports.push(...matched.imports);
|
|
89
|
+
if (
|
|
90
|
+
p.category === "acceptor" ||
|
|
91
|
+
p.category === "driver" ||
|
|
92
|
+
p.category === "query"
|
|
93
|
+
)
|
|
94
|
+
return {
|
|
95
|
+
...p,
|
|
96
|
+
name: matched.name,
|
|
97
|
+
type: matched.type,
|
|
98
|
+
};
|
|
99
|
+
else if (p.category === "param")
|
|
100
|
+
return {
|
|
101
|
+
...p,
|
|
102
|
+
category: "param",
|
|
103
|
+
field: p.field!,
|
|
104
|
+
name: matched.name,
|
|
105
|
+
type: matched.type,
|
|
106
|
+
imports: matched.imports,
|
|
107
|
+
description: matched.description,
|
|
108
|
+
jsDocTags: matched.jsDocTags,
|
|
109
|
+
} satisfies IReflectWebSocketOperationParameter.IParam;
|
|
110
|
+
|
|
111
|
+
// UNKNOWN TYPE, MAYBE NEW FEATURE
|
|
112
|
+
console.log(p);
|
|
113
|
+
return errors.push(
|
|
114
|
+
`@WebSocketRoute.${StringUtil.capitalize(p.category)}() has not been supported yet. How about upgrading the nestia packages?`,
|
|
115
|
+
);
|
|
116
|
+
})
|
|
117
|
+
.filter((p): p is IReflectWebSocketOperationParameter => !!p);
|
|
53
118
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
119
|
+
const fields: string[] = preconfigured
|
|
120
|
+
.filter((p) => p.category === "param")
|
|
121
|
+
.map((p) => p.field ?? "")
|
|
122
|
+
.filter((field): field is string => !!field?.length)
|
|
123
|
+
.sort();
|
|
124
|
+
for (const cLoc of ctx.controller.paths)
|
|
125
|
+
for (const mLoc of route.paths) {
|
|
126
|
+
const location: string = PathAnalyzer.join(cLoc, mLoc);
|
|
127
|
+
if (location.includes("*")) continue;
|
|
62
128
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
if (ranges.equal(binded.sort(), fields) === false)
|
|
74
|
-
errors.push({
|
|
75
|
-
file: props.controller.file,
|
|
76
|
-
controller: props.controller.name,
|
|
77
|
-
function: props.name,
|
|
78
|
-
message: `binded arguments in the "path" between function's decorator and parameters' decorators are different (function: [${binded.join(
|
|
79
|
-
", ",
|
|
80
|
-
)}], parameters: [${fields.join(", ")}]).`,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if (errors.length) {
|
|
84
|
-
project.errors.push(...errors);
|
|
85
|
-
return null;
|
|
129
|
+
const binded: string[] | null = PathAnalyzer.parameters(location);
|
|
130
|
+
if (binded === null)
|
|
131
|
+
errors.push(`invalid path (${JSON.stringify(location)})`);
|
|
132
|
+
else if (ranges.equal(binded.sort(), fields) === false)
|
|
133
|
+
errors.push(
|
|
134
|
+
`binded arguments in the "path" between function's decorator and parameters' decorators are different (function: [${binded.join(
|
|
135
|
+
", ",
|
|
136
|
+
)}], parameters: [${fields.join(", ")}]).`,
|
|
137
|
+
);
|
|
86
138
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
};
|
|
139
|
+
if (errors.length) {
|
|
140
|
+
ctx.project.errors.push({
|
|
141
|
+
file: ctx.controller.file,
|
|
142
|
+
class: ctx.controller.class.name,
|
|
143
|
+
function: ctx.function.name,
|
|
144
|
+
from: ctx.name,
|
|
145
|
+
contents: errors,
|
|
146
|
+
});
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
protocol: "websocket",
|
|
151
|
+
name: ctx.name,
|
|
152
|
+
paths: route.paths,
|
|
153
|
+
function: ctx.function,
|
|
154
|
+
versions: ReflectMetadataAnalyzer.versions(ctx.function),
|
|
155
|
+
parameters,
|
|
156
|
+
imports: ImportAnalyzer.unique(imports),
|
|
157
|
+
description: ctx.metadata.description ?? null,
|
|
158
|
+
jsDocTags: ctx.metadata.jsDocTags,
|
|
95
159
|
};
|
|
160
|
+
};
|
|
96
161
|
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { MetadataFactory } from "typia/lib/factories/MetadataFactory";
|
|
2
|
+
import { IMetadata } from "typia/lib/schemas/metadata/IMetadata";
|
|
3
|
+
import { IMetadataComponents } from "typia/lib/schemas/metadata/IMetadataComponents";
|
|
4
|
+
import { IMetadataDictionary } from "typia/lib/schemas/metadata/IMetadataDictionary";
|
|
5
|
+
import { Metadata } from "typia/lib/schemas/metadata/Metadata";
|
|
6
|
+
import { MetadataComponents } from "typia/lib/schemas/metadata/MetadataComponents";
|
|
7
|
+
import { MetadataObject } from "typia/lib/schemas/metadata/MetadataObject";
|
|
8
|
+
import { Escaper } from "typia/lib/utils/Escaper";
|
|
9
|
+
|
|
10
|
+
import { IReflectController } from "../structures/IReflectController";
|
|
11
|
+
import { IReflectHttpOperation } from "../structures/IReflectHttpOperation";
|
|
12
|
+
import { IReflectOperationError } from "../structures/IReflectOperationError";
|
|
13
|
+
import { ITypedHttpRoute } from "../structures/ITypedHttpRoute";
|
|
14
|
+
import { ITypedHttpRouteException } from "../structures/ITypedHttpRouteException";
|
|
15
|
+
import { ITypedHttpRouteParameter } from "../structures/ITypedHttpRouteParameter";
|
|
16
|
+
import { ITypedHttpRouteSuccess } from "../structures/ITypedHttpRouteSuccess";
|
|
17
|
+
import { PathUtil } from "../utils/PathUtil";
|
|
18
|
+
|
|
19
|
+
export namespace TypedHttpRouteAnalyzer {
|
|
20
|
+
export const dictionary = (
|
|
21
|
+
controllers: IReflectController[],
|
|
22
|
+
): IMetadataDictionary => {
|
|
23
|
+
const individual: IMetadataComponents[] = [];
|
|
24
|
+
for (const c of controllers)
|
|
25
|
+
for (const o of c.operations) {
|
|
26
|
+
if (o.protocol !== "http") continue;
|
|
27
|
+
if (o.success) individual.push(o.success.components);
|
|
28
|
+
for (const p of o.parameters) individual.push(p.components);
|
|
29
|
+
for (const e of Object.values(o.exceptions))
|
|
30
|
+
individual.push(e.components);
|
|
31
|
+
}
|
|
32
|
+
const components: MetadataComponents = MetadataComponents.from({
|
|
33
|
+
objects: Object.values(
|
|
34
|
+
Object.fromEntries(
|
|
35
|
+
individual.map((c) => c.objects.map((o) => [o.name, o])).flat(),
|
|
36
|
+
),
|
|
37
|
+
),
|
|
38
|
+
arrays: Object.values(
|
|
39
|
+
Object.fromEntries(
|
|
40
|
+
individual.map((c) => c.arrays.map((a) => [a.name, a])).flat(),
|
|
41
|
+
),
|
|
42
|
+
),
|
|
43
|
+
tuples: Object.values(
|
|
44
|
+
Object.fromEntries(
|
|
45
|
+
individual.map((c) => c.tuples.map((t) => [t.name, t])).flat(),
|
|
46
|
+
),
|
|
47
|
+
),
|
|
48
|
+
aliases: Object.values(
|
|
49
|
+
Object.fromEntries(
|
|
50
|
+
individual.map((c) => c.aliases.map((a) => [a.name, a])).flat(),
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
});
|
|
54
|
+
return components.dictionary;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const analyze = (props: {
|
|
58
|
+
controller: IReflectController;
|
|
59
|
+
errors: IReflectOperationError[];
|
|
60
|
+
dictionary: IMetadataDictionary;
|
|
61
|
+
operation: IReflectHttpOperation;
|
|
62
|
+
paths: string[];
|
|
63
|
+
}): ITypedHttpRoute[] => {
|
|
64
|
+
const errors: IReflectOperationError[] = [];
|
|
65
|
+
const cast = (
|
|
66
|
+
next: {
|
|
67
|
+
metadata: IMetadata;
|
|
68
|
+
validate: MetadataFactory.Validator;
|
|
69
|
+
},
|
|
70
|
+
from: string,
|
|
71
|
+
escape: boolean,
|
|
72
|
+
): Metadata => {
|
|
73
|
+
const metadata: Metadata = Metadata.from(next.metadata, props.dictionary);
|
|
74
|
+
const metaErrors: MetadataFactory.IError[] = MetadataFactory.validate()({
|
|
75
|
+
escape,
|
|
76
|
+
constant: true,
|
|
77
|
+
absorb: true,
|
|
78
|
+
validate: next.validate,
|
|
79
|
+
})(next.validate)(metadata);
|
|
80
|
+
if (metaErrors.length)
|
|
81
|
+
errors.push({
|
|
82
|
+
file: props.controller.file,
|
|
83
|
+
class: props.controller.class.name,
|
|
84
|
+
function: props.operation.name,
|
|
85
|
+
from,
|
|
86
|
+
contents: metaErrors.map((e) => ({
|
|
87
|
+
name: e.name,
|
|
88
|
+
accessor:
|
|
89
|
+
e.explore.object !== null
|
|
90
|
+
? join({
|
|
91
|
+
object: e.explore.object,
|
|
92
|
+
key: e.explore.property,
|
|
93
|
+
})
|
|
94
|
+
: null,
|
|
95
|
+
messages: e.messages,
|
|
96
|
+
})),
|
|
97
|
+
});
|
|
98
|
+
return metadata;
|
|
99
|
+
};
|
|
100
|
+
const exceptions: Record<
|
|
101
|
+
number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
102
|
+
ITypedHttpRouteException
|
|
103
|
+
> = Object.fromEntries(
|
|
104
|
+
Object.entries(props.operation.exceptions).map(([key, value]) => [
|
|
105
|
+
key as any,
|
|
106
|
+
{
|
|
107
|
+
status: value.status,
|
|
108
|
+
description: value.description,
|
|
109
|
+
example: value.example,
|
|
110
|
+
examples: value.examples,
|
|
111
|
+
type: value.type,
|
|
112
|
+
metadata: cast(value, `exception (status: ${key})`, true),
|
|
113
|
+
},
|
|
114
|
+
]),
|
|
115
|
+
);
|
|
116
|
+
const parameters: ITypedHttpRouteParameter[] =
|
|
117
|
+
props.operation.parameters.map((p) => ({
|
|
118
|
+
...p,
|
|
119
|
+
metadata: cast(
|
|
120
|
+
p,
|
|
121
|
+
`parameter (name: ${JSON.stringify(p.name)})`,
|
|
122
|
+
p.category === "body" &&
|
|
123
|
+
(p.contentType === "application/json" || p.encrypted === true),
|
|
124
|
+
),
|
|
125
|
+
}));
|
|
126
|
+
const success: ITypedHttpRouteSuccess = {
|
|
127
|
+
...props.operation.success,
|
|
128
|
+
metadata: cast(
|
|
129
|
+
props.operation.success,
|
|
130
|
+
"success",
|
|
131
|
+
props.operation.success.encrypted ||
|
|
132
|
+
props.operation.success.contentType === "application/json",
|
|
133
|
+
),
|
|
134
|
+
setHeaders: props.operation.jsDocTags
|
|
135
|
+
.filter(
|
|
136
|
+
(t) =>
|
|
137
|
+
t.text?.length &&
|
|
138
|
+
t.text[0].text &&
|
|
139
|
+
(t.name === "setHeader" || t.name === "assignHeaders"),
|
|
140
|
+
)
|
|
141
|
+
.map((t) =>
|
|
142
|
+
t.name === "setHeader"
|
|
143
|
+
? {
|
|
144
|
+
type: "setter",
|
|
145
|
+
source: t.text![0].text.split(" ")[0].trim(),
|
|
146
|
+
target: t.text![0].text.split(" ")[1]?.trim(),
|
|
147
|
+
}
|
|
148
|
+
: {
|
|
149
|
+
type: "assigner",
|
|
150
|
+
source: t.text![0].text,
|
|
151
|
+
},
|
|
152
|
+
),
|
|
153
|
+
};
|
|
154
|
+
if (errors.length) return [];
|
|
155
|
+
return props.paths.map((path) => ({
|
|
156
|
+
...props.operation,
|
|
157
|
+
controller: props.controller,
|
|
158
|
+
path,
|
|
159
|
+
accessors: [...PathUtil.accessors(path), props.operation.name],
|
|
160
|
+
exceptions,
|
|
161
|
+
parameters,
|
|
162
|
+
success,
|
|
163
|
+
}));
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const join = ({
|
|
168
|
+
object,
|
|
169
|
+
key,
|
|
170
|
+
}: {
|
|
171
|
+
object: MetadataObject;
|
|
172
|
+
key: string | object | null;
|
|
173
|
+
}) => {
|
|
174
|
+
if (key === null) return object.name;
|
|
175
|
+
else if (typeof key === "object") return `${object.name}[key]`;
|
|
176
|
+
else if (Escaper.variable(key)) return `${object.name}.${key}`;
|
|
177
|
+
return `${object.name}[${JSON.stringify(key)}]`;
|
|
178
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IReflectController } from "../structures/IReflectController";
|
|
2
|
+
import { IReflectWebSocketOperation } from "../structures/IReflectWebSocketOperation";
|
|
3
|
+
import { ITypedWebSocketRoute } from "../structures/ITypedWebSocketRoute";
|
|
4
|
+
import { PathUtil } from "../utils/PathUtil";
|
|
5
|
+
|
|
6
|
+
export namespace TypedWebSocketRouteAnalyzer {
|
|
7
|
+
export const analyze = (props: {
|
|
8
|
+
controller: IReflectController;
|
|
9
|
+
operation: IReflectWebSocketOperation;
|
|
10
|
+
paths: string[];
|
|
11
|
+
}): ITypedWebSocketRoute[] =>
|
|
12
|
+
props.paths.map((path) => ({
|
|
13
|
+
...props.operation,
|
|
14
|
+
controller: props.controller,
|
|
15
|
+
path,
|
|
16
|
+
accessors: [...PathUtil.accessors(path), props.operation.name],
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IOperationMetadata } from "../transformers/IOperationMetadata";
|
|
2
|
+
|
|
3
|
+
export function OperationMetadata(
|
|
4
|
+
metadata: IOperationMetadata,
|
|
5
|
+
): MethodDecorator {
|
|
6
|
+
return function OperationMetadata(target, propertyKey, descriptor) {
|
|
7
|
+
Reflect.defineMetadata(
|
|
8
|
+
"nestia/OperationMetadata",
|
|
9
|
+
metadata,
|
|
10
|
+
target,
|
|
11
|
+
propertyKey,
|
|
12
|
+
);
|
|
13
|
+
return descriptor;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NoTransformConfigureError } from "@nestia/core/lib/decorators/internal/NoTransformConfigureError";
|
|
1
2
|
import fs from "fs";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import { register } from "ts-node";
|
|
@@ -32,15 +33,29 @@ export namespace NestiaConfigLoader {
|
|
|
32
33
|
|
|
33
34
|
export const config = async (
|
|
34
35
|
file: string,
|
|
35
|
-
|
|
36
|
+
compilerOptions: Record<string, any>,
|
|
36
37
|
): Promise<INestiaConfig> => {
|
|
37
38
|
if (fs.existsSync(path.resolve(file)) === false)
|
|
38
39
|
throw new Error(`Unable to find "${file}" file.`);
|
|
39
40
|
|
|
41
|
+
(NoTransformConfigureError as any).throws = false;
|
|
42
|
+
const plugins: any[] = [
|
|
43
|
+
...typia
|
|
44
|
+
.assert<object[]>(compilerOptions.plugins ?? [])
|
|
45
|
+
.filter(
|
|
46
|
+
(x: any) =>
|
|
47
|
+
x.transform !== "@nestia/core/lib/transform" &&
|
|
48
|
+
x.transform !== "@nestia/sdk/lib/transform",
|
|
49
|
+
),
|
|
50
|
+
{ transform: "@nestia/sdk/lib/transform" },
|
|
51
|
+
];
|
|
40
52
|
register({
|
|
41
53
|
emit: false,
|
|
42
|
-
compilerOptions:
|
|
43
|
-
|
|
54
|
+
compilerOptions: {
|
|
55
|
+
...compilerOptions,
|
|
56
|
+
plugins,
|
|
57
|
+
},
|
|
58
|
+
require: compilerOptions.baseUrl
|
|
44
59
|
? ["tsconfig-paths/register"]
|
|
45
60
|
: undefined,
|
|
46
61
|
});
|
|
@@ -34,10 +34,7 @@ export namespace NestiaSdkCommand {
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
// GENERATE
|
|
37
|
-
const app: NestiaSdkApplication = new NestiaSdkApplication(
|
|
38
|
-
config,
|
|
39
|
-
command.options,
|
|
40
|
-
);
|
|
37
|
+
const app: NestiaSdkApplication = new NestiaSdkApplication(config);
|
|
41
38
|
await task(app);
|
|
42
39
|
};
|
|
43
40
|
|
|
@@ -1,64 +1,65 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import ts from "typescript";
|
|
1
|
+
// import fs from "fs";
|
|
2
|
+
// import ts from "typescript";
|
|
3
3
|
|
|
4
|
-
import { INestiaProject } from "../structures/INestiaProject";
|
|
5
|
-
import {
|
|
6
|
-
import { FilePrinter } from "./internal/FilePrinter";
|
|
7
|
-
import { ImportDictionary } from "./internal/ImportDictionary";
|
|
8
|
-
import { SdkHttpCloneProgrammer } from "./internal/SdkHttpCloneProgrammer";
|
|
4
|
+
// import { INestiaProject } from "../structures/INestiaProject";
|
|
5
|
+
// import { ITypedApplication } from "../structures/ITypedApplication";
|
|
6
|
+
// import { FilePrinter } from "./internal/FilePrinter";
|
|
7
|
+
// import { ImportDictionary } from "./internal/ImportDictionary";
|
|
8
|
+
// // import { SdkHttpCloneProgrammer } from "./internal/SdkHttpCloneProgrammer";
|
|
9
9
|
|
|
10
|
-
export namespace CloneGenerator {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
// export namespace CloneGenerator {
|
|
11
|
+
// export const write = async (app: ITypedApplication): Promise<void> => {
|
|
12
|
+
// // const dict: Map<string, SdkHttpCloneProgrammer.IModule> =
|
|
13
|
+
// // SdkHttpCloneProgrammer.write(app.project)(
|
|
14
|
+
// // app.routes.filter((r) => r.protocol === "http"),
|
|
15
|
+
// // );
|
|
16
|
+
// if (dict.size === 0) return;
|
|
17
|
+
// try {
|
|
18
|
+
// await fs.promises.mkdir(`${app.project.config.output}/structures`);
|
|
19
|
+
// } catch {}
|
|
20
|
+
// for (const [key, value] of dict)
|
|
21
|
+
// await writeDtoFile(app.project)(key, value);
|
|
22
|
+
// };
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
// const writeDtoFile =
|
|
25
|
+
// (project: INestiaProject) =>
|
|
26
|
+
// async (
|
|
27
|
+
// key: string,
|
|
28
|
+
// value: SdkHttpCloneProgrammer.IModule,
|
|
29
|
+
// ): Promise<void> => {
|
|
30
|
+
// const location: string = `${project.config.output}/structures/${key}.ts`;
|
|
31
|
+
// const importer: ImportDictionary = new ImportDictionary(location);
|
|
32
|
+
// const statements: ts.Statement[] = iterate(importer)(value);
|
|
33
|
+
// if (statements.length === 0) return;
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
// await FilePrinter.write({
|
|
36
|
+
// location,
|
|
37
|
+
// statements: [
|
|
38
|
+
// ...importer.toStatements(`${project.config.output}/structures`),
|
|
39
|
+
// ...(importer.empty() ? [] : [FilePrinter.enter()]),
|
|
40
|
+
// ...statements,
|
|
41
|
+
// ],
|
|
42
|
+
// });
|
|
43
|
+
// };
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
45
|
+
// const iterate =
|
|
46
|
+
// (importer: ImportDictionary) =>
|
|
47
|
+
// (modulo: SdkHttpCloneProgrammer.IModule): ts.Statement[] => {
|
|
48
|
+
// const output: ts.Statement[] = [];
|
|
49
|
+
// if (modulo.programmer !== null) output.push(modulo.programmer(importer));
|
|
50
|
+
// if (modulo.children.size) {
|
|
51
|
+
// const internal: ts.Statement[] = [];
|
|
52
|
+
// for (const child of modulo.children.values())
|
|
53
|
+
// internal.push(...iterate(importer)(child));
|
|
54
|
+
// output.push(
|
|
55
|
+
// ts.factory.createModuleDeclaration(
|
|
56
|
+
// [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)],
|
|
57
|
+
// ts.factory.createIdentifier(modulo.name),
|
|
58
|
+
// ts.factory.createModuleBlock(internal),
|
|
59
|
+
// ts.NodeFlags.Namespace,
|
|
60
|
+
// ),
|
|
61
|
+
// );
|
|
62
|
+
// }
|
|
63
|
+
// return output;
|
|
64
|
+
// };
|
|
65
|
+
// }
|