diff --git a/src/Aspire.Cli/Commands/RestoreCommand.cs b/src/Aspire.Cli/Commands/RestoreCommand.cs index 6f780ac53fe..0891a5325a1 100644 --- a/src/Aspire.Cli/Commands/RestoreCommand.cs +++ b/src/Aspire.Cli/Commands/RestoreCommand.cs @@ -3,6 +3,7 @@ using System.CommandLine; using System.Globalization; +using System.Text.Json; using Aspire.Cli.Configuration; using Aspire.Cli.DotNet; using Aspire.Cli.Interaction; @@ -25,6 +26,7 @@ internal sealed class RestoreCommand : BaseCommand private readonly IProjectLocator _projectLocator; private readonly IAppHostProjectFactory _projectFactory; + private readonly ILanguageDiscovery _languageDiscovery; private readonly IDotNetCliRunner _runner; private readonly IDotNetSdkInstaller _sdkInstaller; private readonly IInteractionService _interactionService; @@ -35,6 +37,7 @@ internal sealed class RestoreCommand : BaseCommand public RestoreCommand( IProjectLocator projectLocator, IAppHostProjectFactory projectFactory, + ILanguageDiscovery languageDiscovery, IDotNetCliRunner runner, IDotNetSdkInstaller sdkInstaller, IFeatures features, @@ -47,6 +50,7 @@ public RestoreCommand( { _projectLocator = projectLocator; _projectFactory = projectFactory; + _languageDiscovery = languageDiscovery; _runner = runner; _sdkInstaller = sdkInstaller; _interactionService = interactionService; @@ -63,13 +67,50 @@ protected override async Task ExecuteAsync(ParseResult parseResult, Cancell { using var activity = Telemetry.StartDiagnosticActivity(Name); - var searchResult = await _projectLocator.UseOrFindAppHostProjectFileAsync( - passedAppHostProjectFile, - MultipleAppHostProjectsFoundBehavior.Prompt, - createSettingsFile: false, - cancellationToken); + FileInfo? effectiveAppHostFile = null; + GuestAppHostProject? configOnlyGuestProject = null; + DirectoryInfo? configOnlyProjectDirectory = null; - var effectiveAppHostFile = searchResult.SelectedProjectFile; + try + { + var searchResult = await _projectLocator.UseOrFindAppHostProjectFileAsync( + passedAppHostProjectFile, + MultipleAppHostProjectsFoundBehavior.Prompt, + createSettingsFile: false, + cancellationToken); + + effectiveAppHostFile = searchResult.SelectedProjectFile; + } + catch (ProjectLocatorException ex) when (ex.FailureReason is ProjectLocatorFailureReason.NoProjectFileFound or ProjectLocatorFailureReason.ProjectFileDoesntExist) + { + (configOnlyGuestProject, configOnlyProjectDirectory) = TryResolveConfigOnlyGuestProject(passedAppHostProjectFile); + + if (configOnlyGuestProject is null || configOnlyProjectDirectory is null) + { + throw; + } + } + + if (configOnlyGuestProject is not null && configOnlyProjectDirectory is not null) + { + _logger.LogDebug( + "Restoring SDK code for config-only guest AppHost in {Directory}", + configOnlyProjectDirectory.FullName); + + var success = await _interactionService.ShowStatusAsync( + RestoreCommandStrings.RestoringSdkCode, + async () => await configOnlyGuestProject.BuildAndGenerateSdkAsync(configOnlyProjectDirectory, cancellationToken), + emoji: KnownEmojis.Gear); + + if (success) + { + _interactionService.DisplaySuccess( + string.Format(CultureInfo.CurrentCulture, RestoreCommandStrings.RestoreSucceeded, AspireConfigFile.FileName)); + return ExitCodeConstants.Success; + } + + return ExitCodeConstants.FailedToBuildArtifacts; + } if (effectiveAppHostFile is null) { @@ -149,4 +190,75 @@ protected override async Task ExecuteAsync(ParseResult parseResult, Cancell return ExitCodeConstants.FailedToBuildArtifacts; } } + + private (GuestAppHostProject? Project, DirectoryInfo? Directory) TryResolveConfigOnlyGuestProject(FileInfo? passedAppHostProjectFile) + { + var searchDirectory = GetFallbackSearchDirectory(passedAppHostProjectFile); + if (searchDirectory is null) + { + return (null, null); + } + + while (searchDirectory is not null) + { + AspireConfigFile? config; + try + { + config = AspireConfigFile.Load(searchDirectory.FullName); + } + catch (JsonException ex) + { + _logger.LogDebug(ex, "Ignoring invalid config while resolving config-only guest AppHost in {Directory}", searchDirectory.FullName); + return (null, null); + } + + if (config is not null) + { + if (!string.IsNullOrWhiteSpace(config.AppHost?.Path)) + { + return (null, null); + } + + if (!string.IsNullOrWhiteSpace(config.AppHost?.Language)) + { + var language = _languageDiscovery.GetLanguageById(config.AppHost.Language); + if (language is null) + { + _logger.LogDebug("Configured AppHost language '{Language}' is not available for config-only restore in {Directory}", config.AppHost.Language, searchDirectory.FullName); + return (null, null); + } + + if (_projectFactory.GetProject(language) is GuestAppHostProject guestProject) + { + _logger.LogInformation( + "Using config-only guest AppHost restore for language {Language} in {Directory}", + language.LanguageId.Value, + searchDirectory.FullName); + return (guestProject, searchDirectory); + } + + return (null, null); + } + } + + searchDirectory = searchDirectory.Parent; + } + + return (null, null); + } + + private DirectoryInfo? GetFallbackSearchDirectory(FileInfo? passedAppHostProjectFile) + { + if (passedAppHostProjectFile is null) + { + return ExecutionContext.WorkingDirectory; + } + + if (Directory.Exists(passedAppHostProjectFile.FullName)) + { + return new DirectoryInfo(passedAppHostProjectFile.FullName); + } + + return null; + } } diff --git a/src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs b/src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs index 8d2b152a7e7..3f42ed07269 100644 --- a/src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs +++ b/src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs @@ -122,6 +122,25 @@ public sealed class AtsTypeScriptCodeGenerator : ICodeGenerator // Mapping of enum type IDs to TypeScript enum names private readonly Dictionary _enumTypeNames = new(StringComparer.Ordinal); + private static string GetInterfaceName(string className) => className; + + private static string GetPromiseInterfaceName(string className) => $"{className}Promise"; + + private static string GetImplementationClassName(string className) => $"{className}Impl"; + + private static string GetImplementationPromiseClassName(string className) => $"{className}PromiseImpl"; + + private static string GetReferenceExpressionInterfaceName() => "ReferenceExpression"; + + private static string GetCancellationTokenInterfaceName() => "CancellationToken"; + + private static string GetHandleReferenceInterfaceName() => "HandleReference"; + + private string GetConcreteClassName(string typeId) => _wrapperClassNames.GetValueOrDefault(typeId) + ?? DeriveClassName(typeId); + + private string GetPublicPromiseInterfaceName(string typeId) => GetPromiseInterfaceName(GetConcreteClassName(typeId)); + /// /// Checks if an AtsTypeRef represents a handle type. /// @@ -142,13 +161,13 @@ private string MapTypeRefToTypeScript(AtsTypeRef? typeRef) // Check for wrapper class first (handles custom types like resource builders) if (_wrapperClassNames.TryGetValue(typeRef.TypeId, out var wrapperClassName)) { - return wrapperClassName; + return GetInterfaceName(wrapperClassName); } // ReferenceExpression is a value type defined in base.ts, not a handle-based wrapper if (typeRef.TypeId == AtsConstants.ReferenceExpressionTypeId) { - return "ReferenceExpression"; + return GetReferenceExpressionInterfaceName(); } return typeRef.Category switch @@ -183,7 +202,7 @@ AtsConstants.DateTime or AtsConstants.DateTimeOffset or AtsConstants.DateOnly or AtsConstants.TimeOnly => "string", AtsConstants.TimeSpan => "number", AtsConstants.Guid or AtsConstants.Uri => "string", - AtsConstants.CancellationToken => "CancellationToken", + AtsConstants.CancellationToken => GetCancellationTokenInterfaceName(), _ => typeId }; @@ -244,19 +263,19 @@ private static string GetDtoInterfaceName(string typeId) /// /// Maps a user-supplied input type to TypeScript. - /// For interface handle types, generated APIs accept wrapper instances. + /// For interface handle types, generated APIs accept any handle-bearing wrapper instance. /// For cancellation tokens, generated APIs accept either an AbortSignal or a transport-safe CancellationToken. /// private string MapInputTypeToTypeScript(AtsTypeRef? typeRef) { if (IsInterfaceHandleType(typeRef)) { - return "ResourceBuilderBase"; + return GetHandleReferenceInterfaceName(); } if (IsCancellationTokenType(typeRef)) { - return "AbortSignal | CancellationToken"; + return $"AbortSignal | {GetCancellationTokenInterfaceName()}"; } return MapTypeRefToTypeScript(typeRef); @@ -384,7 +403,7 @@ private string GenerateAspireSdk(AtsContext context) // GENERATED CODE - DO NOT EDIT import { - AspireClient as AspireClientRpc, + AspireClient, Handle, MarshalledHandle, AppHostUsageError, @@ -394,6 +413,9 @@ private string GenerateAspireSdk(AtsContext context) wrapIfHandle, registerHandleWrapper } from './transport.js'; + import type { AspireClientRpc } from './transport.js'; + + import type { HandleReference } from './base.js'; import { ResourceBuilderBase, @@ -919,17 +941,252 @@ private static string GetTypeDescription(string typeId) return $"Handle to {typeName}"; } + private string BuildPublicParameterList(List requiredParams, bool hasOptionals, string optionsInterfaceName) + { + var publicParamDefs = new List(); + foreach (var param in requiredParams) + { + var tsType = MapParameterToTypeScript(param); + publicParamDefs.Add($"{param.Name}: {tsType}"); + } + if (hasOptionals) + { + publicParamDefs.Add($"options?: {optionsInterfaceName}"); + } + + return string.Join(", ", publicParamDefs); + } + + private void GenerateInterfaceProperty(string propertyName, AtsCapabilityInfo? getter, AtsCapabilityInfo? setter) + { + if (getter?.ReturnType is { } returnType) + { + if (IsDictionaryType(returnType)) + { + var keyType = returnType.KeyType != null ? MapTypeRefToTypeScript(returnType.KeyType) : "string"; + var valueType = returnType.ValueType != null ? MapTypeRefToTypeScript(returnType.ValueType) : "unknown"; + WriteLine($" readonly {propertyName}: AspireDict<{keyType}, {valueType}>;"); + return; + } + + if (IsListType(returnType)) + { + var elementType = returnType.ElementType != null ? MapTypeRefToTypeScript(returnType.ElementType) : "unknown"; + WriteLine($" readonly {propertyName}: AspireList<{elementType}>;"); + return; + } + } + + WriteLine($" {propertyName}: {{"); + + if (getter != null) + { + var returnTypeName = MapTypeRefToTypeScript(getter.ReturnType); + WriteLine($" get: () => Promise<{returnTypeName}>;"); + } + + if (setter != null) + { + var valueParam = setter.Parameters.FirstOrDefault(p => p.Name == "value"); + if (valueParam != null) + { + var valueType = MapInputTypeToTypeScript(valueParam.Type); + WriteLine($" set: (value: {valueType}) => Promise;"); + } + } + + WriteLine(" };"); + } + + private string GetBuilderPromiseInterfaceForMethod(BuilderModel builder, AtsCapabilityInfo capability) + { + if (capability.ReturnsBuilder && capability.ReturnType?.TypeId != null && + !string.Equals(capability.ReturnType.TypeId, builder.TypeId, StringComparison.Ordinal) && + !string.Equals(capability.ReturnType.TypeId, capability.TargetTypeId, StringComparison.Ordinal)) + { + return GetPublicPromiseInterfaceName(capability.ReturnType.TypeId); + } + + return GetPromiseInterfaceName(builder.BuilderClassName); + } + + private void GenerateBuilderInterface(BuilderModel builder) + { + var interfaceName = GetInterfaceName(builder.BuilderClassName); + + WriteLine("// ============================================================================"); + WriteLine($"// {interfaceName}"); + WriteLine("// ============================================================================"); + WriteLine(); + WriteLine($"export interface {interfaceName} {{"); + WriteLine(" toJSON(): MarshalledHandle;"); + + var getters = builder.Capabilities.Where(c => c.CapabilityKind == AtsCapabilityKind.PropertyGetter).ToList(); + var setters = builder.Capabilities.Where(c => c.CapabilityKind == AtsCapabilityKind.PropertySetter).ToList(); + if (getters.Count > 0 || setters.Count > 0) + { + var properties = GroupPropertiesByName(getters, setters); + foreach (var prop in properties) + { + GenerateInterfaceProperty(prop.PropertyName, prop.Getter, prop.Setter); + } + } + + foreach (var capability in builder.Capabilities.Where(c => + c.CapabilityKind != AtsCapabilityKind.PropertyGetter && + c.CapabilityKind != AtsCapabilityKind.PropertySetter)) + { + var (requiredParams, optionalParams) = SeparateParameters(capability.Parameters); + var hasOptionals = optionalParams.Count > 0; + var optionsInterfaceName = ResolveOptionsInterfaceName(capability); + var publicParamsString = BuildPublicParameterList(requiredParams, hasOptionals, optionsInterfaceName); + var hasNonBuilderReturn = !capability.ReturnsBuilder && capability.ReturnType != null; + + if (hasNonBuilderReturn) + { + var returnType = MapTypeRefToTypeScript(capability.ReturnType); + WriteLine($" {capability.MethodName}({publicParamsString}): Promise<{returnType}>;"); + } + else + { + WriteLine($" {capability.MethodName}({publicParamsString}): {GetBuilderPromiseInterfaceForMethod(builder, capability)};"); + } + } + + WriteLine("}"); + WriteLine(); + } + + private void GenerateBuilderPromiseInterface(BuilderModel builder) + { + var capabilities = builder.Capabilities.Where(c => + c.CapabilityKind != AtsCapabilityKind.PropertyGetter && + c.CapabilityKind != AtsCapabilityKind.PropertySetter).ToList(); + + if (capabilities.Count == 0) + { + return; + } + + var interfaceName = GetInterfaceName(builder.BuilderClassName); + var promiseInterfaceName = GetPromiseInterfaceName(builder.BuilderClassName); + + WriteLine($"export interface {promiseInterfaceName} extends PromiseLike<{interfaceName}> {{"); + + foreach (var capability in capabilities) + { + var (requiredParams, optionalParams) = SeparateParameters(capability.Parameters); + var hasOptionals = optionalParams.Count > 0; + var optionsInterfaceName = ResolveOptionsInterfaceName(capability); + var paramsString = BuildPublicParameterList(requiredParams, hasOptionals, optionsInterfaceName); + var hasNonBuilderReturn = !capability.ReturnsBuilder && capability.ReturnType != null; + + if (hasNonBuilderReturn) + { + var returnType = MapTypeRefToTypeScript(capability.ReturnType); + WriteLine($" {capability.MethodName}({paramsString}): Promise<{returnType}>;"); + } + else + { + WriteLine($" {capability.MethodName}({paramsString}): {GetBuilderPromiseInterfaceForMethod(builder, capability)};"); + } + } + + WriteLine("}"); + WriteLine(); + } + + private void GenerateTypeClassInterfaceMethod(string className, AtsCapabilityInfo capability) + { + var methodName = !string.IsNullOrEmpty(capability.OwningTypeName) && capability.MethodName.Contains('.') + ? capability.MethodName[(capability.MethodName.LastIndexOf('.') + 1)..] + : GetTypeScriptMethodName(capability.MethodName); + var targetParamName = capability.TargetParameterName ?? "context"; + var userParams = capability.Parameters.Where(p => p.Name != targetParamName).ToList(); + var (requiredParams, optionalParams) = SeparateParameters(userParams); + var hasOptionals = optionalParams.Count > 0; + var optionsInterfaceName = ResolveOptionsInterfaceName(capability); + var paramsString = BuildPublicParameterList(requiredParams, hasOptionals, optionsInterfaceName); + var isVoid = capability.ReturnType == null || capability.ReturnType.TypeId == AtsConstants.Void; + + if (capability.ReturnType != null && _typesWithPromiseWrappers.Contains(capability.ReturnType.TypeId)) + { + WriteLine($" {methodName}({paramsString}): {GetPublicPromiseInterfaceName(capability.ReturnType.TypeId)};"); + } + else if (isVoid) + { + WriteLine($" {methodName}({paramsString}): {GetPromiseInterfaceName(className)};"); + } + else + { + var returnType = MapTypeRefToTypeScript(capability.ReturnType); + WriteLine($" {methodName}({paramsString}): Promise<{returnType}>;"); + } + } + + private void GenerateTypeClassInterface(BuilderModel model) + { + var className = DeriveClassName(model.TypeId); + var interfaceName = GetInterfaceName(className); + var hasMethods = HasChainableMethods(model); + + WriteLine("// ============================================================================"); + WriteLine($"// {interfaceName}"); + WriteLine("// ============================================================================"); + WriteLine(); + WriteLine($"export interface {interfaceName} {{"); + WriteLine(" toJSON(): MarshalledHandle;"); + + var getters = model.Capabilities.Where(c => c.CapabilityKind == AtsCapabilityKind.PropertyGetter).ToList(); + var setters = model.Capabilities.Where(c => c.CapabilityKind == AtsCapabilityKind.PropertySetter).ToList(); + var contextMethods = model.Capabilities.Where(c => c.CapabilityKind == AtsCapabilityKind.InstanceMethod).ToList(); + var otherMethods = model.Capabilities.Where(c => c.CapabilityKind == AtsCapabilityKind.Method).ToList(); + + var properties = GroupPropertiesByName(getters, setters); + foreach (var prop in properties) + { + GenerateInterfaceProperty(prop.PropertyName, prop.Getter, prop.Setter); + } + + foreach (var method in contextMethods.Concat(otherMethods)) + { + GenerateTypeClassInterfaceMethod(className, method); + } + + WriteLine("}"); + WriteLine(); + + if (!hasMethods) + { + return; + } + + var promiseInterfaceName = GetPromiseInterfaceName(className); + WriteLine($"export interface {promiseInterfaceName} extends PromiseLike<{interfaceName}> {{"); + foreach (var method in contextMethods.Concat(otherMethods)) + { + GenerateTypeClassInterfaceMethod(className, method); + } + WriteLine("}"); + WriteLine(); + } + private void GenerateBuilderClass(BuilderModel builder) { + GenerateBuilderInterface(builder); + GenerateBuilderPromiseInterface(builder); + + var implementationClassName = GetImplementationClassName(builder.BuilderClassName); + WriteLine("// ============================================================================"); - WriteLine($"// {builder.BuilderClassName}"); + WriteLine($"// {implementationClassName}"); WriteLine("// ============================================================================"); WriteLine(); var handleType = GetHandleTypeName(builder.TypeId); // Generate builder class extending ResourceBuilderBase - WriteLine($"export class {builder.BuilderClassName} extends ResourceBuilderBase<{handleType}> {{"); + WriteLine($"class {implementationClassName} extends ResourceBuilderBase<{handleType}> implements {builder.BuilderClassName} {{"); // Constructor WriteLine($" constructor(handle: {handleType}, client: AspireClientRpc) {{"); @@ -1022,6 +1279,7 @@ private void GenerateBuilderMethod(BuilderModel builder, AtsCapabilityInfo capab ? GetHandleTypeName(returnTypeId) : "void"; var returnsBuilder = capability.ReturnsBuilder; + var returnImplementationClassName = GetImplementationClassName(returnClassName); // Check if this method returns a non-builder, non-void type (e.g., getEndpoint returns EndpointReference) var hasNonBuilderReturn = !returnsBuilder && capability.ReturnType != null; @@ -1097,7 +1355,7 @@ private void GenerateBuilderMethod(BuilderModel builder, AtsCapabilityInfo capab WriteLine($" '{capability.CapabilityId}',"); WriteLine($" rpcArgs"); WriteLine(" );"); - WriteLine($" return new {returnClassName}(result, this._client);"); + WriteLine($" return new {returnImplementationClassName}(result, this._client);"); } else { @@ -1116,6 +1374,7 @@ private void GenerateBuilderMethod(BuilderModel builder, AtsCapabilityInfo capab WriteLine($" /** {capability.Description} */"); } var promiseClass = $"{returnClassName}Promise"; + var promiseImplementationClass = GetImplementationPromiseClassName(returnClassName); Write($" {methodName}("); Write(publicParamsString); Write($"): {promiseClass} {{"); @@ -1129,7 +1388,7 @@ private void GenerateBuilderMethod(BuilderModel builder, AtsCapabilityInfo capab // Forward all params to internal method var allParamNames = capability.Parameters.Select(p => p.Name); - Write($" return new {promiseClass}(this.{internalMethodName}("); + Write($" return new {promiseImplementationClass}(this.{internalMethodName}("); Write(string.Join(", ", allParamNames)); WriteLine("));"); WriteLine(" }"); @@ -1163,14 +1422,24 @@ private void GenerateArgsObjectWithConditionals( private void GenerateThenableClass(BuilderModel builder) { + var capabilities = builder.Capabilities.Where(c => + c.CapabilityKind != AtsCapabilityKind.PropertyGetter && + c.CapabilityKind != AtsCapabilityKind.PropertySetter).ToList(); + + if (capabilities.Count == 0) + { + return; + } + var promiseClass = $"{builder.BuilderClassName}Promise"; + var promiseImplementationClass = GetImplementationPromiseClassName(builder.BuilderClassName); WriteLine($"/**"); WriteLine($" * Thenable wrapper for {builder.BuilderClassName} that enables fluent chaining."); WriteLine($" * @example"); WriteLine($" * await builder.addSomething().withX().withY();"); WriteLine($" */"); - WriteLine($"export class {promiseClass} implements PromiseLike<{builder.BuilderClassName}> {{"); + WriteLine($"class {promiseImplementationClass} implements {promiseClass} {{"); WriteLine($" constructor(private _promise: Promise<{builder.BuilderClassName}>) {{}}"); WriteLine(); @@ -1186,9 +1455,7 @@ private void GenerateThenableClass(BuilderModel builder) // Generate fluent methods that chain via .then() // Capabilities are already flattened - no need to collect from parents // Filter out property getters and setters - they are not methods - foreach (var capability in builder.Capabilities.Where(c => - c.CapabilityKind != AtsCapabilityKind.PropertyGetter && - c.CapabilityKind != AtsCapabilityKind.PropertySetter)) + foreach (var capability in capabilities) { var methodName = capability.MethodName; @@ -1247,6 +1514,7 @@ private void GenerateThenableClass(BuilderModel builder) // For fluent builder methods, determine the correct promise class. // Factory methods returning a different builder type use the return type's promise class. var methodPromiseClass = promiseClass; + var methodPromiseImplementationClass = promiseImplementationClass; if (capability.ReturnsBuilder && capability.ReturnType?.TypeId != null && !string.Equals(capability.ReturnType.TypeId, builder.TypeId, StringComparison.Ordinal) && !string.Equals(capability.ReturnType.TypeId, capability.TargetTypeId, StringComparison.Ordinal)) @@ -1254,6 +1522,7 @@ private void GenerateThenableClass(BuilderModel builder) var returnClass = _wrapperClassNames.GetValueOrDefault(capability.ReturnType.TypeId) ?? DeriveClassName(capability.ReturnType.TypeId); methodPromiseClass = $"{returnClass}Promise"; + methodPromiseImplementationClass = GetImplementationPromiseClassName(returnClass); } Write($" {methodName}("); @@ -1261,7 +1530,7 @@ private void GenerateThenableClass(BuilderModel builder) Write($"): {methodPromiseClass} {{"); WriteLine(); // Forward to the public method on the underlying object, wrapping result in promise class - Write($" return new {methodPromiseClass}(this._promise.then(obj => obj.{methodName}("); + Write($" return new {methodPromiseImplementationClass}(this._promise.then(obj => obj.{methodName}("); Write(argsString); WriteLine(")));"); WriteLine(" }"); @@ -1326,6 +1595,8 @@ private void GenerateEntryPointFunction(AtsCapabilityInfo capability) // Return type has Promise wrapper - generate fluent function var returnWrapperClass = _wrapperClassNames.GetValueOrDefault(capReturnTypeId) ?? DeriveClassName(capReturnTypeId); + var returnWrapperImplementationClass = GetImplementationClassName(returnWrapperClass); + var returnPromiseImplementationClass = GetImplementationPromiseClassName(returnWrapperClass); var handleType = GetHandleTypeName(capReturnTypeId); Write($"export function {methodName}("); @@ -1342,8 +1613,8 @@ private void GenerateEntryPointFunction(AtsCapabilityInfo capability) WriteLine($" const promise = client.invokeCapability<{handleType}>("); WriteLine($" '{capability.CapabilityId}',"); WriteLine(" rpcArgs"); - WriteLine($" ).then(handle => new {returnWrapperClass}(handle, client));"); - WriteLine($" return new {returnPromiseWrapper}(promise);"); + WriteLine($" ).then(handle => new {returnWrapperImplementationClass}(handle, client));"); + WriteLine($" return new {returnPromiseImplementationClass}(promise);"); WriteLine("}"); } else @@ -1493,7 +1764,7 @@ private void GenerateCallbackBody(AtsParameterInfo callbackParam, IReadOnlyList< // For types with wrapper classes, create an instance of the wrapper var handleType = GetHandleTypeName(cbTypeId); WriteLine($" const {cbParam.Name}Handle = wrapIfHandle({cbParam.Name}Data) as {handleType};"); - WriteLine($" const {cbParam.Name} = new {wrapperClassName}({cbParam.Name}Handle, this._client);"); + WriteLine($" const {cbParam.Name} = new {GetImplementationClassName(wrapperClassName)}({cbParam.Name}Handle, this._client);"); } else { @@ -1522,7 +1793,7 @@ private void GenerateCallbackBody(AtsParameterInfo callbackParam, IReadOnlyList< // For types with wrapper classes, create an instance of the wrapper var handleType = GetHandleTypeName(cbTypeId); WriteLine($" const {cbParam.Name}Handle = wrapIfHandle({callbackArgName}) as {handleType};"); - WriteLine($" const {cbParam.Name} = new {wrapperClassName}({cbParam.Name}Handle, this._client);"); + WriteLine($" const {cbParam.Name} = new {GetImplementationClassName(wrapperClassName)}({cbParam.Name}Handle, this._client);"); } else { @@ -1558,7 +1829,7 @@ export async function connect(): Promise { ); } - const client = new AspireClientRpc(socketPath); + const client = new AspireClient(socketPath); await client.connect(); // Exit the process if the server connection is lost @@ -1600,12 +1871,13 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise typeClasses, { var className = _wrapperClassNames.GetValueOrDefault(typeClass.TypeId) ?? DeriveClassName(typeClass.TypeId); var handleType = GetHandleTypeName(typeClass.TypeId); - WriteLine($"registerHandleWrapper('{typeClass.TypeId}', (handle, client) => new {className}(handle as {handleType}, client));"); + WriteLine($"registerHandleWrapper('{typeClass.TypeId}', (handle, client) => new {GetImplementationClassName(className)}(handle as {handleType}, client));"); } // Register resource builder classes @@ -1682,7 +1954,7 @@ private void GenerateHandleWrapperRegistrations(List typeClasses, { var className = _wrapperClassNames.GetValueOrDefault(builder.TypeId) ?? DeriveClassName(builder.TypeId); var handleType = GetHandleTypeName(builder.TypeId); - WriteLine($"registerHandleWrapper('{builder.TypeId}', (handle, client) => new {className}(handle as {handleType}, client));"); + WriteLine($"registerHandleWrapper('{builder.TypeId}', (handle, client) => new {GetImplementationClassName(className)}(handle as {handleType}, client));"); } WriteLine(); @@ -1697,10 +1969,13 @@ private void GenerateTypeClass(BuilderModel model) { var handleType = GetHandleTypeName(model.TypeId); var className = DeriveClassName(model.TypeId); + var implementationClassName = GetImplementationClassName(className); var hasMethods = HasChainableMethods(model); + GenerateTypeClassInterface(model); + WriteLine("// ============================================================================"); - WriteLine($"// {className}"); + WriteLine($"// {implementationClassName}"); WriteLine("// ============================================================================"); WriteLine(); @@ -1716,7 +1991,7 @@ private void GenerateTypeClass(BuilderModel model) WriteLine($"/**"); WriteLine($" * Type class for {className}."); WriteLine($" */"); - WriteLine($"export class {className} {{"); + WriteLine($"class {implementationClassName} implements {className} {{"); WriteLine($" constructor(private _handle: {handleType}, private _client: AspireClientRpc) {{}}"); WriteLine(); WriteLine($" /** Serialize for JSON-RPC transport */"); @@ -1853,7 +2128,7 @@ private void GeneratePropertyLikeObject(string propertyName, AtsCapabilityInfo? // Check if return type is a wrapper class - use property-like object returning wrapper if (getter.ReturnType?.TypeId != null && _wrapperClassNames.TryGetValue(getter.ReturnType.TypeId, out var wrapperClassName)) { - GenerateWrapperPropertyObject(propertyName, getter, wrapperClassName); + GenerateWrapperPropertyObject(propertyName, getter, setter, wrapperClassName); return; } } @@ -1911,9 +2186,10 @@ private void GeneratePropertyLikeObject(string propertyName, AtsCapabilityInfo? /// /// Generates a property-like object that returns a wrapper class. /// - private void GenerateWrapperPropertyObject(string propertyName, AtsCapabilityInfo getter, string wrapperClassName) + private void GenerateWrapperPropertyObject(string propertyName, AtsCapabilityInfo getter, AtsCapabilityInfo? setter, string wrapperClassName) { var handleType = GetHandleTypeName(getter.ReturnType!.TypeId); + var wrapperImplementationClassName = GetImplementationClassName(wrapperClassName); if (!string.IsNullOrEmpty(getter.Description)) { @@ -1926,8 +2202,24 @@ private void GenerateWrapperPropertyObject(string propertyName, AtsCapabilityInf WriteLine($" '{getter.CapabilityId}',"); WriteLine($" {{ context: this._handle }}"); WriteLine(" );"); - WriteLine($" return new {wrapperClassName}(handle, this._client);"); + WriteLine($" return new {wrapperImplementationClassName}(handle, this._client);"); WriteLine(" },"); + + if (setter != null) + { + var valueParam = setter.Parameters.FirstOrDefault(p => p.Name == "value"); + if (valueParam != null) + { + var valueType = MapInputTypeToTypeScript(valueParam.Type); + WriteLine($" set: async (value: {valueType}): Promise => {{"); + WriteLine($" await this._client.invokeCapability("); + WriteLine($" '{setter.CapabilityId}',"); + WriteLine($" {{ context: this._handle, {GetRpcArgumentEntry("value", valueParam.Type)} }}"); + WriteLine(" );"); + WriteLine(" }"); + } + } + WriteLine(" };"); WriteLine(); } @@ -2209,6 +2501,7 @@ private void GenerateTypeClassMethod(BuilderModel model, AtsCapabilityInfo capab { var className = DeriveClassName(model.TypeId); var promiseClass = $"{className}Promise"; + var promiseImplementationClass = GetImplementationPromiseClassName(className); // Use OwningTypeName if available to extract method name, otherwise parse from MethodName var methodName = !string.IsNullOrEmpty(capability.OwningTypeName) && capability.MethodName.Contains('.') @@ -2265,6 +2558,8 @@ private void GenerateTypeClassMethod(BuilderModel model, AtsCapabilityInfo capab { var returnWrapperClass = _wrapperClassNames.GetValueOrDefault(capability.ReturnType!.TypeId) ?? DeriveClassName(capability.ReturnType.TypeId); + var returnWrapperImplementationClass = GetImplementationClassName(returnWrapperClass); + var returnPromiseImplementationClass = GetImplementationPromiseClassName(returnWrapperClass); var returnHandleType = GetHandleTypeName(capability.ReturnType.TypeId); // Generate internal async method @@ -2287,7 +2582,7 @@ private void GenerateTypeClassMethod(BuilderModel model, AtsCapabilityInfo capab WriteLine($" '{capability.CapabilityId}',"); WriteLine($" rpcArgs"); WriteLine(" );"); - WriteLine($" return new {returnWrapperClass}(result, this._client);"); + WriteLine($" return new {returnWrapperImplementationClass}(result, this._client);"); WriteLine(" }"); WriteLine(); @@ -2302,7 +2597,7 @@ private void GenerateTypeClassMethod(BuilderModel model, AtsCapabilityInfo capab WriteLine($" const {param.Name} = options?.{param.Name};"); } - Write($" return new {returnPromiseWrapper}(this.{internalMethodName}("); + Write($" return new {returnPromiseImplementationClass}(this.{internalMethodName}("); Write(string.Join(", ", userParams.Select(p => p.Name))); WriteLine("));"); WriteLine(" }"); @@ -2345,7 +2640,7 @@ private void GenerateTypeClassMethod(BuilderModel model, AtsCapabilityInfo capab WriteLine($" const {param.Name} = options?.{param.Name};"); } - Write($" return new {promiseClass}(this.{internalMethodName}("); + Write($" return new {promiseImplementationClass}(this.{internalMethodName}("); Write(string.Join(", ", userParams.Select(p => p.Name))); WriteLine("));"); WriteLine(" }"); @@ -2400,11 +2695,12 @@ private void GenerateTypeClassThenableWrapper(BuilderModel model, List {{"); + WriteLine($"class {promiseImplementationClass} implements {promiseClass} {{"); WriteLine($" constructor(private _promise: Promise<{className}>) {{}}"); WriteLine(); @@ -2469,11 +2765,14 @@ private void GenerateTypeClassThenableWrapper(BuilderModel model, List obj.{methodName}("); + Write($" return new {returnPromiseImplementationClass}(this._promise.then(obj => obj.{methodName}("); Write(argsString); WriteLine(")));"); WriteLine(" }"); @@ -2484,7 +2783,7 @@ private void GenerateTypeClassThenableWrapper(BuilderModel model, List obj.{methodName}("); + Write($" return new {promiseImplementationClass}(this._promise.then(obj => obj.{methodName}("); Write(argsString); WriteLine(")));"); WriteLine(" }"); diff --git a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts index 95f3429b80d..8d7033494fb 100644 --- a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts +++ b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts @@ -1,5 +1,6 @@ -// base.ts - Core Aspire types: base classes, ReferenceExpression +// base.ts - Core Aspire types: base classes, ReferenceExpression import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; +import type { AspireClientRpc } from './transport.js'; // Re-export transport types for convenience export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; @@ -38,49 +39,59 @@ export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './t * await api.withEnvironment("REDIS_URL", expr); * ``` */ -export class ReferenceExpression { - // Expression mode fields - private readonly _format?: string; - private readonly _valueProviders?: unknown[]; - - // Conditional mode fields - private readonly _condition?: unknown; - private readonly _whenTrue?: ReferenceExpression; - private readonly _whenFalse?: ReferenceExpression; - private readonly _matchValue?: string; - - // Handle mode fields (when wrapping a server-returned handle) - private readonly _handle?: Handle; - private readonly _client?: AspireClient; +const referenceExpressionState = new WeakMap(); +export class ReferenceExpression { constructor(format: string, valueProviders: unknown[]); - constructor(handle: Handle, client: AspireClient); + constructor(handle: Handle, client: AspireClientRpc); constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); constructor( handleOrFormatOrCondition: Handle | string | unknown, - clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + clientOrValueProvidersOrMatchValue: AspireClientRpc | unknown[] | string, whenTrueOrWhenFalse?: ReferenceExpression, whenFalse?: ReferenceExpression ) { + const state: { + format?: string; + valueProviders?: unknown[]; + condition?: unknown; + whenTrue?: ReferenceExpression; + whenFalse?: ReferenceExpression; + matchValue?: string; + handle?: Handle; + client?: AspireClientRpc; + } = {}; + if (typeof handleOrFormatOrCondition === 'string') { - this._format = handleOrFormatOrCondition; - this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; - } else if (handleOrFormatOrCondition instanceof Handle) { - this._handle = handleOrFormatOrCondition; - this._client = clientOrValueProvidersOrMatchValue as AspireClient; + state.format = handleOrFormatOrCondition; + state.valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (isHandleLike(handleOrFormatOrCondition)) { + state.handle = handleOrFormatOrCondition; + state.client = clientOrValueProvidersOrMatchValue as AspireClientRpc; } else { - this._condition = handleOrFormatOrCondition; - this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; - this._whenTrue = whenTrueOrWhenFalse; - this._whenFalse = whenFalse; + state.condition = handleOrFormatOrCondition; + state.matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + state.whenTrue = whenTrueOrWhenFalse; + state.whenFalse = whenFalse; } + + referenceExpressionState.set(this, state); } /** * Gets whether this reference expression is conditional. */ get isConditional(): boolean { - return this._condition !== undefined; + return referenceExpressionState.get(this)?.condition !== undefined; } /** @@ -90,40 +101,6 @@ export class ReferenceExpression { * @param values - The interpolated values (handles to value providers) * @returns A ReferenceExpression instance */ - static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { - // Build the format string with {0}, {1}, etc. placeholders - let format = ''; - for (let i = 0; i < strings.length; i++) { - format += strings[i]; - if (i < values.length) { - format += `{${i}}`; - } - } - - // Extract handles from values - const valueProviders = values.map(extractHandleForExpr); - - return new ReferenceExpression(format, valueProviders); - } - - /** - * Creates a conditional reference expression from its constituent parts. - * - * @param condition - A value provider whose result is compared to matchValue - * @param whenTrue - The expression to use when the condition matches - * @param whenFalse - The expression to use when the condition does not match - * @param matchValue - The value to compare the condition against (defaults to "True") - * @returns A ReferenceExpression instance in conditional mode - */ - static createConditional( - condition: unknown, - matchValue: string, - whenTrue: ReferenceExpression, - whenFalse: ReferenceExpression - ): ReferenceExpression { - return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); - } - /** * Serializes the reference expression for JSON-RPC transport. * In expression mode, uses the $expr format with format + valueProviders. @@ -131,25 +108,27 @@ export class ReferenceExpression { * In handle mode, delegates to the handle's serialization. */ toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { - if (this._handle) { - return this._handle.toJSON(); + const state = referenceExpressionState.get(this)!; + + if (state.handle) { + return state.handle.toJSON(); } if (this.isConditional) { return { $expr: { - condition: extractHandleForExpr(this._condition), - whenTrue: this._whenTrue!.toJSON(), - whenFalse: this._whenFalse!.toJSON(), - matchValue: this._matchValue! + condition: extractHandleForExpr(state.condition), + whenTrue: state.whenTrue!.toJSON(), + whenFalse: state.whenFalse!.toJSON(), + matchValue: state.matchValue! } }; } return { $expr: { - format: this._format!, - valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + format: state.format!, + valueProviders: state.valueProviders && state.valueProviders.length > 0 ? state.valueProviders : undefined } }; } @@ -162,14 +141,16 @@ export class ReferenceExpression { * @returns The resolved string value, or null if the expression resolves to null */ async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { - if (!this._handle || !this._client) { + const state = referenceExpressionState.get(this)!; + + if (!state.handle || !state.client) { throw new Error('getValue is only available on server-returned ReferenceExpression instances'); } - const cancellationTokenId = registerCancellation(this._client, cancellationToken); + const cancellationTokenId = registerCancellation(state.client, cancellationToken); try { - const rpcArgs: Record = { context: this._handle }; + const rpcArgs: Record = { context: state.handle }; if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; - return await this._client.invokeCapability( + return await state.client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValue', rpcArgs ); @@ -182,16 +163,84 @@ export class ReferenceExpression { * String representation for debugging. */ toString(): string { - if (this._handle) { + const state = referenceExpressionState.get(this)!; + + if (state.handle) { return `ReferenceExpression(handle)`; } if (this.isConditional) { return `ReferenceExpression(conditional)`; } - return `ReferenceExpression(${this._format})`; + return `ReferenceExpression(${state.format})`; + } + + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return createReferenceExpression(strings, ...values); + } + + static createConditional( + condition: unknown, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression; + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression; + static createConditional( + condition: unknown, + matchValueOrWhenTrue: string | ReferenceExpression, + whenTrueOrWhenFalse: ReferenceExpression, + whenFalse?: ReferenceExpression + ): ReferenceExpression { + if (typeof matchValueOrWhenTrue === 'string') { + return createConditionalReferenceExpression(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse, whenFalse!); + } + + return createConditionalReferenceExpression(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse); } } +function createReferenceExpression(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); +} + +function createConditionalReferenceExpression( + condition: unknown, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression +): ReferenceExpression; +function createConditionalReferenceExpression( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression +): ReferenceExpression; +function createConditionalReferenceExpression( + condition: unknown, + matchValueOrWhenTrue: string | ReferenceExpression, + whenTrueOrWhenFalse: ReferenceExpression, + whenFalse?: ReferenceExpression +): ReferenceExpression { + if (typeof matchValueOrWhenTrue === 'string') { + return new ReferenceExpression(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse, whenFalse!); + } + + return new ReferenceExpression(condition, 'True', matchValueOrWhenTrue, whenTrueOrWhenFalse); +} + registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => new ReferenceExpression(handle, client) ); @@ -217,7 +266,7 @@ function extractHandleForExpr(value: unknown): unknown { } // Handle objects - get their JSON representation - if (value instanceof Handle) { + if (isHandleLike(value)) { return value.toJSON(); } @@ -240,6 +289,19 @@ function extractHandleForExpr(value: unknown): unknown { ); } +function isHandleLike(value: unknown): value is Handle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + typeof (value as { $handle?: unknown }).$handle === 'string' && + '$type' in value && + typeof (value as { $type?: unknown }).$type === 'string' && + 'toJSON' in value && + typeof (value as { toJSON?: unknown }).toJSON === 'function' + ); +} + /** * Tagged template function for creating reference expressions. * @@ -266,12 +328,16 @@ export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): Re // ResourceBuilderBase // ============================================================================ +export interface HandleReference { + toJSON(): MarshalledHandle; +} + /** * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). * Provides handle management and JSON serialization. */ -export class ResourceBuilderBase { - constructor(protected _handle: THandle, protected _client: AspireClient) {} +export class ResourceBuilderBase implements HandleReference { + constructor(protected _handle: THandle, protected _client: AspireClientRpc) {} toJSON(): MarshalledHandle { return this._handle.toJSON(); } } @@ -292,13 +358,24 @@ export class ResourceBuilderBase { * await items.add(newItem); * ``` */ -export class AspireList { +export type AspireList = { + count(): Promise; + get(index: number): Promise; + add(item: T): Promise; + removeAt(index: number): Promise; + clear(): Promise; + toArray(): Promise; + toTransportValue(): Promise; + toJSON(): MarshalledHandle; +}; + +class AspireListImpl implements AspireList { private _resolvedHandle?: Handle; private _resolvePromise?: Promise; constructor( private readonly _handleOrContext: Handle, - private readonly _client: AspireClient, + private readonly _client: AspireClientRpc, private readonly _typeId: string, private readonly _getterCapabilityId?: string ) { @@ -409,6 +486,8 @@ export class AspireList { } } +export const AspireList = AspireListImpl; + // ============================================================================ // AspireDict - Mutable Dictionary Wrapper // ============================================================================ @@ -425,13 +504,27 @@ export class AspireList { * const hasKey = await config.containsKey("key"); * ``` */ -export class AspireDict { +export type AspireDict = { + count(): Promise; + get(key: K): Promise; + set(key: K, value: V): Promise; + containsKey(key: K): Promise; + remove(key: K): Promise; + clear(): Promise; + keys(): Promise; + values(): Promise; + toObject(): Promise>; + toTransportValue(): Promise; + toJSON(): MarshalledHandle; +}; + +class AspireDictImpl implements AspireDict { private _resolvedHandle?: Handle; private _resolvePromise?: Promise; constructor( private readonly _handleOrContext: Handle, - private readonly _client: AspireClient, + private readonly _client: AspireClientRpc, private readonly _typeId: string, private readonly _getterCapabilityId?: string ) { @@ -576,3 +669,5 @@ export class AspireDict { return this._resolvedHandle.toJSON(); } } + +export const AspireDict = AspireDictImpl; diff --git a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts index 904e57142f9..148ffe057ef 100644 --- a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts +++ b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts @@ -6,11 +6,21 @@ import * as rpc from 'vscode-jsonrpc/node.js'; // Base Types // ============================================================================ +/** + * Structural client surface used by generated wrappers and transport helpers. + * This keeps generated types assignable across separately restored SDK copies. + */ +export interface AspireClientRpc { + readonly connected: boolean; + invokeCapability(capabilityId: string, args?: Record): Promise; + cancelToken(cancellationId: string): Promise; +} + /** * Type for callback functions that can be registered and invoked from .NET. * Internal: receives args and client for handle wrapping. */ -export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; +export type CallbackFunction = (args: unknown, client: AspireClientRpc) => unknown | Promise; /** * Represents a handle to a .NET object in the ATS system. @@ -104,6 +114,17 @@ function isAbortSignal(value: unknown): value is AbortSignal { ); } +function isCancellationTokenLike(value: unknown): value is CancellationToken { + return ( + value !== null && + typeof value === 'object' && + 'register' in value && + typeof (value as { register?: unknown }).register === 'function' && + 'toJSON' in value && + typeof (value as { toJSON?: unknown }).toJSON === 'function' + ); +} + function isPlainObject(value: unknown): value is Record { if (value === null || typeof value !== 'object') { return false; @@ -146,35 +167,25 @@ function createCircularReferenceError(capabilityId: string, path: string): AppHo * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") */ export class Handle { - private readonly _handleId: string; - private readonly _typeId: T; + readonly $handle: string; + readonly $type: T; constructor(marshalled: MarshalledHandle) { - this._handleId = marshalled.$handle; - this._typeId = marshalled.$type as T; - } - - /** The handle ID (instance number) */ - get $handle(): string { - return this._handleId; - } - - /** The ATS type ID */ - get $type(): T { - return this._typeId; + this.$handle = marshalled.$handle; + this.$type = marshalled.$type as T; } /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return { - $handle: this._handleId, - $type: this._typeId + $handle: this.$handle, + $type: this.$type }; } /** String representation for debugging */ toString(): string { - return `Handle<${this._typeId}>(${this._handleId})`; + return `Handle<${this.$type}>(${this.$handle})`; } } @@ -205,23 +216,48 @@ export class Handle { * const connectionString = await connectionStringExpression.getValue(cancellationToken); * ``` */ -export class CancellationToken { - private readonly _signal?: AbortSignal; - private readonly _remoteTokenId?: string; +const cancellationTokenState = new WeakMap(); +export class CancellationToken { constructor(signal?: AbortSignal); constructor(tokenId?: string); constructor(value?: AbortSignal | string | null) { + const state: { signal?: AbortSignal; remoteTokenId?: string } = {}; + if (typeof value === 'string') { - this._remoteTokenId = value; + state.remoteTokenId = value; } else if (isAbortSignal(value)) { - this._signal = value; + state.signal = value; } + + cancellationTokenState.set(this, state); } /** * Creates a cancellation token from a local {@link AbortSignal}. */ + toJSON(): string | undefined { + return cancellationTokenState.get(this)?.remoteTokenId; + } + + register(client?: AspireClientRpc): string | undefined { + const state = cancellationTokenState.get(this); + + if (state?.remoteTokenId !== undefined) { + return state.remoteTokenId; + } + + return client + ? registerCancellation(client, state?.signal) + : registerCancellation(state?.signal); + } + + /** + * Creates transport-safe cancellation token values for the generated SDK. + */ static from(signal?: AbortSignal): CancellationToken { return new CancellationToken(signal); } @@ -231,7 +267,7 @@ export class CancellationToken { * Generated code uses this to materialize values that come from the AppHost. */ static fromValue(value: unknown): CancellationToken { - if (value instanceof CancellationToken) { + if (isCancellationTokenLike(value)) { return value; } @@ -245,23 +281,6 @@ export class CancellationToken { return new CancellationToken(); } - - /** - * Serializes the token for JSON-RPC transport. - */ - toJSON(): string | undefined { - return this._remoteTokenId; - } - - register(client?: AspireClient): string | undefined { - if (this._remoteTokenId !== undefined) { - return this._remoteTokenId; - } - - return client - ? registerCancellation(client, this._signal) - : registerCancellation(this._signal); - } } // ============================================================================ @@ -271,7 +290,7 @@ export class CancellationToken { /** * Factory function for creating typed wrapper instances from handles. */ -export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; +export type HandleWrapperFactory = (handle: Handle, client: AspireClientRpc) => unknown; /** * Registry of handle wrapper factories by type ID. @@ -294,7 +313,7 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param value - The value to potentially wrap * @param client - Optional client for creating typed wrapper instances */ -export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { +export function wrapIfHandle(value: unknown, client?: AspireClientRpc): unknown { if (isMarshalledHandle(value)) { const handle = new Handle(value); const typeId = value.$type; @@ -456,7 +475,7 @@ export function registerCallback( const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; // Wrap the callback to handle .NET's positional argument format - const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + const wrapper: CallbackFunction = async (args: unknown, client: AspireClientRpc) => { // .NET sends args as object { p0: value0, p1: value1, ... } if (args && typeof args === 'object' && !Array.isArray(args)) { const argObj = args as Record; @@ -537,7 +556,7 @@ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; const connectedClients = new Set(); -function resolveCancellationClient(client?: AspireClient): AspireClient { +function resolveCancellationClient(client?: AspireClientRpc): AspireClientRpc { if (client) { return client; } @@ -559,6 +578,22 @@ function resolveCancellationClient(client?: AspireClient): AspireClient { ); } +function isAspireClientLike(value: unknown): value is AspireClientRpc { + if (!value || typeof value !== 'object') { + return false; + } + + const candidate = value as { + invokeCapability?: unknown; + cancelToken?: unknown; + connected?: unknown; + }; + + return typeof candidate.invokeCapability === 'function' + && typeof candidate.cancelToken === 'function' + && typeof candidate.connected === 'boolean'; +} + /** * Registers cancellation support for a local signal or SDK cancellation token. * Returns a cancellation ID that should be passed to methods accepting cancellation input. @@ -569,12 +604,12 @@ function resolveCancellationClient(client?: AspireClient): AspireClient { * @param signalOrToken - The signal or token to register (optional) * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None */ -export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation(client: AspireClientRpc, signalOrToken?: AbortSignal | CancellationToken): string | undefined; /** * Registers cancellation support using the single connected AspireClient. * * @param signalOrToken - The signal or token to register (optional) - * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * @returns The cancellation ID, or undefined if no value was provided, the signal was already aborted, or the token maps to CancellationToken.None * * @example * const controller = new AbortController(); @@ -588,10 +623,10 @@ export function registerCancellation(client: AspireClient, signalOrToken?: Abort */ export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; export function registerCancellation( - clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + clientOrSignalOrToken?: AspireClientRpc | AbortSignal | CancellationToken, maybeSignalOrToken?: AbortSignal | CancellationToken ): string | undefined { - const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const client = isAspireClientLike(clientOrSignalOrToken) ? clientOrSignalOrToken : undefined; const signalOrToken = client ? maybeSignalOrToken : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; @@ -600,7 +635,7 @@ export function registerCancellation( return undefined; } - if (signalOrToken instanceof CancellationToken) { + if (isCancellationTokenLike(signalOrToken)) { return signalOrToken.register(client); } @@ -638,7 +673,7 @@ export function registerCancellation( async function marshalTransportValue( value: unknown, - client: AspireClient, + client: AspireClientRpc, cancellationIds: string[], capabilityId: string, path: string = 'args', @@ -648,7 +683,7 @@ async function marshalTransportValue( return value; } - if (value instanceof CancellationToken) { + if (isCancellationTokenLike(value)) { const cancellationId = value.register(client); if (cancellationId !== undefined) { cancellationIds.push(cancellationId); @@ -711,7 +746,7 @@ export function unregisterCancellation(cancellationId: string | undefined): void /** * Client for connecting to the Aspire AppHost via socket/named pipe. */ -export class AspireClient { +export class AspireClient implements AspireClientRpc { private connection: rpc.MessageConnection | null = null; private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = []; diff --git a/tests/Aspire.Cli.EndToEnd.Tests/TypeScriptReusablePackageTests.cs b/tests/Aspire.Cli.EndToEnd.Tests/TypeScriptReusablePackageTests.cs new file mode 100644 index 00000000000..779d73bc7cc --- /dev/null +++ b/tests/Aspire.Cli.EndToEnd.Tests/TypeScriptReusablePackageTests.cs @@ -0,0 +1,225 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Text.Json; +using Aspire.Cli.EndToEnd.Tests.Helpers; +using Aspire.Cli.Tests.Utils; +using Hex1b.Automation; +using Xunit; + +namespace Aspire.Cli.EndToEnd.Tests; + +/// +/// End-to-end tests for reusable TypeScript helper packages that consume generated Aspire SDK types. +/// +public sealed class TypeScriptReusablePackageTests(ITestOutputHelper output) +{ + [Fact] + public async Task RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes() + { + var repoRoot = CliE2ETestHelpers.GetRepoRoot(); + var installMode = CliE2ETestHelpers.DetectDockerInstallMode(repoRoot); + var workspace = TemporaryWorkspace.Create(output); + + using var terminal = CliE2ETestHelpers.CreateDockerTestTerminal(repoRoot, installMode, output, variant: CliE2ETestHelpers.DockerfileVariant.Polyglot, workspace: workspace); + + var pendingRun = terminal.RunAsync(TestContext.Current.CancellationToken); + + var counter = new SequenceCounter(); + var auto = new Hex1bTerminalAutomator(terminal, defaultTimeout: TimeSpan.FromSeconds(500)); + + await auto.PrepareDockerEnvironmentAsync(counter, workspace); + await auto.InstallAspireCliInDockerAsync(installMode, counter); + + var appDirectory = Directory.CreateDirectory(Path.Combine(workspace.WorkspaceRoot.FullName, "app")); + var helperDirectory = Directory.CreateDirectory(Path.Combine(workspace.WorkspaceRoot.FullName, "packages", "aspire-commands")); + var helperSourceDirectory = helperDirectory.CreateSubdirectory("src"); + + await auto.TypeAsync($"cd {CliE2ETestHelpers.ToContainerPath(appDirectory.FullName, workspace)}"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter); + + // The main app is a normal TypeScript AppHost created by the CLI. + await auto.TypeAsync("aspire init --language typescript --non-interactive"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter); + + var appAppHostPath = Path.Combine(appDirectory.FullName, "apphost.ts"); + Assert.True(File.Exists(appAppHostPath), $"Expected the CLI-created app to contain {appAppHostPath}."); + + await auto.TypeAsync("aspire add Aspire.Hosting.Redis"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("The package Aspire.Hosting.", timeout: TimeSpan.FromMinutes(2)); + await auto.WaitForSuccessPromptAsync(counter); + + var sdkVersion = GetSdkVersion(appDirectory); + WriteHelperPackageFiles(helperDirectory, helperSourceDirectory, sdkVersion); + RewriteAppHostFiles(appDirectory); + + // The helper package is intentionally config-only: it has aspire.config.json but no apphost.ts. + var helperAppHostPath = Path.Combine(helperDirectory.FullName, "apphost.ts"); + Assert.False(File.Exists(helperAppHostPath), $"Config-only helper package unexpectedly contained {helperAppHostPath}."); + + await auto.TypeAsync($"cd {CliE2ETestHelpers.ToContainerPath(helperDirectory.FullName, workspace)}"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter); + + await auto.TypeAsync("aspire restore"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("SDK code restored successfully", timeout: TimeSpan.FromMinutes(3)); + await auto.WaitForSuccessPromptAsync(counter); + + var helperModulesDirectory = Path.Combine(helperDirectory.FullName, ".modules"); + Assert.True(Directory.Exists(helperModulesDirectory), $".modules directory was not created for helper package at {helperModulesDirectory}"); + Assert.Contains("addRedis", File.ReadAllText(Path.Combine(helperModulesDirectory, "aspire.ts"))); + + await auto.TypeAsync("npx tsc --noEmit"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptFailFastAsync(counter, TimeSpan.FromMinutes(2)); + + await auto.TypeAsync($"cd {CliE2ETestHelpers.ToContainerPath(appDirectory.FullName, workspace)}"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter); + + await auto.TypeAsync("aspire restore"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("SDK code restored successfully", timeout: TimeSpan.FromMinutes(3)); + await auto.WaitForSuccessPromptAsync(counter); + + await auto.TypeAsync("npx tsc --noEmit"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptFailFastAsync(counter, TimeSpan.FromMinutes(2)); + + await auto.TypeAsync("exit"); + await auto.EnterAsync(); + + await pendingRun; + } + + private static string GetSdkVersion(DirectoryInfo appDirectory) + { + var configPath = Path.Combine(appDirectory.FullName, "aspire.config.json"); + using var doc = JsonDocument.Parse(File.ReadAllText(configPath)); + return doc.RootElement.GetProperty("sdk").GetProperty("version").GetString() + ?? throw new InvalidOperationException("Expected aspire.config.json to contain sdk.version."); + } + + private static void RewriteAppHostFiles(DirectoryInfo appDirectory) + { + File.WriteAllText(Path.Combine(appDirectory.FullName, "apphost.ts"), """ + import { createBuilder, refExpr } from './.modules/aspire.js'; + import { configureRedis } from '../packages/aspire-commands/src/index.js'; + + const builder = await createBuilder(); + const redis = await builder.addRedis("cache"); + + await configureRedis(redis, refExpr`redis://${redis}`); + + await builder.build().run(); + """); + + File.WriteAllText(Path.Combine(appDirectory.FullName, "tsconfig.json"), """ + { + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": ".." + }, + "include": [ + "apphost.ts", + ".modules/**/*.ts", + "../packages/aspire-commands/src/**/*.ts", + "../packages/aspire-commands/.modules/**/*.ts" + ], + "exclude": [ + "node_modules" + ] + } + """); + } + + private static void WriteHelperPackageFiles(DirectoryInfo helperDirectory, DirectoryInfo helperSourceDirectory, string sdkVersion) + { + File.WriteAllText(Path.Combine(helperDirectory.FullName, "aspire.config.json"), $$""" + { + "appHost": { + "language": "typescript/nodejs" + }, + "sdk": { + "version": "{{sdkVersion}}" + }, + "packages": { + "Aspire.Hosting.Redis": "" + } + } + """); + + File.WriteAllText(Path.Combine(helperDirectory.FullName, "package.json"), """ + { + "name": "@issue15507/aspire-commands", + "private": true, + "type": "module", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "tsx": "^4.19.0", + "typescript": "^5.3.0" + } + } + """); + + File.WriteAllText(Path.Combine(helperDirectory.FullName, "tsconfig.json"), """ + { + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": [ + "src/**/*.ts", + ".modules/**/*.ts" + ], + "exclude": [ + "node_modules" + ] + } + """); + + File.WriteAllText(Path.Combine(helperSourceDirectory.FullName, "index.ts"), """ + import type { + ExecuteCommandContext, + ExecuteCommandResult, + RedisResource, + ReferenceExpression + } from '../.modules/aspire.js'; + + export async function configureRedis( + redis: RedisResource, + prefix: ReferenceExpression + ): Promise { + await redis.withConnectionProperty("prefix", prefix); + + return await redis.withCommand( + "flush", + "Flush Redis cache", + async (context: ExecuteCommandContext): Promise => ({ + success: (await context.resourceName.get()).length > 0 + })); + } + """); + } +} diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs index 9b0a0060aea..b81e6e3b0e9 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs @@ -65,10 +65,11 @@ public void GenerateDistributedApplication_WithHostingTypes_KeepsReferenceExpres var files = _generator.GenerateDistributedApplication(atsContext); Assert.DoesNotContain("export class ReferenceExpression {", files["aspire.ts"]); + Assert.Contains("export class ReferenceExpression {", files["base.ts"]); Assert.Contains("registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression'", files["base.ts"]); - Assert.Contains("condition: extractHandleForExpr(this._condition),", files["base.ts"]); + Assert.Contains("condition: extractHandleForExpr(state.condition),", files["base.ts"]); Assert.Contains("('$handle' in json || '$expr' in json)", files["base.ts"]); - Assert.Contains("registerCancellation(this._client, cancellationToken)", files["base.ts"]); + Assert.Contains("registerCancellation(state.client, cancellationToken)", files["base.ts"]); } [Fact] @@ -339,7 +340,7 @@ public void FactoryMethod_ReturnsChildResourceType_NotParentType() // Verify the thenable class also uses the child type's promise class. // In TestRedisResourcePromise, addTestChildDatabase should return TestDatabaseResourcePromise. - Assert.Contains("new TestDatabaseResourcePromise(this._promise.then(obj => obj.addTestChildDatabase(", aspireTs); + Assert.Contains("new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.addTestChildDatabase(", aspireTs); } [Fact] @@ -582,23 +583,17 @@ public void Pattern4_InterfaceParameterType_HasCorrectTypeRef() [Fact] public void Pattern4_InterfaceParameterType_GeneratesUnionType() { - // Pattern 4/5: Verify that parameters with interface handle types generate union types - // in the generated TypeScript. + // Interface-constrained resource parameters should accept a structural + // handle-bearing type instead of the nominal ResourceBuilderBase type. var atsContext = CreateContextFromTestAssembly(); // Generate the TypeScript output var files = _generator.GenerateDistributedApplication(atsContext); var aspireTs = files["aspire.ts"]; - // The withDependency method should have its dependency parameter as a union type: - // dependency: IResourceWithConnectionStringHandle | ResourceBuilderBase - // Note: The exact generated name depends on the type mapping, but it should contain - // both the handle type and ResourceBuilderBase. - Assert.Contains("ResourceBuilderBase", aspireTs); - - // Also verify the union type pattern appears somewhere - // (the exact format depends on the type name mapping) - Assert.Contains("|", aspireTs); // Union types use pipe + Assert.Contains("export type { HandleReference } from './base.js';", aspireTs); + Assert.Contains("withDependency(dependency: HandleReference)", aspireTs); + Assert.DoesNotContain("withDependency(dependency: ResourceBuilderBase)", aspireTs); } [Fact] @@ -1066,8 +1061,8 @@ public void Generate_TypeWithMethods_CreatesThenableWrapper() var code = GenerateTwoPassCode(); // TestResourceContext has ExposeMethods=true - gets Promise wrapper - Assert.Contains("export class TestResourceContextPromise", code); - Assert.Contains("implements PromiseLike", code); + Assert.Contains("class TestResourceContextPromiseImpl implements TestResourceContextPromise", code); + Assert.Contains("implements TestResourceContextPromise", code); } [Fact] @@ -1139,7 +1134,7 @@ public void Scanner_CancellationToken_MapsToCorrectTypeId() public void Generate_MethodWithCancellationToken_GeneratesCancellationTokenParameter() { // Generated input parameters should accept AbortSignal for user-authored cancellation, - // while callbacks and returned values continue to use the SDK CancellationToken wrapper. + // while callbacks and returned values use the structural SDK cancellation token interface. var code = GenerateTwoPassCode(); Assert.Contains("cancellationToken?: AbortSignal | CancellationToken;", code); @@ -1354,12 +1349,12 @@ public void Generate_ConcreteAndInterfaceWithSameClassName_NoDuplicateClasses() var files = _generator.GenerateDistributedApplication(atsContext); var code = files["aspire.ts"]; - // Count occurrences of the class definition - var classCount = CountOccurrences(code, "export class TestVaultResource "); + // Count occurrences of the public interface definition. + var classCount = CountOccurrences(code, "export interface TestVaultResource "); Assert.Equal(1, classCount); - // Also verify the Promise wrapper is not duplicated - var promiseCount = CountOccurrences(code, "export class TestVaultResourcePromise "); + // Also verify the Promise wrapper interface is not duplicated. + var promiseCount = CountOccurrences(code, "export interface TestVaultResourcePromise "); Assert.Equal(1, promiseCount); } diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts index 31fe0cf0350..bdf268585d3 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts @@ -5,7 +5,7 @@ // GENERATED CODE - DO NOT EDIT import { - AspireClient as AspireClientRpc, + AspireClient, Handle, MarshalledHandle, AppHostUsageError, @@ -15,6 +15,9 @@ import { wrapIfHandle, registerHandleWrapper } from './transport.js'; +import type { AspireClientRpc } from './transport.js'; + +import type { HandleReference } from './base.js'; import { ResourceBuilderBase, @@ -164,10 +167,30 @@ export interface WithPersistenceOptions { // TestCallbackContext // ============================================================================ +export interface TestCallbackContext { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + value: { + get: () => Promise; + set: (value: number) => Promise; + }; + cancellationToken: { + get: () => Promise; + set: (value: AbortSignal | CancellationToken) => Promise; + }; +} + +// ============================================================================ +// TestCallbackContextImpl +// ============================================================================ + /** * Type class for TestCallbackContext. */ -export class TestCallbackContext { +class TestCallbackContextImpl implements TestCallbackContext { constructor(private _handle: TestCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -228,10 +251,20 @@ export class TestCallbackContext { // TestCollectionContext // ============================================================================ +export interface TestCollectionContext { + toJSON(): MarshalledHandle; + readonly items: AspireList; + readonly metadata: AspireDict; +} + +// ============================================================================ +// TestCollectionContextImpl +// ============================================================================ + /** * Type class for TestCollectionContext. */ -export class TestCollectionContext { +class TestCollectionContextImpl implements TestCollectionContext { constructor(private _handle: TestCollectionContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -271,10 +304,30 @@ export class TestCollectionContext { // TestEnvironmentContext // ============================================================================ +export interface TestEnvironmentContext { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + description: { + get: () => Promise; + set: (value: string) => Promise; + }; + priority: { + get: () => Promise; + set: (value: number) => Promise; + }; +} + +// ============================================================================ +// TestEnvironmentContextImpl +// ============================================================================ + /** * Type class for TestEnvironmentContext. */ -export class TestEnvironmentContext { +class TestEnvironmentContextImpl implements TestEnvironmentContext { constructor(private _handle: TestEnvironmentContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -334,10 +387,35 @@ export class TestEnvironmentContext { // TestResourceContext // ============================================================================ +export interface TestResourceContext { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + value: { + get: () => Promise; + set: (value: number) => Promise; + }; + getValueAsync(): Promise; + setValueAsync(value: string): TestResourceContextPromise; + validateAsync(): Promise; +} + +export interface TestResourceContextPromise extends PromiseLike { + getValueAsync(): Promise; + setValueAsync(value: string): TestResourceContextPromise; + validateAsync(): Promise; +} + +// ============================================================================ +// TestResourceContextImpl +// ============================================================================ + /** * Type class for TestResourceContext. */ -export class TestResourceContext { +class TestResourceContextImpl implements TestResourceContext { constructor(private _handle: TestResourceContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -396,7 +474,7 @@ export class TestResourceContext { } setValueAsync(value: string): TestResourceContextPromise { - return new TestResourceContextPromise(this._setValueAsyncInternal(value)); + return new TestResourceContextPromiseImpl(this._setValueAsyncInternal(value)); } /** Invokes the ValidateAsync method */ @@ -413,7 +491,7 @@ export class TestResourceContext { /** * Thenable wrapper for TestResourceContext that enables fluent chaining. */ -export class TestResourceContextPromise implements PromiseLike { +class TestResourceContextPromiseImpl implements TestResourceContextPromise { constructor(private _promise: Promise) {} then( @@ -430,7 +508,7 @@ export class TestResourceContextPromise implements PromiseLike obj.setValueAsync(value))); + return new TestResourceContextPromiseImpl(this._promise.then(obj => obj.setValueAsync(value))); } /** Invokes the ValidateAsync method */ @@ -444,10 +522,25 @@ export class TestResourceContextPromise implements PromiseLike { + addTestRedis(name: string, options?: AddTestRedisOptions): TestRedisResourcePromise; + addTestVault(name: string): TestVaultResourcePromise; +} + +// ============================================================================ +// DistributedApplicationBuilderImpl +// ============================================================================ + /** * Type class for DistributedApplicationBuilder. */ -export class DistributedApplicationBuilder { +class DistributedApplicationBuilderImpl implements DistributedApplicationBuilder { constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -462,12 +555,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/addTestRedis', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } addTestRedis(name: string, options?: AddTestRedisOptions): TestRedisResourcePromise { const port = options?.port; - return new TestRedisResourcePromise(this._addTestRedisInternal(name, port)); + return new TestRedisResourcePromiseImpl(this._addTestRedisInternal(name, port)); } /** Adds a test vault resource */ @@ -478,11 +571,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/addTestVault', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } addTestVault(name: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._addTestVaultInternal(name)); + return new TestVaultResourcePromiseImpl(this._addTestVaultInternal(name)); } } @@ -490,7 +583,7 @@ export class DistributedApplicationBuilder { /** * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { +class DistributedApplicationBuilderPromiseImpl implements DistributedApplicationBuilderPromise { constructor(private _promise: Promise) {} then( @@ -502,12 +595,12 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addTestRedis(name, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.addTestRedis(name, options))); } /** Adds a test vault resource */ addTestVault(name: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.addTestVault(name))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.addTestVault(name))); } } @@ -516,7 +609,66 @@ export class DistributedApplicationBuilderPromise implements PromiseLike { +export interface TestDatabaseResource { + toJSON(): MarshalledHandle; + withOptionalString(options?: WithOptionalStringOptions): TestDatabaseResourcePromise; + withConfig(config: TestConfigDto): TestDatabaseResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestDatabaseResourcePromise; + withCreatedAt(createdAt: string): TestDatabaseResourcePromise; + withModifiedAt(modifiedAt: string): TestDatabaseResourcePromise; + withCorrelationId(correlationId: string): TestDatabaseResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestDatabaseResourcePromise; + withStatus(status: TestResourceStatus): TestDatabaseResourcePromise; + withNestedConfig(config: TestNestedDto): TestDatabaseResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestDatabaseResourcePromise; + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise; + withDependency(dependency: HandleReference): TestDatabaseResourcePromise; + withEndpoints(endpoints: string[]): TestDatabaseResourcePromise; + withEnvironmentVariables(variables: Record): TestDatabaseResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestDatabaseResourcePromise; + withDataVolume(options?: WithDataVolumeOptions): TestDatabaseResourcePromise; + withMergeLabel(label: string): TestDatabaseResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestDatabaseResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestDatabaseResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestDatabaseResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestDatabaseResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestDatabaseResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestDatabaseResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestDatabaseResourcePromise; +} + +export interface TestDatabaseResourcePromise extends PromiseLike { + withOptionalString(options?: WithOptionalStringOptions): TestDatabaseResourcePromise; + withConfig(config: TestConfigDto): TestDatabaseResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestDatabaseResourcePromise; + withCreatedAt(createdAt: string): TestDatabaseResourcePromise; + withModifiedAt(modifiedAt: string): TestDatabaseResourcePromise; + withCorrelationId(correlationId: string): TestDatabaseResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestDatabaseResourcePromise; + withStatus(status: TestResourceStatus): TestDatabaseResourcePromise; + withNestedConfig(config: TestNestedDto): TestDatabaseResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestDatabaseResourcePromise; + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise; + withDependency(dependency: HandleReference): TestDatabaseResourcePromise; + withEndpoints(endpoints: string[]): TestDatabaseResourcePromise; + withEnvironmentVariables(variables: Record): TestDatabaseResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestDatabaseResourcePromise; + withDataVolume(options?: WithDataVolumeOptions): TestDatabaseResourcePromise; + withMergeLabel(label: string): TestDatabaseResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestDatabaseResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestDatabaseResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestDatabaseResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestDatabaseResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestDatabaseResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestDatabaseResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestDatabaseResourcePromise; +} + +// ============================================================================ +// TestDatabaseResourceImpl +// ============================================================================ + +class TestDatabaseResourceImpl extends ResourceBuilderBase implements TestDatabaseResource { constructor(handle: TestDatabaseResourceHandle, client: AspireClientRpc) { super(handle, client); } @@ -530,14 +682,14 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -567,12 +719,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -582,12 +734,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -633,13 +785,13 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -684,42 +836,42 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withValidatorInternal(validator)); + return new TestDatabaseResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -729,12 +881,12 @@ export class TestDatabaseResource extends ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -763,12 +915,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestDatabaseResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -779,13 +931,13 @@ export class TestDatabaseResource extends ResourceBuilderBase { +class TestDatabaseResourcePromiseImpl implements TestDatabaseResourcePromise { constructor(private _promise: Promise) {} then( @@ -935,122 +1087,122 @@ export class TestDatabaseResourcePromise implements PromiseLike obj.withOptionalString(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a data volume */ withDataVolume(options?: WithDataVolumeOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withDataVolume(options))); } /** Adds a label to the resource */ withMergeLabel(label: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -1059,7 +1211,88 @@ export class TestDatabaseResourcePromise implements PromiseLike { +export interface TestRedisResource { + toJSON(): MarshalledHandle; + addTestChildDatabase(name: string, options?: AddTestChildDatabaseOptions): TestDatabaseResourcePromise; + withPersistence(options?: WithPersistenceOptions): TestRedisResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestRedisResourcePromise; + withConfig(config: TestConfigDto): TestRedisResourcePromise; + getTags(): Promise>; + getMetadata(): Promise>; + withConnectionString(connectionString: ReferenceExpression): TestRedisResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withCreatedAt(createdAt: string): TestRedisResourcePromise; + withModifiedAt(modifiedAt: string): TestRedisResourcePromise; + withCorrelationId(correlationId: string): TestRedisResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestRedisResourcePromise; + withStatus(status: TestResourceStatus): TestRedisResourcePromise; + withNestedConfig(config: TestNestedDto): TestRedisResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestRedisResourcePromise; + testWaitFor(dependency: HandleReference): TestRedisResourcePromise; + getEndpoints(): Promise; + withConnectionStringDirect(connectionString: string): TestRedisResourcePromise; + withRedisSpecific(option: string): TestRedisResourcePromise; + withDependency(dependency: HandleReference): TestRedisResourcePromise; + withEndpoints(endpoints: string[]): TestRedisResourcePromise; + withEnvironmentVariables(variables: Record): TestRedisResourcePromise; + getStatusAsync(options?: GetStatusAsyncOptions): Promise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestRedisResourcePromise; + waitForReadyAsync(timeout: number, options?: WaitForReadyAsyncOptions): Promise; + withMultiParamHandleCallback(callback: (arg1: TestCallbackContext, arg2: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withDataVolume(options?: WithDataVolumeOptions): TestRedisResourcePromise; + withMergeLabel(label: string): TestRedisResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestRedisResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestRedisResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestRedisResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestRedisResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestRedisResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestRedisResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestRedisResourcePromise; +} + +export interface TestRedisResourcePromise extends PromiseLike { + addTestChildDatabase(name: string, options?: AddTestChildDatabaseOptions): TestDatabaseResourcePromise; + withPersistence(options?: WithPersistenceOptions): TestRedisResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestRedisResourcePromise; + withConfig(config: TestConfigDto): TestRedisResourcePromise; + getTags(): Promise>; + getMetadata(): Promise>; + withConnectionString(connectionString: ReferenceExpression): TestRedisResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withCreatedAt(createdAt: string): TestRedisResourcePromise; + withModifiedAt(modifiedAt: string): TestRedisResourcePromise; + withCorrelationId(correlationId: string): TestRedisResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestRedisResourcePromise; + withStatus(status: TestResourceStatus): TestRedisResourcePromise; + withNestedConfig(config: TestNestedDto): TestRedisResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestRedisResourcePromise; + testWaitFor(dependency: HandleReference): TestRedisResourcePromise; + getEndpoints(): Promise; + withConnectionStringDirect(connectionString: string): TestRedisResourcePromise; + withRedisSpecific(option: string): TestRedisResourcePromise; + withDependency(dependency: HandleReference): TestRedisResourcePromise; + withEndpoints(endpoints: string[]): TestRedisResourcePromise; + withEnvironmentVariables(variables: Record): TestRedisResourcePromise; + getStatusAsync(options?: GetStatusAsyncOptions): Promise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestRedisResourcePromise; + waitForReadyAsync(timeout: number, options?: WaitForReadyAsyncOptions): Promise; + withMultiParamHandleCallback(callback: (arg1: TestCallbackContext, arg2: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withDataVolume(options?: WithDataVolumeOptions): TestRedisResourcePromise; + withMergeLabel(label: string): TestRedisResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestRedisResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestRedisResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestRedisResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestRedisResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestRedisResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestRedisResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestRedisResourcePromise; +} + +// ============================================================================ +// TestRedisResourceImpl +// ============================================================================ + +class TestRedisResourceImpl extends ResourceBuilderBase implements TestRedisResource { constructor(handle: TestRedisResourceHandle, client: AspireClientRpc) { super(handle, client); } @@ -1072,13 +1305,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -1177,12 +1410,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -1192,12 +1425,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -1243,13 +1476,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -1294,27 +1527,27 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withValidatorInternal(validator)); + return new TestRedisResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** Gets the endpoints */ @@ -1333,12 +1566,12 @@ export class TestRedisResource extends ResourceBuilderBase { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -1378,12 +1611,12 @@ export class TestRedisResource extends ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestRedisResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** Gets the status of the resource asynchronously */ @@ -1423,12 +1656,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestRedisResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** Waits for the resource to be ready */ @@ -1446,9 +1679,9 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { const arg1Handle = wrapIfHandle(arg1Data) as TestCallbackContextHandle; - const arg1 = new TestCallbackContext(arg1Handle, this._client); + const arg1 = new TestCallbackContextImpl(arg1Handle, this._client); const arg2Handle = wrapIfHandle(arg2Data) as TestEnvironmentContextHandle; - const arg2 = new TestEnvironmentContext(arg2Handle, this._client); + const arg2 = new TestEnvironmentContextImpl(arg2Handle, this._client); await callback(arg1, arg2); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -1456,12 +1689,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withMultiParamHandleCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withMultiParamHandleCallbackInternal(callback)); } /** @internal */ @@ -1473,14 +1706,14 @@ export class TestRedisResource extends ResourceBuilderBase { +class TestRedisResourcePromiseImpl implements TestRedisResourcePromise { constructor(private _promise: Promise) {} then( @@ -1630,22 +1863,22 @@ export class TestRedisResourcePromise implements PromiseLike /** Adds a child database to a test Redis resource */ addTestChildDatabase(name: string, options?: AddTestChildDatabaseOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.addTestChildDatabase(name, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.addTestChildDatabase(name, options))); } /** Configures the Redis resource with persistence */ withPersistence(options?: WithPersistenceOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withPersistence(options))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Gets the tags for the resource */ @@ -1660,52 +1893,52 @@ export class TestRedisResourcePromise implements PromiseLike /** Sets the connection string using a reference expression */ withConnectionString(connectionString: ReferenceExpression): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConnectionString(connectionString))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConnectionString(connectionString))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Gets the endpoints */ @@ -1715,27 +1948,27 @@ export class TestRedisResourcePromise implements PromiseLike /** Sets connection string using direct interface target */ withConnectionStringDirect(connectionString: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); } /** Redis-specific configuration */ withRedisSpecific(option: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withRedisSpecific(option))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withRedisSpecific(option))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Gets the status of the resource asynchronously */ @@ -1745,7 +1978,7 @@ export class TestRedisResourcePromise implements PromiseLike /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Waits for the resource to be ready */ @@ -1755,52 +1988,52 @@ export class TestRedisResourcePromise implements PromiseLike /** Tests multi-param callback destructuring */ withMultiParamHandleCallback(callback: (arg1: TestCallbackContext, arg2: TestEnvironmentContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMultiParamHandleCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMultiParamHandleCallback(callback))); } /** Adds a data volume with persistence */ withDataVolume(options?: WithDataVolumeOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDataVolume(options))); } /** Adds a label to the resource */ withMergeLabel(label: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -1809,7 +2042,66 @@ export class TestRedisResourcePromise implements PromiseLike // TestVaultResource // ============================================================================ -export class TestVaultResource extends ResourceBuilderBase { +export interface TestVaultResource { + toJSON(): MarshalledHandle; + withOptionalString(options?: WithOptionalStringOptions): TestVaultResourcePromise; + withConfig(config: TestConfigDto): TestVaultResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestVaultResourcePromise; + withCreatedAt(createdAt: string): TestVaultResourcePromise; + withModifiedAt(modifiedAt: string): TestVaultResourcePromise; + withCorrelationId(correlationId: string): TestVaultResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestVaultResourcePromise; + withStatus(status: TestResourceStatus): TestVaultResourcePromise; + withNestedConfig(config: TestNestedDto): TestVaultResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestVaultResourcePromise; + testWaitFor(dependency: HandleReference): TestVaultResourcePromise; + withDependency(dependency: HandleReference): TestVaultResourcePromise; + withEndpoints(endpoints: string[]): TestVaultResourcePromise; + withEnvironmentVariables(variables: Record): TestVaultResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestVaultResourcePromise; + withVaultDirect(option: string): TestVaultResourcePromise; + withMergeLabel(label: string): TestVaultResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestVaultResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestVaultResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestVaultResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestVaultResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestVaultResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestVaultResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestVaultResourcePromise; +} + +export interface TestVaultResourcePromise extends PromiseLike { + withOptionalString(options?: WithOptionalStringOptions): TestVaultResourcePromise; + withConfig(config: TestConfigDto): TestVaultResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestVaultResourcePromise; + withCreatedAt(createdAt: string): TestVaultResourcePromise; + withModifiedAt(modifiedAt: string): TestVaultResourcePromise; + withCorrelationId(correlationId: string): TestVaultResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestVaultResourcePromise; + withStatus(status: TestResourceStatus): TestVaultResourcePromise; + withNestedConfig(config: TestNestedDto): TestVaultResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestVaultResourcePromise; + testWaitFor(dependency: HandleReference): TestVaultResourcePromise; + withDependency(dependency: HandleReference): TestVaultResourcePromise; + withEndpoints(endpoints: string[]): TestVaultResourcePromise; + withEnvironmentVariables(variables: Record): TestVaultResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestVaultResourcePromise; + withVaultDirect(option: string): TestVaultResourcePromise; + withMergeLabel(label: string): TestVaultResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestVaultResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestVaultResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestVaultResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestVaultResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestVaultResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestVaultResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestVaultResourcePromise; +} + +// ============================================================================ +// TestVaultResourceImpl +// ============================================================================ + +class TestVaultResourceImpl extends ResourceBuilderBase implements TestVaultResource { constructor(handle: TestVaultResourceHandle, client: AspireClientRpc) { super(handle, client); } @@ -1823,14 +2115,14 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -1860,12 +2152,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -1875,12 +2167,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -1926,13 +2218,13 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -1977,42 +2269,42 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withValidatorInternal(validator)); + return new TestVaultResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -2022,12 +2314,12 @@ export class TestVaultResource extends ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestVaultResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -2056,12 +2348,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestVaultResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -2071,12 +2363,12 @@ export class TestVaultResource extends ResourceBuilderBase { +class TestVaultResourcePromiseImpl implements TestVaultResourcePromise { constructor(private _promise: Promise) {} then( @@ -2226,122 +2518,122 @@ export class TestVaultResourcePromise implements PromiseLike /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Configures vault using direct interface target */ withVaultDirect(option: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withVaultDirect(option))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withVaultDirect(option))); } /** Adds a label to the resource */ withMergeLabel(label: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -2350,7 +2642,60 @@ export class TestVaultResourcePromise implements PromiseLike // Resource // ============================================================================ -export class Resource extends ResourceBuilderBase { +export interface Resource { + toJSON(): MarshalledHandle; + withOptionalString(options?: WithOptionalStringOptions): ResourcePromise; + withConfig(config: TestConfigDto): ResourcePromise; + withCreatedAt(createdAt: string): ResourcePromise; + withModifiedAt(modifiedAt: string): ResourcePromise; + withCorrelationId(correlationId: string): ResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise; + withStatus(status: TestResourceStatus): ResourcePromise; + withNestedConfig(config: TestNestedDto): ResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise; + testWaitFor(dependency: HandleReference): ResourcePromise; + withDependency(dependency: HandleReference): ResourcePromise; + withEndpoints(endpoints: string[]): ResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise; + withMergeLabel(label: string): ResourcePromise; + withMergeLabelCategorized(label: string, category: string): ResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise; +} + +export interface ResourcePromise extends PromiseLike { + withOptionalString(options?: WithOptionalStringOptions): ResourcePromise; + withConfig(config: TestConfigDto): ResourcePromise; + withCreatedAt(createdAt: string): ResourcePromise; + withModifiedAt(modifiedAt: string): ResourcePromise; + withCorrelationId(correlationId: string): ResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise; + withStatus(status: TestResourceStatus): ResourcePromise; + withNestedConfig(config: TestNestedDto): ResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise; + testWaitFor(dependency: HandleReference): ResourcePromise; + withDependency(dependency: HandleReference): ResourcePromise; + withEndpoints(endpoints: string[]): ResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise; + withMergeLabel(label: string): ResourcePromise; + withMergeLabelCategorized(label: string, category: string): ResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise; +} + +// ============================================================================ +// ResourceImpl +// ============================================================================ + +class ResourceImpl extends ResourceBuilderBase implements Resource { constructor(handle: IResourceHandle, client: AspireClientRpc) { super(handle, client); } @@ -2364,14 +2709,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withOptionalString', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ResourcePromise { const value = options?.value; const enabled = options?.enabled; - return new ResourcePromise(this._withOptionalStringInternal(value, enabled)); + return new ResourcePromiseImpl(this._withOptionalStringInternal(value, enabled)); } /** @internal */ @@ -2381,12 +2726,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withConfig', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ResourcePromise { - return new ResourcePromise(this._withConfigInternal(config)); + return new ResourcePromiseImpl(this._withConfigInternal(config)); } /** @internal */ @@ -2396,12 +2741,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCreatedAt', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ResourcePromise { - return new ResourcePromise(this._withCreatedAtInternal(createdAt)); + return new ResourcePromiseImpl(this._withCreatedAtInternal(createdAt)); } /** @internal */ @@ -2411,12 +2756,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withModifiedAt', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ResourcePromise { - return new ResourcePromise(this._withModifiedAtInternal(modifiedAt)); + return new ResourcePromiseImpl(this._withModifiedAtInternal(modifiedAt)); } /** @internal */ @@ -2426,19 +2771,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCorrelationId', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ResourcePromise { - return new ResourcePromise(this._withCorrelationIdInternal(correlationId)); + return new ResourcePromiseImpl(this._withCorrelationIdInternal(correlationId)); } /** @internal */ private async _withOptionalCallbackInternal(callback?: (arg: TestCallbackContext) => Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -2447,13 +2792,13 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withOptionalCallback', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise { const callback = options?.callback; - return new ResourcePromise(this._withOptionalCallbackInternal(callback)); + return new ResourcePromiseImpl(this._withOptionalCallbackInternal(callback)); } /** @internal */ @@ -2463,12 +2808,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withStatus', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ResourcePromise { - return new ResourcePromise(this._withStatusInternal(status)); + return new ResourcePromiseImpl(this._withStatusInternal(status)); } /** @internal */ @@ -2478,19 +2823,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withNestedConfig', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ResourcePromise { - return new ResourcePromise(this._withNestedConfigInternal(config)); + return new ResourcePromiseImpl(this._withNestedConfigInternal(config)); } /** @internal */ private async _withValidatorInternal(validator: (arg: TestResourceContext) => Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -2498,42 +2843,42 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withValidator', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise { - return new ResourcePromise(this._withValidatorInternal(validator)); + return new ResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -2543,12 +2888,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withEndpoints', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ResourcePromise { - return new ResourcePromise(this._withEndpointsInternal(endpoints)); + return new ResourcePromiseImpl(this._withEndpointsInternal(endpoints)); } /** @internal */ @@ -2562,12 +2907,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCancellableOperation', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise { - return new ResourcePromise(this._withCancellableOperationInternal(operation)); + return new ResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -2577,12 +2922,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLabel', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a label to the resource */ withMergeLabel(label: string): ResourcePromise { - return new ResourcePromise(this._withMergeLabelInternal(label)); + return new ResourcePromiseImpl(this._withMergeLabelInternal(label)); } /** @internal */ @@ -2592,12 +2937,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLabelCategorized', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ResourcePromise { - return new ResourcePromise(this._withMergeLabelCategorizedInternal(label, category)); + return new ResourcePromiseImpl(this._withMergeLabelCategorizedInternal(label, category)); } /** @internal */ @@ -2607,12 +2952,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeEndpoint', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ResourcePromise { - return new ResourcePromise(this._withMergeEndpointInternal(endpointName, port)); + return new ResourcePromiseImpl(this._withMergeEndpointInternal(endpointName, port)); } /** @internal */ @@ -2622,12 +2967,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeEndpointScheme', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise { - return new ResourcePromise(this._withMergeEndpointSchemeInternal(endpointName, port, scheme)); + return new ResourcePromiseImpl(this._withMergeEndpointSchemeInternal(endpointName, port, scheme)); } /** @internal */ @@ -2639,14 +2984,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLogging', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise { const enableConsole = options?.enableConsole; const maxFiles = options?.maxFiles; - return new ResourcePromise(this._withMergeLoggingInternal(logLevel, enableConsole, maxFiles)); + return new ResourcePromiseImpl(this._withMergeLoggingInternal(logLevel, enableConsole, maxFiles)); } /** @internal */ @@ -2658,14 +3003,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLoggingPath', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise { const enableConsole = options?.enableConsole; const maxFiles = options?.maxFiles; - return new ResourcePromise(this._withMergeLoggingPathInternal(logLevel, logPath, enableConsole, maxFiles)); + return new ResourcePromiseImpl(this._withMergeLoggingPathInternal(logLevel, logPath, enableConsole, maxFiles)); } /** @internal */ @@ -2675,12 +3020,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeRoute', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise { - return new ResourcePromise(this._withMergeRouteInternal(path, method, handler, priority)); + return new ResourcePromiseImpl(this._withMergeRouteInternal(path, method, handler, priority)); } /** @internal */ @@ -2690,12 +3035,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeRouteMiddleware', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise { - return new ResourcePromise(this._withMergeRouteMiddlewareInternal(path, method, handler, priority, middleware)); + return new ResourcePromiseImpl(this._withMergeRouteMiddlewareInternal(path, method, handler, priority, middleware)); } } @@ -2705,7 +3050,7 @@ export class Resource extends ResourceBuilderBase { * @example * await builder.addSomething().withX().withY(); */ -export class ResourcePromise implements PromiseLike { +class ResourcePromiseImpl implements ResourcePromise { constructor(private _promise: Promise) {} then( @@ -2717,107 +3062,107 @@ export class ResourcePromise implements PromiseLike { /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -2826,7 +3171,22 @@ export class ResourcePromise implements PromiseLike { // ResourceWithConnectionString // ============================================================================ -export class ResourceWithConnectionString extends ResourceBuilderBase { +export interface ResourceWithConnectionString { + toJSON(): MarshalledHandle; + withConnectionString(connectionString: ReferenceExpression): ResourceWithConnectionStringPromise; + withConnectionStringDirect(connectionString: string): ResourceWithConnectionStringPromise; +} + +export interface ResourceWithConnectionStringPromise extends PromiseLike { + withConnectionString(connectionString: ReferenceExpression): ResourceWithConnectionStringPromise; + withConnectionStringDirect(connectionString: string): ResourceWithConnectionStringPromise; +} + +// ============================================================================ +// ResourceWithConnectionStringImpl +// ============================================================================ + +class ResourceWithConnectionStringImpl extends ResourceBuilderBase implements ResourceWithConnectionString { constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { super(handle, client); } @@ -2838,12 +3198,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { +class ResourceWithConnectionStringPromiseImpl implements ResourceWithConnectionStringPromise { constructor(private _promise: Promise) {} then( @@ -2880,12 +3240,12 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionString(connectionString))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.withConnectionString(connectionString))); } /** Sets connection string using direct interface target */ withConnectionStringDirect(connectionString: string): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); } } @@ -2894,7 +3254,22 @@ export class ResourceWithConnectionStringPromise implements PromiseLike { +export interface ResourceWithEnvironment { + toJSON(): MarshalledHandle; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ResourceWithEnvironmentPromise; + withEnvironmentVariables(variables: Record): ResourceWithEnvironmentPromise; +} + +export interface ResourceWithEnvironmentPromise extends PromiseLike { + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ResourceWithEnvironmentPromise; + withEnvironmentVariables(variables: Record): ResourceWithEnvironmentPromise; +} + +// ============================================================================ +// ResourceWithEnvironmentImpl +// ============================================================================ + +class ResourceWithEnvironmentImpl extends ResourceBuilderBase implements ResourceWithEnvironment { constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { super(handle, client); } @@ -2903,7 +3278,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -2911,12 +3286,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ResourceWithEnvironmentPromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -2926,12 +3301,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentVariablesInternal(variables)); + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentVariablesInternal(variables)); } } @@ -2941,7 +3316,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { +class ResourceWithEnvironmentPromiseImpl implements ResourceWithEnvironmentPromise { constructor(private _promise: Promise) {} then( @@ -2953,12 +3328,12 @@ export class ResourceWithEnvironmentPromise implements PromiseLike Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } } @@ -2980,7 +3355,7 @@ export async function connect(): Promise { ); } - const client = new AspireClientRpc(socketPath); + const client = new AspireClient(socketPath); await client.connect(); // Exit the process if the server connection is lost @@ -3022,12 +3397,13 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext', (handle, client) => new TestCallbackContext(handle as TestCallbackContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext', (handle, client) => new TestCollectionContext(handle as TestCollectionContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext', (handle, client) => new TestEnvironmentContext(handle as TestEnvironmentContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext', (handle, client) => new TestResourceContext(handle as TestResourceContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource', (handle, client) => new TestDatabaseResource(handle as TestDatabaseResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource', (handle, client) => new TestRedisResource(handle as TestRedisResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource', (handle, client) => new TestVaultResource(handle as TestVaultResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext', (handle, client) => new TestCallbackContextImpl(handle as TestCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext', (handle, client) => new TestCollectionContextImpl(handle as TestCollectionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext', (handle, client) => new TestEnvironmentContextImpl(handle as TestEnvironmentContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext', (handle, client) => new TestResourceContextImpl(handle as TestResourceContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilderImpl(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource', (handle, client) => new TestDatabaseResourceImpl(handle as TestDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource', (handle, client) => new TestRedisResourceImpl(handle as TestRedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource', (handle, client) => new TestVaultResourceImpl(handle as TestVaultResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new ResourceImpl(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionStringImpl(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironmentImpl(handle as IResourceWithEnvironmentHandle, client)); diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts index a531d10b22e..34b6a13d7f3 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts @@ -1,11 +1,11 @@ -// aspire.ts - Capability-based Aspire SDK +// aspire.ts - Capability-based Aspire SDK // This SDK uses the ATS (Aspire Type System) capability API. // Capabilities are endpoints like 'Aspire.Hosting/createBuilder'. // // GENERATED CODE - DO NOT EDIT import { - AspireClient as AspireClientRpc, + AspireClient, Handle, MarshalledHandle, AppHostUsageError, @@ -15,6 +15,9 @@ import { wrapIfHandle, registerHandleWrapper } from './transport.js'; +import type { AspireClientRpc } from './transport.js'; + +import type { HandleReference } from './base.js'; import { ResourceBuilderBase, @@ -713,10 +716,24 @@ export interface WithVolumeOptions { // AfterResourcesCreatedEvent // ============================================================================ +export interface AfterResourcesCreatedEvent { + toJSON(): MarshalledHandle; + services: { + get: () => Promise; + }; + model: { + get: () => Promise; + }; +} + +// ============================================================================ +// AfterResourcesCreatedEventImpl +// ============================================================================ + /** * Type class for AfterResourcesCreatedEvent. */ -export class AfterResourcesCreatedEvent { +class AfterResourcesCreatedEventImpl implements AfterResourcesCreatedEvent { constructor(private _handle: AfterResourcesCreatedEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -729,7 +746,7 @@ export class AfterResourcesCreatedEvent { 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -740,7 +757,7 @@ export class AfterResourcesCreatedEvent { 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -750,10 +767,24 @@ export class AfterResourcesCreatedEvent { // BeforeResourceStartedEvent // ============================================================================ +export interface BeforeResourceStartedEvent { + toJSON(): MarshalledHandle; + resource: { + get: () => Promise; + }; + services: { + get: () => Promise; + }; +} + +// ============================================================================ +// BeforeResourceStartedEventImpl +// ============================================================================ + /** * Type class for BeforeResourceStartedEvent. */ -export class BeforeResourceStartedEvent { +class BeforeResourceStartedEventImpl implements BeforeResourceStartedEvent { constructor(private _handle: BeforeResourceStartedEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -766,7 +797,7 @@ export class BeforeResourceStartedEvent { 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -777,7 +808,7 @@ export class BeforeResourceStartedEvent { 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -787,10 +818,24 @@ export class BeforeResourceStartedEvent { // BeforeStartEvent // ============================================================================ +export interface BeforeStartEvent { + toJSON(): MarshalledHandle; + services: { + get: () => Promise; + }; + model: { + get: () => Promise; + }; +} + +// ============================================================================ +// BeforeStartEventImpl +// ============================================================================ + /** * Type class for BeforeStartEvent. */ -export class BeforeStartEvent { +class BeforeStartEventImpl implements BeforeStartEvent { constructor(private _handle: BeforeStartEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -803,7 +848,7 @@ export class BeforeStartEvent { 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -814,7 +859,7 @@ export class BeforeStartEvent { 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -824,10 +869,33 @@ export class BeforeStartEvent { // CommandLineArgsCallbackContext // ============================================================================ +export interface CommandLineArgsCallbackContext { + toJSON(): MarshalledHandle; + readonly args: AspireList; + cancellationToken: { + get: () => Promise; + }; + executionContext: { + get: () => Promise; + set: (value: DistributedApplicationExecutionContext) => Promise; + }; + logger: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + resource: { + get: () => Promise; + }; +} + +// ============================================================================ +// CommandLineArgsCallbackContextImpl +// ============================================================================ + /** * Type class for CommandLineArgsCallbackContext. */ -export class CommandLineArgsCallbackContext { +class CommandLineArgsCallbackContextImpl implements CommandLineArgsCallbackContext { constructor(private _handle: CommandLineArgsCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -865,8 +933,14 @@ export class CommandLineArgsCallbackContext { 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, + set: async (value: DistributedApplicationExecutionContext): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.setExecutionContext', + { context: this._handle, value } + ); + } }; /** Gets the Logger property */ @@ -876,8 +950,14 @@ export class CommandLineArgsCallbackContext { 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.setLogger', + { context: this._handle, value } + ); + } }; /** Gets the Resource property */ @@ -887,7 +967,7 @@ export class CommandLineArgsCallbackContext { 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -897,10 +977,24 @@ export class CommandLineArgsCallbackContext { // ConnectionStringAvailableEvent // ============================================================================ +export interface ConnectionStringAvailableEvent { + toJSON(): MarshalledHandle; + resource: { + get: () => Promise; + }; + services: { + get: () => Promise; + }; +} + +// ============================================================================ +// ConnectionStringAvailableEventImpl +// ============================================================================ + /** * Type class for ConnectionStringAvailableEvent. */ -export class ConnectionStringAvailableEvent { +class ConnectionStringAvailableEventImpl implements ConnectionStringAvailableEvent { constructor(private _handle: ConnectionStringAvailableEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -913,7 +1007,7 @@ export class ConnectionStringAvailableEvent { 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -924,7 +1018,7 @@ export class ConnectionStringAvailableEvent { 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -934,10 +1028,23 @@ export class ConnectionStringAvailableEvent { // DistributedApplication // ============================================================================ +export interface DistributedApplication { + toJSON(): MarshalledHandle; + run(options?: RunOptions): DistributedApplicationPromise; +} + +export interface DistributedApplicationPromise extends PromiseLike { + run(options?: RunOptions): DistributedApplicationPromise; +} + +// ============================================================================ +// DistributedApplicationImpl +// ============================================================================ + /** * Type class for DistributedApplication. */ -export class DistributedApplication { +class DistributedApplicationImpl implements DistributedApplication { constructor(private _handle: DistributedApplicationHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -957,7 +1064,7 @@ export class DistributedApplication { run(options?: RunOptions): DistributedApplicationPromise { const cancellationToken = options?.cancellationToken; - return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + return new DistributedApplicationPromiseImpl(this._runInternal(cancellationToken)); } } @@ -965,7 +1072,7 @@ export class DistributedApplication { /** * Thenable wrapper for DistributedApplication that enables fluent chaining. */ -export class DistributedApplicationPromise implements PromiseLike { +class DistributedApplicationPromiseImpl implements DistributedApplicationPromise { constructor(private _promise: Promise) {} then( @@ -977,7 +1084,7 @@ export class DistributedApplicationPromise implements PromiseLike obj.run(options))); + return new DistributedApplicationPromiseImpl(this._promise.then(obj => obj.run(options))); } } @@ -986,10 +1093,34 @@ export class DistributedApplicationPromise implements PromiseLike Promise; + set: (value: string) => Promise; + }; + operation: { + get: () => Promise; + }; + serviceProvider: { + get: () => Promise; + }; + isPublishMode: { + get: () => Promise; + }; + isRunMode: { + get: () => Promise; + }; +} + +// ============================================================================ +// DistributedApplicationExecutionContextImpl +// ============================================================================ + /** * Type class for DistributedApplicationExecutionContext. */ -export class DistributedApplicationExecutionContext { +class DistributedApplicationExecutionContextImpl implements DistributedApplicationExecutionContext { constructor(private _handle: DistributedApplicationExecutionContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1028,7 +1159,7 @@ export class DistributedApplicationExecutionContext { 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1058,10 +1189,25 @@ export class DistributedApplicationExecutionContext { // DistributedApplicationModel // ============================================================================ +export interface DistributedApplicationModel { + toJSON(): MarshalledHandle; + getResources(): Promise; + findResourceByName(name: string): ResourcePromise; +} + +export interface DistributedApplicationModelPromise extends PromiseLike { + getResources(): Promise; + findResourceByName(name: string): ResourcePromise; +} + +// ============================================================================ +// DistributedApplicationModelImpl +// ============================================================================ + /** * Type class for DistributedApplicationModel. */ -export class DistributedApplicationModel { +class DistributedApplicationModelImpl implements DistributedApplicationModel { constructor(private _handle: DistributedApplicationModelHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1084,11 +1230,11 @@ export class DistributedApplicationModel { 'Aspire.Hosting/findResourceByName', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } findResourceByName(name: string): ResourcePromise { - return new ResourcePromise(this._findResourceByNameInternal(name)); + return new ResourcePromiseImpl(this._findResourceByNameInternal(name)); } } @@ -1096,7 +1242,7 @@ export class DistributedApplicationModel { /** * Thenable wrapper for DistributedApplicationModel that enables fluent chaining. */ -export class DistributedApplicationModelPromise implements PromiseLike { +class DistributedApplicationModelPromiseImpl implements DistributedApplicationModelPromise { constructor(private _promise: Promise) {} then( @@ -1113,7 +1259,7 @@ export class DistributedApplicationModelPromise implements PromiseLike obj.findResourceByName(name))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.findResourceByName(name))); } } @@ -1122,10 +1268,68 @@ export class DistributedApplicationModelPromise implements PromiseLike Promise; + }; + endpointName: { + get: () => Promise; + }; + errorMessage: { + get: () => Promise; + set: (value: string) => Promise; + }; + isAllocated: { + get: () => Promise; + }; + exists: { + get: () => Promise; + }; + isHttp: { + get: () => Promise; + }; + isHttps: { + get: () => Promise; + }; + tlsEnabled: { + get: () => Promise; + }; + excludeReferenceEndpoint: { + get: () => Promise; + }; + port: { + get: () => Promise; + }; + targetPort: { + get: () => Promise; + }; + host: { + get: () => Promise; + }; + scheme: { + get: () => Promise; + }; + url: { + get: () => Promise; + }; + getValueAsync(options?: GetValueAsyncOptions): Promise; + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise; +} + +export interface EndpointReferencePromise extends PromiseLike { + getValueAsync(options?: GetValueAsyncOptions): Promise; + getTlsValue(enabledValue: ReferenceExpression, disabledValue: ReferenceExpression): Promise; +} + +// ============================================================================ +// EndpointReferenceImpl +// ============================================================================ + /** * Type class for EndpointReference. */ -export class EndpointReference { +class EndpointReferenceImpl implements EndpointReference { constructor(private _handle: EndpointReferenceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1138,7 +1342,7 @@ export class EndpointReference { 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', { context: this._handle } ); - return new ResourceWithEndpoints(handle, this._client); + return new ResourceWithEndpointsImpl(handle, this._client); }, }; @@ -1303,7 +1507,7 @@ export class EndpointReference { /** * Thenable wrapper for EndpointReference that enables fluent chaining. */ -export class EndpointReferencePromise implements PromiseLike { +class EndpointReferencePromiseImpl implements EndpointReferencePromise { constructor(private _promise: Promise) {} then( @@ -1329,10 +1533,27 @@ export class EndpointReferencePromise implements PromiseLike // EndpointReferenceExpression // ============================================================================ +export interface EndpointReferenceExpression { + toJSON(): MarshalledHandle; + endpoint: { + get: () => Promise; + }; + property: { + get: () => Promise; + }; + valueExpression: { + get: () => Promise; + }; +} + +// ============================================================================ +// EndpointReferenceExpressionImpl +// ============================================================================ + /** * Type class for EndpointReferenceExpression. */ -export class EndpointReferenceExpression { +class EndpointReferenceExpressionImpl implements EndpointReferenceExpression { constructor(private _handle: EndpointReferenceExpressionHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1345,7 +1566,7 @@ export class EndpointReferenceExpression { 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', { context: this._handle } ); - return new EndpointReference(handle, this._client); + return new EndpointReferenceImpl(handle, this._client); }, }; @@ -1375,10 +1596,32 @@ export class EndpointReferenceExpression { // EnvironmentCallbackContext // ============================================================================ +export interface EnvironmentCallbackContext { + toJSON(): MarshalledHandle; + readonly environmentVariables: AspireDict; + cancellationToken: { + get: () => Promise; + }; + logger: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + resource: { + get: () => Promise; + }; + executionContext: { + get: () => Promise; + }; +} + +// ============================================================================ +// EnvironmentCallbackContextImpl +// ============================================================================ + /** * Type class for EnvironmentCallbackContext. */ -export class EnvironmentCallbackContext { +class EnvironmentCallbackContextImpl implements EnvironmentCallbackContext { constructor(private _handle: EnvironmentCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1416,8 +1659,14 @@ export class EnvironmentCallbackContext { 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.setLogger', + { context: this._handle, value } + ); + } }; /** Gets the Resource property */ @@ -1427,7 +1676,7 @@ export class EnvironmentCallbackContext { 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -1438,7 +1687,7 @@ export class EnvironmentCallbackContext { 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -1448,10 +1697,34 @@ export class EnvironmentCallbackContext { // ExecuteCommandContext // ============================================================================ +export interface ExecuteCommandContext { + toJSON(): MarshalledHandle; + serviceProvider: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + resourceName: { + get: () => Promise; + set: (value: string) => Promise; + }; + cancellationToken: { + get: () => Promise; + set: (value: AbortSignal | CancellationToken) => Promise; + }; + logger: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; +} + +// ============================================================================ +// ExecuteCommandContextImpl +// ============================================================================ + /** * Type class for ExecuteCommandContext. */ -export class ExecuteCommandContext { +class ExecuteCommandContextImpl implements ExecuteCommandContext { constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1464,8 +1737,14 @@ export class ExecuteCommandContext { 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setServiceProvider', + { context: this._handle, value } + ); + } }; /** Gets the ResourceName property */ @@ -1508,8 +1787,14 @@ export class ExecuteCommandContext { 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setLogger', + { context: this._handle, value } + ); + } }; } @@ -1518,10 +1803,33 @@ export class ExecuteCommandContext { // InitializeResourceEvent // ============================================================================ +export interface InitializeResourceEvent { + toJSON(): MarshalledHandle; + resource: { + get: () => Promise; + }; + eventing: { + get: () => Promise; + }; + logger: { + get: () => Promise; + }; + notifications: { + get: () => Promise; + }; + services: { + get: () => Promise; + }; +} + +// ============================================================================ +// InitializeResourceEventImpl +// ============================================================================ + /** * Type class for InitializeResourceEvent. */ -export class InitializeResourceEvent { +class InitializeResourceEventImpl implements InitializeResourceEvent { constructor(private _handle: InitializeResourceEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1534,7 +1842,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -1545,7 +1853,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new DistributedApplicationEventingImpl(handle, this._client); }, }; @@ -1556,7 +1864,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, }; @@ -1567,7 +1875,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', { context: this._handle } ); - return new ResourceNotificationService(handle, this._client); + return new ResourceNotificationServiceImpl(handle, this._client); }, }; @@ -1578,7 +1886,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1588,10 +1896,35 @@ export class InitializeResourceEvent { // PipelineConfigurationContext // ============================================================================ +export interface PipelineConfigurationContext { + toJSON(): MarshalledHandle; + services: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + steps: { + get: () => Promise; + set: (value: PipelineStep[]) => Promise; + }; + model: { + get: () => Promise; + set: (value: DistributedApplicationModel) => Promise; + }; + getStepsByTag(tag: string): Promise; +} + +export interface PipelineConfigurationContextPromise extends PromiseLike { + getStepsByTag(tag: string): Promise; +} + +// ============================================================================ +// PipelineConfigurationContextImpl +// ============================================================================ + /** * Type class for PipelineConfigurationContext. */ -export class PipelineConfigurationContext { +class PipelineConfigurationContextImpl implements PipelineConfigurationContext { constructor(private _handle: PipelineConfigurationContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1604,8 +1937,14 @@ export class PipelineConfigurationContext { 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setServices', + { context: this._handle, value } + ); + } }; /** Gets the Steps property */ @@ -1631,8 +1970,14 @@ export class PipelineConfigurationContext { 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, + set: async (value: DistributedApplicationModel): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineConfigurationContext.setModel', + { context: this._handle, value } + ); + } }; /** Gets pipeline steps with the specified tag */ @@ -1649,7 +1994,7 @@ export class PipelineConfigurationContext { /** * Thenable wrapper for PipelineConfigurationContext that enables fluent chaining. */ -export class PipelineConfigurationContextPromise implements PromiseLike { +class PipelineConfigurationContextPromiseImpl implements PipelineConfigurationContextPromise { constructor(private _promise: Promise) {} then( @@ -1670,10 +2015,37 @@ export class PipelineConfigurationContextPromise implements PromiseLike Promise; + }; + executionContext: { + get: () => Promise; + }; + services: { + get: () => Promise; + }; + logger: { + get: () => Promise; + }; + cancellationToken: { + get: () => Promise; + set: (value: AbortSignal | CancellationToken) => Promise; + }; + summary: { + get: () => Promise; + }; +} + +// ============================================================================ +// PipelineContextImpl +// ============================================================================ + /** * Type class for PipelineContext. */ -export class PipelineContext { +class PipelineContextImpl implements PipelineContext { constructor(private _handle: PipelineContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1686,7 +2058,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -1697,7 +2069,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -1708,7 +2080,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1719,7 +2091,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, }; @@ -1747,7 +2119,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.summary', { context: this._handle } ); - return new PipelineSummary(handle, this._client); + return new PipelineSummaryImpl(handle, this._client); }, }; @@ -1757,10 +2129,40 @@ export class PipelineContext { // PipelineStep // ============================================================================ +export interface PipelineStep { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + description: { + get: () => Promise; + set: (value: string) => Promise; + }; + readonly dependsOnSteps: AspireList; + readonly requiredBySteps: AspireList; + readonly tags: AspireList; + resource: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + dependsOn(stepName: string): PipelineStepPromise; + requiredBy(stepName: string): PipelineStepPromise; +} + +export interface PipelineStepPromise extends PromiseLike { + dependsOn(stepName: string): PipelineStepPromise; + requiredBy(stepName: string): PipelineStepPromise; +} + +// ============================================================================ +// PipelineStepImpl +// ============================================================================ + /** * Type class for PipelineStep. */ -export class PipelineStep { +class PipelineStepImpl implements PipelineStep { constructor(private _handle: PipelineStepHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1847,8 +2249,14 @@ export class PipelineStep { 'Aspire.Hosting.Pipelines/PipelineStep.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStep.setResource', + { context: this._handle, value } + ); + } }; /** Adds a dependency on another step by name */ @@ -1863,7 +2271,7 @@ export class PipelineStep { } dependsOn(stepName: string): PipelineStepPromise { - return new PipelineStepPromise(this._dependsOnInternal(stepName)); + return new PipelineStepPromiseImpl(this._dependsOnInternal(stepName)); } /** Specifies that another step requires this step by name */ @@ -1878,7 +2286,7 @@ export class PipelineStep { } requiredBy(stepName: string): PipelineStepPromise { - return new PipelineStepPromise(this._requiredByInternal(stepName)); + return new PipelineStepPromiseImpl(this._requiredByInternal(stepName)); } } @@ -1886,7 +2294,7 @@ export class PipelineStep { /** * Thenable wrapper for PipelineStep that enables fluent chaining. */ -export class PipelineStepPromise implements PromiseLike { +class PipelineStepPromiseImpl implements PipelineStepPromise { constructor(private _promise: Promise) {} then( @@ -1898,12 +2306,12 @@ export class PipelineStepPromise implements PromiseLike { /** Adds a dependency on another step by name */ dependsOn(stepName: string): PipelineStepPromise { - return new PipelineStepPromise(this._promise.then(obj => obj.dependsOn(stepName))); + return new PipelineStepPromiseImpl(this._promise.then(obj => obj.dependsOn(stepName))); } /** Specifies that another step requires this step by name */ requiredBy(stepName: string): PipelineStepPromise { - return new PipelineStepPromise(this._promise.then(obj => obj.requiredBy(stepName))); + return new PipelineStepPromiseImpl(this._promise.then(obj => obj.requiredBy(stepName))); } } @@ -1912,10 +2320,44 @@ export class PipelineStepPromise implements PromiseLike { // PipelineStepContext // ============================================================================ +export interface PipelineStepContext { + toJSON(): MarshalledHandle; + pipelineContext: { + get: () => Promise; + set: (value: PipelineContext) => Promise; + }; + reportingStep: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + model: { + get: () => Promise; + }; + executionContext: { + get: () => Promise; + }; + services: { + get: () => Promise; + }; + logger: { + get: () => Promise; + }; + cancellationToken: { + get: () => Promise; + }; + summary: { + get: () => Promise; + }; +} + +// ============================================================================ +// PipelineStepContextImpl +// ============================================================================ + /** * Type class for PipelineStepContext. */ -export class PipelineStepContext { +class PipelineStepContextImpl implements PipelineStepContext { constructor(private _handle: PipelineStepContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1928,8 +2370,14 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext', { context: this._handle } ); - return new PipelineContext(handle, this._client); + return new PipelineContextImpl(handle, this._client); }, + set: async (value: PipelineContext): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.setPipelineContext', + { context: this._handle, value } + ); + } }; /** Gets the ReportingStep property */ @@ -1939,8 +2387,14 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep', { context: this._handle } ); - return new ReportingStep(handle, this._client); + return new ReportingStepImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepContext.setReportingStep', + { context: this._handle, value } + ); + } }; /** Gets the Model property */ @@ -1950,7 +2404,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -1961,7 +2415,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -1972,7 +2426,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1983,7 +2437,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, }; @@ -2005,7 +2459,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', { context: this._handle } ); - return new PipelineSummary(handle, this._client); + return new PipelineSummaryImpl(handle, this._client); }, }; @@ -2015,10 +2469,26 @@ export class PipelineStepContext { // PipelineStepFactoryContext // ============================================================================ +export interface PipelineStepFactoryContext { + toJSON(): MarshalledHandle; + pipelineContext: { + get: () => Promise; + set: (value: PipelineContext) => Promise; + }; + resource: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; +} + +// ============================================================================ +// PipelineStepFactoryContextImpl +// ============================================================================ + /** * Type class for PipelineStepFactoryContext. */ -export class PipelineStepFactoryContext { +class PipelineStepFactoryContextImpl implements PipelineStepFactoryContext { constructor(private _handle: PipelineStepFactoryContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2031,8 +2501,14 @@ export class PipelineStepFactoryContext { 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext', { context: this._handle } ); - return new PipelineContext(handle, this._client); + return new PipelineContextImpl(handle, this._client); }, + set: async (value: PipelineContext): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.setPipelineContext', + { context: this._handle, value } + ); + } }; /** Gets the Resource property */ @@ -2042,8 +2518,14 @@ export class PipelineStepFactoryContext { 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.Pipelines/PipelineStepFactoryContext.setResource', + { context: this._handle, value } + ); + } }; } @@ -2052,10 +2534,25 @@ export class PipelineStepFactoryContext { // PipelineSummary // ============================================================================ +export interface PipelineSummary { + toJSON(): MarshalledHandle; + add(key: string, value: string): PipelineSummaryPromise; + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise; +} + +export interface PipelineSummaryPromise extends PromiseLike { + add(key: string, value: string): PipelineSummaryPromise; + addMarkdown(key: string, markdownString: string): PipelineSummaryPromise; +} + +// ============================================================================ +// PipelineSummaryImpl +// ============================================================================ + /** * Type class for PipelineSummary. */ -export class PipelineSummary { +class PipelineSummaryImpl implements PipelineSummary { constructor(private _handle: PipelineSummaryHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2073,7 +2570,7 @@ export class PipelineSummary { } add(key: string, value: string): PipelineSummaryPromise { - return new PipelineSummaryPromise(this._addInternal(key, value)); + return new PipelineSummaryPromiseImpl(this._addInternal(key, value)); } /** Adds a Markdown-formatted value to the pipeline summary */ @@ -2088,7 +2585,7 @@ export class PipelineSummary { } addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { - return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + return new PipelineSummaryPromiseImpl(this._addMarkdownInternal(key, markdownString)); } } @@ -2096,7 +2593,7 @@ export class PipelineSummary { /** * Thenable wrapper for PipelineSummary that enables fluent chaining. */ -export class PipelineSummaryPromise implements PromiseLike { +class PipelineSummaryPromiseImpl implements PipelineSummaryPromise { constructor(private _promise: Promise) {} then( @@ -2108,12 +2605,12 @@ export class PipelineSummaryPromise implements PromiseLike { /** Invokes the Add method */ add(key: string, value: string): PipelineSummaryPromise { - return new PipelineSummaryPromise(this._promise.then(obj => obj.add(key, value))); + return new PipelineSummaryPromiseImpl(this._promise.then(obj => obj.add(key, value))); } /** Adds a Markdown-formatted value to the pipeline summary */ addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { - return new PipelineSummaryPromise(this._promise.then(obj => obj.addMarkdown(key, markdownString))); + return new PipelineSummaryPromiseImpl(this._promise.then(obj => obj.addMarkdown(key, markdownString))); } } @@ -2122,10 +2619,30 @@ export class PipelineSummaryPromise implements PromiseLike { // ProjectResourceOptions // ============================================================================ +export interface ProjectResourceOptions { + toJSON(): MarshalledHandle; + launchProfileName: { + get: () => Promise; + set: (value: string) => Promise; + }; + excludeLaunchProfile: { + get: () => Promise; + set: (value: boolean) => Promise; + }; + excludeKestrelEndpoints: { + get: () => Promise; + set: (value: boolean) => Promise; + }; +} + +// ============================================================================ +// ProjectResourceOptionsImpl +// ============================================================================ + /** * Type class for ProjectResourceOptions. */ -export class ProjectResourceOptions { +class ProjectResourceOptionsImpl implements ProjectResourceOptions { constructor(private _handle: ProjectResourceOptionsHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2185,10 +2702,32 @@ export class ProjectResourceOptions { // ReferenceExpressionBuilder // ============================================================================ +export interface ReferenceExpressionBuilder { + toJSON(): MarshalledHandle; + isEmpty: { + get: () => Promise; + }; + appendLiteral(value: string): ReferenceExpressionBuilderPromise; + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise; + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise; + build(): Promise; +} + +export interface ReferenceExpressionBuilderPromise extends PromiseLike { + appendLiteral(value: string): ReferenceExpressionBuilderPromise; + appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise; + appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise; + build(): Promise; +} + +// ============================================================================ +// ReferenceExpressionBuilderImpl +// ============================================================================ + /** * Type class for ReferenceExpressionBuilder. */ -export class ReferenceExpressionBuilder { +class ReferenceExpressionBuilderImpl implements ReferenceExpressionBuilder { constructor(private _handle: ReferenceExpressionBuilderHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2216,7 +2755,7 @@ export class ReferenceExpressionBuilder { } appendLiteral(value: string): ReferenceExpressionBuilderPromise { - return new ReferenceExpressionBuilderPromise(this._appendLiteralInternal(value)); + return new ReferenceExpressionBuilderPromiseImpl(this._appendLiteralInternal(value)); } /** Appends a formatted string value to the reference expression */ @@ -2233,7 +2772,7 @@ export class ReferenceExpressionBuilder { appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { const format = options?.format; - return new ReferenceExpressionBuilderPromise(this._appendFormattedInternal(value, format)); + return new ReferenceExpressionBuilderPromiseImpl(this._appendFormattedInternal(value, format)); } /** Appends a value provider to the reference expression */ @@ -2250,7 +2789,7 @@ export class ReferenceExpressionBuilder { appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { const format = options?.format; - return new ReferenceExpressionBuilderPromise(this._appendValueProviderInternal(valueProvider, format)); + return new ReferenceExpressionBuilderPromiseImpl(this._appendValueProviderInternal(valueProvider, format)); } /** Builds the reference expression */ @@ -2267,7 +2806,7 @@ export class ReferenceExpressionBuilder { /** * Thenable wrapper for ReferenceExpressionBuilder that enables fluent chaining. */ -export class ReferenceExpressionBuilderPromise implements PromiseLike { +class ReferenceExpressionBuilderPromiseImpl implements ReferenceExpressionBuilderPromise { constructor(private _promise: Promise) {} then( @@ -2279,17 +2818,17 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike obj.appendLiteral(value))); + return new ReferenceExpressionBuilderPromiseImpl(this._promise.then(obj => obj.appendLiteral(value))); } /** Appends a formatted string value to the reference expression */ appendFormatted(value: string, options?: AppendFormattedOptions): ReferenceExpressionBuilderPromise { - return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendFormatted(value, options))); + return new ReferenceExpressionBuilderPromiseImpl(this._promise.then(obj => obj.appendFormatted(value, options))); } /** Appends a value provider to the reference expression */ appendValueProvider(valueProvider: any, options?: AppendValueProviderOptions): ReferenceExpressionBuilderPromise { - return new ReferenceExpressionBuilderPromise(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); + return new ReferenceExpressionBuilderPromiseImpl(this._promise.then(obj => obj.appendValueProvider(valueProvider, options))); } /** Builds the reference expression */ @@ -2303,10 +2842,24 @@ export class ReferenceExpressionBuilderPromise implements PromiseLike Promise; + }; + services: { + get: () => Promise; + }; +} + +// ============================================================================ +// ResourceEndpointsAllocatedEventImpl +// ============================================================================ + /** * Type class for ResourceEndpointsAllocatedEvent. */ -export class ResourceEndpointsAllocatedEvent { +class ResourceEndpointsAllocatedEventImpl implements ResourceEndpointsAllocatedEvent { constructor(private _handle: ResourceEndpointsAllocatedEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2319,7 +2872,7 @@ export class ResourceEndpointsAllocatedEvent { 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2330,7 +2883,7 @@ export class ResourceEndpointsAllocatedEvent { 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -2340,10 +2893,25 @@ export class ResourceEndpointsAllocatedEvent { // ResourceLoggerService // ============================================================================ +export interface ResourceLoggerService { + toJSON(): MarshalledHandle; + completeLog(resource: HandleReference): ResourceLoggerServicePromise; + completeLogByName(resourceName: string): ResourceLoggerServicePromise; +} + +export interface ResourceLoggerServicePromise extends PromiseLike { + completeLog(resource: HandleReference): ResourceLoggerServicePromise; + completeLogByName(resourceName: string): ResourceLoggerServicePromise; +} + +// ============================================================================ +// ResourceLoggerServiceImpl +// ============================================================================ + /** * Type class for ResourceLoggerService. */ -export class ResourceLoggerService { +class ResourceLoggerServiceImpl implements ResourceLoggerService { constructor(private _handle: ResourceLoggerServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2351,7 +2919,7 @@ export class ResourceLoggerService { /** Completes the log stream for a resource */ /** @internal */ - async _completeLogInternal(resource: ResourceBuilderBase): Promise { + async _completeLogInternal(resource: HandleReference): Promise { const rpcArgs: Record = { loggerService: this._handle, resource }; await this._client.invokeCapability( 'Aspire.Hosting/completeLog', @@ -2360,8 +2928,8 @@ export class ResourceLoggerService { return this; } - completeLog(resource: ResourceBuilderBase): ResourceLoggerServicePromise { - return new ResourceLoggerServicePromise(this._completeLogInternal(resource)); + completeLog(resource: HandleReference): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromiseImpl(this._completeLogInternal(resource)); } /** Completes the log stream by resource name */ @@ -2376,7 +2944,7 @@ export class ResourceLoggerService { } completeLogByName(resourceName: string): ResourceLoggerServicePromise { - return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + return new ResourceLoggerServicePromiseImpl(this._completeLogByNameInternal(resourceName)); } } @@ -2384,7 +2952,7 @@ export class ResourceLoggerService { /** * Thenable wrapper for ResourceLoggerService that enables fluent chaining. */ -export class ResourceLoggerServicePromise implements PromiseLike { +class ResourceLoggerServicePromiseImpl implements ResourceLoggerServicePromise { constructor(private _promise: Promise) {} then( @@ -2395,13 +2963,13 @@ export class ResourceLoggerServicePromise implements PromiseLike obj.completeLog(resource))); + completeLog(resource: HandleReference): ResourceLoggerServicePromise { + return new ResourceLoggerServicePromiseImpl(this._promise.then(obj => obj.completeLog(resource))); } /** Completes the log stream by resource name */ completeLogByName(resourceName: string): ResourceLoggerServicePromise { - return new ResourceLoggerServicePromise(this._promise.then(obj => obj.completeLogByName(resourceName))); + return new ResourceLoggerServicePromiseImpl(this._promise.then(obj => obj.completeLogByName(resourceName))); } } @@ -2410,10 +2978,33 @@ export class ResourceLoggerServicePromise implements PromiseLike; + waitForResourceHealthy(resourceName: string): Promise; + waitForDependencies(resource: HandleReference): ResourceNotificationServicePromise; + tryGetResourceState(resourceName: string): Promise; + publishResourceUpdate(resource: HandleReference, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise; +} + +export interface ResourceNotificationServicePromise extends PromiseLike { + waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise; + waitForResourceStates(resourceName: string, targetStates: string[]): Promise; + waitForResourceHealthy(resourceName: string): Promise; + waitForDependencies(resource: HandleReference): ResourceNotificationServicePromise; + tryGetResourceState(resourceName: string): Promise; + publishResourceUpdate(resource: HandleReference, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise; +} + +// ============================================================================ +// ResourceNotificationServiceImpl +// ============================================================================ + /** * Type class for ResourceNotificationService. */ -export class ResourceNotificationService { +class ResourceNotificationServiceImpl implements ResourceNotificationService { constructor(private _handle: ResourceNotificationServiceHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2433,7 +3024,7 @@ export class ResourceNotificationService { waitForResourceState(resourceName: string, options?: WaitForResourceStateOptions): ResourceNotificationServicePromise { const targetState = options?.targetState; - return new ResourceNotificationServicePromise(this._waitForResourceStateInternal(resourceName, targetState)); + return new ResourceNotificationServicePromiseImpl(this._waitForResourceStateInternal(resourceName, targetState)); } /** Waits for a resource to reach one of the specified states */ @@ -2456,7 +3047,7 @@ export class ResourceNotificationService { /** Waits for all dependencies of a resource to be ready */ /** @internal */ - async _waitForDependenciesInternal(resource: ResourceBuilderBase): Promise { + async _waitForDependenciesInternal(resource: HandleReference): Promise { const rpcArgs: Record = { notificationService: this._handle, resource }; await this._client.invokeCapability( 'Aspire.Hosting/waitForDependencies', @@ -2465,8 +3056,8 @@ export class ResourceNotificationService { return this; } - waitForDependencies(resource: ResourceBuilderBase): ResourceNotificationServicePromise { - return new ResourceNotificationServicePromise(this._waitForDependenciesInternal(resource)); + waitForDependencies(resource: HandleReference): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromiseImpl(this._waitForDependenciesInternal(resource)); } /** Tries to get the current state of a resource */ @@ -2480,7 +3071,7 @@ export class ResourceNotificationService { /** Publishes an update for a resource's state */ /** @internal */ - async _publishResourceUpdateInternal(resource: ResourceBuilderBase, state?: string, stateStyle?: string): Promise { + async _publishResourceUpdateInternal(resource: HandleReference, state?: string, stateStyle?: string): Promise { const rpcArgs: Record = { notificationService: this._handle, resource }; if (state !== undefined) rpcArgs.state = state; if (stateStyle !== undefined) rpcArgs.stateStyle = stateStyle; @@ -2491,10 +3082,10 @@ export class ResourceNotificationService { return this; } - publishResourceUpdate(resource: ResourceBuilderBase, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + publishResourceUpdate(resource: HandleReference, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { const state = options?.state; const stateStyle = options?.stateStyle; - return new ResourceNotificationServicePromise(this._publishResourceUpdateInternal(resource, state, stateStyle)); + return new ResourceNotificationServicePromiseImpl(this._publishResourceUpdateInternal(resource, state, stateStyle)); } } @@ -2502,7 +3093,7 @@ export class ResourceNotificationService { /** * Thenable wrapper for ResourceNotificationService that enables fluent chaining. */ -export class ResourceNotificationServicePromise implements PromiseLike { +class ResourceNotificationServicePromiseImpl implements ResourceNotificationServicePromise { constructor(private _promise: Promise) {} then( @@ -2514,7 +3105,7 @@ export class ResourceNotificationServicePromise implements PromiseLike obj.waitForResourceState(resourceName, options))); + return new ResourceNotificationServicePromiseImpl(this._promise.then(obj => obj.waitForResourceState(resourceName, options))); } /** Waits for a resource to reach one of the specified states */ @@ -2528,8 +3119,8 @@ export class ResourceNotificationServicePromise implements PromiseLike obj.waitForDependencies(resource))); + waitForDependencies(resource: HandleReference): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromiseImpl(this._promise.then(obj => obj.waitForDependencies(resource))); } /** Tries to get the current state of a resource */ @@ -2538,8 +3129,8 @@ export class ResourceNotificationServicePromise implements PromiseLike obj.publishResourceUpdate(resource, options))); + publishResourceUpdate(resource: HandleReference, options?: PublishResourceUpdateOptions): ResourceNotificationServicePromise { + return new ResourceNotificationServicePromiseImpl(this._promise.then(obj => obj.publishResourceUpdate(resource, options))); } } @@ -2548,10 +3139,24 @@ export class ResourceNotificationServicePromise implements PromiseLike Promise; + }; + services: { + get: () => Promise; + }; +} + +// ============================================================================ +// ResourceReadyEventImpl +// ============================================================================ + /** * Type class for ResourceReadyEvent. */ -export class ResourceReadyEvent { +class ResourceReadyEventImpl implements ResourceReadyEvent { constructor(private _handle: ResourceReadyEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2564,7 +3169,7 @@ export class ResourceReadyEvent { 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2575,7 +3180,7 @@ export class ResourceReadyEvent { 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -2585,10 +3190,24 @@ export class ResourceReadyEvent { // ResourceStoppedEvent // ============================================================================ +export interface ResourceStoppedEvent { + toJSON(): MarshalledHandle; + resource: { + get: () => Promise; + }; + services: { + get: () => Promise; + }; +} + +// ============================================================================ +// ResourceStoppedEventImpl +// ============================================================================ + /** * Type class for ResourceStoppedEvent. */ -export class ResourceStoppedEvent { +class ResourceStoppedEventImpl implements ResourceStoppedEvent { constructor(private _handle: ResourceStoppedEventHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2601,7 +3220,7 @@ export class ResourceStoppedEvent { 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2612,7 +3231,7 @@ export class ResourceStoppedEvent { 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -2622,10 +3241,32 @@ export class ResourceStoppedEvent { // ResourceUrlsCallbackContext // ============================================================================ +export interface ResourceUrlsCallbackContext { + toJSON(): MarshalledHandle; + resource: { + get: () => Promise; + }; + readonly urls: AspireList; + cancellationToken: { + get: () => Promise; + }; + logger: { + get: () => Promise; + set: (value: HandleReference) => Promise; + }; + executionContext: { + get: () => Promise; + }; +} + +// ============================================================================ +// ResourceUrlsCallbackContextImpl +// ============================================================================ + /** * Type class for ResourceUrlsCallbackContext. */ -export class ResourceUrlsCallbackContext { +class ResourceUrlsCallbackContextImpl implements ResourceUrlsCallbackContext { constructor(private _handle: ResourceUrlsCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2638,7 +3279,7 @@ export class ResourceUrlsCallbackContext { 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2674,8 +3315,14 @@ export class ResourceUrlsCallbackContext { 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.setLogger', + { context: this._handle, value } + ); + } }; /** Gets the ExecutionContext property */ @@ -2685,7 +3332,7 @@ export class ResourceUrlsCallbackContext { 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -2695,10 +3342,30 @@ export class ResourceUrlsCallbackContext { // TestCallbackContext // ============================================================================ +export interface TestCallbackContext { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + value: { + get: () => Promise; + set: (value: number) => Promise; + }; + cancellationToken: { + get: () => Promise; + set: (value: AbortSignal | CancellationToken) => Promise; + }; +} + +// ============================================================================ +// TestCallbackContextImpl +// ============================================================================ + /** * Type class for TestCallbackContext. */ -export class TestCallbackContext { +class TestCallbackContextImpl implements TestCallbackContext { constructor(private _handle: TestCallbackContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2759,10 +3426,20 @@ export class TestCallbackContext { // TestCollectionContext // ============================================================================ +export interface TestCollectionContext { + toJSON(): MarshalledHandle; + readonly items: AspireList; + readonly metadata: AspireDict; +} + +// ============================================================================ +// TestCollectionContextImpl +// ============================================================================ + /** * Type class for TestCollectionContext. */ -export class TestCollectionContext { +class TestCollectionContextImpl implements TestCollectionContext { constructor(private _handle: TestCollectionContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2802,10 +3479,30 @@ export class TestCollectionContext { // TestEnvironmentContext // ============================================================================ +export interface TestEnvironmentContext { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + description: { + get: () => Promise; + set: (value: string) => Promise; + }; + priority: { + get: () => Promise; + set: (value: number) => Promise; + }; +} + +// ============================================================================ +// TestEnvironmentContextImpl +// ============================================================================ + /** * Type class for TestEnvironmentContext. */ -export class TestEnvironmentContext { +class TestEnvironmentContextImpl implements TestEnvironmentContext { constructor(private _handle: TestEnvironmentContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2865,10 +3562,35 @@ export class TestEnvironmentContext { // TestResourceContext // ============================================================================ +export interface TestResourceContext { + toJSON(): MarshalledHandle; + name: { + get: () => Promise; + set: (value: string) => Promise; + }; + value: { + get: () => Promise; + set: (value: number) => Promise; + }; + getValueAsync(): Promise; + setValueAsync(value: string): TestResourceContextPromise; + validateAsync(): Promise; +} + +export interface TestResourceContextPromise extends PromiseLike { + getValueAsync(): Promise; + setValueAsync(value: string): TestResourceContextPromise; + validateAsync(): Promise; +} + +// ============================================================================ +// TestResourceContextImpl +// ============================================================================ + /** * Type class for TestResourceContext. */ -export class TestResourceContext { +class TestResourceContextImpl implements TestResourceContext { constructor(private _handle: TestResourceContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2927,7 +3649,7 @@ export class TestResourceContext { } setValueAsync(value: string): TestResourceContextPromise { - return new TestResourceContextPromise(this._setValueAsyncInternal(value)); + return new TestResourceContextPromiseImpl(this._setValueAsyncInternal(value)); } /** Invokes the ValidateAsync method */ @@ -2944,7 +3666,7 @@ export class TestResourceContext { /** * Thenable wrapper for TestResourceContext that enables fluent chaining. */ -export class TestResourceContextPromise implements PromiseLike { +class TestResourceContextPromiseImpl implements TestResourceContextPromise { constructor(private _promise: Promise) {} then( @@ -2961,7 +3683,7 @@ export class TestResourceContextPromise implements PromiseLike obj.setValueAsync(value))); + return new TestResourceContextPromiseImpl(this._promise.then(obj => obj.setValueAsync(value))); } /** Invokes the ValidateAsync method */ @@ -2975,10 +3697,22 @@ export class TestResourceContextPromise implements PromiseLike Promise; + set: (value: HandleReference) => Promise; + }; +} + +// ============================================================================ +// UpdateCommandStateContextImpl +// ============================================================================ + /** * Type class for UpdateCommandStateContext. */ -export class UpdateCommandStateContext { +class UpdateCommandStateContextImpl implements UpdateCommandStateContext { constructor(private _handle: UpdateCommandStateContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -2991,8 +3725,14 @@ export class UpdateCommandStateContext { 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, + set: async (value: HandleReference): Promise => { + await this._client.invokeCapability( + 'Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.setServiceProvider', + { context: this._handle, value } + ); + } }; } @@ -3001,10 +3741,31 @@ export class UpdateCommandStateContext { // Configuration // ============================================================================ +export interface Configuration { + toJSON(): MarshalledHandle; + getConfigValue(key: string): Promise; + getConnectionString(name: string): Promise; + getSection(key: string): Promise; + getChildren(): Promise; + exists(key: string): Promise; +} + +export interface ConfigurationPromise extends PromiseLike { + getConfigValue(key: string): Promise; + getConnectionString(name: string): Promise; + getSection(key: string): Promise; + getChildren(): Promise; + exists(key: string): Promise; +} + +// ============================================================================ +// ConfigurationImpl +// ============================================================================ + /** * Type class for Configuration. */ -export class Configuration { +class ConfigurationImpl implements Configuration { constructor(private _handle: IConfigurationHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -3060,7 +3821,7 @@ export class Configuration { /** * Thenable wrapper for Configuration that enables fluent chaining. */ -export class ConfigurationPromise implements PromiseLike { +class ConfigurationPromiseImpl implements ConfigurationPromise { constructor(private _promise: Promise) {} then( @@ -3101,10 +3862,86 @@ export class ConfigurationPromise implements PromiseLike { // DistributedApplicationBuilder // ============================================================================ +export interface DistributedApplicationBuilder { + toJSON(): MarshalledHandle; + appHostDirectory: { + get: () => Promise; + }; + environment: { + get: () => Promise; + }; + eventing: { + get: () => Promise; + }; + executionContext: { + get: () => Promise; + }; + userSecretsManager: { + get: () => Promise; + }; + build(): DistributedApplicationPromise; + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise; + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise; + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise; + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise; + addContainer(name: string, image: string): ContainerResourcePromise; + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise; + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise; + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise; + addExternalService(name: string, url: string): ExternalServiceResourcePromise; + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise; + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise; + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise; + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise; + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise; + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise; + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise; + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise; + addCSharpApp(name: string, path: string): ProjectResourcePromise; + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise; + getConfiguration(): ConfigurationPromise; + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise; + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise; + addTestRedis(name: string, options?: AddTestRedisOptions): TestRedisResourcePromise; + addTestVault(name: string): TestVaultResourcePromise; +} + +export interface DistributedApplicationBuilderPromise extends PromiseLike { + build(): DistributedApplicationPromise; + addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise; + addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise; + addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise; + addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise; + addContainer(name: string, image: string): ContainerResourcePromise; + addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise; + addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise; + addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise; + addExternalService(name: string, url: string): ExternalServiceResourcePromise; + addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise; + addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise; + addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise; + addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise; + addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise; + addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise; + addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise; + addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise; + addCSharpApp(name: string, path: string): ProjectResourcePromise; + addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise; + getConfiguration(): ConfigurationPromise; + subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise; + subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise; + addTestRedis(name: string, options?: AddTestRedisOptions): TestRedisResourcePromise; + addTestVault(name: string): TestVaultResourcePromise; +} + +// ============================================================================ +// DistributedApplicationBuilderImpl +// ============================================================================ + /** * Type class for DistributedApplicationBuilder. */ -export class DistributedApplicationBuilder { +class DistributedApplicationBuilderImpl implements DistributedApplicationBuilder { constructor(private _handle: IDistributedApplicationBuilderHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -3127,7 +3964,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.environment', { context: this._handle } ); - return new HostEnvironment(handle, this._client); + return new HostEnvironmentImpl(handle, this._client); }, }; @@ -3138,7 +3975,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new DistributedApplicationEventingImpl(handle, this._client); }, }; @@ -3149,7 +3986,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -3160,7 +3997,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', { context: this._handle } ); - return new UserSecretsManager(handle, this._client); + return new UserSecretsManagerImpl(handle, this._client); }, }; @@ -3172,11 +4009,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/build', rpcArgs ); - return new DistributedApplication(result, this._client); + return new DistributedApplicationImpl(result, this._client); } build(): DistributedApplicationPromise { - return new DistributedApplicationPromise(this._buildInternal()); + return new DistributedApplicationPromiseImpl(this._buildInternal()); } /** Adds a connection string with a reference expression */ @@ -3187,11 +4024,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addConnectionStringExpression', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); + return new ConnectionStringResourcePromiseImpl(this._addConnectionStringExpressionInternal(name, connectionStringExpression)); } /** Adds a connection string with a builder callback */ @@ -3199,7 +4036,7 @@ export class DistributedApplicationBuilder { async _addConnectionStringBuilderInternal(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): Promise { const connectionStringBuilderId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ReferenceExpressionBuilderHandle; - const obj = new ReferenceExpressionBuilder(objHandle, this._client); + const obj = new ReferenceExpressionBuilderImpl(objHandle, this._client); await connectionStringBuilder(obj); }); const rpcArgs: Record = { builder: this._handle, name, connectionStringBuilder: connectionStringBuilderId }; @@ -3207,11 +4044,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addConnectionStringBuilder', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); + return new ConnectionStringResourcePromiseImpl(this._addConnectionStringBuilderInternal(name, connectionStringBuilder)); } /** Adds a container registry resource */ @@ -3223,12 +4060,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addContainerRegistry', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryInternal(name, endpoint, repository)); + return new ContainerRegistryResourcePromiseImpl(this._addContainerRegistryInternal(name, endpoint, repository)); } /** Adds a container registry with string endpoint */ @@ -3240,12 +4077,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addContainerRegistryFromString', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { const repository = options?.repository; - return new ContainerRegistryResourcePromise(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); + return new ContainerRegistryResourcePromiseImpl(this._addContainerRegistryFromStringInternal(name, endpoint, repository)); } /** Adds a container resource */ @@ -3256,11 +4093,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addContainer', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._addContainerInternal(name, image)); + return new ContainerResourcePromiseImpl(this._addContainerInternal(name, image)); } /** Adds a container resource built from a Dockerfile */ @@ -3273,13 +4110,13 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addDockerfile', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { const dockerfilePath = options?.dockerfilePath; const stage = options?.stage; - return new ContainerResourcePromise(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); + return new ContainerResourcePromiseImpl(this._addDockerfileInternal(name, contextPath, dockerfilePath, stage)); } /** Adds a .NET tool resource */ @@ -3290,11 +4127,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addDotnetTool', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._addDotnetToolInternal(name, packageId)); + return new DotnetToolResourcePromiseImpl(this._addDotnetToolInternal(name, packageId)); } /** Adds an executable resource */ @@ -3305,11 +4142,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addExecutable', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._addExecutableInternal(name, command, workingDirectory, args)); + return new ExecutableResourcePromiseImpl(this._addExecutableInternal(name, command, workingDirectory, args)); } /** Adds an external service resource */ @@ -3320,11 +4157,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addExternalService', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceInternal(name, url)); + return new ExternalServiceResourcePromiseImpl(this._addExternalServiceInternal(name, url)); } /** Adds an external service with a URI */ @@ -3335,11 +4172,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addExternalServiceUri', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceUriInternal(name, uri)); + return new ExternalServiceResourcePromiseImpl(this._addExternalServiceUriInternal(name, uri)); } /** Adds an external service with a parameter URL */ @@ -3350,11 +4187,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addExternalServiceParameter', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._addExternalServiceParameterInternal(name, urlParameter)); + return new ExternalServiceResourcePromiseImpl(this._addExternalServiceParameterInternal(name, urlParameter)); } /** Adds a parameter resource */ @@ -3366,12 +4203,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addParameter', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterInternal(name, secret)); + return new ParameterResourcePromiseImpl(this._addParameterInternal(name, secret)); } /** Adds a parameter with a default value */ @@ -3384,13 +4221,13 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addParameterWithValue', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { const publishValueAsDefault = options?.publishValueAsDefault; const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); + return new ParameterResourcePromiseImpl(this._addParameterWithValueInternal(name, value, publishValueAsDefault, secret)); } /** Adds a parameter sourced from configuration */ @@ -3402,12 +4239,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addParameterFromConfiguration', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { const secret = options?.secret; - return new ParameterResourcePromise(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); + return new ParameterResourcePromiseImpl(this._addParameterFromConfigurationInternal(name, configurationKey, secret)); } /** Adds a connection string resource */ @@ -3419,12 +4256,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addConnectionString', rpcArgs ); - return new ResourceWithConnectionString(result, this._client); + return new ResourceWithConnectionStringImpl(result, this._client); } addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { const environmentVariableName = options?.environmentVariableName; - return new ResourceWithConnectionStringPromise(this._addConnectionStringInternal(name, environmentVariableName)); + return new ResourceWithConnectionStringPromiseImpl(this._addConnectionStringInternal(name, environmentVariableName)); } /** Adds a .NET project resource */ @@ -3435,11 +4272,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addProject', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectInternal(name, projectPath, launchProfileName)); + return new ProjectResourcePromiseImpl(this._addProjectInternal(name, projectPath, launchProfileName)); } /** Adds a project resource with configuration options */ @@ -3447,7 +4284,7 @@ export class DistributedApplicationBuilder { async _addProjectWithOptionsInternal(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { const configureId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); + const obj = new ProjectResourceOptionsImpl(objHandle, this._client); await configure(obj); }); const rpcArgs: Record = { builder: this._handle, name, projectPath, configure: configureId }; @@ -3455,11 +4292,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addProjectWithOptions', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._addProjectWithOptionsInternal(name, projectPath, configure)); + return new ProjectResourcePromiseImpl(this._addProjectWithOptionsInternal(name, projectPath, configure)); } /** Adds a C# application resource */ @@ -3470,11 +4307,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addCSharpApp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._addCSharpAppInternal(name, path)); + return new ProjectResourcePromiseImpl(this._addCSharpAppInternal(name, path)); } /** Adds a C# application resource with configuration options */ @@ -3482,7 +4319,7 @@ export class DistributedApplicationBuilder { async _addCSharpAppWithOptionsInternal(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): Promise { const configureId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ProjectResourceOptionsHandle; - const obj = new ProjectResourceOptions(objHandle, this._client); + const obj = new ProjectResourceOptionsImpl(objHandle, this._client); await configure(obj); }); const rpcArgs: Record = { builder: this._handle, name, path, configure: configureId }; @@ -3490,11 +4327,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/addCSharpAppWithOptions', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._addCSharpAppWithOptionsInternal(name, path, configure)); + return new CSharpAppResourcePromiseImpl(this._addCSharpAppWithOptionsInternal(name, path, configure)); } /** Gets the application configuration */ @@ -3505,18 +4342,18 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/getConfiguration', rpcArgs ); - return new Configuration(result, this._client); + return new ConfigurationImpl(result, this._client); } getConfiguration(): ConfigurationPromise { - return new ConfigurationPromise(this._getConfigurationInternal()); + return new ConfigurationPromiseImpl(this._getConfigurationInternal()); } /** Subscribes to the BeforeStart event */ async subscribeBeforeStart(callback: (arg: BeforeStartEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeStartEventHandle; - const arg = new BeforeStartEvent(argHandle, this._client); + const arg = new BeforeStartEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -3530,7 +4367,7 @@ export class DistributedApplicationBuilder { async subscribeAfterResourcesCreated(callback: (arg: AfterResourcesCreatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as AfterResourcesCreatedEventHandle; - const arg = new AfterResourcesCreatedEvent(argHandle, this._client); + const arg = new AfterResourcesCreatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -3549,12 +4386,12 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/addTestRedis', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } addTestRedis(name: string, options?: AddTestRedisOptions): TestRedisResourcePromise { const port = options?.port; - return new TestRedisResourcePromise(this._addTestRedisInternal(name, port)); + return new TestRedisResourcePromiseImpl(this._addTestRedisInternal(name, port)); } /** Adds a test vault resource */ @@ -3565,11 +4402,11 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/addTestVault', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } addTestVault(name: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._addTestVaultInternal(name)); + return new TestVaultResourcePromiseImpl(this._addTestVaultInternal(name)); } } @@ -3577,7 +4414,7 @@ export class DistributedApplicationBuilder { /** * Thenable wrapper for DistributedApplicationBuilder that enables fluent chaining. */ -export class DistributedApplicationBuilderPromise implements PromiseLike { +class DistributedApplicationBuilderPromiseImpl implements DistributedApplicationBuilderPromise { constructor(private _promise: Promise) {} then( @@ -3589,107 +4426,107 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.build())); + return new DistributedApplicationPromiseImpl(this._promise.then(obj => obj.build())); } /** Adds a connection string with a reference expression */ addConnectionStringExpression(name: string, connectionStringExpression: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.addConnectionStringExpression(name, connectionStringExpression))); } /** Adds a connection string with a builder callback */ addConnectionStringBuilder(name: string, connectionStringBuilder: (obj: ReferenceExpressionBuilder) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.addConnectionStringBuilder(name, connectionStringBuilder))); } /** Adds a container registry resource */ addContainerRegistry(name: string, endpoint: ParameterResource, options?: AddContainerRegistryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.addContainerRegistry(name, endpoint, options))); } /** Adds a container registry with string endpoint */ addContainerRegistryFromString(name: string, endpoint: string, options?: AddContainerRegistryFromStringOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.addContainerRegistryFromString(name, endpoint, options))); } /** Adds a container resource */ addContainer(name: string, image: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addContainer(name, image))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.addContainer(name, image))); } /** Adds a container resource built from a Dockerfile */ addDockerfile(name: string, contextPath: string, options?: AddDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.addDockerfile(name, contextPath, options))); } /** Adds a .NET tool resource */ addDotnetTool(name: string, packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.addDotnetTool(name, packageId))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.addDotnetTool(name, packageId))); } /** Adds an executable resource */ addExecutable(name: string, command: string, workingDirectory: string, args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.addExecutable(name, command, workingDirectory, args))); } /** Adds an external service resource */ addExternalService(name: string, url: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalService(name, url))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.addExternalService(name, url))); } /** Adds an external service with a URI */ addExternalServiceUri(name: string, uri: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.addExternalServiceUri(name, uri))); } /** Adds an external service with a parameter URL */ addExternalServiceParameter(name: string, urlParameter: ParameterResource): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.addExternalServiceParameter(name, urlParameter))); } /** Adds a parameter resource */ addParameter(name: string, options?: AddParameterOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameter(name, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.addParameter(name, options))); } /** Adds a parameter with a default value */ addParameterWithValue(name: string, value: string, options?: AddParameterWithValueOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.addParameterWithValue(name, value, options))); } /** Adds a parameter sourced from configuration */ addParameterFromConfiguration(name: string, configurationKey: string, options?: AddParameterFromConfigurationOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.addParameterFromConfiguration(name, configurationKey, options))); } /** Adds a connection string resource */ addConnectionString(name: string, options?: AddConnectionStringOptions): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.addConnectionString(name, options))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.addConnectionString(name, options))); } /** Adds a .NET project resource */ addProject(name: string, projectPath: string, launchProfileName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.addProject(name, projectPath, launchProfileName))); } /** Adds a project resource with configuration options */ addProjectWithOptions(name: string, projectPath: string, configure: (obj: ProjectResourceOptions) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.addProjectWithOptions(name, projectPath, configure))); } /** Adds a C# application resource */ addCSharpApp(name: string, path: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.addCSharpApp(name, path))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.addCSharpApp(name, path))); } /** Adds a C# application resource with configuration options */ addCSharpAppWithOptions(name: string, path: string, configure: (obj: ProjectResourceOptions) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.addCSharpAppWithOptions(name, path, configure))); } /** Gets the application configuration */ getConfiguration(): ConfigurationPromise { - return new ConfigurationPromise(this._promise.then(obj => obj.getConfiguration())); + return new ConfigurationPromiseImpl(this._promise.then(obj => obj.getConfiguration())); } /** Subscribes to the BeforeStart event */ @@ -3704,12 +4541,12 @@ export class DistributedApplicationBuilderPromise implements PromiseLike obj.addTestRedis(name, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.addTestRedis(name, options))); } /** Adds a test vault resource */ addTestVault(name: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.addTestVault(name))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.addTestVault(name))); } } @@ -3718,10 +4555,23 @@ export class DistributedApplicationBuilderPromise implements PromiseLike { + unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise; +} + +// ============================================================================ +// DistributedApplicationEventingImpl +// ============================================================================ + /** * Type class for DistributedApplicationEventing. */ -export class DistributedApplicationEventing { +class DistributedApplicationEventingImpl implements DistributedApplicationEventing { constructor(private _handle: IDistributedApplicationEventingHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -3739,7 +4589,7 @@ export class DistributedApplicationEventing { } unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + return new DistributedApplicationEventingPromiseImpl(this._unsubscribeInternal(subscription)); } } @@ -3747,7 +4597,7 @@ export class DistributedApplicationEventing { /** * Thenable wrapper for DistributedApplicationEventing that enables fluent chaining. */ -export class DistributedApplicationEventingPromise implements PromiseLike { +class DistributedApplicationEventingPromiseImpl implements DistributedApplicationEventingPromise { constructor(private _promise: Promise) {} then( @@ -3759,7 +4609,7 @@ export class DistributedApplicationEventingPromise implements PromiseLike obj.unsubscribe(subscription))); + return new DistributedApplicationEventingPromiseImpl(this._promise.then(obj => obj.unsubscribe(subscription))); } } @@ -3768,10 +4618,29 @@ export class DistributedApplicationEventingPromise implements PromiseLike; + isProduction(): Promise; + isStaging(): Promise; + isEnvironment(environmentName: string): Promise; +} + +export interface HostEnvironmentPromise extends PromiseLike { + isDevelopment(): Promise; + isProduction(): Promise; + isStaging(): Promise; + isEnvironment(environmentName: string): Promise; +} + +// ============================================================================ +// HostEnvironmentImpl +// ============================================================================ + /** * Type class for HostEnvironment. */ -export class HostEnvironment { +class HostEnvironmentImpl implements HostEnvironment { constructor(private _handle: IHostEnvironmentHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -3818,7 +4687,7 @@ export class HostEnvironment { /** * Thenable wrapper for HostEnvironment that enables fluent chaining. */ -export class HostEnvironmentPromise implements PromiseLike { +class HostEnvironmentPromiseImpl implements HostEnvironmentPromise { constructor(private _promise: Promise) {} then( @@ -3854,10 +4723,31 @@ export class HostEnvironmentPromise implements PromiseLike { // Logger // ============================================================================ +export interface Logger { + toJSON(): MarshalledHandle; + logInformation(message: string): LoggerPromise; + logWarning(message: string): LoggerPromise; + logError(message: string): LoggerPromise; + logDebug(message: string): LoggerPromise; + log(level: string, message: string): LoggerPromise; +} + +export interface LoggerPromise extends PromiseLike { + logInformation(message: string): LoggerPromise; + logWarning(message: string): LoggerPromise; + logError(message: string): LoggerPromise; + logDebug(message: string): LoggerPromise; + log(level: string, message: string): LoggerPromise; +} + +// ============================================================================ +// LoggerImpl +// ============================================================================ + /** * Type class for Logger. */ -export class Logger { +class LoggerImpl implements Logger { constructor(private _handle: ILoggerHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -3875,7 +4765,7 @@ export class Logger { } logInformation(message: string): LoggerPromise { - return new LoggerPromise(this._logInformationInternal(message)); + return new LoggerPromiseImpl(this._logInformationInternal(message)); } /** Logs a warning message */ @@ -3890,7 +4780,7 @@ export class Logger { } logWarning(message: string): LoggerPromise { - return new LoggerPromise(this._logWarningInternal(message)); + return new LoggerPromiseImpl(this._logWarningInternal(message)); } /** Logs an error message */ @@ -3905,7 +4795,7 @@ export class Logger { } logError(message: string): LoggerPromise { - return new LoggerPromise(this._logErrorInternal(message)); + return new LoggerPromiseImpl(this._logErrorInternal(message)); } /** Logs a debug message */ @@ -3920,7 +4810,7 @@ export class Logger { } logDebug(message: string): LoggerPromise { - return new LoggerPromise(this._logDebugInternal(message)); + return new LoggerPromiseImpl(this._logDebugInternal(message)); } /** Logs a message with specified level */ @@ -3935,7 +4825,7 @@ export class Logger { } log(level: string, message: string): LoggerPromise { - return new LoggerPromise(this._logInternal(level, message)); + return new LoggerPromiseImpl(this._logInternal(level, message)); } } @@ -3943,7 +4833,7 @@ export class Logger { /** * Thenable wrapper for Logger that enables fluent chaining. */ -export class LoggerPromise implements PromiseLike { +class LoggerPromiseImpl implements LoggerPromise { constructor(private _promise: Promise) {} then( @@ -3955,27 +4845,27 @@ export class LoggerPromise implements PromiseLike { /** Logs an information message */ logInformation(message: string): LoggerPromise { - return new LoggerPromise(this._promise.then(obj => obj.logInformation(message))); + return new LoggerPromiseImpl(this._promise.then(obj => obj.logInformation(message))); } /** Logs a warning message */ logWarning(message: string): LoggerPromise { - return new LoggerPromise(this._promise.then(obj => obj.logWarning(message))); + return new LoggerPromiseImpl(this._promise.then(obj => obj.logWarning(message))); } /** Logs an error message */ logError(message: string): LoggerPromise { - return new LoggerPromise(this._promise.then(obj => obj.logError(message))); + return new LoggerPromiseImpl(this._promise.then(obj => obj.logError(message))); } /** Logs a debug message */ logDebug(message: string): LoggerPromise { - return new LoggerPromise(this._promise.then(obj => obj.logDebug(message))); + return new LoggerPromiseImpl(this._promise.then(obj => obj.logDebug(message))); } /** Logs a message with specified level */ log(level: string, message: string): LoggerPromise { - return new LoggerPromise(this._promise.then(obj => obj.log(level, message))); + return new LoggerPromiseImpl(this._promise.then(obj => obj.log(level, message))); } } @@ -3984,10 +4874,23 @@ export class LoggerPromise implements PromiseLike { // LoggerFactory // ============================================================================ +export interface LoggerFactory { + toJSON(): MarshalledHandle; + createLogger(categoryName: string): LoggerPromise; +} + +export interface LoggerFactoryPromise extends PromiseLike { + createLogger(categoryName: string): LoggerPromise; +} + +// ============================================================================ +// LoggerFactoryImpl +// ============================================================================ + /** * Type class for LoggerFactory. */ -export class LoggerFactory { +class LoggerFactoryImpl implements LoggerFactory { constructor(private _handle: ILoggerFactoryHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -4001,11 +4904,11 @@ export class LoggerFactory { 'Aspire.Hosting/createLogger', rpcArgs ); - return new Logger(result, this._client); + return new LoggerImpl(result, this._client); } createLogger(categoryName: string): LoggerPromise { - return new LoggerPromise(this._createLoggerInternal(categoryName)); + return new LoggerPromiseImpl(this._createLoggerInternal(categoryName)); } } @@ -4013,7 +4916,7 @@ export class LoggerFactory { /** * Thenable wrapper for LoggerFactory that enables fluent chaining. */ -export class LoggerFactoryPromise implements PromiseLike { +class LoggerFactoryPromiseImpl implements LoggerFactoryPromise { constructor(private _promise: Promise) {} then( @@ -4025,7 +4928,7 @@ export class LoggerFactoryPromise implements PromiseLike { /** Creates a logger for a category */ createLogger(categoryName: string): LoggerPromise { - return new LoggerPromise(this._promise.then(obj => obj.createLogger(categoryName))); + return new LoggerPromiseImpl(this._promise.then(obj => obj.createLogger(categoryName))); } } @@ -4034,10 +4937,33 @@ export class LoggerFactoryPromise implements PromiseLike { // ReportingStep // ============================================================================ +export interface ReportingStep { + toJSON(): MarshalledHandle; + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise; + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise; + logStep(level: string, message: string): ReportingStepPromise; + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise; + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise; + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise; +} + +export interface ReportingStepPromise extends PromiseLike { + createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise; + createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise; + logStep(level: string, message: string): ReportingStepPromise; + logStepMarkdown(level: string, markdownString: string): ReportingStepPromise; + completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise; + completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise; +} + +// ============================================================================ +// ReportingStepImpl +// ============================================================================ + /** * Type class for ReportingStep. */ -export class ReportingStep { +class ReportingStepImpl implements ReportingStep { constructor(private _handle: IReportingStepHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -4052,12 +4978,12 @@ export class ReportingStep { 'Aspire.Hosting/createTask', rpcArgs ); - return new ReportingTask(result, this._client); + return new ReportingTaskImpl(result, this._client); } createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { const cancellationToken = options?.cancellationToken; - return new ReportingTaskPromise(this._createTaskInternal(statusText, cancellationToken)); + return new ReportingTaskPromiseImpl(this._createTaskInternal(statusText, cancellationToken)); } /** Creates a reporting task with Markdown-formatted status text */ @@ -4069,12 +4995,12 @@ export class ReportingStep { 'Aspire.Hosting/createMarkdownTask', rpcArgs ); - return new ReportingTask(result, this._client); + return new ReportingTaskImpl(result, this._client); } createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { const cancellationToken = options?.cancellationToken; - return new ReportingTaskPromise(this._createMarkdownTaskInternal(markdownString, cancellationToken)); + return new ReportingTaskPromiseImpl(this._createMarkdownTaskInternal(markdownString, cancellationToken)); } /** Logs a plain-text message for the reporting step */ @@ -4089,7 +5015,7 @@ export class ReportingStep { } logStep(level: string, message: string): ReportingStepPromise { - return new ReportingStepPromise(this._logStepInternal(level, message)); + return new ReportingStepPromiseImpl(this._logStepInternal(level, message)); } /** Logs a Markdown-formatted message for the reporting step */ @@ -4104,7 +5030,7 @@ export class ReportingStep { } logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { - return new ReportingStepPromise(this._logStepMarkdownInternal(level, markdownString)); + return new ReportingStepPromiseImpl(this._logStepMarkdownInternal(level, markdownString)); } /** Completes the reporting step with plain-text completion text */ @@ -4123,7 +5049,7 @@ export class ReportingStep { completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { const completionState = options?.completionState; const cancellationToken = options?.cancellationToken; - return new ReportingStepPromise(this._completeStepInternal(completionText, completionState, cancellationToken)); + return new ReportingStepPromiseImpl(this._completeStepInternal(completionText, completionState, cancellationToken)); } /** Completes the reporting step with Markdown-formatted completion text */ @@ -4142,7 +5068,7 @@ export class ReportingStep { completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { const completionState = options?.completionState; const cancellationToken = options?.cancellationToken; - return new ReportingStepPromise(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); + return new ReportingStepPromiseImpl(this._completeStepMarkdownInternal(markdownString, completionState, cancellationToken)); } } @@ -4150,7 +5076,7 @@ export class ReportingStep { /** * Thenable wrapper for ReportingStep that enables fluent chaining. */ -export class ReportingStepPromise implements PromiseLike { +class ReportingStepPromiseImpl implements ReportingStepPromise { constructor(private _promise: Promise) {} then( @@ -4162,32 +5088,32 @@ export class ReportingStepPromise implements PromiseLike { /** Creates a reporting task with plain-text status text */ createTask(statusText: string, options?: CreateTaskOptions): ReportingTaskPromise { - return new ReportingTaskPromise(this._promise.then(obj => obj.createTask(statusText, options))); + return new ReportingTaskPromiseImpl(this._promise.then(obj => obj.createTask(statusText, options))); } /** Creates a reporting task with Markdown-formatted status text */ createMarkdownTask(markdownString: string, options?: CreateMarkdownTaskOptions): ReportingTaskPromise { - return new ReportingTaskPromise(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); + return new ReportingTaskPromiseImpl(this._promise.then(obj => obj.createMarkdownTask(markdownString, options))); } /** Logs a plain-text message for the reporting step */ logStep(level: string, message: string): ReportingStepPromise { - return new ReportingStepPromise(this._promise.then(obj => obj.logStep(level, message))); + return new ReportingStepPromiseImpl(this._promise.then(obj => obj.logStep(level, message))); } /** Logs a Markdown-formatted message for the reporting step */ logStepMarkdown(level: string, markdownString: string): ReportingStepPromise { - return new ReportingStepPromise(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); + return new ReportingStepPromiseImpl(this._promise.then(obj => obj.logStepMarkdown(level, markdownString))); } /** Completes the reporting step with plain-text completion text */ completeStep(completionText: string, options?: CompleteStepOptions): ReportingStepPromise { - return new ReportingStepPromise(this._promise.then(obj => obj.completeStep(completionText, options))); + return new ReportingStepPromiseImpl(this._promise.then(obj => obj.completeStep(completionText, options))); } /** Completes the reporting step with Markdown-formatted completion text */ completeStepMarkdown(markdownString: string, options?: CompleteStepMarkdownOptions): ReportingStepPromise { - return new ReportingStepPromise(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); + return new ReportingStepPromiseImpl(this._promise.then(obj => obj.completeStepMarkdown(markdownString, options))); } } @@ -4196,10 +5122,29 @@ export class ReportingStepPromise implements PromiseLike { // ReportingTask // ============================================================================ +export interface ReportingTask { + toJSON(): MarshalledHandle; + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise; + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise; + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise; + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise; +} + +export interface ReportingTaskPromise extends PromiseLike { + updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise; + updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise; + completeTask(options?: CompleteTaskOptions): ReportingTaskPromise; + completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise; +} + +// ============================================================================ +// ReportingTaskImpl +// ============================================================================ + /** * Type class for ReportingTask. */ -export class ReportingTask { +class ReportingTaskImpl implements ReportingTask { constructor(private _handle: IReportingTaskHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -4219,7 +5164,7 @@ export class ReportingTask { updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { const cancellationToken = options?.cancellationToken; - return new ReportingTaskPromise(this._updateTaskInternal(statusText, cancellationToken)); + return new ReportingTaskPromiseImpl(this._updateTaskInternal(statusText, cancellationToken)); } /** Updates the reporting task with Markdown-formatted status text */ @@ -4236,7 +5181,7 @@ export class ReportingTask { updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { const cancellationToken = options?.cancellationToken; - return new ReportingTaskPromise(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); + return new ReportingTaskPromiseImpl(this._updateTaskMarkdownInternal(markdownString, cancellationToken)); } /** Completes the reporting task with plain-text completion text */ @@ -4257,7 +5202,7 @@ export class ReportingTask { const completionMessage = options?.completionMessage; const completionState = options?.completionState; const cancellationToken = options?.cancellationToken; - return new ReportingTaskPromise(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); + return new ReportingTaskPromiseImpl(this._completeTaskInternal(completionMessage, completionState, cancellationToken)); } /** Completes the reporting task with Markdown-formatted completion text */ @@ -4276,7 +5221,7 @@ export class ReportingTask { completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { const completionState = options?.completionState; const cancellationToken = options?.cancellationToken; - return new ReportingTaskPromise(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); + return new ReportingTaskPromiseImpl(this._completeTaskMarkdownInternal(markdownString, completionState, cancellationToken)); } } @@ -4284,7 +5229,7 @@ export class ReportingTask { /** * Thenable wrapper for ReportingTask that enables fluent chaining. */ -export class ReportingTaskPromise implements PromiseLike { +class ReportingTaskPromiseImpl implements ReportingTaskPromise { constructor(private _promise: Promise) {} then( @@ -4296,22 +5241,22 @@ export class ReportingTaskPromise implements PromiseLike { /** Updates the reporting task with plain-text status text */ updateTask(statusText: string, options?: UpdateTaskOptions): ReportingTaskPromise { - return new ReportingTaskPromise(this._promise.then(obj => obj.updateTask(statusText, options))); + return new ReportingTaskPromiseImpl(this._promise.then(obj => obj.updateTask(statusText, options))); } /** Updates the reporting task with Markdown-formatted status text */ updateTaskMarkdown(markdownString: string, options?: UpdateTaskMarkdownOptions): ReportingTaskPromise { - return new ReportingTaskPromise(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); + return new ReportingTaskPromiseImpl(this._promise.then(obj => obj.updateTaskMarkdown(markdownString, options))); } /** Completes the reporting task with plain-text completion text */ completeTask(options?: CompleteTaskOptions): ReportingTaskPromise { - return new ReportingTaskPromise(this._promise.then(obj => obj.completeTask(options))); + return new ReportingTaskPromiseImpl(this._promise.then(obj => obj.completeTask(options))); } /** Completes the reporting task with Markdown-formatted completion text */ completeTaskMarkdown(markdownString: string, options?: CompleteTaskMarkdownOptions): ReportingTaskPromise { - return new ReportingTaskPromise(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); + return new ReportingTaskPromiseImpl(this._promise.then(obj => obj.completeTaskMarkdown(markdownString, options))); } } @@ -4320,10 +5265,33 @@ export class ReportingTaskPromise implements PromiseLike { // ServiceProvider // ============================================================================ +export interface ServiceProvider { + toJSON(): MarshalledHandle; + getEventing(): DistributedApplicationEventingPromise; + getLoggerFactory(): LoggerFactoryPromise; + getResourceLoggerService(): ResourceLoggerServicePromise; + getDistributedApplicationModel(): DistributedApplicationModelPromise; + getResourceNotificationService(): ResourceNotificationServicePromise; + getUserSecretsManager(): UserSecretsManagerPromise; +} + +export interface ServiceProviderPromise extends PromiseLike { + getEventing(): DistributedApplicationEventingPromise; + getLoggerFactory(): LoggerFactoryPromise; + getResourceLoggerService(): ResourceLoggerServicePromise; + getDistributedApplicationModel(): DistributedApplicationModelPromise; + getResourceNotificationService(): ResourceNotificationServicePromise; + getUserSecretsManager(): UserSecretsManagerPromise; +} + +// ============================================================================ +// ServiceProviderImpl +// ============================================================================ + /** * Type class for ServiceProvider. */ -export class ServiceProvider { +class ServiceProviderImpl implements ServiceProvider { constructor(private _handle: IServiceProviderHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -4337,11 +5305,11 @@ export class ServiceProvider { 'Aspire.Hosting/getEventing', rpcArgs ); - return new DistributedApplicationEventing(result, this._client); + return new DistributedApplicationEventingImpl(result, this._client); } getEventing(): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._getEventingInternal()); + return new DistributedApplicationEventingPromiseImpl(this._getEventingInternal()); } /** Gets the logger factory from the service provider */ @@ -4352,11 +5320,11 @@ export class ServiceProvider { 'Aspire.Hosting/getLoggerFactory', rpcArgs ); - return new LoggerFactory(result, this._client); + return new LoggerFactoryImpl(result, this._client); } getLoggerFactory(): LoggerFactoryPromise { - return new LoggerFactoryPromise(this._getLoggerFactoryInternal()); + return new LoggerFactoryPromiseImpl(this._getLoggerFactoryInternal()); } /** Gets the resource logger service from the service provider */ @@ -4367,11 +5335,11 @@ export class ServiceProvider { 'Aspire.Hosting/getResourceLoggerService', rpcArgs ); - return new ResourceLoggerService(result, this._client); + return new ResourceLoggerServiceImpl(result, this._client); } getResourceLoggerService(): ResourceLoggerServicePromise { - return new ResourceLoggerServicePromise(this._getResourceLoggerServiceInternal()); + return new ResourceLoggerServicePromiseImpl(this._getResourceLoggerServiceInternal()); } /** Gets the distributed application model from the service provider */ @@ -4382,11 +5350,11 @@ export class ServiceProvider { 'Aspire.Hosting/getDistributedApplicationModel', rpcArgs ); - return new DistributedApplicationModel(result, this._client); + return new DistributedApplicationModelImpl(result, this._client); } getDistributedApplicationModel(): DistributedApplicationModelPromise { - return new DistributedApplicationModelPromise(this._getDistributedApplicationModelInternal()); + return new DistributedApplicationModelPromiseImpl(this._getDistributedApplicationModelInternal()); } /** Gets the resource notification service from the service provider */ @@ -4397,11 +5365,11 @@ export class ServiceProvider { 'Aspire.Hosting/getResourceNotificationService', rpcArgs ); - return new ResourceNotificationService(result, this._client); + return new ResourceNotificationServiceImpl(result, this._client); } getResourceNotificationService(): ResourceNotificationServicePromise { - return new ResourceNotificationServicePromise(this._getResourceNotificationServiceInternal()); + return new ResourceNotificationServicePromiseImpl(this._getResourceNotificationServiceInternal()); } /** Gets the user secrets manager from the service provider */ @@ -4412,11 +5380,11 @@ export class ServiceProvider { 'Aspire.Hosting/getUserSecretsManager', rpcArgs ); - return new UserSecretsManager(result, this._client); + return new UserSecretsManagerImpl(result, this._client); } getUserSecretsManager(): UserSecretsManagerPromise { - return new UserSecretsManagerPromise(this._getUserSecretsManagerInternal()); + return new UserSecretsManagerPromiseImpl(this._getUserSecretsManagerInternal()); } } @@ -4424,7 +5392,7 @@ export class ServiceProvider { /** * Thenable wrapper for ServiceProvider that enables fluent chaining. */ -export class ServiceProviderPromise implements PromiseLike { +class ServiceProviderPromiseImpl implements ServiceProviderPromise { constructor(private _promise: Promise) {} then( @@ -4436,32 +5404,32 @@ export class ServiceProviderPromise implements PromiseLike { /** Gets the distributed application eventing service from the service provider */ getEventing(): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._promise.then(obj => obj.getEventing())); + return new DistributedApplicationEventingPromiseImpl(this._promise.then(obj => obj.getEventing())); } /** Gets the logger factory from the service provider */ getLoggerFactory(): LoggerFactoryPromise { - return new LoggerFactoryPromise(this._promise.then(obj => obj.getLoggerFactory())); + return new LoggerFactoryPromiseImpl(this._promise.then(obj => obj.getLoggerFactory())); } /** Gets the resource logger service from the service provider */ getResourceLoggerService(): ResourceLoggerServicePromise { - return new ResourceLoggerServicePromise(this._promise.then(obj => obj.getResourceLoggerService())); + return new ResourceLoggerServicePromiseImpl(this._promise.then(obj => obj.getResourceLoggerService())); } /** Gets the distributed application model from the service provider */ getDistributedApplicationModel(): DistributedApplicationModelPromise { - return new DistributedApplicationModelPromise(this._promise.then(obj => obj.getDistributedApplicationModel())); + return new DistributedApplicationModelPromiseImpl(this._promise.then(obj => obj.getDistributedApplicationModel())); } /** Gets the resource notification service from the service provider */ getResourceNotificationService(): ResourceNotificationServicePromise { - return new ResourceNotificationServicePromise(this._promise.then(obj => obj.getResourceNotificationService())); + return new ResourceNotificationServicePromiseImpl(this._promise.then(obj => obj.getResourceNotificationService())); } /** Gets the user secrets manager from the service provider */ getUserSecretsManager(): UserSecretsManagerPromise { - return new UserSecretsManagerPromise(this._promise.then(obj => obj.getUserSecretsManager())); + return new UserSecretsManagerPromiseImpl(this._promise.then(obj => obj.getUserSecretsManager())); } } @@ -4470,10 +5438,33 @@ export class ServiceProviderPromise implements PromiseLike { // UserSecretsManager // ============================================================================ +export interface UserSecretsManager { + toJSON(): MarshalledHandle; + isAvailable: { + get: () => Promise; + }; + filePath: { + get: () => Promise; + }; + trySetSecret(name: string, value: string): Promise; + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise; + getOrSetSecret(resourceBuilder: HandleReference, name: string, value: string): UserSecretsManagerPromise; +} + +export interface UserSecretsManagerPromise extends PromiseLike { + trySetSecret(name: string, value: string): Promise; + saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise; + getOrSetSecret(resourceBuilder: HandleReference, name: string, value: string): UserSecretsManagerPromise; +} + +// ============================================================================ +// UserSecretsManagerImpl +// ============================================================================ + /** * Type class for UserSecretsManager. */ -export class UserSecretsManager { +class UserSecretsManagerImpl implements UserSecretsManager { constructor(private _handle: IUserSecretsManagerHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -4522,12 +5513,12 @@ export class UserSecretsManager { saveStateJson(json: string, options?: SaveStateJsonOptions): UserSecretsManagerPromise { const cancellationToken = options?.cancellationToken; - return new UserSecretsManagerPromise(this._saveStateJsonInternal(json, cancellationToken)); + return new UserSecretsManagerPromiseImpl(this._saveStateJsonInternal(json, cancellationToken)); } /** Gets a secret value if it exists, or sets it to the provided value if it does not */ /** @internal */ - async _getOrSetSecretInternal(resourceBuilder: ResourceBuilderBase, name: string, value: string): Promise { + async _getOrSetSecretInternal(resourceBuilder: HandleReference, name: string, value: string): Promise { const rpcArgs: Record = { userSecretsManager: this._handle, resourceBuilder, name, value }; await this._client.invokeCapability( 'Aspire.Hosting/getOrSetSecret', @@ -4536,8 +5527,8 @@ export class UserSecretsManager { return this; } - getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { - return new UserSecretsManagerPromise(this._getOrSetSecretInternal(resourceBuilder, name, value)); + getOrSetSecret(resourceBuilder: HandleReference, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromiseImpl(this._getOrSetSecretInternal(resourceBuilder, name, value)); } } @@ -4545,7 +5536,7 @@ export class UserSecretsManager { /** * Thenable wrapper for UserSecretsManager that enables fluent chaining. */ -export class UserSecretsManagerPromise implements PromiseLike { +class UserSecretsManagerPromiseImpl implements UserSecretsManagerPromise { constructor(private _promise: Promise) {} then( @@ -4562,12 +5553,12 @@ export class UserSecretsManagerPromise implements PromiseLike obj.saveStateJson(json, options))); + return new UserSecretsManagerPromiseImpl(this._promise.then(obj => obj.saveStateJson(json, options))); } /** Gets a secret value if it exists, or sets it to the provided value if it does not */ - getOrSetSecret(resourceBuilder: ResourceBuilderBase, name: string, value: string): UserSecretsManagerPromise { - return new UserSecretsManagerPromise(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); + getOrSetSecret(resourceBuilder: HandleReference, name: string, value: string): UserSecretsManagerPromise { + return new UserSecretsManagerPromiseImpl(this._promise.then(obj => obj.getOrSetSecret(resourceBuilder, name, value))); } } @@ -4576,24 +5567,141 @@ export class UserSecretsManagerPromise implements PromiseLike { +export interface ConnectionStringResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ConnectionStringResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise; + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise; + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise; + excludeFromManifest(): ConnectionStringResourcePromise; + waitFor(dependency: HandleReference): ConnectionStringResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise; + waitForStart(dependency: HandleReference): ConnectionStringResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise; + withExplicitStart(): ConnectionStringResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ConnectionStringResourcePromise; + withHealthCheck(key: string): ConnectionStringResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise; + withParentRelationship(parent: HandleReference): ConnectionStringResourcePromise; + withChildRelationship(child: HandleReference): ConnectionStringResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise; + excludeFromMcp(): ConnectionStringResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise; + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ConnectionStringResourcePromise; + withConfig(config: TestConfigDto): ConnectionStringResourcePromise; + withConnectionString(connectionString: ReferenceExpression): ConnectionStringResourcePromise; + withCreatedAt(createdAt: string): ConnectionStringResourcePromise; + withModifiedAt(modifiedAt: string): ConnectionStringResourcePromise; + withCorrelationId(correlationId: string): ConnectionStringResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ConnectionStringResourcePromise; + withStatus(status: TestResourceStatus): ConnectionStringResourcePromise; + withNestedConfig(config: TestNestedDto): ConnectionStringResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ConnectionStringResourcePromise; + testWaitFor(dependency: HandleReference): ConnectionStringResourcePromise; + withConnectionStringDirect(connectionString: string): ConnectionStringResourcePromise; + withDependency(dependency: HandleReference): ConnectionStringResourcePromise; + withEndpoints(endpoints: string[]): ConnectionStringResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ConnectionStringResourcePromise; + withMergeLabel(label: string): ConnectionStringResourcePromise; + withMergeLabelCategorized(label: string, category: string): ConnectionStringResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ConnectionStringResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ConnectionStringResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ConnectionStringResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ConnectionStringResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ConnectionStringResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ConnectionStringResourcePromise; +} + +export interface ConnectionStringResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ConnectionStringResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise; + withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise; + withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise; + excludeFromManifest(): ConnectionStringResourcePromise; + waitFor(dependency: HandleReference): ConnectionStringResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise; + waitForStart(dependency: HandleReference): ConnectionStringResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise; + withExplicitStart(): ConnectionStringResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ConnectionStringResourcePromise; + withHealthCheck(key: string): ConnectionStringResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise; + withParentRelationship(parent: HandleReference): ConnectionStringResourcePromise; + withChildRelationship(child: HandleReference): ConnectionStringResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise; + excludeFromMcp(): ConnectionStringResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ConnectionStringResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise; + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ConnectionStringResourcePromise; + withConfig(config: TestConfigDto): ConnectionStringResourcePromise; + withConnectionString(connectionString: ReferenceExpression): ConnectionStringResourcePromise; + withCreatedAt(createdAt: string): ConnectionStringResourcePromise; + withModifiedAt(modifiedAt: string): ConnectionStringResourcePromise; + withCorrelationId(correlationId: string): ConnectionStringResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ConnectionStringResourcePromise; + withStatus(status: TestResourceStatus): ConnectionStringResourcePromise; + withNestedConfig(config: TestNestedDto): ConnectionStringResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ConnectionStringResourcePromise; + testWaitFor(dependency: HandleReference): ConnectionStringResourcePromise; + withConnectionStringDirect(connectionString: string): ConnectionStringResourcePromise; + withDependency(dependency: HandleReference): ConnectionStringResourcePromise; + withEndpoints(endpoints: string[]): ConnectionStringResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ConnectionStringResourcePromise; + withMergeLabel(label: string): ConnectionStringResourcePromise; + withMergeLabelCategorized(label: string, category: string): ConnectionStringResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ConnectionStringResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ConnectionStringResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ConnectionStringResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ConnectionStringResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ConnectionStringResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ConnectionStringResourcePromise; +} + +// ============================================================================ +// ConnectionStringResourceImpl +// ============================================================================ + +class ConnectionStringResourceImpl extends ResourceBuilderBase implements ConnectionStringResource { constructor(handle: ConnectionStringResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -4605,14 +5713,14 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -4674,12 +5782,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -4690,13 +5798,13 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ConnectionStringResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -4742,72 +5850,72 @@ export class ConnectionStringResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -4817,29 +5925,29 @@ export class ConnectionStringResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { const exitCode = options?.exitCode; - return new ConnectionStringResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ConnectionStringResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -4849,19 +5957,19 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -4870,43 +5978,43 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { const commandOptions = options?.commandOptions; - return new ConnectionStringResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ConnectionStringResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -4917,13 +6025,13 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -4957,7 +6065,7 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -4981,12 +6089,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -5002,7 +6110,7 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -5010,19 +6118,19 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -5030,19 +6138,19 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._onResourceStoppedInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; - const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + const arg = new ConnectionStringAvailableEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -5050,19 +6158,19 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._onConnectionStringAvailableInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -5070,19 +6178,19 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._onInitializeResourceInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -5090,12 +6198,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -5107,14 +6215,14 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -5205,13 +6313,13 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -5256,27 +6364,27 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withValidatorInternal(validator)); + return new ConnectionStringResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ @@ -5286,27 +6394,27 @@ export class ConnectionStringResource extends ResourceBuilderBase { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ConnectionStringResource(result, this._client); + return new ConnectionStringResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -5316,12 +6424,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withCancellableOperationInternal(operation)); + return new ConnectionStringResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -5350,12 +6458,12 @@ export class ConnectionStringResource extends ResourceBuilderBase { +class ConnectionStringResourcePromiseImpl implements ConnectionStringResourcePromise { constructor(private _promise: Promise) {} then( @@ -5489,123 +6597,123 @@ export class ConnectionStringResourcePromise implements PromiseLike obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Adds a connection property with a reference expression */ withConnectionProperty(name: string, value: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withConnectionProperty(name, value))); } /** Adds a connection property with a string value */ withConnectionPropertyValue(name: string, value: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -5615,142 +6723,142 @@ export class ConnectionStringResourcePromise implements PromiseLike Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the ConnectionStringAvailable event */ onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Sets the connection string using a reference expression */ withConnectionString(connectionString: ReferenceExpression): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionString(connectionString))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withConnectionString(connectionString))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Sets connection string using direct interface target */ withConnectionStringDirect(connectionString: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ConnectionStringResourcePromise { + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ConnectionStringResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -5759,24 +6867,121 @@ export class ConnectionStringResourcePromise implements PromiseLike { +export interface ContainerRegistryResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ContainerRegistryResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise; + excludeFromManifest(): ContainerRegistryResourcePromise; + withExplicitStart(): ContainerRegistryResourcePromise; + withHealthCheck(key: string): ContainerRegistryResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise; + withParentRelationship(parent: HandleReference): ContainerRegistryResourcePromise; + withChildRelationship(child: HandleReference): ContainerRegistryResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise; + excludeFromMcp(): ContainerRegistryResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ContainerRegistryResourcePromise; + withConfig(config: TestConfigDto): ContainerRegistryResourcePromise; + withCreatedAt(createdAt: string): ContainerRegistryResourcePromise; + withModifiedAt(modifiedAt: string): ContainerRegistryResourcePromise; + withCorrelationId(correlationId: string): ContainerRegistryResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ContainerRegistryResourcePromise; + withStatus(status: TestResourceStatus): ContainerRegistryResourcePromise; + withNestedConfig(config: TestNestedDto): ContainerRegistryResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ContainerRegistryResourcePromise; + testWaitFor(dependency: HandleReference): ContainerRegistryResourcePromise; + withDependency(dependency: HandleReference): ContainerRegistryResourcePromise; + withEndpoints(endpoints: string[]): ContainerRegistryResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ContainerRegistryResourcePromise; + withMergeLabel(label: string): ContainerRegistryResourcePromise; + withMergeLabelCategorized(label: string, category: string): ContainerRegistryResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ContainerRegistryResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ContainerRegistryResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ContainerRegistryResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ContainerRegistryResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ContainerRegistryResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ContainerRegistryResourcePromise; +} + +export interface ContainerRegistryResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ContainerRegistryResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise; + excludeFromManifest(): ContainerRegistryResourcePromise; + withExplicitStart(): ContainerRegistryResourcePromise; + withHealthCheck(key: string): ContainerRegistryResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise; + withParentRelationship(parent: HandleReference): ContainerRegistryResourcePromise; + withChildRelationship(child: HandleReference): ContainerRegistryResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise; + excludeFromMcp(): ContainerRegistryResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerRegistryResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ContainerRegistryResourcePromise; + withConfig(config: TestConfigDto): ContainerRegistryResourcePromise; + withCreatedAt(createdAt: string): ContainerRegistryResourcePromise; + withModifiedAt(modifiedAt: string): ContainerRegistryResourcePromise; + withCorrelationId(correlationId: string): ContainerRegistryResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ContainerRegistryResourcePromise; + withStatus(status: TestResourceStatus): ContainerRegistryResourcePromise; + withNestedConfig(config: TestNestedDto): ContainerRegistryResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ContainerRegistryResourcePromise; + testWaitFor(dependency: HandleReference): ContainerRegistryResourcePromise; + withDependency(dependency: HandleReference): ContainerRegistryResourcePromise; + withEndpoints(endpoints: string[]): ContainerRegistryResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ContainerRegistryResourcePromise; + withMergeLabel(label: string): ContainerRegistryResourcePromise; + withMergeLabelCategorized(label: string, category: string): ContainerRegistryResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ContainerRegistryResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ContainerRegistryResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ContainerRegistryResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ContainerRegistryResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ContainerRegistryResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ContainerRegistryResourcePromise; +} + +// ============================================================================ +// ContainerRegistryResourceImpl +// ============================================================================ + +class ContainerRegistryResourceImpl extends ResourceBuilderBase implements ContainerRegistryResource { constructor(handle: ContainerRegistryResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -5788,14 +6993,14 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -5827,12 +7032,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -5843,13 +7048,13 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ContainerRegistryResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -5895,12 +7100,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -5946,43 +7151,43 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { const commandOptions = options?.commandOptions; - return new ContainerRegistryResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerRegistryResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -5993,13 +7198,13 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -6033,7 +7238,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -6057,12 +7262,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -6078,7 +7283,7 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -6086,19 +7291,19 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -6106,19 +7311,19 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._onResourceStoppedInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -6126,19 +7331,19 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._onInitializeResourceInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -6146,12 +7351,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -6163,14 +7368,14 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -6246,13 +7451,13 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -6297,42 +7502,42 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withValidatorInternal(validator)); + return new ContainerRegistryResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ContainerRegistryResource(result, this._client); + return new ContainerRegistryResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -6342,12 +7547,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withCancellableOperationInternal(operation)); + return new ContainerRegistryResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -6376,12 +7581,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase { +class ContainerRegistryResourcePromiseImpl implements ContainerRegistryResourcePromise { constructor(private _promise: Promise) {} then( @@ -6515,88 +7720,88 @@ export class ContainerRegistryResourcePromise implements PromiseLike obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ withExplicitStart(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ withHealthCheck(key: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -6606,127 +7811,127 @@ export class ContainerRegistryResourcePromise implements PromiseLike Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ContainerRegistryResourcePromise { + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ContainerRegistryResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -6735,24 +7940,233 @@ export class ContainerRegistryResourcePromise implements PromiseLike { +export interface ContainerResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ContainerResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise; + withEntrypoint(entrypoint: string): ContainerResourcePromise; + withImageTag(tag: string): ContainerResourcePromise; + withImageRegistry(registry: string): ContainerResourcePromise; + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise; + withImageSHA256(sha256: string): ContainerResourcePromise; + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise; + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise; + publishAsContainer(): ContainerResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise; + withContainerName(name: string): ContainerResourcePromise; + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise; + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise; + withContainerNetworkAlias(alias: string): ContainerResourcePromise; + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise; + withOtlpExporter(): ContainerResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise; + publishAsConnectionString(): ContainerResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise; + withEnvironment(name: string, value: string): ContainerResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ContainerResourcePromise; + withArgs(args: string[]): ContainerResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ContainerResourcePromise; + withReferenceUri(name: string, uri: string): ContainerResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise; + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise; + withExternalHttpEndpoints(): ContainerResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ContainerResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise; + excludeFromManifest(): ContainerResourcePromise; + waitFor(dependency: HandleReference): ContainerResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise; + waitForStart(dependency: HandleReference): ContainerResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise; + withExplicitStart(): ContainerResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ContainerResourcePromise; + withHealthCheck(key: string): ContainerResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise; + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise; + withoutHttpsCertificate(): ContainerResourcePromise; + withParentRelationship(parent: HandleReference): ContainerResourcePromise; + withChildRelationship(child: HandleReference): ContainerResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise; + excludeFromMcp(): ContainerResourcePromise; + withRemoteImageName(remoteImageName: string): ContainerResourcePromise; + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ContainerResourcePromise; + withConfig(config: TestConfigDto): ContainerResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ContainerResourcePromise; + withCreatedAt(createdAt: string): ContainerResourcePromise; + withModifiedAt(modifiedAt: string): ContainerResourcePromise; + withCorrelationId(correlationId: string): ContainerResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ContainerResourcePromise; + withStatus(status: TestResourceStatus): ContainerResourcePromise; + withNestedConfig(config: TestNestedDto): ContainerResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ContainerResourcePromise; + testWaitFor(dependency: HandleReference): ContainerResourcePromise; + withDependency(dependency: HandleReference): ContainerResourcePromise; + withEndpoints(endpoints: string[]): ContainerResourcePromise; + withEnvironmentVariables(variables: Record): ContainerResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ContainerResourcePromise; + withMergeLabel(label: string): ContainerResourcePromise; + withMergeLabelCategorized(label: string, category: string): ContainerResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ContainerResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ContainerResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ContainerResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ContainerResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ContainerResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ContainerResourcePromise; +} + +export interface ContainerResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ContainerResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise; + withEntrypoint(entrypoint: string): ContainerResourcePromise; + withImageTag(tag: string): ContainerResourcePromise; + withImageRegistry(registry: string): ContainerResourcePromise; + withImage(image: string, options?: WithImageOptions): ContainerResourcePromise; + withImageSHA256(sha256: string): ContainerResourcePromise; + withContainerRuntimeArgs(args: string[]): ContainerResourcePromise; + withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise; + publishAsContainer(): ContainerResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise; + withContainerName(name: string): ContainerResourcePromise; + withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise; + withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise; + withContainerNetworkAlias(alias: string): ContainerResourcePromise; + withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise; + withOtlpExporter(): ContainerResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise; + publishAsConnectionString(): ContainerResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise; + withEnvironment(name: string, value: string): ContainerResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ContainerResourcePromise; + withArgs(args: string[]): ContainerResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ContainerResourcePromise; + withReferenceUri(name: string, uri: string): ContainerResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise; + withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise; + withExternalHttpEndpoints(): ContainerResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ContainerResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise; + excludeFromManifest(): ContainerResourcePromise; + waitFor(dependency: HandleReference): ContainerResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise; + waitForStart(dependency: HandleReference): ContainerResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise; + withExplicitStart(): ContainerResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ContainerResourcePromise; + withHealthCheck(key: string): ContainerResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise; + withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise; + withoutHttpsCertificate(): ContainerResourcePromise; + withParentRelationship(parent: HandleReference): ContainerResourcePromise; + withChildRelationship(child: HandleReference): ContainerResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise; + excludeFromMcp(): ContainerResourcePromise; + withRemoteImageName(remoteImageName: string): ContainerResourcePromise; + withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ContainerResourcePromise; + withConfig(config: TestConfigDto): ContainerResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ContainerResourcePromise; + withCreatedAt(createdAt: string): ContainerResourcePromise; + withModifiedAt(modifiedAt: string): ContainerResourcePromise; + withCorrelationId(correlationId: string): ContainerResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ContainerResourcePromise; + withStatus(status: TestResourceStatus): ContainerResourcePromise; + withNestedConfig(config: TestNestedDto): ContainerResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ContainerResourcePromise; + testWaitFor(dependency: HandleReference): ContainerResourcePromise; + withDependency(dependency: HandleReference): ContainerResourcePromise; + withEndpoints(endpoints: string[]): ContainerResourcePromise; + withEnvironmentVariables(variables: Record): ContainerResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ContainerResourcePromise; + withMergeLabel(label: string): ContainerResourcePromise; + withMergeLabelCategorized(label: string, category: string): ContainerResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ContainerResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ContainerResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ContainerResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ContainerResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ContainerResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ContainerResourcePromise; +} + +// ============================================================================ +// ContainerResourceImpl +// ============================================================================ + +class ContainerResourceImpl extends ResourceBuilderBase implements ContainerResource { constructor(handle: ContainerResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -6763,13 +8177,13 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7145,12 +8559,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -7160,12 +8574,12 @@ export class ContainerResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -7205,19 +8619,19 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7225,16 +8639,16 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withArgsCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -7243,15 +8657,15 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7431,12 +8845,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -7447,13 +8861,13 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ContainerResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -7504,12 +8918,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ContainerResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -7519,72 +8933,72 @@ export class ContainerResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -7594,29 +9008,29 @@ export class ContainerResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ContainerResourcePromise { const exitCode = options?.exitCode; - return new ContainerResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ContainerResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -7626,12 +9040,12 @@ export class ContainerResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -7668,13 +9082,13 @@ export class ContainerResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): ContainerResourcePromise { const commandOptions = options?.commandOptions; - return new ContainerResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ContainerResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -7684,12 +9098,12 @@ export class ContainerResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -7777,13 +9191,13 @@ export class ContainerResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -7876,7 +9290,7 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7900,12 +9314,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ContainerResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -7917,14 +9331,14 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7948,19 +9362,19 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ContainerResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7968,19 +9382,19 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._onResourceStoppedInternal(callback)); + return new ContainerResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -7988,19 +9402,19 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._onInitializeResourceInternal(callback)); + return new ContainerResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -8008,19 +9422,19 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new ContainerResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -8028,12 +9442,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); + return new ContainerResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -8045,14 +9459,14 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -8082,12 +9496,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -8097,12 +9511,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -8148,13 +9562,13 @@ export class ContainerResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -8199,42 +9613,42 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withValidatorInternal(validator)); + return new ContainerResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ContainerResource(result, this._client); + return new ContainerResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -8244,12 +9658,12 @@ export class ContainerResource extends ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new ContainerResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -8278,12 +9692,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCancellableOperationInternal(operation)); + return new ContainerResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -8293,12 +9707,12 @@ export class ContainerResource extends ResourceBuilderBase { +class ContainerResourcePromiseImpl implements ContainerResourcePromise { constructor(private _promise: Promise) {} then( @@ -8432,198 +9846,198 @@ export class ContainerResourcePromise implements PromiseLike } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Adds a bind mount */ withBindMount(source: string, target: string, options?: WithBindMountOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withBindMount(source, target, options))); } /** Sets the container entrypoint */ withEntrypoint(entrypoint: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } /** Sets the container image tag */ withImageTag(tag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withImageTag(tag))); } /** Sets the container image registry */ withImageRegistry(registry: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withImageRegistry(registry))); } /** Sets the container image */ withImage(image: string, options?: WithImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withImage(image, options))); } /** Sets the image SHA256 digest */ withImageSHA256(sha256: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withImageSHA256(sha256))); } /** Adds runtime arguments for the container */ withContainerRuntimeArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } /** Sets the lifetime behavior of the container resource */ withLifetime(lifetime: ContainerLifetime): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withLifetime(lifetime))); } /** Sets the container image pull policy */ withImagePullPolicy(pullPolicy: ImagePullPolicy): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } /** Configures the resource to be published as a container */ publishAsContainer(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.publishAsContainer())); } /** Configures the resource to use a Dockerfile */ withDockerfile(contextPath: string, options?: WithDockerfileOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } /** Sets the container name */ withContainerName(name: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withContainerName(name))); } /** Adds a build argument from a parameter resource */ withBuildArg(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withBuildArg(name, value))); } /** Adds a build secret from a parameter resource */ withBuildSecret(name: string, value: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withBuildSecret(name, value))); } /** Configures endpoint proxy support */ withEndpointProxySupport(proxyEnabled: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a network alias for the container */ withContainerNetworkAlias(alias: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Publishes the resource as a connection string */ publishAsConnectionString(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -8633,152 +10047,152 @@ export class ContainerResourcePromise implements PromiseLike /** Configures resource for HTTP/2 */ asHttp2Service(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Adds a volume */ withVolume(target: string, options?: WithVolumeOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -8788,142 +10202,142 @@ export class ContainerResourcePromise implements PromiseLike /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ContainerResourcePromise { + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ContainerResourcePromise { - return new ContainerResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ContainerResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -8932,24 +10346,205 @@ export class ContainerResourcePromise implements PromiseLike // CSharpAppResource // ============================================================================ -export class CSharpAppResource extends ResourceBuilderBase { +export interface CSharpAppResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): CSharpAppResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise; + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise; + withOtlpExporter(): CSharpAppResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise; + withReplicas(replicas: number): CSharpAppResourcePromise; + disableForwardedHeaders(): CSharpAppResourcePromise; + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise; + withEnvironment(name: string, value: string): CSharpAppResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): CSharpAppResourcePromise; + withArgs(args: string[]): CSharpAppResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): CSharpAppResourcePromise; + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise; + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise; + withExternalHttpEndpoints(): CSharpAppResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): CSharpAppResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise; + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise; + publishWithContainerFiles(source: HandleReference, destinationPath: string): CSharpAppResourcePromise; + excludeFromManifest(): CSharpAppResourcePromise; + waitFor(dependency: HandleReference): CSharpAppResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise; + waitForStart(dependency: HandleReference): CSharpAppResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise; + withExplicitStart(): CSharpAppResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): CSharpAppResourcePromise; + withHealthCheck(key: string): CSharpAppResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise; + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise; + withoutHttpsCertificate(): CSharpAppResourcePromise; + withParentRelationship(parent: HandleReference): CSharpAppResourcePromise; + withChildRelationship(child: HandleReference): CSharpAppResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise; + excludeFromMcp(): CSharpAppResourcePromise; + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise; + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): CSharpAppResourcePromise; + withConfig(config: TestConfigDto): CSharpAppResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): CSharpAppResourcePromise; + withCreatedAt(createdAt: string): CSharpAppResourcePromise; + withModifiedAt(modifiedAt: string): CSharpAppResourcePromise; + withCorrelationId(correlationId: string): CSharpAppResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): CSharpAppResourcePromise; + withStatus(status: TestResourceStatus): CSharpAppResourcePromise; + withNestedConfig(config: TestNestedDto): CSharpAppResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): CSharpAppResourcePromise; + testWaitFor(dependency: HandleReference): CSharpAppResourcePromise; + withDependency(dependency: HandleReference): CSharpAppResourcePromise; + withEndpoints(endpoints: string[]): CSharpAppResourcePromise; + withEnvironmentVariables(variables: Record): CSharpAppResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): CSharpAppResourcePromise; + withMergeLabel(label: string): CSharpAppResourcePromise; + withMergeLabelCategorized(label: string, category: string): CSharpAppResourcePromise; + withMergeEndpoint(endpointName: string, port: number): CSharpAppResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): CSharpAppResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): CSharpAppResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): CSharpAppResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): CSharpAppResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): CSharpAppResourcePromise; +} + +export interface CSharpAppResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): CSharpAppResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise; + withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise; + withOtlpExporter(): CSharpAppResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise; + withReplicas(replicas: number): CSharpAppResourcePromise; + disableForwardedHeaders(): CSharpAppResourcePromise; + publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise; + withEnvironment(name: string, value: string): CSharpAppResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): CSharpAppResourcePromise; + withArgs(args: string[]): CSharpAppResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): CSharpAppResourcePromise; + withReferenceUri(name: string, uri: string): CSharpAppResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise; + withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise; + withExternalHttpEndpoints(): CSharpAppResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): CSharpAppResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise; + withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise; + publishWithContainerFiles(source: HandleReference, destinationPath: string): CSharpAppResourcePromise; + excludeFromManifest(): CSharpAppResourcePromise; + waitFor(dependency: HandleReference): CSharpAppResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise; + waitForStart(dependency: HandleReference): CSharpAppResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise; + withExplicitStart(): CSharpAppResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): CSharpAppResourcePromise; + withHealthCheck(key: string): CSharpAppResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise; + withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise; + withoutHttpsCertificate(): CSharpAppResourcePromise; + withParentRelationship(parent: HandleReference): CSharpAppResourcePromise; + withChildRelationship(child: HandleReference): CSharpAppResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise; + excludeFromMcp(): CSharpAppResourcePromise; + withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise; + withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): CSharpAppResourcePromise; + withConfig(config: TestConfigDto): CSharpAppResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): CSharpAppResourcePromise; + withCreatedAt(createdAt: string): CSharpAppResourcePromise; + withModifiedAt(modifiedAt: string): CSharpAppResourcePromise; + withCorrelationId(correlationId: string): CSharpAppResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): CSharpAppResourcePromise; + withStatus(status: TestResourceStatus): CSharpAppResourcePromise; + withNestedConfig(config: TestNestedDto): CSharpAppResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): CSharpAppResourcePromise; + testWaitFor(dependency: HandleReference): CSharpAppResourcePromise; + withDependency(dependency: HandleReference): CSharpAppResourcePromise; + withEndpoints(endpoints: string[]): CSharpAppResourcePromise; + withEnvironmentVariables(variables: Record): CSharpAppResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): CSharpAppResourcePromise; + withMergeLabel(label: string): CSharpAppResourcePromise; + withMergeLabelCategorized(label: string, category: string): CSharpAppResourcePromise; + withMergeEndpoint(endpointName: string, port: number): CSharpAppResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): CSharpAppResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): CSharpAppResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): CSharpAppResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): CSharpAppResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): CSharpAppResourcePromise; +} + +// ============================================================================ +// CSharpAppResourceImpl +// ============================================================================ + +class CSharpAppResourceImpl extends ResourceBuilderBase implements CSharpAppResource { constructor(handle: CSharpAppResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -8961,14 +10556,14 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const configureId = configure ? registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); + const obj = new ContainerResourceImpl(objHandle, this._client); await configure(obj); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -9063,13 +10658,13 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9131,12 +10726,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -9146,12 +10741,12 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -9191,19 +10786,19 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9211,16 +10806,16 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withArgsCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -9229,15 +10824,15 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9417,12 +11012,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -9433,13 +11028,13 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new CSharpAppResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -9490,27 +11085,27 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new CSharpAppResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + private async _publishWithContainerFilesInternal(source: HandleReference, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( 'Aspire.Hosting/publishWithContainerFiles', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + publishWithContainerFiles(source: HandleReference, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ @@ -9520,72 +11115,72 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -9595,29 +11190,29 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): CSharpAppResourcePromise { const exitCode = options?.exitCode; - return new CSharpAppResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new CSharpAppResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -9627,12 +11222,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -9669,13 +11264,13 @@ export class CSharpAppResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): CSharpAppResourcePromise { const commandOptions = options?.commandOptions; - return new CSharpAppResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new CSharpAppResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -9685,12 +11280,12 @@ export class CSharpAppResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -9778,13 +11373,13 @@ export class CSharpAppResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -9877,7 +11472,7 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9901,12 +11496,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9922,7 +11517,7 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9930,19 +11525,19 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9950,19 +11545,19 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._onResourceStoppedInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9970,19 +11565,19 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._onInitializeResourceInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -9990,19 +11585,19 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -10010,12 +11605,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -10027,14 +11622,14 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -10064,12 +11659,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -10079,12 +11674,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -10130,13 +11725,13 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -10181,42 +11776,42 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withValidatorInternal(validator)); + return new CSharpAppResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new CSharpAppResource(result, this._client); + return new CSharpAppResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -10226,12 +11821,12 @@ export class CSharpAppResource extends ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new CSharpAppResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -10260,12 +11855,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCancellableOperationInternal(operation)); + return new CSharpAppResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -10275,12 +11870,12 @@ export class CSharpAppResource extends ResourceBuilderBase { +class CSharpAppResourcePromiseImpl implements CSharpAppResourcePromise { constructor(private _promise: Promise) {} then( @@ -10414,128 +12009,128 @@ export class CSharpAppResourcePromise implements PromiseLike } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Sets the number of replicas */ withReplicas(replicas: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withReplicas(replicas))); } /** Disables forwarded headers for the project */ disableForwardedHeaders(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.disableForwardedHeaders())); } /** Publishes a project as a Docker file with optional container configuration */ publishAsDockerFile(options?: PublishAsDockerFileOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.publishAsDockerFile(options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -10545,152 +12140,152 @@ export class CSharpAppResourcePromise implements PromiseLike /** Configures resource for HTTP/2 */ asHttp2Service(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + publishWithContainerFiles(source: HandleReference, destinationPath: string): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -10700,142 +12295,142 @@ export class CSharpAppResourcePromise implements PromiseLike /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): CSharpAppResourcePromise { + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new CSharpAppResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -10844,24 +12439,217 @@ export class CSharpAppResourcePromise implements PromiseLike // DotnetToolResource // ============================================================================ -export class DotnetToolResource extends ResourceBuilderBase { +export interface DotnetToolResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): DotnetToolResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise; + withToolPackage(packageId: string): DotnetToolResourcePromise; + withToolVersion(version: string): DotnetToolResourcePromise; + withToolPrerelease(): DotnetToolResourcePromise; + withToolSource(source: string): DotnetToolResourcePromise; + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise; + withToolIgnoreFailedSources(): DotnetToolResourcePromise; + publishAsDockerFile(): DotnetToolResourcePromise; + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise; + withExecutableCommand(command: string): DotnetToolResourcePromise; + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise; + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise; + withOtlpExporter(): DotnetToolResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise; + withEnvironment(name: string, value: string): DotnetToolResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): DotnetToolResourcePromise; + withArgs(args: string[]): DotnetToolResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): DotnetToolResourcePromise; + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise; + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise; + withExternalHttpEndpoints(): DotnetToolResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): DotnetToolResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise; + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise; + excludeFromManifest(): DotnetToolResourcePromise; + waitFor(dependency: HandleReference): DotnetToolResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise; + waitForStart(dependency: HandleReference): DotnetToolResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise; + withExplicitStart(): DotnetToolResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): DotnetToolResourcePromise; + withHealthCheck(key: string): DotnetToolResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise; + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise; + withoutHttpsCertificate(): DotnetToolResourcePromise; + withParentRelationship(parent: HandleReference): DotnetToolResourcePromise; + withChildRelationship(child: HandleReference): DotnetToolResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise; + excludeFromMcp(): DotnetToolResourcePromise; + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise; + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): DotnetToolResourcePromise; + withConfig(config: TestConfigDto): DotnetToolResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): DotnetToolResourcePromise; + withCreatedAt(createdAt: string): DotnetToolResourcePromise; + withModifiedAt(modifiedAt: string): DotnetToolResourcePromise; + withCorrelationId(correlationId: string): DotnetToolResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): DotnetToolResourcePromise; + withStatus(status: TestResourceStatus): DotnetToolResourcePromise; + withNestedConfig(config: TestNestedDto): DotnetToolResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): DotnetToolResourcePromise; + testWaitFor(dependency: HandleReference): DotnetToolResourcePromise; + withDependency(dependency: HandleReference): DotnetToolResourcePromise; + withEndpoints(endpoints: string[]): DotnetToolResourcePromise; + withEnvironmentVariables(variables: Record): DotnetToolResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): DotnetToolResourcePromise; + withMergeLabel(label: string): DotnetToolResourcePromise; + withMergeLabelCategorized(label: string, category: string): DotnetToolResourcePromise; + withMergeEndpoint(endpointName: string, port: number): DotnetToolResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): DotnetToolResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): DotnetToolResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): DotnetToolResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): DotnetToolResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): DotnetToolResourcePromise; +} + +export interface DotnetToolResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): DotnetToolResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise; + withToolPackage(packageId: string): DotnetToolResourcePromise; + withToolVersion(version: string): DotnetToolResourcePromise; + withToolPrerelease(): DotnetToolResourcePromise; + withToolSource(source: string): DotnetToolResourcePromise; + withToolIgnoreExistingFeeds(): DotnetToolResourcePromise; + withToolIgnoreFailedSources(): DotnetToolResourcePromise; + publishAsDockerFile(): DotnetToolResourcePromise; + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise; + withExecutableCommand(command: string): DotnetToolResourcePromise; + withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise; + withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise; + withOtlpExporter(): DotnetToolResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise; + withEnvironment(name: string, value: string): DotnetToolResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): DotnetToolResourcePromise; + withArgs(args: string[]): DotnetToolResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): DotnetToolResourcePromise; + withReferenceUri(name: string, uri: string): DotnetToolResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise; + withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise; + withExternalHttpEndpoints(): DotnetToolResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): DotnetToolResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise; + withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise; + excludeFromManifest(): DotnetToolResourcePromise; + waitFor(dependency: HandleReference): DotnetToolResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise; + waitForStart(dependency: HandleReference): DotnetToolResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise; + withExplicitStart(): DotnetToolResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): DotnetToolResourcePromise; + withHealthCheck(key: string): DotnetToolResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise; + withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise; + withoutHttpsCertificate(): DotnetToolResourcePromise; + withParentRelationship(parent: HandleReference): DotnetToolResourcePromise; + withChildRelationship(child: HandleReference): DotnetToolResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise; + excludeFromMcp(): DotnetToolResourcePromise; + withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise; + withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): DotnetToolResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): DotnetToolResourcePromise; + withConfig(config: TestConfigDto): DotnetToolResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): DotnetToolResourcePromise; + withCreatedAt(createdAt: string): DotnetToolResourcePromise; + withModifiedAt(modifiedAt: string): DotnetToolResourcePromise; + withCorrelationId(correlationId: string): DotnetToolResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): DotnetToolResourcePromise; + withStatus(status: TestResourceStatus): DotnetToolResourcePromise; + withNestedConfig(config: TestNestedDto): DotnetToolResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): DotnetToolResourcePromise; + testWaitFor(dependency: HandleReference): DotnetToolResourcePromise; + withDependency(dependency: HandleReference): DotnetToolResourcePromise; + withEndpoints(endpoints: string[]): DotnetToolResourcePromise; + withEnvironmentVariables(variables: Record): DotnetToolResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): DotnetToolResourcePromise; + withMergeLabel(label: string): DotnetToolResourcePromise; + withMergeLabelCategorized(label: string, category: string): DotnetToolResourcePromise; + withMergeEndpoint(endpointName: string, port: number): DotnetToolResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): DotnetToolResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): DotnetToolResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): DotnetToolResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): DotnetToolResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): DotnetToolResourcePromise; +} + +// ============================================================================ +// DotnetToolResourceImpl +// ============================================================================ + +class DotnetToolResourceImpl extends ResourceBuilderBase implements DotnetToolResource { constructor(handle: DotnetToolResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -10873,14 +12661,14 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const configureId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); + const obj = new ContainerResourceImpl(objHandle, this._client); await configure(obj); }); const rpcArgs: Record = { builder: this._handle, configure: configureId }; @@ -11000,12 +12788,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + return new DotnetToolResourcePromiseImpl(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ @@ -11015,12 +12803,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11146,12 +12934,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -11161,12 +12949,12 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -11206,19 +12994,19 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11226,16 +13014,16 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withArgsCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -11244,15 +13032,15 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11432,12 +13220,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -11448,13 +13236,13 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new DotnetToolResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -11505,12 +13293,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new DotnetToolResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -11520,72 +13308,72 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -11595,29 +13383,29 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): DotnetToolResourcePromise { const exitCode = options?.exitCode; - return new DotnetToolResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new DotnetToolResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -11627,12 +13415,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -11669,13 +13457,13 @@ export class DotnetToolResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): DotnetToolResourcePromise { const commandOptions = options?.commandOptions; - return new DotnetToolResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new DotnetToolResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -11685,12 +13473,12 @@ export class DotnetToolResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -11778,13 +13566,13 @@ export class DotnetToolResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -11877,7 +13665,7 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11901,12 +13689,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11922,7 +13710,7 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11930,19 +13718,19 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11950,19 +13738,19 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._onResourceStoppedInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11970,19 +13758,19 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._onInitializeResourceInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -11990,19 +13778,19 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -12010,12 +13798,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -12027,14 +13815,14 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -12064,12 +13852,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -12079,12 +13867,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -12130,13 +13918,13 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -12181,42 +13969,42 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withValidatorInternal(validator)); + return new DotnetToolResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new DotnetToolResource(result, this._client); + return new DotnetToolResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -12226,12 +14014,12 @@ export class DotnetToolResource extends ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new DotnetToolResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -12260,12 +14048,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCancellableOperationInternal(operation)); + return new DotnetToolResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -12275,12 +14063,12 @@ export class DotnetToolResource extends ResourceBuilderBase { +class DotnetToolResourcePromiseImpl implements DotnetToolResourcePromise { constructor(private _promise: Promise) {} then( @@ -12414,163 +14202,163 @@ export class DotnetToolResourcePromise implements PromiseLike obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Sets the tool package ID */ withToolPackage(packageId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPackage(packageId))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withToolPackage(packageId))); } /** Sets the tool version */ withToolVersion(version: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolVersion(version))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withToolVersion(version))); } /** Allows prerelease tool versions */ withToolPrerelease(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolPrerelease())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withToolPrerelease())); } /** Adds a NuGet source for the tool */ withToolSource(source: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolSource(source))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withToolSource(source))); } /** Ignores existing NuGet feeds */ withToolIgnoreExistingFeeds(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withToolIgnoreExistingFeeds())); } /** Ignores failed NuGet sources */ withToolIgnoreFailedSources(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withToolIgnoreFailedSources())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withToolIgnoreFailedSources())); } /** Publishes the executable as a Docker container */ publishAsDockerFile(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.publishAsDockerFile())); } /** Publishes an executable as a Docker file with optional container configuration */ publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } /** Sets the executable command */ withExecutableCommand(command: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withExecutableCommand(command))); } /** Sets the executable working directory */ withWorkingDirectory(workingDirectory: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -12580,147 +14368,147 @@ export class DotnetToolResourcePromise implements PromiseLike obj.asHttp2Service())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -12730,142 +14518,142 @@ export class DotnetToolResourcePromise implements PromiseLike Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): DotnetToolResourcePromise { + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new DotnetToolResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -12874,24 +14662,205 @@ export class DotnetToolResourcePromise implements PromiseLike { +export interface ExecutableResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ExecutableResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise; + publishAsDockerFile(): ExecutableResourcePromise; + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise; + withExecutableCommand(command: string): ExecutableResourcePromise; + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise; + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise; + withOtlpExporter(): ExecutableResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise; + withEnvironment(name: string, value: string): ExecutableResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ExecutableResourcePromise; + withArgs(args: string[]): ExecutableResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ExecutableResourcePromise; + withReferenceUri(name: string, uri: string): ExecutableResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise; + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise; + withExternalHttpEndpoints(): ExecutableResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ExecutableResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise; + excludeFromManifest(): ExecutableResourcePromise; + waitFor(dependency: HandleReference): ExecutableResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise; + waitForStart(dependency: HandleReference): ExecutableResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise; + withExplicitStart(): ExecutableResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ExecutableResourcePromise; + withHealthCheck(key: string): ExecutableResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise; + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise; + withoutHttpsCertificate(): ExecutableResourcePromise; + withParentRelationship(parent: HandleReference): ExecutableResourcePromise; + withChildRelationship(child: HandleReference): ExecutableResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise; + excludeFromMcp(): ExecutableResourcePromise; + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise; + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ExecutableResourcePromise; + withConfig(config: TestConfigDto): ExecutableResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ExecutableResourcePromise; + withCreatedAt(createdAt: string): ExecutableResourcePromise; + withModifiedAt(modifiedAt: string): ExecutableResourcePromise; + withCorrelationId(correlationId: string): ExecutableResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ExecutableResourcePromise; + withStatus(status: TestResourceStatus): ExecutableResourcePromise; + withNestedConfig(config: TestNestedDto): ExecutableResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ExecutableResourcePromise; + testWaitFor(dependency: HandleReference): ExecutableResourcePromise; + withDependency(dependency: HandleReference): ExecutableResourcePromise; + withEndpoints(endpoints: string[]): ExecutableResourcePromise; + withEnvironmentVariables(variables: Record): ExecutableResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ExecutableResourcePromise; + withMergeLabel(label: string): ExecutableResourcePromise; + withMergeLabelCategorized(label: string, category: string): ExecutableResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ExecutableResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ExecutableResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ExecutableResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ExecutableResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ExecutableResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ExecutableResourcePromise; +} + +export interface ExecutableResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ExecutableResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise; + publishAsDockerFile(): ExecutableResourcePromise; + publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise; + withExecutableCommand(command: string): ExecutableResourcePromise; + withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise; + withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise; + withOtlpExporter(): ExecutableResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise; + withEnvironment(name: string, value: string): ExecutableResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ExecutableResourcePromise; + withArgs(args: string[]): ExecutableResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ExecutableResourcePromise; + withReferenceUri(name: string, uri: string): ExecutableResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise; + withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise; + withExternalHttpEndpoints(): ExecutableResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ExecutableResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise; + excludeFromManifest(): ExecutableResourcePromise; + waitFor(dependency: HandleReference): ExecutableResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise; + waitForStart(dependency: HandleReference): ExecutableResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise; + withExplicitStart(): ExecutableResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ExecutableResourcePromise; + withHealthCheck(key: string): ExecutableResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise; + withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise; + withoutHttpsCertificate(): ExecutableResourcePromise; + withParentRelationship(parent: HandleReference): ExecutableResourcePromise; + withChildRelationship(child: HandleReference): ExecutableResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise; + excludeFromMcp(): ExecutableResourcePromise; + withRemoteImageName(remoteImageName: string): ExecutableResourcePromise; + withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExecutableResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ExecutableResourcePromise; + withConfig(config: TestConfigDto): ExecutableResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ExecutableResourcePromise; + withCreatedAt(createdAt: string): ExecutableResourcePromise; + withModifiedAt(modifiedAt: string): ExecutableResourcePromise; + withCorrelationId(correlationId: string): ExecutableResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ExecutableResourcePromise; + withStatus(status: TestResourceStatus): ExecutableResourcePromise; + withNestedConfig(config: TestNestedDto): ExecutableResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ExecutableResourcePromise; + testWaitFor(dependency: HandleReference): ExecutableResourcePromise; + withDependency(dependency: HandleReference): ExecutableResourcePromise; + withEndpoints(endpoints: string[]): ExecutableResourcePromise; + withEnvironmentVariables(variables: Record): ExecutableResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ExecutableResourcePromise; + withMergeLabel(label: string): ExecutableResourcePromise; + withMergeLabelCategorized(label: string, category: string): ExecutableResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ExecutableResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ExecutableResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ExecutableResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ExecutableResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ExecutableResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ExecutableResourcePromise; +} + +// ============================================================================ +// ExecutableResourceImpl +// ============================================================================ + +class ExecutableResourceImpl extends ResourceBuilderBase implements ExecutableResource { constructor(handle: ExecutableResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -12903,14 +14872,14 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const configureId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); + const obj = new ContainerResourceImpl(objHandle, this._client); await configure(obj); }); const rpcArgs: Record = { builder: this._handle, configure: configureId }; @@ -12940,12 +14909,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + return new ExecutableResourcePromiseImpl(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ @@ -12955,12 +14924,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13086,12 +15055,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -13101,12 +15070,12 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -13146,19 +15115,19 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13166,16 +15135,16 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withArgsCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -13184,15 +15153,15 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13372,12 +15341,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -13388,13 +15357,13 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ExecutableResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -13445,12 +15414,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ExecutableResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -13460,72 +15429,72 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -13535,29 +15504,29 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ExecutableResourcePromise { const exitCode = options?.exitCode; - return new ExecutableResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ExecutableResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -13567,12 +15536,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -13609,13 +15578,13 @@ export class ExecutableResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): ExecutableResourcePromise { const commandOptions = options?.commandOptions; - return new ExecutableResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ExecutableResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -13625,12 +15594,12 @@ export class ExecutableResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -13718,13 +15687,13 @@ export class ExecutableResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -13817,7 +15786,7 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13841,12 +15810,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -13862,7 +15831,7 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13870,19 +15839,19 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ExecutableResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13890,19 +15859,19 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._onResourceStoppedInternal(callback)); + return new ExecutableResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13910,19 +15879,19 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._onInitializeResourceInternal(callback)); + return new ExecutableResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13930,19 +15899,19 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new ExecutableResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -13950,12 +15919,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + return new ExecutableResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -13967,14 +15936,14 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -14004,12 +15973,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -14019,12 +15988,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -14070,13 +16039,13 @@ export class ExecutableResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -14121,42 +16090,42 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withValidatorInternal(validator)); + return new ExecutableResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ExecutableResource(result, this._client); + return new ExecutableResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -14166,12 +16135,12 @@ export class ExecutableResource extends ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new ExecutableResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -14200,12 +16169,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCancellableOperationInternal(operation)); + return new ExecutableResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -14215,12 +16184,12 @@ export class ExecutableResource extends ResourceBuilderBase { +class ExecutableResourcePromiseImpl implements ExecutableResourcePromise { constructor(private _promise: Promise) {} then( @@ -14354,133 +16323,133 @@ export class ExecutableResourcePromise implements PromiseLike obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Publishes the executable as a Docker container */ publishAsDockerFile(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFile())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.publishAsDockerFile())); } /** Publishes an executable as a Docker file with optional container configuration */ publishAsDockerFileWithConfigure(configure: (obj: ContainerResource) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.publishAsDockerFileWithConfigure(configure))); } /** Sets the executable command */ withExecutableCommand(command: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExecutableCommand(command))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withExecutableCommand(command))); } /** Sets the executable working directory */ withWorkingDirectory(workingDirectory: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withWorkingDirectory(workingDirectory))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -14490,147 +16459,147 @@ export class ExecutableResourcePromise implements PromiseLike obj.asHttp2Service())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -14640,142 +16609,142 @@ export class ExecutableResourcePromise implements PromiseLike Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ExecutableResourcePromise { + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ExecutableResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -14784,24 +16753,123 @@ export class ExecutableResourcePromise implements PromiseLike { +export interface ExternalServiceResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ExternalServiceResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise; + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise; + excludeFromManifest(): ExternalServiceResourcePromise; + withExplicitStart(): ExternalServiceResourcePromise; + withHealthCheck(key: string): ExternalServiceResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise; + withParentRelationship(parent: HandleReference): ExternalServiceResourcePromise; + withChildRelationship(child: HandleReference): ExternalServiceResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise; + excludeFromMcp(): ExternalServiceResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ExternalServiceResourcePromise; + withConfig(config: TestConfigDto): ExternalServiceResourcePromise; + withCreatedAt(createdAt: string): ExternalServiceResourcePromise; + withModifiedAt(modifiedAt: string): ExternalServiceResourcePromise; + withCorrelationId(correlationId: string): ExternalServiceResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ExternalServiceResourcePromise; + withStatus(status: TestResourceStatus): ExternalServiceResourcePromise; + withNestedConfig(config: TestNestedDto): ExternalServiceResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ExternalServiceResourcePromise; + testWaitFor(dependency: HandleReference): ExternalServiceResourcePromise; + withDependency(dependency: HandleReference): ExternalServiceResourcePromise; + withEndpoints(endpoints: string[]): ExternalServiceResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ExternalServiceResourcePromise; + withMergeLabel(label: string): ExternalServiceResourcePromise; + withMergeLabelCategorized(label: string, category: string): ExternalServiceResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ExternalServiceResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ExternalServiceResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ExternalServiceResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ExternalServiceResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ExternalServiceResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ExternalServiceResourcePromise; +} + +export interface ExternalServiceResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ExternalServiceResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise; + withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise; + excludeFromManifest(): ExternalServiceResourcePromise; + withExplicitStart(): ExternalServiceResourcePromise; + withHealthCheck(key: string): ExternalServiceResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise; + withParentRelationship(parent: HandleReference): ExternalServiceResourcePromise; + withChildRelationship(child: HandleReference): ExternalServiceResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise; + excludeFromMcp(): ExternalServiceResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ExternalServiceResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ExternalServiceResourcePromise; + withConfig(config: TestConfigDto): ExternalServiceResourcePromise; + withCreatedAt(createdAt: string): ExternalServiceResourcePromise; + withModifiedAt(modifiedAt: string): ExternalServiceResourcePromise; + withCorrelationId(correlationId: string): ExternalServiceResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ExternalServiceResourcePromise; + withStatus(status: TestResourceStatus): ExternalServiceResourcePromise; + withNestedConfig(config: TestNestedDto): ExternalServiceResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ExternalServiceResourcePromise; + testWaitFor(dependency: HandleReference): ExternalServiceResourcePromise; + withDependency(dependency: HandleReference): ExternalServiceResourcePromise; + withEndpoints(endpoints: string[]): ExternalServiceResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ExternalServiceResourcePromise; + withMergeLabel(label: string): ExternalServiceResourcePromise; + withMergeLabelCategorized(label: string, category: string): ExternalServiceResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ExternalServiceResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ExternalServiceResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ExternalServiceResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ExternalServiceResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ExternalServiceResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ExternalServiceResourcePromise; +} + +// ============================================================================ +// ExternalServiceResourceImpl +// ============================================================================ + +class ExternalServiceResourceImpl extends ResourceBuilderBase implements ExternalServiceResource { constructor(handle: ExternalServiceResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -14813,14 +16881,14 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -14871,12 +16939,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -14887,13 +16955,13 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ExternalServiceResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -14939,12 +17007,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -14990,43 +17058,43 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { const commandOptions = options?.commandOptions; - return new ExternalServiceResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ExternalServiceResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -15037,13 +17105,13 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -15077,7 +17145,7 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -15101,12 +17169,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -15122,7 +17190,7 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -15130,19 +17198,19 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -15150,19 +17218,19 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._onResourceStoppedInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -15170,19 +17238,19 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._onInitializeResourceInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -15190,12 +17258,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -15207,14 +17275,14 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -15290,13 +17358,13 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -15341,42 +17409,42 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withValidatorInternal(validator)); + return new ExternalServiceResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ExternalServiceResource(result, this._client); + return new ExternalServiceResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -15386,12 +17454,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withCancellableOperationInternal(operation)); + return new ExternalServiceResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -15420,12 +17488,12 @@ export class ExternalServiceResource extends ResourceBuilderBase { +class ExternalServiceResourcePromiseImpl implements ExternalServiceResourcePromise { constructor(private _promise: Promise) {} then( @@ -15559,93 +17627,93 @@ export class ExternalServiceResourcePromise implements PromiseLike obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds an HTTP health check to an external service */ withExternalServiceHttpHealthCheck(options?: WithExternalServiceHttpHealthCheckOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withExternalServiceHttpHealthCheck(options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ withExplicitStart(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ withHealthCheck(key: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -15655,127 +17723,127 @@ export class ExternalServiceResourcePromise implements PromiseLike Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ExternalServiceResourcePromise { + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ExternalServiceResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -15784,24 +17852,123 @@ export class ExternalServiceResourcePromise implements PromiseLike { +export interface ParameterResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ParameterResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise; + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise; + excludeFromManifest(): ParameterResourcePromise; + withExplicitStart(): ParameterResourcePromise; + withHealthCheck(key: string): ParameterResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise; + withParentRelationship(parent: HandleReference): ParameterResourcePromise; + withChildRelationship(child: HandleReference): ParameterResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise; + excludeFromMcp(): ParameterResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ParameterResourcePromise; + withConfig(config: TestConfigDto): ParameterResourcePromise; + withCreatedAt(createdAt: string): ParameterResourcePromise; + withModifiedAt(modifiedAt: string): ParameterResourcePromise; + withCorrelationId(correlationId: string): ParameterResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ParameterResourcePromise; + withStatus(status: TestResourceStatus): ParameterResourcePromise; + withNestedConfig(config: TestNestedDto): ParameterResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ParameterResourcePromise; + testWaitFor(dependency: HandleReference): ParameterResourcePromise; + withDependency(dependency: HandleReference): ParameterResourcePromise; + withEndpoints(endpoints: string[]): ParameterResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ParameterResourcePromise; + withMergeLabel(label: string): ParameterResourcePromise; + withMergeLabelCategorized(label: string, category: string): ParameterResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ParameterResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ParameterResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ParameterResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ParameterResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ParameterResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ParameterResourcePromise; +} + +export interface ParameterResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ParameterResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise; + withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise; + excludeFromManifest(): ParameterResourcePromise; + withExplicitStart(): ParameterResourcePromise; + withHealthCheck(key: string): ParameterResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise; + withParentRelationship(parent: HandleReference): ParameterResourcePromise; + withChildRelationship(child: HandleReference): ParameterResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise; + excludeFromMcp(): ParameterResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ParameterResourcePromise; + withConfig(config: TestConfigDto): ParameterResourcePromise; + withCreatedAt(createdAt: string): ParameterResourcePromise; + withModifiedAt(modifiedAt: string): ParameterResourcePromise; + withCorrelationId(correlationId: string): ParameterResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ParameterResourcePromise; + withStatus(status: TestResourceStatus): ParameterResourcePromise; + withNestedConfig(config: TestNestedDto): ParameterResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ParameterResourcePromise; + testWaitFor(dependency: HandleReference): ParameterResourcePromise; + withDependency(dependency: HandleReference): ParameterResourcePromise; + withEndpoints(endpoints: string[]): ParameterResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ParameterResourcePromise; + withMergeLabel(label: string): ParameterResourcePromise; + withMergeLabelCategorized(label: string, category: string): ParameterResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ParameterResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ParameterResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ParameterResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ParameterResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ParameterResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ParameterResourcePromise; +} + +// ============================================================================ +// ParameterResourceImpl +// ============================================================================ + +class ParameterResourceImpl extends ResourceBuilderBase implements ParameterResource { constructor(handle: ParameterResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -15813,14 +17980,14 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -15869,12 +18036,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ParameterResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -15885,13 +18052,13 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ParameterResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -15937,12 +18104,12 @@ export class ParameterResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -15988,43 +18155,43 @@ export class ParameterResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): ParameterResourcePromise { const commandOptions = options?.commandOptions; - return new ParameterResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ParameterResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -16035,13 +18202,13 @@ export class ParameterResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -16075,7 +18242,7 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -16099,12 +18266,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ParameterResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -16120,7 +18287,7 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -16128,19 +18295,19 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ParameterResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -16148,19 +18315,19 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._onResourceStoppedInternal(callback)); + return new ParameterResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -16168,19 +18335,19 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._onInitializeResourceInternal(callback)); + return new ParameterResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -16188,12 +18355,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + return new ParameterResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -16205,14 +18372,14 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -16288,13 +18455,13 @@ export class ParameterResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -16339,42 +18506,42 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withValidatorInternal(validator)); + return new ParameterResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ParameterResource(result, this._client); + return new ParameterResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -16384,12 +18551,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withCancellableOperationInternal(operation)); + return new ParameterResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -16418,12 +18585,12 @@ export class ParameterResource extends ResourceBuilderBase { +class ParameterResourcePromiseImpl implements ParameterResourcePromise { constructor(private _promise: Promise) {} then( @@ -16557,93 +18724,93 @@ export class ParameterResourcePromise implements PromiseLike } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Sets a parameter description */ withDescription(description: string, options?: WithDescriptionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDescription(description, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withDescription(description, options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ withExplicitStart(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ withHealthCheck(key: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -16653,127 +18820,127 @@ export class ParameterResourcePromise implements PromiseLike /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ParameterResourcePromise { + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ParameterResourcePromise { - return new ParameterResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ParameterResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -16782,24 +18949,205 @@ export class ParameterResourcePromise implements PromiseLike // ProjectResource // ============================================================================ -export class ProjectResource extends ResourceBuilderBase { +export interface ProjectResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ProjectResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise; + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise; + withOtlpExporter(): ProjectResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise; + withReplicas(replicas: number): ProjectResourcePromise; + disableForwardedHeaders(): ProjectResourcePromise; + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise; + withEnvironment(name: string, value: string): ProjectResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ProjectResourcePromise; + withArgs(args: string[]): ProjectResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ProjectResourcePromise; + withReferenceUri(name: string, uri: string): ProjectResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise; + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise; + withExternalHttpEndpoints(): ProjectResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ProjectResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise; + publishWithContainerFiles(source: HandleReference, destinationPath: string): ProjectResourcePromise; + excludeFromManifest(): ProjectResourcePromise; + waitFor(dependency: HandleReference): ProjectResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise; + waitForStart(dependency: HandleReference): ProjectResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise; + withExplicitStart(): ProjectResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ProjectResourcePromise; + withHealthCheck(key: string): ProjectResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise; + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise; + withoutHttpsCertificate(): ProjectResourcePromise; + withParentRelationship(parent: HandleReference): ProjectResourcePromise; + withChildRelationship(child: HandleReference): ProjectResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise; + excludeFromMcp(): ProjectResourcePromise; + withRemoteImageName(remoteImageName: string): ProjectResourcePromise; + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ProjectResourcePromise; + withConfig(config: TestConfigDto): ProjectResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ProjectResourcePromise; + withCreatedAt(createdAt: string): ProjectResourcePromise; + withModifiedAt(modifiedAt: string): ProjectResourcePromise; + withCorrelationId(correlationId: string): ProjectResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ProjectResourcePromise; + withStatus(status: TestResourceStatus): ProjectResourcePromise; + withNestedConfig(config: TestNestedDto): ProjectResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ProjectResourcePromise; + testWaitFor(dependency: HandleReference): ProjectResourcePromise; + withDependency(dependency: HandleReference): ProjectResourcePromise; + withEndpoints(endpoints: string[]): ProjectResourcePromise; + withEnvironmentVariables(variables: Record): ProjectResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ProjectResourcePromise; + withMergeLabel(label: string): ProjectResourcePromise; + withMergeLabelCategorized(label: string, category: string): ProjectResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ProjectResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ProjectResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ProjectResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ProjectResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ProjectResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ProjectResourcePromise; +} + +export interface ProjectResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ProjectResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise; + withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise; + withOtlpExporter(): ProjectResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise; + withReplicas(replicas: number): ProjectResourcePromise; + disableForwardedHeaders(): ProjectResourcePromise; + publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise; + withEnvironment(name: string, value: string): ProjectResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ProjectResourcePromise; + withArgs(args: string[]): ProjectResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ProjectResourcePromise; + withReferenceUri(name: string, uri: string): ProjectResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise; + withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise; + withExternalHttpEndpoints(): ProjectResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ProjectResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise; + publishWithContainerFiles(source: HandleReference, destinationPath: string): ProjectResourcePromise; + excludeFromManifest(): ProjectResourcePromise; + waitFor(dependency: HandleReference): ProjectResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise; + waitForStart(dependency: HandleReference): ProjectResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise; + withExplicitStart(): ProjectResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ProjectResourcePromise; + withHealthCheck(key: string): ProjectResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise; + withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise; + withoutHttpsCertificate(): ProjectResourcePromise; + withParentRelationship(parent: HandleReference): ProjectResourcePromise; + withChildRelationship(child: HandleReference): ProjectResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise; + excludeFromMcp(): ProjectResourcePromise; + withRemoteImageName(remoteImageName: string): ProjectResourcePromise; + withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ProjectResourcePromise; + withConfig(config: TestConfigDto): ProjectResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ProjectResourcePromise; + withCreatedAt(createdAt: string): ProjectResourcePromise; + withModifiedAt(modifiedAt: string): ProjectResourcePromise; + withCorrelationId(correlationId: string): ProjectResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ProjectResourcePromise; + withStatus(status: TestResourceStatus): ProjectResourcePromise; + withNestedConfig(config: TestNestedDto): ProjectResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ProjectResourcePromise; + testWaitFor(dependency: HandleReference): ProjectResourcePromise; + withDependency(dependency: HandleReference): ProjectResourcePromise; + withEndpoints(endpoints: string[]): ProjectResourcePromise; + withEnvironmentVariables(variables: Record): ProjectResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ProjectResourcePromise; + withMergeLabel(label: string): ProjectResourcePromise; + withMergeLabelCategorized(label: string, category: string): ProjectResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ProjectResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ProjectResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ProjectResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ProjectResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ProjectResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ProjectResourcePromise; +} + +// ============================================================================ +// ProjectResourceImpl +// ============================================================================ + +class ProjectResourceImpl extends ResourceBuilderBase implements ProjectResource { constructor(handle: ProjectResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -16811,14 +19159,14 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ProjectResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ProjectResourcePromiseImpl(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ @@ -16830,14 +19178,14 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withMcpServer', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { const path = options?.path; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withMcpServerInternal(path, endpointName)); + return new ProjectResourcePromiseImpl(this._withMcpServerInternal(path, endpointName)); } /** @internal */ @@ -16847,12 +19195,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withOtlpExporter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures OTLP telemetry export */ withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterInternal()); + return new ProjectResourcePromiseImpl(this._withOtlpExporterInternal()); } /** @internal */ @@ -16862,12 +19210,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withOtlpExporterProtocol', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._withOtlpExporterProtocolInternal(protocol)); + return new ProjectResourcePromiseImpl(this._withOtlpExporterProtocolInternal(protocol)); } /** @internal */ @@ -16877,12 +19225,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withReplicas', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the number of replicas */ withReplicas(replicas: number): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReplicasInternal(replicas)); + return new ProjectResourcePromiseImpl(this._withReplicasInternal(replicas)); } /** @internal */ @@ -16892,19 +19240,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/disableForwardedHeaders', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Disables forwarded headers for the project */ disableForwardedHeaders(): ProjectResourcePromise { - return new ProjectResourcePromise(this._disableForwardedHeadersInternal()); + return new ProjectResourcePromiseImpl(this._disableForwardedHeadersInternal()); } /** @internal */ private async _publishAsDockerFileInternal(configure?: (obj: ContainerResource) => Promise): Promise { const configureId = configure ? registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ContainerResourceHandle; - const obj = new ContainerResource(objHandle, this._client); + const obj = new ContainerResourceImpl(objHandle, this._client); await configure(obj); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -16913,13 +19261,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/publishProjectAsDockerFileWithConfigure', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Publishes a project as a Docker file with optional container configuration */ publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { const configure = options?.configure; - return new ProjectResourcePromise(this._publishAsDockerFileInternal(configure)); + return new ProjectResourcePromiseImpl(this._publishAsDockerFileInternal(configure)); } /** @internal */ @@ -16930,13 +19278,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { const helpLink = options?.helpLink; - return new ProjectResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ProjectResourcePromiseImpl(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ @@ -16946,12 +19294,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withEnvironment', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets an environment variable */ withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentInternal(name, value)); + return new ProjectResourcePromiseImpl(this._withEnvironmentInternal(name, value)); } /** @internal */ @@ -16961,19 +19309,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withEnvironmentExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentExpressionInternal(name, value)); + return new ProjectResourcePromiseImpl(this._withEnvironmentExpressionInternal(name, value)); } /** @internal */ private async _withEnvironmentCallbackInternal(callback: (obj: EnvironmentCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -16981,12 +19329,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ProjectResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -16996,12 +19344,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withEnvironmentEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentEndpointInternal(name, endpointReference)); + return new ProjectResourcePromiseImpl(this._withEnvironmentEndpointInternal(name, endpointReference)); } /** @internal */ @@ -17011,27 +19359,27 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withEnvironmentParameter', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentParameterInternal(name, parameter)); + return new ProjectResourcePromiseImpl(this._withEnvironmentParameterInternal(name, parameter)); } /** @internal */ - private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: ResourceBuilderBase): Promise { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -17041,19 +19389,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withArgs', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds arguments */ withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsInternal(args)); + return new ProjectResourcePromiseImpl(this._withArgsInternal(args)); } /** @internal */ private async _withArgsCallbackInternal(callback: (obj: CommandLineArgsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17061,16 +19409,16 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withArgsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withArgsCallbackInternal(callback)); + return new ProjectResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -17079,15 +19427,15 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withReference', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { + withReference(source: HandleReference, options?: WithReferenceOptions): ProjectResourcePromise { const connectionName = options?.connectionName; const optional = options?.optional; const name = options?.name; - return new ProjectResourcePromise(this._withReferenceInternal(source, connectionName, optional, name)); + return new ProjectResourcePromiseImpl(this._withReferenceInternal(source, connectionName, optional, name)); } /** @internal */ @@ -17097,12 +19445,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withReferenceUri', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceUriInternal(name, uri)); + return new ProjectResourcePromiseImpl(this._withReferenceUriInternal(name, uri)); } /** @internal */ @@ -17112,12 +19460,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withReferenceExternalService', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceExternalServiceInternal(externalService)); + return new ProjectResourcePromiseImpl(this._withReferenceExternalServiceInternal(externalService)); } /** @internal */ @@ -17127,12 +19475,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withReferenceEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._withReferenceEndpointInternal(endpointReference)); + return new ProjectResourcePromiseImpl(this._withReferenceEndpointInternal(endpointReference)); } /** @internal */ @@ -17150,7 +19498,7 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a network endpoint */ @@ -17163,7 +19511,7 @@ export class ProjectResource extends ResourceBuilderBase const isProxied = options?.isProxied; const isExternal = options?.isExternal; const protocol = options?.protocol; - return new ProjectResourcePromise(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); + return new ProjectResourcePromiseImpl(this._withEndpointInternal(port, targetPort, scheme, name, env, isProxied, isExternal, protocol)); } /** @internal */ @@ -17178,7 +19526,7 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withHttpEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds an HTTP endpoint */ @@ -17188,7 +19536,7 @@ export class ProjectResource extends ResourceBuilderBase const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); + return new ProjectResourcePromiseImpl(this._withHttpEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ @@ -17203,7 +19551,7 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withHttpsEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds an HTTPS endpoint */ @@ -17213,7 +19561,7 @@ export class ProjectResource extends ResourceBuilderBase const name = options?.name; const env = options?.env; const isProxied = options?.isProxied; - return new ProjectResourcePromise(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); + return new ProjectResourcePromiseImpl(this._withHttpsEndpointInternal(port, targetPort, name, env, isProxied)); } /** @internal */ @@ -17223,12 +19571,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withExternalHttpEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExternalHttpEndpointsInternal()); + return new ProjectResourcePromiseImpl(this._withExternalHttpEndpointsInternal()); } /** Gets an endpoint reference */ @@ -17247,19 +19595,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/asHttp2Service', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures resource for HTTP/2 */ asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._asHttp2ServiceInternal()); + return new ProjectResourcePromiseImpl(this._asHttp2ServiceInternal()); } /** @internal */ private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17267,12 +19615,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ProjectResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -17283,13 +19631,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withUrl', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlInternal(url, displayText)); + return new ProjectResourcePromiseImpl(this._withUrlInternal(url, displayText)); } /** @internal */ @@ -17300,13 +19648,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { const displayText = options?.displayText; - return new ProjectResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ProjectResourcePromiseImpl(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ @@ -17320,19 +19668,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ProjectResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -17340,27 +19688,27 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withUrlForEndpointFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ProjectResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + private async _publishWithContainerFilesInternal(source: HandleReference, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( 'Aspire.Hosting/publishWithContainerFiles', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + publishWithContainerFiles(source: HandleReference, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._publishWithContainerFilesInternal(source, destinationPath)); } /** @internal */ @@ -17370,72 +19718,72 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromManifestInternal()); + return new ProjectResourcePromiseImpl(this._excludeFromManifestInternal()); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -17445,29 +19793,29 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Prevents resource from starting automatically */ withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withExplicitStartInternal()); + return new ProjectResourcePromiseImpl(this._withExplicitStartInternal()); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ProjectResourcePromise { const exitCode = options?.exitCode; - return new ProjectResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ProjectResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -17477,12 +19825,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a health check by key */ withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withHealthCheckInternal(key)); + return new ProjectResourcePromiseImpl(this._withHealthCheckInternal(key)); } /** @internal */ @@ -17495,7 +19843,7 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withHttpHealthCheck', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds an HTTP health check */ @@ -17503,14 +19851,14 @@ export class ProjectResource extends ResourceBuilderBase const path = options?.path; const statusCode = options?.statusCode; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); + return new ProjectResourcePromiseImpl(this._withHttpHealthCheckInternal(path, statusCode, endpointName)); } /** @internal */ private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -17519,13 +19867,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withCommand', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { const commandOptions = options?.commandOptions; - return new ProjectResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ProjectResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -17535,12 +19883,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withDeveloperCertificateTrust', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDeveloperCertificateTrustInternal(trust)); + return new ProjectResourcePromiseImpl(this._withDeveloperCertificateTrustInternal(trust)); } /** @internal */ @@ -17550,12 +19898,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withCertificateTrustScope', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCertificateTrustScopeInternal(scope)); + return new ProjectResourcePromiseImpl(this._withCertificateTrustScopeInternal(scope)); } /** @internal */ @@ -17566,13 +19914,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withHttpsDeveloperCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { const password = options?.password; - return new ProjectResourcePromise(this._withHttpsDeveloperCertificateInternal(password)); + return new ProjectResourcePromiseImpl(this._withHttpsDeveloperCertificateInternal(password)); } /** @internal */ @@ -17582,42 +19930,42 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withoutHttpsCertificate', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._withoutHttpsCertificateInternal()); + return new ProjectResourcePromiseImpl(this._withoutHttpsCertificateInternal()); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -17628,13 +19976,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withIconName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { const iconVariant = options?.iconVariant; - return new ProjectResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ProjectResourcePromiseImpl(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ @@ -17651,7 +19999,7 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withHttpProbe', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds an HTTP health probe to the resource */ @@ -17663,7 +20011,7 @@ export class ProjectResource extends ResourceBuilderBase const failureThreshold = options?.failureThreshold; const successThreshold = options?.successThreshold; const endpointName = options?.endpointName; - return new ProjectResourcePromise(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); + return new ProjectResourcePromiseImpl(this._withHttpProbeInternal(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName)); } /** @internal */ @@ -17673,12 +20021,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._excludeFromMcpInternal()); + return new ProjectResourcePromiseImpl(this._excludeFromMcpInternal()); } /** @internal */ @@ -17688,12 +20036,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + return new ProjectResourcePromiseImpl(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ @@ -17703,19 +20051,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + return new ProjectResourcePromiseImpl(this._withRemoteImageTagInternal(remoteImageTag)); } /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -17727,7 +20075,7 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a pipeline step to the resource */ @@ -17736,14 +20084,14 @@ export class ProjectResource extends ResourceBuilderBase const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ProjectResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ProjectResourcePromiseImpl(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17751,12 +20099,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ProjectResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -17772,7 +20120,7 @@ export class ProjectResource extends ResourceBuilderBase private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17780,19 +20128,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ProjectResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17800,19 +20148,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._onResourceStoppedInternal(callback)); + return new ProjectResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17820,19 +20168,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._onInitializeResourceInternal(callback)); + return new ProjectResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17840,19 +20188,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/onResourceEndpointsAllocated', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new ProjectResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17860,12 +20208,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._onResourceReadyInternal(callback)); + return new ProjectResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -17877,14 +20225,14 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withOptionalString', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ProjectResourcePromise { const value = options?.value; const enabled = options?.enabled; - return new ProjectResourcePromise(this._withOptionalStringInternal(value, enabled)); + return new ProjectResourcePromiseImpl(this._withOptionalStringInternal(value, enabled)); } /** @internal */ @@ -17894,19 +20242,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withConfig', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ProjectResourcePromise { - return new ProjectResourcePromise(this._withConfigInternal(config)); + return new ProjectResourcePromiseImpl(this._withConfigInternal(config)); } /** @internal */ private async _testWithEnvironmentCallbackInternal(callback: (arg: TestEnvironmentContext) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -17914,12 +20262,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWithEnvironmentCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ProjectResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -17929,12 +20277,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCreatedAt', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCreatedAtInternal(createdAt)); + return new ProjectResourcePromiseImpl(this._withCreatedAtInternal(createdAt)); } /** @internal */ @@ -17944,12 +20292,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withModifiedAt', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withModifiedAtInternal(modifiedAt)); + return new ProjectResourcePromiseImpl(this._withModifiedAtInternal(modifiedAt)); } /** @internal */ @@ -17959,19 +20307,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCorrelationId', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCorrelationIdInternal(correlationId)); + return new ProjectResourcePromiseImpl(this._withCorrelationIdInternal(correlationId)); } /** @internal */ private async _withOptionalCallbackInternal(callback?: (arg: TestCallbackContext) => Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -17980,13 +20328,13 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withOptionalCallback', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ProjectResourcePromise { const callback = options?.callback; - return new ProjectResourcePromise(this._withOptionalCallbackInternal(callback)); + return new ProjectResourcePromiseImpl(this._withOptionalCallbackInternal(callback)); } /** @internal */ @@ -17996,12 +20344,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withStatus', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ProjectResourcePromise { - return new ProjectResourcePromise(this._withStatusInternal(status)); + return new ProjectResourcePromiseImpl(this._withStatusInternal(status)); } /** @internal */ @@ -18011,19 +20359,19 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withNestedConfig', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ProjectResourcePromise { - return new ProjectResourcePromise(this._withNestedConfigInternal(config)); + return new ProjectResourcePromiseImpl(this._withNestedConfigInternal(config)); } /** @internal */ private async _withValidatorInternal(validator: (arg: TestResourceContext) => Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -18031,42 +20379,42 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withValidator', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withValidatorInternal(validator)); + return new ProjectResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -18076,12 +20424,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withEndpoints', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEndpointsInternal(endpoints)); + return new ProjectResourcePromiseImpl(this._withEndpointsInternal(endpoints)); } /** @internal */ @@ -18091,12 +20439,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withEnvironmentVariables', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): ProjectResourcePromise { - return new ProjectResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new ProjectResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -18110,12 +20458,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCancellableOperation', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._withCancellableOperationInternal(operation)); + return new ProjectResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -18125,12 +20473,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLabel', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a label to the resource */ withMergeLabel(label: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withMergeLabelInternal(label)); + return new ProjectResourcePromiseImpl(this._withMergeLabelInternal(label)); } /** @internal */ @@ -18140,12 +20488,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLabelCategorized', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withMergeLabelCategorizedInternal(label, category)); + return new ProjectResourcePromiseImpl(this._withMergeLabelCategorizedInternal(label, category)); } /** @internal */ @@ -18155,12 +20503,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeEndpoint', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ProjectResourcePromise { - return new ProjectResourcePromise(this._withMergeEndpointInternal(endpointName, port)); + return new ProjectResourcePromiseImpl(this._withMergeEndpointInternal(endpointName, port)); } /** @internal */ @@ -18170,12 +20518,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeEndpointScheme', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withMergeEndpointSchemeInternal(endpointName, port, scheme)); + return new ProjectResourcePromiseImpl(this._withMergeEndpointSchemeInternal(endpointName, port, scheme)); } /** @internal */ @@ -18187,14 +20535,14 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLogging', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ProjectResourcePromise { const enableConsole = options?.enableConsole; const maxFiles = options?.maxFiles; - return new ProjectResourcePromise(this._withMergeLoggingInternal(logLevel, enableConsole, maxFiles)); + return new ProjectResourcePromiseImpl(this._withMergeLoggingInternal(logLevel, enableConsole, maxFiles)); } /** @internal */ @@ -18206,14 +20554,14 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLoggingPath', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ProjectResourcePromise { const enableConsole = options?.enableConsole; const maxFiles = options?.maxFiles; - return new ProjectResourcePromise(this._withMergeLoggingPathInternal(logLevel, logPath, enableConsole, maxFiles)); + return new ProjectResourcePromiseImpl(this._withMergeLoggingPathInternal(logLevel, logPath, enableConsole, maxFiles)); } /** @internal */ @@ -18223,12 +20571,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeRoute', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ProjectResourcePromise { - return new ProjectResourcePromise(this._withMergeRouteInternal(path, method, handler, priority)); + return new ProjectResourcePromiseImpl(this._withMergeRouteInternal(path, method, handler, priority)); } /** @internal */ @@ -18238,12 +20586,12 @@ export class ProjectResource extends ResourceBuilderBase 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeRouteMiddleware', rpcArgs ); - return new ProjectResource(result, this._client); + return new ProjectResourceImpl(result, this._client); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._withMergeRouteMiddlewareInternal(path, method, handler, priority, middleware)); + return new ProjectResourcePromiseImpl(this._withMergeRouteMiddlewareInternal(path, method, handler, priority, middleware)); } } @@ -18253,7 +20601,7 @@ export class ProjectResource extends ResourceBuilderBase * @example * await builder.addSomething().withX().withY(); */ -export class ProjectResourcePromise implements PromiseLike { +class ProjectResourcePromiseImpl implements ProjectResourcePromise { constructor(private _promise: Promise) {} then( @@ -18264,128 +20612,128 @@ export class ProjectResourcePromise implements PromiseLike { } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Sets the number of replicas */ withReplicas(replicas: number): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReplicas(replicas))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withReplicas(replicas))); } /** Disables forwarded headers for the project */ disableForwardedHeaders(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.disableForwardedHeaders())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.disableForwardedHeaders())); } /** Publishes a project as a Docker file with optional container configuration */ publishAsDockerFile(options?: PublishAsDockerFileOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishAsDockerFile(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.publishAsDockerFile(options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -18395,152 +20743,152 @@ export class ProjectResourcePromise implements PromiseLike { /** Configures resource for HTTP/2 */ asHttp2Service(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); + publishWithContainerFiles(source: HandleReference, destinationPath: string): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -18550,142 +20898,142 @@ export class ProjectResourcePromise implements PromiseLike { /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ProjectResourcePromise { + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ProjectResourcePromise { - return new ProjectResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ProjectResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -18694,24 +21042,233 @@ export class ProjectResourcePromise implements PromiseLike { // TestDatabaseResource // ============================================================================ -export class TestDatabaseResource extends ResourceBuilderBase { +export interface TestDatabaseResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): TestDatabaseResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): TestDatabaseResourcePromise; + withEntrypoint(entrypoint: string): TestDatabaseResourcePromise; + withImageTag(tag: string): TestDatabaseResourcePromise; + withImageRegistry(registry: string): TestDatabaseResourcePromise; + withImage(image: string, options?: WithImageOptions): TestDatabaseResourcePromise; + withImageSHA256(sha256: string): TestDatabaseResourcePromise; + withContainerRuntimeArgs(args: string[]): TestDatabaseResourcePromise; + withLifetime(lifetime: ContainerLifetime): TestDatabaseResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): TestDatabaseResourcePromise; + publishAsContainer(): TestDatabaseResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestDatabaseResourcePromise; + withContainerName(name: string): TestDatabaseResourcePromise; + withBuildArg(name: string, value: ParameterResource): TestDatabaseResourcePromise; + withBuildSecret(name: string, value: ParameterResource): TestDatabaseResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): TestDatabaseResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestDatabaseResourcePromise; + withContainerNetworkAlias(alias: string): TestDatabaseResourcePromise; + withMcpServer(options?: WithMcpServerOptions): TestDatabaseResourcePromise; + withOtlpExporter(): TestDatabaseResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): TestDatabaseResourcePromise; + publishAsConnectionString(): TestDatabaseResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestDatabaseResourcePromise; + withEnvironment(name: string, value: string): TestDatabaseResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): TestDatabaseResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestDatabaseResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestDatabaseResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): TestDatabaseResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestDatabaseResourcePromise; + withArgs(args: string[]): TestDatabaseResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestDatabaseResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): TestDatabaseResourcePromise; + withReferenceUri(name: string, uri: string): TestDatabaseResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): TestDatabaseResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): TestDatabaseResourcePromise; + withEndpoint(options?: WithEndpointOptions): TestDatabaseResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): TestDatabaseResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestDatabaseResourcePromise; + withExternalHttpEndpoints(): TestDatabaseResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): TestDatabaseResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestDatabaseResourcePromise; + withUrl(url: string, options?: WithUrlOptions): TestDatabaseResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestDatabaseResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestDatabaseResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestDatabaseResourcePromise; + excludeFromManifest(): TestDatabaseResourcePromise; + waitFor(dependency: HandleReference): TestDatabaseResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise; + waitForStart(dependency: HandleReference): TestDatabaseResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise; + withExplicitStart(): TestDatabaseResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestDatabaseResourcePromise; + withHealthCheck(key: string): TestDatabaseResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestDatabaseResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestDatabaseResourcePromise; + withDeveloperCertificateTrust(trust: boolean): TestDatabaseResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): TestDatabaseResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestDatabaseResourcePromise; + withoutHttpsCertificate(): TestDatabaseResourcePromise; + withParentRelationship(parent: HandleReference): TestDatabaseResourcePromise; + withChildRelationship(child: HandleReference): TestDatabaseResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): TestDatabaseResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestDatabaseResourcePromise; + excludeFromMcp(): TestDatabaseResourcePromise; + withRemoteImageName(remoteImageName: string): TestDatabaseResourcePromise; + withRemoteImageTag(remoteImageTag: string): TestDatabaseResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestDatabaseResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestDatabaseResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): TestDatabaseResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestDatabaseResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestDatabaseResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestDatabaseResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestDatabaseResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestDatabaseResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestDatabaseResourcePromise; + withConfig(config: TestConfigDto): TestDatabaseResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestDatabaseResourcePromise; + withCreatedAt(createdAt: string): TestDatabaseResourcePromise; + withModifiedAt(modifiedAt: string): TestDatabaseResourcePromise; + withCorrelationId(correlationId: string): TestDatabaseResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestDatabaseResourcePromise; + withStatus(status: TestResourceStatus): TestDatabaseResourcePromise; + withNestedConfig(config: TestNestedDto): TestDatabaseResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestDatabaseResourcePromise; + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise; + withDependency(dependency: HandleReference): TestDatabaseResourcePromise; + withEndpoints(endpoints: string[]): TestDatabaseResourcePromise; + withEnvironmentVariables(variables: Record): TestDatabaseResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestDatabaseResourcePromise; + withMergeLabel(label: string): TestDatabaseResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestDatabaseResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestDatabaseResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestDatabaseResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestDatabaseResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestDatabaseResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestDatabaseResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestDatabaseResourcePromise; +} + +export interface TestDatabaseResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): TestDatabaseResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): TestDatabaseResourcePromise; + withEntrypoint(entrypoint: string): TestDatabaseResourcePromise; + withImageTag(tag: string): TestDatabaseResourcePromise; + withImageRegistry(registry: string): TestDatabaseResourcePromise; + withImage(image: string, options?: WithImageOptions): TestDatabaseResourcePromise; + withImageSHA256(sha256: string): TestDatabaseResourcePromise; + withContainerRuntimeArgs(args: string[]): TestDatabaseResourcePromise; + withLifetime(lifetime: ContainerLifetime): TestDatabaseResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): TestDatabaseResourcePromise; + publishAsContainer(): TestDatabaseResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestDatabaseResourcePromise; + withContainerName(name: string): TestDatabaseResourcePromise; + withBuildArg(name: string, value: ParameterResource): TestDatabaseResourcePromise; + withBuildSecret(name: string, value: ParameterResource): TestDatabaseResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): TestDatabaseResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestDatabaseResourcePromise; + withContainerNetworkAlias(alias: string): TestDatabaseResourcePromise; + withMcpServer(options?: WithMcpServerOptions): TestDatabaseResourcePromise; + withOtlpExporter(): TestDatabaseResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): TestDatabaseResourcePromise; + publishAsConnectionString(): TestDatabaseResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestDatabaseResourcePromise; + withEnvironment(name: string, value: string): TestDatabaseResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): TestDatabaseResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestDatabaseResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestDatabaseResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): TestDatabaseResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestDatabaseResourcePromise; + withArgs(args: string[]): TestDatabaseResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestDatabaseResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): TestDatabaseResourcePromise; + withReferenceUri(name: string, uri: string): TestDatabaseResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): TestDatabaseResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): TestDatabaseResourcePromise; + withEndpoint(options?: WithEndpointOptions): TestDatabaseResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): TestDatabaseResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestDatabaseResourcePromise; + withExternalHttpEndpoints(): TestDatabaseResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): TestDatabaseResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestDatabaseResourcePromise; + withUrl(url: string, options?: WithUrlOptions): TestDatabaseResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestDatabaseResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestDatabaseResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestDatabaseResourcePromise; + excludeFromManifest(): TestDatabaseResourcePromise; + waitFor(dependency: HandleReference): TestDatabaseResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise; + waitForStart(dependency: HandleReference): TestDatabaseResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise; + withExplicitStart(): TestDatabaseResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestDatabaseResourcePromise; + withHealthCheck(key: string): TestDatabaseResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestDatabaseResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestDatabaseResourcePromise; + withDeveloperCertificateTrust(trust: boolean): TestDatabaseResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): TestDatabaseResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestDatabaseResourcePromise; + withoutHttpsCertificate(): TestDatabaseResourcePromise; + withParentRelationship(parent: HandleReference): TestDatabaseResourcePromise; + withChildRelationship(child: HandleReference): TestDatabaseResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): TestDatabaseResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestDatabaseResourcePromise; + excludeFromMcp(): TestDatabaseResourcePromise; + withRemoteImageName(remoteImageName: string): TestDatabaseResourcePromise; + withRemoteImageTag(remoteImageTag: string): TestDatabaseResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestDatabaseResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestDatabaseResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): TestDatabaseResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestDatabaseResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestDatabaseResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestDatabaseResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestDatabaseResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestDatabaseResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestDatabaseResourcePromise; + withConfig(config: TestConfigDto): TestDatabaseResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestDatabaseResourcePromise; + withCreatedAt(createdAt: string): TestDatabaseResourcePromise; + withModifiedAt(modifiedAt: string): TestDatabaseResourcePromise; + withCorrelationId(correlationId: string): TestDatabaseResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestDatabaseResourcePromise; + withStatus(status: TestResourceStatus): TestDatabaseResourcePromise; + withNestedConfig(config: TestNestedDto): TestDatabaseResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestDatabaseResourcePromise; + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise; + withDependency(dependency: HandleReference): TestDatabaseResourcePromise; + withEndpoints(endpoints: string[]): TestDatabaseResourcePromise; + withEnvironmentVariables(variables: Record): TestDatabaseResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestDatabaseResourcePromise; + withMergeLabel(label: string): TestDatabaseResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestDatabaseResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestDatabaseResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestDatabaseResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestDatabaseResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestDatabaseResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestDatabaseResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestDatabaseResourcePromise; +} + +// ============================================================================ +// TestDatabaseResourceImpl +// ============================================================================ + +class TestDatabaseResourceImpl extends ResourceBuilderBase implements TestDatabaseResource { constructor(handle: TestDatabaseResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -18722,13 +21279,13 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19104,12 +21661,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -19119,12 +21676,12 @@ export class TestDatabaseResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -19164,19 +21721,19 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19184,16 +21741,16 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withArgsCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -19202,15 +21759,15 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19390,12 +21947,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -19406,13 +21963,13 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new TestDatabaseResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -19463,12 +22020,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new TestDatabaseResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -19478,72 +22035,72 @@ export class TestDatabaseResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -19553,29 +22110,29 @@ export class TestDatabaseResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): TestDatabaseResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestDatabaseResourcePromise { const exitCode = options?.exitCode; - return new TestDatabaseResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new TestDatabaseResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -19585,12 +22142,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -19627,13 +22184,13 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): TestDatabaseResourcePromise { const commandOptions = options?.commandOptions; - return new TestDatabaseResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new TestDatabaseResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -19643,12 +22200,12 @@ export class TestDatabaseResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -19736,13 +22293,13 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -19835,7 +22392,7 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19859,12 +22416,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -19876,14 +22433,14 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19907,19 +22464,19 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19927,19 +22484,19 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._onResourceStoppedInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19947,19 +22504,19 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._onInitializeResourceInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19967,19 +22524,19 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -19987,12 +22544,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._onResourceReadyInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -20004,14 +22561,14 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -20041,12 +22598,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -20056,12 +22613,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -20107,13 +22664,13 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -20158,42 +22715,42 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withValidatorInternal(validator)); + return new TestDatabaseResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new TestDatabaseResource(result, this._client); + return new TestDatabaseResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -20203,12 +22760,12 @@ export class TestDatabaseResource extends ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -20237,12 +22794,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestDatabaseResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -20252,12 +22809,12 @@ export class TestDatabaseResource extends ResourceBuilderBase { +class TestDatabaseResourcePromiseImpl implements TestDatabaseResourcePromise { constructor(private _promise: Promise) {} then( @@ -20391,198 +22948,198 @@ export class TestDatabaseResourcePromise implements PromiseLike obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Adds a bind mount */ withBindMount(source: string, target: string, options?: WithBindMountOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withBindMount(source, target, options))); } /** Sets the container entrypoint */ withEntrypoint(entrypoint: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } /** Sets the container image tag */ withImageTag(tag: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withImageTag(tag))); } /** Sets the container image registry */ withImageRegistry(registry: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withImageRegistry(registry))); } /** Sets the container image */ withImage(image: string, options?: WithImageOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withImage(image, options))); } /** Sets the image SHA256 digest */ withImageSHA256(sha256: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withImageSHA256(sha256))); } /** Adds runtime arguments for the container */ withContainerRuntimeArgs(args: string[]): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } /** Sets the lifetime behavior of the container resource */ withLifetime(lifetime: ContainerLifetime): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withLifetime(lifetime))); } /** Sets the container image pull policy */ withImagePullPolicy(pullPolicy: ImagePullPolicy): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } /** Configures the resource to be published as a container */ publishAsContainer(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.publishAsContainer())); } /** Configures the resource to use a Dockerfile */ withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } /** Sets the container name */ withContainerName(name: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withContainerName(name))); } /** Adds a build argument from a parameter resource */ withBuildArg(name: string, value: ParameterResource): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withBuildArg(name, value))); } /** Adds a build secret from a parameter resource */ withBuildSecret(name: string, value: ParameterResource): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withBuildSecret(name, value))); } /** Configures endpoint proxy support */ withEndpointProxySupport(proxyEnabled: boolean): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a network alias for the container */ withContainerNetworkAlias(alias: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Publishes the resource as a connection string */ publishAsConnectionString(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -20592,152 +23149,152 @@ export class TestDatabaseResourcePromise implements PromiseLike obj.asHttp2Service())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Adds a volume */ withVolume(target: string, options?: WithVolumeOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -20747,142 +23304,142 @@ export class TestDatabaseResourcePromise implements PromiseLike Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): TestDatabaseResourcePromise { + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -20891,24 +23448,263 @@ export class TestDatabaseResourcePromise implements PromiseLike { +export interface TestRedisResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): TestRedisResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): TestRedisResourcePromise; + withEntrypoint(entrypoint: string): TestRedisResourcePromise; + withImageTag(tag: string): TestRedisResourcePromise; + withImageRegistry(registry: string): TestRedisResourcePromise; + withImage(image: string, options?: WithImageOptions): TestRedisResourcePromise; + withImageSHA256(sha256: string): TestRedisResourcePromise; + withContainerRuntimeArgs(args: string[]): TestRedisResourcePromise; + withLifetime(lifetime: ContainerLifetime): TestRedisResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): TestRedisResourcePromise; + publishAsContainer(): TestRedisResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestRedisResourcePromise; + withContainerName(name: string): TestRedisResourcePromise; + withBuildArg(name: string, value: ParameterResource): TestRedisResourcePromise; + withBuildSecret(name: string, value: ParameterResource): TestRedisResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): TestRedisResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestRedisResourcePromise; + withContainerNetworkAlias(alias: string): TestRedisResourcePromise; + withMcpServer(options?: WithMcpServerOptions): TestRedisResourcePromise; + withOtlpExporter(): TestRedisResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): TestRedisResourcePromise; + publishAsConnectionString(): TestRedisResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestRedisResourcePromise; + withEnvironment(name: string, value: string): TestRedisResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): TestRedisResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestRedisResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestRedisResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): TestRedisResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestRedisResourcePromise; + withConnectionProperty(name: string, value: ReferenceExpression): TestRedisResourcePromise; + withConnectionPropertyValue(name: string, value: string): TestRedisResourcePromise; + withArgs(args: string[]): TestRedisResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestRedisResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): TestRedisResourcePromise; + withReferenceUri(name: string, uri: string): TestRedisResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): TestRedisResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): TestRedisResourcePromise; + withEndpoint(options?: WithEndpointOptions): TestRedisResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): TestRedisResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestRedisResourcePromise; + withExternalHttpEndpoints(): TestRedisResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): TestRedisResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestRedisResourcePromise; + withUrl(url: string, options?: WithUrlOptions): TestRedisResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestRedisResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestRedisResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestRedisResourcePromise; + excludeFromManifest(): TestRedisResourcePromise; + waitFor(dependency: HandleReference): TestRedisResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise; + waitForStart(dependency: HandleReference): TestRedisResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise; + withExplicitStart(): TestRedisResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestRedisResourcePromise; + withHealthCheck(key: string): TestRedisResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestRedisResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestRedisResourcePromise; + withDeveloperCertificateTrust(trust: boolean): TestRedisResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): TestRedisResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestRedisResourcePromise; + withoutHttpsCertificate(): TestRedisResourcePromise; + withParentRelationship(parent: HandleReference): TestRedisResourcePromise; + withChildRelationship(child: HandleReference): TestRedisResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): TestRedisResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestRedisResourcePromise; + excludeFromMcp(): TestRedisResourcePromise; + withRemoteImageName(remoteImageName: string): TestRedisResourcePromise; + withRemoteImageTag(remoteImageTag: string): TestRedisResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestRedisResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestRedisResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): TestRedisResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestRedisResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestRedisResourcePromise; + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): TestRedisResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestRedisResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestRedisResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestRedisResourcePromise; + addTestChildDatabase(name: string, options?: AddTestChildDatabaseOptions): TestDatabaseResourcePromise; + withPersistence(options?: WithPersistenceOptions): TestRedisResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestRedisResourcePromise; + withConfig(config: TestConfigDto): TestRedisResourcePromise; + getTags(): Promise>; + getMetadata(): Promise>; + withConnectionString(connectionString: ReferenceExpression): TestRedisResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withCreatedAt(createdAt: string): TestRedisResourcePromise; + withModifiedAt(modifiedAt: string): TestRedisResourcePromise; + withCorrelationId(correlationId: string): TestRedisResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestRedisResourcePromise; + withStatus(status: TestResourceStatus): TestRedisResourcePromise; + withNestedConfig(config: TestNestedDto): TestRedisResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestRedisResourcePromise; + testWaitFor(dependency: HandleReference): TestRedisResourcePromise; + getEndpoints(): Promise; + withConnectionStringDirect(connectionString: string): TestRedisResourcePromise; + withRedisSpecific(option: string): TestRedisResourcePromise; + withDependency(dependency: HandleReference): TestRedisResourcePromise; + withEndpoints(endpoints: string[]): TestRedisResourcePromise; + withEnvironmentVariables(variables: Record): TestRedisResourcePromise; + getStatusAsync(options?: GetStatusAsyncOptions): Promise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestRedisResourcePromise; + waitForReadyAsync(timeout: number, options?: WaitForReadyAsyncOptions): Promise; + withMultiParamHandleCallback(callback: (arg1: TestCallbackContext, arg2: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withDataVolume(options?: WithDataVolumeOptions): TestRedisResourcePromise; + withMergeLabel(label: string): TestRedisResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestRedisResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestRedisResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestRedisResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestRedisResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestRedisResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestRedisResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestRedisResourcePromise; +} + +export interface TestRedisResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): TestRedisResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): TestRedisResourcePromise; + withEntrypoint(entrypoint: string): TestRedisResourcePromise; + withImageTag(tag: string): TestRedisResourcePromise; + withImageRegistry(registry: string): TestRedisResourcePromise; + withImage(image: string, options?: WithImageOptions): TestRedisResourcePromise; + withImageSHA256(sha256: string): TestRedisResourcePromise; + withContainerRuntimeArgs(args: string[]): TestRedisResourcePromise; + withLifetime(lifetime: ContainerLifetime): TestRedisResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): TestRedisResourcePromise; + publishAsContainer(): TestRedisResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestRedisResourcePromise; + withContainerName(name: string): TestRedisResourcePromise; + withBuildArg(name: string, value: ParameterResource): TestRedisResourcePromise; + withBuildSecret(name: string, value: ParameterResource): TestRedisResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): TestRedisResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestRedisResourcePromise; + withContainerNetworkAlias(alias: string): TestRedisResourcePromise; + withMcpServer(options?: WithMcpServerOptions): TestRedisResourcePromise; + withOtlpExporter(): TestRedisResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): TestRedisResourcePromise; + publishAsConnectionString(): TestRedisResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestRedisResourcePromise; + withEnvironment(name: string, value: string): TestRedisResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): TestRedisResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestRedisResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestRedisResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): TestRedisResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestRedisResourcePromise; + withConnectionProperty(name: string, value: ReferenceExpression): TestRedisResourcePromise; + withConnectionPropertyValue(name: string, value: string): TestRedisResourcePromise; + withArgs(args: string[]): TestRedisResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestRedisResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): TestRedisResourcePromise; + withReferenceUri(name: string, uri: string): TestRedisResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): TestRedisResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): TestRedisResourcePromise; + withEndpoint(options?: WithEndpointOptions): TestRedisResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): TestRedisResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestRedisResourcePromise; + withExternalHttpEndpoints(): TestRedisResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): TestRedisResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestRedisResourcePromise; + withUrl(url: string, options?: WithUrlOptions): TestRedisResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestRedisResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestRedisResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestRedisResourcePromise; + excludeFromManifest(): TestRedisResourcePromise; + waitFor(dependency: HandleReference): TestRedisResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise; + waitForStart(dependency: HandleReference): TestRedisResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise; + withExplicitStart(): TestRedisResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestRedisResourcePromise; + withHealthCheck(key: string): TestRedisResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestRedisResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestRedisResourcePromise; + withDeveloperCertificateTrust(trust: boolean): TestRedisResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): TestRedisResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestRedisResourcePromise; + withoutHttpsCertificate(): TestRedisResourcePromise; + withParentRelationship(parent: HandleReference): TestRedisResourcePromise; + withChildRelationship(child: HandleReference): TestRedisResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): TestRedisResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestRedisResourcePromise; + excludeFromMcp(): TestRedisResourcePromise; + withRemoteImageName(remoteImageName: string): TestRedisResourcePromise; + withRemoteImageTag(remoteImageTag: string): TestRedisResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestRedisResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestRedisResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): TestRedisResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestRedisResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestRedisResourcePromise; + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): TestRedisResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestRedisResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestRedisResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestRedisResourcePromise; + addTestChildDatabase(name: string, options?: AddTestChildDatabaseOptions): TestDatabaseResourcePromise; + withPersistence(options?: WithPersistenceOptions): TestRedisResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestRedisResourcePromise; + withConfig(config: TestConfigDto): TestRedisResourcePromise; + getTags(): Promise>; + getMetadata(): Promise>; + withConnectionString(connectionString: ReferenceExpression): TestRedisResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withCreatedAt(createdAt: string): TestRedisResourcePromise; + withModifiedAt(modifiedAt: string): TestRedisResourcePromise; + withCorrelationId(correlationId: string): TestRedisResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestRedisResourcePromise; + withStatus(status: TestResourceStatus): TestRedisResourcePromise; + withNestedConfig(config: TestNestedDto): TestRedisResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestRedisResourcePromise; + testWaitFor(dependency: HandleReference): TestRedisResourcePromise; + getEndpoints(): Promise; + withConnectionStringDirect(connectionString: string): TestRedisResourcePromise; + withRedisSpecific(option: string): TestRedisResourcePromise; + withDependency(dependency: HandleReference): TestRedisResourcePromise; + withEndpoints(endpoints: string[]): TestRedisResourcePromise; + withEnvironmentVariables(variables: Record): TestRedisResourcePromise; + getStatusAsync(options?: GetStatusAsyncOptions): Promise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestRedisResourcePromise; + waitForReadyAsync(timeout: number, options?: WaitForReadyAsyncOptions): Promise; + withMultiParamHandleCallback(callback: (arg1: TestCallbackContext, arg2: TestEnvironmentContext) => Promise): TestRedisResourcePromise; + withDataVolume(options?: WithDataVolumeOptions): TestRedisResourcePromise; + withMergeLabel(label: string): TestRedisResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestRedisResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestRedisResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestRedisResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestRedisResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestRedisResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestRedisResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestRedisResourcePromise; +} + +// ============================================================================ +// TestRedisResourceImpl +// ============================================================================ + +class TestRedisResourceImpl extends ResourceBuilderBase implements TestRedisResource { constructor(handle: TestRedisResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -20919,13 +23715,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -21301,12 +24097,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -21316,12 +24112,12 @@ export class TestRedisResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -21361,12 +24157,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -21411,16 +24207,16 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withArgsCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -21429,15 +24225,15 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -21617,12 +24413,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withUrlsCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -21633,13 +24429,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new TestRedisResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -21690,12 +24486,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new TestRedisResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -21705,72 +24501,72 @@ export class TestRedisResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -21780,29 +24576,29 @@ export class TestRedisResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): TestRedisResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestRedisResourcePromise { const exitCode = options?.exitCode; - return new TestRedisResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new TestRedisResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -21812,12 +24608,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -21854,13 +24650,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): TestRedisResourcePromise { const commandOptions = options?.commandOptions; - return new TestRedisResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new TestRedisResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -21870,12 +24666,12 @@ export class TestRedisResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -21963,13 +24759,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -22062,7 +24858,7 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22086,12 +24882,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -22103,14 +24899,14 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22134,19 +24930,19 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22154,19 +24950,19 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onResourceStoppedInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onConnectionStringAvailableInternal(callback: (arg: ConnectionStringAvailableEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; - const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + const arg = new ConnectionStringAvailableEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22174,19 +24970,19 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onConnectionStringAvailableInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22194,19 +24990,19 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onInitializeResourceInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22214,19 +25010,19 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22234,12 +25030,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onResourceReadyInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -22250,13 +25046,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22355,12 +25151,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -22370,12 +25166,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -22421,13 +25217,13 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -22472,27 +25268,27 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withValidatorInternal(validator)); + return new TestRedisResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** Gets the endpoints */ @@ -22511,12 +25307,12 @@ export class TestRedisResource extends ResourceBuilderBase { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new TestRedisResource(result, this._client); + return new TestRedisResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -22556,12 +25352,12 @@ export class TestRedisResource extends ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestRedisResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** Gets the status of the resource asynchronously */ @@ -22601,12 +25397,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestRedisResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** Waits for the resource to be ready */ @@ -22624,9 +25420,9 @@ export class TestRedisResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (arg1Data: unknown, arg2Data: unknown) => { const arg1Handle = wrapIfHandle(arg1Data) as TestCallbackContextHandle; - const arg1 = new TestCallbackContext(arg1Handle, this._client); + const arg1 = new TestCallbackContextImpl(arg1Handle, this._client); const arg2Handle = wrapIfHandle(arg2Data) as TestEnvironmentContextHandle; - const arg2 = new TestEnvironmentContext(arg2Handle, this._client); + const arg2 = new TestEnvironmentContextImpl(arg2Handle, this._client); await callback(arg1, arg2); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -22634,12 +25430,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withMultiParamHandleCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withMultiParamHandleCallbackInternal(callback)); } /** @internal */ @@ -22651,14 +25447,14 @@ export class TestRedisResource extends ResourceBuilderBase { +class TestRedisResourcePromiseImpl implements TestRedisResourcePromise { constructor(private _promise: Promise) {} then( @@ -22807,208 +25603,208 @@ export class TestRedisResourcePromise implements PromiseLike } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Adds a bind mount */ withBindMount(source: string, target: string, options?: WithBindMountOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withBindMount(source, target, options))); } /** Sets the container entrypoint */ withEntrypoint(entrypoint: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } /** Sets the container image tag */ withImageTag(tag: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withImageTag(tag))); } /** Sets the container image registry */ withImageRegistry(registry: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withImageRegistry(registry))); } /** Sets the container image */ withImage(image: string, options?: WithImageOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withImage(image, options))); } /** Sets the image SHA256 digest */ withImageSHA256(sha256: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withImageSHA256(sha256))); } /** Adds runtime arguments for the container */ withContainerRuntimeArgs(args: string[]): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } /** Sets the lifetime behavior of the container resource */ withLifetime(lifetime: ContainerLifetime): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withLifetime(lifetime))); } /** Sets the container image pull policy */ withImagePullPolicy(pullPolicy: ImagePullPolicy): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } /** Configures the resource to be published as a container */ publishAsContainer(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.publishAsContainer())); } /** Configures the resource to use a Dockerfile */ withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } /** Sets the container name */ withContainerName(name: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withContainerName(name))); } /** Adds a build argument from a parameter resource */ withBuildArg(name: string, value: ParameterResource): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withBuildArg(name, value))); } /** Adds a build secret from a parameter resource */ withBuildSecret(name: string, value: ParameterResource): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withBuildSecret(name, value))); } /** Configures endpoint proxy support */ withEndpointProxySupport(proxyEnabled: boolean): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a network alias for the container */ withContainerNetworkAlias(alias: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Publishes the resource as a connection string */ publishAsConnectionString(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds a connection property with a reference expression */ withConnectionProperty(name: string, value: ReferenceExpression): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConnectionProperty(name, value))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConnectionProperty(name, value))); } /** Adds a connection property with a string value */ withConnectionPropertyValue(name: string, value: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Adds arguments */ withArgs(args: string[]): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -23018,152 +25814,152 @@ export class TestRedisResourcePromise implements PromiseLike /** Configures resource for HTTP/2 */ asHttp2Service(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Adds a volume */ withVolume(target: string, options?: WithVolumeOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -23173,52 +25969,52 @@ export class TestRedisResourcePromise implements PromiseLike /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the ConnectionStringAvailable event */ onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds a child database to a test Redis resource */ addTestChildDatabase(name: string, options?: AddTestChildDatabaseOptions): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._promise.then(obj => obj.addTestChildDatabase(name, options))); + return new TestDatabaseResourcePromiseImpl(this._promise.then(obj => obj.addTestChildDatabase(name, options))); } /** Configures the Redis resource with persistence */ withPersistence(options?: WithPersistenceOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withPersistence(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withPersistence(options))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Gets the tags for the resource */ @@ -23233,52 +26029,52 @@ export class TestRedisResourcePromise implements PromiseLike /** Sets the connection string using a reference expression */ withConnectionString(connectionString: ReferenceExpression): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConnectionString(connectionString))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConnectionString(connectionString))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Gets the endpoints */ @@ -23288,27 +26084,27 @@ export class TestRedisResourcePromise implements PromiseLike /** Sets connection string using direct interface target */ withConnectionStringDirect(connectionString: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); } /** Redis-specific configuration */ withRedisSpecific(option: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withRedisSpecific(option))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withRedisSpecific(option))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): TestRedisResourcePromise { + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Gets the status of the resource asynchronously */ @@ -23318,7 +26114,7 @@ export class TestRedisResourcePromise implements PromiseLike /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Waits for the resource to be ready */ @@ -23328,52 +26124,52 @@ export class TestRedisResourcePromise implements PromiseLike /** Tests multi-param callback destructuring */ withMultiParamHandleCallback(callback: (arg1: TestCallbackContext, arg2: TestEnvironmentContext) => Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMultiParamHandleCallback(callback))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMultiParamHandleCallback(callback))); } /** Adds a data volume with persistence */ withDataVolume(options?: WithDataVolumeOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withDataVolume(options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withDataVolume(options))); } /** Adds a label to the resource */ withMergeLabel(label: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new TestRedisResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -23382,24 +26178,235 @@ export class TestRedisResourcePromise implements PromiseLike // TestVaultResource // ============================================================================ -export class TestVaultResource extends ResourceBuilderBase { +export interface TestVaultResource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): TestVaultResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): TestVaultResourcePromise; + withEntrypoint(entrypoint: string): TestVaultResourcePromise; + withImageTag(tag: string): TestVaultResourcePromise; + withImageRegistry(registry: string): TestVaultResourcePromise; + withImage(image: string, options?: WithImageOptions): TestVaultResourcePromise; + withImageSHA256(sha256: string): TestVaultResourcePromise; + withContainerRuntimeArgs(args: string[]): TestVaultResourcePromise; + withLifetime(lifetime: ContainerLifetime): TestVaultResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): TestVaultResourcePromise; + publishAsContainer(): TestVaultResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestVaultResourcePromise; + withContainerName(name: string): TestVaultResourcePromise; + withBuildArg(name: string, value: ParameterResource): TestVaultResourcePromise; + withBuildSecret(name: string, value: ParameterResource): TestVaultResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): TestVaultResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestVaultResourcePromise; + withContainerNetworkAlias(alias: string): TestVaultResourcePromise; + withMcpServer(options?: WithMcpServerOptions): TestVaultResourcePromise; + withOtlpExporter(): TestVaultResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): TestVaultResourcePromise; + publishAsConnectionString(): TestVaultResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestVaultResourcePromise; + withEnvironment(name: string, value: string): TestVaultResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): TestVaultResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestVaultResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestVaultResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): TestVaultResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestVaultResourcePromise; + withArgs(args: string[]): TestVaultResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestVaultResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): TestVaultResourcePromise; + withReferenceUri(name: string, uri: string): TestVaultResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): TestVaultResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): TestVaultResourcePromise; + withEndpoint(options?: WithEndpointOptions): TestVaultResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): TestVaultResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestVaultResourcePromise; + withExternalHttpEndpoints(): TestVaultResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): TestVaultResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestVaultResourcePromise; + withUrl(url: string, options?: WithUrlOptions): TestVaultResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestVaultResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestVaultResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestVaultResourcePromise; + excludeFromManifest(): TestVaultResourcePromise; + waitFor(dependency: HandleReference): TestVaultResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise; + waitForStart(dependency: HandleReference): TestVaultResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise; + withExplicitStart(): TestVaultResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestVaultResourcePromise; + withHealthCheck(key: string): TestVaultResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestVaultResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestVaultResourcePromise; + withDeveloperCertificateTrust(trust: boolean): TestVaultResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): TestVaultResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestVaultResourcePromise; + withoutHttpsCertificate(): TestVaultResourcePromise; + withParentRelationship(parent: HandleReference): TestVaultResourcePromise; + withChildRelationship(child: HandleReference): TestVaultResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): TestVaultResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestVaultResourcePromise; + excludeFromMcp(): TestVaultResourcePromise; + withRemoteImageName(remoteImageName: string): TestVaultResourcePromise; + withRemoteImageTag(remoteImageTag: string): TestVaultResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestVaultResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestVaultResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): TestVaultResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestVaultResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestVaultResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestVaultResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestVaultResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestVaultResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestVaultResourcePromise; + withConfig(config: TestConfigDto): TestVaultResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestVaultResourcePromise; + withCreatedAt(createdAt: string): TestVaultResourcePromise; + withModifiedAt(modifiedAt: string): TestVaultResourcePromise; + withCorrelationId(correlationId: string): TestVaultResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestVaultResourcePromise; + withStatus(status: TestResourceStatus): TestVaultResourcePromise; + withNestedConfig(config: TestNestedDto): TestVaultResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestVaultResourcePromise; + testWaitFor(dependency: HandleReference): TestVaultResourcePromise; + withDependency(dependency: HandleReference): TestVaultResourcePromise; + withEndpoints(endpoints: string[]): TestVaultResourcePromise; + withEnvironmentVariables(variables: Record): TestVaultResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestVaultResourcePromise; + withVaultDirect(option: string): TestVaultResourcePromise; + withMergeLabel(label: string): TestVaultResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestVaultResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestVaultResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestVaultResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestVaultResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestVaultResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestVaultResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestVaultResourcePromise; +} + +export interface TestVaultResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): TestVaultResourcePromise; + withBindMount(source: string, target: string, options?: WithBindMountOptions): TestVaultResourcePromise; + withEntrypoint(entrypoint: string): TestVaultResourcePromise; + withImageTag(tag: string): TestVaultResourcePromise; + withImageRegistry(registry: string): TestVaultResourcePromise; + withImage(image: string, options?: WithImageOptions): TestVaultResourcePromise; + withImageSHA256(sha256: string): TestVaultResourcePromise; + withContainerRuntimeArgs(args: string[]): TestVaultResourcePromise; + withLifetime(lifetime: ContainerLifetime): TestVaultResourcePromise; + withImagePullPolicy(pullPolicy: ImagePullPolicy): TestVaultResourcePromise; + publishAsContainer(): TestVaultResourcePromise; + withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestVaultResourcePromise; + withContainerName(name: string): TestVaultResourcePromise; + withBuildArg(name: string, value: ParameterResource): TestVaultResourcePromise; + withBuildSecret(name: string, value: ParameterResource): TestVaultResourcePromise; + withEndpointProxySupport(proxyEnabled: boolean): TestVaultResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestVaultResourcePromise; + withContainerNetworkAlias(alias: string): TestVaultResourcePromise; + withMcpServer(options?: WithMcpServerOptions): TestVaultResourcePromise; + withOtlpExporter(): TestVaultResourcePromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): TestVaultResourcePromise; + publishAsConnectionString(): TestVaultResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestVaultResourcePromise; + withEnvironment(name: string, value: string): TestVaultResourcePromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): TestVaultResourcePromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestVaultResourcePromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestVaultResourcePromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): TestVaultResourcePromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestVaultResourcePromise; + withArgs(args: string[]): TestVaultResourcePromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestVaultResourcePromise; + withReference(source: HandleReference, options?: WithReferenceOptions): TestVaultResourcePromise; + withReferenceUri(name: string, uri: string): TestVaultResourcePromise; + withReferenceExternalService(externalService: ExternalServiceResource): TestVaultResourcePromise; + withReferenceEndpoint(endpointReference: EndpointReference): TestVaultResourcePromise; + withEndpoint(options?: WithEndpointOptions): TestVaultResourcePromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): TestVaultResourcePromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestVaultResourcePromise; + withExternalHttpEndpoints(): TestVaultResourcePromise; + getEndpoint(name: string): Promise; + asHttp2Service(): TestVaultResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestVaultResourcePromise; + withUrl(url: string, options?: WithUrlOptions): TestVaultResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestVaultResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestVaultResourcePromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestVaultResourcePromise; + excludeFromManifest(): TestVaultResourcePromise; + waitFor(dependency: HandleReference): TestVaultResourcePromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise; + waitForStart(dependency: HandleReference): TestVaultResourcePromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise; + withExplicitStart(): TestVaultResourcePromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestVaultResourcePromise; + withHealthCheck(key: string): TestVaultResourcePromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestVaultResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestVaultResourcePromise; + withDeveloperCertificateTrust(trust: boolean): TestVaultResourcePromise; + withCertificateTrustScope(scope: CertificateTrustScope): TestVaultResourcePromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestVaultResourcePromise; + withoutHttpsCertificate(): TestVaultResourcePromise; + withParentRelationship(parent: HandleReference): TestVaultResourcePromise; + withChildRelationship(child: HandleReference): TestVaultResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): TestVaultResourcePromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestVaultResourcePromise; + excludeFromMcp(): TestVaultResourcePromise; + withRemoteImageName(remoteImageName: string): TestVaultResourcePromise; + withRemoteImageTag(remoteImageTag: string): TestVaultResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestVaultResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestVaultResourcePromise; + withVolume(target: string, options?: WithVolumeOptions): TestVaultResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestVaultResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestVaultResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestVaultResourcePromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestVaultResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestVaultResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): TestVaultResourcePromise; + withConfig(config: TestConfigDto): TestVaultResourcePromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestVaultResourcePromise; + withCreatedAt(createdAt: string): TestVaultResourcePromise; + withModifiedAt(modifiedAt: string): TestVaultResourcePromise; + withCorrelationId(correlationId: string): TestVaultResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): TestVaultResourcePromise; + withStatus(status: TestResourceStatus): TestVaultResourcePromise; + withNestedConfig(config: TestNestedDto): TestVaultResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): TestVaultResourcePromise; + testWaitFor(dependency: HandleReference): TestVaultResourcePromise; + withDependency(dependency: HandleReference): TestVaultResourcePromise; + withEndpoints(endpoints: string[]): TestVaultResourcePromise; + withEnvironmentVariables(variables: Record): TestVaultResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestVaultResourcePromise; + withVaultDirect(option: string): TestVaultResourcePromise; + withMergeLabel(label: string): TestVaultResourcePromise; + withMergeLabelCategorized(label: string, category: string): TestVaultResourcePromise; + withMergeEndpoint(endpointName: string, port: number): TestVaultResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestVaultResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestVaultResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestVaultResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): TestVaultResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestVaultResourcePromise; +} + +// ============================================================================ +// TestVaultResourceImpl +// ============================================================================ + +class TestVaultResourceImpl extends ResourceBuilderBase implements TestVaultResource { constructor(handle: TestVaultResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -23410,13 +26417,13 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -23792,12 +26799,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -23807,12 +26814,12 @@ export class TestVaultResource extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ @@ -23852,19 +26859,19 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -23872,16 +26879,16 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withArgsCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withArgsCallbackInternal(callback)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -23890,15 +26897,15 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24078,12 +27085,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withUrlsCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -24094,13 +27101,13 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new TestVaultResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ private async _withUrlForEndpointFactoryInternal(endpointName: string, callback: (arg: EndpointReference) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -24151,12 +27158,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new TestVaultResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -24166,72 +27173,72 @@ export class TestVaultResource extends ResourceBuilderBase { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ @@ -24241,29 +27248,29 @@ export class TestVaultResource extends ResourceBuilderBase { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): TestVaultResourcePromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestVaultResourcePromise { const exitCode = options?.exitCode; - return new TestVaultResourcePromise(this._waitForCompletionInternal(dependency, exitCode)); + return new TestVaultResourcePromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } /** @internal */ @@ -24273,12 +27280,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -24315,13 +27322,13 @@ export class TestVaultResource extends ResourceBuilderBase Promise, options?: WithCommandOptions): TestVaultResourcePromise { const commandOptions = options?.commandOptions; - return new TestVaultResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new TestVaultResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ @@ -24331,12 +27338,12 @@ export class TestVaultResource extends ResourceBuilderBase { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -24424,13 +27431,13 @@ export class TestVaultResource extends ResourceBuilderBase Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -24523,7 +27530,7 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24547,12 +27554,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -24564,14 +27571,14 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24595,19 +27602,19 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new TestVaultResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24615,19 +27622,19 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._onResourceStoppedInternal(callback)); + return new TestVaultResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24635,19 +27642,19 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._onInitializeResourceInternal(callback)); + return new TestVaultResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceEndpointsAllocatedInternal(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24655,19 +27662,19 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new TestVaultResourcePromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24675,12 +27682,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._onResourceReadyInternal(callback)); + return new TestVaultResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -24692,14 +27699,14 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -24729,12 +27736,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -24744,12 +27751,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -24795,13 +27802,13 @@ export class TestVaultResource extends ResourceBuilderBase Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -24846,42 +27853,42 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withValidatorInternal(validator)); + return new TestVaultResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new TestVaultResource(result, this._client); + return new TestVaultResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -24891,12 +27898,12 @@ export class TestVaultResource extends ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestVaultResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -24925,12 +27932,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestVaultResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -24940,12 +27947,12 @@ export class TestVaultResource extends ResourceBuilderBase { +class TestVaultResourcePromiseImpl implements TestVaultResourcePromise { constructor(private _promise: Promise) {} then( @@ -25094,198 +28101,198 @@ export class TestVaultResourcePromise implements PromiseLike } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Adds a bind mount */ withBindMount(source: string, target: string, options?: WithBindMountOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withBindMount(source, target, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withBindMount(source, target, options))); } /** Sets the container entrypoint */ withEntrypoint(entrypoint: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEntrypoint(entrypoint))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEntrypoint(entrypoint))); } /** Sets the container image tag */ withImageTag(tag: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withImageTag(tag))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withImageTag(tag))); } /** Sets the container image registry */ withImageRegistry(registry: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withImageRegistry(registry))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withImageRegistry(registry))); } /** Sets the container image */ withImage(image: string, options?: WithImageOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withImage(image, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withImage(image, options))); } /** Sets the image SHA256 digest */ withImageSHA256(sha256: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withImageSHA256(sha256))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withImageSHA256(sha256))); } /** Adds runtime arguments for the container */ withContainerRuntimeArgs(args: string[]): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withContainerRuntimeArgs(args))); } /** Sets the lifetime behavior of the container resource */ withLifetime(lifetime: ContainerLifetime): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withLifetime(lifetime))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withLifetime(lifetime))); } /** Sets the container image pull policy */ withImagePullPolicy(pullPolicy: ImagePullPolicy): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withImagePullPolicy(pullPolicy))); } /** Configures the resource to be published as a container */ publishAsContainer(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.publishAsContainer())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.publishAsContainer())); } /** Configures the resource to use a Dockerfile */ withDockerfile(contextPath: string, options?: WithDockerfileOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withDockerfile(contextPath, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withDockerfile(contextPath, options))); } /** Sets the container name */ withContainerName(name: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withContainerName(name))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withContainerName(name))); } /** Adds a build argument from a parameter resource */ withBuildArg(name: string, value: ParameterResource): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withBuildArg(name, value))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withBuildArg(name, value))); } /** Adds a build secret from a parameter resource */ withBuildSecret(name: string, value: ParameterResource): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withBuildSecret(name, value))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withBuildSecret(name, value))); } /** Configures endpoint proxy support */ withEndpointProxySupport(proxyEnabled: boolean): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEndpointProxySupport(proxyEnabled))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a network alias for the container */ withContainerNetworkAlias(alias: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withContainerNetworkAlias(alias))); } /** Configures an MCP server endpoint on the resource */ withMcpServer(options?: WithMcpServerOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMcpServer(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Configures OTLP telemetry export */ withOtlpExporter(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withOtlpExporter())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Publishes the resource as a connection string */ publishAsConnectionString(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.publishAsConnectionString())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.publishAsConnectionString())); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds arguments */ withArgs(args: string[]): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withArgs(args))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEndpoint(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -25295,152 +28302,152 @@ export class TestVaultResourcePromise implements PromiseLike /** Configures resource for HTTP/2 */ asHttp2Service(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.asHttp2Service())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.waitFor(dependency))); + waitFor(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Prevents resource from starting automatically */ withExplicitStart(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } /** Adds a health check by key */ withHealthCheck(key: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Adds a volume */ withVolume(target: string, options?: WithVolumeOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withVolume(target, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withVolume(target, options))); } /** Gets the resource name */ @@ -25450,147 +28457,147 @@ export class TestVaultResourcePromise implements PromiseLike /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): TestVaultResourcePromise { + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Configures vault using direct interface target */ withVaultDirect(option: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withVaultDirect(option))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withVaultDirect(option))); } /** Adds a label to the resource */ withMergeLabel(label: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new TestVaultResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -25599,7 +28606,22 @@ export class TestVaultResourcePromise implements PromiseLike // ComputeResource // ============================================================================ -export class ComputeResource extends ResourceBuilderBase { +export interface ComputeResource { + toJSON(): MarshalledHandle; + withRemoteImageName(remoteImageName: string): ComputeResourcePromise; + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise; +} + +export interface ComputeResourcePromise extends PromiseLike { + withRemoteImageName(remoteImageName: string): ComputeResourcePromise; + withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise; +} + +// ============================================================================ +// ComputeResourceImpl +// ============================================================================ + +class ComputeResourceImpl extends ResourceBuilderBase implements ComputeResource { constructor(handle: IComputeResourceHandle, client: AspireClientRpc) { super(handle, client); } @@ -25611,12 +28633,12 @@ export class ComputeResource extends ResourceBuilderBase 'Aspire.Hosting/withRemoteImageName', rpcArgs ); - return new ComputeResource(result, this._client); + return new ComputeResourceImpl(result, this._client); } /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): ComputeResourcePromise { - return new ComputeResourcePromise(this._withRemoteImageNameInternal(remoteImageName)); + return new ComputeResourcePromiseImpl(this._withRemoteImageNameInternal(remoteImageName)); } /** @internal */ @@ -25626,12 +28648,12 @@ export class ComputeResource extends ResourceBuilderBase 'Aspire.Hosting/withRemoteImageTag', rpcArgs ); - return new ComputeResource(result, this._client); + return new ComputeResourceImpl(result, this._client); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { - return new ComputeResourcePromise(this._withRemoteImageTagInternal(remoteImageTag)); + return new ComputeResourcePromiseImpl(this._withRemoteImageTagInternal(remoteImageTag)); } } @@ -25641,7 +28663,7 @@ export class ComputeResource extends ResourceBuilderBase * @example * await builder.addSomething().withX().withY(); */ -export class ComputeResourcePromise implements PromiseLike { +class ComputeResourcePromiseImpl implements ComputeResourcePromise { constructor(private _promise: Promise) {} then( @@ -25653,12 +28675,12 @@ export class ComputeResourcePromise implements PromiseLike { /** Sets the remote image name for publishing */ withRemoteImageName(remoteImageName: string): ComputeResourcePromise { - return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); + return new ComputeResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageName(remoteImageName))); } /** Sets the remote image tag for publishing */ withRemoteImageTag(remoteImageTag: string): ComputeResourcePromise { - return new ComputeResourcePromise(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); + return new ComputeResourcePromiseImpl(this._promise.then(obj => obj.withRemoteImageTag(remoteImageTag))); } } @@ -25667,24 +28689,37 @@ export class ComputeResourcePromise implements PromiseLike { // ContainerFilesDestinationResource // ============================================================================ -export class ContainerFilesDestinationResource extends ResourceBuilderBase { +export interface ContainerFilesDestinationResource { + toJSON(): MarshalledHandle; + publishWithContainerFiles(source: HandleReference, destinationPath: string): ContainerFilesDestinationResourcePromise; +} + +export interface ContainerFilesDestinationResourcePromise extends PromiseLike { + publishWithContainerFiles(source: HandleReference, destinationPath: string): ContainerFilesDestinationResourcePromise; +} + +// ============================================================================ +// ContainerFilesDestinationResourceImpl +// ============================================================================ + +class ContainerFilesDestinationResourceImpl extends ResourceBuilderBase implements ContainerFilesDestinationResource { constructor(handle: IContainerFilesDestinationResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _publishWithContainerFilesInternal(source: ResourceBuilderBase, destinationPath: string): Promise { + private async _publishWithContainerFilesInternal(source: HandleReference, destinationPath: string): Promise { const rpcArgs: Record = { builder: this._handle, source, destinationPath }; const result = await this._client.invokeCapability( 'Aspire.Hosting/publishWithContainerFiles', rpcArgs ); - return new ContainerFilesDestinationResource(result, this._client); + return new ContainerFilesDestinationResourceImpl(result, this._client); } /** Configures the resource to copy container files from the specified source during publishing */ - publishWithContainerFiles(source: ResourceBuilderBase, destinationPath: string): ContainerFilesDestinationResourcePromise { - return new ContainerFilesDestinationResourcePromise(this._publishWithContainerFilesInternal(source, destinationPath)); + publishWithContainerFiles(source: HandleReference, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromiseImpl(this._publishWithContainerFilesInternal(source, destinationPath)); } } @@ -25694,7 +28729,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { +class ContainerFilesDestinationResourcePromiseImpl implements ContainerFilesDestinationResourcePromise { constructor(private _promise: Promise) {} then( @@ -25705,8 +28740,8 @@ export class ContainerFilesDestinationResourcePromise implements PromiseLike obj.publishWithContainerFiles(source, destinationPath))); + publishWithContainerFiles(source: HandleReference, destinationPath: string): ContainerFilesDestinationResourcePromise { + return new ContainerFilesDestinationResourcePromiseImpl(this._promise.then(obj => obj.publishWithContainerFiles(source, destinationPath))); } } @@ -25715,24 +28750,121 @@ export class ContainerFilesDestinationResourcePromise implements PromiseLike { +export interface Resource { + toJSON(): MarshalledHandle; + withContainerRegistry(registry: HandleReference): ResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise; + excludeFromManifest(): ResourcePromise; + withExplicitStart(): ResourcePromise; + withHealthCheck(key: string): ResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise; + withParentRelationship(parent: HandleReference): ResourcePromise; + withChildRelationship(child: HandleReference): ResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise; + excludeFromMcp(): ResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ResourcePromise; + withConfig(config: TestConfigDto): ResourcePromise; + withCreatedAt(createdAt: string): ResourcePromise; + withModifiedAt(modifiedAt: string): ResourcePromise; + withCorrelationId(correlationId: string): ResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise; + withStatus(status: TestResourceStatus): ResourcePromise; + withNestedConfig(config: TestNestedDto): ResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise; + testWaitFor(dependency: HandleReference): ResourcePromise; + withDependency(dependency: HandleReference): ResourcePromise; + withEndpoints(endpoints: string[]): ResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise; + withMergeLabel(label: string): ResourcePromise; + withMergeLabelCategorized(label: string, category: string): ResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise; +} + +export interface ResourcePromise extends PromiseLike { + withContainerRegistry(registry: HandleReference): ResourcePromise; + withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise; + withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise; + withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise; + withUrl(url: string, options?: WithUrlOptions): ResourcePromise; + withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise; + withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise; + excludeFromManifest(): ResourcePromise; + withExplicitStart(): ResourcePromise; + withHealthCheck(key: string): ResourcePromise; + withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise; + withParentRelationship(parent: HandleReference): ResourcePromise; + withChildRelationship(child: HandleReference): ResourcePromise; + withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise; + excludeFromMcp(): ResourcePromise; + withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise; + withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise; + getResourceName(): Promise; + onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise; + onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise; + onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise; + onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise; + withOptionalString(options?: WithOptionalStringOptions): ResourcePromise; + withConfig(config: TestConfigDto): ResourcePromise; + withCreatedAt(createdAt: string): ResourcePromise; + withModifiedAt(modifiedAt: string): ResourcePromise; + withCorrelationId(correlationId: string): ResourcePromise; + withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise; + withStatus(status: TestResourceStatus): ResourcePromise; + withNestedConfig(config: TestNestedDto): ResourcePromise; + withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise; + testWaitFor(dependency: HandleReference): ResourcePromise; + withDependency(dependency: HandleReference): ResourcePromise; + withEndpoints(endpoints: string[]): ResourcePromise; + withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise; + withMergeLabel(label: string): ResourcePromise; + withMergeLabelCategorized(label: string, category: string): ResourcePromise; + withMergeEndpoint(endpointName: string, port: number): ResourcePromise; + withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise; + withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise; + withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise; + withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise; + withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise; +} + +// ============================================================================ +// ResourceImpl +// ============================================================================ + +class ResourceImpl extends ResourceBuilderBase implements Resource { constructor(handle: IResourceHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _withContainerRegistryInternal(registry: ResourceBuilderBase): Promise { + private async _withContainerRegistryInternal(registry: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, registry }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withContainerRegistry', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._withContainerRegistryInternal(registry)); + withContainerRegistry(registry: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._withContainerRegistryInternal(registry)); } /** @internal */ @@ -25744,14 +28876,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withDockerfileBaseImage', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { const buildImage = options?.buildImage; const runtimeImage = options?.runtimeImage; - return new ResourcePromise(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); + return new ResourcePromiseImpl(this._withDockerfileBaseImageInternal(buildImage, runtimeImage)); } /** @internal */ @@ -25762,20 +28894,20 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withRequiredCommand', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { const helpLink = options?.helpLink; - return new ResourcePromise(this._withRequiredCommandInternal(command, helpLink)); + return new ResourcePromiseImpl(this._withRequiredCommandInternal(command, helpLink)); } /** @internal */ private async _withUrlsCallbackInternal(callback: (obj: ResourceUrlsCallbackContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as ResourceUrlsCallbackContextHandle; - const obj = new ResourceUrlsCallbackContext(objHandle, this._client); + const obj = new ResourceUrlsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -25783,12 +28915,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withUrlsCallback', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { - return new ResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -25799,13 +28931,13 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withUrl', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ResourcePromise { const displayText = options?.displayText; - return new ResourcePromise(this._withUrlInternal(url, displayText)); + return new ResourcePromiseImpl(this._withUrlInternal(url, displayText)); } /** @internal */ @@ -25816,13 +28948,13 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withUrlExpression', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { const displayText = options?.displayText; - return new ResourcePromise(this._withUrlExpressionInternal(url, displayText)); + return new ResourcePromiseImpl(this._withUrlExpressionInternal(url, displayText)); } /** @internal */ @@ -25836,12 +28968,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withUrlForEndpoint', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { - return new ResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -25851,12 +28983,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/excludeFromManifest', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ResourcePromise { - return new ResourcePromise(this._excludeFromManifestInternal()); + return new ResourcePromiseImpl(this._excludeFromManifestInternal()); } /** @internal */ @@ -25866,12 +28998,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withExplicitStart', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Prevents resource from starting automatically */ withExplicitStart(): ResourcePromise { - return new ResourcePromise(this._withExplicitStartInternal()); + return new ResourcePromiseImpl(this._withExplicitStartInternal()); } /** @internal */ @@ -25881,19 +29013,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withHealthCheck', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a health check by key */ withHealthCheck(key: string): ResourcePromise { - return new ResourcePromise(this._withHealthCheckInternal(key)); + return new ResourcePromiseImpl(this._withHealthCheckInternal(key)); } /** @internal */ private async _withCommandInternal(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, commandOptions?: CommandOptions): Promise { const executeCommandId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ExecuteCommandContextHandle; - const arg = new ExecuteCommandContext(argHandle, this._client); + const arg = new ExecuteCommandContextImpl(argHandle, this._client); return await executeCommand(arg); }); const rpcArgs: Record = { builder: this._handle, name, displayName, executeCommand: executeCommandId }; @@ -25902,43 +29034,43 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withCommand', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { const commandOptions = options?.commandOptions; - return new ResourcePromise(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); + return new ResourcePromiseImpl(this._withCommandInternal(name, displayName, executeCommand, commandOptions)); } /** @internal */ - private async _withParentRelationshipInternal(parent: ResourceBuilderBase): Promise { + private async _withParentRelationshipInternal(parent: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, parent }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withParentRelationship', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._withParentRelationshipInternal(parent)); + withParentRelationship(parent: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._withParentRelationshipInternal(parent)); } /** @internal */ - private async _withChildRelationshipInternal(child: ResourceBuilderBase): Promise { + private async _withChildRelationshipInternal(child: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, child }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withChildRelationship', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._withChildRelationshipInternal(child)); + withChildRelationship(child: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._withChildRelationshipInternal(child)); } /** @internal */ @@ -25949,13 +29081,13 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withIconName', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { const iconVariant = options?.iconVariant; - return new ResourcePromise(this._withIconNameInternal(iconName, iconVariant)); + return new ResourcePromiseImpl(this._withIconNameInternal(iconName, iconVariant)); } /** @internal */ @@ -25965,19 +29097,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/excludeFromMcp', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ResourcePromise { - return new ResourcePromise(this._excludeFromMcpInternal()); + return new ResourcePromiseImpl(this._excludeFromMcpInternal()); } /** @internal */ private async _withPipelineStepFactoryInternal(stepName: string, callback: (arg: PipelineStepContext) => Promise, dependsOn?: string[], requiredBy?: string[], tags?: string[], description?: string): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as PipelineStepContextHandle; - const arg = new PipelineStepContext(argHandle, this._client); + const arg = new PipelineStepContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, stepName, callback: callbackId }; @@ -25989,7 +29121,7 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withPipelineStepFactory', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a pipeline step to the resource */ @@ -25998,14 +29130,14 @@ export class Resource extends ResourceBuilderBase { const requiredBy = options?.requiredBy; const tags = options?.tags; const description = options?.description; - return new ResourcePromise(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); + return new ResourcePromiseImpl(this._withPipelineStepFactoryInternal(stepName, callback, dependsOn, requiredBy, tags, description)); } /** @internal */ private async _withPipelineConfigurationInternal(callback: (obj: PipelineConfigurationContext) => Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as PipelineConfigurationContextHandle; - const obj = new PipelineConfigurationContext(objHandle, this._client); + const obj = new PipelineConfigurationContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26013,12 +29145,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/withPipelineConfiguration', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { - return new ResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -26034,7 +29166,7 @@ export class Resource extends ResourceBuilderBase { private async _onBeforeResourceStartedInternal(callback: (arg: BeforeResourceStartedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as BeforeResourceStartedEventHandle; - const arg = new BeforeResourceStartedEvent(argHandle, this._client); + const arg = new BeforeResourceStartedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26042,19 +29174,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/onBeforeResourceStarted', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._onBeforeResourceStartedInternal(callback)); + return new ResourcePromiseImpl(this._onBeforeResourceStartedInternal(callback)); } /** @internal */ private async _onResourceStoppedInternal(callback: (arg: ResourceStoppedEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceStoppedEventHandle; - const arg = new ResourceStoppedEvent(argHandle, this._client); + const arg = new ResourceStoppedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26062,19 +29194,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/onResourceStopped', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._onResourceStoppedInternal(callback)); + return new ResourcePromiseImpl(this._onResourceStoppedInternal(callback)); } /** @internal */ private async _onInitializeResourceInternal(callback: (arg: InitializeResourceEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as InitializeResourceEventHandle; - const arg = new InitializeResourceEvent(argHandle, this._client); + const arg = new InitializeResourceEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26082,19 +29214,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/onInitializeResource', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._onInitializeResourceInternal(callback)); + return new ResourcePromiseImpl(this._onInitializeResourceInternal(callback)); } /** @internal */ private async _onResourceReadyInternal(callback: (arg: ResourceReadyEvent) => Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceReadyEventHandle; - const arg = new ResourceReadyEvent(argHandle, this._client); + const arg = new ResourceReadyEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26102,12 +29234,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting/onResourceReady', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._onResourceReadyInternal(callback)); + return new ResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -26119,14 +29251,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withOptionalString', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ResourcePromise { const value = options?.value; const enabled = options?.enabled; - return new ResourcePromise(this._withOptionalStringInternal(value, enabled)); + return new ResourcePromiseImpl(this._withOptionalStringInternal(value, enabled)); } /** @internal */ @@ -26136,12 +29268,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withConfig', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ResourcePromise { - return new ResourcePromise(this._withConfigInternal(config)); + return new ResourcePromiseImpl(this._withConfigInternal(config)); } /** @internal */ @@ -26151,12 +29283,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCreatedAt', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ResourcePromise { - return new ResourcePromise(this._withCreatedAtInternal(createdAt)); + return new ResourcePromiseImpl(this._withCreatedAtInternal(createdAt)); } /** @internal */ @@ -26166,12 +29298,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withModifiedAt', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ResourcePromise { - return new ResourcePromise(this._withModifiedAtInternal(modifiedAt)); + return new ResourcePromiseImpl(this._withModifiedAtInternal(modifiedAt)); } /** @internal */ @@ -26181,19 +29313,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCorrelationId', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ResourcePromise { - return new ResourcePromise(this._withCorrelationIdInternal(correlationId)); + return new ResourcePromiseImpl(this._withCorrelationIdInternal(correlationId)); } /** @internal */ private async _withOptionalCallbackInternal(callback?: (arg: TestCallbackContext) => Promise): Promise { const callbackId = callback ? registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestCallbackContextHandle; - const arg = new TestCallbackContext(argHandle, this._client); + const arg = new TestCallbackContextImpl(argHandle, this._client); await callback(arg); }) : undefined; const rpcArgs: Record = { builder: this._handle }; @@ -26202,13 +29334,13 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withOptionalCallback', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise { const callback = options?.callback; - return new ResourcePromise(this._withOptionalCallbackInternal(callback)); + return new ResourcePromiseImpl(this._withOptionalCallbackInternal(callback)); } /** @internal */ @@ -26218,12 +29350,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withStatus', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ResourcePromise { - return new ResourcePromise(this._withStatusInternal(status)); + return new ResourcePromiseImpl(this._withStatusInternal(status)); } /** @internal */ @@ -26233,19 +29365,19 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withNestedConfig', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ResourcePromise { - return new ResourcePromise(this._withNestedConfigInternal(config)); + return new ResourcePromiseImpl(this._withNestedConfigInternal(config)); } /** @internal */ private async _withValidatorInternal(validator: (arg: TestResourceContext) => Promise): Promise { const validatorId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestResourceContextHandle; - const arg = new TestResourceContext(argHandle, this._client); + const arg = new TestResourceContextImpl(argHandle, this._client); return await validator(arg); }); const rpcArgs: Record = { builder: this._handle, validator: validatorId }; @@ -26253,42 +29385,42 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withValidator', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise { - return new ResourcePromise(this._withValidatorInternal(validator)); + return new ResourcePromiseImpl(this._withValidatorInternal(validator)); } /** @internal */ - private async _testWaitForInternal(dependency: ResourceBuilderBase): Promise { + private async _testWaitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/testWaitFor', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._testWaitForInternal(dependency)); + testWaitFor(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._testWaitForInternal(dependency)); } /** @internal */ - private async _withDependencyInternal(dependency: ResourceBuilderBase): Promise { + private async _withDependencyInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withDependency', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._withDependencyInternal(dependency)); + withDependency(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._withDependencyInternal(dependency)); } /** @internal */ @@ -26298,12 +29430,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withEndpoints', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ResourcePromise { - return new ResourcePromise(this._withEndpointsInternal(endpoints)); + return new ResourcePromiseImpl(this._withEndpointsInternal(endpoints)); } /** @internal */ @@ -26317,12 +29449,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withCancellableOperation', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise { - return new ResourcePromise(this._withCancellableOperationInternal(operation)); + return new ResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -26332,12 +29464,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLabel', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a label to the resource */ withMergeLabel(label: string): ResourcePromise { - return new ResourcePromise(this._withMergeLabelInternal(label)); + return new ResourcePromiseImpl(this._withMergeLabelInternal(label)); } /** @internal */ @@ -26347,12 +29479,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLabelCategorized', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ResourcePromise { - return new ResourcePromise(this._withMergeLabelCategorizedInternal(label, category)); + return new ResourcePromiseImpl(this._withMergeLabelCategorizedInternal(label, category)); } /** @internal */ @@ -26362,12 +29494,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeEndpoint', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ResourcePromise { - return new ResourcePromise(this._withMergeEndpointInternal(endpointName, port)); + return new ResourcePromiseImpl(this._withMergeEndpointInternal(endpointName, port)); } /** @internal */ @@ -26377,12 +29509,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeEndpointScheme', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise { - return new ResourcePromise(this._withMergeEndpointSchemeInternal(endpointName, port, scheme)); + return new ResourcePromiseImpl(this._withMergeEndpointSchemeInternal(endpointName, port, scheme)); } /** @internal */ @@ -26394,14 +29526,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLogging', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise { const enableConsole = options?.enableConsole; const maxFiles = options?.maxFiles; - return new ResourcePromise(this._withMergeLoggingInternal(logLevel, enableConsole, maxFiles)); + return new ResourcePromiseImpl(this._withMergeLoggingInternal(logLevel, enableConsole, maxFiles)); } /** @internal */ @@ -26413,14 +29545,14 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeLoggingPath', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise { const enableConsole = options?.enableConsole; const maxFiles = options?.maxFiles; - return new ResourcePromise(this._withMergeLoggingPathInternal(logLevel, logPath, enableConsole, maxFiles)); + return new ResourcePromiseImpl(this._withMergeLoggingPathInternal(logLevel, logPath, enableConsole, maxFiles)); } /** @internal */ @@ -26430,12 +29562,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeRoute', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise { - return new ResourcePromise(this._withMergeRouteInternal(path, method, handler, priority)); + return new ResourcePromiseImpl(this._withMergeRouteInternal(path, method, handler, priority)); } /** @internal */ @@ -26445,12 +29577,12 @@ export class Resource extends ResourceBuilderBase { 'Aspire.Hosting.CodeGeneration.TypeScript.Tests/withMergeRouteMiddleware', rpcArgs ); - return new Resource(result, this._client); + return new ResourceImpl(result, this._client); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise { - return new ResourcePromise(this._withMergeRouteMiddlewareInternal(path, method, handler, priority, middleware)); + return new ResourcePromiseImpl(this._withMergeRouteMiddlewareInternal(path, method, handler, priority, middleware)); } } @@ -26460,7 +29592,7 @@ export class Resource extends ResourceBuilderBase { * @example * await builder.addSomething().withX().withY(); */ -export class ResourcePromise implements PromiseLike { +class ResourcePromiseImpl implements ResourcePromise { constructor(private _promise: Promise) {} then( @@ -26471,88 +29603,88 @@ export class ResourcePromise implements PromiseLike { } /** Configures a resource to use a container registry */ - withContainerRegistry(registry: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withContainerRegistry(registry))); + withContainerRegistry(registry: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.withContainerRegistry(registry))); } /** Sets the base image for a Dockerfile build */ withDockerfileBaseImage(options?: WithDockerfileBaseImageOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withDockerfileBaseImage(options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withDockerfileBaseImage(options))); } /** Adds a required command dependency */ withRequiredCommand(command: string, options?: WithRequiredCommandOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withRequiredCommand(command, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withRequiredCommand(command, options))); } /** Customizes displayed URLs via callback */ withUrlsCallback(callback: (obj: ResourceUrlsCallbackContext) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withUrlsCallback(callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withUrlsCallback(callback))); } /** Adds or modifies displayed URLs */ withUrl(url: string, options?: WithUrlOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withUrl(url, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withUrl(url, options))); } /** Adds a URL using a reference expression */ withUrlExpression(url: ReferenceExpression, options?: WithUrlExpressionOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withUrlExpression(url, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withUrlExpression(url, options))); } /** Customizes the URL for a specific endpoint via callback */ withUrlForEndpoint(endpointName: string, callback: (obj: ResourceUrlAnnotation) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withUrlForEndpoint(endpointName, callback))); } /** Excludes the resource from the deployment manifest */ excludeFromManifest(): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.excludeFromManifest())); + return new ResourcePromiseImpl(this._promise.then(obj => obj.excludeFromManifest())); } /** Prevents resource from starting automatically */ withExplicitStart(): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withExplicitStart())); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withExplicitStart())); } /** Adds a health check by key */ withHealthCheck(key: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withHealthCheck(key))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withHealthCheck(key))); } /** Adds a resource command */ withCommand(name: string, displayName: string, executeCommand: (arg: ExecuteCommandContext) => Promise, options?: WithCommandOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCommand(name, displayName, executeCommand, options))); } /** Sets the parent relationship */ - withParentRelationship(parent: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withParentRelationship(parent))); + withParentRelationship(parent: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.withParentRelationship(parent))); } /** Sets a child relationship */ - withChildRelationship(child: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withChildRelationship(child))); + withChildRelationship(child: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.withChildRelationship(child))); } /** Sets the icon for the resource */ withIconName(iconName: string, options?: WithIconNameOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withIconName(iconName, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withIconName(iconName, options))); } /** Excludes the resource from MCP server exposure */ excludeFromMcp(): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.excludeFromMcp())); + return new ResourcePromiseImpl(this._promise.then(obj => obj.excludeFromMcp())); } /** Adds a pipeline step to the resource */ withPipelineStepFactory(stepName: string, callback: (arg: PipelineStepContext) => Promise, options?: WithPipelineStepFactoryOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withPipelineStepFactory(stepName, callback, options))); } /** Configures pipeline step dependencies via a callback */ withPipelineConfiguration(callback: (obj: PipelineConfigurationContext) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withPipelineConfiguration(callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withPipelineConfiguration(callback))); } /** Gets the resource name */ @@ -26562,127 +29694,127 @@ export class ResourcePromise implements PromiseLike { /** Subscribes to the BeforeResourceStarted event */ onBeforeResourceStarted(callback: (arg: BeforeResourceStartedEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.onBeforeResourceStarted(callback))); } /** Subscribes to the ResourceStopped event */ onResourceStopped(callback: (arg: ResourceStoppedEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.onResourceStopped(callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.onResourceStopped(callback))); } /** Subscribes to the InitializeResource event */ onInitializeResource(callback: (arg: InitializeResourceEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.onInitializeResource(callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.onInitializeResource(callback))); } /** Subscribes to the ResourceReady event */ onResourceReady(callback: (arg: ResourceReadyEvent) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.onResourceReady(callback))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.onResourceReady(callback))); } /** Adds an optional string parameter */ withOptionalString(options?: WithOptionalStringOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withOptionalString(options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withOptionalString(options))); } /** Configures the resource with a DTO */ withConfig(config: TestConfigDto): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withConfig(config))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withConfig(config))); } /** Sets the created timestamp */ withCreatedAt(createdAt: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCreatedAt(createdAt))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCreatedAt(createdAt))); } /** Sets the modified timestamp */ withModifiedAt(modifiedAt: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withModifiedAt(modifiedAt))); } /** Sets the correlation ID */ withCorrelationId(correlationId: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCorrelationId(correlationId))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCorrelationId(correlationId))); } /** Configures with optional callback */ withOptionalCallback(options?: WithOptionalCallbackOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withOptionalCallback(options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withOptionalCallback(options))); } /** Sets the resource status */ withStatus(status: TestResourceStatus): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withStatus(status))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withStatus(status))); } /** Configures with nested DTO */ withNestedConfig(config: TestNestedDto): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withNestedConfig(config))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withNestedConfig(config))); } /** Adds validation callback */ withValidator(validator: (arg: TestResourceContext) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withValidator(validator))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withValidator(validator))); } /** Waits for another resource (test version) */ - testWaitFor(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.testWaitFor(dependency))); + testWaitFor(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.testWaitFor(dependency))); } /** Adds a dependency on another resource */ - withDependency(dependency: ResourceBuilderBase): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withDependency(dependency))); + withDependency(dependency: HandleReference): ResourcePromise { + return new ResourcePromiseImpl(this._promise.then(obj => obj.withDependency(dependency))); } /** Sets the endpoints */ withEndpoints(endpoints: string[]): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withEndpoints(endpoints))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withEndpoints(endpoints))); } /** Performs a cancellable operation */ withCancellableOperation(operation: (arg: CancellationToken) => Promise): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withCancellableOperation(operation))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withCancellableOperation(operation))); } /** Adds a label to the resource */ withMergeLabel(label: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLabel(label))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabel(label))); } /** Adds a categorized label to the resource */ withMergeLabelCategorized(label: string, category: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLabelCategorized(label, category))); } /** Configures a named endpoint */ withMergeEndpoint(endpointName: string, port: number): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpoint(endpointName, port))); } /** Configures a named endpoint with scheme */ withMergeEndpointScheme(endpointName: string, port: number, scheme: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeEndpointScheme(endpointName, port, scheme))); } /** Configures resource logging */ withMergeLogging(logLevel: string, options?: WithMergeLoggingOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLogging(logLevel, options))); } /** Configures resource logging with file path */ withMergeLoggingPath(logLevel: string, logPath: string, options?: WithMergeLoggingPathOptions): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeLoggingPath(logLevel, logPath, options))); } /** Configures a route */ withMergeRoute(path: string, method: string, handler: string, priority: number): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeRoute(path, method, handler, priority))); } /** Configures a route with middleware */ withMergeRouteMiddleware(path: string, method: string, handler: string, priority: number, middleware: string): ResourcePromise { - return new ResourcePromise(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.withMergeRouteMiddleware(path, method, handler, priority, middleware))); } } @@ -26691,7 +29823,22 @@ export class ResourcePromise implements PromiseLike { // ResourceWithArgs // ============================================================================ -export class ResourceWithArgs extends ResourceBuilderBase { +export interface ResourceWithArgs { + toJSON(): MarshalledHandle; + withArgs(args: string[]): ResourceWithArgsPromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise; +} + +export interface ResourceWithArgsPromise extends PromiseLike { + withArgs(args: string[]): ResourceWithArgsPromise; + withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise; +} + +// ============================================================================ +// ResourceWithArgsImpl +// ============================================================================ + +class ResourceWithArgsImpl extends ResourceBuilderBase implements ResourceWithArgs { constructor(handle: IResourceWithArgsHandle, client: AspireClientRpc) { super(handle, client); } @@ -26703,19 +29850,19 @@ export class ResourceWithArgs extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as CommandLineArgsCallbackContextHandle; - const obj = new CommandLineArgsCallbackContext(objHandle, this._client); + const obj = new CommandLineArgsCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26723,12 +29870,12 @@ export class ResourceWithArgs extends ResourceBuilderBase Promise): ResourceWithArgsPromise { - return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + return new ResourceWithArgsPromiseImpl(this._withArgsCallbackInternal(callback)); } } @@ -26738,7 +29885,7 @@ export class ResourceWithArgs extends ResourceBuilderBase { +class ResourceWithArgsPromiseImpl implements ResourceWithArgsPromise { constructor(private _promise: Promise) {} then( @@ -26750,12 +29897,12 @@ export class ResourceWithArgsPromise implements PromiseLike { /** Adds arguments */ withArgs(args: string[]): ResourceWithArgsPromise { - return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgs(args))); + return new ResourceWithArgsPromiseImpl(this._promise.then(obj => obj.withArgs(args))); } /** Sets command-line arguments via callback */ withArgsCallback(callback: (obj: CommandLineArgsCallbackContext) => Promise): ResourceWithArgsPromise { - return new ResourceWithArgsPromise(this._promise.then(obj => obj.withArgsCallback(callback))); + return new ResourceWithArgsPromiseImpl(this._promise.then(obj => obj.withArgsCallback(callback))); } } @@ -26764,7 +29911,28 @@ export class ResourceWithArgsPromise implements PromiseLike { // ResourceWithConnectionString // ============================================================================ -export class ResourceWithConnectionString extends ResourceBuilderBase { +export interface ResourceWithConnectionString { + toJSON(): MarshalledHandle; + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise; + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise; + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise; + withConnectionString(connectionString: ReferenceExpression): ResourceWithConnectionStringPromise; + withConnectionStringDirect(connectionString: string): ResourceWithConnectionStringPromise; +} + +export interface ResourceWithConnectionStringPromise extends PromiseLike { + withConnectionProperty(name: string, value: ReferenceExpression): ResourceWithConnectionStringPromise; + withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise; + onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise; + withConnectionString(connectionString: ReferenceExpression): ResourceWithConnectionStringPromise; + withConnectionStringDirect(connectionString: string): ResourceWithConnectionStringPromise; +} + +// ============================================================================ +// ResourceWithConnectionStringImpl +// ============================================================================ + +class ResourceWithConnectionStringImpl extends ResourceBuilderBase implements ResourceWithConnectionString { constructor(handle: IResourceWithConnectionStringHandle, client: AspireClientRpc) { super(handle, client); } @@ -26776,12 +29944,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ConnectionStringAvailableEventHandle; - const arg = new ConnectionStringAvailableEvent(argHandle, this._client); + const arg = new ConnectionStringAvailableEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -26811,12 +29979,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase Promise): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + return new ResourceWithConnectionStringPromiseImpl(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ @@ -26826,12 +29994,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { +class ResourceWithConnectionStringPromiseImpl implements ResourceWithConnectionStringPromise { constructor(private _promise: Promise) {} then( @@ -26868,27 +30036,27 @@ export class ResourceWithConnectionStringPromise implements PromiseLike obj.withConnectionProperty(name, value))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.withConnectionProperty(name, value))); } /** Adds a connection property with a string value */ withConnectionPropertyValue(name: string, value: string): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.withConnectionPropertyValue(name, value))); } /** Subscribes to the ConnectionStringAvailable event */ onConnectionStringAvailable(callback: (arg: ConnectionStringAvailableEvent) => Promise): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.onConnectionStringAvailable(callback))); } /** Sets the connection string using a reference expression */ withConnectionString(connectionString: ReferenceExpression): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionString(connectionString))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.withConnectionString(connectionString))); } /** Sets connection string using direct interface target */ withConnectionStringDirect(connectionString: string): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); + return new ResourceWithConnectionStringPromiseImpl(this._promise.then(obj => obj.withConnectionStringDirect(connectionString))); } } @@ -26897,7 +30065,22 @@ export class ResourceWithConnectionStringPromise implements PromiseLike { +export interface ResourceWithContainerFiles { + toJSON(): MarshalledHandle; + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise; + clearContainerFilesSources(): ResourceWithContainerFilesPromise; +} + +export interface ResourceWithContainerFilesPromise extends PromiseLike { + withContainerFilesSource(sourcePath: string): ResourceWithContainerFilesPromise; + clearContainerFilesSources(): ResourceWithContainerFilesPromise; +} + +// ============================================================================ +// ResourceWithContainerFilesImpl +// ============================================================================ + +class ResourceWithContainerFilesImpl extends ResourceBuilderBase implements ResourceWithContainerFiles { constructor(handle: IResourceWithContainerFilesHandle, client: AspireClientRpc) { super(handle, client); } @@ -26909,12 +30092,12 @@ export class ResourceWithContainerFiles extends ResourceBuilderBase { +class ResourceWithContainerFilesPromiseImpl implements ResourceWithContainerFilesPromise { constructor(private _promise: Promise) {} then( @@ -26951,12 +30134,12 @@ export class ResourceWithContainerFilesPromise implements PromiseLike obj.withContainerFilesSource(sourcePath))); + return new ResourceWithContainerFilesPromiseImpl(this._promise.then(obj => obj.withContainerFilesSource(sourcePath))); } /** Clears all container file sources */ clearContainerFilesSources(): ResourceWithContainerFilesPromise { - return new ResourceWithContainerFilesPromise(this._promise.then(obj => obj.clearContainerFilesSources())); + return new ResourceWithContainerFilesPromiseImpl(this._promise.then(obj => obj.clearContainerFilesSources())); } } @@ -26965,7 +30148,40 @@ export class ResourceWithContainerFilesPromise implements PromiseLike { +export interface ResourceWithEndpoints { + toJSON(): MarshalledHandle; + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise; + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise; + withExternalHttpEndpoints(): ResourceWithEndpointsPromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ResourceWithEndpointsPromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise; +} + +export interface ResourceWithEndpointsPromise extends PromiseLike { + withMcpServer(options?: WithMcpServerOptions): ResourceWithEndpointsPromise; + withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise; + withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise; + withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise; + withExternalHttpEndpoints(): ResourceWithEndpointsPromise; + getEndpoint(name: string): Promise; + asHttp2Service(): ResourceWithEndpointsPromise; + withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise; + withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise; + withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise; + onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise; +} + +// ============================================================================ +// ResourceWithEndpointsImpl +// ============================================================================ + +class ResourceWithEndpointsImpl extends ResourceBuilderBase implements ResourceWithEndpoints { constructor(handle: IResourceWithEndpointsHandle, client: AspireClientRpc) { super(handle, client); } @@ -26979,14 +30195,14 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as EndpointReferenceHandle; - const arg = new EndpointReference(argHandle, this._client); + const arg = new EndpointReferenceImpl(argHandle, this._client); return await callback(arg); }); const rpcArgs: Record = { builder: this._handle, endpointName, callback: callbackId }; @@ -27121,12 +30337,12 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ResourceWithEndpointsPromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -27139,7 +30355,7 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as ResourceEndpointsAllocatedEventHandle; - const arg = new ResourceEndpointsAllocatedEvent(argHandle, this._client); + const arg = new ResourceEndpointsAllocatedEventImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -27191,12 +30407,12 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new ResourceWithEndpointsPromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } } @@ -27206,7 +30422,7 @@ export class ResourceWithEndpoints extends ResourceBuilderBase { +class ResourceWithEndpointsPromiseImpl implements ResourceWithEndpointsPromise { constructor(private _promise: Promise) {} then( @@ -27218,27 +30434,27 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.withMcpServer(options))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withMcpServer(options))); } /** Adds a network endpoint */ withEndpoint(options?: WithEndpointOptions): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withEndpoint(options))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withEndpoint(options))); } /** Adds an HTTP endpoint */ withHttpEndpoint(options?: WithHttpEndpointOptions): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpEndpoint(options))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withHttpEndpoint(options))); } /** Adds an HTTPS endpoint */ withHttpsEndpoint(options?: WithHttpsEndpointOptions): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpsEndpoint(options))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withHttpsEndpoint(options))); } /** Makes HTTP endpoints externally accessible */ withExternalHttpEndpoints(): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withExternalHttpEndpoints())); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withExternalHttpEndpoints())); } /** Gets an endpoint reference */ @@ -27248,27 +30464,27 @@ export class ResourceWithEndpointsPromise implements PromiseLike obj.asHttp2Service())); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.asHttp2Service())); } /** Adds a URL for a specific endpoint via factory callback */ withUrlForEndpointFactory(endpointName: string, callback: (arg: EndpointReference) => Promise): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withUrlForEndpointFactory(endpointName, callback))); } /** Adds an HTTP health check */ withHttpHealthCheck(options?: WithHttpHealthCheckOptions): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpHealthCheck(options))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withHttpHealthCheck(options))); } /** Adds an HTTP health probe to the resource */ withHttpProbe(probeType: ProbeType, options?: WithHttpProbeOptions): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.withHttpProbe(probeType, options))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.withHttpProbe(probeType, options))); } /** Subscribes to the ResourceEndpointsAllocated event */ onResourceEndpointsAllocated(callback: (arg: ResourceEndpointsAllocatedEvent) => Promise): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); + return new ResourceWithEndpointsPromiseImpl(this._promise.then(obj => obj.onResourceEndpointsAllocated(callback))); } } @@ -27277,7 +30493,54 @@ export class ResourceWithEndpointsPromise implements PromiseLike { +export interface ResourceWithEnvironment { + toJSON(): MarshalledHandle; + withOtlpExporter(): ResourceWithEnvironmentPromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise; + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ResourceWithEnvironmentPromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ResourceWithEnvironmentPromise; + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise; + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise; + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise; + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise; + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise; + withoutHttpsCertificate(): ResourceWithEnvironmentPromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ResourceWithEnvironmentPromise; + withEnvironmentVariables(variables: Record): ResourceWithEnvironmentPromise; +} + +export interface ResourceWithEnvironmentPromise extends PromiseLike { + withOtlpExporter(): ResourceWithEnvironmentPromise; + withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise; + withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise; + withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise; + withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise; + withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise; + withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise; + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ResourceWithEnvironmentPromise; + withReference(source: HandleReference, options?: WithReferenceOptions): ResourceWithEnvironmentPromise; + withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise; + withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise; + withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise; + withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise; + withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise; + withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise; + withoutHttpsCertificate(): ResourceWithEnvironmentPromise; + testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ResourceWithEnvironmentPromise; + withEnvironmentVariables(variables: Record): ResourceWithEnvironmentPromise; +} + +// ============================================================================ +// ResourceWithEnvironmentImpl +// ============================================================================ + +class ResourceWithEnvironmentImpl extends ResourceBuilderBase implements ResourceWithEnvironment { constructor(handle: IResourceWithEnvironmentHandle, client: AspireClientRpc) { super(handle, client); } @@ -27289,12 +30552,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (objData: unknown) => { const objHandle = wrapIfHandle(objData) as EnvironmentCallbackContextHandle; - const obj = new EnvironmentCallbackContext(objHandle, this._client); + const obj = new EnvironmentCallbackContextImpl(objHandle, this._client); await callback(obj); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -27354,12 +30617,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -27369,12 +30632,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { + private async _withEnvironmentConnectionStringInternal(envVarName: string, resource: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, envVarName, resource }; const result = await this._client.invokeCapability( 'Aspire.Hosting/withEnvironmentConnectionString', rpcArgs ); - return new ResourceWithEnvironment(result, this._client); + return new ResourceWithEnvironmentImpl(result, this._client); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentConnectionStringInternal(envVarName, resource)); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentConnectionStringInternal(envVarName, resource)); } /** @internal */ - private async _withReferenceInternal(source: ResourceBuilderBase, connectionName?: string, optional?: boolean, name?: string): Promise { + private async _withReferenceInternal(source: HandleReference, connectionName?: string, optional?: boolean, name?: string): Promise { const rpcArgs: Record = { builder: this._handle, source }; if (connectionName !== undefined) rpcArgs.connectionName = connectionName; if (optional !== undefined) rpcArgs.optional = optional; @@ -27417,15 +30680,15 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): Promise { const callbackId = registerCallback(async (argData: unknown) => { const argHandle = wrapIfHandle(argData) as TestEnvironmentContextHandle; - const arg = new TestEnvironmentContext(argHandle, this._client); + const arg = new TestEnvironmentContextImpl(argHandle, this._client); await callback(arg); }); const rpcArgs: Record = { builder: this._handle, callback: callbackId }; @@ -27547,12 +30810,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ResourceWithEnvironmentPromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -27562,12 +30825,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentVariablesInternal(variables)); + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentVariablesInternal(variables)); } } @@ -27577,7 +30840,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { +class ResourceWithEnvironmentPromiseImpl implements ResourceWithEnvironmentPromise { constructor(private _promise: Promise) {} then( @@ -27589,92 +30852,92 @@ export class ResourceWithEnvironmentPromise implements PromiseLike obj.withOtlpExporter())); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withOtlpExporter())); } /** Configures OTLP telemetry export with specific protocol */ withOtlpExporterProtocol(protocol: OtlpProtocol): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withOtlpExporterProtocol(protocol))); } /** Sets an environment variable */ withEnvironment(name: string, value: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironment(name, value))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironment(name, value))); } /** Adds an environment variable with a reference expression */ withEnvironmentExpression(name: string, value: ReferenceExpression): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentExpression(name, value))); } /** Sets environment variables via callback */ withEnvironmentCallback(callback: (obj: EnvironmentCallbackContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentCallback(callback))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentCallback(callback))); } /** Sets an environment variable from an endpoint reference */ withEnvironmentEndpoint(name: string, endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentEndpoint(name, endpointReference))); } /** Sets an environment variable from a parameter resource */ withEnvironmentParameter(name: string, parameter: ParameterResource): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentParameter(name, parameter))); } /** Sets an environment variable from a connection string resource */ - withEnvironmentConnectionString(envVarName: string, resource: ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); + withEnvironmentConnectionString(envVarName: string, resource: HandleReference): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentConnectionString(envVarName, resource))); } /** Adds a reference to another resource */ - withReference(source: ResourceBuilderBase, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReference(source, options))); + withReference(source: HandleReference, options?: WithReferenceOptions): ResourceWithEnvironmentPromise { + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withReference(source, options))); } /** Adds a reference to a URI */ withReferenceUri(name: string, uri: string): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceUri(name, uri))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withReferenceUri(name, uri))); } /** Adds a reference to an external service */ withReferenceExternalService(externalService: ExternalServiceResource): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceExternalService(externalService))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withReferenceExternalService(externalService))); } /** Adds a reference to an endpoint */ withReferenceEndpoint(endpointReference: EndpointReference): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withReferenceEndpoint(endpointReference))); } /** Configures developer certificate trust */ withDeveloperCertificateTrust(trust: boolean): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withDeveloperCertificateTrust(trust))); } /** Sets the certificate trust scope */ withCertificateTrustScope(scope: CertificateTrustScope): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withCertificateTrustScope(scope))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withCertificateTrustScope(scope))); } /** Configures HTTPS with a developer certificate */ withHttpsDeveloperCertificate(options?: WithHttpsDeveloperCertificateOptions): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withHttpsDeveloperCertificate(options))); } /** Removes HTTPS certificate configuration */ withoutHttpsCertificate(): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withoutHttpsCertificate())); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withoutHttpsCertificate())); } /** Configures environment with callback (test version) */ testWithEnvironmentCallback(callback: (arg: TestEnvironmentContext) => Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.testWithEnvironmentCallback(callback))); } /** Sets environment variables */ withEnvironmentVariables(variables: Record): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._promise.then(obj => obj.withEnvironmentVariables(variables))); + return new ResourceWithEnvironmentPromiseImpl(this._promise.then(obj => obj.withEnvironmentVariables(variables))); } } @@ -27683,86 +30946,107 @@ export class ResourceWithEnvironmentPromise implements PromiseLike { +export interface ResourceWithWaitSupport { + toJSON(): MarshalledHandle; + waitFor(dependency: HandleReference): ResourceWithWaitSupportPromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise; + waitForStart(dependency: HandleReference): ResourceWithWaitSupportPromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise; +} + +export interface ResourceWithWaitSupportPromise extends PromiseLike { + waitFor(dependency: HandleReference): ResourceWithWaitSupportPromise; + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise; + waitForStart(dependency: HandleReference): ResourceWithWaitSupportPromise; + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise; + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise; +} + +// ============================================================================ +// ResourceWithWaitSupportImpl +// ============================================================================ + +class ResourceWithWaitSupportImpl extends ResourceBuilderBase implements ResourceWithWaitSupport { constructor(handle: IResourceWithWaitSupportHandle, client: AspireClientRpc) { super(handle, client); } /** @internal */ - private async _waitForInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitFor', rpcArgs ); - return new ResourceWithWaitSupport(result, this._client); + return new ResourceWithWaitSupportImpl(result, this._client); } /** Waits for another resource to be ready */ - waitFor(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._waitForInternal(dependency)); + waitFor(dependency: HandleReference): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._waitForInternal(dependency)); } /** @internal */ - private async _waitForWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForWithBehavior', rpcArgs ); - return new ResourceWithWaitSupport(result, this._client); + return new ResourceWithWaitSupportImpl(result, this._client); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._waitForWithBehaviorInternal(dependency, waitBehavior)); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._waitForWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForStartInternal(dependency: ResourceBuilderBase): Promise { + private async _waitForStartInternal(dependency: HandleReference): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStart', rpcArgs ); - return new ResourceWithWaitSupport(result, this._client); + return new ResourceWithWaitSupportImpl(result, this._client); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._waitForStartInternal(dependency)); + waitForStart(dependency: HandleReference): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._waitForStartInternal(dependency)); } /** @internal */ - private async _waitForStartWithBehaviorInternal(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): Promise { + private async _waitForStartWithBehaviorInternal(dependency: HandleReference, waitBehavior: WaitBehavior): Promise { const rpcArgs: Record = { builder: this._handle, dependency, waitBehavior }; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForStartWithBehavior', rpcArgs ); - return new ResourceWithWaitSupport(result, this._client); + return new ResourceWithWaitSupportImpl(result, this._client); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._waitForStartWithBehaviorInternal(dependency, waitBehavior)); } /** @internal */ - private async _waitForCompletionInternal(dependency: ResourceBuilderBase, exitCode?: number): Promise { + private async _waitForCompletionInternal(dependency: HandleReference, exitCode?: number): Promise { const rpcArgs: Record = { builder: this._handle, dependency }; if (exitCode !== undefined) rpcArgs.exitCode = exitCode; const result = await this._client.invokeCapability( 'Aspire.Hosting/waitForCompletion', rpcArgs ); - return new ResourceWithWaitSupport(result, this._client); + return new ResourceWithWaitSupportImpl(result, this._client); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { const exitCode = options?.exitCode; - return new ResourceWithWaitSupportPromise(this._waitForCompletionInternal(dependency, exitCode)); + return new ResourceWithWaitSupportPromiseImpl(this._waitForCompletionInternal(dependency, exitCode)); } } @@ -27772,7 +31056,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { +class ResourceWithWaitSupportPromiseImpl implements ResourceWithWaitSupportPromise { constructor(private _promise: Promise) {} then( @@ -27783,28 +31067,28 @@ export class ResourceWithWaitSupportPromise implements PromiseLike obj.waitFor(dependency))); + waitFor(dependency: HandleReference): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._promise.then(obj => obj.waitFor(dependency))); } /** Waits for another resource with specific behavior */ - waitForWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); + waitForWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._promise.then(obj => obj.waitForWithBehavior(dependency, waitBehavior))); } /** Waits for another resource to start */ - waitForStart(dependency: ResourceBuilderBase): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStart(dependency))); + waitForStart(dependency: HandleReference): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._promise.then(obj => obj.waitForStart(dependency))); } /** Waits for another resource to start with specific behavior */ - waitForStartWithBehavior(dependency: ResourceBuilderBase, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); + waitForStartWithBehavior(dependency: HandleReference, waitBehavior: WaitBehavior): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._promise.then(obj => obj.waitForStartWithBehavior(dependency, waitBehavior))); } /** Waits for resource completion */ - waitForCompletion(dependency: ResourceBuilderBase, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { - return new ResourceWithWaitSupportPromise(this._promise.then(obj => obj.waitForCompletion(dependency, options))); + waitForCompletion(dependency: HandleReference, options?: WaitForCompletionOptions): ResourceWithWaitSupportPromise { + return new ResourceWithWaitSupportPromiseImpl(this._promise.then(obj => obj.waitForCompletion(dependency, options))); } } @@ -27826,7 +31110,7 @@ export async function connect(): Promise { ); } - const client = new AspireClientRpc(socketPath); + const client = new AspireClient(socketPath); await client.connect(); // Exit the process if the server connection is lost @@ -27868,12 +31152,13 @@ export async function createBuilder(options?: CreateBuilderOptions): Promise { // ============================================================================ // Register wrapper factories for typed handle wrapping in callbacks -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEvent(handle as AfterResourcesCreatedEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEvent(handle as BeforeResourceStartedEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEvent(handle as BeforeStartEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContext(handle as CommandLineArgsCallbackContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEvent(handle as ConnectionStringAvailableEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplication(handle as DistributedApplicationHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContext(handle as DistributedApplicationExecutionContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModel(handle as DistributedApplicationModelHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReference(handle as EndpointReferenceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpression(handle as EndpointReferenceExpressionHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContext(handle as EnvironmentCallbackContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContext(handle as ExecuteCommandContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEvent(handle as InitializeResourceEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContext(handle as PipelineConfigurationContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContext(handle as PipelineContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStep(handle as PipelineStepHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContext(handle as PipelineStepContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContext(handle as PipelineStepFactoryContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummary(handle as PipelineSummaryHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptions(handle as ProjectResourceOptionsHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilder(handle as ReferenceExpressionBuilderHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEvent(handle as ResourceEndpointsAllocatedEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerService(handle as ResourceLoggerServiceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationService(handle as ResourceNotificationServiceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEvent(handle as ResourceReadyEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEvent(handle as ResourceStoppedEventHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContext(handle as ResourceUrlsCallbackContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext', (handle, client) => new TestCallbackContext(handle as TestCallbackContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext', (handle, client) => new TestCollectionContext(handle as TestCollectionContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext', (handle, client) => new TestEnvironmentContext(handle as TestEnvironmentContextHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext', (handle, client) => new TestResourceContext(handle as TestResourceContextHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContext(handle as UpdateCommandStateContextHandle, client)); -registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new Configuration(handle as IConfigurationHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilder(handle as IDistributedApplicationBuilderHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventing(handle as IDistributedApplicationEventingHandle, client)); -registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironment(handle as IHostEnvironmentHandle, client)); -registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new Logger(handle as ILoggerHandle, client)); -registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactory(handle as ILoggerFactoryHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStep(handle as IReportingStepHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTask(handle as IReportingTaskHandle, client)); -registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProvider(handle as IServiceProviderHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManager(handle as IUserSecretsManagerHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResource(handle as ConnectionStringResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResource(handle as ContainerRegistryResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResource(handle as ContainerResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResource(handle as CSharpAppResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResource(handle as DotnetToolResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResource(handle as ExecutableResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResource(handle as ExternalServiceResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResource(handle as ParameterResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResource(handle as ProjectResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource', (handle, client) => new TestDatabaseResource(handle as TestDatabaseResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource', (handle, client) => new TestRedisResource(handle as TestRedisResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource', (handle, client) => new TestVaultResource(handle as TestVaultResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResource(handle as IComputeResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResource(handle as IContainerFilesDestinationResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new Resource(handle as IResourceHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgs(handle as IResourceWithArgsHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionString(handle as IResourceWithConnectionStringHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFiles(handle as IResourceWithContainerFilesHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpoints(handle as IResourceWithEndpointsHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironment(handle as IResourceWithEnvironmentHandle, client)); -registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupport(handle as IResourceWithWaitSupportHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent', (handle, client) => new AfterResourcesCreatedEventImpl(handle as AfterResourcesCreatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent', (handle, client) => new BeforeResourceStartedEventImpl(handle as BeforeResourceStartedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent', (handle, client) => new BeforeStartEventImpl(handle as BeforeStartEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext', (handle, client) => new CommandLineArgsCallbackContextImpl(handle as CommandLineArgsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent', (handle, client) => new ConnectionStringAvailableEventImpl(handle as ConnectionStringAvailableEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplication', (handle, client) => new DistributedApplicationImpl(handle as DistributedApplicationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext', (handle, client) => new DistributedApplicationExecutionContextImpl(handle as DistributedApplicationExecutionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel', (handle, client) => new DistributedApplicationModelImpl(handle as DistributedApplicationModelHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference', (handle, client) => new EndpointReferenceImpl(handle as EndpointReferenceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression', (handle, client) => new EndpointReferenceExpressionImpl(handle as EndpointReferenceExpressionHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext', (handle, client) => new EnvironmentCallbackContextImpl(handle as EnvironmentCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext', (handle, client) => new ExecuteCommandContextImpl(handle as ExecuteCommandContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent', (handle, client) => new InitializeResourceEventImpl(handle as InitializeResourceEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext', (handle, client) => new PipelineConfigurationContextImpl(handle as PipelineConfigurationContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext', (handle, client) => new PipelineContextImpl(handle as PipelineContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep', (handle, client) => new PipelineStepImpl(handle as PipelineStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext', (handle, client) => new PipelineStepContextImpl(handle as PipelineStepContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext', (handle, client) => new PipelineStepFactoryContextImpl(handle as PipelineStepFactoryContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary', (handle, client) => new PipelineSummaryImpl(handle as PipelineSummaryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions', (handle, client) => new ProjectResourceOptionsImpl(handle as ProjectResourceOptionsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder', (handle, client) => new ReferenceExpressionBuilderImpl(handle as ReferenceExpressionBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent', (handle, client) => new ResourceEndpointsAllocatedEventImpl(handle as ResourceEndpointsAllocatedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService', (handle, client) => new ResourceLoggerServiceImpl(handle as ResourceLoggerServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService', (handle, client) => new ResourceNotificationServiceImpl(handle as ResourceNotificationServiceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent', (handle, client) => new ResourceReadyEventImpl(handle as ResourceReadyEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent', (handle, client) => new ResourceStoppedEventImpl(handle as ResourceStoppedEventHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext', (handle, client) => new ResourceUrlsCallbackContextImpl(handle as ResourceUrlsCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext', (handle, client) => new TestCallbackContextImpl(handle as TestCallbackContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext', (handle, client) => new TestCollectionContextImpl(handle as TestCollectionContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext', (handle, client) => new TestEnvironmentContextImpl(handle as TestEnvironmentContextHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext', (handle, client) => new TestResourceContextImpl(handle as TestResourceContextHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext', (handle, client) => new UpdateCommandStateContextImpl(handle as UpdateCommandStateContextHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration', (handle, client) => new ConfigurationImpl(handle as IConfigurationHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder', (handle, client) => new DistributedApplicationBuilderImpl(handle as IDistributedApplicationBuilderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing', (handle, client) => new DistributedApplicationEventingImpl(handle as IDistributedApplicationEventingHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment', (handle, client) => new HostEnvironmentImpl(handle as IHostEnvironmentHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger', (handle, client) => new LoggerImpl(handle as ILoggerHandle, client)); +registerHandleWrapper('Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory', (handle, client) => new LoggerFactoryImpl(handle as ILoggerFactoryHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep', (handle, client) => new ReportingStepImpl(handle as IReportingStepHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask', (handle, client) => new ReportingTaskImpl(handle as IReportingTaskHandle, client)); +registerHandleWrapper('System.ComponentModel/System.IServiceProvider', (handle, client) => new ServiceProviderImpl(handle as IServiceProviderHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IUserSecretsManager', (handle, client) => new UserSecretsManagerImpl(handle as IUserSecretsManagerHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ConnectionStringResource', (handle, client) => new ConnectionStringResourceImpl(handle as ConnectionStringResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource', (handle, client) => new ContainerRegistryResourceImpl(handle as ContainerRegistryResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource', (handle, client) => new ContainerResourceImpl(handle as ContainerResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource', (handle, client) => new CSharpAppResourceImpl(handle as CSharpAppResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource', (handle, client) => new DotnetToolResourceImpl(handle as DotnetToolResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource', (handle, client) => new ExecutableResourceImpl(handle as ExecutableResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ExternalServiceResource', (handle, client) => new ExternalServiceResourceImpl(handle as ExternalServiceResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource', (handle, client) => new ParameterResourceImpl(handle as ParameterResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource', (handle, client) => new ProjectResourceImpl(handle as ProjectResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource', (handle, client) => new TestDatabaseResourceImpl(handle as TestDatabaseResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource', (handle, client) => new TestRedisResourceImpl(handle as TestRedisResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting.CodeGeneration.TypeScript.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource', (handle, client) => new TestVaultResourceImpl(handle as TestVaultResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource', (handle, client) => new ComputeResourceImpl(handle as IComputeResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource', (handle, client) => new ContainerFilesDestinationResourceImpl(handle as IContainerFilesDestinationResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource', (handle, client) => new ResourceImpl(handle as IResourceHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs', (handle, client) => new ResourceWithArgsImpl(handle as IResourceWithArgsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString', (handle, client) => new ResourceWithConnectionStringImpl(handle as IResourceWithConnectionStringHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles', (handle, client) => new ResourceWithContainerFilesImpl(handle as IResourceWithContainerFilesHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints', (handle, client) => new ResourceWithEndpointsImpl(handle as IResourceWithEndpointsHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment', (handle, client) => new ResourceWithEnvironmentImpl(handle as IResourceWithEnvironmentHandle, client)); +registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport', (handle, client) => new ResourceWithWaitSupportImpl(handle as IResourceWithWaitSupportHandle, client)); diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/WithDataVolumeOptionsMerged.verified.ts b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/WithDataVolumeOptionsMerged.verified.ts index 0fab5cb4e64..81e32543081 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/WithDataVolumeOptionsMerged.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/WithDataVolumeOptionsMerged.verified.ts @@ -1,4 +1,4 @@ -export interface WithDataVolumeOptions { +export interface WithDataVolumeOptions { name?: string; isReadOnly?: boolean; } \ No newline at end of file diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts index b3d8b8be98c..8d7033494fb 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts @@ -1,5 +1,6 @@ // base.ts - Core Aspire types: base classes, ReferenceExpression import { Handle, AspireClient, MarshalledHandle, CancellationToken, registerCancellation, registerHandleWrapper, unregisterCancellation } from './transport.js'; +import type { AspireClientRpc } from './transport.js'; // Re-export transport types for convenience export { Handle, AspireClient, CapabilityError, CancellationToken, registerCallback, unregisterCallback, registerCancellation, unregisterCancellation } from './transport.js'; @@ -38,49 +39,59 @@ export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './t * await api.withEnvironment("REDIS_URL", expr); * ``` */ -export class ReferenceExpression { - // Expression mode fields - private readonly _format?: string; - private readonly _valueProviders?: unknown[]; - - // Conditional mode fields - private readonly _condition?: unknown; - private readonly _whenTrue?: ReferenceExpression; - private readonly _whenFalse?: ReferenceExpression; - private readonly _matchValue?: string; - - // Handle mode fields (when wrapping a server-returned handle) - private readonly _handle?: Handle; - private readonly _client?: AspireClient; +const referenceExpressionState = new WeakMap(); +export class ReferenceExpression { constructor(format: string, valueProviders: unknown[]); - constructor(handle: Handle, client: AspireClient); + constructor(handle: Handle, client: AspireClientRpc); constructor(condition: unknown, matchValue: string, whenTrue: ReferenceExpression, whenFalse: ReferenceExpression); constructor( handleOrFormatOrCondition: Handle | string | unknown, - clientOrValueProvidersOrMatchValue: AspireClient | unknown[] | string, + clientOrValueProvidersOrMatchValue: AspireClientRpc | unknown[] | string, whenTrueOrWhenFalse?: ReferenceExpression, whenFalse?: ReferenceExpression ) { + const state: { + format?: string; + valueProviders?: unknown[]; + condition?: unknown; + whenTrue?: ReferenceExpression; + whenFalse?: ReferenceExpression; + matchValue?: string; + handle?: Handle; + client?: AspireClientRpc; + } = {}; + if (typeof handleOrFormatOrCondition === 'string') { - this._format = handleOrFormatOrCondition; - this._valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; - } else if (handleOrFormatOrCondition instanceof Handle) { - this._handle = handleOrFormatOrCondition; - this._client = clientOrValueProvidersOrMatchValue as AspireClient; + state.format = handleOrFormatOrCondition; + state.valueProviders = clientOrValueProvidersOrMatchValue as unknown[]; + } else if (isHandleLike(handleOrFormatOrCondition)) { + state.handle = handleOrFormatOrCondition; + state.client = clientOrValueProvidersOrMatchValue as AspireClientRpc; } else { - this._condition = handleOrFormatOrCondition; - this._matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; - this._whenTrue = whenTrueOrWhenFalse; - this._whenFalse = whenFalse; + state.condition = handleOrFormatOrCondition; + state.matchValue = (clientOrValueProvidersOrMatchValue as string) ?? 'True'; + state.whenTrue = whenTrueOrWhenFalse; + state.whenFalse = whenFalse; } + + referenceExpressionState.set(this, state); } /** * Gets whether this reference expression is conditional. */ get isConditional(): boolean { - return this._condition !== undefined; + return referenceExpressionState.get(this)?.condition !== undefined; } /** @@ -90,40 +101,6 @@ export class ReferenceExpression { * @param values - The interpolated values (handles to value providers) * @returns A ReferenceExpression instance */ - static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { - // Build the format string with {0}, {1}, etc. placeholders - let format = ''; - for (let i = 0; i < strings.length; i++) { - format += strings[i]; - if (i < values.length) { - format += `{${i}}`; - } - } - - // Extract handles from values - const valueProviders = values.map(extractHandleForExpr); - - return new ReferenceExpression(format, valueProviders); - } - - /** - * Creates a conditional reference expression from its constituent parts. - * - * @param condition - A value provider whose result is compared to matchValue - * @param whenTrue - The expression to use when the condition matches - * @param whenFalse - The expression to use when the condition does not match - * @param matchValue - The value to compare the condition against (defaults to "True") - * @returns A ReferenceExpression instance in conditional mode - */ - static createConditional( - condition: unknown, - matchValue: string, - whenTrue: ReferenceExpression, - whenFalse: ReferenceExpression - ): ReferenceExpression { - return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); - } - /** * Serializes the reference expression for JSON-RPC transport. * In expression mode, uses the $expr format with format + valueProviders. @@ -131,25 +108,27 @@ export class ReferenceExpression { * In handle mode, delegates to the handle's serialization. */ toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle { - if (this._handle) { - return this._handle.toJSON(); + const state = referenceExpressionState.get(this)!; + + if (state.handle) { + return state.handle.toJSON(); } if (this.isConditional) { return { $expr: { - condition: extractHandleForExpr(this._condition), - whenTrue: this._whenTrue!.toJSON(), - whenFalse: this._whenFalse!.toJSON(), - matchValue: this._matchValue! + condition: extractHandleForExpr(state.condition), + whenTrue: state.whenTrue!.toJSON(), + whenFalse: state.whenFalse!.toJSON(), + matchValue: state.matchValue! } }; } return { $expr: { - format: this._format!, - valueProviders: this._valueProviders && this._valueProviders.length > 0 ? this._valueProviders : undefined + format: state.format!, + valueProviders: state.valueProviders && state.valueProviders.length > 0 ? state.valueProviders : undefined } }; } @@ -162,14 +141,16 @@ export class ReferenceExpression { * @returns The resolved string value, or null if the expression resolves to null */ async getValue(cancellationToken?: AbortSignal | CancellationToken): Promise { - if (!this._handle || !this._client) { + const state = referenceExpressionState.get(this)!; + + if (!state.handle || !state.client) { throw new Error('getValue is only available on server-returned ReferenceExpression instances'); } - const cancellationTokenId = registerCancellation(this._client, cancellationToken); + const cancellationTokenId = registerCancellation(state.client, cancellationToken); try { - const rpcArgs: Record = { context: this._handle }; + const rpcArgs: Record = { context: state.handle }; if (cancellationTokenId !== undefined) rpcArgs.cancellationToken = cancellationTokenId; - return await this._client.invokeCapability( + return await state.client.invokeCapability( 'Aspire.Hosting.ApplicationModel/getValue', rpcArgs ); @@ -182,16 +163,84 @@ export class ReferenceExpression { * String representation for debugging. */ toString(): string { - if (this._handle) { + const state = referenceExpressionState.get(this)!; + + if (state.handle) { return `ReferenceExpression(handle)`; } if (this.isConditional) { return `ReferenceExpression(conditional)`; } - return `ReferenceExpression(${this._format})`; + return `ReferenceExpression(${state.format})`; + } + + static create(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + return createReferenceExpression(strings, ...values); + } + + static createConditional( + condition: unknown, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression; + static createConditional( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression + ): ReferenceExpression; + static createConditional( + condition: unknown, + matchValueOrWhenTrue: string | ReferenceExpression, + whenTrueOrWhenFalse: ReferenceExpression, + whenFalse?: ReferenceExpression + ): ReferenceExpression { + if (typeof matchValueOrWhenTrue === 'string') { + return createConditionalReferenceExpression(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse, whenFalse!); + } + + return createConditionalReferenceExpression(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse); } } +function createReferenceExpression(strings: TemplateStringsArray, ...values: unknown[]): ReferenceExpression { + let format = ''; + for (let i = 0; i < strings.length; i++) { + format += strings[i]; + if (i < values.length) { + format += `{${i}}`; + } + } + + const valueProviders = values.map(extractHandleForExpr); + + return new ReferenceExpression(format, valueProviders); +} + +function createConditionalReferenceExpression( + condition: unknown, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression +): ReferenceExpression; +function createConditionalReferenceExpression( + condition: unknown, + matchValue: string, + whenTrue: ReferenceExpression, + whenFalse: ReferenceExpression +): ReferenceExpression; +function createConditionalReferenceExpression( + condition: unknown, + matchValueOrWhenTrue: string | ReferenceExpression, + whenTrueOrWhenFalse: ReferenceExpression, + whenFalse?: ReferenceExpression +): ReferenceExpression { + if (typeof matchValueOrWhenTrue === 'string') { + return new ReferenceExpression(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse, whenFalse!); + } + + return new ReferenceExpression(condition, 'True', matchValueOrWhenTrue, whenTrueOrWhenFalse); +} + registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => new ReferenceExpression(handle, client) ); @@ -217,7 +266,7 @@ function extractHandleForExpr(value: unknown): unknown { } // Handle objects - get their JSON representation - if (value instanceof Handle) { + if (isHandleLike(value)) { return value.toJSON(); } @@ -240,6 +289,19 @@ function extractHandleForExpr(value: unknown): unknown { ); } +function isHandleLike(value: unknown): value is Handle { + return ( + value !== null && + typeof value === 'object' && + '$handle' in value && + typeof (value as { $handle?: unknown }).$handle === 'string' && + '$type' in value && + typeof (value as { $type?: unknown }).$type === 'string' && + 'toJSON' in value && + typeof (value as { toJSON?: unknown }).toJSON === 'function' + ); +} + /** * Tagged template function for creating reference expressions. * @@ -266,12 +328,16 @@ export function refExpr(strings: TemplateStringsArray, ...values: unknown[]): Re // ResourceBuilderBase // ============================================================================ +export interface HandleReference { + toJSON(): MarshalledHandle; +} + /** * Base class for resource builders (e.g., RedisBuilder, ContainerBuilder). * Provides handle management and JSON serialization. */ -export class ResourceBuilderBase { - constructor(protected _handle: THandle, protected _client: AspireClient) {} +export class ResourceBuilderBase implements HandleReference { + constructor(protected _handle: THandle, protected _client: AspireClientRpc) {} toJSON(): MarshalledHandle { return this._handle.toJSON(); } } @@ -292,13 +358,24 @@ export class ResourceBuilderBase { * await items.add(newItem); * ``` */ -export class AspireList { +export type AspireList = { + count(): Promise; + get(index: number): Promise; + add(item: T): Promise; + removeAt(index: number): Promise; + clear(): Promise; + toArray(): Promise; + toTransportValue(): Promise; + toJSON(): MarshalledHandle; +}; + +class AspireListImpl implements AspireList { private _resolvedHandle?: Handle; private _resolvePromise?: Promise; constructor( private readonly _handleOrContext: Handle, - private readonly _client: AspireClient, + private readonly _client: AspireClientRpc, private readonly _typeId: string, private readonly _getterCapabilityId?: string ) { @@ -409,6 +486,8 @@ export class AspireList { } } +export const AspireList = AspireListImpl; + // ============================================================================ // AspireDict - Mutable Dictionary Wrapper // ============================================================================ @@ -425,13 +504,27 @@ export class AspireList { * const hasKey = await config.containsKey("key"); * ``` */ -export class AspireDict { +export type AspireDict = { + count(): Promise; + get(key: K): Promise; + set(key: K, value: V): Promise; + containsKey(key: K): Promise; + remove(key: K): Promise; + clear(): Promise; + keys(): Promise; + values(): Promise; + toObject(): Promise>; + toTransportValue(): Promise; + toJSON(): MarshalledHandle; +}; + +class AspireDictImpl implements AspireDict { private _resolvedHandle?: Handle; private _resolvePromise?: Promise; constructor( private readonly _handleOrContext: Handle, - private readonly _client: AspireClient, + private readonly _client: AspireClientRpc, private readonly _typeId: string, private readonly _getterCapabilityId?: string ) { @@ -576,3 +669,5 @@ export class AspireDict { return this._resolvedHandle.toJSON(); } } + +export const AspireDict = AspireDictImpl; diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/transport.verified.ts b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/transport.verified.ts index 3df2a47d497..148ffe057ef 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/transport.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/transport.verified.ts @@ -1,4 +1,4 @@ -// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks +// transport.ts - ATS transport layer: RPC, Handle, errors, callbacks import * as net from 'net'; import * as rpc from 'vscode-jsonrpc/node.js'; @@ -6,11 +6,21 @@ import * as rpc from 'vscode-jsonrpc/node.js'; // Base Types // ============================================================================ +/** + * Structural client surface used by generated wrappers and transport helpers. + * This keeps generated types assignable across separately restored SDK copies. + */ +export interface AspireClientRpc { + readonly connected: boolean; + invokeCapability(capabilityId: string, args?: Record): Promise; + cancelToken(cancellationId: string): Promise; +} + /** * Type for callback functions that can be registered and invoked from .NET. * Internal: receives args and client for handle wrapping. */ -export type CallbackFunction = (args: unknown, client: AspireClient) => unknown | Promise; +export type CallbackFunction = (args: unknown, client: AspireClientRpc) => unknown | Promise; /** * Represents a handle to a .NET object in the ATS system. @@ -104,6 +114,17 @@ function isAbortSignal(value: unknown): value is AbortSignal { ); } +function isCancellationTokenLike(value: unknown): value is CancellationToken { + return ( + value !== null && + typeof value === 'object' && + 'register' in value && + typeof (value as { register?: unknown }).register === 'function' && + 'toJSON' in value && + typeof (value as { toJSON?: unknown }).toJSON === 'function' + ); +} + function isPlainObject(value: unknown): value is Record { if (value === null || typeof value !== 'object') { return false; @@ -146,35 +167,25 @@ function createCircularReferenceError(capabilityId: string, path: string): AppHo * @typeParam T - The ATS type ID (e.g., "Aspire.Hosting/IDistributedApplicationBuilder") */ export class Handle { - private readonly _handleId: string; - private readonly _typeId: T; + readonly $handle: string; + readonly $type: T; constructor(marshalled: MarshalledHandle) { - this._handleId = marshalled.$handle; - this._typeId = marshalled.$type as T; - } - - /** The handle ID (instance number) */ - get $handle(): string { - return this._handleId; - } - - /** The ATS type ID */ - get $type(): T { - return this._typeId; + this.$handle = marshalled.$handle; + this.$type = marshalled.$type as T; } /** Serialize for JSON-RPC transport */ toJSON(): MarshalledHandle { return { - $handle: this._handleId, - $type: this._typeId + $handle: this.$handle, + $type: this.$type }; } /** String representation for debugging */ toString(): string { - return `Handle<${this._typeId}>(${this._handleId})`; + return `Handle<${this.$type}>(${this.$handle})`; } } @@ -205,23 +216,48 @@ export class Handle { * const connectionString = await connectionStringExpression.getValue(cancellationToken); * ``` */ -export class CancellationToken { - private readonly _signal?: AbortSignal; - private readonly _remoteTokenId?: string; +const cancellationTokenState = new WeakMap(); +export class CancellationToken { constructor(signal?: AbortSignal); constructor(tokenId?: string); constructor(value?: AbortSignal | string | null) { + const state: { signal?: AbortSignal; remoteTokenId?: string } = {}; + if (typeof value === 'string') { - this._remoteTokenId = value; + state.remoteTokenId = value; } else if (isAbortSignal(value)) { - this._signal = value; + state.signal = value; } + + cancellationTokenState.set(this, state); } /** * Creates a cancellation token from a local {@link AbortSignal}. */ + toJSON(): string | undefined { + return cancellationTokenState.get(this)?.remoteTokenId; + } + + register(client?: AspireClientRpc): string | undefined { + const state = cancellationTokenState.get(this); + + if (state?.remoteTokenId !== undefined) { + return state.remoteTokenId; + } + + return client + ? registerCancellation(client, state?.signal) + : registerCancellation(state?.signal); + } + + /** + * Creates transport-safe cancellation token values for the generated SDK. + */ static from(signal?: AbortSignal): CancellationToken { return new CancellationToken(signal); } @@ -231,7 +267,7 @@ export class CancellationToken { * Generated code uses this to materialize values that come from the AppHost. */ static fromValue(value: unknown): CancellationToken { - if (value instanceof CancellationToken) { + if (isCancellationTokenLike(value)) { return value; } @@ -245,23 +281,6 @@ export class CancellationToken { return new CancellationToken(); } - - /** - * Serializes the token for JSON-RPC transport. - */ - toJSON(): string | undefined { - return this._remoteTokenId; - } - - register(client?: AspireClient): string | undefined { - if (this._remoteTokenId !== undefined) { - return this._remoteTokenId; - } - - return client - ? registerCancellation(client, this._signal) - : registerCancellation(this._signal); - } } // ============================================================================ @@ -271,7 +290,7 @@ export class CancellationToken { /** * Factory function for creating typed wrapper instances from handles. */ -export type HandleWrapperFactory = (handle: Handle, client: AspireClient) => unknown; +export type HandleWrapperFactory = (handle: Handle, client: AspireClientRpc) => unknown; /** * Registry of handle wrapper factories by type ID. @@ -294,7 +313,7 @@ export function registerHandleWrapper(typeId: string, factory: HandleWrapperFact * @param value - The value to potentially wrap * @param client - Optional client for creating typed wrapper instances */ -export function wrapIfHandle(value: unknown, client?: AspireClient): unknown { +export function wrapIfHandle(value: unknown, client?: AspireClientRpc): unknown { if (isMarshalledHandle(value)) { const handle = new Handle(value); const typeId = value.$type; @@ -456,7 +475,7 @@ export function registerCallback( const callbackId = `callback_${++callbackIdCounter}_${Date.now()}`; // Wrap the callback to handle .NET's positional argument format - const wrapper: CallbackFunction = async (args: unknown, client: AspireClient) => { + const wrapper: CallbackFunction = async (args: unknown, client: AspireClientRpc) => { // .NET sends args as object { p0: value0, p1: value1, ... } if (args && typeof args === 'object' && !Array.isArray(args)) { const argObj = args as Record; @@ -537,7 +556,7 @@ const cancellationRegistry = new Map void>(); let cancellationIdCounter = 0; const connectedClients = new Set(); -function resolveCancellationClient(client?: AspireClient): AspireClient { +function resolveCancellationClient(client?: AspireClientRpc): AspireClientRpc { if (client) { return client; } @@ -559,6 +578,22 @@ function resolveCancellationClient(client?: AspireClient): AspireClient { ); } +function isAspireClientLike(value: unknown): value is AspireClientRpc { + if (!value || typeof value !== 'object') { + return false; + } + + const candidate = value as { + invokeCapability?: unknown; + cancelToken?: unknown; + connected?: unknown; + }; + + return typeof candidate.invokeCapability === 'function' + && typeof candidate.cancelToken === 'function' + && typeof candidate.connected === 'boolean'; +} + /** * Registers cancellation support for a local signal or SDK cancellation token. * Returns a cancellation ID that should be passed to methods accepting cancellation input. @@ -569,12 +604,12 @@ function resolveCancellationClient(client?: AspireClient): AspireClient { * @param signalOrToken - The signal or token to register (optional) * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None */ -export function registerCancellation(client: AspireClient, signalOrToken?: AbortSignal | CancellationToken): string | undefined; +export function registerCancellation(client: AspireClientRpc, signalOrToken?: AbortSignal | CancellationToken): string | undefined; /** * Registers cancellation support using the single connected AspireClient. * * @param signalOrToken - The signal or token to register (optional) - * @returns The cancellation ID, or undefined if no value was provided or the token maps to CancellationToken.None + * @returns The cancellation ID, or undefined if no value was provided, the signal was already aborted, or the token maps to CancellationToken.None * * @example * const controller = new AbortController(); @@ -588,10 +623,10 @@ export function registerCancellation(client: AspireClient, signalOrToken?: Abort */ export function registerCancellation(signalOrToken?: AbortSignal | CancellationToken): string | undefined; export function registerCancellation( - clientOrSignalOrToken?: AspireClient | AbortSignal | CancellationToken, + clientOrSignalOrToken?: AspireClientRpc | AbortSignal | CancellationToken, maybeSignalOrToken?: AbortSignal | CancellationToken ): string | undefined { - const client = clientOrSignalOrToken instanceof AspireClient ? clientOrSignalOrToken : undefined; + const client = isAspireClientLike(clientOrSignalOrToken) ? clientOrSignalOrToken : undefined; const signalOrToken = client ? maybeSignalOrToken : clientOrSignalOrToken as AbortSignal | CancellationToken | undefined; @@ -600,7 +635,7 @@ export function registerCancellation( return undefined; } - if (signalOrToken instanceof CancellationToken) { + if (isCancellationTokenLike(signalOrToken)) { return signalOrToken.register(client); } @@ -638,7 +673,7 @@ export function registerCancellation( async function marshalTransportValue( value: unknown, - client: AspireClient, + client: AspireClientRpc, cancellationIds: string[], capabilityId: string, path: string = 'args', @@ -648,7 +683,7 @@ async function marshalTransportValue( return value; } - if (value instanceof CancellationToken) { + if (isCancellationTokenLike(value)) { const cancellationId = value.register(client); if (cancellationId !== undefined) { cancellationIds.push(cancellationId); @@ -711,7 +746,7 @@ export function unregisterCancellation(cancellationId: string | undefined): void /** * Client for connecting to the Aspire AppHost via socket/named pipe. */ -export class AspireClient { +export class AspireClient implements AspireClientRpc { private connection: rpc.MessageConnection | null = null; private socket: net.Socket | null = null; private disconnectCallbacks: (() => void)[] = [];