mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-19 15:33:12 +09:00
Flatten lib namespace
Move all functions and classes currently available through lib/name and libName to be under a single flat namespace in lib. This make reorganising the lib namespace much simpler as the location of symbols can move without breaking the consumers of lib. The multi-entrypoint design was already problematic for the web plugin system which couldn't effectively use it due to how webpack's shared module system is awkward to set up with multiple entrypoints per package.
This commit is contained in:
1 parent
bb58670597
commit
bfe119eaa3
143 files changed
+1798
-1918
No files matched your search
@@ -15,7 +15,7 @@
|
||||
* `base` if more time than the value for `reset` has passed between two
|
||||
* invocations of delay.
|
||||
*
|
||||
* @alias module:lib/ExponentialBackoff
|
||||
* @alias module:lib.ExponentialBackoff
|
||||
*/
|
||||
class ExponentialBackoff {
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* Stastics collected about a player.
|
||||
* @alias module:lib/PlayerStats
|
||||
* @alias module:lib.PlayerStats
|
||||
*/
|
||||
class PlayerStats {
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* // and one more time 1 second later for 99 other activations that were
|
||||
* // exceeding the rate limit.
|
||||
* }
|
||||
* @alias module:lib/RateLimiter
|
||||
* @alias module:lib.RateLimiter
|
||||
*/
|
||||
class RateLimiter {
|
||||
/**
|
||||
|
||||
+12
-10
@@ -1,13 +1,15 @@
|
||||
export { default as libConfig } from "./config";
|
||||
export { default as libData } from "./data";
|
||||
export { default as libErrors } from "./errors";
|
||||
export { default as libFactorio } from "./factorio/exchange_string";
|
||||
export { default as libHelpers } from "./helpers";
|
||||
export { default as libLink } from "./link";
|
||||
export { default as libLogging } from "./logging";
|
||||
export { default as libPlugin } from "./plugin";
|
||||
export { default as libSchema } from "./schema";
|
||||
export { default as libUsers } from "./users";
|
||||
export * from "./config";
|
||||
export * from "./data";
|
||||
export * from "./errors";
|
||||
export * from "./factorio/exchange_string";
|
||||
export * from "./helpers";
|
||||
export * from "./ini";
|
||||
export * from "./link";
|
||||
export * from "./logging";
|
||||
export * from "./plugin";
|
||||
export * from "./schema";
|
||||
export * from "./users";
|
||||
|
||||
export { default as ExponentialBackoff } from "./ExponentialBackoff";
|
||||
export { default as PlayerStats } from "./PlayerStats";
|
||||
export { default as RateLimiter } from "./RateLimiter";
|
||||
@@ -52,10 +52,10 @@ class Command {
|
||||
/**
|
||||
* A node in the command tree that can hold commands and sub trees
|
||||
*
|
||||
* Container which can contain {@link module:lib/command.Command}s and other
|
||||
* Container which can contain {@link module:lib.Command}s and other
|
||||
* CommandTrees. This is used by clusterioctl to hold the full tree of
|
||||
* available commands, you may extend this tree by using a control plugin,
|
||||
* see {@link module:lib/plugin.BaseControlPlugin#addCommands}
|
||||
* see {@link module:lib.BaseControlPlugin#addCommands}
|
||||
*
|
||||
* @static
|
||||
*/
|
||||
@@ -83,7 +83,7 @@ class CommandTree {
|
||||
/**
|
||||
* Add a command or command tree to this tree
|
||||
*
|
||||
* @param {module:lib/command.Command|module:lib/command.CommandTree} command -
|
||||
* @param {module:lib.Command|module:lib.CommandTree} command -
|
||||
* The command to add to this command tree.
|
||||
*/
|
||||
add(command) {
|
||||
@@ -104,7 +104,7 @@ class CommandTree {
|
||||
*
|
||||
* @param {string} name -
|
||||
* The name of the command or command tree to retrieve.
|
||||
* @return {?module:lib/command.Command|module:lib/command.CommandTree}
|
||||
* @return {?module:lib.Command|module:lib.CommandTree}
|
||||
* The command to add to this command tree.
|
||||
*/
|
||||
get(name) {
|
||||
@@ -141,7 +141,7 @@ class CommandTree {
|
||||
* Resolves a string with either an host name or an id into an integer with
|
||||
* the host ID.
|
||||
*
|
||||
* @param {module:lib/link.Link} client - link to controller to query host on.
|
||||
* @param {module:lib.Link} client - link to controller to query host on.
|
||||
* @param {string} hostName - string with name or id of host.
|
||||
* @returns {Promise<number>} host ID.
|
||||
* @static
|
||||
@@ -173,7 +173,7 @@ async function resolveHost(client, hostName) {
|
||||
* Resolves a string with either an instance name or an id into an integer
|
||||
* with the instance ID.
|
||||
*
|
||||
* @param {module:lib/link.Link} client - link to controller to query instance on.
|
||||
* @param {module:lib.Link} client - link to controller to query instance on.
|
||||
* @param {string} instanceName - string with name or id of instance.
|
||||
* @returns {Promise<number>} instance ID.
|
||||
* @static
|
||||
@@ -205,7 +205,7 @@ async function resolveInstance(client, instanceName) {
|
||||
* Resolevs a string with either a mod pack name or an id into an integer
|
||||
* with the mod pack ID.
|
||||
*
|
||||
* @param {module:lib/link.Link} client -
|
||||
* @param {module:lib.Link} client -
|
||||
* link to controller to query mod pack on.
|
||||
* @param {string} modPackName - string with name or id of mod pack.
|
||||
* @returns {Promise<number>} mod pack ID.
|
||||
@@ -238,7 +238,7 @@ async function resolveModPack(client, modPackName) {
|
||||
* Resolves a string with either a role name or an id into an object
|
||||
* representing the role.
|
||||
*
|
||||
* @param {module:lib/link.Link} client - link to controller to query role on.
|
||||
* @param {module:lib.Link} client - link to controller to query role on.
|
||||
* @param {string} roleName - string with name or id of role.
|
||||
* @returns {Promise<object>} Role info.
|
||||
* @static
|
||||
|
||||
@@ -14,7 +14,7 @@ const { basicType } = require("../helpers");
|
||||
* does not permitt this access is done.
|
||||
*
|
||||
* @extends Error
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class InvalidAccess extends Error { };
|
||||
|
||||
@@ -25,7 +25,7 @@ class InvalidAccess extends Error { };
|
||||
* field.
|
||||
*
|
||||
* @extends Error
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class InvalidValue extends Error { };
|
||||
|
||||
@@ -36,7 +36,7 @@ class InvalidValue extends Error { };
|
||||
* attempted to be accessed.
|
||||
*
|
||||
* @extends Error
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class InvalidField extends Error { };
|
||||
|
||||
@@ -51,7 +51,7 @@ class InvalidField extends Error { };
|
||||
* @param {string} separator - Separator to split string by.
|
||||
* @param {string} string - String to split
|
||||
* @returns {Array} string split on separator.
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ function splitOn(separator, string) {
|
||||
*
|
||||
* @extends events.EventEmitter
|
||||
*
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class Config extends events.EventEmitter {
|
||||
/**
|
||||
@@ -236,7 +236,7 @@ class Config extends events.EventEmitter {
|
||||
* Get the config group instance with the given name
|
||||
*
|
||||
* @param {string} name - Name of group to get.
|
||||
* @returns {module:lib/config.ConfigGroup} config group.
|
||||
* @returns {module:lib.ConfigGroup} config group.
|
||||
*/
|
||||
group(name) {
|
||||
if (!this._initialized) {
|
||||
@@ -287,7 +287,7 @@ class Config extends events.EventEmitter {
|
||||
* Adds the ConfigGroup to this config as a group that will get
|
||||
* initialized, loaded and serialized with this config class.
|
||||
*
|
||||
* @param {module:lib/config.ConfigGroup} group - class to register.
|
||||
* @param {module:lib.ConfigGroup} group - class to register.
|
||||
*/
|
||||
static registerGroup(group) {
|
||||
this._initSubclass();
|
||||
@@ -317,7 +317,7 @@ class Config extends events.EventEmitter {
|
||||
* loading a config with invalid values will result in those being replaced
|
||||
* by the innitial value for those fields.
|
||||
*
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class ConfigGroup {
|
||||
/**
|
||||
@@ -326,7 +326,7 @@ class ConfigGroup {
|
||||
* After the creation of the new config group you have to call
|
||||
* either .init() or .load() on it in order to fully initialize it.
|
||||
*
|
||||
* @param {module:lib/config.Config} config -
|
||||
* @param {module:lib.Config} config -
|
||||
* Parent config for this group instance.
|
||||
*/
|
||||
constructor(config) {
|
||||
@@ -345,7 +345,7 @@ class ConfigGroup {
|
||||
* @param {object} def - definition for for the field to check.
|
||||
* @param {string} remote - location of remote access to check for.
|
||||
* @param {boolean} error - throw on failure to pass check.
|
||||
* @throws {module:lib/config.InvalidAccess}
|
||||
* @throws {module:lib.InvalidAccess}
|
||||
* if access is not granted and error is true.
|
||||
* @returns {boolean} true if access is granted
|
||||
* @private
|
||||
@@ -456,8 +456,8 @@ class ConfigGroup {
|
||||
* @param {string} name - Name of field to set.
|
||||
* @param {*} value - Value to set for field.
|
||||
* @param {string=} location - Location used for access control.
|
||||
* @throws {module:lib/config.InvalidField} if field is not defined.
|
||||
* @throws {module:lib/config.InvalidValue} if value is not allowed for the field.
|
||||
* @throws {module:lib.InvalidField} if field is not defined.
|
||||
* @throws {module:lib.InvalidValue} if value is not allowed for the field.
|
||||
*/
|
||||
set(name, value, location = this.config.location) {
|
||||
let def = this.constructor._definitions.get(name);
|
||||
@@ -524,8 +524,8 @@ class ConfigGroup {
|
||||
* @param {string} prop - Name of property to set on field.
|
||||
* @param {*} value - the value to set the property to.
|
||||
* @param {string=} location - Location used for access control.
|
||||
* @throws {module:lib/config.InvalidField} if field is not defined.
|
||||
* @throws {module:lib/config.InvalidValue} if field is not an object.
|
||||
* @throws {module:lib.InvalidField} if field is not defined.
|
||||
* @throws {module:lib.InvalidValue} if field is not an object.
|
||||
*/
|
||||
setProp(name, prop, value, location = this.config.location) {
|
||||
let def = this.constructor._definitions.get(name);
|
||||
@@ -829,8 +829,8 @@ class ConfigGroup {
|
||||
* plugins. This is currently only the enabled field. It is otherwise
|
||||
* identical to the ConfigGroup class.
|
||||
*
|
||||
* @extends module:lib/config.ConfigGroup
|
||||
* @memberof module:lib/config
|
||||
* @extends module:lib.ConfigGroup
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class PluginConfigGroup extends ConfigGroup {
|
||||
static _initSubclass() {
|
||||
|
||||
@@ -5,9 +5,9 @@ const classes = require("./classes");
|
||||
|
||||
|
||||
/**
|
||||
* Controller config group for {@link module:lib/config.ControllerConfig}
|
||||
* @extends module:lib/config.ConfigGroup
|
||||
* @memberof module:lib/config
|
||||
* Controller config group for {@link module:lib.ControllerConfig}
|
||||
* @extends module:lib.ConfigGroup
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class ControllerGroup extends classes.ConfigGroup { }
|
||||
ControllerGroup.defaultAccess = ["controller", "host", "control"];
|
||||
@@ -140,17 +140,17 @@ ControllerGroup.finalize();
|
||||
|
||||
/**
|
||||
* Controller Config class
|
||||
* @extends module:lib/config.Config
|
||||
* @memberof module:lib/config
|
||||
* @extends module:lib.Config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class ControllerConfig extends classes.Config { }
|
||||
ControllerConfig.registerGroup(ControllerGroup);
|
||||
|
||||
|
||||
/**
|
||||
* Host config group for {@link module:lib/config.HostConfig}
|
||||
* @extends module:lib/config.ConfigGroup
|
||||
* @memberof module:lib/config
|
||||
* Host config group for {@link module:lib.HostConfig}
|
||||
* @extends module:lib.ConfigGroup
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class HostGroup extends classes.ConfigGroup {}
|
||||
HostGroup.defaultAccess = ["controller", "host", "control"];
|
||||
@@ -232,17 +232,17 @@ HostGroup.finalize();
|
||||
|
||||
/**
|
||||
* Host Config class
|
||||
* @extends module:lib/config.Config
|
||||
* @memberof module:lib/config
|
||||
* @extends module:lib.Config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class HostConfig extends classes.Config { }
|
||||
HostConfig.registerGroup(HostGroup);
|
||||
|
||||
|
||||
/**
|
||||
* Instance config group for {@link module:lib/config.InstanceConfig}
|
||||
* @extends module:lib/config.ConfigGroup
|
||||
* @memberof module:lib/config
|
||||
* Instance config group for {@link module:lib.InstanceConfig}
|
||||
* @extends module:lib.ConfigGroup
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class InstanceGroup extends classes.ConfigGroup { }
|
||||
InstanceGroup.defaultAccess = ["controller", "host", "control"];
|
||||
@@ -272,9 +272,9 @@ InstanceGroup.define({
|
||||
InstanceGroup.finalize();
|
||||
|
||||
/**
|
||||
* Factorio config group for {@link module:lib/config.InstanceConfig}
|
||||
* @extends module:lib/config.ConfigGroup
|
||||
* @memberof module:lib/config
|
||||
* Factorio config group for {@link module:lib.InstanceConfig}
|
||||
* @extends module:lib.ConfigGroup
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class FactorioGroup extends classes.ConfigGroup { }
|
||||
FactorioGroup.defaultAccess = ["controller", "host", "control"];
|
||||
@@ -398,8 +398,8 @@ FactorioGroup.finalize();
|
||||
|
||||
/**
|
||||
* Instance config class
|
||||
* @extends module:lib/config.Config
|
||||
* @memberof module:lib/config
|
||||
* @extends module:lib.Config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class InstanceConfig extends classes.Config { }
|
||||
InstanceConfig.registerGroup(InstanceGroup);
|
||||
@@ -407,9 +407,9 @@ InstanceConfig.registerGroup(FactorioGroup);
|
||||
|
||||
|
||||
/**
|
||||
* Control config group for {@link module:lib/config.ControlConfig}
|
||||
* @extends module:lib/config.ConfigGroup
|
||||
* @memberof module:lib/config
|
||||
* Control config group for {@link module:lib.ControlConfig}
|
||||
* @extends module:lib.ConfigGroup
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class ControlGroup extends classes.ConfigGroup {}
|
||||
ControlGroup.defaultAccess = ["control"];
|
||||
@@ -443,8 +443,8 @@ ControlGroup.finalize();
|
||||
|
||||
/**
|
||||
* Control config class
|
||||
* @extends module:lib/config.Config
|
||||
* @memberof module:lib/config
|
||||
* @extends module:lib.Config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class ControlConfig extends classes.Config { }
|
||||
ControlConfig.registerGroup(ControlGroup);
|
||||
@@ -468,7 +468,7 @@ function validateGroup(pluginInfo, groupName) {
|
||||
* Registers the config groups for the provided plugin infos
|
||||
*
|
||||
* @param {Array<Object>} pluginInfos - Array of plugin info objects.
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
function registerPluginConfigGroups(pluginInfos) {
|
||||
for (let pluginInfo of pluginInfos) {
|
||||
@@ -503,7 +503,7 @@ function registerPluginConfigGroups(pluginInfos) {
|
||||
/**
|
||||
* Lock configs from adding more groups and make them usable
|
||||
*
|
||||
* @memberof module:lib/config
|
||||
* @memberof module:lib
|
||||
*/
|
||||
function finalizeConfigs() {
|
||||
ControllerConfig.finalize();
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Tracks files stored on disk for data that extracted from Factorio using a
|
||||
* given mod pack.
|
||||
* @alias module:lib/data.ExportManifest
|
||||
* @alias module:lib.ExportManifest
|
||||
*/
|
||||
class ExportManifest {
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const { integerModVersion, integerFactorioVersion, modVersionRegExp } = require(
|
||||
*
|
||||
* See https://wiki.factorio.com/Tutorial:Mod_structure#info.json for
|
||||
* details of the invidiual fields sourced from info.json.
|
||||
* @alias module:lib/data.ModInfo
|
||||
* @alias module:lib.ModInfo
|
||||
*/
|
||||
class ModInfo {
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ const { integerFactorioVersion } = require("./version");
|
||||
|
||||
/**
|
||||
* A setting for a mod.
|
||||
* @typedef {object} module:lib/data.ModPack~ModSetting
|
||||
* @typedef {object} module:lib.ModPack~ModSetting
|
||||
* @property {boolean|number|string} value - Value of the given mod setting.
|
||||
*/
|
||||
const ModSettingJsonSchema = {
|
||||
@@ -28,7 +28,7 @@ const ModSettingsJsonSchema = {
|
||||
|
||||
/**
|
||||
* A mod in a mod pack
|
||||
* @typedef {object} module:lib/data.ModPack~ModRecord
|
||||
* @typedef {object} module:lib.ModPack~ModRecord
|
||||
* @property {string} name - name of the mod.
|
||||
* @property {boolean} enabled - if mod is to be loaded.
|
||||
* @property {string} version - version of the mod.
|
||||
@@ -49,7 +49,7 @@ const ModRecordJsonSchema = {
|
||||
* Factorio Mod Pack
|
||||
*
|
||||
* Tracks mods and settings for a collection of Factorio mods.
|
||||
* @alias module:lib/data.ModPack
|
||||
* @alias module:lib.ModPack
|
||||
*/
|
||||
class ModPack {
|
||||
/**
|
||||
@@ -86,13 +86,13 @@ class ModPack {
|
||||
|
||||
/**
|
||||
* Mods included in this mod pack
|
||||
* @type {Map<string, module:lib/data.ModPack~ModRecord>}
|
||||
* @type {Map<string, module:lib.ModPack~ModRecord>}
|
||||
*/
|
||||
mods = new Map();
|
||||
|
||||
/**
|
||||
* Mod settings for this mod pack
|
||||
* @type {Object<string, Map<string, module:lib/data.ModPack~ModSetting>>=}
|
||||
* @type {Object<string, Map<string, module:lib.ModPack~ModSetting>>=}
|
||||
*/
|
||||
settings = {
|
||||
"startup": new Map(),
|
||||
@@ -102,7 +102,7 @@ class ModPack {
|
||||
|
||||
/**
|
||||
* Mapping to files containing exported data for this modpack
|
||||
* @type {module:lib/data.ExportManifest|undefined}
|
||||
* @type {module:lib.ExportManifest|undefined}
|
||||
*/
|
||||
exportManifest;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const { JsonString } = require("./composites");
|
||||
|
||||
// TODO: remove after config refactor
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class RawConfig {
|
||||
/** @type {object} */
|
||||
serializedConfig;
|
||||
@@ -24,7 +24,7 @@ class RawConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ControllerConfigGetRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -33,7 +33,7 @@ class ControllerConfigGetRequest {
|
||||
static Response = RawConfig;
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ControllerConfigSetFieldRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -64,7 +64,7 @@ class ControllerConfigSetFieldRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ControllerConfigSetPropRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -99,7 +99,7 @@ class ControllerConfigSetPropRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class HostGenerateTokenRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -128,7 +128,7 @@ class HostGenerateTokenRequest {
|
||||
static Response = JsonString;
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class HostConfigCreateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -165,7 +165,7 @@ class HostConfigCreateRequest {
|
||||
static Response = RawConfig;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class LogSetSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -214,7 +214,7 @@ class LogSetSubscriptionsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class LogQueryRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -298,7 +298,7 @@ LogQueryRequest.Response = class Response {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class LogMessageEvent {
|
||||
static type = "event";
|
||||
static src = ["host", "controller"];
|
||||
@@ -331,7 +331,7 @@ class LogMessageEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class DebugDumpWsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -339,7 +339,7 @@ class DebugDumpWsRequest {
|
||||
static permission = "core.debug.dump_ws";
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class DebugWsMessageEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const libSchema = require("../schema");
|
||||
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class Address {
|
||||
/** Controller address */
|
||||
static controller = 0;
|
||||
@@ -44,9 +44,9 @@ class Address {
|
||||
* `"allHosts"`: new Address(Address.broadcast, Address.host)
|
||||
* `"allInstances"`: new Address(Address.broadcast, Address.instance)
|
||||
* `"allControls"`: new Address(Address.broadcast, Address.control)
|
||||
* @param {module:lib/data.Address|string|object} shorthand -
|
||||
* @param {module:lib.Address|string|object} shorthand -
|
||||
* Shorthand to translate with.
|
||||
* @returns {module:lib/data.Address} Translated address.
|
||||
* @returns {module:lib.Address} Translated address.
|
||||
*/
|
||||
static fromShorthand(shorthand) {
|
||||
if (shorthand instanceof Address) { return shorthand; }
|
||||
@@ -107,7 +107,7 @@ class Address {
|
||||
|
||||
/**
|
||||
* Returns true if this address targets the given destination
|
||||
* @param {module:lib/Data.Address} dst - Destination to check
|
||||
* @param {module:lib.Address} dst - Destination to check
|
||||
* @returns {boolean} true if this address is addressed to the given destination
|
||||
*/
|
||||
addressedTo(dst) {
|
||||
@@ -129,7 +129,7 @@ class Address {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class Message {
|
||||
/** @type {string} */
|
||||
type;
|
||||
@@ -161,7 +161,7 @@ class Message {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class HelloData {
|
||||
/** @type {string} */
|
||||
version;
|
||||
@@ -190,9 +190,9 @@ class HelloData {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageHello extends Message {
|
||||
/** @type {module:lib/data.HelloData} */
|
||||
/** @type {module:lib.HelloData} */
|
||||
data;
|
||||
|
||||
constructor(data) {
|
||||
@@ -214,7 +214,7 @@ class MessageHello extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class RegisterHostData {
|
||||
/** @type {string} */
|
||||
token;
|
||||
@@ -263,9 +263,9 @@ class RegisterHostData {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageRegisterHost extends Message {
|
||||
/** @type {module:lib/data.RegisterHostData} */
|
||||
/** @type {module:lib.RegisterHostData} */
|
||||
data;
|
||||
|
||||
constructor(data) {
|
||||
@@ -287,7 +287,7 @@ class MessageRegisterHost extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class RegisterControlData {
|
||||
/** @type {string} */
|
||||
token;
|
||||
@@ -317,9 +317,9 @@ class RegisterControlData {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageRegisterControl extends Message {
|
||||
/** @type {module:lib/data.RegisterControlData} */
|
||||
/** @type {module:lib.RegisterControlData} */
|
||||
data;
|
||||
|
||||
constructor(data) {
|
||||
@@ -341,7 +341,7 @@ class MessageRegisterControl extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class AccountDetails {
|
||||
/** @type {string} */
|
||||
name;
|
||||
@@ -381,9 +381,9 @@ class AccountDetails {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ReadyData {
|
||||
/** @type {module:lib/data.Address} */
|
||||
/** @type {module:lib.Address} */
|
||||
src;
|
||||
/** @type {string} */
|
||||
sessionToken;
|
||||
@@ -427,9 +427,9 @@ class ReadyData {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageReady extends Message {
|
||||
/** @type {module:lib/data.ReadyData} */
|
||||
/** @type {module:lib.ReadyData} */
|
||||
data;
|
||||
|
||||
constructor(data) {
|
||||
@@ -451,7 +451,7 @@ class MessageReady extends Message {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ResumeData {
|
||||
/** @type {string} */
|
||||
sessionToken;
|
||||
@@ -478,9 +478,9 @@ class ResumeData {
|
||||
}
|
||||
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageResume extends Message {
|
||||
/** @type {module:lib/data.ResumeData} */
|
||||
/** @type {module:lib.ResumeData} */
|
||||
data;
|
||||
|
||||
constructor(data) {
|
||||
@@ -502,7 +502,7 @@ class MessageResume extends Message {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ContinueData {
|
||||
/** @type {number} */
|
||||
sessionTimeout;
|
||||
@@ -532,9 +532,9 @@ class ContinueData {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageContinue extends Message {
|
||||
/** @type {module:lib/data.ContinueData} */
|
||||
/** @type {module:lib.ContinueData} */
|
||||
data;
|
||||
|
||||
constructor(data) {
|
||||
@@ -556,7 +556,7 @@ class MessageContinue extends Message {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageInvalidate extends Message {
|
||||
constructor() {
|
||||
super("invalidate");
|
||||
@@ -574,7 +574,7 @@ class MessageInvalidate extends Message {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageHeartbeat extends Message {
|
||||
/** @type {integer|undefined} */
|
||||
seq;
|
||||
@@ -598,7 +598,7 @@ class MessageHeartbeat extends Message {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageRequest extends Message {
|
||||
/** @type {number} */
|
||||
seq;
|
||||
@@ -644,7 +644,7 @@ class MessageRequest extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageResponse extends Message {
|
||||
/** @type {number} */
|
||||
seq;
|
||||
@@ -685,7 +685,7 @@ class MessageResponse extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ResponseError {
|
||||
/** @type {string} */
|
||||
message;
|
||||
@@ -715,7 +715,7 @@ class ResponseError {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageResponseError extends Message {
|
||||
/** @type {number} */
|
||||
seq;
|
||||
@@ -723,7 +723,7 @@ class MessageResponseError extends Message {
|
||||
src;
|
||||
/** @type {Address} */
|
||||
dst;
|
||||
/** @type {module:lib/data.ResponseError} */
|
||||
/** @type {module:lib.ResponseError} */
|
||||
data;
|
||||
|
||||
constructor(seq, src, dst, data) {
|
||||
@@ -756,7 +756,7 @@ class MessageResponseError extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageEvent extends Message {
|
||||
/** @type {number} */
|
||||
seq;
|
||||
@@ -802,7 +802,7 @@ class MessageEvent extends Message {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class MessageDisconnect extends Message {
|
||||
/** @type {string} */
|
||||
data;
|
||||
@@ -853,7 +853,7 @@ Message.jsonSchema = {
|
||||
};
|
||||
Message.validate = libSchema.compile(Message.jsonSchema);
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class PingRequest {
|
||||
static type = "request";
|
||||
static src = ["controller", "host", "control"];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const { jsonArray } = require("./composites");
|
||||
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class HostDetails {
|
||||
/** @type {string} */
|
||||
agent;
|
||||
@@ -44,7 +44,7 @@ class HostDetails {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class HostListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -53,7 +53,7 @@ class HostListRequest {
|
||||
static Response = jsonArray(HostDetails);
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class HostSetSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -88,13 +88,13 @@ class HostSetSubscriptionsRequest {
|
||||
}
|
||||
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class HostUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
static dst = "control";
|
||||
|
||||
/** @type {module:lib/data.HostDetails} */
|
||||
/** @type {module:lib.HostDetails} */
|
||||
update;
|
||||
|
||||
constructor(update) {
|
||||
@@ -114,7 +114,7 @@ class HostUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class HostMetricsRequest {
|
||||
static type = "request";
|
||||
static src = "controller";
|
||||
@@ -143,7 +143,7 @@ HostMetricsRequest.Response = class Response { // TODO: Use JSON class pattern i
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ControllerConnectionEvent {
|
||||
static type = "event";
|
||||
static src = "host";
|
||||
@@ -169,14 +169,14 @@ class ControllerConnectionEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class PrepareControllerDisconnectRequest {
|
||||
static type = "request";
|
||||
static src = "host";
|
||||
static dst = "instance";
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class SyncUserListsEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const PlayerStats = require("../PlayerStats");
|
||||
const { JsonString, jsonArray } = require("./composites");
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDetails {
|
||||
/** @type {string} */
|
||||
name;
|
||||
@@ -43,7 +43,7 @@ class InstanceDetails {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDetailsGetRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -72,7 +72,7 @@ class InstanceDetailsGetRequest {
|
||||
static Response = InstanceDetails;
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDetailsListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -81,7 +81,7 @@ class InstanceDetailsListRequest {
|
||||
static Response = jsonArray(InstanceDetails);
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDetailsSetSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -115,13 +115,13 @@ class InstanceDetailsSetSubscriptionsRequest {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDetailsUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
static dst = "control";
|
||||
|
||||
/** @type {module:lib/data.InstanceDetails} */
|
||||
/** @type {module:lib.InstanceDetails} */
|
||||
details;
|
||||
|
||||
constructor(details) {
|
||||
@@ -139,7 +139,7 @@ class InstanceDetailsUpdateEvent {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceCreateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -167,7 +167,7 @@ class InstanceCreateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceConfigGetRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -215,7 +215,7 @@ InstanceConfigGetRequest.Response = class Response {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceConfigSetFieldRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -250,7 +250,7 @@ class InstanceConfigSetFieldRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceConfigSetPropRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -291,7 +291,7 @@ class InstanceConfigSetPropRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceAssignRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -322,7 +322,7 @@ class InstanceAssignRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceMetricsRequest {
|
||||
static type = "request";
|
||||
static src = "host";
|
||||
@@ -351,7 +351,7 @@ InstanceMetricsRequest.Response = class Response { // TODO: Use JSON class patte
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceStartRequest {
|
||||
static type = "request";
|
||||
static src = ["control", "controller"];
|
||||
@@ -377,7 +377,7 @@ class InstanceStartRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class SaveDetails {
|
||||
/** @type {string} */
|
||||
type;
|
||||
@@ -419,7 +419,7 @@ class SaveDetails {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceListSavesRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -428,7 +428,7 @@ class InstanceListSavesRequest {
|
||||
static Response = jsonArray(SaveDetails);
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceSetSaveListSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -462,7 +462,7 @@ class InstanceSetSaveListSubscriptionsRequest {
|
||||
}
|
||||
};
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceSaveListUpdateEvent {
|
||||
static type = "event";
|
||||
static src = ["instance", "host", "controller"];
|
||||
@@ -470,7 +470,7 @@ class InstanceSaveListUpdateEvent {
|
||||
|
||||
/** @type {number} */
|
||||
instanceId;
|
||||
/** @type {module:lib/data.SaveDetails} */
|
||||
/** @type {module:lib.SaveDetails} */
|
||||
saves;
|
||||
|
||||
constructor(instanceId, saves) {
|
||||
@@ -495,7 +495,7 @@ class InstanceSaveListUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceCreateSaveRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -534,7 +534,7 @@ class InstanceCreateSaveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceRenameSaveRequest {
|
||||
static type = "request";
|
||||
static src = ["control", "controller"];
|
||||
@@ -569,7 +569,7 @@ class InstanceRenameSaveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceCopySaveRequest {
|
||||
static type = "request";
|
||||
static src = ["control", "controller"];
|
||||
@@ -604,7 +604,7 @@ class InstanceCopySaveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDeleteSaveRequest {
|
||||
static type = "request";
|
||||
static src = ["control", "controller"];
|
||||
@@ -635,7 +635,7 @@ class InstanceDeleteSaveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDownloadSaveRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -668,7 +668,7 @@ class InstanceDownloadSaveRequest {
|
||||
static Response = JsonString;
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceTransferSaveRequest {
|
||||
static type = "request";
|
||||
static src = ["control", "controller"];
|
||||
@@ -724,7 +724,7 @@ class InstanceTransferSaveRequest {
|
||||
}
|
||||
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstancePullSaveRequest {
|
||||
static type = "request";
|
||||
static src = "controller";
|
||||
@@ -760,7 +760,7 @@ class InstancePullSaveRequest {
|
||||
static Response = JsonString;
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstancePushSaveRequest {
|
||||
static type = "request";
|
||||
static src = "controller";
|
||||
@@ -794,7 +794,7 @@ class InstancePushSaveRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceLoadScenarioRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -833,7 +833,7 @@ class InstanceLoadScenarioRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceExportDataRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -841,7 +841,7 @@ class InstanceExportDataRequest {
|
||||
static permission = "core.instance.export_data";
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceExtractPlayersRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -849,7 +849,7 @@ class InstanceExtractPlayersRequest {
|
||||
static permission = "core.instance.extract_players";
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceStopRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -857,7 +857,7 @@ class InstanceStopRequest {
|
||||
static permission = "core.instance.stop";
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceKillRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -865,7 +865,7 @@ class InstanceKillRequest {
|
||||
static permission = "core.instance.kill";
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDeleteRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -892,7 +892,7 @@ class InstanceDeleteRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDeleteInternalRequest {
|
||||
static type = "request";
|
||||
static src = "controller";
|
||||
@@ -918,7 +918,7 @@ class InstanceDeleteInternalRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceSendRconRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -948,7 +948,7 @@ class InstanceSendRconRequest {
|
||||
}
|
||||
|
||||
// TODO remove this after config refactor
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class RawInstanceInfo {
|
||||
/** @type {object} */
|
||||
config;
|
||||
@@ -977,13 +977,13 @@ class RawInstanceInfo {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstancesUpdateRequest {
|
||||
static type = "request";
|
||||
static src = "host";
|
||||
static dst = "controller";
|
||||
|
||||
/** @type {Array<module:lib/data.RawInstanceInfo>} */
|
||||
/** @type {Array<module:lib.RawInstanceInfo>} */
|
||||
instances;
|
||||
|
||||
constructor(instances) {
|
||||
@@ -1004,7 +1004,7 @@ class InstancesUpdateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceAssignInternalRequest {
|
||||
static type = "request";
|
||||
static src = "controller";
|
||||
@@ -1035,7 +1035,7 @@ class InstanceAssignInternalRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceUnassignInternalRequest {
|
||||
static type = "request";
|
||||
static src = "controller";
|
||||
@@ -1061,7 +1061,7 @@ class InstanceUnassignInternalRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceInitialisedEvent {
|
||||
static type = "event";
|
||||
static src = "instance";
|
||||
@@ -1090,7 +1090,7 @@ class InstanceInitialisedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceStatusChangedEvent {
|
||||
static type = "event";
|
||||
static src = ["instance", "host"];
|
||||
@@ -1129,13 +1129,13 @@ class InstanceStatusChangedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceDetailsChangedEvent {
|
||||
static type = "event";
|
||||
static src = "instance";
|
||||
static dst = "controller";
|
||||
|
||||
/** @type {module:lib/data.InstanceDetails} */
|
||||
/** @type {module:lib.InstanceDetails} */
|
||||
details;
|
||||
|
||||
constructor(details) {
|
||||
@@ -1149,7 +1149,7 @@ class InstanceDetailsChangedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceBanlistUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
@@ -1185,7 +1185,7 @@ class InstanceBanlistUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceAdminlistUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
@@ -1216,7 +1216,7 @@ class InstanceAdminlistUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstanceWhitelistUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
@@ -1247,7 +1247,7 @@ class InstanceWhitelistUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class InstancePlayerUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "instance";
|
||||
|
||||
@@ -4,7 +4,7 @@ const ModInfo = require("./ModInfo");
|
||||
const { jsonArray, JsonString } = require("./composites");
|
||||
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackGetRequest {
|
||||
static type = "request";
|
||||
static src = ["instance", "control"];
|
||||
@@ -33,7 +33,7 @@ class ModPackGetRequest {
|
||||
static Response = ModPack;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackGetDefaultRequest {
|
||||
static type = "request";
|
||||
static src = ["instance", "control"];
|
||||
@@ -42,7 +42,7 @@ class ModPackGetDefaultRequest {
|
||||
static Response = ModPack;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -51,14 +51,14 @@ class ModPackListRequest {
|
||||
static Response = jsonArray(ModPack);
|
||||
}
|
||||
|
||||
/** @memberof module:lib/data */
|
||||
/** @memberof module:lib */
|
||||
class ModPackCreateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
static dst = "controller";
|
||||
static permission = "core.mod_pack.create";
|
||||
|
||||
/** @type {module:lib/data.ModPack} */
|
||||
/** @type {module:lib.ModPack} */
|
||||
modPack;
|
||||
|
||||
constructor(modPack) {
|
||||
@@ -78,14 +78,14 @@ class ModPackCreateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackUpdateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
static dst = "controller";
|
||||
static permission = "core.mod_pack.update";
|
||||
|
||||
/** @type {module:lib/data.ModPack} */
|
||||
/** @type {module:lib.ModPack} */
|
||||
modPack;
|
||||
|
||||
constructor(modPack) {
|
||||
@@ -105,7 +105,7 @@ class ModPackUpdateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackDeleteRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -132,7 +132,7 @@ class ModPackDeleteRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackSetSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -166,7 +166,7 @@ class ModPackSetSubscriptionsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModGetRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -199,7 +199,7 @@ class ModGetRequest {
|
||||
static Response = ModInfo;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -208,7 +208,7 @@ class ModListRequest {
|
||||
static Response = jsonArray(ModInfo);
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModSearchRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -305,7 +305,7 @@ ModSearchRequest.Response = class Response {
|
||||
}
|
||||
};
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModSetSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -339,7 +339,7 @@ class ModSetSubscriptionsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModDownloadRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -372,7 +372,7 @@ class ModDownloadRequest {
|
||||
static Response = JsonString;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModDeleteRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -403,13 +403,13 @@ class ModDeleteRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModPackUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
static dst = "control";
|
||||
|
||||
/** @type {module:lib/data.ModPack} */
|
||||
/** @type {module:lib.ModPack} */
|
||||
modPack;
|
||||
|
||||
constructor(modPack) {
|
||||
@@ -429,13 +429,13 @@ class ModPackUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class ModUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
static dst = "control";
|
||||
|
||||
/** @type {module:lib/data.ModInfo} */
|
||||
/** @type {module:lib.ModInfo} */
|
||||
mod;
|
||||
|
||||
constructor(mod) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
const PlayerStats = require("../PlayerStats");
|
||||
const { jsonArray, JsonNumber } = require("./composites");
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RawPermission { // TODO refactor into lib/user.Permission
|
||||
/** @type {string} */
|
||||
name;
|
||||
@@ -32,7 +32,7 @@ class RawPermission { // TODO refactor into lib/user.Permission
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class PermissionListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -77,7 +77,7 @@ class RawRole { // TODO refactor into lib/user.Role
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RoleListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -86,7 +86,7 @@ class RoleListRequest {
|
||||
static Response = jsonArray(RawRole);
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RoleCreateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -126,7 +126,7 @@ class RoleCreateRequest {
|
||||
static Response = JsonNumber;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RoleUpdateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -168,7 +168,7 @@ class RoleUpdateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RoleGrantDefaultPermissionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -195,7 +195,7 @@ class RoleGrantDefaultPermissionsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RoleDeleteRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -222,7 +222,7 @@ class RoleDeleteRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class RawUser { // TODO refactor into lib/user.User
|
||||
/** @type {string} */
|
||||
name;
|
||||
@@ -240,9 +240,9 @@ class RawUser { // TODO refactor into lib/user.User
|
||||
banReason;
|
||||
/** @type {boolean|undefined} */
|
||||
isDeleted;
|
||||
/** @type {module:lib/PlayerStats} */
|
||||
/** @type {module:lib.PlayerStats} */
|
||||
playerStats;
|
||||
/** @type {Map<number, module:lib/PlayerStats>|undefined} */
|
||||
/** @type {Map<number, module:lib.PlayerStats>|undefined} */
|
||||
instanceStats;
|
||||
|
||||
constructor(
|
||||
@@ -321,7 +321,7 @@ class RawUser { // TODO refactor into lib/user.User
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserGetRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -350,7 +350,7 @@ class UserGetRequest {
|
||||
static Response = RawUser;
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserListRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -359,7 +359,7 @@ class UserListRequest {
|
||||
static Response = jsonArray(RawUser);
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserSetSubscriptionsRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -393,7 +393,7 @@ class UserSetSubscriptionsRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserCreateRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -420,7 +420,7 @@ class UserCreateRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserRevokeTokenRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -447,7 +447,7 @@ class UserRevokeTokenRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserUpdateRolesRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -481,7 +481,7 @@ class UserUpdateRolesRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserSetAdminRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -516,7 +516,7 @@ class UserSetAdminRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserSetWhitelistedRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -551,7 +551,7 @@ class UserSetWhitelistedRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserSetBannedRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -590,7 +590,7 @@ class UserSetBannedRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserDeleteRequest {
|
||||
static type = "request";
|
||||
static src = "control";
|
||||
@@ -618,7 +618,7 @@ class UserDeleteRequest {
|
||||
}
|
||||
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class AccountUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
@@ -657,13 +657,13 @@ class AccountUpdateEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/* @memberof module:lib/data */
|
||||
/* @memberof module:lib */
|
||||
class UserUpdateEvent {
|
||||
static type = "event";
|
||||
static src = "controller";
|
||||
static dst = "control";
|
||||
|
||||
/** @type {module:lib/data.RawUser} */
|
||||
/** @type {module:lib.RawUser} */
|
||||
user;
|
||||
|
||||
constructor(user) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* number of leading zeros in them.
|
||||
* @param {string} version - string representation of version.
|
||||
* @returns {number} numeric representation.
|
||||
* @alias module:lib/data.integerModVersion
|
||||
* @alias module:lib.integerModVersion
|
||||
*/
|
||||
function integerModVersion(version) {
|
||||
const [major, minor, sub] = version.split(".").map(n => Number.parseInt(n, 10));
|
||||
@@ -23,7 +23,7 @@ function integerModVersion(version) {
|
||||
* number of leading zeros in them.
|
||||
* @param {string} version - string representation of version.
|
||||
* @returns {number} numeric representation.
|
||||
* @alias module:lib/data.integerFactorioVersion
|
||||
* @alias module:lib.integerFactorioVersion
|
||||
*/
|
||||
function integerFactorioVersion(version) {
|
||||
const [main, major, minor] = version.split(".").map(n => Number.parseInt(n, 10));
|
||||
@@ -33,7 +33,7 @@ function integerFactorioVersion(version) {
|
||||
/**
|
||||
* Matches valid mod versions.
|
||||
* @type {RegExp}
|
||||
* @alias module:lib/data.modVersionRegExp
|
||||
* @alias module:lib.modVersionRegExp
|
||||
*/
|
||||
const modVersionRegExp = /^\d+\.\d+\.\d+$/;
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ class ItemDatabase {
|
||||
* Create a new item database
|
||||
*
|
||||
* @param {object|undefined} serialized - An object from a previous call to
|
||||
* {@link module:lib/database~ItemDatabase#serialize} to restore the
|
||||
* {@link module:libbase~ItemDatabase#serialize} to restore the
|
||||
* database from. An empty database will be created if this parameter
|
||||
* is left undefined.
|
||||
*/
|
||||
|
||||
@@ -324,7 +324,7 @@ function readMapSettings(state) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} module:lib/factorio.MapExchangeResult
|
||||
* @typedef {object} module:lib.MapExchangeResult
|
||||
* @property {array} version -
|
||||
* Version of Factorio the string was created with.
|
||||
* @property {object} map_gen_settings -
|
||||
@@ -344,8 +344,8 @@ function readMapSettings(state) {
|
||||
* save to set the map gen settings and the map settings for the save.
|
||||
*
|
||||
* @param {string} exchangeString - Max Exchange String to parse.
|
||||
* @returns {module:lib/factorio.MapExchangeResult} Parsed result.
|
||||
* @memberof module:lib/factorio
|
||||
* @returns {module:lib.MapExchangeResult} Parsed result.
|
||||
* @memberof module:lib
|
||||
*/
|
||||
function readMapExchangeString(exchangeString) {
|
||||
exchangeString = exchangeString.replace(/[ \t\n\r]+/g, "");
|
||||
|
||||
@@ -16,9 +16,9 @@ const libZipOps = require("../zip_ops");
|
||||
* the server given, with dependencies generated for all the mods present in
|
||||
* the server's mods folder.
|
||||
*
|
||||
* @param {module:lib/factorio.FactorioServer} server -
|
||||
* @param {module:lib.FactorioServer} server -
|
||||
* The server to generate the export mod for.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
*/
|
||||
async function generateExportMod(server) {
|
||||
let dependencies = [];
|
||||
@@ -63,12 +63,12 @@ async function loadZip(server, modVersions, mod) {
|
||||
/**
|
||||
* Load the given Factorio file path into a Buffer
|
||||
*
|
||||
* @param {module:lib/factorio.FactorioServer} server -
|
||||
* @param {module:lib.FactorioServer} server -
|
||||
* The server to load the file from.
|
||||
* @param {Map<string, string>} modVersions - Mapping of mod to version used.
|
||||
* @param {string} modPath - Factorio style path to the file to load.
|
||||
* @returns {Promise<?Buffer>} The content of the file or null if not found.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -250,14 +250,14 @@ function filterItems(prototypes) {
|
||||
* Assembles and packs the icons for the item prototypes given into a single
|
||||
* spritesheet and json file with meta data.
|
||||
*
|
||||
* @param {module:lib/factorio.FactorioServer} server -
|
||||
* @param {module:lib.FactorioServer} server -
|
||||
* The server to generate the export mod for.
|
||||
* @param {Map<string, string>} modVersions -
|
||||
* Mapping of mod name to versions to get icons from.
|
||||
* @param {Array<Object>} items - Array of item prototypes.
|
||||
* @return {Promise<{itemSheet: Jimp, itemData: Map<string,Object>}>}
|
||||
* Item spritesheet and metadata.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -321,14 +321,14 @@ async function exportItems(server, modVersions, items) {
|
||||
* Parses and merges all the locales for the all the mods given through
|
||||
* `modVersions` and `modOrder`.
|
||||
*
|
||||
* @param {module:lib/factorio.FactorioServer} server -
|
||||
* @param {module:lib.FactorioServer} server -
|
||||
* The server to export the locale from.
|
||||
* @param {Map<string, string>} modVersions -
|
||||
* Mapping of mod name to version to export locale from.
|
||||
* @param {Array<string>} modOrder - Load order of the mods.
|
||||
* @param {string} languageCode - Language to export locale for.
|
||||
* @returns {Promise<Map<string, string>>} merged locale information
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -377,10 +377,10 @@ async function exportLocale(server, modVersions, modOrder, languageCode) {
|
||||
/**
|
||||
* Export the locale and item icons for the given factorio server
|
||||
*
|
||||
* @param {module:lib/factorio.FactorioServer} server -
|
||||
* @param {module:lib.FactorioServer} server -
|
||||
* The server to export the data from.
|
||||
* @returns {Promise<JSZip>} zip file with exported data.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
*/
|
||||
async function exportData(server) {
|
||||
await generateExportMod(server);
|
||||
|
||||
@@ -27,7 +27,7 @@ const knownScenarios = {
|
||||
*
|
||||
* @param {Object} patchInfo - The patch info files's json content
|
||||
* @returns {string} Generated control.lua code.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ function generateLoader(patchInfo) {
|
||||
* their dependents. Throws an error if this is not possible.
|
||||
*
|
||||
* @param {Array<Object>} modules - Array of modules to reorder
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -175,7 +175,7 @@ function reorderDependencies(modules) {
|
||||
*
|
||||
* @param {string} savePath - Path to the Factorio save to patch.
|
||||
* @param {Array<Object>} modules - Description of the modules to patch.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
*/
|
||||
async function patch(savePath, modules) {
|
||||
let zip = await JSZip.loadAsync(await fs.readFile(savePath));
|
||||
|
||||
@@ -21,7 +21,7 @@ const { LineSplitter } = require("../stream");
|
||||
* reading the changelog.txt in it.
|
||||
*
|
||||
* @param {string} changelogPath - Path to changelog.txt.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ async function getVersion(changelogPath) {
|
||||
* @param {string} a - Version to compare.
|
||||
* @param {string} b - Version to compare.
|
||||
* @returns {number} 1 if a < b, 0 if a = b and -1 if a > b.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ function versionOrder(a, b) {
|
||||
* Version to look for, supports the special value "latest" for the
|
||||
* latest version available.
|
||||
* @returns {Promise<Array>} Array with path to data dir and version found.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -145,7 +145,7 @@ async function findVersion(factorioDir, targetVersion) {
|
||||
* RFC 6335.
|
||||
*
|
||||
* @return {number} a number in the range 49152 to 65535.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -164,7 +164,7 @@ function randomDynamicPort() {
|
||||
*
|
||||
* @param {number} length - the length of the password to generate.
|
||||
* @return {Promise<string>} password of the given length
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -207,7 +207,7 @@ async function generatePassword(length) {
|
||||
* @param {string} source - Passed into the output structure as source
|
||||
*
|
||||
* @returns {object} - An object with interpeted data.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
@@ -412,7 +412,7 @@ const outputHeuristics = [
|
||||
* - save-finished - invoked when the server has finished a manual save
|
||||
* - exit - invoked when the sterver has exited
|
||||
* @extends events.EventEmitter
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class FactorioServer extends events.EventEmitter {
|
||||
/**
|
||||
|
||||
@@ -210,18 +210,18 @@ function wordMatches(word, ...texts) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {object} module:lib/helpers~ParsedTerm
|
||||
* @typedef {object} module:lib~ParsedTerm
|
||||
* @property {string} type - Type of term, either attribute or word.
|
||||
* @property {string=} name - attribute only: Name of attribute.
|
||||
* @property {boolean=} exclude - word only: exclude results with this word.
|
||||
* @property {string | module:lib/helpers.ParsedTerm} value -
|
||||
* @property {string | module:lib.ParsedTerm} value -
|
||||
* Parsed value of this term. Is a string if type is word, and a
|
||||
* ParsedTerm if type is attribute.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} module:lib/helpers~ParsedSearch
|
||||
* @property {Array<module:lib/helpers~ParsedTerm>} terms -
|
||||
* @typedef {object} module:lib~ParsedSearch
|
||||
* @property {Array<module:lib~ParsedTerm>} terms -
|
||||
* Parsed result of search terms.
|
||||
* @property {Array<string>} issues -
|
||||
* Issues detected while parsing the seach string.
|
||||
@@ -248,7 +248,7 @@ function wordMatches(word, ...texts) {
|
||||
* @param {Object<string, string>} attributes -
|
||||
* Recognized attributes and their format. Currently only word is
|
||||
* supported.
|
||||
* @returns {module:lib/helpers~ParsedSearch} parsed terms of the search.
|
||||
* @returns {module:lib~ParsedSearch} parsed terms of the search.
|
||||
* @static
|
||||
*/
|
||||
function parseSearchString(input, attributes = {}) {
|
||||
|
||||
+31
-21
@@ -1,3 +1,7 @@
|
||||
/**
|
||||
* Shared library for Clusterio
|
||||
* @module lib
|
||||
*/
|
||||
"use strict";
|
||||
const libBuildMod = require("./build_mod");
|
||||
const libCommand = require("./command");
|
||||
@@ -9,6 +13,7 @@ const libFactorio = require("./factorio");
|
||||
const libFileOps = require("./file_ops");
|
||||
const libHash = require("./hash");
|
||||
const libHelpers = require("./helpers");
|
||||
const libIni = require("./ini");
|
||||
const libLink = require("./link");
|
||||
const libLogging = require("./logging");
|
||||
const libLoggingUtils = require("./logging_utils");
|
||||
@@ -18,36 +23,41 @@ const libPluginLoader = require("./plugin_loader");
|
||||
const libPrometheus = require("./prometheus");
|
||||
const libSchema = require("./schema");
|
||||
const libSharedCommands = require("./shared_commands");
|
||||
const libStream = require("./stream");
|
||||
const libUsers = require("./users");
|
||||
const libZipOps = require("./zip_ops");
|
||||
|
||||
const ExponentialBackoff = require("./ExponentialBackoff");
|
||||
const PlayerStats = require("./PlayerStats");
|
||||
const RateLimiter = require("./RateLimiter");
|
||||
|
||||
|
||||
module.exports = {
|
||||
libBuildMod,
|
||||
libCommand,
|
||||
libConfig,
|
||||
libData,
|
||||
libDatabase,
|
||||
libErrors,
|
||||
libFactorio,
|
||||
libFileOps,
|
||||
libHash,
|
||||
libHelpers,
|
||||
libLink,
|
||||
libLogging,
|
||||
libLoggingUtils,
|
||||
libLuaTools,
|
||||
libPlugin,
|
||||
libPluginLoader,
|
||||
libPrometheus,
|
||||
libSchema,
|
||||
libSharedCommands,
|
||||
libUsers,
|
||||
libZipOps,
|
||||
...libBuildMod,
|
||||
...libCommand,
|
||||
...libConfig,
|
||||
...libData,
|
||||
...libDatabase,
|
||||
...libErrors,
|
||||
...libFactorio,
|
||||
...libFileOps,
|
||||
...libHash,
|
||||
...libHelpers,
|
||||
...libIni,
|
||||
...libLink,
|
||||
...libLogging,
|
||||
...libLoggingUtils,
|
||||
...libLuaTools,
|
||||
...libPlugin,
|
||||
...libPluginLoader,
|
||||
...libPrometheus,
|
||||
...libSchema,
|
||||
...libSharedCommands,
|
||||
...libStream,
|
||||
...libUsers,
|
||||
...libZipOps,
|
||||
|
||||
ExponentialBackoff,
|
||||
PlayerStats,
|
||||
RateLimiter,
|
||||
};
|
||||
@@ -15,7 +15,7 @@ const ExponentialBackoff = require("../ExponentialBackoff");
|
||||
* Base connector for links
|
||||
*
|
||||
* @extends events.EventEmitter
|
||||
* @memberof module:lib/link
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class BaseConnector extends events.EventEmitter {
|
||||
constructor(src, dst) {
|
||||
@@ -76,8 +76,8 @@ class BaseConnector extends events.EventEmitter {
|
||||
/**
|
||||
* Base connector for links
|
||||
*
|
||||
* @extends module:lib/link.BaseConnector
|
||||
* @memberof module:lib/link
|
||||
* @extends module:lib.BaseConnector
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class WebSocketBaseConnector extends BaseConnector {
|
||||
constructor(src, dst) {
|
||||
@@ -231,7 +231,7 @@ class WebSocketBaseConnector extends BaseConnector {
|
||||
* This is a low level method that should only be used for implementing
|
||||
* links. See sendTo for sending requests and events.
|
||||
*
|
||||
* @param {module:lib/data.Message} message - Message to send.
|
||||
* @param {module:lib.Message} message - Message to send.
|
||||
*/
|
||||
send(message) {
|
||||
if (!["connected", "resuming"].includes(this._state)) {
|
||||
@@ -313,8 +313,8 @@ class WebSocketBaseConnector extends BaseConnector {
|
||||
/**
|
||||
* Connector for controller clients
|
||||
*
|
||||
* @extends module:lib/link.WebSocketBaseConnector
|
||||
* @memberof module:lib/link
|
||||
* @extends module:lib.WebSocketBaseConnector
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
constructor(url, maxReconnectDelay, tlsCa = null) {
|
||||
@@ -360,7 +360,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
* Used in the register function in order to send the handshake messages
|
||||
* over the WebSocket.
|
||||
*
|
||||
* @param {module:lib/data.Message} message - Message to send.
|
||||
* @param {module:lib.Message} message - Message to send.
|
||||
*/
|
||||
sendHandshake(message) {
|
||||
this._check("connecting", "resuming");
|
||||
@@ -647,7 +647,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
* Connector for in-memory local links
|
||||
*
|
||||
* @extends events.EventEmitter
|
||||
* @memberof module:lib/link
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class VirtualConnector extends BaseConnector {
|
||||
constructor(src, dst) {
|
||||
@@ -662,8 +662,8 @@ class VirtualConnector extends BaseConnector {
|
||||
* Creates two virtual connectors that are liked to each othes such that
|
||||
* a message sent on one is received by the other.
|
||||
*
|
||||
* @param {module:lib/data.Address} src - Source for obverse connector
|
||||
* @param {module:lib/data.Address} dst - destination for obverse connector
|
||||
* @param {module:lib.Address} src - Source for obverse connector
|
||||
* @param {module:lib.Address} dst - destination for obverse connector
|
||||
* @returns {Array} two virtuarl connectors.
|
||||
*/
|
||||
static makePair(src, dst) {
|
||||
@@ -677,7 +677,7 @@ class VirtualConnector extends BaseConnector {
|
||||
/**
|
||||
* Send a message to the other end of the connector
|
||||
*
|
||||
* @param {module:lib/data.Message} message - Message type to send.
|
||||
* @param {module:lib.Message} message - Message type to send.
|
||||
*/
|
||||
send(message) {
|
||||
this.other.emit("message", message);
|
||||
|
||||
@@ -17,7 +17,7 @@ const { dataClasses } = require("./messages");
|
||||
/**
|
||||
* Common interface for server and client connections
|
||||
*
|
||||
* @memberof module:lib/link
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class Link {
|
||||
constructor(connector) {
|
||||
@@ -95,8 +95,8 @@ class Link {
|
||||
* Validates and invokes the handler and/or waiters for a message that has
|
||||
* been received. An unhandled message is considered to be an error.
|
||||
*
|
||||
* @param {module:lib/data.Message} message - Message to process.
|
||||
* @throws {module:lib/errors.InvalidMessage} if the message is invalid or not handled.
|
||||
* @param {module:lib.Message} message - Message to process.
|
||||
* @throws {module:lib.InvalidMessage} if the message is invalid or not handled.
|
||||
*/
|
||||
_processMessage(message) {
|
||||
if (!["request", "response", "responseError", "event"].includes(message.type)) {
|
||||
@@ -149,8 +149,8 @@ class Link {
|
||||
*
|
||||
* Should be overridden by sub-classes to validate messages received.
|
||||
*
|
||||
* @param {module:lib/data.Message} message - Message to check.
|
||||
* @throws {module:lib/errors.InvalidMessage} if the message is invalid.
|
||||
* @param {module:lib.Message} message - Message to check.
|
||||
* @throws {module:lib.InvalidMessage} if the message is invalid.
|
||||
*/
|
||||
validateIngress(message) { }
|
||||
|
||||
@@ -222,9 +222,9 @@ class Link {
|
||||
* Called when an request or event is received by a control connector.
|
||||
* Should be overridden by sub-classes to validate messages received.
|
||||
*
|
||||
* @param {module:lib/data.Message} message - Message to check.
|
||||
* @param {module:lib.Message} message - Message to check.
|
||||
* @param {object} entry - Request or Event entry for this Message.
|
||||
* @throws {module:lib/errors.PermissionError} if unauthorized.
|
||||
* @throws {module:lib.PermissionError} if unauthorized.
|
||||
*/
|
||||
validatePermission(message, entry) { }
|
||||
|
||||
@@ -380,7 +380,7 @@ class Link {
|
||||
/**
|
||||
* Send a request or event to the given address
|
||||
*
|
||||
* @param {*|module:lib/data.Address} destination - Where to send it
|
||||
* @param {*|module:lib.Address} destination - Where to send it
|
||||
* @param {*} requestOrEvent - Request or event to send
|
||||
* @returns {Promise<*>|undefined}
|
||||
* Promise that resolves to the response if a request was sent or
|
||||
|
||||
@@ -84,7 +84,7 @@ class WebConsoleFormat {
|
||||
|
||||
/**
|
||||
* Filter object for logs
|
||||
* @typedef {Object} module:lib/logging~LogFilter
|
||||
* @typedef {Object} module:lib~LogFilter
|
||||
* @property {string} [maxLevel] -
|
||||
* Maximum log level to include. Higher levels are more verbose.
|
||||
* @property {boolean} [all] -
|
||||
@@ -101,7 +101,7 @@ class WebConsoleFormat {
|
||||
/**
|
||||
* Create log filter by level and source.
|
||||
*
|
||||
* @param {module:lib/logging~LogFilter} filter -
|
||||
* @param {module:lib~LogFilter} filter -
|
||||
* Filter to filter log entries by.
|
||||
* @returns {function(object): boolean}
|
||||
* filter returning true for log entries that match it.
|
||||
|
||||
@@ -188,10 +188,10 @@ class LogIndex {
|
||||
*
|
||||
* Loads index.json from the given log directy expecting it to contain
|
||||
* data about previously indexed files saved with {@link
|
||||
* module:lib/logging_utils.LogIndex#save}.
|
||||
* module:lib.LogIndex#save}.
|
||||
*
|
||||
* @param {string} logDirectory - Path to directory to load from.
|
||||
* @returns {Promise<module:lib/logging_utils.LogIndex>} loaded or created log index.
|
||||
* @returns {Promise<module:lib.LogIndex>} loaded or created log index.
|
||||
*/
|
||||
static async load(logDirectory) {
|
||||
try {
|
||||
@@ -275,7 +275,7 @@ class LogIndex {
|
||||
*
|
||||
* @param {string} file -
|
||||
* Name of file in the log directory to check for.
|
||||
* @param {module:lib/logging~LogFilter} filter -
|
||||
* @param {module:lib~LogFilter} filter -
|
||||
* Filter to check index if file contains entries for.
|
||||
* @returns {boolean}
|
||||
* true if the file may contain entries included by the filter.
|
||||
@@ -314,7 +314,7 @@ class LogIndex {
|
||||
|
||||
/**
|
||||
* Filter object for querying logs
|
||||
* @typedef {Object} module:lib/logging_utils~QueryLogFilter
|
||||
* @typedef {Object} module:lib~QueryLogFilter
|
||||
* @property {number} [limit=100] - Maximum number of entries to return.
|
||||
* @property {string} [order="asc"] -
|
||||
* Return entries in ascending ("asc") date order or desceding ("desc")
|
||||
@@ -336,9 +336,9 @@ class LogIndex {
|
||||
* Query log directory
|
||||
*
|
||||
* @param {string} logDirectory - path to directory with logs.
|
||||
* @param {module:lib/logging_utils~QueryLogFilter} filter -
|
||||
* @param {module:lib~QueryLogFilter} filter -
|
||||
* Filter to limit logs by.
|
||||
* @param {module:lib/logging_utils.LogIndex=} index -
|
||||
* @param {module:lib.LogIndex=} index -
|
||||
* Index to speed up query with.
|
||||
* @returns {Promise<Array<Object>>} log entries matching the filter
|
||||
*/
|
||||
|
||||
+16
-16
@@ -9,10 +9,10 @@ const helpers = require("./helpers");
|
||||
/**
|
||||
* Conceptual base for controller and instance plugins.
|
||||
* @typedef {
|
||||
* module:lib/plugin.BaseControllerPlugin
|
||||
* |module:lib/plugin.BaseInstancePlugin
|
||||
* |module:lib/plugin.BaseControlPlugin
|
||||
* } module:lib/plugin.BasePlugin
|
||||
* module:lib.BaseControllerPlugin
|
||||
* |module:lib.BaseInstancePlugin
|
||||
* |module:lib.BaseControlPlugin
|
||||
* } module:lib.BasePlugin
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -77,7 +77,7 @@ class BaseInstancePlugin {
|
||||
* Invoked after the value of the config field given by `field` has
|
||||
* changed.
|
||||
*
|
||||
* @param {module:lib/config.ConfigGroup} group -
|
||||
* @param {module:lib.ConfigGroup} group -
|
||||
* The group who's field got changed.
|
||||
* @param {string} field - Name of the field that changed.
|
||||
* @param {*} prev - The previous value of the field.
|
||||
@@ -366,7 +366,7 @@ class BaseControllerPlugin {
|
||||
* Invoked after the value of the config field given by `field` has
|
||||
* changed on the controller.
|
||||
*
|
||||
* @param {module:lib/config.ConfigGroup} group -
|
||||
* @param {module:lib.ConfigGroup} group -
|
||||
* The group who's field got changed.
|
||||
* @param {string} field - Name of the field that changed.
|
||||
* @param {*} prev - The previous value of the field.
|
||||
@@ -381,7 +381,7 @@ class BaseControllerPlugin {
|
||||
*
|
||||
* @param {module:controller/src/InstanceInfo} instance -
|
||||
* The instance the config changed on.
|
||||
* @param {module:lib/config.ConfigGroup} group -
|
||||
* @param {module:lib.ConfigGroup} group -
|
||||
* The group who's field got changed.
|
||||
* @param {string} field - Name of the field that changed.
|
||||
* @param {*} prev - The previous value of the field.
|
||||
@@ -504,7 +504,7 @@ class BaseControllerPlugin {
|
||||
* If the mod pack has been deleted its `.isDeleted` property will be
|
||||
* true.
|
||||
*
|
||||
* @param {module:lib/data.ModPack} modPack - Mod pack that updated.
|
||||
* @param {module:lib.ModPack} modPack - Mod pack that updated.
|
||||
*/
|
||||
async onModPackUpdated(modPack) { }
|
||||
|
||||
@@ -516,7 +516,7 @@ class BaseControllerPlugin {
|
||||
*
|
||||
* If a mod has been deleted its `.isDeleted` property will be true.
|
||||
*
|
||||
* @param {module:lib/data.ModInfo} mod - Mod that updated.
|
||||
* @param {module:lib.ModInfo} mod - Mod that updated.
|
||||
*/
|
||||
async onModUpdated(mod) { }
|
||||
|
||||
@@ -601,9 +601,9 @@ class BaseControlPlugin {
|
||||
*
|
||||
* Invoked by clusterioctl to let plugins add commands. `rootCommand` is
|
||||
* the top level command node which the plugin should add its own {@link
|
||||
* module:lib/command.CommandTree} to.
|
||||
* module:lib.CommandTree} to.
|
||||
*
|
||||
* @param {module:lib/command.CommandTree} rootCommand -
|
||||
* @param {module:lib.CommandTree} rootCommand -
|
||||
* Root of the clusterioctl command tree.
|
||||
*/
|
||||
async addCommands(rootCommand) { }
|
||||
@@ -612,7 +612,7 @@ class BaseControlPlugin {
|
||||
|
||||
/**
|
||||
* Plugin supplied login form
|
||||
* @typedef {Object} module:lib/plugin~LoginForm
|
||||
* @typedef {Object} module:lib~LoginForm
|
||||
* @property {string} name -
|
||||
* Internal name of the login form, this should start with the
|
||||
* plugin name followed by a dot.
|
||||
@@ -627,7 +627,7 @@ class BaseControlPlugin {
|
||||
|
||||
/**
|
||||
* Plugin supplied pages
|
||||
* @typedef {Object} module:lib/plugin~Page
|
||||
* @typedef {Object} module:lib~Page
|
||||
* @property {string} path - URL path to this page.
|
||||
* @property {string=} sidebarPath -
|
||||
* If present and this path matches one of the pages in the sidebar it
|
||||
@@ -669,7 +669,7 @@ class BaseWebPlugin {
|
||||
/**
|
||||
* Control link to the controller, not available until the
|
||||
* connect event in onControllerConnectionEvent is signaled.
|
||||
* @type {?module:lib/link.Link}
|
||||
* @type {?module:lib.Link}
|
||||
*/
|
||||
this.control = null;
|
||||
|
||||
@@ -685,14 +685,14 @@ class BaseWebPlugin {
|
||||
/**
|
||||
* List of login forms provided by this plugin
|
||||
*
|
||||
* @type {Array<module:lib/plugin~LoginForm>}
|
||||
* @type {Array<module:lib~LoginForm>}
|
||||
*/
|
||||
this.loginForms = [];
|
||||
|
||||
/**
|
||||
* List of pages provided by this plugin
|
||||
*
|
||||
* @type {Array<module:lib/plugin~Page>}
|
||||
* @type {Array<module:lib~Page>}
|
||||
*/
|
||||
this.pages = [];
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ function loadPluginClass(entrypointName, className, pluginClass, pluginInfo) {
|
||||
*
|
||||
* @param {Object} pluginInfo -
|
||||
* Plugin info object returned from {@link
|
||||
* module:lib/plugin_loader.loadPluginInfos} to load class from.
|
||||
* module:lib.loadPluginInfos} to load class from.
|
||||
* @returns {Promise<function>} plugin class
|
||||
* @static
|
||||
*/
|
||||
@@ -90,7 +90,7 @@ async function loadControllerPluginClass(pluginInfo) {
|
||||
*
|
||||
* @param {Object} pluginInfo -
|
||||
* Plugin info object returned from {@link
|
||||
* module:lib/plugin_loader.loadPluginInfos} to load class from.
|
||||
* module:lib.loadPluginInfos} to load class from.
|
||||
* @returns {Promise<function>} plugin class
|
||||
* @static
|
||||
*/
|
||||
@@ -103,7 +103,7 @@ async function loadInstancePluginClass(pluginInfo) {
|
||||
*
|
||||
* @param {Object} pluginInfo -
|
||||
* Plugin info object returned from {@link
|
||||
* module:lib/plugin_loader.loadPluginInfos} to load class from.
|
||||
* module:lib.loadPluginInfos} to load class from.
|
||||
* @returns {Promise<function>} plugin class
|
||||
* @static
|
||||
*/
|
||||
|
||||
+26
-26
@@ -7,13 +7,13 @@
|
||||
* metric collections in prom-client.
|
||||
*
|
||||
* The ordinary use case of instrumenting a code base should be covered by
|
||||
* {@link module:lib/prometheus.Counter}, {@link
|
||||
* module:lib/prometheus.Gauge}, {@link module:lib/prometheus.Histogram} and
|
||||
* {@link module:lib/prometheus.exposition}. See documentation for each of
|
||||
* {@link module:lib.Counter}, {@link
|
||||
* module:lib.Gauge}, {@link module:lib.Histogram} and
|
||||
* {@link module:lib.exposition}. See documentation for each of
|
||||
* the listed interfaces for more information.
|
||||
*
|
||||
* @example
|
||||
* const { Counter, exposition } = require("@clusterio/lib/prometheus");
|
||||
* const { Counter, exposition } = require("@clusterio/lib");
|
||||
*
|
||||
* // Collectors are by default registered to the default collector regitry.
|
||||
* const totalRequests = new Counter(
|
||||
@@ -42,9 +42,9 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Result from collecting a {@link module:lib/prometheus.Collector}
|
||||
* Result from collecting a {@link module:lib.Collector}
|
||||
* @typedef {Object} CollectorResult
|
||||
* @property {module:lib/prometheus.Metric} metric -
|
||||
* @property {module:lib.Metric} metric -
|
||||
* Metric collected.
|
||||
* @property {Map<string, Map<string, number>>} samples -
|
||||
* Mapping of metric suffix to mapping of label keys to values
|
||||
@@ -165,7 +165,7 @@ class Metric {
|
||||
|
||||
/**
|
||||
* The default registry which collectors are regististered to.
|
||||
* @type {module:lib/prometheus.CollectorRegistry}
|
||||
* @type {module:lib.CollectorRegistry}
|
||||
* @static
|
||||
*/
|
||||
let defaultRegistry;
|
||||
@@ -176,7 +176,7 @@ let defaultRegistry;
|
||||
* This servers mostly as a conceptual base for all collectors, the only
|
||||
* feature implemented here is registring to the default registry on
|
||||
* construction. If you want to implement a custom collector you most
|
||||
* likely want to base it on {@link module:lib/prometheus.LabeledCollector}
|
||||
* likely want to base it on {@link module:lib.LabeledCollector}
|
||||
* instead.
|
||||
*
|
||||
* @static
|
||||
@@ -197,7 +197,7 @@ class Collector {
|
||||
/**
|
||||
* Retrieve metric data from this collctor.
|
||||
*
|
||||
* Called by {@link module:lib/prometheus.CollectorRegistry} to gather
|
||||
* Called by {@link module:lib.CollectorRegistry} to gather
|
||||
* the metric data this Collector exports.
|
||||
*
|
||||
* @returns {*} Async iterator of {@link CollectorResult}.
|
||||
@@ -318,7 +318,7 @@ function removeMatchingLabels(mapping, labels) {
|
||||
* set is a child to the collector that can be retrieved with the .labels()
|
||||
* method.
|
||||
*
|
||||
* @extends module:lib/prometheus.Collector
|
||||
* @extends module:lib.Collector
|
||||
* @static
|
||||
*/
|
||||
class LabeledCollector extends Collector {
|
||||
@@ -341,7 +341,7 @@ class LabeledCollector extends Collector {
|
||||
* collected. The collector being collected is passed as the
|
||||
* argument.
|
||||
* @param {
|
||||
* function(module:lib/prometheus.LabeledCollector,string)
|
||||
* function(module:lib.LabeledCollector,string)
|
||||
* } childClass -
|
||||
* Constructor taking instance of collector and label key as
|
||||
* arguments and returns a child instance.
|
||||
@@ -461,7 +461,7 @@ class LabeledCollector extends Collector {
|
||||
/**
|
||||
* Base class for implementing single value per label collectors
|
||||
*
|
||||
* @extends module:lib/prometheus.LabeledCollector
|
||||
* @extends module:lib.LabeledCollector
|
||||
* @static
|
||||
*/
|
||||
class ValueCollector extends LabeledCollector {
|
||||
@@ -485,8 +485,8 @@ class ValueCollector extends LabeledCollector {
|
||||
* argument.
|
||||
* @param {
|
||||
* function(
|
||||
* new:module:lib/prometheus.ValueCollectorChild,
|
||||
* module:lib/prometheus.LabeledCollector,
|
||||
* new:module:lib.ValueCollectorChild,
|
||||
* module:lib.LabeledCollector,
|
||||
* string
|
||||
* )
|
||||
* } childClass -
|
||||
@@ -555,7 +555,7 @@ class ValueCollectorChild {
|
||||
|
||||
/**
|
||||
* Child counter holding the value for a single label set.
|
||||
* @extends module:lib/prometheus~ValueCollectorChild
|
||||
* @extends module:lib~ValueCollectorChild
|
||||
*/
|
||||
class CounterChild extends ValueCollectorChild {
|
||||
/**
|
||||
@@ -597,7 +597,7 @@ class CounterChild extends ValueCollectorChild {
|
||||
*
|
||||
* The `totalRequests` counter will register with the default registry and
|
||||
* provided exposition is set up (see {@link
|
||||
* module:lib/prometheus.exposition}) the counter will be exported to
|
||||
* module:lib.exposition}) the counter will be exported to
|
||||
* Prometheus starting out with a value of 0. And that is all there is to
|
||||
* it.
|
||||
*
|
||||
@@ -652,7 +652,7 @@ class CounterChild extends ValueCollectorChild {
|
||||
* labels you actually need as resource usage for a metric increases
|
||||
* exponentially with the number of labels used.
|
||||
*
|
||||
* @extends module:lib/prometheus.ValueCollector
|
||||
* @extends module:lib.ValueCollector
|
||||
* @static
|
||||
*/
|
||||
class Counter extends ValueCollector {
|
||||
@@ -689,7 +689,7 @@ class Counter extends ValueCollector {
|
||||
|
||||
/**
|
||||
* Child gauge holding the value for a single label set.
|
||||
* @extends module:lib/prometheus~ValueCollectorChild
|
||||
* @extends module:lib~ValueCollectorChild
|
||||
*/
|
||||
class GaugeChild extends ValueCollectorChild {
|
||||
/**
|
||||
@@ -771,7 +771,7 @@ class GaugeChild extends ValueCollectorChild {
|
||||
*
|
||||
* The `activeRequests` gauge will register with the default registry and
|
||||
* provided exposition is set up (see {@link
|
||||
* module:lib/prometheus.exposition}) the gauge will be exported to
|
||||
* module:lib.exposition}) the gauge will be exported to
|
||||
* Prometheus starting out with a value of 0.
|
||||
*
|
||||
* Sometimes keeping track of the value measured is impractical or
|
||||
@@ -842,7 +842,7 @@ class GaugeChild extends ValueCollectorChild {
|
||||
* labels you actually need as resource usage for a metric increases
|
||||
* exponentially with the number of labels used.
|
||||
*
|
||||
* @extends module:lib/prometheus.ValueCollector
|
||||
* @extends module:lib.ValueCollector
|
||||
* @static
|
||||
*/
|
||||
class Gauge extends ValueCollector {
|
||||
@@ -1637,7 +1637,7 @@ async function* expositionLines(resultsIterator) {
|
||||
* @param {*} resultsIterator -
|
||||
* Asynchronously itreable of {@link CollectorResult} results to create
|
||||
* exposition for. Defaults to collecting results from {@link
|
||||
* module:lib/prometheus.defaultRegistry}.
|
||||
* module:lib.defaultRegistry}.
|
||||
* @returns {string} Prometheus exposition.
|
||||
*
|
||||
* @property {string} exposition.contentType
|
||||
@@ -1658,10 +1658,10 @@ exposition.contentType = "text/plain; version=0.0.4";
|
||||
/**
|
||||
* Serialize CollectorResult into a plain object
|
||||
*
|
||||
* Converts a {@link module:lib/prometheus~CollectorResult} into a plain
|
||||
* Converts a {@link module:lib~CollectorResult} into a plain
|
||||
* object form that can be stringified to JSON.
|
||||
*
|
||||
* @param {module:lib/prometheus~CollectorResult} result -
|
||||
* @param {module:lib~CollectorResult} result -
|
||||
* Result to serialize into plain object form.
|
||||
* @param {Object} options - Options for controlling the serialization.
|
||||
* @param {string} options.addLabels -
|
||||
@@ -1724,10 +1724,10 @@ function serializeResult(result, options = {}) {
|
||||
/**
|
||||
* Deserialize CollectorResult from plain object
|
||||
*
|
||||
* Reverse counterpart to {@link module:lib/prometheus.serializeResult}.
|
||||
* Reverse counterpart to {@link module:lib.serializeResult}.
|
||||
*
|
||||
* @param {Object} serializedResult - Previously serialized result object.
|
||||
* @returns {module:lib/prometheus~CollectorResult} deserialized result.
|
||||
* @returns {module:lib~CollectorResult} deserialized result.
|
||||
* @static
|
||||
*/
|
||||
function deserializeResult(serializedResult) {
|
||||
@@ -1748,7 +1748,7 @@ function deserializeResult(serializedResult) {
|
||||
|
||||
/**
|
||||
* Default collectors provided by this library
|
||||
* @type {Object<string, module:lib/prometheus.Collector>}
|
||||
* @type {Object<string, module:lib.Collector>}
|
||||
*/
|
||||
let defaultCollectors = {};
|
||||
defaultCollectors.processCpuSecondsTotal = new Gauge(
|
||||
|
||||
@@ -120,7 +120,7 @@ function configCommand(yargs) {
|
||||
* Handle the actions that are made available by configCommand.
|
||||
*
|
||||
* @param {Object} args - yargs args object.
|
||||
* @param {module:lib/config.Config} instance - Config instance.
|
||||
* @param {module:lib.Config} instance - Config instance.
|
||||
* @param {string} configPath - Path to configuration file.
|
||||
*/
|
||||
async function handleConfigCommand(args, instance, configPath) {
|
||||
|
||||
@@ -16,7 +16,7 @@ const stream = require("stream");
|
||||
* let fileStream = fs.createReadStream(path);
|
||||
* fileStream.pipe(lineStream);
|
||||
*
|
||||
* @memberof module:lib/stream
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class LineSplitter extends stream.Transform {
|
||||
constructor(options) {
|
||||
@@ -63,7 +63,7 @@ class LineSplitter extends stream.Transform {
|
||||
* Transform splitting a reverse stream into lines
|
||||
*
|
||||
* Splits up a reverse stream of chunks created by {@link
|
||||
* module:lib/stream.createReverseReadStream} by newlines and passes on the
|
||||
* module:lib.createReverseReadStream} by newlines and passes on the
|
||||
* lines one by one in reverse order removing the line feed and optional
|
||||
* carriage return from the lines.
|
||||
*
|
||||
@@ -73,7 +73,7 @@ class LineSplitter extends stream.Transform {
|
||||
* let revFileStream = await libStream.createReverseReadStream(path);
|
||||
* revFileStream.pipe(revLineStream);
|
||||
*
|
||||
* @memberof module:lib/stream
|
||||
* @memberof module:lib
|
||||
*/
|
||||
class ReverseLineSplitter extends stream.Transform {
|
||||
constructor(options) {
|
||||
@@ -141,7 +141,7 @@ class ReverseLineSplitter extends stream.Transform {
|
||||
* @param {object} options -
|
||||
* Options to pass to fs.createReadStream. Values passed for `fd` and
|
||||
* `fs` will be ignored.
|
||||
* @memberof module:lib/stream
|
||||
* @memberof module:lib
|
||||
*/
|
||||
async function createReverseReadStream(path, options) {
|
||||
const fileFd = await fs.open(path, "r");
|
||||
|
||||
@@ -100,8 +100,8 @@ class Role {
|
||||
*
|
||||
* Ensures the role with id 0 exisits and has the core.admin permission.
|
||||
*
|
||||
* @param {Map<number, module:lib/user.Role>} roles - role storage to modify.
|
||||
* @returns {module:lib/permission.Role} the default admin role
|
||||
* @param {Map<number, module:lib.Role>} roles - role storage to modify.
|
||||
* @returns {module:lib.Role} the default admin role
|
||||
* @static
|
||||
*/
|
||||
function ensureDefaultAdminRole(roles) {
|
||||
@@ -121,7 +121,7 @@ function ensureDefaultAdminRole(roles) {
|
||||
* assigned by default. Note that this may not be the same role as the one
|
||||
* that is assigned to new users by default.
|
||||
*
|
||||
* @param {Map<number, module:lib/user.Role>} roles - role storage to modify.
|
||||
* @param {Map<number, module:lib.Role>} roles - role storage to modify.
|
||||
* @static
|
||||
*/
|
||||
function ensureDefaultPlayerRole(roles) {
|
||||
@@ -186,7 +186,7 @@ class User {
|
||||
|
||||
/**
|
||||
* Roles this user has
|
||||
* @type {Set<module:lib/permissions.Role>}
|
||||
* @type {Set<module:lib.Role>}
|
||||
*/
|
||||
this.roles = new Set();
|
||||
if (serializedUser.roles) {
|
||||
@@ -200,7 +200,7 @@ class User {
|
||||
|
||||
/**
|
||||
* Per instance statistics for the player this user account is tied to.
|
||||
* @type {Map<number, module:lib/PlayerStats>}
|
||||
* @type {Map<number, module:lib.PlayerStats>}
|
||||
*/
|
||||
this.instanceStats = new Map(
|
||||
(serializedUser.instance_stats ? serializedUser.instance_stats : []).map(
|
||||
@@ -210,7 +210,7 @@ class User {
|
||||
|
||||
/**
|
||||
* Combined statistics for the player this user account is tied to.
|
||||
* @type {module:lib/PlayerStats}
|
||||
* @type {module:lib.PlayerStats}
|
||||
*/
|
||||
this.playerStats = this._calculatePlayerStats();
|
||||
|
||||
@@ -286,7 +286,7 @@ class User {
|
||||
*
|
||||
* @param {string} permission - The permission to check for.
|
||||
* @throws {Error} If the given permission does not exist.
|
||||
* @throws {module:lib/errors.PermissionError} if the user does noh have the given permission.
|
||||
* @throws {module:lib.PermissionError} if the user does noh have the given permission.
|
||||
*/
|
||||
checkPermission(permission) {
|
||||
if (!permissions.has(permission)) {
|
||||
@@ -336,7 +336,7 @@ class User {
|
||||
}
|
||||
/**
|
||||
* Set of users currently online in the cluster.
|
||||
* @type {module:lib/users.User}
|
||||
* @type {module:lib.User}
|
||||
*/
|
||||
User.onlineUsers = new Set();
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* @param {JSZip} zip - Zip to search through.
|
||||
* @returns {string} name of the root folder.
|
||||
* @memberof module:lib/factorio
|
||||
* @memberof module:lib
|
||||
* @private
|
||||
* @inner
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user