mowojang 0.3.6 → 0.3.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mowojang",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "author": "Pixelic",
25
25
  "license": "MIT",
26
26
  "engines": {
27
- "node": ">=20.0.0"
27
+ "node": ">=22.0.0"
28
28
  },
29
29
  "dependencies": {
30
30
  "axios": "^1.7.9",
@@ -63,14 +63,23 @@ export default class Client {
63
63
  *
64
64
  */
65
65
  async getProfile(player, config) {
66
- if (this.shouldValidate(config) && !validatePlayer(player, this.getValidationMinLength(config)))
67
- return { data: null, error: "INVALID_INPUT" };
68
- const profiles = await this.getProfiles([player], config);
69
- if (profiles.error)
70
- return { data: null, error: profiles.error };
71
- if (profiles.data.length === 0)
66
+ try {
67
+ if (this.shouldValidate(config) && !validatePlayer(player, this.getValidationMinLength(config)))
68
+ return { data: null, error: "INVALID_INPUT" };
69
+ const fetchResponse = await this.axios.get(`https://mowojang.matdoes.dev/${player}`, {
70
+ cache: config?.cache ?? { ttl: 15 * 60 * 1000 },
71
+ });
72
+ return {
73
+ data: {
74
+ UUID: fetchResponse.data.id,
75
+ username: fetchResponse.data.name,
76
+ },
77
+ error: null,
78
+ };
79
+ }
80
+ catch {
72
81
  return { data: null, error: "INVALID_PLAYER" };
73
- return { data: profiles.data[0], error: null };
82
+ }
74
83
  }
75
84
  /**
76
85
  * A Simple Wrapper to Retrieve Only the UUID of a Player's Profile
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mowojang",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "description": "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "author": "Pixelic",
19
19
  "license": "MIT",
20
20
  "engines": {
21
- "node": ">=20.0.0"
21
+ "node": ">=22.0.0"
22
22
  },
23
23
  "dependencies": {
24
24
  "axios": "^1.7.9",
package/tsconfig.json CHANGED
@@ -10,6 +10,6 @@
10
10
  "skipDefaultLibCheck": true,
11
11
  "resolveJsonModule": true
12
12
  },
13
- "include": ["src"],
13
+ "include": ["src", "types"],
14
14
  "exclude": ["node_modules"]
15
15
  }