feat(AppData): Refactor AppData class for declarative env mapping and enhanced static helpers

This commit is contained in:
2025-08-15 13:17:18 +00:00
parent 61fafd2c8f
commit ed969cee47
6 changed files with 628 additions and 138 deletions

View File

@@ -1,5 +1,46 @@
# Changelog
## 2025-08-15 - 5.3.0 - feat(AppData)
Refactor AppData class for declarative env mapping and enhanced static helpers
- Introduced a singleton Qenv provider to optimize environment variable resolution.
- Centralized type conversion logic with utility functions for boolean, JSON, base64, number, and string conversions.
- Replaced complex switch statements with a composable, declarative mapping pipeline for processing envMapping.
- Enhanced logging during AppData initialization to clearly report key processing and overwrite operations.
- Added new static helper methods for environment variable access (valueAsBoolean, valueAsJson, valueAsBase64, valueAsString, valueAsNumber).
- Fixed boolean conversion issues and ensured backward compatibility with the deprecated 'ephermal' option.
## 2025-08-15 - 5.2.0 - feat(AppData)
Major refactoring of AppData class for improved elegance and maintainability
- **New Features:**
- Added static helper methods for direct environment variable access:
- `AppData.valueAsBoolean()` - Convert env vars to boolean
- `AppData.valueAsJson()` - Parse env vars as JSON
- `AppData.valueAsBase64()` - Decode base64 env vars
- `AppData.valueAsString()` - Get env vars as string
- `AppData.valueAsNumber()` - Parse env vars as number
- Enhanced logging for AppData initialization and key processing:
- Shows which storage type is being used (custom, ephemeral, auto-selected)
- Logs each key being processed with its spec type
- Reports success/failure for each key with type information
- Provides summary statistics of processed keys
- **Architecture Improvements:**
- Replaced 100+ line switch statement with declarative pipeline architecture
- Introduced centralized type converters and transform registry
- Implemented composable transform pipeline: `parseMappingSpec()``resolveSource()``applyTransforms()`
- Added singleton Qenv provider to reduce allocations
- Reduced code complexity by ~70% while maintaining 100% backward compatibility
- **Bug Fixes:**
- Fixed boolean conversion to properly handle both string and boolean inputs
- Added `ephemeral` option (correctly spelled) while maintaining backward compatibility with deprecated `ephermal`
- **Performance:**
- Optimized environment variable resolution with shared Qenv instance
- Reduced object allocations in static helpers
## 2025-08-15 - 5.1.4 - fix(AppData, dev dependencies, settings)
Improve boolean conversion in AppData, update @types/node dependency, and add local settings file.