Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
1ad204a
Remove contributors with deleted accounts (#74053)
github-actions[bot] Nov 11, 2025
e3aecc5
🤖 Merge PR #74043 add hints to `discord-rpc`'s `Presence` interface b…
RuralAnemone Nov 11, 2025
a3d61f9
🤖 Merge PR #73901 Update exaroton types to 2.0.0 by @maxiicodes
maxiicodes Nov 11, 2025
c4a3535
🤖 Merge PR #74045 feat(validator): update isStrongPassword() with fal…
hkleungai Nov 11, 2025
5691e7a
🤖 Merge PR #74050 feat(validator): add `options.allow_primitives` to …
hkleungai Nov 11, 2025
af4bdb1
🤖 Merge PR #74035 feat(validator): narrow isVAT()'s `countryCode` to …
hkleungai Nov 11, 2025
7a50d38
🤖 Merge PR #74020 feat(validator): add options for isBase32(), update…
hkleungai Nov 11, 2025
533c36e
🤖 Merge PR #74016 feat(validator): update isBefore() & isAfter() to a…
hkleungai Nov 11, 2025
77c0a6a
🤖 Merge PR #74010 feat(validator): update & export isPostalCode's loc…
hkleungai Nov 11, 2025
5598a1e
🤖 Merge PR #74004 feat(validator): update & export isMobilePhone's lo…
hkleungai Nov 11, 2025
10a6e63
feat(validator): update isLicensePlate's locale list (#74008)
hkleungai Nov 11, 2025
9871bf3
feat(validator): add options.ignore_max_length to isFQDN() (#74024)
hkleungai Nov 11, 2025
e1dd81c
feat(validator): update isIBAN's locale list & factor out locale type…
hkleungai Nov 11, 2025
74209b3
feat(validator): add `options.withOptionalSeconds` to isTime() (#74044)
hkleungai Nov 11, 2025
80a919b
🤖 Merge PR #73998 [chrome] update browserAction namespace (MV2 only) …
erwanjugand Nov 11, 2025
d3264da
🤖 Merge PR #73999 [chrome] update pageAction namespace (MV2 only) by …
erwanjugand Nov 11, 2025
69142f7
🤖 Merge PR #74000 [chrome] update declarativeWebRequest namespace (MV…
erwanjugand Nov 11, 2025
9054266
🤖 Merge PR #73965 [chrome] update since Chrome 141-142 by @erwanjugand
erwanjugand Nov 11, 2025
51b82cb
🤖 Merge PR #73949 fix(chrome): corrected typo for `chrome.declarative…
cyfung1031 Nov 11, 2025
2df641b
🤖 Merge PR #73979 fix(chrome): Fix definitions of MV2 permissions by …
rnwst Nov 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
516 changes: 338 additions & 178 deletions types/chrome/index.d.ts

Large diffs are not rendered by default.

396 changes: 185 additions & 211 deletions types/chrome/test/index.ts

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions types/discord-rpc/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,20 +449,68 @@ export interface VoiceSettings {
}

export interface Presence {
/**
* The user's current party status
*/
state?: string | undefined;
/**
* What the user is currently doing
*/
details?: string | undefined;
/**
* Epoch seconds for game start — including will show time as "elapsed"
*/
startTimestamp?: number | Date | undefined;
/**
* Epoch seconds for game end — including will show time as "remaining"
*/
endTimestamp?: number | Date | undefined;
/**
* Key of the uploaded image for the large profile artwork
*/
largeImageKey?: string | undefined;
/**
* Tooltip for the largeImageKey
*/
largeImageText?: string | undefined;
/**
* Key of the uploaded image for the small profile artwork
*/
smallImageKey?: string | undefined;
/**
* Tooltip for the smallImageKey
*/
smallImageText?: string | undefined;
/**
* Whether or not the activity is an instanced game session
*/
instance?: boolean | undefined;
/**
* ID of the player's party, lobby, or group
*/
partyId?: string | undefined;
/**
* Current size of the player's party, lobby, or group
*/
partySize?: number | undefined;
/**
* Maximum size of the player's party, lobby, or group
*/
partyMax?: number | undefined;
/**
* Secret for a specified instanced match
*/
matchSecret?: string | undefined;
/**
* Secret for spectating a game
*/
spectateSecret?: string | undefined;
/**
* Unique hashed string for chat invitations and Ask to Join
*/
joinSecret?: string | undefined;
/**
* Custom buttons shown in the Rich Presence (max 2)
*/
buttons?: Array<{ label: string; url: string }> | undefined;
}
31 changes: 28 additions & 3 deletions types/exaroton/exaroton-tests.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import { Client, ServerStatus } from "exaroton";
import { Client, RequestError, ServerStatus } from "exaroton";
import { MinecraftServer, Notifications } from "mc-server-management";

const client = new Client("my token");

const startServer = async (name: string) => {
try {
const { name, email } = await client.getAccount();
console.log(`Using Account ${name} (${email})`);
} catch (err: unknown) {
if (err instanceof RequestError) {
console.error(`${err.statusCode}: ${err.message}`);
}
}

const servers = await client.getServers();
const myServer = servers.find(s => s.name === name);
if (!myServer) throw Error("Server not found");
await myServer.setMOTD("Hello World");
console.log(myServer.status);
if (myServer.hasStatus([myServer.STATUS.ONLINE, ServerStatus.STARTING])) return;
await myServer.start();
console.log(`${myServer.name} has benn started. Running on: ${myServer.address}`);
console.log(`${myServer.name} has been started. Running on: ${myServer.address}`);
console.log(myServer.status);
console.log(myServer.players.max);

Expand Down Expand Up @@ -53,6 +63,21 @@ const startServer = async (name: string) => {
myServer.on("stats:stats", data => console.log(data.memory.usage));
myServer.on("heap:heap", data => console.log(data.usage));
myServer.unsubscribe();

// management protocol
myServer.subscribe("management");
const stream = myServer.getWebsocketClient().getStream("management");
if (typeof stream === "boolean") return;

const connection = stream.getProxyConnection();

const mcServer = new MinecraftServer(connection);
const status = await mcServer.getStatus();
console.log(status);

mcServer.on(Notifications.ALLOWLIST_ADDED, data => {
console.log("Allowlist added", data);
});
};

startServer("my server");
startServer("my server").then(() => console.log("Server started"));
126 changes: 89 additions & 37 deletions types/exaroton/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Method, Options as GotOptions, ResponseType } from "got";
import { Connection } from "mc-server-management";
import { EventEmitter } from "node:events";
import { ReadStream, WriteStream } from "node:fs";
import { Readable, Writable } from "node:stream";
import { WebSocket } from "ws";

export { Client, ConfigOptionType, Pool, PoolMember, Request, Response, Server, ServerStatus, Software };
export { Client, ConfigOptionType, Pool, PoolMember, Request, RequestError, Response, Server, ServerStatus, Software };

declare enum ServerStatus {
OFFLINE = 0,
Expand Down Expand Up @@ -83,22 +83,7 @@ declare class Client {
* @param {Request} request
* @throws {RequestError} if the request was unsuccessful
*/
request<T extends Request>(request: T): Promise<unknown>;

/**
* @param {string} url
* @param {GotOptions & {
isStream?: true | boolean;
}} gotOptions
* @param {stream.Writable} outputStream
*/
streamResponse<T extends NodeJS.WritableStream>(
url: string,
gotOptions: GotOptions & {
isStream?: true | boolean;
},
outputStream: T,
): Promise<void>;
request<T extends Request>(request: T): Promise<Response>;

/**
* Get a list of all servers
Expand Down Expand Up @@ -145,7 +130,7 @@ declare class Request {
/**
* Request method, e.g. "GET" or "POST"
*/
method: Method;
method: HttpMethod;

/**
* Endpoint URL, without base, version or starting /
Expand Down Expand Up @@ -189,7 +174,7 @@ declare class Request {
/**
* Optional stream to stream the response body to
*/
outputStream?: WriteStream | null;
outputStream?: Writable | null;

/**
* Optional path to read the request body from
Expand All @@ -199,7 +184,7 @@ declare class Request {
/**
* Optional stream to read the request body from
*/
inputStream?: ReadStream | null;
inputStream?: Readable | null;

/**
* Client that has executed this request
Expand Down Expand Up @@ -237,7 +222,7 @@ declare class Request {
/**
* Get body for request
*/
getBody(): string | ReadStream;
getBody(): BodyInit;

/**
* Create a response object for this request
Expand All @@ -255,7 +240,7 @@ declare class Request {
/**
* @return {null|WriteStream}
*/
getOutputStream(): WriteStream | null;
getOutputStream(): Writable | null;

/**
* @return {boolean}
Expand All @@ -265,7 +250,7 @@ declare class Request {
/**
* @return {null|ReadStream}
*/
getInputStream(): ReadStream | null;
getInputStream(): Readable | null;

/**
* @return {boolean}
Expand Down Expand Up @@ -302,15 +287,15 @@ declare class Request {
* @param {ReadStream} inputStream
* @return {this}
*/
setInputStream(inputStream: ReadStream): this;
setInputStream(inputStream: Readable): this;

/**
* Set a stream as output stream for the response body
*
* @param {WriteStream} outputStream
* @return {this}
*/
setOutputStream(outputStream: WriteStream): this;
setOutputStream(outputStream: Writable): this;
}

declare class Response {
Expand Down Expand Up @@ -434,7 +419,7 @@ declare class File {
* @param {WriteStream} outputStream
* @return {Promise<Response>}
*/
downloadToStream(outputStream: WriteStream): Promise<Response>;
downloadToStream(outputStream: Writable): Promise<Response>;

/**
* Put the content of a file
Expand Down Expand Up @@ -462,7 +447,7 @@ declare class File {
* @param {ReadStream} inputStream
* @return {Promise<Response>}
*/
uploadFromStream(inputStream: ReadStream): Promise<Response>;
uploadFromStream(inputStream: Readable): Promise<Response>;

/**
* Delete the file
Expand Down Expand Up @@ -683,14 +668,29 @@ interface HeapData {
usage: number;
}

export interface StreamTypes {
interface ServerManagementData {
id: string;
method: string;
params: Record<string, string>;
}

export interface StreamTypesData {
management: [data: ServerManagementData];
status: [server: Server];
"console:line": [data: string];
"tick:tick": [data: TickData];
"stats:stats": [data: StatsData];
"heap:heap": [data: HeapData];
}

export interface StreamTypes {
console: ConsoleStream;
tick: TickStream;
stats: StatsStream;
heap: HeapStream;
management: ServerManagementStream;
}

declare class Server extends EventEmitter {
/**
* Shorthand to get server status constants
Expand Down Expand Up @@ -960,9 +960,9 @@ declare class Server extends EventEmitter {
*/
toJSON(): Record<string, any>;

on<StreamType extends keyof StreamTypes>(
on<StreamType extends keyof StreamTypesData>(
stream: StreamType,
listener: (...args: StreamTypes[StreamType]) => void,
listener: (...args: StreamTypesData[StreamType]) => void,
): this;
}

Expand All @@ -978,6 +978,35 @@ declare class Software {

// Internal types

declare class RequestError extends Error {
statusCode: number;

/**
* Response object that caused the error (if any)
*/
response: Response | null;

/**
* @param {Error|null} error
*/
constructor(error: Error | null);

/**
* Set error and status code from response object
*
* Returns if an error message was found
*
* @param {Response} response fetch response object
* @param {any} data response data
*/
setErrorFromResponseBody(response: globalThis.Response, data: any): void;
}

// all types used by the API, see: https://developers.exaroton.com
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";

type ResponseType = "text" | "json" | "buffer";

declare class Account {
#client: Client;

Expand Down Expand Up @@ -1059,6 +1088,7 @@ declare class WebsocketClient extends EventEmitter {
heap: HeapStream;
stats: StatsStream;
tick: TickStream;
management: ServerManagementStream;
};

constructor(server: Server);
Expand All @@ -1083,15 +1113,15 @@ declare class WebsocketClient extends EventEmitter {

getServerStatus(): Promise<number>;

getStreams(stream: string): boolean | Stream;
getStream<StreamType extends keyof StreamTypes>(stream: StreamType): boolean | StreamTypes[StreamType];

hasStream(stream: string): boolean;
hasStream(stream: SubscriptionType): boolean;

tryToStartStreams(): void;

removeStreams(stream: string): void;
removeStreams(stream: SubscriptionType): void;

send(stream: string, type: string, data: string): boolean;
send(stream: SubscriptionType, type: string, data: string): boolean;
}

declare class Stream extends EventEmitter {
Expand Down Expand Up @@ -1129,7 +1159,7 @@ declare class Stream extends EventEmitter {
isStarted(): boolean;
}

type SubscriptionType = "tick" | "heap" | "stats" | "console";
type SubscriptionType = "tick" | "heap" | "stats" | "console" | "management";

type TickDataType = "start" | "stop" | "started" | "tick";

Expand Down Expand Up @@ -1169,3 +1199,25 @@ declare class ConsoleStream extends Stream {

sendCommand(command: string): void;
}

declare class ManagementProxyConnection extends Connection {
stream: ServerManagementStream;

protected callRaw(
method: string,
parameters: object | Array<unknown>,
): Promise<{ success: true; data: unknown } | { success: false; error: unknown }>;

close(): void;
}

declare class ServerManagementStream extends Stream {
readonly name: string;
readonly startStatuses: StreamStatus[];

onDataMessage(type: string, message: Record<string, unknown>): void;

request(method: HttpMethod, params: any): Promise<void>;

getProxyConnection(): ManagementProxyConnection;
}
Loading