fix(types,client,server): improve type safety and harden client/server message handling

This commit is contained in:
2026-05-01 11:22:06 +00:00
parent 496fd9a81a
commit 3ac4c2e708
22 changed files with 9276 additions and 3895 deletions
@@ -36,7 +36,7 @@ export class UniverseConnection {
universeCache: UniverseCache,
universeConnectionArg: UniverseConnection
): Promise<UniverseConnection> {
let connectionToReturn: UniverseConnection;
let connectionToReturn: UniverseConnection | undefined;
universeCache.connectionMap.forEach(async (existingConnection) => {
if (existingConnection.socketConnection === universeConnectionArg.socketConnection) {
connectionToReturn = await this.mergeUniverseConnections(
@@ -63,7 +63,7 @@ export class UniverseConnection {
universeRef,
authenticationRequest.name
);
if (universeChannelToAuthenticateAgainst.passphrase === authenticationRequest.passphrase) {
if (universeChannelToAuthenticateAgainst?.passphrase === authenticationRequest.passphrase) {
universeConnectionArg.authenticatedChannels.push(universeChannelToAuthenticateAgainst);
}
}
@@ -86,7 +86,7 @@ export class UniverseConnection {
public static findUniverseConnectionBySocketConnection(
universeCache: UniverseCache,
socketConnectionArg: plugins.smartsocket.SocketConnection
): UniverseConnection {
): UniverseConnection | undefined {
const universeConnection = universeCache.connectionMap.findSync((universeConnectionArg) => {
return universeConnectionArg.socketConnection === socketConnectionArg;
});