mowojang 0.4.5 → 0.4.6
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/README.md +3 -6
- package/dist/index.d.ts +7 -7
- package/dist/index.js +34 -34
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mowojang
|
|
1
|
+
# mowojang
|
|
2
2
|
|
|
3
3
|

|
|
4
4
|

|
|
@@ -79,12 +79,9 @@ All Validator Functions are exported combined as `validate.x`.
|
|
|
79
79
|
|
|
80
80
|
## 📎 Credits
|
|
81
81
|
|
|
82
|
-
- Mowojang Creator (Mat):
|
|
83
|
-
- [Website](https://matdoes.dev)
|
|
84
|
-
- [GitHub](https://github.com/mat-1)
|
|
85
|
-
- [Ko-Fi](https://ko-fi.com/matdoesdev)
|
|
82
|
+
- Mowojang Creator (Mat): [Website](https://matdoes.dev), [GitHub](https://github.com/mat-1) or [Ko-Fi](https://ko-fi.com/matdoesdev)
|
|
86
83
|
|
|
87
|
-
## 📡 [Status](https://mowojang-status.pixelic.dev/)
|
|
84
|
+
## 📡 [Mowojang Status](https://mowojang-status.pixelic.dev/)
|
|
88
85
|
|
|
89
86
|
<details>
|
|
90
87
|
<summary>Show status badges</summary>
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LoggerConfig } from '@pixelic/logger';
|
|
2
1
|
import { CacheOptions, CacheRequestConfig, buildStorage, buildMemoryStorage } from 'axios-cache-interceptor';
|
|
2
|
+
import { LoggerConfig } from '@pixelic/logger';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Minecraft Username or UUIDv4 (both undashed and dashed will be accepted)
|
|
@@ -95,12 +95,12 @@ declare class Client {
|
|
|
95
95
|
*/
|
|
96
96
|
getProfile(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangProfile, "INVALID_PLAYER">;
|
|
97
97
|
/**
|
|
98
|
-
* A
|
|
98
|
+
* A simple Wrapper to retrieve only the UUID of a Player's Profile
|
|
99
99
|
*
|
|
100
100
|
*/
|
|
101
101
|
getUUID(username: Username, config?: MowojangRequestConfig): Promise<null | UUID>;
|
|
102
102
|
/**
|
|
103
|
-
* A
|
|
103
|
+
* A simple Wrapper to retrieve only the Username of a Player's Profile
|
|
104
104
|
*
|
|
105
105
|
*/
|
|
106
106
|
getUsername(UUID: UUID, config?: MowojangRequestConfig): Promise<null | Username>;
|
|
@@ -116,22 +116,22 @@ declare class Client {
|
|
|
116
116
|
*/
|
|
117
117
|
getSession(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangSession, "INVALID_PLAYER">;
|
|
118
118
|
/**
|
|
119
|
-
* A
|
|
119
|
+
* A simple Wrapper to retrieve only the Skin from a Player's Session
|
|
120
120
|
*
|
|
121
121
|
*/
|
|
122
122
|
getSkin(player: Player, config?: MowojangRequestConfig): Promise<null | MowojangSkin>;
|
|
123
123
|
/**
|
|
124
|
-
* A
|
|
124
|
+
* A simple Wrapper to retrieve only the Player's Skin from their Session Data loaded into a Buffer
|
|
125
125
|
*
|
|
126
126
|
*/
|
|
127
127
|
getSkinBuffer(player: Player, config?: MowojangRequestConfig): Promise<null | Buffer>;
|
|
128
128
|
/**
|
|
129
|
-
* A
|
|
129
|
+
* A simple Wrapper to retrieve only the Cape Data from a Player's Session
|
|
130
130
|
*
|
|
131
131
|
*/
|
|
132
132
|
getCape(player: Player, config?: MowojangRequestConfig): Promise<null | MowojangCape>;
|
|
133
133
|
/**
|
|
134
|
-
* A
|
|
134
|
+
* A simple Wrapper to retrieve only the Player's Cape from their Session Data loaded into a Buffer
|
|
135
135
|
*
|
|
136
136
|
*/
|
|
137
137
|
getCapeBuffer(player: Player, config?: MowojangRequestConfig): Promise<null | Buffer>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
+
// src/utils.ts
|
|
5
|
+
var undashUUID = /* @__PURE__ */ __name((UUID) => UUID.replace(/-/g, "").toLowerCase(), "undashUUID");
|
|
6
|
+
var dashUUID = /* @__PURE__ */ __name((UUID) => undashUUID(UUID).replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5"), "dashUUID");
|
|
7
|
+
|
|
8
|
+
// src/validators.ts
|
|
9
|
+
var validateUUID = /* @__PURE__ */ __name((UUID) => {
|
|
10
|
+
if (typeof UUID !== "string") return false;
|
|
11
|
+
UUID = undashUUID(UUID);
|
|
12
|
+
if (UUID.length !== 32) return false;
|
|
13
|
+
return /[0-9a-f]{12}4[0-9a-f]{19}/.test(UUID);
|
|
14
|
+
}, "validateUUID");
|
|
15
|
+
var validateUsername = /* @__PURE__ */ __name((username, minimumLength) => {
|
|
16
|
+
if (typeof username !== "string") return false;
|
|
17
|
+
if (minimumLength === 1) return /^[a-zA-Z0-9_]{1,16}$/.test(username);
|
|
18
|
+
if (minimumLength === 2) return /^[a-zA-Z0-9_]{2,16}$/.test(username);
|
|
19
|
+
return /^[a-zA-Z0-9_]{3,16}$/.test(username);
|
|
20
|
+
}, "validateUsername");
|
|
21
|
+
var validatePlayer = /* @__PURE__ */ __name((player, minimumUsernameLength) => validateUUID(player) || validateUsername(player, minimumUsernameLength), "validatePlayer");
|
|
22
|
+
var validateArray = /* @__PURE__ */ __name((array, validatorFunction, ...params) => {
|
|
23
|
+
if (!Array.isArray(array)) return false;
|
|
24
|
+
return array.every((item) => validatorFunction(item, ...params));
|
|
25
|
+
}, "validateArray");
|
|
26
|
+
|
|
27
|
+
// src/index.ts
|
|
28
|
+
import { buildStorage, buildMemoryStorage } from "axios-cache-interceptor";
|
|
29
|
+
|
|
4
30
|
// src/client.ts
|
|
5
31
|
import { isAxiosError } from "axios";
|
|
6
32
|
|
|
@@ -11,7 +37,7 @@ import { setupCache } from "axios-cache-interceptor";
|
|
|
11
37
|
// package.json
|
|
12
38
|
var package_default = {
|
|
13
39
|
name: "mowojang",
|
|
14
|
-
version: "0.4.
|
|
40
|
+
version: "0.4.6",
|
|
15
41
|
description: "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
|
|
16
42
|
exports: {
|
|
17
43
|
".": {
|
|
@@ -32,7 +58,7 @@ var package_default = {
|
|
|
32
58
|
},
|
|
33
59
|
repository: {
|
|
34
60
|
type: "git",
|
|
35
|
-
url: "https://github.com/Pixelicc/mowojang
|
|
61
|
+
url: "https://github.com/Pixelicc/mowojang"
|
|
36
62
|
},
|
|
37
63
|
keywords: [
|
|
38
64
|
"Minecraft",
|
|
@@ -124,29 +150,6 @@ var axiosInstance_default = /* @__PURE__ */ __name((options, logger) => {
|
|
|
124
150
|
return instance;
|
|
125
151
|
}, "default");
|
|
126
152
|
|
|
127
|
-
// src/utils.ts
|
|
128
|
-
var undashUUID = /* @__PURE__ */ __name((UUID) => UUID.replace(/-/g, "").toLowerCase(), "undashUUID");
|
|
129
|
-
var dashUUID = /* @__PURE__ */ __name((UUID) => undashUUID(UUID).replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5"), "dashUUID");
|
|
130
|
-
|
|
131
|
-
// src/validators.ts
|
|
132
|
-
var validateUUID = /* @__PURE__ */ __name((UUID) => {
|
|
133
|
-
if (typeof UUID !== "string") return false;
|
|
134
|
-
UUID = undashUUID(UUID);
|
|
135
|
-
if (UUID.length !== 32) return false;
|
|
136
|
-
return /[0-9a-f]{12}4[0-9a-f]{19}/.test(UUID);
|
|
137
|
-
}, "validateUUID");
|
|
138
|
-
var validateUsername = /* @__PURE__ */ __name((username, minimumLength) => {
|
|
139
|
-
if (typeof username !== "string") return false;
|
|
140
|
-
if (minimumLength === 1) return /^[a-zA-Z0-9_]{1,16}$/.test(username);
|
|
141
|
-
if (minimumLength === 2) return /^[a-zA-Z0-9_]{2,16}$/.test(username);
|
|
142
|
-
return /^[a-zA-Z0-9_]{3,16}$/.test(username);
|
|
143
|
-
}, "validateUsername");
|
|
144
|
-
var validatePlayer = /* @__PURE__ */ __name((player, minimumUsernameLength) => validateUUID(player) || validateUsername(player, minimumUsernameLength), "validatePlayer");
|
|
145
|
-
var validateArray = /* @__PURE__ */ __name((array, validatorFunction, ...params) => {
|
|
146
|
-
if (!Array.isArray(array)) return false;
|
|
147
|
-
return array.every((item) => validatorFunction(item, ...params));
|
|
148
|
-
}, "validateArray");
|
|
149
|
-
|
|
150
153
|
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
151
154
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
152
155
|
var wrapAnsi16 = /* @__PURE__ */ __name((offset = 0) => (code) => `\x1B[${code + offset}m`, "wrapAnsi16");
|
|
@@ -827,7 +830,6 @@ var Client = class {
|
|
|
827
830
|
});
|
|
828
831
|
const profiles = (await Promise.all(profilePromises)).filter((p) => p.data !== null).map((p) => p.data);
|
|
829
832
|
return {
|
|
830
|
-
// @ts-ignore
|
|
831
833
|
data: profiles,
|
|
832
834
|
error: null
|
|
833
835
|
};
|
|
@@ -858,7 +860,7 @@ var Client = class {
|
|
|
858
860
|
}
|
|
859
861
|
}
|
|
860
862
|
/**
|
|
861
|
-
* A
|
|
863
|
+
* A simple Wrapper to retrieve only the UUID of a Player's Profile
|
|
862
864
|
*
|
|
863
865
|
*/
|
|
864
866
|
async getUUID(username, config) {
|
|
@@ -867,7 +869,7 @@ var Client = class {
|
|
|
867
869
|
return profile.data.UUID;
|
|
868
870
|
}
|
|
869
871
|
/**
|
|
870
|
-
* A
|
|
872
|
+
* A simple Wrapper to retrieve only the Username of a Player's Profile
|
|
871
873
|
*
|
|
872
874
|
*/
|
|
873
875
|
async getUsername(UUID, config) {
|
|
@@ -894,7 +896,6 @@ var Client = class {
|
|
|
894
896
|
});
|
|
895
897
|
const sessions = (await Promise.all(sessionsPromises)).filter((session) => session.data !== null).map((session) => session.data);
|
|
896
898
|
return {
|
|
897
|
-
// @ts-ignore
|
|
898
899
|
data: sessions,
|
|
899
900
|
error: null
|
|
900
901
|
};
|
|
@@ -953,7 +954,7 @@ var Client = class {
|
|
|
953
954
|
});
|
|
954
955
|
}
|
|
955
956
|
/**
|
|
956
|
-
* A
|
|
957
|
+
* A simple Wrapper to retrieve only the Skin from a Player's Session
|
|
957
958
|
*
|
|
958
959
|
*/
|
|
959
960
|
async getSkin(player, config) {
|
|
@@ -962,7 +963,7 @@ var Client = class {
|
|
|
962
963
|
return session.data.skin;
|
|
963
964
|
}
|
|
964
965
|
/**
|
|
965
|
-
* A
|
|
966
|
+
* A simple Wrapper to retrieve only the Player's Skin from their Session Data loaded into a Buffer
|
|
966
967
|
*
|
|
967
968
|
*/
|
|
968
969
|
async getSkinBuffer(player, config) {
|
|
@@ -975,7 +976,7 @@ var Client = class {
|
|
|
975
976
|
return Buffer.from(fetchResponse.data, "base64");
|
|
976
977
|
}
|
|
977
978
|
/**
|
|
978
|
-
* A
|
|
979
|
+
* A simple Wrapper to retrieve only the Cape Data from a Player's Session
|
|
979
980
|
*
|
|
980
981
|
*/
|
|
981
982
|
async getCape(player, config) {
|
|
@@ -984,7 +985,7 @@ var Client = class {
|
|
|
984
985
|
return session.data.cape;
|
|
985
986
|
}
|
|
986
987
|
/**
|
|
987
|
-
* A
|
|
988
|
+
* A simple Wrapper to retrieve only the Player's Cape from their Session Data loaded into a Buffer
|
|
988
989
|
*
|
|
989
990
|
*/
|
|
990
991
|
async getCapeBuffer(player, config) {
|
|
@@ -999,7 +1000,6 @@ var Client = class {
|
|
|
999
1000
|
};
|
|
1000
1001
|
|
|
1001
1002
|
// src/index.ts
|
|
1002
|
-
import { buildStorage, buildMemoryStorage } from "axios-cache-interceptor";
|
|
1003
1003
|
var validate = {
|
|
1004
1004
|
player: validatePlayer,
|
|
1005
1005
|
UUID: validateUUID,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mowojang",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/Pixelicc/mowojang
|
|
17
|
+
"url": "https://github.com/Pixelicc/mowojang"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
20
20
|
"Minecraft",
|