@nestia/sdk 11.2.1 → 12.0.0-dev.20260521.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/bundle/distribute/package.json +1 -1
- package/lib/NestiaSdkApplication.js +5 -4
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/NestiaSwaggerComposer.js +2 -2
- package/lib/NestiaSwaggerComposer.js.map +1 -1
- package/lib/analyses/AccessorAnalyzer.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.js +133 -7
- package/lib/analyses/ConfigAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts +9 -2
- package/lib/analyses/ImportAnalyzer.js +13 -50
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/analyses/PathAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +5 -4
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js +22 -5
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +8 -8
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +15 -15
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/SecurityAnalyzer.js.map +1 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +2 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.js +296 -39
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +1 -4
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
- package/lib/decorators/OperationMetadata.d.ts +12 -2
- package/lib/decorators/OperationMetadata.js +14 -1
- package/lib/decorators/OperationMetadata.js.map +1 -1
- package/lib/executable/internal/CommandParser.js.map +1 -1
- package/lib/executable/internal/NestiaConfigLoader.d.ts +6 -2
- package/lib/executable/internal/NestiaConfigLoader.js +285 -793
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js +6 -4
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/sdk.js +17 -5
- package/lib/executable/sdk.js.map +1 -1
- package/lib/generates/CloneGenerator.js +2 -2
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/E2eGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.js +6 -9
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +20 -107
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +44 -28
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +4 -4
- package/lib/generates/internal/FilePrinter.js +25 -16
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +2 -2
- package/lib/generates/internal/ImportDictionary.js +7 -5
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +11 -11
- package/lib/generates/internal/SdkAliasCollection.js +27 -31
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.js +15 -70
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js +2 -2
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +6 -12
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.js +2 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +73 -77
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +64 -66
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +4 -10
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +15 -22
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +18 -20
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +47 -49
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkImportWizard.js.map +1 -1
- package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +4 -4
- package/lib/generates/internal/SdkTypeProgrammer.js +66 -67
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +1 -2
- package/lib/generates/internal/SdkTypeTagProgrammer.js +29 -11
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +55 -55
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +9 -12
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +43 -45
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationComposer.d.ts +1 -1
- package/lib/generates/internal/SwaggerOperationComposer.js +5 -4
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +0 -3
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +19 -20
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +4 -3
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/internal/legacy.d.ts +180 -0
- package/lib/internal/legacy.js +361 -0
- package/lib/internal/legacy.js.map +1 -0
- package/lib/structures/INestiaProject.d.ts +0 -2
- package/lib/{transformers → structures}/IOperationMetadata.d.ts +2 -7
- package/lib/structures/IOperationMetadata.js.map +1 -0
- package/lib/structures/IReflectHttpOperationException.d.ts +1 -1
- package/lib/structures/IReflectHttpOperationParameter.d.ts +1 -1
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +1 -1
- package/lib/structures/IReflectOperationError.d.ts +1 -1
- package/lib/structures/IReflectOperationError.js.map +1 -1
- package/lib/structures/IReflectWebSocketOperation.d.ts +2 -2
- package/lib/structures/ITypedApplication.d.ts +1 -1
- package/lib/structures/ITypedHttpRouteException.d.ts +1 -1
- package/lib/structures/ITypedHttpRouteParameter.d.ts +1 -1
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +1 -1
- package/lib/structures/ITypedWebSocketRoute.d.ts +2 -2
- package/lib/transform.d.ts +16 -3
- package/lib/transform.js +47 -5
- package/lib/transform.js.map +1 -1
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/FileRetriever.js.map +1 -1
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/PathUtil.js.map +1 -1
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/StringUtil.js.map +1 -1
- package/lib/utils/TsConfigReader.d.ts +7 -0
- package/lib/utils/TsConfigReader.js +102 -0
- package/lib/utils/TsConfigReader.js.map +1 -0
- package/lib/utils/TtscExecutor.d.ts +8 -0
- package/lib/utils/TtscExecutor.js +58 -0
- package/lib/utils/TtscExecutor.js.map +1 -0
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/lib/validators/HttpHeadersValidator.d.ts +8 -5
- package/lib/validators/HttpHeadersValidator.js +7 -26
- package/lib/validators/HttpHeadersValidator.js.map +1 -1
- package/lib/validators/HttpQueryValidator.d.ts +8 -5
- package/lib/validators/HttpQueryValidator.js +7 -26
- package/lib/validators/HttpQueryValidator.js.map +1 -1
- package/lib/{transformers → validators}/TextPlainValidator.d.ts +1 -1
- package/lib/{transformers → validators}/TextPlainValidator.js +2 -1
- package/lib/validators/TextPlainValidator.js.map +1 -0
- package/native/go.mod +52 -0
- package/native/go.sum +54 -0
- package/native/sdk/register.go +130 -0
- package/native/sdk/sdk.go +17 -0
- package/native/sdk/sdk_metadata_json.go +327 -0
- package/native/sdk/sdk_transform.go +1542 -0
- package/package.json +19 -19
- package/src/NestiaSdkApplication.ts +9 -5
- package/src/NestiaSwaggerComposer.ts +2 -3
- package/src/analyses/ConfigAnalyzer.ts +175 -1
- package/src/analyses/ImportAnalyzer.ts +15 -49
- package/src/analyses/ReflectControllerAnalyzer.ts +1 -1
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +1 -1
- package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +24 -6
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +3 -3
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +14 -10
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +2 -2
- package/src/analyses/TypedHttpRouteAnalyzer.ts +354 -22
- package/src/decorators/OperationMetadata.ts +17 -3
- package/src/executable/internal/NestiaConfigLoader.ts +419 -53
- package/src/executable/internal/NestiaSdkCommand.ts +9 -10
- package/src/executable/sdk.ts +15 -4
- package/src/generates/CloneGenerator.ts +10 -10
- package/src/generates/SwaggerGenerator.ts +28 -9
- package/src/generates/internal/E2eFileProgrammer.ts +80 -43
- package/src/generates/internal/FilePrinter.ts +38 -37
- package/src/generates/internal/ImportDictionary.ts +18 -16
- package/src/generates/internal/SdkAliasCollection.ts +41 -40
- package/src/generates/internal/SdkDistributionComposer.ts +21 -8
- package/src/generates/internal/SdkFileProgrammer.ts +7 -5
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +10 -10
- package/src/generates/internal/SdkHttpCloneReferencer.ts +6 -6
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +101 -78
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +153 -145
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +20 -33
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +2 -2
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +88 -86
- package/src/generates/internal/SdkTypeProgrammer.ts +93 -99
- package/src/generates/internal/SdkTypeTagProgrammer.ts +12 -12
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +128 -118
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +15 -13
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +133 -112
- package/src/generates/internal/SwaggerOperationComposer.ts +1 -1
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +10 -9
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +1 -1
- package/src/internal/legacy.ts +492 -0
- package/src/structures/INestiaProject.ts +0 -3
- package/src/{transformers → structures}/IOperationMetadata.ts +2 -7
- package/src/structures/IReflectHttpOperationException.ts +1 -1
- package/src/structures/IReflectHttpOperationParameter.ts +1 -1
- package/src/structures/IReflectHttpOperationSuccess.ts +1 -1
- package/src/structures/IReflectOperationError.ts +1 -1
- package/src/structures/IReflectWebSocketOperation.ts +2 -2
- package/src/structures/ITypedApplication.ts +1 -1
- package/src/structures/ITypedHttpRouteException.ts +1 -1
- package/src/structures/ITypedHttpRouteParameter.ts +1 -1
- package/src/structures/ITypedHttpRouteSuccess.ts +1 -1
- package/src/structures/ITypedWebSocketRoute.ts +2 -2
- package/src/transform.ts +57 -7
- package/src/utils/TsConfigReader.ts +108 -0
- package/src/utils/TtscExecutor.ts +63 -0
- package/src/validators/HttpHeadersValidator.ts +8 -37
- package/src/validators/HttpQueryValidator.ts +8 -37
- package/src/{transformers → validators}/TextPlainValidator.ts +2 -2
- package/lib/analyses/DtoAnalyzer.d.ts +0 -21
- package/lib/analyses/DtoAnalyzer.js +0 -219
- package/lib/analyses/DtoAnalyzer.js.map +0 -1
- package/lib/analyses/ExceptionAnalyzer.d.ts +0 -0
- package/lib/analyses/ExceptionAnalyzer.js +0 -2
- package/lib/analyses/ExceptionAnalyzer.js.map +0 -1
- package/lib/analyses/GenericAnalyzer.d.ts +0 -4
- package/lib/analyses/GenericAnalyzer.js +0 -42
- package/lib/analyses/GenericAnalyzer.js.map +0 -1
- package/lib/structures/IReflectApplication.d.ts +0 -6
- package/lib/structures/IReflectApplication.js +0 -3
- package/lib/structures/IReflectApplication.js.map +0 -1
- package/lib/structures/MethodType.d.ts +0 -4
- package/lib/structures/MethodType.js +0 -8
- package/lib/structures/MethodType.js.map +0 -1
- package/lib/structures/ParamCategory.d.ts +0 -1
- package/lib/structures/ParamCategory.js +0 -3
- package/lib/structures/ParamCategory.js.map +0 -1
- package/lib/structures/TypeEntry.d.ts +0 -9
- package/lib/structures/TypeEntry.js +0 -21
- package/lib/structures/TypeEntry.js.map +0 -1
- package/lib/transformers/IOperationMetadata.js.map +0 -1
- package/lib/transformers/ISdkOperationTransformerContext.d.ts +0 -7
- package/lib/transformers/ISdkOperationTransformerContext.js +0 -3
- package/lib/transformers/ISdkOperationTransformerContext.js.map +0 -1
- package/lib/transformers/SdkOperationProgrammer.d.ts +0 -15
- package/lib/transformers/SdkOperationProgrammer.js +0 -186
- package/lib/transformers/SdkOperationProgrammer.js.map +0 -1
- package/lib/transformers/SdkOperationTransformer.d.ts +0 -4
- package/lib/transformers/SdkOperationTransformer.js +0 -128
- package/lib/transformers/SdkOperationTransformer.js.map +0 -1
- package/lib/transformers/TextPlainValidator.js.map +0 -1
- package/lib/utils/MetadataUtil.d.ts +0 -4
- package/lib/utils/MetadataUtil.js +0 -34
- package/lib/utils/MetadataUtil.js.map +0 -1
- package/lib/utils/StripEnums.d.ts +0 -3
- package/lib/utils/StripEnums.js +0 -3
- package/lib/utils/StripEnums.js.map +0 -1
- package/lib/utils/TypeLiteralExpression.d.ts +0 -0
- package/lib/utils/TypeLiteralExpression.js +0 -2
- package/lib/utils/TypeLiteralExpression.js.map +0 -1
- package/src/analyses/DtoAnalyzer.ts +0 -260
- package/src/analyses/ExceptionAnalyzer.ts +0 -154
- package/src/analyses/GenericAnalyzer.ts +0 -49
- package/src/structures/IReflectApplication.ts +0 -8
- package/src/structures/MethodType.ts +0 -5
- package/src/structures/ParamCategory.ts +0 -1
- package/src/structures/TypeEntry.ts +0 -22
- package/src/transformers/ISdkOperationTransformerContext.ts +0 -8
- package/src/transformers/SdkOperationProgrammer.ts +0 -240
- package/src/transformers/SdkOperationTransformer.ts +0 -248
- package/src/utils/MetadataUtil.ts +0 -26
- package/src/utils/StripEnums.ts +0 -5
- package/src/utils/TypeLiteralExpression.ts +0 -0
- /package/lib/{transformers → structures}/IOperationMetadata.js +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Node, SyntaxKind, TypeScriptFactory } from "@nestia/factory";
|
|
2
|
+
import { TypeFactory } from "@nestia/factory";
|
|
3
|
+
import { MetadataSchema, sizeOf } from "../../internal/legacy";
|
|
3
4
|
|
|
4
5
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
5
6
|
import { IReflectType } from "../../structures/IReflectType";
|
|
@@ -12,8 +13,8 @@ import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
|
12
13
|
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
13
14
|
|
|
14
15
|
export namespace SdkAliasCollection {
|
|
15
|
-
export const name = ({ type }: { type: IReflectType }):
|
|
16
|
-
|
|
16
|
+
export const name = ({ type }: { type: IReflectType }): Node =>
|
|
17
|
+
TypeScriptFactory.createTypeReferenceNode(
|
|
17
18
|
type.name,
|
|
18
19
|
type.typeArguments
|
|
19
20
|
? type.typeArguments.map((a) => name({ type: a }))
|
|
@@ -29,8 +30,8 @@ export namespace SdkAliasCollection {
|
|
|
29
30
|
export const httpProps =
|
|
30
31
|
(project: INestiaProject) =>
|
|
31
32
|
(importer: ImportDictionary) =>
|
|
32
|
-
(route: ITypedHttpRoute):
|
|
33
|
-
|
|
33
|
+
(route: ITypedHttpRoute): Node =>
|
|
34
|
+
TypeScriptFactory.createTypeLiteralNode(
|
|
34
35
|
SdkHttpParameterProgrammer.getEntries({
|
|
35
36
|
project,
|
|
36
37
|
importer,
|
|
@@ -39,13 +40,13 @@ export namespace SdkAliasCollection {
|
|
|
39
40
|
prefix: false,
|
|
40
41
|
})
|
|
41
42
|
.map((e) => {
|
|
42
|
-
const signature:
|
|
43
|
-
|
|
43
|
+
const signature: Node =
|
|
44
|
+
TypeScriptFactory.createPropertySignature(
|
|
44
45
|
undefined,
|
|
45
46
|
e.key,
|
|
46
47
|
e.required
|
|
47
48
|
? undefined
|
|
48
|
-
:
|
|
49
|
+
: TypeScriptFactory.createToken(SyntaxKind.QuestionToken),
|
|
49
50
|
e.type,
|
|
50
51
|
);
|
|
51
52
|
const description: string | null =
|
|
@@ -61,7 +62,7 @@ export namespace SdkAliasCollection {
|
|
|
61
62
|
null;
|
|
62
63
|
return description?.length
|
|
63
64
|
? [
|
|
64
|
-
|
|
65
|
+
TypeScriptFactory.createIdentifier("\n") as any,
|
|
65
66
|
FilePrinter.description(signature, description),
|
|
66
67
|
]
|
|
67
68
|
: [signature];
|
|
@@ -69,10 +70,10 @@ export namespace SdkAliasCollection {
|
|
|
69
70
|
.flat(),
|
|
70
71
|
);
|
|
71
72
|
|
|
72
|
-
export const websocketProps = (route: ITypedWebSocketRoute):
|
|
73
|
-
|
|
73
|
+
export const websocketProps = (route: ITypedWebSocketRoute): Node =>
|
|
74
|
+
TypeScriptFactory.createTypeLiteralNode([
|
|
74
75
|
...route.pathParameters.map((p) =>
|
|
75
|
-
|
|
76
|
+
TypeScriptFactory.createPropertySignature(
|
|
76
77
|
undefined,
|
|
77
78
|
p.name,
|
|
78
79
|
undefined,
|
|
@@ -81,31 +82,31 @@ export namespace SdkAliasCollection {
|
|
|
81
82
|
),
|
|
82
83
|
...(route.query
|
|
83
84
|
? [
|
|
84
|
-
|
|
85
|
+
TypeScriptFactory.createPropertySignature(
|
|
85
86
|
undefined,
|
|
86
87
|
"query",
|
|
87
88
|
undefined,
|
|
88
|
-
|
|
89
|
+
TypeScriptFactory.createTypeReferenceNode("Query"),
|
|
89
90
|
),
|
|
90
91
|
]
|
|
91
92
|
: []),
|
|
92
|
-
|
|
93
|
+
TypeScriptFactory.createPropertySignature(
|
|
93
94
|
undefined,
|
|
94
95
|
"provider",
|
|
95
96
|
undefined,
|
|
96
|
-
|
|
97
|
+
TypeScriptFactory.createTypeReferenceNode("Provider"),
|
|
97
98
|
),
|
|
98
99
|
]);
|
|
99
100
|
|
|
100
101
|
export const headers =
|
|
101
102
|
(project: INestiaProject) =>
|
|
102
103
|
(importer: ImportDictionary) =>
|
|
103
|
-
(param: ITypedHttpRouteParameter.IHeaders):
|
|
104
|
+
(param: ITypedHttpRouteParameter.IHeaders): Node => {
|
|
104
105
|
if (project.config.clone === true)
|
|
105
106
|
return from(project)(importer)(param.metadata);
|
|
106
|
-
const type:
|
|
107
|
+
const type: Node = name(param);
|
|
107
108
|
if (project.config.primitive === false) return type;
|
|
108
|
-
return
|
|
109
|
+
return TypeScriptFactory.createTypeReferenceNode(
|
|
109
110
|
importer.external({
|
|
110
111
|
file: "typia",
|
|
111
112
|
declaration: true,
|
|
@@ -119,12 +120,12 @@ export namespace SdkAliasCollection {
|
|
|
119
120
|
export const query =
|
|
120
121
|
(project: INestiaProject) =>
|
|
121
122
|
(importer: ImportDictionary) =>
|
|
122
|
-
(param: ITypedHttpRouteParameter.IQuery):
|
|
123
|
+
(param: ITypedHttpRouteParameter.IQuery): Node => {
|
|
123
124
|
if (project.config.clone === true)
|
|
124
125
|
return from(project)(importer)(param.metadata);
|
|
125
|
-
const type:
|
|
126
|
+
const type: Node = name(param);
|
|
126
127
|
if (project.config.primitive === false) return type;
|
|
127
|
-
return
|
|
128
|
+
return TypeScriptFactory.createTypeReferenceNode(
|
|
128
129
|
importer.external({
|
|
129
130
|
file: "typia",
|
|
130
131
|
declaration: true,
|
|
@@ -138,18 +139,18 @@ export namespace SdkAliasCollection {
|
|
|
138
139
|
export const body =
|
|
139
140
|
(project: INestiaProject) =>
|
|
140
141
|
(importer: ImportDictionary) =>
|
|
141
|
-
(param: ITypedHttpRouteParameter.IBody):
|
|
142
|
+
(param: ITypedHttpRouteParameter.IBody): Node => {
|
|
142
143
|
if (project.config.clone === true) {
|
|
143
|
-
const type:
|
|
144
|
+
const type: Node = from(project)(importer)(param.metadata);
|
|
144
145
|
return param.contentType === "multipart/form-data"
|
|
145
146
|
? formDataInput(importer)(type)
|
|
146
147
|
: type;
|
|
147
148
|
}
|
|
148
|
-
const type:
|
|
149
|
+
const type: Node = name(param);
|
|
149
150
|
if (param.contentType === "multipart/form-data")
|
|
150
151
|
return formDataInput(importer)(type);
|
|
151
152
|
else if (project.config.primitive === false) return type;
|
|
152
|
-
return
|
|
153
|
+
return TypeScriptFactory.createTypeReferenceNode(
|
|
153
154
|
importer.external({
|
|
154
155
|
file: "typia",
|
|
155
156
|
declaration: true,
|
|
@@ -166,14 +167,14 @@ export namespace SdkAliasCollection {
|
|
|
166
167
|
export const response =
|
|
167
168
|
(project: INestiaProject) =>
|
|
168
169
|
(importer: ImportDictionary) =>
|
|
169
|
-
(route: ITypedHttpRoute):
|
|
170
|
+
(route: ITypedHttpRoute): Node => {
|
|
170
171
|
const schema = (p: { metadata: MetadataSchema; type: IReflectType }) =>
|
|
171
|
-
p.metadata
|
|
172
|
+
sizeOf(p.metadata) === 0
|
|
172
173
|
? TypeFactory.keyword("void")
|
|
173
174
|
: project.config.clone === true
|
|
174
175
|
? from(project)(importer)(p.metadata)
|
|
175
176
|
: project.config.primitive !== false
|
|
176
|
-
?
|
|
177
|
+
? TypeScriptFactory.createTypeReferenceNode(
|
|
177
178
|
importer.external({
|
|
178
179
|
file: "typia",
|
|
179
180
|
declaration: true,
|
|
@@ -201,7 +202,7 @@ export namespace SdkAliasCollection {
|
|
|
201
202
|
type: schema(value),
|
|
202
203
|
})),
|
|
203
204
|
];
|
|
204
|
-
return
|
|
205
|
+
return TypeScriptFactory.createTypeReferenceNode(
|
|
205
206
|
importer.external({
|
|
206
207
|
file: "@nestia/fetcher",
|
|
207
208
|
declaration: true,
|
|
@@ -209,11 +210,11 @@ export namespace SdkAliasCollection {
|
|
|
209
210
|
name: "IPropagation",
|
|
210
211
|
}),
|
|
211
212
|
[
|
|
212
|
-
|
|
213
|
+
TypeScriptFactory.createTypeLiteralNode(
|
|
213
214
|
branches.map((b) =>
|
|
214
|
-
|
|
215
|
+
TypeScriptFactory.createPropertySignature(
|
|
215
216
|
undefined,
|
|
216
|
-
|
|
217
|
+
TypeScriptFactory.createNumericLiteral(b.status),
|
|
217
218
|
undefined,
|
|
218
219
|
b.type,
|
|
219
220
|
),
|
|
@@ -221,8 +222,8 @@ export namespace SdkAliasCollection {
|
|
|
221
222
|
),
|
|
222
223
|
...(route.success.status
|
|
223
224
|
? [
|
|
224
|
-
|
|
225
|
-
|
|
225
|
+
TypeScriptFactory.createLiteralTypeNode(
|
|
226
|
+
TypeScriptFactory.createNumericLiteral(route.success.status),
|
|
226
227
|
),
|
|
227
228
|
]
|
|
228
229
|
: []),
|
|
@@ -233,7 +234,7 @@ export namespace SdkAliasCollection {
|
|
|
233
234
|
export const responseBody =
|
|
234
235
|
(project: INestiaProject) =>
|
|
235
236
|
(importer: ImportDictionary) =>
|
|
236
|
-
(route: ITypedHttpRoute):
|
|
237
|
+
(route: ITypedHttpRoute): Node =>
|
|
237
238
|
response({
|
|
238
239
|
...project,
|
|
239
240
|
config: {
|
|
@@ -242,8 +243,8 @@ export namespace SdkAliasCollection {
|
|
|
242
243
|
},
|
|
243
244
|
})(importer)(route);
|
|
244
245
|
|
|
245
|
-
const formDataInput = (importer: ImportDictionary) => (type:
|
|
246
|
-
|
|
246
|
+
const formDataInput = (importer: ImportDictionary) => (type: Node) =>
|
|
247
|
+
TypeScriptFactory.createTypeReferenceNode(
|
|
247
248
|
importer.external({
|
|
248
249
|
file: "@nestia/fetcher",
|
|
249
250
|
declaration: true,
|
|
@@ -256,5 +257,5 @@ export namespace SdkAliasCollection {
|
|
|
256
257
|
|
|
257
258
|
interface IBranch {
|
|
258
259
|
status: string;
|
|
259
|
-
type:
|
|
260
|
+
type: Node;
|
|
260
261
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import cp from "child_process";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import typia from "typia";
|
|
5
4
|
|
|
6
5
|
import { INestiaConfig } from "../../INestiaConfig";
|
|
7
6
|
|
|
@@ -30,11 +29,12 @@ export namespace SdkDistributionComposer {
|
|
|
30
29
|
await replace({ root, output })(file);
|
|
31
30
|
|
|
32
31
|
// INSTALL PACKAGES
|
|
33
|
-
const v: IDependencies = await dependencies();
|
|
32
|
+
const v: IDependencies = await dependencies({ websocket: props.websocket });
|
|
34
33
|
execute("npm install --save-dev rimraf");
|
|
35
34
|
execute(`npm install --save @nestia/fetcher@${v.version}`);
|
|
36
35
|
execute(`npm install --save typia@${v.typia}`);
|
|
37
|
-
if (props.websocket
|
|
36
|
+
if (props.websocket && v.tgrid !== undefined)
|
|
37
|
+
execute(`npm install --save tgrid@${v.tgrid}`);
|
|
38
38
|
execute("npx typia setup --manager npm");
|
|
39
39
|
|
|
40
40
|
exit();
|
|
@@ -77,7 +77,9 @@ export namespace SdkDistributionComposer {
|
|
|
77
77
|
);
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const dependencies = async (
|
|
80
|
+
const dependencies = async (opts: {
|
|
81
|
+
websocket: boolean;
|
|
82
|
+
}): Promise<IDependencies> => {
|
|
81
83
|
const content: string = await fs.promises.readFile(
|
|
82
84
|
__dirname + "/../../../package.json",
|
|
83
85
|
"utf8",
|
|
@@ -87,17 +89,28 @@ export namespace SdkDistributionComposer {
|
|
|
87
89
|
dependencies: Record<string, string>;
|
|
88
90
|
devDependencies: Record<string, string>;
|
|
89
91
|
} = JSON.parse(content);
|
|
90
|
-
|
|
92
|
+
const dependencies: Record<string, string> = {
|
|
91
93
|
...json.devDependencies,
|
|
92
94
|
...json.dependencies,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
};
|
|
96
|
+
const required = (key: "version" | "typia"): string => {
|
|
97
|
+
const value: string | undefined =
|
|
98
|
+
key === "version" ? json.version : dependencies[key];
|
|
99
|
+
if (typeof value !== "string" || value.length === 0)
|
|
100
|
+
throw new Error(`Unable to resolve ${key} version for SDK distribution.`);
|
|
101
|
+
return value;
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
version: required("version"),
|
|
105
|
+
typia: required("typia"),
|
|
106
|
+
tgrid: opts.websocket ? dependencies.tgrid : undefined,
|
|
107
|
+
};
|
|
95
108
|
};
|
|
96
109
|
}
|
|
97
110
|
|
|
98
111
|
interface IDependencies {
|
|
99
112
|
version: string;
|
|
100
113
|
typia: string;
|
|
101
|
-
tgrid: string;
|
|
114
|
+
tgrid: string | undefined;
|
|
102
115
|
}
|
|
103
116
|
const BUNDLE = __dirname + "/../../../assets/bundle/distribute";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Node, TypeScriptFactory } from "@nestia/factory";
|
|
1
2
|
import fs from "fs";
|
|
2
|
-
import ts from "typescript";
|
|
3
3
|
|
|
4
4
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
5
5
|
import { ITypedApplication } from "../../structures/ITypedApplication";
|
|
@@ -54,15 +54,17 @@ export namespace SdkFileProgrammer {
|
|
|
54
54
|
} catch {}
|
|
55
55
|
|
|
56
56
|
// ITERATE CHILDREN
|
|
57
|
-
const statements:
|
|
57
|
+
const statements: Node[] = [];
|
|
58
58
|
for (const [key, value] of directory.children) {
|
|
59
59
|
await iterate(project)(value)(`${outDir}/${key}`);
|
|
60
60
|
statements.push(
|
|
61
|
-
|
|
61
|
+
TypeScriptFactory.createExportDeclaration(
|
|
62
62
|
undefined,
|
|
63
63
|
false,
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
TypeScriptFactory.createNamespaceExport(
|
|
65
|
+
TypeScriptFactory.createIdentifier(key),
|
|
66
|
+
),
|
|
67
|
+
TypeScriptFactory.createStringLiteral(`./${key}/index`),
|
|
66
68
|
undefined,
|
|
67
69
|
),
|
|
68
70
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { Node, SyntaxKind, TypeScriptFactory } from "@nestia/factory";
|
|
1
2
|
import {
|
|
2
3
|
MetadataAliasType,
|
|
3
4
|
MetadataAtomic,
|
|
4
5
|
MetadataObjectType,
|
|
5
|
-
} from "
|
|
6
|
+
} from "../../internal/legacy";
|
|
6
7
|
import { IPointer } from "tstl";
|
|
7
|
-
import ts from "typescript";
|
|
8
8
|
import { IJsDocTagInfo } from "typia";
|
|
9
9
|
|
|
10
10
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
@@ -21,7 +21,7 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
21
21
|
children: Map<string, IModule>;
|
|
22
22
|
programmer:
|
|
23
23
|
| null
|
|
24
|
-
| ((importer: ImportDictionary) =>
|
|
24
|
+
| ((importer: ImportDictionary) => Node);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const write = (app: ITypedApplication): Map<string, IModule> => {
|
|
@@ -47,7 +47,7 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
47
47
|
const prepare = (props: {
|
|
48
48
|
dict: Map<string, IModule>;
|
|
49
49
|
name: string;
|
|
50
|
-
programmer: (importer: ImportDictionary) =>
|
|
50
|
+
programmer: (importer: ImportDictionary) => Node;
|
|
51
51
|
}) => {
|
|
52
52
|
let next: Map<string, IModule> = props.dict;
|
|
53
53
|
const accessors: string[] = props.name.split(".");
|
|
@@ -69,10 +69,10 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
69
69
|
const writeAlias =
|
|
70
70
|
(project: INestiaProject) =>
|
|
71
71
|
(importer: ImportDictionary) =>
|
|
72
|
-
(alias: MetadataAliasType):
|
|
72
|
+
(alias: MetadataAliasType): Node =>
|
|
73
73
|
FilePrinter.description(
|
|
74
|
-
|
|
75
|
-
[
|
|
74
|
+
TypeScriptFactory.createTypeAliasDeclaration(
|
|
75
|
+
[TypeScriptFactory.createToken(SyntaxKind.ExportKeyword)],
|
|
76
76
|
alias.name.split(".").at(-1)!,
|
|
77
77
|
[],
|
|
78
78
|
SdkTypeProgrammer.write(project)(importer)(alias.value),
|
|
@@ -83,10 +83,10 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
83
83
|
const writeObject =
|
|
84
84
|
(project: INestiaProject) =>
|
|
85
85
|
(importer: ImportDictionary) =>
|
|
86
|
-
(object: MetadataObjectType):
|
|
86
|
+
(object: MetadataObjectType): Node => {
|
|
87
87
|
return FilePrinter.description(
|
|
88
|
-
|
|
89
|
-
[
|
|
88
|
+
TypeScriptFactory.createTypeAliasDeclaration(
|
|
89
|
+
[TypeScriptFactory.createToken(SyntaxKind.ExportKeyword)],
|
|
90
90
|
object.name.split(".").at(-1)!,
|
|
91
91
|
[],
|
|
92
92
|
SdkTypeProgrammer.write_object(project)(importer)(object),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MetadataSchema } from "
|
|
1
|
+
import { MetadataSchema, nameOf } from "../../internal/legacy";
|
|
2
2
|
|
|
3
3
|
import { IReflectType } from "../../structures/IReflectType";
|
|
4
4
|
import { ITypedApplication } from "../../structures/ITypedApplication";
|
|
@@ -63,11 +63,11 @@ export namespace SdkHttpCloneReferencer {
|
|
|
63
63
|
if (key.length && StringUtil.isImplicit(key) === false)
|
|
64
64
|
p.unique.add(key.split(".")[0]!);
|
|
65
65
|
};
|
|
66
|
-
for (const alias of p.metadata.aliases) enroll(alias.type
|
|
67
|
-
for (const array of p.metadata.arrays) enroll(array.type
|
|
68
|
-
for (const tuple of p.metadata.tuples) enroll(tuple.type
|
|
69
|
-
for (const object of p.metadata.objects) enroll(object.type
|
|
70
|
-
p.name(p.metadata
|
|
66
|
+
for (const alias of p.metadata.aliases) enroll(alias.type!.name);
|
|
67
|
+
for (const array of p.metadata.arrays) enroll(array.type!.name);
|
|
68
|
+
for (const tuple of p.metadata.tuples) enroll(tuple.type!.name);
|
|
69
|
+
for (const object of p.metadata.objects) enroll(object.type!.name);
|
|
70
|
+
p.name(nameOf(p.metadata));
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
|