mcutils-js-api 2.0.0 → 2.0.2

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/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { ErrorResponse } from "./types/response/error-response";
2
- import type { BedrockServer } from "./types/server/bedrock-server";
3
- import type { JavaServer } from "./types/server/java-server";
4
- import type { CachedPlayer } from "./types/player/cached-player";
5
- import type { CachedPlayerName } from "./types/player/cached-player-name";
2
+ import type { BedrockServer } from "./types/server/impl/bedrock-server";
3
+ import type { JavaServer } from "./types/server/impl/java-server";
4
+ import type { CachedPlayer } from "./types/cache/cached-player";
5
+ import type { CachedPlayerName } from "./types/cache/cached-player-name";
6
6
  export declare class McUtilsAPI {
7
7
  private readonly endpoint;
8
8
  constructor(endpoint?: string);
package/dist/test.js ADDED
@@ -0,0 +1,8 @@
1
+ import McUtilsAPI from ".";
2
+ const api = new McUtilsAPI();
3
+ api.fetchJavaServer("aetheria.cc").then((result) => {
4
+ console.log(result);
5
+ });
6
+ api.fetchPlayer("ImFascinated").then((result) => {
7
+ console.log(result);
8
+ });
@@ -1,4 +1,4 @@
1
- import type { Cache } from "../cache";
1
+ import type { Cache } from "./cache";
2
2
  export type CachedPlayerNameData = {
3
3
  username: string;
4
4
  uniqueId: string;
@@ -0,0 +1,3 @@
1
+ import type { Cache } from "./cache";
2
+ import type { Player } from "../player/player";
3
+ export type CachedPlayer = Cache & Player;
@@ -1,16 +1,5 @@
1
- export interface ARecord {
2
- type: "A";
3
- ttl: number;
4
- name?: string;
5
- address?: string;
6
- }
7
- export interface SRVRecord {
8
- type: "SRV";
9
- ttl: number;
10
- name: string;
11
- target: string;
12
- priority: number;
13
- weight: number;
14
- port: number;
15
- }
1
+ import type { ARecord } from "./impl/a-record";
2
+ import type { SRVRecord } from "./impl/srv-record";
3
+ export type { ARecord } from "./impl/a-record";
4
+ export type { SRVRecord } from "./impl/srv-record";
16
5
  export type DnsRecord = ARecord | SRVRecord;
@@ -0,0 +1,6 @@
1
+ export interface ARecord {
2
+ type: "A";
3
+ ttl: number;
4
+ name?: string;
5
+ address?: string;
6
+ }
@@ -0,0 +1,9 @@
1
+ export interface SRVRecord {
2
+ type: "SRV";
3
+ ttl: number;
4
+ name: string;
5
+ target: string;
6
+ priority: number;
7
+ weight: number;
8
+ port: number;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Server } from "./server";
1
+ import type { Server } from "../server";
2
2
  export interface BedrockServer extends Server {
3
3
  id: string;
4
4
  edition: ServerEdition;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Server } from "./server";
1
+ import type { Server } from "../server";
2
2
  export interface JavaServer extends Server {
3
3
  version: ServerVersion;
4
4
  favicon: ServerFavicon | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Cache } from "../cache";
1
+ import type { Cache } from "../cache/cache";
2
2
  import type { DnsRecord } from "../dns/dns-record";
3
3
  export interface Server extends Cache {
4
4
  hostname: string;
@@ -7,7 +7,7 @@ export interface Server extends Cache {
7
7
  motd: ServerMotd;
8
8
  players: ServerPlayers;
9
9
  records: DnsRecord[];
10
- location?: ServerLocation | null;
10
+ location?: GeoLocation | null;
11
11
  asn?: AsnData | null;
12
12
  }
13
13
  export type ServerMotd = {
@@ -16,22 +16,29 @@ export type ServerMotd = {
16
16
  html: string[];
17
17
  preview: string;
18
18
  };
19
+ export type ServerPlayerSampleName = {
20
+ raw: string;
21
+ clean: string;
22
+ html: string;
23
+ };
19
24
  export type ServerPlayerSample = {
20
25
  id: string;
21
- name: string;
26
+ name: ServerPlayerSampleName;
27
+ url: string;
22
28
  };
23
29
  export type ServerPlayers = {
24
30
  online: number;
25
31
  max: number;
26
32
  sample?: ServerPlayerSample[];
27
33
  };
28
- export type ServerLocation = {
34
+ export type GeoLocation = {
29
35
  country: string;
30
36
  countryCode: string;
31
37
  region: string;
32
38
  city: string;
33
39
  latitude: number;
34
40
  longitude: number;
41
+ flagUrl: string;
35
42
  };
36
43
  export type AsnData = {
37
44
  asn: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcutils-js-api",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "module": "dist/index.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,3 +0,0 @@
1
- import type { Cache } from "../cache";
2
- import type { Player } from "./player";
3
- export type CachedPlayer = Cache & Player;
File without changes
File without changes