Export enums
Some checks failed
Publish JS SDK / docker (push) Failing after 19s

This commit is contained in:
Braydon 2024-04-15 11:24:03 -04:00
parent 77bff8067e
commit 9cf2f10ee9
15 changed files with 62 additions and 56 deletions

@ -1,5 +1,6 @@
export * from "./types/mojang"; export * from "./types/dns/dns-record";
export * from "./types/mojang/server-status-response";
export * from "./types/player/player"; export * from "./types/player/player";
export * from "./types/server/bedrock-server"; export * from "./types/server/bedrock/server";
export * from "./types/server/java-server"; export * from "./types/server/java-server";
export * from "./types/server/server"; export * from "./types/server/server";

@ -1,6 +1,11 @@
export * from "@/lib/restfulmc"; export * from "@/lib/restfulmc";
// Types // Types
export * from "@/types/dns/record-type";
export * from "@/types/error"; export * from "@/types/error";
export * from "@/types/mojang/server-status";
export * from "@/types/player/profile-action";
export * from "@/types/player/skin-model";
export * from "@/types/player/skin-part"; export * from "@/types/player/skin-part";
export * from "@/types/server/bedrock/edition";
export * from "@/types/server/platform"; export * from "@/types/server/platform";

@ -1,8 +1,8 @@
import { WebRequest } from "@/lib/web-request"; import { WebRequest } from "@/lib/web-request";
import { MojangServerStatus } from "@/types/mojang"; import { MojangServerStatusResponse } from "@/types/mojang/server-status-response";
import { CachedPlayer } from "@/types/player/player"; import { CachedPlayer } from "@/types/player/player";
import { SkinPart } from "@/types/player/skin-part"; import { SkinPart } from "@/types/player/skin-part";
import { CachedBedrockMinecraftServer } from "@/types/server/bedrock-server"; import { CachedBedrockMinecraftServer } from "@/types/server/bedrock/server";
import { CachedJavaMinecraftServer } from "@/types/server/java-server"; import { CachedJavaMinecraftServer } from "@/types/server/java-server";
import { ServerPlatform } from "@/types/server/platform"; import { ServerPlatform } from "@/types/server/platform";
@ -83,5 +83,5 @@ export const getJavaServerFavicon = (hostname: string): Promise<ArrayBuffer> =>
* *
* @returns the promised status * @returns the promised status
*/ */
export const getMojangServerStatus = (): Promise<MojangServerStatus> => export const getMojangServerStatus = (): Promise<MojangServerStatusResponse> =>
new WebRequest("/mojang/status").execute<MojangServerStatus>(); new WebRequest("/mojang/status").execute<MojangServerStatusResponse>();

@ -1,3 +1,5 @@
import { RecordType } from "@/type/dns/record-type";
/** /**
* An A record. * An A record.
*/ */
@ -47,11 +49,3 @@ export type DNSRecord = {
*/ */
ttl: number; ttl: number;
}; };
/**
* Types of a DNS record.
*/
enum RecordType {
A,
SRV,
}

@ -0,0 +1,7 @@
/**
* Types of a DNS record.
*/
export enum RecordType {
A,
SRV,
}

@ -1,16 +0,0 @@
/**
* Represents the status of
* a service provided by Mojang.
*/
export type MojangServerStatus = {
[endpoint: string]: Status;
};
/**
* The status of a service.
*/
enum Status {
ONLINE,
DEGRADED,
OFFLINE,
}

@ -0,0 +1,7 @@
/**
* Represents the status of
* a service provided by Mojang.
*/
export type MojangServerStatusResponse = {
[endpoint: string]: Status;
};

@ -0,0 +1,8 @@
/**
* The status of a service.
*/
export enum Status {
ONLINE,
DEGRADED,
OFFLINE,
}

@ -1,3 +1,5 @@
import { ProfileAction } from "@/types/player/profile-action";
import { SkinModel } from "@/types/player/skin-model";
import { SkinPart } from "@/types/player/skin-part"; import { SkinPart } from "@/types/player/skin-part";
/** /**
@ -87,14 +89,6 @@ type Skin = {
}; };
}; };
/**
* Possible models for a skin.
*/
enum SkinModel {
DEFAULT,
SLIM,
}
/** /**
* A cape for a {@link Player}. * A cape for a {@link Player}.
*/ */
@ -125,11 +119,3 @@ type ProfileProperty = {
*/ */
signature?: string | undefined; signature?: string | undefined;
}; };
/**
* Profile actions that can
*/
enum ProfileAction {
FORCED_NAME_CHANGE,
USING_BANNED_SKIN,
}

@ -0,0 +1,7 @@
/**
* Profile actions that can
*/
export enum ProfileAction {
FORCED_NAME_CHANGE,
USING_BANNED_SKIN,
}

@ -0,0 +1,7 @@
/**
* Possible models for a skin.
*/
export enum SkinModel {
DEFAULT,
SLIM,
}

@ -0,0 +1,7 @@
/**
* The edition of a Bedrock server.
*/
export enum Edition {
MCPE,
MCEE,
}

@ -1,3 +1,4 @@
import { Edition } from "@/types/server/bedrock/edition";
import { MinecraftServer } from "@/types/server/server"; import { MinecraftServer } from "@/types/server/server";
/** /**
@ -36,14 +37,6 @@ export interface BedrockMinecraftServer extends MinecraftServer {
gamemode: GameMode; gamemode: GameMode;
} }
/**
* The edition of a Bedrock server.
*/
enum Edition {
MCPE,
MCEE,
}
/** /**
* Version information for a server. * Version information for a server.
*/ */

@ -1,4 +1,4 @@
import { ARecord, SRVRecord } from "@/types/dns"; import { ARecord, SRVRecord } from "@/types/dns/dns-record";
/** /**
* A model representing a Minecraft server. * A model representing a Minecraft server.

@ -5,7 +5,7 @@ import {
isMojangBlocked, isMojangBlocked,
} from "@/index"; } from "@/index";
import { RestfulMCAPIError } from "@/types/error"; import { RestfulMCAPIError } from "@/types/error";
import { CachedBedrockMinecraftServer } from "@/types/server/bedrock-server"; import { CachedBedrockMinecraftServer } from "@/types/server/bedrock/server";
import { CachedJavaMinecraftServer } from "@/types/server/java-server"; import { CachedJavaMinecraftServer } from "@/types/server/java-server";
import { expect, test } from "bun:test"; import { expect, test } from "bun:test";