@colyseus/monitor
Advanced tools
Comparing version 0.15.7 to 0.15.8
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -15,3 +6,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getAPI = void 0; | ||
exports.getAPI = getAPI; | ||
const core_1 = require("@colyseus/core"); | ||
@@ -23,5 +14,5 @@ const express_1 = __importDefault(require("express")); | ||
const api = express_1.default.Router(); | ||
api.get("/", (req, res) => __awaiter(this, void 0, void 0, function* () { | ||
api.get("/", async (req, res) => { | ||
try { | ||
const rooms = yield core_1.matchMaker.query({}); | ||
const rooms = await core_1.matchMaker.query({}); | ||
const columns = opts.columns || ['roomId', 'name', 'clients', 'maxClients', 'locked', 'elapsedTime']; | ||
@@ -46,4 +37,4 @@ // extend columns to expose "publicAddress", if present | ||
connections, | ||
cpu: yield node_os_utils_1.default.cpu.usage(), | ||
memory: yield node_os_utils_1.default.mem.used() | ||
cpu: await node_os_utils_1.default.cpu.usage(), | ||
memory: await node_os_utils_1.default.mem.used() | ||
}); | ||
@@ -57,7 +48,7 @@ } | ||
} | ||
})); | ||
api.get("/room", (req, res) => __awaiter(this, void 0, void 0, function* () { | ||
}); | ||
api.get("/room", async (req, res) => { | ||
const roomId = req.query.roomId; | ||
try { | ||
const inspectData = yield core_1.matchMaker.remoteRoomCall(roomId, "getInspectData"); | ||
const inspectData = await core_1.matchMaker.remoteRoomCall(roomId, "getInspectData"); | ||
res.json(inspectData); | ||
@@ -71,4 +62,4 @@ } | ||
} | ||
})); | ||
api.get("/room/call", (req, res) => __awaiter(this, void 0, void 0, function* () { | ||
}); | ||
api.get("/room/call", async (req, res) => { | ||
const roomId = req.query.roomId; | ||
@@ -78,3 +69,3 @@ const method = req.query.method; | ||
try { | ||
const data = yield core_1.matchMaker.remoteRoomCall(roomId, method, args); | ||
const data = await core_1.matchMaker.remoteRoomCall(roomId, method, args); | ||
res.json(data); | ||
@@ -88,5 +79,4 @@ } | ||
} | ||
})); | ||
}); | ||
return api; | ||
} | ||
exports.getAPI = getAPI; |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -30,41 +21,33 @@ // | ||
}; | ||
core_1.Room.prototype.getRoomListData = function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const stateSize = getStateSize(this); | ||
const elapsedTime = this.clock.elapsedTime; | ||
const locked = this.locked; | ||
const data = this.getAvailableData(); | ||
return Object.assign(Object.assign({}, data), { locked, elapsedTime, stateSize }); | ||
}); | ||
core_1.Room.prototype.getRoomListData = async function () { | ||
const stateSize = getStateSize(this); | ||
const elapsedTime = this.clock.elapsedTime; | ||
const locked = this.locked; | ||
const data = this.getAvailableData(); | ||
return { ...data, locked, elapsedTime, stateSize }; | ||
}; | ||
core_1.Room.prototype.getInspectData = function () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const state = this.state; | ||
const stateSize = getStateSize(this); | ||
const data = this.getAvailableData(); | ||
const clients = this.clients.map((client) => ({ sessionId: client.sessionId })); | ||
const locked = this.locked; | ||
return Object.assign(Object.assign({}, data), { locked, clients, state, stateSize }); | ||
}); | ||
core_1.Room.prototype.getInspectData = async function () { | ||
const state = this.state; | ||
const stateSize = getStateSize(this); | ||
const data = this.getAvailableData(); | ||
const clients = this.clients.map((client) => ({ sessionId: client.sessionId })); | ||
const locked = this.locked; | ||
return { ...data, locked, clients, state, stateSize }; | ||
}; | ||
// Actions | ||
core_1.Room.prototype._forceClientDisconnect = function (sessionId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
for (let i = 0; i < this.clients.length; i++) { | ||
if (this.clients[i].sessionId === sessionId) { | ||
this.clients[i].leave(); | ||
break; | ||
} | ||
core_1.Room.prototype._forceClientDisconnect = async function (sessionId) { | ||
for (let i = 0; i < this.clients.length; i++) { | ||
if (this.clients[i].sessionId === sessionId) { | ||
this.clients[i].leave(); | ||
break; | ||
} | ||
}); | ||
} | ||
}; | ||
core_1.Room.prototype._sendMessageToClient = function (sessionId, type, data) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
for (let i = 0; i < this.clients.length; i++) { | ||
if (this.clients[i].sessionId === sessionId) { | ||
this.clients[i].send(type, data); | ||
break; | ||
} | ||
core_1.Room.prototype._sendMessageToClient = async function (sessionId, type, data) { | ||
for (let i = 0; i < this.clients.length; i++) { | ||
if (this.clients[i].sessionId === sessionId) { | ||
this.clients[i].send(type, data); | ||
break; | ||
} | ||
}); | ||
} | ||
}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.monitor = void 0; | ||
exports.monitor = monitor; | ||
const express_1 = __importDefault(require("express")); | ||
@@ -22,2 +22,1 @@ const path_1 = __importDefault(require("path")); | ||
} | ||
exports.monitor = monitor; |
@@ -18,2 +18,3 @@ import * as React from "react"; | ||
componentWillMount(): void; | ||
componentWillUnmount(): void; | ||
fetchRoomList(): Promise<void>; | ||
@@ -20,0 +21,0 @@ handleRowSelection: (selectedRows: any) => void; |
@@ -1,5 +0,3 @@ | ||
/// <reference lib="dom" /> | ||
import http from "superagent"; | ||
export declare function fetchRoomList(): http.SuperAgentRequest; | ||
export declare function fetchRoomData(roomId: string): http.SuperAgentRequest; | ||
export declare function remoteRoomCall(roomId: string, method: string, ...args: any[]): http.SuperAgentRequest; | ||
export declare function fetchRoomList(): Promise<any>; | ||
export declare function fetchRoomData(roomId: string): Promise<any>; | ||
export declare function remoteRoomCall(roomId: string, method: string, ...args: any[]): Promise<any>; |
{ | ||
"name": "@colyseus/monitor", | ||
"version": "0.15.7", | ||
"version": "0.15.8", | ||
"description": "Web Monitoring Panel for Colyseus", | ||
@@ -45,3 +45,2 @@ "input": "./src/index.ts", | ||
"@types/react-router-dom": "^4.2.6", | ||
"@types/superagent": "^3.5.8", | ||
"colyseus": "^0.15.15", | ||
@@ -69,6 +68,5 @@ "css-loader": "^0.28.11", | ||
"express": "^4.16.2", | ||
"node-os-utils": "^1.2.0", | ||
"superagent": "^3.8.2" | ||
"node-os-utils": "^1.2.0" | ||
}, | ||
"gitHead": "320a0325f01eff3cd7afa8fb2efa80077ebdbf4a" | ||
} |
@@ -5,4 +5,4 @@ { | ||
"module": "commonjs", | ||
"lib": ["es6", "dom"], | ||
"target": "es6", | ||
"lib": ["ES2022", "DOM"], | ||
"target": "ES2022", | ||
"declaration": true, | ||
@@ -12,2 +12,3 @@ "noImplicitAny": false, | ||
"experimentalDecorators": true, | ||
"useDefineForClassFields": false, | ||
"sourceMap": false, | ||
@@ -14,0 +15,0 @@ "skipLibCheck": true, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
2
31
45
6222
2846968
- Removedsuperagent@^3.8.2
- Removedasynckit@0.4.0(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcomponent-emitter@1.3.1(transitive)
- Removedcookiejar@2.1.4(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@3.2.7(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedextend@3.0.2(transitive)
- Removedform-data@2.5.2(transitive)
- Removedformidable@1.2.6(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedsuperagent@3.8.3(transitive)
- Removedutil-deprecate@1.0.2(transitive)