@nestia/sdk 14.0.1 → 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/assets/bundle/distribute/build-sdk.cjs +28 -0
- package/assets/bundle/distribute/package.json +6 -2
- package/lib/INestiaConfig.d.ts +55 -24
- package/lib/NestiaSdkApplication.d.ts +60 -0
- package/lib/NestiaSdkApplication.js +63 -5
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/NestiaSwaggerComposer.d.ts +21 -0
- package/lib/NestiaSwaggerComposer.js +21 -3
- package/lib/NestiaSwaggerComposer.js.map +1 -1
- package/lib/analyses/AccessorAnalyzer.d.ts +26 -0
- package/lib/analyses/AccessorAnalyzer.js +26 -0
- package/lib/analyses/AccessorAnalyzer.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.d.ts +41 -0
- package/lib/analyses/ConfigAnalyzer.js +48 -73
- package/lib/analyses/ConfigAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts +25 -0
- package/lib/analyses/ImportAnalyzer.js +25 -0
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/analyses/ParameterNameAnalyzer.d.ts +24 -0
- package/lib/analyses/ParameterNameAnalyzer.js +15 -0
- package/lib/analyses/ParameterNameAnalyzer.js.map +1 -1
- package/lib/analyses/PathAnalyzer.d.ts +63 -1
- package/lib/analyses/PathAnalyzer.js +54 -9
- package/lib/analyses/PathAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectControllerAnalyzer.js +22 -0
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +28 -17
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.d.ts +31 -0
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js +21 -0
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +31 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +21 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +22 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectMcpOperationAnalyzer.js +30 -9
- package/lib/analyses/ReflectMcpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMetadataAnalyzer.d.ts +47 -0
- package/lib/analyses/ReflectMetadataAnalyzer.js +47 -0
- package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +21 -2
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/SecurityAnalyzer.d.ts +15 -0
- package/lib/analyses/SecurityAnalyzer.js +15 -0
- package/lib/analyses/SecurityAnalyzer.js.map +1 -1
- package/lib/analyses/SwaggerExampleAnalyzer.d.ts +16 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js +16 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js.map +1 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +41 -3
- package/lib/analyses/TypedHttpRouteAnalyzer.js +172 -157
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedMcpRouteAnalyzer.d.ts +29 -0
- package/lib/analyses/TypedMcpRouteAnalyzer.js +152 -20
- package/lib/analyses/TypedMcpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +19 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +19 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
- package/lib/decorators/OperationMetadata.d.ts +6 -0
- package/lib/decorators/OperationMetadata.js +6 -0
- package/lib/decorators/OperationMetadata.js.map +1 -1
- package/lib/executable/internal/CommandParser.d.ts +19 -0
- package/lib/executable/internal/CommandParser.js +19 -0
- package/lib/executable/internal/CommandParser.js.map +1 -1
- package/lib/executable/internal/NestiaConfigLoader.d.ts +56 -0
- package/lib/executable/internal/NestiaConfigLoader.js +48 -42
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.d.ts +60 -0
- package/lib/executable/internal/NestiaSdkCommand.js +95 -3
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/internal/NestiaSdkWatcher.d.ts +81 -0
- package/lib/executable/internal/NestiaSdkWatcher.js +122 -38
- package/lib/executable/internal/NestiaSdkWatcher.js.map +1 -1
- package/lib/executable/internal/NestiaSwaggerWatch.d.ts +80 -0
- package/lib/executable/internal/NestiaSwaggerWatch.js +308 -0
- package/lib/executable/internal/NestiaSwaggerWatch.js.map +1 -0
- package/lib/factories/ExpressionFactory.d.ts +17 -2
- package/lib/factories/ExpressionFactory.js +17 -2
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +24 -0
- package/lib/factories/IdentifierFactory.js +24 -0
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/LiteralFactory.d.ts +22 -4
- package/lib/factories/LiteralFactory.js +30 -10
- package/lib/factories/LiteralFactory.js.map +1 -1
- package/lib/factories/StatementFactory.d.ts +28 -1
- package/lib/factories/StatementFactory.js +28 -1
- package/lib/factories/StatementFactory.js.map +1 -1
- package/lib/factories/TypeFactory.d.ts +24 -0
- package/lib/factories/TypeFactory.js +15 -0
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/generates/CloneGenerator.d.ts +22 -0
- package/lib/generates/CloneGenerator.js +26 -5
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/E2eGenerator.d.ts +19 -0
- package/lib/generates/E2eGenerator.js +19 -0
- package/lib/generates/E2eGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.d.ts +38 -0
- package/lib/generates/SdkGenerator.js +40 -2
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts +36 -6
- package/lib/generates/SwaggerGenerator.js +55 -13
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.d.ts +19 -0
- package/lib/generates/internal/E2eFileProgrammer.js +20 -1
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +43 -0
- package/lib/generates/internal/FilePrinter.js +43 -0
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +92 -2
- package/lib/generates/internal/ImportDictionary.js +91 -3
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +119 -0
- package/lib/generates/internal/SdkAliasCollection.js +124 -7
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +19 -0
- package/lib/generates/internal/SdkDistributionComposer.js +98 -59
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +29 -0
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +33 -0
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpCloneReferencer.js +78 -25
- package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +19 -0
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +104 -2
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +70 -0
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +38 -0
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +49 -5
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkImportWizard.d.ts +63 -0
- package/lib/generates/internal/SdkImportWizard.js +63 -0
- package/lib/generates/internal/SdkImportWizard.js.map +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +17 -2
- package/lib/generates/internal/SdkMcpRouteProgrammer.js +33 -13
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkPathTemplate.d.ts +15 -0
- package/lib/generates/internal/SdkPathTemplate.js +15 -0
- package/lib/generates/internal/SdkPathTemplate.js.map +1 -1
- package/lib/generates/internal/SdkRouteDirectory.d.ts +10 -0
- package/lib/generates/internal/SdkRouteDirectory.js +10 -0
- package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +54 -1
- package/lib/generates/internal/SdkTypeProgrammer.js +96 -12
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +36 -3
- package/lib/generates/internal/SdkTypeTagProgrammer.js +28 -7
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.d.ts +40 -0
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js +149 -142
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +19 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +81 -2
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +48 -0
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +42 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationComposer.d.ts +18 -0
- package/lib/generates/internal/SwaggerOperationComposer.js +18 -0
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +39 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +31 -8
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +19 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +19 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
- package/lib/internal/legacy.d.ts +296 -16
- package/lib/internal/legacy.js +127 -10
- package/lib/internal/legacy.js.map +1 -1
- package/lib/structures/INestiaProject.d.ts +10 -0
- package/lib/structures/INestiaSdkInput.d.ts +30 -0
- package/lib/structures/IOperationMetadata.d.ts +55 -0
- package/lib/structures/IReflectController.d.ts +10 -0
- package/lib/structures/IReflectHttpOperation.d.ts +10 -0
- package/lib/structures/IReflectHttpOperationException.d.ts +10 -0
- package/lib/structures/IReflectHttpOperationParameter.d.ts +47 -0
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +11 -0
- package/lib/structures/IReflectImport.d.ts +10 -0
- package/lib/structures/IReflectMcpOperation.d.ts +19 -0
- package/lib/structures/IReflectMcpOperationParameter.d.ts +9 -0
- package/lib/structures/IReflectOperationError.d.ts +28 -0
- package/lib/structures/IReflectOperationError.js +22 -2
- package/lib/structures/IReflectOperationError.js.map +1 -1
- package/lib/structures/IReflectType.d.ts +9 -0
- package/lib/structures/IReflectWebSocketOperation.d.ts +10 -0
- package/lib/structures/IReflectWebSocketOperationParameter.d.ts +55 -0
- package/lib/structures/ITypedApplication.d.ts +10 -0
- package/lib/structures/ITypedHttpRoute.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteException.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteParameter.d.ts +45 -0
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +10 -0
- package/lib/structures/ITypedMcpRoute.d.ts +11 -0
- package/lib/structures/ITypedWebSocketRoute.d.ts +10 -0
- package/lib/transform.d.ts +6 -0
- package/lib/transform.js +6 -0
- package/lib/transform.js.map +1 -1
- package/lib/utils/ArrayUtil.d.ts +31 -1
- package/lib/utils/ArrayUtil.js +32 -11
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/EmittedJavaScriptPatcher.d.ts +20 -0
- package/lib/utils/EmittedJavaScriptPatcher.js +65 -46
- package/lib/utils/EmittedJavaScriptPatcher.js.map +1 -1
- package/lib/utils/FileRetriever.d.ts +29 -0
- package/lib/utils/FileRetriever.js +29 -0
- package/lib/utils/FileRetriever.js.map +1 -1
- package/lib/utils/HttpResponseContentTypeUtil.d.ts +41 -0
- package/lib/utils/HttpResponseContentTypeUtil.js +31 -0
- package/lib/utils/HttpResponseContentTypeUtil.js.map +1 -1
- package/lib/utils/MapUtil.d.ts +64 -1
- package/lib/utils/MapUtil.js +24 -3
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/PathUtil.d.ts +31 -0
- package/lib/utils/PathUtil.js +38 -0
- package/lib/utils/PathUtil.js.map +1 -1
- package/lib/utils/SdkBundlePath.d.ts +2 -0
- package/lib/utils/SdkBundlePath.js +10 -0
- package/lib/utils/SdkBundlePath.js.map +1 -0
- package/lib/utils/SdkInputFilter.d.ts +31 -0
- package/lib/utils/SdkInputFilter.js +115 -0
- package/lib/utils/SdkInputFilter.js.map +1 -0
- package/lib/utils/SourceFinder.d.ts +35 -0
- package/lib/utils/SourceFinder.js +47 -12
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/StringUtil.d.ts +77 -2
- package/lib/utils/StringUtil.js +166 -4
- package/lib/utils/StringUtil.js.map +1 -1
- package/lib/utils/TemporaryDirectory.d.ts +60 -0
- package/lib/utils/TemporaryDirectory.js +112 -0
- package/lib/utils/TemporaryDirectory.js.map +1 -0
- package/lib/utils/TsConfigReader.d.ts +42 -0
- package/lib/utils/TsConfigReader.js +98 -14
- package/lib/utils/TsConfigReader.js.map +1 -1
- package/lib/utils/TtscExecutor.d.ts +23 -1
- package/lib/utils/TtscExecutor.js +22 -0
- package/lib/utils/TtscExecutor.js.map +1 -1
- package/lib/utils/VersioningStrategy.d.ts +26 -1
- package/lib/utils/VersioningStrategy.js +30 -9
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/lib/validators/TextPlainValidator.d.ts +19 -0
- package/lib/validators/TextPlainValidator.js +19 -0
- package/lib/validators/TextPlainValidator.js.map +1 -1
- package/native/go.mod +1 -1
- package/native/go.sum +2 -2
- package/native/sdk/register.go +12 -2
- package/native/sdk/sdk_metadata_json.go +6 -1
- package/native/sdk/sdk_transform.go +388 -397
- package/package.json +7 -5
- package/src/INestiaConfig.ts +55 -24
- package/src/NestiaSdkApplication.ts +66 -7
- package/src/NestiaSwaggerComposer.ts +21 -6
- package/src/analyses/AccessorAnalyzer.ts +26 -0
- package/src/analyses/ConfigAnalyzer.ts +49 -87
- package/src/analyses/ImportAnalyzer.ts +25 -0
- package/src/analyses/ParameterNameAnalyzer.ts +24 -0
- package/src/analyses/PathAnalyzer.ts +63 -11
- package/src/analyses/ReflectControllerAnalyzer.ts +32 -0
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +32 -10
- package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +32 -0
- package/src/analyses/ReflectMcpOperationAnalyzer.ts +32 -1
- package/src/analyses/ReflectMetadataAnalyzer.ts +47 -0
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +33 -4
- package/src/analyses/SecurityAnalyzer.ts +15 -0
- package/src/analyses/SwaggerExampleAnalyzer.ts +16 -0
- package/src/analyses/TypedHttpRouteAnalyzer.ts +240 -184
- package/src/analyses/TypedMcpRouteAnalyzer.ts +180 -20
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +19 -0
- package/src/decorators/OperationMetadata.ts +6 -0
- package/src/executable/internal/CommandParser.ts +19 -0
- package/src/executable/internal/NestiaConfigLoader.ts +66 -50
- package/src/executable/internal/NestiaSdkCommand.ts +96 -3
- package/src/executable/internal/NestiaSdkWatcher.ts +169 -41
- package/src/executable/internal/NestiaSwaggerWatch.ts +359 -0
- package/src/factories/ExpressionFactory.ts +17 -2
- package/src/factories/IdentifierFactory.ts +24 -0
- package/src/factories/LiteralFactory.ts +44 -11
- package/src/factories/StatementFactory.ts +28 -1
- package/src/factories/TypeFactory.ts +24 -0
- package/src/generates/CloneGenerator.ts +26 -5
- package/src/generates/E2eGenerator.ts +19 -0
- package/src/generates/SdkGenerator.ts +40 -9
- package/src/generates/SwaggerGenerator.ts +56 -14
- package/src/generates/internal/E2eFileProgrammer.ts +20 -0
- package/src/generates/internal/FilePrinter.ts +43 -0
- package/src/generates/internal/ImportDictionary.ts +110 -3
- package/src/generates/internal/SdkAliasCollection.ts +133 -11
- package/src/generates/internal/SdkDistributionComposer.ts +117 -66
- package/src/generates/internal/SdkFileProgrammer.ts +18 -0
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +55 -0
- package/src/generates/internal/SdkHttpCloneReferencer.ts +97 -23
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +19 -0
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +19 -0
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +104 -2
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +20 -0
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +72 -5
- package/src/generates/internal/SdkImportWizard.ts +63 -0
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +38 -18
- package/src/generates/internal/SdkPathTemplate.ts +15 -0
- package/src/generates/internal/SdkRouteDirectory.ts +10 -0
- package/src/generates/internal/SdkTypeProgrammer.ts +118 -14
- package/src/generates/internal/SdkTypeTagProgrammer.ts +37 -7
- package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +185 -142
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +19 -0
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +81 -2
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +18 -0
- package/src/generates/internal/SwaggerDescriptionComposer.ts +47 -1
- package/src/generates/internal/SwaggerOperationComposer.ts +18 -0
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +41 -8
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +19 -0
- package/src/internal/legacy-augmentation.d.ts +16 -0
- package/src/internal/legacy.ts +296 -26
- package/src/structures/INestiaProject.ts +10 -0
- package/src/structures/INestiaSdkInput.ts +30 -0
- package/src/structures/IOperationMetadata.ts +55 -0
- package/src/structures/IReflectController.ts +10 -0
- package/src/structures/IReflectHttpOperation.ts +10 -0
- package/src/structures/IReflectHttpOperationException.ts +10 -0
- package/src/structures/IReflectHttpOperationParameter.ts +47 -0
- package/src/structures/IReflectHttpOperationSuccess.ts +11 -0
- package/src/structures/IReflectImport.ts +10 -0
- package/src/structures/IReflectMcpOperation.ts +19 -0
- package/src/structures/IReflectMcpOperationParameter.ts +9 -0
- package/src/structures/IReflectOperationError.ts +31 -2
- package/src/structures/IReflectType.ts +9 -0
- package/src/structures/IReflectWebSocketOperation.ts +10 -0
- package/src/structures/IReflectWebSocketOperationParameter.ts +55 -0
- package/src/structures/ITypedApplication.ts +10 -0
- package/src/structures/ITypedHttpRoute.ts +10 -0
- package/src/structures/ITypedHttpRouteException.ts +10 -0
- package/src/structures/ITypedHttpRouteParameter.ts +45 -0
- package/src/structures/ITypedHttpRouteSuccess.ts +10 -0
- package/src/structures/ITypedMcpRoute.ts +12 -0
- package/src/structures/ITypedWebSocketRoute.ts +10 -0
- package/src/transform.ts +6 -0
- package/src/utils/ArrayUtil.ts +32 -13
- package/src/utils/EmittedJavaScriptPatcher.ts +70 -47
- package/src/utils/FileRetriever.ts +29 -0
- package/src/utils/HttpResponseContentTypeUtil.ts +41 -0
- package/src/utils/MapUtil.ts +68 -3
- package/src/utils/PathUtil.ts +38 -0
- package/src/utils/SdkBundlePath.ts +11 -0
- package/src/utils/SdkInputFilter.ts +108 -0
- package/src/utils/SourceFinder.ts +51 -14
- package/src/utils/StringUtil.ts +182 -5
- package/src/utils/TemporaryDirectory.ts +108 -0
- package/src/utils/TsConfigReader.ts +124 -26
- package/src/utils/TtscExecutor.ts +23 -1
- package/src/utils/VersioningStrategy.ts +33 -13
- package/src/validators/TextPlainValidator.ts +19 -0
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.d.ts +0 -9
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js +0 -178
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js.map +0 -1
- package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +0 -264
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
import { ImportDictionary } from "./ImportDictionary";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The imports of the SDK's runtime dependencies.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/common.md#principled-implementation The namespace names each dependency once so every generator registers it the same way.
|
|
7
|
+
* @evidence contracts/common.md#clear-and-simple-design Six one-call helpers.
|
|
8
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Each helper registers one fixed import.
|
|
9
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
10
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkImportWizard 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.
|
|
11
|
+
*/
|
|
3
12
|
export namespace SdkImportWizard {
|
|
13
|
+
/**
|
|
14
|
+
* Returns the import of the fetcher: the encrypted one or the plain one.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation The choice follows the route.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design One conditional.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It returns the registering function.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkImportWizard.Fetcher 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.
|
|
21
|
+
*/
|
|
4
22
|
export const Fetcher = (encrypted: boolean) =>
|
|
5
23
|
encrypted ? EncryptedFetcher : PlainFetcher;
|
|
6
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Registers `HttpError` of `@nestia/fetcher`.
|
|
27
|
+
*
|
|
28
|
+
* @evidence contracts/common.md#principled-implementation It is a type import.
|
|
29
|
+
* @evidence contracts/common.md#clear-and-simple-design One call.
|
|
30
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The import is fixed.
|
|
31
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
32
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkImportWizard.HttpError 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.
|
|
33
|
+
*/
|
|
7
34
|
export const HttpError = (importer: ImportDictionary) =>
|
|
8
35
|
importer.external({
|
|
9
36
|
declaration: true,
|
|
@@ -12,6 +39,15 @@ export namespace SdkImportWizard {
|
|
|
12
39
|
name: "HttpError",
|
|
13
40
|
});
|
|
14
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Registers `IConnection` of `@nestia/fetcher`.
|
|
44
|
+
*
|
|
45
|
+
* @evidence contracts/common.md#principled-implementation It is a type import.
|
|
46
|
+
* @evidence contracts/common.md#clear-and-simple-design One call.
|
|
47
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The import is fixed.
|
|
48
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
49
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkImportWizard.IConnection 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.
|
|
50
|
+
*/
|
|
15
51
|
export const IConnection = (importer: ImportDictionary) =>
|
|
16
52
|
importer.external({
|
|
17
53
|
declaration: true,
|
|
@@ -20,6 +56,15 @@ export namespace SdkImportWizard {
|
|
|
20
56
|
name: "IConnection",
|
|
21
57
|
});
|
|
22
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Registers `Primitive` of `typia`.
|
|
61
|
+
*
|
|
62
|
+
* @evidence contracts/common.md#principled-implementation It is a type import.
|
|
63
|
+
* @evidence contracts/common.md#clear-and-simple-design One call.
|
|
64
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The import is fixed.
|
|
65
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
66
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkImportWizard.Primitive 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.
|
|
67
|
+
*/
|
|
23
68
|
export const Primitive = (importer: ImportDictionary) =>
|
|
24
69
|
importer.external({
|
|
25
70
|
declaration: true,
|
|
@@ -28,6 +73,15 @@ export namespace SdkImportWizard {
|
|
|
28
73
|
name: "Primitive",
|
|
29
74
|
});
|
|
30
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Registers `Resolved` of `typia`.
|
|
78
|
+
*
|
|
79
|
+
* @evidence contracts/common.md#principled-implementation It is a type import.
|
|
80
|
+
* @evidence contracts/common.md#clear-and-simple-design One call.
|
|
81
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The import is fixed.
|
|
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 SdkImportWizard.Resolved 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
|
+
*/
|
|
31
85
|
export const Resolved = (importer: ImportDictionary) =>
|
|
32
86
|
importer.external({
|
|
33
87
|
declaration: true,
|
|
@@ -36,6 +90,15 @@ export namespace SdkImportWizard {
|
|
|
36
90
|
name: "Resolved",
|
|
37
91
|
});
|
|
38
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Registers the default import of `typia`.
|
|
95
|
+
*
|
|
96
|
+
* @evidence contracts/common.md#principled-implementation It is a value import.
|
|
97
|
+
* @evidence contracts/common.md#clear-and-simple-design One call.
|
|
98
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The import is fixed.
|
|
99
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
100
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkImportWizard.typia 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.
|
|
101
|
+
*/
|
|
39
102
|
export const typia = (importer: ImportDictionary) =>
|
|
40
103
|
importer.external({
|
|
41
104
|
declaration: false,
|
|
@@ -15,16 +15,32 @@ import { ITypedMcpRoute } from "../../structures/ITypedMcpRoute";
|
|
|
15
15
|
import { StringUtil } from "../../utils/StringUtil";
|
|
16
16
|
import { FilePrinter } from "./FilePrinter";
|
|
17
17
|
import { ImportDictionary } from "./ImportDictionary";
|
|
18
|
+
import { SdkTypeProgrammer } from "./SdkTypeProgrammer";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Emits a typed client wrapper for an MCP tool.
|
|
21
22
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* Cloned input and output declarations use the native JSON wire graph.
|
|
24
|
+
* Source-reference output types use `Primitive<T>` for the same JSON
|
|
25
|
+
* round-trip. Void MCP tools return `Promise<void>`.
|
|
24
26
|
*
|
|
25
27
|
* @author wildduck - https://github.com/wildduck2
|
|
28
|
+
* @evidence contracts/common.md#principled-implementation The namespace prints the wrapper that calls the tool and its metadata, and turns a tool error into an exception.
|
|
29
|
+
* @evidence contracts/common.md#clear-and-simple-design One public function and the writers.
|
|
30
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The function's identifiers yield to the tool's own name.
|
|
31
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
32
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkMcpRouteProgrammer composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
26
33
|
*/
|
|
27
34
|
export namespace SdkMcpRouteProgrammer {
|
|
35
|
+
/**
|
|
36
|
+
* Returns the function and the namespace of an MCP tool.
|
|
37
|
+
*
|
|
38
|
+
* @evidence contracts/common.md#principled-implementation The two nodes are composed together so they share names.
|
|
39
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
40
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The shape follows the tool metadata.
|
|
41
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
42
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkMcpRouteProgrammer.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.
|
|
43
|
+
*/
|
|
28
44
|
export const write =
|
|
29
45
|
(project: INestiaProject) =>
|
|
30
46
|
(importer: ImportDictionary) =>
|
|
@@ -67,7 +83,7 @@ export namespace SdkMcpRouteProgrammer {
|
|
|
67
83
|
alias: "McpCallToolResult",
|
|
68
84
|
});
|
|
69
85
|
const isVoid = isVoidReturn(route);
|
|
70
|
-
if (!isVoid)
|
|
86
|
+
if (!isVoid && _project.config.clone !== true)
|
|
71
87
|
importer.external({
|
|
72
88
|
declaration: true,
|
|
73
89
|
file: "typia",
|
|
@@ -315,7 +331,7 @@ export namespace SdkMcpRouteProgrammer {
|
|
|
315
331
|
};
|
|
316
332
|
|
|
317
333
|
const writeNamespace =
|
|
318
|
-
(
|
|
334
|
+
(project: INestiaProject) =>
|
|
319
335
|
(importer: ImportDictionary) =>
|
|
320
336
|
(route: ITypedMcpRoute): Node => {
|
|
321
337
|
const statements: Statement[] = [];
|
|
@@ -326,25 +342,29 @@ export namespace SdkMcpRouteProgrammer {
|
|
|
326
342
|
[factory.createModifier(SyntaxKind.ExportKeyword)],
|
|
327
343
|
"Input",
|
|
328
344
|
undefined,
|
|
329
|
-
|
|
345
|
+
project.config.clone === true && route.inputMetadata
|
|
346
|
+
? SdkTypeProgrammer.write(project)(importer)(route.inputMetadata)
|
|
347
|
+
: factory.createTypeReferenceNode(route.input.type.name),
|
|
330
348
|
),
|
|
331
349
|
);
|
|
332
350
|
|
|
333
351
|
const outputType: Node =
|
|
334
352
|
!isVoidReturn(route) && route.returnType !== null
|
|
335
|
-
?
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
353
|
+
? project.config.clone === true && route.outputMetadata
|
|
354
|
+
? SdkTypeProgrammer.write(project)(importer)(route.outputMetadata)
|
|
355
|
+
: factory.createTypeReferenceNode(
|
|
356
|
+
importer.external({
|
|
357
|
+
declaration: true,
|
|
358
|
+
file: "typia",
|
|
359
|
+
type: "element",
|
|
360
|
+
name: "Primitive",
|
|
361
|
+
}),
|
|
362
|
+
[
|
|
363
|
+
factory.createTypeReferenceNode(
|
|
364
|
+
unwrapPromise(route.returnType.name),
|
|
365
|
+
),
|
|
366
|
+
],
|
|
367
|
+
)
|
|
348
368
|
: factory.createKeywordTypeNode(SyntaxKind.VoidKeyword);
|
|
349
369
|
statements.push(
|
|
350
370
|
factory.createTypeAliasDeclaration(
|
|
@@ -4,6 +4,15 @@ import { PathAnalyzer } from "../../analyses/PathAnalyzer";
|
|
|
4
4
|
import { IdentifierFactory } from "../../factories/IdentifierFactory";
|
|
5
5
|
import { ImportDictionary } from "./ImportDictionary";
|
|
6
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
|
+
*/
|
|
7
16
|
export namespace SdkPathTemplate {
|
|
8
17
|
/**
|
|
9
18
|
* The expression an SDK function builds its route's path with: the literal
|
|
@@ -16,6 +25,12 @@ export namespace SdkPathTemplate {
|
|
|
16
25
|
* router reads the path, so a parameter with literal text beside it in its
|
|
17
26
|
* segment, such as `/files/:id.json` or `/range/:from-:to`, is filled in
|
|
18
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.
|
|
19
34
|
*/
|
|
20
35
|
export const compose = (props: {
|
|
21
36
|
importer: ImportDictionary;
|
|
@@ -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>;
|
|
@@ -8,6 +8,7 @@ import { TypeFactory } from "../../factories/TypeFactory";
|
|
|
8
8
|
import {
|
|
9
9
|
MetadataAliasType,
|
|
10
10
|
MetadataArray,
|
|
11
|
+
MetadataArrayType,
|
|
11
12
|
MetadataAtomic,
|
|
12
13
|
MetadataConstantValue,
|
|
13
14
|
MetadataEscaped,
|
|
@@ -15,10 +16,10 @@ import {
|
|
|
15
16
|
MetadataProperty,
|
|
16
17
|
MetadataSchema,
|
|
17
18
|
MetadataTuple,
|
|
19
|
+
MetadataTupleType,
|
|
18
20
|
decodeMetadataValue,
|
|
19
21
|
isRequiredOf,
|
|
20
22
|
isSoleLiteralOf,
|
|
21
|
-
sizeOf,
|
|
22
23
|
} from "../../internal/legacy";
|
|
23
24
|
import { INestiaProject } from "../../structures/INestiaProject";
|
|
24
25
|
import { StringUtil } from "../../utils/StringUtil";
|
|
@@ -26,10 +27,30 @@ import { FilePrinter } from "./FilePrinter";
|
|
|
26
27
|
import { ImportDictionary } from "./ImportDictionary";
|
|
27
28
|
import { SdkTypeTagProgrammer } from "./SdkTypeTagProgrammer";
|
|
28
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
|
+
*/
|
|
29
39
|
export namespace SdkTypeProgrammer {
|
|
30
40
|
/* -----------------------------------------------------------
|
|
31
41
|
FACADE
|
|
32
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
|
+
*/
|
|
33
54
|
export const write =
|
|
34
55
|
(project: INestiaProject) =>
|
|
35
56
|
(importer: ImportDictionary) =>
|
|
@@ -70,15 +91,39 @@ export namespace SdkTypeProgrammer {
|
|
|
70
91
|
union.push(
|
|
71
92
|
writeAlias(project)(importer)(alias.type as MetadataAliasType),
|
|
72
93
|
);
|
|
73
|
-
for (const native of meta.natives)
|
|
74
|
-
|
|
75
|
-
|
|
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
|
+
);
|
|
76
108
|
|
|
77
|
-
return union.length ===
|
|
78
|
-
?
|
|
79
|
-
:
|
|
109
|
+
return union.length === 0
|
|
110
|
+
? TypeFactory.keyword("never")
|
|
111
|
+
: union.length === 1
|
|
112
|
+
? union[0]!
|
|
113
|
+
: factory.createUnionTypeNode(union);
|
|
80
114
|
};
|
|
81
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
|
+
*/
|
|
82
127
|
export const write_object =
|
|
83
128
|
(project: INestiaProject) =>
|
|
84
129
|
(importer: ImportDictionary) =>
|
|
@@ -102,9 +147,22 @@ export namespace SdkTypeProgrammer {
|
|
|
102
147
|
(importer: ImportDictionary) =>
|
|
103
148
|
(meta: MetadataEscaped): TypeNode => {
|
|
104
149
|
if (
|
|
105
|
-
sizeOf(meta.original) === 1 &&
|
|
106
150
|
meta.original.natives.length === 1 &&
|
|
107
|
-
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)
|
|
108
166
|
)
|
|
109
167
|
return factory.createIntersectionTypeNode([
|
|
110
168
|
TypeFactory.keyword("string"),
|
|
@@ -209,7 +267,9 @@ export namespace SdkTypeProgrammer {
|
|
|
209
267
|
(meta: MetadataArray): TypeNode =>
|
|
210
268
|
write_type_tag_matrix(importer)(
|
|
211
269
|
"array",
|
|
212
|
-
|
|
270
|
+
meta.type!.recursive
|
|
271
|
+
? writeAlias(project)(importer)(meta.type!)
|
|
272
|
+
: write_array_type(project)(importer)(meta.type!),
|
|
213
273
|
meta.tags,
|
|
214
274
|
);
|
|
215
275
|
|
|
@@ -217,8 +277,42 @@ export namespace SdkTypeProgrammer {
|
|
|
217
277
|
(project: INestiaProject) =>
|
|
218
278
|
(importer: ImportDictionary) =>
|
|
219
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 =>
|
|
220
314
|
factory.createTupleTypeNode(
|
|
221
|
-
meta.
|
|
315
|
+
meta.elements.map((elem) =>
|
|
222
316
|
elem.rest
|
|
223
317
|
? factory.createRestTypeNode(
|
|
224
318
|
factory.createArrayTypeNode(
|
|
@@ -243,7 +337,9 @@ export namespace SdkTypeProgrammer {
|
|
|
243
337
|
p.jsDocTags,
|
|
244
338
|
);
|
|
245
339
|
const signature = factory.createPropertySignature(
|
|
246
|
-
|
|
340
|
+
p.mutability === "readonly"
|
|
341
|
+
? [factory.createModifier(SyntaxKind.ReadonlyKeyword)]
|
|
342
|
+
: undefined,
|
|
247
343
|
NamingConvention.variable(
|
|
248
344
|
String(p.key.constants[0]!.values[0]!.value),
|
|
249
345
|
)
|
|
@@ -275,7 +371,9 @@ export namespace SdkTypeProgrammer {
|
|
|
275
371
|
factory.createTypeLiteralNode([
|
|
276
372
|
FilePrinter.description(
|
|
277
373
|
factory.createIndexSignature(
|
|
278
|
-
|
|
374
|
+
property.mutability === "readonly"
|
|
375
|
+
? [factory.createModifier(SyntaxKind.ReadonlyKeyword)]
|
|
376
|
+
: undefined,
|
|
279
377
|
[
|
|
280
378
|
factory.createParameterDeclaration(
|
|
281
379
|
undefined,
|
|
@@ -297,7 +395,13 @@ export namespace SdkTypeProgrammer {
|
|
|
297
395
|
const writeAlias =
|
|
298
396
|
(project: INestiaProject) =>
|
|
299
397
|
(importer: ImportDictionary) =>
|
|
300
|
-
(
|
|
398
|
+
(
|
|
399
|
+
meta:
|
|
400
|
+
| MetadataAliasType
|
|
401
|
+
| MetadataObjectType
|
|
402
|
+
| MetadataArrayType
|
|
403
|
+
| MetadataTupleType,
|
|
404
|
+
): TypeNode => {
|
|
301
405
|
importInternalFile(project)(importer)(meta.name);
|
|
302
406
|
// The reference has to spell the accessor path the declaration was
|
|
303
407
|
// written under, not the raw metadata name: a duplicated name carries
|
|
@@ -5,7 +5,25 @@ import { LiteralFactory } from "../../factories/LiteralFactory";
|
|
|
5
5
|
import { decodeTagValue } from "../../internal/legacy";
|
|
6
6
|
import { ImportDictionary } from "./ImportDictionary";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Writes the type tags of a cloned DTO.
|
|
10
|
+
*
|
|
11
|
+
* @evidence contracts/common.md#principled-implementation Supported predefined tags require matching arguments and encoded validation, exclusivity and schema expansions; other tags are emitted from the metadata fields as tags.TagBase.
|
|
12
|
+
* @evidence contracts/common.md#clear-and-simple-design Two public functions over a table of predefined tags.
|
|
13
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The choice is decided by the expansion.
|
|
14
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
15
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeTagProgrammer 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.
|
|
16
|
+
*/
|
|
8
17
|
export namespace SdkTypeTagProgrammer {
|
|
18
|
+
/**
|
|
19
|
+
* The kinds of type a tag can be attached to.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/common.md#principled-implementation The six kinds are those the tags declare.
|
|
22
|
+
* @evidence contracts/common.md#clear-and-simple-design One union.
|
|
23
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
24
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
25
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeTagProgrammer.Target composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
26
|
+
*/
|
|
9
27
|
export type Target =
|
|
10
28
|
| "object"
|
|
11
29
|
| "array"
|
|
@@ -20,8 +38,9 @@ export namespace SdkTypeTagProgrammer {
|
|
|
20
38
|
* A tag prints as the predefined typia tag it matches, `tags.Minimum<3>`,
|
|
21
39
|
* only when that tag accepts the argument and, given it, expands to exactly
|
|
22
40
|
* the tag the metadata carries; then the two are the same type. Anything else
|
|
23
|
-
* prints in the generic `tags.TagBase<{ ... }>` form
|
|
24
|
-
*
|
|
41
|
+
* prints in the generic `tags.TagBase<{ ... }>` form using the native
|
|
42
|
+
* metadata's reported fields. This cannot recover source details absent from
|
|
43
|
+
* that metadata or composite values changed by JSON encoding.
|
|
25
44
|
*
|
|
26
45
|
* The tag's name cannot decide it. The SDK names a tag after its object type
|
|
27
46
|
* with the brackets and quotes a component name drops, `Minimum3` or
|
|
@@ -29,6 +48,12 @@ export namespace SdkTypeTagProgrammer {
|
|
|
29
48
|
* tag named alike (#1662). The expansion can: it is typia's declaration of
|
|
30
49
|
* each predefined tag, and should typia change one, the tag only falls back
|
|
31
50
|
* to the `TagBase` form.
|
|
51
|
+
*
|
|
52
|
+
* @evidence contracts/common.md#principled-implementation A tag prints as the predefined tag it matches only when that tag expands to exactly the tag the metadata carries.
|
|
53
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
54
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Generic tags retain the reported value, validation, exclusivity and schema fields; NaN has no literal type and is represented as null. Source details absent from native metadata are not claimed to be reconstructed.
|
|
55
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
56
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeTagProgrammer.write composes SDK syntax, identifiers or import bindings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
32
57
|
*/
|
|
33
58
|
export const write = (
|
|
34
59
|
importer: ImportDictionary,
|
|
@@ -60,7 +85,15 @@ export namespace SdkTypeTagProgrammer {
|
|
|
60
85
|
);
|
|
61
86
|
};
|
|
62
87
|
|
|
63
|
-
/**
|
|
88
|
+
/**
|
|
89
|
+
* Writes the predefined typia tag `tags.<name><argument>`.
|
|
90
|
+
*
|
|
91
|
+
* @evidence contracts/common.md#principled-implementation The name and argument were decided by the matching.
|
|
92
|
+
* @evidence contracts/common.md#clear-and-simple-design One node.
|
|
93
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The argument is written as a literal.
|
|
94
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the declaration produces and its result.
|
|
95
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation SdkTypeTagProgrammer.writePredefined 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.
|
|
96
|
+
*/
|
|
64
97
|
export const writePredefined = (
|
|
65
98
|
importer: ImportDictionary,
|
|
66
99
|
name: string,
|
|
@@ -289,10 +322,7 @@ const serialize = (value: string): string =>
|
|
|
289
322
|
})[char]!,
|
|
290
323
|
);
|
|
291
324
|
|
|
292
|
-
/**
|
|
293
|
-
* Every predefined typia tag, keyed by its kind, as `@typia/interface` declares
|
|
294
|
-
* it.
|
|
295
|
-
*/
|
|
325
|
+
/** Supported predefined typia tag expansions, keyed by their metadata kind. */
|
|
296
326
|
const DEFINITIONS: Record<string, IDefinition> = {
|
|
297
327
|
minimum: {
|
|
298
328
|
name: "Minimum",
|