@srvquery/protocol-minecraft-bedrock 0.0.1-next.0

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.
@@ -0,0 +1,8 @@
1
+ /** RakNet magic used by unconnected ping packets. */
2
+ export declare const rakNetMagic: Buffer<ArrayBuffer>;
3
+ /** Builds a Minecraft Bedrock/RakNet unconnected ping packet. */
4
+ export declare const buildUnconnectedPingPacket: ({ timestamp, clientGuid, }: {
5
+ timestamp: bigint;
6
+ clientGuid?: Buffer;
7
+ }) => Buffer;
8
+ //# sourceMappingURL=request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/packet/request.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,eAAO,MAAM,WAAW,qBAAyD,CAAC;AAElF,iEAAiE;AACjE,eAAO,MAAM,0BAA0B,+BAGpC;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,MAQH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Parses a RakNet unconnected pong and its semicolon-delimited MOTD. */
2
+ export declare const parseUnconnectedPongPacket: (packet: Buffer) => {
3
+ edition: string;
4
+ motd: string;
5
+ protocol: string;
6
+ version: string;
7
+ onlinePlayers: string;
8
+ maxPlayers: string;
9
+ serverId: string;
10
+ map: string;
11
+ gameMode: string;
12
+ portV4: string;
13
+ portV6: string;
14
+ };
15
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/packet/response.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,WAAY,MAAM;IAerD,OAAO;IACP,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,aAAa;IACb,UAAU;IACV,QAAQ;IACR,GAAG;IACH,QAAQ;IACR,MAAM;IACN,MAAM;CAET,CAAC"}
@@ -0,0 +1,18 @@
1
+ import z from "zod";
2
+ /** Validates a Minecraft Bedrock server status response. */
3
+ export declare const MinecraftBedrockServerStatusSchema: z.ZodObject<{
4
+ edition: z.ZodString;
5
+ motd: z.ZodString;
6
+ protocol: z.ZodCoercedNumber<unknown>;
7
+ version: z.ZodString;
8
+ onlinePlayers: z.ZodCoercedNumber<unknown>;
9
+ maxPlayers: z.ZodCoercedNumber<unknown>;
10
+ serverId: z.ZodString;
11
+ map: z.ZodString;
12
+ gameMode: z.ZodString;
13
+ portV4: z.ZodCoercedNumber<unknown>;
14
+ portV6: z.ZodCoercedNumber<unknown>;
15
+ }, z.core.$strip>;
16
+ /** Server status returned by a Minecraft Bedrock unconnected ping. */
17
+ export type MinecraftBedrockServerStatus = z.infer<typeof MinecraftBedrockServerStatusSchema>;
18
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/packet/schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,4DAA4D;AAC5D,eAAO,MAAM,kCAAkC;;;;;;;;;;;;iBAY7C,CAAC;AAEH,sEAAsE;AACtE,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { type CreateUdpSocketOptions, type CreateUdpSocketParams, type RetryOptions } from "@srvquery/core";
2
+ import { type MinecraftBedrockServerStatus } from "./packet/schema";
3
+ /** Default UDP port used by Minecraft Bedrock servers. */
4
+ export declare const defaultMinecraftBedrockPort = 19132;
5
+ /** Connection and retry settings used to create a Minecraft Bedrock client. */
6
+ export type CreateMinecraftBedrockProtocolParams = Omit<CreateUdpSocketParams, "port"> & {
7
+ port?: number;
8
+ retry?: RetryOptions;
9
+ } & Omit<CreateUdpSocketOptions, "retry">;
10
+ /** Query operations supported by Minecraft Bedrock. */
11
+ export type MinecraftBedrockProtocolRequestOpcode = "STATUS" | "PING";
12
+ type MinecraftBedrockResponseMap = {
13
+ STATUS: MinecraftBedrockServerStatus;
14
+ PING: number;
15
+ };
16
+ /** Client for querying Minecraft Bedrock servers directly over RakNet UDP. */
17
+ export interface MinecraftBedrockProtocol {
18
+ query<Opcode extends MinecraftBedrockProtocolRequestOpcode>({ opcode, }: {
19
+ opcode: Opcode;
20
+ }): Promise<MinecraftBedrockResponseMap[Opcode]>;
21
+ }
22
+ export declare const createMinecraftBedrockProtocol: ({ host, port, retry, timeout, ...socketOptions }: CreateMinecraftBedrockProtocolParams) => MinecraftBedrockProtocol;
23
+ export {};
24
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAI1B,KAAK,YAAY,EAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,4BAA4B,EAClC,MAAM,iBAAiB,CAAC;AAIzB,0DAA0D;AAC1D,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AAEjD,+EAA+E;AAC/E,MAAM,MAAM,oCAAoC,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,GAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAC;AAE1C,uDAAuD;AACvD,MAAM,MAAM,qCAAqC,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtE,KAAK,2BAA2B,GAAG;IACjC,MAAM,EAAE,4BAA4B,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,MAAM,SAAS,qCAAqC,EAAE,EAC1D,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,8BAA8B,qDAMxC,oCAAoC,KAAG,wBAmCzC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@srvquery/protocol-minecraft-bedrock",
3
+ "version": "0.0.1-next.0",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "dependencies": {
15
+ "zod": "^4.5.4"
16
+ },
17
+ "devDependencies": {
18
+ "@internal/typescript-config": "0.0.0",
19
+ "@srvquery/core": "0.0.1-next.0",
20
+ "@types/node": "^26.4.1",
21
+ "rolldown": "^1.2.7",
22
+ "typescript": "^7.0.2",
23
+ "vitest": "^5.0.0"
24
+ },
25
+ "peerDependencies": {
26
+ "@srvquery/core": "0.0.1-next.0"
27
+ },
28
+ "scripts": {
29
+ "build": "rolldown -c rolldown.config.ts && tsc -p tsconfig.json",
30
+ "test": "vitest run",
31
+ "test:watch": "vitest"
32
+ }
33
+ }