@colyseus/core 0.16.0-preview.9 → 0.16.1
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.
- package/README.md +5 -5
- package/build/Debug.js +6 -2
- package/build/Debug.js.map +2 -2
- package/build/Debug.mjs +11 -10
- package/build/Debug.mjs.map +2 -2
- package/build/IPC.d.ts +1 -1
- package/build/IPC.js +3 -3
- package/build/IPC.js.map +2 -2
- package/build/IPC.mjs +4 -3
- package/build/IPC.mjs.map +2 -2
- package/build/Logger.mjs +4 -3
- package/build/Logger.mjs.map +1 -1
- package/build/MatchMaker.d.ts +35 -30
- package/build/MatchMaker.js +150 -100
- package/build/MatchMaker.js.map +2 -2
- package/build/MatchMaker.mjs +154 -107
- package/build/MatchMaker.mjs.map +2 -2
- package/build/Protocol.d.ts +3 -4
- package/build/Protocol.js +33 -19
- package/build/Protocol.js.map +2 -2
- package/build/Protocol.mjs +36 -21
- package/build/Protocol.mjs.map +2 -2
- package/build/Room.d.ts +64 -40
- package/build/Room.js +408 -151
- package/build/Room.js.map +2 -2
- package/build/Room.mjs +412 -158
- package/build/Room.mjs.map +2 -2
- package/build/Server.d.ts +8 -7
- package/build/Server.js +51 -18
- package/build/Server.js.map +2 -2
- package/build/Server.mjs +51 -21
- package/build/Server.mjs.map +3 -3
- package/build/Stats.d.ts +2 -0
- package/build/Stats.js +38 -3
- package/build/Stats.js.map +2 -2
- package/build/Stats.mjs +30 -6
- package/build/Stats.mjs.map +2 -2
- package/build/Transport.d.ts +8 -7
- package/build/Transport.js +1 -1
- package/build/Transport.js.map +2 -2
- package/build/Transport.mjs +6 -5
- package/build/Transport.mjs.map +2 -2
- package/build/discovery/index.d.ts +1 -1
- package/build/discovery/index.js.map +2 -2
- package/build/discovery/index.mjs +3 -2
- package/build/discovery/index.mjs.map +2 -2
- package/build/errors/RoomExceptions.d.ts +39 -0
- package/build/errors/RoomExceptions.js +100 -0
- package/build/errors/RoomExceptions.js.map +7 -0
- package/build/errors/RoomExceptions.mjs +71 -0
- package/build/errors/RoomExceptions.mjs.map +7 -0
- package/build/errors/SeatReservationError.mjs +3 -2
- package/build/errors/SeatReservationError.mjs.map +1 -1
- package/build/errors/ServerError.js +1 -1
- package/build/errors/ServerError.js.map +1 -1
- package/build/errors/ServerError.mjs +5 -4
- package/build/errors/ServerError.mjs.map +2 -2
- package/build/index.d.ts +21 -19
- package/build/index.js +45 -20
- package/build/index.js.map +2 -2
- package/build/index.mjs +39 -19
- package/build/index.mjs.map +2 -2
- package/build/matchmaker/Lobby.d.ts +3 -3
- package/build/matchmaker/Lobby.js +6 -3
- package/build/matchmaker/Lobby.js.map +2 -2
- package/build/matchmaker/Lobby.mjs +4 -4
- package/build/matchmaker/Lobby.mjs.map +2 -2
- package/build/matchmaker/RegisteredHandler.d.ts +6 -7
- package/build/matchmaker/RegisteredHandler.js +7 -10
- package/build/matchmaker/RegisteredHandler.js.map +2 -2
- package/build/matchmaker/RegisteredHandler.mjs +11 -13
- package/build/matchmaker/RegisteredHandler.mjs.map +2 -2
- package/build/matchmaker/controller.d.ts +4 -5
- package/build/matchmaker/controller.js +22 -15
- package/build/matchmaker/controller.js.map +2 -2
- package/build/matchmaker/controller.mjs +19 -13
- package/build/matchmaker/controller.mjs.map +2 -2
- package/build/matchmaker/driver/api.d.ts +104 -0
- package/build/matchmaker/driver/api.js +29 -0
- package/build/matchmaker/driver/api.js.map +7 -0
- package/build/matchmaker/driver/api.mjs +7 -0
- package/build/matchmaker/driver/api.mjs.map +7 -0
- package/build/matchmaker/driver/index.d.ts +2 -2
- package/build/matchmaker/driver/index.js +2 -2
- package/build/matchmaker/driver/index.js.map +2 -2
- package/build/matchmaker/driver/index.mjs +5 -4
- package/build/matchmaker/driver/index.mjs.map +2 -2
- package/build/matchmaker/driver/local/LocalDriver.d.ts +13 -0
- package/build/matchmaker/driver/local/LocalDriver.js +65 -0
- package/build/matchmaker/driver/local/LocalDriver.js.map +7 -0
- package/build/matchmaker/driver/local/LocalDriver.mjs +43 -0
- package/build/matchmaker/driver/local/LocalDriver.mjs.map +7 -0
- package/build/matchmaker/driver/local/Query.d.ts +9 -0
- package/build/matchmaker/driver/local/Query.js +78 -0
- package/build/matchmaker/driver/local/Query.js.map +7 -0
- package/build/matchmaker/driver/local/Query.mjs +56 -0
- package/build/matchmaker/driver/local/Query.mjs.map +7 -0
- package/build/matchmaker/driver/local/RoomData.d.ts +19 -0
- package/build/matchmaker/driver/local/RoomData.js +79 -0
- package/build/matchmaker/driver/local/RoomData.js.map +7 -0
- package/build/matchmaker/driver/local/RoomData.mjs +57 -0
- package/build/matchmaker/driver/local/RoomData.mjs.map +7 -0
- package/build/presence/LocalPresence.d.ts +10 -6
- package/build/presence/LocalPresence.js +85 -24
- package/build/presence/LocalPresence.js.map +3 -3
- package/build/presence/LocalPresence.mjs +85 -27
- package/build/presence/LocalPresence.mjs.map +3 -3
- package/build/presence/Presence.d.ts +38 -2
- package/build/presence/Presence.js.map +1 -1
- package/build/rooms/LobbyRoom.d.ts +6 -6
- package/build/rooms/LobbyRoom.js +8 -3
- package/build/rooms/LobbyRoom.js.map +2 -2
- package/build/rooms/LobbyRoom.mjs +7 -5
- package/build/rooms/LobbyRoom.mjs.map +2 -2
- package/build/rooms/RelayRoom.d.ts +3 -3
- package/build/rooms/RelayRoom.js +3 -1
- package/build/rooms/RelayRoom.js.map +2 -2
- package/build/rooms/RelayRoom.mjs +10 -7
- package/build/rooms/RelayRoom.mjs.map +2 -2
- package/build/serializer/NoneSerializer.d.ts +2 -2
- package/build/serializer/NoneSerializer.js.map +1 -1
- package/build/serializer/NoneSerializer.mjs +3 -2
- package/build/serializer/NoneSerializer.mjs.map +2 -2
- package/build/serializer/SchemaSerializer.d.ts +16 -15
- package/build/serializer/SchemaSerializer.js +12 -10
- package/build/serializer/SchemaSerializer.js.map +2 -2
- package/build/serializer/SchemaSerializer.mjs +16 -13
- package/build/serializer/SchemaSerializer.mjs.map +2 -2
- package/build/serializer/SchemaSerializerDebug.d.ts +7 -0
- package/build/serializer/SchemaSerializerDebug.js +0 -0
- package/build/serializer/SchemaSerializerDebug.js.map +7 -0
- package/build/serializer/SchemaSerializerDebug.mjs +0 -0
- package/build/serializer/SchemaSerializerDebug.mjs.map +7 -0
- package/build/serializer/Serializer.d.ts +1 -2
- package/build/serializer/Serializer.js.map +1 -1
- package/build/utils/DevMode.d.ts +2 -2
- package/build/utils/DevMode.js +8 -4
- package/build/utils/DevMode.js.map +2 -2
- package/build/utils/DevMode.mjs +7 -6
- package/build/utils/DevMode.mjs.map +2 -2
- package/build/utils/Utils.d.ts +8 -3
- package/build/utils/Utils.js +41 -17
- package/build/utils/Utils.js.map +2 -2
- package/build/utils/Utils.mjs +40 -21
- package/build/utils/Utils.mjs.map +2 -2
- package/package.json +17 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// packages/core/src/discovery/index.ts
|
|
2
|
+
var NODES_SET = "colyseus:nodes";
|
|
3
|
+
var DISCOVERY_CHANNEL = "colyseus:nodes:discovery";
|
|
3
4
|
async function getHostname() {
|
|
4
5
|
return process.env.SELF_HOSTNAME;
|
|
5
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/discovery/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { Presence } from '../presence/Presence';\n\nconst NODES_SET = 'colyseus:nodes';\nconst DISCOVERY_CHANNEL = 'colyseus:nodes:discovery';\n\nexport interface Node {\n port: number;\n processId: string;\n}\n\nexport async function getHostname() {\n return process.env.SELF_HOSTNAME;\n}\n\nasync function getNodeAddress(node: Node) {\n const host = await getHostname();\n const port = process.env.SELF_PORT ?? node.port;\n return (port)\n ? `${node.processId}/${host}:${port}`\n : `${node.processId}/${host}`;\n}\n\nexport async function registerNode(presence: Presence, node: Node) {\n const nodeAddress = await getNodeAddress(node);\n await presence.sadd(NODES_SET, nodeAddress);\n await presence.publish(DISCOVERY_CHANNEL, `add,${nodeAddress}`);\n}\n\nexport async function unregisterNode(presence: Presence, node: Node) {\n const nodeAddress = await getNodeAddress(node);\n await presence.srem(NODES_SET, nodeAddress);\n await presence.publish(DISCOVERY_CHANNEL, `remove,${nodeAddress}`);\n}\n"],
|
|
5
|
-
"mappings": "AAEA,
|
|
4
|
+
"sourcesContent": ["import { Presence } from '../presence/Presence.js';\n\nconst NODES_SET = 'colyseus:nodes';\nconst DISCOVERY_CHANNEL = 'colyseus:nodes:discovery';\n\nexport interface Node {\n port: number;\n processId: string;\n}\n\nexport async function getHostname() {\n return process.env.SELF_HOSTNAME;\n}\n\nasync function getNodeAddress(node: Node) {\n const host = await getHostname();\n const port = process.env.SELF_PORT ?? node.port;\n return (port)\n ? `${node.processId}/${host}:${port}`\n : `${node.processId}/${host}`;\n}\n\nexport async function registerNode(presence: Presence, node: Node) {\n const nodeAddress = await getNodeAddress(node);\n await presence.sadd(NODES_SET, nodeAddress);\n await presence.publish(DISCOVERY_CHANNEL, `add,${nodeAddress}`);\n}\n\nexport async function unregisterNode(presence: Presence, node: Node) {\n const nodeAddress = await getNodeAddress(node);\n await presence.srem(NODES_SET, nodeAddress);\n await presence.publish(DISCOVERY_CHANNEL, `remove,${nodeAddress}`);\n}\n"],
|
|
5
|
+
"mappings": ";AAEA,IAAM,YAAY;AAClB,IAAM,oBAAoB;AAO1B,eAAsB,cAAc;AAClC,SAAO,QAAQ,IAAI;AACrB;AAEA,eAAe,eAAe,MAAY;AACxC,QAAM,OAAO,MAAM,YAAY;AAC/B,QAAM,OAAO,QAAQ,IAAI,aAAa,KAAK;AAC3C,SAAQ,OACJ,GAAG,KAAK,SAAS,IAAI,IAAI,IAAI,IAAI,KACjC,GAAG,KAAK,SAAS,IAAI,IAAI;AAC/B;AAEA,eAAsB,aAAa,UAAoB,MAAY;AACjE,QAAM,cAAc,MAAM,eAAe,IAAI;AAC7C,QAAM,SAAS,KAAK,WAAW,WAAW;AAC1C,QAAM,SAAS,QAAQ,mBAAmB,OAAO,WAAW,EAAE;AAChE;AAEA,eAAsB,eAAe,UAAoB,MAAY;AACnE,QAAM,cAAc,MAAM,eAAe,IAAI;AAC7C,QAAM,SAAS,KAAK,WAAW,WAAW;AAC1C,QAAM,SAAS,QAAQ,mBAAmB,UAAU,WAAW,EAAE;AACnE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Client } from '../Transport';
|
|
2
|
+
import type { ExtractAuthData, ExtractUserData, Room } from '../Room';
|
|
3
|
+
export type RoomException<R extends Room = Room> = OnCreateException<R> | OnAuthException<R> | OnJoinException<R> | OnLeaveException<R> | OnDisposeException | OnMessageException<R> | SimulationIntervalException | TimedEventException;
|
|
4
|
+
export declare class OnCreateException<R extends Room = Room> extends Error {
|
|
5
|
+
options: Parameters<R['onCreate']>[0];
|
|
6
|
+
constructor(cause: Error, message: string, options: Parameters<R['onCreate']>[0]);
|
|
7
|
+
}
|
|
8
|
+
export declare class OnAuthException<R extends Room = Room> extends Error {
|
|
9
|
+
client: Parameters<R['onAuth']>[0];
|
|
10
|
+
options: Parameters<R['onAuth']>[1];
|
|
11
|
+
constructor(cause: Error, message: string, client: Parameters<R['onAuth']>[0], options: Parameters<R['onAuth']>[1]);
|
|
12
|
+
}
|
|
13
|
+
export declare class OnJoinException<R extends Room = Room> extends Error {
|
|
14
|
+
client: Parameters<R['onJoin']>[0];
|
|
15
|
+
options: Parameters<R['onJoin']>[1];
|
|
16
|
+
auth: Parameters<R['onJoin']>[2];
|
|
17
|
+
constructor(cause: Error, message: string, client: Parameters<R['onJoin']>[0], options: Parameters<R['onJoin']>[1], auth: Parameters<R['onJoin']>[2]);
|
|
18
|
+
}
|
|
19
|
+
export declare class OnLeaveException<R extends Room = Room> extends Error {
|
|
20
|
+
client: Parameters<R['onLeave']>[0];
|
|
21
|
+
consented: Parameters<R['onLeave']>[1];
|
|
22
|
+
constructor(cause: Error, message: string, client: Parameters<R['onLeave']>[0], consented: Parameters<R['onLeave']>[1]);
|
|
23
|
+
}
|
|
24
|
+
export declare class OnDisposeException extends Error {
|
|
25
|
+
constructor(cause: Error, message: string);
|
|
26
|
+
}
|
|
27
|
+
export declare class OnMessageException<R extends Room = Room, MessagePayload = any> extends Error {
|
|
28
|
+
client: Client<ExtractUserData<R['clients']>, ExtractAuthData<R['clients']>>;
|
|
29
|
+
payload: MessagePayload;
|
|
30
|
+
type: string;
|
|
31
|
+
constructor(cause: Error, message: string, client: Client<ExtractUserData<R['clients']>, ExtractAuthData<R['clients']>>, payload: MessagePayload, type: string);
|
|
32
|
+
}
|
|
33
|
+
export declare class SimulationIntervalException extends Error {
|
|
34
|
+
constructor(cause: Error, message: string);
|
|
35
|
+
}
|
|
36
|
+
export declare class TimedEventException extends Error {
|
|
37
|
+
args: any[];
|
|
38
|
+
constructor(cause: Error, message: string, ...args: any[]);
|
|
39
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var RoomExceptions_exports = {};
|
|
19
|
+
__export(RoomExceptions_exports, {
|
|
20
|
+
OnAuthException: () => OnAuthException,
|
|
21
|
+
OnCreateException: () => OnCreateException,
|
|
22
|
+
OnDisposeException: () => OnDisposeException,
|
|
23
|
+
OnJoinException: () => OnJoinException,
|
|
24
|
+
OnLeaveException: () => OnLeaveException,
|
|
25
|
+
OnMessageException: () => OnMessageException,
|
|
26
|
+
SimulationIntervalException: () => SimulationIntervalException,
|
|
27
|
+
TimedEventException: () => TimedEventException
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(RoomExceptions_exports);
|
|
30
|
+
class OnCreateException extends Error {
|
|
31
|
+
constructor(cause, message, options) {
|
|
32
|
+
super(message, { cause });
|
|
33
|
+
this.options = options;
|
|
34
|
+
this.name = "OnCreateException";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class OnAuthException extends Error {
|
|
38
|
+
constructor(cause, message, client, options) {
|
|
39
|
+
super(message, { cause });
|
|
40
|
+
this.client = client;
|
|
41
|
+
this.options = options;
|
|
42
|
+
this.name = "OnAuthException";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
class OnJoinException extends Error {
|
|
46
|
+
constructor(cause, message, client, options, auth) {
|
|
47
|
+
super(message, { cause });
|
|
48
|
+
this.client = client;
|
|
49
|
+
this.options = options;
|
|
50
|
+
this.auth = auth;
|
|
51
|
+
this.name = "OnJoinException";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
class OnLeaveException extends Error {
|
|
55
|
+
constructor(cause, message, client, consented) {
|
|
56
|
+
super(message, { cause });
|
|
57
|
+
this.client = client;
|
|
58
|
+
this.consented = consented;
|
|
59
|
+
this.name = "OnLeaveException";
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
class OnDisposeException extends Error {
|
|
63
|
+
constructor(cause, message) {
|
|
64
|
+
super(message, { cause });
|
|
65
|
+
this.name = "OnDisposeException";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class OnMessageException extends Error {
|
|
69
|
+
constructor(cause, message, client, payload, type) {
|
|
70
|
+
super(message, { cause });
|
|
71
|
+
this.client = client;
|
|
72
|
+
this.payload = payload;
|
|
73
|
+
this.type = type;
|
|
74
|
+
this.name = "OnMessageException";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
class SimulationIntervalException extends Error {
|
|
78
|
+
constructor(cause, message) {
|
|
79
|
+
super(message, { cause });
|
|
80
|
+
this.name = "SimulationIntervalException";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
class TimedEventException extends Error {
|
|
84
|
+
constructor(cause, message, ...args) {
|
|
85
|
+
super(message, { cause });
|
|
86
|
+
this.name = "TimedEventException";
|
|
87
|
+
this.args = args;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
OnAuthException,
|
|
93
|
+
OnCreateException,
|
|
94
|
+
OnDisposeException,
|
|
95
|
+
OnJoinException,
|
|
96
|
+
OnLeaveException,
|
|
97
|
+
OnMessageException,
|
|
98
|
+
SimulationIntervalException,
|
|
99
|
+
TimedEventException
|
|
100
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/errors/RoomExceptions.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Client } from '../Transport';\nimport type { ExtractAuthData, ExtractUserData, Room } from '../Room';\n\nexport type RoomException<R extends Room = Room> =\n OnCreateException<R> |\n OnAuthException<R> |\n OnJoinException<R> |\n OnLeaveException<R> |\n OnDisposeException |\n OnMessageException<R> |\n SimulationIntervalException |\n TimedEventException;\n\nexport class OnCreateException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public options: Parameters<R['onCreate']>[0],\n ) {\n super(message, { cause });\n this.name = 'OnCreateException';\n }\n}\n\nexport class OnAuthException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Parameters<R['onAuth']>[0],\n public options: Parameters<R['onAuth']>[1],\n ) {\n super(message, { cause });\n this.name = 'OnAuthException';\n }\n}\n\nexport class OnJoinException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Parameters<R['onJoin']>[0],\n public options: Parameters<R['onJoin']>[1],\n public auth: Parameters<R['onJoin']>[2],\n ) {\n super(message, { cause });\n this.name = 'OnJoinException';\n }\n}\n\nexport class OnLeaveException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Parameters<R['onLeave']>[0],\n public consented: Parameters<R['onLeave']>[1],\n ) {\n super(message, { cause });\n this.name = 'OnLeaveException';\n }\n}\n\nexport class OnDisposeException extends Error {\n constructor(\n cause: Error,\n message: string,\n ) {\n super(message, { cause });\n this.name = 'OnDisposeException';\n }\n}\n\nexport class OnMessageException<R extends Room = Room, MessagePayload = any> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Client<ExtractUserData<R['clients']>, ExtractAuthData<R['clients']>>,\n public payload: MessagePayload,\n public type: string,\n ) {\n super(message, { cause });\n this.name = 'OnMessageException';\n }\n}\n\nexport class SimulationIntervalException extends Error {\n constructor(\n cause: Error,\n message: string,\n ) {\n super(message, { cause });\n this.name = 'SimulationIntervalException';\n }\n}\n\nexport class TimedEventException extends Error {\n public args: any[];\n constructor(\n cause: Error,\n message: string,\n ...args: any[]\n ) {\n super(message, { cause });\n this.name = 'TimedEventException';\n this.args = args;\n }\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,MAAM,0BAAiD,MAAM;AAAA,EAClE,YACE,OACA,SACO,SACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAFjB;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,wBAA+C,MAAM;AAAA,EAChE,YACE,OACA,SACO,QACA,SACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAHjB;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,wBAA+C,MAAM;AAAA,EAChE,YACE,OACA,SACO,QACA,SACA,MACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAJjB;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,yBAAgD,MAAM;AAAA,EACjE,YACE,OACA,SACO,QACA,WACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAHjB;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,2BAA2B,MAAM;AAAA,EAC5C,YACE,OACA,SACA;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,2BAAwE,MAAM;AAAA,EACzF,YACE,OACA,SACO,QACA,SACA,MACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAJjB;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,oCAAoC,MAAM;AAAA,EACrD,YACE,OACA,SACA;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,MAAM,4BAA4B,MAAM;AAAA,EAE7C,YACE,OACA,YACG,MACH;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AACxB,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// packages/core/src/errors/RoomExceptions.ts
|
|
2
|
+
var OnCreateException = class extends Error {
|
|
3
|
+
constructor(cause, message, options) {
|
|
4
|
+
super(message, { cause });
|
|
5
|
+
this.options = options;
|
|
6
|
+
this.name = "OnCreateException";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var OnAuthException = class extends Error {
|
|
10
|
+
constructor(cause, message, client, options) {
|
|
11
|
+
super(message, { cause });
|
|
12
|
+
this.client = client;
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.name = "OnAuthException";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var OnJoinException = class extends Error {
|
|
18
|
+
constructor(cause, message, client, options, auth) {
|
|
19
|
+
super(message, { cause });
|
|
20
|
+
this.client = client;
|
|
21
|
+
this.options = options;
|
|
22
|
+
this.auth = auth;
|
|
23
|
+
this.name = "OnJoinException";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var OnLeaveException = class extends Error {
|
|
27
|
+
constructor(cause, message, client, consented) {
|
|
28
|
+
super(message, { cause });
|
|
29
|
+
this.client = client;
|
|
30
|
+
this.consented = consented;
|
|
31
|
+
this.name = "OnLeaveException";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var OnDisposeException = class extends Error {
|
|
35
|
+
constructor(cause, message) {
|
|
36
|
+
super(message, { cause });
|
|
37
|
+
this.name = "OnDisposeException";
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var OnMessageException = class extends Error {
|
|
41
|
+
constructor(cause, message, client, payload, type) {
|
|
42
|
+
super(message, { cause });
|
|
43
|
+
this.client = client;
|
|
44
|
+
this.payload = payload;
|
|
45
|
+
this.type = type;
|
|
46
|
+
this.name = "OnMessageException";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var SimulationIntervalException = class extends Error {
|
|
50
|
+
constructor(cause, message) {
|
|
51
|
+
super(message, { cause });
|
|
52
|
+
this.name = "SimulationIntervalException";
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var TimedEventException = class extends Error {
|
|
56
|
+
constructor(cause, message, ...args) {
|
|
57
|
+
super(message, { cause });
|
|
58
|
+
this.name = "TimedEventException";
|
|
59
|
+
this.args = args;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
OnAuthException,
|
|
64
|
+
OnCreateException,
|
|
65
|
+
OnDisposeException,
|
|
66
|
+
OnJoinException,
|
|
67
|
+
OnLeaveException,
|
|
68
|
+
OnMessageException,
|
|
69
|
+
SimulationIntervalException,
|
|
70
|
+
TimedEventException
|
|
71
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/errors/RoomExceptions.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Client } from '../Transport';\nimport type { ExtractAuthData, ExtractUserData, Room } from '../Room';\n\nexport type RoomException<R extends Room = Room> =\n OnCreateException<R> |\n OnAuthException<R> |\n OnJoinException<R> |\n OnLeaveException<R> |\n OnDisposeException |\n OnMessageException<R> |\n SimulationIntervalException |\n TimedEventException;\n\nexport class OnCreateException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public options: Parameters<R['onCreate']>[0],\n ) {\n super(message, { cause });\n this.name = 'OnCreateException';\n }\n}\n\nexport class OnAuthException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Parameters<R['onAuth']>[0],\n public options: Parameters<R['onAuth']>[1],\n ) {\n super(message, { cause });\n this.name = 'OnAuthException';\n }\n}\n\nexport class OnJoinException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Parameters<R['onJoin']>[0],\n public options: Parameters<R['onJoin']>[1],\n public auth: Parameters<R['onJoin']>[2],\n ) {\n super(message, { cause });\n this.name = 'OnJoinException';\n }\n}\n\nexport class OnLeaveException<R extends Room = Room> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Parameters<R['onLeave']>[0],\n public consented: Parameters<R['onLeave']>[1],\n ) {\n super(message, { cause });\n this.name = 'OnLeaveException';\n }\n}\n\nexport class OnDisposeException extends Error {\n constructor(\n cause: Error,\n message: string,\n ) {\n super(message, { cause });\n this.name = 'OnDisposeException';\n }\n}\n\nexport class OnMessageException<R extends Room = Room, MessagePayload = any> extends Error {\n constructor(\n cause: Error,\n message: string,\n public client: Client<ExtractUserData<R['clients']>, ExtractAuthData<R['clients']>>,\n public payload: MessagePayload,\n public type: string,\n ) {\n super(message, { cause });\n this.name = 'OnMessageException';\n }\n}\n\nexport class SimulationIntervalException extends Error {\n constructor(\n cause: Error,\n message: string,\n ) {\n super(message, { cause });\n this.name = 'SimulationIntervalException';\n }\n}\n\nexport class TimedEventException extends Error {\n public args: any[];\n constructor(\n cause: Error,\n message: string,\n ...args: any[]\n ) {\n super(message, { cause });\n this.name = 'TimedEventException';\n this.args = args;\n }\n}"],
|
|
5
|
+
"mappings": ";AAaO,IAAM,oBAAN,cAAuD,MAAM;AAAA,EAClE,YACE,OACA,SACO,SACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAFjB;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAAqD,MAAM;AAAA,EAChE,YACE,OACA,SACO,QACA,SACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAHjB;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAAqD,MAAM;AAAA,EAChE,YACE,OACA,SACO,QACA,SACA,MACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAJjB;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,mBAAN,cAAsD,MAAM;AAAA,EACjE,YACE,OACA,SACO,QACA,WACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAHjB;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,qBAAN,cAAiC,MAAM;AAAA,EAC5C,YACE,OACA,SACA;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,qBAAN,cAA8E,MAAM;AAAA,EACzF,YACE,OACA,SACO,QACA,SACA,MACP;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AAJjB;AACA;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,8BAAN,cAA0C,MAAM;AAAA,EACrD,YACE,OACA,SACA;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AACxB,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAE7C,YACE,OACA,YACG,MACH;AACA,UAAM,SAAS,EAAE,MAAM,CAAC;AACxB,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/errors/SeatReservationError.ts"],
|
|
4
4
|
"sourcesContent": ["export class SeatReservationError extends Error {\n constructor(message: string) {\n super(message);\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAO,
|
|
5
|
+
"mappings": ";AAAO,IAAM,uBAAN,cAAmC,MAAM;AAAA,EAC9C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,7 +20,7 @@ __export(ServerError_exports, {
|
|
|
20
20
|
ServerError: () => ServerError
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(ServerError_exports);
|
|
23
|
-
var import_Protocol = require("../Protocol");
|
|
23
|
+
var import_Protocol = require("../Protocol.js");
|
|
24
24
|
class ServerError extends Error {
|
|
25
25
|
constructor(code = import_Protocol.ErrorCode.MATCHMAKE_UNHANDLED, message) {
|
|
26
26
|
super(message);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/errors/ServerError.ts"],
|
|
4
|
-
"sourcesContent": ["import { ErrorCode } from '../Protocol';\n\nexport class ServerError extends Error {\n public code: number;\n\n constructor(code: number = ErrorCode.MATCHMAKE_UNHANDLED, message?: string) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ServerError);\n }\n\n this.name = 'ServerError';\n this.code = code;\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["import { ErrorCode } from '../Protocol.js';\n\nexport class ServerError extends Error {\n public code: number;\n\n constructor(code: number = ErrorCode.MATCHMAKE_UNHANDLED, message?: string) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ServerError);\n }\n\n this.name = 'ServerError';\n this.code = code;\n }\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA0B;AAEnB,MAAM,oBAAoB,MAAM;AAAA,EAGrC,YAAY,OAAe,0BAAU,qBAAqB,SAAkB;AAC1E,UAAM,OAAO;AAGb,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,WAAW;AAAA,IAC3C;AAEA,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// packages/core/src/errors/ServerError.ts
|
|
2
|
+
import { ErrorCode } from "../Protocol.mjs";
|
|
3
|
+
var ServerError = class _ServerError extends Error {
|
|
3
4
|
constructor(code = ErrorCode.MATCHMAKE_UNHANDLED, message) {
|
|
4
5
|
super(message);
|
|
5
6
|
if (Error.captureStackTrace) {
|
|
6
|
-
Error.captureStackTrace(this,
|
|
7
|
+
Error.captureStackTrace(this, _ServerError);
|
|
7
8
|
}
|
|
8
9
|
this.name = "ServerError";
|
|
9
10
|
this.code = code;
|
|
10
11
|
}
|
|
11
|
-
}
|
|
12
|
+
};
|
|
12
13
|
export {
|
|
13
14
|
ServerError
|
|
14
15
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/errors/ServerError.ts"],
|
|
4
|
-
"sourcesContent": ["import { ErrorCode } from '../Protocol';\n\nexport class ServerError extends Error {\n public code: number;\n\n constructor(code: number = ErrorCode.MATCHMAKE_UNHANDLED, message?: string) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ServerError);\n }\n\n this.name = 'ServerError';\n this.code = code;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,iBAAiB;AAEnB,MAAM,
|
|
4
|
+
"sourcesContent": ["import { ErrorCode } from '../Protocol.js';\n\nexport class ServerError extends Error {\n public code: number;\n\n constructor(code: number = ErrorCode.MATCHMAKE_UNHANDLED, message?: string) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, ServerError);\n }\n\n this.name = 'ServerError';\n this.code = code;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,iBAAiB;AAEnB,IAAM,cAAN,MAAM,qBAAoB,MAAM;AAAA,EAGrC,YAAY,OAAe,UAAU,qBAAqB,SAAkB;AAC1E,UAAM,OAAO;AAGb,QAAI,MAAM,mBAAmB;AAC3B,YAAM,kBAAkB,MAAM,YAAW;AAAA,IAC3C;AAEA,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import Clock, { Delayed } from '@
|
|
2
|
-
export { Server, type ServerOptions } from './Server';
|
|
3
|
-
export { Room, RoomInternalState } from './Room';
|
|
4
|
-
export { Protocol, ErrorCode, getMessageBytes } from './Protocol';
|
|
5
|
-
export { RegisteredHandler } from './matchmaker/RegisteredHandler';
|
|
6
|
-
export { ServerError } from './errors/ServerError';
|
|
7
|
-
|
|
1
|
+
import Clock, { Delayed } from '@colyseus/timer';
|
|
2
|
+
export { Server, type ServerOptions } from './Server.js';
|
|
3
|
+
export { Room, RoomInternalState } from './Room.js';
|
|
4
|
+
export { Protocol, ErrorCode, getMessageBytes } from './Protocol.js';
|
|
5
|
+
export { RegisteredHandler } from './matchmaker/RegisteredHandler.js';
|
|
6
|
+
export { ServerError } from './errors/ServerError.js';
|
|
7
|
+
export { type RoomException, OnCreateException, OnAuthException, OnJoinException, OnLeaveException, OnDisposeException, OnMessageException, SimulationIntervalException, TimedEventException, } from './errors/RoomExceptions';
|
|
8
|
+
import * as matchMaker from './MatchMaker.js';
|
|
8
9
|
export { matchMaker };
|
|
9
|
-
export { updateLobby, subscribeLobby } from './matchmaker/Lobby';
|
|
10
|
-
export * from './matchmaker/driver';
|
|
11
|
-
export { type Client, type ClientPrivate, ClientState, ClientArray, Transport, type ISendOptions } from './Transport';
|
|
12
|
-
export { type Presence } from './presence/Presence';
|
|
13
|
-
export { LocalPresence } from './presence/LocalPresence';
|
|
14
|
-
export { type Serializer } from './serializer/Serializer';
|
|
15
|
-
export { SchemaSerializer } from './serializer/SchemaSerializer';
|
|
10
|
+
export { updateLobby, subscribeLobby } from './matchmaker/Lobby.js';
|
|
11
|
+
export * from './matchmaker/driver/local/LocalDriver.js';
|
|
12
|
+
export { type Client, type ClientPrivate, type AuthContext, ClientState, ClientArray, Transport, type ISendOptions } from './Transport.js';
|
|
13
|
+
export { type Presence } from './presence/Presence.js';
|
|
14
|
+
export { LocalPresence } from './presence/LocalPresence.js';
|
|
15
|
+
export { type Serializer } from './serializer/Serializer.js';
|
|
16
|
+
export { SchemaSerializer } from './serializer/SchemaSerializer.js';
|
|
16
17
|
export { Clock, Delayed };
|
|
17
|
-
export { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from './utils/Utils';
|
|
18
|
-
export { isDevMode } from './utils/DevMode';
|
|
18
|
+
export { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from './utils/Utils.js';
|
|
19
|
+
export { isDevMode } from './utils/DevMode.js';
|
|
20
|
+
export { subscribeIPC, requestFromIPC } from './IPC.js';
|
|
19
21
|
export { debugMatchMaking, debugMessage, debugPatch, debugError, debugConnection, debugDriver, debugPresence, debugAndPrintError, } from './Debug';
|
|
20
|
-
export { LobbyRoom } from './rooms/LobbyRoom';
|
|
21
|
-
export { RelayRoom } from './rooms/RelayRoom';
|
|
22
|
-
export { logger } from './Logger';
|
|
22
|
+
export { LobbyRoom } from './rooms/LobbyRoom.js';
|
|
23
|
+
export { RelayRoom } from './rooms/RelayRoom.js';
|
|
24
|
+
export { logger } from './Logger.js';
|
package/build/index.js
CHANGED
|
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
20
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
25
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
26
|
mod
|
|
23
27
|
));
|
|
@@ -33,6 +37,12 @@ __export(src_exports, {
|
|
|
33
37
|
HttpServerMock: () => import_Utils.HttpServerMock,
|
|
34
38
|
LobbyRoom: () => import_LobbyRoom.LobbyRoom,
|
|
35
39
|
LocalPresence: () => import_LocalPresence.LocalPresence,
|
|
40
|
+
OnAuthException: () => import_RoomExceptions.OnAuthException,
|
|
41
|
+
OnCreateException: () => import_RoomExceptions.OnCreateException,
|
|
42
|
+
OnDisposeException: () => import_RoomExceptions.OnDisposeException,
|
|
43
|
+
OnJoinException: () => import_RoomExceptions.OnJoinException,
|
|
44
|
+
OnLeaveException: () => import_RoomExceptions.OnLeaveException,
|
|
45
|
+
OnMessageException: () => import_RoomExceptions.OnMessageException,
|
|
36
46
|
Protocol: () => import_Protocol.Protocol,
|
|
37
47
|
RegisteredHandler: () => import_RegisteredHandler.RegisteredHandler,
|
|
38
48
|
RelayRoom: () => import_RelayRoom.RelayRoom,
|
|
@@ -41,6 +51,8 @@ __export(src_exports, {
|
|
|
41
51
|
SchemaSerializer: () => import_SchemaSerializer.SchemaSerializer,
|
|
42
52
|
Server: () => import_Server.Server,
|
|
43
53
|
ServerError: () => import_ServerError.ServerError,
|
|
54
|
+
SimulationIntervalException: () => import_RoomExceptions.SimulationIntervalException,
|
|
55
|
+
TimedEventException: () => import_RoomExceptions.TimedEventException,
|
|
44
56
|
Transport: () => import_Transport.Transport,
|
|
45
57
|
debugAndPrintError: () => import_Debug.debugAndPrintError,
|
|
46
58
|
debugConnection: () => import_Debug.debugConnection,
|
|
@@ -56,31 +68,33 @@ __export(src_exports, {
|
|
|
56
68
|
isDevMode: () => import_DevMode.isDevMode,
|
|
57
69
|
logger: () => import_Logger.logger,
|
|
58
70
|
matchMaker: () => matchMaker,
|
|
71
|
+
requestFromIPC: () => import_IPC.requestFromIPC,
|
|
59
72
|
spliceOne: () => import_Utils.spliceOne,
|
|
73
|
+
subscribeIPC: () => import_IPC.subscribeIPC,
|
|
60
74
|
subscribeLobby: () => import_Lobby.subscribeLobby,
|
|
61
75
|
updateLobby: () => import_Lobby.updateLobby
|
|
62
76
|
});
|
|
63
77
|
module.exports = __toCommonJS(src_exports);
|
|
64
|
-
var import_timer = __toESM(require("@
|
|
65
|
-
var import_Server = require("./Server");
|
|
66
|
-
var import_Room = require("./Room");
|
|
67
|
-
var import_Protocol = require("./Protocol");
|
|
68
|
-
var import_RegisteredHandler = require("./matchmaker/RegisteredHandler");
|
|
69
|
-
var import_ServerError = require("./errors/ServerError");
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
var import_LocalPresence = require("./presence/LocalPresence");
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var
|
|
78
|
+
var import_timer = __toESM(require("@colyseus/timer"));
|
|
79
|
+
var import_Server = require("./Server.js");
|
|
80
|
+
var import_Room = require("./Room.js");
|
|
81
|
+
var import_Protocol = require("./Protocol.js");
|
|
82
|
+
var import_RegisteredHandler = require("./matchmaker/RegisteredHandler.js");
|
|
83
|
+
var import_ServerError = require("./errors/ServerError.js");
|
|
84
|
+
var import_RoomExceptions = require("./errors/RoomExceptions");
|
|
85
|
+
var matchMaker = __toESM(require("./MatchMaker.js"));
|
|
86
|
+
var import_Lobby = require("./matchmaker/Lobby.js");
|
|
87
|
+
__reExport(src_exports, require("./matchmaker/driver/local/LocalDriver.js"), module.exports);
|
|
88
|
+
var import_Transport = require("./Transport.js");
|
|
89
|
+
var import_LocalPresence = require("./presence/LocalPresence.js");
|
|
90
|
+
var import_SchemaSerializer = require("./serializer/SchemaSerializer.js");
|
|
91
|
+
var import_Utils = require("./utils/Utils.js");
|
|
92
|
+
var import_DevMode = require("./utils/DevMode.js");
|
|
93
|
+
var import_IPC = require("./IPC.js");
|
|
80
94
|
var import_Debug = require("./Debug");
|
|
81
|
-
var import_LobbyRoom = require("./rooms/LobbyRoom");
|
|
82
|
-
var import_RelayRoom = require("./rooms/RelayRoom");
|
|
83
|
-
var import_Logger = require("./Logger");
|
|
95
|
+
var import_LobbyRoom = require("./rooms/LobbyRoom.js");
|
|
96
|
+
var import_RelayRoom = require("./rooms/RelayRoom.js");
|
|
97
|
+
var import_Logger = require("./Logger.js");
|
|
84
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
85
99
|
0 && (module.exports = {
|
|
86
100
|
ClientArray,
|
|
@@ -92,6 +106,12 @@ var import_Logger = require("./Logger");
|
|
|
92
106
|
HttpServerMock,
|
|
93
107
|
LobbyRoom,
|
|
94
108
|
LocalPresence,
|
|
109
|
+
OnAuthException,
|
|
110
|
+
OnCreateException,
|
|
111
|
+
OnDisposeException,
|
|
112
|
+
OnJoinException,
|
|
113
|
+
OnLeaveException,
|
|
114
|
+
OnMessageException,
|
|
95
115
|
Protocol,
|
|
96
116
|
RegisteredHandler,
|
|
97
117
|
RelayRoom,
|
|
@@ -100,6 +120,8 @@ var import_Logger = require("./Logger");
|
|
|
100
120
|
SchemaSerializer,
|
|
101
121
|
Server,
|
|
102
122
|
ServerError,
|
|
123
|
+
SimulationIntervalException,
|
|
124
|
+
TimedEventException,
|
|
103
125
|
Transport,
|
|
104
126
|
debugAndPrintError,
|
|
105
127
|
debugConnection,
|
|
@@ -115,7 +137,10 @@ var import_Logger = require("./Logger");
|
|
|
115
137
|
isDevMode,
|
|
116
138
|
logger,
|
|
117
139
|
matchMaker,
|
|
140
|
+
requestFromIPC,
|
|
118
141
|
spliceOne,
|
|
142
|
+
subscribeIPC,
|
|
119
143
|
subscribeLobby,
|
|
120
|
-
updateLobby
|
|
144
|
+
updateLobby,
|
|
145
|
+
...require("./matchmaker/driver/local/LocalDriver.js")
|
|
121
146
|
});
|
package/build/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["import Clock, { Delayed } from '@
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import Clock, { Delayed } from '@colyseus/timer';\n\n// Core classes\nexport { Server, type ServerOptions } from './Server.js';\nexport { Room, RoomInternalState } from './Room.js';\nexport { Protocol, ErrorCode, getMessageBytes } from './Protocol.js';\nexport { RegisteredHandler } from './matchmaker/RegisteredHandler.js';\nexport { ServerError } from './errors/ServerError.js';\n\nexport {\n type RoomException,\n OnCreateException,\n OnAuthException,\n OnJoinException,\n OnLeaveException,\n OnDisposeException,\n OnMessageException,\n SimulationIntervalException,\n TimedEventException,\n} from './errors/RoomExceptions';\n\n// MatchMaker\nimport * as matchMaker from './MatchMaker.js';\nexport { matchMaker };\nexport { updateLobby, subscribeLobby } from './matchmaker/Lobby.js';\n\n// Driver\nexport * from './matchmaker/driver/local/LocalDriver.js';\n\n// Transport\nexport { type Client, type ClientPrivate, type AuthContext, ClientState, ClientArray, Transport, type ISendOptions } from './Transport.js';\n\n// Presence\nexport { type Presence } from './presence/Presence.js';\nexport { LocalPresence } from './presence/LocalPresence.js';\n\n// Serializers\nexport { type Serializer } from './serializer/Serializer.js';\nexport { SchemaSerializer } from './serializer/SchemaSerializer.js';\n// export { SchemaSerializerDebug } from './serializer/SchemaSerializerDebug.js';\n\n// Utilities\nexport { Clock, Delayed };\nexport { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from './utils/Utils.js';\nexport { isDevMode } from './utils/DevMode.js';\n\n// IPC\nexport { subscribeIPC, requestFromIPC } from './IPC.js';\n\n// Debug\nexport {\n debugMatchMaking,\n debugMessage,\n debugPatch,\n debugError,\n debugConnection,\n debugDriver,\n debugPresence,\n debugAndPrintError,\n} from './Debug';\n\n// Default rooms\nexport { LobbyRoom } from './rooms/LobbyRoom.js';\nexport { RelayRoom } from './rooms/RelayRoom.js';\n\n// Abstract logging support\nexport { logger } from './Logger.js';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA+B;AAG/B,oBAA2C;AAC3C,kBAAwC;AACxC,sBAAqD;AACrD,+BAAkC;AAClC,yBAA4B;AAE5B,4BAUO;AAGP,iBAA4B;AAE5B,mBAA4C;AAG5C,wBAAc,qDA3Bd;AA8BA,uBAA0H;AAI1H,2BAA8B;AAI9B,8BAAiC;AAKjC,mBAAgF;AAChF,qBAA0B;AAG1B,iBAA6C;AAG7C,mBASO;AAGP,uBAA0B;AAC1B,uBAA0B;AAG1B,oBAAuB;",
|
|
6
6
|
"names": ["Clock"]
|
|
7
7
|
}
|
package/build/index.mjs
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
// packages/core/src/index.ts
|
|
2
|
+
import Clock, { Delayed } from "@colyseus/timer";
|
|
3
|
+
import { Server } from "./Server.mjs";
|
|
4
|
+
import { Room, RoomInternalState } from "./Room.mjs";
|
|
5
|
+
import { Protocol, ErrorCode, getMessageBytes } from "./Protocol.mjs";
|
|
6
|
+
import { RegisteredHandler } from "./matchmaker/RegisteredHandler.mjs";
|
|
7
|
+
import { ServerError } from "./errors/ServerError.mjs";
|
|
8
|
+
import {
|
|
9
|
+
OnCreateException,
|
|
10
|
+
OnAuthException,
|
|
11
|
+
OnJoinException,
|
|
12
|
+
OnLeaveException,
|
|
13
|
+
OnDisposeException,
|
|
14
|
+
OnMessageException,
|
|
15
|
+
SimulationIntervalException,
|
|
16
|
+
TimedEventException
|
|
17
|
+
} from "./errors/RoomExceptions";
|
|
18
|
+
import * as matchMaker from "./MatchMaker.mjs";
|
|
19
|
+
import { updateLobby, subscribeLobby } from "./matchmaker/Lobby.mjs";
|
|
20
|
+
export * from "./matchmaker/driver/local/LocalDriver.mjs";
|
|
21
|
+
import { ClientState, ClientArray, Transport } from "./Transport.mjs";
|
|
22
|
+
import { LocalPresence } from "./presence/LocalPresence.mjs";
|
|
23
|
+
import { SchemaSerializer } from "./serializer/SchemaSerializer.mjs";
|
|
24
|
+
import { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from "./utils/Utils.mjs";
|
|
25
|
+
import { isDevMode } from "./utils/DevMode.mjs";
|
|
26
|
+
import { subscribeIPC, requestFromIPC } from "./IPC.mjs";
|
|
17
27
|
import {
|
|
18
28
|
debugMatchMaking,
|
|
19
29
|
debugMessage,
|
|
@@ -24,9 +34,9 @@ import {
|
|
|
24
34
|
debugPresence,
|
|
25
35
|
debugAndPrintError
|
|
26
36
|
} from "./Debug";
|
|
27
|
-
import { LobbyRoom } from "./rooms/LobbyRoom";
|
|
28
|
-
import { RelayRoom } from "./rooms/RelayRoom";
|
|
29
|
-
import { logger } from "./Logger";
|
|
37
|
+
import { LobbyRoom } from "./rooms/LobbyRoom.mjs";
|
|
38
|
+
import { RelayRoom } from "./rooms/RelayRoom.mjs";
|
|
39
|
+
import { logger } from "./Logger.mjs";
|
|
30
40
|
export {
|
|
31
41
|
ClientArray,
|
|
32
42
|
ClientState,
|
|
@@ -37,6 +47,12 @@ export {
|
|
|
37
47
|
HttpServerMock,
|
|
38
48
|
LobbyRoom,
|
|
39
49
|
LocalPresence,
|
|
50
|
+
OnAuthException,
|
|
51
|
+
OnCreateException,
|
|
52
|
+
OnDisposeException,
|
|
53
|
+
OnJoinException,
|
|
54
|
+
OnLeaveException,
|
|
55
|
+
OnMessageException,
|
|
40
56
|
Protocol,
|
|
41
57
|
RegisteredHandler,
|
|
42
58
|
RelayRoom,
|
|
@@ -45,6 +61,8 @@ export {
|
|
|
45
61
|
SchemaSerializer,
|
|
46
62
|
Server,
|
|
47
63
|
ServerError,
|
|
64
|
+
SimulationIntervalException,
|
|
65
|
+
TimedEventException,
|
|
48
66
|
Transport,
|
|
49
67
|
debugAndPrintError,
|
|
50
68
|
debugConnection,
|
|
@@ -60,7 +78,9 @@ export {
|
|
|
60
78
|
isDevMode,
|
|
61
79
|
logger,
|
|
62
80
|
matchMaker,
|
|
81
|
+
requestFromIPC,
|
|
63
82
|
spliceOne,
|
|
83
|
+
subscribeIPC,
|
|
64
84
|
subscribeLobby,
|
|
65
85
|
updateLobby
|
|
66
86
|
};
|