@iota-big3/sdk-gateway
Version:
Universal API Gateway with protocol translation, intelligent routing, rate limiting, health checking, and caching
239 lines (190 loc) • 7.59 kB
Markdown
# Changelog
All notable changes to `@iota-big3/sdk-gateway` will be documented in this file.
## [2.1.1] - 2025-07-25
### Fixed
- **TypeScript Configuration**: Resolved 40 compilation errors related to monorepo imports
- Root cause: `rootDir` was restricting imports from other packages
- Solution: Updated `tsconfig.build.json` to set `rootDir: "../.."`
- Result: Full TypeScript health restored (0 errors)
### Added
- **Phase 2.5 Documentation**: Comprehensive audit results and lessons learned
- Core competency assessment: Grade A- (90%)
- Detailed technical analysis of the fix
- Next steps for Phase 2f, 2h, and 3
## [2.1.0] - 2024-07-24
### Added (Phase 2k - Production Readiness)
- **Chaos Engineering Framework**: Production-grade failure injection system
- Network latency simulation with configurable delays
- Service failure injection (HTTP error codes)
- Request timeout simulation
- Resource exhaustion simulation (CPU, memory, connections)
- Response corruption (truncated, invalid JSON, empty, huge)
- Deterministic chaos with seed support
- Real-time statistics and event emissions
- Enable/disable controls at runtime
- **Performance Monitoring**: Enterprise-grade metrics and anomaly detection
- Request metrics tracking (rate, latency percentiles, active connections)
- Error rate monitoring with configurable thresholds
- Resource monitoring (CPU, memory usage)
- Throughput measurements
- Anomaly detection algorithms:
- Latency spike detection
- Memory leak identification
- Error rate threshold monitoring
- Throughput degradation alerts
- Real-time metric collection
- Event emission for critical anomalies
- **Production Smoke Tests**: Automated deployment validation
- Health check endpoint validation
- Service discovery verification
- Request routing tests
- Rate limiting functionality checks
- Circuit breaker validation
- Cache operation tests
- Authentication verification
- Metrics endpoint validation
- Parallel/sequential execution modes
- Critical test prioritization
- Comprehensive reporting with pass rates
- **Documentation**: Comprehensive production deployment guide
- Chaos engineering examples
- Performance monitoring integration
- Smoke test automation
- Production configuration best practices
### Improved
- **Type Safety**: All new components with full TypeScript support
- **Testing**: Comprehensive test coverage for chaos middleware
- **Examples**: Added production-ready demo showcasing all Phase 2k features
- **API Documentation**: Updated with new production readiness APIs
## [2.0.0-beta.1] - 2024-07-21
### Added (Phase 2g - Safe Feature Enhancement)
- **Rate Limiting**: Configurable request rate limiting with custom key generation
- Window-based rate limiting with configurable duration and max requests
- Custom key generator support for user/IP/route-based limiting
- Skip conditions for whitelisting paths
- Events for rate limit violations
- **Health Checking**: Active service health monitoring
- Periodic health checks with configurable intervals
- Custom health check functions
- Retry logic with exponential backoff
- Overall gateway health status reporting
- **Response Caching**: Intelligent caching with multiple strategies
- LRU (Least Recently Used), LFU (Least Frequently Used), and FIFO strategies
- TTL management with per-entry expiration
- Cache invalidation by pattern and tags
- Cache statistics and hit rate tracking
- Pluggable cache stores (Redis/Memcached support)
- **Gateway Management Features**:
- Dynamic enable/disable functionality
- Runtime configuration updates
- Route management (add/remove routes dynamically)
- Enhanced metrics with cache and rate limit statistics
### Changed (Phase 2d - Subfolder-Level Clean Rebuild)
- Rebuilt corrupted modules with clean architecture:
- `http-adapter` - Clean HTTP protocol adapter implementation
- `response-aggregator` - Improved aggregation logic
- `service-registry` - Enhanced service discovery
- `gateway-manager` - Centralized gateway management
- Improved type definitions with better type safety
- Enhanced error handling across all modules
### Fixed (Phase 2f - Lint Quality Enhancement)
- Fixed all TypeScript compilation errors (0 errors)
- Resolved ESLint issues:
- Replaced `any` types with proper type definitions
- Fixed unused variables with underscore prefix convention
- Added proper null/undefined checks
- Improved type safety in test files
### Improved
- **Performance**: Optimized request handling pipeline
- **Memory Usage**: Better cleanup and resource management
- **Type Safety**: Stricter TypeScript configuration
- **Test Coverage**: Comprehensive test suite with 42 tests
- **Documentation**: Updated with all new features and examples
### Technical Details
- **Phase 2b**: Clean rebuild approach was considered but Phase 2d was chosen
- **Phase 2d**: Successfully rebuilt 4 corrupted modules
- **Phase 2e**: File-level fixes applied to remaining issues
- **Phase 2f**: Systematic lint cleanup after TypeScript fixes
- **Phase 2g**: Safe feature enhancement with backward compatibility
- **Phase 2k**: Production readiness with chaos engineering and monitoring
## [1.0.0] - Previous Version
### Initial Features
- Multi-protocol support (HTTP, gRPC, WebSocket, GraphQL)
- Basic routing engine
- Circuit breaker pattern
- SLA monitoring
- Cost tracking
- Service discovery (static, Kubernetes, Consul)
---
## Migration Guide
### From 2.0 to 2.1 (Phase 2k)
The Phase 2k update is fully backward compatible. To use the new production features:
1. **Enable Chaos Engineering** (staging/testing only):
```typescript
import { ChaosMiddleware } from "@iota-big3/sdk-gateway";
const chaos = new ChaosMiddleware({
enabled: process.env.NODE_ENV === "staging",
failures: {
networkLatency: { probability: 0.1, minMs: 100, maxMs: 500 },
},
});
gateway.use(chaos);
```
2. **Add Performance Monitoring**:
```typescript
import { PerformanceMonitor } from "@iota-big3/sdk-gateway";
const monitor = new PerformanceMonitor({
latency: { p95: 150 },
errorRate: 0.01,
});
monitor.on("anomaly:critical", (anomaly) => {
// Handle critical anomaly
});
```
3. **Implement Smoke Tests**:
```typescript
import { runSmokeTests } from "@iota-big3/sdk-gateway";
// In your deployment pipeline
const results = await runSmokeTests(gatewayUrl);
if (results.some((r) => !r.passed)) {
throw new Error("Deployment validation failed");
}
```
### From 1.x to 2.0
1. **Configuration Changes**:
```typescript
// Old
const gateway = createGateway({
protocols: ["http"],
port: 8080,
});
// New
const gateway = createGateway({
name: "My Gateway",
port: 8080,
rateLimit: { windowMs: 60000, max: 100 },
healthCheck: { interval: 30000 },
caching: { enabled: true, ttl: 300 },
});
```
2. **Service Registration**:
```typescript
// Old
gateway.registerService({
id: "service-1",
url: "http://localhost:3000",
});
// New
gateway.registerService({
id: "service-1",
name: "my-service",
host: "localhost",
port: 3000,
protocol: "http",
healthCheck: "/health",
});
```
3. **New Features**:
- Use `gateway.getRateLimiter()` for rate limit management
- Use `gateway.getHealthChecker()` for health monitoring
- Use `gateway.getCacheManager()` for cache control