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 +2 -2
- package/dist/src/client.js +16 -7
- package/package.json +2 -2
- package/tsconfig.json +1 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mowojang",
|
|
3
|
-
"version": "0.3.
|
|
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": ">=
|
|
27
|
+
"node": ">=22.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"axios": "^1.7.9",
|
package/dist/src/client.js
CHANGED
|
@@ -63,14 +63,23 @@ export default class Client {
|
|
|
63
63
|
*
|
|
64
64
|
*/
|
|
65
65
|
async getProfile(player, config) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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.
|
|
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": ">=
|
|
21
|
+
"node": ">=22.0.0"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"axios": "^1.7.9",
|