@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
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type Expression, factory } from "@ttsc/factory";
|
|
2
|
+
|
|
3
|
+
import { PathAnalyzer } from "../../analyses/PathAnalyzer";
|
|
4
|
+
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
5
|
+
import { ImportDictionary } from "./ImportDictionary";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The path expression of an SDK function.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation The namespace composes the route's path from its segments, filling the parameters through the fetcher's encoder.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
12
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The segments are those the router reads.
|
|
13
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
14
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkPathTemplate 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.
|
|
15
|
+
*/
|
|
16
|
+
export namespace SdkPathTemplate {
|
|
17
|
+
/**
|
|
18
|
+
* The expression an SDK function builds its route's path with: the literal
|
|
19
|
+
* text of the path, each parameter filled in by `PathParameter.encode()` of
|
|
20
|
+
* `@nestia/fetcher` with the value `argument` names for it: URI-encoded, or
|
|
21
|
+
* `"null"` when nullish, and refused when it is a dot segment (`.`, `..`) the
|
|
22
|
+
* URL would resolve away.
|
|
23
|
+
*
|
|
24
|
+
* The positions come from {@link PathAnalyzer.segments}, as the server's
|
|
25
|
+
* router reads the path, so a parameter with literal text beside it in its
|
|
26
|
+
* segment, such as `/files/:id.json` or `/range/:from-:to`, is filled in
|
|
27
|
+
* where it stands.
|
|
28
|
+
*
|
|
29
|
+
* @evidence contracts/common.md#principled-implementation A path without a parameter is a literal, and otherwise a template holding each parameter's `PathParameter.encode` call between its literal texts.
|
|
30
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
31
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The literal text follows the router's reading.
|
|
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 SdkPathTemplate.compose 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
|
+
*/
|
|
35
|
+
export const compose = (props: {
|
|
36
|
+
importer: ImportDictionary;
|
|
37
|
+
path: string;
|
|
38
|
+
argument: (name: string) => Expression;
|
|
39
|
+
}): Expression => {
|
|
40
|
+
const segments: PathAnalyzer.ISegment[] | null = PathAnalyzer.segments(
|
|
41
|
+
props.path,
|
|
42
|
+
);
|
|
43
|
+
if (segments === null) return factory.createStringLiteral(props.path);
|
|
44
|
+
// the literal text as the router reads it, an escaped `\:` unescaped
|
|
45
|
+
else if (segments.every((segment) => segment.type === "literal"))
|
|
46
|
+
return factory.createStringLiteral(
|
|
47
|
+
segments
|
|
48
|
+
.map((segment) => (segment.type === "literal" ? segment.value : ""))
|
|
49
|
+
.join(""),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// a template holds a literal between every two expressions
|
|
53
|
+
const literals: string[] = [""];
|
|
54
|
+
const parameters: string[] = [];
|
|
55
|
+
for (const segment of segments)
|
|
56
|
+
if (segment.type === "literal")
|
|
57
|
+
literals[literals.length - 1] += segment.value;
|
|
58
|
+
else {
|
|
59
|
+
parameters.push(segment.name);
|
|
60
|
+
literals.push("");
|
|
61
|
+
}
|
|
62
|
+
return factory.createTemplateExpression(
|
|
63
|
+
factory.createTemplateHead(literals[0]!),
|
|
64
|
+
parameters.map((name, i) =>
|
|
65
|
+
factory.createTemplateSpan(
|
|
66
|
+
factory.createCallExpression(
|
|
67
|
+
IdentifierFactory.access(
|
|
68
|
+
factory.createIdentifier(
|
|
69
|
+
props.importer.external({
|
|
70
|
+
declaration: false,
|
|
71
|
+
file: "@nestia/fetcher",
|
|
72
|
+
type: "element",
|
|
73
|
+
name: "PathParameter",
|
|
74
|
+
}),
|
|
75
|
+
),
|
|
76
|
+
"encode",
|
|
77
|
+
),
|
|
78
|
+
undefined,
|
|
79
|
+
[factory.createStringLiteral(name), props.argument(name)],
|
|
80
|
+
),
|
|
81
|
+
(i !== parameters.length - 1
|
|
82
|
+
? factory.createTemplateMiddle
|
|
83
|
+
: factory.createTemplateTail)(literals[i + 1]!),
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -2,6 +2,16 @@ import { ITypedHttpRoute } from "../../structures/ITypedHttpRoute";
|
|
|
2
2
|
import { ITypedMcpRoute } from "../../structures/ITypedMcpRoute";
|
|
3
3
|
import { ITypedWebSocketRoute } from "../../structures/ITypedWebSocketRoute";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* One directory of the functional tree: its parent, its name, its module path,
|
|
7
|
+
* its children, and its routes.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/common.md#principled-implementation The module path is the parent's path with the name, from `api.functional`.
|
|
10
|
+
* @evidence contracts/common.md#clear-and-simple-design Parent and segment name identify one node; its derived module name, children and routes organize the generated functional tree.
|
|
11
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The members are set once and only the collections grow.
|
|
12
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
13
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkRouteDirectory 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.
|
|
14
|
+
*/
|
|
5
15
|
export class SdkRouteDirectory {
|
|
6
16
|
public readonly module: string;
|
|
7
17
|
public readonly children: Map<string, SdkRouteDirectory>;
|
|
@@ -3,10 +3,12 @@ import { NamingConvention } from "@typia/utils";
|
|
|
3
3
|
import { IJsDocTagInfo, IMetadataTypeTag } from "typia";
|
|
4
4
|
|
|
5
5
|
import { ExpressionFactory } from "../../factories/ExpressionFactory";
|
|
6
|
+
import { LiteralFactory } from "../../factories/LiteralFactory";
|
|
6
7
|
import { TypeFactory } from "../../factories/TypeFactory";
|
|
7
8
|
import {
|
|
8
9
|
MetadataAliasType,
|
|
9
10
|
MetadataArray,
|
|
11
|
+
MetadataArrayType,
|
|
10
12
|
MetadataAtomic,
|
|
11
13
|
MetadataConstantValue,
|
|
12
14
|
MetadataEscaped,
|
|
@@ -14,9 +16,10 @@ import {
|
|
|
14
16
|
MetadataProperty,
|
|
15
17
|
MetadataSchema,
|
|
16
18
|
MetadataTuple,
|
|
19
|
+
MetadataTupleType,
|
|
20
|
+
decodeMetadataValue,
|
|
17
21
|
isRequiredOf,
|
|
18
22
|
isSoleLiteralOf,
|
|
19
|
-
sizeOf,
|
|
20
23
|
} from "../../internal/legacy";
|
|
21
24
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
22
25
|
import { StringUtil } from "../../utils/StringUtil";
|
|
@@ -24,10 +27,30 @@ import { FilePrinter } from "./FilePrinter";
|
|
|
24
27
|
import { ImportDictionary } from "./ImportDictionary";
|
|
25
28
|
import { SdkTypeTagProgrammer } from "./SdkTypeTagProgrammer";
|
|
26
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Writes the TypeScript type of a metadata.
|
|
32
|
+
*
|
|
33
|
+
* @evidence contracts/common.md#principled-implementation The namespace turns each member of the metadata into a type node and joins them as a union.
|
|
34
|
+
* @evidence contracts/common.md#clear-and-simple-design The schema facade and object writer use one writer per form; collection-body operations distinguish a named recursive definition from its nested references.
|
|
35
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A name that cannot be referenced is written inline.
|
|
36
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
37
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeProgrammer 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.
|
|
38
|
+
*/
|
|
27
39
|
export namespace SdkTypeProgrammer {
|
|
28
40
|
/* -----------------------------------------------------------
|
|
29
41
|
FACADE
|
|
30
42
|
----------------------------------------------------------- */
|
|
43
|
+
/**
|
|
44
|
+
* Returns the type of a metadata: the union of its any, null, undefined,
|
|
45
|
+
* escaped, constant, template, atomic, tuple, array, object, alias, and
|
|
46
|
+
* native and typed collection forms. An empty union emits never.
|
|
47
|
+
*
|
|
48
|
+
* @evidence contracts/common.md#principled-implementation Named objects, aliases and recursive collections use references; implicit objects and nonrecursive collections use inline bodies. A recursive declaration writes its collection body once, and nested uses return through references.
|
|
49
|
+
* @evidence contracts/common.md#clear-and-simple-design One function of ordered cases.
|
|
50
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The member order is fixed, supported resolved natives retain their type references, and empty unions use the TypeScript bottom type rather than an empty printed node.
|
|
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 SdkTypeProgrammer.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
|
+
*/
|
|
31
54
|
export const write =
|
|
32
55
|
(project: INestiaProject) =>
|
|
33
56
|
(importer: ImportDictionary) =>
|
|
@@ -43,7 +66,7 @@ export namespace SdkTypeProgrammer {
|
|
|
43
66
|
|
|
44
67
|
// ATOMIC TYPES
|
|
45
68
|
for (const c of meta.constants)
|
|
46
|
-
for (const value of c.values) union.push(write_constant(value));
|
|
69
|
+
for (const value of c.values) union.push(write_constant(c.type, value));
|
|
47
70
|
for (const tpl of meta.templates)
|
|
48
71
|
union.push(write_template(project)(importer)(tpl.row ?? tpl));
|
|
49
72
|
for (const atom of meta.atomics) union.push(write_atomic(importer)(atom));
|
|
@@ -68,15 +91,39 @@ export namespace SdkTypeProgrammer {
|
|
|
68
91
|
union.push(
|
|
69
92
|
writeAlias(project)(importer)(alias.type as MetadataAliasType),
|
|
70
93
|
);
|
|
71
|
-
for (const native of meta.natives)
|
|
72
|
-
|
|
73
|
-
|
|
94
|
+
for (const native of meta.natives) union.push(write_native(native.name));
|
|
95
|
+
for (const set of meta.sets)
|
|
96
|
+
union.push(
|
|
97
|
+
factory.createTypeReferenceNode("Set", [
|
|
98
|
+
write(project)(importer)(set.value),
|
|
99
|
+
]),
|
|
100
|
+
);
|
|
101
|
+
for (const map of meta.maps)
|
|
102
|
+
union.push(
|
|
103
|
+
factory.createTypeReferenceNode("Map", [
|
|
104
|
+
write(project)(importer)(map.key),
|
|
105
|
+
write(project)(importer)(map.value),
|
|
106
|
+
]),
|
|
107
|
+
);
|
|
74
108
|
|
|
75
|
-
return union.length ===
|
|
76
|
-
?
|
|
77
|
-
:
|
|
109
|
+
return union.length === 0
|
|
110
|
+
? TypeFactory.keyword("never")
|
|
111
|
+
: union.length === 1
|
|
112
|
+
? union[0]!
|
|
113
|
+
: factory.createUnionTypeNode(union);
|
|
78
114
|
};
|
|
79
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Returns the type of an object: the regular properties as one literal,
|
|
118
|
+
* intersected with each dynamic key's index signature. Both signature forms
|
|
119
|
+
* retain the metadata's readonly modifier.
|
|
120
|
+
*
|
|
121
|
+
* @evidence contracts/common.md#principled-implementation A key that is a sole literal is regular, and every other key is dynamic. Each property's mutability supplies the readonly modifier for its corresponding property or index signature.
|
|
122
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
123
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The cases are exhaustive over the keys.
|
|
124
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
125
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeProgrammer.write_object 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.
|
|
126
|
+
*/
|
|
80
127
|
export const write_object =
|
|
81
128
|
(project: INestiaProject) =>
|
|
82
129
|
(importer: ImportDictionary) =>
|
|
@@ -100,16 +147,26 @@ export namespace SdkTypeProgrammer {
|
|
|
100
147
|
(importer: ImportDictionary) =>
|
|
101
148
|
(meta: MetadataEscaped): TypeNode => {
|
|
102
149
|
if (
|
|
103
|
-
sizeOf(meta.original) === 1 &&
|
|
104
150
|
meta.original.natives.length === 1 &&
|
|
105
|
-
meta.original.natives[0]!.name === "Date"
|
|
151
|
+
meta.original.natives[0]!.name === "Date" &&
|
|
152
|
+
!meta.original.any &&
|
|
153
|
+
meta.original.escaped === null &&
|
|
154
|
+
[
|
|
155
|
+
meta.original.atomics,
|
|
156
|
+
meta.original.constants,
|
|
157
|
+
meta.original.templates,
|
|
158
|
+
meta.original.arrays,
|
|
159
|
+
meta.original.tuples,
|
|
160
|
+
meta.original.objects,
|
|
161
|
+
meta.original.aliases,
|
|
162
|
+
meta.original.sets,
|
|
163
|
+
meta.original.maps,
|
|
164
|
+
meta.original.functions,
|
|
165
|
+
].every((members) => members.length === 0)
|
|
106
166
|
)
|
|
107
167
|
return factory.createIntersectionTypeNode([
|
|
108
168
|
TypeFactory.keyword("string"),
|
|
109
|
-
SdkTypeTagProgrammer.
|
|
110
|
-
name: "Format",
|
|
111
|
-
value: "date-time",
|
|
112
|
-
} as IMetadataTypeTag),
|
|
169
|
+
SdkTypeTagProgrammer.writePredefined(importer, "Format", "date-time"),
|
|
113
170
|
]);
|
|
114
171
|
return write(project)(importer)(meta.returns, true);
|
|
115
172
|
};
|
|
@@ -117,26 +174,24 @@ export namespace SdkTypeProgrammer {
|
|
|
117
174
|
/* -----------------------------------------------------------
|
|
118
175
|
ATOMICS
|
|
119
176
|
----------------------------------------------------------- */
|
|
120
|
-
const write_constant = (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return factory.createLiteralTypeNode(
|
|
127
|
-
value.value < BigInt(0)
|
|
128
|
-
? factory.createPrefixUnaryExpression(
|
|
129
|
-
SyntaxKind.MinusToken,
|
|
130
|
-
factory.createBigIntLiteral((-value.value).toString()),
|
|
131
|
-
)
|
|
132
|
-
: factory.createBigIntLiteral(value.value.toString()),
|
|
133
|
-
);
|
|
134
|
-
else if (typeof value.value === "number")
|
|
177
|
+
const write_constant = (
|
|
178
|
+
type: string,
|
|
179
|
+
constant: MetadataConstantValue,
|
|
180
|
+
): TypeNode => {
|
|
181
|
+
const value: unknown = decodeMetadataValue(type, constant.value);
|
|
182
|
+
if (typeof value === "boolean")
|
|
135
183
|
return factory.createLiteralTypeNode(
|
|
136
|
-
|
|
184
|
+
value ? factory.createTrue() : factory.createFalse(),
|
|
137
185
|
);
|
|
186
|
+
else if (typeof value === "bigint")
|
|
187
|
+
return factory.createLiteralTypeNode(LiteralFactory.write(value) as any);
|
|
188
|
+
else if (typeof value === "number")
|
|
189
|
+
// NaN is the one number with no literal type
|
|
190
|
+
return Number.isNaN(value)
|
|
191
|
+
? TypeFactory.keyword("number")
|
|
192
|
+
: factory.createLiteralTypeNode(ExpressionFactory.number(value));
|
|
138
193
|
return factory.createLiteralTypeNode(
|
|
139
|
-
factory.createStringLiteral(value
|
|
194
|
+
factory.createStringLiteral(value as string),
|
|
140
195
|
);
|
|
141
196
|
};
|
|
142
197
|
|
|
@@ -212,7 +267,9 @@ export namespace SdkTypeProgrammer {
|
|
|
212
267
|
(meta: MetadataArray): TypeNode =>
|
|
213
268
|
write_type_tag_matrix(importer)(
|
|
214
269
|
"array",
|
|
215
|
-
|
|
270
|
+
meta.type!.recursive
|
|
271
|
+
? writeAlias(project)(importer)(meta.type!)
|
|
272
|
+
: write_array_type(project)(importer)(meta.type!),
|
|
216
273
|
meta.tags,
|
|
217
274
|
);
|
|
218
275
|
|
|
@@ -220,8 +277,42 @@ export namespace SdkTypeProgrammer {
|
|
|
220
277
|
(project: INestiaProject) =>
|
|
221
278
|
(importer: ImportDictionary) =>
|
|
222
279
|
(meta: MetadataTuple): TypeNode =>
|
|
280
|
+
meta.type!.recursive
|
|
281
|
+
? writeAlias(project)(importer)(meta.type!)
|
|
282
|
+
: write_tuple_type(project)(importer)(meta.type!);
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Writes an array definition's body, using named references for recursive
|
|
286
|
+
* collections reached through its element schema.
|
|
287
|
+
*
|
|
288
|
+
* @evidence contracts/common.md#principled-implementation A declaration needs one array body while its nested use sites use the ordinary writer's recursive references, so X=X[] is finite and retains its element meaning.
|
|
289
|
+
* @evidence contracts/common.md#clear-and-simple-design One array node delegates its element to write.
|
|
290
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The declaration operation is distinct from reference emission and adds no test-only flags or names.
|
|
291
|
+
* @evidence contracts/common.md#meaningful-documentation The comment distinguishes a definition body from nested references.
|
|
292
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeProgrammer.write_array_type 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.
|
|
293
|
+
*/
|
|
294
|
+
export const write_array_type =
|
|
295
|
+
(project: INestiaProject) =>
|
|
296
|
+
(importer: ImportDictionary) =>
|
|
297
|
+
(meta: MetadataArrayType): TypeNode =>
|
|
298
|
+
factory.createArrayTypeNode(write(project)(importer)(meta.value));
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Writes a tuple definition's body, retaining optional and rest elements
|
|
302
|
+
* while nested recursive collections use named references.
|
|
303
|
+
*
|
|
304
|
+
* @evidence contracts/common.md#principled-implementation Each element retains its optional/rest form and schema; nested uses return through write, whose recursive reference branch terminates self and mutual collection cycles.
|
|
305
|
+
* @evidence contracts/common.md#clear-and-simple-design One element map creates the tuple body.
|
|
306
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The same body operation serves ordinary inline tuples and recursive declarations without special-cased source names.
|
|
307
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the definition body and modifier responsibilities.
|
|
308
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeProgrammer.write_tuple_type 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.
|
|
309
|
+
*/
|
|
310
|
+
export const write_tuple_type =
|
|
311
|
+
(project: INestiaProject) =>
|
|
312
|
+
(importer: ImportDictionary) =>
|
|
313
|
+
(meta: MetadataTupleType): TypeNode =>
|
|
223
314
|
factory.createTupleTypeNode(
|
|
224
|
-
meta.
|
|
315
|
+
meta.elements.map((elem) =>
|
|
225
316
|
elem.rest
|
|
226
317
|
? factory.createRestTypeNode(
|
|
227
318
|
factory.createArrayTypeNode(
|
|
@@ -246,7 +337,9 @@ export namespace SdkTypeProgrammer {
|
|
|
246
337
|
p.jsDocTags,
|
|
247
338
|
);
|
|
248
339
|
const signature = factory.createPropertySignature(
|
|
249
|
-
|
|
340
|
+
p.mutability === "readonly"
|
|
341
|
+
? [factory.createModifier(SyntaxKind.ReadonlyKeyword)]
|
|
342
|
+
: undefined,
|
|
250
343
|
NamingConvention.variable(
|
|
251
344
|
String(p.key.constants[0]!.values[0]!.value),
|
|
252
345
|
)
|
|
@@ -278,7 +371,9 @@ export namespace SdkTypeProgrammer {
|
|
|
278
371
|
factory.createTypeLiteralNode([
|
|
279
372
|
FilePrinter.description(
|
|
280
373
|
factory.createIndexSignature(
|
|
281
|
-
|
|
374
|
+
property.mutability === "readonly"
|
|
375
|
+
? [factory.createModifier(SyntaxKind.ReadonlyKeyword)]
|
|
376
|
+
: undefined,
|
|
282
377
|
[
|
|
283
378
|
factory.createParameterDeclaration(
|
|
284
379
|
undefined,
|
|
@@ -300,7 +395,13 @@ export namespace SdkTypeProgrammer {
|
|
|
300
395
|
const writeAlias =
|
|
301
396
|
(project: INestiaProject) =>
|
|
302
397
|
(importer: ImportDictionary) =>
|
|
303
|
-
(
|
|
398
|
+
(
|
|
399
|
+
meta:
|
|
400
|
+
| MetadataAliasType
|
|
401
|
+
| MetadataObjectType
|
|
402
|
+
| MetadataArrayType
|
|
403
|
+
| MetadataTupleType,
|
|
404
|
+
): TypeNode => {
|
|
304
405
|
importInternalFile(project)(importer)(meta.name);
|
|
305
406
|
// The reference has to spell the accessor path the declaration was
|
|
306
407
|
// written under, not the raw metadata name: a duplicated name carries
|