@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
|
@@ -11,6 +11,16 @@ import { ImportAnalyzer } from "../../analyses/ImportAnalyzer";
|
|
|
11
11
|
import { IReflectImport } from "../../structures/IReflectImport";
|
|
12
12
|
import { FilePrinter } from "./FilePrinter";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The imports of one generated file, merged by module and kind, and printed as
|
|
16
|
+
* import declarations.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/common.md#principled-implementation An import is keyed by its module, its type-only flag, and its default or namespace name, so the same import is one declaration whose named bindings are collected in order.
|
|
19
|
+
* @evidence contracts/common.md#clear-and-simple-design One class with a hash map of components, and private helpers for the paths.
|
|
20
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The keys are equal exactly when the declarations can be merged.
|
|
21
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
22
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source path spelling uses Node path.resolve and relative imports use path.relative followed by native-separator conversion to forward slashes. Package registration uses a node_modules marker; normalization is lexical, not symlink or filesystem-case canonicalization.
|
|
23
|
+
*/
|
|
14
24
|
export class ImportDictionary {
|
|
15
25
|
private readonly components_: HashMap<ICompositeKey, ICompositeValue> =
|
|
16
26
|
new HashMap(
|
|
@@ -24,10 +34,32 @@ export class ImportDictionary {
|
|
|
24
34
|
|
|
25
35
|
public constructor(public readonly file: string) {}
|
|
26
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Reports whether the file has no import.
|
|
39
|
+
*
|
|
40
|
+
* @evidence contracts/common.md#principled-implementation The dictionary is empty exactly when no component was registered.
|
|
41
|
+
* @evidence contracts/common.md#clear-and-simple-design One call.
|
|
42
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the map.
|
|
43
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
44
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ImportDictionary.prototype.empty 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.
|
|
45
|
+
*/
|
|
27
46
|
public empty(): boolean {
|
|
28
47
|
return this.components_.empty();
|
|
29
48
|
}
|
|
30
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Registers the imports a route's declarations need, merged by file, as
|
|
52
|
+
* type-only imports.
|
|
53
|
+
*
|
|
54
|
+
* The `WebSocketAcceptor` element is skipped, because the SDK refers to it
|
|
55
|
+
* through `tgrid`.
|
|
56
|
+
*
|
|
57
|
+
* @evidence contracts/common.md#principled-implementation Each namespace, default, and named import is registered under its alias so a name resolves to the same local binding.
|
|
58
|
+
* @evidence contracts/common.md#clear-and-simple-design One loop over the merged imports.
|
|
59
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The skipped element is the one binding that the generated code supplies itself.
|
|
60
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
61
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source path spelling uses Node path.resolve and relative imports use path.relative followed by native-separator conversion to forward slashes. Package registration uses a node_modules marker; normalization is lexical, not symlink or filesystem-case canonicalization.
|
|
62
|
+
*/
|
|
31
63
|
public declarations(imports: IReflectImport[]): void {
|
|
32
64
|
imports = ImportAnalyzer.merge(imports);
|
|
33
65
|
for (const imp of imports) {
|
|
@@ -59,6 +91,63 @@ export class ImportDictionary {
|
|
|
59
91
|
}
|
|
60
92
|
}
|
|
61
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Every identifier the imports bind in the file.
|
|
96
|
+
*
|
|
97
|
+
* @evidence contracts/common.md#principled-implementation The namespace, the default, and each named local are collected, so a caller can see what a route name would shadow.
|
|
98
|
+
* @evidence contracts/common.md#clear-and-simple-design One loop.
|
|
99
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads the components without changing them.
|
|
100
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
101
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ImportDictionary.prototype.locals 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.
|
|
102
|
+
*/
|
|
103
|
+
public locals(): string[] {
|
|
104
|
+
const output: string[] = [];
|
|
105
|
+
for (const { second: c } of this.components_) {
|
|
106
|
+
if (c.asterisk !== null) output.push(c.asterisk);
|
|
107
|
+
if (c.default !== null) output.push(c.default);
|
|
108
|
+
for (const { first: local } of c.elements) output.push(local);
|
|
109
|
+
}
|
|
110
|
+
return output;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Returns registered bindings in the route import representation, retaining
|
|
115
|
+
* normalized module paths and local-to-exported aliases. The route emitter
|
|
116
|
+
* consumes these as type-only declarations.
|
|
117
|
+
*
|
|
118
|
+
* @evidence contracts/common.md#principled-implementation The projection reads the same normalized module keys and local-to-exported binding map used by toStatements, so a structural type writer and its route retain the same imports.
|
|
119
|
+
* @evidence contracts/common.md#clear-and-simple-design One projection over existing registrations.
|
|
120
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No AST parsing or second import policy reconstructs the bindings.
|
|
121
|
+
* @evidence contracts/common.md#meaningful-documentation Documents normalized paths, alias direction and the route's type-only consumption.
|
|
122
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation ImportDictionary.prototype.toImports 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.
|
|
123
|
+
*/
|
|
124
|
+
public toImports(): IReflectImport[] {
|
|
125
|
+
return Array.from(this.components_).map(({ second: component }) => {
|
|
126
|
+
const bindings = Array.from(component.elements);
|
|
127
|
+
const aliases = Object.fromEntries(
|
|
128
|
+
bindings
|
|
129
|
+
.filter(({ first, second }) => first !== second)
|
|
130
|
+
.map(({ first, second }) => [first, second]),
|
|
131
|
+
);
|
|
132
|
+
return {
|
|
133
|
+
file: component.file,
|
|
134
|
+
asterisk: component.asterisk,
|
|
135
|
+
default: component.default,
|
|
136
|
+
elements: bindings.map(({ first }) => first),
|
|
137
|
+
...(Object.keys(aliases).length ? { elementAliases: aliases } : {}),
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Registers an import of a package and returns the local name it binds.
|
|
144
|
+
*
|
|
145
|
+
* @evidence contracts/common.md#principled-implementation The file is placed under `node_modules`, so the printer emits the bare package specifier.
|
|
146
|
+
* @evidence contracts/common.md#clear-and-simple-design One delegation.
|
|
147
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It shares the registration of `internal`.
|
|
148
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
149
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source path spelling uses Node path.resolve and relative imports use path.relative followed by native-separator conversion to forward slashes. Package registration uses a node_modules marker; normalization is lexical, not symlink or filesystem-case canonicalization.
|
|
150
|
+
*/
|
|
62
151
|
public external(props: ImportDictionary.IProps): string {
|
|
63
152
|
const file: string = `node_modules/${props.file}`;
|
|
64
153
|
return this.internal({
|
|
@@ -67,6 +156,15 @@ export class ImportDictionary {
|
|
|
67
156
|
});
|
|
68
157
|
}
|
|
69
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Registers an import of a source file and returns the local name it binds.
|
|
161
|
+
*
|
|
162
|
+
* @evidence contracts/common.md#principled-implementation The path is normalized and its source extension removed, so equal normalized module spellings share a component, and a named binding is stored under its local name. Symlink and filesystem-case identity are not canonicalized.
|
|
163
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
164
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The result is the alias when there is one.
|
|
165
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
166
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source path spelling uses Node path.resolve and relative imports use path.relative followed by native-separator conversion to forward slashes. Package registration uses a node_modules marker; normalization is lexical, not symlink or filesystem-case canonicalization.
|
|
167
|
+
*/
|
|
70
168
|
public internal(props: ImportDictionary.IProps): string {
|
|
71
169
|
const file: string = normalize(trimSourceExtension(props.file));
|
|
72
170
|
const key: ICompositeKey = {
|
|
@@ -86,6 +184,16 @@ export class ImportDictionary {
|
|
|
86
184
|
return props.type === "element" ? (props.alias ?? props.name) : props.name;
|
|
87
185
|
}
|
|
88
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Returns the import declarations, packages first and files after them,
|
|
189
|
+
* sorted by module, with paths relative to the output directory.
|
|
190
|
+
*
|
|
191
|
+
* @evidence contracts/common.md#principled-implementation The package paths are cut at their last `node_modules`, and a file path is made relative with forward slashes, so the output does not depend on the platform.
|
|
192
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over one filter helper.
|
|
193
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Both groups are sorted and separated by one empty line.
|
|
194
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
195
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source path spelling uses Node path.resolve and relative imports use path.relative followed by native-separator conversion to forward slashes. Package registration uses a node_modules marker; normalization is lexical, not symlink or filesystem-case canonicalization.
|
|
196
|
+
*/
|
|
89
197
|
public toStatements(outDir: string): Node[] {
|
|
90
198
|
outDir = path.resolve(outDir);
|
|
91
199
|
|
|
@@ -120,7 +228,7 @@ export class ImportDictionary {
|
|
|
120
228
|
container.push(
|
|
121
229
|
factory.createImportDeclaration(
|
|
122
230
|
undefined,
|
|
123
|
-
this.
|
|
231
|
+
this.toImportClause(c),
|
|
124
232
|
factory.createStringLiteral(c.file),
|
|
125
233
|
),
|
|
126
234
|
);
|
|
@@ -135,7 +243,7 @@ export class ImportDictionary {
|
|
|
135
243
|
];
|
|
136
244
|
}
|
|
137
245
|
|
|
138
|
-
private
|
|
246
|
+
private toImportClause(c: ICompositeValue): ImportClause {
|
|
139
247
|
// A namespace binding cannot carry a per-binding `type` modifier, so the
|
|
140
248
|
// type-only flag goes on the clause itself (`import type * as X`) —
|
|
141
249
|
// generated SDK code references DTO namespaces only in type positions.
|
|
@@ -167,6 +275,16 @@ export class ImportDictionary {
|
|
|
167
275
|
}
|
|
168
276
|
}
|
|
169
277
|
export namespace ImportDictionary {
|
|
278
|
+
/**
|
|
279
|
+
* One import to register: its kind, its module, its name, an optional alias,
|
|
280
|
+
* and whether it is type-only.
|
|
281
|
+
*
|
|
282
|
+
* @evidence contracts/common.md#principled-implementation The record is the argument of both registrations.
|
|
283
|
+
* @evidence contracts/common.md#clear-and-simple-design A flat record.
|
|
284
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
285
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
286
|
+
* @evidence contracts/portability.md#os-neutral-implementation Source path spelling uses Node path.resolve and relative imports use path.relative followed by native-separator conversion to forward slashes. Package registration uses a node_modules marker; normalization is lexical, not symlink or filesystem-case canonicalization.
|
|
287
|
+
*/
|
|
170
288
|
export interface IProps {
|
|
171
289
|
type: "default" | "element" | "asterisk";
|
|
172
290
|
file: string;
|
|
@@ -16,8 +16,28 @@ import { FilePrinter } from "./FilePrinter";
|
|
|
16
16
|
import { ImportDictionary } from "./ImportDictionary";
|
|
17
17
|
import { SdkHttpParameterProgrammer } from "./SdkHttpParameterProgrammer";
|
|
18
18
|
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
19
|
+
import type { SdkWebSocketParameterProgrammer } from "./SdkWebSocketParameterProgrammer";
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Type nodes of the SDK: the named types of routes, and the request and
|
|
23
|
+
* response aliases.
|
|
24
|
+
*
|
|
25
|
+
* @evidence contracts/common.md#principled-implementation The namespace builds each type as the syntax tree that the printer writes, from the reflected names or from the metadata when `clone` is on.
|
|
26
|
+
* @evidence contracts/common.md#clear-and-simple-design Several small builders.
|
|
27
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The builders depend on the project configuration for the choice of source.
|
|
28
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
29
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection 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.
|
|
30
|
+
*/
|
|
20
31
|
export namespace SdkAliasCollection {
|
|
32
|
+
/**
|
|
33
|
+
* Returns the type reference of a reflected type, with its type arguments.
|
|
34
|
+
*
|
|
35
|
+
* @evidence contracts/common.md#principled-implementation The arguments are built recursively.
|
|
36
|
+
* @evidence contracts/common.md#clear-and-simple-design One recursion.
|
|
37
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It writes the name as reflected.
|
|
38
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
39
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.name 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.
|
|
40
|
+
*/
|
|
21
41
|
export const name = ({ type }: { type: IReflectType }): TypeNode =>
|
|
22
42
|
factory.createTypeReferenceNode(
|
|
23
43
|
type.name,
|
|
@@ -26,20 +46,58 @@ export namespace SdkAliasCollection {
|
|
|
26
46
|
: undefined,
|
|
27
47
|
);
|
|
28
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Returns the type of one chunk of a binary response:
|
|
51
|
+
* `Uint8Array<ArrayBufferLike>`.
|
|
52
|
+
*
|
|
53
|
+
* @evidence contracts/common.md#principled-implementation The chunk type of the platform stream is a byte array.
|
|
54
|
+
* @evidence contracts/common.md#clear-and-simple-design One node.
|
|
55
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The type is fixed.
|
|
56
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
57
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.binaryChunk 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.
|
|
58
|
+
*/
|
|
29
59
|
export const binaryChunk = (): TypeNode =>
|
|
30
60
|
factory.createTypeReferenceNode("Uint8Array", [
|
|
31
61
|
factory.createTypeReferenceNode("ArrayBufferLike"),
|
|
32
62
|
]);
|
|
33
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Returns the type of a binary response: `ReadableStream` of its chunks.
|
|
66
|
+
*
|
|
67
|
+
* @evidence contracts/common.md#principled-implementation A binary response is streamed, not read into memory.
|
|
68
|
+
* @evidence contracts/common.md#clear-and-simple-design One node.
|
|
69
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The chunk type is shared.
|
|
70
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
71
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.binaryResponse 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.
|
|
72
|
+
*/
|
|
34
73
|
export const binaryResponse = (): TypeNode =>
|
|
35
74
|
factory.createTypeReferenceNode("ReadableStream", [binaryChunk()]);
|
|
36
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Returns the type node of a metadata.
|
|
78
|
+
*
|
|
79
|
+
* @evidence contracts/common.md#principled-implementation The metadata is written by the type programmer, so the result is the DTO the clone declares.
|
|
80
|
+
* @evidence contracts/common.md#clear-and-simple-design One delegation.
|
|
81
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It shares the type writer.
|
|
82
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
83
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.from 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.
|
|
84
|
+
*/
|
|
37
85
|
export const from =
|
|
38
86
|
(project: INestiaProject) =>
|
|
39
87
|
(importer: ImportDictionary) =>
|
|
40
88
|
(metadata: MetadataSchema): TypeNode =>
|
|
41
89
|
SdkTypeProgrammer.write(project)(importer)(metadata) as TypeNode;
|
|
42
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Returns the object type of a route's keyword parameters, each with the
|
|
93
|
+
* description of its parameter or its `@param` tag.
|
|
94
|
+
*
|
|
95
|
+
* @evidence contracts/common.md#principled-implementation The entries are the route's path, query, and body parameters, optional where the metadata is, without prefix.
|
|
96
|
+
* @evidence contracts/common.md#clear-and-simple-design One map over the entries.
|
|
97
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A parameter with a description carries it as a comment.
|
|
98
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
99
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.httpProps 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.
|
|
100
|
+
*/
|
|
43
101
|
export const httpProps =
|
|
44
102
|
(project: INestiaProject) =>
|
|
45
103
|
(importer: ImportDictionary) =>
|
|
@@ -82,7 +140,20 @@ export namespace SdkAliasCollection {
|
|
|
82
140
|
.flat(),
|
|
83
141
|
);
|
|
84
142
|
|
|
85
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Returns the object type of a WebSocket route's keyword parameters: its path
|
|
145
|
+
* parameters, its query, and its provider.
|
|
146
|
+
*
|
|
147
|
+
* @evidence contracts/common.md#principled-implementation The keys are the names decided by the parameter programmer, so the type and the function agree.
|
|
148
|
+
* @evidence contracts/common.md#clear-and-simple-design One literal.
|
|
149
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The names are shared.
|
|
150
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
151
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.websocketProps 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.
|
|
152
|
+
*/
|
|
153
|
+
export const websocketProps = (
|
|
154
|
+
route: ITypedWebSocketRoute,
|
|
155
|
+
names: SdkWebSocketParameterProgrammer.INames,
|
|
156
|
+
): TypeNode =>
|
|
86
157
|
factory.createTypeLiteralNode([
|
|
87
158
|
...route.pathParameters.map((p) =>
|
|
88
159
|
factory.createPropertySignature(
|
|
@@ -96,7 +167,7 @@ export namespace SdkAliasCollection {
|
|
|
96
167
|
? [
|
|
97
168
|
factory.createPropertySignature(
|
|
98
169
|
undefined,
|
|
99
|
-
|
|
170
|
+
names.query,
|
|
100
171
|
undefined,
|
|
101
172
|
factory.createTypeReferenceNode("Query"),
|
|
102
173
|
),
|
|
@@ -104,12 +175,22 @@ export namespace SdkAliasCollection {
|
|
|
104
175
|
: []),
|
|
105
176
|
factory.createPropertySignature(
|
|
106
177
|
undefined,
|
|
107
|
-
|
|
178
|
+
names.provider,
|
|
108
179
|
undefined,
|
|
109
180
|
factory.createTypeReferenceNode("Provider"),
|
|
110
181
|
),
|
|
111
182
|
]);
|
|
112
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Returns the type of a route's headers: its reflected name, or the
|
|
186
|
+
* metadata's type under `clone`.
|
|
187
|
+
*
|
|
188
|
+
* @evidence contracts/common.md#principled-implementation The source follows the `clone` setting.
|
|
189
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
190
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The choice is made on one flag.
|
|
191
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
192
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.headers 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.
|
|
193
|
+
*/
|
|
113
194
|
export const headers =
|
|
114
195
|
(project: INestiaProject) =>
|
|
115
196
|
(importer: ImportDictionary) =>
|
|
@@ -129,6 +210,16 @@ export namespace SdkAliasCollection {
|
|
|
129
210
|
);
|
|
130
211
|
};
|
|
131
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Returns the type of a route's query: its metadata under `clone`, otherwise
|
|
215
|
+
* its reflected type wrapped in Resolved unless primitive conversion is off.
|
|
216
|
+
*
|
|
217
|
+
* @evidence contracts/common.md#principled-implementation Clone mode uses the resolved metadata graph; source mode uses the declared type with the configured Resolved conversion.
|
|
218
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
219
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The choice is made on one flag.
|
|
220
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
221
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.query 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.
|
|
222
|
+
*/
|
|
132
223
|
export const query =
|
|
133
224
|
(project: INestiaProject) =>
|
|
134
225
|
(importer: ImportDictionary) =>
|
|
@@ -148,6 +239,16 @@ export namespace SdkAliasCollection {
|
|
|
148
239
|
);
|
|
149
240
|
};
|
|
150
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Returns the type of a route's body: a form data input for a multipart body,
|
|
244
|
+
* and otherwise the reflected name or the metadata's type under `clone`.
|
|
245
|
+
*
|
|
246
|
+
* @evidence contracts/common.md#principled-implementation The multipart body is an input of files and fields, not the declared class.
|
|
247
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
248
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The cases are the content types.
|
|
249
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
250
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.body 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.
|
|
251
|
+
*/
|
|
151
252
|
export const body =
|
|
152
253
|
(project: INestiaProject) =>
|
|
153
254
|
(importer: ImportDictionary) =>
|
|
@@ -176,14 +277,28 @@ export namespace SdkAliasCollection {
|
|
|
176
277
|
);
|
|
177
278
|
};
|
|
178
279
|
|
|
280
|
+
/**
|
|
281
|
+
* Returns the type of a route's output: the success and every exception as a
|
|
282
|
+
* union of `IPropagation` members, or the success body alone when propagation
|
|
283
|
+
* is off.
|
|
284
|
+
*
|
|
285
|
+
* @evidence contracts/common.md#principled-implementation Status keys retain their declared numeric or range spelling for IPropagation to expand. Source success types follow their content type, while declared exceptions use JSON Primitive conversion independently of the success media type; primitive:false preserves declared source types.
|
|
286
|
+
* @evidence contracts/common.md#clear-and-simple-design One function of two branches.
|
|
287
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The exceptions are the declared ones.
|
|
288
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
289
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.response 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.
|
|
290
|
+
*/
|
|
179
291
|
export const response =
|
|
180
292
|
(project: INestiaProject) =>
|
|
181
293
|
(importer: ImportDictionary) =>
|
|
182
294
|
(route: ITypedHttpRoute): TypeNode => {
|
|
183
|
-
const schema = (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
295
|
+
const schema = (
|
|
296
|
+
p: {
|
|
297
|
+
metadata: MetadataSchema;
|
|
298
|
+
type: IReflectType;
|
|
299
|
+
},
|
|
300
|
+
json: boolean,
|
|
301
|
+
): TypeNode =>
|
|
187
302
|
sizeOf(p.metadata) === 0
|
|
188
303
|
? TypeFactory.keyword("void")
|
|
189
304
|
: project.config.clone === true
|
|
@@ -194,11 +309,7 @@ export namespace SdkAliasCollection {
|
|
|
194
309
|
file: "typia",
|
|
195
310
|
declaration: true,
|
|
196
311
|
type: "element",
|
|
197
|
-
name:
|
|
198
|
-
route.success.contentType === "application/json" ||
|
|
199
|
-
route.success.encrypted === true
|
|
200
|
-
? "Primitive"
|
|
201
|
-
: "Resolved",
|
|
312
|
+
name: json ? "Primitive" : "Resolved",
|
|
202
313
|
}),
|
|
203
314
|
[name(p)],
|
|
204
315
|
)
|
|
@@ -206,7 +317,11 @@ export namespace SdkAliasCollection {
|
|
|
206
317
|
const success: TypeNode =
|
|
207
318
|
route.success.binary === true
|
|
208
319
|
? binaryResponse()
|
|
209
|
-
: schema(
|
|
320
|
+
: schema(
|
|
321
|
+
route.success,
|
|
322
|
+
route.success.contentType === "application/json" ||
|
|
323
|
+
route.success.encrypted === true,
|
|
324
|
+
);
|
|
210
325
|
if (project.config.propagate !== true) return success;
|
|
211
326
|
|
|
212
327
|
const branches: IBranch[] = [
|
|
@@ -218,7 +333,7 @@ export namespace SdkAliasCollection {
|
|
|
218
333
|
},
|
|
219
334
|
...Object.entries(route.exceptions).map(([status, value]) => ({
|
|
220
335
|
status,
|
|
221
|
-
type: schema(value),
|
|
336
|
+
type: schema(value, true),
|
|
222
337
|
})),
|
|
223
338
|
];
|
|
224
339
|
return factory.createTypeReferenceNode(
|
|
@@ -233,7 +348,10 @@ export namespace SdkAliasCollection {
|
|
|
233
348
|
branches.map((b) =>
|
|
234
349
|
factory.createPropertySignature(
|
|
235
350
|
undefined,
|
|
236
|
-
|
|
351
|
+
// a status range like "4XX" is no numeric literal
|
|
352
|
+
/^\d+$/.test(b.status)
|
|
353
|
+
? factory.createNumericLiteral(b.status)
|
|
354
|
+
: factory.createStringLiteral(b.status),
|
|
237
355
|
undefined,
|
|
238
356
|
b.type,
|
|
239
357
|
),
|
|
@@ -250,6 +368,17 @@ export namespace SdkAliasCollection {
|
|
|
250
368
|
);
|
|
251
369
|
};
|
|
252
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Returns the type of the success body: a stream for a binary response, the
|
|
373
|
+
* reflected type for a plain one, and its primitive form for a JSON
|
|
374
|
+
* response.
|
|
375
|
+
*
|
|
376
|
+
* @evidence contracts/common.md#principled-implementation The route's metadata decides between the branches.
|
|
377
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
378
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The branches are the response kinds.
|
|
379
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
380
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkAliasCollection.responseBody 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.
|
|
381
|
+
*/
|
|
253
382
|
export const responseBody =
|
|
254
383
|
(project: INestiaProject) =>
|
|
255
384
|
(importer: ImportDictionary) =>
|