@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,5 +1,4 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import typia from "typia";
|
|
3
2
|
import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
|
|
4
3
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
|
5
4
|
import { LiteralFactory } from "typia/lib/factories/LiteralFactory";
|
|
@@ -7,14 +6,13 @@ import { TypeFactory } from "typia/lib/factories/TypeFactory";
|
|
|
7
6
|
import { Escaper } from "typia/lib/utils/Escaper";
|
|
8
7
|
|
|
9
8
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
10
|
-
import { IReflectHttpOperation } from "../../structures/IReflectHttpOperation";
|
|
11
9
|
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
10
|
+
import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
|
|
12
11
|
import { FilePrinter } from "./FilePrinter";
|
|
13
12
|
import { ImportDictionary } from "./ImportDictionary";
|
|
14
13
|
import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
15
14
|
import { SdkHttpSimulationProgrammer } from "./SdkHttpSimulationProgrammer";
|
|
16
15
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
17
|
-
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
18
16
|
|
|
19
17
|
export namespace SdkHttpNamespaceProgrammer {
|
|
20
18
|
export const write =
|
|
@@ -23,9 +21,9 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
23
21
|
(
|
|
24
22
|
route: ITypedHttpRoute,
|
|
25
23
|
props: {
|
|
26
|
-
headers:
|
|
27
|
-
query:
|
|
28
|
-
input:
|
|
24
|
+
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
25
|
+
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
26
|
+
input: ITypedHttpRouteParameter.IBody | undefined;
|
|
29
27
|
},
|
|
30
28
|
): ts.ModuleDeclaration => {
|
|
31
29
|
const types = write_types(project)(importer)(route, props);
|
|
@@ -37,7 +35,7 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
37
35
|
...(types.length ? [FilePrinter.enter()] : []),
|
|
38
36
|
write_metadata(importer)(route, props),
|
|
39
37
|
FilePrinter.enter(),
|
|
40
|
-
write_path(
|
|
38
|
+
write_path(route, props.query),
|
|
41
39
|
...(project.config.simulate
|
|
42
40
|
? [
|
|
43
41
|
SdkHttpSimulationProgrammer.random(project)(importer)(route),
|
|
@@ -48,7 +46,7 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
48
46
|
]
|
|
49
47
|
: []),
|
|
50
48
|
...(project.config.json &&
|
|
51
|
-
|
|
49
|
+
props.input !== undefined &&
|
|
52
50
|
(props.input.contentType === "application/json" ||
|
|
53
51
|
props.input.encrypted === true)
|
|
54
52
|
? [write_stringify(project)(importer)]
|
|
@@ -64,9 +62,9 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
64
62
|
(
|
|
65
63
|
route: ITypedHttpRoute,
|
|
66
64
|
props: {
|
|
67
|
-
headers:
|
|
68
|
-
query:
|
|
69
|
-
input:
|
|
65
|
+
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
66
|
+
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
67
|
+
input: ITypedHttpRouteParameter.IBody | undefined;
|
|
70
68
|
},
|
|
71
69
|
): ts.TypeAliasDeclaration[] => {
|
|
72
70
|
const array: ts.TypeAliasDeclaration[] = [];
|
|
@@ -94,7 +92,7 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
94
92
|
"Input",
|
|
95
93
|
SdkAliasCollection.input(project)(importer)(props.input),
|
|
96
94
|
);
|
|
97
|
-
if (
|
|
95
|
+
if (route.success.type.name !== "void")
|
|
98
96
|
declare("Output", SdkAliasCollection.output(project)(importer)(route));
|
|
99
97
|
return array;
|
|
100
98
|
};
|
|
@@ -104,9 +102,9 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
104
102
|
(
|
|
105
103
|
route: ITypedHttpRoute,
|
|
106
104
|
props: {
|
|
107
|
-
headers:
|
|
108
|
-
query:
|
|
109
|
-
input:
|
|
105
|
+
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
106
|
+
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
107
|
+
input: ITypedHttpRouteParameter.IBody | undefined;
|
|
110
108
|
},
|
|
111
109
|
): ts.VariableStatement =>
|
|
112
110
|
constant("METADATA")(
|
|
@@ -125,9 +123,7 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
125
123
|
"request",
|
|
126
124
|
props.input
|
|
127
125
|
? LiteralFactory.generate(
|
|
128
|
-
|
|
129
|
-
props.input,
|
|
130
|
-
)
|
|
126
|
+
props.input !== undefined
|
|
131
127
|
? {
|
|
132
128
|
type: props.input.contentType,
|
|
133
129
|
encrypted: !!props.input.encrypted,
|
|
@@ -143,18 +139,18 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
143
139
|
"response",
|
|
144
140
|
route.method !== "HEAD"
|
|
145
141
|
? LiteralFactory.generate({
|
|
146
|
-
type: route.
|
|
147
|
-
encrypted: !!route.encrypted,
|
|
142
|
+
type: route.success.contentType,
|
|
143
|
+
encrypted: !!route.success.encrypted,
|
|
148
144
|
})
|
|
149
145
|
: ts.factory.createNull(),
|
|
150
146
|
),
|
|
151
147
|
ts.factory.createPropertyAssignment(
|
|
152
148
|
"status",
|
|
153
|
-
route.status !==
|
|
154
|
-
? ExpressionFactory.number(route.status)
|
|
149
|
+
route.success.status !== null
|
|
150
|
+
? ExpressionFactory.number(route.success.status)
|
|
155
151
|
: ts.factory.createNull(),
|
|
156
152
|
),
|
|
157
|
-
...(route.
|
|
153
|
+
...(route.success.contentType ===
|
|
158
154
|
"application/x-www-form-urlencoded"
|
|
159
155
|
? [
|
|
160
156
|
ts.factory.createPropertyAssignment(
|
|
@@ -163,11 +159,7 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
163
159
|
ts.factory.createIdentifier(
|
|
164
160
|
`${SdkImportWizard.typia(importer)}.http.createAssertQuery`,
|
|
165
161
|
),
|
|
166
|
-
[
|
|
167
|
-
ts.factory.createTypeReferenceNode(
|
|
168
|
-
route.output.typeName,
|
|
169
|
-
),
|
|
170
|
-
],
|
|
162
|
+
[SdkAliasCollection.name(route.success.type)],
|
|
171
163
|
undefined,
|
|
172
164
|
),
|
|
173
165
|
),
|
|
@@ -182,278 +174,263 @@ export namespace SdkHttpNamespaceProgrammer {
|
|
|
182
174
|
),
|
|
183
175
|
);
|
|
184
176
|
|
|
185
|
-
const write_path =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
): ts.VariableStatement => {
|
|
194
|
-
const g = {
|
|
195
|
-
total: [
|
|
196
|
-
...route.parameters.filter(
|
|
197
|
-
(param) => param.category === "param" || param.category === "query",
|
|
198
|
-
),
|
|
199
|
-
],
|
|
200
|
-
query: route.parameters.filter(
|
|
201
|
-
(param) => param.category === "query" && param.field !== undefined,
|
|
177
|
+
const write_path = (
|
|
178
|
+
route: ITypedHttpRoute,
|
|
179
|
+
query: ITypedHttpRouteParameter.IQuery | undefined,
|
|
180
|
+
): ts.VariableStatement => {
|
|
181
|
+
const g = {
|
|
182
|
+
total: [
|
|
183
|
+
...route.parameters.filter(
|
|
184
|
+
(param) => param.category === "param" || param.category === "query",
|
|
202
185
|
),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
186
|
+
],
|
|
187
|
+
query: route.parameters
|
|
188
|
+
.filter((param) => param.category === "query")
|
|
189
|
+
.filter((param) => param.field !== null),
|
|
190
|
+
path: route.parameters.filter((param) => param.category === "param"),
|
|
191
|
+
};
|
|
192
|
+
const out = (body: ts.ConciseBody) =>
|
|
193
|
+
constant("path")(
|
|
194
|
+
ts.factory.createArrowFunction(
|
|
195
|
+
[],
|
|
196
|
+
[],
|
|
197
|
+
g.total.map((p) =>
|
|
198
|
+
IdentifierFactory.parameter(
|
|
199
|
+
p.name,
|
|
200
|
+
p === query
|
|
201
|
+
? p.metadata.isRequired() === false
|
|
202
|
+
? ts.factory.createUnionTypeNode([
|
|
203
|
+
ts.factory.createTypeReferenceNode(`${route.name}.Query`),
|
|
204
|
+
ts.factory.createTypeReferenceNode("undefined"),
|
|
205
|
+
])
|
|
206
|
+
: ts.factory.createTypeReferenceNode(`${route.name}.Query`)
|
|
207
|
+
: SdkAliasCollection.name(p.type),
|
|
224
208
|
),
|
|
225
|
-
undefined,
|
|
226
|
-
undefined,
|
|
227
|
-
body,
|
|
228
209
|
),
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
210
|
+
undefined,
|
|
211
|
+
undefined,
|
|
212
|
+
body,
|
|
213
|
+
),
|
|
214
|
+
);
|
|
215
|
+
if (g.total.length === 0)
|
|
216
|
+
return out(ts.factory.createStringLiteral(route.path));
|
|
232
217
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
),
|
|
250
|
-
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
|
|
251
|
-
ts.factory.createStringLiteral("null"),
|
|
218
|
+
const template = () => {
|
|
219
|
+
const splitted: string[] = route.path.split(":");
|
|
220
|
+
if (splitted.length === 1)
|
|
221
|
+
return ts.factory.createStringLiteral(route.path);
|
|
222
|
+
return ts.factory.createTemplateExpression(
|
|
223
|
+
ts.factory.createTemplateHead(splitted[0]),
|
|
224
|
+
splitted.slice(1).map((s, i, arr) => {
|
|
225
|
+
const name: string = s.split("/")[0];
|
|
226
|
+
return ts.factory.createTemplateSpan(
|
|
227
|
+
ts.factory.createCallExpression(
|
|
228
|
+
ts.factory.createIdentifier("encodeURIComponent"),
|
|
229
|
+
undefined,
|
|
230
|
+
[
|
|
231
|
+
ts.factory.createBinaryExpression(
|
|
232
|
+
ts.factory.createIdentifier(
|
|
233
|
+
g.path.find((p) => p.field === name)!.name,
|
|
252
234
|
),
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
235
|
+
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
|
|
236
|
+
ts.factory.createStringLiteral("null"),
|
|
237
|
+
),
|
|
238
|
+
],
|
|
239
|
+
),
|
|
240
|
+
(i !== arr.length - 1
|
|
241
|
+
? ts.factory.createTemplateMiddle
|
|
242
|
+
: ts.factory.createTemplateTail)(s.substring(name.length)),
|
|
243
|
+
);
|
|
244
|
+
}),
|
|
245
|
+
);
|
|
246
|
+
};
|
|
247
|
+
if (query === undefined && g.query.length === 0) return out(template());
|
|
264
248
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
[],
|
|
279
|
-
[],
|
|
280
|
-
),
|
|
249
|
+
const block = (expr: ts.Expression) => {
|
|
250
|
+
const computeName = (str: string): string =>
|
|
251
|
+
g.total.find((p) => p.name === str) !== undefined
|
|
252
|
+
? computeName("_" + str)
|
|
253
|
+
: str;
|
|
254
|
+
const variables: string = computeName("variables");
|
|
255
|
+
return ts.factory.createBlock(
|
|
256
|
+
[
|
|
257
|
+
local(variables)("URLSearchParams")(
|
|
258
|
+
ts.factory.createNewExpression(
|
|
259
|
+
ts.factory.createIdentifier("URLSearchParams"),
|
|
260
|
+
[],
|
|
261
|
+
[],
|
|
281
262
|
),
|
|
282
|
-
|
|
263
|
+
),
|
|
264
|
+
ts.factory.createForOfStatement(
|
|
265
|
+
undefined,
|
|
266
|
+
ts.factory.createVariableDeclarationList(
|
|
267
|
+
[
|
|
268
|
+
ts.factory.createVariableDeclaration(
|
|
269
|
+
ts.factory.createArrayBindingPattern([
|
|
270
|
+
ts.factory.createBindingElement(
|
|
271
|
+
undefined,
|
|
272
|
+
undefined,
|
|
273
|
+
ts.factory.createIdentifier("key"),
|
|
274
|
+
undefined,
|
|
275
|
+
),
|
|
276
|
+
ts.factory.createBindingElement(
|
|
277
|
+
undefined,
|
|
278
|
+
undefined,
|
|
279
|
+
ts.factory.createIdentifier("value"),
|
|
280
|
+
undefined,
|
|
281
|
+
),
|
|
282
|
+
]),
|
|
283
|
+
undefined,
|
|
284
|
+
undefined,
|
|
285
|
+
undefined,
|
|
286
|
+
),
|
|
287
|
+
],
|
|
288
|
+
ts.NodeFlags.Const,
|
|
289
|
+
),
|
|
290
|
+
ts.factory.createCallExpression(
|
|
291
|
+
ts.factory.createIdentifier("Object.entries"),
|
|
283
292
|
undefined,
|
|
284
|
-
ts.factory.
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
293
|
+
[ts.factory.createAsExpression(expr, TypeFactory.keyword("any"))],
|
|
294
|
+
),
|
|
295
|
+
ts.factory.createIfStatement(
|
|
296
|
+
ts.factory.createStrictEquality(
|
|
297
|
+
ts.factory.createIdentifier("undefined"),
|
|
298
|
+
ts.factory.createIdentifier("value"),
|
|
299
|
+
),
|
|
300
|
+
ts.factory.createContinueStatement(),
|
|
301
|
+
ts.factory.createIfStatement(
|
|
302
|
+
ts.factory.createCallExpression(
|
|
303
|
+
ts.factory.createIdentifier("Array.isArray"),
|
|
304
|
+
undefined,
|
|
305
|
+
[ts.factory.createIdentifier("value")],
|
|
306
|
+
),
|
|
307
|
+
ts.factory.createExpressionStatement(
|
|
308
|
+
ts.factory.createCallExpression(
|
|
309
|
+
ts.factory.createPropertyAccessExpression(
|
|
310
|
+
ts.factory.createIdentifier("value"),
|
|
311
|
+
ts.factory.createIdentifier("forEach"),
|
|
312
|
+
),
|
|
313
|
+
undefined,
|
|
314
|
+
[
|
|
315
|
+
ts.factory.createArrowFunction(
|
|
292
316
|
undefined,
|
|
293
|
-
),
|
|
294
|
-
ts.factory.createBindingElement(
|
|
295
317
|
undefined,
|
|
318
|
+
[IdentifierFactory.parameter("elem")],
|
|
296
319
|
undefined,
|
|
297
|
-
ts.factory.createIdentifier("value"),
|
|
298
320
|
undefined,
|
|
321
|
+
ts.factory.createCallExpression(
|
|
322
|
+
IdentifierFactory.access(
|
|
323
|
+
ts.factory.createIdentifier(variables),
|
|
324
|
+
)("append"),
|
|
325
|
+
undefined,
|
|
326
|
+
[
|
|
327
|
+
ts.factory.createIdentifier("key"),
|
|
328
|
+
ts.factory.createCallExpression(
|
|
329
|
+
ts.factory.createIdentifier("String"),
|
|
330
|
+
undefined,
|
|
331
|
+
[ts.factory.createIdentifier("elem")],
|
|
332
|
+
),
|
|
333
|
+
],
|
|
334
|
+
),
|
|
299
335
|
),
|
|
300
|
-
]
|
|
301
|
-
undefined,
|
|
302
|
-
undefined,
|
|
303
|
-
undefined,
|
|
336
|
+
],
|
|
304
337
|
),
|
|
305
|
-
],
|
|
306
|
-
ts.NodeFlags.Const,
|
|
307
|
-
),
|
|
308
|
-
ts.factory.createCallExpression(
|
|
309
|
-
ts.factory.createIdentifier("Object.entries"),
|
|
310
|
-
undefined,
|
|
311
|
-
[
|
|
312
|
-
ts.factory.createAsExpression(
|
|
313
|
-
expr,
|
|
314
|
-
TypeFactory.keyword("any"),
|
|
315
|
-
),
|
|
316
|
-
],
|
|
317
|
-
),
|
|
318
|
-
ts.factory.createIfStatement(
|
|
319
|
-
ts.factory.createStrictEquality(
|
|
320
|
-
ts.factory.createIdentifier("undefined"),
|
|
321
|
-
ts.factory.createIdentifier("value"),
|
|
322
338
|
),
|
|
323
|
-
ts.factory.
|
|
324
|
-
ts.factory.createIfStatement(
|
|
339
|
+
ts.factory.createExpressionStatement(
|
|
325
340
|
ts.factory.createCallExpression(
|
|
326
|
-
|
|
341
|
+
IdentifierFactory.access(
|
|
342
|
+
ts.factory.createIdentifier(variables),
|
|
343
|
+
)("set"),
|
|
327
344
|
undefined,
|
|
328
|
-
[
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
ts.factory.createIdentifier("value"),
|
|
334
|
-
ts.factory.createIdentifier("forEach"),
|
|
345
|
+
[
|
|
346
|
+
ts.factory.createIdentifier("key"),
|
|
347
|
+
ts.factory.createCallExpression(
|
|
348
|
+
ts.factory.createIdentifier("String"),
|
|
349
|
+
undefined,
|
|
350
|
+
[ts.factory.createIdentifier("value")],
|
|
335
351
|
),
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
),
|
|
352
|
+
],
|
|
353
|
+
),
|
|
354
|
+
),
|
|
355
|
+
),
|
|
356
|
+
),
|
|
357
|
+
),
|
|
358
|
+
local("location")("string")(template()),
|
|
359
|
+
ts.factory.createReturnStatement(
|
|
360
|
+
ts.factory.createConditionalExpression(
|
|
361
|
+
ts.factory.createStrictEquality(
|
|
362
|
+
ExpressionFactory.number(0),
|
|
363
|
+
IdentifierFactory.access(
|
|
364
|
+
ts.factory.createIdentifier(variables),
|
|
365
|
+
)("size"),
|
|
366
|
+
),
|
|
367
|
+
undefined,
|
|
368
|
+
ts.factory.createIdentifier("location"),
|
|
369
|
+
undefined,
|
|
370
|
+
ts.factory.createTemplateExpression(
|
|
371
|
+
ts.factory.createTemplateHead(""),
|
|
372
|
+
[
|
|
373
|
+
ts.factory.createTemplateSpan(
|
|
374
|
+
ts.factory.createIdentifier("location"),
|
|
375
|
+
ts.factory.createTemplateMiddle("?"),
|
|
361
376
|
),
|
|
362
|
-
ts.factory.
|
|
377
|
+
ts.factory.createTemplateSpan(
|
|
363
378
|
ts.factory.createCallExpression(
|
|
364
379
|
IdentifierFactory.access(
|
|
365
380
|
ts.factory.createIdentifier(variables),
|
|
366
|
-
)("
|
|
381
|
+
)("toString"),
|
|
382
|
+
undefined,
|
|
367
383
|
undefined,
|
|
368
|
-
[
|
|
369
|
-
ts.factory.createIdentifier("key"),
|
|
370
|
-
ts.factory.createCallExpression(
|
|
371
|
-
ts.factory.createIdentifier("String"),
|
|
372
|
-
undefined,
|
|
373
|
-
[ts.factory.createIdentifier("value")],
|
|
374
|
-
),
|
|
375
|
-
],
|
|
376
384
|
),
|
|
385
|
+
ts.factory.createTemplateTail(""),
|
|
377
386
|
),
|
|
378
|
-
|
|
379
|
-
),
|
|
380
|
-
),
|
|
381
|
-
local("location")("string")(template()),
|
|
382
|
-
ts.factory.createReturnStatement(
|
|
383
|
-
ts.factory.createConditionalExpression(
|
|
384
|
-
ts.factory.createStrictEquality(
|
|
385
|
-
ExpressionFactory.number(0),
|
|
386
|
-
IdentifierFactory.access(
|
|
387
|
-
ts.factory.createIdentifier(variables),
|
|
388
|
-
)("size"),
|
|
389
|
-
),
|
|
390
|
-
undefined,
|
|
391
|
-
ts.factory.createIdentifier("location"),
|
|
392
|
-
undefined,
|
|
393
|
-
ts.factory.createTemplateExpression(
|
|
394
|
-
ts.factory.createTemplateHead(""),
|
|
395
|
-
[
|
|
396
|
-
ts.factory.createTemplateSpan(
|
|
397
|
-
ts.factory.createIdentifier("location"),
|
|
398
|
-
ts.factory.createTemplateMiddle("?"),
|
|
399
|
-
),
|
|
400
|
-
ts.factory.createTemplateSpan(
|
|
401
|
-
ts.factory.createCallExpression(
|
|
402
|
-
IdentifierFactory.access(
|
|
403
|
-
ts.factory.createIdentifier(variables),
|
|
404
|
-
)("toString"),
|
|
405
|
-
undefined,
|
|
406
|
-
undefined,
|
|
407
|
-
),
|
|
408
|
-
ts.factory.createTemplateTail(""),
|
|
409
|
-
),
|
|
410
|
-
],
|
|
411
|
-
),
|
|
387
|
+
],
|
|
412
388
|
),
|
|
413
389
|
),
|
|
414
|
-
],
|
|
415
|
-
true,
|
|
416
|
-
);
|
|
417
|
-
};
|
|
418
|
-
if (props.query !== undefined && g.query.length === 0)
|
|
419
|
-
return out(
|
|
420
|
-
block(
|
|
421
|
-
props.query.optional
|
|
422
|
-
? ts.factory.createBinaryExpression(
|
|
423
|
-
ts.factory.createIdentifier(props.query.name),
|
|
424
|
-
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
|
|
425
|
-
ts.factory.createObjectLiteralExpression([], false),
|
|
426
|
-
)
|
|
427
|
-
: ts.factory.createIdentifier(props.query.name),
|
|
428
390
|
),
|
|
429
|
-
|
|
391
|
+
],
|
|
392
|
+
true,
|
|
393
|
+
);
|
|
394
|
+
};
|
|
395
|
+
if (query !== undefined && g.query.length === 0)
|
|
430
396
|
return out(
|
|
431
397
|
block(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
]
|
|
440
|
-
: []),
|
|
441
|
-
...g.query.map((q) =>
|
|
442
|
-
q.name === q.field
|
|
443
|
-
? ts.factory.createShorthandPropertyAssignment(q.name)
|
|
444
|
-
: ts.factory.createPropertyAssignment(
|
|
445
|
-
Escaper.variable(q.field!)
|
|
446
|
-
? q.field!
|
|
447
|
-
: ts.factory.createStringLiteral(q.field!),
|
|
448
|
-
ts.factory.createIdentifier(q.name),
|
|
449
|
-
),
|
|
450
|
-
),
|
|
451
|
-
],
|
|
452
|
-
true,
|
|
453
|
-
),
|
|
398
|
+
query.metadata.isRequired() === false
|
|
399
|
+
? ts.factory.createBinaryExpression(
|
|
400
|
+
ts.factory.createIdentifier(query.name),
|
|
401
|
+
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionToken),
|
|
402
|
+
ts.factory.createObjectLiteralExpression([], false),
|
|
403
|
+
)
|
|
404
|
+
: ts.factory.createIdentifier(query.name),
|
|
454
405
|
),
|
|
455
406
|
);
|
|
456
|
-
|
|
407
|
+
return out(
|
|
408
|
+
block(
|
|
409
|
+
ts.factory.createObjectLiteralExpression(
|
|
410
|
+
[
|
|
411
|
+
...(query
|
|
412
|
+
? [
|
|
413
|
+
ts.factory.createSpreadAssignment(
|
|
414
|
+
ts.factory.createIdentifier(query.name),
|
|
415
|
+
),
|
|
416
|
+
]
|
|
417
|
+
: []),
|
|
418
|
+
...g.query.map((q) =>
|
|
419
|
+
q.name === q.field
|
|
420
|
+
? ts.factory.createShorthandPropertyAssignment(q.name)
|
|
421
|
+
: ts.factory.createPropertyAssignment(
|
|
422
|
+
Escaper.variable(q.field!)
|
|
423
|
+
? q.field!
|
|
424
|
+
: ts.factory.createStringLiteral(q.field!),
|
|
425
|
+
ts.factory.createIdentifier(q.name),
|
|
426
|
+
),
|
|
427
|
+
),
|
|
428
|
+
],
|
|
429
|
+
true,
|
|
430
|
+
),
|
|
431
|
+
),
|
|
432
|
+
);
|
|
433
|
+
};
|
|
457
434
|
|
|
458
435
|
const write_stringify =
|
|
459
436
|
(project: INestiaProject) =>
|
|
@@ -513,10 +490,3 @@ const constant = (name: string) => (expression: ts.Expression) =>
|
|
|
513
490
|
ts.NodeFlags.Const,
|
|
514
491
|
),
|
|
515
492
|
);
|
|
516
|
-
const getType =
|
|
517
|
-
(project: INestiaProject) =>
|
|
518
|
-
(importer: ImportDictionary) =>
|
|
519
|
-
(p: ITypedHttpRoute.IParameter | ITypedHttpRoute.IOutput) =>
|
|
520
|
-
p.metadata
|
|
521
|
-
? SdkTypeProgrammer.write(project)(importer)(p.metadata)
|
|
522
|
-
: ts.factory.createTypeReferenceNode(p.typeName);
|