@colyseus/core 0.16.0-preview.9 → 0.16.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.
Files changed (146) hide show
  1. package/README.md +5 -5
  2. package/build/Debug.js +6 -2
  3. package/build/Debug.js.map +2 -2
  4. package/build/Debug.mjs +11 -10
  5. package/build/Debug.mjs.map +2 -2
  6. package/build/IPC.d.ts +1 -1
  7. package/build/IPC.js +3 -3
  8. package/build/IPC.js.map +2 -2
  9. package/build/IPC.mjs +4 -3
  10. package/build/IPC.mjs.map +2 -2
  11. package/build/Logger.mjs +4 -3
  12. package/build/Logger.mjs.map +1 -1
  13. package/build/MatchMaker.d.ts +35 -30
  14. package/build/MatchMaker.js +150 -100
  15. package/build/MatchMaker.js.map +2 -2
  16. package/build/MatchMaker.mjs +154 -107
  17. package/build/MatchMaker.mjs.map +2 -2
  18. package/build/Protocol.d.ts +3 -4
  19. package/build/Protocol.js +33 -19
  20. package/build/Protocol.js.map +2 -2
  21. package/build/Protocol.mjs +36 -21
  22. package/build/Protocol.mjs.map +2 -2
  23. package/build/Room.d.ts +64 -40
  24. package/build/Room.js +408 -151
  25. package/build/Room.js.map +2 -2
  26. package/build/Room.mjs +412 -158
  27. package/build/Room.mjs.map +2 -2
  28. package/build/Server.d.ts +8 -7
  29. package/build/Server.js +51 -18
  30. package/build/Server.js.map +2 -2
  31. package/build/Server.mjs +51 -21
  32. package/build/Server.mjs.map +3 -3
  33. package/build/Stats.d.ts +2 -0
  34. package/build/Stats.js +38 -3
  35. package/build/Stats.js.map +2 -2
  36. package/build/Stats.mjs +30 -6
  37. package/build/Stats.mjs.map +2 -2
  38. package/build/Transport.d.ts +8 -7
  39. package/build/Transport.js +1 -1
  40. package/build/Transport.js.map +2 -2
  41. package/build/Transport.mjs +6 -5
  42. package/build/Transport.mjs.map +2 -2
  43. package/build/discovery/index.d.ts +1 -1
  44. package/build/discovery/index.js.map +2 -2
  45. package/build/discovery/index.mjs +3 -2
  46. package/build/discovery/index.mjs.map +2 -2
  47. package/build/errors/RoomExceptions.d.ts +39 -0
  48. package/build/errors/RoomExceptions.js +100 -0
  49. package/build/errors/RoomExceptions.js.map +7 -0
  50. package/build/errors/RoomExceptions.mjs +71 -0
  51. package/build/errors/RoomExceptions.mjs.map +7 -0
  52. package/build/errors/SeatReservationError.mjs +3 -2
  53. package/build/errors/SeatReservationError.mjs.map +1 -1
  54. package/build/errors/ServerError.js +1 -1
  55. package/build/errors/ServerError.js.map +1 -1
  56. package/build/errors/ServerError.mjs +5 -4
  57. package/build/errors/ServerError.mjs.map +2 -2
  58. package/build/index.d.ts +21 -19
  59. package/build/index.js +47 -20
  60. package/build/index.js.map +2 -2
  61. package/build/index.mjs +41 -19
  62. package/build/index.mjs.map +2 -2
  63. package/build/matchmaker/Lobby.d.ts +3 -3
  64. package/build/matchmaker/Lobby.js +6 -3
  65. package/build/matchmaker/Lobby.js.map +2 -2
  66. package/build/matchmaker/Lobby.mjs +4 -4
  67. package/build/matchmaker/Lobby.mjs.map +2 -2
  68. package/build/matchmaker/RegisteredHandler.d.ts +6 -7
  69. package/build/matchmaker/RegisteredHandler.js +7 -10
  70. package/build/matchmaker/RegisteredHandler.js.map +2 -2
  71. package/build/matchmaker/RegisteredHandler.mjs +11 -13
  72. package/build/matchmaker/RegisteredHandler.mjs.map +2 -2
  73. package/build/matchmaker/controller.d.ts +4 -5
  74. package/build/matchmaker/controller.js +22 -15
  75. package/build/matchmaker/controller.js.map +2 -2
  76. package/build/matchmaker/controller.mjs +19 -13
  77. package/build/matchmaker/controller.mjs.map +2 -2
  78. package/build/matchmaker/driver/api.d.ts +104 -0
  79. package/build/matchmaker/driver/api.js +29 -0
  80. package/build/matchmaker/driver/api.js.map +7 -0
  81. package/build/matchmaker/driver/api.mjs +7 -0
  82. package/build/matchmaker/driver/api.mjs.map +7 -0
  83. package/build/matchmaker/driver/index.d.ts +2 -2
  84. package/build/matchmaker/driver/index.js +2 -2
  85. package/build/matchmaker/driver/index.js.map +2 -2
  86. package/build/matchmaker/driver/index.mjs +5 -4
  87. package/build/matchmaker/driver/index.mjs.map +2 -2
  88. package/build/matchmaker/driver/local/LocalDriver.d.ts +13 -0
  89. package/build/matchmaker/driver/local/LocalDriver.js +65 -0
  90. package/build/matchmaker/driver/local/LocalDriver.js.map +7 -0
  91. package/build/matchmaker/driver/local/LocalDriver.mjs +43 -0
  92. package/build/matchmaker/driver/local/LocalDriver.mjs.map +7 -0
  93. package/build/matchmaker/driver/local/Query.d.ts +9 -0
  94. package/build/matchmaker/driver/local/Query.js +78 -0
  95. package/build/matchmaker/driver/local/Query.js.map +7 -0
  96. package/build/matchmaker/driver/local/Query.mjs +56 -0
  97. package/build/matchmaker/driver/local/Query.mjs.map +7 -0
  98. package/build/matchmaker/driver/local/RoomData.d.ts +19 -0
  99. package/build/matchmaker/driver/local/RoomData.js +79 -0
  100. package/build/matchmaker/driver/local/RoomData.js.map +7 -0
  101. package/build/matchmaker/driver/local/RoomData.mjs +57 -0
  102. package/build/matchmaker/driver/local/RoomData.mjs.map +7 -0
  103. package/build/presence/LocalPresence.d.ts +10 -6
  104. package/build/presence/LocalPresence.js +85 -24
  105. package/build/presence/LocalPresence.js.map +3 -3
  106. package/build/presence/LocalPresence.mjs +85 -27
  107. package/build/presence/LocalPresence.mjs.map +3 -3
  108. package/build/presence/Presence.d.ts +38 -2
  109. package/build/presence/Presence.js.map +1 -1
  110. package/build/rooms/LobbyRoom.d.ts +6 -6
  111. package/build/rooms/LobbyRoom.js +8 -3
  112. package/build/rooms/LobbyRoom.js.map +2 -2
  113. package/build/rooms/LobbyRoom.mjs +7 -5
  114. package/build/rooms/LobbyRoom.mjs.map +2 -2
  115. package/build/rooms/RelayRoom.d.ts +3 -3
  116. package/build/rooms/RelayRoom.js +3 -1
  117. package/build/rooms/RelayRoom.js.map +2 -2
  118. package/build/rooms/RelayRoom.mjs +10 -7
  119. package/build/rooms/RelayRoom.mjs.map +2 -2
  120. package/build/serializer/NoneSerializer.d.ts +2 -2
  121. package/build/serializer/NoneSerializer.js.map +1 -1
  122. package/build/serializer/NoneSerializer.mjs +3 -2
  123. package/build/serializer/NoneSerializer.mjs.map +2 -2
  124. package/build/serializer/SchemaSerializer.d.ts +16 -15
  125. package/build/serializer/SchemaSerializer.js +12 -10
  126. package/build/serializer/SchemaSerializer.js.map +2 -2
  127. package/build/serializer/SchemaSerializer.mjs +16 -13
  128. package/build/serializer/SchemaSerializer.mjs.map +2 -2
  129. package/build/serializer/SchemaSerializerDebug.d.ts +7 -0
  130. package/build/serializer/SchemaSerializerDebug.js +0 -0
  131. package/build/serializer/SchemaSerializerDebug.js.map +7 -0
  132. package/build/serializer/SchemaSerializerDebug.mjs +0 -0
  133. package/build/serializer/SchemaSerializerDebug.mjs.map +7 -0
  134. package/build/serializer/Serializer.d.ts +1 -2
  135. package/build/serializer/Serializer.js.map +1 -1
  136. package/build/utils/DevMode.d.ts +2 -2
  137. package/build/utils/DevMode.js +8 -4
  138. package/build/utils/DevMode.js.map +2 -2
  139. package/build/utils/DevMode.mjs +7 -6
  140. package/build/utils/DevMode.mjs.map +2 -2
  141. package/build/utils/Utils.d.ts +8 -3
  142. package/build/utils/Utils.js +41 -17
  143. package/build/utils/Utils.js.map +2 -2
  144. package/build/utils/Utils.mjs +40 -21
  145. package/build/utils/Utils.mjs.map +2 -2
  146. package/package.json +17 -6
@@ -1,5 +1,6 @@
1
- const NODES_SET = "colyseus:nodes";
2
- const DISCOVERY_CHANNEL = "colyseus:nodes:discovery";
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,MAAM,YAAY;AAClB,MAAM,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,aAAa,QAAQ,SAC7B,GAAG,KAAK,aAAa;AAC3B;AAEA,eAAsB,aAAa,UAAoB,MAAY;AACjE,QAAM,cAAc,MAAM,eAAe,IAAI;AAC7C,QAAM,SAAS,KAAK,WAAW,WAAW;AAC1C,QAAM,SAAS,QAAQ,mBAAmB,OAAO,aAAa;AAChE;AAEA,eAAsB,eAAe,UAAoB,MAAY;AACnE,QAAM,cAAc,MAAM,eAAe,IAAI;AAC7C,QAAM,SAAS,KAAK,WAAW,WAAW;AAC1C,QAAM,SAAS,QAAQ,mBAAmB,UAAU,aAAa;AACnE;",
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
+ }
@@ -1,8 +1,9 @@
1
- class SeatReservationError extends Error {
1
+ // packages/core/src/errors/SeatReservationError.ts
2
+ var SeatReservationError = class extends Error {
2
3
  constructor(message) {
3
4
  super(message);
4
5
  }
5
- }
6
+ };
6
7
  export {
7
8
  SeatReservationError
8
9
  };
@@ -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,MAAM,6BAA6B,MAAM;AAAA,EAC9C,YAAY,SAAiB;AAC3B,UAAM,OAAO;AAAA,EACf;AACF;",
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
- import { ErrorCode } from "../Protocol";
2
- class ServerError extends Error {
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, ServerError);
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,oBAAoB,MAAM;AAAA,EAGrC,YAAY,OAAe,UAAU,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;",
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 '@gamestdio/timer';
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
- import * as matchMaker from './MatchMaker';
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 { 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,14 +37,23 @@ __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,
39
49
  Room: () => import_Room.Room,
50
+ RoomException: () => import_RoomExceptions.RoomException,
40
51
  RoomInternalState: () => import_Room.RoomInternalState,
41
52
  SchemaSerializer: () => import_SchemaSerializer.SchemaSerializer,
42
53
  Server: () => import_Server.Server,
43
54
  ServerError: () => import_ServerError.ServerError,
55
+ SimulationIntervalException: () => import_RoomExceptions.SimulationIntervalException,
56
+ TimedEventException: () => import_RoomExceptions.TimedEventException,
44
57
  Transport: () => import_Transport.Transport,
45
58
  debugAndPrintError: () => import_Debug.debugAndPrintError,
46
59
  debugConnection: () => import_Debug.debugConnection,
@@ -56,31 +69,33 @@ __export(src_exports, {
56
69
  isDevMode: () => import_DevMode.isDevMode,
57
70
  logger: () => import_Logger.logger,
58
71
  matchMaker: () => matchMaker,
72
+ requestFromIPC: () => import_IPC.requestFromIPC,
59
73
  spliceOne: () => import_Utils.spliceOne,
74
+ subscribeIPC: () => import_IPC.subscribeIPC,
60
75
  subscribeLobby: () => import_Lobby.subscribeLobby,
61
76
  updateLobby: () => import_Lobby.updateLobby
62
77
  });
63
78
  module.exports = __toCommonJS(src_exports);
64
- var import_timer = __toESM(require("@gamestdio/timer"));
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 matchMaker = __toESM(require("./MatchMaker"));
71
- var import_Lobby = require("./matchmaker/Lobby");
72
- __reExport(src_exports, require("./matchmaker/driver"), module.exports);
73
- var import_Transport = require("./Transport");
74
- var import_Presence = require("./presence/Presence");
75
- var import_LocalPresence = require("./presence/LocalPresence");
76
- var import_Serializer = require("./serializer/Serializer");
77
- var import_SchemaSerializer = require("./serializer/SchemaSerializer");
78
- var import_Utils = require("./utils/Utils");
79
- var import_DevMode = require("./utils/DevMode");
79
+ var import_timer = __toESM(require("@colyseus/timer"));
80
+ var import_Server = require("./Server.js");
81
+ var import_Room = require("./Room.js");
82
+ var import_Protocol = require("./Protocol.js");
83
+ var import_RegisteredHandler = require("./matchmaker/RegisteredHandler.js");
84
+ var import_ServerError = require("./errors/ServerError.js");
85
+ var import_RoomExceptions = require("./errors/RoomExceptions");
86
+ var matchMaker = __toESM(require("./MatchMaker.js"));
87
+ var import_Lobby = require("./matchmaker/Lobby.js");
88
+ __reExport(src_exports, require("./matchmaker/driver/local/LocalDriver.js"), module.exports);
89
+ var import_Transport = require("./Transport.js");
90
+ var import_LocalPresence = require("./presence/LocalPresence.js");
91
+ var import_SchemaSerializer = require("./serializer/SchemaSerializer.js");
92
+ var import_Utils = require("./utils/Utils.js");
93
+ var import_DevMode = require("./utils/DevMode.js");
94
+ var import_IPC = require("./IPC.js");
80
95
  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");
96
+ var import_LobbyRoom = require("./rooms/LobbyRoom.js");
97
+ var import_RelayRoom = require("./rooms/RelayRoom.js");
98
+ var import_Logger = require("./Logger.js");
84
99
  // Annotate the CommonJS export names for ESM import in node:
85
100
  0 && (module.exports = {
86
101
  ClientArray,
@@ -92,14 +107,23 @@ var import_Logger = require("./Logger");
92
107
  HttpServerMock,
93
108
  LobbyRoom,
94
109
  LocalPresence,
110
+ OnAuthException,
111
+ OnCreateException,
112
+ OnDisposeException,
113
+ OnJoinException,
114
+ OnLeaveException,
115
+ OnMessageException,
95
116
  Protocol,
96
117
  RegisteredHandler,
97
118
  RelayRoom,
98
119
  Room,
120
+ RoomException,
99
121
  RoomInternalState,
100
122
  SchemaSerializer,
101
123
  Server,
102
124
  ServerError,
125
+ SimulationIntervalException,
126
+ TimedEventException,
103
127
  Transport,
104
128
  debugAndPrintError,
105
129
  debugConnection,
@@ -115,7 +139,10 @@ var import_Logger = require("./Logger");
115
139
  isDevMode,
116
140
  logger,
117
141
  matchMaker,
142
+ requestFromIPC,
118
143
  spliceOne,
144
+ subscribeIPC,
119
145
  subscribeLobby,
120
- updateLobby
146
+ updateLobby,
147
+ ...require("./matchmaker/driver/local/LocalDriver.js")
121
148
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import Clock, { Delayed } from '@gamestdio/timer';\n\n// Core classes\nexport { Server, type ServerOptions } from './Server';\nexport { Room, RoomInternalState } from './Room';\nexport { Protocol, ErrorCode, getMessageBytes } from './Protocol';\nexport { RegisteredHandler } from './matchmaker/RegisteredHandler';\nexport { ServerError } from './errors/ServerError';\n\n// MatchMaker\nimport * as matchMaker from './MatchMaker';\nexport { matchMaker };\nexport { updateLobby, subscribeLobby } from './matchmaker/Lobby';\n\n// Driver\nexport * from './matchmaker/driver';\n\n// Transport\nexport { type Client, type ClientPrivate, ClientState, ClientArray, Transport, type ISendOptions } from './Transport';\n\n// Presence\nexport { type Presence } from './presence/Presence';\nexport { LocalPresence } from './presence/LocalPresence';\n\n// Serializers\nexport { type Serializer } from './serializer/Serializer';\nexport { SchemaSerializer } from './serializer/SchemaSerializer';\n\n// Utilities\nexport { Clock, Delayed };\nexport { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from './utils/Utils';\nexport { isDevMode } from './utils/DevMode';\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';\nexport { RelayRoom } from './rooms/RelayRoom';\n\n// Abstract logging support\nexport { logger } from './Logger'\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,mBAA+B;AAG/B,oBAA2C;AAC3C,kBAAwC;AACxC,sBAAqD;AACrD,+BAAkC;AAClC,yBAA4B;AAG5B,iBAA4B;AAE5B,mBAA4C;AAG5C,wBAAc,gCAfd;AAkBA,uBAAwG;AAGxG,sBAA8B;AAC9B,2BAA8B;AAG9B,wBAAgC;AAChC,8BAAiC;AAIjC,mBAAgF;AAChF,qBAA0B;AAG1B,mBASO;AAGP,uBAA0B;AAC1B,uBAA0B;AAG1B,oBAAuB;",
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 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;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,30 @@
1
- import Clock, { Delayed } from "@gamestdio/timer";
2
- import { Server } from "./Server";
3
- import { Room, RoomInternalState } from "./Room";
4
- import { Protocol, ErrorCode, getMessageBytes } from "./Protocol";
5
- import { RegisteredHandler } from "./matchmaker/RegisteredHandler";
6
- import { ServerError } from "./errors/ServerError";
7
- import * as matchMaker from "./MatchMaker";
8
- import { updateLobby, subscribeLobby } from "./matchmaker/Lobby";
9
- export * from "./matchmaker/driver";
10
- import { ClientState, ClientArray, Transport } from "./Transport";
11
- import {} from "./presence/Presence";
12
- import { LocalPresence } from "./presence/LocalPresence";
13
- import {} from "./serializer/Serializer";
14
- import { SchemaSerializer } from "./serializer/SchemaSerializer";
15
- import { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from "./utils/Utils";
16
- import { isDevMode } from "./utils/DevMode";
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
+ RoomException,
10
+ OnCreateException,
11
+ OnAuthException,
12
+ OnJoinException,
13
+ OnLeaveException,
14
+ OnDisposeException,
15
+ OnMessageException,
16
+ SimulationIntervalException,
17
+ TimedEventException
18
+ } from "./errors/RoomExceptions";
19
+ import * as matchMaker from "./MatchMaker.mjs";
20
+ import { updateLobby, subscribeLobby } from "./matchmaker/Lobby.mjs";
21
+ export * from "./matchmaker/driver/local/LocalDriver.mjs";
22
+ import { ClientState, ClientArray, Transport } from "./Transport.mjs";
23
+ import { LocalPresence } from "./presence/LocalPresence.mjs";
24
+ import { SchemaSerializer } from "./serializer/SchemaSerializer.mjs";
25
+ import { generateId, Deferred, HttpServerMock, spliceOne, getBearerToken } from "./utils/Utils.mjs";
26
+ import { isDevMode } from "./utils/DevMode.mjs";
27
+ import { subscribeIPC, requestFromIPC } from "./IPC.mjs";
17
28
  import {
18
29
  debugMatchMaking,
19
30
  debugMessage,
@@ -24,9 +35,9 @@ import {
24
35
  debugPresence,
25
36
  debugAndPrintError
26
37
  } from "./Debug";
27
- import { LobbyRoom } from "./rooms/LobbyRoom";
28
- import { RelayRoom } from "./rooms/RelayRoom";
29
- import { logger } from "./Logger";
38
+ import { LobbyRoom } from "./rooms/LobbyRoom.mjs";
39
+ import { RelayRoom } from "./rooms/RelayRoom.mjs";
40
+ import { logger } from "./Logger.mjs";
30
41
  export {
31
42
  ClientArray,
32
43
  ClientState,
@@ -37,14 +48,23 @@ export {
37
48
  HttpServerMock,
38
49
  LobbyRoom,
39
50
  LocalPresence,
51
+ OnAuthException,
52
+ OnCreateException,
53
+ OnDisposeException,
54
+ OnJoinException,
55
+ OnLeaveException,
56
+ OnMessageException,
40
57
  Protocol,
41
58
  RegisteredHandler,
42
59
  RelayRoom,
43
60
  Room,
61
+ RoomException,
44
62
  RoomInternalState,
45
63
  SchemaSerializer,
46
64
  Server,
47
65
  ServerError,
66
+ SimulationIntervalException,
67
+ TimedEventException,
48
68
  Transport,
49
69
  debugAndPrintError,
50
70
  debugConnection,
@@ -60,7 +80,9 @@ export {
60
80
  isDevMode,
61
81
  logger,
62
82
  matchMaker,
83
+ requestFromIPC,
63
84
  spliceOne,
85
+ subscribeIPC,
64
86
  subscribeLobby,
65
87
  updateLobby
66
88
  };