@colyseus/monitor 0.17.7 → 0.18.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.
- package/build/ext/Room.cjs +38 -2
- package/build/ext/Room.cjs.map +2 -2
- package/build/ext/Room.mjs +38 -2
- package/build/ext/Room.mjs.map +2 -2
- package/build/index.cjs +129 -7
- package/build/index.cjs.map +3 -3
- package/build/index.d.ts +9 -4
- package/build/index.mjs +124 -7
- package/build/index.mjs.map +2 -2
- package/build/serve-static.cjs +107 -0
- package/build/serve-static.cjs.map +7 -0
- package/build/serve-static.d.ts +1 -0
- package/build/serve-static.mjs +72 -0
- package/build/serve-static.mjs.map +7 -0
- package/build/static/assets/index-BibYO4R0.js +247 -0
- package/build/static/assets/index-BibYO4R0.js.map +1 -0
- package/build/static/assets/index-C4SPBCkT.css +1 -0
- package/build/static/index.html +2 -2
- package/package.json +8 -6
- package/src-backend/ext/Room.ts +41 -2
- package/src-backend/index.ts +154 -21
- package/src-backend/serve-static.ts +73 -0
- package/README.md +0 -57
- package/build/api.cjs +0 -110
- package/build/api.cjs.map +0 -7
- package/build/api.d.ts +0 -3
- package/build/api.mjs +0 -75
- package/build/api.mjs.map +0 -7
- package/build/static/assets/index-8wRFHIxm.css +0 -1
- package/build/static/assets/index-pYihVoWY.js +0 -248
- package/build/static/assets/index-pYihVoWY.js.map +0 -1
- package/src-backend/api.ts +0 -94
package/build/ext/Room.cjs
CHANGED
|
@@ -22,8 +22,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
22
22
|
var import_core = require("@colyseus/core");
|
|
23
23
|
function getStateSize(room) {
|
|
24
24
|
const hasState = room._serializer.encoder || // schema v3
|
|
25
|
-
room._serializer.state
|
|
26
|
-
room._serializer.previousState;
|
|
25
|
+
room._serializer.state;
|
|
27
26
|
const fullState = hasState && room._serializer.getFullState();
|
|
28
27
|
return fullState && (fullState.byteLength || fullState.length) || 0;
|
|
29
28
|
}
|
|
@@ -70,3 +69,40 @@ import_core.Room.prototype._sendMessageToClient = async function(sessionId, type
|
|
|
70
69
|
}
|
|
71
70
|
}
|
|
72
71
|
};
|
|
72
|
+
function getChild(parent, key) {
|
|
73
|
+
if (typeof parent.at === "function" && typeof key === "number") {
|
|
74
|
+
return parent.at(key);
|
|
75
|
+
}
|
|
76
|
+
if (typeof parent.get === "function") {
|
|
77
|
+
return parent.get(String(key));
|
|
78
|
+
}
|
|
79
|
+
return parent[key];
|
|
80
|
+
}
|
|
81
|
+
import_core.Room.prototype._editStateProperty = async function(path, value) {
|
|
82
|
+
let current = this.state;
|
|
83
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
84
|
+
if (current === null || current === void 0) return;
|
|
85
|
+
current = getChild(current, path[i]);
|
|
86
|
+
}
|
|
87
|
+
if (current === null || current === void 0) return;
|
|
88
|
+
const property = path[path.length - 1];
|
|
89
|
+
if (typeof current.set === "function") {
|
|
90
|
+
current.set(String(property), value);
|
|
91
|
+
} else {
|
|
92
|
+
current[property] = value;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
import_core.Room.prototype._deleteStateProperty = async function(path) {
|
|
96
|
+
let current = this.state;
|
|
97
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
98
|
+
if (current === null || current === void 0) return;
|
|
99
|
+
current = getChild(current, path[i]);
|
|
100
|
+
}
|
|
101
|
+
if (current === null || current === void 0) return;
|
|
102
|
+
const property = path[path.length - 1];
|
|
103
|
+
if (typeof current.delete === "function") {
|
|
104
|
+
current.delete(String(property));
|
|
105
|
+
} else {
|
|
106
|
+
current[property] = void 0;
|
|
107
|
+
}
|
|
108
|
+
};
|
package/build/ext/Room.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src-backend/ext/Room.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Monkey-patch Colyseus' default behaviour\n//\nimport { Room, type Client, type ClientPrivate } from \"@colyseus/core\";\n\nfunction getStateSize(room) {\n // TODO: `Serializer<T>` should provide a method for this (e.g. `serializer.hasState()`)\n const hasState = (\n room._serializer.encoder || // schema v3\n room._serializer.state
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAGA,kBAAsD;AAEtD,SAAS,aAAa,MAAM;AAExB,QAAM,WACJ,KAAK,YAAY;AAAA,EACjB,KAAK,YAAY;
|
|
4
|
+
"sourcesContent": ["//\n// Monkey-patch Colyseus' default behaviour\n//\nimport { Room, type Client, type ClientPrivate } from \"@colyseus/core\";\n\nfunction getStateSize(room) {\n // TODO: `Serializer<T>` should provide a method for this (e.g. `serializer.hasState()`)\n const hasState = (\n room._serializer.encoder || // schema v3\n room._serializer.state // schema v2\n );\n const fullState = hasState && room._serializer.getFullState();\n return fullState && (fullState.byteLength || fullState.length) || 0;\n}\n\n(Room.prototype as any).getAvailableData = function () {\n return {\n clients: this.clients.length,\n maxClients: this.maxClients,\n metadata: this.metadata,\n roomId: this.roomId,\n };\n};\n\n(Room.prototype as any).getRoomListData = async function () {\n const stateSize = getStateSize(this);\n const elapsedTime = this.clock.elapsedTime;\n const locked = this.locked;\n const data = this.getAvailableData();\n\n return { ...data, locked, elapsedTime, stateSize };\n};\n\n(Room.prototype as any).getInspectData = async function () {\n const state = this.state;\n const stateSize = getStateSize(this);\n const roomElapsedTime = this.clock.elapsedTime;\n\n const data = this.getAvailableData();\n const clients = this.clients.map((client: Client & ClientPrivate) => ({\n sessionId: client.sessionId,\n elapsedTime: roomElapsedTime - client._joinedAt\n }));\n const locked = this.locked;\n\n return { ...data, locked, clients, state, stateSize };\n};\n\n// Actions\n(Room.prototype as any)._forceClientDisconnect = async function (sessionId) {\n for (let i = 0; i < this.clients.length; i++) {\n if (this.clients[i].sessionId === sessionId) {\n this.clients[i].leave();\n break;\n }\n }\n};\n\n(Room.prototype as any)._sendMessageToClient = async function (sessionId, type, data) {\n for (let i = 0; i < this.clients.length; i++) {\n if (this.clients[i].sessionId === sessionId) {\n this.clients[i].send(type, data);\n break;\n }\n }\n};\n\nfunction getChild(parent: any, key: string | number) {\n if (typeof parent.at === 'function' && typeof key === 'number') {\n return parent.at(key);\n }\n if (typeof parent.get === 'function') {\n return parent.get(String(key));\n }\n return parent[key];\n}\n\n(Room.prototype as any)._editStateProperty = async function (path: (string | number)[], value: any) {\n let current = this.state;\n for (let i = 0; i < path.length - 1; i++) {\n if (current === null || current === undefined) return;\n current = getChild(current, path[i]);\n }\n if (current === null || current === undefined) return;\n const property = path[path.length - 1];\n if (typeof current.set === 'function') {\n current.set(String(property), value);\n } else {\n current[property] = value;\n }\n};\n\n(Room.prototype as any)._deleteStateProperty = async function (path: (string | number)[]) {\n let current = this.state;\n for (let i = 0; i < path.length - 1; i++) {\n if (current === null || current === undefined) return;\n current = getChild(current, path[i]);\n }\n if (current === null || current === undefined) return;\n const property = path[path.length - 1];\n if (typeof current.delete === 'function') {\n current.delete(String(property));\n } else {\n current[property] = undefined;\n }\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAGA,kBAAsD;AAEtD,SAAS,aAAa,MAAM;AAExB,QAAM,WACJ,KAAK,YAAY;AAAA,EACjB,KAAK,YAAY;AAEnB,QAAM,YAAY,YAAY,KAAK,YAAY,aAAa;AAC5D,SAAO,cAAc,UAAU,cAAc,UAAU,WAAW;AACtE;AAEC,iBAAK,UAAkB,mBAAmB,WAAY;AACnD,SAAO;AAAA,IACH,SAAS,KAAK,QAAQ;AAAA,IACtB,YAAY,KAAK;AAAA,IACjB,UAAU,KAAK;AAAA,IACf,QAAQ,KAAK;AAAA,EACjB;AACJ;AAEC,iBAAK,UAAkB,kBAAkB,iBAAkB;AACxD,QAAM,YAAY,aAAa,IAAI;AACnC,QAAM,cAAc,KAAK,MAAM;AAC/B,QAAM,SAAS,KAAK;AACpB,QAAM,OAAO,KAAK,iBAAiB;AAEnC,SAAO,iCAAK,OAAL,EAAW,QAAQ,aAAa,UA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C,QAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,cAAU,SAAS,SAAS,KAAK,CAAC,CAAC;AAAA,EACvC;AACA,MAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,QAAM,WAAW,KAAK,KAAK,SAAS,CAAC;AACrC,MAAI,OAAO,QAAQ,QAAQ,YAAY;AACnC,YAAQ,IAAI,OAAO,QAAQ,GAAG,KAAK;AAAA,EACvC,OAAO;AACH,YAAQ,QAAQ,IAAI;AAAA,EACxB;AACJ;AAEC,iBAAK,UAAkB,uBAAuB,eAAgB,MAA2B;AACtF,MAAI,UAAU,KAAK;AACnB,WAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACtC,QAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,cAAU,SAAS,SAAS,KAAK,CAAC,CAAC;AAAA,EACvC;AACA,MAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,QAAM,WAAW,KAAK,KAAK,SAAS,CAAC;AACrC,MAAI,OAAO,QAAQ,WAAW,YAAY;AACtC,YAAQ,OAAO,OAAO,QAAQ,CAAC;AAAA,EACnC,OAAO;AACH,YAAQ,QAAQ,IAAI;AAAA,EACxB;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/ext/Room.mjs
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { Room } from "@colyseus/core";
|
|
3
3
|
function getStateSize(room) {
|
|
4
4
|
const hasState = room._serializer.encoder || // schema v3
|
|
5
|
-
room._serializer.state
|
|
6
|
-
room._serializer.previousState;
|
|
5
|
+
room._serializer.state;
|
|
7
6
|
const fullState = hasState && room._serializer.getFullState();
|
|
8
7
|
return fullState && (fullState.byteLength || fullState.length) || 0;
|
|
9
8
|
}
|
|
@@ -50,3 +49,40 @@ Room.prototype._sendMessageToClient = async function(sessionId, type, data) {
|
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
};
|
|
52
|
+
function getChild(parent, key) {
|
|
53
|
+
if (typeof parent.at === "function" && typeof key === "number") {
|
|
54
|
+
return parent.at(key);
|
|
55
|
+
}
|
|
56
|
+
if (typeof parent.get === "function") {
|
|
57
|
+
return parent.get(String(key));
|
|
58
|
+
}
|
|
59
|
+
return parent[key];
|
|
60
|
+
}
|
|
61
|
+
Room.prototype._editStateProperty = async function(path, value) {
|
|
62
|
+
let current = this.state;
|
|
63
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
64
|
+
if (current === null || current === void 0) return;
|
|
65
|
+
current = getChild(current, path[i]);
|
|
66
|
+
}
|
|
67
|
+
if (current === null || current === void 0) return;
|
|
68
|
+
const property = path[path.length - 1];
|
|
69
|
+
if (typeof current.set === "function") {
|
|
70
|
+
current.set(String(property), value);
|
|
71
|
+
} else {
|
|
72
|
+
current[property] = value;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
Room.prototype._deleteStateProperty = async function(path) {
|
|
76
|
+
let current = this.state;
|
|
77
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
78
|
+
if (current === null || current === void 0) return;
|
|
79
|
+
current = getChild(current, path[i]);
|
|
80
|
+
}
|
|
81
|
+
if (current === null || current === void 0) return;
|
|
82
|
+
const property = path[path.length - 1];
|
|
83
|
+
if (typeof current.delete === "function") {
|
|
84
|
+
current.delete(String(property));
|
|
85
|
+
} else {
|
|
86
|
+
current[property] = void 0;
|
|
87
|
+
}
|
|
88
|
+
};
|
package/build/ext/Room.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src-backend/ext/Room.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Monkey-patch Colyseus' default behaviour\n//\nimport { Room, type Client, type ClientPrivate } from \"@colyseus/core\";\n\nfunction getStateSize(room) {\n // TODO: `Serializer<T>` should provide a method for this (e.g. `serializer.hasState()`)\n const hasState = (\n room._serializer.encoder || // schema v3\n room._serializer.state
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAA6C;AAEtD,SAAS,aAAa,MAAM;AAExB,QAAM,WACJ,KAAK,YAAY;AAAA,EACjB,KAAK,YAAY;
|
|
4
|
+
"sourcesContent": ["//\n// Monkey-patch Colyseus' default behaviour\n//\nimport { Room, type Client, type ClientPrivate } from \"@colyseus/core\";\n\nfunction getStateSize(room) {\n // TODO: `Serializer<T>` should provide a method for this (e.g. `serializer.hasState()`)\n const hasState = (\n room._serializer.encoder || // schema v3\n room._serializer.state // schema v2\n );\n const fullState = hasState && room._serializer.getFullState();\n return fullState && (fullState.byteLength || fullState.length) || 0;\n}\n\n(Room.prototype as any).getAvailableData = function () {\n return {\n clients: this.clients.length,\n maxClients: this.maxClients,\n metadata: this.metadata,\n roomId: this.roomId,\n };\n};\n\n(Room.prototype as any).getRoomListData = async function () {\n const stateSize = getStateSize(this);\n const elapsedTime = this.clock.elapsedTime;\n const locked = this.locked;\n const data = this.getAvailableData();\n\n return { ...data, locked, elapsedTime, stateSize };\n};\n\n(Room.prototype as any).getInspectData = async function () {\n const state = this.state;\n const stateSize = getStateSize(this);\n const roomElapsedTime = this.clock.elapsedTime;\n\n const data = this.getAvailableData();\n const clients = this.clients.map((client: Client & ClientPrivate) => ({\n sessionId: client.sessionId,\n elapsedTime: roomElapsedTime - client._joinedAt\n }));\n const locked = this.locked;\n\n return { ...data, locked, clients, state, stateSize };\n};\n\n// Actions\n(Room.prototype as any)._forceClientDisconnect = async function (sessionId) {\n for (let i = 0; i < this.clients.length; i++) {\n if (this.clients[i].sessionId === sessionId) {\n this.clients[i].leave();\n break;\n }\n }\n};\n\n(Room.prototype as any)._sendMessageToClient = async function (sessionId, type, data) {\n for (let i = 0; i < this.clients.length; i++) {\n if (this.clients[i].sessionId === sessionId) {\n this.clients[i].send(type, data);\n break;\n }\n }\n};\n\nfunction getChild(parent: any, key: string | number) {\n if (typeof parent.at === 'function' && typeof key === 'number') {\n return parent.at(key);\n }\n if (typeof parent.get === 'function') {\n return parent.get(String(key));\n }\n return parent[key];\n}\n\n(Room.prototype as any)._editStateProperty = async function (path: (string | number)[], value: any) {\n let current = this.state;\n for (let i = 0; i < path.length - 1; i++) {\n if (current === null || current === undefined) return;\n current = getChild(current, path[i]);\n }\n if (current === null || current === undefined) return;\n const property = path[path.length - 1];\n if (typeof current.set === 'function') {\n current.set(String(property), value);\n } else {\n current[property] = value;\n }\n};\n\n(Room.prototype as any)._deleteStateProperty = async function (path: (string | number)[]) {\n let current = this.state;\n for (let i = 0; i < path.length - 1; i++) {\n if (current === null || current === undefined) return;\n current = getChild(current, path[i]);\n }\n if (current === null || current === undefined) return;\n const property = path[path.length - 1];\n if (typeof current.delete === 'function') {\n current.delete(String(property));\n } else {\n current[property] = undefined;\n }\n};\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAA6C;AAEtD,SAAS,aAAa,MAAM;AAExB,QAAM,WACJ,KAAK,YAAY;AAAA,EACjB,KAAK,YAAY;AAEnB,QAAM,YAAY,YAAY,KAAK,YAAY,aAAa;AAC5D,SAAO,cAAc,UAAU,cAAc,UAAU,WAAW;AACtE;AAEC,KAAK,UAAkB,mBAAmB,WAAY;AACnD,SAAO;AAAA,IACH,SAAS,KAAK,QAAQ;AAAA,IACtB,YAAY,KAAK;AAAA,IACjB,UAAU,KAAK;AAAA,IACf,QAAQ,KAAK;AAAA,EACjB;AACJ;AAEC,KAAK,UAAkB,kBAAkB,iBAAkB;AACxD,QAAM,YAAY,aAAa,IAAI;AACnC,QAAM,cAAc,KAAK,MAAM;AAC/B,QAAM,SAAS,KAAK;AACpB,QAAM,OAAO,KAAK,iBAAiB;AAEnC,SAAO,EAAE,GAAG,MAAM,QAAQ,aAAa,UAAU;AACrD;AAEC,KAAK,UAAkB,iBAAiB,iBAAkB;AACvD,QAAM,QAAQ,KAAK;AACnB,QAAM,YAAY,aAAa,IAAI;AACnC,QAAM,kBAAkB,KAAK,MAAM;AAEnC,QAAM,OAAO,KAAK,iBAAiB;AACnC,QAAM,UAAU,KAAK,QAAQ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AAY;AACnC,YAAQ,IAAI,OAAO,QAAQ,GAAG,KAAK;AAAA,EACvC,OAAO;AACH,YAAQ,QAAQ,IAAI;AAAA,EACxB;AACJ;AAEC,KAAK,UAAkB,uBAAuB,eAAgB,MAA2B;AACtF,MAAI,UAAU,KAAK;AACnB,WAAS,IAAI,GAAG,IAAI,KAAK,SAAS,GAAG,KAAK;AACtC,QAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,cAAU,SAAS,SAAS,KAAK,CAAC,CAAC;AAAA,EACvC;AACA,MAAI,YAAY,QAAQ,YAAY,OAAW;AAC/C,QAAM,WAAW,KAAK,KAAK,SAAS,CAAC;AACrC,MAAI,OAAO,QAAQ,WAAW,YAAY;AACtC,YAAQ,OAAO,OAAO,QAAQ,CAAC;AAAA,EACnC,OAAO;AACH,YAAQ,QAAQ,IAAI;AAAA,EACxB;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/index.cjs
CHANGED
|
@@ -32,16 +32,138 @@ __export(index_exports, {
|
|
|
32
32
|
monitor: () => monitor
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(index_exports);
|
|
35
|
-
var
|
|
35
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
|
-
var
|
|
37
|
+
var import_url = require("url");
|
|
38
|
+
var import_zod = require("zod");
|
|
39
|
+
var import_core = require("@colyseus/core");
|
|
40
|
+
var import_node_os_utils = require("node-os-utils");
|
|
41
|
+
var import_serve_static = require("./serve-static.cjs");
|
|
38
42
|
var import_Room = require("./ext/Room.cjs");
|
|
39
|
-
var
|
|
43
|
+
var import_meta = {};
|
|
44
|
+
var osutils = new import_node_os_utils.OSUtils();
|
|
45
|
+
var UNAVAILABLE_ROOM_ERROR = "@colyseus/monitor: room $roomId is not available anymore.";
|
|
46
|
+
var SPA_DIST = import_path.default.resolve(import_path.default.dirname((0, import_url.fileURLToPath)(import_meta.url)), "..", "build", "static");
|
|
40
47
|
function monitor(opts = {}) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const prefix = (_a = opts.prefix) != null ? _a : "/monitor";
|
|
50
|
+
const use = (_b = opts.use) != null ? _b : [];
|
|
51
|
+
const columnsOpt = opts.columns;
|
|
52
|
+
const endpoints = {
|
|
53
|
+
"monitor-api-rooms": (0, import_core.createEndpoint)(`${prefix}/api`, { method: "GET", use }, async () => {
|
|
54
|
+
var _a2, _b2;
|
|
55
|
+
try {
|
|
56
|
+
const rooms = await import_core.matchMaker.query({});
|
|
57
|
+
const columns = columnsOpt != null ? columnsOpt : ["roomId", "name", "clients", "maxClients", "locked", "elapsedTime"];
|
|
58
|
+
if (!columnsOpt && rooms[0] && rooms[0].publicAddress !== void 0) {
|
|
59
|
+
columns.push("publicAddress");
|
|
60
|
+
}
|
|
61
|
+
let connections = 0;
|
|
62
|
+
const cpuUsage = await osutils.cpu.usage();
|
|
63
|
+
const cpu = cpuUsage.success ? cpuUsage.data : NaN;
|
|
64
|
+
const memoryInfo = await osutils.memory.info();
|
|
65
|
+
const totalMemMb = memoryInfo.success ? (_a2 = memoryInfo.data.total) == null ? void 0 : _a2.toMB() : NaN;
|
|
66
|
+
const usedMemMb = memoryInfo.success ? (_b2 = memoryInfo.data.used) == null ? void 0 : _b2.toMB() : NaN;
|
|
67
|
+
return {
|
|
68
|
+
columns,
|
|
69
|
+
rooms: rooms.map((room) => {
|
|
70
|
+
const data = JSON.parse(JSON.stringify(room));
|
|
71
|
+
connections += room.clients;
|
|
72
|
+
data.locked = room.locked || false;
|
|
73
|
+
data.private = room.private;
|
|
74
|
+
data.maxClients = `${room.maxClients}`;
|
|
75
|
+
data.elapsedTime = Date.now() - new Date(room.createdAt).getTime();
|
|
76
|
+
return data;
|
|
77
|
+
}),
|
|
78
|
+
connections,
|
|
79
|
+
cpu,
|
|
80
|
+
memory: { totalMemMb, usedMemMb }
|
|
81
|
+
};
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.error(e.message);
|
|
84
|
+
return new Response(JSON.stringify({ message: e.message }), {
|
|
85
|
+
status: 500,
|
|
86
|
+
headers: { "content-type": "application/json" }
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}),
|
|
90
|
+
"monitor-api-room": (0, import_core.createEndpoint)(`${prefix}/api/room`, {
|
|
91
|
+
method: "GET",
|
|
92
|
+
query: import_zod.z.object({ roomId: import_zod.z.string() }),
|
|
93
|
+
use
|
|
94
|
+
}, async (ctx) => {
|
|
95
|
+
const roomId = ctx.query.roomId;
|
|
96
|
+
try {
|
|
97
|
+
return await import_core.matchMaker.remoteRoomCall(roomId, "getInspectData");
|
|
98
|
+
} catch (e) {
|
|
99
|
+
return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace("$roomId", roomId) }), {
|
|
100
|
+
status: 500,
|
|
101
|
+
headers: { "content-type": "application/json" }
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
"monitor-api-room-call": (0, import_core.createEndpoint)(`${prefix}/api/room/call`, {
|
|
106
|
+
method: "GET",
|
|
107
|
+
query: import_zod.z.object({ roomId: import_zod.z.string(), method: import_zod.z.string(), args: import_zod.z.string() }),
|
|
108
|
+
use
|
|
109
|
+
}, async (ctx) => {
|
|
110
|
+
const { roomId, method } = ctx.query;
|
|
111
|
+
try {
|
|
112
|
+
const args = JSON.parse(ctx.query.args);
|
|
113
|
+
const data = await import_core.matchMaker.remoteRoomCall(roomId, method, args);
|
|
114
|
+
return data != null ? data : {};
|
|
115
|
+
} catch (e) {
|
|
116
|
+
return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace("$roomId", roomId) }), {
|
|
117
|
+
status: 500,
|
|
118
|
+
headers: { "content-type": "application/json" }
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
"monitor-index": (0, import_core.createEndpoint)(`${prefix}/`, { method: "GET", use }, async () => {
|
|
123
|
+
return (0, import_serve_static.serveStatic)(SPA_DIST, "");
|
|
124
|
+
}),
|
|
125
|
+
"monitor-static": (0, import_core.createEndpoint)(`${prefix}/**:splat`, { method: "GET", use }, async (ctx) => {
|
|
126
|
+
return (0, import_serve_static.serveStatic)(SPA_DIST, ctx.params.splat);
|
|
127
|
+
})
|
|
128
|
+
};
|
|
129
|
+
const SPA_DIST_RESOLVED = import_path.default.resolve(SPA_DIST);
|
|
130
|
+
return (0, import_core.dualModeEndpoints)(endpoints, {
|
|
131
|
+
catchAllKey: "monitor-static",
|
|
132
|
+
buildMiddleware: ({ specificRouter, specificHandler, fullHandler }) => (req, res, next) => {
|
|
133
|
+
var _a2, _b2, _c;
|
|
134
|
+
if (req.method !== "GET") {
|
|
135
|
+
return next();
|
|
136
|
+
}
|
|
137
|
+
const dispatchUrl = ((_b2 = (_a2 = req.originalUrl) != null ? _a2 : req.url) != null ? _b2 : "").split("?")[0];
|
|
138
|
+
if (prefix && dispatchUrl === prefix) {
|
|
139
|
+
res.writeHead(301, { location: `${prefix}/` });
|
|
140
|
+
res.end();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const route = specificRouter.findRoute("GET", dispatchUrl);
|
|
144
|
+
if (route && ((_c = route.data) == null ? void 0 : _c.path) === dispatchUrl) {
|
|
145
|
+
return specificHandler(req, res).catch(next);
|
|
146
|
+
}
|
|
147
|
+
if (!dispatchUrl.startsWith(prefix)) {
|
|
148
|
+
return next();
|
|
149
|
+
}
|
|
150
|
+
const rel = dispatchUrl.slice(prefix.length).replace(/^\/+/, "");
|
|
151
|
+
if (!rel || rel.includes("..")) {
|
|
152
|
+
return next();
|
|
153
|
+
}
|
|
154
|
+
const filePath = import_path.default.resolve(SPA_DIST_RESOLVED, rel);
|
|
155
|
+
if (!filePath.startsWith(SPA_DIST_RESOLVED + import_path.default.sep)) {
|
|
156
|
+
return next();
|
|
157
|
+
}
|
|
158
|
+
import_promises.default.stat(filePath).then((stat) => {
|
|
159
|
+
if (stat.isFile()) {
|
|
160
|
+
fullHandler(req, res).catch(next);
|
|
161
|
+
} else {
|
|
162
|
+
next();
|
|
163
|
+
}
|
|
164
|
+
}).catch(() => next());
|
|
165
|
+
}
|
|
166
|
+
});
|
|
45
167
|
}
|
|
46
168
|
// Annotate the CommonJS export names for ESM import in node:
|
|
47
169
|
0 && (module.exports = {
|
package/build/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src-backend/index.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
6
|
-
"names": ["path", "
|
|
4
|
+
"sourcesContent": ["import fs from 'fs/promises';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { z } from 'zod';\nimport { createEndpoint, dualModeEndpoints, matchMaker, type Endpoint } from '@colyseus/core';\nimport { OSUtils } from 'node-os-utils';\n\nimport { serveStatic } from './serve-static.js';\nimport './ext/Room.js';\n\nconst osutils = new OSUtils();\nconst UNAVAILABLE_ROOM_ERROR = \"@colyseus/monitor: room $roomId is not available anymore.\";\nconst SPA_DIST = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'build', 'static');\n\nexport interface MonitorOptions {\n /** Mount prefix used when spread into `createRouter`. Ignored in express-middleware mode. Defaults to `''`. */\n prefix?: string;\n /** Better-call middleware applied to every monitor endpoint \u2014 use for auth gating. */\n use?: any[];\n /** Columns shown in the rooms grid. */\n columns?: Array<\n 'roomId' |\n 'name' |\n 'clients' |\n 'maxClients' |\n 'locked' |\n 'elapsedTime' |\n { metadata: string } |\n 'processId' |\n 'publicAddress'\n >;\n}\n\nexport function monitor(opts: MonitorOptions = {}) {\n const prefix = opts.prefix ?? '/monitor';\n const use = opts.use ?? [];\n const columnsOpt = opts.columns;\n\n const endpoints: Record<string, Endpoint> = {\n 'monitor-api-rooms': createEndpoint(`${prefix}/api`, { method: 'GET', use }, async () => {\n try {\n const rooms: any[] = await matchMaker.query({});\n const columns = columnsOpt ?? ['roomId', 'name', 'clients', 'maxClients', 'locked', 'elapsedTime'];\n\n if (!columnsOpt && rooms[0] && rooms[0].publicAddress !== undefined) {\n columns.push('publicAddress');\n }\n\n let connections = 0;\n const cpuUsage = await osutils.cpu.usage();\n const cpu = cpuUsage.success ? cpuUsage.data : NaN;\n const memoryInfo = await osutils.memory.info();\n const totalMemMb = memoryInfo.success ? memoryInfo.data.total?.toMB() : NaN;\n const usedMemMb = memoryInfo.success ? memoryInfo.data.used?.toMB() : NaN;\n\n return {\n columns,\n rooms: rooms.map((room) => {\n const data = JSON.parse(JSON.stringify(room));\n connections += room.clients;\n data.locked = room.locked || false;\n data.private = room.private;\n data.maxClients = `${room.maxClients}`;\n data.elapsedTime = Date.now() - new Date(room.createdAt).getTime();\n return data;\n }),\n connections,\n cpu,\n memory: { totalMemMb, usedMemMb },\n };\n } catch (e: any) {\n console.error(e.message);\n return new Response(JSON.stringify({ message: e.message }), {\n status: 500,\n headers: { 'content-type': 'application/json' },\n });\n }\n }),\n\n 'monitor-api-room': createEndpoint(`${prefix}/api/room`, {\n method: 'GET',\n query: z.object({ roomId: z.string() }),\n use,\n }, async (ctx) => {\n const roomId = ctx.query.roomId;\n try {\n return await matchMaker.remoteRoomCall(roomId, 'getInspectData');\n } catch {\n return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace('$roomId', roomId) }), {\n status: 500,\n headers: { 'content-type': 'application/json' },\n });\n }\n }),\n\n 'monitor-api-room-call': createEndpoint(`${prefix}/api/room/call`, {\n method: 'GET',\n query: z.object({ roomId: z.string(), method: z.string(), args: z.string() }),\n use,\n }, async (ctx) => {\n const { roomId, method } = ctx.query;\n try {\n const args = JSON.parse(ctx.query.args);\n const data = await matchMaker.remoteRoomCall(roomId, method, args);\n return data ?? {};\n } catch {\n return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace('$roomId', roomId) }), {\n status: 500,\n headers: { 'content-type': 'application/json' },\n });\n }\n }),\n\n 'monitor-index': createEndpoint(`${prefix}/`, { method: 'GET', use }, async () => {\n return serveStatic(SPA_DIST, '');\n }),\n\n 'monitor-static': createEndpoint(`${prefix}/**:splat`, { method: 'GET', use }, async (ctx) => {\n return serveStatic(SPA_DIST, (ctx.params as any).splat);\n }),\n };\n\n const SPA_DIST_RESOLVED = path.resolve(SPA_DIST);\n\n // Express compat \u2014 works with either `app.use(\"/monitor\", monitor())` or\n // `app.use(\"/\", monitor())`. Routing decisions use originalUrl (the same\n // string better-call's getRequest uses to build the dispatched Request URL),\n // so the middleware's match check and the actual dispatch always agree.\n return dualModeEndpoints(endpoints, {\n catchAllKey: 'monitor-static',\n buildMiddleware: ({ specificRouter, specificHandler, fullHandler }) => (req, res, next) => {\n if (req.method !== 'GET') { return next(); }\n\n const dispatchUrl = ((req as any).originalUrl ?? req.url ?? '').split('?')[0]!;\n\n // Bare prefix (`/monitor`) \u2192 301 to canonical `/monitor/`.\n if (prefix && dispatchUrl === prefix) {\n res.writeHead(301, { location: `${prefix}/` });\n res.end();\n return;\n }\n\n const route = specificRouter.findRoute('GET', dispatchUrl);\n if (route && route.data?.path === dispatchUrl) {\n return specificHandler(req as any, res as any).catch(next);\n }\n\n // Asset request \u2014 only delegate if the file exists on disk.\n if (!dispatchUrl.startsWith(prefix)) { return next(); }\n const rel = dispatchUrl.slice(prefix.length).replace(/^\\/+/, '');\n if (!rel || rel.includes('..')) { return next(); }\n const filePath = path.resolve(SPA_DIST_RESOLVED, rel);\n if (!filePath.startsWith(SPA_DIST_RESOLVED + path.sep)) { return next(); }\n\n fs.stat(filePath).then((stat) => {\n if (stat.isFile()) {\n fullHandler(req as any, res as any).catch(next);\n } else {\n next();\n }\n }).catch(() => next());\n },\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;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YAAI,IAAI;AACR;AAAA,MACF;AAEA,YAAM,QAAQ,eAAe,UAAU,OAAO,WAAW;AACzD,UAAI,WAAS,WAAM,SAAN,mBAAY,UAAS,aAAa;AAC7C,eAAO,gBAAgB,KAAY,GAAU,EAAE,MAAM,IAAI;AAAA,MAC3D;AAGA,UAAI,CAAC,YAAY,WAAW,MAAM,GAAG;AAAE,eAAO,KAAK;AAAA,MAAG;AACtD,YAAM,MAAM,YAAY,MAAM,OAAO,MAAM,EAAE,QAAQ,QAAQ,EAAE;AAC/D,UAAI,CAAC,OAAO,IAAI,SAAS,IAAI,GAAG;AAAE,eAAO,KAAK;AAAA,MAAG;AACjD,YAAM,WAAW,YAAAF,QAAK,QAAQ,mBAAmB,GAAG;AACpD,UAAI,CAAC,SAAS,WAAW,oBAAoB,YAAAA,QAAK,GAAG,GAAG;AAAE,eAAO,KAAK;AAAA,MAAG;AAEzE,sBAAAG,QAAG,KAAK,QAAQ,EAAE,KAAK,CAAC,SAAS;AAC/B,YAAI,KAAK,OAAO,GAAG;AACjB,sBAAY,KAAY,GAAU,EAAE,MAAM,IAAI;AAAA,QAChD,OAAO;AACL,eAAK;AAAA,QACP;AAAA,MACF,CAAC,EAAE,MAAM,MAAM,KAAK,CAAC;AAAA,IACvB;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": ["path", "_a", "_b", "fs"]
|
|
7
7
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Endpoint } from '@colyseus/core';
|
|
2
2
|
import './ext/Room.js';
|
|
3
3
|
export interface MonitorOptions {
|
|
4
|
-
|
|
4
|
+
/** Mount prefix used when spread into `createRouter`. Ignored in express-middleware mode. Defaults to `''`. */
|
|
5
|
+
prefix?: string;
|
|
6
|
+
/** Better-call middleware applied to every monitor endpoint — use for auth gating. */
|
|
7
|
+
use?: any[];
|
|
8
|
+
/** Columns shown in the rooms grid. */
|
|
9
|
+
columns?: Array<'roomId' | 'name' | 'clients' | 'maxClients' | 'locked' | 'elapsedTime' | {
|
|
5
10
|
metadata: string;
|
|
6
|
-
} | 'processId' |
|
|
11
|
+
} | 'processId' | 'publicAddress'>;
|
|
7
12
|
}
|
|
8
|
-
export declare function monitor(opts?:
|
|
13
|
+
export declare function monitor(opts?: MonitorOptions): import("@colyseus/core").ExpressMiddleware & Record<string, Endpoint>;
|
package/build/index.mjs
CHANGED
|
@@ -1,15 +1,132 @@
|
|
|
1
1
|
// src-backend/index.ts
|
|
2
|
-
import
|
|
2
|
+
import fs from "fs/promises";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
-
import {
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { createEndpoint, dualModeEndpoints, matchMaker } from "@colyseus/core";
|
|
7
|
+
import { OSUtils } from "node-os-utils";
|
|
8
|
+
import { serveStatic } from "./serve-static.mjs";
|
|
6
9
|
import "./ext/Room.mjs";
|
|
7
|
-
var
|
|
10
|
+
var osutils = new OSUtils();
|
|
11
|
+
var UNAVAILABLE_ROOM_ERROR = "@colyseus/monitor: room $roomId is not available anymore.";
|
|
12
|
+
var SPA_DIST = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "build", "static");
|
|
8
13
|
function monitor(opts = {}) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
const prefix = opts.prefix ?? "/monitor";
|
|
15
|
+
const use = opts.use ?? [];
|
|
16
|
+
const columnsOpt = opts.columns;
|
|
17
|
+
const endpoints = {
|
|
18
|
+
"monitor-api-rooms": createEndpoint(`${prefix}/api`, { method: "GET", use }, async () => {
|
|
19
|
+
try {
|
|
20
|
+
const rooms = await matchMaker.query({});
|
|
21
|
+
const columns = columnsOpt ?? ["roomId", "name", "clients", "maxClients", "locked", "elapsedTime"];
|
|
22
|
+
if (!columnsOpt && rooms[0] && rooms[0].publicAddress !== void 0) {
|
|
23
|
+
columns.push("publicAddress");
|
|
24
|
+
}
|
|
25
|
+
let connections = 0;
|
|
26
|
+
const cpuUsage = await osutils.cpu.usage();
|
|
27
|
+
const cpu = cpuUsage.success ? cpuUsage.data : NaN;
|
|
28
|
+
const memoryInfo = await osutils.memory.info();
|
|
29
|
+
const totalMemMb = memoryInfo.success ? memoryInfo.data.total?.toMB() : NaN;
|
|
30
|
+
const usedMemMb = memoryInfo.success ? memoryInfo.data.used?.toMB() : NaN;
|
|
31
|
+
return {
|
|
32
|
+
columns,
|
|
33
|
+
rooms: rooms.map((room) => {
|
|
34
|
+
const data = JSON.parse(JSON.stringify(room));
|
|
35
|
+
connections += room.clients;
|
|
36
|
+
data.locked = room.locked || false;
|
|
37
|
+
data.private = room.private;
|
|
38
|
+
data.maxClients = `${room.maxClients}`;
|
|
39
|
+
data.elapsedTime = Date.now() - new Date(room.createdAt).getTime();
|
|
40
|
+
return data;
|
|
41
|
+
}),
|
|
42
|
+
connections,
|
|
43
|
+
cpu,
|
|
44
|
+
memory: { totalMemMb, usedMemMb }
|
|
45
|
+
};
|
|
46
|
+
} catch (e) {
|
|
47
|
+
console.error(e.message);
|
|
48
|
+
return new Response(JSON.stringify({ message: e.message }), {
|
|
49
|
+
status: 500,
|
|
50
|
+
headers: { "content-type": "application/json" }
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
"monitor-api-room": createEndpoint(`${prefix}/api/room`, {
|
|
55
|
+
method: "GET",
|
|
56
|
+
query: z.object({ roomId: z.string() }),
|
|
57
|
+
use
|
|
58
|
+
}, async (ctx) => {
|
|
59
|
+
const roomId = ctx.query.roomId;
|
|
60
|
+
try {
|
|
61
|
+
return await matchMaker.remoteRoomCall(roomId, "getInspectData");
|
|
62
|
+
} catch {
|
|
63
|
+
return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace("$roomId", roomId) }), {
|
|
64
|
+
status: 500,
|
|
65
|
+
headers: { "content-type": "application/json" }
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
"monitor-api-room-call": createEndpoint(`${prefix}/api/room/call`, {
|
|
70
|
+
method: "GET",
|
|
71
|
+
query: z.object({ roomId: z.string(), method: z.string(), args: z.string() }),
|
|
72
|
+
use
|
|
73
|
+
}, async (ctx) => {
|
|
74
|
+
const { roomId, method } = ctx.query;
|
|
75
|
+
try {
|
|
76
|
+
const args = JSON.parse(ctx.query.args);
|
|
77
|
+
const data = await matchMaker.remoteRoomCall(roomId, method, args);
|
|
78
|
+
return data ?? {};
|
|
79
|
+
} catch {
|
|
80
|
+
return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace("$roomId", roomId) }), {
|
|
81
|
+
status: 500,
|
|
82
|
+
headers: { "content-type": "application/json" }
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
"monitor-index": createEndpoint(`${prefix}/`, { method: "GET", use }, async () => {
|
|
87
|
+
return serveStatic(SPA_DIST, "");
|
|
88
|
+
}),
|
|
89
|
+
"monitor-static": createEndpoint(`${prefix}/**:splat`, { method: "GET", use }, async (ctx) => {
|
|
90
|
+
return serveStatic(SPA_DIST, ctx.params.splat);
|
|
91
|
+
})
|
|
92
|
+
};
|
|
93
|
+
const SPA_DIST_RESOLVED = path.resolve(SPA_DIST);
|
|
94
|
+
return dualModeEndpoints(endpoints, {
|
|
95
|
+
catchAllKey: "monitor-static",
|
|
96
|
+
buildMiddleware: ({ specificRouter, specificHandler, fullHandler }) => (req, res, next) => {
|
|
97
|
+
if (req.method !== "GET") {
|
|
98
|
+
return next();
|
|
99
|
+
}
|
|
100
|
+
const dispatchUrl = (req.originalUrl ?? req.url ?? "").split("?")[0];
|
|
101
|
+
if (prefix && dispatchUrl === prefix) {
|
|
102
|
+
res.writeHead(301, { location: `${prefix}/` });
|
|
103
|
+
res.end();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const route = specificRouter.findRoute("GET", dispatchUrl);
|
|
107
|
+
if (route && route.data?.path === dispatchUrl) {
|
|
108
|
+
return specificHandler(req, res).catch(next);
|
|
109
|
+
}
|
|
110
|
+
if (!dispatchUrl.startsWith(prefix)) {
|
|
111
|
+
return next();
|
|
112
|
+
}
|
|
113
|
+
const rel = dispatchUrl.slice(prefix.length).replace(/^\/+/, "");
|
|
114
|
+
if (!rel || rel.includes("..")) {
|
|
115
|
+
return next();
|
|
116
|
+
}
|
|
117
|
+
const filePath = path.resolve(SPA_DIST_RESOLVED, rel);
|
|
118
|
+
if (!filePath.startsWith(SPA_DIST_RESOLVED + path.sep)) {
|
|
119
|
+
return next();
|
|
120
|
+
}
|
|
121
|
+
fs.stat(filePath).then((stat) => {
|
|
122
|
+
if (stat.isFile()) {
|
|
123
|
+
fullHandler(req, res).catch(next);
|
|
124
|
+
} else {
|
|
125
|
+
next();
|
|
126
|
+
}
|
|
127
|
+
}).catch(() => next());
|
|
128
|
+
}
|
|
129
|
+
});
|
|
13
130
|
}
|
|
14
131
|
export {
|
|
15
132
|
monitor
|
package/build/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src-backend/index.ts"],
|
|
4
|
-
"sourcesContent": ["import
|
|
5
|
-
"mappings": ";AAAA,OAAO,
|
|
4
|
+
"sourcesContent": ["import fs from 'fs/promises';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { z } from 'zod';\nimport { createEndpoint, dualModeEndpoints, matchMaker, type Endpoint } from '@colyseus/core';\nimport { OSUtils } from 'node-os-utils';\n\nimport { serveStatic } from './serve-static.js';\nimport './ext/Room.js';\n\nconst osutils = new OSUtils();\nconst UNAVAILABLE_ROOM_ERROR = \"@colyseus/monitor: room $roomId is not available anymore.\";\nconst SPA_DIST = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'build', 'static');\n\nexport interface MonitorOptions {\n /** Mount prefix used when spread into `createRouter`. Ignored in express-middleware mode. Defaults to `''`. */\n prefix?: string;\n /** Better-call middleware applied to every monitor endpoint \u2014 use for auth gating. */\n use?: any[];\n /** Columns shown in the rooms grid. */\n columns?: Array<\n 'roomId' |\n 'name' |\n 'clients' |\n 'maxClients' |\n 'locked' |\n 'elapsedTime' |\n { metadata: string } |\n 'processId' |\n 'publicAddress'\n >;\n}\n\nexport function monitor(opts: MonitorOptions = {}) {\n const prefix = opts.prefix ?? '/monitor';\n const use = opts.use ?? [];\n const columnsOpt = opts.columns;\n\n const endpoints: Record<string, Endpoint> = {\n 'monitor-api-rooms': createEndpoint(`${prefix}/api`, { method: 'GET', use }, async () => {\n try {\n const rooms: any[] = await matchMaker.query({});\n const columns = columnsOpt ?? ['roomId', 'name', 'clients', 'maxClients', 'locked', 'elapsedTime'];\n\n if (!columnsOpt && rooms[0] && rooms[0].publicAddress !== undefined) {\n columns.push('publicAddress');\n }\n\n let connections = 0;\n const cpuUsage = await osutils.cpu.usage();\n const cpu = cpuUsage.success ? cpuUsage.data : NaN;\n const memoryInfo = await osutils.memory.info();\n const totalMemMb = memoryInfo.success ? memoryInfo.data.total?.toMB() : NaN;\n const usedMemMb = memoryInfo.success ? memoryInfo.data.used?.toMB() : NaN;\n\n return {\n columns,\n rooms: rooms.map((room) => {\n const data = JSON.parse(JSON.stringify(room));\n connections += room.clients;\n data.locked = room.locked || false;\n data.private = room.private;\n data.maxClients = `${room.maxClients}`;\n data.elapsedTime = Date.now() - new Date(room.createdAt).getTime();\n return data;\n }),\n connections,\n cpu,\n memory: { totalMemMb, usedMemMb },\n };\n } catch (e: any) {\n console.error(e.message);\n return new Response(JSON.stringify({ message: e.message }), {\n status: 500,\n headers: { 'content-type': 'application/json' },\n });\n }\n }),\n\n 'monitor-api-room': createEndpoint(`${prefix}/api/room`, {\n method: 'GET',\n query: z.object({ roomId: z.string() }),\n use,\n }, async (ctx) => {\n const roomId = ctx.query.roomId;\n try {\n return await matchMaker.remoteRoomCall(roomId, 'getInspectData');\n } catch {\n return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace('$roomId', roomId) }), {\n status: 500,\n headers: { 'content-type': 'application/json' },\n });\n }\n }),\n\n 'monitor-api-room-call': createEndpoint(`${prefix}/api/room/call`, {\n method: 'GET',\n query: z.object({ roomId: z.string(), method: z.string(), args: z.string() }),\n use,\n }, async (ctx) => {\n const { roomId, method } = ctx.query;\n try {\n const args = JSON.parse(ctx.query.args);\n const data = await matchMaker.remoteRoomCall(roomId, method, args);\n return data ?? {};\n } catch {\n return new Response(JSON.stringify({ message: UNAVAILABLE_ROOM_ERROR.replace('$roomId', roomId) }), {\n status: 500,\n headers: { 'content-type': 'application/json' },\n });\n }\n }),\n\n 'monitor-index': createEndpoint(`${prefix}/`, { method: 'GET', use }, async () => {\n return serveStatic(SPA_DIST, '');\n }),\n\n 'monitor-static': createEndpoint(`${prefix}/**:splat`, { method: 'GET', use }, async (ctx) => {\n return serveStatic(SPA_DIST, (ctx.params as any).splat);\n }),\n };\n\n const SPA_DIST_RESOLVED = path.resolve(SPA_DIST);\n\n // Express compat \u2014 works with either `app.use(\"/monitor\", monitor())` or\n // `app.use(\"/\", monitor())`. Routing decisions use originalUrl (the same\n // string better-call's getRequest uses to build the dispatched Request URL),\n // so the middleware's match check and the actual dispatch always agree.\n return dualModeEndpoints(endpoints, {\n catchAllKey: 'monitor-static',\n buildMiddleware: ({ specificRouter, specificHandler, fullHandler }) => (req, res, next) => {\n if (req.method !== 'GET') { return next(); }\n\n const dispatchUrl = ((req as any).originalUrl ?? req.url ?? '').split('?')[0]!;\n\n // Bare prefix (`/monitor`) \u2192 301 to canonical `/monitor/`.\n if (prefix && dispatchUrl === prefix) {\n res.writeHead(301, { location: `${prefix}/` });\n res.end();\n return;\n }\n\n const route = specificRouter.findRoute('GET', dispatchUrl);\n if (route && route.data?.path === dispatchUrl) {\n return specificHandler(req as any, res as any).catch(next);\n }\n\n // Asset request \u2014 only delegate if the file exists on disk.\n if (!dispatchUrl.startsWith(prefix)) { return next(); }\n const rel = dispatchUrl.slice(prefix.length).replace(/^\\/+/, '');\n if (!rel || rel.includes('..')) { return next(); }\n const filePath = path.resolve(SPA_DIST_RESOLVED, rel);\n if (!filePath.startsWith(SPA_DIST_RESOLVED + path.sep)) { return next(); }\n\n fs.stat(filePath).then((stat) => {\n if (stat.isFile()) {\n fullHandler(req as any, res as any).catch(next);\n } else {\n next();\n }\n }).catch(() => next());\n },\n });\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,SAAS;AAClB,SAAS,gBAAgB,mBAAmB,kBAAiC;AAC7E,SAAS,eAAe;AAExB,SAAS,mBAAmB;AAC5B,OAAO;AAEP,IAAM,UAAU,IAAI,QAAQ;AAC5B,IAAM,yBAAyB;AAC/B,IAAM,WAAW,KAAK,QAAQ,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC,GAAG,MAAM,SAAS,QAAQ;AAqB5F,SAAS,QAAQ,OAAuB,CAAC,GAAG;AACjD,QAAM,SAAS,KAAK,UAAU;AAC9B,QAAM,MAAM,KAAK,OAAO,CAAC;AACzB,QAAM,aAAa,KAAK;AAExB,QAAM,YAAsC;AAAA,IAC1C,qBAAqB,eAAe,GAAG,MAAM,QAAQ,EAAE,QAAQ,OAAO,IAAI,GAAG,YAAY;AACvF,UAAI;AACF,cAAM,QAAe,MAAM,WAAW,MAAM,CAAC,CAAC;AAC9C,cAAM,UAAU,cAAc,CAAC,UAAU,QAAQ,WAAW,cAAc,UAAU,aAAa;AAEjG,YAAI,CAAC,cAAc,MAAM,CAAC,KAAK,MAAM,CAAC,EAAE,kBAAkB,QAAW;AACnE,kBAAQ,KAAK,eAAe;AAAA,QAC9B;AAEA,YAAI,cAAc;AAClB,cAAM,WAAW,MAAM,QAAQ,IAAI,MAAM;AACzC,cAAM,MAAM,SAAS,UAAU,SAAS,OAAO;AAC/C,cAAM,aAAa,MAAM,QAAQ,OAAO,KAAK;AAC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