diff --git a/CommunityToolkit.Aspire.slnx b/CommunityToolkit.Aspire.slnx index a58bb4ef6..0032f5caf 100644 --- a/CommunityToolkit.Aspire.slnx +++ b/CommunityToolkit.Aspire.slnx @@ -51,6 +51,10 @@ + + + + @@ -251,6 +255,7 @@ + @@ -327,6 +332,7 @@ + diff --git a/Directory.Packages.props b/Directory.Packages.props index 2afb0fc61..05eb84018 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -76,6 +76,8 @@ + + + diff --git a/README.md b/README.md index 7d3a49d85..96be6d01f 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ This repository contains the source code for the Aspire Community Toolkit, a col | - **Learn More**: [`Hosting.Umami`][umami-integration-docs]
- Stable 📦: [![CommunityToolkit.Aspire.Hosting.Umami][umami-shields]][umami-nuget]
- Preview 📦: [![CommunityToolkit.Aspire.Hosting.Umami][umami-shields-preview]][umami-nuget-preview] | An Aspire hosting integration leveraging the [Umami](https://umami.is/) container. | | - **Learn More**: [`Hosting.Azure.Extensions`][azure-ext-integration-docs]
- Stable 📦: [![CommunityToolkit.Aspire.Azure.Extensions][azure-ext-shields]][azure-ext-nuget]
- Preview 📦: [![CommunityToolkit.Aspire.Hosting.Azure.Extensions][azure-ext-shields-preview]][azure-ext-nuget-preview] | An integration that contains some additional extensions for hosting Azure container. | | - **Learn More**: [`Hosting.Squad`][squad-integration-docs]
- Stable 📦: [![CommunityToolkit.Aspire.Hosting.Squad][squad-shields]][squad-nuget]
- Preview 📦: [![CommunityToolkit.Aspire.Hosting.Squad][squad-shields-preview]][squad-nuget-preview] | An Aspire hosting integration that models a [Squad](https://github.com/bradygaster/squad) AI-agent team as a first-class resource. | +| - **Learn More**: [`Hosting.Floci`][floci-integration-docs]
- Stable 📦: [![CommunityToolkit.Aspire.Hosting.Floci][floci-shields]][floci-nuget]
- Preview 📦: [![CommunityToolkit.Aspire.Hosting.Floci][floci-shields-preview]][floci-nuget-preview] | An Aspire hosting integration leveraging the [Floci](https://floci.io) AWS emulator container. | ## 🙌 Getting Started @@ -333,3 +334,8 @@ This project is supported by the [.NET Foundation](https://dotnetfoundation.org) [squad-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.Squad/ [squad-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.Squad?label=nuget%20(preview) [squad-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.Squad/absoluteLatest +[floci-integration-docs]: https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-floci +[floci-shields]: https://img.shields.io/nuget/v/CommunityToolkit.Aspire.Hosting.Floci +[floci-nuget]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.Floci/ +[floci-shields-preview]: https://img.shields.io/nuget/vpre/CommunityToolkit.Aspire.Hosting.Floci?label=nuget%20(preview) +[floci-nuget-preview]: https://nuget.org/packages/CommunityToolkit.Aspire.Hosting.Floci/absoluteLatest diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/CommunityToolkit.Aspire.Hosting.Floci.ApiService.csproj b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/CommunityToolkit.Aspire.Hosting.Floci.ApiService.csproj new file mode 100644 index 000000000..630ecb85b --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/CommunityToolkit.Aspire.Hosting.Floci.ApiService.csproj @@ -0,0 +1,14 @@ + + + + enable + enable + + + + + + + + + diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/Program.cs b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/Program.cs new file mode 100644 index 000000000..35e805d8c --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/Program.cs @@ -0,0 +1,351 @@ +using Amazon.Runtime; +using Amazon.S3; +using Amazon.S3.Model; +using Azure; +using Azure.Storage.Blobs; +using Google.Api.Gax; +using Google.Cloud.Storage.V1; +using Microsoft.Extensions.Diagnostics.HealthChecks; + +var builder = WebApplication.CreateBuilder(args); + +// --- AWS (S3) -------------------------------------------------------------- +// Read AWS config from env vars injected by Aspire's WithReference(floci). +// RegionEndpoint is intentionally omitted — the SDK resolves it from AWS_DEFAULT_REGION +// automatically, and combining ServiceURL + RegionEndpoint in SDK v4 triggers a NPE in +// the endpoint rule engine. +var awsEndpointUrl = Environment.GetEnvironmentVariable("AWS_ENDPOINT_URL")!; +var awsRegion = Environment.GetEnvironmentVariable("AWS_DEFAULT_REGION")!; +var awsAccessKey = Environment.GetEnvironmentVariable("AWS_ACCESS_KEY_ID")!; +var awsSecretKey = Environment.GetEnvironmentVariable("AWS_SECRET_ACCESS_KEY")!; + +var s3 = new AmazonS3Client( + new BasicAWSCredentials(awsAccessKey, awsSecretKey), + new AmazonS3Config + { + ServiceURL = awsEndpointUrl, + ForcePathStyle = true + }); + +builder.Services.AddSingleton(s3); + +// --- Azure (Blob Storage) ---------------------------------------------------- +// AZURE_STORAGE_CONNECTION_STRING is injected by Aspire's WithReference(flociAzure) — +// it already points BlobEndpoint at the Floci Azure emulator with the well-known +// devstoreaccount1 dev credentials. +var azureConnectionString = Environment.GetEnvironmentVariable("AZURE_STORAGE_CONNECTION_STRING")!; + +var blobServiceClient = new BlobServiceClient(azureConnectionString); + +builder.Services.AddSingleton(blobServiceClient); + +// --- GCP (Cloud Storage) ------------------------------------------------------ +// STORAGE_EMULATOR_HOST / GOOGLE_CLOUD_PROJECT are injected by Aspire's WithReference(flociGcp). +// EmulatorDetection.EmulatorOnly makes the client library read STORAGE_EMULATOR_HOST and skip +// real GCP credential resolution entirely. +var gcpProjectId = Environment.GetEnvironmentVariable("GOOGLE_CLOUD_PROJECT")!; + +var gcpStorageClient = await new StorageClientBuilder +{ + EmulatorDetection = EmulatorDetection.EmulatorOnly +}.BuildAsync(); + +builder.Services.AddSingleton(gcpStorageClient); + +// Creates the demo bucket/container once each Floci emulator is reachable; logs a warning if +// still starting. Runs concurrently with the health checks — failures here are non-fatal. +builder.Services.AddHostedService(); +builder.Services.AddHostedService(); +builder.Services.AddHostedService(); + +builder.Services.AddHealthChecks() + .AddAsyncCheck("floci-s3", async ct => + { + try + { + var response = await s3.ListBucketsAsync(ct); + if (response?.Buckets == null) + { + return HealthCheckResult.Unhealthy("Floci S3 returned null buckets list"); + } + return HealthCheckResult.Healthy($"Floci S3 reachable — {response.Buckets.Count} bucket(s)"); + } + catch (Exception ex) + { + return HealthCheckResult.Unhealthy("Floci S3 unreachable", ex); + } + }) + .AddAsyncCheck("floci-azure-blob", async ct => + { + try + { + var count = 0; + await foreach (var _ in blobServiceClient.GetBlobContainersAsync(cancellationToken: ct)) + { + count++; + } + return HealthCheckResult.Healthy($"Floci Azure Blob reachable — {count} container(s)"); + } + catch (Exception ex) + { + return HealthCheckResult.Unhealthy("Floci Azure Blob unreachable", ex); + } + }) + .AddAsyncCheck("floci-gcp-storage", async ct => + { + try + { + var count = 0; + await foreach (var _ in gcpStorageClient.ListBucketsAsync(gcpProjectId).WithCancellation(ct)) + { + count++; + } + return HealthCheckResult.Healthy($"Floci GCP Storage reachable — {count} bucket(s)"); + } + catch (Exception ex) + { + return HealthCheckResult.Unhealthy("Floci GCP Storage unreachable", ex); + } + }); + +var app = builder.Build(); + +app.Logger.LogInformation( + "AWS endpoint={AwsEndpoint} region={AwsRegion} | Azure blob endpoint present={HasAzureConn} | GCP project={GcpProject}", + awsEndpointUrl, awsRegion, !string.IsNullOrEmpty(azureConnectionString), gcpProjectId); + +// /alive — liveness probe (process is up, no dependency checks) +// /health — readiness probe (checks S3/Blob/GCS connectivity) +app.MapGet("/alive", () => Results.Ok()); +app.MapHealthChecks("/health"); + +// --- S3 demo endpoints ------------------------------------------------------- + +// List all buckets currently in Floci +app.MapGet("/s3/buckets", async (IAmazonS3 s3) => +{ + var response = await s3.ListBucketsAsync(); + return (response?.Buckets ?? []).Select(b => new { b.BucketName, b.CreationDate }); +}); + +// Create a new bucket +app.MapPost("/s3/{bucket}", async (string bucket, IAmazonS3 s3) => +{ + await s3.PutBucketAsync(new PutBucketRequest { BucketName = bucket }); + return Results.Created($"/s3/{bucket}", new { bucket }); +}); + +// Store a text value at bucket/key +app.MapPut("/s3/{bucket}/{*key}", async (string bucket, string key, HttpRequest request, IAmazonS3 s3) => +{ + using var reader = new StreamReader(request.Body); + var body = await reader.ReadToEndAsync(); + await s3.PutObjectAsync(new PutObjectRequest { BucketName = bucket, Key = key, ContentBody = body }); + return Results.Created($"/s3/{bucket}/{key}", new { bucket, key, size = body.Length }); +}); + +// Retrieve a value previously stored at bucket/key +app.MapGet("/s3/{bucket}/{*key}", async (string bucket, string key, IAmazonS3 s3) => +{ + try + { + var response = await s3.GetObjectAsync(new GetObjectRequest { BucketName = bucket, Key = key }); + using var reader = new StreamReader(response.ResponseStream); + return Results.Ok(await reader.ReadToEndAsync()); + } + catch (AmazonS3Exception ex) when (ex.ErrorCode is "NoSuchKey" or "NoSuchBucket") + { + return Results.NotFound(new { bucket, key }); + } +}); + +// --- Azure Blob demo endpoints ------------------------------------------------ + +// List all containers currently in Floci Azure +app.MapGet("/azure/containers", async (BlobServiceClient blobServiceClient) => +{ + var containers = new List(); + await foreach (var container in blobServiceClient.GetBlobContainersAsync()) + { + containers.Add(new { container.Name, LastModified = container.Properties.LastModified }); + } + return containers; +}); + +// Create a new container +app.MapPost("/azure/{container}", async (string container, BlobServiceClient blobServiceClient) => +{ + await blobServiceClient.GetBlobContainerClient(container).CreateIfNotExistsAsync(); + return Results.Created($"/azure/{container}", new { container }); +}); + +// Store a text value at container/key as a blob +app.MapPut("/azure/{container}/{*key}", async (string container, string key, HttpRequest request, BlobServiceClient blobServiceClient) => +{ + using var reader = new StreamReader(request.Body); + var body = await reader.ReadToEndAsync(); + var containerClient = blobServiceClient.GetBlobContainerClient(container); + await containerClient.CreateIfNotExistsAsync(); + using var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(body)); + await containerClient.GetBlobClient(key).UploadAsync(stream, overwrite: true); + return Results.Created($"/azure/{container}/{key}", new { container, key, size = body.Length }); +}); + +// Retrieve a value previously stored at container/key +app.MapGet("/azure/{container}/{*key}", async (string container, string key, BlobServiceClient blobServiceClient) => +{ + try + { + var blobClient = blobServiceClient.GetBlobContainerClient(container).GetBlobClient(key); + var response = await blobClient.DownloadContentAsync(); + return Results.Ok(response.Value.Content.ToString()); + } + catch (RequestFailedException ex) when (ex.ErrorCode is "BlobNotFound" or "ContainerNotFound") + { + return Results.NotFound(new { container, key }); + } +}); + +// --- GCP Storage demo endpoints ------------------------------------------------ + +// List all buckets currently in Floci GCP +app.MapGet("/gcp/buckets", async (StorageClient gcpStorageClient) => +{ + var buckets = new List(); + await foreach (var bucket in gcpStorageClient.ListBucketsAsync(gcpProjectId)) + { + buckets.Add(new { bucket.Name, TimeCreated = bucket.TimeCreatedDateTimeOffset }); + } + return buckets; +}); + +// Create a new bucket +app.MapPost("/gcp/{bucket}", async (string bucket, StorageClient gcpStorageClient) => +{ + await gcpStorageClient.CreateBucketAsync(gcpProjectId, bucket); + return Results.Created($"/gcp/{bucket}", new { bucket }); +}); + +// Store a text value at bucket/key as an object +app.MapPut("/gcp/{bucket}/{*key}", async (string bucket, string key, HttpRequest request, StorageClient gcpStorageClient) => +{ + using var reader = new StreamReader(request.Body); + var body = await reader.ReadToEndAsync(); + using var stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(body)); + await gcpStorageClient.UploadObjectAsync(bucket, key, "text/plain", stream); + return Results.Created($"/gcp/{bucket}/{key}", new { bucket, key, size = body.Length }); +}); + +// Retrieve a value previously stored at bucket/key +app.MapGet("/gcp/{bucket}/{*key}", async (string bucket, string key, StorageClient gcpStorageClient) => +{ + try + { + using var stream = new MemoryStream(); + await gcpStorageClient.DownloadObjectAsync(bucket, key, stream); + return Results.Ok(System.Text.Encoding.UTF8.GetString(stream.ToArray())); + } + catch (Google.GoogleApiException ex) when (ex.HttpStatusCode == System.Net.HttpStatusCode.NotFound) + { + return Results.NotFound(new { bucket, key }); + } +}); + +app.Run(); + +/// Hosted service that creates the demo bucket once the app starts. +/// Runs concurrently with the health check; failures are non-fatal since +/// Floci may still be initialising when the API first comes up. +class AwsBucketInitializer(IAmazonS3 s3, ILogger logger) : IHostedService +{ + public async Task StartAsync(CancellationToken ct) + { + try + { + var buckets = await s3.ListBucketsAsync(ct); + if (buckets?.Buckets == null || !buckets.Buckets.Any(b => b.BucketName == Demo.Name)) + { + await s3.PutBucketAsync(new PutBucketRequest { BucketName = Demo.Name }, ct); + logger.LogInformation("Created demo S3 bucket '{Bucket}'", Demo.Name); + } + else + { + logger.LogInformation("Demo S3 bucket '{Bucket}' already exists", Demo.Name); + } + } + catch (Exception ex) + { + logger.LogWarning(ex, "Demo S3 bucket init deferred — Floci may still be starting"); + } + } + + public Task StopAsync(CancellationToken ct) => Task.CompletedTask; +} + +/// Hosted service that creates the demo blob container once the app starts. +/// Runs concurrently with the health check; failures are non-fatal since +/// Floci may still be initialising when the API first comes up. +class AzureContainerInitializer(BlobServiceClient blobServiceClient, ILogger logger) : IHostedService +{ + public async Task StartAsync(CancellationToken ct) + { + try + { + var response = await blobServiceClient.GetBlobContainerClient(Demo.Name).CreateIfNotExistsAsync(cancellationToken: ct); + logger.LogInformation( + response != null ? "Created demo Azure Blob container '{Container}'" : "Demo Azure Blob container '{Container}' already exists", + Demo.Name); + } + catch (Exception ex) + { + logger.LogWarning(ex, "Demo Azure Blob container init deferred — Floci may still be starting"); + } + } + + public Task StopAsync(CancellationToken ct) => Task.CompletedTask; +} + +/// Hosted service that creates the demo bucket once the app starts. +/// Runs concurrently with the health check; failures are non-fatal since +/// Floci may still be initialising when the API first comes up. +class GcpBucketInitializer(StorageClient gcpStorageClient, ILogger logger) : IHostedService +{ + public async Task StartAsync(CancellationToken ct) + { + try + { + var projectId = Environment.GetEnvironmentVariable("GOOGLE_CLOUD_PROJECT") ?? "floci-local"; + var exists = false; + await foreach (var bucket in gcpStorageClient.ListBucketsAsync(projectId).WithCancellation(ct)) + { + if (bucket.Name == Demo.Name) + { + exists = true; + break; + } + } + + if (!exists) + { + await gcpStorageClient.CreateBucketAsync(projectId, Demo.Name, cancellationToken: ct); + logger.LogInformation("Created demo GCP Storage bucket '{Bucket}'", Demo.Name); + } + else + { + logger.LogInformation("Demo GCP Storage bucket '{Bucket}' already exists", Demo.Name); + } + } + catch (Exception ex) + { + logger.LogWarning(ex, "Demo GCP Storage bucket init deferred — Floci may still be starting"); + } + } + + public Task StopAsync(CancellationToken ct) => Task.CompletedTask; +} + +/// Shared demo bucket/container name used across all three clouds. +static class Demo +{ + public const string Name = "aspire-demo"; +} diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/Properties/launchSettings.json b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/Properties/launchSettings.json new file mode 100644 index 000000000..139284692 --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.ApiService/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "profiles": { + "CommunityToolkit.Aspire.Hosting.Floci.ApiService": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:56381" + } + } +} \ No newline at end of file diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/apphost.mts b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/apphost.mts new file mode 100644 index 000000000..501f8eafe --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/apphost.mts @@ -0,0 +1,151 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { createBuilder } from './.aspire/modules/aspire.mjs'; + +const builder = await createBuilder(); + +// ── Runtime path (actually executed) ───────────────────────────────────────── +const flociAws = await builder.addFlociAws('floci-aws'); +const flociAzure = await builder.addFlociAzure('floci-az'); +const flociGcp = await builder.addFlociGcp('floci-gcp'); + +// A single Floci UI console browses all three clouds — flociAws.withFlociUI() creates the +// console wired to AWS, then withPluggedCloud attaches the Azure and GCP resources to it. +await flociAws.withFlociUI({ + configureContainer: async (ui) => { + await ui.withPluggedCloudAzure(flociAzure); + await ui.withPluggedCloudGcp(flociGcp); + }, +}); + +const appHostDirectory = path.dirname(fileURLToPath(import.meta.url)); +const apiServiceProject = "CommunityToolkit.Aspire.Hosting.Floci.ApiService"; +const apiServiceProjectPath = path.join(appHostDirectory, "..", apiServiceProject, apiServiceProject + ".csproj"); + +const apiService = await builder.addProject("floci-api", apiServiceProjectPath) + .withExternalHttpEndpoints() + .withHttpHealthCheck({ path: "/health" }) + .withReference(flociAws) + .withReference(flociAzure) + .withReference(flociGcp) + .waitFor(flociAws) + .waitFor(flociAzure) + .waitFor(flociGcp); + +// ── Custom port and region ──────────────────────────────────────────────────── +await builder.addFlociAws('floci-custom', { + port: 14566, + defaultRegion: 'eu-west-1', + defaultAccountId: '123456789012', +}); + +// ── Custom project ID (GCP) ─────────────────────────────────────────────────── +await builder.addFlociGcp('floci-gcp-custom', { + defaultProjectId: 'my-project', +}); + +// ── Persistent storage — named volume ───────────────────────────────────────── +// Switches Floci from in-memory to persistent mode automatically. +const flociPersistent = await builder.addFlociAws('floci-persistent'); +await flociPersistent.withDataVolume('floci-data'); + +// ── Persistent storage — bind mount ─────────────────────────────────────────── +const flociMount = await builder.addFlociAws('floci-mount'); +await flociMount.withDataBindMount('/tmp/floci-data'); + +// ── Compile-time coverage ───────────────────────────────────────────────────── +// Guards with false so these are type-checked but never executed. +// Covers API surface that requires special host setup (Docker socket, cert files) or that +// would just be redundant with the AWS coverage already exercised on the runtime path above. +const includeCompileOnlyScenarios = false; + +if (includeCompileOnlyScenarios) { + + // ── Floci UI web console — custom container name and host port ──────────── + const _withUi = await builder.addFlociAws('floci-with-ui'); + await _withUi.withFlociUI({ + containerName: 'my-floci-ui', + configureContainer: async (ui) => { + await ui.withHostPort({ port: 14500 }); + }, + }); + + // ── Custom socket path ──────────────────────────────────────────────────── + // Non-standard Docker installations (Podman, Rancher Desktop) expose the + // socket at a different path; pass it explicitly. Available on all three clouds. + const _podman = await builder.addFlociAws('floci-podman'); + await _podman.withDockerSocket({ + socketPath: '/run/user/1000/podman/podman.sock' + }); + + const _azurePodman = await builder.addFlociAzure('floci-az-podman'); + await _azurePodman.withDockerSocket({ + socketPath: '/run/user/1000/podman/podman.sock' + }); + + const _gcpPodman = await builder.addFlociGcp('floci-gcp-podman'); + await _gcpPodman.withDockerSocket({ + socketPath: '/run/user/1000/podman/podman.sock' + }); + + // ── Persistent storage — Azure and GCP ───────────────────────────────────── + const _azurePersistent = await builder.addFlociAzure('floci-az-persistent'); + await _azurePersistent.withDataVolume('floci-az-data'); + + const _azureMount = await builder.addFlociAzure('floci-az-mount'); + await _azureMount.withDataBindMount('/tmp/floci-az-data'); + + const _gcpPersistent = await builder.addFlociGcp('floci-gcp-persistent'); + await _gcpPersistent.withDataVolume('floci-gcp-data'); + + const _gcpMount = await builder.addFlociGcp('floci-gcp-mount'); + await _gcpMount.withDataBindMount('/tmp/floci-gcp-data'); + + // ── Custom Quarkus config file (AWS only) ────────────────────────────────── + // Mounts application.yml read-only at /deployments/config/application.yml + // inside the container so Quarkus merges it with built-in defaults on startup. + const _configured = await builder.addFlociAws('floci-configured'); + await _configured.withConfigFile('./floci.yml'); + + // ── Connection string / endpoint properties — all three clouds ──────────── + // connectionStringExpression → http://localhost:{port} (host processes) + // http://host.docker.internal:{port} (containers) + const _awsEndpoint = await flociAws.primaryEndpoint(); + const _awsHost = await flociAws.host(); + const _awsPort = await flociAws.port(); + const _awsConnectionString = await flociAws.connectionStringExpression(); + + const _azureEndpoint = await flociAzure.primaryEndpoint(); + const _azureHost = await flociAzure.host(); + const _azurePort = await flociAzure.port(); + const _azureConnectionString = await flociAzure.connectionStringExpression(); + + const _gcpEndpoint = await flociGcp.primaryEndpoint(); + const _gcpHost = await flociGcp.host(); + const _gcpPort = await flociGcp.port(); + const _gcpConnectionString = await flociGcp.connectionStringExpression(); + + // ── WithReference — env var injection per cloud ──────────────────────────── + // Standard WithReference injects: + // ConnectionStrings__floci = http://localhost:{port} + // AWS_ENDPOINT_URL = http://localhost:{port} (or host.docker.internal for containers) + // AWS_DEFAULT_REGION = us-east-1 + // AWS_ACCESS_KEY_ID = test + // AWS_SECRET_ACCESS_KEY = test + // For Azure: AZURE_STORAGE_CONNECTION_STRING (devstoreaccount1 dev credentials) + // For GCP: PUBSUB_EMULATOR_HOST, FIRESTORE_EMULATOR_HOST, DATASTORE_EMULATOR_HOST, + // STORAGE_EMULATOR_HOST, SECRET_MANAGER_EMULATOR_HOST, GOOGLE_CLOUD_PROJECT + const _project = await builder + .addProject('api', '../FlociApi/FlociApi.csproj') + .withReference(flociAws) + .withReference(flociAzure) + .withReference(flociGcp); + + const _container = await builder + .addContainer('worker', 'myorg/worker') + .withReference(flociAws) + .withReference(flociAzure) + .withReference(flociGcp); +} + +await builder.build().run(); diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/aspire.config.json b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/aspire.config.json new file mode 100644 index 000000000..0ae5759ff --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "apphost.mts", + "language": "typescript/nodejs" + }, + "sdk": { + "version": "13.4.3" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29760;http://localhost:28941", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10985", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13329" + } + } + }, + "packages": { + "CommunityToolkit.Aspire.Hosting.Floci": "../../../src/CommunityToolkit.Aspire.Hosting.Floci/CommunityToolkit.Aspire.Hosting.Floci.csproj" + } +} diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/eslint.config.mjs b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/eslint.config.mjs new file mode 100644 index 000000000..001a84a17 --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/eslint.config.mjs @@ -0,0 +1,17 @@ +// @ts-check + +import { defineConfig } from 'eslint/config'; +import tseslint from 'typescript-eslint'; + +export default defineConfig({ + files: ['apphost.mts'], + extends: [tseslint.configs.base], + languageOptions: { + parserOptions: { + projectService: true, + }, + }, + rules: { + '@typescript-eslint/no-floating-promises': ['error', { checkThenables: true }], + }, +}); diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/package-lock.json b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/package-lock.json new file mode 100644 index 000000000..2c2c67b8d --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/package-lock.json @@ -0,0 +1,2037 @@ +{ + "name": "communitytoolkit-aspire-hosting-floci-apphost-typescript", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "communitytoolkit-aspire-hosting-floci-apphost-typescript", + "version": "1.0.0", + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "eslint": "^10.0.3", + "nodemon": "^3.1.14", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.57.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz", + "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz", + "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz", + "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz", + "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz", + "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz", + "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz", + "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz", + "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz", + "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz", + "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz", + "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz", + "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz", + "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz", + "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz", + "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz", + "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz", + "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz", + "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz", + "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz", + "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz", + "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz", + "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz", + "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz", + "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz", + "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz", + "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.6.0.tgz", + "integrity": "sha512-ii6Bw9jJ2zi2cWA2Z+9/QZ/+3DX6kwaV5Q986D/CdP3Lap3w/pgQZ373FV7byY/i7L4IRH/G43I5dz1ClsCbpA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.2.tgz", + "integrity": "sha512-+CNAzxglkrpNf/kKywqQfk74QjtceuOE7Qm+AF8miRvPF/wmmK5+OJOgVh3AVTT3RP2mH3+FOaxlE5v72owk0A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.20.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.0.tgz", + "integrity": "sha512-QWlFW2wf3nTjC13/DqRnBpR4ZO36VJH/JVBkA/vcnmbTBNQIlnObqyqZE1tUR7+Ni23Lda8R1BxMfbXRpCUx5g==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.62.1.tgz", + "integrity": "sha512-4EQM77WgVNxj7OkL/5b/D/xZsw00G577+UriYTC7JF5opcF3T2AuoeY7ueLaZgSVjSgCS6yOAJB5bRGLPSJUzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.62.1", + "@typescript-eslint/type-utils": "8.62.1", + "@typescript-eslint/utils": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.62.1", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.62.1.tgz", + "integrity": "sha512-sPhE4iHuJDSvoAiec+Ro8JyXw8f0ql13HFR82P99nCm9GwTEKG0KYLvDe6REk8BCXuit6vJAv/Yxg5ABaNS2rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.62.1", + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.62.1.tgz", + "integrity": "sha512-yQ3RgY5RkSBpsNS1Bx/JQEcA24FOSdfGktoyprAr5u18390UQdtVcfnEv4nIrIshNnavlVyZBKxQwT1fIAE6cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.62.1", + "@typescript-eslint/types": "^8.62.1", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.62.1.tgz", + "integrity": "sha512-r4d249KbQ1SFdpeStvob8Ih6aPPIzfqllPVOtvhve6ZcpuVcYo5/7zUWckKpHE7StASX4kTKZTLf0WQm/wPkcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.62.1.tgz", + "integrity": "sha512-xadytJqX9vJVQ2fdQjkcIVigwaOJNWkpjdLt6cEQ+xPnrI1fkp+/jZE/I97k9KUjqtpd25i0HeyZf3T6dutv2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.62.1.tgz", + "integrity": "sha512-aXM5xlqXiTxPibXB93cLAURfT3rlizf7uMXISCXy66Isr/9hISJx3yDsKl0L7lKa51b8JpFuNKby0/O0pEm9jg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1", + "@typescript-eslint/utils": "8.62.1", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.62.1.tgz", + "integrity": "sha512-ooCzJFaf+Hg+uG6fA3NRFGuFjlfNlDhBthbv4ZPU/0elCAFUfnyXUvf/WOpHz/jYwSmvU2GkR2LtyUfy1AxZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.62.1.tgz", + "integrity": "sha512-xMcW9oP9u7fAMXYs9A65CVmtLQe2r//oXINHfi8HV+oiqhih17sbLdhXr4540YWlgpDKQdY854OL5ZrdCiQsAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.62.1", + "@typescript-eslint/tsconfig-utils": "8.62.1", + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/visitor-keys": "8.62.1", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.62.1.tgz", + "integrity": "sha512-sHtbPfuKNZCG+ih8SyjjucqRntSVmp8XgL5u6o9mAhiSn8ds5o/M/XdM0abweme2Tln3szOstOrZ9OXitvPh0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.62.1", + "@typescript-eslint/types": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.62.1.tgz", + "integrity": "sha512-4g3BLxfdTMy8iZG0MaBkadnlRrCJ74cQiFbyEVMrkwIoqdyaXXQM22cotDvrl4x28wgIZ9rEJRoM+mmhSJpJ1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.62.1", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.7.tgz", + "integrity": "sha512-7oFy703dxfY3/NLxC1fh2SUCQ0H9rmAY+5EpDVfXjUTTs+HEwR2nYaqLv+GWcTsumwxPfiz6CzCNkwXwBUwqCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.1.tgz", + "integrity": "sha512-HrJrvZv5ayxBzPfwphOoNzkzOIIlifzk0KJrGK2c8R4+LKpMtpYLQeUdjnwjWv/LZlkH2laZk+4w78pi99D4Vw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.1", + "@esbuild/android-arm": "0.28.1", + "@esbuild/android-arm64": "0.28.1", + "@esbuild/android-x64": "0.28.1", + "@esbuild/darwin-arm64": "0.28.1", + "@esbuild/darwin-x64": "0.28.1", + "@esbuild/freebsd-arm64": "0.28.1", + "@esbuild/freebsd-x64": "0.28.1", + "@esbuild/linux-arm": "0.28.1", + "@esbuild/linux-arm64": "0.28.1", + "@esbuild/linux-ia32": "0.28.1", + "@esbuild/linux-loong64": "0.28.1", + "@esbuild/linux-mips64el": "0.28.1", + "@esbuild/linux-ppc64": "0.28.1", + "@esbuild/linux-riscv64": "0.28.1", + "@esbuild/linux-s390x": "0.28.1", + "@esbuild/linux-x64": "0.28.1", + "@esbuild/netbsd-arm64": "0.28.1", + "@esbuild/netbsd-x64": "0.28.1", + "@esbuild/openbsd-arm64": "0.28.1", + "@esbuild/openbsd-x64": "0.28.1", + "@esbuild/openharmony-arm64": "0.28.1", + "@esbuild/sunos-x64": "0.28.1", + "@esbuild/win32-arm64": "0.28.1", + "@esbuild/win32-ia32": "0.28.1", + "@esbuild/win32-x64": "0.28.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.6.0.tgz", + "integrity": "sha512-6lVbcqSodALYo+4ELD0heG6lFiFxnLMuLkiMi2qV8LMp54N8tE8FT1GMH+ev4Ti00nFjNze2+Su6DsV5OQW3Dg==", + "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.6.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.2", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz", + "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true, + "license": "ISC" + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "10.2.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz", + "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.5" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "3.1.14", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.14.tgz", + "integrity": "sha512-jakjZi93UtB3jHMWsXL68FXSAosbLfY0In5gtKq3niLSkrWznrVBzXFNOEMJUfc9+Ke7SHWoAZsiMkNP3vq6Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^10.2.1", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true, + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "license": "ISC", + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tsx": { + "version": "4.22.4", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.22.4.tgz", + "integrity": "sha512-X8EX+XV4QR5xCsrgxaED954zTDfY8KqlDtskKEL0cHhyS/P8b4IFOvGDQpsC9Q1XnLq915wEfwwY/zzskCtmhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.62.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.62.1.tgz", + "integrity": "sha512-vymnnM5g0AKQDSAyfP12nMIBvgwgA42syg74kkuZ4x1VuTzwQKwc5h9rGxeShCjny5o+zWAb6OEoz7XLgrIkIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.62.1", + "@typescript-eslint/parser": "8.62.1", + "@typescript-eslint/typescript-estree": "8.62.1", + "@typescript-eslint/utils": "8.62.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.1.tgz", + "integrity": "sha512-kdjOSJ2lLIn7r1rtrMbbNCHjyMPfRnowdKjBQ+mGq6NAW5QY2bEZC/khaC5OR8svbbjvLEaIXkOq45e2X9BIbQ==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/package.json b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/package.json new file mode 100644 index 000000000..43bc8dd2d --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/package.json @@ -0,0 +1,28 @@ +{ + "name": "communitytoolkit-aspire-hosting-floci-apphost-typescript", + "version": "1.0.0", + "private": true, + "type": "module", + "scripts": { + "lint": "eslint apphost.mts", + "predev": "npm run lint", + "dev": "aspire run", + "prebuild": "npm run lint", + "build": "tsc", + "watch": "tsc --watch" + }, + "dependencies": { + "vscode-jsonrpc": "^8.2.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "devDependencies": { + "@types/node": "^22.0.0", + "eslint": "^10.0.3", + "nodemon": "^3.1.14", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "typescript-eslint": "^8.57.1" + } +} diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/tsconfig.json b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/tsconfig.json new file mode 100644 index 000000000..e70fa1fa2 --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": [ + "apphost.mts", + ".aspire/modules/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost/CommunityToolkit.Aspire.Hosting.Floci.AppHost.csproj b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost/CommunityToolkit.Aspire.Hosting.Floci.AppHost.csproj new file mode 100644 index 000000000..d03c40965 --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost/CommunityToolkit.Aspire.Hosting.Floci.AppHost.csproj @@ -0,0 +1,24 @@ + + + + Exe + enable + enable + true + a1b2c3d4-e5f6-7890-abcd-ef1234567890 + + + + $(NoWarn);ASPIRECERTIFICATES001 + + + + + + + + + + + + diff --git a/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost/Program.cs b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost/Program.cs new file mode 100644 index 000000000..4a125cf5a --- /dev/null +++ b/examples/floci/CommunityToolkit.Aspire.Hosting.Floci.AppHost/Program.cs @@ -0,0 +1,27 @@ +var builder = DistributedApplication.CreateBuilder(args); + +var flociAws = builder.AddFlociAws("floci-aws"); +var flociAzure = builder.AddFlociAzure("floci-az"); +var flociGcp = builder.AddFlociGcp("floci-gcp"); + +// A single Floci UI console browses all three clouds — flociAws.WithFlociUI() creates the +// console wired to AWS, then WithPluggedCloud attaches the Azure and GCP resources to it. +// Named "floci-ui" (not "floci-aws-ui") since it isn't AWS-specific once the other clouds +// are plugged in. +flociAws.WithFlociUI(configureContainer: ui => +{ + ui.WithPluggedCloud(flociAzure); + ui.WithPluggedCloud(flociGcp); +}, containerName: "floci-ui"); + +builder.AddProject("floci-api") + .WithExternalHttpEndpoints() + .WithHttpHealthCheck("/health") + .WithReference(flociAws) + .WithReference(flociAzure) + .WithReference(flociGcp) + .WaitFor(flociAws) + .WaitFor(flociAzure) + .WaitFor(flociGcp); + +builder.Build().Run(); diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/CommunityToolkit.Aspire.Hosting.Floci.csproj b/src/CommunityToolkit.Aspire.Hosting.Floci/CommunityToolkit.Aspire.Hosting.Floci.csproj new file mode 100644 index 000000000..6f1a828b3 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/CommunityToolkit.Aspire.Hosting.Floci.csproj @@ -0,0 +1,17 @@ + + + + An Aspire component leveraging the Floci AWS emulator container. Includes a WithFlociUI() extension for running the Floci UI web console alongside the emulator. + floci aws localstack emulator hosting ui + + + + + + + + + + + + diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociAwsContainerResource.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociAwsContainerResource.cs new file mode 100644 index 000000000..1beb46510 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociAwsContainerResource.cs @@ -0,0 +1,50 @@ +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting.ApplicationModel; + +/// +/// Resource for the Floci AWS emulator container. +/// +/// The name of the resource. +[AspireExport(ExposeProperties = true)] +public class FlociAwsContainerResource(string name) : FlociContainerResource(name, AwsEndpointName) +{ + internal const int AwsEndpointPort = 4566; + internal const string AwsEndpointName = "aws"; + internal const string HostnameEnvVar = "FLOCI_HOSTNAME"; + internal const string DefaultRegionEnvVar = "FLOCI_DEFAULT_REGION"; + internal const string DefaultAccountIdEnvVar = "FLOCI_DEFAULT_ACCOUNT_ID"; + + // Quarkus JVM Docker image config override path + internal const string ConfigMountPath = "/deployments/config/application.yml"; + + /// + /// Gets the AWS region configured for this Floci instance. + /// Set by from the defaultRegion parameter. + /// Used by the BeforeStartEvent subscriber to inject AWS_DEFAULT_REGION into dependent resources. + /// + internal string DefaultRegion { get; init; } = "us-east-1"; + + /// + /// Gets the default AWS account ID configured for this Floci instance. + /// Set by from the defaultAccountId parameter. + /// Used by WithFlociUI to inject FLOCI_DEFAULT_ACCOUNT_ID into the UI container. + /// + internal string DefaultAccountId { get; init; } = "000000000000"; + + internal override void ApplyUIEnvironment(EnvironmentCallbackContext context) + { + // Floci serves HTTP on the same port (4566), so the http:// endpoint URL stays valid. + context.EnvironmentVariables[FlociUIContainerResource.EndpointEnvVar] = + ReferenceExpression.Create($"{PrimaryEndpoint}"); + context.EnvironmentVariables[FlociUIContainerResource.RegionEnvVar] = DefaultRegion; + context.EnvironmentVariables[FlociUIContainerResource.AccessKeyIdEnvVar] = "test"; + context.EnvironmentVariables[FlociUIContainerResource.SecretAccessKeyEnvVar] = "test"; + context.EnvironmentVariables[FlociUIContainerResource.DefaultAccountIdEnvVar] = DefaultAccountId; + } + + internal override string DockerHostEnvVar => "FLOCI_DOCKER_DOCKER_HOST"; + internal override string StorageModeEnvVar => "FLOCI_STORAGE_MODE"; +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociAzureContainerResource.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociAzureContainerResource.cs new file mode 100644 index 000000000..d07696cb8 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociAzureContainerResource.cs @@ -0,0 +1,30 @@ +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting.ApplicationModel; + +/// +/// Resource for the Floci Azure emulator container. +/// +/// The name of the resource. +[AspireExport(ExposeProperties = true)] +public class FlociAzureContainerResource(string name) : FlociContainerResource(name, "azure") +{ + internal const int EndpointPort = 4577; + internal const string HostnameEnvVar = "FLOCI_AZ_HOSTNAME"; + + // Well-known Azurite-compatible dev credentials that floci-az accepts by default (no auth enforced). + internal const string DefaultAccountName = "devstoreaccount1"; + internal const string DefaultAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMh0=="; + + internal override void ApplyUIEnvironment(EnvironmentCallbackContext context) + { + context.EnvironmentVariables[FlociUIContainerResource.AzureEndpointEnvVar] = + ReferenceExpression.Create($"{PrimaryEndpoint}"); + context.EnvironmentVariables[FlociUIContainerResource.AzureAccountNameEnvVar] = DefaultAccountName; + } + + internal override string DockerHostEnvVar => "FLOCI_AZ_DOCKER_DOCKER_HOST"; + internal override string StorageModeEnvVar => "FLOCI_AZ_STORAGE_MODE"; +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociContainerImageTags.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociContainerImageTags.cs new file mode 100644 index 000000000..b6a9925dd --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociContainerImageTags.cs @@ -0,0 +1,20 @@ +namespace CommunityToolkit.Aspire.Hosting.Floci; + +internal static class FlociContainerImageTags +{ + public const string AwsRegistry = "docker.io"; + public const string AwsImage = "floci/floci"; + public const string AwsTag = "latest"; // Consider pinning to a specific version tag for reproducible builds/runs (or document why only `latest` is available). + + public const string AzureRegistry = "docker.io"; + public const string AzureImage = "floci/floci-az"; + public const string AzureTag = "latest"; + + public const string GcpRegistry = "docker.io"; + public const string GcpImage = "floci/floci-gcp"; + public const string GcpTag = "latest"; + + public const string UIRegistry = "docker.io"; + public const string UIImage = "floci/floci-ui"; + public const string UITag = "0.2.0"; +} diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociContainerResource.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociContainerResource.cs new file mode 100644 index 000000000..980bbf3e9 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociContainerResource.cs @@ -0,0 +1,67 @@ +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting.ApplicationModel; + +/// +/// Common base for Floci cloud-emulator container resources (AWS, Azure, GCP). +/// Holds the shared endpoint/connection-string plumbing so each cloud only needs to +/// implement its own image, container env vars, and Floci UI wiring. +/// +/// The name of the resource. +/// The name of the primary HTTP endpoint for this cloud's emulator. +public abstract class FlociContainerResource(string name, string endpointName) : ContainerResource(name), IResourceWithConnectionString +{ + private EndpointReference? _primaryEndpoint; + + internal string EndpointName { get; } = endpointName; + + /// + /// Gets the primary endpoint reference for the Floci container. + /// + public EndpointReference PrimaryEndpoint => _primaryEndpoint ??= new EndpointReference(this, EndpointName); + + /// + /// Gets the host endpoint reference for the primary endpoint. + /// + public EndpointReferenceExpression Host => PrimaryEndpoint.Property(EndpointProperty.Host); + + /// + /// Gets the port endpoint reference for the primary endpoint. + /// + public EndpointReferenceExpression Port => PrimaryEndpoint.Property(EndpointProperty.Port); + + /// + /// Gets the emulator endpoint URL. + /// + public ReferenceExpression ConnectionStringExpression => + ReferenceExpression.Create($"http://{Host}:{Port}"); + + IEnumerable> IResourceWithConnectionString.GetConnectionProperties() + { + yield return new("Host", ReferenceExpression.Create($"{Host}")); + yield return new("Port", ReferenceExpression.Create($"{Port}")); + yield return new("Uri", ConnectionStringExpression); + } + + /// + /// Sets the Floci UI environment variables needed for this cloud's adapter to connect. + /// Implemented by each concrete cloud resource so WithFlociUI and WithPluggedCloud + /// can attach any combination of clouds to a single shared UI container. + /// + internal abstract void ApplyUIEnvironment(EnvironmentCallbackContext context); + + /// + /// Gets the name of the env var this cloud's image reads to locate the Docker socket. + /// Backs the shared WithDockerSocket implementation used by all three providers. + /// + internal abstract string DockerHostEnvVar { get; } + + /// + /// Gets the name of the env var this cloud's image reads to select its storage mode + /// (memory vs. persistent). Backs the shared WithDataVolume/WithDataBindMount + /// implementation used by all three providers. + /// + internal abstract string StorageModeEnvVar { get; } +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociGcpContainerResource.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociGcpContainerResource.cs new file mode 100644 index 000000000..12cddc6e5 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociGcpContainerResource.cs @@ -0,0 +1,33 @@ +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting.ApplicationModel; + +/// +/// Resource for the Floci GCP emulator container. +/// +/// The name of the resource. +[AspireExport(ExposeProperties = true)] +public class FlociGcpContainerResource(string name) : FlociContainerResource(name, "gcp") +{ + internal const int EndpointPort = 4588; + internal const string HostnameEnvVar = "FLOCI_GCP_HOSTNAME"; + internal const string DefaultProjectIdEnvVar = "FLOCI_GCP_DEFAULT_PROJECT_ID"; + + /// + /// Gets the default GCP project ID configured for this Floci instance. + /// Set by from the defaultProjectId parameter. + /// + internal string DefaultProjectId { get; init; } = "floci-local"; + + internal override void ApplyUIEnvironment(EnvironmentCallbackContext context) + { + context.EnvironmentVariables[FlociUIContainerResource.GcpEndpointEnvVar] = + ReferenceExpression.Create($"{PrimaryEndpoint}"); + context.EnvironmentVariables[FlociUIContainerResource.GcpProjectEnvVar] = DefaultProjectId; + } + + internal override string DockerHostEnvVar => "FLOCI_GCP_DOCKER_DOCKER_HOST"; + internal override string StorageModeEnvVar => "FLOCI_GCP_STORAGE_MODE"; +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Aws.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Aws.cs new file mode 100644 index 000000000..720c37de8 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Aws.cs @@ -0,0 +1,180 @@ +using Aspire.Hosting.ApplicationModel; +using CommunityToolkit.Aspire.Hosting.Floci; +using Microsoft.Extensions.DependencyInjection; + +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting; + +/// +/// Provides extension methods for adding Floci to an . +/// +public static partial class FlociHostingExtension +{ + /// + /// Adds a Floci AWS emulator container resource to the . + /// + /// Adds a Floci AWS emulator container resource + /// The to which the Floci resource will be added. + /// The name of the Floci container resource. + /// Optional. The host port to bind for the AWS endpoint. + /// Optional. The default AWS region (default: us-east-1). + /// Optional. The default AWS account ID (default: 000000000000). + /// A reference to the for further resource configuration. + [AspireExport] + public static IResourceBuilder AddFlociAws( + this IDistributedApplicationBuilder builder, + [ResourceName] string name, + int? port = null, + string defaultRegion = "us-east-1", + string defaultAccountId = "000000000000") + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(name); + + FlociAwsContainerResource resource = new(name) { DefaultRegion = defaultRegion, DefaultAccountId = defaultAccountId }; + + // BeforeStartEvent: inject standard AWS env vars into every resource that called + // WithReference(floci). Standard WithReference already injects ConnectionStrings__; + // this subscriber additionally sets AWS_ENDPOINT_URL (and companions) so the AWS SDK + // needs no extra configuration in dependent services. + // + // Processing is deferred to BeforeStartEvent so resources can be wired up in any order + // in Program.cs without worrying about whether Floci is fully configured yet. + builder.Eventing.Subscribe((evt, ct) => + { + var appModel = evt.Services.GetRequiredService(); + + foreach (var dependent in appModel.Resources) + { + // Standard WithReference(floci) adds a ResourceRelationshipAnnotation pointing to + // our resource. Detect dependents without needing a separate tracking collection. + bool referencesFloci = dependent.Annotations + .OfType() + .Any(a => ReferenceEquals(a.Resource, resource)); + + if (!referencesFloci) + continue; + + if (dependent is ContainerResource) + { + // Containers cannot reach the host via localhost — use host.docker.internal + // so they can reach the host-exposed Floci port (4566). + var flociPort = resource.Port; + // Ensure host.docker.internal resolves inside containers. + dependent.Annotations.Add( + new ContainerRuntimeArgsCallbackAnnotation( + args => args.Add("--add-host=host.docker.internal:host-gateway"))); + dependent.Annotations.Add(new EnvironmentCallbackAnnotation(ctx => + { + ctx.EnvironmentVariables["AWS_ENDPOINT_URL"] = + ReferenceExpression.Create($"http://host.docker.internal:{flociPort}"); + ctx.EnvironmentVariables["AWS_DEFAULT_REGION"] = resource.DefaultRegion; + ctx.EnvironmentVariables["AWS_ACCESS_KEY_ID"] = "test"; + ctx.EnvironmentVariables["AWS_SECRET_ACCESS_KEY"] = "test"; + })); + } + else + { + // Host processes (projects, executables) use the standard connection string + // which resolves to http://localhost:{port}. + dependent.Annotations.Add(new EnvironmentCallbackAnnotation(ctx => + { + ctx.EnvironmentVariables["AWS_ENDPOINT_URL"] = resource.ConnectionStringExpression; + ctx.EnvironmentVariables["AWS_DEFAULT_REGION"] = resource.DefaultRegion; + ctx.EnvironmentVariables["AWS_ACCESS_KEY_ID"] = "test"; + ctx.EnvironmentVariables["AWS_SECRET_ACCESS_KEY"] = "test"; + })); + } + } + + return Task.CompletedTask; + }); + + var flociBuilder = builder.AddResource(resource) + .WithImage(FlociContainerImageTags.AwsImage) + .WithImageTag(FlociContainerImageTags.AwsTag) + .WithImageRegistry(FlociContainerImageTags.AwsRegistry) + .WithHttpEndpoint( + targetPort: FlociAwsContainerResource.AwsEndpointPort, + port: port, + name: FlociAwsContainerResource.AwsEndpointName) + .WithEnvironment(FlociAwsContainerResource.HostnameEnvVar, name) + .WithEnvironment(FlociAwsContainerResource.DefaultRegionEnvVar, defaultRegion) + .WithEnvironment(FlociAwsContainerResource.DefaultAccountIdEnvVar, defaultAccountId) + .WithEnvironment(resource.StorageModeEnvVar, "memory") + .WithHttpHealthCheck( + path: "/_floci/info", + statusCode: 200, + endpointName: FlociAwsContainerResource.AwsEndpointName); + + return flociBuilder; + } + + /// + /// Mounts the Docker socket into the Floci container so that Lambda and other + /// container-backed AWS services can launch sibling containers. + /// Also sets FLOCI_DOCKER_DOCKER_HOST to unix:///var/run/docker.sock (the + /// container-side path where the socket is always mounted) so Floci can connect to it. + /// + /// The used to configure the resource. + /// Optional. Host path to the Docker socket (default: /var/run/docker.sock). + /// Non-standard paths (e.g. Podman at /run/user/1000/podman/podman.sock) are bind-mounted + /// to /var/run/docker.sock inside the container. + /// A reference to the for further configuration. + [AspireExport] + public static IResourceBuilder WithDockerSocket( + this IResourceBuilder builder, + string socketPath = "/var/run/docker.sock") + => WithDockerSocketCore(builder, socketPath); + + /// + /// Mounts a custom Quarkus application.yml configuration file into the Floci container. + /// The file is mounted read-only at /deployments/config/application.yml, which Quarkus + /// reads on startup and merges with built-in defaults. + /// + /// The used to configure the resource. + /// The host-side path to the application.yml file to mount. + /// A reference to the for further configuration. + [AspireExport] + public static IResourceBuilder WithConfigFile( + this IResourceBuilder builder, + string hostPath) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(hostPath); + + return builder.WithBindMount(hostPath, FlociAwsContainerResource.ConfigMountPath, isReadOnly: true); + } + + /// + /// Configures a named data volume for persistent Floci state. + /// + /// The used to configure the resource. + /// The name of the volume to mount. + /// Whether the volume should be read-only. + /// A reference to the for further configuration. + [AspireExport] + public static IResourceBuilder WithDataVolume( + this IResourceBuilder builder, + string name, + bool isReadOnly = false) + => WithDataVolumeCore(builder, name, isReadOnly); + + /// + /// Configures a bind mount for persistent Floci state. + /// + /// The used to configure the resource. + /// The host path to bind into the container. + /// Whether the bind mount should be read-only. + /// A reference to the for further configuration. + [AspireExport] + public static IResourceBuilder WithDataBindMount( + this IResourceBuilder builder, + string source, + bool isReadOnly = false) + => WithDataBindMountCore(builder, source, isReadOnly); + +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Azure.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Azure.cs new file mode 100644 index 000000000..2b59746f8 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Azure.cs @@ -0,0 +1,162 @@ +using Aspire.Hosting.ApplicationModel; +using CommunityToolkit.Aspire.Hosting.Floci; +using Microsoft.Extensions.DependencyInjection; + +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting; + +public static partial class FlociHostingExtension +{ + /// + /// Adds a Floci Azure emulator container resource to the . + /// + /// Adds a Floci Azure emulator container resource + /// The to which the Floci resource will be added. + /// The name of the Floci container resource. + /// Optional. The host port to bind for the Azure endpoint. + /// A reference to the for further resource configuration. + [AspireExport] + public static IResourceBuilder AddFlociAzure( + this IDistributedApplicationBuilder builder, + [ResourceName] string name, + int? port = null) + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(name); + + FlociAzureContainerResource resource = new(name); + + // BeforeStartEvent: inject an Azure Storage connection string into every resource that + // called WithReference(floci). Deferred so resources can be wired up in any order in + // Program.cs without worrying about whether Floci is fully configured yet. + builder.Eventing.Subscribe((evt, ct) => + { + var appModel = evt.Services.GetRequiredService(); + + foreach (var dependent in appModel.Resources) + { + bool referencesFloci = dependent.Annotations + .OfType() + .Any(a => ReferenceEquals(a.Resource, resource)); + + if (!referencesFloci) + continue; + + if (dependent is ContainerResource) + { + // Containers cannot reach the host via localhost — use host.docker.internal + // so they can reach the host-exposed Floci port (4577). + var flociPort = resource.Port; + dependent.Annotations.Add( + new ContainerRuntimeArgsCallbackAnnotation( + args => args.Add("--add-host=host.docker.internal:host-gateway"))); + dependent.Annotations.Add(new EnvironmentCallbackAnnotation(ctx => + { + var blobEndpoint = ReferenceExpression.Create($"http://host.docker.internal:{flociPort}/{FlociAzureContainerResource.DefaultAccountName}"); + ctx.EnvironmentVariables["AZURE_STORAGE_CONNECTION_STRING"] = ReferenceExpression.Create( + $"DefaultEndpointsProtocol=http;AccountName={FlociAzureContainerResource.DefaultAccountName};AccountKey={FlociAzureContainerResource.DefaultAccountKey};BlobEndpoint={blobEndpoint};"); + })); + } + else + { + // Host processes (projects, executables) use the standard connection string + // which resolves to http://localhost:{port}. + dependent.Annotations.Add(new EnvironmentCallbackAnnotation(ctx => + { + var blobEndpoint = ReferenceExpression.Create($"{resource.ConnectionStringExpression}/{FlociAzureContainerResource.DefaultAccountName}"); + ctx.EnvironmentVariables["AZURE_STORAGE_CONNECTION_STRING"] = ReferenceExpression.Create( + $"DefaultEndpointsProtocol=http;AccountName={FlociAzureContainerResource.DefaultAccountName};AccountKey={FlociAzureContainerResource.DefaultAccountKey};BlobEndpoint={blobEndpoint};"); + })); + } + } + + return Task.CompletedTask; + }); + + var flociBuilder = builder.AddResource(resource) + .WithImage(FlociContainerImageTags.AzureImage) + .WithImageTag(FlociContainerImageTags.AzureTag) + .WithImageRegistry(FlociContainerImageTags.AzureRegistry) + .WithHttpEndpoint( + targetPort: FlociAzureContainerResource.EndpointPort, + port: port, + name: resource.EndpointName) + .WithEnvironment(FlociAzureContainerResource.HostnameEnvVar, name) + .WithEnvironment(resource.StorageModeEnvVar, "memory") + .WithHttpHealthCheck( + path: "/_floci/health", + statusCode: 200, + endpointName: resource.EndpointName); + + return flociBuilder; + } + + /// + /// Mounts the Docker socket into the Floci Azure container so that Azure Functions and other + /// container-backed services can launch sibling containers. + /// Also sets FLOCI_AZ_DOCKER_DOCKER_HOST to unix:///var/run/docker.sock (the + /// container-side path where the socket is always mounted) so Floci can connect to it. + /// + /// The used to configure the resource. + /// Optional. Host path to the Docker socket (default: /var/run/docker.sock). + /// Non-standard paths (e.g. Podman at /run/user/1000/podman/podman.sock) are bind-mounted + /// to /var/run/docker.sock inside the container. + /// A reference to the for further configuration. + [AspireExport("withDockerSocketAzure", MethodName = "withDockerSocket")] + public static IResourceBuilder WithDockerSocket( + this IResourceBuilder builder, + string socketPath = "/var/run/docker.sock") + => WithDockerSocketCore(builder, socketPath); + + /// + /// Configures a named data volume for persistent Floci Azure state. + /// + /// The used to configure the resource. + /// The name of the volume to mount. + /// Whether the volume should be read-only. + /// A reference to the for further configuration. + [AspireExport("withDataVolumeAzure", MethodName = "withDataVolume")] + public static IResourceBuilder WithDataVolume( + this IResourceBuilder builder, + string name, + bool isReadOnly = false) + => WithDataVolumeCore(builder, name, isReadOnly); + + /// + /// Configures a bind mount for persistent Floci Azure state. + /// + /// The used to configure the resource. + /// The host path to bind into the container. + /// Whether the bind mount should be read-only. + /// A reference to the for further configuration. + [AspireExport("withDataBindMountAzure", MethodName = "withDataBindMount")] + public static IResourceBuilder WithDataBindMount( + this IResourceBuilder builder, + string source, + bool isReadOnly = false) + => WithDataBindMountCore(builder, source, isReadOnly); + + /// + /// Adds a Floci UI web console container + /// for browsing the resources hosted by the Floci Azure emulator. + /// + /// Adds a Floci UI web console container for the Floci Azure resource + /// The Floci Azure resource builder. + /// Configuration callback for the Floci UI container resource. + /// Optional. The name of the Floci UI container (default: {floci-name}-ui). + /// A reference to the for further resource configuration. + [AspireExport("withFlociUIAzure", MethodName = "withFlociUI", RunSyncOnBackgroundThread = true)] + public static IResourceBuilder WithFlociUI( + this IResourceBuilder builder, + Action>? configureContainer = null, + string? containerName = null) + { + ArgumentNullException.ThrowIfNull(builder); + + AddOrConfigureFlociUI(builder, configureContainer, containerName); + return builder; + } +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Common.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Common.cs new file mode 100644 index 000000000..900f0ff21 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Common.cs @@ -0,0 +1,66 @@ +using Aspire.Hosting.ApplicationModel; + +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting; + +public static partial class FlociHostingExtension +{ + private const string ContainerSocketPath = "/var/run/docker.sock"; + + /// + /// Shared implementation behind every provider's WithDockerSocket overload: mounts the + /// Docker socket and points the resource's + /// at it so container-backed services (Lambda, Azure Functions, Cloud Run, ...) can launch + /// sibling containers. + /// + internal static IResourceBuilder WithDockerSocketCore( + IResourceBuilder builder, + string socketPath) + where TFloci : FlociContainerResource + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(socketPath); + + return builder + .WithEnvironment(builder.Resource.DockerHostEnvVar, $"unix://{ContainerSocketPath}") + .WithContainerRuntimeArgs("-u", "root", "-v", $"{socketPath}:{ContainerSocketPath}"); + } + + /// + /// Shared implementation behind every provider's WithDataVolume overload: switches the + /// resource to persistent storage mode and mounts a named volume for it. + /// + internal static IResourceBuilder WithDataVolumeCore( + IResourceBuilder builder, + string name, + bool isReadOnly) + where TFloci : FlociContainerResource + { + ArgumentNullException.ThrowIfNull(builder); + + return builder + .WithEnvironment(builder.Resource.StorageModeEnvVar, "persistent") + .WithVolume(name, "/app/data", isReadOnly); + } + + /// + /// Shared implementation behind every provider's WithDataBindMount overload: switches + /// the resource to persistent storage mode and bind-mounts a host path for it. + /// + internal static IResourceBuilder WithDataBindMountCore( + IResourceBuilder builder, + string source, + bool isReadOnly) + where TFloci : FlociContainerResource + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(source); + + return builder + .WithEnvironment(builder.Resource.StorageModeEnvVar, "persistent") + .WithBindMount(source, "/app/data", isReadOnly); + } +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.FlociUI.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.FlociUI.cs new file mode 100644 index 000000000..91893431f --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.FlociUI.cs @@ -0,0 +1,160 @@ +using Aspire.Hosting.ApplicationModel; +using CommunityToolkit.Aspire.Hosting.Floci; + +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting; + +public static partial class FlociHostingExtension +{ + /// + /// Adds a Floci UI web console container + /// for browsing the resources hosted by the Floci AWS emulator. + /// + /// Adds a Floci UI web console container for the Floci resource + /// + /// Use in application host with a Floci resource + /// + /// var builder = DistributedApplication.CreateBuilder(args); + /// + /// var floci = builder.AddFlociAws("floci") + /// .WithFlociUI(); + /// + /// builder.Build().Run(); + /// + /// + /// The Floci resource builder. + /// Configuration callback for the Floci UI container resource. + /// Use this to attach additional clouds to the same UI console via WithPluggedCloud. + /// Optional. The name of the Floci UI container (default: {floci-name}-ui). + /// A reference to the for further resource configuration. + [AspireExport(RunSyncOnBackgroundThread = true)] + public static IResourceBuilder WithFlociUI( + this IResourceBuilder builder, + Action>? configureContainer = null, + string? containerName = null) + { + ArgumentNullException.ThrowIfNull(builder); + + AddOrConfigureFlociUI(builder, configureContainer, containerName); + return builder; + } + + /// + /// Configures the host port that the Floci UI resource is exposed on instead of using a randomly assigned port. + /// + /// The resource builder for Floci UI. + /// The port to bind on the host. If is used a random port will be assigned. + /// The resource builder for Floci UI. + [AspireExport] + public static IResourceBuilder WithHostPort( + this IResourceBuilder builder, + int? port) + { + ArgumentNullException.ThrowIfNull(builder); + + return builder.WithEndpoint(FlociUIContainerResource.PrimaryEndpointName, endpoint => + { + endpoint.Port = port; + }); + } + + /// + /// Attaches an additional Floci AWS emulator resource to an existing Floci UI console, so a + /// single console can browse multiple clouds at once instead of creating a UI container per cloud. + /// + /// The Floci UI resource builder (from the configureContainer callback of WithFlociUI). + /// The additional Floci AWS resource to attach. + /// A reference to the for further configuration. + [AspireExport("withPluggedCloudAws")] + public static IResourceBuilder WithPluggedCloud( + this IResourceBuilder builder, + IResourceBuilder cloud) + => WithPluggedCloudCore(builder, cloud); + + /// + /// Attaches an additional Floci Azure emulator resource to an existing Floci UI console, so a + /// single console can browse multiple clouds at once instead of creating a UI container per cloud. + /// + /// The Floci UI resource builder (from the configureContainer callback of WithFlociUI). + /// The additional Floci Azure resource to attach. + /// A reference to the for further configuration. + [AspireExport("withPluggedCloudAzure")] + public static IResourceBuilder WithPluggedCloud( + this IResourceBuilder builder, + IResourceBuilder cloud) + => WithPluggedCloudCore(builder, cloud); + + /// + /// Attaches an additional Floci GCP emulator resource to an existing Floci UI console, so a + /// single console can browse multiple clouds at once instead of creating a UI container per cloud. + /// + /// The Floci UI resource builder (from the configureContainer callback of WithFlociUI). + /// The additional Floci GCP resource to attach. + /// A reference to the for further configuration. + [AspireExport("withPluggedCloudGcp")] + public static IResourceBuilder WithPluggedCloud( + this IResourceBuilder builder, + IResourceBuilder cloud) + => WithPluggedCloudCore(builder, cloud); + + private static IResourceBuilder WithPluggedCloudCore( + IResourceBuilder builder, + IResourceBuilder cloud) + where TCloud : FlociContainerResource + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(cloud); + + FlociContainerResource cloudResource = cloud.Resource; + return builder.WithEnvironment(context => cloudResource.ApplyUIEnvironment(context)); + } + + /// + /// Shared implementation behind every provider's WithFlociUI overload: creates the + /// single UI container resource on first call (or reconfigures the existing one on repeat + /// calls for the same cloud resource), wiring in that cloud's env vars via . + /// + internal static void AddOrConfigureFlociUI( + IResourceBuilder builder, + Action>? configureContainer, + string? containerName) + where TFloci : FlociContainerResource + { + // A UI instance connects to any number of Floci endpoints, so only one UI container is + // created per Floci resource that calls WithFlociUI. Calling WithFlociUI again on the same + // resource re-configures the existing UI container instead of adding a duplicate. + if (builder.ApplicationBuilder.Resources.OfType() + .FirstOrDefault(ui => ReferenceEquals(ui.Parent, builder.Resource)) is { } existingFlociUIResource) + { + var builderForExistingResource = builder.ApplicationBuilder.CreateResourceBuilder(existingFlociUIResource); + configureContainer?.Invoke(builderForExistingResource); + return; + } + + containerName ??= $"{builder.Resource.Name}-ui"; + + FlociContainerResource flociResource = builder.Resource; + var flociUI = new FlociUIContainerResource(containerName, flociResource); + + var flociUIBuilder = builder.ApplicationBuilder.AddResource(flociUI) + .WithImage(FlociContainerImageTags.UIImage, FlociContainerImageTags.UITag) + .WithImageRegistry(FlociContainerImageTags.UIRegistry) + .WithHttpEndpoint( + targetPort: FlociUIContainerResource.UIPort, + name: FlociUIContainerResource.PrimaryEndpointName) + .WithEnvironment(context => flociResource.ApplyUIEnvironment(context)) + // Note: no explicit WaitFor — the UI is a child of the Floci resource + // (IResourceWithParent), and Aspire disallows waiting on a parent. + // Floci UI has no dedicated health endpoint; the SPA index responds 200 at the root. + .WithHttpHealthCheck( + path: "/", + statusCode: 200, + endpointName: FlociUIContainerResource.PrimaryEndpointName) + .ExcludeFromManifest(); + + configureContainer?.Invoke(flociUIBuilder); + } +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Gcp.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Gcp.cs new file mode 100644 index 000000000..bd4d7bfce --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociHostingExtension.Gcp.cs @@ -0,0 +1,175 @@ +using Aspire.Hosting.ApplicationModel; +using CommunityToolkit.Aspire.Hosting.Floci; +using Microsoft.Extensions.DependencyInjection; + +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting; + +public static partial class FlociHostingExtension +{ + /// + /// Adds a Floci GCP emulator container resource to the . + /// + /// Adds a Floci GCP emulator container resource + /// The to which the Floci resource will be added. + /// The name of the Floci container resource. + /// Optional. The host port to bind for the GCP endpoint. + /// Optional. The default GCP project ID (default: floci-local). + /// A reference to the for further resource configuration. + [AspireExport] + public static IResourceBuilder AddFlociGcp( + this IDistributedApplicationBuilder builder, + [ResourceName] string name, + int? port = null, + string defaultProjectId = "floci-local") + { + ArgumentNullException.ThrowIfNull(builder); + ArgumentNullException.ThrowIfNull(name); + + FlociGcpContainerResource resource = new(name) { DefaultProjectId = defaultProjectId }; + + // BeforeStartEvent: inject the *_EMULATOR_HOST vars the GCP SDKs already honor into every + // resource that called WithReference(floci). Deferred so resources can be wired up in any + // order in Program.cs without worrying about whether Floci is fully configured yet. + builder.Eventing.Subscribe((evt, ct) => + { + var appModel = evt.Services.GetRequiredService(); + + foreach (var dependent in appModel.Resources) + { + bool referencesFloci = dependent.Annotations + .OfType() + .Any(a => ReferenceEquals(a.Resource, resource)); + + if (!referencesFloci) + continue; + + if (dependent is ContainerResource) + { + // Containers cannot reach the host via localhost — use host.docker.internal + // so they can reach the host-exposed Floci port (4588). + var flociPort = resource.Port; + dependent.Annotations.Add( + new ContainerRuntimeArgsCallbackAnnotation( + args => args.Add("--add-host=host.docker.internal:host-gateway"))); + dependent.Annotations.Add(new EnvironmentCallbackAnnotation(ctx => + { + var hostAndPort = ReferenceExpression.Create($"host.docker.internal:{flociPort}"); + ctx.EnvironmentVariables["PUBSUB_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["FIRESTORE_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["DATASTORE_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["STORAGE_EMULATOR_HOST"] = ReferenceExpression.Create($"http://{hostAndPort}"); + ctx.EnvironmentVariables["SECRET_MANAGER_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["GOOGLE_CLOUD_PROJECT"] = resource.DefaultProjectId; + ctx.EnvironmentVariables["CLOUDSDK_CORE_PROJECT"] = resource.DefaultProjectId; + })); + } + else + { + // Host processes (projects, executables) use the standard connection string + // which resolves to http://localhost:{port}. + dependent.Annotations.Add(new EnvironmentCallbackAnnotation(ctx => + { + var hostAndPort = ReferenceExpression.Create($"{resource.Host}:{resource.Port}"); + ctx.EnvironmentVariables["PUBSUB_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["FIRESTORE_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["DATASTORE_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["STORAGE_EMULATOR_HOST"] = resource.ConnectionStringExpression; + ctx.EnvironmentVariables["SECRET_MANAGER_EMULATOR_HOST"] = hostAndPort; + ctx.EnvironmentVariables["GOOGLE_CLOUD_PROJECT"] = resource.DefaultProjectId; + ctx.EnvironmentVariables["CLOUDSDK_CORE_PROJECT"] = resource.DefaultProjectId; + })); + } + } + + return Task.CompletedTask; + }); + + var flociBuilder = builder.AddResource(resource) + .WithImage(FlociContainerImageTags.GcpImage) + .WithImageTag(FlociContainerImageTags.GcpTag) + .WithImageRegistry(FlociContainerImageTags.GcpRegistry) + .WithHttpEndpoint( + targetPort: FlociGcpContainerResource.EndpointPort, + port: port, + name: resource.EndpointName) + .WithEnvironment(FlociGcpContainerResource.HostnameEnvVar, name) + .WithEnvironment(FlociGcpContainerResource.DefaultProjectIdEnvVar, defaultProjectId) + .WithEnvironment(resource.StorageModeEnvVar, "memory") + .WithHttpHealthCheck( + path: "/_floci-gcp/health", + statusCode: 200, + endpointName: resource.EndpointName); + + return flociBuilder; + } + + /// + /// Mounts the Docker socket into the Floci GCP container so that Cloud Run, Cloud SQL, and other + /// container-backed services can launch sibling containers. + /// Also sets FLOCI_GCP_DOCKER_DOCKER_HOST to unix:///var/run/docker.sock (the + /// container-side path where the socket is always mounted) so Floci can connect to it. + /// + /// The used to configure the resource. + /// Optional. Host path to the Docker socket (default: /var/run/docker.sock). + /// Non-standard paths (e.g. Podman at /run/user/1000/podman/podman.sock) are bind-mounted + /// to /var/run/docker.sock inside the container. + /// A reference to the for further configuration. + [AspireExport("withDockerSocketGcp", MethodName = "withDockerSocket")] + public static IResourceBuilder WithDockerSocket( + this IResourceBuilder builder, + string socketPath = "/var/run/docker.sock") + => WithDockerSocketCore(builder, socketPath); + + /// + /// Configures a named data volume for persistent Floci GCP state. + /// + /// The used to configure the resource. + /// The name of the volume to mount. + /// Whether the volume should be read-only. + /// A reference to the for further configuration. + [AspireExport("withDataVolumeGcp", MethodName = "withDataVolume")] + public static IResourceBuilder WithDataVolume( + this IResourceBuilder builder, + string name, + bool isReadOnly = false) + => WithDataVolumeCore(builder, name, isReadOnly); + + /// + /// Configures a bind mount for persistent Floci GCP state. + /// + /// The used to configure the resource. + /// The host path to bind into the container. + /// Whether the bind mount should be read-only. + /// A reference to the for further configuration. + [AspireExport("withDataBindMountGcp", MethodName = "withDataBindMount")] + public static IResourceBuilder WithDataBindMount( + this IResourceBuilder builder, + string source, + bool isReadOnly = false) + => WithDataBindMountCore(builder, source, isReadOnly); + + /// + /// Adds a Floci UI web console container + /// for browsing the resources hosted by the Floci GCP emulator. + /// + /// Adds a Floci UI web console container for the Floci GCP resource + /// The Floci GCP resource builder. + /// Configuration callback for the Floci UI container resource. + /// Optional. The name of the Floci UI container (default: {floci-name}-ui). + /// A reference to the for further resource configuration. + [AspireExport("withFlociUIGcp", MethodName = "withFlociUI", RunSyncOnBackgroundThread = true)] + public static IResourceBuilder WithFlociUI( + this IResourceBuilder builder, + Action>? configureContainer = null, + string? containerName = null) + { + ArgumentNullException.ThrowIfNull(builder); + + AddOrConfigureFlociUI(builder, configureContainer, containerName); + return builder; + } +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/FlociUIContainerResource.cs b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociUIContainerResource.cs new file mode 100644 index 000000000..20beac200 --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/FlociUIContainerResource.cs @@ -0,0 +1,49 @@ +#pragma warning disable ASPIREATS001 // AspireExport is experimental + +namespace Aspire.Hosting.ApplicationModel; + +/// +/// Resource for the Floci UI web console container. A single UI instance can attach to any +/// combination of Floci cloud resources (AWS, Azure, GCP) — one created it via WithFlociUI +/// (its ), and any others are attached via WithPluggedCloud. +/// +/// The name of the resource. +/// The Floci cloud resource that created this UI instance. +[AspireExport(ExposeProperties = true)] +public class FlociUIContainerResource(string name, FlociContainerResource floci) + : ContainerResource(name), IResourceWithParent +{ + // The packaged floci/floci-ui image serves both the SPA and its API from a single + // server listening on PORT (default 4500). + internal const int UIPort = 4500; + internal const string PrimaryEndpointName = "http"; + + // AWS adapter env vars. + internal const string EndpointEnvVar = "FLOCI_ENDPOINT"; + internal const string RegionEnvVar = "AWS_REGION"; + internal const string AccessKeyIdEnvVar = "AWS_ACCESS_KEY_ID"; + internal const string SecretAccessKeyEnvVar = "AWS_SECRET_ACCESS_KEY"; + internal const string DefaultAccountIdEnvVar = "FLOCI_DEFAULT_ACCOUNT_ID"; + + // Azure adapter env vars. + internal const string AzureEndpointEnvVar = "FLOCI_AZURE_ENDPOINT"; + internal const string AzureAccountNameEnvVar = "FLOCI_AZURE_ACCOUNT_NAME"; + + // GCP adapter env vars. + internal const string GcpEndpointEnvVar = "FLOCI_GCP_ENDPOINT"; + internal const string GcpProjectEnvVar = "FLOCI_GCP_PROJECT"; + + private EndpointReference? _primaryEndpoint; + + /// + /// Gets the Floci cloud resource that created this UI instance. + /// + public FlociContainerResource Parent { get; } = floci ?? throw new ArgumentNullException(nameof(floci)); + + /// + /// Gets the http endpoint for the Floci UI resource. + /// + public EndpointReference PrimaryEndpoint => _primaryEndpoint ??= new(this, PrimaryEndpointName); +} + +#pragma warning restore ASPIREATS001 diff --git a/src/CommunityToolkit.Aspire.Hosting.Floci/README.md b/src/CommunityToolkit.Aspire.Hosting.Floci/README.md new file mode 100644 index 000000000..a9723791a --- /dev/null +++ b/src/CommunityToolkit.Aspire.Hosting.Floci/README.md @@ -0,0 +1,316 @@ +# CommunityToolkit.Aspire.Hosting.Floci + +## Overview + +This Aspire integration runs [Floci](https://floci.io) in a container. Floci is a family of high-performance local cloud emulators — `floci/floci` (AWS, 65+ services including Lambda, S3, DynamoDB, SQS, SNS), `floci/floci-az` (Azure — Blob/Queue/Table Storage, Cosmos DB, Functions, Event Hubs, Service Bus), and `floci/floci-gcp` (GCP — Pub/Sub, Firestore, Datastore, Storage, Secret Manager, Cloud Functions) — each API-compatible with its respective cloud. + +Every example below is shown in both C# and TypeScript (polyglot AppHost) form. + +## Usage + +### Example 1: Add an emulator with default configuration + +**AWS** + +```csharp +var builder = DistributedApplication.CreateBuilder(args); + +var aws = builder.AddFlociAws("floci-aws"); + +var api = builder.AddProject("api") + .WithReference(aws) + .WaitFor(aws); + +builder.Build().Run(); +``` + +```typescript +const builder = await createBuilder(); + +const aws = await builder.addFlociAws('floci-aws'); + +const api = await builder.addProject('api', '../MyApi/MyApi.csproj') + .withReference(aws) + .waitFor(aws); + +await builder.build().run(); +``` + +`WithReference(aws)` / `withReference(aws)` uses the standard Aspire connection string injection and automatically injects the following environment variables into the dependent resource: + +| Variable | Value | +|---|---| +| `ConnectionStrings__floci-aws` | `http://localhost:{port}` (standard Aspire connection string) | +| `AWS_ENDPOINT_URL` | `http://localhost:{port}` (host processes) / `http://host.docker.internal:{port}` (containers) | +| `AWS_DEFAULT_REGION` | Region passed to `AddFlociAws`/`addFlociAws` (default: `us-east-1`) | +| `AWS_ACCESS_KEY_ID` | `test` | +| `AWS_SECRET_ACCESS_KEY` | `test` | + +**Azure** + +```csharp +var azure = builder.AddFlociAzure("floci-az"); + +builder.AddProject("api") + .WithReference(azure) + .WaitFor(azure); +``` + +```typescript +const azure = await builder.addFlociAzure('floci-az'); + +await builder.addProject('api', '../MyApi/MyApi.csproj') + .withReference(azure) + .waitFor(azure); +``` + +`WithReference(azure)` / `withReference(azure)` injects the following environment variables into the dependent resource: + +| Variable | Value | +|---|---| +| `ConnectionStrings__floci-az` | `http://localhost:{port}` (standard Aspire connection string) | +| `AZURE_STORAGE_CONNECTION_STRING` | Connection string pointed at the Floci Azure endpoint, using the well-known `devstoreaccount1` dev storage account credentials | + +**GCP** + +```csharp +var gcp = builder.AddFlociGcp("floci-gcp", defaultProjectId: "my-project"); + +builder.AddProject("api") + .WithReference(gcp) + .WaitFor(gcp); +``` + +```typescript +const gcp = await builder.addFlociGcp('floci-gcp', { + defaultProjectId: 'my-project', +}); + +await builder.addProject('api', '../MyApi/MyApi.csproj') + .withReference(gcp) + .waitFor(gcp); +``` + +`WithReference(gcp)` / `withReference(gcp)` injects the following environment variables into the dependent resource: + +| Variable | Value | +|---|---| +| `ConnectionStrings__floci-gcp` | `http://localhost:{port}` (standard Aspire connection string) | +| `PUBSUB_EMULATOR_HOST` | `localhost:{port}` (host processes) / `host.docker.internal:{port}` (containers) | +| `FIRESTORE_EMULATOR_HOST` | `localhost:{port}` (host processes) / `host.docker.internal:{port}` (containers) | +| `DATASTORE_EMULATOR_HOST` | `localhost:{port}` (host processes) / `host.docker.internal:{port}` (containers) | +| `STORAGE_EMULATOR_HOST` | `http://localhost:{port}` (host processes) / `http://host.docker.internal:{port}` (containers) | +| `SECRET_MANAGER_EMULATOR_HOST` | `localhost:{port}` (host processes) / `host.docker.internal:{port}` (containers) | +| `GOOGLE_CLOUD_PROJECT` | Project ID passed to `AddFlociGcp`/`addFlociGcp` (default: `floci-local`) | +| `CLOUDSDK_CORE_PROJECT` | Same project ID, for tools that read the `gcloud` CLI's config var instead | + +### Example 2: Enable Lambda / Azure Functions / container-backed services + +Each emulator needs access to the Docker socket to launch sibling containers for its container-backed services (AWS Lambda, Azure Functions, GCP Cloud Run/Cloud SQL): + +```csharp +var aws = builder.AddFlociAws("floci-aws") + .WithDockerSocket(); + +var azure = builder.AddFlociAzure("floci-az") + .WithDockerSocket(); + +var gcp = builder.AddFlociGcp("floci-gcp") + .WithDockerSocket(); +``` + +```typescript +const aws = await builder.addFlociAws('floci-aws'); +await aws.withDockerSocket(); + +const azure = await builder.addFlociAzure('floci-az'); +await azure.withDockerSocket(); + +const gcp = await builder.addFlociGcp('floci-gcp'); +await gcp.withDockerSocket(); +``` + +On non-standard Docker installations (e.g. Podman, Rancher Desktop), pass the socket path explicitly — this works the same way on all three clouds: + +```csharp +var aws = builder.AddFlociAws("floci-aws") + .WithDockerSocket("/run/user/1000/podman/podman.sock"); +``` + +```typescript +const aws = await builder.addFlociAws('floci-aws'); +await aws.withDockerSocket({ socketPath: '/run/user/1000/podman/podman.sock' }); +``` + +### Example 3: Persistent storage + +By default each emulator stores all state in memory. Use `WithDataVolume`/`withDataVolume` to persist state across restarts — available on all three clouds: + +```csharp +var aws = builder.AddFlociAws("floci-aws") + .WithDataVolume("floci-data"); + +var azure = builder.AddFlociAzure("floci-az") + .WithDataVolume("floci-az-data"); + +var gcp = builder.AddFlociGcp("floci-gcp") + .WithDataVolume("floci-gcp-data"); +``` + +```typescript +const aws = await builder.addFlociAws('floci-aws'); +await aws.withDataVolume('floci-data'); + +const azure = await builder.addFlociAzure('floci-az'); +await azure.withDataVolume('floci-az-data'); + +const gcp = await builder.addFlociGcp('floci-gcp'); +await gcp.withDataVolume('floci-gcp-data'); +``` + +Or use a host bind mount: + +```csharp +var aws = builder.AddFlociAws("floci-aws") + .WithDataBindMount("/path/to/data"); +``` + +```typescript +const aws = await builder.addFlociAws('floci-aws'); +await aws.withDataBindMount('/path/to/data'); +``` + +### Example 4: Custom region/account/project + +```csharp +var aws = builder.AddFlociAws("floci-aws", + defaultRegion: "eu-west-1", + defaultAccountId: "123456789012"); + +var gcp = builder.AddFlociGcp("floci-gcp", + defaultProjectId: "my-project"); +``` + +```typescript +const aws = await builder.addFlociAws('floci-aws', { + defaultRegion: 'eu-west-1', + defaultAccountId: '123456789012', +}); + +const gcp = await builder.addFlociGcp('floci-gcp', { + defaultProjectId: 'my-project', +}); +``` + +### Example 5: Floci UI web console — single cloud + +Run the [Floci UI](https://github.com/floci-io/floci-ui) web console alongside an emulator to browse its hosted resources: + +```csharp +var floci = builder.AddFlociAws("floci") + .WithFlociUI(); +``` + +```typescript +const floci = await builder.addFlociAws('floci'); +await floci.withFlociUI(); +``` + +Customize the container name or pin the host port: + +```csharp +var floci = builder.AddFlociAws("floci") + .WithFlociUI(ui => ui.WithHostPort(14500), containerName: "my-floci-ui"); +``` + +```typescript +const floci = await builder.addFlociAws('floci'); +await floci.withFlociUI({ + containerName: 'my-floci-ui', + configureContainer: async (ui) => { + await ui.withHostPort({ port: 14500 }); + }, +}); +``` + +> Note: Floci also has a built-in mechanism to launch the UI as a sidecar container on demand, but that relies on Floci itself talking to the Docker socket and self-discovered endpoints, which does not play well with Aspire's DCP-managed container networking. `WithFlociUI`/`withFlociUI` runs the UI as a first-class Aspire resource instead. + +### Example 6: Floci UI web console — all three clouds in one console + +A single UI console can attach to any combination of clouds — call `WithFlociUI`/`withFlociUI` on whichever cloud creates the console, then attach the others with `WithPluggedCloud`/`withPluggedCloud`: + +```csharp +var aws = builder.AddFlociAws("floci-aws"); +var azure = builder.AddFlociAzure("floci-az"); +var gcp = builder.AddFlociGcp("floci-gcp"); + +aws.WithFlociUI(configureContainer: ui => +{ + ui.WithPluggedCloud(azure); + ui.WithPluggedCloud(gcp); +}); +``` + +```typescript +const aws = await builder.addFlociAws('floci-aws'); +const azure = await builder.addFlociAzure('floci-az'); +const gcp = await builder.addFlociGcp('floci-gcp'); + +await aws.withFlociUI({ + configureContainer: async (ui) => { + await ui.withPluggedCloudAzure(azure); + await ui.withPluggedCloudGcp(gcp); + }, +}); +``` + +The UI container (`floci/floci-ui`) is added as a child resource of whichever cloud resource created it, wired to each attached cloud's endpoint over the container network (`FLOCI_ENDPOINT`/`FLOCI_AZURE_ENDPOINT`/`FLOCI_GCP_ENDPOINT`), and is excluded from the deployment manifest (it is a local development tool only). + +> Note: In C# `WithPluggedCloud` is a single overloaded method name — the compiler picks the right one from the argument type. In TypeScript there is no overload resolution on the generated bindings, so each cloud gets its own method: `withPluggedCloudAws`, `withPluggedCloudAzure`, `withPluggedCloudGcp`. + +### Example 7: Custom Quarkus configuration file (AWS only) + +Mount a hand-crafted `application.yml` to tune any Floci setting that does not have an extension method. The file is injected read-only at `/deployments/config/application.yml` — the standard Quarkus Docker config override location. + +```csharp +var floci = builder.AddFlociAws("floci") + .WithConfigFile("./floci.yml"); +``` + +```typescript +const floci = await builder.addFlociAws('floci'); +await floci.withConfigFile('./floci.yml'); +``` + +A minimal `floci.yml` that enables debug logging and disables signature validation: + +```yaml +floci: + auth: + validate-signatures: false +quarkus: + log: + level: DEBUG +``` + +All Floci settings can also be set via `FLOCI_`-prefixed environment variables — `WithConfigFile`/`withConfigFile` is only needed for settings that do not have a dedicated extension method. This is currently only available for the AWS emulator. + +### Connection string / endpoint properties + +Available on all three cloud resource types: + +```csharp +var endpoint = floci.PrimaryEndpoint; +var host = floci.Host; +var port = floci.Port; +var connectionString = floci.ConnectionStringExpression; +``` + +```typescript +const endpoint = await floci.primaryEndpoint(); +const host = await floci.host(); +const port = await floci.port(); +const connectionString = await floci.connectionStringExpression(); +``` + +`connectionStringExpression` resolves to `http://localhost:{port}` for host processes and `http://host.docker.internal:{port}` for container dependents that call `WithReference`/`withReference`. diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AppHostTests.cs b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AppHostTests.cs new file mode 100644 index 000000000..9c261f7b0 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AppHostTests.cs @@ -0,0 +1,46 @@ +using Aspire.Components.Common.Tests; +using CommunityToolkit.Aspire.Testing; + +namespace CommunityToolkit.Aspire.Hosting.Floci.Tests; + +[RequiresDocker] +public class AppHostTests(AspireIntegrationTestFixture fixture) + : IClassFixture> +{ + private const string AwsResourceName = "floci-aws"; + private const string AzureResourceName = "floci-az"; + private const string GcpResourceName = "floci-gcp"; + private const string UIResourceName = "floci-ui"; + + [Fact] + public async Task ResourceStartsAndBecomesHealthy() + { + await fixture.ResourceNotificationService + .WaitForResourceHealthyAsync(AwsResourceName) + .WaitAsync(TimeSpan.FromMinutes(3)); + } + + [Fact] + public async Task AzureResourceStartsAndBecomesHealthy() + { + await fixture.ResourceNotificationService + .WaitForResourceHealthyAsync(AzureResourceName) + .WaitAsync(TimeSpan.FromMinutes(3)); + } + + [Fact] + public async Task GcpResourceStartsAndBecomesHealthy() + { + await fixture.ResourceNotificationService + .WaitForResourceHealthyAsync(GcpResourceName) + .WaitAsync(TimeSpan.FromMinutes(3)); + } + + [Fact] + public async Task UIResourceStartsAndBecomesHealthy() + { + await fixture.ResourceNotificationService + .WaitForResourceHealthyAsync(UIResourceName) + .WaitAsync(TimeSpan.FromMinutes(5)); + } +} diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AwsContainerResourceCreationTests.cs b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AwsContainerResourceCreationTests.cs new file mode 100644 index 000000000..d110c2123 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AwsContainerResourceCreationTests.cs @@ -0,0 +1,245 @@ +using Aspire.Hosting; + +namespace CommunityToolkit.Aspire.Hosting.Floci.Tests; + +public class ContainerResourceCreationTests +{ + [Fact] + public void AddFlociAwsBuilderShouldNotBeNull() + { + IDistributedApplicationBuilder builder = null!; + Assert.Throws(() => builder.AddFlociAws("floci")); + } + + [Fact] + public void AddFlociAwsBuilderNameShouldNotBeNull() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + Assert.Throws(() => builder.AddFlociAws(null!)); + } + + [Fact] + public void AddFlociAwsBuilderContainerDetailsSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.Equal("floci", resource.Name); + + Assert.True(resource.TryGetLastAnnotation(out ContainerImageAnnotation? imageAnnotations)); + Assert.Equal(FlociContainerImageTags.AwsTag, imageAnnotations.Tag); + Assert.Equal(FlociContainerImageTags.AwsImage, imageAnnotations.Image); + Assert.Equal(FlociContainerImageTags.AwsRegistry, imageAnnotations.Registry); + } + + [Fact] + public async Task AddFlociAwsBuilderSetsEnvironmentVariables() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci", defaultRegion: "eu-west-1", defaultAccountId: "111111111111"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + Assert.Equal("floci", envVars[FlociAwsContainerResource.HostnameEnvVar].ToString()); + Assert.Equal("eu-west-1", envVars[FlociAwsContainerResource.DefaultRegionEnvVar].ToString()); + Assert.Equal("111111111111", envVars[FlociAwsContainerResource.DefaultAccountIdEnvVar].ToString()); + Assert.Equal("memory", envVars[resource.StorageModeEnvVar].ToString()); + } + + [Fact] + public void AddFlociAwsBuilderWithDataVolumeSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci") + .WithDataVolume("floci-data", isReadOnly: false); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetLastAnnotation(out ContainerMountAnnotation? mountAnnotations)); + Assert.Equal(ContainerMountType.Volume, mountAnnotations.Type); + Assert.Equal("/app/data", mountAnnotations.Target); + } + + [Fact] + public void WithFlociUIBuilderShouldNotBeNull() + { + IResourceBuilder builder = null!; + Assert.Throws(() => builder.WithFlociUI()); + } + + [Fact] + public void WithFlociUIAddsUIContainerResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci") + .WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var flociResource = appModel.Resources.OfType().SingleOrDefault(); + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(flociResource); + Assert.NotNull(uiResource); + Assert.Equal("floci-ui", uiResource.Name); + Assert.Same(flociResource, uiResource.Parent); + + Assert.True(uiResource.TryGetLastAnnotation(out ContainerImageAnnotation? imageAnnotations)); + Assert.Equal(FlociContainerImageTags.UITag, imageAnnotations.Tag); + Assert.Equal(FlociContainerImageTags.UIImage, imageAnnotations.Image); + Assert.Equal(FlociContainerImageTags.UIRegistry, imageAnnotations.Registry); + + Assert.True(uiResource.TryGetLastAnnotation(out EndpointAnnotation? endpointAnnotation)); + Assert.Equal(4500, endpointAnnotation.TargetPort); + Assert.Equal("http", endpointAnnotation.Name); + } + + [Fact] + public async Task WithFlociUISetsEnvironmentVariables() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci", defaultRegion: "eu-west-1", defaultAccountId: "111111111111") + .WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(uiResource); + Assert.True(uiResource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + var endpointExpression = Assert.IsType(envVars[FlociUIContainerResource.EndpointEnvVar]); + Assert.Contains("floci.bindings.aws.url", endpointExpression.ValueExpression); + Assert.Equal("eu-west-1", envVars[FlociUIContainerResource.RegionEnvVar].ToString()); + Assert.Equal("test", envVars[FlociUIContainerResource.AccessKeyIdEnvVar].ToString()); + Assert.Equal("test", envVars[FlociUIContainerResource.SecretAccessKeyEnvVar].ToString()); + Assert.Equal("111111111111", envVars[FlociUIContainerResource.DefaultAccountIdEnvVar].ToString()); + } + + [Fact] + public void WithFlociUICustomContainerNameSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci") + .WithFlociUI(containerName: "my-floci-ui"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(uiResource); + Assert.Equal("my-floci-ui", uiResource.Name); + } + + [Fact] + public void WithFlociUICalledTwiceOnSameResourceAddsSingleUIContainer() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + bool configureCallbackInvoked = false; + builder.AddFlociAws("floci") + .WithFlociUI() + .WithFlociUI(configureContainer: _ => configureCallbackInvoked = true); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + Assert.Single(appModel.Resources.OfType()); + Assert.True(configureCallbackInvoked); + } + + [Fact] + public void WithFlociUIPerFlociResourceAddsSeparateUIContainers() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci1").WithFlociUI(); + builder.AddFlociAws("floci2").WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResources = appModel.Resources.OfType().ToList(); + + Assert.Equal(2, uiResources.Count); + Assert.Contains(uiResources, r => r.Name == "floci1-ui"); + Assert.Contains(uiResources, r => r.Name == "floci2-ui"); + } + + [Fact] + public void WithFlociUIWithHostPortSetsEndpointPort() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci") + .WithFlociUI(configureContainer: ui => ui.WithHostPort(14500)); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(uiResource); + Assert.True(uiResource.TryGetLastAnnotation(out EndpointAnnotation? endpointAnnotation)); + Assert.Equal(14500, endpointAnnotation.Port); + } + + [Fact] + public void AddFlociAwsBuilderWithDataBindMountSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAws("floci") + .WithDataBindMount("floci-data", isReadOnly: false); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetLastAnnotation(out ContainerMountAnnotation? mountAnnotations)); + Assert.Equal(ContainerMountType.BindMount, mountAnnotations.Type); + Assert.Equal("/app/data", mountAnnotations.Target); + Assert.NotNull(mountAnnotations.Source); + } +} diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AzureContainerResourceCreationTests.cs b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AzureContainerResourceCreationTests.cs new file mode 100644 index 000000000..52571a433 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/AzureContainerResourceCreationTests.cs @@ -0,0 +1,187 @@ +using Aspire.Hosting; + +namespace CommunityToolkit.Aspire.Hosting.Floci.Tests; + +public class AzureContainerResourceCreationTests +{ + [Fact] + public void AddFlociAzureBuilderShouldNotBeNull() + { + IDistributedApplicationBuilder builder = null!; + Assert.Throws(() => builder.AddFlociAzure("floci-az")); + } + + [Fact] + public void AddFlociAzureBuilderNameShouldNotBeNull() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + Assert.Throws(() => builder.AddFlociAzure(null!)); + } + + [Fact] + public void AddFlociAzureBuilderContainerDetailsSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAzure("floci-az"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.Equal("floci-az", resource.Name); + + Assert.True(resource.TryGetLastAnnotation(out ContainerImageAnnotation? imageAnnotations)); + Assert.Equal(FlociContainerImageTags.AzureTag, imageAnnotations.Tag); + Assert.Equal(FlociContainerImageTags.AzureImage, imageAnnotations.Image); + Assert.Equal(FlociContainerImageTags.AzureRegistry, imageAnnotations.Registry); + + Assert.True(resource.TryGetLastAnnotation(out EndpointAnnotation? endpointAnnotation)); + Assert.Equal(4577, endpointAnnotation.TargetPort); + Assert.Equal("azure", endpointAnnotation.Name); + } + + [Fact] + public async Task AddFlociAzureBuilderSetsEnvironmentVariables() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAzure("floci-az"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + Assert.Equal("floci-az", envVars[FlociAzureContainerResource.HostnameEnvVar].ToString()); + Assert.Equal("memory", envVars[resource.StorageModeEnvVar].ToString()); + } + + [Fact] + public void AddFlociAzureBuilderWithDataVolumeSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAzure("floci-az") + .WithDataVolume("floci-az-data", isReadOnly: false); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetLastAnnotation(out ContainerMountAnnotation? mountAnnotations)); + Assert.Equal(ContainerMountType.Volume, mountAnnotations.Type); + Assert.Equal("/app/data", mountAnnotations.Target); + } + + [Fact] + public void AddFlociAzureBuilderWithDataBindMountSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAzure("floci-az") + .WithDataBindMount("floci-az-data", isReadOnly: false); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetLastAnnotation(out ContainerMountAnnotation? mountAnnotations)); + Assert.Equal(ContainerMountType.BindMount, mountAnnotations.Type); + Assert.Equal("/app/data", mountAnnotations.Target); + Assert.NotNull(mountAnnotations.Source); + } + + [Fact] + public void WithFlociUIBuilderShouldNotBeNullForAzure() + { + IResourceBuilder builder = null!; + Assert.Throws(() => builder.WithFlociUI()); + } + + [Fact] + public void WithFlociUIAddsUIContainerResourceForAzure() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAzure("floci-az") + .WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var flociResource = appModel.Resources.OfType().SingleOrDefault(); + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(flociResource); + Assert.NotNull(uiResource); + Assert.Equal("floci-az-ui", uiResource.Name); + Assert.Same(flociResource, uiResource.Parent); + + Assert.True(uiResource.TryGetLastAnnotation(out ContainerImageAnnotation? imageAnnotations)); + Assert.Equal(FlociContainerImageTags.UITag, imageAnnotations.Tag); + Assert.Equal(FlociContainerImageTags.UIImage, imageAnnotations.Image); + Assert.Equal(FlociContainerImageTags.UIRegistry, imageAnnotations.Registry); + } + + [Fact] + public async Task WithFlociUISetsEnvironmentVariablesForAzure() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociAzure("floci-az") + .WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(uiResource); + Assert.True(uiResource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + var endpointExpression = Assert.IsType(envVars[FlociUIContainerResource.AzureEndpointEnvVar]); + Assert.Contains("floci-az.bindings.azure.url", endpointExpression.ValueExpression); + Assert.Equal("devstoreaccount1", envVars[FlociUIContainerResource.AzureAccountNameEnvVar].ToString()); + } + + [Fact] + public void WithFlociUICalledTwiceOnSameResourceAddsSingleUIContainerForAzure() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + bool configureCallbackInvoked = false; + builder.AddFlociAzure("floci-az") + .WithFlociUI() + .WithFlociUI(configureContainer: _ => configureCallbackInvoked = true); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + Assert.Single(appModel.Resources.OfType()); + Assert.True(configureCallbackInvoked); + } +} diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/CommunityToolkit.Aspire.Hosting.Floci.Tests.csproj b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/CommunityToolkit.Aspire.Hosting.Floci.Tests.csproj new file mode 100644 index 000000000..e01ffc58d --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/CommunityToolkit.Aspire.Hosting.Floci.Tests.csproj @@ -0,0 +1,18 @@ + + + + false + true + + + + + + + + + + + + + diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/GcpContainerResourceCreationTests.cs b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/GcpContainerResourceCreationTests.cs new file mode 100644 index 000000000..c7f3e3c88 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/GcpContainerResourceCreationTests.cs @@ -0,0 +1,188 @@ +using Aspire.Hosting; + +namespace CommunityToolkit.Aspire.Hosting.Floci.Tests; + +public class GcpContainerResourceCreationTests +{ + [Fact] + public void AddFlociGcpBuilderShouldNotBeNull() + { + IDistributedApplicationBuilder builder = null!; + Assert.Throws(() => builder.AddFlociGcp("floci-gcp")); + } + + [Fact] + public void AddFlociGcpBuilderNameShouldNotBeNull() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + Assert.Throws(() => builder.AddFlociGcp(null!)); + } + + [Fact] + public void AddFlociGcpBuilderContainerDetailsSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociGcp("floci-gcp"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.Equal("floci-gcp", resource.Name); + + Assert.True(resource.TryGetLastAnnotation(out ContainerImageAnnotation? imageAnnotations)); + Assert.Equal(FlociContainerImageTags.GcpTag, imageAnnotations.Tag); + Assert.Equal(FlociContainerImageTags.GcpImage, imageAnnotations.Image); + Assert.Equal(FlociContainerImageTags.GcpRegistry, imageAnnotations.Registry); + + Assert.True(resource.TryGetLastAnnotation(out EndpointAnnotation? endpointAnnotation)); + Assert.Equal(4588, endpointAnnotation.TargetPort); + Assert.Equal("gcp", endpointAnnotation.Name); + } + + [Fact] + public async Task AddFlociGcpBuilderSetsEnvironmentVariables() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociGcp("floci-gcp", defaultProjectId: "my-project"); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + Assert.Equal("floci-gcp", envVars[FlociGcpContainerResource.HostnameEnvVar].ToString()); + Assert.Equal("my-project", envVars[FlociGcpContainerResource.DefaultProjectIdEnvVar].ToString()); + Assert.Equal("memory", envVars[resource.StorageModeEnvVar].ToString()); + } + + [Fact] + public void AddFlociGcpBuilderWithDataVolumeSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociGcp("floci-gcp") + .WithDataVolume("floci-gcp-data", isReadOnly: false); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetLastAnnotation(out ContainerMountAnnotation? mountAnnotations)); + Assert.Equal(ContainerMountType.Volume, mountAnnotations.Type); + Assert.Equal("/app/data", mountAnnotations.Target); + } + + [Fact] + public void AddFlociGcpBuilderWithDataBindMountSetOnResource() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociGcp("floci-gcp") + .WithDataBindMount("floci-gcp-data", isReadOnly: false); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var resource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(resource); + Assert.True(resource.TryGetLastAnnotation(out ContainerMountAnnotation? mountAnnotations)); + Assert.Equal(ContainerMountType.BindMount, mountAnnotations.Type); + Assert.Equal("/app/data", mountAnnotations.Target); + Assert.NotNull(mountAnnotations.Source); + } + + [Fact] + public void WithFlociUIBuilderShouldNotBeNullForGcp() + { + IResourceBuilder builder = null!; + Assert.Throws(() => builder.WithFlociUI()); + } + + [Fact] + public void WithFlociUIAddsUIContainerResourceForGcp() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociGcp("floci-gcp") + .WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var flociResource = appModel.Resources.OfType().SingleOrDefault(); + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(flociResource); + Assert.NotNull(uiResource); + Assert.Equal("floci-gcp-ui", uiResource.Name); + Assert.Same(flociResource, uiResource.Parent); + + Assert.True(uiResource.TryGetLastAnnotation(out ContainerImageAnnotation? imageAnnotations)); + Assert.Equal(FlociContainerImageTags.UITag, imageAnnotations.Tag); + Assert.Equal(FlociContainerImageTags.UIImage, imageAnnotations.Image); + Assert.Equal(FlociContainerImageTags.UIRegistry, imageAnnotations.Registry); + } + + [Fact] + public async Task WithFlociUISetsEnvironmentVariablesForGcp() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + builder.AddFlociGcp("floci-gcp", defaultProjectId: "my-project") + .WithFlociUI(); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResource = appModel.Resources.OfType().SingleOrDefault(); + + Assert.NotNull(uiResource); + Assert.True(uiResource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + var endpointExpression = Assert.IsType(envVars[FlociUIContainerResource.GcpEndpointEnvVar]); + Assert.Contains("floci-gcp.bindings.gcp.url", endpointExpression.ValueExpression); + Assert.Equal("my-project", envVars[FlociUIContainerResource.GcpProjectEnvVar].ToString()); + } + + [Fact] + public void WithFlociUICalledTwiceOnSameResourceAddsSingleUIContainerForGcp() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + bool configureCallbackInvoked = false; + builder.AddFlociGcp("floci-gcp") + .WithFlociUI() + .WithFlociUI(configureContainer: _ => configureCallbackInvoked = true); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + Assert.Single(appModel.Resources.OfType()); + Assert.True(configureCallbackInvoked); + } +} diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/MultiCloudUITests.cs b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/MultiCloudUITests.cs new file mode 100644 index 000000000..90493b745 --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/MultiCloudUITests.cs @@ -0,0 +1,79 @@ +using Aspire.Hosting; + +namespace CommunityToolkit.Aspire.Hosting.Floci.Tests; + +public class MultiCloudUITests +{ + [Fact] + public void WithPluggedCloudAttachesAdditionalCloudsToSingleUIContainer() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + var azure = builder.AddFlociAzure("floci-az"); + var gcp = builder.AddFlociGcp("floci-gcp"); + + builder.AddFlociAws("floci") + .WithFlociUI(configureContainer: ui => + { + ui.WithPluggedCloud(azure); + ui.WithPluggedCloud(gcp); + }); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + // Only one UI container is created, even though three clouds are attached to it. + Assert.Single(appModel.Resources.OfType()); + } + + [Fact] + public async Task WithPluggedCloudSetsEachCloudsEnvironmentVariablesOnTheSharedUIContainer() + { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + var azure = builder.AddFlociAzure("floci-az"); + var gcp = builder.AddFlociGcp("floci-gcp", defaultProjectId: "my-project"); + + builder.AddFlociAws("floci") + .WithFlociUI(configureContainer: ui => + { + ui.WithPluggedCloud(azure); + ui.WithPluggedCloud(gcp); + }); + + using var app = builder.Build(); + var appModel = app.Services.GetRequiredService(); + + var uiResource = appModel.Resources.OfType().Single(); + + Assert.True(uiResource.TryGetAnnotationsOfType(out IEnumerable? envAnnotations)); + + var envVars = new Dictionary(); + var context = new EnvironmentCallbackContext(builder.ExecutionContext, envVars); + foreach (var annotation in envAnnotations!) + { + await annotation.Callback(context); + } + + // AWS vars — set because the UI was created via floci.WithFlociUI(). + Assert.True(envVars.ContainsKey(FlociUIContainerResource.EndpointEnvVar)); + Assert.Equal("test", envVars[FlociUIContainerResource.AccessKeyIdEnvVar].ToString()); + + // Azure and GCP vars — set via WithPluggedCloud on the same container. + var azureEndpoint = Assert.IsType(envVars[FlociUIContainerResource.AzureEndpointEnvVar]); + Assert.Contains("floci-az.bindings.azure.url", azureEndpoint.ValueExpression); + Assert.Equal("devstoreaccount1", envVars[FlociUIContainerResource.AzureAccountNameEnvVar].ToString()); + + var gcpEndpoint = Assert.IsType(envVars[FlociUIContainerResource.GcpEndpointEnvVar]); + Assert.Contains("floci-gcp.bindings.gcp.url", gcpEndpoint.ValueExpression); + Assert.Equal("my-project", envVars[FlociUIContainerResource.GcpProjectEnvVar].ToString()); + } + + [Fact] + public void WithPluggedCloudBuilderShouldNotBeNull() + { + IResourceBuilder builder = null!; + IResourceBuilder azure = null!; + Assert.Throws(() => builder.WithPluggedCloud(azure)); + } +} diff --git a/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/TypeScriptAppHostTests.cs b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/TypeScriptAppHostTests.cs new file mode 100644 index 000000000..404772dca --- /dev/null +++ b/tests/CommunityToolkit.Aspire.Hosting.Floci.Tests/TypeScriptAppHostTests.cs @@ -0,0 +1,19 @@ +using Aspire.Components.Common.Tests; +using CommunityToolkit.Aspire.Testing; + +namespace CommunityToolkit.Aspire.Hosting.Floci.Tests; + +[RequiresDocker] +public class TypeScriptAppHostTests +{ + [Fact] + public async Task TypeScriptAppHostCompilesAndStarts() + { + await TypeScriptAppHostTest.Run( + appHostProject: "CommunityToolkit.Aspire.Hosting.Floci.AppHost.TypeScript", + packageName: "CommunityToolkit.Aspire.Hosting.Floci", + exampleName: "floci", + waitForResources: ["floci-aws", "floci-az", "floci-gcp", "floci-custom", "floci-gcp-custom", "floci-persistent", "floci-mount"], + cancellationToken: TestContext.Current.CancellationToken); + } +}