@nestia/sdk 14.0.0 → 14.0.2
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/README.md +1 -1
- package/assets/bundle/distribute/build-sdk.cjs +28 -0
- package/assets/bundle/distribute/package.json +7 -3
- package/assets/bundle/distribute/tsconfig.json +15 -105
- package/lib/INestiaConfig.d.ts +74 -34
- package/lib/NestiaSdkApplication.d.ts +60 -0
- package/lib/NestiaSdkApplication.js +121 -32
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/NestiaSwaggerComposer.d.ts +21 -0
- package/lib/NestiaSwaggerComposer.js +32 -13
- 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 +52 -77
- 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 +44 -0
- package/lib/analyses/ParameterNameAnalyzer.js +63 -0
- package/lib/analyses/ParameterNameAnalyzer.js.map +1 -0
- package/lib/analyses/PathAnalyzer.d.ts +93 -1
- package/lib/analyses/PathAnalyzer.js +160 -23
- package/lib/analyses/PathAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectControllerAnalyzer.js +24 -1
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +35 -24
- 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 +143 -23
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +27 -2
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectMcpOperationAnalyzer.js +35 -11
- 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 +27 -5
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/SecurityAnalyzer.d.ts +25 -0
- package/lib/analyses/SecurityAnalyzer.js +39 -19
- package/lib/analyses/SecurityAnalyzer.js.map +1 -1
- package/lib/analyses/SwaggerExampleAnalyzer.d.ts +31 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js +36 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js.map +1 -0
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +41 -3
- package/lib/analyses/TypedHttpRouteAnalyzer.js +196 -172
- 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 +20 -1
- 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 +125 -41
- 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/executable/sdk.js +16 -1
- package/lib/executable/sdk.js.map +1 -1
- package/lib/factories/ExpressionFactory.d.ts +18 -0
- package/lib/factories/ExpressionFactory.js +21 -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 +33 -11
- 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 +43 -5
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts +36 -6
- package/lib/generates/SwaggerGenerator.js +190 -40
- 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 +57 -0
- package/lib/generates/internal/FilePrinter.js +74 -0
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +93 -1
- package/lib/generates/internal/ImportDictionary.js +103 -2
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +121 -1
- package/lib/generates/internal/SdkAliasCollection.js +132 -11
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +19 -0
- package/lib/generates/internal/SdkDistributionComposer.js +149 -52
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js +101 -12
- 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 +40 -23
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +46 -34
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +142 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +175 -6
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +36 -32
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +38 -0
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +66 -18
- 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 +72 -24
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkPathTemplate.d.ts +36 -0
- package/lib/generates/internal/SdkPathTemplate.js +65 -0
- package/lib/generates/internal/SdkPathTemplate.js.map +1 -0
- 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 +111 -27
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +53 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.js +407 -67
- 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 +46 -36
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +114 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +120 -5
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +75 -33
- 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 +37 -8
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +40 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +230 -25
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +21 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +58 -7
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
- package/lib/internal/legacy.d.ts +342 -31
- package/lib/internal/legacy.js +207 -31
- package/lib/internal/legacy.js.map +1 -1
- package/lib/structures/INestiaProject.d.ts +10 -0
- package/lib/structures/INestiaSdkInput.d.ts +30 -0
- package/lib/structures/IOperationMetadata.d.ts +77 -0
- package/lib/structures/IReflectController.d.ts +10 -0
- package/lib/structures/IReflectHttpOperation.d.ts +10 -0
- package/lib/structures/IReflectHttpOperationException.d.ts +13 -2
- package/lib/structures/IReflectHttpOperationParameter.d.ts +55 -3
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +15 -3
- 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 +18 -0
- package/lib/structures/ITypedHttpRouteException.d.ts +13 -1
- package/lib/structures/ITypedHttpRouteParameter.d.ts +48 -1
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +13 -1
- package/lib/structures/ITypedMcpRoute.d.ts +11 -0
- package/lib/structures/ITypedWebSocketRoute.d.ts +18 -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 +45 -0
- package/lib/utils/SourceFinder.js +74 -16
- 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 +39 -2
- package/lib/utils/VersioningStrategy.js +46 -13
- 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_http_rules.go +210 -0
- package/native/sdk/sdk_metadata_json.go +79 -4
- package/native/sdk/sdk_transform.go +1157 -414
- package/package.json +8 -6
- package/src/INestiaConfig.ts +74 -34
- package/src/NestiaSdkApplication.ts +129 -41
- package/src/NestiaSwaggerComposer.ts +32 -14
- package/src/analyses/AccessorAnalyzer.ts +26 -0
- package/src/analyses/ConfigAnalyzer.ts +52 -90
- package/src/analyses/ImportAnalyzer.ts +25 -0
- package/src/analyses/ParameterNameAnalyzer.ts +75 -0
- package/src/analyses/PathAnalyzer.ts +167 -23
- package/src/analyses/ReflectControllerAnalyzer.ts +34 -1
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +36 -14
- package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +153 -39
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +38 -7
- package/src/analyses/ReflectMcpOperationAnalyzer.ts +38 -3
- package/src/analyses/ReflectMetadataAnalyzer.ts +47 -0
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +40 -7
- package/src/analyses/SecurityAnalyzer.ts +45 -20
- package/src/analyses/SwaggerExampleAnalyzer.ts +39 -0
- package/src/analyses/TypedHttpRouteAnalyzer.ts +263 -198
- package/src/analyses/TypedMcpRouteAnalyzer.ts +180 -20
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +20 -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 +172 -44
- package/src/executable/internal/NestiaSwaggerWatch.ts +359 -0
- package/src/executable/sdk.ts +24 -1
- package/src/factories/ExpressionFactory.ts +23 -2
- package/src/factories/IdentifierFactory.ts +24 -0
- package/src/factories/LiteralFactory.ts +51 -13
- 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 +43 -12
- package/src/generates/SwaggerGenerator.ts +229 -46
- package/src/generates/internal/E2eFileProgrammer.ts +20 -0
- package/src/generates/internal/FilePrinter.ts +71 -0
- package/src/generates/internal/ImportDictionary.ts +120 -2
- package/src/generates/internal/SdkAliasCollection.ts +144 -15
- package/src/generates/internal/SdkDistributionComposer.ts +181 -56
- package/src/generates/internal/SdkFileProgrammer.ts +126 -16
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +55 -0
- package/src/generates/internal/SdkHttpCloneReferencer.ts +97 -23
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +47 -30
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +53 -64
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +295 -13
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +37 -31
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +122 -18
- package/src/generates/internal/SdkImportWizard.ts +63 -0
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +150 -33
- package/src/generates/internal/SdkPathTemplate.ts +88 -0
- package/src/generates/internal/SdkRouteDirectory.ts +10 -0
- package/src/generates/internal/SdkTypeProgrammer.ts +137 -36
- package/src/generates/internal/SdkTypeTagProgrammer.ts +536 -78
- package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +185 -142
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +62 -68
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +205 -5
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +89 -48
- package/src/generates/internal/SwaggerDescriptionComposer.ts +47 -1
- package/src/generates/internal/SwaggerOperationComposer.ts +38 -6
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +318 -36
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +74 -11
- package/src/internal/legacy-augmentation.d.ts +16 -0
- package/src/internal/legacy.ts +407 -49
- package/src/structures/INestiaProject.ts +10 -0
- package/src/structures/INestiaSdkInput.ts +30 -0
- package/src/structures/IOperationMetadata.ts +83 -0
- package/src/structures/IReflectController.ts +10 -0
- package/src/structures/IReflectHttpOperation.ts +10 -0
- package/src/structures/IReflectHttpOperationException.ts +17 -2
- package/src/structures/IReflectHttpOperationParameter.ts +56 -2
- package/src/structures/IReflectHttpOperationSuccess.ts +19 -3
- 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 +18 -0
- package/src/structures/ITypedHttpRouteException.ts +14 -1
- package/src/structures/ITypedHttpRouteParameter.ts +48 -1
- package/src/structures/ITypedHttpRouteSuccess.ts +14 -1
- package/src/structures/ITypedMcpRoute.ts +12 -0
- package/src/structures/ITypedWebSocketRoute.ts +18 -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 +76 -18
- 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 +51 -16
- 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/lib/validators/HttpHeadersValidator.d.ts +0 -11
- package/lib/validators/HttpHeadersValidator.js +0 -15
- package/lib/validators/HttpHeadersValidator.js.map +0 -1
- package/lib/validators/HttpQueryValidator.d.ts +0 -10
- package/lib/validators/HttpQueryValidator.js +0 -14
- package/lib/validators/HttpQueryValidator.js.map +0 -1
- package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +0 -264
- package/src/validators/HttpHeadersValidator.ts +0 -12
- package/src/validators/HttpQueryValidator.ts +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReflectMcpOperationAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ReflectMcpOperationAnalyzer.ts"],"names":[],"mappings":";;;AAAA,wDAA0E;AAQ1E,qDAAkD;
|
|
1
|
+
{"version":3,"file":"ReflectMcpOperationAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ReflectMcpOperationAnalyzer.ts"],"names":[],"mappings":";;;AAAA,wDAA0E;AAQ1E,qDAAkD;AAClD,mEAAgE;AAEhE;;;;;;;;GAQG;AACH,IAAiB,2BAA2B,CA0I3C;AA1ID,WAAiB,2BAA2B;IAmB1C;;;;;;;;;OASG;IACU,mCAAO,GAAG,CAAC,GAAW,EAA+B,EAAE;;;QAClE,MAAM,KAAK,GASK,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrE,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QAErC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B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GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI;gBAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI;gBAC3B,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,QAAQ,EAAE,KAAK,CAAC,IAAI;YACpB,KAAK,QAAE,KAAK,CAAC,KAAK,mCAAI,IAAI;YAC1B,eAAe,QAAE,KAAK,CAAC,WAAW,mCAAI,IAAI;YAC1C,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,YAAY,QAAE,KAAK,CAAC,YAAY,mCAAI,IAAI;YACxC,WAAW,QAAE,KAAK,CAAC,WAAW,mCAAI,IAAI;YACtC,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,UAAU;YACV,UAAU,QAAE,MAAA,GAAG,CAAC,QAAQ,CAAC,OAAO,0CAAE,IAAI,mCAAI,IAAI;YAC9C,cAAc,EAAE,MAAA,GAAG,CAAC,QAAQ,CAAC,OAAO,0CAAE,SAAS;YAC/C,OAAO,EAAE,+BAAc,CAAC,KAAK,CAAC,OAAO,CAAC;YACtC,WAAW,QAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,mCAAI,IAAI;YAC7C,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS;SAClC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA1IgB,2BAA2B,aAA3B,2BAA2B,GAA3B,2BAA2B,QA0I3C"}
|
|
@@ -1,7 +1,54 @@
|
|
|
1
1
|
import { VERSION_NEUTRAL } from "@nestjs/common";
|
|
2
|
+
/**
|
|
3
|
+
* Reads the NestJS and Swagger metadata of a class or method.
|
|
4
|
+
*
|
|
5
|
+
* @evidence contracts/common.md#principled-implementation The functions read the reflect metadata keys that Nest and `@nestjs/swagger` define and normalize them into arrays.
|
|
6
|
+
* @evidence contracts/common.md#clear-and-simple-design Four small readers.
|
|
7
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts They read only public metadata keys.
|
|
8
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
9
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer 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.
|
|
10
|
+
*/
|
|
2
11
|
export declare namespace ReflectMetadataAnalyzer {
|
|
12
|
+
/**
|
|
13
|
+
* Returns the path list of a controller or route: a string is a one-element
|
|
14
|
+
* list and an empty list is one empty path.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation Nest stores a path as a string or an array, and an empty array means the root path, so the result is never empty.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It normalizes without changing paths.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the normalization.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.paths 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
|
+
*/
|
|
3
22
|
const paths: (target: Function) => string[];
|
|
23
|
+
/**
|
|
24
|
+
* Returns the `@ApiExtension` values of a target.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation The metadata is returned as recorded, and an absent value is an empty object.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design One read.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the Swagger metadata key.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
30
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.extensions 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.
|
|
31
|
+
*/
|
|
4
32
|
const extensions: (value: any) => Record<string, any>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the deduplicated security requirements of a target.
|
|
35
|
+
*
|
|
36
|
+
* @evidence contracts/common.md#principled-implementation The `@ApiSecurity` metadata is merged by `SecurityAnalyzer.merge`, and an absent value is an empty list.
|
|
37
|
+
* @evidence contracts/common.md#clear-and-simple-design One read and one merge.
|
|
38
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the Swagger metadata key.
|
|
39
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
40
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.securities 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.
|
|
41
|
+
*/
|
|
5
42
|
const securities: (value: any) => Record<string, string[]>[];
|
|
43
|
+
/**
|
|
44
|
+
* Returns the version list of a target, or `undefined` when it is
|
|
45
|
+
* unversioned.
|
|
46
|
+
*
|
|
47
|
+
* @evidence contracts/common.md#principled-implementation A single version becomes a one-element list, and an absent value stays absent so callers can tell unversioned from versioned.
|
|
48
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
49
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads Nest's version metadata.
|
|
50
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the three cases.
|
|
51
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.versions 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.
|
|
52
|
+
*/
|
|
6
53
|
const versions: (target: any) => Array<string | typeof VERSION_NEUTRAL> | undefined;
|
|
7
54
|
}
|
|
@@ -3,8 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ReflectMetadataAnalyzer = void 0;
|
|
4
4
|
const constants_1 = require("@nestjs/common/constants");
|
|
5
5
|
const SecurityAnalyzer_1 = require("./SecurityAnalyzer");
|
|
6
|
+
/**
|
|
7
|
+
* Reads the NestJS and Swagger metadata of a class or method.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/common.md#principled-implementation The functions read the reflect metadata keys that Nest and `@nestjs/swagger` define and normalize them into arrays.
|
|
10
|
+
* @evidence contracts/common.md#clear-and-simple-design Four small readers.
|
|
11
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts They read only public metadata keys.
|
|
12
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
13
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer 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.
|
|
14
|
+
*/
|
|
6
15
|
var ReflectMetadataAnalyzer;
|
|
7
16
|
(function (ReflectMetadataAnalyzer) {
|
|
17
|
+
/**
|
|
18
|
+
* Returns the path list of a controller or route: a string is a one-element
|
|
19
|
+
* list and an empty list is one empty path.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/common.md#principled-implementation Nest stores a path as a string or an array, and an empty array means the root path, so the result is never empty.
|
|
22
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
23
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It normalizes without changing paths.
|
|
24
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the normalization.
|
|
25
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.paths 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.
|
|
26
|
+
*/
|
|
8
27
|
ReflectMetadataAnalyzer.paths = (target) => {
|
|
9
28
|
const value = Reflect.getMetadata(constants_1.PATH_METADATA, target);
|
|
10
29
|
if (typeof value === "string")
|
|
@@ -14,14 +33,42 @@ var ReflectMetadataAnalyzer;
|
|
|
14
33
|
else
|
|
15
34
|
return value;
|
|
16
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Returns the `@ApiExtension` values of a target.
|
|
38
|
+
*
|
|
39
|
+
* @evidence contracts/common.md#principled-implementation The metadata is returned as recorded, and an absent value is an empty object.
|
|
40
|
+
* @evidence contracts/common.md#clear-and-simple-design One read.
|
|
41
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the Swagger metadata key.
|
|
42
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
43
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.extensions 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.
|
|
44
|
+
*/
|
|
17
45
|
ReflectMetadataAnalyzer.extensions = (value) => {
|
|
18
46
|
const entire = Reflect.getMetadata("swagger/apiExtension", value);
|
|
19
47
|
return entire !== null && entire !== void 0 ? entire : {};
|
|
20
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Returns the deduplicated security requirements of a target.
|
|
51
|
+
*
|
|
52
|
+
* @evidence contracts/common.md#principled-implementation The `@ApiSecurity` metadata is merged by `SecurityAnalyzer.merge`, and an absent value is an empty list.
|
|
53
|
+
* @evidence contracts/common.md#clear-and-simple-design One read and one merge.
|
|
54
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the Swagger metadata key.
|
|
55
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
56
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.securities 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.
|
|
57
|
+
*/
|
|
21
58
|
ReflectMetadataAnalyzer.securities = (value) => {
|
|
22
59
|
const entire = Reflect.getMetadata("swagger/apiSecurity", value);
|
|
23
60
|
return entire ? SecurityAnalyzer_1.SecurityAnalyzer.merge(...entire) : [];
|
|
24
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Returns the version list of a target, or `undefined` when it is
|
|
64
|
+
* unversioned.
|
|
65
|
+
*
|
|
66
|
+
* @evidence contracts/common.md#principled-implementation A single version becomes a one-element list, and an absent value stays absent so callers can tell unversioned from versioned.
|
|
67
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
68
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads Nest's version metadata.
|
|
69
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the three cases.
|
|
70
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectMetadataAnalyzer.versions 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.
|
|
71
|
+
*/
|
|
25
72
|
ReflectMetadataAnalyzer.versions = (target) => {
|
|
26
73
|
const value = Reflect.getMetadata(constants_1.VERSION_METADATA, target);
|
|
27
74
|
return value === undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReflectMetadataAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ReflectMetadataAnalyzer.ts"],"names":[],"mappings":";;;AACA,wDAA2E;AAG3E,yDAAsD;AAEtD,IAAiB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"ReflectMetadataAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ReflectMetadataAnalyzer.ts"],"names":[],"mappings":";;;AACA,wDAA2E;AAG3E,yDAAsD;AAEtD;;;;;;;;GAQG;AACH,IAAiB,uBAAuB,CA2EvC;AA3ED,WAAiB,uBAAuB;IACtC;;;;;;;;;OASG;IACU,6BAAK,GAAG,CAAC,MAAgB,EAAY,EAAE;QAClD,MAAM,KAAK,GAAsB,OAAO,CAAC,WAAW,CAAC,yBAAa,EAAE,MAAM,CAAC,CAAC;QAC5E,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,CAAC,KAAK,CAAC,CAAC;aACzC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,EAAE,CAAC,CAAC;;YACpC,OAAO,KAAK,CAAC;IACpB,CAAC,CAAC;IAEF;;;;;;;;OAQG;IACU,kCAAU,GAAG,CAAC,KAAU,EAAuB,EAAE;QAC5D,MAAM,MAAM,GAAsC,OAAO,CAAC,WAAW,CACnE,sBAAsB,EACtB,KAAK,CACN,CAAC;QACF,OAAO,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF;;;;;;;;OAQG;IACU,kCAAU,GAAG,CAAC,KAAU,EAA8B,EAAE;QACnE,MAAM,MAAM,GAA2C,OAAO,CAAC,WAAW,CACxE,qBAAqB,EACrB,KAAK,CACN,CAAC;QACF,OAAO,MAAM,CAAC,CAAC,CAAC,mCAAgB,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,CAAC,CAAC;IAEF;;;;;;;;;OASG;IACU,gCAAQ,GAAG,CACtB,MAAW,EACyC,EAAE;QACtD,MAAM,KAAK,GAA6B,OAAO,CAAC,WAAW,CACzD,4BAAgB,EAChB,MAAM,CACP,CAAC;QACF,OAAO,KAAK,KAAK,SAAS;YACxB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBACpB,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,EA3EgB,uBAAuB,aAAvB,uBAAuB,GAAvB,uBAAuB,QA2EvC"}
|
|
@@ -2,7 +2,26 @@ import { INestiaProject } from "../structures/INestiaProject";
|
|
|
2
2
|
import { IOperationMetadata } from "../structures/IOperationMetadata";
|
|
3
3
|
import { IReflectController } from "../structures/IReflectController";
|
|
4
4
|
import { IReflectWebSocketOperation } from "../structures/IReflectWebSocketOperation";
|
|
5
|
+
/**
|
|
6
|
+
* Reflects a `@WebSocketRoute` method into an operation.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation The parameter decorators give each parameter's category, the acceptor and driver type arguments are checked, the path parameters of the route are matched against the param decorators, and the tgrid declarations are not imported into the SDK.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rules follow the decorator contract.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
12
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectWebSocketOperationAnalyzer 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.
|
|
13
|
+
*/
|
|
5
14
|
export declare namespace ReflectWebSocketOperationAnalyzer {
|
|
15
|
+
/**
|
|
16
|
+
* The input of the WebSocket operation analysis: the project, the controller,
|
|
17
|
+
* the method, and its metadata.
|
|
18
|
+
*
|
|
19
|
+
* @evidence contracts/common.md#principled-implementation The record holds what the analysis needs.
|
|
20
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record with no behavior.
|
|
21
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
22
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the type describes and the meaning of its members.
|
|
23
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectWebSocketOperationAnalyzer.IProps 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.
|
|
24
|
+
*/
|
|
6
25
|
interface IProps {
|
|
7
26
|
project: Omit<INestiaProject, "config">;
|
|
8
27
|
controller: IReflectController;
|
|
@@ -10,5 +29,15 @@ export declare namespace ReflectWebSocketOperationAnalyzer {
|
|
|
10
29
|
name: string;
|
|
11
30
|
metadata: IOperationMetadata;
|
|
12
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns the WebSocket operation of a method, or `null` when the method is
|
|
34
|
+
* not a WebSocket route or has errors.
|
|
35
|
+
*
|
|
36
|
+
* @evidence contracts/common.md#principled-implementation An acceptor is required, every parameter must carry one of the five decorators, the acceptor has three type arguments and the driver one, and the path parameters must equal the param fields.
|
|
37
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
38
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rules follow the decorator contract.
|
|
39
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the null result.
|
|
40
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectWebSocketOperationAnalyzer.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.
|
|
41
|
+
*/
|
|
13
42
|
const analyze: (ctx: IProps) => IReflectWebSocketOperation | null;
|
|
14
43
|
}
|
|
@@ -4,10 +4,30 @@ exports.ReflectWebSocketOperationAnalyzer = void 0;
|
|
|
4
4
|
const tstl_1 = require("tstl");
|
|
5
5
|
const StringUtil_1 = require("../utils/StringUtil");
|
|
6
6
|
const ImportAnalyzer_1 = require("./ImportAnalyzer");
|
|
7
|
+
const ParameterNameAnalyzer_1 = require("./ParameterNameAnalyzer");
|
|
7
8
|
const PathAnalyzer_1 = require("./PathAnalyzer");
|
|
8
9
|
const ReflectMetadataAnalyzer_1 = require("./ReflectMetadataAnalyzer");
|
|
10
|
+
/**
|
|
11
|
+
* Reflects a `@WebSocketRoute` method into an operation.
|
|
12
|
+
*
|
|
13
|
+
* @evidence contracts/common.md#principled-implementation The parameter decorators give each parameter's category, the acceptor and driver type arguments are checked, the path parameters of the route are matched against the param decorators, and the tgrid declarations are not imported into the SDK.
|
|
14
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function.
|
|
15
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rules follow the decorator contract.
|
|
16
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
17
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectWebSocketOperationAnalyzer 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.
|
|
18
|
+
*/
|
|
9
19
|
var ReflectWebSocketOperationAnalyzer;
|
|
10
20
|
(function (ReflectWebSocketOperationAnalyzer) {
|
|
21
|
+
/**
|
|
22
|
+
* Returns the WebSocket operation of a method, or `null` when the method is
|
|
23
|
+
* not a WebSocket route or has errors.
|
|
24
|
+
*
|
|
25
|
+
* @evidence contracts/common.md#principled-implementation An acceptor is required, every parameter must carry one of the five decorators, the acceptor has three type arguments and the driver one, and the path parameters must equal the param fields.
|
|
26
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
27
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rules follow the decorator contract.
|
|
28
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the null result.
|
|
29
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ReflectWebSocketOperationAnalyzer.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.
|
|
30
|
+
*/
|
|
11
31
|
ReflectWebSocketOperationAnalyzer.analyze = (ctx) => {
|
|
12
32
|
var _a, _b;
|
|
13
33
|
const route = Reflect.getMetadata("nestia/WebSocketRoute", ctx.function);
|
|
@@ -28,7 +48,7 @@ var ReflectWebSocketOperationAnalyzer;
|
|
|
28
48
|
" - @WebSocketRoute.Query()",
|
|
29
49
|
].join("\n"));
|
|
30
50
|
const imports = [];
|
|
31
|
-
const
|
|
51
|
+
const declared = preconfigured
|
|
32
52
|
.map((p) => {
|
|
33
53
|
var _a, _b, _c, _d, _e;
|
|
34
54
|
const reject = (message) => {
|
|
@@ -41,7 +61,7 @@ var ReflectWebSocketOperationAnalyzer;
|
|
|
41
61
|
if (matched === undefined)
|
|
42
62
|
return reject(`Unable to find parameter type of the ${p.index} (th).`);
|
|
43
63
|
else if (matched.type === null)
|
|
44
|
-
return reject(`Failed to analyze the parameter type of the ${JSON.stringify(matched.name)}.`);
|
|
64
|
+
return reject(`Failed to analyze the parameter type of the ${matched.name ? JSON.stringify(matched.name) : `${p.index} th parameter`}.`);
|
|
45
65
|
else if (p.category === "param" &&
|
|
46
66
|
!((_a = p.field) === null || _a === void 0 ? void 0 : _a.length))
|
|
47
67
|
return reject(`@WebSocketRoute.Param() must have a field name.`);
|
|
@@ -57,18 +77,20 @@ var ReflectWebSocketOperationAnalyzer;
|
|
|
57
77
|
i.file.endsWith("WebSocketAcceptor.d.ts")))));
|
|
58
78
|
if (p.category === "acceptor" ||
|
|
59
79
|
p.category === "driver" ||
|
|
80
|
+
p.category === "header" ||
|
|
60
81
|
p.category === "query")
|
|
61
82
|
return Object.assign(Object.assign({}, p), { name: matched.name, type: matched.type });
|
|
62
83
|
else if (p.category === "param")
|
|
63
84
|
return Object.assign(Object.assign({}, p), { category: "param", field: p.field, name: matched.name, type: matched.type, imports: matched.imports, description: matched.description, jsDocTags: matched.jsDocTags });
|
|
64
85
|
// UNKNOWN TYPE, MAYBE NEW FEATURE
|
|
65
86
|
else {
|
|
66
|
-
|
|
67
|
-
reject(`@WebSocketRoute.${StringUtil_1.StringUtil.capitalize(p.category)}() has not been supported yet. How about upgrading the nestia packages?`);
|
|
87
|
+
reject(`@WebSocketRoute.${StringUtil_1.StringUtil.capitalize(p.category)}() has not been supported yet. How about upgrading the nestia packages?`);
|
|
68
88
|
return null;
|
|
69
89
|
}
|
|
70
90
|
})
|
|
71
91
|
.filter((p) => !!p);
|
|
92
|
+
// a destructured parameter declares no name, so it is given one
|
|
93
|
+
const parameters = ParameterNameAnalyzer_1.ParameterNameAnalyzer.name(declared);
|
|
72
94
|
const fields = preconfigured
|
|
73
95
|
.filter((p) => p.category === "param")
|
|
74
96
|
.map((p) => { var _a; return (_a = p.field) !== null && _a !== void 0 ? _a : ""; })
|
|
@@ -77,7 +99,7 @@ var ReflectWebSocketOperationAnalyzer;
|
|
|
77
99
|
for (const cLoc of ctx.controller.paths)
|
|
78
100
|
for (const mLoc of route.paths) {
|
|
79
101
|
const location = PathAnalyzer_1.PathAnalyzer.join(cLoc, mLoc);
|
|
80
|
-
if (
|
|
102
|
+
if (PathAnalyzer_1.PathAnalyzer.wildcard(location))
|
|
81
103
|
continue;
|
|
82
104
|
const binded = PathAnalyzer_1.PathAnalyzer.parameters(location);
|
|
83
105
|
if (binded === null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReflectWebSocketOperationAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ReflectWebSocketOperationAnalyzer.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAQ9B,oDAAiD;AACjD,qDAAkD;AAClD,iDAA8C;AAC9C,uEAAoE;AAEpE,IAAiB,iCAAiC,
|
|
1
|
+
{"version":3,"file":"ReflectWebSocketOperationAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/ReflectWebSocketOperationAnalyzer.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAQ9B,oDAAiD;AACjD,qDAAkD;AAClD,mEAAgE;AAChE,iDAA8C;AAC9C,uEAAoE;AAEpE;;;;;;;;GAQG;AACH,IAAiB,iCAAiC,CA4LjD;AA5LD,WAAiB,iCAAiC;IAkBhD;;;;;;;;;OASG;IACU,yCAAO,GAAG,CAAC,GAAW,EAAqC,EAAE;;QACxE,MAAM,KAAK,GAAoC,OAAO,CAAC,WAAW,CAChE,uBAAuB,EACvB,GAAG,CAAC,QAAQ,CACb,CAAC;QACF,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QAErC,iCAAiC;QACjC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,aAAa,GAEf,OAAC,OAAO,CAAC,WAAW,CAClB,kCAAkC,EAClC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,EAC9B,GAAG,CAAC,IAAI,CACT,mCAAI,EAAE,CACR,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC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KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,KAAK,KAAK;oBACpD,MAAM,CAAC,IAAI,CACT,oHAAoH,MAAM,CAAC,IAAI,CAC7H,IAAI,CACL,mBAAmB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAC3C,CAAC;YACN,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClB,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;gBACtB,IAAI,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI;gBACzB,KAAK,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI;gBAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI;gBAC3B,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,WAAW;YACrB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,QAAQ,EAAE,iDAAuB,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;YACxD,UAAU;YACV,OAAO,EAAE,+BAAc,CAAC,KAAK,CAAC,OAAO,CAAC;YACtC,WAAW,QAAE,GAAG,CAAC,QAAQ,CAAC,WAAW,mCAAI,IAAI;YAC7C,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,SAAS;SAClC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EA5LgB,iCAAiC,aAAjC,iCAAiC,GAAjC,iCAAiC,QA4LjD"}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for security requirements.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation The namespace merges requirement lists into a canonical, duplicate-free list.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain helper.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
8
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SecurityAnalyzer 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.
|
|
9
|
+
*/
|
|
1
10
|
export declare namespace SecurityAnalyzer {
|
|
11
|
+
/**
|
|
12
|
+
* Joins lists of security requirements into one, as OpenAPI reads them.
|
|
13
|
+
*
|
|
14
|
+
* Each requirement is an alternative, any one of which suffices, and every
|
|
15
|
+
* scheme of one requirement must hold, so each is kept as declared. Merging
|
|
16
|
+
* them by scheme name turned `{ a, b }` (both) into `a` or `b`, and the
|
|
17
|
+
* `read` or `write` scope alternatives of one scheme into both scopes. Only a
|
|
18
|
+
* requirement repeating an earlier one, such as a controller's restated on
|
|
19
|
+
* its method, is dropped; an empty one, anonymous access, is kept.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/common.md#principled-implementation Each requirement is normalized to unique scopes and keyed by its sorted schemes and sorted scopes, so equality does not depend on order, and the first occurrence keeps its position.
|
|
22
|
+
* @evidence contracts/common.md#clear-and-simple-design One function with one key computation.
|
|
23
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Equality is defined by content.
|
|
24
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the equality and the order.
|
|
25
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SecurityAnalyzer.merge 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.
|
|
26
|
+
*/
|
|
2
27
|
const merge: (...entire: Record<string, string[]>[]) => Record<string, string[]>[];
|
|
3
28
|
}
|
|
@@ -1,30 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SecurityAnalyzer = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Helpers for security requirements.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation The namespace merges requirement lists into a canonical, duplicate-free list.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain helper.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SecurityAnalyzer 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.
|
|
12
|
+
*/
|
|
5
13
|
var SecurityAnalyzer;
|
|
6
14
|
(function (SecurityAnalyzer) {
|
|
15
|
+
/**
|
|
16
|
+
* Joins lists of security requirements into one, as OpenAPI reads them.
|
|
17
|
+
*
|
|
18
|
+
* Each requirement is an alternative, any one of which suffices, and every
|
|
19
|
+
* scheme of one requirement must hold, so each is kept as declared. Merging
|
|
20
|
+
* them by scheme name turned `{ a, b }` (both) into `a` or `b`, and the
|
|
21
|
+
* `read` or `write` scope alternatives of one scheme into both scopes. Only a
|
|
22
|
+
* requirement repeating an earlier one, such as a controller's restated on
|
|
23
|
+
* its method, is dropped; an empty one, anonymous access, is kept.
|
|
24
|
+
*
|
|
25
|
+
* @evidence contracts/common.md#principled-implementation Each requirement is normalized to unique scopes and keyed by its sorted schemes and sorted scopes, so equality does not depend on order, and the first occurrence keeps its position.
|
|
26
|
+
* @evidence contracts/common.md#clear-and-simple-design One function with one key computation.
|
|
27
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Equality is defined by content.
|
|
28
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the equality and the order.
|
|
29
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SecurityAnalyzer.merge 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.
|
|
30
|
+
*/
|
|
7
31
|
SecurityAnalyzer.merge = (...entire) => {
|
|
8
|
-
const dict = new Map();
|
|
9
|
-
for (const obj of entire) {
|
|
10
|
-
const entries = Object.entries(obj);
|
|
11
|
-
for (const [key, value] of entries) {
|
|
12
|
-
const set = MapUtil_1.MapUtil.take(dict, key, () => new Set());
|
|
13
|
-
for (const val of value)
|
|
14
|
-
set.add(val);
|
|
15
|
-
}
|
|
16
|
-
if (entries.length === 0)
|
|
17
|
-
MapUtil_1.MapUtil.take(dict, none, () => new Set());
|
|
18
|
-
}
|
|
19
32
|
const output = [];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
const visited = new Set();
|
|
34
|
+
for (const requirement of entire) {
|
|
35
|
+
const normalized = Object.fromEntries(Object.entries(requirement).map(([name, scopes]) => [
|
|
36
|
+
name,
|
|
37
|
+
[...new Set(scopes)],
|
|
38
|
+
]));
|
|
39
|
+
const key = JSON.stringify(Object.entries(normalized)
|
|
40
|
+
.map(([name, scopes]) => [name, [...scopes].sort()])
|
|
41
|
+
.sort(([x], [y]) => (x < y ? -1 : x > y ? 1 : 0)));
|
|
42
|
+
if (visited.has(key))
|
|
43
|
+
continue;
|
|
44
|
+
visited.add(key);
|
|
45
|
+
output.push(normalized);
|
|
46
|
+
}
|
|
26
47
|
return output;
|
|
27
48
|
};
|
|
28
|
-
const none = Symbol("none");
|
|
29
49
|
})(SecurityAnalyzer || (exports.SecurityAnalyzer = SecurityAnalyzer = {}));
|
|
30
50
|
//# sourceMappingURL=SecurityAnalyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/SecurityAnalyzer.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"SecurityAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/SecurityAnalyzer.ts"],"names":[],"mappings":";;;AAAA;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EAxCgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAwChC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SwaggerExample } from "@nestia/core";
|
|
2
|
+
import { OpenApi } from "@typia/interface";
|
|
3
|
+
/**
|
|
4
|
+
* Converts the named examples of `@SwaggerExample` into OpenAPI example
|
|
5
|
+
* objects.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation The namespace maps each named value to an example object.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain mapping.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SwaggerExampleAnalyzer 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.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace SwaggerExampleAnalyzer {
|
|
14
|
+
/**
|
|
15
|
+
* The named examples `@SwaggerExample` attached, as the Example Objects an
|
|
16
|
+
* OpenAPI `examples` map holds.
|
|
17
|
+
*
|
|
18
|
+
* The decorator stores each named example as its value, and documents used to
|
|
19
|
+
* carry the value itself. OpenAPI 3.x names examples with Example Objects,
|
|
20
|
+
* whose `value` holds the value, so a tool read the raw value as an Example
|
|
21
|
+
* Object and found no example in it (#1649). `@TypedException()` examples are
|
|
22
|
+
* declared as Example Objects already.
|
|
23
|
+
*
|
|
24
|
+
* @evidence contracts/common.md#principled-implementation Each value is wrapped as `{ value }`, which is the OpenAPI example object.
|
|
25
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional and one mapping.
|
|
26
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The values are kept as given.
|
|
27
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
28
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SwaggerExampleAnalyzer.examples 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.
|
|
29
|
+
*/
|
|
30
|
+
const examples: (data: SwaggerExample.IData<any> | undefined) => Record<string, OpenApi.IExample> | undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwaggerExampleAnalyzer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Converts the named examples of `@SwaggerExample` into OpenAPI example
|
|
6
|
+
* objects.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation The namespace maps each named value to an example object.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain mapping.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
12
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SwaggerExampleAnalyzer 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.
|
|
13
|
+
*/
|
|
14
|
+
var SwaggerExampleAnalyzer;
|
|
15
|
+
(function (SwaggerExampleAnalyzer) {
|
|
16
|
+
/**
|
|
17
|
+
* The named examples `@SwaggerExample` attached, as the Example Objects an
|
|
18
|
+
* OpenAPI `examples` map holds.
|
|
19
|
+
*
|
|
20
|
+
* The decorator stores each named example as its value, and documents used to
|
|
21
|
+
* carry the value itself. OpenAPI 3.x names examples with Example Objects,
|
|
22
|
+
* whose `value` holds the value, so a tool read the raw value as an Example
|
|
23
|
+
* Object and found no example in it (#1649). `@TypedException()` examples are
|
|
24
|
+
* declared as Example Objects already.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation Each value is wrapped as `{ value }`, which is the OpenAPI example object.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional and one mapping.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The values are kept as given.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
30
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SwaggerExampleAnalyzer.examples 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.
|
|
31
|
+
*/
|
|
32
|
+
SwaggerExampleAnalyzer.examples = (data) => (data === null || data === void 0 ? void 0 : data.examples) === undefined
|
|
33
|
+
? undefined
|
|
34
|
+
: Object.fromEntries(Object.entries(data.examples).map(([key, value]) => [key, { value }]));
|
|
35
|
+
})(SwaggerExampleAnalyzer || (exports.SwaggerExampleAnalyzer = SwaggerExampleAnalyzer = {}));
|
|
36
|
+
//# sourceMappingURL=SwaggerExampleAnalyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwaggerExampleAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/SwaggerExampleAnalyzer.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;GASG;AACH,IAAiB,sBAAsB,CAyBtC;AAzBD,WAAiB,sBAAsB;IACrC;;;;;;;;;;;;;;;OAeG;IACU,+BAAQ,GAAG,CACtB,IAA2C,EACG,EAAE,CAChD,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,MAAK,SAAS;QAC1B,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CACtE,CAAC;AACV,CAAC,EAzBgB,sBAAsB,aAAtB,sBAAsB,GAAtB,sBAAsB,QAyBtC"}
|
|
@@ -3,14 +3,52 @@ import { IReflectController } from "../structures/IReflectController";
|
|
|
3
3
|
import { IReflectHttpOperation } from "../structures/IReflectHttpOperation";
|
|
4
4
|
import { IReflectOperationError } from "../structures/IReflectOperationError";
|
|
5
5
|
import { ITypedHttpRoute } from "../structures/ITypedHttpRoute";
|
|
6
|
+
import { ITypedMcpRoute } from "../structures/ITypedMcpRoute";
|
|
7
|
+
/**
|
|
8
|
+
* Turns reflected HTTP operations into typed routes, one per path, and builds
|
|
9
|
+
* the shared dictionary of the JSON components HTTP and MCP routes use.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/common.md#principled-implementation Each operation's metadata is resolved against its own components and validated by the policy of its position, the routes carry the typed parameters, the success response, and the exceptions, and the dictionary of the routes is built after component names that collide with different definitions are renamed per controller.
|
|
12
|
+
* @evidence contracts/common.md#clear-and-simple-design Two public functions and private collectors for the component rename.
|
|
13
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rename mutates only component definitions owned by analysis; consumers emit resolved structural types rather than modifying foreign cache fields or replacing names in strings.
|
|
14
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
15
|
+
* efficient algorithms: This namespace groups operations; analyze and routeDictionary own the algorithms.
|
|
16
|
+
* reuse equivalent work: The namespace itself coordinates no completed or in-flight work.
|
|
17
|
+
* bound retention and release resources: The namespace owns no cache, handle or running task.
|
|
18
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedHttpRouteAnalyzer 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.
|
|
19
|
+
*/
|
|
6
20
|
export declare namespace TypedHttpRouteAnalyzer {
|
|
7
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Returns the typed routes of one operation, one per path, or none when the
|
|
23
|
+
* metadata violates a policy; the violations are pushed to the errors.
|
|
24
|
+
*
|
|
25
|
+
* @evidence contracts/common.md#principled-implementation Each metadata is resolved against its own components and validated with the policy of its position (JSON, query, header, or text), the `@setHeader` and `@assignHeaders` tags become header directives, and the route splits the parameters by category.
|
|
26
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
27
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The policies come from the validators of the package.
|
|
28
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result and the errors.
|
|
29
|
+
* efficient algorithms: Each supplied parameter and exception is cast once, policy validation belongs to MetadataFactory, and route splitting maps only the supplied paths.
|
|
30
|
+
* reuse equivalent work: Independently supplied operation metadata and position-specific validation have no shared completed or in-flight request.
|
|
31
|
+
* bound retention and release resources: Metadata dictionaries and local diagnostics belong to this synchronous operation and its returned routes; no process, handle or persistent history is retained.
|
|
32
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedHttpRouteAnalyzer.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.
|
|
33
|
+
*/
|
|
8
34
|
const analyze: (props: {
|
|
9
35
|
controller: IReflectController;
|
|
10
36
|
errors: IReflectOperationError[];
|
|
11
|
-
dictionary: IMetadataDictionary;
|
|
12
37
|
operation: IReflectHttpOperation;
|
|
13
38
|
paths: string[];
|
|
14
39
|
}) => ITypedHttpRoute[];
|
|
15
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Returns the dictionary of the components the routes actually use, after
|
|
42
|
+
* renaming components whose names collide with different definitions.
|
|
43
|
+
*
|
|
44
|
+
* @evidence contracts/common.md#principled-implementation Objects, aliases and recursive arrays/tuples share their emitted accessor-path slots, while finite and object-mediated collections remain kind-specific inline groups. Different semantic classes in one slot receive unique controller-qualified names, and the emitted dictionary follows escaped returns rather than original-only toJSON declarations.
|
|
45
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over private collectors.
|
|
46
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Finite partition refinement preserves semantic discriminators and user payloads while component edges reference equivalence classes. Only actual component ordinals are omitted; no foreign name cache or generated text is rewritten.
|
|
47
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result and the rename.
|
|
48
|
+
* efficient algorithms: Each refinement round encodes each distinct component body with constant-sized component edges. The partition only splits and stabilizes within the distinct component count, avoiding exponential expansion of shared DAGs.
|
|
49
|
+
* reuse equivalent work: One local partition compares all routes together, reuses graph node colors for shared children and supplies all collision groups; equivalent same-slot definitions reuse one emitted representative.
|
|
50
|
+
* bound retention and release resources: Collected nodes, partitions and visited sets are local to this synchronous call and are released with it; the returned dictionary retains only its reachable emitted representatives.
|
|
51
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedHttpRouteAnalyzer.routeDictionary 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.
|
|
52
|
+
*/
|
|
53
|
+
const routeDictionary: (routes: Array<ITypedHttpRoute | ITypedMcpRoute>) => IMetadataDictionary;
|
|
16
54
|
}
|