Socket
Socket
Sign inDemoInstall

@vermaysha/hoyolab-api

Package Overview
Dependencies
21
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 3.1.1

775

dist/index.d.ts

@@ -1,11 +0,764 @@

export * from './helpers';
export * from './Request';
export { Cache } from './Cache';
export * from './Interfaces';
export * from './Interfaces/Genshin';
export { Hoyolab } from './Hoyolab';
export * from './HoyolabError';
export { Genshin } from './Genshin';
export { HonkaiStarRail } from './HonkaiStarRail';
export * from './Cookie';
export * as Route from './routes';
import { SearchParameters } from 'got';
interface IResponse {
retcode: number;
message: string;
data: unknown;
}
declare enum LanguageEnum {
SIMPLIFIED_CHINESE = "zh-cn",
TRADIIONAL_CHINESE = "zh-tw",
GERMAN = "de-de",
ENGLISH = "en-us",
SPANISH = "es-es",
FRENCH = "fr-fr",
INDONESIAN = "id-id",
ITALIAN = "it-it",
JAPANESE = "ja-jp",
KOREAN = "ko-kr",
PORTUGUESE = "pt-pt",
RUSSIAN = "ru-ru",
THAI = "th-th",
TURKISH = "tr-tr",
VIETNAMESE = "vi-vn"
}
interface ICookie {
ltoken: string;
ltuid: number;
cookieToken?: string | null;
accountId?: number;
mi18nLang?: LanguageEnum | string | null;
}
type BodyType = {
[x: string]: string | number | boolean | null | undefined | string[] | number[] | never[];
};
interface IRedeemCode {
data: string | null;
message: string;
retcode: number;
}
interface IHoyolabOptions {
/**
* Cookie Object
*/
cookie: ICookie | string;
/**
* If this property is filled, it will override the value contained in cookie.mi18nLang
*/
lang?: LanguageEnum;
}
interface IGame {
game_biz: string;
region: string;
game_uid: string;
nickname: string;
level: number;
is_chosen: boolean;
region_name: string;
is_official: boolean;
}
interface IGamesList {
list: IGame[];
}
declare enum GamesEnum {
GENSHIN_IMPACT = "hk4e_global",
HONKAI_IMPACT = "bh3_global",
HONKAI_STAR_RAIL = "hkrpg_global"
}
/**
* Convert given string to camelCase
*
* @param str string The string or text to convert
* @returns {string}
*/
declare function toCamelCase(str: string): string;
/**
* Transform camel case to snake case
*
* @param text string The string or text to convert
* @returns {string}
*/
declare function toSnakeCase(text: string): string;
/**
* Get Server Region by UID
*
* @param uid number UID
* @returns {string}
*/
declare function getServerRegion(uid: number): string;
/**
* Parse string to LanguageEnum
*
* @param lang string | null
* @returns {LanguageEnum}
*/
declare function parseLang(lang?: string | null): LanguageEnum;
declare class Request {
private headers;
private body;
private params;
private cache;
private ds;
constructor(cookies?: string | null);
/**
* Set Referer Headers
*
* @param url string URL string of referer
* @returns {this}
*/
setReferer(url: string): this;
/**
* Set Body Paramter
*
* @param body Body Body Parameters as object
* @returns {this}
*/
setBody(body: BodyType): this;
/**
* Set SearchParams or query parameter
*
* @param params SearchParameters Object of query parameter
* @returns {this}
*/
setParams(params: SearchParameters): this;
/**
* Set to used Dynamic Security or not
*
* @param flag boolean Flag
* @returns {this}
*/
setDs(flag?: boolean): this;
/**
* Set Language
*
* @param lang Language Language that used for return of API (default: Language.ENGLISH).
* @returns {this}
*/
setLang(lang?: LanguageEnum): this;
/**
* Send Request
*
* @param url string URL String
* @param method GET|POST Method for request
* @returns {Promise<IResponse>}
*/
send(url: string, method?: 'GET' | 'POST'): Promise<IResponse>;
/**
* Generate Dynamic Security
*
* @returns {string}
*/
private generateDS;
}
declare class Cache<K, V> extends Map<K, V> {
}
interface IGenshinOptions extends IHoyolabOptions {
uid?: number;
}
interface IGenshinRecordAvatar {
id: number;
image: string;
name: string;
element: string;
fetter: number;
level: number;
rarity: number;
actived_constellation_num: number;
card_image: string;
is_chosen: boolean;
}
interface IGenshinRecordStat {
active_day_number: number;
achievement_number: number;
anemoculus_number: number;
geoculus_number: number;
avatar_number: number;
way_point_number: number;
domain_number: number;
spiral_abyss: string;
precious_chest_number: number;
luxurious_chest_number: number;
exquisite_chest_number: number;
common_chest_number: number;
electroculus_number: number;
magic_chest_number: number;
dendroculus_number: number;
}
interface IGenshinRecordWorldExploration {
level: number;
exploration_percentage: number;
icon: string;
name: string;
type: string;
offerings: {
name: string;
level: number;
icon: string;
}[];
id: number;
parent_id: number;
map_url: string;
strategy_url: string;
background_image: string;
inner_icon: string;
cover: string;
}
interface IGenshinRecordHome {
level: number;
visit_num: number;
comfort_num: number;
item_num: number;
name: string;
icon: string;
comfort_level_name: string;
comfort_level_icon: string;
}
interface IGenshinRecord {
role: {
AvatarUrl: string;
nickname: string;
region: string;
level: number;
};
avatars: IGenshinRecordAvatar[];
stats: IGenshinRecordStat;
world_explorations: IGenshinRecordWorldExploration[];
homes: IGenshinRecordHome[];
city_explorations: unknown[];
}
interface IGenshinCharacterWeapon {
id: number;
name: string;
icon: string;
type: number;
rarity: number;
level: number;
promote_level: number;
type_name: string;
desc: string;
affix_level: number;
}
interface IGenshinCharacterReliquariesSet {
id: number;
name: string;
affixes: IGenshinCharacterReliquariesAffix[];
}
interface IGenshinCharacterReliquaries {
id: number;
name: string;
icon: string;
pos: number;
rarity: number;
level: number;
set: IGenshinCharacterReliquariesSet;
pos_name: string;
}
interface IGenshinCharacterReliquariesAffix {
activation_number: number;
effect: string;
}
interface IGenshinCharacterConstellation {
id: number;
name: string;
icon: string;
effect: string;
is_actived: boolean;
pos: number;
}
interface IGenshinCharacterCostume {
id: number;
name: string;
icon: string;
}
interface IGenshinCharacterBase {
id: number;
image: string;
icon: string;
name: string;
element: string;
rarity: number;
}
interface IGenshinCharacterAvatarFull extends IGenshinCharacterBase {
fetter: number;
level: number;
weapon: IGenshinCharacterWeapon;
reliquaries: IGenshinCharacterReliquaries[] | [];
constellations: IGenshinCharacterConstellation[];
actived_constellation_num: number;
costumes: IGenshinCharacterCostume[] | [];
external: unknown | null;
}
interface IGenshinCharacterRole {
AvatarUrl: string;
nickname: string;
region: string;
level: number;
}
interface IGenshinCharacters {
avatars: IGenshinCharacterAvatarFull[];
role: IGenshinCharacterRole;
}
interface IGenshinCharacterSummary {
avatars: Array<IGenshinCharacterBase & {
weapon_type: number;
weapon_type_name: string;
}>;
}
interface IGenshinDailyNote {
current_resin: number;
max_resin: number;
resin_recovery_time: string;
finished_task_num: number;
total_task_num: number;
is_extra_task_reward_received: boolean;
remain_resin_discount_num: number;
resin_discount_num_limit: number;
current_expedition_num: number;
max_expedition_num: number;
expeditions: {
avatar_side_icon: string;
status: 'Finished' | 'Ongoing';
remained_time: string;
}[];
current_home_coin: number;
max_home_coin: number;
home_coin_recovery_time: string;
calendar_url: string;
transformer: {
obtained: boolean;
recovery_time: {
Day: number;
Hour: number;
Minute: number;
Second: number;
reached: boolean;
};
wiki: string;
noticed: boolean;
latest_job_id: string;
};
}
interface IGenshinSpiralAbyssRank {
avatar_id: number;
avatar_icon: string;
value: number;
rarity: number;
}
interface IGenshinSpiralAbyssAvatar {
id: number;
icon: string;
level: number;
rarity: number;
}
interface IGenshinSpiralAbyssBattle {
index: number;
timestamp: string;
avatars: IGenshinSpiralAbyssAvatar[];
}
interface IGenshinSpiralAbyssLevel {
index: number;
star: number;
max_star: number;
battles: IGenshinSpiralAbyssBattle[];
}
interface IGenshinSpiralAbyssFloor {
index: number;
icon: string;
is_unlock: boolean;
settle_time: string;
star: number;
max_star: number;
levels: IGenshinSpiralAbyssLevel[];
}
interface IGenshinSpiralAbyss {
schedule_id: number;
start_time: string;
end_time: string;
total_battle_times: number;
total_win_times: number;
max_floor: string;
reveal_rank: IGenshinSpiralAbyssRank[];
defeat_rank: IGenshinSpiralAbyssRank[];
damage_rank: IGenshinSpiralAbyssRank[];
take_damage_rank: IGenshinSpiralAbyssRank[];
normal_skill_rank: IGenshinSpiralAbyssRank[];
energy_skill_rank: IGenshinSpiralAbyssRank[];
floors: IGenshinSpiralAbyssFloor[];
total_star: number;
is_unlock: boolean;
}
interface IGenshinDiaryBase {
uid: number;
region: string;
nickname: string;
optional_month: number[];
data_month: number;
}
interface IGenshinDiaryInfo extends IGenshinDiaryBase {
month: number;
month_data: {
current_primogems: number;
current_mora: number;
last_primogems: number;
last_mora: number;
primogem_rate: number;
mora_rate: number;
group_by: {
action_id: number;
action: string;
num: number;
percent: number;
}[];
};
day_data: {
current_primogems: number;
current_mora: number;
};
}
interface IGenshinDiaryHistory {
action_id: number;
action: string;
time: string;
num: number;
}
interface IGenshinDiaryDetail extends IGenshinDiaryBase {
current_page: number;
list: IGenshinDiaryHistory[];
}
interface IGenshinDailyAwardItem {
icon: string;
name: string;
cnt: number;
}
interface IGenshinDailyInfo {
total_sign_day: number;
today: string;
is_sign: boolean;
first_bind: boolean;
is_sub: boolean;
region: string;
month_last_day: boolean;
}
interface IGenshinDailyReward {
month: number;
resign: boolean;
now: string;
award: IGenshinDailyAwardItem;
}
interface IGenshinDailyRewards {
month: number;
resign: boolean;
now: string;
awards: IGenshinDailyAwardItem[];
}
interface IGenshinDailyClaim {
status: string;
code: number;
reward: IGenshinDailyReward | null;
info: IGenshinDailyInfo;
}
declare enum AbyssScheduleEnum {
CURRENT = 1,
PREVIOUS = 2
}
declare enum DiaryMonthEnum {
CURRENT = 3,
ONE_MONTH_AGO = 2,
TWO_MONTH_AGO = 1
}
declare enum DiaryEnum {
PRIMOGEMS = 1,
MORA = 2
}
declare class Hoyolab {
readonly cookie: ICookie;
readonly request: Request;
lang: LanguageEnum;
constructor(options: IHoyolabOptions);
/**
* Get games available accounts
*
* @param game GamesEnum Selected Game
* @returns {Promise<Interface.IGame[]>}
*/
gamesList(game?: GamesEnum): Promise<IGame[]>;
/**
* Select one of highest level game account
*
* @param game GameEnum Selected Game
* @returns {Promise<Interface.IGame>}
*/
gameAccount(game: GamesEnum): Promise<IGame>;
}
declare class HoyolabError extends Error {
readonly name: string;
readonly message: string;
constructor(message: string);
}
declare class Genshin {
readonly cookie: ICookie;
readonly request: Request;
uid: number | null;
region: string | null;
lang: LanguageEnum;
constructor(options: IGenshinOptions);
/**
* Create Genshin Object
*
* @param options IGenshinOptions Options
* @returns {Promise<Genshin>}
*/
static create(options: IGenshinOptions): Promise<Genshin>;
/**
* Fetch game records
*
* @returns {Promise<IGenshinRecord>}
*/
records(): Promise<IGenshinRecord>;
/**
* Fetch obtained genshin characters with artifact, weapon, level and constellation
*
* @returns {Promise<IGenshinCharacters>}
*/
characters(): Promise<IGenshinCharacters>;
/**
* Fetch characters summary detail (name, rarity, weapon, icon)
*
* @param characterIds number[] Characters ID
* @returns {Promise<IGenshinCharacterSummary>}
*/
charactersSummary(characterIds: number[]): Promise<IGenshinCharacterSummary>;
/**
* Fetch Spiral Abyss data
*
* @param scheduleType AbyssScheduleEnum
* @returns {Promise<IGenshinSpiralAbyss>}
*/
spiralAbyss(scheduleType?: AbyssScheduleEnum): Promise<IGenshinSpiralAbyss>;
/**
* Fetch daily note resources (resin, home coin, expeditions, and transformer)
*
* @returns {Promise<IGenshinDailyNote>}
*/
dailyNote(): Promise<IGenshinDailyNote>;
/**
* Fetch genshin impact diary data
*
* @param month
* @returns {Promise<IGenshinDiaryInfo>}
*/
diaries(month?: DiaryMonthEnum): Promise<IGenshinDiaryInfo>;
/**
* Fetch history of received resources (primogems and mora) from diary
*
* @param type DiaryEnum
* @param month DiaryMonthEnum
* @returns {IGenshinDiaryDetail}
*/
diaryDetail(type: DiaryEnum, month?: DiaryMonthEnum): Promise<IGenshinDiaryDetail>;
/**
* Fetch Daily login information
*
* @returns {Promise<IGenshinDailyInfo>}
*/
dailyInfo(): Promise<IGenshinDailyInfo>;
/**
* Fetch all rewards from daily login
*
* @returns {Promise<IGenshinDailyRewards>}
*/
dailyRewards(): Promise<IGenshinDailyRewards>;
/**
* Fetch reward from daily login based on day
*
* @param day number | null
* @returns {Promise<IGenshinDailyReward>}
*/
dailyReward(day?: number | null): Promise<IGenshinDailyReward>;
/**
* Claim current reward
*
* @returns {Promise<IGenshinDailyClaim>}
*/
dailyClaim(): Promise<IGenshinDailyClaim>;
/**
* Redeem Code
*
* @param code string
* @returns {Promise<IRedeemCode>}
*/
redeemCode(code: string): Promise<IRedeemCode>;
}
interface IHsrOptions extends IHoyolabOptions {
uid?: number;
}
interface IHsrDailyAwardItem {
icon: string;
name: string;
cnt: number;
}
interface IHsrDailyInfo {
total_sign_day: number;
today: string;
is_sign: boolean;
is_sub: boolean;
region: string;
}
interface IHsrDailyReward {
month: number;
resign: boolean;
biz: string;
award: IHsrDailyAwardItem;
}
interface IHsrDailyRewards {
month: number;
resign: boolean;
biz: string;
awards: IHsrDailyAwardItem[];
}
interface IHsrDailyClaim {
status: string;
code: number;
reward: IHsrDailyReward | null;
info: IHsrDailyInfo;
}
declare class HonkaiStarRail {
readonly cookie: ICookie;
readonly request: Request;
uid: number | null;
region: string | null;
lang: LanguageEnum;
constructor(options: IHsrOptions);
/**
* Create StarRails Object
*
* @param options IHsrOptions Options
* @returns {Promise<HonkaiStarRail>}
*/
static create(options: IHsrOptions): Promise<HonkaiStarRail>;
dailyInfo(): Promise<IHsrDailyInfo>;
/**
* Fetch all rewards from daily login
*
* @returns {Promise<IHsrDailyRewards>}
*/
dailyRewards(): Promise<IHsrDailyRewards>;
/**
* Fetch reward from daily login based on day
*
* @param day number | null
* @returns {Promise<IHsrDailyReward>}
*/
dailyReward(day?: number | null): Promise<IHsrDailyReward>;
/**
* Claim current reward
*
* @returns {Promise<IHsrDailyClaim>}
*/
dailyClaim(): Promise<IHsrDailyClaim>;
/**
* Redeem Code
*
* @param code string
* @returns {Promise<IRedeemCode>}
*/
redeemCode(code: string): Promise<IRedeemCode>;
}
declare class Cookie {
/**
* Parse Cookie string to ICookie Object
*
* @param cookieString string String cookies sourced from the hoyolab page
* @returns {ICookie}
*/
static parseCookieString(cookieString: string): ICookie;
/**
* Parse Cookie object to cookie string
*
* @param cookie ICookie
* @returns {string}
*/
static parseCookie(cookie: ICookie): string;
}
declare const GAMES_ACCOUNT = "https://api-account-os.hoyolab.com/account/binding/api/getUserGameRolesByCookieToken";
declare const GENSHIN_GAME_RECORD_REFERER = "https://act.hoyolab.com";
declare const GENSHIN_GAME_RECORD: string;
declare const GENSHIN_CHARACTERS_LIST: string;
declare const GENSHIN_CHARACTERS_SUMMARY: string;
declare const GENSHIN_SPIRAL_ABYSS: string;
declare const GENSHIN_DAILY_NOTE: string;
declare const GENSHIN_DIARY: string;
declare const GENSHIN_DIARY_DETAIL: string;
declare const GENSHIN_DAILY_INFO: string;
declare const GENSHIN_DAILY_REWARD: string;
declare const GENSHIN_DAILY_CLAIM: string;
declare const HSR_DAILY_INFO: string;
declare const HSR_DAILY_REWARD: string;
declare const HSR_DAILY_CLAIM: string;
declare const GENSHIN_REDEEM_CODE: string;
declare const routes_GAMES_ACCOUNT: typeof GAMES_ACCOUNT;
declare const routes_GENSHIN_CHARACTERS_LIST: typeof GENSHIN_CHARACTERS_LIST;
declare const routes_GENSHIN_CHARACTERS_SUMMARY: typeof GENSHIN_CHARACTERS_SUMMARY;
declare const routes_GENSHIN_DAILY_CLAIM: typeof GENSHIN_DAILY_CLAIM;
declare const routes_GENSHIN_DAILY_INFO: typeof GENSHIN_DAILY_INFO;
declare const routes_GENSHIN_DAILY_NOTE: typeof GENSHIN_DAILY_NOTE;
declare const routes_GENSHIN_DAILY_REWARD: typeof GENSHIN_DAILY_REWARD;
declare const routes_GENSHIN_DIARY: typeof GENSHIN_DIARY;
declare const routes_GENSHIN_DIARY_DETAIL: typeof GENSHIN_DIARY_DETAIL;
declare const routes_GENSHIN_GAME_RECORD: typeof GENSHIN_GAME_RECORD;
declare const routes_GENSHIN_GAME_RECORD_REFERER: typeof GENSHIN_GAME_RECORD_REFERER;
declare const routes_GENSHIN_REDEEM_CODE: typeof GENSHIN_REDEEM_CODE;
declare const routes_GENSHIN_SPIRAL_ABYSS: typeof GENSHIN_SPIRAL_ABYSS;
declare const routes_HSR_DAILY_CLAIM: typeof HSR_DAILY_CLAIM;
declare const routes_HSR_DAILY_INFO: typeof HSR_DAILY_INFO;
declare const routes_HSR_DAILY_REWARD: typeof HSR_DAILY_REWARD;
declare namespace routes {
export {
routes_GAMES_ACCOUNT as GAMES_ACCOUNT,
routes_GENSHIN_CHARACTERS_LIST as GENSHIN_CHARACTERS_LIST,
routes_GENSHIN_CHARACTERS_SUMMARY as GENSHIN_CHARACTERS_SUMMARY,
routes_GENSHIN_DAILY_CLAIM as GENSHIN_DAILY_CLAIM,
routes_GENSHIN_DAILY_INFO as GENSHIN_DAILY_INFO,
routes_GENSHIN_DAILY_NOTE as GENSHIN_DAILY_NOTE,
routes_GENSHIN_DAILY_REWARD as GENSHIN_DAILY_REWARD,
routes_GENSHIN_DIARY as GENSHIN_DIARY,
routes_GENSHIN_DIARY_DETAIL as GENSHIN_DIARY_DETAIL,
routes_GENSHIN_GAME_RECORD as GENSHIN_GAME_RECORD,
routes_GENSHIN_GAME_RECORD_REFERER as GENSHIN_GAME_RECORD_REFERER,
routes_GENSHIN_REDEEM_CODE as GENSHIN_REDEEM_CODE,
routes_GENSHIN_SPIRAL_ABYSS as GENSHIN_SPIRAL_ABYSS,
routes_HSR_DAILY_CLAIM as HSR_DAILY_CLAIM,
routes_HSR_DAILY_INFO as HSR_DAILY_INFO,
routes_HSR_DAILY_REWARD as HSR_DAILY_REWARD,
};
}
export { AbyssScheduleEnum, BodyType, Cache, Cookie, DiaryEnum, DiaryMonthEnum, GamesEnum, Genshin, HonkaiStarRail, Hoyolab, HoyolabError, ICookie, IGame, IGamesList, IGenshinCharacterAvatarFull, IGenshinCharacterBase, IGenshinCharacterConstellation, IGenshinCharacterCostume, IGenshinCharacterReliquaries, IGenshinCharacterReliquariesAffix, IGenshinCharacterReliquariesSet, IGenshinCharacterRole, IGenshinCharacterSummary, IGenshinCharacterWeapon, IGenshinCharacters, IGenshinDailyAwardItem, IGenshinDailyClaim, IGenshinDailyInfo, IGenshinDailyNote, IGenshinDailyReward, IGenshinDailyRewards, IGenshinDiaryBase, IGenshinDiaryDetail, IGenshinDiaryHistory, IGenshinDiaryInfo, IGenshinOptions, IGenshinRecord, IGenshinRecordAvatar, IGenshinRecordHome, IGenshinRecordStat, IGenshinRecordWorldExploration, IGenshinSpiralAbyss, IGenshinSpiralAbyssAvatar, IGenshinSpiralAbyssBattle, IGenshinSpiralAbyssFloor, IGenshinSpiralAbyssLevel, IGenshinSpiralAbyssRank, IHoyolabOptions, IRedeemCode, IResponse, LanguageEnum, Request, routes as Route, getServerRegion, parseLang, toCamelCase, toSnakeCase };

@@ -1,11 +0,877 @@

export * from './helpers';
export * from './Request';
export { Cache } from './Cache';
export * from './Interfaces';
export * from './Interfaces/Genshin';
export { Hoyolab } from './Hoyolab';
export * from './HoyolabError';
export { Genshin } from './Genshin';
export { HonkaiStarRail } from './HonkaiStarRail';
export * from './Cookie';
export * as Route from './routes';
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
// src/HoyolabError.ts
var HoyolabError = class extends Error {
constructor(message) {
super(message);
this.name = this.constructor.name;
this.message = message;
Error.captureStackTrace(this, this.constructor);
}
};
// src/Interfaces/LanguageEnum.ts
var LanguageEnum = /* @__PURE__ */ ((LanguageEnum4) => {
LanguageEnum4["SIMPLIFIED_CHINESE"] = "zh-cn";
LanguageEnum4["TRADIIONAL_CHINESE"] = "zh-tw";
LanguageEnum4["GERMAN"] = "de-de";
LanguageEnum4["ENGLISH"] = "en-us";
LanguageEnum4["SPANISH"] = "es-es";
LanguageEnum4["FRENCH"] = "fr-fr";
LanguageEnum4["INDONESIAN"] = "id-id";
LanguageEnum4["ITALIAN"] = "it-it";
LanguageEnum4["JAPANESE"] = "ja-jp";
LanguageEnum4["KOREAN"] = "ko-kr";
LanguageEnum4["PORTUGUESE"] = "pt-pt";
LanguageEnum4["RUSSIAN"] = "ru-ru";
LanguageEnum4["THAI"] = "th-th";
LanguageEnum4["TURKISH"] = "tr-tr";
LanguageEnum4["VIETNAMESE"] = "vi-vn";
return LanguageEnum4;
})(LanguageEnum || {});
// src/Interfaces/Hoyolab/GamesEnum.ts
var GamesEnum = /* @__PURE__ */ ((GamesEnum2) => {
GamesEnum2["GENSHIN_IMPACT"] = "hk4e_global";
GamesEnum2["HONKAI_IMPACT"] = "bh3_global";
GamesEnum2["HONKAI_STAR_RAIL"] = "hkrpg_global";
return GamesEnum2;
})(GamesEnum || {});
// src/helpers.ts
function toCamelCase(str) {
const words = str.split("_");
const camelCaseWords = words.map((word, index) => {
return index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1);
});
return camelCaseWords.join("");
}
function toSnakeCase(text) {
return text.replace(/([A-Z])/g, " $1").split(" ").join("_").toLowerCase();
}
function getServerRegion(uid) {
const server_region = Number(uid.toString().trim().slice(0, 1));
switch (server_region) {
case 6:
return "os_usa";
case 7:
return "os_euro";
case 8:
return "os_asia";
case 9:
return "os_cht";
default:
throw new HoyolabError(`Given UID ${uid} is invalid !`);
}
}
function parseLang(lang) {
if (!lang) {
return "en-us" /* ENGLISH */;
}
const langKeys = Object.keys(LanguageEnum);
const matchingKey = langKeys.find((key) => LanguageEnum[key] === lang);
return matchingKey ? LanguageEnum[matchingKey] : "en-us" /* ENGLISH */;
}
// src/Request.ts
import got from "got";
import crypto from "crypto";
import { HTTPError } from "got";
// src/Cache.ts
var Cache = class extends Map {
};
var Cache_default = new Cache();
// src/Request.ts
var Request = class {
constructor(cookies = null) {
this.headers = {
"Content-Type": "application/json",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
"x-rpc-app_version": "1.5.0",
"x-rpc-client_type": "5",
"x-rpc-language": "en-us" /* ENGLISH */
};
this.body = {};
this.params = {};
this.cache = Cache_default;
this.ds = false;
if (cookies)
this.headers.Cookie = cookies;
}
/**
* Set Referer Headers
*
* @param url string URL string of referer
* @returns {this}
*/
setReferer(url) {
this.headers.Referer = url;
this.headers.Origin = url;
return this;
}
/**
* Set Body Paramter
*
* @param body Body Body Parameters as object
* @returns {this}
*/
setBody(body) {
this.body = { ...this.body, ...body };
return this;
}
/**
* Set SearchParams or query parameter
*
* @param params SearchParameters Object of query parameter
* @returns {this}
*/
setParams(params) {
this.params = { ...this.params, ...params };
return this;
}
/**
* Set to used Dynamic Security or not
*
* @param flag boolean Flag
* @returns {this}
*/
setDs(flag = true) {
this.ds = flag;
return this;
}
/**
* Set Language
*
* @param lang Language Language that used for return of API (default: Language.ENGLISH).
* @returns {this}
*/
setLang(lang = "en-us" /* ENGLISH */) {
this.headers["x-rpc-language"] = lang;
return this;
}
/* c8 ignore start */
/**
* Send Request
*
* @param url string URL String
* @param method GET|POST Method for request
* @returns {Promise<IResponse>}
*/
async send(url, method = "GET") {
const bodyOrParam = method === "POST" ? got.extend({
json: this.body,
searchParams: this.params
}) : got.extend({
searchParams: this.params
});
const main = got.extend({
method,
// cache: this.cache,
retry: {
limit: 30
},
headers: this.headers,
responseType: "json"
});
const hook = got.extend({
hooks: {
beforeRequest: [
(options) => {
if (this.ds)
options.headers.DS = this.generateDS();
}
]
}
});
try {
const request = got.extend(hook, main, bodyOrParam);
const result = await request(url).json();
this.body = {};
return result;
} catch (error) {
if (error instanceof HTTPError) {
throw new HoyolabError(`[${error.code}] - ${error.message}`);
} else {
return {
retcode: -9999,
message: "",
data: null
};
}
}
}
/**
* Generate Dynamic Security
*
* @returns {string}
*/
generateDS() {
const salt = "6s25p5ox5y14umn1p61aqyyvbvvl3lrt";
const date = /* @__PURE__ */ new Date();
const time = Math.floor(date.getTime() / 1e3);
let random = "";
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (let i = 0; i < 6; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
const randomChar = characters.charAt(randomIndex);
random += randomChar;
}
const hash = crypto.createHash("md5").update(`salt=${salt}&t=${time}&r=${random}`).digest("hex");
return `${time},${random},${hash}`;
}
/* c8 ignore stop */
};
// src/Interfaces/Genshin/AbyssScheduleEnum.ts
var AbyssScheduleEnum = /* @__PURE__ */ ((AbyssScheduleEnum2) => {
AbyssScheduleEnum2[AbyssScheduleEnum2["CURRENT"] = 1] = "CURRENT";
AbyssScheduleEnum2[AbyssScheduleEnum2["PREVIOUS"] = 2] = "PREVIOUS";
return AbyssScheduleEnum2;
})(AbyssScheduleEnum || {});
// src/Interfaces/Genshin/DiaryEnum.ts
var DiaryMonthEnum = /* @__PURE__ */ ((DiaryMonthEnum2) => {
DiaryMonthEnum2[DiaryMonthEnum2["CURRENT"] = 3] = "CURRENT";
DiaryMonthEnum2[DiaryMonthEnum2["ONE_MONTH_AGO"] = 2] = "ONE_MONTH_AGO";
DiaryMonthEnum2[DiaryMonthEnum2["TWO_MONTH_AGO"] = 1] = "TWO_MONTH_AGO";
return DiaryMonthEnum2;
})(DiaryMonthEnum || {});
var DiaryEnum = /* @__PURE__ */ ((DiaryEnum2) => {
DiaryEnum2[DiaryEnum2["PRIMOGEMS"] = 1] = "PRIMOGEMS";
DiaryEnum2[DiaryEnum2["MORA"] = 2] = "MORA";
return DiaryEnum2;
})(DiaryEnum || {});
// src/Cookie.ts
var Cookie = class {
/**
* Parse Cookie string to ICookie Object
*
* @param cookieString string String cookies sourced from the hoyolab page
* @returns {ICookie}
*/
static parseCookieString(cookieString) {
const cookies = {};
const keys = [
"ltoken",
"ltuid",
"account_id",
"cookie_token",
"mi18nLang"
];
const cookieArr = cookieString.split(";");
for (const element of cookieArr) {
const cookie = element.trim().split("=");
const cookieKey = cookie[0];
let cookieValue = decodeURIComponent(cookie[1]);
if (keys.includes(cookieKey)) {
if (["ltuid", "account_id"].includes(cookieKey)) {
cookieValue = parseInt(cookieValue);
}
if (cookieKey === "mi18nLang") {
cookieValue = parseLang(cookieValue.toString());
}
cookies[toCamelCase(cookieKey)] = cookieValue;
}
}
if (cookies.ltuid && !cookies.accountId) {
cookies.accountId = cookies.ltuid;
} else if (!cookies.ltuid && cookies.accountId) {
cookies.ltuid = cookies.accountId;
}
if (!cookies.ltoken || !cookies.ltuid) {
throw new HoyolabError("Cookie key ltuid or ltoken doesnt exist !");
}
return cookies;
}
/**
* Parse Cookie object to cookie string
*
* @param cookie ICookie
* @returns {string}
*/
static parseCookie(cookie) {
if (!cookie.accountId) {
cookie.accountId = cookie.ltuid;
}
const cookies = [];
Object.entries(cookie).forEach(([key, value]) => {
if (value) {
if (["cookieToken", "accountId"].includes(key)) {
key = toSnakeCase(key);
}
cookies.push(`${key}=${value}`);
}
});
return cookies.join("; ");
}
};
// src/routes.ts
var routes_exports = {};
__export(routes_exports, {
GAMES_ACCOUNT: () => GAMES_ACCOUNT,
GENSHIN_CHARACTERS_LIST: () => GENSHIN_CHARACTERS_LIST,
GENSHIN_CHARACTERS_SUMMARY: () => GENSHIN_CHARACTERS_SUMMARY,
GENSHIN_DAILY_CLAIM: () => GENSHIN_DAILY_CLAIM,
GENSHIN_DAILY_INFO: () => GENSHIN_DAILY_INFO,
GENSHIN_DAILY_NOTE: () => GENSHIN_DAILY_NOTE,
GENSHIN_DAILY_REWARD: () => GENSHIN_DAILY_REWARD,
GENSHIN_DIARY: () => GENSHIN_DIARY,
GENSHIN_DIARY_DETAIL: () => GENSHIN_DIARY_DETAIL,
GENSHIN_GAME_RECORD: () => GENSHIN_GAME_RECORD,
GENSHIN_GAME_RECORD_REFERER: () => GENSHIN_GAME_RECORD_REFERER,
GENSHIN_REDEEM_CODE: () => GENSHIN_REDEEM_CODE,
GENSHIN_SPIRAL_ABYSS: () => GENSHIN_SPIRAL_ABYSS,
HSR_DAILY_CLAIM: () => HSR_DAILY_CLAIM,
HSR_DAILY_INFO: () => HSR_DAILY_INFO,
HSR_DAILY_REWARD: () => HSR_DAILY_REWARD
});
var GENSHIN_GAME_RECORD_URL = "https://bbs-api-os.hoyolab.com/game_record/genshin/api";
var GENSHIN_HKE_URL = "https://sg-hk4e-api.hoyolab.com";
var SG_PUBLIC_URL = "https://sg-public-api.hoyolab.com";
var GAMES_ACCOUNT = "https://api-account-os.hoyolab.com/account/binding/api/getUserGameRolesByCookieToken";
var GENSHIN_GAME_RECORD_REFERER = "https://act.hoyolab.com";
var GENSHIN_GAME_RECORD = `${GENSHIN_GAME_RECORD_URL}/index`;
var GENSHIN_CHARACTERS_LIST = `${GENSHIN_GAME_RECORD_URL}/character`;
var GENSHIN_CHARACTERS_SUMMARY = `${GENSHIN_GAME_RECORD_URL}/avatarBasicInfo`;
var GENSHIN_SPIRAL_ABYSS = `${GENSHIN_GAME_RECORD_URL}/spiralAbyss`;
var GENSHIN_DAILY_NOTE = `${GENSHIN_GAME_RECORD_URL}/dailyNote`;
var GENSHIN_DIARY = `${GENSHIN_HKE_URL}/event/ysledgeros/month_info`;
var GENSHIN_DIARY_DETAIL = `${GENSHIN_HKE_URL}/event/ysledgeros/month_detail`;
var GENSHIN_DAILY_INFO = `${GENSHIN_HKE_URL}/event/sol/info`;
var GENSHIN_DAILY_REWARD = `${GENSHIN_HKE_URL}/event/sol/home`;
var GENSHIN_DAILY_CLAIM = `${GENSHIN_HKE_URL}/event/sol/sign`;
var HSR_DAILY_INFO = `${SG_PUBLIC_URL}/event/luna/os/info`;
var HSR_DAILY_REWARD = `${SG_PUBLIC_URL}/event/luna/os/home`;
var HSR_DAILY_CLAIM = `${SG_PUBLIC_URL}/event/luna/os/sign`;
var GENSHIN_REDEEM_CODE = `${GENSHIN_HKE_URL}/common/apicdkey/api/webExchangeCdkey`;
// src/Hoyolab.ts
var Hoyolab = class {
constructor(options) {
const cookie = typeof options.cookie === "string" ? Cookie.parseCookieString(options.cookie) : options.cookie;
this.cookie = cookie;
if (!options.lang) {
options.lang = parseLang(cookie.mi18nLang);
}
this.request = new Request(Cookie.parseCookie(this.cookie));
this.request.setLang(options.lang);
this.lang = options.lang;
}
/**
* Get games available accounts
*
* @param game GamesEnum Selected Game
* @returns {Promise<Interface.IGame[]>}
*/
async gamesList(game) {
if (game) {
this.request.setParams({
game_biz: game
});
}
this.request.setParams({
uid: this.cookie.ltuid,
sLangKey: this.cookie.mi18nLang
});
const res = await this.request.send(GAMES_ACCOUNT);
const data = res.data;
if (!res.data || !data.list) {
throw new HoyolabError(
"There is no game account on this hoyolab account !"
);
}
return data.list;
}
/**
* Select one of highest level game account
*
* @param game GameEnum Selected Game
* @returns {Promise<Interface.IGame>}
*/
async gameAccount(game) {
const games = await this.gamesList(game);
if (games.length < 1) {
throw new HoyolabError(
"There is no game account on this hoyolab account !"
);
}
return games.reduce((first, second) => {
return second.level > first.level ? second : first;
});
}
};
// src/Genshin.ts
var Genshin = class {
constructor(options) {
const cookie = typeof options.cookie === "string" ? Cookie.parseCookieString(options.cookie) : options.cookie;
this.cookie = cookie;
if (!options.lang) {
options.lang = parseLang(cookie.mi18nLang);
}
this.request = new Request(Cookie.parseCookie(this.cookie));
this.request.setReferer(GENSHIN_GAME_RECORD_REFERER);
this.request.setLang(options.lang);
this.uid = options.uid ?? null;
this.region = this.uid !== null ? getServerRegion(this.uid) : null;
this.lang = options.lang;
}
/**
* Create Genshin Object
*
* @param options IGenshinOptions Options
* @returns {Promise<Genshin>}
*/
static async create(options) {
const instance = new Genshin(options);
if (instance.uid === null) {
const hoyolab = new Hoyolab({
cookie: options.cookie
});
const game = await hoyolab.gameAccount("hk4e_global" /* GENSHIN_IMPACT */);
const uid = parseInt(game.game_uid);
instance.uid = uid;
instance.region = getServerRegion(uid);
}
return instance;
}
/**
* Fetch game records
*
* @returns {Promise<IGenshinRecord>}
*/
async records() {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
this.request.setParams({
server: this.region,
role_id: this.uid
}).setDs(true);
const res = (await this.request.send(GENSHIN_GAME_RECORD)).data;
return res;
}
/**
* Fetch obtained genshin characters with artifact, weapon, level and constellation
*
* @returns {Promise<IGenshinCharacters>}
*/
async characters() {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
this.request.setBody({
server: this.region,
role_id: this.uid
}).setDs(true);
const res = (await this.request.send(GENSHIN_CHARACTERS_LIST, "POST")).data;
return res;
}
/**
* Fetch characters summary detail (name, rarity, weapon, icon)
*
* @param characterIds number[] Characters ID
* @returns {Promise<IGenshinCharacterSummary>}
*/
async charactersSummary(characterIds) {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
this.request.setBody({
character_ids: characterIds,
role_id: this.uid,
server: this.region
}).setDs();
const res = (await this.request.send(GENSHIN_CHARACTERS_SUMMARY, "POST")).data;
return res;
}
/**
* Fetch Spiral Abyss data
*
* @param scheduleType AbyssScheduleEnum
* @returns {Promise<IGenshinSpiralAbyss>}
*/
async spiralAbyss(scheduleType = 1 /* CURRENT */) {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
if (Object.values(AbyssScheduleEnum).includes(scheduleType) === false) {
throw new HoyolabError("The given scheduleType parameter is invalid !");
}
this.request.setParams({
server: this.region,
role_id: this.uid,
schedule_type: scheduleType
}).setDs();
const res = (await this.request.send(GENSHIN_SPIRAL_ABYSS)).data;
return res;
}
/**
* Fetch daily note resources (resin, home coin, expeditions, and transformer)
*
* @returns {Promise<IGenshinDailyNote>}
*/
async dailyNote() {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
this.request.setParams({
server: this.region,
role_id: this.uid
}).setDs();
const res = (await this.request.send(GENSHIN_DAILY_NOTE)).data;
return res;
}
/**
* Fetch genshin impact diary data
*
* @param month
* @returns {Promise<IGenshinDiaryInfo>}
*/
async diaries(month = 3 /* CURRENT */) {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
if (Object.values(DiaryMonthEnum).includes(month) === false) {
throw new HoyolabError("The given month parameter is invalid !");
}
this.request.setParams({
region: this.region,
uid: this.uid,
month
}).setDs();
const res = (await this.request.send(GENSHIN_DIARY)).data;
return res;
}
/**
* Fetch history of received resources (primogems and mora) from diary
*
* @param type DiaryEnum
* @param month DiaryMonthEnum
* @returns {IGenshinDiaryDetail}
*/
async diaryDetail(type, month = 3 /* CURRENT */) {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
if (Object.values(DiaryMonthEnum).includes(month) === false) {
throw new HoyolabError("The given month parameter is invalid !");
}
if (Object.values(DiaryEnum).includes(type) === false) {
throw new HoyolabError("The given type parameter is invalid !");
}
const responses = {};
let page = 1;
let next = true;
do {
this.request.setParams({
region: this.region,
uid: this.uid,
month,
type,
current_page: page,
page_size: 100
}).setDs();
const res = await (await this.request.send(GENSHIN_DIARY_DETAIL)).data;
responses.uid = res.uid;
responses.region = res.region;
responses.optional_month = res.optional_month;
responses.nickname = res.nickname;
responses.data_month = res.data_month;
responses.current_page = res.current_page;
responses.list = [...responses.list ?? [], ...res.list];
if (res.list.length < 1) {
next = false;
}
page++;
} while (next);
responses.list.sort((a, b) => {
const keyA = new Date(a.time);
const keyB = new Date(b.time);
if (keyA < keyB)
return -1;
if (keyA > keyB)
return 1;
return 0;
});
return responses;
}
/**
* Fetch Daily login information
*
* @returns {Promise<IGenshinDailyInfo>}
*/
async dailyInfo() {
this.request.setParams({
act_id: "e202102251931481",
lang: this.lang
}).setLang(this.lang);
const res = (await this.request.send(GENSHIN_DAILY_INFO)).data;
return res;
}
/**
* Fetch all rewards from daily login
*
* @returns {Promise<IGenshinDailyRewards>}
*/
async dailyRewards() {
this.request.setParams({
act_id: "e202102251931481",
lang: this.lang
}).setLang(this.lang);
const res = (await this.request.send(GENSHIN_DAILY_REWARD)).data;
return res;
}
/**
* Fetch reward from daily login based on day
*
* @param day number | null
* @returns {Promise<IGenshinDailyReward>}
*/
async dailyReward(day = null) {
const response = await this.dailyRewards();
if (day === null) {
const now = new Date(Number(response.now) * 1e3);
day = now.getDate();
}
const date = /* @__PURE__ */ new Date();
const year = date.getFullYear();
const month = date.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
if (!(day > 0 && day <= daysInMonth) || typeof response.awards[day - 1] === void 0) {
throw new HoyolabError(`${day} is not a valid date in this month.`);
}
return {
month: response.month,
now: response.now,
resign: response.resign,
award: response.awards[day - 1]
};
}
/**
* Claim current reward
*
* @returns {Promise<IGenshinDailyClaim>}
*/
async dailyClaim() {
this.request.setParams({
act_id: "e202102251931481",
lang: this.lang
}).setLang(this.lang);
const response = await this.request.send(GENSHIN_DAILY_CLAIM, "POST");
const info = await this.dailyInfo();
const reward = await this.dailyReward();
if (response.retcode === -5003) {
return {
status: response.message,
code: -5003,
reward,
info
};
}
if (String(response.data.code).toLocaleLowerCase() === "ok" && response.retcode === 0) {
return {
status: response.message,
code: 0,
reward,
info
};
}
return {
status: response.message,
code: response.retcode,
reward: null,
info
};
}
/* c8 ignore stop */
/**
* Redeem Code
*
* @param code string
* @returns {Promise<IRedeemCode>}
*/
async redeemCode(code) {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
this.request.setParams({
uid: this.uid,
region: this.region,
game_biz: "hk4e_global",
cdkey: code.replace(/\uFFFD/g, ""),
lang: this.lang,
sLangKey: this.lang
});
const res = await this.request.send(GENSHIN_REDEEM_CODE);
return res;
}
};
// src/HonkaiStarRail.ts
var HonkaiStarRail = class {
constructor(options) {
const cookie = typeof options.cookie === "string" ? Cookie.parseCookieString(options.cookie) : options.cookie;
this.cookie = cookie;
if (!options.lang) {
options.lang = parseLang(cookie.mi18nLang);
}
this.request = new Request(Cookie.parseCookie(this.cookie));
this.request.setReferer(GENSHIN_GAME_RECORD_REFERER);
this.request.setLang(options.lang);
this.uid = options.uid ?? null;
this.region = this.uid !== null ? getServerRegion(this.uid) : null;
this.lang = options.lang;
}
/**
* Create StarRails Object
*
* @param options IHsrOptions Options
* @returns {Promise<HonkaiStarRail>}
*/
static async create(options) {
const instance = new HonkaiStarRail(options);
if (instance.uid === null) {
const hoyolab = new Hoyolab({
cookie: options.cookie
});
const game = await hoyolab.gameAccount("hkrpg_global" /* HONKAI_STAR_RAIL */);
const uid = parseInt(game.game_uid);
instance.uid = uid;
instance.region = getServerRegion(uid);
}
return instance;
}
async dailyInfo() {
this.request.setParams({
act_id: "e202303301540311",
lang: this.lang
}).setLang(this.lang);
const res = (await this.request.send(HSR_DAILY_INFO)).data;
return res;
}
/**
* Fetch all rewards from daily login
*
* @returns {Promise<IHsrDailyRewards>}
*/
async dailyRewards() {
this.request.setParams({
act_id: "e202303301540311",
lang: this.lang
}).setLang(this.lang);
const res = (await this.request.send(HSR_DAILY_REWARD)).data;
return res;
}
/**
* Fetch reward from daily login based on day
*
* @param day number | null
* @returns {Promise<IHsrDailyReward>}
*/
async dailyReward(day = null) {
const response = await this.dailyRewards();
if (day === null) {
const now = /* @__PURE__ */ new Date();
day = now.getDate();
}
const date = /* @__PURE__ */ new Date();
const year = date.getFullYear();
const month = date.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
if (!(day > 0 && day <= daysInMonth) || typeof response.awards[day - 1] === void 0) {
throw new HoyolabError(`${day} is not a valid date in this month.`);
}
return {
month: response.month,
biz: response.biz,
resign: response.resign,
award: response.awards[day - 1]
};
}
/**
* Claim current reward
*
* @returns {Promise<IHsrDailyClaim>}
*/
async dailyClaim() {
this.request.setParams({
act_id: "e202303301540311",
lang: this.lang
}).setLang(this.lang);
const response = await this.request.send(HSR_DAILY_CLAIM, "POST");
const info = await this.dailyInfo();
const reward = await this.dailyReward();
if (response.retcode === -5003) {
return {
status: response.message,
code: -5003,
reward,
info
};
}
if (String(response.data.code).toLocaleLowerCase() === "ok" && response.retcode === 0) {
return {
status: response.message,
code: 0,
reward,
info
};
}
return {
status: response.message,
code: response.retcode,
reward: null,
info
};
}
/* c8 ignore stop */
/**
* Redeem Code
*
* @param code string
* @returns {Promise<IRedeemCode>}
*/
async redeemCode(code) {
if (!this.region || !this.uid) {
throw new HoyolabError("UID parameter is missing or failed to be filled");
}
this.request.setParams({
uid: this.uid,
region: this.region,
game_biz: "hkrpg_global" /* HONKAI_STAR_RAIL */,
cdkey: code.replace(/\uFFFD/g, ""),
lang: this.lang,
sLangKey: this.lang
});
const res = await this.request.send(GENSHIN_REDEEM_CODE);
return res;
}
};
export {
AbyssScheduleEnum,
Cache,
Cookie,
DiaryEnum,
DiaryMonthEnum,
GamesEnum,
Genshin,
HonkaiStarRail,
Hoyolab,
HoyolabError,
LanguageEnum,
Request,
routes_exports as Route,
getServerRegion,
parseLang,
toCamelCase,
toSnakeCase
};

9

package.json
{
"name": "@vermaysha/hoyolab-api",
"version": "3.1.0",
"version": "3.1.1",
"description": "Its unofficial HoYoLab API Wrapper for getting hoyoverse some in-game data, including Genshin Impact, Honkai Impact 3rd.",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"types": "./dist/index.d.ts",
"exports": "./dist/index.js",
"scripts": {

@@ -12,3 +12,3 @@ "format": "prettier src/**/* -w",

"prepare": "husky install",
"build:ts": "rimraf dist/ && tsc --build --listEmittedFiles",
"build:ts": "tsup",
"build:docs": "typedoc",

@@ -85,2 +85,3 @@ "build": "npm run build:docs && npm run build:ts",

"ts-node": "^10.9.1",
"tsup": "^6.7.0",
"tsx": "^3.12.6",

@@ -87,0 +88,0 @@ "typedoc": "^0.23.28",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc