Move base plugins to their respective packages

Move BaseControllerPlugin to controller/src/BaseControllerPlugin.ts
Move BaseInstancePlugin to host/src/BaseInstancePlugin.ts
Move BaseControlPlugin to ctl/src/BaseCtlPlugin.ts
Move BaseWebPlugin to web_ui/src/BaseWebPlugin.ts

This solves the circular package dependency problem of the base plugins
needing types that are available only in the dependencies to lib.
This commit is contained in:
Hornwitser committed 2023-11-25 18:41:43 +01:00
1 parent 63dc370ea0
commit 808eda0513
51 files changed
+1073 -1060

No files matched your search

+31 -1
View File
@@ -3,7 +3,6 @@ import { TSchema, Type, Static } from "@sinclair/typebox";
// eslint-disable-next-line node/no-missing-import
import messageValidate from "./message_validate"; // generated file
import { StringEnum } from "./composites";
import { AccountRole } from "../plugin";
export type AddressType = "controller" | "host" | "instance" | "control" | "broadcast";
export type AddressShorthand =
@@ -287,6 +286,12 @@ export class MessageRegisterControl extends Message {
}
};
export type AccountRole = {
name: string;
id: number;
permissions: string[];
};
export class AccountDetails {
constructor(
public name: string,
@@ -632,3 +637,28 @@ export class PingRequest {
static dst = ["controller", "host", "control"] as const;
static permission = null;
}
export class AccountUpdateEvent {
declare ["constructor"]: typeof AccountUpdateEvent;
static type = "event" as const;
static src = "controller" as const;
static dst = "control" as const;
constructor(
public roles?: AccountRole[],
) { }
static jsonSchema = Type.Object({
roles: Type.Array(
Type.Object({
name: Type.String(),
id: Type.Integer(),
permissions: Type.Array(Type.String()),
}),
),
});
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(json.roles);
}
}
-27
View File
@@ -1,7 +1,6 @@
import { Type, Static } from "@sinclair/typebox";
import PlayerStats from "../PlayerStats";
import { JsonNumber, jsonArray } from "./composites";
import { AccountRole } from "../plugin";
export class RawPermission { // TODO refactor into lib/user.Permission
constructor(
@@ -407,32 +406,6 @@ export class UserDeleteRequest {
}
}
export class AccountUpdateEvent {
declare ["constructor"]: typeof AccountUpdateEvent;
static type = "event" as const;
static src = "controller" as const;
static dst = "control" as const;
constructor(
public roles?: AccountRole[],
) { }
static jsonSchema = Type.Object({
roles: Type.Array(
Type.Object({
name: Type.String(),
id: Type.Integer(),
permissions: Type.Array(Type.String()),
}),
),
});
static fromJSON(json: Static<typeof this.jsonSchema>) {
return new this(json.roles);
}
}
export class UserUpdateEvent {
declare ["constructor"]: typeof UserUpdateEvent;
static type = "event" as const;