mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
expose and/or modify signatures from lib package
This commit is contained in:
1 parent
b72fa25d3f
commit
e011625a2d
5 files changed
+72
-11
No files matched your search
@@ -140,7 +140,27 @@ ControllerGroup.finalize();
|
|||||||
* Controller Config class
|
* Controller Config class
|
||||||
* @extends classes.Config
|
* @extends classes.Config
|
||||||
*/
|
*/
|
||||||
export class ControllerConfig extends classes.Config { }
|
export class ControllerConfig extends classes.Config {
|
||||||
|
get(name: "controller.name"): string;
|
||||||
|
get(name: "controller.mods_directory"): string;
|
||||||
|
get(name: "controller.database_directory"): string;
|
||||||
|
get(name: "controller.http_port"): number | null;
|
||||||
|
get(name: "controller.https_port"): number | null;
|
||||||
|
get(name: "controller.bind_address"): string | null;
|
||||||
|
get(name: "controller.external_address"): string | null;
|
||||||
|
get(name: "controller.tls_certificate"): string | null;
|
||||||
|
get(name: "controller.tls_private_key"): string | null;
|
||||||
|
get(name: "controller.auth_secret"): string | null;
|
||||||
|
get(name: "controller.heartbeat_interval"): number;
|
||||||
|
get(name: "controller.session_timeout"): number;
|
||||||
|
get(name: "controller.metrics_timeout"): number;
|
||||||
|
get(name: "controller.proxy_stream_timeout"): number;
|
||||||
|
get(name: "controller.default_mod_pack_id"): number | null;
|
||||||
|
get(name: "controller.default_role_id"): number | null;
|
||||||
|
get(name: string) {
|
||||||
|
return super.get(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
ControllerConfig.registerGroup(ControllerGroup);
|
ControllerConfig.registerGroup(ControllerGroup);
|
||||||
|
|
||||||
|
|
||||||
@@ -230,7 +250,22 @@ HostGroup.finalize();
|
|||||||
* Host Config class
|
* Host Config class
|
||||||
* @extends classes.Config
|
* @extends classes.Config
|
||||||
*/
|
*/
|
||||||
export class HostConfig extends classes.Config { }
|
export class HostConfig extends classes.Config {
|
||||||
|
get(name: "host.name"): string;
|
||||||
|
get(name: "host.id"): number;
|
||||||
|
get(name: "host.factorio_directory"): string;
|
||||||
|
get(name: "host.mods_directory"): string;
|
||||||
|
get(name: "host.mods_directory_is_shared"): boolean;
|
||||||
|
get(name: "host.instances_directory"): string;
|
||||||
|
get(name: "host.controller_url"): string;
|
||||||
|
get(name: "host.controller_token"): string;
|
||||||
|
get(name: "host.tls_ca"): string | null;
|
||||||
|
get(name: "host.public_address"): string;
|
||||||
|
get(name: "host.max_reconnect_delay"): number;
|
||||||
|
get(name: string) {
|
||||||
|
return super.get(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
HostConfig.registerGroup(HostGroup);
|
HostConfig.registerGroup(HostGroup);
|
||||||
|
|
||||||
|
|
||||||
@@ -393,7 +428,31 @@ FactorioGroup.finalize();
|
|||||||
* Instance config class
|
* Instance config class
|
||||||
* @extends classes.Config
|
* @extends classes.Config
|
||||||
*/
|
*/
|
||||||
export class InstanceConfig extends classes.Config { }
|
export class InstanceConfig extends classes.Config {
|
||||||
|
get(name: "instance.name"): string;
|
||||||
|
get(name: "instance.id"): number;
|
||||||
|
get(name: "instance.assigned_host"): number | null;
|
||||||
|
get(name: "instance.auto_start"): boolean;
|
||||||
|
|
||||||
|
get(name: "factorio.version"): string;
|
||||||
|
get(name: "factorio.game_port"): number | null;
|
||||||
|
get(name: "factorio.rcon_port"): number | null;
|
||||||
|
get(name: "factorio.rcon_password"): string | null;
|
||||||
|
get(name: "factorio.player_online_autosave_slots"): number;
|
||||||
|
get(name: "factorio.mod_pack"): string | null;
|
||||||
|
get(name: "factorio.enable_save_patching"): boolean;
|
||||||
|
get(name: "factorio.enable_whitelist"): boolean;
|
||||||
|
get(name: "factorio.enable_authserver_bans"): boolean;
|
||||||
|
get(name: "factorio.settings"): Object;
|
||||||
|
get(name: "factorio.verbose_logging"): boolean;
|
||||||
|
get(name: "factorio.strip_paths"): boolean;
|
||||||
|
get(name: "factorio.sync_adminlist"): boolean;
|
||||||
|
get(name: "factorio.sync_whitelist"): boolean;
|
||||||
|
get(name: "factorio.max_concurrent_commands"): number;
|
||||||
|
get(name: string) {
|
||||||
|
return super.get(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
InstanceConfig.registerGroup(InstanceGroup);
|
InstanceConfig.registerGroup(InstanceGroup);
|
||||||
InstanceConfig.registerGroup(FactorioGroup);
|
InstanceConfig.registerGroup(FactorioGroup);
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class HostGenerateTokenRequest {
|
|||||||
static permission = "core.host.generate_token" as const;
|
static permission = "core.host.generate_token" as const;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public hostId?: number,
|
public hostId: number | null = null,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
static jsonSchema = Type.Object({
|
||||||
@@ -202,7 +202,7 @@ export class LogMessageEvent {
|
|||||||
static dst = ["controller", "control"] as const;
|
static dst = ["controller", "control"] as const;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public info: object,
|
public info: { level: string, message: string },
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
static jsonSchema = Type.Object({
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export class Address {
|
|||||||
* Shorthand to translate with.
|
* Shorthand to translate with.
|
||||||
* @returns Translated address.
|
* @returns Translated address.
|
||||||
*/
|
*/
|
||||||
static fromShorthand(shorthand: AddressShorthand) {
|
static fromShorthand(shorthand: AddressShorthand | Address) {
|
||||||
if (shorthand instanceof Address) { return shorthand; }
|
if (shorthand instanceof Address) { return shorthand; }
|
||||||
if (shorthand === "controller") { return new Address(Address.controller, 0); }
|
if (shorthand === "controller") { return new Address(Address.controller, 0); }
|
||||||
if (shorthand === "allHosts") { return new Address(Address.broadcast, Address.host); }
|
if (shorthand === "allHosts") { return new Address(Address.broadcast, Address.host); }
|
||||||
@@ -172,6 +172,8 @@ export class Message {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type MessageSrcDst = MessageRequest | MessageResponse | MessageResponseError | MessageEvent;
|
||||||
|
|
||||||
export class HelloData {
|
export class HelloData {
|
||||||
constructor(
|
constructor(
|
||||||
public version: string,
|
public version: string,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export interface Event<T> {
|
|||||||
}
|
}
|
||||||
export type EventClass<T> = Event<T>["constructor"];
|
export type EventClass<T> = Event<T>["constructor"];
|
||||||
|
|
||||||
interface RequestEntry {
|
export interface RequestEntry {
|
||||||
Request: RequestClass<unknown, unknown>;
|
Request: RequestClass<unknown, unknown>;
|
||||||
name: string,
|
name: string,
|
||||||
allowedSrcTypes: Set<number>;
|
allowedSrcTypes: Set<number>;
|
||||||
@@ -60,15 +60,15 @@ interface ForwardedRequest {
|
|||||||
dst: libData.Address;
|
dst: libData.Address;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventEntry {
|
export interface EventEntry {
|
||||||
Event: EventClass<unknown>;
|
Event: EventClass<unknown>;
|
||||||
name: string,
|
name: string,
|
||||||
allowedSrcTypes: Set<number>;
|
allowedSrcTypes: Set<number>;
|
||||||
allowedDstTypes: Set<number>;
|
allowedDstTypes: Set<number>;
|
||||||
eventFromJSON: (json: any) => Event<unknown>;
|
eventFromJSON: (json: any) => Event<unknown>;
|
||||||
}
|
}
|
||||||
type RequestHandler<Req, Res> = (request: Req, src: libData.Address, dst: libData.Address) => Promise<Res>;
|
export type RequestHandler<Req, Res> = (request: Req, src: libData.Address, dst: libData.Address) => Promise<Res>;
|
||||||
type EventHandler<T> = (event: T, src: libData.Address, dst: libData.Address) => Promise<void>;
|
export type EventHandler<T> = (event: T, src: libData.Address, dst: libData.Address) => Promise<void>;
|
||||||
|
|
||||||
interface Router {
|
interface Router {
|
||||||
forwardMessage(origin: Link, message: Message, fallback: boolean): boolean,
|
forwardMessage(origin: Link, message: Message, fallback: boolean): boolean,
|
||||||
|
|||||||
@@ -451,7 +451,7 @@ export interface QueryLogFilter {
|
|||||||
* Index to speed up query with.
|
* Index to speed up query with.
|
||||||
* @returns log entries matching the filter
|
* @returns log entries matching the filter
|
||||||
*/
|
*/
|
||||||
export async function queryLog(logDirectory: string, filter: QueryLogFilter, index: LogIndex) {
|
export async function queryLog(logDirectory: string, filter: QueryLogFilter, index: LogIndex | null) {
|
||||||
let files = (await fs.readdir(logDirectory)).filter(entry => logFileGlob.test(entry));
|
let files = (await fs.readdir(logDirectory)).filter(entry => logFileGlob.test(entry));
|
||||||
|
|
||||||
filter = {
|
filter = {
|
||||||
|
|||||||
Reference in new issue
Block a user