minecraft-toolkit 0.1.2 → 0.1.3
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/index.d.ts +213 -0
- package/package.json +6 -6
package/index.d.ts
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import type { H3 } from "h3";
|
|
2
|
+
|
|
3
|
+
export interface SkinTexture {
|
|
4
|
+
url: string;
|
|
5
|
+
metadata?: {
|
|
6
|
+
model?: "default" | "slim";
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface CapeTexture {
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface PlayerProfile {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
profile: Record<string, unknown>;
|
|
18
|
+
textures: Record<string, unknown>;
|
|
19
|
+
skin: SkinTexture | null;
|
|
20
|
+
cape: CapeTexture | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PlayerSkin {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
skin: SkinTexture | null;
|
|
27
|
+
cape: CapeTexture | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PlayerSummary {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
skinUrl: string | null;
|
|
34
|
+
capeUrl: string | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface BatchResult {
|
|
38
|
+
username: string;
|
|
39
|
+
profile?: PlayerProfile;
|
|
40
|
+
error?: unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface BatchOptions {
|
|
44
|
+
delayMs?: number;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface SkinMetadataResult {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
skin: SkinTexture | null;
|
|
52
|
+
cape: CapeTexture | null;
|
|
53
|
+
hasCape: boolean;
|
|
54
|
+
dominantColor: string | null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function fetchPlayerProfile(username: string): Promise<PlayerProfile>;
|
|
58
|
+
export function fetchPlayerSkin(username: string): Promise<PlayerSkin>;
|
|
59
|
+
export function fetchPlayerUUID(username: string): Promise<{ id: string; name: string }>;
|
|
60
|
+
export function fetchUsernameByUUID(uuid: string): Promise<{ id: string; name: string }>;
|
|
61
|
+
export function fetchNameHistory(uuid: string): Promise<{ name: string; changedAt: Date | null }[]>;
|
|
62
|
+
export function fetchPlayers(usernames: string[], options?: BatchOptions): Promise<BatchResult[]>;
|
|
63
|
+
export function fetchPlayerSummary(username: string): Promise<PlayerSummary>;
|
|
64
|
+
export function playerExists(username: string): Promise<boolean>;
|
|
65
|
+
export function hasSkinChanged(profileA: PlayerProfile, profileB: PlayerProfile): boolean;
|
|
66
|
+
export function fetchSkinMetadata(
|
|
67
|
+
username: string,
|
|
68
|
+
options?: {
|
|
69
|
+
dominantColor?: boolean;
|
|
70
|
+
sampleRegion?: { x?: number; y?: number; width?: number; height?: number };
|
|
71
|
+
},
|
|
72
|
+
): Promise<SkinMetadataResult>;
|
|
73
|
+
export function fetchSkinDominantColor(
|
|
74
|
+
url: string,
|
|
75
|
+
region?: { x?: number; y?: number; width?: number; height?: number },
|
|
76
|
+
): Promise<string | null>;
|
|
77
|
+
export function resolvePlayer(input: string): Promise<PlayerSkin>;
|
|
78
|
+
|
|
79
|
+
export function isValidUsername(username: string): boolean;
|
|
80
|
+
export function isUUID(value: string): boolean;
|
|
81
|
+
export function normalizeUUID(uuid: string): string;
|
|
82
|
+
export function uuidWithDashes(uuid: string): string;
|
|
83
|
+
export function uuidWithoutDashes(uuid: string): string;
|
|
84
|
+
|
|
85
|
+
export type FormattingMode = "inline" | "class";
|
|
86
|
+
|
|
87
|
+
export interface FormattingOptions {
|
|
88
|
+
mode?: FormattingMode;
|
|
89
|
+
classPrefix?: string;
|
|
90
|
+
animationName?: string;
|
|
91
|
+
obfuscatedSpeedMs?: number;
|
|
92
|
+
escapeHtml?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface FormattingColorMeta {
|
|
96
|
+
name: string;
|
|
97
|
+
classSuffix: string;
|
|
98
|
+
hex: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface FormattingFormatMeta {
|
|
102
|
+
name: string;
|
|
103
|
+
classSuffix: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface FormattingMaps {
|
|
107
|
+
colors: Record<string, FormattingColorMeta>;
|
|
108
|
+
formats: Record<string, FormattingFormatMeta>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function toHTML(input: string, options?: FormattingOptions): string;
|
|
112
|
+
export function stripCodes(input: string): string;
|
|
113
|
+
export function generateCSS(options?: FormattingOptions): string;
|
|
114
|
+
export function hasCodes(input: string): boolean;
|
|
115
|
+
export function convertPrefix(input: string, direction?: "toSection" | "toAmpersand"): string;
|
|
116
|
+
export function getMaps(): FormattingMaps;
|
|
117
|
+
|
|
118
|
+
export function getSkinURL(profile: PlayerProfile | PlayerSkin): string | null;
|
|
119
|
+
export function getCapeURL(profile: PlayerProfile | PlayerSkin): string | null;
|
|
120
|
+
export function getSkinModel(profile: PlayerProfile | PlayerSkin): "default" | "slim";
|
|
121
|
+
export function extractTextureHash(url: string | null): string | null;
|
|
122
|
+
|
|
123
|
+
export type ServerEdition = "java" | "bedrock" | "auto";
|
|
124
|
+
|
|
125
|
+
export interface JavaServerStatusOptions {
|
|
126
|
+
port?: number;
|
|
127
|
+
timeoutMs?: number;
|
|
128
|
+
protocolVersion?: number;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface BedrockServerStatusOptions {
|
|
132
|
+
port?: number;
|
|
133
|
+
timeoutMs?: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface ServerStatusOptions extends JavaServerStatusOptions {
|
|
137
|
+
edition?: ServerEdition;
|
|
138
|
+
type?: ServerEdition;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface JavaServerStatus {
|
|
142
|
+
edition: "java";
|
|
143
|
+
online: boolean;
|
|
144
|
+
host: string;
|
|
145
|
+
port: number;
|
|
146
|
+
version: {
|
|
147
|
+
name?: string | null;
|
|
148
|
+
protocol?: number | null;
|
|
149
|
+
} | null;
|
|
150
|
+
players: {
|
|
151
|
+
max?: number | null;
|
|
152
|
+
online?: number | null;
|
|
153
|
+
sample?: Array<{ name: string; id: string }>;
|
|
154
|
+
} | null;
|
|
155
|
+
motd: string | null;
|
|
156
|
+
favicon: string | null;
|
|
157
|
+
latencyMs: number | null;
|
|
158
|
+
raw: Record<string, unknown>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface BedrockServerStatus {
|
|
162
|
+
edition: "bedrock";
|
|
163
|
+
online: boolean;
|
|
164
|
+
host: string;
|
|
165
|
+
port: number;
|
|
166
|
+
motd: string;
|
|
167
|
+
version: {
|
|
168
|
+
protocol: number;
|
|
169
|
+
name: string;
|
|
170
|
+
};
|
|
171
|
+
players: {
|
|
172
|
+
online: number;
|
|
173
|
+
max: number;
|
|
174
|
+
};
|
|
175
|
+
serverId: string;
|
|
176
|
+
map: string;
|
|
177
|
+
gamemode: string;
|
|
178
|
+
ipv4Port: number;
|
|
179
|
+
ipv6Port: number | null;
|
|
180
|
+
raw: string;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type ServerStatus = JavaServerStatus | BedrockServerStatus;
|
|
184
|
+
|
|
185
|
+
export function fetchServerStatus(address: string, options?: ServerStatusOptions): Promise<ServerStatus>;
|
|
186
|
+
export function fetchJavaServerStatus(
|
|
187
|
+
address: string,
|
|
188
|
+
options?: JavaServerStatusOptions,
|
|
189
|
+
): Promise<JavaServerStatus>;
|
|
190
|
+
export function fetchBedrockServerStatus(
|
|
191
|
+
address: string,
|
|
192
|
+
options?: BedrockServerStatusOptions,
|
|
193
|
+
): Promise<BedrockServerStatus>;
|
|
194
|
+
|
|
195
|
+
export interface PlayerHandlers {
|
|
196
|
+
profileHandler: any;
|
|
197
|
+
skinHandler: any;
|
|
198
|
+
summaryHandler: any;
|
|
199
|
+
uuidHandler: any;
|
|
200
|
+
resolverHandler: any;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function createPlayerHandlers(): PlayerHandlers;
|
|
204
|
+
export function createPlayerApp(options?: { app?: ConstructorParameters<typeof H3>[0] }): {
|
|
205
|
+
app: H3;
|
|
206
|
+
handlers: PlayerHandlers;
|
|
207
|
+
};
|
|
208
|
+
export const playerPlugin: (app: H3) => PlayerHandlers;
|
|
209
|
+
|
|
210
|
+
export function fetchNameChangeInfo(accessToken: string): Promise<any>;
|
|
211
|
+
export function checkNameAvailability(name: string, accessToken: string): Promise<any>;
|
|
212
|
+
export function validateGiftCode(code: string, accessToken: string): Promise<boolean>;
|
|
213
|
+
export function fetchBlockedServers(): Promise<string[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minecraft-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Developer toolkit for working with Mojang Minecraft player data, skins, and utilities.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"minecraft",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"files": [
|
|
31
31
|
"src",
|
|
32
32
|
"index.js",
|
|
33
|
+
"index.d.ts",
|
|
33
34
|
"README.md",
|
|
34
35
|
"LICENSE"
|
|
35
36
|
],
|
|
@@ -37,11 +38,10 @@
|
|
|
37
38
|
"sideEffects": false,
|
|
38
39
|
"types": "./index.d.ts",
|
|
39
40
|
"exports": {
|
|
40
|
-
".":
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"./textures": "./src/player/textures.js"
|
|
41
|
+
".": {
|
|
42
|
+
"types": "./index.d.ts",
|
|
43
|
+
"default": "./index.js"
|
|
44
|
+
}
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"test": "vitest",
|