@nestia/sdk 14.0.1 → 14.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/bundle/distribute/build-sdk.cjs +28 -0
- package/assets/bundle/distribute/package.json +6 -2
- package/lib/INestiaConfig.d.ts +55 -24
- package/lib/NestiaSdkApplication.d.ts +60 -0
- package/lib/NestiaSdkApplication.js +63 -5
- package/lib/NestiaSdkApplication.js.map +1 -1
- package/lib/NestiaSwaggerComposer.d.ts +21 -0
- package/lib/NestiaSwaggerComposer.js +21 -3
- package/lib/NestiaSwaggerComposer.js.map +1 -1
- package/lib/analyses/AccessorAnalyzer.d.ts +26 -0
- package/lib/analyses/AccessorAnalyzer.js +26 -0
- package/lib/analyses/AccessorAnalyzer.js.map +1 -1
- package/lib/analyses/ConfigAnalyzer.d.ts +41 -0
- package/lib/analyses/ConfigAnalyzer.js +57 -80
- package/lib/analyses/ConfigAnalyzer.js.map +1 -1
- package/lib/analyses/ImportAnalyzer.d.ts +25 -0
- package/lib/analyses/ImportAnalyzer.js +25 -0
- package/lib/analyses/ImportAnalyzer.js.map +1 -1
- package/lib/analyses/ParameterNameAnalyzer.d.ts +24 -0
- package/lib/analyses/ParameterNameAnalyzer.js +15 -0
- package/lib/analyses/ParameterNameAnalyzer.js.map +1 -1
- package/lib/analyses/PathAnalyzer.d.ts +63 -1
- package/lib/analyses/PathAnalyzer.js +54 -9
- package/lib/analyses/PathAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectControllerAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectControllerAnalyzer.js +22 -0
- package/lib/analyses/ReflectControllerAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectHttpOperationAnalyzer.js +28 -17
- package/lib/analyses/ReflectHttpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.d.ts +31 -0
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js +21 -0
- package/lib/analyses/ReflectHttpOperationExceptionAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.d.ts +31 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js +21 -0
- package/lib/analyses/ReflectHttpOperationParameterAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.d.ts +32 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js +22 -0
- package/lib/analyses/ReflectHttpOperationResponseAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMcpOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectMcpOperationAnalyzer.js +30 -9
- package/lib/analyses/ReflectMcpOperationAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectMetadataAnalyzer.d.ts +47 -0
- package/lib/analyses/ReflectMetadataAnalyzer.js +47 -0
- package/lib/analyses/ReflectMetadataAnalyzer.js.map +1 -1
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.d.ts +29 -0
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js +22 -5
- package/lib/analyses/ReflectWebSocketOperationAnalyzer.js.map +1 -1
- package/lib/analyses/SecurityAnalyzer.d.ts +15 -0
- package/lib/analyses/SecurityAnalyzer.js +15 -0
- package/lib/analyses/SecurityAnalyzer.js.map +1 -1
- package/lib/analyses/SwaggerExampleAnalyzer.d.ts +16 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js +16 -0
- package/lib/analyses/SwaggerExampleAnalyzer.js.map +1 -1
- package/lib/analyses/TypedHttpRouteAnalyzer.d.ts +41 -3
- package/lib/analyses/TypedHttpRouteAnalyzer.js +172 -157
- package/lib/analyses/TypedHttpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedMcpRouteAnalyzer.d.ts +29 -0
- package/lib/analyses/TypedMcpRouteAnalyzer.js +152 -20
- package/lib/analyses/TypedMcpRouteAnalyzer.js.map +1 -1
- package/lib/analyses/TypedWebSocketRouteAnalyzer.d.ts +19 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js +19 -0
- package/lib/analyses/TypedWebSocketRouteAnalyzer.js.map +1 -1
- package/lib/decorators/OperationMetadata.d.ts +6 -0
- package/lib/decorators/OperationMetadata.js +6 -0
- package/lib/decorators/OperationMetadata.js.map +1 -1
- package/lib/executable/internal/CommandParser.d.ts +19 -0
- package/lib/executable/internal/CommandParser.js +19 -0
- package/lib/executable/internal/CommandParser.js.map +1 -1
- package/lib/executable/internal/NestiaConfigLoader.d.ts +56 -0
- package/lib/executable/internal/NestiaConfigLoader.js +48 -42
- package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
- package/lib/executable/internal/NestiaSdkCommand.d.ts +60 -0
- package/lib/executable/internal/NestiaSdkCommand.js +95 -3
- package/lib/executable/internal/NestiaSdkCommand.js.map +1 -1
- package/lib/executable/internal/NestiaSdkWatcher.d.ts +81 -0
- package/lib/executable/internal/NestiaSdkWatcher.js +122 -38
- package/lib/executable/internal/NestiaSdkWatcher.js.map +1 -1
- package/lib/executable/internal/NestiaSwaggerWatch.d.ts +80 -0
- package/lib/executable/internal/NestiaSwaggerWatch.js +308 -0
- package/lib/executable/internal/NestiaSwaggerWatch.js.map +1 -0
- package/lib/factories/ExpressionFactory.d.ts +17 -2
- package/lib/factories/ExpressionFactory.js +17 -2
- package/lib/factories/ExpressionFactory.js.map +1 -1
- package/lib/factories/IdentifierFactory.d.ts +24 -0
- package/lib/factories/IdentifierFactory.js +24 -0
- package/lib/factories/IdentifierFactory.js.map +1 -1
- package/lib/factories/LiteralFactory.d.ts +22 -4
- package/lib/factories/LiteralFactory.js +30 -10
- package/lib/factories/LiteralFactory.js.map +1 -1
- package/lib/factories/StatementFactory.d.ts +28 -1
- package/lib/factories/StatementFactory.js +28 -1
- package/lib/factories/StatementFactory.js.map +1 -1
- package/lib/factories/TypeFactory.d.ts +24 -0
- package/lib/factories/TypeFactory.js +15 -0
- package/lib/factories/TypeFactory.js.map +1 -1
- package/lib/generates/CloneGenerator.d.ts +22 -0
- package/lib/generates/CloneGenerator.js +26 -5
- package/lib/generates/CloneGenerator.js.map +1 -1
- package/lib/generates/E2eGenerator.d.ts +19 -0
- package/lib/generates/E2eGenerator.js +19 -0
- package/lib/generates/E2eGenerator.js.map +1 -1
- package/lib/generates/SdkGenerator.d.ts +38 -0
- package/lib/generates/SdkGenerator.js +40 -2
- package/lib/generates/SdkGenerator.js.map +1 -1
- package/lib/generates/SwaggerGenerator.d.ts +36 -6
- package/lib/generates/SwaggerGenerator.js +55 -13
- package/lib/generates/SwaggerGenerator.js.map +1 -1
- package/lib/generates/internal/E2eFileProgrammer.d.ts +19 -0
- package/lib/generates/internal/E2eFileProgrammer.js +20 -1
- package/lib/generates/internal/E2eFileProgrammer.js.map +1 -1
- package/lib/generates/internal/FilePrinter.d.ts +43 -0
- package/lib/generates/internal/FilePrinter.js +43 -0
- package/lib/generates/internal/FilePrinter.js.map +1 -1
- package/lib/generates/internal/ImportDictionary.d.ts +92 -2
- package/lib/generates/internal/ImportDictionary.js +91 -3
- package/lib/generates/internal/ImportDictionary.js.map +1 -1
- package/lib/generates/internal/SdkAliasCollection.d.ts +119 -0
- package/lib/generates/internal/SdkAliasCollection.js +124 -7
- package/lib/generates/internal/SdkAliasCollection.js.map +1 -1
- package/lib/generates/internal/SdkDistributionComposer.d.ts +19 -0
- package/lib/generates/internal/SdkDistributionComposer.js +98 -59
- package/lib/generates/internal/SdkDistributionComposer.js.map +1 -1
- package/lib/generates/internal/SdkFileProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js +18 -0
- package/lib/generates/internal/SdkFileProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneProgrammer.d.ts +29 -0
- package/lib/generates/internal/SdkHttpCloneProgrammer.js +33 -0
- package/lib/generates/internal/SdkHttpCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpCloneReferencer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpCloneReferencer.js +78 -25
- package/lib/generates/internal/SdkHttpCloneReferencer.js.map +1 -1
- package/lib/generates/internal/SdkHttpFunctionProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js +19 -0
- package/lib/generates/internal/SdkHttpFunctionProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js +19 -0
- package/lib/generates/internal/SdkHttpNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpParameterProgrammer.d.ts +104 -2
- package/lib/generates/internal/SdkHttpParameterProgrammer.js +70 -0
- package/lib/generates/internal/SdkHttpParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpRouteProgrammer.d.ts +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js +20 -0
- package/lib/generates/internal/SdkHttpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkHttpSimulationProgrammer.d.ts +38 -0
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js +49 -5
- package/lib/generates/internal/SdkHttpSimulationProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkImportWizard.d.ts +63 -0
- package/lib/generates/internal/SdkImportWizard.js +63 -0
- package/lib/generates/internal/SdkImportWizard.js.map +1 -1
- package/lib/generates/internal/SdkMcpRouteProgrammer.d.ts +17 -2
- package/lib/generates/internal/SdkMcpRouteProgrammer.js +33 -13
- package/lib/generates/internal/SdkMcpRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkPathTemplate.d.ts +15 -0
- package/lib/generates/internal/SdkPathTemplate.js +15 -0
- package/lib/generates/internal/SdkPathTemplate.js.map +1 -1
- package/lib/generates/internal/SdkRouteDirectory.d.ts +10 -0
- package/lib/generates/internal/SdkRouteDirectory.js +10 -0
- package/lib/generates/internal/SdkRouteDirectory.js.map +1 -1
- package/lib/generates/internal/SdkTypeProgrammer.d.ts +54 -1
- package/lib/generates/internal/SdkTypeProgrammer.js +96 -12
- package/lib/generates/internal/SdkTypeProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkTypeTagProgrammer.d.ts +36 -3
- package/lib/generates/internal/SdkTypeTagProgrammer.js +28 -7
- package/lib/generates/internal/SdkTypeTagProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.d.ts +40 -0
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js +149 -142
- package/lib/generates/internal/SdkWebSocketCloneProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.d.ts +19 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js +19 -0
- package/lib/generates/internal/SdkWebSocketNamespaceProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.d.ts +81 -2
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js +48 -0
- package/lib/generates/internal/SdkWebSocketParameterProgrammer.js.map +1 -1
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.d.ts +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js +18 -0
- package/lib/generates/internal/SdkWebSocketRouteProgrammer.js.map +1 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.d.ts +42 -0
- package/lib/generates/internal/SwaggerDescriptionComposer.js +44 -1
- package/lib/generates/internal/SwaggerDescriptionComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationComposer.d.ts +18 -0
- package/lib/generates/internal/SwaggerOperationComposer.js +18 -0
- package/lib/generates/internal/SwaggerOperationComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationParameterComposer.d.ts +39 -0
- package/lib/generates/internal/SwaggerOperationParameterComposer.js +31 -8
- package/lib/generates/internal/SwaggerOperationParameterComposer.js.map +1 -1
- package/lib/generates/internal/SwaggerOperationResponseComposer.d.ts +19 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js +19 -0
- package/lib/generates/internal/SwaggerOperationResponseComposer.js.map +1 -1
- package/lib/internal/legacy.d.ts +296 -16
- package/lib/internal/legacy.js +127 -10
- package/lib/internal/legacy.js.map +1 -1
- package/lib/structures/INestiaProject.d.ts +10 -0
- package/lib/structures/INestiaSdkInput.d.ts +31 -1
- package/lib/structures/IOperationMetadata.d.ts +55 -0
- package/lib/structures/IReflectController.d.ts +11 -1
- package/lib/structures/IReflectHttpOperation.d.ts +11 -1
- package/lib/structures/IReflectHttpOperationException.d.ts +10 -0
- package/lib/structures/IReflectHttpOperationParameter.d.ts +47 -0
- package/lib/structures/IReflectHttpOperationSuccess.d.ts +11 -0
- package/lib/structures/IReflectImport.d.ts +10 -0
- package/lib/structures/IReflectMcpOperation.d.ts +19 -0
- package/lib/structures/IReflectMcpOperationParameter.d.ts +9 -0
- package/lib/structures/IReflectOperationError.d.ts +28 -0
- package/lib/structures/IReflectOperationError.js +22 -2
- package/lib/structures/IReflectOperationError.js.map +1 -1
- package/lib/structures/IReflectType.d.ts +9 -0
- package/lib/structures/IReflectWebSocketOperation.d.ts +10 -0
- package/lib/structures/IReflectWebSocketOperationParameter.d.ts +55 -0
- package/lib/structures/ITypedApplication.d.ts +10 -0
- package/lib/structures/ITypedHttpRoute.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteException.d.ts +10 -0
- package/lib/structures/ITypedHttpRouteParameter.d.ts +45 -0
- package/lib/structures/ITypedHttpRouteSuccess.d.ts +10 -0
- package/lib/structures/ITypedMcpRoute.d.ts +11 -0
- package/lib/structures/ITypedWebSocketRoute.d.ts +10 -0
- package/lib/transform.d.ts +6 -0
- package/lib/transform.js +6 -0
- package/lib/transform.js.map +1 -1
- package/lib/utils/ArrayUtil.d.ts +31 -1
- package/lib/utils/ArrayUtil.js +32 -11
- package/lib/utils/ArrayUtil.js.map +1 -1
- package/lib/utils/EmittedJavaScriptPatcher.d.ts +20 -0
- package/lib/utils/EmittedJavaScriptPatcher.js +65 -46
- package/lib/utils/EmittedJavaScriptPatcher.js.map +1 -1
- package/lib/utils/FileRetriever.d.ts +29 -0
- package/lib/utils/FileRetriever.js +29 -0
- package/lib/utils/FileRetriever.js.map +1 -1
- package/lib/utils/HttpResponseContentTypeUtil.d.ts +41 -0
- package/lib/utils/HttpResponseContentTypeUtil.js +31 -0
- package/lib/utils/HttpResponseContentTypeUtil.js.map +1 -1
- package/lib/utils/MapUtil.d.ts +64 -1
- package/lib/utils/MapUtil.js +24 -3
- package/lib/utils/MapUtil.js.map +1 -1
- package/lib/utils/PathUtil.d.ts +31 -0
- package/lib/utils/PathUtil.js +38 -0
- package/lib/utils/PathUtil.js.map +1 -1
- package/lib/utils/SdkBundlePath.d.ts +2 -0
- package/lib/utils/SdkBundlePath.js +10 -0
- package/lib/utils/SdkBundlePath.js.map +1 -0
- package/lib/utils/SdkInputFilter.d.ts +31 -0
- package/lib/utils/SdkInputFilter.js +115 -0
- package/lib/utils/SdkInputFilter.js.map +1 -0
- package/lib/utils/SourceFinder.d.ts +35 -0
- package/lib/utils/SourceFinder.js +47 -12
- package/lib/utils/SourceFinder.js.map +1 -1
- package/lib/utils/StringUtil.d.ts +77 -2
- package/lib/utils/StringUtil.js +166 -4
- package/lib/utils/StringUtil.js.map +1 -1
- package/lib/utils/TemporaryDirectory.d.ts +60 -0
- package/lib/utils/TemporaryDirectory.js +112 -0
- package/lib/utils/TemporaryDirectory.js.map +1 -0
- package/lib/utils/TsConfigReader.d.ts +42 -0
- package/lib/utils/TsConfigReader.js +98 -14
- package/lib/utils/TsConfigReader.js.map +1 -1
- package/lib/utils/TtscExecutor.d.ts +23 -1
- package/lib/utils/TtscExecutor.js +22 -0
- package/lib/utils/TtscExecutor.js.map +1 -1
- package/lib/utils/VersioningStrategy.d.ts +27 -2
- package/lib/utils/VersioningStrategy.js +30 -9
- package/lib/utils/VersioningStrategy.js.map +1 -1
- package/lib/validators/TextPlainValidator.d.ts +19 -0
- package/lib/validators/TextPlainValidator.js +19 -0
- package/lib/validators/TextPlainValidator.js.map +1 -1
- package/native/go.mod +1 -1
- package/native/go.sum +2 -2
- package/native/sdk/register.go +12 -2
- package/native/sdk/sdk_metadata_json.go +6 -1
- package/native/sdk/sdk_transform.go +393 -403
- package/package.json +9 -7
- package/src/INestiaConfig.ts +55 -24
- package/src/NestiaSdkApplication.ts +66 -7
- package/src/NestiaSwaggerComposer.ts +21 -6
- package/src/analyses/AccessorAnalyzer.ts +26 -0
- package/src/analyses/ConfigAnalyzer.ts +59 -96
- package/src/analyses/ImportAnalyzer.ts +25 -0
- package/src/analyses/ParameterNameAnalyzer.ts +24 -0
- package/src/analyses/PathAnalyzer.ts +63 -11
- package/src/analyses/ReflectControllerAnalyzer.ts +32 -0
- package/src/analyses/ReflectHttpOperationAnalyzer.ts +32 -10
- package/src/analyses/ReflectHttpOperationExceptionAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationParameterAnalyzer.ts +31 -0
- package/src/analyses/ReflectHttpOperationResponseAnalyzer.ts +32 -0
- package/src/analyses/ReflectMcpOperationAnalyzer.ts +32 -1
- package/src/analyses/ReflectMetadataAnalyzer.ts +48 -1
- package/src/analyses/ReflectWebSocketOperationAnalyzer.ts +34 -14
- package/src/analyses/SecurityAnalyzer.ts +15 -0
- package/src/analyses/SwaggerExampleAnalyzer.ts +16 -0
- package/src/analyses/TypedHttpRouteAnalyzer.ts +240 -184
- package/src/analyses/TypedMcpRouteAnalyzer.ts +180 -20
- package/src/analyses/TypedWebSocketRouteAnalyzer.ts +19 -0
- package/src/decorators/OperationMetadata.ts +6 -0
- package/src/executable/internal/CommandParser.ts +19 -0
- package/src/executable/internal/NestiaConfigLoader.ts +66 -50
- package/src/executable/internal/NestiaSdkCommand.ts +96 -3
- package/src/executable/internal/NestiaSdkWatcher.ts +169 -41
- package/src/executable/internal/NestiaSwaggerWatch.ts +359 -0
- package/src/factories/ExpressionFactory.ts +17 -2
- package/src/factories/IdentifierFactory.ts +24 -0
- package/src/factories/LiteralFactory.ts +44 -11
- package/src/factories/StatementFactory.ts +28 -1
- package/src/factories/TypeFactory.ts +24 -0
- package/src/generates/CloneGenerator.ts +26 -5
- package/src/generates/E2eGenerator.ts +19 -0
- package/src/generates/SdkGenerator.ts +40 -9
- package/src/generates/SwaggerGenerator.ts +56 -14
- package/src/generates/internal/E2eFileProgrammer.ts +20 -0
- package/src/generates/internal/FilePrinter.ts +43 -0
- package/src/generates/internal/ImportDictionary.ts +110 -3
- package/src/generates/internal/SdkAliasCollection.ts +133 -11
- package/src/generates/internal/SdkDistributionComposer.ts +117 -66
- package/src/generates/internal/SdkFileProgrammer.ts +18 -0
- package/src/generates/internal/SdkHttpCloneProgrammer.ts +55 -0
- package/src/generates/internal/SdkHttpCloneReferencer.ts +97 -23
- package/src/generates/internal/SdkHttpFunctionProgrammer.ts +19 -0
- package/src/generates/internal/SdkHttpNamespaceProgrammer.ts +19 -0
- package/src/generates/internal/SdkHttpParameterProgrammer.ts +104 -2
- package/src/generates/internal/SdkHttpRouteProgrammer.ts +20 -0
- package/src/generates/internal/SdkHttpSimulationProgrammer.ts +72 -5
- package/src/generates/internal/SdkImportWizard.ts +63 -0
- package/src/generates/internal/SdkMcpRouteProgrammer.ts +38 -18
- package/src/generates/internal/SdkPathTemplate.ts +15 -0
- package/src/generates/internal/SdkRouteDirectory.ts +10 -0
- package/src/generates/internal/SdkTypeProgrammer.ts +118 -14
- package/src/generates/internal/SdkTypeTagProgrammer.ts +37 -7
- package/src/generates/internal/SdkWebSocketCloneProgrammer.ts +185 -142
- package/src/generates/internal/SdkWebSocketNamespaceProgrammer.ts +19 -0
- package/src/generates/internal/SdkWebSocketParameterProgrammer.ts +81 -2
- package/src/generates/internal/SdkWebSocketRouteProgrammer.ts +18 -0
- package/src/generates/internal/SwaggerDescriptionComposer.ts +47 -1
- package/src/generates/internal/SwaggerOperationComposer.ts +18 -0
- package/src/generates/internal/SwaggerOperationParameterComposer.ts +41 -8
- package/src/generates/internal/SwaggerOperationResponseComposer.ts +19 -0
- package/src/internal/legacy-augmentation.d.ts +16 -0
- package/src/internal/legacy.ts +296 -26
- package/src/structures/INestiaProject.ts +10 -0
- package/src/structures/INestiaSdkInput.ts +31 -1
- package/src/structures/IOperationMetadata.ts +55 -0
- package/src/structures/IReflectController.ts +11 -1
- package/src/structures/IReflectHttpOperation.ts +11 -1
- package/src/structures/IReflectHttpOperationException.ts +10 -0
- package/src/structures/IReflectHttpOperationParameter.ts +47 -0
- package/src/structures/IReflectHttpOperationSuccess.ts +11 -0
- package/src/structures/IReflectImport.ts +10 -0
- package/src/structures/IReflectMcpOperation.ts +19 -0
- package/src/structures/IReflectMcpOperationParameter.ts +9 -0
- package/src/structures/IReflectOperationError.ts +31 -2
- package/src/structures/IReflectType.ts +9 -0
- package/src/structures/IReflectWebSocketOperation.ts +10 -0
- package/src/structures/IReflectWebSocketOperationParameter.ts +55 -0
- package/src/structures/ITypedApplication.ts +10 -0
- package/src/structures/ITypedHttpRoute.ts +10 -0
- package/src/structures/ITypedHttpRouteException.ts +10 -0
- package/src/structures/ITypedHttpRouteParameter.ts +45 -0
- package/src/structures/ITypedHttpRouteSuccess.ts +10 -0
- package/src/structures/ITypedMcpRoute.ts +12 -0
- package/src/structures/ITypedWebSocketRoute.ts +10 -0
- package/src/transform.ts +6 -0
- package/src/utils/ArrayUtil.ts +32 -13
- package/src/utils/EmittedJavaScriptPatcher.ts +70 -47
- package/src/utils/FileRetriever.ts +29 -0
- package/src/utils/HttpResponseContentTypeUtil.ts +41 -0
- package/src/utils/MapUtil.ts +68 -3
- package/src/utils/PathUtil.ts +38 -0
- package/src/utils/SdkBundlePath.ts +11 -0
- package/src/utils/SdkInputFilter.ts +108 -0
- package/src/utils/SourceFinder.ts +51 -14
- package/src/utils/StringUtil.ts +182 -5
- package/src/utils/TemporaryDirectory.ts +108 -0
- package/src/utils/TsConfigReader.ts +124 -26
- package/src/utils/TtscExecutor.ts +23 -1
- package/src/utils/VersioningStrategy.ts +37 -14
- package/src/validators/TextPlainValidator.ts +19 -0
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.d.ts +0 -9
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js +0 -178
- package/lib/generates/internal/SwaggerReadonlyArrayEmender.js.map +0 -1
- package/src/generates/internal/SwaggerReadonlyArrayEmender.ts +0 -264
|
@@ -1,28 +1,160 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TypedMcpRouteAnalyzer = void 0;
|
|
4
|
+
const legacy_1 = require("../internal/legacy");
|
|
5
|
+
/**
|
|
6
|
+
* Turns a reflected MCP operation into a typed route.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation An MCP tool is one route whose accessor is `mcp` and the tool name with non-identifier characters replaced.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The accessor rule is generic.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
12
|
+
* efficient algorithms: The namespace groups declarations; analyze owns graph conversion.
|
|
13
|
+
* reuse equivalent work: The namespace coordinates no computation.
|
|
14
|
+
* bound retention and release resources: The namespace owns no retained state or handles.
|
|
15
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedMcpRouteAnalyzer analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
16
|
+
*/
|
|
4
17
|
var TypedMcpRouteAnalyzer;
|
|
5
18
|
(function (TypedMcpRouteAnalyzer) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Returns the typed route of an MCP tool: its names, schemas, input
|
|
21
|
+
* parameter, return type, and imports. Clone mode resolves a private copy of
|
|
22
|
+
* the native JSON graph and reports missing or unresolved components.
|
|
23
|
+
*
|
|
24
|
+
* @evidence contracts/common.md#principled-implementation Native primitive pipes describe the same JSON wire values the MCP adaptor serializes. Clone requests require these graphs; source-only routes preserve their declared types and imports.
|
|
25
|
+
* @evidence contracts/common.md#clear-and-simple-design One conversion resolves the input and output against their own components and reports clone metadata failures at the route.
|
|
26
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Native JSON pipes are resolved through the shared metadata adapter; source binding names never select a clone exception and native records remain unchanged.
|
|
27
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
28
|
+
* efficient algorithms: Clone mode copies each supplied graph payload once, indexes its components and visits each schema and component target once to check reference closure. Work scales with graph vertices, edges and annotation payload; no compiler or type analysis is repeated.
|
|
29
|
+
* reuse equivalent work: Input and output pipes have independent native component identities, and this operation retains no completed or in-flight request to share across analyses.
|
|
30
|
+
* bound retention and release resources: Resolution copies and visited sets belong to one synchronous conversion; the returned route retains its reachable graphs, and no global cache, process or handle is created.
|
|
31
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedMcpRouteAnalyzer.analyze analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
32
|
+
*/
|
|
33
|
+
TypedMcpRouteAnalyzer.analyze = (props) => {
|
|
34
|
+
const errors = [];
|
|
35
|
+
const cast = (pipe, position) => {
|
|
36
|
+
if (props.clone !== true)
|
|
37
|
+
return undefined;
|
|
38
|
+
if (pipe === undefined) {
|
|
39
|
+
errors.push(`Missing native JSON metadata for MCP ${position}.`);
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
if (pipe.success === false) {
|
|
43
|
+
errors.push(...pipe.errors);
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const data = structuredClone(pipe.data);
|
|
48
|
+
const components = legacy_1.MetadataComponents.from(data.components);
|
|
49
|
+
const metadata = legacy_1.MetadataSchema.from(data.metadata, components.dictionary);
|
|
50
|
+
const visited = new WeakSet();
|
|
51
|
+
const inspect = (value) => {
|
|
52
|
+
var _a;
|
|
53
|
+
if (visited.has(value))
|
|
54
|
+
return;
|
|
55
|
+
visited.add(value);
|
|
56
|
+
for (const kind of [
|
|
57
|
+
"objects",
|
|
58
|
+
"aliases",
|
|
59
|
+
"arrays",
|
|
60
|
+
"tuples",
|
|
61
|
+
]) {
|
|
62
|
+
if (!Array.isArray(value[kind]))
|
|
63
|
+
throw new Error(`Missing ${kind} metadata.`);
|
|
64
|
+
for (const reference of value[kind]) {
|
|
65
|
+
const target = reference.type;
|
|
66
|
+
if (target === undefined)
|
|
67
|
+
throw new Error(`Unresolved ${kind} component ${reference.name}.`);
|
|
68
|
+
if (visited.has(target))
|
|
69
|
+
continue;
|
|
70
|
+
visited.add(target);
|
|
71
|
+
if (kind === "objects")
|
|
72
|
+
for (const property of target
|
|
73
|
+
.properties) {
|
|
74
|
+
inspect(property.key);
|
|
75
|
+
inspect(property.value);
|
|
76
|
+
}
|
|
77
|
+
else if (kind === "tuples")
|
|
78
|
+
for (const element of target.elements)
|
|
79
|
+
inspect(element);
|
|
80
|
+
else
|
|
81
|
+
inspect(target.value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (value.rest)
|
|
85
|
+
inspect(value.rest);
|
|
86
|
+
if (value.escaped) {
|
|
87
|
+
inspect(value.escaped.original);
|
|
88
|
+
inspect(value.escaped.returns);
|
|
89
|
+
}
|
|
90
|
+
for (const template of value.templates)
|
|
91
|
+
for (const element of (_a = template.row) !== null && _a !== void 0 ? _a : template)
|
|
92
|
+
inspect(element);
|
|
93
|
+
for (const set of value.sets)
|
|
94
|
+
inspect(set.value);
|
|
95
|
+
for (const map of value.maps) {
|
|
96
|
+
inspect(map.key);
|
|
97
|
+
inspect(map.value);
|
|
98
|
+
}
|
|
99
|
+
for (const fn of value.functions) {
|
|
100
|
+
for (const parameter of fn.parameters)
|
|
101
|
+
inspect(parameter.type);
|
|
102
|
+
inspect(fn.output);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
if (!Array.isArray(metadata.objects))
|
|
106
|
+
throw new Error("Missing schema metadata.");
|
|
107
|
+
inspect(metadata);
|
|
108
|
+
return metadata;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
errors.push(`Invalid native JSON metadata for MCP ${position}: ${String(error)}`);
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const inputMetadata = props.operation.parameters[0]
|
|
116
|
+
? cast(props.operation.parameters[0].metadata, "input")
|
|
117
|
+
: undefined;
|
|
118
|
+
const outputMetadata = cast(props.operation.returnMetadata, "output");
|
|
119
|
+
if (errors.length) {
|
|
120
|
+
const failure = {
|
|
121
|
+
file: props.controller.file,
|
|
122
|
+
class: props.controller.class.name,
|
|
123
|
+
function: props.operation.name,
|
|
124
|
+
from: props.operation.name,
|
|
125
|
+
contents: errors,
|
|
126
|
+
};
|
|
127
|
+
if (props.errors === undefined)
|
|
128
|
+
throw new Error(errors
|
|
129
|
+
.map((e) => (typeof e === "string" ? e : e.messages.join("; ")))
|
|
130
|
+
.join("\n"));
|
|
131
|
+
props.errors.push(failure);
|
|
132
|
+
return [];
|
|
133
|
+
}
|
|
134
|
+
return [
|
|
135
|
+
{
|
|
136
|
+
protocol: "mcp",
|
|
137
|
+
controller: props.controller,
|
|
138
|
+
name: props.operation.name,
|
|
139
|
+
toolName: props.operation.toolName,
|
|
140
|
+
title: props.operation.title,
|
|
141
|
+
toolDescription: props.operation.toolDescription,
|
|
142
|
+
accessor: accessor(props.operation.toolName),
|
|
143
|
+
function: props.operation.function,
|
|
144
|
+
input: props.operation.parameters[0]
|
|
145
|
+
? Object.assign(Object.assign({}, props.operation.parameters[0]), { type: Object.assign({}, props.operation.parameters[0].type) }) : null,
|
|
146
|
+
returnType: props.operation.returnType,
|
|
147
|
+
inputMetadata,
|
|
148
|
+
outputMetadata,
|
|
149
|
+
inputSchema: props.operation.inputSchema,
|
|
150
|
+
outputSchema: props.operation.outputSchema,
|
|
151
|
+
annotations: props.operation.annotations,
|
|
152
|
+
imports: props.operation.imports,
|
|
153
|
+
description: props.operation.description,
|
|
154
|
+
jsDocTags: props.operation.jsDocTags,
|
|
155
|
+
},
|
|
156
|
+
];
|
|
157
|
+
};
|
|
26
158
|
const accessor = (toolName) => {
|
|
27
159
|
const safe = toolName.replace(/[^A-Za-z0-9_$]/g, "_");
|
|
28
160
|
return ["mcp", safe];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedMcpRouteAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/TypedMcpRouteAnalyzer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TypedMcpRouteAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/TypedMcpRouteAnalyzer.ts"],"names":[],"mappings":";;;AAAA,+CAO4B;AAO5B;;;;;;;;;;;GAWG;AACH,IAAiB,qBAAqB,CAuKrC;AAvKD,WAAiB,qBAAqB;IACpC;;;;;;;;;;;;;OAaG;IACU,6BAAO,GAAG,CAAC,KAKvB,EAAoB,EAAE;QACrB,MAAM,MAAM,GAA8C,EAAE,CAAC;QAC7D,MAAM,IAAI,GAAG,CACX,IAA2D,EAC3D,QAAgB,EACY,EAAE;YAC9B,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI;gBAAE,OAAO,SAAS,CAAC;YAC3C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,MAAM,CAAC,IAAI,CAAC,wCAAwC,QAAQ,GAAG,CAAC,CAAC;gBACjE,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,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AAY,EAAE;QAC9C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;QACtD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC,EAvKgB,qBAAqB,aAArB,qBAAqB,GAArB,qBAAqB,QAuKrC"}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
import { IReflectController } from "../structures/IReflectController";
|
|
2
2
|
import { IReflectWebSocketOperation } from "../structures/IReflectWebSocketOperation";
|
|
3
3
|
import { ITypedWebSocketRoute } from "../structures/ITypedWebSocketRoute";
|
|
4
|
+
/**
|
|
5
|
+
* Turns a reflected WebSocket operation into typed routes, one per path.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation Each path gets an accessor from its segments and the method name, and the parameters are split by category.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The accessor rule is generic.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedWebSocketRouteAnalyzer analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
12
|
+
*/
|
|
4
13
|
export declare namespace TypedWebSocketRouteAnalyzer {
|
|
14
|
+
/**
|
|
15
|
+
* Returns one typed WebSocket route per path, with the header, path
|
|
16
|
+
* parameters, query, acceptor, and driver separated.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/common.md#principled-implementation The parameters are filtered by category, the acceptor is required by the reflection, and the accessor combines the path segments and the method name.
|
|
19
|
+
* @evidence contracts/common.md#clear-and-simple-design One mapping.
|
|
20
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It only reorganizes reflected data.
|
|
21
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
22
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedWebSocketRouteAnalyzer.analyze analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
23
|
+
*/
|
|
5
24
|
const analyze: (props: {
|
|
6
25
|
controller: IReflectController;
|
|
7
26
|
operation: IReflectWebSocketOperation;
|
|
@@ -2,8 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TypedWebSocketRouteAnalyzer = void 0;
|
|
4
4
|
const PathUtil_1 = require("../utils/PathUtil");
|
|
5
|
+
/**
|
|
6
|
+
* Turns a reflected WebSocket operation into typed routes, one per path.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/common.md#principled-implementation Each path gets an accessor from its segments and the method name, and the parameters are split by category.
|
|
9
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
10
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The accessor rule is generic.
|
|
11
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
12
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedWebSocketRouteAnalyzer analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
13
|
+
*/
|
|
5
14
|
var TypedWebSocketRouteAnalyzer;
|
|
6
15
|
(function (TypedWebSocketRouteAnalyzer) {
|
|
16
|
+
/**
|
|
17
|
+
* Returns one typed WebSocket route per path, with the header, path
|
|
18
|
+
* parameters, query, acceptor, and driver separated.
|
|
19
|
+
*
|
|
20
|
+
* @evidence contracts/common.md#principled-implementation The parameters are filtered by category, the acceptor is required by the reflection, and the accessor combines the path segments and the method name.
|
|
21
|
+
* @evidence contracts/common.md#clear-and-simple-design One mapping.
|
|
22
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It only reorganizes reflected data.
|
|
23
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
24
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation TypedWebSocketRouteAnalyzer.analyze analyzes reflected route metadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
25
|
+
*/
|
|
7
26
|
TypedWebSocketRouteAnalyzer.analyze = (props) => props.paths.map((path) => { var _a, _b, _c; return (Object.assign(Object.assign({}, props.operation), { controller: props.controller, key: props.operation.name, path, accessor: [...PathUtil_1.PathUtil.accessors(path), props.operation.name], header: (_a = props.operation.parameters.filter((p) => p.category === "header")[0]) !== null && _a !== void 0 ? _a : null, pathParameters: props.operation.parameters.filter((p) => p.category === "param"), query: (_b = props.operation.parameters.filter((p) => p.category === "query")[0]) !== null && _b !== void 0 ? _b : null, acceptor: props.operation.parameters.filter((p) => p.category === "acceptor")[0], driver: (_c = props.operation.parameters.filter((p) => p.category === "driver")[0]) !== null && _c !== void 0 ? _c : null })); });
|
|
8
27
|
})(TypedWebSocketRouteAnalyzer || (exports.TypedWebSocketRouteAnalyzer = TypedWebSocketRouteAnalyzer = {}));
|
|
9
28
|
//# sourceMappingURL=TypedWebSocketRouteAnalyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypedWebSocketRouteAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/TypedWebSocketRouteAnalyzer.ts"],"names":[],"mappings":";;;AAGA,gDAA6C;AAE7C,IAAiB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"TypedWebSocketRouteAnalyzer.js","sourceRoot":"","sources":["../../src/analyses/TypedWebSocketRouteAnalyzer.ts"],"names":[],"mappings":";;;AAGA,gDAA6C;AAE7C;;;;;;;;GAQG;AACH,IAAiB,2BAA2B,CAsC3C;AAtCD,WAAiB,2BAA2B;IAC1C;;;;;;;;;OASG;IACU,mCAAO,GAAG,CAAC,KAIvB,EAA0B,EAAE,CAC3B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,0BAAC,iCACrB,KAAK,CAAC,SAAS,KAClB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,EACzB,IAAI,EACJ,QAAQ,EAAE,CAAC,GAAG,mBAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAC7D,MAAM,QACJ,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,mCACpE,IAAI,EACN,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAC9B,EACD,KAAK,QACH,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,mCACnE,IAAI,EACN,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CACzC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,UAAU,CACjC,CAAC,CAAC,CAAE,EACL,MAAM,QACJ,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,mCACpE,IAAI,IACN,GAAA,CAAC,CAAC;AACR,CAAC,EAtCgB,2BAA2B,aAA3B,2BAA2B,GAA3B,2BAA2B,QAsC3C"}
|
|
@@ -8,5 +8,11 @@ import { IOperationMetadata } from "../structures/IOperationMetadata";
|
|
|
8
8
|
* object literal — keeping the constructed node tree minimal. The string is
|
|
9
9
|
* parsed once here at module-evaluation time. A pre-parsed `IOperationMetadata`
|
|
10
10
|
* object is still accepted for hand-written or test usage.
|
|
11
|
+
*
|
|
12
|
+
* @evidence contracts/common.md#principled-implementation The metadata is defined on the class prototype and property key, from an object or its JSON text, which is the key the reflection analyzers look up.
|
|
13
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator that parses when given text and defines one metadata entry.
|
|
14
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It only records what the transform computed and does not alter the method.
|
|
15
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states who emits and who reads the metadata.
|
|
16
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation OperationMetadata attaches metadata through Reflect.defineMetadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
11
17
|
*/
|
|
12
18
|
export declare function OperationMetadata(metadata: IOperationMetadata | string): MethodDecorator;
|
|
@@ -10,6 +10,12 @@ exports.OperationMetadata = OperationMetadata;
|
|
|
10
10
|
* object literal — keeping the constructed node tree minimal. The string is
|
|
11
11
|
* parsed once here at module-evaluation time. A pre-parsed `IOperationMetadata`
|
|
12
12
|
* object is still accepted for hand-written or test usage.
|
|
13
|
+
*
|
|
14
|
+
* @evidence contracts/common.md#principled-implementation The metadata is defined on the class prototype and property key, from an object or its JSON text, which is the key the reflection analyzers look up.
|
|
15
|
+
* @evidence contracts/common.md#clear-and-simple-design One decorator that parses when given text and defines one metadata entry.
|
|
16
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It only records what the transform computed and does not alter the method.
|
|
17
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states who emits and who reads the metadata.
|
|
18
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation OperationMetadata attaches metadata through Reflect.defineMetadata; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
13
19
|
*/
|
|
14
20
|
function OperationMetadata(metadata) {
|
|
15
21
|
const parsed = typeof metadata === "string"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationMetadata.js","sourceRoot":"","sources":["../../src/decorators/OperationMetadata.ts"],"names":[],"mappings":";;;AAEA
|
|
1
|
+
{"version":3,"file":"OperationMetadata.js","sourceRoot":"","sources":["../../src/decorators/OperationMetadata.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;GAeG;AACH,2BACE,QAAqC;IAErC,MAAM,MAAM,GACV,OAAO,QAAQ,KAAK,QAAQ;QAC1B,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAwB;QAC9C,CAAC,CAAC,QAAQ,CAAC;IACf,OAAO,SAAS,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU;QAC/D,OAAO,CAAC,cAAc,CACpB,0BAA0B,EAC1B,MAAM,EACN,MAAM,EACN,WAAW,CACZ,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses the command-line flags of the `nestia` command.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation The namespace reads `--key value` pairs from an argument list.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain parser.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
8
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation CommandParser parses supplied argument strings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
9
|
+
*/
|
|
1
10
|
export declare namespace CommandParser {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the `--key value` pairs of an argument list as an object; a flag
|
|
13
|
+
* without a value, or followed by another flag, is left out.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/common.md#principled-implementation Each argument that starts with two dashes is a key, and the next argument is its value only when it exists and is not itself a flag.
|
|
16
|
+
* @evidence contracts/common.md#clear-and-simple-design One loop.
|
|
17
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It applies to every argument.
|
|
18
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the omitted flags.
|
|
19
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation CommandParser.parse parses supplied argument strings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
20
|
+
*/
|
|
2
21
|
function parse(argList: string[]): Record<string, string>;
|
|
3
22
|
}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandParser = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Parses the command-line flags of the `nestia` command.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation The namespace reads `--key value` pairs from an argument list.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a plain parser.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation CommandParser parses supplied argument strings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
12
|
+
*/
|
|
4
13
|
var CommandParser;
|
|
5
14
|
(function (CommandParser) {
|
|
15
|
+
/**
|
|
16
|
+
* Returns the `--key value` pairs of an argument list as an object; a flag
|
|
17
|
+
* without a value, or followed by another flag, is left out.
|
|
18
|
+
*
|
|
19
|
+
* @evidence contracts/common.md#principled-implementation Each argument that starts with two dashes is a key, and the next argument is its value only when it exists and is not itself a flag.
|
|
20
|
+
* @evidence contracts/common.md#clear-and-simple-design One loop.
|
|
21
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It applies to every argument.
|
|
22
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the omitted flags.
|
|
23
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation CommandParser.parse parses supplied argument strings; it does not resolve native file identity or launch a process. Source resolution and file emission belong to their filesystem owners.
|
|
24
|
+
*/
|
|
6
25
|
function parse(argList) {
|
|
7
26
|
const output = {};
|
|
8
27
|
argList.forEach((arg, i) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandParser.js","sourceRoot":"","sources":["../../../src/executable/internal/CommandParser.ts"],"names":[],"mappings":";;;AAAA,IAAiB,aAAa,
|
|
1
|
+
{"version":3,"file":"CommandParser.js","sourceRoot":"","sources":["../../../src/executable/internal/CommandParser.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;GAQG;AACH,IAAiB,aAAa,CAwB7B;AAxBD,WAAiB,aAAa;IAC5B;;;;;;;;;OASG;IACH,SAAgB,KAAK,CAAC,OAAiB;QACrC,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YACzB,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK;gBAAE,OAAO;YAE3C,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACzB,MAAM,KAAK,GAAuB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;gBAAE,OAAO;YAE1D,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAZe,cAAA,KAAK,QAYpB,CAAA;AACH,CAAC,EAxBgB,aAAa,aAAb,aAAa,GAAb,aAAa,QAwB7B"}
|
|
@@ -1,10 +1,66 @@
|
|
|
1
1
|
import { INestiaConfig } from "../../INestiaConfig";
|
|
2
|
+
/**
|
|
3
|
+
* Loads the TypeScript configuration of a project and its `nestia.config.ts`.
|
|
4
|
+
*
|
|
5
|
+
* @evidence contracts/common.md#principled-implementation The project file is found and merged with its `extends` chain, and the configuration is compiled through ttsc with the nestia plugin into a temporary directory, imported, and validated by type checks of the input, the scalar options and the swagger options; the swagger `info`, `servers`, `security` and `tags` values are passed on unchecked.
|
|
6
|
+
* @evidence contracts/common.md#clear-and-simple-design Two public functions with private helpers for the temporary roots, the plugin list, and the validation.
|
|
7
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only this process's unique materializations are removed on exit and handled termination signals; shared cache parents and other processes' children remain, and a compile error is reported with the compiler output.
|
|
8
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
9
|
+
* efficient algorithms: Project inheritance delegates one per-read traversal to TsConfigReader; configuration loading compiles one wrapper project, patches emitted JavaScript once and validates each returned config.
|
|
10
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
11
|
+
* bound retention and release resources: Wrapper project directories are removed in finally after compilation. Emitted output remains owned by the temporary registry until generation cleanup or process termination; imported module loader entries live in that process. A CLI watch child ends after each generation, whereas direct callers retain loaded exports and have no module-unload guarantee.
|
|
12
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native project and materialization paths use path resolution/joining and Node fs/module resolution. The ttsc executor represents platform-specific executables at its process boundary; emitted ESM imports use pathToFileURL, and filename extensions preserve .mts/.cts module format.
|
|
13
|
+
*/
|
|
2
14
|
export declare namespace NestiaConfigLoader {
|
|
15
|
+
/**
|
|
16
|
+
* The compiler options of a project as the loader reads them: the raw
|
|
17
|
+
* `compilerOptions` object.
|
|
18
|
+
*
|
|
19
|
+
* @evidence contracts/common.md#principled-implementation The record wraps the raw options so callers can read them without a compiler API.
|
|
20
|
+
* @evidence contracts/common.md#clear-and-simple-design A one-member record.
|
|
21
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is a type and adds no runtime behavior.
|
|
22
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states what the type describes and the meaning of its members.
|
|
23
|
+
* efficient algorithms: The compiler-options record represents parsed values and selects no algorithm.
|
|
24
|
+
* reuse equivalent work: This record coordinates no configuration loads or shared producers.
|
|
25
|
+
* bound retention and release resources: This record owns neither materialization cleanup nor compiler tasks.
|
|
26
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The raw compiler option record performs no native path resolution or process launch; its loader owns those boundaries.
|
|
27
|
+
*/
|
|
3
28
|
interface ICompilerOptions {
|
|
4
29
|
raw: {
|
|
5
30
|
compilerOptions?: Record<string, any>;
|
|
6
31
|
};
|
|
7
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns the merged compiler options of the project file, following its
|
|
35
|
+
* `extends` chain.
|
|
36
|
+
*
|
|
37
|
+
* It throws when the file cannot be found.
|
|
38
|
+
*
|
|
39
|
+
* @evidence contracts/common.md#principled-implementation The file is searched upward from the working directory when the name is relative, and `TsConfigReader` merges the chain, so the options are those the compiler would use.
|
|
40
|
+
* @evidence contracts/common.md#clear-and-simple-design One function delegating the reading.
|
|
41
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads what the compiler reads.
|
|
42
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result and the error.
|
|
43
|
+
* efficient algorithms: Upward project search visits each ancestor directory once, and TsConfigReader shares repeated ancestors inside one read.
|
|
44
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
45
|
+
* bound retention and release resources: This operation owns only invocation-local values, with no retained cache, handle or background task.
|
|
46
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native project and materialization paths use path resolution/joining and Node fs/module resolution. The ttsc executor represents platform-specific executables at its process boundary; emitted ESM imports use pathToFileURL, and filename extensions preserve .mts/.cts module format.
|
|
47
|
+
*/
|
|
8
48
|
const compilerOptions: (project: string) => Promise<ICompilerOptions>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the configurations exported by a `nestia.config.ts`, validated.
|
|
51
|
+
*
|
|
52
|
+
* The file is compiled through ttsc with the nestia plugin into a temporary
|
|
53
|
+
* directory and imported; a missing file, a compile error, or an invalid
|
|
54
|
+
* field is an error.
|
|
55
|
+
*
|
|
56
|
+
* @evidence contracts/common.md#principled-implementation The wrapper project extends the user's project with emit forced on and declarations off, the typia plugin disabled and the nestia one enabled, the emitted file is patched for `import.meta.url`, and the exported value is checked for its input, scalar options and swagger options, so a malformed one is rejected before generation, while the OpenAPI `info`, `servers`, `security` and `tags` values are not inspected here.
|
|
57
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over private helpers for compilation, extraction, and validation.
|
|
58
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The shared registry removes only owned children on exit and handled termination signals, and the checks follow the `INestiaConfig` contract.
|
|
59
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the compile step and the errors.
|
|
60
|
+
* efficient algorithms: Each invocation compiles one wrapper project, traverses its emitted JavaScript once and validates each returned config and option field.
|
|
61
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
62
|
+
* bound retention and release resources: Wrapper project directories are removed in finally after compilation. Emitted output remains owned by the temporary registry until generation cleanup or process termination; imported module loader entries live in that process. A CLI watch child ends after each generation, whereas direct callers retain loaded exports and have no module-unload guarantee.
|
|
63
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native project and materialization paths use path resolution/joining and Node fs/module resolution. The ttsc executor represents platform-specific executables at its process boundary; emitted ESM imports use pathToFileURL, and filename extensions preserve .mts/.cts module format.
|
|
64
|
+
*/
|
|
9
65
|
const configurations: (file: string, compilerOptions: Record<string, any>) => Promise<INestiaConfig[]>;
|
|
10
66
|
}
|
|
@@ -18,10 +18,38 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
19
|
const url_1 = require("url");
|
|
20
20
|
const EmittedJavaScriptPatcher_1 = require("../../utils/EmittedJavaScriptPatcher");
|
|
21
|
+
const TemporaryDirectory_1 = require("../../utils/TemporaryDirectory");
|
|
21
22
|
const TsConfigReader_1 = require("../../utils/TsConfigReader");
|
|
22
23
|
const TtscExecutor_1 = require("../../utils/TtscExecutor");
|
|
24
|
+
/**
|
|
25
|
+
* Loads the TypeScript configuration of a project and its `nestia.config.ts`.
|
|
26
|
+
*
|
|
27
|
+
* @evidence contracts/common.md#principled-implementation The project file is found and merged with its `extends` chain, and the configuration is compiled through ttsc with the nestia plugin into a temporary directory, imported, and validated by type checks of the input, the scalar options and the swagger options; the swagger `info`, `servers`, `security` and `tags` values are passed on unchecked.
|
|
28
|
+
* @evidence contracts/common.md#clear-and-simple-design Two public functions with private helpers for the temporary roots, the plugin list, and the validation.
|
|
29
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only this process's unique materializations are removed on exit and handled termination signals; shared cache parents and other processes' children remain, and a compile error is reported with the compiler output.
|
|
30
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
31
|
+
* efficient algorithms: Project inheritance delegates one per-read traversal to TsConfigReader; configuration loading compiles one wrapper project, patches emitted JavaScript once and validates each returned config.
|
|
32
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
33
|
+
* bound retention and release resources: Wrapper project directories are removed in finally after compilation. Emitted output remains owned by the temporary registry until generation cleanup or process termination; imported module loader entries live in that process. A CLI watch child ends after each generation, whereas direct callers retain loaded exports and have no module-unload guarantee.
|
|
34
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native project and materialization paths use path resolution/joining and Node fs/module resolution. The ttsc executor represents platform-specific executables at its process boundary; emitted ESM imports use pathToFileURL, and filename extensions preserve .mts/.cts module format.
|
|
35
|
+
*/
|
|
23
36
|
var NestiaConfigLoader;
|
|
24
37
|
(function (NestiaConfigLoader) {
|
|
38
|
+
/**
|
|
39
|
+
* Returns the merged compiler options of the project file, following its
|
|
40
|
+
* `extends` chain.
|
|
41
|
+
*
|
|
42
|
+
* It throws when the file cannot be found.
|
|
43
|
+
*
|
|
44
|
+
* @evidence contracts/common.md#principled-implementation The file is searched upward from the working directory when the name is relative, and `TsConfigReader` merges the chain, so the options are those the compiler would use.
|
|
45
|
+
* @evidence contracts/common.md#clear-and-simple-design One function delegating the reading.
|
|
46
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It reads what the compiler reads.
|
|
47
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result and the error.
|
|
48
|
+
* efficient algorithms: Upward project search visits each ancestor directory once, and TsConfigReader shares repeated ancestors inside one read.
|
|
49
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
50
|
+
* bound retention and release resources: This operation owns only invocation-local values, with no retained cache, handle or background task.
|
|
51
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native project and materialization paths use path resolution/joining and Node fs/module resolution. The ttsc executor represents platform-specific executables at its process boundary; emitted ESM imports use pathToFileURL, and filename extensions preserve .mts/.cts module format.
|
|
52
|
+
*/
|
|
25
53
|
NestiaConfigLoader.compilerOptions = (project) => __awaiter(this, void 0, void 0, function* () {
|
|
26
54
|
const configFileName = findConfigFile(process.cwd(), project);
|
|
27
55
|
if (!configFileName)
|
|
@@ -35,6 +63,22 @@ var NestiaConfigLoader;
|
|
|
35
63
|
},
|
|
36
64
|
};
|
|
37
65
|
});
|
|
66
|
+
/**
|
|
67
|
+
* Returns the configurations exported by a `nestia.config.ts`, validated.
|
|
68
|
+
*
|
|
69
|
+
* The file is compiled through ttsc with the nestia plugin into a temporary
|
|
70
|
+
* directory and imported; a missing file, a compile error, or an invalid
|
|
71
|
+
* field is an error.
|
|
72
|
+
*
|
|
73
|
+
* @evidence contracts/common.md#principled-implementation The wrapper project extends the user's project with emit forced on and declarations off, the typia plugin disabled and the nestia one enabled, the emitted file is patched for `import.meta.url`, and the exported value is checked for its input, scalar options and swagger options, so a malformed one is rejected before generation, while the OpenAPI `info`, `servers`, `security` and `tags` values are not inspected here.
|
|
74
|
+
* @evidence contracts/common.md#clear-and-simple-design One function over private helpers for compilation, extraction, and validation.
|
|
75
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The shared registry removes only owned children on exit and handled termination signals, and the checks follow the `INestiaConfig` contract.
|
|
76
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the compile step and the errors.
|
|
77
|
+
* efficient algorithms: Each invocation compiles one wrapper project, traverses its emitted JavaScript once and validates each returned config and option field.
|
|
78
|
+
* reuse equivalent work: This invocation computes its own result and coordinates no completed or in-flight computation across requests.
|
|
79
|
+
* bound retention and release resources: Wrapper project directories are removed in finally after compilation. Emitted output remains owned by the temporary registry until generation cleanup or process termination; imported module loader entries live in that process. A CLI watch child ends after each generation, whereas direct callers retain loaded exports and have no module-unload guarantee.
|
|
80
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native project and materialization paths use path resolution/joining and Node fs/module resolution. The ttsc executor represents platform-specific executables at its process boundary; emitted ESM imports use pathToFileURL, and filename extensions preserve .mts/.cts module format.
|
|
81
|
+
*/
|
|
38
82
|
NestiaConfigLoader.configurations = (file, compilerOptions) => __awaiter(this, void 0, void 0, function* () {
|
|
39
83
|
if (fs_1.default.existsSync(path_1.default.resolve(file)) === false)
|
|
40
84
|
throw new Error(`Unable to find "${file}" file.`);
|
|
@@ -52,8 +96,6 @@ var NestiaConfigLoader;
|
|
|
52
96
|
: [instance];
|
|
53
97
|
return assertConfigurations(file, configurations);
|
|
54
98
|
});
|
|
55
|
-
const MATERIALIZED_ROOTS = new Set();
|
|
56
|
-
let CLEANUP_REGISTERED = false;
|
|
57
99
|
const materializeConfiguration = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
58
100
|
var _a, _b;
|
|
59
101
|
const configFile = path_1.default.resolve(props.file);
|
|
@@ -62,8 +104,8 @@ var NestiaConfigLoader;
|
|
|
62
104
|
if (projectFile === undefined)
|
|
63
105
|
throw new Error(`unable to find "${project}" file.`);
|
|
64
106
|
const projectRoot = path_1.default.dirname(path_1.default.resolve(projectFile));
|
|
65
|
-
const wrapperRoot =
|
|
66
|
-
const outputRoot =
|
|
107
|
+
const wrapperRoot = TemporaryDirectory_1.TemporaryDirectory.create(materializedRoot(projectRoot), "tsconfig-");
|
|
108
|
+
const outputRoot = TemporaryDirectory_1.TemporaryDirectory.create(materializedRoot(projectRoot), "run-");
|
|
67
109
|
const wrapperFile = path_1.default.join(wrapperRoot, "tsconfig.json");
|
|
68
110
|
const wrapperConfig = {
|
|
69
111
|
extends: projectFile,
|
|
@@ -94,7 +136,7 @@ var NestiaConfigLoader;
|
|
|
94
136
|
: `failed to compile "${props.file}" through ttsc (exit code ${status !== null && status !== void 0 ? status : "unknown"}). Run \`npx ttsc -p ${projectFile}\` to see the underlying diagnostics.`, { cause });
|
|
95
137
|
}
|
|
96
138
|
finally {
|
|
97
|
-
|
|
139
|
+
TemporaryDirectory_1.TemporaryDirectory.remove(wrapperRoot);
|
|
98
140
|
}
|
|
99
141
|
yield EmittedJavaScriptPatcher_1.EmittedJavaScriptPatcher.importMetaUrl(outputRoot);
|
|
100
142
|
const configKey = emittedJavaScriptKey(projectRoot, configFile);
|
|
@@ -103,43 +145,7 @@ var NestiaConfigLoader;
|
|
|
103
145
|
throw new Error(`failed to materialize "${props.file}" through ttsc native transform.`);
|
|
104
146
|
return next;
|
|
105
147
|
});
|
|
106
|
-
const
|
|
107
|
-
const root = path_1.default.join(projectRoot, "node_modules", ".nestia", "config-loader");
|
|
108
|
-
fs_1.default.mkdirSync(root, { recursive: true });
|
|
109
|
-
MATERIALIZED_ROOTS.add(root);
|
|
110
|
-
if (CLEANUP_REGISTERED === false) {
|
|
111
|
-
CLEANUP_REGISTERED = true;
|
|
112
|
-
const sweep = () => {
|
|
113
|
-
for (const location of MATERIALIZED_ROOTS)
|
|
114
|
-
fs_1.default.rmSync(location, { force: true, recursive: true });
|
|
115
|
-
};
|
|
116
|
-
process.once("exit", sweep);
|
|
117
|
-
// process.once("exit", …) does not fire on SIGINT/SIGTERM. Without
|
|
118
|
-
// these handlers a Ctrl-C during codegen leaves `run-*` and
|
|
119
|
-
// `tsconfig-*` mkdtempSync directories behind under
|
|
120
|
-
// node_modules/.nestia/config-loader/ until a subsequent clean exit.
|
|
121
|
-
// The module-level CLEANUP_REGISTERED flag above guards against
|
|
122
|
-
// re-entrancy within this module; we deliberately do NOT gate on
|
|
123
|
-
// `process.listenerCount(signal) > 0` because the parallel sweep in
|
|
124
|
-
// `ConfigAnalyzer.ensureRuntimeCleanup` (or any user-app SIGINT
|
|
125
|
-
// handler) could register first, and that gate would skip our
|
|
126
|
-
// registration — leaving MATERIALIZED_ROOTS unswept on Ctrl-C.
|
|
127
|
-
// Windows note: `process.kill(pid, "SIGINT")` calls TerminateProcess
|
|
128
|
-
// rather than re-raising; whichever module registers FIRST runs its
|
|
129
|
-
// sweep, the second is skipped, RUNTIME/MATERIALIZED cleanup is
|
|
130
|
-
// best-effort on Windows. SIGHUP is a no-op for most common code
|
|
131
|
-
// paths on Windows (Node fires it on console-close and exits within
|
|
132
|
-
// seconds).
|
|
133
|
-
const onSignal = (signal) => {
|
|
134
|
-
sweep();
|
|
135
|
-
process.kill(process.pid, signal);
|
|
136
|
-
};
|
|
137
|
-
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
138
|
-
process.once(signal, onSignal);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
return root;
|
|
142
|
-
};
|
|
148
|
+
const materializedRoot = (projectRoot) => path_1.default.join(projectRoot, "node_modules", ".nestia", "config-loader");
|
|
143
149
|
const emittedJavaScriptKey = (projectRoot, file) => {
|
|
144
150
|
const relative = path_1.default.relative(projectRoot, file);
|
|
145
151
|
const extension = path_1.default.extname(relative).toLowerCase();
|