UNPKG

@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
# 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