diff --git a/src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs b/src/Aspire.Hosting.CodeGeneration.TypeScript/AtsTypeScriptCodeGenerator.cs index 8d2b152a7e7..1fecdc678c1 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); @@ -395,6 +414,8 @@ private string GenerateAspireSdk(AtsContext context) registerHandleWrapper } from './transport.js'; + import type { HandleReference } from './base.js'; + import { ResourceBuilderBase, ReferenceExpression, @@ -919,17 +940,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 +1278,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 +1354,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 +1373,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 +1387,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 +1421,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 +1454,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 +1513,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 +1521,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 +1529,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 +1594,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 +1612,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 +1763,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 +1792,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 { @@ -1600,12 +1870,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 +1953,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 +1968,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 +1990,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 +2127,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 +2185,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 +2201,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 +2500,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 +2557,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 +2581,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 +2596,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 +2639,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 +2694,12 @@ private void GenerateTypeClassThenableWrapper(BuilderModel model, List {{"); + WriteLine($"class {promiseImplementationClass} implements {promiseClass} {{"); WriteLine($" constructor(private _promise: Promise<{className}>) {{}}"); WriteLine(); @@ -2469,11 +2764,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 +2782,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..79029117e8c 100644 --- a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts +++ b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/base.ts @@ -1,4 +1,4 @@ -// 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'; // Re-export transport types for convenience @@ -38,7 +38,14 @@ export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './t * await api.withEnvironment("REDIS_URL", expr); * ``` */ -export class ReferenceExpression { +export interface ReferenceExpression { + readonly isConditional: boolean; + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle; + getValue(cancellationToken?: AbortSignal | CancellationToken): Promise; + toString(): string; +} + +class ReferenceExpressionImpl implements ReferenceExpression { // Expression mode fields private readonly _format?: string; private readonly _valueProviders?: unknown[]; @@ -90,40 +97,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. @@ -192,8 +165,51 @@ export class ReferenceExpression { } } +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 ReferenceExpressionImpl(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 ReferenceExpressionImpl(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse, whenFalse!); + } + + return new ReferenceExpressionImpl(condition, 'True', matchValueOrWhenTrue, whenTrueOrWhenFalse); +} + +export const ReferenceExpression = { + create: createReferenceExpression, + createConditional: createConditionalReferenceExpression +}; + registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => - new ReferenceExpression(handle, client) + new ReferenceExpressionImpl(handle, client) ); /** @@ -266,11 +282,15 @@ 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 { +export class ResourceBuilderBase implements HandleReference { constructor(protected _handle: THandle, protected _client: AspireClient) {} toJSON(): MarshalledHandle { return this._handle.toJSON(); } diff --git a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts index 904e57142f9..a7089200192 100644 --- a/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts +++ b/src/Aspire.Hosting.CodeGeneration.TypeScript/Resources/transport.ts @@ -104,6 +104,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; @@ -205,7 +216,12 @@ export class Handle { * const connectionString = await connectionStringExpression.getValue(cancellationToken); * ``` */ -export class CancellationToken { +export interface CancellationToken { + toJSON(): string | undefined; + register(client?: AspireClient): string | undefined; +} + +class CancellationTokenImpl implements CancellationToken { private readonly _signal?: AbortSignal; private readonly _remoteTokenId?: string; @@ -222,47 +238,49 @@ export class CancellationToken { /** * Creates a cancellation token from a local {@link AbortSignal}. */ - static from(signal?: AbortSignal): CancellationToken { - return new CancellationToken(signal); + 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); + } +} + +/** + * Creates transport-safe cancellation token values for the generated SDK. + */ +export const CancellationToken = { + from(signal?: AbortSignal): CancellationToken { + return new CancellationTokenImpl(signal); + }, + /** * Creates a cancellation token from a transport value. * Generated code uses this to materialize values that come from the AppHost. */ - static fromValue(value: unknown): CancellationToken { - if (value instanceof CancellationToken) { + fromValue(value: unknown): CancellationToken { + if (isCancellationTokenLike(value)) { return value; } if (typeof value === 'string') { - return new CancellationToken(value); + return new CancellationTokenImpl(value); } if (isAbortSignal(value)) { - return new CancellationToken(value); + return new CancellationTokenImpl(value); } - return new CancellationToken(); + return new CancellationTokenImpl(); } - - /** - * 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); - } -} +}; // ============================================================================ // Handle Wrapper Registry @@ -559,6 +577,22 @@ function resolveCancellationClient(client?: AspireClient): AspireClient { ); } +function isAspireClientLike(value: unknown): value is AspireClient { + 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. @@ -574,7 +608,7 @@ export function registerCancellation(client: AspireClient, signalOrToken?: Abort * 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(); @@ -591,7 +625,7 @@ export function registerCancellation( clientOrSignalOrToken?: AspireClient | 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 +634,7 @@ export function registerCancellation( return undefined; } - if (signalOrToken instanceof CancellationToken) { + if (isCancellationTokenLike(signalOrToken)) { return signalOrToken.register(client); } @@ -648,7 +682,7 @@ async function marshalTransportValue( return value; } - if (value instanceof CancellationToken) { + if (isCancellationTokenLike(value)) { const cancellationId = value.register(client); if (cancellationId !== undefined) { cancellationIds.push(cancellationId); diff --git a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs index 9b0a0060aea..97d304a27f6 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/AtsTypeScriptCodeGeneratorTests.cs @@ -339,7 +339,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 +582,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 +1060,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 +1133,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 +1348,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..8f9a1519a7a 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/AtsGeneratedAspire.verified.ts @@ -16,6 +16,8 @@ import { registerHandleWrapper } from './transport.js'; +import type { HandleReference } from './base.js'; + import { ResourceBuilderBase, ReferenceExpression, @@ -164,10 +166,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 +250,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 +303,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 +386,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 +473,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 +490,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 +507,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 +521,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 +554,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 +570,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 +582,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 +594,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 +608,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 +681,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 +718,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -582,12 +733,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 +784,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 +835,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 +880,12 @@ export class TestDatabaseResource extends ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -763,12 +914,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestDatabaseResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -779,13 +930,13 @@ export class TestDatabaseResource extends ResourceBuilderBase { +class TestDatabaseResourcePromiseImpl implements TestDatabaseResourcePromise { constructor(private _promise: Promise) {} then( @@ -935,122 +1086,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 +1210,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 +1304,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 +1409,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -1192,12 +1424,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 +1475,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 +1526,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 +1565,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 +1610,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 +1655,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 +1678,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 +1688,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withMultiParamHandleCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withMultiParamHandleCallbackInternal(callback)); } /** @internal */ @@ -1473,14 +1705,14 @@ export class TestRedisResource extends ResourceBuilderBase { +class TestRedisResourcePromiseImpl implements TestRedisResourcePromise { constructor(private _promise: Promise) {} then( @@ -1630,22 +1862,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 +1892,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 +1947,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 +1977,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 +1987,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 +2041,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 +2114,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 +2151,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -1875,12 +2166,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 +2217,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 +2268,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 +2313,12 @@ export class TestVaultResource extends ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestVaultResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -2056,12 +2347,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestVaultResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -2071,12 +2362,12 @@ export class TestVaultResource extends ResourceBuilderBase { +class TestVaultResourcePromiseImpl implements TestVaultResourcePromise { constructor(private _promise: Promise) {} then( @@ -2226,122 +2517,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 +2641,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 +2708,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 +2725,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 +2740,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 +2755,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 +2770,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 +2791,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 +2807,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 +2822,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 +2842,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 +2887,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 +2906,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 +2921,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 +2936,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 +2951,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 +2966,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 +2983,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 +3002,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 +3019,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 +3034,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 +3049,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 +3061,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 +3170,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 +3197,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { +class ResourceWithConnectionStringPromiseImpl implements ResourceWithConnectionStringPromise { constructor(private _promise: Promise) {} then( @@ -2880,12 +3239,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 +3253,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 +3277,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 +3285,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ResourceWithEnvironmentPromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -2926,12 +3300,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentVariablesInternal(variables)); + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentVariablesInternal(variables)); } } @@ -2941,7 +3315,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { +class ResourceWithEnvironmentPromiseImpl implements ResourceWithEnvironmentPromise { constructor(private _promise: Promise) {} then( @@ -2953,12 +3327,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))); } } @@ -3022,12 +3396,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 174077be454..831c140b8c3 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.ts @@ -16,6 +16,8 @@ import { registerHandleWrapper } from './transport.js'; +import type { HandleReference } from './base.js'; + import { ResourceBuilderBase, ReferenceExpression, @@ -705,10 +707,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 */ @@ -721,7 +737,7 @@ export class AfterResourcesCreatedEvent { 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -732,7 +748,7 @@ export class AfterResourcesCreatedEvent { 'Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -742,10 +758,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 */ @@ -758,7 +788,7 @@ export class BeforeResourceStartedEvent { 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -769,7 +799,7 @@ export class BeforeResourceStartedEvent { 'Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -779,10 +809,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 */ @@ -795,7 +839,7 @@ export class BeforeStartEvent { 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -806,7 +850,7 @@ export class BeforeStartEvent { 'Aspire.Hosting.ApplicationModel/BeforeStartEvent.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -816,10 +860,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 */ @@ -857,8 +924,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 */ @@ -868,8 +941,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 */ @@ -879,7 +958,7 @@ export class CommandLineArgsCallbackContext { 'Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -889,10 +968,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 */ @@ -905,7 +998,7 @@ export class ConnectionStringAvailableEvent { 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -916,7 +1009,7 @@ export class ConnectionStringAvailableEvent { 'Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -926,10 +1019,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 */ @@ -949,7 +1055,7 @@ export class DistributedApplication { run(options?: RunOptions): DistributedApplicationPromise { const cancellationToken = options?.cancellationToken; - return new DistributedApplicationPromise(this._runInternal(cancellationToken)); + return new DistributedApplicationPromiseImpl(this._runInternal(cancellationToken)); } } @@ -957,7 +1063,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( @@ -969,7 +1075,7 @@ export class DistributedApplicationPromise implements PromiseLike obj.run(options))); + return new DistributedApplicationPromiseImpl(this._promise.then(obj => obj.run(options))); } } @@ -978,10 +1084,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 */ @@ -1020,7 +1150,7 @@ export class DistributedApplicationExecutionContext { 'Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1050,10 +1180,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 */ @@ -1076,11 +1221,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)); } } @@ -1088,7 +1233,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( @@ -1105,7 +1250,7 @@ export class DistributedApplicationModelPromise implements PromiseLike obj.findResourceByName(name))); + return new ResourcePromiseImpl(this._promise.then(obj => obj.findResourceByName(name))); } } @@ -1114,10 +1259,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 */ @@ -1130,7 +1333,7 @@ export class EndpointReference { 'Aspire.Hosting.ApplicationModel/EndpointReference.resource', { context: this._handle } ); - return new ResourceWithEndpoints(handle, this._client); + return new ResourceWithEndpointsImpl(handle, this._client); }, }; @@ -1295,7 +1498,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( @@ -1321,10 +1524,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 */ @@ -1337,7 +1557,7 @@ export class EndpointReferenceExpression { 'Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint', { context: this._handle } ); - return new EndpointReference(handle, this._client); + return new EndpointReferenceImpl(handle, this._client); }, }; @@ -1367,10 +1587,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 */ @@ -1408,8 +1650,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 */ @@ -1419,7 +1667,7 @@ export class EnvironmentCallbackContext { 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -1430,7 +1678,7 @@ export class EnvironmentCallbackContext { 'Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -1440,10 +1688,30 @@ 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; + }; +} + +// ============================================================================ +// ExecuteCommandContextImpl +// ============================================================================ + /** * Type class for ExecuteCommandContext. */ -export class ExecuteCommandContext { +class ExecuteCommandContextImpl implements ExecuteCommandContext { constructor(private _handle: ExecuteCommandContextHandle, private _client: AspireClientRpc) {} /** Serialize for JSON-RPC transport */ @@ -1456,8 +1724,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 */ @@ -1499,10 +1773,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 */ @@ -1515,7 +1812,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -1526,7 +1823,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new DistributedApplicationEventingImpl(handle, this._client); }, }; @@ -1537,7 +1834,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, }; @@ -1548,7 +1845,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications', { context: this._handle } ); - return new ResourceNotificationService(handle, this._client); + return new ResourceNotificationServiceImpl(handle, this._client); }, }; @@ -1559,7 +1856,7 @@ export class InitializeResourceEvent { 'Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1569,10 +1866,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 */ @@ -1585,8 +1907,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 */ @@ -1612,8 +1940,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 */ @@ -1630,7 +1964,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( @@ -1651,10 +1985,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 */ @@ -1667,7 +2028,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -1678,7 +2039,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -1689,7 +2050,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1700,7 +2061,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, }; @@ -1728,7 +2089,7 @@ export class PipelineContext { 'Aspire.Hosting.Pipelines/PipelineContext.summary', { context: this._handle } ); - return new PipelineSummary(handle, this._client); + return new PipelineSummaryImpl(handle, this._client); }, }; @@ -1738,10 +2099,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 */ @@ -1828,8 +2219,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 */ @@ -1844,7 +2241,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 */ @@ -1859,7 +2256,7 @@ export class PipelineStep { } requiredBy(stepName: string): PipelineStepPromise { - return new PipelineStepPromise(this._requiredByInternal(stepName)); + return new PipelineStepPromiseImpl(this._requiredByInternal(stepName)); } } @@ -1867,7 +2264,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( @@ -1879,12 +2276,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))); } } @@ -1893,10 +2290,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 */ @@ -1909,8 +2340,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 */ @@ -1920,8 +2357,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 */ @@ -1931,7 +2374,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.model', { context: this._handle } ); - return new DistributedApplicationModel(handle, this._client); + return new DistributedApplicationModelImpl(handle, this._client); }, }; @@ -1942,7 +2385,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -1953,7 +2396,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -1964,7 +2407,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.logger', { context: this._handle } ); - return new Logger(handle, this._client); + return new LoggerImpl(handle, this._client); }, }; @@ -1986,7 +2429,7 @@ export class PipelineStepContext { 'Aspire.Hosting.Pipelines/PipelineStepContext.summary', { context: this._handle } ); - return new PipelineSummary(handle, this._client); + return new PipelineSummaryImpl(handle, this._client); }, }; @@ -1996,10 +2439,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 */ @@ -2012,8 +2471,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 */ @@ -2023,8 +2488,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 } + ); + } }; } @@ -2033,10 +2504,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 */ @@ -2054,7 +2540,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 */ @@ -2069,7 +2555,7 @@ export class PipelineSummary { } addMarkdown(key: string, markdownString: string): PipelineSummaryPromise { - return new PipelineSummaryPromise(this._addMarkdownInternal(key, markdownString)); + return new PipelineSummaryPromiseImpl(this._addMarkdownInternal(key, markdownString)); } } @@ -2077,7 +2563,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( @@ -2089,12 +2575,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))); } } @@ -2103,10 +2589,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 */ @@ -2166,10 +2672,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 */ @@ -2197,7 +2725,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 */ @@ -2214,7 +2742,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 */ @@ -2231,7 +2759,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 */ @@ -2248,7 +2776,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( @@ -2260,17 +2788,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 */ @@ -2284,10 +2812,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 */ @@ -2300,7 +2842,7 @@ export class ResourceEndpointsAllocatedEvent { 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2311,7 +2853,7 @@ export class ResourceEndpointsAllocatedEvent { 'Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -2321,10 +2863,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 */ @@ -2332,7 +2889,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', @@ -2341,8 +2898,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 */ @@ -2357,7 +2914,7 @@ export class ResourceLoggerService { } completeLogByName(resourceName: string): ResourceLoggerServicePromise { - return new ResourceLoggerServicePromise(this._completeLogByNameInternal(resourceName)); + return new ResourceLoggerServicePromiseImpl(this._completeLogByNameInternal(resourceName)); } } @@ -2365,7 +2922,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( @@ -2376,13 +2933,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))); } } @@ -2391,10 +2948,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 */ @@ -2414,7 +2994,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 */ @@ -2437,7 +3017,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', @@ -2446,8 +3026,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 */ @@ -2461,7 +3041,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; @@ -2472,10 +3052,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)); } } @@ -2483,7 +3063,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( @@ -2495,7 +3075,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 */ @@ -2509,8 +3089,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 */ @@ -2519,8 +3099,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))); } } @@ -2529,10 +3109,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 */ @@ -2545,7 +3139,7 @@ export class ResourceReadyEvent { 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2556,7 +3150,7 @@ export class ResourceReadyEvent { 'Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -2566,10 +3160,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 */ @@ -2582,7 +3190,7 @@ export class ResourceStoppedEvent { 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2593,7 +3201,7 @@ export class ResourceStoppedEvent { 'Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services', { context: this._handle } ); - return new ServiceProvider(handle, this._client); + return new ServiceProviderImpl(handle, this._client); }, }; @@ -2603,10 +3211,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 */ @@ -2619,7 +3249,7 @@ export class ResourceUrlsCallbackContext { 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource', { context: this._handle } ); - return new Resource(handle, this._client); + return new ResourceImpl(handle, this._client); }, }; @@ -2655,8 +3285,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 */ @@ -2666,7 +3302,7 @@ export class ResourceUrlsCallbackContext { 'Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -2676,10 +3312,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 */ @@ -2740,10 +3396,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 */ @@ -2783,10 +3449,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 */ @@ -2846,10 +3532,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 */ @@ -2908,7 +3619,7 @@ export class TestResourceContext { } setValueAsync(value: string): TestResourceContextPromise { - return new TestResourceContextPromise(this._setValueAsyncInternal(value)); + return new TestResourceContextPromiseImpl(this._setValueAsyncInternal(value)); } /** Invokes the ValidateAsync method */ @@ -2925,7 +3636,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( @@ -2942,7 +3653,7 @@ export class TestResourceContextPromise implements PromiseLike obj.setValueAsync(value))); + return new TestResourceContextPromiseImpl(this._promise.then(obj => obj.setValueAsync(value))); } /** Invokes the ValidateAsync method */ @@ -2956,10 +3667,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 */ @@ -2972,8 +3695,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 } + ); + } }; } @@ -2982,10 +3711,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 */ @@ -3041,7 +3791,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( @@ -3082,10 +3832,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 */ @@ -3108,7 +3934,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.environment', { context: this._handle } ); - return new HostEnvironment(handle, this._client); + return new HostEnvironmentImpl(handle, this._client); }, }; @@ -3119,7 +3945,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.eventing', { context: this._handle } ); - return new DistributedApplicationEventing(handle, this._client); + return new DistributedApplicationEventingImpl(handle, this._client); }, }; @@ -3130,7 +3956,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.executionContext', { context: this._handle } ); - return new DistributedApplicationExecutionContext(handle, this._client); + return new DistributedApplicationExecutionContextImpl(handle, this._client); }, }; @@ -3141,7 +3967,7 @@ export class DistributedApplicationBuilder { 'Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager', { context: this._handle } ); - return new UserSecretsManager(handle, this._client); + return new UserSecretsManagerImpl(handle, this._client); }, }; @@ -3153,11 +3979,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 */ @@ -3168,11 +3994,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 */ @@ -3180,7 +4006,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 }; @@ -3188,11 +4014,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 */ @@ -3204,12 +4030,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 */ @@ -3221,12 +4047,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 */ @@ -3237,11 +4063,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 */ @@ -3254,13 +4080,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 */ @@ -3271,11 +4097,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 */ @@ -3286,11 +4112,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 */ @@ -3301,11 +4127,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 */ @@ -3316,11 +4142,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 */ @@ -3331,11 +4157,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 */ @@ -3347,12 +4173,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 */ @@ -3365,13 +4191,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 */ @@ -3383,12 +4209,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 */ @@ -3400,12 +4226,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 */ @@ -3416,11 +4242,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 */ @@ -3428,7 +4254,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 }; @@ -3436,11 +4262,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 */ @@ -3451,11 +4277,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 */ @@ -3463,7 +4289,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 }; @@ -3471,11 +4297,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 */ @@ -3486,18 +4312,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 }; @@ -3511,7 +4337,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 }; @@ -3530,12 +4356,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 */ @@ -3546,11 +4372,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)); } } @@ -3558,7 +4384,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( @@ -3570,107 +4396,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 */ @@ -3685,12 +4511,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))); } } @@ -3699,10 +4525,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 */ @@ -3720,7 +4559,7 @@ export class DistributedApplicationEventing { } unsubscribe(subscription: DistributedApplicationEventSubscriptionHandle): DistributedApplicationEventingPromise { - return new DistributedApplicationEventingPromise(this._unsubscribeInternal(subscription)); + return new DistributedApplicationEventingPromiseImpl(this._unsubscribeInternal(subscription)); } } @@ -3728,7 +4567,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( @@ -3740,7 +4579,7 @@ export class DistributedApplicationEventingPromise implements PromiseLike obj.unsubscribe(subscription))); + return new DistributedApplicationEventingPromiseImpl(this._promise.then(obj => obj.unsubscribe(subscription))); } } @@ -3749,10 +4588,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 */ @@ -3799,7 +4657,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( @@ -3835,10 +4693,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 */ @@ -3856,7 +4735,7 @@ export class Logger { } logInformation(message: string): LoggerPromise { - return new LoggerPromise(this._logInformationInternal(message)); + return new LoggerPromiseImpl(this._logInformationInternal(message)); } /** Logs a warning message */ @@ -3871,7 +4750,7 @@ export class Logger { } logWarning(message: string): LoggerPromise { - return new LoggerPromise(this._logWarningInternal(message)); + return new LoggerPromiseImpl(this._logWarningInternal(message)); } /** Logs an error message */ @@ -3886,7 +4765,7 @@ export class Logger { } logError(message: string): LoggerPromise { - return new LoggerPromise(this._logErrorInternal(message)); + return new LoggerPromiseImpl(this._logErrorInternal(message)); } /** Logs a debug message */ @@ -3901,7 +4780,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 */ @@ -3916,7 +4795,7 @@ export class Logger { } log(level: string, message: string): LoggerPromise { - return new LoggerPromise(this._logInternal(level, message)); + return new LoggerPromiseImpl(this._logInternal(level, message)); } } @@ -3924,7 +4803,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( @@ -3936,27 +4815,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))); } } @@ -3965,10 +4844,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 */ @@ -3982,11 +4874,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)); } } @@ -3994,7 +4886,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( @@ -4006,7 +4898,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))); } } @@ -4015,10 +4907,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 */ @@ -4033,12 +4948,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 */ @@ -4050,12 +4965,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 */ @@ -4070,7 +4985,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 */ @@ -4085,7 +5000,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 */ @@ -4104,7 +5019,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 */ @@ -4123,7 +5038,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)); } } @@ -4131,7 +5046,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( @@ -4143,32 +5058,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))); } } @@ -4177,10 +5092,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 */ @@ -4200,7 +5134,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 */ @@ -4217,7 +5151,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 */ @@ -4238,7 +5172,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 */ @@ -4257,7 +5191,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)); } } @@ -4265,7 +5199,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( @@ -4277,22 +5211,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))); } } @@ -4301,10 +5235,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 */ @@ -4318,11 +5275,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 */ @@ -4333,11 +5290,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 */ @@ -4348,11 +5305,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 */ @@ -4363,11 +5320,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 */ @@ -4378,11 +5335,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 */ @@ -4393,11 +5350,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()); } } @@ -4405,7 +5362,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( @@ -4417,32 +5374,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())); } } @@ -4451,10 +5408,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 */ @@ -4503,12 +5483,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', @@ -4517,8 +5497,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)); } } @@ -4526,7 +5506,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( @@ -4543,12 +5523,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))); } } @@ -4557,24 +5537,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 */ @@ -4586,14 +5683,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 }; @@ -4655,12 +5752,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -4671,13 +5768,13 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ConnectionStringResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -4723,72 +5820,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 */ @@ -4798,29 +5895,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 */ @@ -4830,19 +5927,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 }; @@ -4851,43 +5948,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 */ @@ -4898,13 +5995,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 }; @@ -4938,7 +6035,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 }; @@ -4962,12 +6059,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -4983,7 +6080,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 }; @@ -4991,19 +6088,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 }; @@ -5011,19 +6108,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 }; @@ -5031,19 +6128,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 }; @@ -5051,19 +6148,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 }; @@ -5071,12 +6168,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._onResourceReadyInternal(callback)); + return new ConnectionStringResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -5088,14 +6185,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 }; @@ -5186,13 +6283,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 }; @@ -5237,27 +6334,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 */ @@ -5267,27 +6364,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 */ @@ -5297,12 +6394,12 @@ export class ConnectionStringResource extends ResourceBuilderBase Promise): ConnectionStringResourcePromise { - return new ConnectionStringResourcePromise(this._withCancellableOperationInternal(operation)); + return new ConnectionStringResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -5331,12 +6428,12 @@ export class ConnectionStringResource extends ResourceBuilderBase { +class ConnectionStringResourcePromiseImpl implements ConnectionStringResourcePromise { constructor(private _promise: Promise) {} then( @@ -5470,123 +6567,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 */ @@ -5596,142 +6693,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))); } } @@ -5740,24 +6837,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 */ @@ -5769,14 +6963,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 }; @@ -5808,12 +7002,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -5824,13 +7018,13 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ContainerRegistryResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -5876,12 +7070,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 }; @@ -5927,43 +7121,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 */ @@ -5974,13 +7168,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 }; @@ -6014,7 +7208,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 }; @@ -6038,12 +7232,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -6059,7 +7253,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 }; @@ -6067,19 +7261,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 }; @@ -6087,19 +7281,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 }; @@ -6107,19 +7301,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 }; @@ -6127,12 +7321,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._onResourceReadyInternal(callback)); + return new ContainerRegistryResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -6144,14 +7338,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 }; @@ -6227,13 +7421,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 }; @@ -6278,42 +7472,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 */ @@ -6323,12 +7517,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase Promise): ContainerRegistryResourcePromise { - return new ContainerRegistryResourcePromise(this._withCancellableOperationInternal(operation)); + return new ContainerRegistryResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -6357,12 +7551,12 @@ export class ContainerRegistryResource extends ResourceBuilderBase { +class ContainerRegistryResourcePromiseImpl implements ContainerRegistryResourcePromise { constructor(private _promise: Promise) {} then( @@ -6496,88 +7690,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 */ @@ -6587,127 +7781,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))); } } @@ -6716,24 +7910,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 */ @@ -6744,13 +8147,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 }; @@ -7126,12 +8529,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -7141,12 +8544,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 */ @@ -7186,19 +8589,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 }; @@ -7206,16 +8609,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; @@ -7224,15 +8627,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 }; @@ -7412,12 +8815,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -7428,13 +8831,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 }; @@ -7485,12 +8888,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ContainerResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -7500,72 +8903,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 */ @@ -7575,29 +8978,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 */ @@ -7607,12 +9010,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 }; @@ -7649,13 +9052,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 */ @@ -7665,12 +9068,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 */ @@ -7758,13 +9161,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 }; @@ -7857,7 +9260,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 }; @@ -7881,12 +9284,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ContainerResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -7898,14 +9301,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 }; @@ -7929,19 +9332,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 }; @@ -7949,19 +9352,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 }; @@ -7969,19 +9372,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 }; @@ -7989,19 +9392,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 }; @@ -8009,12 +9412,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._onResourceReadyInternal(callback)); + return new ContainerResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -8026,14 +9429,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 }; @@ -8063,12 +9466,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ContainerResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -8078,12 +9481,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 }; @@ -8129,13 +9532,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 }; @@ -8180,42 +9583,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 */ @@ -8225,12 +9628,12 @@ export class ContainerResource extends ResourceBuilderBase): ContainerResourcePromise { - return new ContainerResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new ContainerResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -8259,12 +9662,12 @@ export class ContainerResource extends ResourceBuilderBase Promise): ContainerResourcePromise { - return new ContainerResourcePromise(this._withCancellableOperationInternal(operation)); + return new ContainerResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -8274,12 +9677,12 @@ export class ContainerResource extends ResourceBuilderBase { +class ContainerResourcePromiseImpl implements ContainerResourcePromise { constructor(private _promise: Promise) {} then( @@ -8413,198 +9816,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 */ @@ -8614,152 +10017,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 */ @@ -8769,142 +10172,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))); } } @@ -8913,24 +10316,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 */ @@ -8942,14 +10526,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 }; @@ -9044,13 +10628,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 }; @@ -9112,12 +10696,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -9127,12 +10711,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 */ @@ -9172,19 +10756,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 }; @@ -9192,16 +10776,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; @@ -9210,15 +10794,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 }; @@ -9398,12 +10982,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withUrlsCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -9414,13 +10998,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 }; @@ -9471,27 +11055,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 */ @@ -9501,72 +11085,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 */ @@ -9576,29 +11160,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 */ @@ -9608,12 +11192,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 }; @@ -9650,13 +11234,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 */ @@ -9666,12 +11250,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 */ @@ -9759,13 +11343,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 }; @@ -9858,7 +11442,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 }; @@ -9882,12 +11466,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -9903,7 +11487,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 }; @@ -9911,19 +11495,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 }; @@ -9931,19 +11515,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 }; @@ -9951,19 +11535,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 }; @@ -9971,19 +11555,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 }; @@ -9991,12 +11575,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._onResourceReadyInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -10008,14 +11592,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 }; @@ -10045,12 +11629,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new CSharpAppResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -10060,12 +11644,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 }; @@ -10111,13 +11695,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 }; @@ -10162,42 +11746,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 */ @@ -10207,12 +11791,12 @@ export class CSharpAppResource extends ResourceBuilderBase): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new CSharpAppResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -10241,12 +11825,12 @@ export class CSharpAppResource extends ResourceBuilderBase Promise): CSharpAppResourcePromise { - return new CSharpAppResourcePromise(this._withCancellableOperationInternal(operation)); + return new CSharpAppResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -10256,12 +11840,12 @@ export class CSharpAppResource extends ResourceBuilderBase { +class CSharpAppResourcePromiseImpl implements CSharpAppResourcePromise { constructor(private _promise: Promise) {} then( @@ -10395,128 +11979,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 */ @@ -10526,152 +12110,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 */ @@ -10681,142 +12265,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))); } } @@ -10825,24 +12409,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 */ @@ -10854,14 +12631,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 }; @@ -10981,12 +12758,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + return new DotnetToolResourcePromiseImpl(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ @@ -10996,12 +12773,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 }; @@ -11127,12 +12904,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -11142,12 +12919,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 */ @@ -11187,19 +12964,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 }; @@ -11207,16 +12984,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; @@ -11225,15 +13002,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 }; @@ -11413,12 +13190,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlsCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -11429,13 +13206,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 }; @@ -11486,12 +13263,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new DotnetToolResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -11501,72 +13278,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 */ @@ -11576,29 +13353,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 */ @@ -11608,12 +13385,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 }; @@ -11650,13 +13427,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 */ @@ -11666,12 +13443,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 */ @@ -11759,13 +13536,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 }; @@ -11858,7 +13635,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 }; @@ -11882,12 +13659,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -11903,7 +13680,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 }; @@ -11911,19 +13688,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 }; @@ -11931,19 +13708,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 }; @@ -11951,19 +13728,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 }; @@ -11971,19 +13748,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 }; @@ -11991,12 +13768,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._onResourceReadyInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -12008,14 +13785,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 }; @@ -12045,12 +13822,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new DotnetToolResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -12060,12 +13837,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 }; @@ -12111,13 +13888,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 }; @@ -12162,42 +13939,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 */ @@ -12207,12 +13984,12 @@ export class DotnetToolResource extends ResourceBuilderBase): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new DotnetToolResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -12241,12 +14018,12 @@ export class DotnetToolResource extends ResourceBuilderBase Promise): DotnetToolResourcePromise { - return new DotnetToolResourcePromise(this._withCancellableOperationInternal(operation)); + return new DotnetToolResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -12256,12 +14033,12 @@ export class DotnetToolResource extends ResourceBuilderBase { +class DotnetToolResourcePromiseImpl implements DotnetToolResourcePromise { constructor(private _promise: Promise) {} then( @@ -12395,163 +14172,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 */ @@ -12561,147 +14338,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 */ @@ -12711,142 +14488,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))); } } @@ -12855,24 +14632,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 */ @@ -12884,14 +14842,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 }; @@ -12921,12 +14879,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._publishAsDockerFileWithConfigureInternal(configure)); + return new ExecutableResourcePromiseImpl(this._publishAsDockerFileWithConfigureInternal(configure)); } /** @internal */ @@ -12936,12 +14894,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 }; @@ -13067,12 +15025,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -13082,12 +15040,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 */ @@ -13127,19 +15085,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 }; @@ -13147,16 +15105,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; @@ -13165,15 +15123,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 }; @@ -13353,12 +15311,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -13369,13 +15327,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 }; @@ -13426,12 +15384,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ExecutableResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -13441,72 +15399,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 */ @@ -13516,29 +15474,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 */ @@ -13548,12 +15506,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 }; @@ -13590,13 +15548,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 */ @@ -13606,12 +15564,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 */ @@ -13699,13 +15657,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 }; @@ -13798,7 +15756,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 }; @@ -13822,12 +15780,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ExecutableResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -13843,7 +15801,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 }; @@ -13851,19 +15809,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 }; @@ -13871,19 +15829,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 }; @@ -13891,19 +15849,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 }; @@ -13911,19 +15869,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 }; @@ -13931,12 +15889,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._onResourceReadyInternal(callback)); + return new ExecutableResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -13948,14 +15906,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 }; @@ -13985,12 +15943,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ExecutableResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -14000,12 +15958,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 }; @@ -14051,13 +16009,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 }; @@ -14102,42 +16060,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 */ @@ -14147,12 +16105,12 @@ export class ExecutableResource extends ResourceBuilderBase): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new ExecutableResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -14181,12 +16139,12 @@ export class ExecutableResource extends ResourceBuilderBase Promise): ExecutableResourcePromise { - return new ExecutableResourcePromise(this._withCancellableOperationInternal(operation)); + return new ExecutableResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -14196,12 +16154,12 @@ export class ExecutableResource extends ResourceBuilderBase { +class ExecutableResourcePromiseImpl implements ExecutableResourcePromise { constructor(private _promise: Promise) {} then( @@ -14335,133 +16293,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 */ @@ -14471,147 +16429,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 */ @@ -14621,142 +16579,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))); } } @@ -14765,24 +16723,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 */ @@ -14794,14 +16851,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 }; @@ -14852,12 +16909,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -14868,13 +16925,13 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ExternalServiceResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -14920,12 +16977,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 }; @@ -14971,43 +17028,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 */ @@ -15018,13 +17075,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 }; @@ -15058,7 +17115,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 }; @@ -15082,12 +17139,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -15103,7 +17160,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 }; @@ -15111,19 +17168,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 }; @@ -15131,19 +17188,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 }; @@ -15151,19 +17208,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 }; @@ -15171,12 +17228,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._onResourceReadyInternal(callback)); + return new ExternalServiceResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -15188,14 +17245,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 }; @@ -15271,13 +17328,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 }; @@ -15322,42 +17379,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 */ @@ -15367,12 +17424,12 @@ export class ExternalServiceResource extends ResourceBuilderBase Promise): ExternalServiceResourcePromise { - return new ExternalServiceResourcePromise(this._withCancellableOperationInternal(operation)); + return new ExternalServiceResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -15401,12 +17458,12 @@ export class ExternalServiceResource extends ResourceBuilderBase { +class ExternalServiceResourcePromiseImpl implements ExternalServiceResourcePromise { constructor(private _promise: Promise) {} then( @@ -15540,93 +17597,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 */ @@ -15636,127 +17693,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))); } } @@ -15765,24 +17822,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 */ @@ -15794,14 +17950,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 }; @@ -15850,12 +18006,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlsCallbackInternal(callback)); + return new ParameterResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -15866,13 +18022,13 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withUrlForEndpointInternal(endpointName, callback)); + return new ParameterResourcePromiseImpl(this._withUrlForEndpointInternal(endpointName, callback)); } /** @internal */ @@ -15918,12 +18074,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 }; @@ -15969,43 +18125,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 */ @@ -16016,13 +18172,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 }; @@ -16056,7 +18212,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 }; @@ -16080,12 +18236,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new ParameterResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** Gets the resource name */ @@ -16101,7 +18257,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 }; @@ -16109,19 +18265,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 }; @@ -16129,19 +18285,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 }; @@ -16149,19 +18305,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 }; @@ -16169,12 +18325,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._onResourceReadyInternal(callback)); + return new ParameterResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -16186,14 +18342,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 }; @@ -16269,13 +18425,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 }; @@ -16320,42 +18476,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 */ @@ -16365,12 +18521,12 @@ export class ParameterResource extends ResourceBuilderBase Promise): ParameterResourcePromise { - return new ParameterResourcePromise(this._withCancellableOperationInternal(operation)); + return new ParameterResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -16399,12 +18555,12 @@ export class ParameterResource extends ResourceBuilderBase { +class ParameterResourcePromiseImpl implements ParameterResourcePromise { constructor(private _promise: Promise) {} then( @@ -16538,93 +18694,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 */ @@ -16634,127 +18790,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))); } } @@ -16763,24 +18919,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 */ @@ -16792,14 +19129,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 */ @@ -16811,14 +19148,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 */ @@ -16828,12 +19165,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 */ @@ -16843,12 +19180,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 */ @@ -16858,12 +19195,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 */ @@ -16873,19 +19210,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 }; @@ -16894,13 +19231,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 */ @@ -16911,13 +19248,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 */ @@ -16927,12 +19264,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 */ @@ -16942,19 +19279,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 }; @@ -16962,12 +19299,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 */ @@ -16977,12 +19314,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 */ @@ -16992,27 +19329,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 */ @@ -17022,19 +19359,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 }; @@ -17042,16 +19379,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; @@ -17060,15 +19397,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 */ @@ -17078,12 +19415,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 */ @@ -17093,12 +19430,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 */ @@ -17108,12 +19445,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 */ @@ -17131,7 +19468,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 */ @@ -17144,7 +19481,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 */ @@ -17159,7 +19496,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 */ @@ -17169,7 +19506,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 */ @@ -17184,7 +19521,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 */ @@ -17194,7 +19531,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 */ @@ -17204,12 +19541,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 */ @@ -17228,19 +19565,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 }; @@ -17248,12 +19585,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 */ @@ -17264,13 +19601,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 */ @@ -17281,13 +19618,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 */ @@ -17301,19 +19638,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 }; @@ -17321,27 +19658,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 */ @@ -17351,72 +19688,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 */ @@ -17426,29 +19763,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 */ @@ -17458,12 +19795,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 */ @@ -17476,7 +19813,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 */ @@ -17484,14 +19821,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 }; @@ -17500,13 +19837,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 */ @@ -17516,12 +19853,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 */ @@ -17531,12 +19868,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 */ @@ -17547,13 +19884,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 */ @@ -17563,42 +19900,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 */ @@ -17609,13 +19946,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 */ @@ -17632,7 +19969,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 */ @@ -17644,7 +19981,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 */ @@ -17654,12 +19991,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 */ @@ -17669,12 +20006,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 */ @@ -17684,19 +20021,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 }; @@ -17708,7 +20045,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 */ @@ -17717,14 +20054,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 }; @@ -17732,12 +20069,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 */ @@ -17753,7 +20090,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 }; @@ -17761,19 +20098,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 }; @@ -17781,19 +20118,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 }; @@ -17801,19 +20138,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 }; @@ -17821,19 +20158,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 }; @@ -17841,12 +20178,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 */ @@ -17858,14 +20195,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 */ @@ -17875,19 +20212,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 }; @@ -17895,12 +20232,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 */ @@ -17910,12 +20247,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 */ @@ -17925,12 +20262,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 */ @@ -17940,19 +20277,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 }; @@ -17961,13 +20298,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 */ @@ -17977,12 +20314,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 */ @@ -17992,19 +20329,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 }; @@ -18012,42 +20349,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 */ @@ -18057,12 +20394,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 */ @@ -18072,12 +20409,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 */ @@ -18091,12 +20428,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 */ @@ -18106,12 +20443,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 */ @@ -18121,12 +20458,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 */ @@ -18136,12 +20473,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 */ @@ -18151,12 +20488,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 */ @@ -18168,14 +20505,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 */ @@ -18187,14 +20524,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 */ @@ -18204,12 +20541,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 */ @@ -18219,12 +20556,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)); } } @@ -18234,7 +20571,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( @@ -18245,128 +20582,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 */ @@ -18376,152 +20713,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 */ @@ -18531,142 +20868,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))); } } @@ -18675,24 +21012,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 */ @@ -18703,13 +21249,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 }; @@ -19085,12 +21631,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -19100,12 +21646,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 */ @@ -19145,19 +21691,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 }; @@ -19165,16 +21711,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; @@ -19183,15 +21729,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 }; @@ -19371,12 +21917,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withUrlsCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -19387,13 +21933,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 }; @@ -19444,12 +21990,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new TestDatabaseResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -19459,72 +22005,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 */ @@ -19534,29 +22080,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 */ @@ -19566,12 +22112,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 }; @@ -19608,13 +22154,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 */ @@ -19624,12 +22170,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 */ @@ -19717,13 +22263,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 }; @@ -19816,7 +22362,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 }; @@ -19840,12 +22386,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -19857,14 +22403,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 }; @@ -19888,19 +22434,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 }; @@ -19908,19 +22454,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 }; @@ -19928,19 +22474,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 }; @@ -19948,19 +22494,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 }; @@ -19968,12 +22514,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._onResourceReadyInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -19985,14 +22531,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 }; @@ -20022,12 +22568,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestDatabaseResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -20037,12 +22583,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 }; @@ -20088,13 +22634,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 }; @@ -20139,42 +22685,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 */ @@ -20184,12 +22730,12 @@ export class TestDatabaseResource extends ResourceBuilderBase): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestDatabaseResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -20218,12 +22764,12 @@ export class TestDatabaseResource extends ResourceBuilderBase Promise): TestDatabaseResourcePromise { - return new TestDatabaseResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestDatabaseResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -20233,12 +22779,12 @@ export class TestDatabaseResource extends ResourceBuilderBase { +class TestDatabaseResourcePromiseImpl implements TestDatabaseResourcePromise { constructor(private _promise: Promise) {} then( @@ -20372,198 +22918,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 */ @@ -20573,152 +23119,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 */ @@ -20728,142 +23274,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))); } } @@ -20872,24 +23418,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 */ @@ -20900,13 +23685,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 }; @@ -21282,12 +24067,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -21297,12 +24082,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 */ @@ -21342,12 +24127,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 }; @@ -21392,16 +24177,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; @@ -21410,15 +24195,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 }; @@ -21598,12 +24383,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withUrlsCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -21614,13 +24399,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 }; @@ -21671,12 +24456,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new TestRedisResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -21686,72 +24471,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 */ @@ -21761,29 +24546,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 */ @@ -21793,12 +24578,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 }; @@ -21835,13 +24620,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 */ @@ -21851,12 +24636,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 */ @@ -21944,13 +24729,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 }; @@ -22043,7 +24828,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 }; @@ -22067,12 +24852,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -22084,14 +24869,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 }; @@ -22115,19 +24900,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 }; @@ -22135,19 +24920,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 }; @@ -22155,19 +24940,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 }; @@ -22175,19 +24960,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 }; @@ -22195,19 +24980,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 }; @@ -22215,12 +25000,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._onResourceReadyInternal(callback)); + return new TestRedisResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -22231,13 +25016,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 }; @@ -22336,12 +25121,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -22351,12 +25136,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 }; @@ -22402,13 +25187,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 }; @@ -22453,27 +25238,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 */ @@ -22492,12 +25277,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 */ @@ -22537,12 +25322,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 */ @@ -22582,12 +25367,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 */ @@ -22605,9 +25390,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 }; @@ -22615,12 +25400,12 @@ export class TestRedisResource extends ResourceBuilderBase Promise): TestRedisResourcePromise { - return new TestRedisResourcePromise(this._withMultiParamHandleCallbackInternal(callback)); + return new TestRedisResourcePromiseImpl(this._withMultiParamHandleCallbackInternal(callback)); } /** @internal */ @@ -22632,14 +25417,14 @@ export class TestRedisResource extends ResourceBuilderBase { +class TestRedisResourcePromiseImpl implements TestRedisResourcePromise { constructor(private _promise: Promise) {} then( @@ -22788,208 +25573,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 */ @@ -22999,152 +25784,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 */ @@ -23154,52 +25939,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 */ @@ -23214,52 +25999,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 */ @@ -23269,27 +26054,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 */ @@ -23299,7 +26084,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 */ @@ -23309,52 +26094,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))); } } @@ -23363,24 +26148,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 */ @@ -23391,13 +26387,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 }; @@ -23773,12 +26769,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -23788,12 +26784,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 */ @@ -23833,19 +26829,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 }; @@ -23853,16 +26849,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; @@ -23871,15 +26867,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 }; @@ -24059,12 +27055,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withUrlsCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withUrlsCallbackInternal(callback)); } /** @internal */ @@ -24075,13 +27071,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 }; @@ -24132,12 +27128,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new TestVaultResourcePromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -24147,72 +27143,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 */ @@ -24222,29 +27218,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 */ @@ -24254,12 +27250,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 }; @@ -24296,13 +27292,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 */ @@ -24312,12 +27308,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 */ @@ -24405,13 +27401,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 }; @@ -24504,7 +27500,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 }; @@ -24528,12 +27524,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withPipelineConfigurationInternal(callback)); + return new TestVaultResourcePromiseImpl(this._withPipelineConfigurationInternal(callback)); } /** @internal */ @@ -24545,14 +27541,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 }; @@ -24576,19 +27572,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 }; @@ -24596,19 +27592,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 }; @@ -24616,19 +27612,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 }; @@ -24636,19 +27632,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 }; @@ -24656,12 +27652,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._onResourceReadyInternal(callback)); + return new TestVaultResourcePromiseImpl(this._onResourceReadyInternal(callback)); } /** @internal */ @@ -24673,14 +27669,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 }; @@ -24710,12 +27706,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._testWithEnvironmentCallbackInternal(callback)); + return new TestVaultResourcePromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -24725,12 +27721,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 }; @@ -24776,13 +27772,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 }; @@ -24827,42 +27823,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 */ @@ -24872,12 +27868,12 @@ export class TestVaultResource extends ResourceBuilderBase): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withEnvironmentVariablesInternal(variables)); + return new TestVaultResourcePromiseImpl(this._withEnvironmentVariablesInternal(variables)); } /** @internal */ @@ -24906,12 +27902,12 @@ export class TestVaultResource extends ResourceBuilderBase Promise): TestVaultResourcePromise { - return new TestVaultResourcePromise(this._withCancellableOperationInternal(operation)); + return new TestVaultResourcePromiseImpl(this._withCancellableOperationInternal(operation)); } /** @internal */ @@ -24921,12 +27917,12 @@ export class TestVaultResource extends ResourceBuilderBase { +class TestVaultResourcePromiseImpl implements TestVaultResourcePromise { constructor(private _promise: Promise) {} then( @@ -25075,198 +28071,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 */ @@ -25276,152 +28272,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 */ @@ -25431,147 +28427,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))); } } @@ -25580,7 +28576,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); } @@ -25592,12 +28603,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 */ @@ -25607,12 +28618,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)); } } @@ -25622,7 +28633,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( @@ -25634,12 +28645,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))); } } @@ -25648,24 +28659,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)); } } @@ -25675,7 +28699,7 @@ export class ContainerFilesDestinationResource extends ResourceBuilderBase { +class ContainerFilesDestinationResourcePromiseImpl implements ContainerFilesDestinationResourcePromise { constructor(private _promise: Promise) {} then( @@ -25686,8 +28710,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))); } } @@ -25696,24 +28720,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 */ @@ -25725,14 +28846,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 */ @@ -25743,20 +28864,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 }; @@ -25764,12 +28885,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 */ @@ -25780,13 +28901,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 */ @@ -25797,13 +28918,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 */ @@ -25817,12 +28938,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 */ @@ -25832,12 +28953,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 */ @@ -25847,12 +28968,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 */ @@ -25862,19 +28983,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 }; @@ -25883,43 +29004,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 */ @@ -25930,13 +29051,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 */ @@ -25946,19 +29067,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 }; @@ -25970,7 +29091,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 */ @@ -25979,14 +29100,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 }; @@ -25994,12 +29115,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 */ @@ -26015,7 +29136,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 }; @@ -26023,19 +29144,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 }; @@ -26043,19 +29164,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 }; @@ -26063,19 +29184,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 }; @@ -26083,12 +29204,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 */ @@ -26100,14 +29221,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 */ @@ -26117,12 +29238,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 */ @@ -26132,12 +29253,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 */ @@ -26147,12 +29268,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 */ @@ -26162,19 +29283,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 }; @@ -26183,13 +29304,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 */ @@ -26199,12 +29320,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 */ @@ -26214,19 +29335,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 }; @@ -26234,42 +29355,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 */ @@ -26279,12 +29400,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 */ @@ -26298,12 +29419,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 */ @@ -26313,12 +29434,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 */ @@ -26328,12 +29449,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 */ @@ -26343,12 +29464,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 */ @@ -26358,12 +29479,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 */ @@ -26375,14 +29496,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 */ @@ -26394,14 +29515,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 */ @@ -26411,12 +29532,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 */ @@ -26426,12 +29547,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)); } } @@ -26441,7 +29562,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( @@ -26452,88 +29573,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 */ @@ -26543,127 +29664,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))); } } @@ -26672,7 +29793,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); } @@ -26684,19 +29820,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 }; @@ -26704,12 +29840,12 @@ export class ResourceWithArgs extends ResourceBuilderBase Promise): ResourceWithArgsPromise { - return new ResourceWithArgsPromise(this._withArgsCallbackInternal(callback)); + return new ResourceWithArgsPromiseImpl(this._withArgsCallbackInternal(callback)); } } @@ -26719,7 +29855,7 @@ export class ResourceWithArgs extends ResourceBuilderBase { +class ResourceWithArgsPromiseImpl implements ResourceWithArgsPromise { constructor(private _promise: Promise) {} then( @@ -26731,12 +29867,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))); } } @@ -26745,7 +29881,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); } @@ -26757,12 +29914,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 }; @@ -26792,12 +29949,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase Promise): ResourceWithConnectionStringPromise { - return new ResourceWithConnectionStringPromise(this._onConnectionStringAvailableInternal(callback)); + return new ResourceWithConnectionStringPromiseImpl(this._onConnectionStringAvailableInternal(callback)); } /** @internal */ @@ -26807,12 +29964,12 @@ export class ResourceWithConnectionString extends ResourceBuilderBase { +class ResourceWithConnectionStringPromiseImpl implements ResourceWithConnectionStringPromise { constructor(private _promise: Promise) {} then( @@ -26849,27 +30006,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))); } } @@ -26878,7 +30035,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); } @@ -26890,12 +30062,12 @@ export class ResourceWithContainerFiles extends ResourceBuilderBase { +class ResourceWithContainerFilesPromiseImpl implements ResourceWithContainerFilesPromise { constructor(private _promise: Promise) {} then( @@ -26932,12 +30104,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())); } } @@ -26946,7 +30118,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); } @@ -26960,14 +30165,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 }; @@ -27102,12 +30307,12 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._withUrlForEndpointFactoryInternal(endpointName, callback)); + return new ResourceWithEndpointsPromiseImpl(this._withUrlForEndpointFactoryInternal(endpointName, callback)); } /** @internal */ @@ -27120,7 +30325,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 }; @@ -27172,12 +30377,12 @@ export class ResourceWithEndpoints extends ResourceBuilderBase Promise): ResourceWithEndpointsPromise { - return new ResourceWithEndpointsPromise(this._onResourceEndpointsAllocatedInternal(callback)); + return new ResourceWithEndpointsPromiseImpl(this._onResourceEndpointsAllocatedInternal(callback)); } } @@ -27187,7 +30392,7 @@ export class ResourceWithEndpoints extends ResourceBuilderBase { +class ResourceWithEndpointsPromiseImpl implements ResourceWithEndpointsPromise { constructor(private _promise: Promise) {} then( @@ -27199,27 +30404,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 */ @@ -27229,27 +30434,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))); } } @@ -27258,7 +30463,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); } @@ -27270,12 +30522,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 }; @@ -27335,12 +30587,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentCallbackInternal(callback)); + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -27350,12 +30602,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; @@ -27398,15 +30650,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 }; @@ -27528,12 +30780,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase Promise): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._testWithEnvironmentCallbackInternal(callback)); + return new ResourceWithEnvironmentPromiseImpl(this._testWithEnvironmentCallbackInternal(callback)); } /** @internal */ @@ -27543,12 +30795,12 @@ export class ResourceWithEnvironment extends ResourceBuilderBase): ResourceWithEnvironmentPromise { - return new ResourceWithEnvironmentPromise(this._withEnvironmentVariablesInternal(variables)); + return new ResourceWithEnvironmentPromiseImpl(this._withEnvironmentVariablesInternal(variables)); } } @@ -27558,7 +30810,7 @@ export class ResourceWithEnvironment extends ResourceBuilderBase { +class ResourceWithEnvironmentPromiseImpl implements ResourceWithEnvironmentPromise { constructor(private _promise: Promise) {} then( @@ -27570,92 +30822,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))); } } @@ -27664,86 +30916,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)); } } @@ -27753,7 +31026,7 @@ export class ResourceWithWaitSupport extends ResourceBuilderBase { +class ResourceWithWaitSupportPromiseImpl implements ResourceWithWaitSupportPromise { constructor(private _promise: Promise) {} then( @@ -27764,28 +31037,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))); } } @@ -27849,12 +31122,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..64e4c50a7db 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/base.verified.ts @@ -1,4 +1,4 @@ -// 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'; // Re-export transport types for convenience @@ -38,7 +38,14 @@ export { AtsErrorCodes, isMarshalledHandle, isAtsError, wrapIfHandle } from './t * await api.withEnvironment("REDIS_URL", expr); * ``` */ -export class ReferenceExpression { +export interface ReferenceExpression { + readonly isConditional: boolean; + toJSON(): { $expr: { format: string; valueProviders?: unknown[] } | { condition: unknown; whenTrue: unknown; whenFalse: unknown; matchValue: string } } | MarshalledHandle; + getValue(cancellationToken?: AbortSignal | CancellationToken): Promise; + toString(): string; +} + +class ReferenceExpressionImpl implements ReferenceExpression { // Expression mode fields private readonly _format?: string; private readonly _valueProviders?: unknown[]; @@ -90,40 +97,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. @@ -192,8 +165,51 @@ export class ReferenceExpression { } } +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 ReferenceExpressionImpl(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 ReferenceExpressionImpl(condition, matchValueOrWhenTrue, whenTrueOrWhenFalse, whenFalse!); + } + + return new ReferenceExpressionImpl(condition, 'True', matchValueOrWhenTrue, whenTrueOrWhenFalse); +} + +export const ReferenceExpression = { + create: createReferenceExpression, + createConditional: createConditionalReferenceExpression +}; + registerHandleWrapper('Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression', (handle, client) => - new ReferenceExpression(handle, client) + new ReferenceExpressionImpl(handle, client) ); /** @@ -266,11 +282,15 @@ 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 { +export class ResourceBuilderBase implements HandleReference { constructor(protected _handle: THandle, protected _client: AspireClient) {} toJSON(): MarshalledHandle { return this._handle.toJSON(); } 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..724836a73fd 100644 --- a/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/transport.verified.ts +++ b/tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests/Snapshots/transport.verified.ts @@ -104,6 +104,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; @@ -205,7 +216,12 @@ export class Handle { * const connectionString = await connectionStringExpression.getValue(cancellationToken); * ``` */ -export class CancellationToken { +export interface CancellationToken { + toJSON(): string | undefined; + register(client?: AspireClient): string | undefined; +} + +class CancellationTokenImpl implements CancellationToken { private readonly _signal?: AbortSignal; private readonly _remoteTokenId?: string; @@ -222,47 +238,49 @@ export class CancellationToken { /** * Creates a cancellation token from a local {@link AbortSignal}. */ - static from(signal?: AbortSignal): CancellationToken { - return new CancellationToken(signal); + 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); + } +} + +/** + * Creates transport-safe cancellation token values for the generated SDK. + */ +export const CancellationToken = { + from(signal?: AbortSignal): CancellationToken { + return new CancellationTokenImpl(signal); + }, + /** * Creates a cancellation token from a transport value. * Generated code uses this to materialize values that come from the AppHost. */ - static fromValue(value: unknown): CancellationToken { - if (value instanceof CancellationToken) { + fromValue(value: unknown): CancellationToken { + if (isCancellationTokenLike(value)) { return value; } if (typeof value === 'string') { - return new CancellationToken(value); + return new CancellationTokenImpl(value); } if (isAbortSignal(value)) { - return new CancellationToken(value); + return new CancellationTokenImpl(value); } - return new CancellationToken(); + return new CancellationTokenImpl(); } - - /** - * 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); - } -} +}; // ============================================================================ // Handle Wrapper Registry @@ -559,6 +577,22 @@ function resolveCancellationClient(client?: AspireClient): AspireClient { ); } +function isAspireClientLike(value: unknown): value is AspireClient { + 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. @@ -574,7 +608,7 @@ export function registerCancellation(client: AspireClient, signalOrToken?: Abort * 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(); @@ -591,7 +625,7 @@ export function registerCancellation( clientOrSignalOrToken?: AspireClient | 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 +634,7 @@ export function registerCancellation( return undefined; } - if (signalOrToken instanceof CancellationToken) { + if (isCancellationTokenLike(signalOrToken)) { return signalOrToken.register(client); } @@ -648,7 +682,7 @@ async function marshalTransportValue( return value; } - if (value instanceof CancellationToken) { + if (isCancellationTokenLike(value)) { const cancellationId = value.register(client); if (cancellationId !== undefined) { cancellationIds.push(cancellationId);