@nestia/sdk 12.0.0-dev.20260601.1 → 12.0.0-dev.20260619.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/LICENSE +21 -21
- package/README.md +93 -93
- package/assets/bundle/api/HttpError.ts +1 -1
- package/assets/bundle/api/IConnection.ts +1 -1
- package/assets/bundle/api/Primitive.ts +1 -1
- package/assets/bundle/api/Resolved.ts +1 -1
- package/assets/bundle/api/index.ts +4 -4
- package/assets/bundle/api/module.ts +6 -6
- package/assets/bundle/distribute/README.md +37 -37
- package/assets/bundle/distribute/package.json +28 -28
- package/assets/bundle/distribute/tsconfig.json +109 -109
- package/assets/bundle/e2e/index.ts +42 -42
- package/assets/config/nestia.config.ts +97 -97
- package/lib/NestiaSdkApplication.js +29 -7
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/NestiaSwaggerComposer.js +21 -13
- package/lib/NestiaSwaggerComposer.js.map +1 -1
- package/lib/analyses/AccessorAnalyzer.d.ts +4 -1
- package/lib/analyses/AccessorAnalyzer.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.js +1 -1
- package/lib/analyses/PathAnalyzer.d.ts +18 -3
- package/lib/analyses/PathAnalyzer.js +32 -0
- package/lib/analyses/PathAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.js +3 -2
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +53 -20
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +14 -0
- package/lib/analyses/ReflectMcpOperationAnalyzer.js +79 -0
- package/lib/analyses/ReflectMcpOperationAnalyzer.js.map +1 -0
- package/lib/analyses/TypedMcpRouteAnalyzer.d.ts +9 -0
- package/lib/analyses/TypedMcpRouteAnalyzer.js +31 -0
- package/lib/analyses/TypedMcpRouteAnalyzer.js.map +1 -0
- package/lib/executable/internal/NestiaConfigLoader.js +5 -1
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.js +30 -14
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/internal/NestiaSdkWatcher.d.ts +10 -0
- package/lib/executable/internal/NestiaSdkWatcher.js +322 -0
- package/lib/executable/internal/NestiaSdkWatcher.js.map +1 -0
- package/lib/executable/sdk.js +12 -12
- package/lib/executable/sdk.js.map +1 -1
- package/lib/factories/ExpressionFactory.d.ts +9 -0
- package/lib/factories/ExpressionFactory.js +16 -0
- package/lib/factories/ExpressionFactory.js.map +1 -0
- package/lib/factories/IdentifierFactory.d.ts +22 -0
- package/lib/factories/IdentifierFactory.js +50 -0
- package/lib/factories/IdentifierFactory.js.map +1 -0
- package/lib/factories/LiteralFactory.d.ts +9 -0
- package/lib/factories/LiteralFactory.js +48 -0
- package/lib/factories/LiteralFactory.js.map +1 -0
- package/lib/factories/StatementFactory.d.ts +14 -0
- package/lib/factories/StatementFactory.js +20 -0
- package/lib/factories/StatementFactory.js.map +1 -0
- package/lib/factories/TypeFactory.d.ts +24 -0
- package/lib/factories/TypeFactory.js +27 -0
- package/lib/factories/TypeFactory.js.map +1 -0
- package/lib/generates/CloneGenerator.js +6 -4
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.js +50 -1
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.js +18 -2
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.js +32 -29
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +2 -2
- package/lib/generates/internal/FilePrinter.js +14 -25
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +2 -1
- package/lib/generates/internal/ImportDictionary.js +16 -10
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +12 -10
- package/lib/generates/internal/SdkAliasCollection.js +29 -22
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +1 -0
- package/lib/generates/internal/SdkDistributionComposer.js +3 -0
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.js +6 -3
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +3 -3
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.js +42 -9
- package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +47 -51
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +63 -61
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +11 -13
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +52 -47
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +15 -0
- package/lib/generates/internal/SdkMcpRouteProgrammer.js +149 -0
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -0
- package/lib/generates/internal/SdkRouteDirectory.d.ts +2 -1
- package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +3 -3
- package/lib/generates/internal/SdkTypeProgrammer.js +42 -43
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +2 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.js +7 -9
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.d.ts +6 -0
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js +283 -0
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js.map +1 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +45 -47
- 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 -9
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +2 -2
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +37 -41
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +10 -2
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +6 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.d.ts +9 -0
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js +174 -0
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js.map +1 -0
- package/lib/structures/INestiaSdkInput.d.ts +9 -2
- package/lib/structures/IReflectController.d.ts +2 -1
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +4 -2
- package/lib/structures/IReflectMcpOperation.d.ts +35 -0
- package/lib/structures/IReflectMcpOperation.js +3 -0
- package/lib/structures/IReflectMcpOperation.js.map +1 -0
- package/lib/structures/IReflectMcpOperationParameter.d.ts +19 -0
- package/lib/structures/IReflectMcpOperationParameter.js +3 -0
- package/lib/structures/IReflectMcpOperationParameter.js.map +1 -0
- package/lib/structures/ITypedApplication.d.ts +2 -1
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +3 -1
- package/lib/structures/ITypedMcpRoute.d.ts +31 -0
- package/lib/structures/ITypedMcpRoute.js +3 -0
- package/lib/structures/ITypedMcpRoute.js.map +1 -0
- package/lib/transform.d.ts +5 -9
- package/lib/transform.js +8 -31
- package/lib/transform.js.map +1 -1
- package/lib/utils/HttpResponseContentTypeUtil.d.ts +5 -0
- package/lib/utils/HttpResponseContentTypeUtil.js +22 -0
- package/lib/utils/HttpResponseContentTypeUtil.js.map +1 -0
- package/native/go.mod +52 -52
- package/native/go.sum +84 -54
- package/native/sdk/register.go +322 -165
- package/native/sdk/sdk.go +17 -17
- package/native/sdk/sdk_metadata_json.go +327 -327
- package/native/sdk/sdk_transform.go +1879 -1549
- package/package.json +13 -11
- package/src/INestiaConfig.ts +267 -267
- package/src/NestiaSdkApplication.ts +39 -8
- package/src/NestiaSwaggerComposer.ts +153 -142
- package/src/analyses/AccessorAnalyzer.ts +64 -67
- package/src/analyses/ConfigAnalyzer.ts +330 -330
- package/src/analyses/ImportAnalyzer.ts +92 -92
- package/src/analyses/PathAnalyzer.ts +130 -69
- package/src/analyses/ReflectControllerAnalyzer.ts +112 -105
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +183 -183
- package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +90 -90
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +350 -350
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +163 -130
- package/src/analyses/ReflectMcpOperationAnalyzer.ts +124 -0
- package/src/analyses/ReflectMetadataAnalyzer.ts +44 -44
- package/src/analyses/SecurityAnalyzer.ts +25 -25
- package/src/analyses/TypedMcpRouteAnalyzer.ts +34 -0
- package/src/decorators/OperationMetadata.ts +29 -29
- package/src/executable/internal/CommandParser.ts +15 -15
- package/src/executable/internal/NestiaConfigLoader.ts +451 -446
- package/src/executable/internal/NestiaSdkCommand.ts +124 -106
- package/src/executable/internal/NestiaSdkWatcher.ts +342 -0
- package/src/executable/sdk.ts +90 -88
- package/src/factories/ExpressionFactory.ts +23 -0
- package/src/factories/IdentifierFactory.ts +84 -0
- package/src/factories/LiteralFactory.ts +54 -0
- package/src/factories/StatementFactory.ts +56 -0
- package/src/factories/TypeFactory.ts +27 -0
- package/src/generates/CloneGenerator.ts +74 -66
- package/src/generates/E2eGenerator.ts +32 -32
- package/src/generates/SdkGenerator.ts +176 -118
- package/src/generates/SwaggerGenerator.ts +342 -310
- package/src/generates/internal/E2eFileProgrammer.ts +246 -233
- package/src/generates/internal/FilePrinter.ts +57 -65
- package/src/generates/internal/ImportDictionary.ts +207 -204
- package/src/generates/internal/SdkAliasCollection.ts +280 -261
- package/src/generates/internal/SdkDistributionComposer.ts +123 -116
- package/src/generates/internal/SdkFileProgrammer.ts +113 -112
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +124 -126
- package/src/generates/internal/SdkHttpCloneReferencer.ts +131 -77
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +290 -301
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +507 -510
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +163 -165
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +109 -109
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +322 -314
- package/src/generates/internal/SdkImportWizard.ts +62 -62
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +447 -0
- package/src/generates/internal/SdkRouteDirectory.ts +21 -18
- package/src/generates/internal/SdkTypeProgrammer.ts +389 -382
- package/src/generates/internal/SdkTypeTagProgrammer.ts +110 -114
- package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +319 -0
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +383 -389
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +91 -89
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +304 -323
- package/src/generates/internal/SwaggerDescriptionComposer.ts +64 -64
- package/src/generates/internal/SwaggerOperationComposer.ts +119 -119
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +175 -162
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +115 -110
- package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +262 -0
- package/src/index.ts +4 -4
- package/src/internal/legacy.ts +492 -492
- package/src/module.ts +4 -4
- package/src/structures/INestiaProject.ts +10 -10
- package/src/structures/INestiaSdkInput.ts +27 -20
- package/src/structures/IOperationMetadata.ts +41 -41
- package/src/structures/IReflectController.ts +18 -15
- package/src/structures/IReflectHttpOperation.ts +26 -26
- package/src/structures/IReflectHttpOperationException.ts +18 -18
- package/src/structures/IReflectHttpOperationParameter.ts +79 -79
- package/src/structures/IReflectHttpOperationSuccess.ts +18 -21
- package/src/structures/IReflectImport.ts +6 -6
- package/src/structures/IReflectMcpOperation.ts +38 -0
- package/src/structures/IReflectMcpOperationParameter.ts +27 -0
- package/src/structures/IReflectOperationError.ts +26 -26
- package/src/structures/IReflectType.ts +4 -4
- package/src/structures/IReflectWebSocketOperation.ts +17 -17
- package/src/structures/ITypedApplication.ts +12 -11
- package/src/structures/ITypedHttpRoute.ts +41 -41
- package/src/structures/ITypedHttpRouteException.ts +15 -15
- package/src/structures/ITypedHttpRouteParameter.ts +41 -41
- package/src/structures/ITypedHttpRouteSuccess.ts +18 -22
- package/src/structures/ITypedMcpRoute.ts +33 -0
- package/src/structures/ITypedWebSocketRoute.ts +24 -24
- package/src/structures/ITypedWebSocketRouteParameter.ts +3 -3
- package/src/transform.ts +28 -59
- package/src/typings/get-function-location.d.ts +7 -7
- package/src/utils/ArrayUtil.ts +26 -26
- package/src/utils/EmittedJavaScriptPatcher.ts +88 -88
- package/src/utils/FileRetriever.ts +22 -22
- package/src/utils/HttpResponseContentTypeUtil.ts +30 -0
- package/src/utils/MapUtil.ts +14 -14
- package/src/utils/PathUtil.ts +10 -10
- package/src/utils/SourceFinder.ts +63 -63
- package/src/utils/StringUtil.ts +17 -17
- package/src/utils/TsConfigReader.ts +108 -108
- package/src/utils/TtscExecutor.ts +68 -68
- package/src/utils/VersioningStrategy.ts +28 -28
- package/src/validators/HttpHeadersValidator.ts +11 -11
- package/src/validators/HttpQueryValidator.ts +11 -11
- package/src/validators/TextPlainValidator.ts +17 -17
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { VERSION_NEUTRAL } from "@nestjs/common";
|
|
2
|
-
import { IJsDocTagInfo } from "typia";
|
|
3
|
-
|
|
4
|
-
import { IReflectImport } from "./IReflectImport";
|
|
5
|
-
import { IReflectWebSocketOperationParameter } from "./IReflectWebSocketOperationParameter";
|
|
6
|
-
|
|
7
|
-
export interface IReflectWebSocketOperation {
|
|
8
|
-
protocol: "websocket";
|
|
9
|
-
name: string;
|
|
10
|
-
paths: string[];
|
|
11
|
-
function: Function;
|
|
12
|
-
versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
13
|
-
parameters: IReflectWebSocketOperationParameter[];
|
|
14
|
-
imports: IReflectImport[];
|
|
15
|
-
description: string | null;
|
|
16
|
-
jsDocTags: IJsDocTagInfo[];
|
|
17
|
-
}
|
|
1
|
+
import { VERSION_NEUTRAL } from "@nestjs/common";
|
|
2
|
+
import { IJsDocTagInfo } from "typia";
|
|
3
|
+
|
|
4
|
+
import { IReflectImport } from "./IReflectImport";
|
|
5
|
+
import { IReflectWebSocketOperationParameter } from "./IReflectWebSocketOperationParameter";
|
|
6
|
+
|
|
7
|
+
export interface IReflectWebSocketOperation {
|
|
8
|
+
protocol: "websocket";
|
|
9
|
+
name: string;
|
|
10
|
+
paths: string[];
|
|
11
|
+
function: Function;
|
|
12
|
+
versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
13
|
+
parameters: IReflectWebSocketOperationParameter[];
|
|
14
|
+
imports: IReflectImport[];
|
|
15
|
+
description: string | null;
|
|
16
|
+
jsDocTags: IJsDocTagInfo[];
|
|
17
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { IMetadataDictionary } from "../internal/legacy";
|
|
2
|
-
|
|
3
|
-
import { INestiaProject } from "./INestiaProject";
|
|
4
|
-
import { ITypedHttpRoute } from "./ITypedHttpRoute";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { IMetadataDictionary } from "../internal/legacy";
|
|
2
|
+
|
|
3
|
+
import { INestiaProject } from "./INestiaProject";
|
|
4
|
+
import { ITypedHttpRoute } from "./ITypedHttpRoute";
|
|
5
|
+
import { ITypedMcpRoute } from "./ITypedMcpRoute";
|
|
6
|
+
import { ITypedWebSocketRoute } from "./ITypedWebSocketRoute";
|
|
7
|
+
|
|
8
|
+
export interface ITypedApplication {
|
|
9
|
+
project: INestiaProject;
|
|
10
|
+
collection: IMetadataDictionary;
|
|
11
|
+
routes: Array<ITypedHttpRoute | ITypedWebSocketRoute | ITypedMcpRoute>;
|
|
12
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { IJsDocTagInfo } from "typia";
|
|
2
|
-
|
|
3
|
-
import { IReflectController } from "./IReflectController";
|
|
4
|
-
import { IReflectImport } from "./IReflectImport";
|
|
5
|
-
import { ITypedHttpRouteException } from "./ITypedHttpRouteException";
|
|
6
|
-
import { ITypedHttpRouteParameter } from "./ITypedHttpRouteParameter";
|
|
7
|
-
import { ITypedHttpRouteSuccess } from "./ITypedHttpRouteSuccess";
|
|
8
|
-
|
|
9
|
-
export interface ITypedHttpRoute {
|
|
10
|
-
protocol: "http";
|
|
11
|
-
function: Function;
|
|
12
|
-
controller: IReflectController;
|
|
13
|
-
name: string;
|
|
14
|
-
method: string;
|
|
15
|
-
path: string;
|
|
16
|
-
accessor: string[];
|
|
17
|
-
|
|
18
|
-
// PARAMETERS
|
|
19
|
-
pathParameters: ITypedHttpRouteParameter.IPath[];
|
|
20
|
-
queryParameters: ITypedHttpRouteParameter.IQuery[];
|
|
21
|
-
headerParameters: ITypedHttpRouteParameter.IHeaders[];
|
|
22
|
-
queryObject: ITypedHttpRouteParameter.IQuery | null;
|
|
23
|
-
headerObject: ITypedHttpRouteParameter.IHeaders | null;
|
|
24
|
-
body: ITypedHttpRouteParameter.IBody | null;
|
|
25
|
-
|
|
26
|
-
// RESPONSES
|
|
27
|
-
success: ITypedHttpRouteSuccess;
|
|
28
|
-
exceptions: Record<
|
|
29
|
-
number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
30
|
-
ITypedHttpRouteException
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
|
-
// ADDITIONAL INFORMATION
|
|
34
|
-
security: Record<string, string[]>[];
|
|
35
|
-
tags: string[];
|
|
36
|
-
imports: IReflectImport[];
|
|
37
|
-
description: string | null;
|
|
38
|
-
jsDocTags: IJsDocTagInfo[];
|
|
39
|
-
operationId: string | undefined;
|
|
40
|
-
extensions?: Record<string, any>;
|
|
41
|
-
}
|
|
1
|
+
import { IJsDocTagInfo } from "typia";
|
|
2
|
+
|
|
3
|
+
import { IReflectController } from "./IReflectController";
|
|
4
|
+
import { IReflectImport } from "./IReflectImport";
|
|
5
|
+
import { ITypedHttpRouteException } from "./ITypedHttpRouteException";
|
|
6
|
+
import { ITypedHttpRouteParameter } from "./ITypedHttpRouteParameter";
|
|
7
|
+
import { ITypedHttpRouteSuccess } from "./ITypedHttpRouteSuccess";
|
|
8
|
+
|
|
9
|
+
export interface ITypedHttpRoute {
|
|
10
|
+
protocol: "http";
|
|
11
|
+
function: Function;
|
|
12
|
+
controller: IReflectController;
|
|
13
|
+
name: string;
|
|
14
|
+
method: string;
|
|
15
|
+
path: string;
|
|
16
|
+
accessor: string[];
|
|
17
|
+
|
|
18
|
+
// PARAMETERS
|
|
19
|
+
pathParameters: ITypedHttpRouteParameter.IPath[];
|
|
20
|
+
queryParameters: ITypedHttpRouteParameter.IQuery[];
|
|
21
|
+
headerParameters: ITypedHttpRouteParameter.IHeaders[];
|
|
22
|
+
queryObject: ITypedHttpRouteParameter.IQuery | null;
|
|
23
|
+
headerObject: ITypedHttpRouteParameter.IHeaders | null;
|
|
24
|
+
body: ITypedHttpRouteParameter.IBody | null;
|
|
25
|
+
|
|
26
|
+
// RESPONSES
|
|
27
|
+
success: ITypedHttpRouteSuccess;
|
|
28
|
+
exceptions: Record<
|
|
29
|
+
number | "2XX" | "3XX" | "4XX" | "5XX",
|
|
30
|
+
ITypedHttpRouteException
|
|
31
|
+
>;
|
|
32
|
+
|
|
33
|
+
// ADDITIONAL INFORMATION
|
|
34
|
+
security: Record<string, string[]>[];
|
|
35
|
+
tags: string[];
|
|
36
|
+
imports: IReflectImport[];
|
|
37
|
+
description: string | null;
|
|
38
|
+
jsDocTags: IJsDocTagInfo[];
|
|
39
|
+
operationId: string | undefined;
|
|
40
|
+
extensions?: Record<string, any>;
|
|
41
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { MetadataSchema } from "../internal/legacy";
|
|
2
|
-
|
|
3
|
-
import { IReflectType } from "./IReflectType";
|
|
4
|
-
|
|
5
|
-
export interface ITypedHttpRouteException {
|
|
6
|
-
// BASIC PROPERTIES
|
|
7
|
-
status: number | "2XX" | "3XX" | "4XX" | "5XX";
|
|
8
|
-
description: string | null;
|
|
9
|
-
example: any;
|
|
10
|
-
examples: Record<string, any>;
|
|
11
|
-
|
|
12
|
-
// REFLECTED PROPERTIES
|
|
13
|
-
type: IReflectType;
|
|
14
|
-
metadata: MetadataSchema;
|
|
15
|
-
}
|
|
1
|
+
import { MetadataSchema } from "../internal/legacy";
|
|
2
|
+
|
|
3
|
+
import { IReflectType } from "./IReflectType";
|
|
4
|
+
|
|
5
|
+
export interface ITypedHttpRouteException {
|
|
6
|
+
// BASIC PROPERTIES
|
|
7
|
+
status: number | "2XX" | "3XX" | "4XX" | "5XX";
|
|
8
|
+
description: string | null;
|
|
9
|
+
example: any;
|
|
10
|
+
examples: Record<string, any>;
|
|
11
|
+
|
|
12
|
+
// REFLECTED PROPERTIES
|
|
13
|
+
type: IReflectType;
|
|
14
|
+
metadata: MetadataSchema;
|
|
15
|
+
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { MetadataSchema } from "../internal/legacy";
|
|
2
|
-
import { IJsDocTagInfo } from "typia";
|
|
3
|
-
|
|
4
|
-
import { IReflectType } from "./IReflectType";
|
|
5
|
-
|
|
6
|
-
export type ITypedHttpRouteParameter =
|
|
7
|
-
| ITypedHttpRouteParameter.IBody
|
|
8
|
-
| ITypedHttpRouteParameter.IHeaders
|
|
9
|
-
| ITypedHttpRouteParameter.IPath
|
|
10
|
-
| ITypedHttpRouteParameter.IQuery;
|
|
11
|
-
export namespace ITypedHttpRouteParameter {
|
|
12
|
-
export interface IBody extends IBase<"body"> {
|
|
13
|
-
contentType:
|
|
14
|
-
| "application/json"
|
|
15
|
-
| "application/x-www-form-urlencoded"
|
|
16
|
-
| "multipart/form-data"
|
|
17
|
-
| "text/plain";
|
|
18
|
-
encrypted: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface IHeaders extends IBase<"headers"> {
|
|
21
|
-
field: string | null;
|
|
22
|
-
}
|
|
23
|
-
export interface IPath extends IBase<"param"> {
|
|
24
|
-
field: string;
|
|
25
|
-
}
|
|
26
|
-
export interface IQuery extends IBase<"query"> {
|
|
27
|
-
field: string | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface IBase<Category extends string> {
|
|
31
|
-
category: Category;
|
|
32
|
-
name: string;
|
|
33
|
-
index: number;
|
|
34
|
-
type: IReflectType;
|
|
35
|
-
metadata: MetadataSchema;
|
|
36
|
-
example?: any;
|
|
37
|
-
examples?: Record<string, any>;
|
|
38
|
-
description: string | null;
|
|
39
|
-
jsDocTags: IJsDocTagInfo[];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
import { MetadataSchema } from "../internal/legacy";
|
|
2
|
+
import { IJsDocTagInfo } from "typia";
|
|
3
|
+
|
|
4
|
+
import { IReflectType } from "./IReflectType";
|
|
5
|
+
|
|
6
|
+
export type ITypedHttpRouteParameter =
|
|
7
|
+
| ITypedHttpRouteParameter.IBody
|
|
8
|
+
| ITypedHttpRouteParameter.IHeaders
|
|
9
|
+
| ITypedHttpRouteParameter.IPath
|
|
10
|
+
| ITypedHttpRouteParameter.IQuery;
|
|
11
|
+
export namespace ITypedHttpRouteParameter {
|
|
12
|
+
export interface IBody extends IBase<"body"> {
|
|
13
|
+
contentType:
|
|
14
|
+
| "application/json"
|
|
15
|
+
| "application/x-www-form-urlencoded"
|
|
16
|
+
| "multipart/form-data"
|
|
17
|
+
| "text/plain";
|
|
18
|
+
encrypted: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface IHeaders extends IBase<"headers"> {
|
|
21
|
+
field: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface IPath extends IBase<"param"> {
|
|
24
|
+
field: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IQuery extends IBase<"query"> {
|
|
27
|
+
field: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface IBase<Category extends string> {
|
|
31
|
+
category: Category;
|
|
32
|
+
name: string;
|
|
33
|
+
index: number;
|
|
34
|
+
type: IReflectType;
|
|
35
|
+
metadata: MetadataSchema;
|
|
36
|
+
example?: any;
|
|
37
|
+
examples?: Record<string, any>;
|
|
38
|
+
description: string | null;
|
|
39
|
+
jsDocTags: IJsDocTagInfo[];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
import { MetadataSchema } from "../internal/legacy";
|
|
2
|
-
|
|
3
|
-
import { IReflectType } from "./IReflectType";
|
|
4
|
-
|
|
5
|
-
export interface ITypedHttpRouteSuccess {
|
|
6
|
-
type: IReflectType;
|
|
7
|
-
status: number | null;
|
|
8
|
-
contentType:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| { type: "setter"; source: string; target?: string }
|
|
20
|
-
| { type: "assigner"; source: string }
|
|
21
|
-
>;
|
|
22
|
-
}
|
|
1
|
+
import { MetadataSchema } from "../internal/legacy";
|
|
2
|
+
import { HttpResponseContentTypeUtil } from "../utils/HttpResponseContentTypeUtil";
|
|
3
|
+
import { IReflectType } from "./IReflectType";
|
|
4
|
+
|
|
5
|
+
export interface ITypedHttpRouteSuccess {
|
|
6
|
+
type: IReflectType;
|
|
7
|
+
status: number | null;
|
|
8
|
+
contentType: HttpResponseContentTypeUtil.Response;
|
|
9
|
+
binary: boolean;
|
|
10
|
+
encrypted: boolean;
|
|
11
|
+
metadata: MetadataSchema;
|
|
12
|
+
example?: any;
|
|
13
|
+
examples?: Record<string, any>;
|
|
14
|
+
setHeaders: Array<
|
|
15
|
+
| { type: "setter"; source: string; target?: string }
|
|
16
|
+
| { type: "assigner"; source: string }
|
|
17
|
+
>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
import { IReflectController } from "./IReflectController";
|
|
4
|
+
import { IReflectImport } from "./IReflectImport";
|
|
5
|
+
import { IReflectMcpOperation } from "./IReflectMcpOperation";
|
|
6
|
+
import { IReflectMcpOperationParameter } from "./IReflectMcpOperationParameter";
|
|
7
|
+
import { IReflectType } from "./IReflectType";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Final typed representation of an MCP tool route.
|
|
11
|
+
*
|
|
12
|
+
* Carries everything the SDK generator needs to emit a typed client function:
|
|
13
|
+
* the controller reference, accessor path, typia-derived input schema, and
|
|
14
|
+
* input/output type info.
|
|
15
|
+
*/
|
|
16
|
+
export interface ITypedMcpRoute {
|
|
17
|
+
protocol: "mcp";
|
|
18
|
+
controller: IReflectController;
|
|
19
|
+
name: string;
|
|
20
|
+
toolName: string;
|
|
21
|
+
title: string | null;
|
|
22
|
+
toolDescription: string | null;
|
|
23
|
+
accessor: string[];
|
|
24
|
+
function: Function;
|
|
25
|
+
input: IReflectMcpOperationParameter | null;
|
|
26
|
+
returnType: IReflectType | null;
|
|
27
|
+
inputSchema: object;
|
|
28
|
+
outputSchema: object | null;
|
|
29
|
+
annotations: IReflectMcpOperation.IAnnotations | null;
|
|
30
|
+
imports: IReflectImport[];
|
|
31
|
+
description: string | null;
|
|
32
|
+
jsDocTags: ts.JSDocTagInfo[];
|
|
33
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { VERSION_NEUTRAL } from "@nestjs/common";
|
|
2
|
-
import { IJsDocTagInfo } from "typia";
|
|
3
|
-
|
|
4
|
-
import { IReflectController } from "./IReflectController";
|
|
5
|
-
import { IReflectImport } from "./IReflectImport";
|
|
6
|
-
import { ITypedWebSocketRouteParameter } from "./ITypedWebSocketRouteParameter";
|
|
7
|
-
|
|
8
|
-
export interface ITypedWebSocketRoute {
|
|
9
|
-
protocol: "websocket";
|
|
10
|
-
controller: IReflectController;
|
|
11
|
-
name: string;
|
|
12
|
-
path: string;
|
|
13
|
-
accessor: string[];
|
|
14
|
-
function: Function;
|
|
15
|
-
versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
16
|
-
acceptor: ITypedWebSocketRouteParameter.IAcceptor;
|
|
17
|
-
header: ITypedWebSocketRouteParameter.IHeader | null;
|
|
18
|
-
pathParameters: ITypedWebSocketRouteParameter.IParam[];
|
|
19
|
-
query: ITypedWebSocketRouteParameter.IQuery | null;
|
|
20
|
-
driver: ITypedWebSocketRouteParameter.IDriver | null;
|
|
21
|
-
imports: IReflectImport[];
|
|
22
|
-
description: string | null;
|
|
23
|
-
jsDocTags: IJsDocTagInfo[];
|
|
24
|
-
}
|
|
1
|
+
import { VERSION_NEUTRAL } from "@nestjs/common";
|
|
2
|
+
import { IJsDocTagInfo } from "typia";
|
|
3
|
+
|
|
4
|
+
import { IReflectController } from "./IReflectController";
|
|
5
|
+
import { IReflectImport } from "./IReflectImport";
|
|
6
|
+
import { ITypedWebSocketRouteParameter } from "./ITypedWebSocketRouteParameter";
|
|
7
|
+
|
|
8
|
+
export interface ITypedWebSocketRoute {
|
|
9
|
+
protocol: "websocket";
|
|
10
|
+
controller: IReflectController;
|
|
11
|
+
name: string;
|
|
12
|
+
path: string;
|
|
13
|
+
accessor: string[];
|
|
14
|
+
function: Function;
|
|
15
|
+
versions: Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
16
|
+
acceptor: ITypedWebSocketRouteParameter.IAcceptor;
|
|
17
|
+
header: ITypedWebSocketRouteParameter.IHeader | null;
|
|
18
|
+
pathParameters: ITypedWebSocketRouteParameter.IParam[];
|
|
19
|
+
query: ITypedWebSocketRouteParameter.IQuery | null;
|
|
20
|
+
driver: ITypedWebSocketRouteParameter.IDriver | null;
|
|
21
|
+
imports: IReflectImport[];
|
|
22
|
+
description: string | null;
|
|
23
|
+
jsDocTags: IJsDocTagInfo[];
|
|
24
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IReflectWebSocketOperationParameter } from "./IReflectWebSocketOperationParameter";
|
|
2
|
-
|
|
3
|
-
export import ITypedWebSocketRouteParameter = IReflectWebSocketOperationParameter;
|
|
1
|
+
import { IReflectWebSocketOperationParameter } from "./IReflectWebSocketOperationParameter";
|
|
2
|
+
|
|
3
|
+
export import ITypedWebSocketRouteParameter = IReflectWebSocketOperationParameter;
|
package/src/transform.ts
CHANGED
|
@@ -1,59 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
export default createTtscPlugin;
|
|
32
|
-
|
|
33
|
-
function currentFilename(): string {
|
|
34
|
-
if (
|
|
35
|
-
typeof __filename === "string" &&
|
|
36
|
-
__filename !== "[stdin]" &&
|
|
37
|
-
__filename.length !== 0
|
|
38
|
-
)
|
|
39
|
-
return normalizeFilename(__filename);
|
|
40
|
-
|
|
41
|
-
const line: string | undefined = new Error().stack
|
|
42
|
-
?.split("\n")
|
|
43
|
-
.find(
|
|
44
|
-
(entry) =>
|
|
45
|
-
entry.includes("/src/transform.ts") ||
|
|
46
|
-
entry.includes("/lib/transform.js") ||
|
|
47
|
-
entry.includes("/lib/transform.mjs"),
|
|
48
|
-
);
|
|
49
|
-
const matched: RegExpMatchArray | null | undefined = line?.match(
|
|
50
|
-
/\(([^()]+):\d+:\d+\)|at ([^\s()]+):\d+:\d+/,
|
|
51
|
-
);
|
|
52
|
-
const fallback: string = typeof __filename === "string" ? __filename : "";
|
|
53
|
-
return normalizeFilename(matched?.[1] ?? matched?.[2] ?? fallback);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function normalizeFilename(value: string): string {
|
|
57
|
-
if (value.startsWith("file:")) return fileURLToPath(value);
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import type { ITtscPlugin, ITtscPluginFactoryContext } from "ttsc";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `@nestia/sdk` ttsc plugin descriptor.
|
|
7
|
+
*
|
|
8
|
+
* Points ttsc at this package's own Go source (`native/sdk`, package `sdk`).
|
|
9
|
+
* Because that package is not `package main`, ttsc classifies it as a linked
|
|
10
|
+
* transform and statically links it into the `@nestia/core` host binary as a
|
|
11
|
+
* contributor — but only for projects that actually depend on `@nestia/sdk`. A
|
|
12
|
+
* project depending on `@nestia/core` alone never links, compiles, or ships any
|
|
13
|
+
* of this SDK transform code.
|
|
14
|
+
*/
|
|
15
|
+
export default function createTtscPlugin(
|
|
16
|
+
context: ITtscPluginFactoryContext,
|
|
17
|
+
): ITtscPlugin {
|
|
18
|
+
const requireFrom = createRequire(
|
|
19
|
+
path.join(context.projectRoot, "package.json"),
|
|
20
|
+
);
|
|
21
|
+
const root: string = path.dirname(
|
|
22
|
+
requireFrom.resolve("@nestia/sdk/package.json"),
|
|
23
|
+
);
|
|
24
|
+
return {
|
|
25
|
+
name: "@nestia/sdk",
|
|
26
|
+
source: path.resolve(root, "native", "sdk"),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
declare module "get-function-location" {
|
|
2
|
-
export default function (func: any): Promise<{
|
|
3
|
-
source: string;
|
|
4
|
-
line: number;
|
|
5
|
-
column: number;
|
|
6
|
-
}>;
|
|
7
|
-
}
|
|
1
|
+
declare module "get-function-location" {
|
|
2
|
+
export default function (func: any): Promise<{
|
|
3
|
+
source: string;
|
|
4
|
+
line: number;
|
|
5
|
+
column: number;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
package/src/utils/ArrayUtil.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
export namespace ArrayUtil {
|
|
2
|
-
export function has<T>(array: T[], ...items: T[]): boolean {
|
|
3
|
-
return items.every(
|
|
4
|
-
(elem) => array.find((org) => org === elem) !== undefined,
|
|
5
|
-
);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export async function asyncMap<X, Y>(
|
|
9
|
-
array: X[],
|
|
10
|
-
closure: (input: X) => Promise<Y>,
|
|
11
|
-
): Promise<Y[]> {
|
|
12
|
-
const ret: Y[] = [];
|
|
13
|
-
for (const elem of array) ret.push(await closure(elem));
|
|
14
|
-
return ret;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function asyncFilter<T>(
|
|
18
|
-
array: T[],
|
|
19
|
-
closure: (input: T) => Promise<boolean>,
|
|
20
|
-
): Promise<T[]> {
|
|
21
|
-
const ret: T[] = [];
|
|
22
|
-
for (const elem of array)
|
|
23
|
-
if ((await closure(elem)) === true) ret.push(elem);
|
|
24
|
-
return ret;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
export namespace ArrayUtil {
|
|
2
|
+
export function has<T>(array: T[], ...items: T[]): boolean {
|
|
3
|
+
return items.every(
|
|
4
|
+
(elem) => array.find((org) => org === elem) !== undefined,
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export async function asyncMap<X, Y>(
|
|
9
|
+
array: X[],
|
|
10
|
+
closure: (input: X) => Promise<Y>,
|
|
11
|
+
): Promise<Y[]> {
|
|
12
|
+
const ret: Y[] = [];
|
|
13
|
+
for (const elem of array) ret.push(await closure(elem));
|
|
14
|
+
return ret;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export async function asyncFilter<T>(
|
|
18
|
+
array: T[],
|
|
19
|
+
closure: (input: T) => Promise<boolean>,
|
|
20
|
+
): Promise<T[]> {
|
|
21
|
+
const ret: T[] = [];
|
|
22
|
+
for (const elem of array)
|
|
23
|
+
if ((await closure(elem)) === true) ret.push(elem);
|
|
24
|
+
return ret;
|
|
25
|
+
}
|
|
26
|
+
}
|