@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,15 +1,14 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import typia from "typia";
|
|
3
2
|
import { IdentifierFactory } from "typia/lib/factories/IdentifierFactory";
|
|
4
3
|
|
|
5
4
|
import { INestiaConfig } from "../../INestiaConfig";
|
|
6
5
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
7
|
-
import { IReflectHttpOperation } from "../../structures/IReflectHttpOperation";
|
|
8
6
|
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
7
|
+
import { ITypedHttpRouteParameter } from "../../structures/ITypedHttpRouteParameter";
|
|
9
8
|
import { StringUtil } from "../../utils/StringUtil";
|
|
10
9
|
import { ImportDictionary } from "./ImportDictionary";
|
|
10
|
+
import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
11
11
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
12
|
-
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
13
12
|
|
|
14
13
|
export namespace SdkHttpFunctionProgrammer {
|
|
15
14
|
export const write =
|
|
@@ -18,9 +17,9 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
18
17
|
(
|
|
19
18
|
route: ITypedHttpRoute,
|
|
20
19
|
props: {
|
|
21
|
-
headers:
|
|
22
|
-
query:
|
|
23
|
-
input:
|
|
20
|
+
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
21
|
+
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
22
|
+
input: ITypedHttpRouteParameter.IBody | undefined;
|
|
24
23
|
},
|
|
25
24
|
): ts.FunctionDeclaration =>
|
|
26
25
|
ts.factory.createFunctionDeclaration(
|
|
@@ -48,7 +47,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
48
47
|
[],
|
|
49
48
|
undefined,
|
|
50
49
|
p.name,
|
|
51
|
-
p.optional
|
|
50
|
+
p.metadata.optional
|
|
52
51
|
? ts.factory.createToken(ts.SyntaxKind.QuestionToken)
|
|
53
52
|
: undefined,
|
|
54
53
|
project.config.primitive !== false &&
|
|
@@ -56,12 +55,12 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
56
55
|
? ts.factory.createTypeReferenceNode(
|
|
57
56
|
`${route.name}.${p === props.query ? "Query" : "Input"}`,
|
|
58
57
|
)
|
|
59
|
-
:
|
|
58
|
+
: SdkAliasCollection.name(p.type),
|
|
60
59
|
),
|
|
61
60
|
),
|
|
62
61
|
],
|
|
63
62
|
ts.factory.createTypeReferenceNode("Promise", [
|
|
64
|
-
|
|
63
|
+
SdkAliasCollection.name(route.success.type),
|
|
65
64
|
]),
|
|
66
65
|
ts.factory.createBlock(
|
|
67
66
|
write_body(project.config)(importer)(route, props),
|
|
@@ -75,34 +74,21 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
75
74
|
(
|
|
76
75
|
route: ITypedHttpRoute,
|
|
77
76
|
props: {
|
|
78
|
-
headers:
|
|
79
|
-
query:
|
|
80
|
-
input:
|
|
77
|
+
headers: ITypedHttpRouteParameter.IHeaders | undefined;
|
|
78
|
+
query: ITypedHttpRouteParameter.IQuery | undefined;
|
|
79
|
+
input: ITypedHttpRouteParameter.IBody | undefined;
|
|
81
80
|
},
|
|
82
81
|
): ts.Statement[] => {
|
|
83
|
-
const encrypted: boolean =
|
|
84
|
-
route.encrypted === true ||
|
|
85
|
-
(props.input !== undefined &&
|
|
86
|
-
props.input.custom === true &&
|
|
87
|
-
props.input.category === "body" &&
|
|
88
|
-
props.input.encrypted === true);
|
|
89
|
-
const contentType: string | undefined =
|
|
90
|
-
props.input !== undefined
|
|
91
|
-
? typia.is<IReflectHttpOperation.IBodyParameter>(props.input)
|
|
92
|
-
? props.input.contentType
|
|
93
|
-
: "application/json"
|
|
94
|
-
: undefined;
|
|
95
|
-
|
|
96
82
|
const caller = () =>
|
|
97
83
|
ts.factory.createCallExpression(
|
|
98
84
|
IdentifierFactory.access(
|
|
99
85
|
ts.factory.createIdentifier(
|
|
100
|
-
SdkImportWizard.Fetcher(encrypted)(importer),
|
|
86
|
+
SdkImportWizard.Fetcher(!!props.input?.encrypted)(importer),
|
|
101
87
|
),
|
|
102
88
|
)(config.propagate ? "propagate" : "fetch"),
|
|
103
89
|
undefined,
|
|
104
90
|
[
|
|
105
|
-
contentType
|
|
91
|
+
props.input?.contentType !== "multipart/form-data"
|
|
106
92
|
? ts.factory.createObjectLiteralExpression(
|
|
107
93
|
[
|
|
108
94
|
ts.factory.createSpreadAssignment(
|
|
@@ -119,7 +105,9 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
119
105
|
),
|
|
120
106
|
ts.factory.createPropertyAssignment(
|
|
121
107
|
ts.factory.createStringLiteral("Content-Type"),
|
|
122
|
-
ts.factory.createStringLiteral(
|
|
108
|
+
ts.factory.createStringLiteral(
|
|
109
|
+
props.input?.contentType ?? "application/json",
|
|
110
|
+
),
|
|
123
111
|
),
|
|
124
112
|
],
|
|
125
113
|
true,
|
|
@@ -165,7 +153,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
165
153
|
? [ts.factory.createIdentifier(props.input.name)]
|
|
166
154
|
: []),
|
|
167
155
|
...(config.json &&
|
|
168
|
-
|
|
156
|
+
props.input !== undefined &&
|
|
169
157
|
(props.input.contentType === "application/json" ||
|
|
170
158
|
props.input.encrypted === true)
|
|
171
159
|
? [ts.factory.createIdentifier(`${route.name}.stringify`)]
|
|
@@ -215,7 +203,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
215
203
|
),
|
|
216
204
|
)
|
|
217
205
|
: []),
|
|
218
|
-
...(route.setHeaders.length === 0
|
|
206
|
+
...(route.success.setHeaders.length === 0
|
|
219
207
|
? [ts.factory.createReturnStatement(output(false))]
|
|
220
208
|
: write_set_headers(config)(route)(output(true))),
|
|
221
209
|
];
|
|
@@ -240,7 +228,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
240
228
|
ts.factory.createToken(ts.SyntaxKind.QuestionQuestionEqualsToken),
|
|
241
229
|
ts.factory.createObjectLiteralExpression([]),
|
|
242
230
|
),
|
|
243
|
-
...route.setHeaders.map((tuple) =>
|
|
231
|
+
...route.success.setHeaders.map((tuple) =>
|
|
244
232
|
tuple.type === "assigner"
|
|
245
233
|
? ts.factory.createCallExpression(
|
|
246
234
|
ts.factory.createIdentifier("Object.assign"),
|
|
@@ -267,7 +255,7 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
267
255
|
ts.factory.createVariableDeclaration(
|
|
268
256
|
output,
|
|
269
257
|
undefined,
|
|
270
|
-
|
|
258
|
+
SdkAliasCollection.name(route.success.type),
|
|
271
259
|
condition,
|
|
272
260
|
),
|
|
273
261
|
],
|
|
@@ -289,18 +277,3 @@ export namespace SdkHttpFunctionProgrammer {
|
|
|
289
277
|
];
|
|
290
278
|
};
|
|
291
279
|
}
|
|
292
|
-
|
|
293
|
-
const getTypeName =
|
|
294
|
-
(project: INestiaProject) =>
|
|
295
|
-
(importer: ImportDictionary) =>
|
|
296
|
-
(p: ITypedHttpRoute.IParameter | ITypedHttpRoute.IOutput) =>
|
|
297
|
-
p.metadata
|
|
298
|
-
? SdkTypeProgrammer.write(project)(importer)(p.metadata)
|
|
299
|
-
: ts.factory.createTypeReferenceNode(p.typeName);
|
|
300
|
-
|
|
301
|
-
const getReturnType = (config: INestiaConfig) => (route: ITypedHttpRoute) =>
|
|
302
|
-
ts.factory.createTypeReferenceNode(
|
|
303
|
-
config.propagate !== true && route.output.typeName === "void"
|
|
304
|
-
? "void"
|
|
305
|
-
: `${route.name}.Output`,
|
|
306
|
-
);
|