mowojang 0.8.3 → 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 CHANGED
@@ -296,4 +296,5 @@ declare const cache: {
296
296
  buildMemoryStorage: typeof buildMemoryStorage;
297
297
  };
298
298
 
299
- export { type AxiosOptions, Client, type ClientOptions, type MowojangCache, type MowojangCape, type MowojangError, type MowojangProfile, type MowojangRequestConfig, type MowojangResponse, type MowojangSession, type MowojangSkin, type Player, type UUID, type Username, type ValidationOptions, cache, utils, validate };
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.3"];
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");
@@ -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
- const fullURL = axios.getUri(err.config);
77
- const host = new URL(fullURL).host;
78
- if (host === "mowojang.matdoes.dev" && !err.config._retry) {
79
- err.config._retry = true;
80
- err.config.url = fullURL.replace("mowojang.matdoes.dev", "mowojang.seraph.si");
81
- if (err.config.baseURL) delete err.config.baseURL;
82
- logger.critical("Mowojang", `Failed to establish connection to mowojang.matdoes.dev`, err.config.internalId);
83
- if (options.fallback) {
84
- logger.info("Mowojang", `Retrying request with fallback of mowojang.seraph.si`, err.config.internalId);
85
- }
86
- logger.info("Mowojang", `Check Status of Mowojang on: https://mowojang-status.pixelic.dev`);
87
- if (options.fallback) return instance(err.config);
88
- } else if (host === "mowojang.seraph.si") {
89
- logger.critical("Mowojang", `Failed to establish connection to mowojang.seraph.si`, err.config.internalId);
90
- logger.info("Mowojang", `Check Status of Seraph on: https://mowojang-status.pixelic.dev`);
91
- } else {
92
- logger.critical("Mowojang", `Failed to establish connection to ${host}`, err.config.internalId);
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",
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.16.1",
32
- "axios-cache-interceptor": "^1.12.0"
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.1.2",
38
- "@typescript-eslint/eslint-plugin": "^8.66.0",
39
- "@typescript-eslint/parser": "^8.66.0",
40
- "eslint": "^10.8.0",
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.6",
43
- "prettier": "^3.9.6",
44
- "tsup": "^8.5.1",
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.66.0"
47
+ "typescript-eslint": "^8.72.0"
47
48
  },
48
49
  "scripts": {
49
50
  "build": "pnpm tsup",