@chiraitori/hoyolab-core
Version:
Core utilities for HoYoLab automation - daily check-ins and code redemption with smart rate limiting
50 lines (40 loc) β’ 2.43 kB
Markdown
# Changelog
All notable changes to this project will be documented in this file.
## [1.1.0] - 2025-06-02
### Added
- β‘ **Rate Limit Compliance**: Default 6-second delays for code redemption (HoYoLab's actual API limit)
- π **Smart Cooldown Handling**: Automatic detection and retry for API cooldowns
- π **RateLimits Constants**: Easy access to timing configurations
- π‘οΈ **Enhanced Error Handling**: Better error categorization and retry logic
- π **Attempt Tracking**: Detailed logging of retry attempts for each code
### Changed
- π **Breaking**: Default `redeemMultipleCodes` delay increased from 1s to 6s for API compliance
- π§ **Improved**: ErrorCodes now properly exported in main package
- π **Enhanced**: Documentation updated with rate limit warnings and best practices
### Fixed
- β
**Cooldown Detection**: Automatic parsing of "Please try again in X second(s)" messages
- β
**Retry Logic**: Smart waiting based on API-provided cooldown times
- β
**Export Issues**: All constants and error codes now properly accessible
## [1.0.0] - 2025-06-02
### Added
- π **Initial release** of hoyolab-core package!
- Daily check-in functionality for Genshin Impact, Honkai: Star Rail, and Zenless Zone Zero
- Code redemption system with game-specific validation
- Game-specific region mapping system (each game has its own region codes)
- HTTP client with rate limiting and retry logic
- Comprehensive error handling with custom error codes
- TypeScript definitions included
- Full test suite with 17 test cases
- Documentation and usage examples
### Core Features
- **HoyoLabClient**: Main client class for HoYoLab APIs
- **Games Support**: Genshin Impact, Honkai: Star Rail, Zenless Zone Zero
- **Region Mapping**: Game-specific region code to name mapping
- **Error Handling**: Custom error types with descriptive codes
- **Zero Dependencies**: Pure Node.js implementation
- **Rate Limiting**: Built-in API protection
- **TypeScript Ready**: Full type definitions
### Game-Specific Region Mappings
- **Genshin Impact**: `os_usa`βNA, `os_euro`βEU, `os_asia`βSEA, `os_cht`βTW/HK/MO
- **Honkai Star Rail**: `prod_official_usa`βNA, `prod_official_eur`βEU, `prod_official_asia`βSEA, `prod_official_cht`βTW/HK/MO
- **Zenless Zone Zero**: `prod_gf_us`βNA, `prod_gf_eu`βEU, `prod_gf_jp`βSEA, `prod_gf_sg`βTW/HK/MO