@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
|
@@ -15,13 +15,42 @@ import { FilePrinter } from "./FilePrinter";
|
|
|
15
15
|
import { ImportDictionary } from "./ImportDictionary";
|
|
16
16
|
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Composes the DTO declarations of the HTTP routes.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/common.md#principled-implementation The namespace turns each named object, alias and recursive collection into a declaration, placed in a tree of modules by its dotted name.
|
|
22
|
+
* @evidence contracts/common.md#clear-and-simple-design One declaration-tree operation dispatches object, alias and recursive collection bodies through their owning writers.
|
|
23
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Implicit object and alias names are not declared; native-marked recursive collections supply named declarations so recursive references have a definition.
|
|
24
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
25
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
26
|
+
*/
|
|
18
27
|
export namespace SdkHttpCloneProgrammer {
|
|
28
|
+
/**
|
|
29
|
+
* A module of the declaration tree: its name, its children, and the writer of
|
|
30
|
+
* its own declaration.
|
|
31
|
+
*
|
|
32
|
+
* @evidence contracts/common.md#principled-implementation A module without a writer only holds children.
|
|
33
|
+
* @evidence contracts/common.md#clear-and-simple-design A three-member record.
|
|
34
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
35
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
36
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer.IModule composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
37
|
+
*/
|
|
19
38
|
export interface IModule {
|
|
20
39
|
name: string;
|
|
21
40
|
children: Map<string, IModule>;
|
|
22
41
|
programmer: null | ((importer: ImportDictionary) => Node);
|
|
23
42
|
}
|
|
24
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Returns the declaration tree of the application's named types, keyed by
|
|
46
|
+
* their top-level name.
|
|
47
|
+
*
|
|
48
|
+
* @evidence contracts/common.md#principled-implementation Named objects and aliases are registered, and implicit names are skipped. Recursive arrays and tuples also need declarations: each writes one collection body whose nested uses are named references. Finite and object-mediated collections stay inline.
|
|
49
|
+
* @evidence contracts/common.md#clear-and-simple-design Four collection loops feed the same declaration tree, so all named forms share namespace and import decisions.
|
|
50
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The implicit test is the shared definition.
|
|
51
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
52
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
53
|
+
*/
|
|
25
54
|
export const write = (app: ITypedApplication): Map<string, IModule> => {
|
|
26
55
|
// COMPOSE THE DICTIONARY
|
|
27
56
|
const dict: Map<string, IModule> = new Map();
|
|
@@ -39,6 +68,32 @@ export namespace SdkHttpCloneProgrammer {
|
|
|
39
68
|
name: k,
|
|
40
69
|
programmer: (importer) => writeAlias(app.project)(importer)(v),
|
|
41
70
|
});
|
|
71
|
+
for (const [k, v] of app.collection.arrays.entries())
|
|
72
|
+
if (v.recursive)
|
|
73
|
+
prepare({
|
|
74
|
+
dict,
|
|
75
|
+
name: k,
|
|
76
|
+
programmer: (importer) =>
|
|
77
|
+
factory.createTypeAliasDeclaration(
|
|
78
|
+
[factory.createModifier(SyntaxKind.ExportKeyword)],
|
|
79
|
+
StringUtil.accessorsOf(k).at(-1)!,
|
|
80
|
+
[],
|
|
81
|
+
SdkTypeProgrammer.write_array_type(app.project)(importer)(v),
|
|
82
|
+
),
|
|
83
|
+
});
|
|
84
|
+
for (const [k, v] of app.collection.tuples.entries())
|
|
85
|
+
if (v.recursive)
|
|
86
|
+
prepare({
|
|
87
|
+
dict,
|
|
88
|
+
name: k,
|
|
89
|
+
programmer: (importer) =>
|
|
90
|
+
factory.createTypeAliasDeclaration(
|
|
91
|
+
[factory.createModifier(SyntaxKind.ExportKeyword)],
|
|
92
|
+
StringUtil.accessorsOf(k).at(-1)!,
|
|
93
|
+
[],
|
|
94
|
+
SdkTypeProgrammer.write_tuple_type(app.project)(importer)(v),
|
|
95
|
+
),
|
|
96
|
+
});
|
|
42
97
|
return dict;
|
|
43
98
|
};
|
|
44
99
|
|
|
@@ -1,13 +1,37 @@
|
|
|
1
|
+
import { TsPrinter } from "@ttsc/factory";
|
|
2
|
+
|
|
1
3
|
import { MetadataSchema, nameOf } from "../../internal/legacy";
|
|
4
|
+
import { INestiaProject } from "../../structures/INestiaProject";
|
|
2
5
|
import { IReflectType } from "../../structures/IReflectType";
|
|
3
6
|
import { ITypedApplication } from "../../structures/ITypedApplication";
|
|
4
7
|
import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
8
|
+
import { ITypedMcpRoute } from "../../structures/ITypedMcpRoute";
|
|
5
9
|
import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
|
|
6
|
-
import {
|
|
10
|
+
import { ImportDictionary } from "./ImportDictionary";
|
|
7
11
|
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
12
|
+
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
8
13
|
import { SdkWebSocketCloneProgrammer } from "./SdkWebSocketCloneProgrammer";
|
|
9
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Rewrites the routes to refer to the cloned DTOs.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/common.md#principled-implementation HTTP and MCP JSON types and their namespace/tag imports are emitted together from resolved metadata by the cloned declaration writer; WebSocket declarations retain their source types and redirect only cloned imports.
|
|
19
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function and three visitors.
|
|
20
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The routes are rewritten in place, once.
|
|
21
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
22
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneReferencer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
23
|
+
*/
|
|
10
24
|
export namespace SdkHttpCloneReferencer {
|
|
25
|
+
/**
|
|
26
|
+
* Rewrites the HTTP, MCP and WebSocket routes so their types and imports
|
|
27
|
+
* refer to the `structures` files.
|
|
28
|
+
*
|
|
29
|
+
* @evidence contracts/common.md#principled-implementation HTTP and MCP JSON routes use structural TypeNodes and the writer's registered imports. Empty and any/unknown forms retain their baked keyword distinction because they require no cloned component binding; WebSocket source types only redirect imports actually cloned.
|
|
30
|
+
* @evidence contracts/common.md#clear-and-simple-design One loop.
|
|
31
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The routes are edited in place, as the generation owns them.
|
|
32
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
33
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpCloneReferencer.replace composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
34
|
+
*/
|
|
11
35
|
export const replace = (
|
|
12
36
|
app: ITypedApplication,
|
|
13
37
|
websocket: Set<string> = new Set(),
|
|
@@ -16,7 +40,7 @@ export namespace SdkHttpCloneReferencer {
|
|
|
16
40
|
for (const route of app.routes)
|
|
17
41
|
if (route.protocol === "http")
|
|
18
42
|
visitHttpRoute({
|
|
19
|
-
|
|
43
|
+
project: app.project,
|
|
20
44
|
route,
|
|
21
45
|
});
|
|
22
46
|
else if (route.protocol === "websocket")
|
|
@@ -25,43 +49,70 @@ export namespace SdkHttpCloneReferencer {
|
|
|
25
49
|
directory,
|
|
26
50
|
route,
|
|
27
51
|
});
|
|
52
|
+
else if (route.protocol === "mcp") visitMcpRoute(app.project, route);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const visitMcpRoute = (
|
|
56
|
+
project: INestiaProject,
|
|
57
|
+
route: ITypedMcpRoute,
|
|
58
|
+
): void => {
|
|
59
|
+
const importer = new ImportDictionary(
|
|
60
|
+
`${project.config.output}/functional/${route.accessor.join("/")}/index.ts`,
|
|
61
|
+
);
|
|
62
|
+
if (route.input && route.inputMetadata)
|
|
63
|
+
visitType({
|
|
64
|
+
importer,
|
|
65
|
+
project,
|
|
66
|
+
metadata: route.inputMetadata,
|
|
67
|
+
type: route.input.type,
|
|
68
|
+
name: (name) => (route.input!.type = { name }),
|
|
69
|
+
});
|
|
70
|
+
if (route.returnType && route.outputMetadata)
|
|
71
|
+
visitType({
|
|
72
|
+
importer,
|
|
73
|
+
project,
|
|
74
|
+
metadata: route.outputMetadata,
|
|
75
|
+
type: route.returnType,
|
|
76
|
+
name: (name) => (route.returnType = { name }),
|
|
77
|
+
});
|
|
78
|
+
route.imports = importer.toImports();
|
|
28
79
|
};
|
|
29
80
|
|
|
30
81
|
const visitHttpRoute = (props: {
|
|
31
|
-
|
|
82
|
+
project: INestiaProject;
|
|
32
83
|
route: ITypedHttpRoute;
|
|
33
84
|
}): void => {
|
|
34
|
-
const
|
|
85
|
+
const importer = new ImportDictionary(
|
|
86
|
+
`${props.project.config.output}/functional/${props.route.accessor.join("/")}/index.ts`,
|
|
87
|
+
);
|
|
35
88
|
for (const p of SdkHttpParameterProgrammer.getSignificant(
|
|
36
89
|
props.route,
|
|
37
90
|
true,
|
|
38
91
|
))
|
|
39
92
|
visitType({
|
|
40
|
-
|
|
93
|
+
importer,
|
|
94
|
+
project: props.project,
|
|
41
95
|
metadata: p.metadata,
|
|
42
96
|
type: p.type,
|
|
43
97
|
name: (name) => (p.type = { name }),
|
|
44
98
|
});
|
|
45
99
|
for (const v of Object.values(props.route.exceptions))
|
|
46
100
|
visitType({
|
|
47
|
-
|
|
101
|
+
importer,
|
|
102
|
+
project: props.project,
|
|
48
103
|
metadata: v.metadata,
|
|
49
104
|
type: v.type,
|
|
50
105
|
name: (name) => (v.type = { name }),
|
|
51
106
|
});
|
|
52
107
|
if (props.route.success.binary === false)
|
|
53
108
|
visitType({
|
|
54
|
-
|
|
109
|
+
importer,
|
|
110
|
+
project: props.project,
|
|
55
111
|
metadata: props.route.success.metadata,
|
|
56
112
|
type: props.route.success.type,
|
|
57
113
|
name: (name) => (props.route.success.type = { name }),
|
|
58
114
|
});
|
|
59
|
-
props.route.imports =
|
|
60
|
-
file: `${props.directory}/${str}`,
|
|
61
|
-
asterisk: null,
|
|
62
|
-
default: null,
|
|
63
|
-
elements: [str],
|
|
64
|
-
}));
|
|
115
|
+
props.route.imports = importer.toImports();
|
|
65
116
|
};
|
|
66
117
|
|
|
67
118
|
const visitWebSocketRoute = (props: {
|
|
@@ -113,20 +164,43 @@ export namespace SdkHttpCloneReferencer {
|
|
|
113
164
|
};
|
|
114
165
|
|
|
115
166
|
const visitType = (p: {
|
|
116
|
-
|
|
167
|
+
importer: ImportDictionary;
|
|
168
|
+
project: INestiaProject;
|
|
117
169
|
metadata: MetadataSchema;
|
|
118
170
|
type: IReflectType;
|
|
119
171
|
name: (key: string) => void;
|
|
120
172
|
}): void => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
173
|
+
// Empty and any/unknown metadata carries no structural declaration from
|
|
174
|
+
// which to recover its source-level keyword distinction. These forms require
|
|
175
|
+
// no cloned component binding; retain the producer's baked name (or declared
|
|
176
|
+
// route type for authored metadata without a bake).
|
|
177
|
+
if (
|
|
178
|
+
p.metadata.any ||
|
|
179
|
+
(p.metadata.nullable === false &&
|
|
180
|
+
p.metadata.escaped === null &&
|
|
181
|
+
p.metadata.rest === null &&
|
|
182
|
+
[
|
|
183
|
+
p.metadata.atomics,
|
|
184
|
+
p.metadata.constants,
|
|
185
|
+
p.metadata.templates,
|
|
186
|
+
p.metadata.arrays,
|
|
187
|
+
p.metadata.tuples,
|
|
188
|
+
p.metadata.objects,
|
|
189
|
+
p.metadata.aliases,
|
|
190
|
+
p.metadata.natives,
|
|
191
|
+
p.metadata.sets,
|
|
192
|
+
p.metadata.maps,
|
|
193
|
+
p.metadata.functions,
|
|
194
|
+
].every((members) => members.length === 0))
|
|
195
|
+
) {
|
|
196
|
+
p.name(nameOf(p.metadata) || getFullText(p.type));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
p.name(
|
|
200
|
+
new TsPrinter().print(
|
|
201
|
+
SdkTypeProgrammer.write(p.project)(p.importer)(p.metadata),
|
|
202
|
+
),
|
|
203
|
+
);
|
|
130
204
|
};
|
|
131
205
|
}
|
|
132
206
|
|
|
@@ -20,7 +20,26 @@ import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
|
20
20
|
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
21
21
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Writes the function of an HTTP route.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation The namespace prints the exported async function with its parameters and the fetcher call and its headers.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function and the body writers.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The names come from the parameter programmer.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
30
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpFunctionProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
31
|
+
*/
|
|
23
32
|
export namespace SdkHttpFunctionProgrammer {
|
|
33
|
+
/**
|
|
34
|
+
* Returns the exported async function of a route: `connection`, then the
|
|
35
|
+
* parameters, returning the output or `void`.
|
|
36
|
+
*
|
|
37
|
+
* @evidence contracts/common.md#principled-implementation The identifiers were decided once by the parameter programmer, and the body calls the plain or the encrypted fetcher.
|
|
38
|
+
* @evidence contracts/common.md#clear-and-simple-design One declaration built from the parameter and body helpers.
|
|
39
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function uses the route's assigned name; SdkFileProgrammer may assign a private binding and export it under the public accessor when the module scope collides.
|
|
40
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
41
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpFunctionProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
42
|
+
*/
|
|
24
43
|
export const write =
|
|
25
44
|
(project: INestiaProject) =>
|
|
26
45
|
(importer: ImportDictionary) =>
|
|
@@ -26,7 +26,26 @@ import { SdkHttpSimulationProgrammer } from "./SdkHttpSimulationProgrammer";
|
|
|
26
26
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
27
27
|
import { SdkPathTemplate } from "./SdkPathTemplate";
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Writes the namespace of an HTTP route.
|
|
31
|
+
*
|
|
32
|
+
* @evidence contracts/common.md#principled-implementation The namespace holds the route's types, its metadata, its path builder, and, when configured, its random, simulate, and stringify functions.
|
|
33
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function and four writers.
|
|
34
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The parts follow the configuration.
|
|
35
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
36
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpNamespaceProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
37
|
+
*/
|
|
29
38
|
export namespace SdkHttpNamespaceProgrammer {
|
|
39
|
+
/**
|
|
40
|
+
* Returns the namespace of a route: its types, `METADATA`, `path`, and, by
|
|
41
|
+
* configuration, `random`, `simulate`, and `stringify`.
|
|
42
|
+
*
|
|
43
|
+
* @evidence contracts/common.md#principled-implementation `stringify` exists only for a JSON or encrypted body when `json` is on, and the simulator only when `simulate` is on.
|
|
44
|
+
* @evidence contracts/common.md#clear-and-simple-design One declaration composed of the writers.
|
|
45
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The optional members follow the flags.
|
|
46
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
47
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpNamespaceProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
48
|
+
*/
|
|
30
49
|
export const write =
|
|
31
50
|
(project: INestiaProject) =>
|
|
32
51
|
(importer: ImportDictionary) =>
|
|
@@ -13,7 +13,26 @@ import { StringUtil } from "../../utils/StringUtil";
|
|
|
13
13
|
import { ImportDictionary } from "./ImportDictionary";
|
|
14
14
|
import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* The parameters of an HTTP route's SDK function.
|
|
18
|
+
*
|
|
19
|
+
* @evidence contracts/common.md#principled-implementation The namespace decides the identifiers, lists the entries, and writes the declarations and the arguments in positional or keyword mode.
|
|
20
|
+
* @evidence contracts/common.md#clear-and-simple-design Several small functions over one entry type.
|
|
21
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The three consumers share one decision.
|
|
22
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
23
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
24
|
+
*/
|
|
16
25
|
export namespace SdkHttpParameterProgrammer {
|
|
26
|
+
/**
|
|
27
|
+
* One parameter of a route: its key, whether it is required, its type, and
|
|
28
|
+
* the reflected parameter.
|
|
29
|
+
*
|
|
30
|
+
* @evidence contracts/common.md#principled-implementation The record is what a declaration or an argument needs.
|
|
31
|
+
* @evidence contracts/common.md#clear-and-simple-design A four-member record.
|
|
32
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
33
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
34
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.IEntry composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
35
|
+
*/
|
|
17
36
|
export interface IEntry {
|
|
18
37
|
key: string;
|
|
19
38
|
required: boolean;
|
|
@@ -40,6 +59,12 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
40
59
|
* generated code actually references for this route and configuration, and an
|
|
41
60
|
* own identifier yields only to the names its scope can see, so nothing is
|
|
42
61
|
* renamed where no name is shadowed.
|
|
62
|
+
*
|
|
63
|
+
* @evidence contracts/common.md#principled-implementation One decision serves the three scopes, so they cannot disagree.
|
|
64
|
+
* @evidence contracts/common.md#clear-and-simple-design A record of names and two lookups.
|
|
65
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
66
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
67
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.INames composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
43
68
|
*/
|
|
44
69
|
export interface INames {
|
|
45
70
|
connection: string;
|
|
@@ -52,13 +77,39 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
52
77
|
value: string;
|
|
53
78
|
elem: string;
|
|
54
79
|
|
|
55
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Local identifier of a significant parameter in positional mode.
|
|
82
|
+
*
|
|
83
|
+
* @evidence contracts/common.md#principled-implementation A parameter yields to a name the SDK cannot change and keeps its own otherwise.
|
|
84
|
+
* @evidence contracts/common.md#clear-and-simple-design One lookup.
|
|
85
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the decision.
|
|
86
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
87
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.INames.parameter composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
88
|
+
*/
|
|
56
89
|
parameter: (p: ITypedHttpRouteParameter) => string;
|
|
57
90
|
|
|
58
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Reads a significant parameter: `props.<name>` or its local.
|
|
93
|
+
*
|
|
94
|
+
* @evidence contracts/common.md#principled-implementation The read follows the mode of the function.
|
|
95
|
+
* @evidence contracts/common.md#clear-and-simple-design One lookup.
|
|
96
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the decision.
|
|
97
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
98
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.INames.access composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
99
|
+
*/
|
|
59
100
|
access: (p: ITypedHttpRouteParameter) => Expression;
|
|
60
101
|
}
|
|
61
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Decides the identifiers of a route's function, `path()`, and `simulate()`
|
|
105
|
+
* once.
|
|
106
|
+
*
|
|
107
|
+
* @evidence contracts/common.md#principled-implementation The fixed names each scope references are collected, and every own identifier avoids them and the other own identifiers it can see.
|
|
108
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over the scope sets.
|
|
109
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only shadowed names are renamed.
|
|
110
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
111
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.getNames composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
112
|
+
*/
|
|
62
113
|
export const getNames = (props: {
|
|
63
114
|
project: INestiaProject;
|
|
64
115
|
route: ITypedHttpRoute;
|
|
@@ -172,6 +223,16 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
172
223
|
};
|
|
173
224
|
};
|
|
174
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Returns every parameter of a route: path, query, header, query object,
|
|
228
|
+
* body, and header object.
|
|
229
|
+
*
|
|
230
|
+
* @evidence contracts/common.md#principled-implementation The list is the concatenation in that order.
|
|
231
|
+
* @evidence contracts/common.md#clear-and-simple-design One list.
|
|
232
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It adds no parameter.
|
|
233
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
234
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.getAll composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
235
|
+
*/
|
|
175
236
|
export const getAll = (
|
|
176
237
|
route: ITypedHttpRoute,
|
|
177
238
|
): ITypedHttpRouteParameter[] => [
|
|
@@ -183,6 +244,16 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
183
244
|
...(route.headerObject ? [route.headerObject] : []),
|
|
184
245
|
];
|
|
185
246
|
|
|
247
|
+
/**
|
|
248
|
+
* Returns the parameters that make up a call: path, query, the query object,
|
|
249
|
+
* and the body when asked.
|
|
250
|
+
*
|
|
251
|
+
* @evidence contracts/common.md#principled-implementation Headers travel in the connection and are not arguments.
|
|
252
|
+
* @evidence contracts/common.md#clear-and-simple-design One list.
|
|
253
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The body is included by the caller's choice.
|
|
254
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
255
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.getSignificant composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
256
|
+
*/
|
|
186
257
|
export const getSignificant = (route: ITypedHttpRoute, body: boolean) => [
|
|
187
258
|
...route.pathParameters,
|
|
188
259
|
...route.queryParameters,
|
|
@@ -190,6 +261,17 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
190
261
|
...(body && route.body ? [route.body] : []),
|
|
191
262
|
];
|
|
192
263
|
|
|
264
|
+
/**
|
|
265
|
+
* Returns the entries of a route: path and query parameters, the query
|
|
266
|
+
* object, and the body when asked, with the type each has in the function or
|
|
267
|
+
* in the test.
|
|
268
|
+
*
|
|
269
|
+
* @evidence contracts/common.md#principled-implementation The type is the alias `Query` or `Body` in the function, and the reflected or cloned type in a test.
|
|
270
|
+
* @evidence contracts/common.md#clear-and-simple-design One list of three groups.
|
|
271
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An empty route has no entries.
|
|
272
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
273
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.getEntries composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
274
|
+
*/
|
|
193
275
|
export const getEntries = (props: {
|
|
194
276
|
project: INestiaProject;
|
|
195
277
|
importer: ImportDictionary;
|
|
@@ -262,6 +344,16 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
262
344
|
];
|
|
263
345
|
};
|
|
264
346
|
|
|
347
|
+
/**
|
|
348
|
+
* Returns the parameter declarations of a route's function: one `props`
|
|
349
|
+
* object in keyword mode, and one positional parameter per entry otherwise.
|
|
350
|
+
*
|
|
351
|
+
* @evidence contracts/common.md#principled-implementation A required parameter cannot follow an optional one, so an optional one before a required one trades its `?` for `undefined` in its type.
|
|
352
|
+
* @evidence contracts/common.md#clear-and-simple-design One function of two modes.
|
|
353
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The names come from `getNames`.
|
|
354
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
355
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.getParameterDeclarations composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
356
|
+
*/
|
|
265
357
|
export const getParameterDeclarations = (props: {
|
|
266
358
|
project: INestiaProject;
|
|
267
359
|
importer: ImportDictionary;
|
|
@@ -328,6 +420,16 @@ export namespace SdkHttpParameterProgrammer {
|
|
|
328
420
|
factory.createKeywordTypeNode(SyntaxKind.UndefinedKeyword),
|
|
329
421
|
]);
|
|
330
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Returns the arguments to call a route's function with: the `props` object
|
|
425
|
+
* in keyword mode, and the parameters otherwise.
|
|
426
|
+
*
|
|
427
|
+
* @evidence contracts/common.md#principled-implementation The identifiers are those declared by `getNames`.
|
|
428
|
+
* @evidence contracts/common.md#clear-and-simple-design One function of two modes.
|
|
429
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No argument is invented for an empty route.
|
|
430
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
431
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpParameterProgrammer.getArguments composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
432
|
+
*/
|
|
331
433
|
export const getArguments = (props: {
|
|
332
434
|
project: INestiaProject;
|
|
333
435
|
route: ITypedHttpRoute;
|
|
@@ -9,7 +9,27 @@ import { SdkHttpFunctionProgrammer } from "./SdkHttpFunctionProgrammer";
|
|
|
9
9
|
import { SdkHttpNamespaceProgrammer } from "./SdkHttpNamespaceProgrammer";
|
|
10
10
|
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Writes an HTTP route into the SDK: its function and its namespace.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/common.md#principled-implementation The namespace pairs the two declarations and describes the function.
|
|
16
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function and one description helper.
|
|
17
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The description is from the route's own comment.
|
|
18
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
19
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpRouteProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
20
|
+
*/
|
|
12
21
|
export namespace SdkHttpRouteProgrammer {
|
|
22
|
+
/**
|
|
23
|
+
* Returns the function and the namespace of a route, the function carrying
|
|
24
|
+
* the route's description, `@param`, and exception tags, and a `@nestia`
|
|
25
|
+
* postfix.
|
|
26
|
+
*
|
|
27
|
+
* @evidence contracts/common.md#principled-implementation The two nodes share the identifiers of one decision.
|
|
28
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
29
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The description keeps the names the function declares.
|
|
30
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
31
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpRouteProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
32
|
+
*/
|
|
13
33
|
export const write =
|
|
14
34
|
(project: INestiaProject) =>
|
|
15
35
|
(importer: ImportDictionary) =>
|
|
@@ -23,7 +23,32 @@ import { SdkAliasCollection } from "./SdkAliasCollection";
|
|
|
23
23
|
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
24
24
|
import { SdkImportWizard } from "./SdkImportWizard";
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Writes the mockup functions of an HTTP route.
|
|
28
|
+
*
|
|
29
|
+
* @evidence contracts/common.md#principled-implementation The namespace prints random for the response type and simulate for structural parameter assertions followed by random response creation. Simulation operates on typed SDK arguments rather than parsing HTTP transport values.
|
|
30
|
+
* @evidence contracts/common.md#clear-and-simple-design Two public functions and their helpers.
|
|
31
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Generated validation calls typia.assert through NestiaSimulator's error adapter. It does not reproduce arbitrary server pipes or the server transform's prune and equality modes; simulation rejects structural type violations without contacting a server.
|
|
32
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
33
|
+
* efficient algorithms: Response construction has a fixed AST skeleton; request assertion emission visits significant parameters once and allocates one validator expression per parameter. Type and parameter projection costs belong to the called programmers.
|
|
34
|
+
* reuse equivalent work: These writers construct route-specific mutable AST nodes and coordinate no completed or in-flight generation across requests.
|
|
35
|
+
* bound retention and release resources: Returned ASTs transfer to the file writer. The emitted binary random function closes its empty stream during construction; the programmer itself retains no stream or producer task.
|
|
36
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpSimulationProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
37
|
+
*/
|
|
26
38
|
export namespace SdkHttpSimulationProgrammer {
|
|
39
|
+
/**
|
|
40
|
+
* Returns `random`: it makes a value of the response, a closed empty stream
|
|
41
|
+
* for a binary one. Binary readers receive EOF without waiting for payload.
|
|
42
|
+
*
|
|
43
|
+
* @evidence contracts/common.md#principled-implementation Ordinary responses call typia.random of the output type. Binary responses construct a stream with the existing binary chunk type and a start callback that closes its own controller synchronously; no bytes are enqueued, so the first read reports EOF under Streams semantics.
|
|
44
|
+
* @evidence contracts/common.md#clear-and-simple-design The existing binary versus ordinary expression branch owns response generation. Its inline stream source supplies closure without another runtime helper, import or transport.
|
|
45
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The binary case has no random content.
|
|
46
|
+
* @evidence contracts/common.md#meaningful-documentation The prose states that binary random output is closed and readers receive EOF without waiting for payload.
|
|
47
|
+
* bound retention and release resources: The emitted binary source queues no bytes or producer task and closes each empty stream during construction. The writer returns its AST without retaining stream handles; runtime readers belong to the generated SDK caller.
|
|
48
|
+
* efficient algorithms: After response-type projection, either branch allocates a fixed AST skeleton; the binary branch emits one empty stream constructor without traversing or generating payload bytes.
|
|
49
|
+
* reuse equivalent work: The returned AST belongs to this route and importer. Each generated runtime call needs its own random value or stream, so neither mutable syntax nor runtime response identity is shared.
|
|
50
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpSimulationProgrammer.random composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
51
|
+
*/
|
|
27
52
|
export const random =
|
|
28
53
|
(project: INestiaProject) =>
|
|
29
54
|
(importer: ImportDictionary) =>
|
|
@@ -47,7 +72,34 @@ export namespace SdkHttpSimulationProgrammer {
|
|
|
47
72
|
? factory.createNewExpression(
|
|
48
73
|
factory.createIdentifier("ReadableStream"),
|
|
49
74
|
[SdkAliasCollection.binaryChunk() as TypeNode],
|
|
50
|
-
[
|
|
75
|
+
[
|
|
76
|
+
factory.createObjectLiteralExpression([
|
|
77
|
+
factory.createPropertyAssignment(
|
|
78
|
+
"start",
|
|
79
|
+
factory.createArrowFunction(
|
|
80
|
+
undefined,
|
|
81
|
+
undefined,
|
|
82
|
+
[
|
|
83
|
+
factory.createParameterDeclaration(
|
|
84
|
+
undefined,
|
|
85
|
+
undefined,
|
|
86
|
+
"controller",
|
|
87
|
+
),
|
|
88
|
+
],
|
|
89
|
+
undefined,
|
|
90
|
+
undefined,
|
|
91
|
+
factory.createCallExpression(
|
|
92
|
+
IdentifierFactory.access(
|
|
93
|
+
factory.createIdentifier("controller"),
|
|
94
|
+
"close",
|
|
95
|
+
),
|
|
96
|
+
undefined,
|
|
97
|
+
[],
|
|
98
|
+
),
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
]),
|
|
102
|
+
],
|
|
51
103
|
)
|
|
52
104
|
: factory.createCallExpression(
|
|
53
105
|
IdentifierFactory.access(
|
|
@@ -61,6 +113,19 @@ export namespace SdkHttpSimulationProgrammer {
|
|
|
61
113
|
);
|
|
62
114
|
};
|
|
63
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Returns `simulate`: it asserts the parameters and returns a random output,
|
|
118
|
+
* wrapped as a propagation when configured.
|
|
119
|
+
*
|
|
120
|
+
* @evidence contracts/common.md#principled-implementation The status of the wrapper is the declared one or the method's default. A response without a content type has no Content-Type entry; a declared media type supplies a string header, preserving the propagation header contract.
|
|
121
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
122
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The parameters are validated before a response is made.
|
|
123
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
124
|
+
* efficient algorithms: Parameter declarations and assertion nodes grow linearly with significant route parameters; propagation adds a fixed response wrapper and one catch block. The private assertion writer handles the connection headers separately rather than duplicating every parameter validation.
|
|
125
|
+
* reuse equivalent work: Simulation syntax contains this route's names, arguments, output type and importer aliases; this operation coordinates no reusable result across generation requests.
|
|
126
|
+
* bound retention and release resources: This function returns an AST to its caller and owns no retained cache, stream, handle or background task; runtime random response creation is documented by random.
|
|
127
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkHttpSimulationProgrammer.simulate composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
128
|
+
*/
|
|
64
129
|
export const simulate =
|
|
65
130
|
(project: INestiaProject) =>
|
|
66
131
|
(importer: ImportDictionary) =>
|
|
@@ -125,9 +190,11 @@ export namespace SdkHttpSimulationProgrammer {
|
|
|
125
190
|
),
|
|
126
191
|
factory.createPropertyAssignment(
|
|
127
192
|
"headers",
|
|
128
|
-
LiteralFactory.write(
|
|
129
|
-
|
|
130
|
-
|
|
193
|
+
LiteralFactory.write(
|
|
194
|
+
route.success.contentType === null
|
|
195
|
+
? {}
|
|
196
|
+
: { "Content-Type": route.success.contentType },
|
|
197
|
+
),
|
|
131
198
|
),
|
|
132
199
|
factory.createPropertyAssignment("data", caller()),
|
|
133
200
|
],
|
|
@@ -240,7 +307,7 @@ export namespace SdkHttpSimulationProgrammer {
|
|
|
240
307
|
),
|
|
241
308
|
)
|
|
242
309
|
.map(factory.createExpressionStatement);
|
|
243
|
-
//
|
|
310
|
+
// Headers travel in the connection and receive a structural assertion.
|
|
244
311
|
if (route.headerObject !== null)
|
|
245
312
|
individual.push(
|
|
246
313
|
factory.createExpressionStatement(
|