Giao diện
Config Registry
TÓM TẮT
configRegistry.ts (~900+ dòng) là single source of truth cho 21 loại config. Hỗ trợ in-memory defaults, database override (per-warehouse), và caching.
21 Config Keys
Foundation (6)
| Key | Mô tả |
|---|---|
seasonal | Seasonal patterns (monthly weights) |
dow | Day-of-week distribution |
weekOfMonth | Week-of-month multipliers |
payday | Payday configuration |
baselineOptions | BAU baseline options |
capacity | Capacity settings |
Sales (3)
| Key | Mô tả |
|---|---|
doubleDays | Double-day event configs |
countrySales | Country-specific sale events |
seasonalEvents | Seasonal event calendar |
Models (3)
| Key | Mô tả |
|---|---|
segmentConfigs | Ensemble weights per segment |
hwDefaults | Holt-Winters default parameters |
quantileParams | Confidence interval parameters |
Algorithms (2)
| Key | Mô tả |
|---|---|
anomalyConfig | Anomaly detection thresholds |
tuningParams | Auto-tuning parameter ranges |
Workforce (5)
| Key | Mô tả |
|---|---|
workforceDefaults | Default staffing settings |
warehouseCodeMap | Warehouse code mappings |
warehouseSeasonal | Per-warehouse seasonal adjustments |
warehouseEventMultipliers | Per-warehouse event multipliers |
warehouseDailyAverages | Per-warehouse daily volume baselines |
Monitoring (2)
| Key | Mô tả |
|---|---|
monitorConfig | Accuracy alert thresholds |
laborLawConfigs | Labor law configs (VN/TH/PH) |
Database Integration
typescript
// Load config from Supabase with caching
await ConfigRegistry.loadFromDB(warehouseCode);
// Get config value (falls back to in-memory default)
const dowConfig = ConfigRegistry.get('dow');