* Add Types

* Add Types
This commit is contained in:
Zach H 2024-06-17 00:32:36 -04:00 committed by GitHub
parent 0994d10410
commit c4bf9eb61c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
61 changed files with 207 additions and 737 deletions

View file

@ -1,66 +0,0 @@
import { Message } from 'types';
import { RoomPersistence } from '../../persistence';
import {
RoomEvent,
JoinRoomData,
LeaveRoomData,
ListGamesData,
} from './interfaces';
import { RoomEvents } from '.';
describe.skip('RoomEvents', () => {
it('.Event_JoinRoom.ext should call RoomPersistence.userJoined', () => {
jest.spyOn(RoomPersistence, 'userJoined').mockImplementation(() => {});
const data: JoinRoomData = { userInfo: {} as any };
const event: RoomEvent = { roomEvent: { roomId: 1 } };
RoomEvents['.Event_JoinRoom.ext'](data, event);
expect(RoomPersistence.userJoined).toHaveBeenCalledWith(
event.roomEvent.roomId,
data.userInfo
);
});
it('.Event_LeaveRoom.ext should call RoomPersistence.userLeft', () => {
jest.spyOn(RoomPersistence, 'userLeft').mockImplementation(() => {});
const data: LeaveRoomData = { name: '' };
const event: RoomEvent = { roomEvent: { roomId: 1 } };
RoomEvents['.Event_LeaveRoom.ext'](data, event);
expect(RoomPersistence.userLeft).toHaveBeenCalledWith(
event.roomEvent.roomId,
data.name
);
});
it('.Event_ListGames.ext should call RoomPersistence.updateGames', () => {
jest.spyOn(RoomPersistence, 'updateGames').mockImplementation(() => {});
const data: ListGamesData = { gameList: [] };
const event: RoomEvent = { roomEvent: { roomId: 1 } };
RoomEvents['.Event_ListGames.ext'](data, event);
expect(RoomPersistence.updateGames).toHaveBeenCalledWith(
event.roomEvent.roomId,
data.gameList
);
});
it('.Event_RoomSay.ext should call RoomPersistence.addMessage', () => {
jest.spyOn(RoomPersistence, 'addMessage').mockImplementation(() => {});
const data: Message = {} as any;
const event: RoomEvent = { roomEvent: { roomId: 1 } };
RoomEvents['.Event_RoomSay.ext'](data, event);
expect(RoomPersistence.addMessage).toHaveBeenCalledWith(
event.roomEvent.roomId,
data
);
});
});

View file

@ -7,9 +7,9 @@ import { roomSay } from './roomSay';
import { removeMessages } from './removeMessages';
export const RoomEvents: ProtobufEvents = {
'.Event_JoinRoom.ext': joinRoom,
'.Event_LeaveRoom.ext': leaveRoom,
'.Event_ListGames.ext': listGames,
'.Event_RemoveMessages.ext': removeMessages,
'.Event_RoomSay.ext': roomSay,
'.Event_JoinRoom.ext': joinRoom,
};

View file

@ -1,11 +1,5 @@
import { Game, User } from 'types';
export interface RoomEvent {
roomEvent: {
roomId: number;
}
}
export interface JoinRoomData {
userInfo: User;
}
@ -22,3 +16,9 @@ export interface RemoveMessagesData {
name: string;
amount: number;
}
export interface RoomEvent {
roomEvent: {
roomId: number;
}
}

View file

@ -1,8 +1,6 @@
import { RoomPersistence } from '../../persistence';
import { JoinRoomData, RoomEvent } from './interfaces';
export function joinRoom({ userInfo }: JoinRoomData, { roomEvent }: RoomEvent) {
const { roomId } = roomEvent;
export function joinRoom({ userInfo }: JoinRoomData, { roomEvent: { roomId } }: RoomEvent): void {
RoomPersistence.userJoined(roomId, userInfo);
}

View file

@ -1,7 +1,6 @@
import { RoomPersistence } from '../../persistence';
import { LeaveRoomData, RoomEvent } from './interfaces';
export function leaveRoom({ name }: LeaveRoomData, { roomEvent }: RoomEvent) {
const { roomId } = roomEvent;
export function leaveRoom({ name }: LeaveRoomData, { roomEvent: { roomId } }: RoomEvent): void {
RoomPersistence.userLeft(roomId, name);
}

View file

@ -1,7 +1,6 @@
import { RoomPersistence } from '../../persistence';
import { ListGamesData, RoomEvent } from './interfaces';
export function listGames({ gameList }: ListGamesData, { roomEvent }: RoomEvent) {
const { roomId } = roomEvent;
export function listGames({ gameList }: ListGamesData, { roomEvent: { roomId } }: RoomEvent): void {
RoomPersistence.updateGames(roomId, gameList);
}

View file

@ -1,6 +1,6 @@
import { RoomPersistence } from '../../persistence';
import { RemoveMessagesData, RoomEvent } from './interfaces';
export function removeMessages({ name, amount }: RemoveMessagesData, { roomEvent: { roomId } }: RoomEvent) {
export function removeMessages({ name, amount }: RemoveMessagesData, { roomEvent: { roomId } }: RoomEvent): void {
RoomPersistence.removeMessages(roomId, name, amount);
}

View file

@ -3,7 +3,6 @@ import { Message } from 'types';
import { RoomPersistence } from '../../persistence';
import { RoomEvent } from './interfaces';
export function roomSay(message: Message, { roomEvent }: RoomEvent) {
const { roomId } = roomEvent;
export function roomSay(message: Message, { roomEvent: { roomId } }: RoomEvent): void {
RoomPersistence.addMessage(roomId, message);
}

View file

@ -1,393 +0,0 @@
import { StatusEnum, WebSocketConnectReason } from 'types';
import { SessionCommands } from '../../commands';
import { RoomPersistence, SessionPersistence } from '../../persistence';
import webClient from '../../WebClient';
import {
AddToListData,
ConnectionClosedData,
ListRoomsData,
RemoveFromListData,
ServerIdentificationData,
ServerMessageData,
UserJoinedData,
UserLeftData,
} from './interfaces';
import { SessionEvents } from '.';
describe.skip('SessionEvents', () => {
const roomId = 1;
beforeEach(() => {
jest.spyOn(SessionCommands, 'updateStatus').mockImplementation(() => {});
});
describe('.Event_AddToList.ext', () => {
it('should call SessionPersistence.addToBuddyList if buddy listName', () => {
jest.spyOn(SessionPersistence, 'addToBuddyList').mockImplementation(() => {});
const data: AddToListData = { listName: 'buddy', userInfo: {} as any };
SessionEvents['.Event_AddToList.ext'](data);
expect(SessionPersistence.addToBuddyList).toHaveBeenCalledWith(
data.userInfo
);
});
it('should call SessionPersistence.addToIgnoreList if ignore listName', () => {
jest.spyOn(SessionPersistence, 'addToIgnoreList').mockImplementation(() => {});
const data: AddToListData = { listName: 'ignore', userInfo: {} as any };
SessionEvents['.Event_AddToList.ext'](data);
expect(SessionPersistence.addToIgnoreList).toHaveBeenCalledWith(
data.userInfo
);
});
it('should call console.log if unknown listName', () => {
jest.spyOn(console, 'log').mockImplementation(() => {});
const data: AddToListData = { listName: 'unknown', userInfo: {} as any };
SessionEvents['.Event_AddToList.ext'](data);
expect(console.log).toHaveBeenCalledWith(
`Attempted to add to unknown list: ${data.listName}`
);
});
});
describe('.Event_ConnectionClosed.ext', () => {
describe('with reasonStr', () => {
it('should call SessionCommands.updateStatus', () => {
const data: ConnectionClosedData = { endTime: 0, reason: 0, reasonStr: 'reasonStr' };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
data.reasonStr
);
});
});
describe('without reasonStr', () => {
beforeEach(() => {
webClient.protobuf.controller.Event_ConnectionClosed = { CloseReason: {} };
});
describe('USER_LIMIT_REACHED', () => {
it('should call SessionCommands.updateStatus', () => {
const USER_LIMIT_REACHED = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.USER_LIMIT_REACHED = USER_LIMIT_REACHED;
const data: ConnectionClosedData = { endTime: 0, reason: USER_LIMIT_REACHED, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'The server has reached its maximum user capacity'
);
});
});
describe('TOO_MANY_CONNECTIONS', () => {
it('should call SessionCommands.updateStatus', () => {
const TOO_MANY_CONNECTIONS = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.TOO_MANY_CONNECTIONS = TOO_MANY_CONNECTIONS;
const data: ConnectionClosedData = { endTime: 0, reason: TOO_MANY_CONNECTIONS, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'There are too many concurrent connections from your address'
);
});
});
describe('BANNED', () => {
it('should call SessionCommands.updateStatus', () => {
const BANNED = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.BANNED = BANNED;
const data: ConnectionClosedData = { endTime: 0, reason: BANNED, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'You are banned'
);
});
});
describe('DEMOTED', () => {
it('should call SessionCommands.updateStatus', () => {
const DEMOTED = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.DEMOTED = DEMOTED;
const data: ConnectionClosedData = { endTime: 0, reason: DEMOTED, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'You were demoted'
);
});
});
describe('SERVER_SHUTDOWN', () => {
it('should call SessionCommands.updateStatus', () => {
const SERVER_SHUTDOWN = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.SERVER_SHUTDOWN = SERVER_SHUTDOWN;
const data: ConnectionClosedData = { endTime: 0, reason: SERVER_SHUTDOWN, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'Scheduled server shutdown'
);
});
});
describe('USERNAMEINVALID', () => {
it('should call SessionCommands.updateStatus', () => {
const USERNAMEINVALID = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.USERNAMEINVALID = USERNAMEINVALID;
const data: ConnectionClosedData = { endTime: 0, reason: USERNAMEINVALID, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'Invalid username'
);
});
});
describe('LOGGEDINELSEWERE', () => {
it('should call SessionCommands.updateStatus', () => {
const LOGGEDINELSEWERE = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.LOGGEDINELSEWERE = LOGGEDINELSEWERE;
const data: ConnectionClosedData = { endTime: 0, reason: LOGGEDINELSEWERE, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'You have been logged out due to logging in at another location'
);
});
});
describe('OTHER', () => {
it('should call SessionCommands.updateStatus', () => {
const OTHER = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.OTHER = OTHER;
const data: ConnectionClosedData = { endTime: 0, reason: OTHER, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'Unknown reason'
);
});
});
describe('UNKNOWN', () => {
it('should call SessionCommands.updateStatus', () => {
const UNKNOWN = 1;
webClient.protobuf.controller.Event_ConnectionClosed.CloseReason.UNKNOWN = UNKNOWN;
const data: ConnectionClosedData = { endTime: 0, reason: UNKNOWN, reasonStr: null };
SessionEvents['.Event_ConnectionClosed.ext'](data);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
'Unknown reason'
);
});
});
});
});
describe('.Event_ListRooms.ext', () => {
beforeEach(() => {
webClient.clientOptions.autojoinrooms = false;
jest.spyOn(RoomPersistence, 'updateRooms').mockImplementation(() => {});
});
it('should call RoomPersistence.updateRooms', () => {
const data: ListRoomsData = { roomList: [{ roomId, autoJoin: false } as any] };
SessionEvents['.Event_ListRooms.ext'](data);
expect(RoomPersistence.updateRooms).toHaveBeenCalledWith(data.roomList);
});
it('should call SessionCommands.joinRoom if webClient and room is configured for autojoin', () => {
webClient.clientOptions.autojoinrooms = true;
jest.spyOn(SessionCommands, 'joinRoom').mockImplementation(() => {});
const data: ListRoomsData = { roomList: [{ roomId, autoJoin: true } as any, { roomId: 2, autoJoin: false } as any] };
SessionEvents['.Event_ListRooms.ext'](data);
expect(SessionCommands.joinRoom).toHaveBeenCalledTimes(1);
expect(SessionCommands.joinRoom).toHaveBeenCalledWith(data.roomList[0].roomId);
});
});
describe('.Event_RemoveFromList.ext', () => {
it('should call SessionPersistence.removeFromBuddyList if buddy listName', () => {
jest.spyOn(SessionPersistence, 'removeFromBuddyList').mockImplementation(() => {});
const data: RemoveFromListData = { listName: 'buddy', userName: '' };
SessionEvents['.Event_RemoveFromList.ext'](data);
expect(SessionPersistence.removeFromBuddyList).toHaveBeenCalledWith(
data.userName
);
});
it('should call SessionPersistence.removeFromIgnoreList if ignore listName', () => {
jest.spyOn(SessionPersistence, 'removeFromIgnoreList').mockImplementation(() => {});
const data: RemoveFromListData = { listName: 'ignore', userName: '' };
SessionEvents['.Event_RemoveFromList.ext'](data);
expect(SessionPersistence.removeFromIgnoreList).toHaveBeenCalledWith(
data.userName
);
});
it('should call console.log if unknown listName', () => {
jest.spyOn(console, 'log').mockImplementation(() => {});
const data: RemoveFromListData = { listName: 'unknown', userName: '' };
SessionEvents['.Event_RemoveFromList.ext'](data);
expect(console.log).toHaveBeenCalledWith(
`Attempted to remove from unknown list: ${data.listName}`
);
});
});
describe('.Event_ServerIdentification.ext', () => {
let data: ServerIdentificationData;
let event;
beforeEach(() => {
webClient.protocolVersion = 0;
event = SessionEvents['.Event_ServerIdentification.ext'];
data = {
serverName: 'serverName',
serverVersion: 'serverVersion',
protocolVersion: 0,
serverOptions: 0
};
jest.spyOn(SessionPersistence, 'updateInfo').mockImplementation(() => {});
webClient.protobuf.controller.Event_ServerIdentification = { ServerOptions: { SupportsPasswordHash: 1 } };
webClient.options = {};
});
it('update status/info and login', () => {
jest.spyOn(SessionCommands, 'login').mockImplementation(() => {});
webClient.options.reason = WebSocketConnectReason.LOGIN;
event(data);
expect(SessionPersistence.updateInfo).toHaveBeenCalledWith(data.serverName, data.serverVersion);
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(StatusEnum.LOGGING_IN, expect.any(String));
expect(SessionCommands.login).toHaveBeenCalled();
});
it('should update stat/info and register', () => {
jest.spyOn(SessionCommands, 'register').mockImplementation(() => {});
webClient.options.reason = WebSocketConnectReason.REGISTER;
event(data);
expect(SessionPersistence.updateInfo).toHaveBeenCalledWith(data.serverName, data.serverVersion);
expect(SessionCommands.register).toHaveBeenCalled();
});
it('should update stat/info and activate account', () => {
jest.spyOn(SessionCommands, 'activate').mockImplementation(() => {});
webClient.options.reason = WebSocketConnectReason.ACTIVATE_ACCOUNT;
event(data);
expect(SessionPersistence.updateInfo).toHaveBeenCalledWith(data.serverName, data.serverVersion);
expect(SessionCommands.activate).toHaveBeenCalled();
});
it('should disconnect if protocolVersion mismatched', () => {
jest.spyOn(SessionCommands, 'login').mockImplementation(() => {});
jest.spyOn(SessionCommands, 'disconnect').mockImplementation(() => {});
webClient.protocolVersion = 0;
const data: ServerIdentificationData = {
serverName: '',
serverVersion: '',
protocolVersion: 1,
serverOptions: 0
};
event(data);
expect(SessionCommands.disconnect).toHaveBeenCalled();
expect(SessionCommands.updateStatus).toHaveBeenCalledWith(
StatusEnum.DISCONNECTED,
`Protocol version mismatch: ${data.protocolVersion}`
);
expect(SessionCommands.login).not.toHaveBeenCalled();
});
});
describe('.Event_ServerMessage.ext', () => {
it('should call SessionPersistence.serverMessage', () => {
jest.spyOn(SessionPersistence, 'serverMessage').mockImplementation(() => {});
const data: ServerMessageData = { message: 'message' };
SessionEvents['.Event_ServerMessage.ext'](data);
expect(SessionPersistence.serverMessage).toHaveBeenCalledWith(
data.message
);
});
});
describe('.Event_UserJoined.ext', () => {
it('should call SessionPersistence.userJoined', () => {
jest.spyOn(SessionPersistence, 'userJoined').mockImplementation(() => {});
const data: UserJoinedData = { userInfo: {} as any };
SessionEvents['.Event_UserJoined.ext'](data);
expect(SessionPersistence.userJoined).toHaveBeenCalledWith(
data.userInfo
);
});
});
describe('.Event_UserLeft.ext', () => {
it('should call SessionPersistence.userLeft', () => {
jest.spyOn(SessionPersistence, 'userLeft').mockImplementation(() => {});
const data: UserLeftData = { name: '' };
SessionEvents['.Event_UserLeft.ext'](data);
expect(SessionPersistence.userLeft).toHaveBeenCalledWith(
data.name
);
});
});
});

View file

@ -1,7 +1,7 @@
import { SessionPersistence } from '../../persistence';
import { AddToListData } from './interfaces';
export function addToList({ listName, userInfo }: AddToListData) {
export function addToList({ listName, userInfo }: AddToListData): void {
switch (listName) {
case 'buddy': {
SessionPersistence.addToBuddyList(userInfo);

View file

@ -3,8 +3,8 @@ import webClient from '../../WebClient';
import { updateStatus } from '../../commands/session';
import { ConnectionClosedData } from './interfaces';
export function connectionClosed({ reason, reasonStr }: ConnectionClosedData) {
let message;
export function connectionClosed({ reason, reasonStr }: ConnectionClosedData): void {
let message: string;
// @TODO (5)
if (reasonStr) {

View file

@ -1,6 +1,6 @@
import { SessionPersistence } from '../../persistence';
import { GameJoinedData } from './interfaces';
export function gameJoined(gameJoined: GameJoinedData) {
export function gameJoined(gameJoined: GameJoinedData): void {
SessionPersistence.gameJoined(gameJoined);
}

View file

@ -1,8 +1,4 @@
import { Game, Room, User } from 'types';
export interface SessionEvent {
sessionEvent: {}
}
import { Game, NotificationType, Room, User } from 'types';
export interface AddToListData {
listName: string;
@ -15,10 +11,37 @@ export interface ConnectionClosedData {
reasonStr: string;
}
export interface GameJoinedData {
gameInfo: Game;
playerId: number;
spectator: boolean;
resuming: boolean;
judge: boolean;
}
export interface ListRoomsData {
roomList: Room[];
}
export interface NotifyUserData {
type: NotificationType;
warningReason: string;
customTitle: string;
customContent: string;
}
export interface PlayerGamePropertiesData {
playerId: number;
userInfo: User;
spectator: boolean;
conceded: boolean;
readyStart: boolean;
deckHash: string;
pingSeconds: number;
sideboardLocked: boolean;
judge: boolean;
}
export interface RemoveFromListData {
listName: string;
userName: string;
@ -35,6 +58,11 @@ export interface ServerMessageData {
message: string;
}
export interface ServerShutdownData {
reason: string;
minutes: number;
}
export interface UserJoinedData {
userInfo: User;
}
@ -43,10 +71,8 @@ export interface UserLeftData {
name: string;
}
export interface GameJoinedData {
gameInfo: Game;
playerId: number;
spectator: boolean;
resuming: boolean;
judge: boolean;
export interface UserMessageData {
senderName: string;
receiverName: string;
message: string;
}

View file

@ -3,7 +3,7 @@ import { joinRoom } from '../../commands/session';
import { RoomPersistence } from '../../persistence';
import { ListRoomsData } from './interfaces';
export function listRooms({ roomList }: ListRoomsData) {
export function listRooms({ roomList }: ListRoomsData): void {
RoomPersistence.updateRooms(roomList);
if (webClient.clientOptions.autojoinrooms) {

View file

@ -1,3 +1,7 @@
export function notifyUser(payload) {
console.info('Event_NotifyUser', payload);
import { SessionPersistence } from '../../persistence';
import { NotifyUserData } from './interfaces';
export function notifyUser(payload: NotifyUserData): void {
SessionPersistence.notifyUser(payload);
}

View file

@ -1,3 +1,6 @@
export function playerPropertiesChanges(payload) {
console.info('Event_PlayerPropertiesChanges', payload);
import { PlayerGamePropertiesData } from './interfaces';
import { SessionPersistence } from '../../persistence';
export function playerPropertiesChanges(payload: PlayerGamePropertiesData): void {
SessionPersistence.playerPropertiesChanged(payload);
}

View file

@ -1,7 +1,7 @@
import { SessionPersistence } from '../../persistence';
import { RemoveFromListData } from './interfaces';
export function removeFromList({ listName, userName }: RemoveFromListData) {
export function removeFromList({ listName, userName }: RemoveFromListData): void {
switch (listName) {
case 'buddy': {
SessionPersistence.removeFromBuddyList(userName);

View file

@ -16,7 +16,7 @@ import { generateSalt, passwordSaltSupported } from '../../utils';
import { ServerIdentificationData } from './interfaces';
import { SessionPersistence } from '../../persistence';
export function serverIdentification(info: ServerIdentificationData) {
export function serverIdentification(info: ServerIdentificationData): void {
const { serverName, serverVersion, protocolVersion, serverOptions } = info;
if (protocolVersion !== webClient.protocolVersion) {
updateStatus(StatusEnum.DISCONNECTED, `Protocol version mismatch: ${protocolVersion}`);

View file

@ -1,6 +1,6 @@
import { SessionPersistence } from '../../persistence';
import { ServerMessageData } from './interfaces';
export function serverMessage({ message }: ServerMessageData) {
export function serverMessage({ message }: ServerMessageData): void {
SessionPersistence.serverMessage(message);
}

View file

@ -1,3 +1,7 @@
export function serverShutdown(payload) {
console.info('Event_ServerShutdown', payload);
import { SessionPersistence } from '../../persistence';
import { ServerShutdownData } from './interfaces';
export function serverShutdown(payload: ServerShutdownData): void {
SessionPersistence.serverShutdown(payload);
}

View file

@ -1,6 +1,6 @@
import { SessionPersistence } from '../../persistence';
import { UserJoinedData } from './interfaces';
export function userJoined({ userInfo }: UserJoinedData) {
export function userJoined({ userInfo }: UserJoinedData): void {
SessionPersistence.userJoined(userInfo);
}

View file

@ -1,6 +1,6 @@
import { SessionPersistence } from '../../persistence';
import { UserLeftData } from './interfaces';
export function userLeft({ name }: UserLeftData) {
export function userLeft({ name }: UserLeftData): void {
SessionPersistence.userLeft(name);
}

View file

@ -1,3 +1,8 @@
export function userMessage(payload) {
console.info('Event_UserMessage', payload);
import { SessionPersistence } from '../../persistence';
import { UserMessageData } from './interfaces';
export function userMessage(payload: UserMessageData): void {
SessionPersistence.userMessage(payload);
}