Fix JSDoc issues

Fix missing documentation for parameters and return types, incorect
config and errors in type definitions.
This commit is contained in:
Hornwitser committed 2020-06-17 20:53:18 +02:00
1 parent 3dba92a03d
commit 703fda43ad
20 files changed
+193 -52

No files matched your search

+29 -15
View File
@@ -9,6 +9,11 @@ const path = require("path");
const errors = require("lib/errors");
/**
* Conceptual base for master and instance plugins.
* @typedef {module:lib/plugin.BaseMasterPlugin|module:lib/plugin.BaseInstancePlugin} module:lib/plugin.BasePlugin
*/
/**
* Base class for instance plugins
* @static
@@ -51,7 +56,7 @@ class BaseInstancePlugin {
* @param {module:lib/config.ConfigGroup} group -
* The group who's field got changed on.
* @param {string} field - Name of the field that changed.
* @param prev - The previous value of the field.
* @param {*} prev - The previous value of the field.
*/
async onInstanceConfigFieldChanged(group, field, prev) { }
@@ -68,7 +73,7 @@ class BaseInstancePlugin {
* the Gauges/Counters/etc in onMetric and let Clusterio deal will
* collecting the values.
*
* @returns an async iterator of prometheus metric results or undefined.
* @returns {*} an async iterator of prometheus metric results or undefined.
*/
async onMetrics() { }
@@ -99,16 +104,23 @@ class BaseInstancePlugin {
*
* Called when the Factorio server outputs a line on either stdout or
* stderr. The output is a parsed form of the line and contains the
* following properties (those marked with ? are optional):
* following properties:
*
* - source: Where the message came from, one of "stdout" and "stderr".
* - format: Timestamp format, one of "date", "seconds" and "none".
* - time?: Timestamp of the message. Not present if format is "none".
* - type: Type of message, one of "log", "action" and "generic".
* - level?: Log level for "log" type. i.e "Info" normally.
* - file?: File reported for "log" type.
* - action?: Kind of action for "action" type. i.e "CHAT" for chat.
* - message: Main content of the line.
* @param {Object} output - parsed server output.
* @param {string} output.source -
* Where the message came from, one of "stdout" and "stderr".
* @param {string} output.format -
* Timestamp format, one of "date", "seconds" and "none".
* @param {string=} output.time -
* Timestamp of the message. Not present if format is "none".
* @param {string} output.type -
* Type of message, one of "log", "action" and "generic".
* @param {string=} output.level -
* Log level for "log" type. i.e "Info" normally.
* @param {string=} output.file - File reported for "log" type.
* @param {string=} output.action -
* Kind of action for "action" type. i.e "CHAT" for chat.
* @param {string} output.message - Main content of the line.
*/
async onOutput(output) { }
@@ -215,7 +227,7 @@ class BaseMasterPlugin {
* the Gauges/Counters/etc in onMetric and let Clusterio deal will
* collecting the values.
*
* @returns an async iterator of prometheus metric results or undefined.
* @returns {*} an async iterator of prometheus metric results or undefined.
*/
async onMetrics() { }
@@ -249,9 +261,9 @@ class BaseMasterPlugin {
*
* Invoked when the connection to the slave has been closed.
*
* @param {string} event - one of connect, drop, and close
* @param {module:master~SlaveConnection} connection -
* The connection the event occured on.
* @param {string} event - one of connect, drop, and close
*/
onSlaveConnectionEvent(connection, event) { }
@@ -311,6 +323,7 @@ class BaseMasterPlugin {
* module. Once loaded the info modules will not be reloaded should this
* function be called again.
*
* @param {string} baseDir - posix relative path to plugin directory.
* @returns {Map<string, Object>} mapping of plugin name to info module.
* @static
*/
@@ -350,7 +363,8 @@ async function loadPluginInfos(baseDir) {
*
* @param {module:lib/link.Link} link - Link to attach handlers to.
* @param {object} pluginInfo - Plugin info object.
* @param plugin - The instance of the plugin to use handlers from.
* @param {module:lib/plugin.BasePlugin} plugin -
* The instance of the plugin to use handlers from.
*/
function attachPluginMessages(link, pluginInfo, plugin) {
let messageDefinitions = pluginInfo.messages || [];
@@ -374,7 +388,7 @@ function attachPluginMessages(link, pluginInfo, plugin) {
/**
* Invokes the given hook on all plugins
*
* @param {Map<string, Object} plugins -
* @param {Map<string, Object>} plugins -
* Mapping of plugin names to plugins to invoke the hook on.
* @param {string} hook - Name of hook to invoke.
* @param {...*} args - Arguments to pass on to the hook.