@nestia/sdk 14.0.1 → 14.0.3
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/build-sdk.cjs +28 -0
- package/assets/bundle/distribute/package.json +6 -2
- package/lib/INestiaConfig.d.ts +55 -24
- package/lib/NestiaSdkApplication.d.ts +60 -0
- package/lib/NestiaSdkApplication.js +63 -5
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/NestiaSwaggerComposer.d.ts +21 -0
- package/lib/NestiaSwaggerComposer.js +21 -3
- package/lib/NestiaSwaggerComposer.js.map +1 -1
- package/lib/analyses/AccessorAnalyzer.d.ts +26 -0
- package/lib/analyses/AccessorAnalyzer.js +26 -0
- package/lib/analyses/AccessorAnalyzer.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.d.ts +41 -0
- package/lib/analyses/ConfigAnalyzer.js +57 -80
- package/lib/analyses/ConfigAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts +25 -0
- package/lib/analyses/ImportAnalyzer.js +25 -0
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/analyses/ParameterNameAnalyzer.d.ts +24 -0
- package/lib/analyses/ParameterNameAnalyzer.js +15 -0
- package/lib/analyses/ParameterNameAnalyzer.js.map +1 -1
- package/lib/analyses/PathAnalyzer.d.ts +63 -1
- package/lib/analyses/PathAnalyzer.js +54 -9
- package/lib/analyses/PathAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectControllerAnalyzer.js +22 -0
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +28 -17
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.d.ts +31 -0
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js +21 -0
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +31 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +21 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +22 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectMcpOperationAnalyzer.js +30 -9
- package/lib/analyses/ReflectMcpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMetadataAnalyzer.d.ts +47 -0
- package/lib/analyses/ReflectMetadataAnalyzer.js +47 -0
- package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +22 -5
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/SecurityAnalyzer.d.ts +15 -0
- package/lib/analyses/SecurityAnalyzer.js +15 -0
- package/lib/analyses/SecurityAnalyzer.js.map +1 -1
- package/lib/analyses/SwaggerExampleAnalyzer.d.ts +16 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js +16 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js.map +1 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +41 -3
- package/lib/analyses/TypedHttpRouteAnalyzer.js +172 -157
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedMcpRouteAnalyzer.d.ts +29 -0
- package/lib/analyses/TypedMcpRouteAnalyzer.js +152 -20
- package/lib/analyses/TypedMcpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +19 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +19 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
- package/lib/decorators/OperationMetadata.d.ts +6 -0
- package/lib/decorators/OperationMetadata.js +6 -0
- package/lib/decorators/OperationMetadata.js.map +1 -1
- package/lib/executable/internal/CommandParser.d.ts +19 -0
- package/lib/executable/internal/CommandParser.js +19 -0
- package/lib/executable/internal/CommandParser.js.map +1 -1
- package/lib/executable/internal/NestiaConfigLoader.d.ts +56 -0
- package/lib/executable/internal/NestiaConfigLoader.js +48 -42
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.d.ts +60 -0
- package/lib/executable/internal/NestiaSdkCommand.js +95 -3
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/internal/NestiaSdkWatcher.d.ts +81 -0
- package/lib/executable/internal/NestiaSdkWatcher.js +122 -38
- package/lib/executable/internal/NestiaSdkWatcher.js.map +1 -1
- package/lib/executable/internal/NestiaSwaggerWatch.d.ts +80 -0
- package/lib/executable/internal/NestiaSwaggerWatch.js +308 -0
- package/lib/executable/internal/NestiaSwaggerWatch.js.map +1 -0
- package/lib/factories/ExpressionFactory.d.ts +17 -2
- package/lib/factories/ExpressionFactory.js +17 -2
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +24 -0
- package/lib/factories/IdentifierFactory.js +24 -0
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/LiteralFactory.d.ts +22 -4
- package/lib/factories/LiteralFactory.js +30 -10
- package/lib/factories/LiteralFactory.js.map +1 -1
- package/lib/factories/StatementFactory.d.ts +28 -1
- package/lib/factories/StatementFactory.js +28 -1
- package/lib/factories/StatementFactory.js.map +1 -1
- package/lib/factories/TypeFactory.d.ts +24 -0
- package/lib/factories/TypeFactory.js +15 -0
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/generates/CloneGenerator.d.ts +22 -0
- package/lib/generates/CloneGenerator.js +26 -5
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/E2eGenerator.d.ts +19 -0
- package/lib/generates/E2eGenerator.js +19 -0
- package/lib/generates/E2eGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.d.ts +38 -0
- package/lib/generates/SdkGenerator.js +40 -2
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts +36 -6
- package/lib/generates/SwaggerGenerator.js +55 -13
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.d.ts +19 -0
- package/lib/generates/internal/E2eFileProgrammer.js +20 -1
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +43 -0
- package/lib/generates/internal/FilePrinter.js +43 -0
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +92 -2
- package/lib/generates/internal/ImportDictionary.js +91 -3
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +119 -0
- package/lib/generates/internal/SdkAliasCollection.js +124 -7
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +19 -0
- package/lib/generates/internal/SdkDistributionComposer.js +98 -59
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +29 -0
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +33 -0
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpCloneReferencer.js +78 -25
- package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +19 -0
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +104 -2
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +70 -0
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +38 -0
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +49 -5
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkImportWizard.d.ts +63 -0
- package/lib/generates/internal/SdkImportWizard.js +63 -0
- package/lib/generates/internal/SdkImportWizard.js.map +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +17 -2
- package/lib/generates/internal/SdkMcpRouteProgrammer.js +33 -13
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkPathTemplate.d.ts +15 -0
- package/lib/generates/internal/SdkPathTemplate.js +15 -0
- package/lib/generates/internal/SdkPathTemplate.js.map +1 -1
- package/lib/generates/internal/SdkRouteDirectory.d.ts +10 -0
- package/lib/generates/internal/SdkRouteDirectory.js +10 -0
- package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +54 -1
- package/lib/generates/internal/SdkTypeProgrammer.js +96 -12
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +36 -3
- package/lib/generates/internal/SdkTypeTagProgrammer.js +28 -7
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.d.ts +40 -0
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js +149 -142
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +19 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +81 -2
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +48 -0
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +42 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationComposer.d.ts +18 -0
- package/lib/generates/internal/SwaggerOperationComposer.js +18 -0
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +39 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +31 -8
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +19 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +19 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
- package/lib/internal/legacy.d.ts +296 -16
- package/lib/internal/legacy.js +127 -10
- package/lib/internal/legacy.js.map +1 -1
- package/lib/structures/INestiaProject.d.ts +10 -0
- package/lib/structures/INestiaSdkInput.d.ts +31 -1
- package/lib/structures/IOperationMetadata.d.ts +55 -0
- package/lib/structures/IReflectController.d.ts +11 -1
- package/lib/structures/IReflectHttpOperation.d.ts +11 -1
- package/lib/structures/IReflectHttpOperationException.d.ts +10 -0
- package/lib/structures/IReflectHttpOperationParameter.d.ts +47 -0
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +11 -0
- package/lib/structures/IReflectImport.d.ts +10 -0
- package/lib/structures/IReflectMcpOperation.d.ts +19 -0
- package/lib/structures/IReflectMcpOperationParameter.d.ts +9 -0
- package/lib/structures/IReflectOperationError.d.ts +28 -0
- package/lib/structures/IReflectOperationError.js +22 -2
- package/lib/structures/IReflectOperationError.js.map +1 -1
- package/lib/structures/IReflectType.d.ts +9 -0
- package/lib/structures/IReflectWebSocketOperation.d.ts +10 -0
- package/lib/structures/IReflectWebSocketOperationParameter.d.ts +55 -0
- package/lib/structures/ITypedApplication.d.ts +10 -0
- package/lib/structures/ITypedHttpRoute.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteException.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteParameter.d.ts +45 -0
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +10 -0
- package/lib/structures/ITypedMcpRoute.d.ts +11 -0
- package/lib/structures/ITypedWebSocketRoute.d.ts +10 -0
- package/lib/transform.d.ts +6 -0
- package/lib/transform.js +6 -0
- package/lib/transform.js.map +1 -1
- package/lib/utils/ArrayUtil.d.ts +31 -1
- package/lib/utils/ArrayUtil.js +32 -11
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/EmittedJavaScriptPatcher.d.ts +20 -0
- package/lib/utils/EmittedJavaScriptPatcher.js +65 -46
- package/lib/utils/EmittedJavaScriptPatcher.js.map +1 -1
- package/lib/utils/FileRetriever.d.ts +29 -0
- package/lib/utils/FileRetriever.js +29 -0
- package/lib/utils/FileRetriever.js.map +1 -1
- package/lib/utils/HttpResponseContentTypeUtil.d.ts +41 -0
- package/lib/utils/HttpResponseContentTypeUtil.js +31 -0
- package/lib/utils/HttpResponseContentTypeUtil.js.map +1 -1
- package/lib/utils/MapUtil.d.ts +64 -1
- package/lib/utils/MapUtil.js +24 -3
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/PathUtil.d.ts +31 -0
- package/lib/utils/PathUtil.js +38 -0
- package/lib/utils/PathUtil.js.map +1 -1
- package/lib/utils/SdkBundlePath.d.ts +2 -0
- package/lib/utils/SdkBundlePath.js +10 -0
- package/lib/utils/SdkBundlePath.js.map +1 -0
- package/lib/utils/SdkInputFilter.d.ts +31 -0
- package/lib/utils/SdkInputFilter.js +115 -0
- package/lib/utils/SdkInputFilter.js.map +1 -0
- package/lib/utils/SourceFinder.d.ts +35 -0
- package/lib/utils/SourceFinder.js +47 -12
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/StringUtil.d.ts +77 -2
- package/lib/utils/StringUtil.js +166 -4
- package/lib/utils/StringUtil.js.map +1 -1
- package/lib/utils/TemporaryDirectory.d.ts +60 -0
- package/lib/utils/TemporaryDirectory.js +112 -0
- package/lib/utils/TemporaryDirectory.js.map +1 -0
- package/lib/utils/TsConfigReader.d.ts +42 -0
- package/lib/utils/TsConfigReader.js +98 -14
- package/lib/utils/TsConfigReader.js.map +1 -1
- package/lib/utils/TtscExecutor.d.ts +23 -1
- package/lib/utils/TtscExecutor.js +22 -0
- package/lib/utils/TtscExecutor.js.map +1 -1
- package/lib/utils/VersioningStrategy.d.ts +27 -2
- package/lib/utils/VersioningStrategy.js +30 -9
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/lib/validators/TextPlainValidator.d.ts +19 -0
- package/lib/validators/TextPlainValidator.js +19 -0
- package/lib/validators/TextPlainValidator.js.map +1 -1
- package/native/go.mod +1 -1
- package/native/go.sum +2 -2
- package/native/sdk/register.go +12 -2
- package/native/sdk/sdk_metadata_json.go +6 -1
- package/native/sdk/sdk_transform.go +393 -403
- package/package.json +9 -7
- package/src/INestiaConfig.ts +55 -24
- package/src/NestiaSdkApplication.ts +66 -7
- package/src/NestiaSwaggerComposer.ts +21 -6
- package/src/analyses/AccessorAnalyzer.ts +26 -0
- package/src/analyses/ConfigAnalyzer.ts +59 -96
- package/src/analyses/ImportAnalyzer.ts +25 -0
- package/src/analyses/ParameterNameAnalyzer.ts +24 -0
- package/src/analyses/PathAnalyzer.ts +63 -11
- package/src/analyses/ReflectControllerAnalyzer.ts +32 -0
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +32 -10
- package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +32 -0
- package/src/analyses/ReflectMcpOperationAnalyzer.ts +32 -1
- package/src/analyses/ReflectMetadataAnalyzer.ts +48 -1
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +34 -14
- package/src/analyses/SecurityAnalyzer.ts +15 -0
- package/src/analyses/SwaggerExampleAnalyzer.ts +16 -0
- package/src/analyses/TypedHttpRouteAnalyzer.ts +240 -184
- package/src/analyses/TypedMcpRouteAnalyzer.ts +180 -20
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +19 -0
- package/src/decorators/OperationMetadata.ts +6 -0
- package/src/executable/internal/CommandParser.ts +19 -0
- package/src/executable/internal/NestiaConfigLoader.ts +66 -50
- package/src/executable/internal/NestiaSdkCommand.ts +96 -3
- package/src/executable/internal/NestiaSdkWatcher.ts +169 -41
- package/src/executable/internal/NestiaSwaggerWatch.ts +359 -0
- package/src/factories/ExpressionFactory.ts +17 -2
- package/src/factories/IdentifierFactory.ts +24 -0
- package/src/factories/LiteralFactory.ts +44 -11
- package/src/factories/StatementFactory.ts +28 -1
- package/src/factories/TypeFactory.ts +24 -0
- package/src/generates/CloneGenerator.ts +26 -5
- package/src/generates/E2eGenerator.ts +19 -0
- package/src/generates/SdkGenerator.ts +40 -9
- package/src/generates/SwaggerGenerator.ts +56 -14
- package/src/generates/internal/E2eFileProgrammer.ts +20 -0
- package/src/generates/internal/FilePrinter.ts +43 -0
- package/src/generates/internal/ImportDictionary.ts +110 -3
- package/src/generates/internal/SdkAliasCollection.ts +133 -11
- package/src/generates/internal/SdkDistributionComposer.ts +117 -66
- package/src/generates/internal/SdkFileProgrammer.ts +18 -0
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +55 -0
- package/src/generates/internal/SdkHttpCloneReferencer.ts +97 -23
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +19 -0
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +19 -0
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +104 -2
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +20 -0
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +72 -5
- package/src/generates/internal/SdkImportWizard.ts +63 -0
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +38 -18
- package/src/generates/internal/SdkPathTemplate.ts +15 -0
- package/src/generates/internal/SdkRouteDirectory.ts +10 -0
- package/src/generates/internal/SdkTypeProgrammer.ts +118 -14
- package/src/generates/internal/SdkTypeTagProgrammer.ts +37 -7
- package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +185 -142
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +19 -0
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +81 -2
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +18 -0
- package/src/generates/internal/SwaggerDescriptionComposer.ts +47 -1
- package/src/generates/internal/SwaggerOperationComposer.ts +18 -0
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +41 -8
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +19 -0
- package/src/internal/legacy-augmentation.d.ts +16 -0
- package/src/internal/legacy.ts +296 -26
- package/src/structures/INestiaProject.ts +10 -0
- package/src/structures/INestiaSdkInput.ts +31 -1
- package/src/structures/IOperationMetadata.ts +55 -0
- package/src/structures/IReflectController.ts +11 -1
- package/src/structures/IReflectHttpOperation.ts +11 -1
- package/src/structures/IReflectHttpOperationException.ts +10 -0
- package/src/structures/IReflectHttpOperationParameter.ts +47 -0
- package/src/structures/IReflectHttpOperationSuccess.ts +11 -0
- package/src/structures/IReflectImport.ts +10 -0
- package/src/structures/IReflectMcpOperation.ts +19 -0
- package/src/structures/IReflectMcpOperationParameter.ts +9 -0
- package/src/structures/IReflectOperationError.ts +31 -2
- package/src/structures/IReflectType.ts +9 -0
- package/src/structures/IReflectWebSocketOperation.ts +10 -0
- package/src/structures/IReflectWebSocketOperationParameter.ts +55 -0
- package/src/structures/ITypedApplication.ts +10 -0
- package/src/structures/ITypedHttpRoute.ts +10 -0
- package/src/structures/ITypedHttpRouteException.ts +10 -0
- package/src/structures/ITypedHttpRouteParameter.ts +45 -0
- package/src/structures/ITypedHttpRouteSuccess.ts +10 -0
- package/src/structures/ITypedMcpRoute.ts +12 -0
- package/src/structures/ITypedWebSocketRoute.ts +10 -0
- package/src/transform.ts +6 -0
- package/src/utils/ArrayUtil.ts +32 -13
- package/src/utils/EmittedJavaScriptPatcher.ts +70 -47
- package/src/utils/FileRetriever.ts +29 -0
- package/src/utils/HttpResponseContentTypeUtil.ts +41 -0
- package/src/utils/MapUtil.ts +68 -3
- package/src/utils/PathUtil.ts +38 -0
- package/src/utils/SdkBundlePath.ts +11 -0
- package/src/utils/SdkInputFilter.ts +108 -0
- package/src/utils/SourceFinder.ts +51 -14
- package/src/utils/StringUtil.ts +182 -5
- package/src/utils/TemporaryDirectory.ts +108 -0
- package/src/utils/TsConfigReader.ts +124 -26
- package/src/utils/TtscExecutor.ts +23 -1
- package/src/utils/VersioningStrategy.ts +37 -14
- package/src/validators/TextPlainValidator.ts +19 -0
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.d.ts +0 -9
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js +0 -178
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js.map +0 -1
- package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +0 -264
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/sdk",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
4
4
|
"description": "Nestia SDK and Swagger generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -56,16 +56,17 @@
|
|
|
56
56
|
"ttsc": "^0.28.1",
|
|
57
57
|
"tstl": "^3.0.0",
|
|
58
58
|
"typia": "15.0.0",
|
|
59
|
-
"@
|
|
60
|
-
"@nestia/
|
|
59
|
+
"@babel/parser": "^7.29.8",
|
|
60
|
+
"@nestia/core": "^14.0.3",
|
|
61
|
+
"@nestia/fetcher": "^14.0.3"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
|
-
"@nestia/core": "^14.0.
|
|
64
|
+
"@nestia/core": "^14.0.3"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
67
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
67
|
-
"@nestjs/common": "^
|
|
68
|
-
"@nestjs/core": "^
|
|
68
|
+
"@nestjs/common": "^12.1.2",
|
|
69
|
+
"@nestjs/core": "^12.1.2",
|
|
69
70
|
"@types/express": "^4.17.15",
|
|
70
71
|
"@types/node": "^25.3.3",
|
|
71
72
|
"rimraf": "^6.1.3",
|
|
@@ -88,7 +89,8 @@
|
|
|
88
89
|
"scripts": {
|
|
89
90
|
"build": "rimraf lib && ttsc",
|
|
90
91
|
"dev": "ttsc --watch",
|
|
91
|
-
"test:go": "cd test && go test -count=1 ./..."
|
|
92
|
+
"test:go": "cd test && go test -count=1 ./...",
|
|
93
|
+
"evidence": "evidence"
|
|
92
94
|
},
|
|
93
95
|
"types": "lib/index.d.ts"
|
|
94
96
|
}
|
package/src/INestiaConfig.ts
CHANGED
|
@@ -5,6 +5,11 @@ import type { OpenApi } from "typia";
|
|
|
5
5
|
* Definition for the `nestia.config.ts` file.
|
|
6
6
|
*
|
|
7
7
|
* @author Jeongho Nam - https://github.com/samchon
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation The input names the controllers to analyze and every optional property enables or refines one output (SDK, distribution, e2e, Swagger), so one configuration file drives every generator.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record whose nested types describe the input and the Swagger options.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation Every property documents its meaning and default, which are the public contract of the configuration file.
|
|
12
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source inputs and output/distribution/e2e destinations carry native pathname strings interpreted by their owning Node filesystem operations; the application callback bypasses source compilation. Swagger route paths are distinct protocol values, not native file identities.
|
|
8
13
|
*/
|
|
9
14
|
export interface INestiaConfig {
|
|
10
15
|
/**
|
|
@@ -49,11 +54,16 @@ export interface INestiaConfig {
|
|
|
49
54
|
*/
|
|
50
55
|
distribute?: string;
|
|
51
56
|
|
|
52
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Groups HTTP and WebSocket SDK call arguments in one props object after the
|
|
59
|
+
* connection. MCP wrappers retain their client and arguments parameters.
|
|
60
|
+
*
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
53
63
|
keyword?: boolean;
|
|
54
64
|
|
|
55
65
|
/**
|
|
56
|
-
* Allow simulation mode.
|
|
66
|
+
* Allow simulation mode for HTTP SDK calls.
|
|
57
67
|
*
|
|
58
68
|
* If you configure this property to be `true`, the SDK library would be
|
|
59
69
|
* contain simulation mode. In the simulation mode, the SDK library would not
|
|
@@ -72,7 +82,8 @@ export interface INestiaConfig {
|
|
|
72
82
|
*
|
|
73
83
|
* If you configure this property and runs `npx nestia e2e` command,
|
|
74
84
|
* `@nestia/sdk` will analyze your NestJS backend server code, and generates
|
|
75
|
-
* e2e test functions for
|
|
85
|
+
* e2e test functions for the analyzed HTTP endpoints. WebSocket and MCP
|
|
86
|
+
* operations have no generated HTTP test function.
|
|
76
87
|
*
|
|
77
88
|
* If not configured, you can't run `npx nestia e2e` command.
|
|
78
89
|
*/
|
|
@@ -82,10 +93,10 @@ export interface INestiaConfig {
|
|
|
82
93
|
* Whether to use propagation mode or not.
|
|
83
94
|
*
|
|
84
95
|
* If being configured, interaction functions of the SDK library would perform
|
|
85
|
-
*
|
|
86
|
-
* exception even when status code is not 200 (or 201), but just returning the
|
|
96
|
+
* propagation mode. HTTP failure statuses are returned through the
|
|
87
97
|
* {@link IPropagation} typed instance, which can specify its body type through
|
|
88
|
-
* discriminated union determined by status code.
|
|
98
|
+
* discriminated union determined by status code. Transport, decoding and
|
|
99
|
+
* configured assertion failures can still throw.
|
|
89
100
|
*
|
|
90
101
|
* @default false
|
|
91
102
|
*/
|
|
@@ -94,9 +105,10 @@ export interface INestiaConfig {
|
|
|
94
105
|
/**
|
|
95
106
|
* Whether to clone DTO structures or not.
|
|
96
107
|
*
|
|
97
|
-
* If
|
|
98
|
-
*
|
|
99
|
-
*
|
|
108
|
+
* If enabled, named DTOs reachable from analyzed routes are emitted into
|
|
109
|
+
* `structures`, with anonymous forms written inline. HTTP and MCP DTOs use
|
|
110
|
+
* their wire metadata; supported WebSocket declarations are copied from local
|
|
111
|
+
* sources, while external or unsupported imports retain source links.
|
|
100
112
|
*
|
|
101
113
|
* @default false
|
|
102
114
|
*/
|
|
@@ -105,8 +117,10 @@ export interface INestiaConfig {
|
|
|
105
117
|
/**
|
|
106
118
|
* Whether to wrap DTO by primitive type.
|
|
107
119
|
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
120
|
+
* Unless false, source DTO aliases use Primitive for JSON bodies and
|
|
121
|
+
* responses, and Resolved for query, headers and other resolved wire forms.
|
|
122
|
+
* Clone mode writes the analyzed metadata directly; multipart bodies use
|
|
123
|
+
* FormDataInput and binary responses use ReadableStream.
|
|
110
124
|
*
|
|
111
125
|
* For refenrece, if a DTO type be capsuled by the {@link Primitive} type, all
|
|
112
126
|
* of methods in the DTO type would be automatically erased. Also, if the DTO
|
|
@@ -120,9 +134,10 @@ export interface INestiaConfig {
|
|
|
120
134
|
/**
|
|
121
135
|
* Whether to assert parameter types or not.
|
|
122
136
|
*
|
|
123
|
-
* If
|
|
124
|
-
*
|
|
125
|
-
*
|
|
137
|
+
* If true, HTTP path, query and body arguments are checked through
|
|
138
|
+
* [`typia.assert<T>()` function](https://typia.io/docs/validators/assert/).
|
|
139
|
+
* The connection, connection headers, WebSocket and MCP arguments are outside
|
|
140
|
+
* this option.
|
|
126
141
|
*
|
|
127
142
|
* This option would make your SDK library compilation time a little bit
|
|
128
143
|
* slower, but would enahcne the type safety even in the runtime level.
|
|
@@ -132,16 +147,13 @@ export interface INestiaConfig {
|
|
|
132
147
|
assert?: boolean;
|
|
133
148
|
|
|
134
149
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* If you configure this property to be `true`, the SDK library would utilize
|
|
138
|
-
* the [`typia.assertStringify<T>()
|
|
139
|
-
* function`](https://github.com/samchon/typia#enhanced-json) to boost up JSON
|
|
140
|
-
* serialization speed and ensure type safety.
|
|
150
|
+
* Generates specialized JSON serialization for JSON and encrypted request
|
|
151
|
+
* bodies.
|
|
141
152
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
153
|
+
* When enabled, the SDK emits a `typia.json.assertStringify` function for the
|
|
154
|
+
* body type. With `assert` enabled, argument validation runs separately and
|
|
155
|
+
* serialization uses `typia.json.stringify` without repeating the assertion.
|
|
156
|
+
* Compilation and runtime costs depend on the body type and workload.
|
|
145
157
|
*
|
|
146
158
|
* @default false
|
|
147
159
|
*/
|
|
@@ -151,6 +163,12 @@ export namespace INestiaConfig {
|
|
|
151
163
|
/**
|
|
152
164
|
* List of files or directories to include or exclude to specifying the NestJS
|
|
153
165
|
* controllers.
|
|
166
|
+
*
|
|
167
|
+
* @evidence contracts/common.md#principled-implementation Include lists select controller files or directories and exclude lists remove files from that selection.
|
|
168
|
+
* @evidence contracts/common.md#clear-and-simple-design A two-member record.
|
|
169
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
170
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the type describes and the meaning of its members.
|
|
171
|
+
* @evidence contracts/portability.md#os-neutral-implementation Include and exclude strings represent native files, directories or glob patterns. SourceFinder owns resolving them against the current working directory and distinguishing literal existing paths from wildcard suffixes.
|
|
154
172
|
*/
|
|
155
173
|
export interface IInput {
|
|
156
174
|
/** List of files or directories containing the NestJS controller classes. */
|
|
@@ -160,7 +178,15 @@ export namespace INestiaConfig {
|
|
|
160
178
|
exclude?: string[];
|
|
161
179
|
}
|
|
162
180
|
|
|
163
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Building `swagger.json` is also possible.
|
|
183
|
+
*
|
|
184
|
+
* @evidence contracts/common.md#principled-implementation The output path is required and every other option refines the composed OpenAPI document before it is written.
|
|
185
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record of options with one callback.
|
|
186
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
187
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the type describes and the meaning of its members.
|
|
188
|
+
* @evidence contracts/portability.md#os-neutral-implementation output is a native destination interpreted by path.parse/resolve in SwaggerGenerator; a nonempty extension denotes a file and otherwise the destination is a directory. Server URLs and operation paths retain protocol spelling independently of that filesystem boundary.
|
|
189
|
+
*/
|
|
164
190
|
export interface ISwaggerConfig {
|
|
165
191
|
/**
|
|
166
192
|
* Response path of the `swagger.json`.
|
|
@@ -265,6 +291,11 @@ export namespace INestiaConfig {
|
|
|
265
291
|
*
|
|
266
292
|
* @param props Properties of the API endpoint.
|
|
267
293
|
* @returns Operation ID.
|
|
294
|
+
* @evidence contracts/common.md#principled-implementation An explicit @operationId tag takes precedence; otherwise this callback receives the four identifying facts once for the composed operation and supplies its identifier.
|
|
295
|
+
* @evidence contracts/common.md#clear-and-simple-design One optional callback with a single argument object.
|
|
296
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a caller-supplied function and nothing about a particular naming scheme is built in.
|
|
297
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents the arguments and the result.
|
|
298
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This callback receives HTTP endpoint identity and returns an OpenAPI identifier; it owns no native pathname or process boundary.
|
|
268
299
|
*/
|
|
269
300
|
operationId?(props: {
|
|
270
301
|
class: string;
|
|
@@ -25,9 +25,34 @@ import { ITypedWebSocketRoute } from "./structures/ITypedWebSocketRoute";
|
|
|
25
25
|
import { StringUtil } from "./utils/StringUtil";
|
|
26
26
|
import { VersioningStrategy } from "./utils/VersioningStrategy";
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Runs the generators of `@nestia/sdk` over one configuration.
|
|
30
|
+
*
|
|
31
|
+
* Each method validates the configuration for the output it needs, analyzes the
|
|
32
|
+
* controllers and the TypeScript metadata, reports every error at once, and
|
|
33
|
+
* then generates.
|
|
34
|
+
*
|
|
35
|
+
* @evidence contracts/common.md#principled-implementation The shared pipeline reflects controllers, types routes from transform metadata, assigns accessors and rejects collected analysis errors before writing. SDK-specific representability checks are attached by sdk and SDK-producing all; e2e currently invokes the SDK writer without that additional validation callback.
|
|
36
|
+
* @evidence contracts/common.md#clear-and-simple-design One class with four public generators over one private pipeline; directory assertion, title, and error report are module-private helpers.
|
|
37
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No controller or route name is special-cased; the same pipeline serves the CLI and programmatic callers.
|
|
38
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the four generators and that the errors of an analysis are reported together.
|
|
39
|
+
* @evidence contracts/portability.md#os-neutral-implementation Output checks and diagnostic locations use Node fs.stat and path operations; controller compilation and output writes remain owned by ConfigAnalyzer and the generators. Filesystem errors distinguish missing/non-directory locations from other native failures.
|
|
40
|
+
*/
|
|
28
41
|
export class NestiaSdkApplication {
|
|
29
42
|
public constructor(private readonly config: INestiaConfig) {}
|
|
30
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Generates everything the configuration asks for: the SDK and its e2e tests
|
|
46
|
+
* when `output` is set, and the Swagger document when `swagger` is set.
|
|
47
|
+
*
|
|
48
|
+
* It throws when neither `output` nor `swagger.output` is configured.
|
|
49
|
+
*
|
|
50
|
+
* @evidence contracts/common.md#principled-implementation The SDK validation is attached only when an SDK is generated, so a Swagger-only run does not fail on SDK rules, and the e2e tests are generated after the SDK they import.
|
|
51
|
+
* @evidence contracts/common.md#clear-and-simple-design One method that composes the generators inside the shared pipeline.
|
|
52
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The error names the properties a caller can configure; none is stale.
|
|
53
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what is generated and the failure.
|
|
54
|
+
* @evidence contracts/portability.md#os-neutral-implementation all delegates configured output creation to the native writers and does not apply the explicit parent-directory checks used by sdk/e2e/swagger. Diagnostic source paths are rendered relative to the current native working directory.
|
|
55
|
+
*/
|
|
31
56
|
public async all(): Promise<void> {
|
|
32
57
|
if (!this.config.output && !this.config.swagger?.output)
|
|
33
58
|
throw new Error(
|
|
@@ -36,7 +61,6 @@ export class NestiaSdkApplication {
|
|
|
36
61
|
"",
|
|
37
62
|
" - INestiaConfig.output",
|
|
38
63
|
" - INestiaConfig.swagger.output",
|
|
39
|
-
" - INestiaConfig.openai.output",
|
|
40
64
|
].join("\n"),
|
|
41
65
|
);
|
|
42
66
|
print_title("Nestia All Generator");
|
|
@@ -52,6 +76,18 @@ export class NestiaSdkApplication {
|
|
|
52
76
|
});
|
|
53
77
|
}
|
|
54
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Generates the SDK and the automatic e2e test functions.
|
|
81
|
+
*
|
|
82
|
+
* It throws when `output` or `e2e` is missing, or when the parent directory
|
|
83
|
+
* of either does not exist.
|
|
84
|
+
*
|
|
85
|
+
* @evidence contracts/common.md#principled-implementation The e2e functions import the generated SDK, so the SDK is generated first, and both parent directories are asserted before any analysis runs.
|
|
86
|
+
* @evidence contracts/common.md#clear-and-simple-design One method over the shared pipeline.
|
|
87
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The directory check follows the configuration and no path is special-cased.
|
|
88
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the requirements and the failures.
|
|
89
|
+
* @evidence contracts/portability.md#os-neutral-implementation path.resolve obtains each native parent and fs.stat follows symlinks to verify a directory before analysis. ENOENT/ENOTDIR become configuration diagnostics; permission and other filesystem errors propagate without a platform-specific shell fallback.
|
|
90
|
+
*/
|
|
55
91
|
public async e2e(): Promise<void> {
|
|
56
92
|
if (!this.config.output)
|
|
57
93
|
throw new Error(
|
|
@@ -84,6 +120,17 @@ export class NestiaSdkApplication {
|
|
|
84
120
|
});
|
|
85
121
|
}
|
|
86
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Generates the SDK library.
|
|
125
|
+
*
|
|
126
|
+
* It throws when `output` is missing or its parent directory does not exist.
|
|
127
|
+
*
|
|
128
|
+
* @evidence contracts/common.md#principled-implementation The SDK validation runs after route typing and before the generator, so a route the SDK cannot express is reported instead of written.
|
|
129
|
+
* @evidence contracts/common.md#clear-and-simple-design One method over the shared pipeline.
|
|
130
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The directory check follows the configuration.
|
|
131
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the requirement and the failures.
|
|
132
|
+
* @evidence contracts/portability.md#os-neutral-implementation The configured output parent is resolved through Node path and verified by fs.stat, including linked directories. Generator writes use their own native boundaries; this entry does not infer case identity from an OS name.
|
|
133
|
+
*/
|
|
87
134
|
public async sdk(): Promise<void> {
|
|
88
135
|
if (!this.config.output)
|
|
89
136
|
throw new Error(
|
|
@@ -104,6 +151,18 @@ export class NestiaSdkApplication {
|
|
|
104
151
|
});
|
|
105
152
|
}
|
|
106
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Generates the Swagger document.
|
|
156
|
+
*
|
|
157
|
+
* It throws when `swagger.output` is missing or the directory that will hold
|
|
158
|
+
* the document does not exist; the output may be a file or a directory.
|
|
159
|
+
*
|
|
160
|
+
* @evidence contracts/common.md#principled-implementation The directory to check is the parent of a file path with an extension and the path itself otherwise, which is how the generator decides where to write.
|
|
161
|
+
* @evidence contracts/common.md#clear-and-simple-design One method over the shared pipeline.
|
|
162
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rule is the generator's own output rule.
|
|
163
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the requirement and the two output forms.
|
|
164
|
+
* @evidence contracts/portability.md#os-neutral-implementation path.parse/resolve decide the native containing directory from whether the output has an extension, matching SwaggerGenerator's destination rule. The common directory check distinguishes missing paths from non-directory entries and propagates other filesystem errors.
|
|
165
|
+
*/
|
|
107
166
|
public async swagger(): Promise<void> {
|
|
108
167
|
if (!this.config.swagger?.output)
|
|
109
168
|
throw new Error(
|
|
@@ -198,10 +257,6 @@ export class NestiaSdkApplication {
|
|
|
198
257
|
//----
|
|
199
258
|
console.log("Analyzing source codes");
|
|
200
259
|
|
|
201
|
-
// METADATA COMPONENTS
|
|
202
|
-
const sourceCollection: IMetadataDictionary =
|
|
203
|
-
TypedHttpRouteAnalyzer.dictionary(controllers);
|
|
204
|
-
|
|
205
260
|
// CONVERT TO TYPED OPERATIONS
|
|
206
261
|
const routes: Array<
|
|
207
262
|
ITypedHttpRoute | ITypedWebSocketRoute | ITypedMcpRoute
|
|
@@ -213,6 +268,8 @@ export class NestiaSdkApplication {
|
|
|
213
268
|
...TypedMcpRouteAnalyzer.analyze({
|
|
214
269
|
controller: c,
|
|
215
270
|
operation: o,
|
|
271
|
+
clone: project.config.clone,
|
|
272
|
+
errors: project.errors,
|
|
216
273
|
}),
|
|
217
274
|
);
|
|
218
275
|
continue;
|
|
@@ -246,7 +303,6 @@ export class NestiaSdkApplication {
|
|
|
246
303
|
...TypedHttpRouteAnalyzer.analyze({
|
|
247
304
|
controller: c,
|
|
248
305
|
errors: project.errors,
|
|
249
|
-
dictionary: sourceCollection,
|
|
250
306
|
operation: o,
|
|
251
307
|
paths: Array.from(pathList),
|
|
252
308
|
}),
|
|
@@ -264,7 +320,10 @@ export class NestiaSdkApplication {
|
|
|
264
320
|
|
|
265
321
|
const collection: IMetadataDictionary =
|
|
266
322
|
TypedHttpRouteAnalyzer.routeDictionary(
|
|
267
|
-
routes.filter(
|
|
323
|
+
routes.filter(
|
|
324
|
+
(r): r is ITypedHttpRoute | ITypedMcpRoute =>
|
|
325
|
+
r.protocol !== "websocket",
|
|
326
|
+
),
|
|
268
327
|
);
|
|
269
328
|
|
|
270
329
|
if (props.validate !== undefined)
|
|
@@ -12,7 +12,6 @@ import { PathAnalyzer } from "./analyses/PathAnalyzer";
|
|
|
12
12
|
import { ReflectControllerAnalyzer } from "./analyses/ReflectControllerAnalyzer";
|
|
13
13
|
import { TypedHttpRouteAnalyzer } from "./analyses/TypedHttpRouteAnalyzer";
|
|
14
14
|
import { SwaggerGenerator } from "./generates/SwaggerGenerator";
|
|
15
|
-
import { IMetadataDictionary } from "./internal/legacy";
|
|
16
15
|
import { INestiaProject } from "./structures/INestiaProject";
|
|
17
16
|
import { INestiaSdkInput } from "./structures/INestiaSdkInput";
|
|
18
17
|
import { IOperationMetadata } from "./structures/IOperationMetadata";
|
|
@@ -21,7 +20,28 @@ import { IReflectOperationError } from "./structures/IReflectOperationError";
|
|
|
21
20
|
import { ITypedHttpRoute } from "./structures/ITypedHttpRoute";
|
|
22
21
|
import { VersioningStrategy } from "./utils/VersioningStrategy";
|
|
23
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Composes the Swagger document of a running NestJS application, without files.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation The controllers are taken from the application's module graph and analyzed like the CLI does, and only the HTTP routes are composed.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function with a private analysis pipeline.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It uses the same analyzers and composer as the CLI, so both produce one document.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
30
|
+
* @evidence contracts/portability.md#os-neutral-implementation Controller source lookup is delegated to ConfigAnalyzer.application; diagnostic filenames use Node path.relative from process.cwd. Route paths and versions remain protocol text rather than native filesystem identity.
|
|
31
|
+
*/
|
|
24
32
|
export namespace NestiaSwaggerComposer {
|
|
33
|
+
/**
|
|
34
|
+
* Returns the OpenAPI document of the application in the requested version.
|
|
35
|
+
*
|
|
36
|
+
* The document is composed as OpenAPI 3.2 and converted to the configured
|
|
37
|
+
* older version; every analysis error is collected and thrown together.
|
|
38
|
+
*
|
|
39
|
+
* @evidence contracts/common.md#principled-implementation Composition runs at the newest version and `OpenApiConverter.downgradeDocument` produces the older ones, so version differences live in one converter, and a failure of the analysis throws one error that lists every problem.
|
|
40
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over the shared analyzers and the Swagger generator.
|
|
41
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No route is special-cased; the module graph is read through `ConfigAnalyzer.application`.
|
|
42
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the returned versions and the error behavior.
|
|
43
|
+
* @evidence contracts/portability.md#os-neutral-implementation The composer receives an existing application and writes no output file. Its delegated controller discovery obtains native source locations, and its report renders those locations through path.relative; initialize may read package metadata for default info.
|
|
44
|
+
*/
|
|
25
45
|
export const document = async (
|
|
26
46
|
app: INestApplication,
|
|
27
47
|
config: Omit<INestiaConfig.ISwaggerConfig, "output">,
|
|
@@ -58,10 +78,6 @@ export namespace NestiaSwaggerComposer {
|
|
|
58
78
|
if (project.errors.length)
|
|
59
79
|
throw report({ type: "error", errors: project.errors });
|
|
60
80
|
|
|
61
|
-
// METADATA COMPONENTS
|
|
62
|
-
const collection: IMetadataDictionary =
|
|
63
|
-
TypedHttpRouteAnalyzer.dictionary(controllers);
|
|
64
|
-
|
|
65
81
|
// CONVERT TO TYPED OPERATIONS
|
|
66
82
|
const routes: ITypedHttpRoute[] = [];
|
|
67
83
|
for (const c of controllers)
|
|
@@ -95,7 +111,6 @@ export namespace NestiaSwaggerComposer {
|
|
|
95
111
|
...TypedHttpRouteAnalyzer.analyze({
|
|
96
112
|
controller: c,
|
|
97
113
|
errors: project.errors,
|
|
98
|
-
dictionary: collection,
|
|
99
114
|
operation: o,
|
|
100
115
|
paths: Array.from(pathList),
|
|
101
116
|
}),
|
|
@@ -6,7 +6,33 @@ import { ITypedWebSocketRoute } from "../structures/ITypedWebSocketRoute";
|
|
|
6
6
|
|
|
7
7
|
type AnyRoute = ITypedHttpRoute | ITypedWebSocketRoute | ITypedMcpRoute;
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Assigns each route the accessor path under which the generated SDK exposes
|
|
11
|
+
* it.
|
|
12
|
+
*
|
|
13
|
+
* @evidence contracts/common.md#principled-implementation The accessors are shrunk where a name repeats, escaped into valid unique identifiers, shrunk again, and each route is renamed to its last accessor segment.
|
|
14
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function over three private passes.
|
|
15
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The passes follow the accessor structure and no route or controller name is special-cased.
|
|
16
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
17
|
+
* efficient algorithms: For R routes of at most D accessor segments, the prefix maps avoid repeated route-to-route searches. Prefix slicing and joining costs O(R D²) character work before collision escapes; collisions add probes and longer names. Two shrink passes are required around escaping because escaping changes the names being shrunk.
|
|
18
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
19
|
+
* bound retention and release resources: This operation owns only invocation-local values, with no retained cache, handle or background task.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation AccessorAnalyzer analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
21
|
+
*/
|
|
9
22
|
export namespace AccessorAnalyzer {
|
|
23
|
+
/**
|
|
24
|
+
* Rewrites the accessor of every route in place so that accessors are valid,
|
|
25
|
+
* unique, and as short as they can be.
|
|
26
|
+
*
|
|
27
|
+
* @evidence contracts/common.md#principled-implementation Segments that repeat their parent are removed when no sibling shares the parent, non-identifier characters become underscores, a segment that collides with an existing accessor gets an underscore prefix, and the route name becomes the last segment.
|
|
28
|
+
* @evidence contracts/common.md#clear-and-simple-design One function that runs the passes in a fixed order.
|
|
29
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rules apply to every route, and reserved names are computed from the routes themselves.
|
|
30
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the passes and the in-place rewrite.
|
|
31
|
+
* efficient algorithms: For R routes of at most D accessor segments, the prefix maps avoid repeated route-to-route searches. Prefix slicing and joining costs O(R D²) character work before collision escapes; collisions add probes and longer names. Two shrink passes are required around escaping because escaping changes the names being shrunk.
|
|
32
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
33
|
+
* bound retention and release resources: This operation owns only invocation-local values, with no retained cache, handle or background task.
|
|
34
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation AccessorAnalyzer.analyze analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
35
|
+
*/
|
|
10
36
|
export const analyze = (routes: Array<AnyRoute>) => {
|
|
11
37
|
shrink(routes);
|
|
12
38
|
variable(routes);
|