Socket
Socket
Sign inDemoInstall

@vermaysha/hoyolab-api

Package Overview
Dependencies
13
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.3 to 2.3.0

dist/Base.d.ts

81

dist/Base.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Base = void 0;
const Utils_1 = require("./Utils");
/**
* This is the main class which contains built-in properties and methods.
*
* @category Main
* @abstract
*/
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Base_exports = {};
__export(Base_exports, {
Base: () => Base
});
module.exports = __toCommonJS(Base_exports);
var import_Utils = require("./Utils");
class Base {
/**
* The cookie that will be used for each request
*
* @protected
*/
cookie;
/**
* Request object
*
* @protected
*/
request;
/**
* @constructor
* @param options Options - Default options
*/
constructor(options) {
this.cookie = options.cookie;
if (!options.cookie.accountId) {
this.cookie.accountId = options.cookie.ltuid;
}
this.request = new Utils_1.Request(Utils_1.Cookie.parseToString(options.cookie));
/**
* The cookie that will be used for each request
*
* @protected
*/
cookie;
/**
* Request object
*
* @protected
*/
request;
/**
* @constructor
* @param options Options - Default options
*/
constructor(options) {
this.cookie = options.cookie;
if (!options.cookie.accountId) {
this.cookie.accountId = options.cookie.ltuid;
}
this.request = new import_Utils.Request(import_Utils.Cookie.parseToString(options.cookie));
}
}
exports.Base = Base;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Base
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiaryMonth = void 0;
var DiaryMonth;
(function (DiaryMonth) {
DiaryMonth[DiaryMonth["CURRENT"] = 3] = "CURRENT";
DiaryMonth[DiaryMonth["ONE_MONTH_AGO"] = 2] = "ONE_MONTH_AGO";
DiaryMonth[DiaryMonth["TWO_MONTH_AGO"] = 1] = "TWO_MONTH_AGO";
})(DiaryMonth = exports.DiaryMonth || (exports.DiaryMonth = {}));
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DiaryMonth_exports = {};
__export(DiaryMonth_exports, {
DiaryMonth: () => DiaryMonth
});
module.exports = __toCommonJS(DiaryMonth_exports);
var DiaryMonth = /* @__PURE__ */ ((DiaryMonth2) => {
DiaryMonth2[DiaryMonth2["CURRENT"] = 3] = "CURRENT";
DiaryMonth2[DiaryMonth2["ONE_MONTH_AGO"] = 2] = "ONE_MONTH_AGO";
DiaryMonth2[DiaryMonth2["TWO_MONTH_AGO"] = 1] = "TWO_MONTH_AGO";
return DiaryMonth2;
})(DiaryMonth || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
DiaryMonth
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiaryType = void 0;
var DiaryType;
(function (DiaryType) {
DiaryType[DiaryType["PRIMOGEMS"] = 1] = "PRIMOGEMS";
DiaryType[DiaryType["MORA"] = 2] = "MORA";
})(DiaryType = exports.DiaryType || (exports.DiaryType = {}));
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DiaryType_exports = {};
__export(DiaryType_exports, {
DiaryType: () => DiaryType
});
module.exports = __toCommonJS(DiaryType_exports);
var DiaryType = /* @__PURE__ */ ((DiaryType2) => {
DiaryType2[DiaryType2["PRIMOGEMS"] = 1] = "PRIMOGEMS";
DiaryType2[DiaryType2["MORA"] = 2] = "MORA";
return DiaryType2;
})(DiaryType || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
DiaryType
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Games = void 0;
var Games;
(function (Games) {
Games["ALL"] = "";
Games["HONKAI"] = "overseas01";
Games["GENSHIN"] = "hk4e_global";
})(Games = exports.Games || (exports.Games = {}));
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Games_exports = {};
__export(Games_exports, {
Games: () => Games
});
module.exports = __toCommonJS(Games_exports);
var Games = /* @__PURE__ */ ((Games2) => {
Games2["ALL"] = "";
Games2["HONKAI"] = "overseas01";
Games2["GENSHIN"] = "hk4e_global";
return Games2;
})(Games || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Games
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DiaryMonth"), exports);
tslib_1.__exportStar(require("./DiaryType"), exports);
tslib_1.__exportStar(require("./ScheduleType"), exports);
tslib_1.__exportStar(require("./Games"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Enum_exports = {};
module.exports = __toCommonJS(Enum_exports);
__reExport(Enum_exports, require("./DiaryMonth"), module.exports);
__reExport(Enum_exports, require("./DiaryType"), module.exports);
__reExport(Enum_exports, require("./ScheduleType"), module.exports);
__reExport(Enum_exports, require("./Games"), module.exports);
__reExport(Enum_exports, require("./Wiki"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScheduleType = void 0;
var ScheduleType;
(function (ScheduleType) {
ScheduleType[ScheduleType["CURRENT"] = 1] = "CURRENT";
ScheduleType[ScheduleType["PREVIOUS"] = 2] = "PREVIOUS";
})(ScheduleType = exports.ScheduleType || (exports.ScheduleType = {}));
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ScheduleType_exports = {};
__export(ScheduleType_exports, {
ScheduleType: () => ScheduleType
});
module.exports = __toCommonJS(ScheduleType_exports);
var ScheduleType = /* @__PURE__ */ ((ScheduleType2) => {
ScheduleType2[ScheduleType2["CURRENT"] = 1] = "CURRENT";
ScheduleType2[ScheduleType2["PREVIOUS"] = 2] = "PREVIOUS";
return ScheduleType2;
})(ScheduleType || {});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ScheduleType
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Genshin = void 0;
const HoyoError_1 = require("./HoyoError");
const Base_1 = require("./Base");
const Utils_1 = require("./Utils");
const Enum_1 = require("./Enum");
/**
* Get data from Hoyolab API
*
* @category Main
*/
class Genshin extends Base_1.Base {
/**
* Genshin Impact UID
*/
uid;
/**
* Genshin Impact Region
*/
region;
/**
* Get Genshin Impact some in-game data through HoYoLab API.
*
* @param options Options & GenshinOption
* @throws {@link HoyoError} - if given UID or Cookie is invalid
*/
constructor(options) {
super(options);
this.uid = options.uid;
this.region = Utils_1.ServerRegion.determineRegion(options.uid);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Genshin_exports = {};
__export(Genshin_exports, {
Genshin: () => Genshin
});
module.exports = __toCommonJS(Genshin_exports);
var import_HoyoError = require("./HoyoError");
var import_Base = require("./Base");
var import_Utils = require("./Utils");
var import_Enum = require("./Enum");
class Genshin extends import_Base.Base {
/**
* Genshin Impact UID
*/
uid;
/**
* Genshin Impact Region
*/
region;
/**
* Get Genshin Impact some in-game data through HoYoLab API.
*
* @param options Options & GenshinOption
* @throws {@link HoyoError} - if given UID or Cookie is invalid
*/
constructor(options) {
super(options);
this.uid = options.uid;
this.region = import_Utils.ServerRegion.determineRegion(options.uid);
}
async getAccountInfo() {
this.request.withDS();
this.request.setParams({
role_id: this.uid,
server: this.region
});
const response = await this.request.send(import_Utils.GenshinRoutes.accountInfo);
return response.data;
}
/**
* Get daily check-in event information.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyInfo() {
const response = await this.request.send(import_Utils.GenshinRoutes.dailyInfo);
return response.data;
}
/**
* Get daily check-in event all rewards.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyRewards() {
const response = await this.request.send(import_Utils.GenshinRoutes.dailyRewards);
return response.data;
}
/**
* Get daily check-in event single rewards.
*
* @param day Types.NumericRange<0, 30>
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyReward(day = null) {
const response = await this.getDailyRewards();
let currentDate = 0;
if (day === null) {
const now = new Date(Number(response.now) * 1e3);
currentDate = now.getDate() - 1;
}
async getAccountInfo() {
this.request.withDS();
this.request.setParams({
role_id: this.uid,
server: this.region,
});
const response = await this.request.send(Utils_1.GenshinRoutes.accountInfo);
return response.data;
if (typeof response.awards[day ?? currentDate] !== void 0) {
return {
month: response.month,
now: response.now,
resign: response.resign,
award: response.awards[day ?? currentDate]
};
}
/**
* Get daily check-in event information.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyInfo() {
const response = await this.request.send(Utils_1.GenshinRoutes.dailyInfo);
return response.data;
throw new import_HoyoError.HoyoError("The selected day was not found !");
}
/**
* Claim daily check-in event.
*
* @throws {@link HoyoError} - If an error occurs
*/
async claimDaily() {
const response = await this.request.send(import_Utils.GenshinRoutes.dailyClaim, "post");
const info = await this.getDailyInfo();
const reward = await this.getDailyReward();
if (response.retcode === -5003) {
return {
status: "Traveller, you've already checked in today",
code: -5003,
reward,
info
};
}
/**
* Get daily check-in event all rewards.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyRewards() {
const response = await this.request.send(Utils_1.GenshinRoutes.dailyRewards);
return response.data;
if (String(
response.data.code
).toLocaleLowerCase() === "ok" && response.retcode === 0) {
return {
status: response.message,
code: 0,
reward,
info
};
}
/**
* Get daily check-in event single rewards.
*
* @param day Types.NumericRange<0, 30>
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyReward(day = null) {
const response = await this.getDailyRewards();
let currentDate = 0;
if (day === null) {
const now = new Date(Number(response.now) * 1000);
currentDate = (now.getDate() - 1);
}
if (typeof response.awards[day ?? currentDate] !== undefined) {
return {
month: response.month,
now: response.now,
resign: response.resign,
award: response.awards[day ?? currentDate],
};
}
/* c8 ignore next 2 */
throw new HoyoError_1.HoyoError('The selected day was not found !');
return {
status: response.message,
code: response.retcode,
reward: null,
info
};
}
/* c8 ignore stop */
/**
* Get all the characters owned by the user with complete information,
* such as: constellation, artefact, weapon, and skin.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getCharacters() {
this.request.withDS();
this.request.setBody({
role_id: this.uid,
server: this.region
});
const response = await this.request.send(import_Utils.GenshinRoutes.characters, "post");
return response.data;
}
/**
* Displays a summary about the selected character.
*
* @param characterIds number[]
* @throws {@link HoyoError} - If an error occurs
*/
async getCharactersInfo(characterIds) {
this.request.withDS();
this.request.setBody({
character_ids: characterIds,
role_id: this.uid,
server: this.region
});
const response = await this.request.send(
import_Utils.GenshinRoutes.charactersInfo,
"post"
);
return response.data;
}
/**
* Get daily notes from character,
* such as: resins, expeditions, transformers recovery time.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyNotes() {
this.request.setParams({
server: this.region,
role_id: this.uid
});
this.request.withDS();
const response = await this.request.send(import_Utils.GenshinRoutes.dailyNotes);
return response.data;
}
/**
* Get diary summary information,
* such as: current month obtained mora or primogems
*
* @param month DiaryMonth
* @throws {@link HoyoError} - If an error occurs
*/
async getDiaryInfo(month = import_Enum.DiaryMonth.CURRENT) {
if (Object.values(import_Enum.DiaryMonth).includes(month) === false) {
throw new import_HoyoError.HoyoError("The given month parameter is invalid !");
}
/**
* Claim daily check-in event.
*
* @throws {@link HoyoError} - If an error occurs
*/
async claimDaily() {
const response = await this.request.send(Utils_1.GenshinRoutes.dailyClaim, 'post');
const info = await this.getDailyInfo();
const reward = await this.getDailyReward();
if (response.retcode === -5003) {
return {
status: "Traveller, you've already checked in today",
code: -5003,
reward,
info,
};
}
/* c8 ignore start */
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,
};
this.request.setParams({
region: this.region,
uid: this.uid,
month
});
this.request.withDS();
const response = await this.request.send(import_Utils.GenshinRoutes.diaryInfo);
return response.data;
}
/**
* Get detailed diary information,
* such as: primogems history and mora history.
*
* @param type DiaryType
* @param month DiaryMonth
* @throws {@link HoyoError} - If an error occurs
*/
async getDiaryDetail(type, month = import_Enum.DiaryMonth.CURRENT) {
if (Object.values(import_Enum.DiaryMonth).includes(month) === false) {
throw new import_HoyoError.HoyoError("The given month parameter is invalid !");
}
/* c8 ignore stop */
/**
* Get all the characters owned by the user with complete information,
* such as: constellation, artefact, weapon, and skin.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getCharacters() {
this.request.withDS();
this.request.setBody({
role_id: this.uid,
server: this.region,
});
const response = await this.request.send(Utils_1.GenshinRoutes.characters, 'post');
return response.data;
if (Object.values(import_Enum.DiaryType).includes(type) === false) {
throw new import_HoyoError.HoyoError("The given type parameter is invalid !");
}
/**
* Displays a summary about the selected character.
*
* @param characterIds number[]
* @throws {@link HoyoError} - If an error occurs
*/
async getCharactersInfo(characterIds) {
this.request.withDS();
this.request.setBody({
character_ids: characterIds,
role_id: this.uid,
server: this.region,
});
const response = await this.request.send(Utils_1.GenshinRoutes.charactersInfo, 'post');
return response.data;
const responses = [];
let page = 1;
do {
this.request.setParams({
region: this.region,
uid: this.uid,
month,
type,
current_page: page,
page_size: 100
});
this.request.withDS();
const response2 = await this.request.send(import_Utils.GenshinRoutes.diaryDetail);
responses.push(response2.data);
page++;
} while (responses[responses.length - 1].list.length > 0);
const response = responses[0];
if (responses.length > 1) {
responses.forEach((item, i) => {
if (i < 1)
return;
response.current_page = item.current_page;
response.data_month = item.data_month;
response.list = [...response.list, ...item.list];
response.nickname = item.nickname;
response.optional_month = item.optional_month;
response.region = item.region;
response.uid = item.uid;
});
}
/**
* Get daily notes from character,
* such as: resins, expeditions, transformers recovery time.
*
* @throws {@link HoyoError} - If an error occurs
*/
async getDailyNotes() {
this.request.setParams({
server: this.region,
role_id: this.uid,
});
this.request.withDS();
const response = await this.request.send(Utils_1.GenshinRoutes.dailyNotes);
return response.data;
response.list.sort((a, b) => {
const keyA = new Date(a.time), keyB = new Date(b.time);
if (keyA < keyB)
return -1;
if (keyA > keyB)
return 1;
return 0;
});
return response;
}
/**
* Get detailed spiral abyss information,
* such as: characters, max floor, total star, timestamp, etc.
*
* @param scheduleType ScheduleType
*/
async getSpiralAbyss(scheduleType = import_Enum.ScheduleType.CURRENT) {
if (Object.values(import_Enum.ScheduleType).includes(scheduleType) === false) {
throw new import_HoyoError.HoyoError("The given scheduleType parameter is invalid !");
}
/**
* Get diary summary information,
* such as: current month obtained mora or primogems
*
* @param month DiaryMonth
* @throws {@link HoyoError} - If an error occurs
*/
async getDiaryInfo(month = Enum_1.DiaryMonth.CURRENT) {
/* c8 ignore start */
if (Object.values(Enum_1.DiaryMonth).includes(month) === false) {
throw new HoyoError_1.HoyoError('The given month parameter is invalid !');
}
/* c8 ignore stop */
this.request.setParams({
region: this.region,
uid: this.uid,
month: month,
});
this.request.withDS();
const response = await this.request.send(Utils_1.GenshinRoutes.diaryInfo);
return response.data;
}
/**
* Get detailed diary information,
* such as: primogems history and mora history.
*
* @param type DiaryType
* @param month DiaryMonth
* @throws {@link HoyoError} - If an error occurs
*/
async getDiaryDetail(type, month = Enum_1.DiaryMonth.CURRENT) {
/* c8 ignore start */
if (Object.values(Enum_1.DiaryMonth).includes(month) === false) {
throw new HoyoError_1.HoyoError('The given month parameter is invalid !');
}
if (Object.values(Enum_1.DiaryType).includes(type) === false) {
throw new HoyoError_1.HoyoError('The given type parameter is invalid !');
}
/* c8 ignore stop */
const responses = [];
let page = 1;
do {
this.request.setParams({
region: this.region,
uid: this.uid,
month: month,
type: type,
current_page: page,
page_size: 100,
});
this.request.withDS();
const response = await this.request.send(Utils_1.GenshinRoutes.diaryDetail);
responses.push(response.data);
page++;
} while (responses[responses.length - 1].list.length > 0);
const response = responses[0];
if (responses.length > 1) {
responses.forEach((item, i) => {
if (i < 1)
return;
response.current_page = item.current_page;
response.data_month = item.data_month;
response.list = [...response.list, ...item.list];
response.nickname = item.nickname;
response.optional_month = item.optional_month;
response.region = item.region;
response.uid = item.uid;
});
}
// Sort by date
response.list.sort((a, b) => {
const keyA = new Date(a.time), keyB = new Date(b.time);
// Compare the 2 dates
/* c8 ignore start */
if (keyA < keyB)
return -1;
if (keyA > keyB)
return 1;
/* c8 ignore stop */
return 0;
});
return response;
}
/**
* Get detailed spiral abyss information,
* such as: characters, max floor, total star, timestamp, etc.
*
* @param scheduleType ScheduleType
*/
async getSpiralAbyss(scheduleType = Enum_1.ScheduleType.CURRENT) {
/* c8 ignore start */
if (Object.values(Enum_1.ScheduleType).includes(scheduleType) === false) {
throw new HoyoError_1.HoyoError('The given scheduleType parameter is invalid !');
}
/* c8 ignore stop */
this.request.setParams({
server: this.region,
role_id: this.uid,
schedule_type: scheduleType,
});
this.request.withDS();
const response = await this.request.send(Utils_1.GenshinRoutes.spiralAbyss);
return response.data;
}
async redeemCode(code) {
this.request.setParams({
uid: this.uid.toString().replace(/\uFFFD/g, ''),
region: this.region.replace(/\uFFFD/g, ''),
game_biz: 'hk4e_global',
cdkey: code.replace(/\uFFFD/g, ''),
lang: 'en',
sLangKey: 'en-us',
});
const response = await this.request.send(Utils_1.HoyolabRoutes.redeem);
return response;
}
this.request.setParams({
server: this.region,
role_id: this.uid,
schedule_type: scheduleType
});
this.request.withDS();
const response = await this.request.send(import_Utils.GenshinRoutes.spiralAbyss);
return response.data;
}
async redeemCode(code) {
this.request.setParams({
uid: this.uid.toString().replace(/\uFFFD/g, ""),
region: this.region.replace(/\uFFFD/g, ""),
game_biz: "hk4e_global",
cdkey: code.replace(/\uFFFD/g, ""),
lang: "en",
sLangKey: "en-us"
});
const response = await this.request.send(import_Utils.HoyolabRoutes.redeem);
return response;
}
}
exports.Genshin = Genshin;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Genshin
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HoyoError = void 0;
/**
*
* @category Error Handling
* */
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var HoyoError_exports = {};
__export(HoyoError_exports, {
HoyoError: () => HoyoError
});
module.exports = __toCommonJS(HoyoError_exports);
class HoyoError extends Error {
/**
* Return message from current request
*/
retmessage;
/**
* Return code from current request
*/
retcode;
/**
* Error Message
*/
message;
constructor(message, response) {
super(message);
this.message = message;
this.retcode = response?.retcode ?? null;
this.retmessage = response?.message ?? null;
Object.setPrototypeOf(this, HoyoError.prototype);
}
/**
* Return message from current request
*/
retmessage;
/**
* Return code from current request
*/
retcode;
/**
* Error Message
*/
message;
constructor(message, response) {
super(message);
this.message = message;
this.retcode = response?.retcode ?? null;
this.retmessage = response?.message ?? null;
Object.setPrototypeOf(this, HoyoError.prototype);
}
}
exports.HoyoError = HoyoError;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
HoyoError
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Hoyolab = void 0;
const HoyoError_1 = require("./HoyoError");
const Base_1 = require("./Base");
const Utils_1 = require("./Utils");
const Enum_1 = require("./Enum");
/**
* Get data from Hoyolab API
*
* @category Main
*/
class Hoyolab extends Base_1.Base {
/**
* Displays a list of game accounts from mihoyo that are registered on user accounts
*
* @throws {@link HoyoError} - If the request error caused by this library
* @throws {@link [AxiosError](https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js)} - If the error is caused by the server
*/
async getGames(games = Enum_1.Games.ALL) {
/* c8 ignore start */
if (Object.values(Enum_1.Games).includes(games) === false) {
throw new HoyoError_1.HoyoError('The given games parameter is invalid !');
}
if (games !== Enum_1.Games.ALL) {
this.request.setParams({
region: games,
});
}
/* c8 ignore stop */
const response = await this.request.send(Utils_1.HoyolabRoutes.gamesList);
return response.data;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Hoyolab_exports = {};
__export(Hoyolab_exports, {
Hoyolab: () => Hoyolab
});
module.exports = __toCommonJS(Hoyolab_exports);
var import_HoyoError = require("./HoyoError");
var import_Base = require("./Base");
var import_Utils = require("./Utils");
var import_Enum = require("./Enum");
class Hoyolab extends import_Base.Base {
/**
* Displays a list of game accounts from mihoyo that are registered on user accounts
*
* @throws {@link HoyoError} - If the request error caused by this library
* @throws {@link [AxiosError](https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js)} - If the error is caused by the server
*/
async getGames(games = import_Enum.Games.ALL) {
if (Object.values(import_Enum.Games).includes(games) === false) {
throw new import_HoyoError.HoyoError("The given games parameter is invalid !");
}
/**
* Displays the Game Record for each registered game
*
* @throws {@link HoyoError} - If the request error caused by this library
* @throws {@link [AxiosError](https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js)} - If the error is caused by the server
*/
async getRecords() {
if (!this.cookie.accountId) {
throw new HoyoError_1.HoyoError('getRecords() function requires cookie.accountId to be filled !');
}
this.request.setParams({
uid: this.cookie.accountId,
});
this.request.withDS();
const response = await this.request.send(Utils_1.HoyolabRoutes.recordsList);
return response.data;
if (games !== import_Enum.Games.ALL) {
this.request.setParams({
region: games
});
}
const response = await this.request.send(import_Utils.HoyolabRoutes.gamesList);
return response.data;
}
/**
* Displays the Game Record for each registered game
*
* @throws {@link HoyoError} - If the request error caused by this library
* @throws {@link [AxiosError](https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js)} - If the error is caused by the server
*/
async getRecords() {
if (!this.cookie.accountId) {
throw new import_HoyoError.HoyoError(
"getRecords() function requires cookie.accountId to be filled !"
);
}
this.request.setParams({
uid: this.cookie.accountId
});
this.request.withDS();
const response = await this.request.send(import_Utils.HoyolabRoutes.recordsList);
return response.data;
}
}
exports.Hoyolab = Hoyolab;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Hoyolab
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Enum = exports.Types = exports.Utils = exports.Interface = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./HoyoError"), exports);
exports.Interface = tslib_1.__importStar(require("./Interfaces"));
exports.Utils = tslib_1.__importStar(require("./Utils"));
exports.Types = tslib_1.__importStar(require("./Types"));
exports.Enum = tslib_1.__importStar(require("./Enum"));
tslib_1.__exportStar(require("./Hoyolab"), exports);
tslib_1.__exportStar(require("./Genshin"), exports);
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
Enum: () => Enum,
Interface: () => Interface,
Types: () => Types,
Utils: () => Utils
});
module.exports = __toCommonJS(src_exports);
__reExport(src_exports, require("./HoyoError"), module.exports);
var Interface = __toESM(require("./Interfaces"));
var Utils = __toESM(require("./Utils"));
var Types = __toESM(require("./Types"));
var Enum = __toESM(require("./Enum"));
__reExport(src_exports, require("./Hoyolab"), module.exports);
__reExport(src_exports, require("./Genshin"), module.exports);
__reExport(src_exports, require("./Wiki"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Enum,
Interface,
Types,
Utils
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Cookie_exports = {};
module.exports = __toCommonJS(Cookie_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Cookie"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Cookie_exports = {};
module.exports = __toCommonJS(Cookie_exports);
__reExport(Cookie_exports, require("./Cookie"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var AccountResponse_exports = {};
module.exports = __toCommonJS(AccountResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./AccountResponse"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Account_exports = {};
module.exports = __toCommonJS(Account_exports);
__reExport(Account_exports, require("./AccountResponse"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var CharacterInfoResponse_exports = {};
module.exports = __toCommonJS(CharacterInfoResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var CharacterResponse_exports = {};
module.exports = __toCommonJS(CharacterResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./CharacterInfoResponse"), exports);
tslib_1.__exportStar(require("./CharacterResponse"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Character_exports = {};
module.exports = __toCommonJS(Character_exports);
__reExport(Character_exports, require("./CharacterInfoResponse"), module.exports);
__reExport(Character_exports, require("./CharacterResponse"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var AwardItem_exports = {};
module.exports = __toCommonJS(AwardItem_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DailyClaimResponse_exports = {};
module.exports = __toCommonJS(DailyClaimResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DailyInfoResponse_exports = {};
module.exports = __toCommonJS(DailyInfoResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DailyNotesResponse_exports = {};
module.exports = __toCommonJS(DailyNotesResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DailyRewardResponse_exports = {};
module.exports = __toCommonJS(DailyRewardResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DailyRewardsResponse_exports = {};
module.exports = __toCommonJS(DailyRewardsResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DailyInfoResponse"), exports);
tslib_1.__exportStar(require("./AwardItem"), exports);
tslib_1.__exportStar(require("./DailyRewardsResponse"), exports);
tslib_1.__exportStar(require("./DailyRewardResponse"), exports);
tslib_1.__exportStar(require("./DailyClaimResponse"), exports);
tslib_1.__exportStar(require("./DailyNotesResponse"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Daily_exports = {};
module.exports = __toCommonJS(Daily_exports);
__reExport(Daily_exports, require("./DailyInfoResponse"), module.exports);
__reExport(Daily_exports, require("./AwardItem"), module.exports);
__reExport(Daily_exports, require("./DailyRewardsResponse"), module.exports);
__reExport(Daily_exports, require("./DailyRewardResponse"), module.exports);
__reExport(Daily_exports, require("./DailyClaimResponse"), module.exports);
__reExport(Daily_exports, require("./DailyNotesResponse"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DiaryDetailResponse_exports = {};
module.exports = __toCommonJS(DiaryDetailResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DiaryInfoResponse_exports = {};
module.exports = __toCommonJS(DiaryInfoResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var IDiary_exports = {};
module.exports = __toCommonJS(IDiary_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DiaryInfoResponse"), exports);
tslib_1.__exportStar(require("./DiaryDetailResponse"), exports);
tslib_1.__exportStar(require("./IDiary"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Diary_exports = {};
module.exports = __toCommonJS(Diary_exports);
__reExport(Diary_exports, require("./DiaryInfoResponse"), module.exports);
__reExport(Diary_exports, require("./DiaryDetailResponse"), module.exports);
__reExport(Diary_exports, require("./IDiary"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Daily"), exports);
tslib_1.__exportStar(require("./Character"), exports);
tslib_1.__exportStar(require("./Diary"), exports);
tslib_1.__exportStar(require("./SpiralAbyss"), exports);
tslib_1.__exportStar(require("./Redeem"), exports);
tslib_1.__exportStar(require("./Account"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Genshin_exports = {};
module.exports = __toCommonJS(Genshin_exports);
__reExport(Genshin_exports, require("./Daily"), module.exports);
__reExport(Genshin_exports, require("./Character"), module.exports);
__reExport(Genshin_exports, require("./Diary"), module.exports);
__reExport(Genshin_exports, require("./SpiralAbyss"), module.exports);
__reExport(Genshin_exports, require("./Redeem"), module.exports);
__reExport(Genshin_exports, require("./Account"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./RedeemResponse"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Redeem_exports = {};
module.exports = __toCommonJS(Redeem_exports);
__reExport(Redeem_exports, require("./RedeemResponse"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var RedeemResponse_exports = {};
module.exports = __toCommonJS(RedeemResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./SpiralAbyssResponse"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var SpiralAbyss_exports = {};
module.exports = __toCommonJS(SpiralAbyss_exports);
__reExport(SpiralAbyss_exports, require("./SpiralAbyssResponse"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var SpiralAbyssResponse_exports = {};
module.exports = __toCommonJS(SpiralAbyssResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var GameListResponse_exports = {};
module.exports = __toCommonJS(GameListResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Hoyolab_exports = {};
module.exports = __toCommonJS(Hoyolab_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var RecordCardResponse_exports = {};
module.exports = __toCommonJS(RecordCardResponse_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Options"), exports);
tslib_1.__exportStar(require("./Request"), exports);
tslib_1.__exportStar(require("./Hoyolab"), exports);
tslib_1.__exportStar(require("./Genshin"), exports);
tslib_1.__exportStar(require("./Cookie"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Interfaces_exports = {};
module.exports = __toCommonJS(Interfaces_exports);
__reExport(Interfaces_exports, require("./Options"), module.exports);
__reExport(Interfaces_exports, require("./Request"), module.exports);
__reExport(Interfaces_exports, require("./Hoyolab"), module.exports);
__reExport(Interfaces_exports, require("./Genshin"), module.exports);
__reExport(Interfaces_exports, require("./Cookie"), module.exports);
__reExport(Interfaces_exports, require("./Wiki"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Options_exports = {};
module.exports = __toCommonJS(Options_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Data_exports = {};
module.exports = __toCommonJS(Data_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Request_exports = {};
module.exports = __toCommonJS(Request_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Response_exports = {};
module.exports = __toCommonJS(Response_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./NumericRange"), exports);
tslib_1.__exportStar(require("./Region"), exports);
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Types_exports = {};
module.exports = __toCommonJS(Types_exports);
__reExport(Types_exports, require("./NumericRange"), module.exports);
__reExport(Types_exports, require("./Region"), module.exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var NumericRange_exports = {};
module.exports = __toCommonJS(NumericRange_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Region_exports = {};
module.exports = __toCommonJS(Region_exports);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cookie = void 0;
const HoyoError_1 = require("../HoyoError");
const String_1 = require("./String");
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Cookie_exports = {};
__export(Cookie_exports, {
Cookie: () => Cookie
});
module.exports = __toCommonJS(Cookie_exports);
var import_HoyoError = require("../HoyoError");
var import_String = require("./String");
class Cookie {
/**
* Parse document.cookie string to acceptable object
*
* @param cookieString string
* @throws {@link HoyoError} - If an error occurs
*/
static parseFromString(cookieString) {
const cookies = cookieString.match(/([^;\s?]+)=([^;]+)/gim);
if (cookies === null) {
throw new HoyoError_1.HoyoError('The given cookieString paramter is invalid');
}
const cookie = {
ltoken: '',
ltuid: '',
};
cookies
.map((val) => {
return val.split('=');
})
.forEach((item) => {
const key = item[0];
const val = item[1];
switch (key) {
case 'ltoken':
cookie.ltoken = val;
break;
case 'ltuid':
cookie.ltuid = val;
break;
case 'cookie_token':
cookie.cookieToken = val;
break;
case 'account_id':
cookie.accountId = val;
break;
case 'mi18nLang':
cookie.mi18nLang = val;
break;
}
});
if (cookie.ltoken === '' || cookie.ltuid === '') {
throw new HoyoError_1.HoyoError('The given cookieString parameter is not Hoyolab Cookie !');
}
if (cookie.ltuid !== '' && !cookie.accountId) {
cookie.accountId = cookie.ltuid;
}
return cookie;
/**
* Parse document.cookie string to acceptable object
*
* @param cookieString string
* @throws {@link HoyoError} - If an error occurs
*/
static parseFromString(cookieString) {
const cookies = cookieString.match(/([^;\s?]+)=([^;]+)/gim);
if (cookies === null) {
throw new import_HoyoError.HoyoError("The given cookieString paramter is invalid");
}
/**
* Parse Cookie object to cookie string
*
* @param cookie ICookie
*/
static parseToString(cookie) {
if (!cookie.accountId) {
cookie.accountId = cookie.ltuid;
const cookie = {
ltoken: "",
ltuid: ""
};
cookies.map((val) => {
return val.split("=");
}).forEach((item) => {
const key = item[0];
const val = item[1];
switch (key) {
case "ltoken":
cookie.ltoken = val;
break;
case "ltuid":
cookie.ltuid = val;
break;
case "cookie_token":
cookie.cookieToken = val;
break;
case "account_id":
cookie.accountId = val;
break;
case "mi18nLang":
cookie.mi18nLang = val;
break;
}
});
if (cookie.ltoken === "" || cookie.ltuid === "") {
throw new import_HoyoError.HoyoError(
"The given cookieString parameter is not Hoyolab Cookie !"
);
}
if (cookie.ltuid !== "" && !cookie.accountId) {
cookie.accountId = cookie.ltuid;
}
return cookie;
}
/**
* Parse Cookie object to cookie string
*
* @param cookie ICookie
*/
static parseToString(cookie) {
if (!cookie.accountId) {
cookie.accountId = cookie.ltuid;
}
const cookies = [];
Object.entries(cookie).forEach(([key, value]) => {
if (value) {
if (["cookieToken", "accountId"].includes(key)) {
key = (0, import_String.camel2Snake)(key);
}
const cookies = [];
Object.entries(cookie).forEach(([key, value]) => {
if (value) {
if (['cookieToken', 'accountId'].includes(key)) {
key = (0, String_1.camel2Snake)(key);
}
cookies.push(`${key}=${value}`);
}
});
return cookies.join('; ');
}
cookies.push(`${key}=${value}`);
}
});
return cookies.join("; ");
}
}
exports.Cookie = Cookie;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Cookie
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DynamicSecurity = void 0;
const tslib_1 = require("tslib");
const md5_1 = tslib_1.__importDefault(require("md5"));
/**
* Generate Digital Signature/Dynamic Security.
*
* Used to bypass the security of the Hoyoverse API
*
* @category Private
* @internal
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var DynamicSecurity_exports = {};
__export(DynamicSecurity_exports, {
DynamicSecurity: () => DynamicSecurity
});
module.exports = __toCommonJS(DynamicSecurity_exports);
var import_md5 = __toESM(require("md5"));
class DynamicSecurity {
/**
* Cypher Salt
*/
static SALT = '6s25p5ox5y14umn1p61aqyyvbvvl3lrt';
/**
* Generate Digital Signature for API Requst
*/
static generate() {
const date = new Date();
const t = Math.floor(date.getTime() / 1000);
let r = '';
const char = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for (let i = 0; i < 6; i++) {
r += char.charAt(Math.floor(Math.random() * char.length));
}
const h = (0, md5_1.default)(`salt=${this.SALT}&t=${t}&r=${r}`, {
encoding: 'string',
});
return `${t},${r},${h}`;
/**
* Cypher Salt
*/
static SALT = "6s25p5ox5y14umn1p61aqyyvbvvl3lrt";
/**
* Generate Digital Signature for API Requst
*/
static generate() {
const date = /* @__PURE__ */ new Date();
const t = Math.floor(date.getTime() / 1e3);
let r = "";
const char = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (let i = 0; i < 6; i++) {
r += char.charAt(Math.floor(Math.random() * char.length));
}
const h = (0, import_md5.default)(`salt=${this.SALT}&t=${t}&r=${r}`, {
encoding: "string"
});
return `${t},${r},${h}`;
}
}
exports.DynamicSecurity = DynamicSecurity;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
DynamicSecurity
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.delay = void 0;
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./DynamicSecurity"), exports);
tslib_1.__exportStar(require("./Request"), exports);
tslib_1.__exportStar(require("./Routes"), exports);
tslib_1.__exportStar(require("./ServerRegion"), exports);
tslib_1.__exportStar(require("./Cookie"), exports);
tslib_1.__exportStar(require("./String"), exports);
/* c8 ignore start */
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Utils_exports = {};
__export(Utils_exports, {
delay: () => delay
});
module.exports = __toCommonJS(Utils_exports);
__reExport(Utils_exports, require("./DynamicSecurity"), module.exports);
__reExport(Utils_exports, require("./Request"), module.exports);
__reExport(Utils_exports, require("./Routes"), module.exports);
__reExport(Utils_exports, require("./ServerRegion"), module.exports);
__reExport(Utils_exports, require("./Cookie"), module.exports);
__reExport(Utils_exports, require("./String"), module.exports);
function delay(second) {
return new Promise((resolve) => {
setTimeout(resolve, second * 1000);
});
return new Promise((resolve) => {
setTimeout(resolve, second * 1e3);
});
}
exports.delay = delay;
/* c8 ignore stop */
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
delay
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Request = void 0;
const tslib_1 = require("tslib");
const HoyoError_1 = require("./../HoyoError");
const axios_1 = tslib_1.__importDefault(require("axios"));
const __1 = require("..");
/**
* Request Class for making request to HoYoLab API.
*
* There are several additions such as headers, cookies, User Agent and also DS.
*
* @category Private
* @internal
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Request_exports = {};
__export(Request_exports, {
Request: () => Request
});
module.exports = __toCommonJS(Request_exports);
var import_HoyoError = require("./../HoyoError");
var import_axios = __toESM(require("axios"));
var import__ = require("..");
class Request {
/**
* Headers List
*/
headers;
/**
* Parameter (Query Param) List
*/
params = {};
/**
* Body data list
*/
body = {};
constructor(cookie) {
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',
Cookie: cookie,
};
/**
* Headers List
*/
headers;
/**
* Parameter (Query Param) List
*/
params = {};
/**
* Body data list
*/
body = {};
constructor(cookie = 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"
};
if (cookie) {
this.headers.Cookie = cookie;
}
/**
* Set Referer for current request
*
* @param url string - Referer Host with http or https prefix
*/
setReferer(url) {
const location = new URL(url);
const referer = `${location.protocol}//${location.host}`;
this.headers['Origin'] = referer;
this.headers['Referer'] = referer;
return this;
}
/**
* Set Referer for current request
*
* @param url string - Referer Host with http or https prefix
*/
setReferer(url) {
const location = new URL(url);
const referer = `${location.protocol}//${location.host}`;
this.headers["Origin"] = referer;
this.headers["Referer"] = referer;
return this;
}
/**
* Set Query Parameter.
* Will be sent using either the GET or POST method.
*
* @param params Params - Query paramater for current request
*/
setParams(params) {
this.params = { ...this.params, ...params };
return this;
}
/**
* Set Body Parameter.
*
* Will be sent if using the POST method, otherwise it will be ignored.
*
* @param body Body - Body parameter for current request
*/
setBody(body) {
this.body = { ...this.body, ...body };
return this;
}
/**
* Added DS headers on current request.
*
* Not all requests will ask for DS headers, only some will.
*
* @param status Boolean
*/
withDS(status = true) {
if (status) {
this.headers["DS"] = import__.Utils.DynamicSecurity.generate();
} else {
this.headers["DS"] = null;
}
/**
* Set Query Parameter.
* Will be sent using either the GET or POST method.
*
* @param params Params - Query paramater for current request
*/
setParams(params) {
this.params = { ...this.params, ...params };
return this;
return this;
}
/**
* Send request and reset query params and body for next request
*
* @param url string - API Endpoint located at GameRoutes
* @param method get | post - HTTP Method
* @throws {@link HoyoError} - If the request error caused by this library
* @throws {@link [AxiosError](https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js)} - If the error is caused by the server
*/
async send(url, method = "get", _retries = 1) {
const cleanUrl = url.replace(/([^:]\/)\/+/g, "$1");
const config = {
url: cleanUrl,
headers: this.headers,
method: method.toLowerCase()
};
if (method.toLowerCase() === "get") {
config["params"] = this.params;
} else {
config["params"] = this.params;
config["data"] = this.body;
}
/**
* Set Body Parameter.
*
* Will be sent if using the POST method, otherwise it will be ignored.
*
* @param body Body - Body parameter for current request
*/
setBody(body) {
this.body = { ...this.body, ...body };
return this;
const response = await (0, import_axios.default)(config);
const maxRetries = 60;
if (response.status === 429 && _retries <= maxRetries) {
await import__.Utils.delay(0.5);
return this.send(url, method, _retries++);
}
/**
* Added DS headers on current request.
*
* Not all requests will ask for DS headers, only some will.
*
* @param status Boolean
*/
withDS(status = true) {
if (status) {
this.headers['DS'] = __1.Utils.DynamicSecurity.generate();
}
else {
this.headers['DS'] = null;
}
return this;
if (response.data.retcode === -2016 && _retries <= maxRetries) {
await import__.Utils.delay(0.5);
return this.send(url, method, _retries++);
}
/**
* Send request and reset query params and body for next request
*
* @param url string - API Endpoint located at GameRoutes
* @param method get | post - HTTP Method
* @throws {@link HoyoError} - If the request error caused by this library
* @throws {@link [AxiosError](https://github.com/axios/axios/blob/v1.x/lib/core/AxiosError.js)} - If the error is caused by the server
*/
async send(url, method = 'get', _retries = 1) {
const cleanUrl = url.replace(/([^:]\/)\/+/g, '$1');
const config = {
url: cleanUrl,
headers: this.headers,
method: method.toLowerCase(),
};
if (method.toLowerCase() === 'get') {
config['params'] = this.params;
}
else {
config['params'] = this.params;
config['data'] = this.body;
}
const response = await (0, axios_1.default)(config);
/* c8 ignore start */
const maxRetries = 60;
if (response.status === 429 && _retries <= maxRetries) {
await __1.Utils.delay(0.5);
return this.send(url, method, _retries++);
}
if (response.data.retcode === -2016 && _retries <= maxRetries) {
await __1.Utils.delay(0.5);
return this.send(url, method, _retries++);
}
/* c8 ignore stop */
if (response.data?.retcode === -100) {
throw new HoyoError_1.HoyoError('Unable to authenticate user, make sure the cookie provided is correct!', response.data);
}
const allowedRetCode = [0, -5003, -2020, -2017];
if (allowedRetCode.includes(response.data?.retcode) === false) {
throw new HoyoError_1.HoyoError(`Failed to retrive data: [${response.data?.retcode}] - ${response.data?.message}`, response?.data);
}
// Reset Body & Params for next request
this.body = {};
this.params = {};
return response.data;
if (response.data?.retcode === -100) {
throw new import_HoyoError.HoyoError(
"Unable to authenticate user, make sure the cookie provided is correct!",
response.data
);
}
const allowedRetCode = [0, -5003, -2020, -2017];
if (allowedRetCode.includes(response.data?.retcode) === false) {
throw new import_HoyoError.HoyoError(
`Failed to retrive data: [${response.data?.retcode}] - ${response.data?.message}`,
response?.data
);
}
this.body = {};
this.params = {};
return response.data;
}
}
exports.Request = Request;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Request
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GenshinRoutes = exports.HoyolabRoutes = exports.BaseURL = void 0;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Routes_exports = {};
__export(Routes_exports, {
BaseURL: () => BaseURL,
GenshinRoutes: () => GenshinRoutes,
HoyolabRoutes: () => HoyolabRoutes
});
module.exports = __toCommonJS(Routes_exports);
class BaseURL {
static webStaticUrl = 'https://webstatic-sea.hoyolab.com/';
static accountUrl = 'https://api-account-os.hoyolab.com/account/auth/api';
static bbsUrl = 'https://bbs-api-os.hoyolab.com/';
static bbsReferrerUrl = 'https://www.hoyolab.com/';
static takumiUrl = 'https://api-os-takumi.hoyolab.com/';
static sgHke4Url = 'https://sg-hk4e-api.hoyolab.com/';
static webStaticUrl = "https://webstatic-sea.hoyolab.com/";
static accountUrl = "https://api-account-os.hoyolab.com/account/auth/api";
static bbsUrl = "https://bbs-api-os.hoyolab.com/";
static bbsReferrerUrl = "https://www.hoyolab.com/";
static takumiUrl = "https://api-os-takumi.hoyolab.com/";
static sgHke4Url = "https://sg-hk4e-api.hoyolab.com/";
static wikiUrl = "https://sg-wiki-api.hoyolab.com/hoyowiki/genshin/wapi/get_entry_page_list";
static wikiRefererUrl = "https://wiki.hoyolab.com";
}
exports.BaseURL = BaseURL;
/**
* Game Routes
*
* Contains a set of Endpoint APIs to support processes
* @category Private
* @internal
*/
class HoyolabRoutes {
static gamesList = BaseURL.takumiUrl + '/binding/api/getUserGameRolesByCookie';
static recordsList = BaseURL.bbsUrl + '/game_record/card/wapi/getGameRecordCard';
static redeem = BaseURL.sgHke4Url + '/common/apicdkey/api/webExchangeCdkey';
static gamesList = `${BaseURL.takumiUrl}/binding/api/getUserGameRolesByCookie`;
static recordsList = BaseURL.bbsUrl + "/game_record/card/wapi/getGameRecordCard";
static redeem = BaseURL.sgHke4Url + "/common/apicdkey/api/webExchangeCdkey";
}
exports.HoyolabRoutes = HoyolabRoutes;
class GenshinRoutes {
static dailyInfo = BaseURL.sgHke4Url + '/event/sol/info?act_id=e202102251931481&lang=en-us';
static dailyRewards = BaseURL.sgHke4Url + '/event/sol/home?act_id=e202102251931481&lang=en-us';
static dailyClaim = BaseURL.sgHke4Url + '/event/sol/sign?act_id=e202102251931481&lang=en-us';
static dailyNotes = BaseURL.bbsUrl + '/game_record/genshin/api/dailyNote';
static characters = BaseURL.bbsUrl + '/game_record/genshin/api/character';
static spiralAbyss = BaseURL.bbsUrl + '/game_record/genshin/api/spiralAbyss';
static charactersInfo = BaseURL.bbsUrl + '/game_record/genshin/api/avatarBasicInfo';
static accountInfo = BaseURL.bbsUrl + '/game_record/genshin/api/index';
static diaryInfo = BaseURL.sgHke4Url + '/event/ysledgeros/month_info';
static diaryDetail = BaseURL.sgHke4Url + '/event/ysledgeros/month_detail';
static dailyInfo = BaseURL.sgHke4Url + "/event/sol/info?act_id=e202102251931481&lang=en-us";
static dailyRewards = BaseURL.sgHke4Url + "/event/sol/home?act_id=e202102251931481&lang=en-us";
static dailyClaim = BaseURL.sgHke4Url + "/event/sol/sign?act_id=e202102251931481&lang=en-us";
static dailyNotes = BaseURL.bbsUrl + "/game_record/genshin/api/dailyNote";
static characters = BaseURL.bbsUrl + "/game_record/genshin/api/character";
static spiralAbyss = BaseURL.bbsUrl + "/game_record/genshin/api/spiralAbyss";
static charactersInfo = BaseURL.bbsUrl + "/game_record/genshin/api/avatarBasicInfo";
static accountInfo = BaseURL.bbsUrl + "/game_record/genshin/api/index";
static diaryInfo = BaseURL.sgHke4Url + "/event/ysledgeros/month_info";
static diaryDetail = BaseURL.sgHke4Url + "/event/ysledgeros/month_detail";
}
exports.GenshinRoutes = GenshinRoutes;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
BaseURL,
GenshinRoutes,
HoyolabRoutes
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServerRegion = void 0;
const HoyoError_1 = require("../HoyoError");
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var ServerRegion_exports = {};
__export(ServerRegion_exports, {
ServerRegion: () => ServerRegion
});
module.exports = __toCommonJS(ServerRegion_exports);
var import_HoyoError = require("../HoyoError");
class ServerRegion {
static determineRegion(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 HoyoError_1.HoyoError(`Given UID ${uid} is invalid !`);
}
static determineRegion(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 import_HoyoError.HoyoError(`Given UID ${uid} is invalid !`);
}
}
}
exports.ServerRegion = ServerRegion;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
ServerRegion
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.camel2Snake = void 0;
/**
* Transform camel case to snake case
*
* @param text string
*/
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var String_exports = {};
__export(String_exports, {
camel2Snake: () => camel2Snake
});
module.exports = __toCommonJS(String_exports);
function camel2Snake(text) {
return text
.replace(/([A-Z])/g, ' $1')
.split(' ')
.join('_')
.toLowerCase();
return text.replace(/([A-Z])/g, " $1").split(" ").join("_").toLowerCase();
}
exports.camel2Snake = camel2Snake;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
camel2Snake
});
{
"name": "@vermaysha/hoyolab-api",
"version": "2.2.3",
"version": "2.3.0",
"description": "Its unofficial HoYoLab API Wrapper for getting hoyoverse some in-game data, including Genshin Impact, Honkai Impact 3rd.",

@@ -8,4 +8,4 @@ "main": "dist/index.js",

"scripts": {
"build:docs": "rimraf docs/ && typedoc",
"build:tsc": "rimraf dist/ && tsc -b -f",
"build:docs": "typedoc",
"build:tsc": "node ./script/build.js && npx tsc --emitDeclarationOnly",
"build": "npm run build:tsc && npm run build:docs",

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

"files": [
"dist/**/*.js"
"dist/**/*"
],

@@ -50,5 +50,7 @@ "devDependencies": {

"dotenv": "^16.0.3",
"esbuild": "^0.17.12",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.7.0",
"eslint-plugin-tsdoc": "^0.2.17",
"fast-glob": "^3.2.12",
"husky": "^8.0.3",

@@ -69,8 +71,7 @@ "jest": "^29.5.0",

"engines": {
"node": ">=16"
"node": ">=14"
},
"dependencies": {
"axios": "^1.3.4",
"md5": "^2.3.0",
"tslib": "^2.5.0"
"md5": "^2.3.0"
},

@@ -77,0 +78,0 @@ "lint-staged": {

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