39 Commits

Author SHA1 Message Date
Lee
13596e5a2b Merge pull request 'Update dependency @types/node to v20.14.14' (#11) from renovate/node-20.x-lockfile into master
Some checks failed
Publish Package / build (push) Failing after 48s
Reviewed-on: #11
2024-08-02 17:51:27 +00:00
ff230e5367 Update dependency @types/node to v20.14.14 2024-08-02 09:01:27 +00:00
Lee
5e0264b9d4 Merge pull request 'Update dependency ts-jest to v29.2.4' (#10) from renovate/ts-jest-29.x-lockfile into master
Some checks failed
Publish Package / build (push) Failing after 22s
Reviewed-on: #10
2024-08-01 13:17:49 +00:00
8c57aa5bb9 Update dependency ts-jest to v29.2.4 2024-08-01 09:01:30 +00:00
Lee
dbb0395865 Update src/lib/mojang.ts
All checks were successful
Publish Package / build (push) Successful in 25s
2024-07-30 20:58:36 +00:00
Lee
86c6f613e6 Merge pull request 'Update dependency @types/node to v20.14.13' (#8) from renovate/node-20.x-lockfile into master
Some checks failed
Publish Package / build (push) Failing after 10s
Reviewed-on: #8
2024-07-30 20:50:44 +00:00
Lee
38fe9ba42a Merge pull request 'Update dependency ts-jest to v29.2.3' (#9) from renovate/ts-jest-29.x-lockfile into master
Some checks failed
Publish Package / build (push) Has been cancelled
Reviewed-on: #9
2024-07-30 20:50:37 +00:00
869e8343d0 Update dependency ts-jest to v29.2.3 2024-07-30 20:18:00 +00:00
c3ed0aa017 Update dependency @types/node to v20.14.13 2024-07-30 20:17:57 +00:00
Lee
009b5acb85 Merge pull request 'Update dependency typescript to v5.5.4' (#7) from renovate/typescript-5.x-lockfile into master
Some checks failed
Publish Package / build (push) Failing after 12s
Reviewed-on: #7
2024-07-30 20:05:32 +00:00
Lee
a6d21ce762 Update package.json
Some checks are pending
Publish Package / build (push) Waiting to run
2024-07-30 20:05:19 +00:00
Lee
9edb9401a4 Update src/types/mojang/endpoint-status.ts
Some checks are pending
Publish Package / build (push) Waiting to run
2024-07-30 20:05:09 +00:00
0ed1ce3975 Update dependency typescript to v5.5.4 2024-07-30 20:01:29 +00:00
Lee
0f051bb8ca Merge pull request 'Update dependency ts-jest to v29.2.3' (#6) from renovate/ts-jest-29.x-lockfile into master
All checks were successful
Publish Package / build (push) Successful in 21s
Reviewed-on: #6
2024-07-30 19:57:43 +00:00
Lee
e782221718 Merge pull request 'Update dependency @types/node to v20.14.13' (#5) from renovate/node-20.x-lockfile into master
Some checks failed
Publish Package / build (push) Has been cancelled
Reviewed-on: #5
2024-07-30 19:57:36 +00:00
Lee
ada236d20e Update package.json
Some checks failed
Publish Package / build (push) Has been cancelled
2024-07-30 19:57:26 +00:00
Lee
1be2f328da Update src/types/mojang/endpoint-status.ts
Some checks failed
Publish Package / build (push) Has been cancelled
2024-07-30 19:57:16 +00:00
b5d96d1dd4 Update dependency ts-jest to v29.1.3 2024-05-21 05:01:55 +00:00
bbf5a6e50a Update dependency @types/node to v20.12.8 2024-05-01 19:01:53 +00:00
d2a3434205 add preview to the motd type
All checks were successful
Publish Package / build (push) Successful in 21s
2024-04-22 20:20:33 +01:00
c909b11b0c Merge remote-tracking branch 'origin/master'
All checks were successful
Publish Package / build (push) Successful in 32s
2024-04-21 23:40:42 +01:00
68c9ac8a05 add server location 2024-04-21 23:40:38 +01:00
Lee
74426ff59d Update README.md 2024-04-21 12:51:00 +00:00
2f17c4d218 Merge remote-tracking branch 'origin/master'
All checks were successful
Publish Package / build (push) Successful in 20s
2024-04-20 22:49:58 +01:00
321db2fb3d add server previews 2024-04-20 22:49:53 +01:00
Lee
c625a70a59 Update README.md 2024-04-20 01:13:13 +00:00
436c9be3e5 fix cache
All checks were successful
Publish Package / build (push) Successful in 19s
2024-04-19 21:14:17 +01:00
db98cf20a1 fix cache import
All checks were successful
Publish Package / build (push) Successful in 19s
2024-04-19 20:39:30 +01:00
9eaf6125b7 fix methods
All checks were successful
Publish Package / build (push) Successful in 20s
2024-04-19 18:39:25 +01:00
2f666a9cfa Merge remote-tracking branch 'origin/master'
All checks were successful
Publish Package / build (push) Successful in 19s
2024-04-19 17:28:54 +01:00
8c2c03eba5 use new endpoint status model 2024-04-19 17:28:50 +01:00
Lee
634fda168e Merge pull request 'Configure Renovate' (#3) from renovate/configure into master
Some checks failed
Publish Package / build (push) Failing after 18s
Reviewed-on: #3
2024-04-18 20:17:11 +00:00
757da0c8e9 Add renovate.json 2024-04-18 20:16:35 +00:00
Lee
6f56a00083 Delete renovate.json
Some checks failed
Publish Package / build (push) Failing after 22s
2024-04-18 20:13:43 +00:00
Lee
dc93325992 Merge pull request 'Configure Renovate' (#2) from renovate/configure into master
Some checks failed
Publish Package / build (push) Failing after 20s
Reviewed-on: #2
2024-04-18 11:02:29 +00:00
efdf121a42 Add renovate.json 2024-04-18 11:02:18 +00:00
Lee
0a11d1ab86 Delete renovate.json
Some checks are pending
Publish Package / build (push) Waiting to run
2024-04-18 11:01:44 +00:00
Lee
f68b340f6f Merge pull request 'Configure Renovate' (#1) from renovate/configure into master
Some checks failed
Publish Package / build (push) Failing after 28s
Reviewed-on: #1
2024-04-18 08:37:00 +00:00
37af4ebbbd Add renovate.json 2024-04-18 08:35:00 +00:00
17 changed files with 233 additions and 121 deletions

View File

@ -1,31 +1,3 @@
# Minecraft Utilities - Javascript Library
The JavaScript library for the Minecraft Utilities API.
## Usage
Install the package using npm:
```bash
npm install mcutils-library
```
Get player:
```javascript
import { getPlayer, CachedPlayer } from "mcutils-library";
const cachedPlayer = await getPlayer(playerId);
console.log(player);
```
Get Server:
```javascript
import { getServer, CachedJavaMinecraftServer } from "mcutils-library";
const cachedServer = await getServer(ServerPlatform.Java, "hypixel.net");
console.log(server);
```
See [The Website](https://mcutils.xyz) or [Minecraft Utilities Documentation](https://mcutils.xyz/docs) for more information.

View File

@ -1,4 +1,4 @@
import { Config } from "jest";
import {Config} from "jest";
// Sync object
const config: Config = {

View File

@ -1,6 +1,6 @@
{
"name": "mcutils-library",
"version": "1.2.2",
"version": "1.3.4",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",

165
pnpm-lock.yaml generated
View File

@ -7,16 +7,16 @@ settings:
dependencies:
jest:
specifier: ^29.7.0
version: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
version: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
ts-jest:
specifier: ^29.1.2
version: 29.1.2(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.4.5)
version: 29.2.4(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.5.4)
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@20.12.7)(typescript@5.4.5)
version: 10.9.2(@types/node@20.14.14)(typescript@5.5.4)
typescript:
specifier: ^5.4.5
version: 5.4.5
version: 5.5.4
devDependencies:
'@types/jest':
@ -24,7 +24,7 @@ devDependencies:
version: 29.5.12
'@types/node':
specifier: ^20.12.7
version: 20.12.7
version: 20.14.14
packages:
@ -391,7 +391,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
chalk: 4.1.2
jest-message-util: 29.7.0
jest-util: 29.7.0
@ -412,14 +412,14 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
ansi-escapes: 4.3.2
chalk: 4.1.2
ci-info: 3.9.0
exit: 0.1.2
graceful-fs: 4.2.11
jest-changed-files: 29.7.0
jest-config: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
jest-haste-map: 29.7.0
jest-message-util: 29.7.0
jest-regex-util: 29.6.3
@ -447,7 +447,7 @@ packages:
dependencies:
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
jest-mock: 29.7.0
dev: false
@ -473,7 +473,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@sinonjs/fake-timers': 10.3.0
'@types/node': 20.12.7
'@types/node': 20.14.14
jest-message-util: 29.7.0
jest-mock: 29.7.0
jest-util: 29.7.0
@ -506,7 +506,7 @@ packages:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@jridgewell/trace-mapping': 0.3.25
'@types/node': 20.12.7
'@types/node': 20.14.14
chalk: 4.1.2
collect-v8-coverage: 1.0.2
exit: 0.1.2
@ -593,7 +593,7 @@ packages:
'@jest/schemas': 29.6.3
'@types/istanbul-lib-coverage': 2.0.6
'@types/istanbul-reports': 3.0.4
'@types/node': 20.12.7
'@types/node': 20.14.14
'@types/yargs': 17.0.32
chalk: 4.1.2
@ -697,7 +697,7 @@ packages:
/@types/graceful-fs@4.1.9:
resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==}
dependencies:
'@types/node': 20.12.7
'@types/node': 20.14.14
dev: false
/@types/istanbul-lib-coverage@2.0.6:
@ -720,8 +720,8 @@ packages:
pretty-format: 29.7.0
dev: true
/@types/node@20.12.7:
resolution: {integrity: sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==}
/@types/node@20.14.14:
resolution: {integrity: sha512-d64f00982fS9YoOgJkAMolK7MN8Iq3TDdVjchbYHdEmjth/DHowx82GnoA+tVUAN+7vxfYUgAzi+JXbKNd2SDQ==}
dependencies:
undici-types: 5.26.5
@ -793,6 +793,10 @@ packages:
sprintf-js: 1.0.3
dev: false
/async@3.2.5:
resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==}
dev: false
/babel-jest@29.7.0(@babel/core@7.24.4):
resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -876,6 +880,12 @@ packages:
concat-map: 0.0.1
dev: false
/brace-expansion@2.0.1:
resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==}
dependencies:
balanced-match: 1.0.2
dev: false
/braces@3.0.2:
resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==}
engines: {node: '>=8'}
@ -1000,7 +1010,7 @@ packages:
resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==}
dev: false
/create-jest@29.7.0(@types/node@20.12.7)(ts-node@10.9.2):
/create-jest@29.7.0(@types/node@20.14.14)(ts-node@10.9.2):
resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@ -1009,7 +1019,7 @@ packages:
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
jest-config: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@ -1072,6 +1082,14 @@ packages:
engines: {node: '>=0.3.1'}
dev: false
/ejs@3.1.10:
resolution: {integrity: sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA==}
engines: {node: '>=0.10.0'}
hasBin: true
dependencies:
jake: 10.9.2
dev: false
/electron-to-chromium@1.4.736:
resolution: {integrity: sha512-Rer6wc3ynLelKNM4lOCg7/zPQj8tPOCB2hzD32PX9wd3hgRRi9MxEbmkFCokzcEhRVMiOVLjnL9ig9cefJ+6+Q==}
dev: false
@ -1150,6 +1168,12 @@ packages:
bser: 2.1.1
dev: false
/filelist@1.0.4:
resolution: {integrity: sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q==}
dependencies:
minimatch: 5.1.6
dev: false
/fill-range@7.0.1:
resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==}
engines: {node: '>=8'}
@ -1327,7 +1351,7 @@ packages:
'@babel/parser': 7.24.4
'@istanbuljs/schema': 0.1.3
istanbul-lib-coverage: 3.2.2
semver: 7.6.0
semver: 7.6.3
transitivePeerDependencies:
- supports-color
dev: false
@ -1360,6 +1384,17 @@ packages:
istanbul-lib-report: 3.0.1
dev: false
/jake@10.9.2:
resolution: {integrity: sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA==}
engines: {node: '>=10'}
hasBin: true
dependencies:
async: 3.2.5
chalk: 4.1.2
filelist: 1.0.4
minimatch: 3.1.2
dev: false
/jest-changed-files@29.7.0:
resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
@ -1377,7 +1412,7 @@ packages:
'@jest/expect': 29.7.0
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
chalk: 4.1.2
co: 4.6.0
dedent: 1.5.3
@ -1398,7 +1433,7 @@ packages:
- supports-color
dev: false
/jest-cli@29.7.0(@types/node@20.12.7)(ts-node@10.9.2):
/jest-cli@29.7.0(@types/node@20.14.14)(ts-node@10.9.2):
resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@ -1412,10 +1447,10 @@ packages:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
create-jest: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
create-jest: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
exit: 0.1.2
import-local: 3.1.0
jest-config: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
jest-config: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@ -1426,7 +1461,7 @@ packages:
- ts-node
dev: false
/jest-config@29.7.0(@types/node@20.12.7)(ts-node@10.9.2):
/jest-config@29.7.0(@types/node@20.14.14)(ts-node@10.9.2):
resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
peerDependencies:
@ -1441,7 +1476,7 @@ packages:
'@babel/core': 7.24.4
'@jest/test-sequencer': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
babel-jest: 29.7.0(@babel/core@7.24.4)
chalk: 4.1.2
ci-info: 3.9.0
@ -1461,7 +1496,7 @@ packages:
pretty-format: 29.7.0
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.2(@types/node@20.12.7)(typescript@5.4.5)
ts-node: 10.9.2(@types/node@20.14.14)(typescript@5.5.4)
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@ -1501,7 +1536,7 @@ packages:
'@jest/environment': 29.7.0
'@jest/fake-timers': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
jest-mock: 29.7.0
jest-util: 29.7.0
dev: false
@ -1516,7 +1551,7 @@ packages:
dependencies:
'@jest/types': 29.6.3
'@types/graceful-fs': 4.1.9
'@types/node': 20.12.7
'@types/node': 20.14.14
anymatch: 3.1.3
fb-watchman: 2.0.2
graceful-fs: 4.2.11
@ -1565,7 +1600,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
jest-util: 29.7.0
dev: false
@ -1620,7 +1655,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
chalk: 4.1.2
emittery: 0.13.1
graceful-fs: 4.2.11
@ -1651,7 +1686,7 @@ packages:
'@jest/test-result': 29.7.0
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
chalk: 4.1.2
cjs-module-lexer: 1.2.3
collect-v8-coverage: 1.0.2
@ -1693,7 +1728,7 @@ packages:
jest-util: 29.7.0
natural-compare: 1.4.0
pretty-format: 29.7.0
semver: 7.6.0
semver: 7.6.2
transitivePeerDependencies:
- supports-color
dev: false
@ -1703,7 +1738,7 @@ packages:
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
chalk: 4.1.2
ci-info: 3.9.0
graceful-fs: 4.2.11
@ -1727,7 +1762,7 @@ packages:
dependencies:
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
'@types/node': 20.12.7
'@types/node': 20.14.14
ansi-escapes: 4.3.2
chalk: 4.1.2
emittery: 0.13.1
@ -1739,13 +1774,13 @@ packages:
resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
dependencies:
'@types/node': 20.12.7
'@types/node': 20.14.14
jest-util: 29.7.0
merge-stream: 2.0.0
supports-color: 8.1.1
dev: false
/jest@29.7.0(@types/node@20.12.7)(ts-node@10.9.2):
/jest@29.7.0(@types/node@20.14.14)(ts-node@10.9.2):
resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==}
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
hasBin: true
@ -1758,7 +1793,7 @@ packages:
'@jest/core': 29.7.0(ts-node@10.9.2)
'@jest/types': 29.6.3
import-local: 3.1.0
jest-cli: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
jest-cli: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
@ -1824,18 +1859,11 @@ packages:
yallist: 3.1.1
dev: false
/lru-cache@6.0.0:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
dependencies:
yallist: 4.0.0
dev: false
/make-dir@4.0.0:
resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==}
engines: {node: '>=10'}
dependencies:
semver: 7.6.0
semver: 7.6.3
dev: false
/make-error@1.3.6:
@ -1870,6 +1898,13 @@ packages:
brace-expansion: 1.1.11
dev: false
/minimatch@5.1.6:
resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
engines: {node: '>=10'}
dependencies:
brace-expansion: 2.0.1
dev: false
/ms@2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: false
@ -2044,12 +2079,16 @@ packages:
hasBin: true
dev: false
/semver@7.6.0:
resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
/semver@7.6.2:
resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==}
engines: {node: '>=10'}
hasBin: true
dev: false
/semver@7.6.3:
resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}
engines: {node: '>=10'}
hasBin: true
dependencies:
lru-cache: 6.0.0
dev: false
/shebang-command@2.0.0:
@ -2185,12 +2224,13 @@ packages:
dependencies:
is-number: 7.0.0
/ts-jest@29.1.2(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.4.5):
resolution: {integrity: sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==}
engines: {node: ^16.10.0 || ^18.0.0 || >=20.0.0}
/ts-jest@29.2.4(@babel/core@7.24.4)(jest@29.7.0)(typescript@5.5.4):
resolution: {integrity: sha512-3d6tgDyhCI29HlpwIq87sNuI+3Q6GLTTCeYRHCs7vDz+/3GCMwEtV9jezLyl4ZtnBgx00I7hm8PCP8cTksMGrw==}
engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0}
hasBin: true
peerDependencies:
'@babel/core': '>=7.0.0-beta.0 <8'
'@jest/transform': ^29.0.0
'@jest/types': ^29.0.0
babel-jest: ^29.0.0
esbuild: '*'
@ -2199,6 +2239,8 @@ packages:
peerDependenciesMeta:
'@babel/core':
optional: true
'@jest/transform':
optional: true
'@jest/types':
optional: true
babel-jest:
@ -2208,18 +2250,19 @@ packages:
dependencies:
'@babel/core': 7.24.4
bs-logger: 0.2.6
ejs: 3.1.10
fast-json-stable-stringify: 2.1.0
jest: 29.7.0(@types/node@20.12.7)(ts-node@10.9.2)
jest: 29.7.0(@types/node@20.14.14)(ts-node@10.9.2)
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
make-error: 1.3.6
semver: 7.6.0
typescript: 5.4.5
semver: 7.6.3
typescript: 5.5.4
yargs-parser: 21.1.1
dev: false
/ts-node@10.9.2(@types/node@20.12.7)(typescript@5.4.5):
/ts-node@10.9.2(@types/node@20.14.14)(typescript@5.5.4):
resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==}
hasBin: true
peerDependencies:
@ -2238,14 +2281,14 @@ packages:
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 20.12.7
'@types/node': 20.14.14
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 5.4.5
typescript: 5.5.4
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
dev: false
@ -2260,8 +2303,8 @@ packages:
engines: {node: '>=10'}
dev: false
/typescript@5.4.5:
resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==}
/typescript@5.5.4:
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
engines: {node: '>=14.17'}
hasBin: true
dev: false
@ -2337,10 +2380,6 @@ packages:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
dev: false
/yallist@4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: false
/yargs-parser@21.1.1:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}

6
renovate.json Normal file
View File

@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
}

View File

@ -1,4 +1,4 @@
import { McUtilsAPIError } from "../types/error";
import {McUtilsAPIError} from "../types/error";
export default class WebRequest {
/**

View File

@ -1,5 +1,5 @@
import { CachedEndpointStatus } from "types/mojang/endpoint-status";
import { API_ENDPOINT } from "..";
import {EndpointStatuses} from "types/mojang/endpoint-status";
import {API_ENDPOINT} from "..";
import WebRequest from "../common/WebRequest";
const endpointStatusEndpoint = API_ENDPOINT + "/mojang/status";
@ -9,6 +9,6 @@ const endpointStatusEndpoint = API_ENDPOINT + "/mojang/status";
*
* @returns the Mojang API status
*/
export function getMojangEndpointStatus(): Promise<CachedEndpointStatus> {
return WebRequest.get(endpointStatusEndpoint);
export async function getMojangEndpointStatus(): Promise<EndpointStatuses> {
return WebRequest.get<EndpointStatuses>(endpointStatusEndpoint);
}

View File

@ -1,4 +1,4 @@
import { API_ENDPOINT, CachedPlayer, CachedUsernameToUuid } from "..";
import {API_ENDPOINT, CachedPlayer, CachedUsernameToUuid} from "..";
import WebRequest from "../common/WebRequest";
const playerEndpoint = API_ENDPOINT + "/player/{id}";
@ -11,7 +11,7 @@ const playerSkinPartEndpoint = API_ENDPOINT + "/player/{part}/{id}";
* @param id the id of the player
* @returns the player information, or null if the player does not exist
*/
export function getPlayer(id: string): Promise<CachedPlayer> {
export async function getPlayer(id: string): Promise<CachedPlayer> {
return WebRequest.get<CachedPlayer>(playerEndpoint.replace("{id}", id));
}
@ -21,7 +21,7 @@ export function getPlayer(id: string): Promise<CachedPlayer> {
* @param id the id of the player
* @returns the player's UUID, or null if the player does not exist
*/
export function getPlayerUuid(id: string): Promise<CachedUsernameToUuid> {
export async function getPlayerUuid(id: string): Promise<CachedUsernameToUuid> {
return WebRequest.get<CachedUsernameToUuid>(playerUsernameToUuidEndpoint.replace("{id}", id));
}
@ -32,6 +32,6 @@ export function getPlayerUuid(id: string): Promise<CachedUsernameToUuid> {
* @param id the id of the player
* @returns the player's skin part, or null if the player does not exist
*/
export function getPlayerSkinPart(part: string, id: string): Promise<Buffer> {
export async function getPlayerSkinPart(part: string, id: string): Promise<Buffer> {
return WebRequest.get<Buffer>(playerSkinPartEndpoint.replace("{part}", part).replace("{id}", id));
}

View File

@ -1,10 +1,11 @@
import { API_ENDPOINT, CachedBedrockMinecraftServer, CachedJavaMinecraftServer } from "..";
import {API_ENDPOINT, CachedBedrockMinecraftServer, CachedJavaMinecraftServer} from "..";
import WebRequest from "../common/WebRequest";
import { BlockedStatus } from "../types/server/blocked-status";
import { ServerPlatform } from "../types/server/platform";
import {BlockedStatus} from "../types/server/blocked-status";
import {ServerPlatform} from "../types/server/platform";
const serverEndpoint = API_ENDPOINT + "/server/{platform}/{hostname}";
const serverIconEndpoint = API_ENDPOINT + "/server/icon/{hostname}";
const serverPreviewEndpoint = API_ENDPOINT + "/server/{platform}/preview/{hostname}";
const blockedServerEndpoint = API_ENDPOINT + "/server/blocked/{hostname}";
/**
@ -15,7 +16,7 @@ const blockedServerEndpoint = API_ENDPOINT + "/server/blocked/{hostname}";
* @param port the port of the server
* @returns the server information, or null if the server does not exist
*/
export function getServer(
export async function getServer(
platform: ServerPlatform,
hostname: string,
port?: 25565
@ -33,17 +34,30 @@ export function getServer(
* @param port the port of the server
* @returns the server icon, or null if the server does not have an icon
*/
export function getServerIcon(hostname: string, port?: 25565): Promise<Buffer> {
export async function getServerIcon(hostname: string, port?: 25565): Promise<Buffer> {
const ip = port ? `${hostname}:${port}` : hostname;
return WebRequest.get<Buffer>(serverIconEndpoint.replace("{hostname}", ip));
}
/**
* Gets the preview of a Minecraft server's MOTD.
*
* @param platform the platform of the server
* @param hostname the hostname of the server
* @param port the port of the server
* @returns the server icon, or null if the server does not have an icon
*/
export async function getServerPreview(platform: ServerPlatform, hostname: string, port?: 25565): Promise<Buffer> {
const ip = port ? `${hostname}:${port}` : hostname;
return WebRequest.get<Buffer>(serverPreviewEndpoint.replace("{platform}", platform).replace("{hostname}", ip));
}
/**
* Gets the Mojang blocked status of a Minecraft server.
*
* @param hostname the hostname of the server
* @returns true if the server is blocked, false otherwise
*/
export function getBlockedStatus(hostname: string): Promise<BlockedStatus> {
export async function getBlockedStatus(hostname: string): Promise<BlockedStatus> {
return WebRequest.get<BlockedStatus>(blockedServerEndpoint.replace("{hostname}", hostname));
}

View File

@ -1,10 +1,26 @@
import { Status } from "../status";
import {Status} from "../status";
import {Cache} from "../cache";
export interface CachedEndpointStatus extends Cache, EndpointStatus {}
export interface EndpointStatuses extends EndpointStatus {
/**
* The endpoint statuses.
*/
endpoints: EndpointStatus[];
}
type EndpointStatus = {
/**
* The cached endpoint status.
* The name of the service.
*/
endpoints: Record<string, Status>;
name: string;
/**
* The endpoint of the service.
*/
endpoint: string;
/**
* The status of the service.
*/
status: Status;
};

View File

@ -1,4 +1,11 @@
export interface CachedPlayer extends Cache, Player {}
import {Cache} from "../cache";
export interface CachedPlayer extends Player {
/**
* The cache information.
*/
cache: Cache;
}
type Player = {
/**

View File

@ -1,6 +1,12 @@
import { MinecraftServer } from "../server";
import {MinecraftServer} from "../server";
import {Cache} from "../../cache";
export interface CachedBedrockMinecraftServer extends Cache, BedrockMinecraftServer {}
export interface CachedBedrockMinecraftServer extends BedrockMinecraftServer {
/**
* The cache information.
*/
cache: Cache;
}
interface BedrockMinecraftServer extends MinecraftServer {
/**

View File

@ -1,6 +1,12 @@
import { MinecraftServer } from "../server";
import {MinecraftServer} from "../server";
import {Cache} from "../../cache";
export interface CachedJavaMinecraftServer extends Cache, JavaMinecraftServer {}
export interface CachedJavaMinecraftServer extends JavaMinecraftServer {
/**
* The cache information.
*/
cache: Cache;
}
interface JavaMinecraftServer extends MinecraftServer {
/**

View File

@ -28,6 +28,11 @@ export type MinecraftServer = {
* The players on the server.
*/
players: Players;
/**
* The location of the server, or undefined if the location is unknown.
*/
location?: GeoLocation;
};
type Motd = {
@ -45,6 +50,11 @@ type Motd = {
* The HTML MOTD, with HTML tags for colors.
*/
html: string[];
/**
* The server list MOTD preview.
*/
preview: string;
};
type Players = {
@ -75,3 +85,30 @@ type PlayerSample = {
*/
name: string;
};
type GeoLocation = {
/**
* The country of the location.
*/
country: string;
/**
* The region of the location.
*/
region: string;
/**
* The city of the location.
*/
city: string;
/**
* The latitude of the location.
*/
latitude: number;
/**
* The longitude of the location.
*/
longitude: number;
}

View File

@ -1,4 +1,4 @@
import { getMojangEndpointStatus } from "../dist";
import {getMojangEndpointStatus} from "../dist";
test("ensureMojangEndpointStatusLookupSuccess", async () => {
const response = await getMojangEndpointStatus();

View File

@ -1,4 +1,4 @@
import { getPlayer, getPlayerSkinPart, getPlayerUuid } from "../dist/index";
import {getPlayer, getPlayerSkinPart, getPlayerUuid} from "../dist/index";
test("ensureGetPlayerLookupSuccess", async () => {
const player = await getPlayer("Notch");
@ -24,6 +24,7 @@ test("ensureGetPlayerSkinPartSuccess", async () => {
// Test each skin part
for (const part in skinParts) {
const partBuffer = await getPlayerSkinPart(part, player.uniqueId);
expect(partBuffer).toBeDefined();
expect(partBuffer.byteLength).toBeGreaterThan(0);
}

View File

@ -1,4 +1,4 @@
import { ServerPlatform, getBlockedStatus, getServer, getServerIcon } from "../dist";
import {getBlockedStatus, getServer, getServerIcon, getServerPreview, ServerPlatform} from "../dist";
test("ensureGetServerLookupSuccess", async () => {
const server = await getServer(ServerPlatform.Java, "mc.hypixel.net");
@ -9,6 +9,7 @@ test("ensureGetServerLookupSuccess", async () => {
test("ensureGetServerIconSuccess", async () => {
const icon = await getServerIcon("mc.hypixel.net");
expect(icon).toBeDefined();
expect(icon.byteLength).toBeGreaterThan(0); // The server has an icon
});
@ -19,3 +20,10 @@ test("ensureGetServerBlockedStatusSuccess", async () => {
expect(blocked).toBe(false); // The server is not blocked
});
test("ensureGetServerPreviewSuccess", async () => {
const preview = await getServerPreview(ServerPlatform.Java, "mc.hypixel.net");
expect(preview).toBeDefined();
expect(preview.byteLength).toBeGreaterThan(0); // The server has a preview
});