Rename RawInstanceInfo to HostInstanceUpdate

Due to configs needing a location to be deserialised it's not possible
to cleanly replace RawInstanceInfo with the InstanceInfo class.  Rename
it to HostInstanceUpdate to better represent its purpose.
This commit is contained in:
Hornwitser committed 2024-01-10 23:52:43 +01:00
1 parent c38a63692d
commit d8301f3c61
2 files changed
+5 -6

No files matched your search

+1 -1
View File
@@ -920,7 +920,7 @@ export default class Host extends lib.Link {
let list = [];
for (let [instanceId, instanceInfo] of this.discoveredInstanceInfos) {
let instanceConnection = this.instanceConnections.get(instanceId);
list.push(new lib.RawInstanceInfo(
list.push(new lib.HostInstanceUpdate(
instanceInfo.config.toRemote("controller"),
instanceConnection ? instanceConnection.instance.status : "stopped",
instanceConnection ? instanceConnection.instance.server.gamePort : undefined,
+4 -5
View File
@@ -712,8 +712,7 @@ export class InstanceSendRconRequest {
static Response = JsonString;
}
// TODO remove this after config refactor
export class RawInstanceInfo {
export class HostInstanceUpdate {
constructor(
public config: Static<typeof InstanceConfig.jsonSchema>,
public status: InstanceStatus,
@@ -740,17 +739,17 @@ export class InstancesUpdateRequest {
static dst = "controller" as const;
constructor(
public instances: RawInstanceInfo[],
public instances: HostInstanceUpdate[],
) { }
static jsonSchema = Type.Array(RawInstanceInfo.jsonSchema);
static jsonSchema = Type.Array(HostInstanceUpdate.jsonSchema);
toJSON() {
return this.instances;
}
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(json.map(i => RawInstanceInfo.fromJSON(i)));
return new this(json.map(i => HostInstanceUpdate.fromJSON(i)));
}
}