# 2.1.16

**Release Date:** October 16, 2025

---

## ✨ New Features

### NuGet Packages

#### WireMock CLI Integration for Aspire App Host 🎭

**Package:** `SAIF.Platform.Aspire.Hosting`

Added comprehensive WireMock CLI integration for Aspire applications, enabling developers to automatically pull mock API configurations from WireMock Cloud and host multiple mock service instances within the Aspire App Host. This eliminates manual mock server setup and provides seamless service discovery for dependent APIs.

**Key Features:**

- ✅ **Multi-Service Support** - Host multiple mock services on different ports
- ✅ **Selective Auto-Update** - Control WireMock Cloud sync per service
- ✅ **Service Discovery** - Automatic environment variable generation
- ✅ **Fluent Configuration** - Clean, readable API with method chaining
- ✅ **Lifecycle Management** - Handles setup, pulls, and startup automatically
- ✅ **Cloud Integration** - Seamless WireMock Cloud synchronization

**Benefits:**

- 🚀 Simplifies local development workflow
- 🔄 Automatic mock configuration updates from cloud
- 🎯 Service discovery integration with Aspire
- 📦 No manual mock server setup required

**Documentation:**

- [WireMock Aspire Hosting Guide](https://dev.azure.com/saifcorporation/Platform/_git/forge?path=/docs/guides/development/mocking/host-wiremock-cli.md)
- [Recording Workflow with GitHub Copilot](https://dev.azure.com/saifcorporation/Platform/_git/forge?path=/docs/guides/development/mocking/wiremock-cli-record.md)

---

### Project Templates

---

### CLI Tools

#### NPM Package Auto-Updates

**Package:** `SAIF.DevTools.CLI`

Added automatic updates for WireMock and HTTP testing tools to the CLI update command.

**New Auto-Update Packages:**

- `@wiremock/cli` - WireMock CLI for mock API hosting
- `httpyac` - HTTP client for API testing

**Usage:**

```bash
saif update
```

---

### Terraform Modules

#### Blob Versioning Support for Azure Storage Account

**Module:** `azure-storage/storageaccount`

Added the ability to enable blob versioning on Azure Storage Accounts. When enabled, Azure Storage automatically maintains previous versions of blobs when they are modified or deleted, providing enhanced data protection and recovery capabilities.

**New Variable:**

- `blob_versioning_enabled` (bool, default: `false`) - Enable versioning for blobs in the storage account

**Example:**

```hcl
module "storage_account" {
  source = "./modules/azure-storage/storageaccount"

  name                     = "mystorageaccount"
  resource_group_name      = "my-rg"
  location                 = "eastus"
  blob_versioning_enabled  = true  # Enable blob versioning
}
```

**Benefits:**

- ✅ Automatic versioning of blob modifications
- ✅ Protection against accidental deletions
- ✅ Point-in-time recovery capabilities
- ✅ Compliance with data retention requirements

#### Cosmos DB Data Plane Access for Event Subscriber Service

**Module:** `saif-event-subscriber-service`

Added the ability to grant Azure Cosmos DB data plane access to Event Subscriber Services when the API service includes Cosmos DB infrastructure. This enables subscriber functions to directly read or write data to Cosmos DB containers using Azure RBAC-based authentication, eliminating the need for connection string management.

**New Feature:**

- Automatic detection of Cosmos DB resources from the API service infrastructure
- **Automatically assigns data contributor access** to both the application service principal and the user managed identity
- Configurable read-only or contributor access levels (defaults to contributor for the `saif-event-subscriber-service` module)
- Uses built-in Cosmos DB SQL role definitions for secure access

**Implementation:**

When a Cosmos DB account is detected in the API service outputs, the subscriber service automatically provisions data contributor access:

```hcl
module "cosmosdb_data_plane_contributor" {
  source                = "azure-databases/modules/cosmosdb_data_plane_access"
  resource_group_name   = data.tfe_outputs.api_service.values.resource_group_name
  cosmosdb_account_id   = data.tfe_outputs.api_service.values.cosmosdb_account_id
  cosmosdb_account_name = data.tfe_outputs.api_service.values.cosmosdb_account_name
  principal_ids_map = {
    "application"   = module.application.service_principal_object_id
    "user_identity" = azurerm_user_assigned_identity.function.principal_id
  }
  read_only_access = false  # Set to true for read-only access
}
```

**Configuration Variables:**

- `read_only_access` (bool, default: `false`) - Set to `true` for read-only data access, `false` for contributor access

**Benefits:**

- ✅ **Automatic data contributor access** - No configuration needed, subscribers can read and write to Cosmos DB by default
- ✅ Secure RBAC-based authentication instead of connection strings
- ✅ Supports both read-only and contributor access patterns
- ✅ Seamless integration with existing API service Cosmos DB infrastructure
- ✅ No manual permission management required

_(In Progress)_: The Event Subscriber .NET project template is currently being updated to include code generation support for Cosmos DB write operations when the function is triggered. This enhancement will provide developers with ready-to-use repository patterns and data access code when Cosmos DB is detected in the infrastructure.

---

## 🔧 Enhancements

### NuGet Packages

- ✅ **SAIF.Platform.Aspire.Hosting** - Added WireMock CLI integration

### CLI Tools

- ✅ **SAIF.DevTools.CLI** - Added `@wiremock/cli` and `httpyac` to auto-update package list

### Terraform Modules

- ✅ **azure-storage/storageaccount** - Added blob versioning support with `blob_versioning_enabled` variable
- ✅ **saif-event-subscriber-service** - Added automatic Cosmos DB data plane contributor access when API service includes Cosmos DB infrastructure

---

## 📚 Documentation

### New Documentation

- 📖 [WireMock Aspire Hosting Guide](https://dev.azure.com/saifcorporation/Platform/_git/forge?path=/docs/guides/development/mocking/host-wiremock-cli.md) - Complete guide for hosting WireMock CLI in Aspire (805 lines)
- 📖 [WireMock Recording Workflow](https://dev.azure.com/saifcorporation/Platform/_git/forge?path=/docs/guides/development/mocking/wiremock-cli-record.md) - Recording API interactions with GitHub Copilot integration
- 📖 [Development Guides](https://dev.azure.com/saifcorporation/Platform/_git/forge?path=/docs/guides/development/_development.md) - Updated navigation with new WireMock documentation

### Updated Documentation

- 📝 [WireMock Tool Documentation](https://dev.azure.com/saifcorporation/Platform/_git/forge?path=/docs/tools/wiremock.md) - Enhanced with Aspire integration examples and workflows

---

## 🔄 Breaking Changes

**None in this release** ✅

---

### Support

- 💬 Teams Support Channel: [Support](https://teams.microsoft.com/l/channel/19%3Acb611810fb0b42b080cfff5590bdd51c%40thread.tacv2/Support?groupId=514d2dac-2d62-48ce-bf99-0fa0ce39469c&tenantId=a86cb8ed-369b-4df5-ace5-43811f6e08cf)

---
