From e93524c403c43573754be69e1a86c959afeb0bf1 Mon Sep 17 00:00:00 2001 From: Justin Bosker Date: Mon, 20 Jul 2026 19:18:58 +0200 Subject: [PATCH] Complete wrapper migration to shared message types --- wrapper/src/index.ts | 33 +++++++++++++++++---------------- wrapper/src/processManager.ts | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/wrapper/src/index.ts b/wrapper/src/index.ts index 623e490..07eeaef 100644 --- a/wrapper/src/index.ts +++ b/wrapper/src/index.ts @@ -301,55 +301,56 @@ class Wrapper { - const command = + const rawCommand = JSON.parse( msg.content.toString() - ) as ServerStartCommand | ServerStopCommand | { - type: string; - [key: string]: unknown; - }; + ) as unknown; - switch(command.type){ + const commandType = (rawCommand as { type?: string }).type; + switch(commandType){ - case "test": - + case "test": { + const command = rawCommand as { + type: string; + message?: unknown; + }; console.log( "TEST COMMAND:", command.message ); - break; + } - case "server.start": - + case "server.start": { + const command = rawCommand as ServerStartCommand; this.processManager.startServer( command ); - break; + } - case "server.stop": - + case "server.stop": { + const command = rawCommand as ServerStopCommand; this.processManager.stopServer( command.serverId ); - break; + } default: @@ -357,7 +358,7 @@ class Wrapper { console.log( "Unbekannter Command:", - command + rawCommand ); diff --git a/wrapper/src/processManager.ts b/wrapper/src/processManager.ts index b5fef8d..661332f 100644 --- a/wrapper/src/processManager.ts +++ b/wrapper/src/processManager.ts @@ -1,5 +1,5 @@ import { spawn, ChildProcess } from "child_process"; - +import { ServerStartCommand } from "server-manager-shared"; interface ServerProcess {