diff --git a/package.json b/package.json index e94f8254..36a62013 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,8 @@ "name": "hypixel-api-reborn", "version": "12.0.0", "description": "Feature-rich Hypixel API wrapper for Node.js", - "main": "./src/index.ts", - "types": "./src/typings/index.d.ts", + "main": "dist/index.js", + "types": "dist/src/typings/index.d.ts", "keywords": [ "minecraft", "client", diff --git a/src/Client.test.ts b/src/Client.test.ts index 0ee6876d..dd824daa 100644 --- a/src/Client.test.ts +++ b/src/Client.test.ts @@ -1,9 +1,8 @@ import CacheHandler from './Private/CacheHandler'; -import Client from './Client'; +import Client, { ClientOptions } from './Client'; import Errors from './Errors'; import Requests from './Private/Requests'; import Updater from './Private/Updater'; -import { ClientOptions } from './typings/Client'; import { expect, expectTypeOf, test } from 'vitest'; const errors = new Errors(); diff --git a/src/Client.ts b/src/Client.ts index 28c76c60..33365fb0 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -4,7 +4,17 @@ import Errors from './Errors'; import RateLimit from './Private/RateLimit'; import Requests from './Private/Requests'; import Updater from './Private/Updater'; -import { ClientOptions } from './typings/Client'; + +export interface ClientOptions { + cache?: boolean; + cacheTime?: number; + cacheMaxKeys?: number; + cacheCheckPeriod?: number; + rateLimit?: 'AUTO' | 'NONE'; + silent?: boolean; + checkForUpdates?: boolean; + checkForUpdatesInterval?: number; +} const clients: Client[] = []; diff --git a/src/index.ts b/src/index.ts index 3a535159..9f1214e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,3 @@ -export * from './Client'; -export * from './Errors'; -export * from './Private/CacheHandler'; -export * from './Private/Updater'; -export * from './Private/Endpoint'; -export * from './Private/Requests'; export * from './API/getAchievements'; export * from './API/getActiveHouses'; export * from './API/getBoosters'; @@ -31,3 +25,95 @@ export * from './API/getSkyblockNews'; export * from './API/getSkyblockProfiles'; export * from './API/getStatus'; export * from './API/getWatchdogStats'; + +export * from './Private/CacheHandler'; +export * from './Private/Endpoint'; +export * from './Private/RateLimit'; +export * from './Private/Requests'; +export * from './Private/Updater'; + +export * from './structures/Boosters/Booster'; +export * from './structures/Color'; +export * from './structures/Game'; +export * from './structures/GameCounts'; +export * from './structures/Guild/Guild'; +export * from './structures/Guild/GuildMember'; +export * from './structures/Guild/GuildRank'; +export * from './structures/House'; +export * from './structures/ItemBytes'; +export * from './structures/Leaderboard'; +export * from './structures/MiniGames/Arcade'; +export * from './structures/MiniGames/ArenaBrawl'; +export * from './structures/MiniGames/BedWars'; +export * from './structures/MiniGames/BlitzSurvivalGames'; +export * from './structures/MiniGames/BuildBattle'; +export * from './structures/MiniGames/CopsAndCrims'; +export * from './structures/MiniGames/Duels'; +export * from './structures/MiniGames/MegaWalls'; +export * from './structures/MiniGames/MurderMystery'; +export * from './structures/MiniGames/Paintball'; +export * from './structures/MiniGames/Pit'; +export * from './structures/MiniGames/PitInventoryItem'; +export * from './structures/MiniGames/Quakecraft'; +export * from './structures/MiniGames/SkyWars'; +export * from './structures/MiniGames/SmashHeroes'; +export * from './structures/MiniGames/SpeedUHC'; +export * from './structures/MiniGames/TNTGames'; +export * from './structures/MiniGames/TurboKartRacers'; +export * from './structures/MiniGames/UHC'; +export * from './structures/MiniGames/VampireZ'; +export * from './structures/MiniGames/Walls'; +export * from './structures/MiniGames/Warlords'; +export * from './structures/MiniGames/WoolWars'; +export * from './structures/Pet'; +export * from './structures/Pets'; +export * from './structures/Player'; +export * from './structures/PlayerCosmetics'; +export * from './structures/RecentGame'; +export * from './structures/ServerInfo'; +export * from './structures/SkyBlock/Auctions/Auction'; +export * from './structures/SkyBlock/Auctions/AuctionInfo'; +export * from './structures/SkyBlock/Auctions/BaseAuction'; +export * from './structures/SkyBlock/Auctions/Bid'; +export * from './structures/SkyBlock/Bazzar/Order'; +export * from './structures/SkyBlock/Bazzar/Product'; +export * from './structures/SkyBlock/News/SkyblockNews'; +export * from './structures/SkyBlock/SkyblockGarden'; +export * from './structures/SkyBlock/SkyblockInventoryItem'; +export * from './structures/SkyBlock/SkyblockMember'; +export * from './structures/SkyBlock/SkyblockMuseum'; +export * from './structures/SkyBlock/SkyblockMuseumItem'; +export * from './structures/SkyBlock/SkyblockPet'; +export * from './structures/SkyBlock/SkyblockProfile'; +export * from './structures/SkyBlock/Static/Bingo'; +export * from './structures/SkyBlock/Static/BingoData'; +export * from './structures/SkyBlock/Static/Candidate'; +export * from './structures/SkyBlock/Static/FireSale'; +export * from './structures/SkyBlock/Static/Government'; +export * from './structures/SkyBlock/Static/Perk'; +export * from './structures/Static/Achievement'; +export * from './structures/Static/AchievementTier'; +export * from './structures/Static/Achievements'; +export * from './structures/Static/Challenges'; +export * from './structures/Static/GameAchievements'; +export * from './structures/Static/GameChallenges'; +export * from './structures/Static/GameQuests'; +export * from './structures/Static/GuildAchievements'; +export * from './structures/Static/Quest'; +export * from './structures/Static/Quests'; +export * from './structures/Status'; +export * from './structures/Watchdog/Stats'; + +export * from './utils/Constants'; +export * from './utils/Guild'; +export * from './utils/Player'; +export * from './utils/SkyblockUtils'; +export * from './utils/divide'; +export * from './utils/isGuildID'; +export * from './utils/isUUID'; +export * from './utils/oscillation'; +export * from './utils/removeSnakeCase'; +export * from './utils/romanize'; + +export * from './Client'; +export * from './Errors'; diff --git a/src/typings/Client.d.ts b/src/typings/Client.d.ts deleted file mode 100644 index 877fabc7..00000000 --- a/src/typings/Client.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface ClientOptions { - cache?: boolean; - cacheTime?: number; - cacheMaxKeys?: number; - cacheCheckPeriod?: number; - rateLimit?: 'AUTO' | 'NONE'; - silent?: boolean; - checkForUpdates?: boolean; - checkForUpdatesInterval?: number; -} diff --git a/src/typings/index.d.ts b/src/typings/index.d.ts index f0e01540..86e537e3 100644 --- a/src/typings/index.d.ts +++ b/src/typings/index.d.ts @@ -1,34 +1,3 @@ -import Achievements from '../structures/Static/Achievements'; -import Auction from '../structures/SkyBlock/Auctions/Auction'; -import AuctionInfo from '../structures/SkyBlock/Auctions/AuctionInfo'; -import BingoData from '../structures/SkyBlock/Static/BingoData'; -import Booster from '../structures/Boosters/Booster'; -import CacheHandler from '../Private/CacheHandler'; -import Challenges from '../structures/Static/Challenges'; -import Errors from '../Errors'; -import FireSale from '../structures/SkyBlock/Static/FireSale'; -import GameCounts from '../structures/GameCounts'; -import GovernmentData from '../structures/SkyBlock/Static/Government'; -import Guild from '../structures/Guild/Guild'; -import GuildAchievements from '../structures/Static/GuildAchievements'; -import House from '../structures/House'; -import Player from '../structures/Player'; -import Product from '../structures/SkyBlock/Bazzar/Product'; -import Quests from '../structures/Static/Quests'; -import RecentGame from '../structures/RecentGame'; -import Requests, { RequestOptions } from '../Private/Requests'; -import SkyblockGarden from '../structures/SkyBlock/SkyblockGarden'; -import SkyblockMember from '../structures/SkyBlock/SkyblockMember'; -import SkyblockMuseum from '../structures/SkyBlock/SkyblockMuseum'; -import SkyblockNews from '../structures/SkyBlock/News/SkyblockNews'; -import SkyblockProfile from '../structures/SkyBlock/SkyblockProfile'; -import Status from '../structures/Status'; -import Updater from '../Private/Updater'; -import WatchdogStats from '../structures/Watchdog/Stats'; -import { AuctionRequestOptions, SkyblockRequestOptions } from '../API/API'; -import { ClientOptions } from '../Client'; -import { getSkyblockAuctionsOptions } from '../API/getSkyblockAuctions'; - export type StaticGameNames = | 'arcade' | 'arena' @@ -53,49 +22,3 @@ export type StaticGameNames = | 'walls' | 'battleground' | 'woolgames'; - -declare module 'hypixel-api-reborn' { - class Client { - readonly key: string; - declare requests: Requests; - declare cacheHandler: CacheHandler; - declare updater: Updater; - declare errors: Errors; - declare options: ClientOptions; - constructor(key: string, options?: ClientOptions); - getAchievements(options?: RequestOptions): Promise; - getActiveHouses(options?: RequestOptions): Promise; - getBoosters(options?: RequestOptions): Promise; - getChallenges(options?: RequestOptions): Promise; - getGameCounts(options?: RequestOptions): Promise; - getGuild(searchParameter: 'id' | 'name' | 'player', query: string, options?: RequestOptions): Promise; - getGuildAchievements(options?: RequestOptions): Promise; - getHouse(query: string, options?: RequestOptions): Promise; - getLeaderboards(options?: RequestOptions): Promise; - getPlayer(query: string, options?: PlayerRequestOptions): Promise; - getPlayerHouses(query: string, options?: RequestOptions): Promise; - getQuests(options?: RequestOptions): Promise; - getRecentGames(query: string, options?: RequestOptions): Promise; - getSkyblockAuction( - query: string, - type: 'profile' | 'player' | 'auction', - options?: AuctionRequestOptions - ): Promise; - getSkyblockAuctions( - range: any, - options?: getSkyblockAuctionsOptions - ): Promise<{ info: AuctionInfo | null; auctions: Auction[] }>; - getSkyblockAuctionsByPlayer(query: string, options?: AuctionRequestOptions): Promise; - getSkyblockBazaar(options?: RequestOptions): Promise; - getSkyblockBingo(options?: RequestOptions): Promise; - getSkyblockFireSales(options?: RequestOptions): Promise; - getSkyblockGarden(profileId: string, options?: RequestOptions): Promise; - getSkyblockGovernment(options?: RequestOptions): Promise; - getSkyblockMember(query: string, options?: SkyblockRequestOptions): Promise>; - getSkyblockMuseum(query: string, profileId: string, options?: RequestOptions): Promise; - getSkyblockNews(options?: RequestOptions): Promise; - getSkyblockProfiles(query: string, options?: SkyblockRequestOptions): Promise; - getStatus(query: string, options?: RequestOptions): Promise; - getWatchdogStats(options?: RequestOptions): Promise; - } -} diff --git a/tsconfig.json b/tsconfig.json index e1d3a576..6d044c12 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,14 +1,25 @@ { "compilerOptions": { + "esModuleInterop": true, + "allowJs": false, + + "target": "ESNext", + "moduleDetection": "force", + "moduleResolution": "Node", + "module": "CommonJS", + + "rootDir": "./src", + "outDir": "./dist", + "declaration": true, + "sourceMap": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", "resolveJsonModule": true, - "esModuleInterop": true, "skipLibCheck": true, - "outDir": "./dist", - "module": "ES2022", - "target": "ES2022", - "strict": true + + "strict": true, + "noImplicitAny": true, + "lib": ["ES2022"] }, - "include": ["src", "API"] + "include": ["src"], + "exclude": ["node_modules", "src/**/*.test.ts"] }