mowojang 0.4.7 → 0.4.9
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 +10 -4
- package/dist/index.d.ts +73 -0
- package/dist/index.js +95 -526
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|

|
|
4
4
|

|
|
5
5
|

|
|
6
|
+

|
|
7
|
+

|
|
6
8
|
|
|
7
9
|
> [!IMPORTANT]
|
|
8
|
-
> This is a third party wrapper for the [Mowojang
|
|
10
|
+
> This is a third party wrapper for the [Mowojang](https://mowojang.matdoes.dev/) API!
|
|
9
11
|
|
|
10
12
|
## ✨ Quick Start
|
|
11
13
|
|
|
@@ -69,13 +71,17 @@ All Validator Functions are exported combined as `validate.x`.
|
|
|
69
71
|
|
|
70
72
|
- `UUID()`: Returns whether the provided String is an valid UUID (Accepts both undashed and dashed UUIDv4 Strings)
|
|
71
73
|
- `username()`: Returns whether the provided String is an valid Username (Accepts a second argument stating the minimum length required to pass the validation)
|
|
72
|
-
- `player()
|
|
74
|
+
- `player()`: Combines the above
|
|
75
|
+
|
|
76
|
+
## 📦 CLI
|
|
77
|
+
|
|
78
|
+
You can also use this package from the CLI using [mowojang-cli](https://www.npmjs.com/package/mowojang-cli). ([Repository](https://github.com/Pixelicc/mowojang-cli))
|
|
73
79
|
|
|
74
80
|
## ⚙️ Development
|
|
75
81
|
|
|
76
82
|
- `pnpm install`: Installs all required dependencies
|
|
77
|
-
- `pnpm build`: Runs the
|
|
78
|
-
- `pnpm test`: Runs tests for all
|
|
83
|
+
- `pnpm build`: Runs the compiler
|
|
84
|
+
- `pnpm test`: Runs tests for all functions
|
|
79
85
|
|
|
80
86
|
## 📎 Credits
|
|
81
87
|
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,19 @@ type Username = string;
|
|
|
20
20
|
*/
|
|
21
21
|
type UUID = string;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Options for the Mowojang Client Instance
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```TS
|
|
28
|
+
* const options: ClientOptions = {
|
|
29
|
+
* timeout: 5000,
|
|
30
|
+
* validation: {
|
|
31
|
+
* enabled: true
|
|
32
|
+
* }
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
23
36
|
type ClientOptions = {
|
|
24
37
|
logger?: LoggerConfig;
|
|
25
38
|
validation?: ValidationOptions;
|
|
@@ -78,6 +91,24 @@ declare class Client {
|
|
|
78
91
|
private axios;
|
|
79
92
|
private validation;
|
|
80
93
|
private baseURL;
|
|
94
|
+
/**
|
|
95
|
+
* Creates a new Mowojang Client Instance
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```TS
|
|
99
|
+
* const client = new Client();
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```TS
|
|
104
|
+
* const client = new Client({
|
|
105
|
+
* timeout: 5000,
|
|
106
|
+
* validation: {
|
|
107
|
+
* enabled: true
|
|
108
|
+
* }
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
81
112
|
constructor(clientOptions?: ClientOptions);
|
|
82
113
|
private shouldValidate;
|
|
83
114
|
private getValidationMinLength;
|
|
@@ -85,6 +116,11 @@ declare class Client {
|
|
|
85
116
|
* Returns an Array of Player Profiles consisting of their Usernames and UUIDs
|
|
86
117
|
*
|
|
87
118
|
* Players considered "INVALID" are excluded from the results
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```TS
|
|
122
|
+
* const profiles = await client.getProfiles(["Pixelic", "14727faefbdc4aff848cd2713eb9939e"]);
|
|
123
|
+
* ```
|
|
88
124
|
*/
|
|
89
125
|
getProfiles(players: Player[], config?: MowojangRequestConfig & {
|
|
90
126
|
usePost?: boolean;
|
|
@@ -92,47 +128,84 @@ declare class Client {
|
|
|
92
128
|
/**
|
|
93
129
|
* Returns a Player's Profile consisting of their Username and UUID
|
|
94
130
|
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```TS
|
|
133
|
+
* const profile = await client.getProfile("Pixelic");
|
|
134
|
+
* ```
|
|
95
135
|
*/
|
|
96
136
|
getProfile(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangProfile, "INVALID_PLAYER">;
|
|
97
137
|
/**
|
|
98
138
|
* A simple Wrapper to retrieve only the UUID of a Player's Profile
|
|
99
139
|
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```TS
|
|
142
|
+
* const uuid = await client.getUUID("Pixelic");
|
|
143
|
+
* ```
|
|
100
144
|
*/
|
|
101
145
|
getUUID(username: Username, config?: MowojangRequestConfig): Promise<null | UUID>;
|
|
102
146
|
/**
|
|
103
147
|
* A simple Wrapper to retrieve only the Username of a Player's Profile
|
|
104
148
|
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```TS
|
|
151
|
+
* const username = await client.getUsername("14727faefbdc4aff848cd2713eb9939e");
|
|
152
|
+
* ```
|
|
105
153
|
*/
|
|
106
154
|
getUsername(UUID: UUID, config?: MowojangRequestConfig): Promise<null | Username>;
|
|
107
155
|
/**
|
|
108
156
|
* Returns an Array of Player Sessions consisting of their Usernames, UUIDs, Skins and Capes
|
|
109
157
|
*
|
|
110
158
|
* Players considered "INVALID" are excluded from the results
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```TS
|
|
162
|
+
* const sessions = await client.getSessions(["Pixelic", "14727faefbdc4aff848cd2713eb9939e"]);
|
|
163
|
+
* ```
|
|
111
164
|
*/
|
|
112
165
|
getSessions(players: Player[], config?: MowojangRequestConfig): MowojangResponse<MowojangSession[], undefined>;
|
|
113
166
|
/**
|
|
114
167
|
* Returns a Player's Sessions consisting of their Username, UUID, Skin and Cape
|
|
115
168
|
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```TS
|
|
171
|
+
* const session = await client.getSession("Pixelic");
|
|
172
|
+
* ```
|
|
116
173
|
*/
|
|
117
174
|
getSession(player: Player, config?: MowojangRequestConfig): MowojangResponse<MowojangSession, "INVALID_PLAYER">;
|
|
118
175
|
/**
|
|
119
176
|
* A simple Wrapper to retrieve only the Skin from a Player's Session
|
|
120
177
|
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```TS
|
|
180
|
+
* const skin = await client.getSkin("Pixelic");
|
|
181
|
+
* ```
|
|
121
182
|
*/
|
|
122
183
|
getSkin(player: Player, config?: MowojangRequestConfig): Promise<null | MowojangSkin>;
|
|
123
184
|
/**
|
|
124
185
|
* A simple Wrapper to retrieve only the Player's Skin from their Session Data loaded into a Buffer
|
|
125
186
|
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```TS
|
|
189
|
+
* const skinBuffer = await client.getSkinBuffer("Pixelic");
|
|
190
|
+
* ```
|
|
126
191
|
*/
|
|
127
192
|
getSkinBuffer(player: Player, config?: MowojangRequestConfig): Promise<null | Buffer>;
|
|
128
193
|
/**
|
|
129
194
|
* A simple Wrapper to retrieve only the Cape Data from a Player's Session
|
|
130
195
|
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```TS
|
|
198
|
+
* const cape = await client.getCape("Pixelic");
|
|
199
|
+
* ```
|
|
131
200
|
*/
|
|
132
201
|
getCape(player: Player, config?: MowojangRequestConfig): Promise<null | MowojangCape>;
|
|
133
202
|
/**
|
|
134
203
|
* A simple Wrapper to retrieve only the Player's Cape from their Session Data loaded into a Buffer
|
|
135
204
|
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```TS
|
|
207
|
+
* const capeBuffer = await client.getCapeBuffer("Pixelic");
|
|
208
|
+
* ```
|
|
136
209
|
*/
|
|
137
210
|
getCapeBuffer(player: Player, config?: MowojangRequestConfig): Promise<null | Buffer>;
|
|
138
211
|
}
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ import { setupCache } from "axios-cache-interceptor";
|
|
|
37
37
|
// package.json
|
|
38
38
|
var package_default = {
|
|
39
39
|
name: "mowojang",
|
|
40
|
-
version: "0.4.
|
|
40
|
+
version: "0.4.9",
|
|
41
41
|
description: "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
|
|
42
42
|
exports: {
|
|
43
43
|
".": {
|
|
@@ -76,8 +76,8 @@ var package_default = {
|
|
|
76
76
|
"axios-cache-interceptor": "^1.12.0"
|
|
77
77
|
},
|
|
78
78
|
devDependencies: {
|
|
79
|
+
"@pixelic/logger": "jsr:~0.2.0",
|
|
79
80
|
"@types/node": "^25.9.1",
|
|
80
|
-
"@pixelic/logger": "npm:@jsr/pixelic__logger@^0.0.6",
|
|
81
81
|
tsup: "^8.5.1",
|
|
82
82
|
typescript: "^6.0.3"
|
|
83
83
|
}
|
|
@@ -150,511 +150,18 @@ var axiosInstance_default = /* @__PURE__ */ __name((options, logger) => {
|
|
|
150
150
|
return instance;
|
|
151
151
|
}, "default");
|
|
152
152
|
|
|
153
|
-
// node_modules/.pnpm
|
|
154
|
-
var
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
italic: [3, 23],
|
|
165
|
-
underline: [4, 24],
|
|
166
|
-
overline: [53, 55],
|
|
167
|
-
inverse: [7, 27],
|
|
168
|
-
hidden: [8, 28],
|
|
169
|
-
strikethrough: [9, 29]
|
|
170
|
-
},
|
|
171
|
-
color: {
|
|
172
|
-
black: [30, 39],
|
|
173
|
-
red: [31, 39],
|
|
174
|
-
green: [32, 39],
|
|
175
|
-
yellow: [33, 39],
|
|
176
|
-
blue: [34, 39],
|
|
177
|
-
magenta: [35, 39],
|
|
178
|
-
cyan: [36, 39],
|
|
179
|
-
white: [37, 39],
|
|
180
|
-
// Bright color
|
|
181
|
-
blackBright: [90, 39],
|
|
182
|
-
gray: [90, 39],
|
|
183
|
-
// Alias of `blackBright`
|
|
184
|
-
grey: [90, 39],
|
|
185
|
-
// Alias of `blackBright`
|
|
186
|
-
redBright: [91, 39],
|
|
187
|
-
greenBright: [92, 39],
|
|
188
|
-
yellowBright: [93, 39],
|
|
189
|
-
blueBright: [94, 39],
|
|
190
|
-
magentaBright: [95, 39],
|
|
191
|
-
cyanBright: [96, 39],
|
|
192
|
-
whiteBright: [97, 39]
|
|
193
|
-
},
|
|
194
|
-
bgColor: {
|
|
195
|
-
bgBlack: [40, 49],
|
|
196
|
-
bgRed: [41, 49],
|
|
197
|
-
bgGreen: [42, 49],
|
|
198
|
-
bgYellow: [43, 49],
|
|
199
|
-
bgBlue: [44, 49],
|
|
200
|
-
bgMagenta: [45, 49],
|
|
201
|
-
bgCyan: [46, 49],
|
|
202
|
-
bgWhite: [47, 49],
|
|
203
|
-
// Bright color
|
|
204
|
-
bgBlackBright: [100, 49],
|
|
205
|
-
bgGray: [100, 49],
|
|
206
|
-
// Alias of `bgBlackBright`
|
|
207
|
-
bgGrey: [100, 49],
|
|
208
|
-
// Alias of `bgBlackBright`
|
|
209
|
-
bgRedBright: [101, 49],
|
|
210
|
-
bgGreenBright: [102, 49],
|
|
211
|
-
bgYellowBright: [103, 49],
|
|
212
|
-
bgBlueBright: [104, 49],
|
|
213
|
-
bgMagentaBright: [105, 49],
|
|
214
|
-
bgCyanBright: [106, 49],
|
|
215
|
-
bgWhiteBright: [107, 49]
|
|
216
|
-
}
|
|
153
|
+
// node_modules/.pnpm/@jsr+pixelic__logger@0.2.0/node_modules/@jsr/pixelic__logger/src/index.js
|
|
154
|
+
var ANSI = {
|
|
155
|
+
reset: "\x1B[0m",
|
|
156
|
+
gray: "\x1B[90m",
|
|
157
|
+
white: "\x1B[37m",
|
|
158
|
+
greenBright: "\x1B[92m",
|
|
159
|
+
red: "\x1B[31m",
|
|
160
|
+
bgRed: "\x1B[41m",
|
|
161
|
+
yellow: "\x1B[33m",
|
|
162
|
+
blue: "\x1B[34m",
|
|
163
|
+
cyan: "\x1B[36m"
|
|
217
164
|
};
|
|
218
|
-
var modifierNames = Object.keys(styles.modifier);
|
|
219
|
-
var foregroundColorNames = Object.keys(styles.color);
|
|
220
|
-
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
221
|
-
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
222
|
-
function assembleStyles() {
|
|
223
|
-
const codes = /* @__PURE__ */ new Map();
|
|
224
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
225
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
226
|
-
styles[styleName] = {
|
|
227
|
-
open: `\x1B[${style[0]}m`,
|
|
228
|
-
close: `\x1B[${style[1]}m`
|
|
229
|
-
};
|
|
230
|
-
group[styleName] = styles[styleName];
|
|
231
|
-
codes.set(style[0], style[1]);
|
|
232
|
-
}
|
|
233
|
-
Object.defineProperty(styles, groupName, {
|
|
234
|
-
value: group,
|
|
235
|
-
enumerable: false
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
Object.defineProperty(styles, "codes", {
|
|
239
|
-
value: codes,
|
|
240
|
-
enumerable: false
|
|
241
|
-
});
|
|
242
|
-
styles.color.close = "\x1B[39m";
|
|
243
|
-
styles.bgColor.close = "\x1B[49m";
|
|
244
|
-
styles.color.ansi = wrapAnsi16();
|
|
245
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
246
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
247
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
248
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
249
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
250
|
-
Object.defineProperties(styles, {
|
|
251
|
-
rgbToAnsi256: {
|
|
252
|
-
value(red, green, blue) {
|
|
253
|
-
if (red === green && green === blue) {
|
|
254
|
-
if (red < 8) {
|
|
255
|
-
return 16;
|
|
256
|
-
}
|
|
257
|
-
if (red > 248) {
|
|
258
|
-
return 231;
|
|
259
|
-
}
|
|
260
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
261
|
-
}
|
|
262
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
263
|
-
},
|
|
264
|
-
enumerable: false
|
|
265
|
-
},
|
|
266
|
-
hexToRgb: {
|
|
267
|
-
value(hex) {
|
|
268
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
269
|
-
if (!matches) {
|
|
270
|
-
return [0, 0, 0];
|
|
271
|
-
}
|
|
272
|
-
let [colorString] = matches;
|
|
273
|
-
if (colorString.length === 3) {
|
|
274
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
275
|
-
}
|
|
276
|
-
const integer = Number.parseInt(colorString, 16);
|
|
277
|
-
return [
|
|
278
|
-
/* eslint-disable no-bitwise */
|
|
279
|
-
integer >> 16 & 255,
|
|
280
|
-
integer >> 8 & 255,
|
|
281
|
-
integer & 255
|
|
282
|
-
/* eslint-enable no-bitwise */
|
|
283
|
-
];
|
|
284
|
-
},
|
|
285
|
-
enumerable: false
|
|
286
|
-
},
|
|
287
|
-
hexToAnsi256: {
|
|
288
|
-
value: /* @__PURE__ */ __name((hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)), "value"),
|
|
289
|
-
enumerable: false
|
|
290
|
-
},
|
|
291
|
-
ansi256ToAnsi: {
|
|
292
|
-
value(code) {
|
|
293
|
-
if (code < 8) {
|
|
294
|
-
return 30 + code;
|
|
295
|
-
}
|
|
296
|
-
if (code < 16) {
|
|
297
|
-
return 90 + (code - 8);
|
|
298
|
-
}
|
|
299
|
-
let red;
|
|
300
|
-
let green;
|
|
301
|
-
let blue;
|
|
302
|
-
if (code >= 232) {
|
|
303
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
304
|
-
green = red;
|
|
305
|
-
blue = red;
|
|
306
|
-
} else {
|
|
307
|
-
code -= 16;
|
|
308
|
-
const remainder = code % 36;
|
|
309
|
-
red = Math.floor(code / 36) / 5;
|
|
310
|
-
green = Math.floor(remainder / 6) / 5;
|
|
311
|
-
blue = remainder % 6 / 5;
|
|
312
|
-
}
|
|
313
|
-
const value = Math.max(red, green, blue) * 2;
|
|
314
|
-
if (value === 0) {
|
|
315
|
-
return 30;
|
|
316
|
-
}
|
|
317
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
318
|
-
if (value === 2) {
|
|
319
|
-
result += 60;
|
|
320
|
-
}
|
|
321
|
-
return result;
|
|
322
|
-
},
|
|
323
|
-
enumerable: false
|
|
324
|
-
},
|
|
325
|
-
rgbToAnsi: {
|
|
326
|
-
value: /* @__PURE__ */ __name((red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), "value"),
|
|
327
|
-
enumerable: false
|
|
328
|
-
},
|
|
329
|
-
hexToAnsi: {
|
|
330
|
-
value: /* @__PURE__ */ __name((hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), "value"),
|
|
331
|
-
enumerable: false
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
return styles;
|
|
335
|
-
}
|
|
336
|
-
__name(assembleStyles, "assembleStyles");
|
|
337
|
-
var ansiStyles = assembleStyles();
|
|
338
|
-
var ansi_styles_default = ansiStyles;
|
|
339
|
-
|
|
340
|
-
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
341
|
-
import process from "process";
|
|
342
|
-
import os from "os";
|
|
343
|
-
import tty from "tty";
|
|
344
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
|
|
345
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
346
|
-
const position = argv.indexOf(prefix + flag);
|
|
347
|
-
const terminatorPosition = argv.indexOf("--");
|
|
348
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
349
|
-
}
|
|
350
|
-
__name(hasFlag, "hasFlag");
|
|
351
|
-
var { env } = process;
|
|
352
|
-
var flagForceColor;
|
|
353
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
354
|
-
flagForceColor = 0;
|
|
355
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
356
|
-
flagForceColor = 1;
|
|
357
|
-
}
|
|
358
|
-
function envForceColor() {
|
|
359
|
-
if ("FORCE_COLOR" in env) {
|
|
360
|
-
if (env.FORCE_COLOR === "true") {
|
|
361
|
-
return 1;
|
|
362
|
-
}
|
|
363
|
-
if (env.FORCE_COLOR === "false") {
|
|
364
|
-
return 0;
|
|
365
|
-
}
|
|
366
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
__name(envForceColor, "envForceColor");
|
|
370
|
-
function translateLevel(level) {
|
|
371
|
-
if (level === 0) {
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
return {
|
|
375
|
-
level,
|
|
376
|
-
hasBasic: true,
|
|
377
|
-
has256: level >= 2,
|
|
378
|
-
has16m: level >= 3
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
__name(translateLevel, "translateLevel");
|
|
382
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
383
|
-
const noFlagForceColor = envForceColor();
|
|
384
|
-
if (noFlagForceColor !== void 0) {
|
|
385
|
-
flagForceColor = noFlagForceColor;
|
|
386
|
-
}
|
|
387
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
388
|
-
if (forceColor === 0) {
|
|
389
|
-
return 0;
|
|
390
|
-
}
|
|
391
|
-
if (sniffFlags) {
|
|
392
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
393
|
-
return 3;
|
|
394
|
-
}
|
|
395
|
-
if (hasFlag("color=256")) {
|
|
396
|
-
return 2;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
400
|
-
return 1;
|
|
401
|
-
}
|
|
402
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
403
|
-
return 0;
|
|
404
|
-
}
|
|
405
|
-
const min = forceColor || 0;
|
|
406
|
-
if (env.TERM === "dumb") {
|
|
407
|
-
return min;
|
|
408
|
-
}
|
|
409
|
-
if (process.platform === "win32") {
|
|
410
|
-
const osRelease = os.release().split(".");
|
|
411
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
412
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
413
|
-
}
|
|
414
|
-
return 1;
|
|
415
|
-
}
|
|
416
|
-
if ("CI" in env) {
|
|
417
|
-
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
418
|
-
return 3;
|
|
419
|
-
}
|
|
420
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
421
|
-
return 1;
|
|
422
|
-
}
|
|
423
|
-
return min;
|
|
424
|
-
}
|
|
425
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
426
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
427
|
-
}
|
|
428
|
-
if (env.COLORTERM === "truecolor") {
|
|
429
|
-
return 3;
|
|
430
|
-
}
|
|
431
|
-
if (env.TERM === "xterm-kitty") {
|
|
432
|
-
return 3;
|
|
433
|
-
}
|
|
434
|
-
if (env.TERM === "xterm-ghostty") {
|
|
435
|
-
return 3;
|
|
436
|
-
}
|
|
437
|
-
if (env.TERM === "wezterm") {
|
|
438
|
-
return 3;
|
|
439
|
-
}
|
|
440
|
-
if ("TERM_PROGRAM" in env) {
|
|
441
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
442
|
-
switch (env.TERM_PROGRAM) {
|
|
443
|
-
case "iTerm.app": {
|
|
444
|
-
return version >= 3 ? 3 : 2;
|
|
445
|
-
}
|
|
446
|
-
case "Apple_Terminal": {
|
|
447
|
-
return 2;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
452
|
-
return 2;
|
|
453
|
-
}
|
|
454
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
455
|
-
return 1;
|
|
456
|
-
}
|
|
457
|
-
if ("COLORTERM" in env) {
|
|
458
|
-
return 1;
|
|
459
|
-
}
|
|
460
|
-
return min;
|
|
461
|
-
}
|
|
462
|
-
__name(_supportsColor, "_supportsColor");
|
|
463
|
-
function createSupportsColor(stream, options = {}) {
|
|
464
|
-
const level = _supportsColor(stream, {
|
|
465
|
-
streamIsTTY: stream && stream.isTTY,
|
|
466
|
-
...options
|
|
467
|
-
});
|
|
468
|
-
return translateLevel(level);
|
|
469
|
-
}
|
|
470
|
-
__name(createSupportsColor, "createSupportsColor");
|
|
471
|
-
var supportsColor = {
|
|
472
|
-
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
473
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
474
|
-
};
|
|
475
|
-
var supports_color_default = supportsColor;
|
|
476
|
-
|
|
477
|
-
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
478
|
-
function stringReplaceAll(string, substring, replacer) {
|
|
479
|
-
let index = string.indexOf(substring);
|
|
480
|
-
if (index === -1) {
|
|
481
|
-
return string;
|
|
482
|
-
}
|
|
483
|
-
const substringLength = substring.length;
|
|
484
|
-
let endIndex = 0;
|
|
485
|
-
let returnValue = "";
|
|
486
|
-
do {
|
|
487
|
-
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
488
|
-
endIndex = index + substringLength;
|
|
489
|
-
index = string.indexOf(substring, endIndex);
|
|
490
|
-
} while (index !== -1);
|
|
491
|
-
returnValue += string.slice(endIndex);
|
|
492
|
-
return returnValue;
|
|
493
|
-
}
|
|
494
|
-
__name(stringReplaceAll, "stringReplaceAll");
|
|
495
|
-
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
496
|
-
let endIndex = 0;
|
|
497
|
-
let returnValue = "";
|
|
498
|
-
do {
|
|
499
|
-
const gotCR = string[index - 1] === "\r";
|
|
500
|
-
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
501
|
-
endIndex = index + 1;
|
|
502
|
-
index = string.indexOf("\n", endIndex);
|
|
503
|
-
} while (index !== -1);
|
|
504
|
-
returnValue += string.slice(endIndex);
|
|
505
|
-
return returnValue;
|
|
506
|
-
}
|
|
507
|
-
__name(stringEncaseCRLFWithFirstIndex, "stringEncaseCRLFWithFirstIndex");
|
|
508
|
-
|
|
509
|
-
// node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
510
|
-
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
511
|
-
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
512
|
-
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
513
|
-
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
514
|
-
var levelMapping = [
|
|
515
|
-
"ansi",
|
|
516
|
-
"ansi",
|
|
517
|
-
"ansi256",
|
|
518
|
-
"ansi16m"
|
|
519
|
-
];
|
|
520
|
-
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
521
|
-
var applyOptions = /* @__PURE__ */ __name((object, options = {}) => {
|
|
522
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
523
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
524
|
-
}
|
|
525
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
526
|
-
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
527
|
-
}, "applyOptions");
|
|
528
|
-
var chalkFactory = /* @__PURE__ */ __name((options) => {
|
|
529
|
-
const chalk2 = /* @__PURE__ */ __name((...strings) => strings.join(" "), "chalk");
|
|
530
|
-
applyOptions(chalk2, options);
|
|
531
|
-
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
532
|
-
return chalk2;
|
|
533
|
-
}, "chalkFactory");
|
|
534
|
-
function createChalk(options) {
|
|
535
|
-
return chalkFactory(options);
|
|
536
|
-
}
|
|
537
|
-
__name(createChalk, "createChalk");
|
|
538
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
539
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
540
|
-
styles2[styleName] = {
|
|
541
|
-
get() {
|
|
542
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
543
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
544
|
-
return builder;
|
|
545
|
-
}
|
|
546
|
-
};
|
|
547
|
-
}
|
|
548
|
-
styles2.visible = {
|
|
549
|
-
get() {
|
|
550
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
551
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
552
|
-
return builder;
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
var getModelAnsi = /* @__PURE__ */ __name((model, level, type, ...arguments_) => {
|
|
556
|
-
if (model === "rgb") {
|
|
557
|
-
if (level === "ansi16m") {
|
|
558
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
559
|
-
}
|
|
560
|
-
if (level === "ansi256") {
|
|
561
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
562
|
-
}
|
|
563
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
564
|
-
}
|
|
565
|
-
if (model === "hex") {
|
|
566
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
567
|
-
}
|
|
568
|
-
return ansi_styles_default[type][model](...arguments_);
|
|
569
|
-
}, "getModelAnsi");
|
|
570
|
-
var usedModels = ["rgb", "hex", "ansi256"];
|
|
571
|
-
for (const model of usedModels) {
|
|
572
|
-
styles2[model] = {
|
|
573
|
-
get() {
|
|
574
|
-
const { level } = this;
|
|
575
|
-
return function(...arguments_) {
|
|
576
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
577
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
582
|
-
styles2[bgModel] = {
|
|
583
|
-
get() {
|
|
584
|
-
const { level } = this;
|
|
585
|
-
return function(...arguments_) {
|
|
586
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
587
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
var proto = Object.defineProperties(() => {
|
|
593
|
-
}, {
|
|
594
|
-
...styles2,
|
|
595
|
-
level: {
|
|
596
|
-
enumerable: true,
|
|
597
|
-
get() {
|
|
598
|
-
return this[GENERATOR].level;
|
|
599
|
-
},
|
|
600
|
-
set(level) {
|
|
601
|
-
this[GENERATOR].level = level;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
var createStyler = /* @__PURE__ */ __name((open, close, parent) => {
|
|
606
|
-
let openAll;
|
|
607
|
-
let closeAll;
|
|
608
|
-
if (parent === void 0) {
|
|
609
|
-
openAll = open;
|
|
610
|
-
closeAll = close;
|
|
611
|
-
} else {
|
|
612
|
-
openAll = parent.openAll + open;
|
|
613
|
-
closeAll = close + parent.closeAll;
|
|
614
|
-
}
|
|
615
|
-
return {
|
|
616
|
-
open,
|
|
617
|
-
close,
|
|
618
|
-
openAll,
|
|
619
|
-
closeAll,
|
|
620
|
-
parent
|
|
621
|
-
};
|
|
622
|
-
}, "createStyler");
|
|
623
|
-
var createBuilder = /* @__PURE__ */ __name((self, _styler, _isEmpty) => {
|
|
624
|
-
const builder = /* @__PURE__ */ __name((...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" ")), "builder");
|
|
625
|
-
Object.setPrototypeOf(builder, proto);
|
|
626
|
-
builder[GENERATOR] = self;
|
|
627
|
-
builder[STYLER] = _styler;
|
|
628
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
629
|
-
return builder;
|
|
630
|
-
}, "createBuilder");
|
|
631
|
-
var applyStyle = /* @__PURE__ */ __name((self, string) => {
|
|
632
|
-
if (self.level <= 0 || !string) {
|
|
633
|
-
return self[IS_EMPTY] ? "" : string;
|
|
634
|
-
}
|
|
635
|
-
let styler = self[STYLER];
|
|
636
|
-
if (styler === void 0) {
|
|
637
|
-
return string;
|
|
638
|
-
}
|
|
639
|
-
const { openAll, closeAll } = styler;
|
|
640
|
-
if (string.includes("\x1B")) {
|
|
641
|
-
while (styler !== void 0) {
|
|
642
|
-
string = stringReplaceAll(string, styler.close, styler.open);
|
|
643
|
-
styler = styler.parent;
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
const lfIndex = string.indexOf("\n");
|
|
647
|
-
if (lfIndex !== -1) {
|
|
648
|
-
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
649
|
-
}
|
|
650
|
-
return openAll + string + closeAll;
|
|
651
|
-
}, "applyStyle");
|
|
652
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
653
|
-
var chalk = createChalk();
|
|
654
|
-
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
655
|
-
var source_default = chalk;
|
|
656
|
-
|
|
657
|
-
// node_modules/.pnpm/@jsr+pixelic__logger@0.0.6/node_modules/@jsr/pixelic__logger/src/index.js
|
|
658
165
|
var LogLevels = /* @__PURE__ */ (function(LogLevels2) {
|
|
659
166
|
LogLevels2[LogLevels2["TRACE"] = 1] = "TRACE";
|
|
660
167
|
LogLevels2[LogLevels2["DEBUG"] = 2] = "DEBUG";
|
|
@@ -690,27 +197,29 @@ var Logger = class {
|
|
|
690
197
|
* @param msg Message to log
|
|
691
198
|
* @param level Log Level
|
|
692
199
|
*/
|
|
693
|
-
log(service, msg, level) {
|
|
200
|
+
log(service, msg, level, id) {
|
|
694
201
|
if (!this.satisfiesMinLevel(level)) return;
|
|
695
|
-
const
|
|
202
|
+
const dateStr = `${String((/* @__PURE__ */ new Date()).getHours()).padStart(2, "0")}:${String((/* @__PURE__ */ new Date()).getMinutes()).padStart(2, "0")}:${String((/* @__PURE__ */ new Date()).getSeconds()).padStart(2, "0")}`;
|
|
203
|
+
const formattedDate = `${ANSI.white}${dateStr}${ANSI.reset}`;
|
|
204
|
+
const greenService = `${ANSI.greenBright}${service}${ANSI.reset}`;
|
|
696
205
|
switch (level) {
|
|
697
206
|
case "CRITICAL":
|
|
698
|
-
console.error(`[${
|
|
207
|
+
console.error(`[${formattedDate}] [${greenService}] [${ANSI.bgRed}${level}${ANSI.reset}] \xBB ${id ? "(" + id + ") " : ""}${ANSI.bgRed}${msg}${ANSI.reset}`);
|
|
699
208
|
break;
|
|
700
209
|
case "ERROR":
|
|
701
|
-
console.error(`[${
|
|
210
|
+
console.error(`[${formattedDate}] [${greenService}] [${ANSI.red}${level}${ANSI.reset}] \xBB ${id ? "(" + id + ") " : ""}${ANSI.red}${msg}${ANSI.reset}`);
|
|
702
211
|
break;
|
|
703
212
|
case "WARNING":
|
|
704
|
-
console.warn(`[${
|
|
213
|
+
console.warn(`[${formattedDate}] [${greenService}] [${ANSI.yellow}${level}${ANSI.reset}] \xBB ${id ? "(" + id + ") " : ""}${ANSI.yellow}${msg}${ANSI.reset}`);
|
|
705
214
|
break;
|
|
706
215
|
case "INFO":
|
|
707
|
-
console.log(`[${
|
|
216
|
+
console.log(`[${formattedDate}] [${greenService}] [${ANSI.blue}${level}${ANSI.reset}] \xBB ${id ? "(" + id + ") " : ""}${ANSI.blue}${msg}${ANSI.reset}`);
|
|
708
217
|
break;
|
|
709
218
|
case "DEBUG":
|
|
710
|
-
console.log(`[${
|
|
219
|
+
console.log(`[${formattedDate}] [${greenService}] [${ANSI.cyan}${level}${ANSI.reset}] \xBB ${id ? "(" + id + ") " : ""}${ANSI.cyan}${msg}${ANSI.reset}`);
|
|
711
220
|
break;
|
|
712
221
|
case "TRACE":
|
|
713
|
-
console.log(`[${
|
|
222
|
+
console.log(`[${formattedDate}] [${greenService}] [${ANSI.gray}${level}${ANSI.reset}] \xBB ${id ? "(" + id + ") " : ""}${ANSI.gray}${msg}${ANSI.reset}`);
|
|
714
223
|
break;
|
|
715
224
|
}
|
|
716
225
|
}
|
|
@@ -720,8 +229,8 @@ var Logger = class {
|
|
|
720
229
|
* @param service Service that emitted the log call
|
|
721
230
|
* @param msg Message to log
|
|
722
231
|
*/
|
|
723
|
-
critical(service, msg) {
|
|
724
|
-
this.log(service, msg, "CRITICAL");
|
|
232
|
+
critical(service, msg, id) {
|
|
233
|
+
this.log(service, msg, "CRITICAL", id);
|
|
725
234
|
}
|
|
726
235
|
/**
|
|
727
236
|
* @public Logs a message to the console using the runtime's default console implementation with the **ERROR** Level
|
|
@@ -729,8 +238,8 @@ var Logger = class {
|
|
|
729
238
|
* @param service Service that emitted the log call
|
|
730
239
|
* @param msg Message to log
|
|
731
240
|
*/
|
|
732
|
-
error(service, msg) {
|
|
733
|
-
this.log(service, msg, "ERROR");
|
|
241
|
+
error(service, msg, id) {
|
|
242
|
+
this.log(service, msg, "ERROR", id);
|
|
734
243
|
}
|
|
735
244
|
/**
|
|
736
245
|
* @public Logs a message to the console using the runtime's default console implementation with the **WARNING** Level
|
|
@@ -738,8 +247,8 @@ var Logger = class {
|
|
|
738
247
|
* @param service Service that emitted the log call
|
|
739
248
|
* @param msg Message to log
|
|
740
249
|
*/
|
|
741
|
-
warning(service, msg) {
|
|
742
|
-
this.log(service, msg, "WARNING");
|
|
250
|
+
warning(service, msg, id) {
|
|
251
|
+
this.log(service, msg, "WARNING", id);
|
|
743
252
|
}
|
|
744
253
|
/**
|
|
745
254
|
* @public Logs a message to the console using the runtime's default console implementation with the **INFO** Level
|
|
@@ -747,8 +256,8 @@ var Logger = class {
|
|
|
747
256
|
* @param service Service that emitted the log call
|
|
748
257
|
* @param msg Message to log
|
|
749
258
|
*/
|
|
750
|
-
info(service, msg) {
|
|
751
|
-
this.log(service, msg, "INFO");
|
|
259
|
+
info(service, msg, id) {
|
|
260
|
+
this.log(service, msg, "INFO", id);
|
|
752
261
|
}
|
|
753
262
|
/**
|
|
754
263
|
* @public Logs a message to the console using the runtime's default console implementation with the **DEBUG** Level
|
|
@@ -756,8 +265,8 @@ var Logger = class {
|
|
|
756
265
|
* @param service Service that emitted the log call
|
|
757
266
|
* @param msg Message to log
|
|
758
267
|
*/
|
|
759
|
-
debug(service, msg) {
|
|
760
|
-
this.log(service, msg, "DEBUG");
|
|
268
|
+
debug(service, msg, id) {
|
|
269
|
+
this.log(service, msg, "DEBUG", id);
|
|
761
270
|
}
|
|
762
271
|
/**
|
|
763
272
|
* @public Logs a message to the console using the runtime's default console implementation with the **TRACE** Level
|
|
@@ -765,8 +274,8 @@ var Logger = class {
|
|
|
765
274
|
* @param service Service that emitted the log call
|
|
766
275
|
* @param msg Message to log
|
|
767
276
|
*/
|
|
768
|
-
trace(service, msg) {
|
|
769
|
-
this.log(service, msg, "TRACE");
|
|
277
|
+
trace(service, msg, id) {
|
|
278
|
+
this.log(service, msg, "TRACE", id);
|
|
770
279
|
}
|
|
771
280
|
};
|
|
772
281
|
|
|
@@ -779,6 +288,24 @@ var Client = class {
|
|
|
779
288
|
axios;
|
|
780
289
|
validation;
|
|
781
290
|
baseURL;
|
|
291
|
+
/**
|
|
292
|
+
* Creates a new Mowojang Client Instance
|
|
293
|
+
*
|
|
294
|
+
* @example
|
|
295
|
+
* ```TS
|
|
296
|
+
* const client = new Client();
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```TS
|
|
301
|
+
* const client = new Client({
|
|
302
|
+
* timeout: 5000,
|
|
303
|
+
* validation: {
|
|
304
|
+
* enabled: true
|
|
305
|
+
* }
|
|
306
|
+
* });
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
782
309
|
constructor(clientOptions) {
|
|
783
310
|
this.logger = new Logger(clientOptions?.logger);
|
|
784
311
|
this.validation = clientOptions?.validation ?? {};
|
|
@@ -799,6 +326,11 @@ var Client = class {
|
|
|
799
326
|
* Returns an Array of Player Profiles consisting of their Usernames and UUIDs
|
|
800
327
|
*
|
|
801
328
|
* Players considered "INVALID" are excluded from the results
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```TS
|
|
332
|
+
* const profiles = await client.getProfiles(["Pixelic", "14727faefbdc4aff848cd2713eb9939e"]);
|
|
333
|
+
* ```
|
|
802
334
|
*/
|
|
803
335
|
async getProfiles(players, config) {
|
|
804
336
|
try {
|
|
@@ -840,6 +372,10 @@ var Client = class {
|
|
|
840
372
|
/**
|
|
841
373
|
* Returns a Player's Profile consisting of their Username and UUID
|
|
842
374
|
*
|
|
375
|
+
* @example
|
|
376
|
+
* ```TS
|
|
377
|
+
* const profile = await client.getProfile("Pixelic");
|
|
378
|
+
* ```
|
|
843
379
|
*/
|
|
844
380
|
async getProfile(player, config) {
|
|
845
381
|
try {
|
|
@@ -862,6 +398,10 @@ var Client = class {
|
|
|
862
398
|
/**
|
|
863
399
|
* A simple Wrapper to retrieve only the UUID of a Player's Profile
|
|
864
400
|
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```TS
|
|
403
|
+
* const uuid = await client.getUUID("Pixelic");
|
|
404
|
+
* ```
|
|
865
405
|
*/
|
|
866
406
|
async getUUID(username, config) {
|
|
867
407
|
const profile = await this.getProfile(username, config);
|
|
@@ -871,6 +411,10 @@ var Client = class {
|
|
|
871
411
|
/**
|
|
872
412
|
* A simple Wrapper to retrieve only the Username of a Player's Profile
|
|
873
413
|
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```TS
|
|
416
|
+
* const username = await client.getUsername("14727faefbdc4aff848cd2713eb9939e");
|
|
417
|
+
* ```
|
|
874
418
|
*/
|
|
875
419
|
async getUsername(UUID, config) {
|
|
876
420
|
const profile = await this.getProfile(UUID, config);
|
|
@@ -881,6 +425,11 @@ var Client = class {
|
|
|
881
425
|
* Returns an Array of Player Sessions consisting of their Usernames, UUIDs, Skins and Capes
|
|
882
426
|
*
|
|
883
427
|
* Players considered "INVALID" are excluded from the results
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```TS
|
|
431
|
+
* const sessions = await client.getSessions(["Pixelic", "14727faefbdc4aff848cd2713eb9939e"]);
|
|
432
|
+
* ```
|
|
884
433
|
*/
|
|
885
434
|
async getSessions(players, config) {
|
|
886
435
|
try {
|
|
@@ -906,6 +455,10 @@ var Client = class {
|
|
|
906
455
|
/**
|
|
907
456
|
* Returns a Player's Sessions consisting of their Username, UUID, Skin and Cape
|
|
908
457
|
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```TS
|
|
460
|
+
* const session = await client.getSession("Pixelic");
|
|
461
|
+
* ```
|
|
909
462
|
*/
|
|
910
463
|
async getSession(player, config) {
|
|
911
464
|
if (this.shouldValidate(config) && !validatePlayer(player, this.getValidationMinLength(config)))
|
|
@@ -956,6 +509,10 @@ var Client = class {
|
|
|
956
509
|
/**
|
|
957
510
|
* A simple Wrapper to retrieve only the Skin from a Player's Session
|
|
958
511
|
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```TS
|
|
514
|
+
* const skin = await client.getSkin("Pixelic");
|
|
515
|
+
* ```
|
|
959
516
|
*/
|
|
960
517
|
async getSkin(player, config) {
|
|
961
518
|
const session = await this.getSession(player, config);
|
|
@@ -965,6 +522,10 @@ var Client = class {
|
|
|
965
522
|
/**
|
|
966
523
|
* A simple Wrapper to retrieve only the Player's Skin from their Session Data loaded into a Buffer
|
|
967
524
|
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```TS
|
|
527
|
+
* const skinBuffer = await client.getSkinBuffer("Pixelic");
|
|
528
|
+
* ```
|
|
968
529
|
*/
|
|
969
530
|
async getSkinBuffer(player, config) {
|
|
970
531
|
const session = await this.getSession(player, config);
|
|
@@ -978,6 +539,10 @@ var Client = class {
|
|
|
978
539
|
/**
|
|
979
540
|
* A simple Wrapper to retrieve only the Cape Data from a Player's Session
|
|
980
541
|
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```TS
|
|
544
|
+
* const cape = await client.getCape("Pixelic");
|
|
545
|
+
* ```
|
|
981
546
|
*/
|
|
982
547
|
async getCape(player, config) {
|
|
983
548
|
const session = await this.getSession(player, config);
|
|
@@ -987,6 +552,10 @@ var Client = class {
|
|
|
987
552
|
/**
|
|
988
553
|
* A simple Wrapper to retrieve only the Player's Cape from their Session Data loaded into a Buffer
|
|
989
554
|
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```TS
|
|
557
|
+
* const capeBuffer = await client.getCapeBuffer("Pixelic");
|
|
558
|
+
* ```
|
|
990
559
|
*/
|
|
991
560
|
async getCapeBuffer(player, config) {
|
|
992
561
|
const session = await this.getSession(player, config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mowojang",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "A simple JavaScript and TypeScript compatible wrapper for the Mowojang-API.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"axios-cache-interceptor": "^1.12.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
+
"@pixelic/logger": "npm:@jsr/pixelic__logger@~0.2.0",
|
|
35
36
|
"@types/node": "^25.9.1",
|
|
36
|
-
"@pixelic/logger": "npm:@jsr/pixelic__logger@^0.0.6",
|
|
37
37
|
"tsup": "^8.5.1",
|
|
38
38
|
"typescript": "^6.0.3"
|
|
39
39
|
},
|