@colyseus/core 0.15.53 → 0.15.54

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 (41) hide show
  1. package/build/MatchMaker.js +34 -11
  2. package/build/MatchMaker.js.map +2 -2
  3. package/build/MatchMaker.mjs +34 -11
  4. package/build/MatchMaker.mjs.map +2 -2
  5. package/build/Room.d.ts +21 -3
  6. package/build/Room.js +48 -6
  7. package/build/Room.js.map +2 -2
  8. package/build/Room.mjs +49 -7
  9. package/build/Room.mjs.map +2 -2
  10. package/build/Server.js.map +2 -2
  11. package/build/Server.mjs.map +2 -2
  12. package/build/Stats.js +3 -0
  13. package/build/Stats.js.map +2 -2
  14. package/build/Stats.mjs +4 -1
  15. package/build/Stats.mjs.map +2 -2
  16. package/build/errors/RoomExceptions.d.ts +39 -0
  17. package/build/errors/RoomExceptions.js +100 -0
  18. package/build/errors/RoomExceptions.js.map +7 -0
  19. package/build/errors/RoomExceptions.mjs +70 -0
  20. package/build/errors/RoomExceptions.mjs.map +7 -0
  21. package/build/index.d.ts +1 -0
  22. package/build/index.js +19 -0
  23. package/build/index.js.map +2 -2
  24. package/build/index.mjs +20 -0
  25. package/build/index.mjs.map +2 -2
  26. package/build/matchmaker/Lobby.d.ts +2 -2
  27. package/build/matchmaker/Lobby.js.map +2 -2
  28. package/build/matchmaker/Lobby.mjs.map +2 -2
  29. package/build/matchmaker/driver/index.js +2 -2
  30. package/build/matchmaker/driver/index.js.map +2 -2
  31. package/build/matchmaker/driver/index.mjs +2 -2
  32. package/build/matchmaker/driver/index.mjs.map +2 -2
  33. package/build/rooms/LobbyRoom.d.ts +4 -4
  34. package/build/rooms/LobbyRoom.js.map +2 -2
  35. package/build/rooms/LobbyRoom.mjs.map +2 -2
  36. package/build/utils/Utils.d.ts +3 -0
  37. package/build/utils/Utils.js +25 -2
  38. package/build/utils/Utils.js.map +2 -2
  39. package/build/utils/Utils.mjs +23 -1
  40. package/build/utils/Utils.mjs.map +2 -2
  41. package/package.json +1 -1
@@ -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,70 @@
1
+ class OnCreateException extends Error {
2
+ constructor(cause, message, options) {
3
+ super(message, { cause });
4
+ this.options = options;
5
+ this.name = "OnCreateException";
6
+ }
7
+ }
8
+ class OnAuthException extends Error {
9
+ constructor(cause, message, client, options) {
10
+ super(message, { cause });
11
+ this.client = client;
12
+ this.options = options;
13
+ this.name = "OnAuthException";
14
+ }
15
+ }
16
+ class OnJoinException extends Error {
17
+ constructor(cause, message, client, options, auth) {
18
+ super(message, { cause });
19
+ this.client = client;
20
+ this.options = options;
21
+ this.auth = auth;
22
+ this.name = "OnJoinException";
23
+ }
24
+ }
25
+ class OnLeaveException extends Error {
26
+ constructor(cause, message, client, consented) {
27
+ super(message, { cause });
28
+ this.client = client;
29
+ this.consented = consented;
30
+ this.name = "OnLeaveException";
31
+ }
32
+ }
33
+ class OnDisposeException extends Error {
34
+ constructor(cause, message) {
35
+ super(message, { cause });
36
+ this.name = "OnDisposeException";
37
+ }
38
+ }
39
+ class OnMessageException extends Error {
40
+ constructor(cause, message, client, payload, type) {
41
+ super(message, { cause });
42
+ this.client = client;
43
+ this.payload = payload;
44
+ this.type = type;
45
+ this.name = "OnMessageException";
46
+ }
47
+ }
48
+ class SimulationIntervalException extends Error {
49
+ constructor(cause, message) {
50
+ super(message, { cause });
51
+ this.name = "SimulationIntervalException";
52
+ }
53
+ }
54
+ class TimedEventException extends Error {
55
+ constructor(cause, message, ...args) {
56
+ super(message, { cause });
57
+ this.name = "TimedEventException";
58
+ this.args = args;
59
+ }
60
+ }
61
+ export {
62
+ OnAuthException,
63
+ OnCreateException,
64
+ OnDisposeException,
65
+ OnJoinException,
66
+ OnLeaveException,
67
+ OnMessageException,
68
+ SimulationIntervalException,
69
+ TimedEventException
70
+ };
@@ -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,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
+ }
package/build/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { Room, RoomInternalState } from './Room';
4
4
  export { Protocol, ErrorCode, getMessageBytes } from './Protocol';
5
5
  export { RegisteredHandler } from './matchmaker/RegisteredHandler';
6
6
  export { ServerError } from './errors/ServerError';
7
+ export { RoomException, OnCreateException, OnAuthException, OnJoinException, OnLeaveException, OnDisposeException, OnMessageException, SimulationIntervalException, TimedEventException, } from './errors/RoomExceptions';
7
8
  import * as matchMaker from './MatchMaker';
8
9
  export { matchMaker };
9
10
  export { updateLobby, subscribeLobby } from './matchmaker/Lobby';
package/build/index.js CHANGED
@@ -33,14 +33,23 @@ __export(src_exports, {
33
33
  ErrorCode: () => import_Protocol.ErrorCode,
34
34
  LobbyRoom: () => import_LobbyRoom.LobbyRoom,
35
35
  LocalPresence: () => import_LocalPresence.LocalPresence,
36
+ OnAuthException: () => import_RoomExceptions.OnAuthException,
37
+ OnCreateException: () => import_RoomExceptions.OnCreateException,
38
+ OnDisposeException: () => import_RoomExceptions.OnDisposeException,
39
+ OnJoinException: () => import_RoomExceptions.OnJoinException,
40
+ OnLeaveException: () => import_RoomExceptions.OnLeaveException,
41
+ OnMessageException: () => import_RoomExceptions.OnMessageException,
36
42
  Protocol: () => import_Protocol.Protocol,
37
43
  RegisteredHandler: () => import_RegisteredHandler.RegisteredHandler,
38
44
  RelayRoom: () => import_RelayRoom.RelayRoom,
39
45
  Room: () => import_Room.Room,
46
+ RoomException: () => import_RoomExceptions.RoomException,
40
47
  RoomInternalState: () => import_Room.RoomInternalState,
41
48
  SchemaSerializer: () => import_SchemaSerializer.SchemaSerializer,
42
49
  Server: () => import_Server.Server,
43
50
  ServerError: () => import_ServerError.ServerError,
51
+ SimulationIntervalException: () => import_RoomExceptions.SimulationIntervalException,
52
+ TimedEventException: () => import_RoomExceptions.TimedEventException,
44
53
  Transport: () => import_Transport.Transport,
45
54
  debugAndPrintError: () => import_Debug.debugAndPrintError,
46
55
  debugConnection: () => import_Debug.debugConnection,
@@ -67,6 +76,7 @@ var import_Room = require("./Room");
67
76
  var import_Protocol = require("./Protocol");
68
77
  var import_RegisteredHandler = require("./matchmaker/RegisteredHandler");
69
78
  var import_ServerError = require("./errors/ServerError");
79
+ var import_RoomExceptions = require("./errors/RoomExceptions");
70
80
  var matchMaker = __toESM(require("./MatchMaker"));
71
81
  var import_Lobby = require("./matchmaker/Lobby");
72
82
  __reExport(src_exports, require("./matchmaker/driver"), module.exports);
@@ -92,14 +102,23 @@ var import_Logger = require("./Logger");
92
102
  ErrorCode,
93
103
  LobbyRoom,
94
104
  LocalPresence,
105
+ OnAuthException,
106
+ OnCreateException,
107
+ OnDisposeException,
108
+ OnJoinException,
109
+ OnLeaveException,
110
+ OnMessageException,
95
111
  Protocol,
96
112
  RegisteredHandler,
97
113
  RelayRoom,
98
114
  Room,
115
+ RoomException,
99
116
  RoomInternalState,
100
117
  SchemaSerializer,
101
118
  Server,
102
119
  ServerError,
120
+ SimulationIntervalException,
121
+ TimedEventException,
103
122
  Transport,
104
123
  debugAndPrintError,
105
124
  debugConnection,
@@ -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, 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, DummyServer, 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,uBAAoF;AAGpF,sBAA8B;AAC9B,2BAA8B;AAG9B,wBAAgC;AAChC,8BAAiC;AAIjC,mBAA6E;AAC7E,qBAA0B;AAG1B,mBASO;AAGP,uBAA0B;AAC1B,uBAA0B;AAG1B,oBAAuB;",
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\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';\nexport { matchMaker };\nexport { updateLobby, subscribeLobby } from './matchmaker/Lobby';\n\n// Driver\nexport * from './matchmaker/driver';\n\n// Transport\nexport { type Client, 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, DummyServer, 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;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,gCA3Bd;AA8BA,uBAAoF;AAGpF,sBAA8B;AAC9B,2BAA8B;AAG9B,wBAAgC;AAChC,8BAAiC;AAIjC,mBAA6E;AAC7E,qBAA0B;AAG1B,mBASO;AAGP,uBAA0B;AAC1B,uBAA0B;AAG1B,oBAAuB;",
6
6
  "names": ["Clock"]
7
7
  }
package/build/index.mjs CHANGED
@@ -4,6 +4,17 @@ import { Room, RoomInternalState } from "./Room";
4
4
  import { Protocol, ErrorCode, getMessageBytes } from "./Protocol";
5
5
  import { RegisteredHandler } from "./matchmaker/RegisteredHandler";
6
6
  import { ServerError } from "./errors/ServerError";
7
+ import {
8
+ RoomException,
9
+ OnCreateException,
10
+ OnAuthException,
11
+ OnJoinException,
12
+ OnLeaveException,
13
+ OnDisposeException,
14
+ OnMessageException,
15
+ SimulationIntervalException,
16
+ TimedEventException
17
+ } from "./errors/RoomExceptions";
7
18
  import * as matchMaker from "./MatchMaker";
8
19
  import { updateLobby, subscribeLobby } from "./matchmaker/Lobby";
9
20
  export * from "./matchmaker/driver";
@@ -37,14 +48,23 @@ export {
37
48
  ErrorCode,
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,
@@ -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, 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, DummyServer, 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,OAAO,SAAS,eAAe;AAG/B,SAAS,cAAkC;AAC3C,SAAS,MAAM,yBAAyB;AACxC,SAAS,UAAU,WAAW,uBAAuB;AACrD,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAG5B,YAAY,gBAAgB;AAE5B,SAAS,aAAa,sBAAsB;AAG5C,cAAc;AAGd,SAAsB,aAAa,aAAa,iBAAoC;AAGpF,eAA8B;AAC9B,SAAS,qBAAqB;AAG9B,eAAgC;AAChC,SAAS,wBAAwB;AAIjC,SAAS,YAAY,UAAU,aAAa,WAAW,sBAAsB;AAC7E,SAAS,iBAAiB;AAG1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAG1B,SAAS,cAAc;",
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\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';\nexport { matchMaker };\nexport { updateLobby, subscribeLobby } from './matchmaker/Lobby';\n\n// Driver\nexport * from './matchmaker/driver';\n\n// Transport\nexport { type Client, 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, DummyServer, 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,OAAO,SAAS,eAAe;AAG/B,SAAS,cAAkC;AAC3C,SAAS,MAAM,yBAAyB;AACxC,SAAS,UAAU,WAAW,uBAAuB;AACrD,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAE5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,YAAY,gBAAgB;AAE5B,SAAS,aAAa,sBAAsB;AAG5C,cAAc;AAGd,SAAsB,aAAa,aAAa,iBAAoC;AAGpF,eAA8B;AAC9B,SAAS,qBAAqB;AAG9B,eAAgC;AAChC,SAAS,wBAAwB;AAIjC,SAAS,YAAY,UAAU,aAAa,WAAW,sBAAsB;AAC7E,SAAS,iBAAiB;AAG1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAG1B,SAAS,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
1
  import type { Room } from '../Room';
2
- import { RoomListingData } from './driver/interfaces';
2
+ import { IRoomListingData } from './driver/interfaces';
3
3
  export declare function updateLobby(room: Room, removed?: boolean): void;
4
- export declare function subscribeLobby(callback: (roomId: string, roomListing: RoomListingData) => void): Promise<() => any>;
4
+ export declare function subscribeLobby(callback: (roomId: string, roomListing: IRoomListingData) => void): Promise<() => any>;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/matchmaker/Lobby.ts"],
4
- "sourcesContent": ["import * as matchMaker from '../MatchMaker';\n\nimport type { Room } from '../Room';\nimport { RoomListingData } from './driver/interfaces';\n\nconst LOBBY_CHANNEL = '$lobby';\n\n/*\n * TODO: refactor this on v0.16\n *\n * Some users might be relying on \"1\" = \"removed\" from the lobby due to this workaround: https://github.com/colyseus/colyseus/issues/617\n * Though, for consistency, we should invert as \"0\" = \"invisible\" and \"1\" = \"visible\".\n *\n * - rename \"removed\" to \"isVisible\" and swap the logic\n * - emit \"visibility-change\" with inverted value (isVisible)\n * - update \"subscribeLobby\" to check \"1\" as \"isVisible\" instead of \"removed\"\n */\n\nexport function updateLobby(room: Room, removed: boolean = false) {\n const listing = room.listing;\n\n if (listing.unlisted) return;\n\n if (removed) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},1`);\n } else if (!listing.private) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},0`);\n }\n}\n\nexport async function subscribeLobby(callback: (roomId: string, roomListing: RoomListingData) => void) {\n const cb = async (message) => {\n const [roomId, isRemove] = message.split(',');\n\n if (isRemove === '1') {\n callback(roomId, null);\n\n } else {\n const room = (await matchMaker.query({ roomId }))[0];\n callback(roomId, room);\n }\n };\n\n await matchMaker.presence.subscribe(LOBBY_CHANNEL, cb);\n\n return () => matchMaker.presence.unsubscribe(LOBBY_CHANNEL, cb);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAK5B,MAAM,gBAAgB;AAaf,SAAS,YAAY,MAAY,UAAmB,OAAO;AAChE,QAAM,UAAU,KAAK;AAErB,MAAI,QAAQ;AAAU;AAEtB,MAAI,SAAS;AACX,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE,WAAW,CAAC,QAAQ,SAAS;AAC3B,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE;AACF;AAEA,eAAsB,eAAe,UAAkE;AACrG,QAAM,KAAK,OAAO,YAAY;AAC5B,UAAM,CAAC,QAAQ,QAAQ,IAAI,QAAQ,MAAM,GAAG;AAE5C,QAAI,aAAa,KAAK;AACpB,eAAS,QAAQ,IAAI;AAAA,IAEvB,OAAO;AACL,YAAM,QAAQ,MAAM,WAAW,MAAM,EAAE,OAAO,CAAC,GAAG;AAClD,eAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,WAAW,SAAS,UAAU,eAAe,EAAE;AAErD,SAAO,MAAM,WAAW,SAAS,YAAY,eAAe,EAAE;AAChE;",
4
+ "sourcesContent": ["import * as matchMaker from '../MatchMaker';\n\nimport type { Room } from '../Room';\nimport { IRoomListingData } from './driver/interfaces';\n\nconst LOBBY_CHANNEL = '$lobby';\n\n/*\n * TODO: refactor this on v0.16\n *\n * Some users might be relying on \"1\" = \"removed\" from the lobby due to this workaround: https://github.com/colyseus/colyseus/issues/617\n * Though, for consistency, we should invert as \"0\" = \"invisible\" and \"1\" = \"visible\".\n *\n * - rename \"removed\" to \"isVisible\" and swap the logic\n * - emit \"visibility-change\" with inverted value (isVisible)\n * - update \"subscribeLobby\" to check \"1\" as \"isVisible\" instead of \"removed\"\n */\n\nexport function updateLobby(room: Room, removed: boolean = false) {\n const listing = room.listing;\n\n if (listing.unlisted) return;\n\n if (removed) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},1`);\n } else if (!listing.private) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},0`);\n }\n}\n\nexport async function subscribeLobby(callback: (roomId: string, roomListing: IRoomListingData) => void) {\n const cb = async (message) => {\n const [roomId, isRemove] = message.split(',');\n\n if (isRemove === '1') {\n callback(roomId, null);\n\n } else {\n const room = (await matchMaker.query({ roomId }))[0];\n callback(roomId, room);\n }\n };\n\n await matchMaker.presence.subscribe(LOBBY_CHANNEL, cb);\n\n return () => matchMaker.presence.unsubscribe(LOBBY_CHANNEL, cb);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA4B;AAK5B,MAAM,gBAAgB;AAaf,SAAS,YAAY,MAAY,UAAmB,OAAO;AAChE,QAAM,UAAU,KAAK;AAErB,MAAI,QAAQ;AAAU;AAEtB,MAAI,SAAS;AACX,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE,WAAW,CAAC,QAAQ,SAAS;AAC3B,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE;AACF;AAEA,eAAsB,eAAe,UAAmE;AACtG,QAAM,KAAK,OAAO,YAAY;AAC5B,UAAM,CAAC,QAAQ,QAAQ,IAAI,QAAQ,MAAM,GAAG;AAE5C,QAAI,aAAa,KAAK;AACpB,eAAS,QAAQ,IAAI;AAAA,IAEvB,OAAO;AACL,YAAM,QAAQ,MAAM,WAAW,MAAM,EAAE,OAAO,CAAC,GAAG;AAClD,eAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,WAAW,SAAS,UAAU,eAAe,EAAE;AAErD,SAAO,MAAM,WAAW,SAAS,YAAY,eAAe,EAAE;AAChE;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/matchmaker/Lobby.ts"],
4
- "sourcesContent": ["import * as matchMaker from '../MatchMaker';\n\nimport type { Room } from '../Room';\nimport { RoomListingData } from './driver/interfaces';\n\nconst LOBBY_CHANNEL = '$lobby';\n\n/*\n * TODO: refactor this on v0.16\n *\n * Some users might be relying on \"1\" = \"removed\" from the lobby due to this workaround: https://github.com/colyseus/colyseus/issues/617\n * Though, for consistency, we should invert as \"0\" = \"invisible\" and \"1\" = \"visible\".\n *\n * - rename \"removed\" to \"isVisible\" and swap the logic\n * - emit \"visibility-change\" with inverted value (isVisible)\n * - update \"subscribeLobby\" to check \"1\" as \"isVisible\" instead of \"removed\"\n */\n\nexport function updateLobby(room: Room, removed: boolean = false) {\n const listing = room.listing;\n\n if (listing.unlisted) return;\n\n if (removed) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},1`);\n } else if (!listing.private) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},0`);\n }\n}\n\nexport async function subscribeLobby(callback: (roomId: string, roomListing: RoomListingData) => void) {\n const cb = async (message) => {\n const [roomId, isRemove] = message.split(',');\n\n if (isRemove === '1') {\n callback(roomId, null);\n\n } else {\n const room = (await matchMaker.query({ roomId }))[0];\n callback(roomId, room);\n }\n };\n\n await matchMaker.presence.subscribe(LOBBY_CHANNEL, cb);\n\n return () => matchMaker.presence.unsubscribe(LOBBY_CHANNEL, cb);\n}\n"],
5
- "mappings": "AAAA,YAAY,gBAAgB;AAK5B,MAAM,gBAAgB;AAaf,SAAS,YAAY,MAAY,UAAmB,OAAO;AAChE,QAAM,UAAU,KAAK;AAErB,MAAI,QAAQ;AAAU;AAEtB,MAAI,SAAS;AACX,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE,WAAW,CAAC,QAAQ,SAAS;AAC3B,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE;AACF;AAEA,eAAsB,eAAe,UAAkE;AACrG,QAAM,KAAK,OAAO,YAAY;AAC5B,UAAM,CAAC,QAAQ,QAAQ,IAAI,QAAQ,MAAM,GAAG;AAE5C,QAAI,aAAa,KAAK;AACpB,eAAS,QAAQ,IAAI;AAAA,IAEvB,OAAO;AACL,YAAM,QAAQ,MAAM,WAAW,MAAM,EAAE,OAAO,CAAC,GAAG;AAClD,eAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,WAAW,SAAS,UAAU,eAAe,EAAE;AAErD,SAAO,MAAM,WAAW,SAAS,YAAY,eAAe,EAAE;AAChE;",
4
+ "sourcesContent": ["import * as matchMaker from '../MatchMaker';\n\nimport type { Room } from '../Room';\nimport { IRoomListingData } from './driver/interfaces';\n\nconst LOBBY_CHANNEL = '$lobby';\n\n/*\n * TODO: refactor this on v0.16\n *\n * Some users might be relying on \"1\" = \"removed\" from the lobby due to this workaround: https://github.com/colyseus/colyseus/issues/617\n * Though, for consistency, we should invert as \"0\" = \"invisible\" and \"1\" = \"visible\".\n *\n * - rename \"removed\" to \"isVisible\" and swap the logic\n * - emit \"visibility-change\" with inverted value (isVisible)\n * - update \"subscribeLobby\" to check \"1\" as \"isVisible\" instead of \"removed\"\n */\n\nexport function updateLobby(room: Room, removed: boolean = false) {\n const listing = room.listing;\n\n if (listing.unlisted) return;\n\n if (removed) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},1`);\n } else if (!listing.private) {\n matchMaker.presence.publish(LOBBY_CHANNEL, `${listing.roomId},0`);\n }\n}\n\nexport async function subscribeLobby(callback: (roomId: string, roomListing: IRoomListingData) => void) {\n const cb = async (message) => {\n const [roomId, isRemove] = message.split(',');\n\n if (isRemove === '1') {\n callback(roomId, null);\n\n } else {\n const room = (await matchMaker.query({ roomId }))[0];\n callback(roomId, room);\n }\n };\n\n await matchMaker.presence.subscribe(LOBBY_CHANNEL, cb);\n\n return () => matchMaker.presence.unsubscribe(LOBBY_CHANNEL, cb);\n}\n"],
5
+ "mappings": "AAAA,YAAY,gBAAgB;AAK5B,MAAM,gBAAgB;AAaf,SAAS,YAAY,MAAY,UAAmB,OAAO;AAChE,QAAM,UAAU,KAAK;AAErB,MAAI,QAAQ;AAAU;AAEtB,MAAI,SAAS;AACX,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE,WAAW,CAAC,QAAQ,SAAS;AAC3B,eAAW,SAAS,QAAQ,eAAe,GAAG,QAAQ,UAAU;AAAA,EAClE;AACF;AAEA,eAAsB,eAAe,UAAmE;AACtG,QAAM,KAAK,OAAO,YAAY;AAC5B,UAAM,CAAC,QAAQ,QAAQ,IAAI,QAAQ,MAAM,GAAG;AAE5C,QAAI,aAAa,KAAK;AACpB,eAAS,QAAQ,IAAI;AAAA,IAEvB,OAAO;AACL,YAAM,QAAQ,MAAM,WAAW,MAAM,EAAE,OAAO,CAAC,GAAG;AAClD,eAAS,QAAQ,IAAI;AAAA,IACvB;AAAA,EACF;AAEA,QAAM,WAAW,SAAS,UAAU,eAAe,EAAE;AAErD,SAAO,MAAM,WAAW,SAAS,YAAY,eAAe,EAAE;AAChE;",
6
6
  "names": []
7
7
  }
@@ -20,7 +20,7 @@ __export(driver_exports, {
20
20
  LocalDriver: () => LocalDriver
21
21
  });
22
22
  module.exports = __toCommonJS(driver_exports);
23
- var import_Logger = require("../../Logger");
23
+ var import_Debug = require("../../Debug");
24
24
  var import_Query = require("./Query");
25
25
  var import_RoomData = require("./RoomData");
26
26
  class LocalDriver {
@@ -45,7 +45,7 @@ class LocalDriver {
45
45
  }
46
46
  cleanup(processId) {
47
47
  const cachedRooms = this.find({ processId });
48
- import_Logger.logger.debug("> Removing stale rooms by processId:", processId, `(${cachedRooms.length} rooms found)`);
48
+ (0, import_Debug.debugMatchMaking)("removing stale rooms by processId %s (%s rooms found)", processId, cachedRooms.length);
49
49
  cachedRooms.forEach((room) => room.remove());
50
50
  return Promise.resolve();
51
51
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/matchmaker/driver/index.ts"],
4
- "sourcesContent": ["import { logger } from \"../../Logger\";\nimport { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver } from \"./interfaces\";\n\n// re-export\nexport type { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver };\n\nimport { Query } from './Query';\nimport { RoomCache } from './RoomData';\n\nexport class LocalDriver implements MatchMakerDriver {\n public rooms: RoomCache[] = [];\n\n public createInstance(initialValues: any = {}) {\n return new RoomCache(initialValues, this.rooms);\n }\n\n public has(roomId: string) {\n return this.rooms.some((room) => room.roomId === roomId);\n }\n\n public find(conditions: Partial<IRoomListingData>) {\n return this.rooms.filter(((room) => {\n for (const field in conditions) {\n if (\n conditions.hasOwnProperty(field) &&\n room[field] !== conditions[field]\n ) {\n return false;\n }\n }\n return true;\n }));\n }\n\n public cleanup(processId: string) {\n const cachedRooms = this.find({ processId });\n logger.debug(\"> Removing stale rooms by processId:\", processId, `(${cachedRooms.length} rooms found)`);\n\n cachedRooms.forEach((room) => room.remove());\n return Promise.resolve();\n }\n\n public findOne(conditions: Partial<IRoomListingData>) {\n return new Query<RoomListingData>(this.rooms, conditions) as any as QueryHelpers<RoomListingData>;\n }\n\n public clear() {\n this.rooms = [];\n }\n\n public shutdown() {\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AAMvB,mBAAsB;AACtB,sBAA0B;AAEnB,MAAM,YAAwC;AAAA,EAA9C;AACL,SAAO,QAAqB,CAAC;AAAA;AAAA,EAEtB,eAAe,gBAAqB,CAAC,GAAG;AAC7C,WAAO,IAAI,0BAAU,eAAe,KAAK,KAAK;AAAA,EAChD;AAAA,EAEO,IAAI,QAAgB;AACzB,WAAO,KAAK,MAAM,KAAK,CAAC,SAAS,KAAK,WAAW,MAAM;AAAA,EACzD;AAAA,EAEO,KAAK,YAAuC;AACjD,WAAO,KAAK,MAAM,OAAQ,CAAC,SAAS;AAClC,iBAAW,SAAS,YAAY;AAC9B,YACE,WAAW,eAAe,KAAK,KAC/B,KAAK,WAAW,WAAW,QAC3B;AACA,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT,CAAE;AAAA,EACJ;AAAA,EAEO,QAAQ,WAAmB;AAChC,UAAM,cAAc,KAAK,KAAK,EAAE,UAAU,CAAC;AAC3C,yBAAO,MAAM,wCAAwC,WAAW,IAAI,YAAY,qBAAqB;AAErG,gBAAY,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAC3C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,QAAQ,YAAuC;AACpD,WAAO,IAAI,mBAAuB,KAAK,OAAO,UAAU;AAAA,EAC1D;AAAA,EAEO,QAAQ;AACb,SAAK,QAAQ,CAAC;AAAA,EAChB;AAAA,EAEO,WAAW;AAAA,EAClB;AACF;",
4
+ "sourcesContent": ["import { debugMatchMaking } from \"../../Debug\";\nimport { logger } from \"../../Logger\";\nimport { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver } from \"./interfaces\";\n\n// re-export\nexport type { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver };\n\nimport { Query } from './Query';\nimport { RoomCache } from './RoomData';\n\nexport class LocalDriver implements MatchMakerDriver {\n public rooms: RoomCache[] = [];\n\n public createInstance(initialValues: any = {}) {\n return new RoomCache(initialValues, this.rooms);\n }\n\n public has(roomId: string) {\n return this.rooms.some((room) => room.roomId === roomId);\n }\n\n public find(conditions: Partial<IRoomListingData>) {\n return this.rooms.filter(((room) => {\n for (const field in conditions) {\n if (\n conditions.hasOwnProperty(field) &&\n room[field] !== conditions[field]\n ) {\n return false;\n }\n }\n return true;\n }));\n }\n\n public cleanup(processId: string) {\n const cachedRooms = this.find({ processId });\n debugMatchMaking(\"removing stale rooms by processId %s (%s rooms found)\", processId, cachedRooms.length);\n\n cachedRooms.forEach((room) => room.remove());\n return Promise.resolve();\n }\n\n public findOne(conditions: Partial<IRoomListingData>) {\n return new Query<RoomListingData>(this.rooms, conditions) as any as QueryHelpers<RoomListingData>;\n }\n\n public clear() {\n this.rooms = [];\n }\n\n public shutdown() {\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAOjC,mBAAsB;AACtB,sBAA0B;AAEnB,MAAM,YAAwC;AAAA,EAA9C;AACL,SAAO,QAAqB,CAAC;AAAA;AAAA,EAEtB,eAAe,gBAAqB,CAAC,GAAG;AAC7C,WAAO,IAAI,0BAAU,eAAe,KAAK,KAAK;AAAA,EAChD;AAAA,EAEO,IAAI,QAAgB;AACzB,WAAO,KAAK,MAAM,KAAK,CAAC,SAAS,KAAK,WAAW,MAAM;AAAA,EACzD;AAAA,EAEO,KAAK,YAAuC;AACjD,WAAO,KAAK,MAAM,OAAQ,CAAC,SAAS;AAClC,iBAAW,SAAS,YAAY;AAC9B,YACE,WAAW,eAAe,KAAK,KAC/B,KAAK,WAAW,WAAW,QAC3B;AACA,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT,CAAE;AAAA,EACJ;AAAA,EAEO,QAAQ,WAAmB;AAChC,UAAM,cAAc,KAAK,KAAK,EAAE,UAAU,CAAC;AAC3C,uCAAiB,yDAAyD,WAAW,YAAY,MAAM;AAEvG,gBAAY,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAC3C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,QAAQ,YAAuC;AACpD,WAAO,IAAI,mBAAuB,KAAK,OAAO,UAAU;AAAA,EAC1D;AAAA,EAEO,QAAQ;AACb,SAAK,QAAQ,CAAC;AAAA,EAChB;AAAA,EAEO,WAAW;AAAA,EAClB;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { logger } from "../../Logger";
1
+ import { debugMatchMaking } from "../../Debug";
2
2
  import { Query } from "./Query";
3
3
  import { RoomCache } from "./RoomData";
4
4
  class LocalDriver {
@@ -23,7 +23,7 @@ class LocalDriver {
23
23
  }
24
24
  cleanup(processId) {
25
25
  const cachedRooms = this.find({ processId });
26
- logger.debug("> Removing stale rooms by processId:", processId, `(${cachedRooms.length} rooms found)`);
26
+ debugMatchMaking("removing stale rooms by processId %s (%s rooms found)", processId, cachedRooms.length);
27
27
  cachedRooms.forEach((room) => room.remove());
28
28
  return Promise.resolve();
29
29
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/matchmaker/driver/index.ts"],
4
- "sourcesContent": ["import { logger } from \"../../Logger\";\nimport { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver } from \"./interfaces\";\n\n// re-export\nexport type { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver };\n\nimport { Query } from './Query';\nimport { RoomCache } from './RoomData';\n\nexport class LocalDriver implements MatchMakerDriver {\n public rooms: RoomCache[] = [];\n\n public createInstance(initialValues: any = {}) {\n return new RoomCache(initialValues, this.rooms);\n }\n\n public has(roomId: string) {\n return this.rooms.some((room) => room.roomId === roomId);\n }\n\n public find(conditions: Partial<IRoomListingData>) {\n return this.rooms.filter(((room) => {\n for (const field in conditions) {\n if (\n conditions.hasOwnProperty(field) &&\n room[field] !== conditions[field]\n ) {\n return false;\n }\n }\n return true;\n }));\n }\n\n public cleanup(processId: string) {\n const cachedRooms = this.find({ processId });\n logger.debug(\"> Removing stale rooms by processId:\", processId, `(${cachedRooms.length} rooms found)`);\n\n cachedRooms.forEach((room) => room.remove());\n return Promise.resolve();\n }\n\n public findOne(conditions: Partial<IRoomListingData>) {\n return new Query<RoomListingData>(this.rooms, conditions) as any as QueryHelpers<RoomListingData>;\n }\n\n public clear() {\n this.rooms = [];\n }\n\n public shutdown() {\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,cAAc;AAMvB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAEnB,MAAM,YAAwC;AAAA,EAA9C;AACL,SAAO,QAAqB,CAAC;AAAA;AAAA,EAEtB,eAAe,gBAAqB,CAAC,GAAG;AAC7C,WAAO,IAAI,UAAU,eAAe,KAAK,KAAK;AAAA,EAChD;AAAA,EAEO,IAAI,QAAgB;AACzB,WAAO,KAAK,MAAM,KAAK,CAAC,SAAS,KAAK,WAAW,MAAM;AAAA,EACzD;AAAA,EAEO,KAAK,YAAuC;AACjD,WAAO,KAAK,MAAM,OAAQ,CAAC,SAAS;AAClC,iBAAW,SAAS,YAAY;AAC9B,YACE,WAAW,eAAe,KAAK,KAC/B,KAAK,WAAW,WAAW,QAC3B;AACA,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT,CAAE;AAAA,EACJ;AAAA,EAEO,QAAQ,WAAmB;AAChC,UAAM,cAAc,KAAK,KAAK,EAAE,UAAU,CAAC;AAC3C,WAAO,MAAM,wCAAwC,WAAW,IAAI,YAAY,qBAAqB;AAErG,gBAAY,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAC3C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,QAAQ,YAAuC;AACpD,WAAO,IAAI,MAAuB,KAAK,OAAO,UAAU;AAAA,EAC1D;AAAA,EAEO,QAAQ;AACb,SAAK,QAAQ,CAAC;AAAA,EAChB;AAAA,EAEO,WAAW;AAAA,EAClB;AACF;",
4
+ "sourcesContent": ["import { debugMatchMaking } from \"../../Debug\";\nimport { logger } from \"../../Logger\";\nimport { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver } from \"./interfaces\";\n\n// re-export\nexport type { IRoomListingData, SortOptions, RoomListingData, QueryHelpers, MatchMakerDriver };\n\nimport { Query } from './Query';\nimport { RoomCache } from './RoomData';\n\nexport class LocalDriver implements MatchMakerDriver {\n public rooms: RoomCache[] = [];\n\n public createInstance(initialValues: any = {}) {\n return new RoomCache(initialValues, this.rooms);\n }\n\n public has(roomId: string) {\n return this.rooms.some((room) => room.roomId === roomId);\n }\n\n public find(conditions: Partial<IRoomListingData>) {\n return this.rooms.filter(((room) => {\n for (const field in conditions) {\n if (\n conditions.hasOwnProperty(field) &&\n room[field] !== conditions[field]\n ) {\n return false;\n }\n }\n return true;\n }));\n }\n\n public cleanup(processId: string) {\n const cachedRooms = this.find({ processId });\n debugMatchMaking(\"removing stale rooms by processId %s (%s rooms found)\", processId, cachedRooms.length);\n\n cachedRooms.forEach((room) => room.remove());\n return Promise.resolve();\n }\n\n public findOne(conditions: Partial<IRoomListingData>) {\n return new Query<RoomListingData>(this.rooms, conditions) as any as QueryHelpers<RoomListingData>;\n }\n\n public clear() {\n this.rooms = [];\n }\n\n public shutdown() {\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,wBAAwB;AAOjC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAEnB,MAAM,YAAwC;AAAA,EAA9C;AACL,SAAO,QAAqB,CAAC;AAAA;AAAA,EAEtB,eAAe,gBAAqB,CAAC,GAAG;AAC7C,WAAO,IAAI,UAAU,eAAe,KAAK,KAAK;AAAA,EAChD;AAAA,EAEO,IAAI,QAAgB;AACzB,WAAO,KAAK,MAAM,KAAK,CAAC,SAAS,KAAK,WAAW,MAAM;AAAA,EACzD;AAAA,EAEO,KAAK,YAAuC;AACjD,WAAO,KAAK,MAAM,OAAQ,CAAC,SAAS;AAClC,iBAAW,SAAS,YAAY;AAC9B,YACE,WAAW,eAAe,KAAK,KAC/B,KAAK,WAAW,WAAW,QAC3B;AACA,iBAAO;AAAA,QACT;AAAA,MACF;AACA,aAAO;AAAA,IACT,CAAE;AAAA,EACJ;AAAA,EAEO,QAAQ,WAAmB;AAChC,UAAM,cAAc,KAAK,KAAK,EAAE,UAAU,CAAC;AAC3C,qBAAiB,yDAAyD,WAAW,YAAY,MAAM;AAEvG,gBAAY,QAAQ,CAAC,SAAS,KAAK,OAAO,CAAC;AAC3C,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEO,QAAQ,YAAuC;AACpD,WAAO,IAAI,MAAuB,KAAK,OAAO,UAAU;AAAA,EAC1D;AAAA,EAEO,QAAQ;AACb,SAAK,QAAQ,CAAC;AAAA,EAChB;AAAA,EAEO,WAAW;AAAA,EAClB;AACF;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import { RoomListingData } from '../matchmaker/driver';
1
+ import { IRoomListingData } from '../matchmaker/driver';
2
2
  import { Room } from '../Room';
3
3
  import { Client } from '../Transport';
4
4
  export interface FilterInput {
@@ -9,7 +9,7 @@ export interface LobbyOptions {
9
9
  filter?: FilterInput;
10
10
  }
11
11
  export declare class LobbyRoom extends Room {
12
- rooms: RoomListingData[];
12
+ rooms: IRoomListingData[];
13
13
  unsubscribeLobby: () => void;
14
14
  clientOptions: {
15
15
  [sessionId: string]: LobbyOptions;
@@ -18,6 +18,6 @@ export declare class LobbyRoom extends Room {
18
18
  onJoin(client: Client, options: LobbyOptions): void;
19
19
  onLeave(client: Client): void;
20
20
  onDispose(): void;
21
- protected filterItemsForClient(options: LobbyOptions): RoomListingData<any>[];
22
- protected filterItemForClient(room: RoomListingData, filter?: LobbyOptions['filter']): boolean;
21
+ protected filterItemsForClient(options: LobbyOptions): IRoomListingData[];
22
+ protected filterItemForClient(room: IRoomListingData, filter?: LobbyOptions['filter']): boolean;
23
23
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/rooms/LobbyRoom.ts"],
4
- "sourcesContent": ["\nimport * as matchMaker from '../MatchMaker';\nimport { RoomListingData } from '../matchmaker/driver';\nimport { subscribeLobby } from '../matchmaker/Lobby';\nimport { Room } from '../Room';\nimport { Client } from '../Transport';\n\n// TODO: use Schema state & filters on version 1.0.0\n\n// class DummyLobbyState extends Schema { // tslint:disable-line\n// @type(\"number\") public _: number;\n// }\n\nexport interface FilterInput {\n name?: string;\n metadata?: any;\n}\n\nexport interface LobbyOptions {\n filter?: FilterInput;\n}\n\nexport class LobbyRoom extends Room { // tslint:disable-line\n public rooms: RoomListingData[] = [];\n public unsubscribeLobby: () => void;\n\n public clientOptions: { [sessionId: string]: LobbyOptions } = {};\n\n public async onCreate(options: any) {\n // prevent LobbyRoom to notify itself\n this.listing.unlisted = true;\n\n this.unsubscribeLobby = await subscribeLobby((roomId, data) => {\n const roomIndex = this.rooms.findIndex((room) => room.roomId === roomId);\n const clients = this.clients.filter((client) => this.clientOptions[client.sessionId]);\n\n if (!data) {\n // remove room listing data\n if (roomIndex !== -1) {\n const previousData = this.rooms[roomIndex];\n\n this.rooms.splice(roomIndex, 1);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter)) {\n client.send('-', roomId);\n }\n });\n }\n\n } else if (roomIndex === -1) {\n // append room listing data\n this.rooms.push(data);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(data, this.clientOptions[client.sessionId].filter)) {\n client.send('+', [roomId, data]);\n }\n });\n\n } else {\n const previousData = this.rooms[roomIndex];\n\n // replace room listing data\n this.rooms[roomIndex] = data;\n\n clients.forEach((client) => {\n const hadData = this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter);\n const hasData = this.filterItemForClient(data, this.clientOptions[client.sessionId].filter);\n\n if (hadData && !hasData) {\n client.send('-', roomId);\n\n } else if (hasData) {\n client.send('+', [roomId, data]);\n }\n });\n }\n });\n\n this.rooms = await matchMaker.query({ private: false, unlisted: false });\n\n this.onMessage('filter', (client: Client, filter: FilterInput) => {\n this.clientOptions[client.sessionId].filter = filter;\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n });\n }\n\n public onJoin(client: Client, options: LobbyOptions) {\n this.clientOptions[client.sessionId] = options || {};\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n }\n\n public onLeave(client: Client) {\n delete this.clientOptions[client.sessionId];\n }\n\n public onDispose() {\n if (this.unsubscribeLobby) {\n this.unsubscribeLobby();\n }\n }\n\n protected filterItemsForClient(options: LobbyOptions) {\n const filter = options.filter;\n\n return (filter)\n ? this.rooms.filter((room) => this.filterItemForClient(room, filter))\n : this.rooms;\n }\n\n protected filterItemForClient(room: RoomListingData, filter?: LobbyOptions['filter']) {\n if (!filter) {\n return true;\n }\n\n let isAllowed = true;\n\n if (filter.name !== room.name) {\n isAllowed = false;\n }\n\n if (filter.metadata) {\n for (const field in filter.metadata) {\n if (room.metadata[field] !== filter.metadata[field]) {\n isAllowed = false;\n break;\n }\n }\n }\n\n return isAllowed;\n }\n\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAA4B;AAE5B,mBAA+B;AAC/B,kBAAqB;AAkBd,MAAM,kBAAkB,iBAAK;AAAA,EAA7B;AAAA;AACL,SAAO,QAA2B,CAAC;AAGnC,SAAO,gBAAuD,CAAC;AAAA;AAAA,EAE/D,MAAa,SAAS,SAAc;AAElC,SAAK,QAAQ,WAAW;AAExB,SAAK,mBAAmB,UAAM,6BAAe,CAAC,QAAQ,SAAS;AAC7D,YAAM,YAAY,KAAK,MAAM,UAAU,CAAC,SAAS,KAAK,WAAW,MAAM;AACvE,YAAM,UAAU,KAAK,QAAQ,OAAO,CAAC,WAAW,KAAK,cAAc,OAAO,UAAU;AAEpF,UAAI,CAAC,MAAM;AAET,YAAI,cAAc,IAAI;AACpB,gBAAM,eAAe,KAAK,MAAM;AAEhC,eAAK,MAAM,OAAO,WAAW,CAAC;AAE9B,kBAAQ,QAAQ,CAAC,WAAW;AAC1B,gBAAI,KAAK,oBAAoB,cAAc,KAAK,cAAc,OAAO,WAAW,MAAM,GAAG;AACvF,qBAAO,KAAK,KAAK,MAAM;AAAA,YACzB;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MAEF,WAAW,cAAc,IAAI;AAE3B,aAAK,MAAM,KAAK,IAAI;AAEpB,gBAAQ,QAAQ,CAAC,WAAW;AAC1B,cAAI,KAAK,oBAAoB,MAAM,KAAK,cAAc,OAAO,WAAW,MAAM,GAAG;AAC/E,mBAAO,KAAK,KAAK,CAAC,QAAQ,IAAI,CAAC;AAAA,UACjC;AAAA,QACF,CAAC;AAAA,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AAA,IACT;AAEA,QAAI,YAAY;AAEhB,QAAI,OAAO,SAAS,KAAK,MAAM;AAC7B,kBAAY;AAAA,IACd;AAEA,QAAI,OAAO,UAAU;AACnB,iBAAW,SAAS,OAAO,UAAU;AACnC,YAAI,KAAK,SAAS,WAAW,OAAO,SAAS,QAAQ;AACnD,sBAAY;AACZ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEF;",
4
+ "sourcesContent": ["\nimport * as matchMaker from '../MatchMaker';\nimport { IRoomListingData } from '../matchmaker/driver';\nimport { subscribeLobby } from '../matchmaker/Lobby';\nimport { Room } from '../Room';\nimport { Client } from '../Transport';\n\n// TODO: use Schema state & filters on version 1.0.0\n\n// class DummyLobbyState extends Schema { // tslint:disable-line\n// @type(\"number\") public _: number;\n// }\n\nexport interface FilterInput {\n name?: string;\n metadata?: any;\n}\n\nexport interface LobbyOptions {\n filter?: FilterInput;\n}\n\nexport class LobbyRoom extends Room { // tslint:disable-line\n public rooms: IRoomListingData[] = [];\n public unsubscribeLobby: () => void;\n\n public clientOptions: { [sessionId: string]: LobbyOptions } = {};\n\n public async onCreate(options: any) {\n // prevent LobbyRoom to notify itself\n this.listing.unlisted = true;\n\n this.unsubscribeLobby = await subscribeLobby((roomId, data) => {\n const roomIndex = this.rooms.findIndex((room) => room.roomId === roomId);\n const clients = this.clients.filter((client) => this.clientOptions[client.sessionId]);\n\n if (!data) {\n // remove room listing data\n if (roomIndex !== -1) {\n const previousData = this.rooms[roomIndex];\n\n this.rooms.splice(roomIndex, 1);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter)) {\n client.send('-', roomId);\n }\n });\n }\n\n } else if (roomIndex === -1) {\n // append room listing data\n this.rooms.push(data);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(data, this.clientOptions[client.sessionId].filter)) {\n client.send('+', [roomId, data]);\n }\n });\n\n } else {\n const previousData = this.rooms[roomIndex];\n\n // replace room listing data\n this.rooms[roomIndex] = data;\n\n clients.forEach((client) => {\n const hadData = this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter);\n const hasData = this.filterItemForClient(data, this.clientOptions[client.sessionId].filter);\n\n if (hadData && !hasData) {\n client.send('-', roomId);\n\n } else if (hasData) {\n client.send('+', [roomId, data]);\n }\n });\n }\n });\n\n this.rooms = await matchMaker.query({ private: false, unlisted: false });\n\n this.onMessage('filter', (client: Client, filter: FilterInput) => {\n this.clientOptions[client.sessionId].filter = filter;\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n });\n }\n\n public onJoin(client: Client, options: LobbyOptions) {\n this.clientOptions[client.sessionId] = options || {};\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n }\n\n public onLeave(client: Client) {\n delete this.clientOptions[client.sessionId];\n }\n\n public onDispose() {\n if (this.unsubscribeLobby) {\n this.unsubscribeLobby();\n }\n }\n\n protected filterItemsForClient(options: LobbyOptions) {\n const filter = options.filter;\n\n return (filter)\n ? this.rooms.filter((room) => this.filterItemForClient(room, filter))\n : this.rooms;\n }\n\n protected filterItemForClient(room: IRoomListingData, filter?: LobbyOptions['filter']) {\n if (!filter) {\n return true;\n }\n\n let isAllowed = true;\n\n if (filter.name !== room.name) {\n isAllowed = false;\n }\n\n if (filter.metadata) {\n for (const field in filter.metadata) {\n if (room.metadata[field] !== filter.metadata[field]) {\n isAllowed = false;\n break;\n }\n }\n }\n\n return isAllowed;\n }\n\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAA4B;AAE5B,mBAA+B;AAC/B,kBAAqB;AAkBd,MAAM,kBAAkB,iBAAK;AAAA,EAA7B;AAAA;AACL,SAAO,QAA4B,CAAC;AAGpC,SAAO,gBAAuD,CAAC;AAAA;AAAA,EAE/D,MAAa,SAAS,SAAc;AAElC,SAAK,QAAQ,WAAW;AAExB,SAAK,mBAAmB,UAAM,6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,UAAU,UAAU,CAAC,QAAgB,WAAwB;AAChE,WAAK,cAAc,OAAO,WAAW,SAAS;AAC9C,aAAO,KAAK,SAAS,KAAK,qBAAqB,KAAK,cAAc,OAAO,UAAU,CAAC;AAAA,IACtF,CAAC;AAAA,EACH;AAAA,EAEO,OAAO,QAAgB,SAAuB;AACnD,SAAK,cAAc,OAAO,aAAa,WAAW,CAAC;AACnD,WAAO,KAAK,SAAS,KAAK,qBAAqB,KAAK,cAAc,OAAO,UAAU,CAAC;AAAA,EACtF;AAAA,EAEO,QAAQ,QAAgB;AAC7B,WAAO,KAAK,cAAc,OAAO;AAAA,EACnC;AAAA,EAEO,YAAY;AACjB,QAAI,KAAK,kBAAkB;AACzB,WAAK,iBAAiB;AAAA,IACxB;AAAA,EACF;AAAA,EAEU,qBAAqB,SAAuB;AACpD,UAAM,SAAS,QAAQ;AAEvB,WAAQ,SACJ,KAAK,MAAM,OAAO,CAAC,SAAS,KAAK,oBAAoB,MAAM,MAAM,CAAC,IAClE,KAAK;AAAA,EACX;AAAA,EAEU,oBAAoB,MAAwB,QAAiC;AACrF,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,IACT;AAEA,QAAI,YAAY;AAEhB,QAAI,OAAO,SAAS,KAAK,MAAM;AAC7B,kBAAY;AAAA,IACd;AAEA,QAAI,OAAO,UAAU;AACnB,iBAAW,SAAS,OAAO,UAAU;AACnC,YAAI,KAAK,SAAS,WAAW,OAAO,SAAS,QAAQ;AACnD,sBAAY;AACZ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/rooms/LobbyRoom.ts"],
4
- "sourcesContent": ["\nimport * as matchMaker from '../MatchMaker';\nimport { RoomListingData } from '../matchmaker/driver';\nimport { subscribeLobby } from '../matchmaker/Lobby';\nimport { Room } from '../Room';\nimport { Client } from '../Transport';\n\n// TODO: use Schema state & filters on version 1.0.0\n\n// class DummyLobbyState extends Schema { // tslint:disable-line\n// @type(\"number\") public _: number;\n// }\n\nexport interface FilterInput {\n name?: string;\n metadata?: any;\n}\n\nexport interface LobbyOptions {\n filter?: FilterInput;\n}\n\nexport class LobbyRoom extends Room { // tslint:disable-line\n public rooms: RoomListingData[] = [];\n public unsubscribeLobby: () => void;\n\n public clientOptions: { [sessionId: string]: LobbyOptions } = {};\n\n public async onCreate(options: any) {\n // prevent LobbyRoom to notify itself\n this.listing.unlisted = true;\n\n this.unsubscribeLobby = await subscribeLobby((roomId, data) => {\n const roomIndex = this.rooms.findIndex((room) => room.roomId === roomId);\n const clients = this.clients.filter((client) => this.clientOptions[client.sessionId]);\n\n if (!data) {\n // remove room listing data\n if (roomIndex !== -1) {\n const previousData = this.rooms[roomIndex];\n\n this.rooms.splice(roomIndex, 1);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter)) {\n client.send('-', roomId);\n }\n });\n }\n\n } else if (roomIndex === -1) {\n // append room listing data\n this.rooms.push(data);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(data, this.clientOptions[client.sessionId].filter)) {\n client.send('+', [roomId, data]);\n }\n });\n\n } else {\n const previousData = this.rooms[roomIndex];\n\n // replace room listing data\n this.rooms[roomIndex] = data;\n\n clients.forEach((client) => {\n const hadData = this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter);\n const hasData = this.filterItemForClient(data, this.clientOptions[client.sessionId].filter);\n\n if (hadData && !hasData) {\n client.send('-', roomId);\n\n } else if (hasData) {\n client.send('+', [roomId, data]);\n }\n });\n }\n });\n\n this.rooms = await matchMaker.query({ private: false, unlisted: false });\n\n this.onMessage('filter', (client: Client, filter: FilterInput) => {\n this.clientOptions[client.sessionId].filter = filter;\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n });\n }\n\n public onJoin(client: Client, options: LobbyOptions) {\n this.clientOptions[client.sessionId] = options || {};\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n }\n\n public onLeave(client: Client) {\n delete this.clientOptions[client.sessionId];\n }\n\n public onDispose() {\n if (this.unsubscribeLobby) {\n this.unsubscribeLobby();\n }\n }\n\n protected filterItemsForClient(options: LobbyOptions) {\n const filter = options.filter;\n\n return (filter)\n ? this.rooms.filter((room) => this.filterItemForClient(room, filter))\n : this.rooms;\n }\n\n protected filterItemForClient(room: RoomListingData, filter?: LobbyOptions['filter']) {\n if (!filter) {\n return true;\n }\n\n let isAllowed = true;\n\n if (filter.name !== room.name) {\n isAllowed = false;\n }\n\n if (filter.metadata) {\n for (const field in filter.metadata) {\n if (room.metadata[field] !== filter.metadata[field]) {\n isAllowed = false;\n break;\n }\n }\n }\n\n return isAllowed;\n }\n\n}\n"],
5
- "mappings": "AACA,YAAY,gBAAgB;AAE5B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AAkBd,MAAM,kBAAkB,KAAK;AAAA,EAA7B;AAAA;AACL,SAAO,QAA2B,CAAC;AAGnC,SAAO,gBAAuD,CAAC;AAAA;AAAA,EAE/D,MAAa,SAAS,SAAc;AAElC,SAAK,QAAQ,WAAW;AAExB,SAAK,mBAAmB,MAAM,eAAe,CAAC,QAAQ,SAAS;AAC7D,YAAM,YAAY,KAAK,MAAM,UAAU,CAAC,SAAS,KAAK,WAAW,MAAM;AACvE,YAAM,UAAU,KAAK,QAAQ,OAAO,CAAC,WAAW,KAAK,cAAc,OAAO,UAAU;AAEpF,UAAI,CAAC,MAAM;AAET,YAAI,cAAc,IAAI;AACpB,gBAAM,eAAe,KAAK,MAAM;AAEhC,eAAK,MAAM,OAAO,WAAW,CAAC;AAE9B,kBAAQ,QAAQ,CAAC,WAAW;AAC1B,gBAAI,KAAK,oBAAoB,cAAc,KAAK,cAAc,OAAO,WAAW,MAAM,GAAG;AACvF,qBAAO,KAAK,KAAK,MAAM;AAAA,YACzB;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MAE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;AAAA,EACF;AAAA,EAEU,qBAAqB,SAAuB;AACpD,UAAM,SAAS,QAAQ;AAEvB,WAAQ,SACJ,KAAK,MAAM,OAAO,CAAC,SAAS,KAAK,oBAAoB,MAAM,MAAM,CAAC,IAClE,KAAK;AAAA,EACX;AAAA,EAEU,oBAAoB,MAAuB,QAAiC;AACpF,QAAI,CAAC,QAAQ;AACX,aAAO;AAAA,IACT;AAEA,QAAI,YAAY;AAEhB,QAAI,OAAO,SAAS,KAAK,MAAM;AAC7B,kBAAY;AAAA,IACd;AAEA,QAAI,OAAO,UAAU;AACnB,iBAAW,SAAS,OAAO,UAAU;AACnC,YAAI,KAAK,SAAS,WAAW,OAAO,SAAS,QAAQ;AACnD,sBAAY;AACZ;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEF;",
4
+ "sourcesContent": ["\nimport * as matchMaker from '../MatchMaker';\nimport { IRoomListingData } from '../matchmaker/driver';\nimport { subscribeLobby } from '../matchmaker/Lobby';\nimport { Room } from '../Room';\nimport { Client } from '../Transport';\n\n// TODO: use Schema state & filters on version 1.0.0\n\n// class DummyLobbyState extends Schema { // tslint:disable-line\n// @type(\"number\") public _: number;\n// }\n\nexport interface FilterInput {\n name?: string;\n metadata?: any;\n}\n\nexport interface LobbyOptions {\n filter?: FilterInput;\n}\n\nexport class LobbyRoom extends Room { // tslint:disable-line\n public rooms: IRoomListingData[] = [];\n public unsubscribeLobby: () => void;\n\n public clientOptions: { [sessionId: string]: LobbyOptions } = {};\n\n public async onCreate(options: any) {\n // prevent LobbyRoom to notify itself\n this.listing.unlisted = true;\n\n this.unsubscribeLobby = await subscribeLobby((roomId, data) => {\n const roomIndex = this.rooms.findIndex((room) => room.roomId === roomId);\n const clients = this.clients.filter((client) => this.clientOptions[client.sessionId]);\n\n if (!data) {\n // remove room listing data\n if (roomIndex !== -1) {\n const previousData = this.rooms[roomIndex];\n\n this.rooms.splice(roomIndex, 1);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter)) {\n client.send('-', roomId);\n }\n });\n }\n\n } else if (roomIndex === -1) {\n // append room listing data\n this.rooms.push(data);\n\n clients.forEach((client) => {\n if (this.filterItemForClient(data, this.clientOptions[client.sessionId].filter)) {\n client.send('+', [roomId, data]);\n }\n });\n\n } else {\n const previousData = this.rooms[roomIndex];\n\n // replace room listing data\n this.rooms[roomIndex] = data;\n\n clients.forEach((client) => {\n const hadData = this.filterItemForClient(previousData, this.clientOptions[client.sessionId].filter);\n const hasData = this.filterItemForClient(data, this.clientOptions[client.sessionId].filter);\n\n if (hadData && !hasData) {\n client.send('-', roomId);\n\n } else if (hasData) {\n client.send('+', [roomId, data]);\n }\n });\n }\n });\n\n this.rooms = await matchMaker.query({ private: false, unlisted: false });\n\n this.onMessage('filter', (client: Client, filter: FilterInput) => {\n this.clientOptions[client.sessionId].filter = filter;\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n });\n }\n\n public onJoin(client: Client, options: LobbyOptions) {\n this.clientOptions[client.sessionId] = options || {};\n client.send('rooms', this.filterItemsForClient(this.clientOptions[client.sessionId]));\n }\n\n public onLeave(client: Client) {\n delete this.clientOptions[client.sessionId];\n }\n\n public onDispose() {\n if (this.unsubscribeLobby) {\n this.unsubscribeLobby();\n }\n }\n\n protected filterItemsForClient(options: LobbyOptions) {\n const filter = options.filter;\n\n return (filter)\n ? this.rooms.filter((room) => this.filterItemForClient(room, filter))\n : this.rooms;\n }\n\n protected filterItemForClient(room: IRoomListingData, filter?: LobbyOptions['filter']) {\n if (!filter) {\n return true;\n }\n\n let isAllowed = true;\n\n if (filter.name !== room.name) {\n isAllowed = false;\n }\n\n if (filter.metadata) {\n for (const field in filter.metadata) {\n if (room.metadata[field] !== filter.metadata[field]) {\n isAllowed = false;\n break;\n }\n }\n }\n\n return isAllowed;\n }\n\n}\n"],
5
+ "mappings": "AACA,YAAY,gBAAgB;AAE5B,SAAS,sBAAsB;AAC/B,S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
  /// <reference types="node" />
3
3
  import { EventEmitter } from "events";
4
4
  import { ServerOpts, Socket } from "net";
5
+ import { RoomException } from '../errors/RoomExceptions';
6
+ import { Type } from './types';
5
7
  export declare const REMOTE_ROOM_SHORT_TIMEOUT: number;
6
8
  export declare function generateId(length?: number): any;
7
9
  export declare function getBearerToken(authHeader: string): string;
@@ -17,6 +19,7 @@ export declare class Deferred<T = any> {
17
19
  catch(func: (value: any) => any): Promise<any>;
18
20
  }
19
21
  export declare function merge(a: any, ...objs: any[]): any;
22
+ export declare function wrapTryCatch(method: Function, onError: (error: RoomException, methodName: string) => void, exceptionClass: Type<RoomException>, methodName: string, rethrow?: boolean, ...additionalErrorArgs: any[]): (...args: any[]) => any;
20
23
  export declare interface DummyServer {
21
24
  constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void): any;
22
25
  listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;