@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Separates authored TypeScript inputs from files owned by SDK generation.
|
|
3
|
+
*
|
|
4
|
+
* Each filter owns one output directory. Installed bundle metadata is shared;
|
|
5
|
+
* output-specific native paths are never stored in the process-wide cache.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation Source extensions are checked before generated functional descendants and exact bundled output files are excluded. Native identities and path.relative distinguish descendants from prefix-sharing siblings.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design One filter factory separates source selection from controller compilation; its private helpers own bundle metadata and filesystem identity.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Exclusions come from the actual installed bundle and the generated functional directory, without fixture names or a cached caller output.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states filter ownership and the cache's output-independent content.
|
|
11
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native real paths resolve existing ancestors and path.relative judges directory containment; neither OS names nor lowercasing assume a volume's case or link policy.
|
|
12
|
+
* efficient algorithms: Successful installed bundle entries are scanned once and each filter builds its exclusion roots once; a candidate resolves one identity and compares at most the bundle entry count plus functional root, with no recursive source scan here.
|
|
13
|
+
* reuse equivalent work: Concurrent filters share installed bundle names and kinds; a failed metadata read clears the promise so a later request can retry. Output-specific resolved roots belong to each factory call, so another output cannot reuse the first caller's paths.
|
|
14
|
+
* bound retention and release resources: The one metadata promise retains only the fixed installed bundle population. Output roots live in the returned filter closure and are released with its source-discovery call; there is no growing per-output registry.
|
|
15
|
+
*/
|
|
16
|
+
export declare namespace SdkInputFilter {
|
|
17
|
+
/**
|
|
18
|
+
* Creates the source predicate for one configuration's output, or an
|
|
19
|
+
* extension-only predicate when no SDK output is configured.
|
|
20
|
+
*
|
|
21
|
+
* @evidence contracts/common.md#principled-implementation The predicate accepts regular TypeScript source names, excludes descendants of this output's functional directory and the bundle's exact file/directory identities, and leaves same-named authored files outside that output eligible.
|
|
22
|
+
* @evidence contracts/common.md#clear-and-simple-design Output roots are prepared before discovery and captured in one returned predicate, so compilation never owns these path-selection rules.
|
|
23
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Every configuration resolves its own output; no first-call output, substring containment or operating-system case guess substitutes for filesystem identity.
|
|
24
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents both output-bound and extension-only modes.
|
|
25
|
+
* @evidence contracts/portability.md#os-neutral-implementation The nearest existing ancestor carries actual case/link identity and nonexistent suffixes retain their native spelling; path.relative rejects sibling and cross-root locations without protocol-path comparisons.
|
|
26
|
+
* efficient algorithms: Factory preparation is linear in installed bundle entries and each predicate call scans those prepared roots after one candidate identity resolution. It reuses the discovery traversal rather than walking inputs again.
|
|
27
|
+
* reuse equivalent work: Output-independent metadata comes from one shared in-flight or successful promise; rejection clears it for retry, while each output-specific root array is computed for its own factory call and is not shared across incompatible configurations.
|
|
28
|
+
* bound retention and release resources: The predicate retains only this configuration's fixed exclusion roots and no candidate history; once SourceFinder finishes, that closure has no persistent owner.
|
|
29
|
+
*/
|
|
30
|
+
const create: (output: string | undefined) => Promise<(location: string) => Promise<boolean>>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SdkInputFilter = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const SdkBundlePath_1 = require("./SdkBundlePath");
|
|
19
|
+
const SourceFinder_1 = require("./SourceFinder");
|
|
20
|
+
/**
|
|
21
|
+
* Separates authored TypeScript inputs from files owned by SDK generation.
|
|
22
|
+
*
|
|
23
|
+
* Each filter owns one output directory. Installed bundle metadata is shared;
|
|
24
|
+
* output-specific native paths are never stored in the process-wide cache.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/common.md#principled-implementation Source extensions are checked before generated functional descendants and exact bundled output files are excluded. Native identities and path.relative distinguish descendants from prefix-sharing siblings.
|
|
27
|
+
* @evidence contracts/common.md#clear-and-simple-design One filter factory separates source selection from controller compilation; its private helpers own bundle metadata and filesystem identity.
|
|
28
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Exclusions come from the actual installed bundle and the generated functional directory, without fixture names or a cached caller output.
|
|
29
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states filter ownership and the cache's output-independent content.
|
|
30
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native real paths resolve existing ancestors and path.relative judges directory containment; neither OS names nor lowercasing assume a volume's case or link policy.
|
|
31
|
+
* efficient algorithms: Successful installed bundle entries are scanned once and each filter builds its exclusion roots once; a candidate resolves one identity and compares at most the bundle entry count plus functional root, with no recursive source scan here.
|
|
32
|
+
* reuse equivalent work: Concurrent filters share installed bundle names and kinds; a failed metadata read clears the promise so a later request can retry. Output-specific resolved roots belong to each factory call, so another output cannot reuse the first caller's paths.
|
|
33
|
+
* bound retention and release resources: The one metadata promise retains only the fixed installed bundle population. Output roots live in the returned filter closure and are released with its source-discovery call; there is no growing per-output registry.
|
|
34
|
+
*/
|
|
35
|
+
var SdkInputFilter;
|
|
36
|
+
(function (SdkInputFilter) {
|
|
37
|
+
/**
|
|
38
|
+
* Creates the source predicate for one configuration's output, or an
|
|
39
|
+
* extension-only predicate when no SDK output is configured.
|
|
40
|
+
*
|
|
41
|
+
* @evidence contracts/common.md#principled-implementation The predicate accepts regular TypeScript source names, excludes descendants of this output's functional directory and the bundle's exact file/directory identities, and leaves same-named authored files outside that output eligible.
|
|
42
|
+
* @evidence contracts/common.md#clear-and-simple-design Output roots are prepared before discovery and captured in one returned predicate, so compilation never owns these path-selection rules.
|
|
43
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Every configuration resolves its own output; no first-call output, substring containment or operating-system case guess substitutes for filesystem identity.
|
|
44
|
+
* @evidence contracts/common.md#meaningful-documentation The comment documents both output-bound and extension-only modes.
|
|
45
|
+
* @evidence contracts/portability.md#os-neutral-implementation The nearest existing ancestor carries actual case/link identity and nonexistent suffixes retain their native spelling; path.relative rejects sibling and cross-root locations without protocol-path comparisons.
|
|
46
|
+
* efficient algorithms: Factory preparation is linear in installed bundle entries and each predicate call scans those prepared roots after one candidate identity resolution. It reuses the discovery traversal rather than walking inputs again.
|
|
47
|
+
* reuse equivalent work: Output-independent metadata comes from one shared in-flight or successful promise; rejection clears it for retry, while each output-specific root array is computed for its own factory call and is not shared across incompatible configurations.
|
|
48
|
+
* bound retention and release resources: The predicate retains only this configuration's fixed exclusion roots and no candidate history; once SourceFinder finishes, that closure has no persistent owner.
|
|
49
|
+
*/
|
|
50
|
+
SdkInputFilter.create = (output) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
if (output === undefined)
|
|
52
|
+
return (location) => __awaiter(this, void 0, void 0, function* () { return SourceFinder_1.SourceFinder.isTypeScriptSource(location); });
|
|
53
|
+
const excluded = [
|
|
54
|
+
{
|
|
55
|
+
location: identity(path_1.default.resolve(output, "functional")),
|
|
56
|
+
directory: true,
|
|
57
|
+
},
|
|
58
|
+
...(yield bundle()).map((asset) => ({
|
|
59
|
+
location: identity(path_1.default.resolve(output, asset.name)),
|
|
60
|
+
directory: asset.directory,
|
|
61
|
+
})),
|
|
62
|
+
];
|
|
63
|
+
return (location) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
if (SourceFinder_1.SourceFinder.isTypeScriptSource(location) === false)
|
|
65
|
+
return false;
|
|
66
|
+
const file = identity(location);
|
|
67
|
+
return excluded.every((entry) => entry.directory
|
|
68
|
+
? within(entry.location, file) === false
|
|
69
|
+
: entry.location !== file);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
})(SdkInputFilter || (exports.SdkInputFilter = SdkInputFilter = {}));
|
|
73
|
+
let bundlePromise;
|
|
74
|
+
const bundle = () => {
|
|
75
|
+
if (bundlePromise === undefined)
|
|
76
|
+
bundlePromise = (() => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
+
return Promise.all((yield fs_1.default.promises.readdir(SdkBundlePath_1.SDK_BUNDLE_PATH, { withFileTypes: true })).map((entry) => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
return ({
|
|
79
|
+
name: entry.name,
|
|
80
|
+
directory: entry.isSymbolicLink()
|
|
81
|
+
? (yield fs_1.default.promises.stat(path_1.default.join(SdkBundlePath_1.SDK_BUNDLE_PATH, entry.name))).isDirectory()
|
|
82
|
+
: entry.isDirectory(),
|
|
83
|
+
});
|
|
84
|
+
})));
|
|
85
|
+
}))().catch((error) => {
|
|
86
|
+
bundlePromise = undefined;
|
|
87
|
+
throw error;
|
|
88
|
+
});
|
|
89
|
+
return bundlePromise;
|
|
90
|
+
};
|
|
91
|
+
const within = (directory, location) => {
|
|
92
|
+
const relative = path_1.default.relative(directory, location);
|
|
93
|
+
return (relative === "" ||
|
|
94
|
+
(path_1.default.isAbsolute(relative) === false &&
|
|
95
|
+
relative !== ".." &&
|
|
96
|
+
relative.startsWith(`..${path_1.default.sep}`) === false));
|
|
97
|
+
};
|
|
98
|
+
const identity = (location) => {
|
|
99
|
+
const rest = [];
|
|
100
|
+
for (let current = path_1.default.resolve(location);;) {
|
|
101
|
+
try {
|
|
102
|
+
return path_1.default.join(fs_1.default.realpathSync.native(current), ...rest.reverse());
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
if (error.code !== "ENOENT")
|
|
106
|
+
throw error;
|
|
107
|
+
const parent = path_1.default.dirname(current);
|
|
108
|
+
if (parent === current)
|
|
109
|
+
throw error;
|
|
110
|
+
rest.push(path_1.default.basename(current));
|
|
111
|
+
current = parent;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=SdkInputFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SdkInputFilter.js","sourceRoot":"","sources":["../../src/utils/SdkInputFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,mDAAkD;AAClD,iDAA8C;AAE9C;;;;;;;;;;;;;;GAcG;AACH,IAAiB,cAAc,CAuC9B;AAvCD,WAAiB,cAAc;IAC7B;;;;;;;;;;;;OAYG;IACU,qBAAM,GAAG,CACpB,MAA0B,EACuB,EAAE;QACnD,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,CAAO,QAAQ,EAAE,EAAE,gDAAC,OAAA,2BAAY,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAA,CAAA,CAAC,CAAD,CAAC;QACvE,MAAM,QAAQ,GAAG;YACf;gBACE,QAAQ,EAAE,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;gBACtD,SAAS,EAAE,IAAI;aAChB;YACD,GAAG,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK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I,MAAM,KAAK,OAAO;gBAAE,MAAM,KAAK,CAAC;YACpC,IAAI,CAAC,IAAI,CAAC,cAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YAClC,OAAO,GAAG,MAAM,CAAC;QACnB,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finds source files by path, directory, or glob.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation Each pattern is resolved to files or directories, directories are walked, the filter is applied to files, and the excluded set is subtracted.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design Three public functions and private walkers.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The filter is the caller's.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
8
|
+
* @evidence contracts/portability.md#os-neutral-implementation The finder turns each pattern into an absolute native path with `path.resolve` and asks the filesystem itself, through `existsSync`, `stat` and `readdir`, whether a path exists and what it is, so the volume's own case policy and links apply. Only the part of a pattern below its longest existing ancestor is globbed, rewritten from the native separator to `/` because glob reads a Windows backslash as an escape. Remaining assumptions: the case policy of wildcard matching is glob's own platform default and not a probe of the volume, and accepted files are keyed by filesystem real path while returned locations retain their discovered spelling, so include and exclude aliases identify the same file.
|
|
9
|
+
*/
|
|
1
10
|
export declare namespace SourceFinder {
|
|
2
11
|
interface IProps {
|
|
3
12
|
exclude?: string[];
|
|
4
13
|
include: string[];
|
|
5
14
|
filter: (location: string) => Promise<boolean>;
|
|
6
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns the files matched by the include patterns and not by the exclude
|
|
18
|
+
* patterns and accepted by the filter.
|
|
19
|
+
*
|
|
20
|
+
* @evidence contracts/common.md#principled-implementation Every pattern is expanded, existing paths remain literal, and only regular files accepted by the filter enter either collection; the exclusion runs the same collection removing instead of adding.
|
|
21
|
+
* @evidence contracts/common.md#clear-and-simple-design One function that runs the collection twice.
|
|
22
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The result follows the patterns and the filter.
|
|
23
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
24
|
+
* @evidence contracts/portability.md#os-neutral-implementation It composes the include and exclude collections over native absolute paths and returns them as `path.resolve` spelled them. A directory is walked through `stat`, which follows links; each include or exclude collection keeps a real-path set, so a linked directory is entered once and a link back to an ancestor is skipped.
|
|
25
|
+
*/
|
|
7
26
|
export const find: (props: IProps) => Promise<string[]>;
|
|
8
27
|
/**
|
|
9
28
|
* Files and directories a path or glob pattern names.
|
|
@@ -13,8 +32,24 @@ export declare namespace SourceFinder {
|
|
|
13
32
|
* a pattern, the longest existing ancestor is the literal base and only the
|
|
14
33
|
* rest is globbed, with `/` separators, since glob reads a Windows backslash
|
|
15
34
|
* as an escape.
|
|
35
|
+
*
|
|
36
|
+
* @evidence contracts/common.md#principled-implementation The wildcard part is matched below the part of the path that exists, and a base that does not exist matches nothing.
|
|
37
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
38
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the filesystem.
|
|
39
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the two cases.
|
|
40
|
+
* @evidence contracts/portability.md#os-neutral-implementation An existing path is used literally, so no character glob reads specially is interpreted. Otherwise the nearest existing ancestor, found with `existsSync` and `dirname` until the filesystem root, is the glob's working directory, the remainder is rewritten from `path.sep` to `/`, and the matches are resolved against that base, so a drive letter or a UNC root never enters the pattern.
|
|
16
41
|
*/
|
|
17
42
|
export const expand: (pattern: string) => Promise<string[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Reports whether a file is a TypeScript source: an extension of `ts`, `mts`,
|
|
45
|
+
* or `cts` that is not a declaration file.
|
|
46
|
+
*
|
|
47
|
+
* @evidence contracts/common.md#principled-implementation The check is on the lower-cased name, and declaration files are excluded because they hold no runtime code.
|
|
48
|
+
* @evidence contracts/common.md#clear-and-simple-design One expression.
|
|
49
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is by extension.
|
|
50
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the accepted extensions.
|
|
51
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The function judges the spelling of a name the caller supplies and opens no path, so it owns no filesystem or process decision; extensions are compared lower-cased on every platform by design.
|
|
52
|
+
*/
|
|
18
53
|
export const isTypeScriptSource: (file: string) => boolean;
|
|
19
54
|
export {};
|
|
20
55
|
}
|
|
@@ -16,38 +16,58 @@ exports.SourceFinder = void 0;
|
|
|
16
16
|
const fs_1 = __importDefault(require("fs"));
|
|
17
17
|
const glob_1 = require("glob");
|
|
18
18
|
const path_1 = __importDefault(require("path"));
|
|
19
|
+
/**
|
|
20
|
+
* Finds source files by path, directory, or glob.
|
|
21
|
+
*
|
|
22
|
+
* @evidence contracts/common.md#principled-implementation Each pattern is resolved to files or directories, directories are walked, the filter is applied to files, and the excluded set is subtracted.
|
|
23
|
+
* @evidence contracts/common.md#clear-and-simple-design Three public functions and private walkers.
|
|
24
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The filter is the caller's.
|
|
25
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
26
|
+
* @evidence contracts/portability.md#os-neutral-implementation The finder turns each pattern into an absolute native path with `path.resolve` and asks the filesystem itself, through `existsSync`, `stat` and `readdir`, whether a path exists and what it is, so the volume's own case policy and links apply. Only the part of a pattern below its longest existing ancestor is globbed, rewritten from the native separator to `/` because glob reads a Windows backslash as an escape. Remaining assumptions: the case policy of wildcard matching is glob's own platform default and not a probe of the volume, and accepted files are keyed by filesystem real path while returned locations retain their discovered spelling, so include and exclude aliases identify the same file.
|
|
27
|
+
*/
|
|
19
28
|
var SourceFinder;
|
|
20
29
|
(function (SourceFinder) {
|
|
30
|
+
/**
|
|
31
|
+
* Returns the files matched by the include patterns and not by the exclude
|
|
32
|
+
* patterns and accepted by the filter.
|
|
33
|
+
*
|
|
34
|
+
* @evidence contracts/common.md#principled-implementation Every pattern is expanded, existing paths remain literal, and only regular files accepted by the filter enter either collection; the exclusion runs the same collection removing instead of adding.
|
|
35
|
+
* @evidence contracts/common.md#clear-and-simple-design One function that runs the collection twice.
|
|
36
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The result follows the patterns and the filter.
|
|
37
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
38
|
+
* @evidence contracts/portability.md#os-neutral-implementation It composes the include and exclude collections over native absolute paths and returns them as `path.resolve` spelled them. A directory is walked through `stat`, which follows links; each include or exclude collection keeps a real-path set, so a linked directory is entered once and a link back to an ancestor is skipped.
|
|
39
|
+
*/
|
|
21
40
|
SourceFinder.find = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
22
41
|
var _a;
|
|
23
|
-
const dict = new
|
|
24
|
-
yield emplace(props.filter)(props.include)((str) => dict.
|
|
42
|
+
const dict = new Map();
|
|
43
|
+
yield emplace(props.filter)(props.include)((str) => dict.set(fs_1.default.realpathSync.native(str), str));
|
|
25
44
|
if ((_a = props.exclude) === null || _a === void 0 ? void 0 : _a.length)
|
|
26
|
-
yield emplace(props.filter)(props.exclude)((str) => dict.delete(str));
|
|
27
|
-
return [...dict];
|
|
45
|
+
yield emplace(props.filter)(props.exclude)((str) => dict.delete(fs_1.default.realpathSync.native(str)));
|
|
46
|
+
return [...dict.values()];
|
|
28
47
|
});
|
|
29
48
|
const emplace = (filter) => (input) => (closure) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const visited = new Set();
|
|
30
50
|
for (const pattern of input) {
|
|
31
|
-
if (_Is_file(pattern)) {
|
|
32
|
-
closure(path_1.default.resolve(pattern));
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
51
|
for (const file of yield SourceFinder.expand(pattern)) {
|
|
36
52
|
const stats = yield fs_1.default.promises.stat(file);
|
|
37
53
|
if (stats.isDirectory() === true)
|
|
38
|
-
yield iterate(filter)(closure)(file);
|
|
54
|
+
yield iterate(filter)(closure)(file, visited);
|
|
39
55
|
else if (stats.isFile() && (yield filter(file)))
|
|
40
56
|
closure(file);
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
59
|
});
|
|
44
|
-
const iterate = (filter) => (closure) => (location) => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const iterate = (filter) => (closure) => (location, visited) => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const identity = yield fs_1.default.promises.realpath(location);
|
|
62
|
+
if (visited.has(identity))
|
|
63
|
+
return;
|
|
64
|
+
visited.add(identity);
|
|
45
65
|
const directory = yield fs_1.default.promises.readdir(location);
|
|
46
66
|
for (const file of directory) {
|
|
47
67
|
const next = path_1.default.resolve(`${location}/${file}`);
|
|
48
68
|
const stats = yield fs_1.default.promises.stat(next);
|
|
49
69
|
if (stats.isDirectory() === true)
|
|
50
|
-
yield iterate(filter)(closure)(next);
|
|
70
|
+
yield iterate(filter)(closure)(next, visited);
|
|
51
71
|
else if (stats.isFile() && (yield filter(next)))
|
|
52
72
|
closure(next);
|
|
53
73
|
}
|
|
@@ -60,6 +80,12 @@ var SourceFinder;
|
|
|
60
80
|
* a pattern, the longest existing ancestor is the literal base and only the
|
|
61
81
|
* rest is globbed, with `/` separators, since glob reads a Windows backslash
|
|
62
82
|
* as an escape.
|
|
83
|
+
*
|
|
84
|
+
* @evidence contracts/common.md#principled-implementation The wildcard part is matched below the part of the path that exists, and a base that does not exist matches nothing.
|
|
85
|
+
* @evidence contracts/common.md#clear-and-simple-design One function.
|
|
86
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It follows the filesystem.
|
|
87
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the two cases.
|
|
88
|
+
* @evidence contracts/portability.md#os-neutral-implementation An existing path is used literally, so no character glob reads specially is interpreted. Otherwise the nearest existing ancestor, found with `existsSync` and `dirname` until the filesystem root, is the glob's working directory, the remainder is rewritten from `path.sep` to `/`, and the matches are resolved against that base, so a drive letter or a UNC root never enters the pattern.
|
|
63
89
|
*/
|
|
64
90
|
SourceFinder.expand = (pattern) => __awaiter(this, void 0, void 0, function* () {
|
|
65
91
|
const absolute = path_1.default.resolve(pattern);
|
|
@@ -79,7 +105,16 @@ var SourceFinder;
|
|
|
79
105
|
const matches = yield (0, glob_1.glob)(rest, { cwd: base });
|
|
80
106
|
return matches.map((str) => path_1.default.resolve(base, str));
|
|
81
107
|
});
|
|
82
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Reports whether a file is a TypeScript source: an extension of `ts`, `mts`,
|
|
110
|
+
* or `cts` that is not a declaration file.
|
|
111
|
+
*
|
|
112
|
+
* @evidence contracts/common.md#principled-implementation The check is on the lower-cased name, and declaration files are excluded because they hold no runtime code.
|
|
113
|
+
* @evidence contracts/common.md#clear-and-simple-design One expression.
|
|
114
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It is by extension.
|
|
115
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the accepted extensions.
|
|
116
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation The function judges the spelling of a name the caller supplies and opens no path, so it owns no filesystem or process decision; extensions are compared lower-cased on every platform by design.
|
|
117
|
+
*/
|
|
83
118
|
SourceFinder.isTypeScriptSource = (file) => {
|
|
84
119
|
const lower = file.toLowerCase();
|
|
85
120
|
return (/\.(?:[cm]?ts)$/.test(lower) &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SourceFinder.js","sourceRoot":"","sources":["../../src/utils/SourceFinder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAA4B;AAC5B,gDAAwB;AAExB,IAAiB,YAAY,
|
|
1
|
+
{"version":3,"file":"SourceFinder.js","sourceRoot":"","sources":["../../src/utils/SourceFinder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,+BAA4B;AAC5B,gDAAwB;AAExB;;;;;;;;GAQG;AACH,IAAiB,YAAY,CAiH5B;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C,IAAI,YAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,IAAI,GAAW,QAAQ,CAAC;QAC5B,OAAO,YAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;YACrC,MAAM,MAAM,GAAW,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,MAAM,KAAK,IAAI;gBAAE,OAAO,EAAE,CAAC;YAC/B,IAAI,GAAG,MAAM,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,GAAW,cAAI;aACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;aACxB,KAAK,CAAC,cAAI,CAAC,GAAG,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,MAAM,OAAO,GAAa,MAAM,IAAA,WAAI,EAAC,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC,CAAA,CAAC;IAEF;;;;;;;;;OASG;IACU,+BAAkB,GAAG,CAAC,IAAY,EAAW,EAAE;QAC1D,MAAM,KAAK,GAAW,IAAI,CAAC,WAAW,EAAE,CAAC;QACzC,OAAO,CACL,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5B,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,CAChD,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,EAjHgB,YAAY,aAAZ,YAAY,GAAZ,YAAY,QAiH5B"}
|
|
@@ -1,5 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String helpers of the SDK generator.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation The namespace holds capitalization, duplicate escaping, and the recognition of anonymous type names.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design Five small functions.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The markers are the spellings typia uses for anonymous types.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states its purpose.
|
|
8
|
+
* efficient algorithms: The namespace groups string operations; each function owns its scan or duplicate lookup.
|
|
9
|
+
* reuse equivalent work: The namespace coordinates no shared computation.
|
|
10
|
+
* bound retention and release resources: The namespace owns no input-dependent retained state or handles.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation StringUtil transforms declaration names and textual content; separators in accessor names are language syntax rather than native filesystem separators.
|
|
12
|
+
*/
|
|
1
13
|
export declare namespace StringUtil {
|
|
14
|
+
/**
|
|
15
|
+
* Upper-cases the first character and lower-cases the rest.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/common.md#principled-implementation The first character is transformed alone and the rest is lower-cased.
|
|
18
|
+
* @evidence contracts/common.md#clear-and-simple-design One expression.
|
|
19
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It applies to every input.
|
|
20
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the rule.
|
|
21
|
+
* efficient algorithms: Case conversion and copying process the input characters once with proportional returned string storage.
|
|
22
|
+
* reuse equivalent work: Case conversion coordinates no shared requests.
|
|
23
|
+
* bound retention and release resources: The returned string belongs to the caller; this operation retains no state or handles.
|
|
24
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation StringUtil.capitalize transforms declaration names and textual content; separators in accessor names are language syntax rather than native filesystem separators.
|
|
25
|
+
*/
|
|
2
26
|
const capitalize: (text: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the name with underscores prefixed until it is not in the list of
|
|
29
|
+
* names to keep clear of.
|
|
30
|
+
*
|
|
31
|
+
* @evidence contracts/common.md#principled-implementation The recursion adds one underscore at a time, so the result is the shortest such name.
|
|
32
|
+
* @evidence contracts/common.md#clear-and-simple-design One curried function.
|
|
33
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The rule is generic.
|
|
34
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the result.
|
|
35
|
+
* efficient algorithms: Each occupied candidate scans the supplied keep list and adds one underscore; the number of recursive candidates is bounded by distinct occupied spellings in that list, with string comparison and copying costs proportional to candidate lengths.
|
|
36
|
+
* reuse equivalent work: The caller supplies the current keep list; this operation coordinates no shared computation between calls.
|
|
37
|
+
* bound retention and release resources: The closure retains only the caller's keep list for its own lifetime and owns no history, handles or tasks.
|
|
38
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation StringUtil.escapeDuplicate transforms declaration names and textual content; separators in accessor names are language syntax rather than native filesystem separators.
|
|
39
|
+
*/
|
|
3
40
|
const escapeDuplicate: (keep: string[]) => (change: string) => string;
|
|
4
41
|
/**
|
|
5
42
|
* The marker names typia gives a type that has no identity of its own: an
|
|
@@ -12,12 +49,41 @@ export declare namespace StringUtil {
|
|
|
12
49
|
* whether its name collided. Three call sites carried their own copy of this
|
|
13
50
|
* list, only one of them learned the `-` spelling, and the two that did not
|
|
14
51
|
* declared and referenced modules that do not exist.
|
|
52
|
+
*
|
|
53
|
+
* @evidence contracts/common.md#principled-implementation The names `__type` and `__object` and their dotted or dashed forms are the anonymous markers, so the predicate is a list of those spellings.
|
|
54
|
+
* @evidence contracts/common.md#clear-and-simple-design One expression.
|
|
55
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The list is the shared definition that the generators use.
|
|
56
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the markers.
|
|
57
|
+
* efficient algorithms: A fixed number of equalities and constant-length prefix checks inspect each name without graph traversal or input-dependent state.
|
|
58
|
+
* reuse equivalent work: This predicate coordinates no shared computation.
|
|
59
|
+
* bound retention and release resources: This predicate retains no input or handles.
|
|
60
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation StringUtil.isAnonymous transforms declaration names and textual content; separators in accessor names are language syntax rather than native filesystem separators.
|
|
15
61
|
*/
|
|
16
62
|
const isAnonymous: (str: string) => boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Reports whether a type name is implicit: the name `object`, an anonymous
|
|
65
|
+
* name, or a readonly tuple.
|
|
66
|
+
*
|
|
67
|
+
* @evidence contracts/common.md#principled-implementation It extends the anonymous test with the two other names that cannot be referenced.
|
|
68
|
+
* @evidence contracts/common.md#clear-and-simple-design One expression over `isAnonymous`.
|
|
69
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts It shares the anonymous list.
|
|
70
|
+
* @evidence contracts/common.md#meaningful-documentation The comment states the cases.
|
|
71
|
+
* efficient algorithms: Fixed name checks and one substring search take at most linear time in the name's length, without allocating a graph or cache.
|
|
72
|
+
* reuse equivalent work: This predicate coordinates no shared computation.
|
|
73
|
+
* bound retention and release resources: This predicate retains no input or handles.
|
|
74
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation StringUtil.isImplicit transforms declaration names and textual content; separators in accessor names are language syntax rather than native filesystem separators.
|
|
75
|
+
*/
|
|
17
76
|
const isImplicit: (str: string) => boolean;
|
|
18
77
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
78
|
+
* Splits a metadata name into legal TypeScript declaration accessors.
|
|
79
|
+
*
|
|
80
|
+
* Component keys remain unchanged: this conversion owns only the cloned
|
|
81
|
+
* declaration, reference and import spelling. Identifier code points survive;
|
|
82
|
+
* other code points are written as hexadecimal identifier fragments. Reserved
|
|
83
|
+
* binding and intrinsic type names receive an underscore. The route
|
|
84
|
+
* dictionary compares these same accessors when separating unequal component
|
|
85
|
+
* definitions, including a source name which already contains an escaped
|
|
86
|
+
* fragment.
|
|
21
87
|
*
|
|
22
88
|
* Typia separates a qualified name with `.` and a _duplicated_ name from its
|
|
23
89
|
* disambiguating counter with a trailing `-o<counter>`
|
|
@@ -32,6 +98,15 @@ export declare namespace StringUtil {
|
|
|
32
98
|
* guessing at the name is what the new separator makes possible -- `-` cannot
|
|
33
99
|
* occur in a qualified name, so unlike the old spelling this cannot be
|
|
34
100
|
* confused with one.
|
|
101
|
+
*
|
|
102
|
+
* @evidence contracts/common.md#principled-implementation The historical trailing duplicate marker and namespace dots are interpreted before each segment is encoded under Unicode IdentifierStart/IdentifierPart and strict binding/type-name restrictions. All clone declarations, references, imports and collision slots consume this same spelling; raw metadata component keys are not rewritten.
|
|
103
|
+
* @evidence contracts/common.md#clear-and-simple-design One accessor operation delegates segment encoding to a private helper with language-defined reserved names.
|
|
104
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Encoding depends on identifier grammar, not a DTO or consumer name; the existing semantic collision partition separates unequal definitions whose accessors coincide.
|
|
105
|
+
* @evidence contracts/common.md#meaningful-documentation The comment distinguishes raw component keys from TypeScript accessors and explains Unicode encoding, reserved bindings and duplicate compatibility.
|
|
106
|
+
* efficient algorithms: Each name and its code points are scanned once, with output space proportional to the encoded spelling; reserved-name lookup uses a fixed set.
|
|
107
|
+
* reuse equivalent work: This pure conversion coordinates no completed or in-flight work across consumers; its callers own graph and dictionary reuse.
|
|
108
|
+
* bound retention and release resources: The fixed grammar set has no input-dependent history; temporary accessor strings belong to the caller and no handles or tasks are retained.
|
|
109
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation StringUtil.accessorsOf transforms declaration names and textual content; separators in accessor names are language syntax rather than native filesystem separators.
|
|
35
110
|
*/
|
|
36
111
|
const accessorsOf: (name: string) => string[];
|
|
37
112
|
}
|