@colyseus/monitor 0.15.6 → 0.16.0-preview.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.js +9 -2
- package/build/static/build/frontend/components/RoomInspect.d.ts +22 -15
- package/build/static/build/frontend/helpers/helpers.d.ts +6 -0
- package/build/static/bundle.js +29 -21
- package/build/static/bundle.js.map +1 -1
- package/build/static/styles.css +2 -12
- package/build/static/styles.css.map +1 -1
- package/package.json +4 -4
package/build/ext/Room.js
CHANGED
|
@@ -15,7 +15,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
const core_1 = require("@colyseus/core");
|
|
16
16
|
function getStateSize(room) {
|
|
17
17
|
// TODO: `Serializer<T>` should provide a method for this (e.g. `serializer.hasState()`)
|
|
18
|
-
const hasState = (room._serializer.
|
|
18
|
+
const hasState = (room._serializer.encoder || // schema v3
|
|
19
|
+
room._serializer.state || // schema v2
|
|
20
|
+
room._serializer.previousState // legacy-fossil-delta
|
|
21
|
+
);
|
|
19
22
|
const fullState = hasState && room._serializer.getFullState();
|
|
20
23
|
return fullState && (fullState.byteLength || fullState.length) || 0;
|
|
21
24
|
}
|
|
@@ -40,8 +43,12 @@ core_1.Room.prototype.getInspectData = function () {
|
|
|
40
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
44
|
const state = this.state;
|
|
42
45
|
const stateSize = getStateSize(this);
|
|
46
|
+
const roomElapsedTime = this.clock.elapsedTime;
|
|
43
47
|
const data = this.getAvailableData();
|
|
44
|
-
const clients = this.clients.map((client) => ({
|
|
48
|
+
const clients = this.clients.map((client) => ({
|
|
49
|
+
sessionId: client.sessionId,
|
|
50
|
+
elapsedTime: client._joinedAt - roomElapsedTime
|
|
51
|
+
}));
|
|
45
52
|
const locked = this.locked;
|
|
46
53
|
return Object.assign(Object.assign({}, data), { locked, clients, state, stateSize });
|
|
47
54
|
});
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import 'react18-json-view/src/style.css';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
interface Props {
|
|
4
|
+
}
|
|
5
|
+
interface State {
|
|
6
|
+
roomId?: string;
|
|
7
|
+
state: any;
|
|
8
|
+
clients: Array<{
|
|
9
|
+
sessionId: string;
|
|
10
|
+
elapsedTime: number;
|
|
11
|
+
}>;
|
|
12
|
+
maxClients: number;
|
|
13
|
+
stateSize: number;
|
|
14
|
+
locked: boolean;
|
|
15
|
+
currentTab: string;
|
|
16
|
+
sendDialogTitle: string;
|
|
17
|
+
sendDialogOpen: boolean;
|
|
18
|
+
sendToClient?: any;
|
|
19
|
+
sendType: string;
|
|
20
|
+
sendData: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class RoomInspect extends React.Component<Props, State> {
|
|
23
|
+
state: State;
|
|
18
24
|
updateDataInterval: number;
|
|
19
25
|
componentDidMount(): void;
|
|
20
26
|
fetchRoomData(): void;
|
|
@@ -31,3 +37,4 @@ export declare class RoomInspect extends React.Component {
|
|
|
31
37
|
handleTabChange: (event: React.SyntheticEvent, newValue: string) => void;
|
|
32
38
|
render(): React.JSX.Element;
|
|
33
39
|
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MonitorOptions } from "../../";
|
|
2
|
+
export type ExtractStringNames<T> = T extends (infer U)[] ? U extends string ? U : never : never;
|
|
3
|
+
export declare const valueFormatter: {
|
|
4
|
+
[key in ExtractStringNames<MonitorOptions['columns']>]?: Function;
|
|
5
|
+
};
|
|
6
|
+
export declare function humanizeElapsedTime(milliseconds: number): string;
|