mowojang 0.8.2 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +22 -21
- package/package.json +12 -11
package/dist/index.d.ts
CHANGED
|
@@ -296,4 +296,5 @@ declare const cache: {
|
|
|
296
296
|
buildMemoryStorage: typeof buildMemoryStorage;
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
export {
|
|
299
|
+
export { Client, cache, utils, validate };
|
|
300
|
+
export type { AxiosOptions, ClientOptions, MowojangCache, MowojangCape, MowojangError, MowojangProfile, MowojangRequestConfig, MowojangResponse, MowojangSession, MowojangSkin, Player, UUID, Username, ValidationOptions };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __defProp = Object.defineProperty;
|
|
|
5
5
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
6
|
|
|
7
7
|
// <define:VERSION>
|
|
8
|
-
var define_VERSION_default = ["0.8.
|
|
8
|
+
var define_VERSION_default = ["0.8.4"];
|
|
9
9
|
|
|
10
10
|
// src/utils.ts
|
|
11
11
|
var undashUUID = /* @__PURE__ */ __name((UUID) => UUID.replaceAll("-", "").toLowerCase(), "undashUUID");
|
|
@@ -18,7 +18,7 @@ var USERNAME_MIN_2_REGEX = /^[a-zA-Z0-9_]{2,16}$/;
|
|
|
18
18
|
var USERNAME_MIN_3_REGEX = /^[a-zA-Z0-9_]{3,16}$/;
|
|
19
19
|
var validateUUID = /* @__PURE__ */ __name((UUID) => {
|
|
20
20
|
if (typeof UUID !== "string") return false;
|
|
21
|
-
UUID = undashUUID(UUID);
|
|
21
|
+
UUID = undashUUID(UUID).toLowerCase();
|
|
22
22
|
if (UUID.length !== 32) return false;
|
|
23
23
|
return UUID_REGEX.test(UUID);
|
|
24
24
|
}, "validateUUID");
|
|
@@ -72,26 +72,27 @@ var axiosInstance_default = /* @__PURE__ */ __name((options, logger) => {
|
|
|
72
72
|
},
|
|
73
73
|
(err) => {
|
|
74
74
|
const isConnectionError = ["ECONNRESET", "ETIMEDOUT", "ECONNREFUSED", "ENOTFOUND", "EAI_AGAIN"].includes(err.code) || (err?.response?.status ?? 0) >= 500;
|
|
75
|
-
if (isConnectionError)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
75
|
+
if (!isConnectionError) return Promise.reject(err);
|
|
76
|
+
const fullURL = axios.getUri(err.config);
|
|
77
|
+
const host = new URL(fullURL).host;
|
|
78
|
+
const isPrimaryHost = host === "mowojang.matdoes.dev";
|
|
79
|
+
const isFallbackHost = host === "mowojang.seraph.si";
|
|
80
|
+
const shouldRetryWithFallback = isPrimaryHost && !err.config._retry;
|
|
81
|
+
if (shouldRetryWithFallback) {
|
|
82
|
+
err.config._retry = true;
|
|
83
|
+
err.config.url = fullURL.replace("mowojang.matdoes.dev", "mowojang.seraph.si");
|
|
84
|
+
if (err.config.baseURL) delete err.config.baseURL;
|
|
85
|
+
}
|
|
86
|
+
logger.critical("Mowojang", `Failed to establish connection to ${host}`, err.config.internalId);
|
|
87
|
+
const shouldFallback = shouldRetryWithFallback && options.fallback;
|
|
88
|
+
if (shouldFallback) {
|
|
89
|
+
logger.info("Mowojang", `Retrying request with fallback of mowojang.seraph.si`, err.config.internalId);
|
|
90
|
+
}
|
|
91
|
+
if (isPrimaryHost || isFallbackHost) {
|
|
92
|
+
const service = isFallbackHost ? "Seraph" : "Mowojang";
|
|
93
|
+
logger.info("Mowojang", `Check Status of ${service} on: https://mowojang-status.pixelic.dev`);
|
|
94
94
|
}
|
|
95
|
+
if (shouldFallback) return instance(err.config);
|
|
95
96
|
return Promise.reject(err);
|
|
96
97
|
}
|
|
97
98
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mowojang",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "A simple TypeScript compatible wrapper for the Mowojang-API.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,22 +28,23 @@
|
|
|
28
28
|
"node": ">=22.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"axios": "^1.
|
|
32
|
-
"axios-cache-interceptor": "^1.
|
|
31
|
+
"axios": "^1.20.0",
|
|
32
|
+
"axios-cache-interceptor": "^1.13.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "^10.0.1",
|
|
36
36
|
"@pixelic/logger": "npm:@jsr/pixelic__logger@^0.3.0",
|
|
37
|
-
"@types/node": "^26.
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
39
|
-
"@typescript-eslint/parser": "^8.
|
|
40
|
-
"eslint": "^10.
|
|
37
|
+
"@types/node": "^26.6.5",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
|
39
|
+
"@typescript-eslint/parser": "^8.72.0",
|
|
40
|
+
"eslint": "^10.13.0",
|
|
41
41
|
"eslint-config-prettier": "^10.1.8",
|
|
42
|
-
"eslint-plugin-prettier": "^5.5.
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
43
|
+
"jiti": "^2.7.0",
|
|
44
|
+
"prettier": "^3.9.10",
|
|
45
|
+
"tsup": "^9.0.0",
|
|
45
46
|
"typescript": "^6.0.3",
|
|
46
|
-
"typescript-eslint": "^8.
|
|
47
|
+
"typescript-eslint": "^8.72.0"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "pnpm tsup",
|