Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

michos_api

Package Overview
Dependencies
Maintainers
0
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

michos_api - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

dist/esm/chunk-2JSWIMWJ.mjs

6

dist/cjs/cache/cache.js

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var cache_exports = {};

@@ -28,4 +30,2 @@ __export(cache_exports, {

class Cache {
cache = /* @__PURE__ */ new Map();
maxCacheCap;
/**

@@ -35,2 +35,4 @@ * Creates an instance of Cache.

constructor() {
__publicField(this, "cache", /* @__PURE__ */ new Map());
__publicField(this, "maxCacheCap");
this.maxCacheCap = this.calculateMaxCapacity();

@@ -37,0 +39,0 @@ }

@@ -53,2 +53,3 @@ "use strict";

async list(month = import_diary.DiaryMonthEnum.CURRENT) {
var _a;
if (!this.region || !this.uid) {

@@ -74,3 +75,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -101,2 +102,3 @@ {

async detail(type, month = import_diary.DiaryMonthEnum.CURRENT) {
var _a, _b;
if (!this.region || !this.uid) {

@@ -132,3 +134,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -152,3 +154,3 @@ {

responses.current_page = data.current_page;
responses.list = [...responses.list ?? [], ...data.list];
responses.list = [...(_b = responses.list) != null ? _b : [], ...data.list];
if (data.list.length < 1) {

@@ -155,0 +157,0 @@ next = false;

@@ -43,3 +43,3 @@ "use strict";

default:
throw new import_error.HoyoAPIError(`Given UID ${uid} is invalid !`);
throw new import_error.HoyoAPIError("Given UID ".concat(uid, " is invalid !"));
}

@@ -46,0 +46,0 @@ return import_gi.GenshinRegion[key];

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var gi_exports = {};

@@ -39,47 +41,2 @@ __export(gi_exports, {

/**
* The `DailyModule` object provides an interface to interact with the daily check-in feature in Genshin Impact.
*
*/
daily;
/**
* The `RedeemModule` object provides an interface to interact with the code redemption feature in Genshin Impact.
*
*/
redeem;
/**
* The `GenshinRecordModule` object provides an interface to interact with the user record feature in Genshin Impact.
*
*/
record;
/**
* The `GenshinDiaryModule` object provides an interface to interact with the user diary feature in Genshin Impact.
*
*/
diary;
/**
* The `GenshinTCGModule` object provides an interface to interact with the user diary feature in Genshin Impact.
*
*/
tcg;
/**
* The cookie object to be used in requests.
*/
cookie;
/**
* The `Request` object used to make requests.
*/
request;
/**
* The UID of the user, if available.
*/
uid;
/**
* The region of the user, if available.
*/
region;
/**
* The language to be used in requests.
*/
lang;
/**
* Constructs a new `Genshin` object.

@@ -90,2 +47,48 @@ *

constructor(options) {
/**
* The `DailyModule` object provides an interface to interact with the daily check-in feature in Genshin Impact.
*
*/
__publicField(this, "daily");
/**
* The `RedeemModule` object provides an interface to interact with the code redemption feature in Genshin Impact.
*
*/
__publicField(this, "redeem");
/**
* The `GenshinRecordModule` object provides an interface to interact with the user record feature in Genshin Impact.
*
*/
__publicField(this, "record");
/**
* The `GenshinDiaryModule` object provides an interface to interact with the user diary feature in Genshin Impact.
*
*/
__publicField(this, "diary");
/**
* The `GenshinTCGModule` object provides an interface to interact with the user diary feature in Genshin Impact.
*
*/
__publicField(this, "tcg");
/**
* The cookie object to be used in requests.
*/
__publicField(this, "cookie");
/**
* The `Request` object used to make requests.
*/
__publicField(this, "request");
/**
* The UID of the user, if available.
*/
__publicField(this, "uid");
/**
* The region of the user, if available.
*/
__publicField(this, "region");
/**
* The language to be used in requests.
*/
__publicField(this, "lang");
var _a;
const cookie = typeof options.cookie === "string" ? import_cookie.Cookie.parseCookieString(options.cookie) : options.cookie;

@@ -100,3 +103,3 @@ this.cookie = cookie;

this.request.setLang(options.lang);
this.uid = options.uid ?? null;
this.uid = (_a = options.uid) != null ? _a : null;
this.region = this.uid !== null ? (0, import_gi.getGenshinRegion)(this.uid) : null;

@@ -103,0 +106,0 @@ this.lang = options.lang;

@@ -55,2 +55,3 @@ "use strict";

async records() {
var _a;
if (!this.region || !this.uid) {

@@ -72,3 +73,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -99,2 +100,3 @@ {

async characters() {
var _a;
if (!this.region || !this.uid) {

@@ -115,3 +117,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -141,2 +143,3 @@ {

async charactersSummary(characterIds) {
var _a;
if (!this.region || !this.uid) {

@@ -158,3 +161,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -184,2 +187,3 @@ {

async spiralAbyss(scheduleType = import_record.SpiralAbyssScheduleEnum.CURRENT) {
var _a;
if (!this.region || !this.uid) {

@@ -204,3 +208,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -228,2 +232,3 @@ {

async dailyNote() {
var _a;
if (!this.region || !this.uid) {

@@ -244,3 +249,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -247,0 +252,0 @@ {

@@ -47,2 +47,3 @@ "use strict";

async basicInfo() {
var _a;
this.request.setQueryParams({

@@ -61,3 +62,3 @@ server: this.region,

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -83,2 +84,3 @@ {

async cards() {
var _a, _b;
const perPage = 100;

@@ -106,3 +108,3 @@ let next = true;

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -122,3 +124,3 @@ {

offset = data.next_offset;
cardLists.card_list = [...cardLists.card_list ?? [], ...data.card_list];
cardLists.card_list = [...(_b = cardLists.card_list) != null ? _b : [], ...data.card_list];
cardLists.is_last = data.is_last;

@@ -137,2 +139,3 @@ cardLists.next_offset = data.next_offset;

async matchs() {
var _a;
this.request.setQueryParams({

@@ -151,3 +154,3 @@ server: this.region,

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -173,2 +176,3 @@ {

async challengeSchedule() {
var _a;
this.request.setQueryParams({

@@ -187,3 +191,3 @@ server: this.region,

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -210,2 +214,3 @@ {

async challengeRecord(schedule_id) {
var _a;
this.request.setQueryParams({

@@ -225,3 +230,3 @@ server: this.region,

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -249,2 +254,3 @@ {

async challangeDeck(schedule_id, deck_id) {
var _a;
this.request.setQueryParams({

@@ -265,3 +271,3 @@ server: this.region,

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -268,0 +274,0 @@ {

@@ -35,3 +35,3 @@ "use strict";

} else {
throw new import_error.HoyoAPIError(`Given UID ${uid} is invalid !`);
throw new import_error.HoyoAPIError("Given UID ".concat(uid, " is invalid !"));
}

@@ -38,0 +38,0 @@ return import_hi.HonkaiRegion[key];

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var hi_exports = {};

@@ -37,44 +39,2 @@ __export(hi_exports, {

/**
* The Daily module for the Honkai Impact 3rd game.
*
*/
daily;
/**
* The Redeem module for the Honkai Impact 3rd game.
*
* @public
* @readonly
*/
redeem;
/**
* The `HIRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails.
*
*/
record;
/**
* The cookie used for authentication.
*
*/
cookie;
/**
* The request object used to make HTTP requests.
*
*/
request;
/**
* The UID of the Honkai Impact 3rd account.
*
*/
uid;
/**
* The region of the Honkai Impact 3rd account.
*
*/
region;
/**
* The language of the Honkai Impact 3rd account.
*
*/
lang;
/**
* Create a new instance of HonkaiImpact.

@@ -85,2 +45,45 @@ *

constructor(options) {
/**
* The Daily module for the Honkai Impact 3rd game.
*
*/
__publicField(this, "daily");
/**
* The Redeem module for the Honkai Impact 3rd game.
*
* @public
* @readonly
*/
__publicField(this, "redeem");
/**
* The `HIRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails.
*
*/
__publicField(this, "record");
/**
* The cookie used for authentication.
*
*/
__publicField(this, "cookie");
/**
* The request object used to make HTTP requests.
*
*/
__publicField(this, "request");
/**
* The UID of the Honkai Impact 3rd account.
*
*/
__publicField(this, "uid");
/**
* The region of the Honkai Impact 3rd account.
*
*/
__publicField(this, "region");
/**
* The language of the Honkai Impact 3rd account.
*
*/
__publicField(this, "lang");
var _a;
const cookie = typeof options.cookie === "string" ? import_cookie.Cookie.parseCookieString(options.cookie) : options.cookie;

@@ -95,3 +98,3 @@ this.cookie = cookie;

this.request.setLang(options.lang);
this.uid = options.uid ?? null;
this.uid = (_a = options.uid) != null ? _a : null;
this.region = this.uid !== null ? (0, import_hi.getHi3Region)(this.uid) : null;

@@ -98,0 +101,0 @@ this.lang = options.lang;

@@ -49,2 +49,3 @@ "use strict";

async records() {
var _a;
if (!this.region || !this.uid) {

@@ -66,3 +67,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -89,2 +90,3 @@ {

async characters() {
var _a;
if (!this.region || !this.uid) {

@@ -106,3 +108,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -134,2 +136,3 @@ {

async abyss(isOverate = true) {
var _a;
if (!this.region || !this.uid) {

@@ -153,3 +156,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -181,2 +184,3 @@ {

async arena() {
var _a;
if (!this.region || !this.uid) {

@@ -198,3 +202,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -226,2 +230,3 @@ {

async elysian() {
var _a;
if (!this.region || !this.uid) {

@@ -243,3 +248,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -246,0 +251,0 @@ {

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var hoyolab_exports = {};

@@ -32,14 +34,2 @@ __export(hoyolab_exports, {

/**
* The parsed ICookie object used to authenticate requests.
*/
cookie;
/**
* The underlying `Request` object used to make HTTP requests.
*/
request;
/**
* The language used for API responses.
*/
lang;
/**
* Creates a new instance of `Hoyolab`.

@@ -57,2 +47,14 @@ *

constructor(options) {
/**
* The parsed ICookie object used to authenticate requests.
*/
__publicField(this, "cookie");
/**
* The underlying `Request` object used to make HTTP requests.
*/
__publicField(this, "request");
/**
* The language used for API responses.
*/
__publicField(this, "lang");
const cookie = typeof options.cookie === "string" ? import_cookie.Cookie.parseCookieString(options.cookie) : options.cookie;

@@ -59,0 +61,0 @@ this.cookie = cookie;

@@ -43,3 +43,3 @@ "use strict";

default:
throw new import_error.HoyoAPIError(`Given UID ${uid} is invalid !`);
throw new import_error.HoyoAPIError("Given UID ".concat(uid, " is invalid !"));
}

@@ -46,0 +46,0 @@ return import_hsr.HsrRegion[key];

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var hsr_exports = {};

@@ -37,42 +39,2 @@ __export(hsr_exports, {

/**
* The Daily module for the Honkai Star Rail game.
*
*/
daily;
/**
* The Redeem module for the Honkai Star Rail game.
*
*/
redeem;
/**
* The `HSRRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails.
*
*/
record;
/**
* The cookie used for authentication.
*
*/
cookie;
/**
* The request object used to make HTTP requests.
*
*/
request;
/**
* The UID of the Honkai Star Rail account.
*
*/
uid;
/**
* The region of the Honkai Star Rail account.
*
*/
region;
/**
* The language of the Honkai Star Rail account.
*
*/
lang;
/**
* Create a new instance of HonkaiStarRail.

@@ -84,2 +46,43 @@ *

constructor(options) {
/**
* The Daily module for the Honkai Star Rail game.
*
*/
__publicField(this, "daily");
/**
* The Redeem module for the Honkai Star Rail game.
*
*/
__publicField(this, "redeem");
/**
* The `HSRRecordModule` object provides an interface to interact with the user record feature in Honkai Star Rails.
*
*/
__publicField(this, "record");
/**
* The cookie used for authentication.
*
*/
__publicField(this, "cookie");
/**
* The request object used to make HTTP requests.
*
*/
__publicField(this, "request");
/**
* The UID of the Honkai Star Rail account.
*
*/
__publicField(this, "uid");
/**
* The region of the Honkai Star Rail account.
*
*/
__publicField(this, "region");
/**
* The language of the Honkai Star Rail account.
*
*/
__publicField(this, "lang");
var _a;
const cookie = typeof options.cookie === "string" ? import_cookie.Cookie.parseCookieString(options.cookie) : options.cookie;

@@ -94,3 +97,3 @@ this.cookie = cookie;

this.request.setLang(options.lang);
this.uid = options.uid ?? null;
this.uid = (_a = options.uid) != null ? _a : null;
this.region = this.uid !== null ? (0, import_hsr.getHsrRegion)(this.uid) : null;

@@ -97,0 +100,0 @@ this.lang = options.lang;

@@ -50,2 +50,3 @@ "use strict";

async characters() {
var _a;
if (!this.region || !this.uid) {

@@ -67,3 +68,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -91,2 +92,3 @@ {

async records() {
var _a;
if (!this.region || !this.uid) {

@@ -108,3 +110,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -131,2 +133,3 @@ {

async note() {
var _a;
if (!this.region || !this.uid) {

@@ -148,3 +151,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -173,2 +176,3 @@ {

async forgottenHall(scheduleType = import_record.ForgottenHallScheduleEnum.CURRENT) {
var _a;
if (!this.region || !this.uid) {

@@ -195,3 +199,3 @@ throw new import_error.HoyoAPIError("UID parameter is missing or failed to be filled");

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -198,0 +202,0 @@ {

@@ -106,3 +106,3 @@ "use strict";

}
return `${key}=${value}`;
return "".concat(key, "=").concat(value);
}).filter((val) => {

@@ -109,0 +109,0 @@ return val !== void 0;

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var error_exports = {};

@@ -28,18 +30,2 @@ __export(error_exports, {

/**
* The name of this error.
*/
name;
/**
* The message associated with this error.
*/
message;
/**
* The HTTP object
*/
http;
/**
* The error code
*/
code;
/**
* Constructs a new instance of the HoyolabError class with the specified message.

@@ -51,2 +37,18 @@ *

super(message);
/**
* The name of this error.
*/
__publicField(this, "name");
/**
* The message associated with this error.
*/
__publicField(this, "message");
/**
* The HTTP object
*/
__publicField(this, "http");
/**
* The error code
*/
__publicField(this, "code");
this.name = this.constructor.name;

@@ -53,0 +55,0 @@ this.message = message;

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var daily_exports = {};

@@ -35,2 +37,5 @@ __export(daily_exports, {

this.region = region;
__publicField(this, "dailyInfoUrl");
__publicField(this, "dailyRewardUrl");
__publicField(this, "dailySignUrl");
this.dailyInfoUrl = (0, import_routes.DAILY_INFO_API)(game);

@@ -40,5 +45,2 @@ this.dailyRewardUrl = (0, import_routes.DAILY_REWARD_API)(game);

}
dailyInfoUrl;
dailyRewardUrl;
dailySignUrl;
/**

@@ -50,2 +52,3 @@ * Retrieves daily information.

async info() {
var _a;
this.request.setQueryParams({

@@ -62,3 +65,3 @@ lang: this.lang

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -76,3 +79,3 @@ {

const data = res.data;
if (typeof data?.first_bind === "undefined" || data?.first_bind === null) {
if (typeof (data == null ? void 0 : data.first_bind) === "undefined" || (data == null ? void 0 : data.first_bind) === null) {
data.first_bind = false;

@@ -106,2 +109,3 @@ }

async rewards() {
var _a;
this.request.setQueryParams({

@@ -118,3 +122,3 @@ lang: this.lang

throw new import_error.HoyoAPIError(
res.message ?? "Failed to retrieve data, please double-check the provided UID.",
(_a = res.message) != null ? _a : "Failed to retrieve data, please double-check the provided UID.",
res.retcode,

@@ -159,3 +163,3 @@ {

if (day === null) {
const now = response?.now ? new Date(parseInt(response.now) * 1e3) : /* @__PURE__ */ new Date();
const now = (response == null ? void 0 : response.now) ? new Date(parseInt(response.now) * 1e3) : /* @__PURE__ */ new Date();
day = now.getDate();

@@ -168,3 +172,3 @@ }

if (!(day > 0 && day <= daysInMonth) || typeof response.awards[day - 1] === "undefined") {
throw new import_error.HoyoAPIError(`${day} is not a valid date in this month.`);
throw new import_error.HoyoAPIError("".concat(day, " is not a valid date in this month."));
}

@@ -185,2 +189,3 @@ return {

async claim() {
var _a;
this.request.setQueryParams({

@@ -200,3 +205,3 @@ lang: this.lang

}
if (response.data?.code.toString().toLowerCase() === "ok" && response.retcode === 0) {
if (((_a = response.data) == null ? void 0 : _a.code.toString().toLowerCase()) === "ok" && response.retcode === 0) {
return {

@@ -203,0 +208,0 @@ status: response.message,

@@ -37,4 +37,4 @@ "use strict";

}
const hash = (0, import_crypto.createHash)("md5").update(`salt=${salt}&t=${time}&r=${random}`).digest("hex");
return `${time},${random},${hash}`;
const hash = (0, import_crypto.createHash)("md5").update("salt=".concat(salt, "&t=").concat(time, "&r=").concat(random)).digest("hex");
return "".concat(time, ",").concat(random, ",").concat(hash);
}

@@ -41,0 +41,0 @@ function delay(second) {

@@ -6,2 +6,3 @@ "use strict";

var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {

@@ -20,2 +21,3 @@ for (var name in all)

var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var request_exports = {};

@@ -34,42 +36,42 @@ __export(request_exports, {

class HTTPRequest {
/**
* Query parameters for the request.
*/
params = {};
/**
* Body of the request.
*/
body = {};
/**
* The cache used for the request
*/
cache;
/*
* Headers for the request.
*/
headers = {
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json",
"Accept-Encoding": "gzip, deflate, br",
"sec-ch-ua": '"Chromium";v="112", "Microsoft Edge";v="112", "Not:A-Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.46",
"x-rpc-app_version": "1.5.0",
"x-rpc-client_type": "5",
"x-rpc-language": "en-us"
};
/**
* Flag indicating whether Dynamic Security is used.
*/
ds = false;
/**
* The number of request attempts made.
*/
retries = 1;
http;
constructor(cookie) {
/**
* Query parameters for the request.
*/
__publicField(this, "params", {});
/**
* Body of the request.
*/
__publicField(this, "body", {});
/**
* The cache used for the request
*/
__publicField(this, "cache");
/*
* Headers for the request.
*/
__publicField(this, "headers", {
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json",
"Accept-Encoding": "gzip, deflate, br",
"sec-ch-ua": '"Chromium";v="112", "Microsoft Edge";v="112", "Not:A-Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-site",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.46",
"x-rpc-app_version": "1.5.0",
"x-rpc-client_type": "5",
"x-rpc-language": "en-us"
});
/**
* Flag indicating whether Dynamic Security is used.
*/
__publicField(this, "ds", false);
/**
* The number of request attempts made.
*/
__publicField(this, "retries", 1);
__publicField(this, "http");
if (cookie) this.headers.Cookie = cookie;

@@ -144,3 +146,4 @@ this.cache = new import_cache.Cache();

Object.keys(this.params).forEach((val) => {
queryParams.append(val, this.params[val]?.toString() ?? "");
var _a, _b;
queryParams.append(val, (_b = (_a = this.params[val]) == null ? void 0 : _a.toString()) != null ? _b : "");
});

@@ -171,3 +174,3 @@ hostname.search = queryParams.toString();

new import_error.HoyoAPIError(
`HTTP ${res.statusCode}: ${res.statusMessage}`,
"HTTP ".concat(res.statusCode, ": ").concat(res.statusMessage),
res.statusCode,

@@ -190,2 +193,3 @@ {

res.on("end", () => {
var _a, _b, _c, _d;
let buffer = Buffer.concat(stream);

@@ -207,9 +211,9 @@ const encoding = res.headers["content-encoding"];

response: {
data: response?.data ?? null,
message: response?.message ?? "",
retcode: response?.retcode ?? -1
data: (_a = response == null ? void 0 : response.data) != null ? _a : null,
message: (_b = response == null ? void 0 : response.message) != null ? _b : "",
retcode: (_c = response == null ? void 0 : response.retcode) != null ? _c : -1
},
status: {
/* c8 ignore next */
code: res.statusCode ?? -1,
code: (_d = res.statusCode) != null ? _d : -1,
message: res.statusMessage

@@ -216,0 +220,0 @@ },

@@ -63,4 +63,4 @@ "use strict";

const DEFAULT_REFERER = "https://hoyolab.com";
const USER_GAMES_LIST = `${ACCOUNT_API}/account/binding/api/getUserGameRolesByCookieToken`;
const GAME_RECORD_CARD_API = `${BBS_API}/game_record/card/wapi/getGameRecordCard`;
const USER_GAMES_LIST = "".concat(ACCOUNT_API, "/account/binding/api/getUserGameRolesByCookieToken");
const GAME_RECORD_CARD_API = "".concat(BBS_API, "/game_record/card/wapi/getGameRecordCard");
const getEventName = (game) => {

@@ -95,15 +95,15 @@ if (game == import_hoyolab.GamesEnum.GENSHIN_IMPACT) {

const DAILY_INFO_API = (game) => {
return `${getEventBaseUrl(game)}/event/${getEventName(
return "".concat(getEventBaseUrl(game), "/event/").concat(getEventName(
game
)}/info?act_id=${getActId(game)}`;
), "/info?act_id=").concat(getActId(game));
};
const DAILY_REWARD_API = (game) => {
return `${getEventBaseUrl(game)}/event/${getEventName(
return "".concat(getEventBaseUrl(game), "/event/").concat(getEventName(
game
)}/home?act_id=${getActId(game)}`;
), "/home?act_id=").concat(getActId(game));
};
const DAILY_CLAIM_API = (game) => {
return `${getEventBaseUrl(game)}/event/${getEventName(
return "".concat(getEventBaseUrl(game), "/event/").concat(getEventName(
game
)}/sign?act_id=${getActId(game)}`;
), "/sign?act_id=").concat(getActId(game));
};

@@ -114,3 +114,3 @@ const REDEEM_CLAIM_API = (game) => {

case import_hoyolab.GamesEnum.HONKAI_IMPACT:
return `${HK4E_API}/common/apicdkey/api/webExchangeCdkey`;
return "".concat(HK4E_API, "/common/apicdkey/api/webExchangeCdkey");
case import_hoyolab.GamesEnum.HONKAI_STAR_RAIL:

@@ -122,25 +122,25 @@ return "https://sg-hkrpg-api.hoyoverse.com/common/apicdkey/api/webExchangeCdkey";

};
const GENSHIN_RECORD_INDEX_API = `${BBS_API}/game_record/genshin/api/index`;
const GENSHIN_RECORD_CHARACTER_API = `${BBS_API}/game_record/genshin/api/character`;
const GENSHIN_RECORD_AVATAR_BASIC_INFO_API = `${BBS_API}/game_record/genshin/api/avatarBasicInfo`;
const GENSHIN_RECORD_SPIRAL_ABYSS_API = `${BBS_API}/game_record/genshin/api/spiralAbyss`;
const GENSHIN_RECORD_DAILY_NOTE_API = `${BBS_API}/game_record/genshin/api/dailyNote`;
const GENSHIN_DIARY_LIST_API = `${HK4E_API}/event/ysledgeros/month_info`;
const GENSHIN_DIARY_DETAIL_API = `${HK4E_API}/event/ysledgeros/month_detail`;
const GENSHIN_TCG_BASICINFO = `${BBS_API}/game_record/genshin/api/gcg/basicInfo`;
const GENSHIN_TCG_CARDLIST = `${BBS_API}/game_record/genshin/api/gcg/cardList`;
const GENSHIN_TCG_MATCHLIST = `${BBS_API}/game_record/genshin/api/gcg/matchList`;
const GENSHIN_TCG_CHALLANGE_SCHEDULE = `${BBS_API}/game_record/genshin/api/gcg/challenge/schedule`;
const GENSHIN_TCG_CHALLANGE_RECORD = `${BBS_API}/game_record/genshin/api/gcg/challenge/record`;
const GENSHIN_TCG_CHALLANGE_DECK = `${BBS_API}/game_record/genshin/api/gcg/challenge/deck`;
const HSR_RECORD_CHARACTER_API = `${BBS_API}/game_record/hkrpg/api/avatar/info`;
const HSR_RECORD_INDEX_API = `${BBS_API}/game_record/hkrpg/api/index`;
const HSR_RECORD_NOTE_API = `${BBS_API}/game_record/hkrpg/api/note`;
const HSR_RECORD_FORGOTTEN_HALL_API = `${BBS_API}/game_record/hkrpg/api/challenge`;
const HI_RECORD_INDEX_API = `${BBS_API}/game_record/honkai3rd/api/index`;
const HI_RECORD_CHARACTER_API = `${BBS_API}/game_record/honkai3rd/api/characters`;
const HI_RECORD_OLD_ABYSS_API = `${BBS_API}/game_record/honkai3rd/api/latestOldAbyssReport`;
const HI_RECORD_NEW_ABYSS_API = `${BBS_API}/game_record/honkai3rd/api/newAbyssReport`;
const HI_RECORD_ELYSIAN_API = `${BBS_API}/game_record/honkai3rd/api/godWar`;
const HI_RECORD_ARENA_API = `${BBS_API}/game_record/honkai3rd/api/battleFieldReport`;
const GENSHIN_RECORD_INDEX_API = "".concat(BBS_API, "/game_record/genshin/api/index");
const GENSHIN_RECORD_CHARACTER_API = "".concat(BBS_API, "/game_record/genshin/api/character");
const GENSHIN_RECORD_AVATAR_BASIC_INFO_API = "".concat(BBS_API, "/game_record/genshin/api/avatarBasicInfo");
const GENSHIN_RECORD_SPIRAL_ABYSS_API = "".concat(BBS_API, "/game_record/genshin/api/spiralAbyss");
const GENSHIN_RECORD_DAILY_NOTE_API = "".concat(BBS_API, "/game_record/genshin/api/dailyNote");
const GENSHIN_DIARY_LIST_API = "".concat(HK4E_API, "/event/ysledgeros/month_info");
const GENSHIN_DIARY_DETAIL_API = "".concat(HK4E_API, "/event/ysledgeros/month_detail");
const GENSHIN_TCG_BASICINFO = "".concat(BBS_API, "/game_record/genshin/api/gcg/basicInfo");
const GENSHIN_TCG_CARDLIST = "".concat(BBS_API, "/game_record/genshin/api/gcg/cardList");
const GENSHIN_TCG_MATCHLIST = "".concat(BBS_API, "/game_record/genshin/api/gcg/matchList");
const GENSHIN_TCG_CHALLANGE_SCHEDULE = "".concat(BBS_API, "/game_record/genshin/api/gcg/challenge/schedule");
const GENSHIN_TCG_CHALLANGE_RECORD = "".concat(BBS_API, "/game_record/genshin/api/gcg/challenge/record");
const GENSHIN_TCG_CHALLANGE_DECK = "".concat(BBS_API, "/game_record/genshin/api/gcg/challenge/deck");
const HSR_RECORD_CHARACTER_API = "".concat(BBS_API, "/game_record/hkrpg/api/avatar/info");
const HSR_RECORD_INDEX_API = "".concat(BBS_API, "/game_record/hkrpg/api/index");
const HSR_RECORD_NOTE_API = "".concat(BBS_API, "/game_record/hkrpg/api/note");
const HSR_RECORD_FORGOTTEN_HALL_API = "".concat(BBS_API, "/game_record/hkrpg/api/challenge");
const HI_RECORD_INDEX_API = "".concat(BBS_API, "/game_record/honkai3rd/api/index");
const HI_RECORD_CHARACTER_API = "".concat(BBS_API, "/game_record/honkai3rd/api/characters");
const HI_RECORD_OLD_ABYSS_API = "".concat(BBS_API, "/game_record/honkai3rd/api/latestOldAbyssReport");
const HI_RECORD_NEW_ABYSS_API = "".concat(BBS_API, "/game_record/honkai3rd/api/newAbyssReport");
const HI_RECORD_ELYSIAN_API = "".concat(BBS_API, "/game_record/honkai3rd/api/godWar");
const HI_RECORD_ARENA_API = "".concat(BBS_API, "/game_record/honkai3rd/api/battleFieldReport");
// Annotate the CommonJS export names for ESM import in node:

@@ -147,0 +147,0 @@ 0 && (module.exports = {

{
"name": "michos_api",
"version": "1.0.7",
"version": "1.0.8",
"description": "Michos API is an unofficial API Wrapper library developed to facilitate communication with the official HoYoLab API.",

@@ -5,0 +5,0 @@ "exports": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc