Skip to content

Commit

Permalink
doc: fix generated comment errors (batch 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Jan 6, 2025
1 parent 15898fe commit 540821c
Show file tree
Hide file tree
Showing 27 changed files with 249 additions and 472 deletions.
5 changes: 0 additions & 5 deletions src/backend/src/modules/apps/ProtectedAppService.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const BaseService = require("../../services/BaseService");
* ensures that the owner of a protected app has implicit permission to access it.
*/
class ProtectedAppService extends BaseService {
/**
* Class representing a service for protected applications.
* Extends the BaseService class to provide additional functionality specific to protected apps.
*/

/**
* Initializes the ProtectedAppService.
* Registers a permission rewriter and implicator to handle application-specific permissions.
Expand Down
2 changes: 0 additions & 2 deletions src/backend/src/modules/core/AlarmService.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class AlarmService extends BaseService {
* This method initializes the AlarmService by setting up its internal data structures and initializing any required dependencies.
*
* It reads in the known errors from a JSON5 file and sets them as the known_errors property of the AlarmService instance.
*
* It also registers commands with the provided commands service.
*/
async _construct () {
this.alarms = {};
Expand Down
17 changes: 5 additions & 12 deletions src/backend/src/modules/core/ParameterService.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ const BaseService = require("../../services/BaseService");
* Parameters can have constraints, default values, and change listeners.
*/
class ParameterService extends BaseService {
/**
* Parameter service for managing system-wide parameters
* @extends BaseService
* @class
* @description Handles registration, storage, and access of parameters across services.
* Parameters can be bound to instances, subscribed to for changes, and accessed via commands.
* Each parameter has a unique service-scoped ID and optional constraints.
*/
_construct () {
/** @type {Array<Parameter>} */
this.parameters_ = [];
}

Expand Down Expand Up @@ -99,11 +92,11 @@ class ParameterService extends BaseService {
return parameter;
}

/**
* Registers parameter-related commands with the command service
* @param {Object} commands - The command service instance to register with
*/
_registerCommands (commands) {
/**
* Registers parameter-related commands with the command service
* @param {Object} commands - The command service instance to register with
*/
const completeParameterName = (args) => {
// The parameter name is the first argument, so return no results if we're on the second or later.
if (args.length > 1)
Expand Down
14 changes: 8 additions & 6 deletions src/backend/src/modules/core/ServerHealthService.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,27 @@ class ServerHealthService extends BaseService {
linuxutil: 'core.util.linuxutil'
};

static MODULES = {
fs: require('fs'),
}
/**
* Defines the modules used by ServerHealthService.
* This static property is used to initialize and access system modules required for health checks.
* @type {Object}
* @property {fs} fs - The file system module for reading system information.
*/
_construct () {
this.checks_ = [];
this.failures_ = [];
static MODULES = {
fs: require('fs'),
}

/**
* Initializes the internal checks and failure tracking for the service.
* This method sets up empty arrays to store health checks and their failure statuses.
*
* @private
*/
_construct () {
this.checks_ = [];
this.failures_ = [];
}

async _init () {
this.init_service_checks_();

Expand Down
1 change: 1 addition & 0 deletions src/backend/src/modules/puterfs/MountpointService.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const BaseService = require("../../services/BaseService");
* in situations where ContextInitService isn't able to
* initialize a context.
*/

/**
* @class MountpointService
* @extends BaseService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ class AuthAuditService extends BaseService {
static MODULES = {
uuidv4: require('uuid').v4,
}
/**
* Generates a unique identifier for the AuthAuditService module.
*
* @returns {Object} An object containing a method to generate a UUID v4.
*/

async _init () {
this.db = this.services.get('database').get(DB_WRITE, 'auth:audit');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class EdgeRateLimitService extends BaseService {
/**
* Initializes the EdgeRateLimitService by setting up a periodic cleanup interval.
* This method sets an interval that calls the cleanup function every 5 minutes.
* It does not take any parameters and does not return any value.
*/
async _init () {
asyncSafeSetInterval(() => this.cleanup(), 5 * MINUTE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,6 @@ class IdentificationService extends BaseService {
this.mw = new RequesterIdentificationExpressMiddleware();
}
/**
* Constructor for the IdentificationService class.
* Initializes the middleware for requester identification.
*/
_init () {
this.mw.log = this.log;
}
/**
* Initializes the middleware logger.
*
* This method sets the logger for the `RequesterIdentificationExpressMiddleware` instance.
Expand All @@ -194,6 +187,12 @@ class IdentificationService extends BaseService {
* @method
* @name _init
*/
_init () {
this.mw.log = this.log;
}
/**
* We need to listen to this event to install a context-aware middleware
*/
async ['__on_install.middlewares.context-aware'] (_, { app }) {
this.mw.install(app);
}
Expand Down
61 changes: 13 additions & 48 deletions src/backend/src/services/auth/Actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,24 @@ class Actor extends AdvancedBase {
});
}

constructor (o, ...a) {
super(o, ...a);
for ( const k in o ) {
this[k] = o[k];
}
}
/**
* Initializes the Actor instance with the provided parameters.
* This constructor assigns object properties from the input object to the instance.
*
* @param {Object} o - The object containing actor parameters.
* @param {...any} a - Additional arguments passed to the parent class constructor.
*/
constructor (o, ...a) {
super(o, ...a);
for ( const k in o ) {
this[k] = o[k];
}
}

get uid () {
return this.type.uid;
}

/**
* Generate a cryptographically-secure deterministic UUID
* from an actor's UID.
*/
/**
* Generates a cryptographically-secure deterministic UUID
* from an actor's UID. The generated UUID is derived by
Expand Down Expand Up @@ -155,14 +152,6 @@ class ActorType {
* and related type management.
*/
class SystemActorType extends ActorType {
/**
* Constructs a new instance of the actor type.
*
* @param {Object} o - The initial properties for the actor type.
* @param {...*} a - Additional arguments to pass to the super class constructor.
*
* @throws {Error} If there is an issue in initializing the actor type.
*/
get uid () {
return 'system';
}
Expand All @@ -181,12 +170,6 @@ class SystemActorType extends ActorType {
* user actors and define how they relate to other types of actors within the system.
*/
class UserActorType extends ActorType {
/**
* Constructs a new UserActorType instance.
*
* @param {Object} o - The initial properties to set on the instance.
* @param {...any} a - Additional arguments to pass to the constructor.
*/
get uid () {
return 'user:' + this.user.uuid;
}
Expand All @@ -204,17 +187,6 @@ class UserActorType extends ActorType {
* to cater to user-specific needs.
*/
class AppUnderUserActorType extends ActorType {
/**
* Create a new instance of the actor type, initializing it with the given parameters.
*
* This method first checks for associated user and app UIDs in the params,
* fetching their respective data asynchronously if present. It then
* constructs a new Actor with the provided type.
*
* @param {Function} type - The class constructor for the actor type.
* @param {Object} params - Initialization parameters for the actor (optional).
* @returns {Actor} A new instance of the Actor type.
*/
get uid () {
return 'app-under-user:' + this.user.uuid + ':' + this.app.uid;
}
Expand All @@ -240,14 +212,6 @@ class AccessTokenActorType extends ActorType {
// authorized: an Actor who is authorized by the token
// token: a string

/**
* Constructs an instance of AccessTokenActorType.
* This class represents an access token actor containing information
* about the authorizer and authorized actors, as well as the token string.
*
* @param {Object} o - The object containing properties to initialize the access token actor.
* @param {...*} a - Additional arguments for further initialization.
*/
get uid () {
return 'access-token:' + this.authorizer.uid +
':' + ( this.authorized?.uid ?? '<none>' ) +
Expand All @@ -274,18 +238,19 @@ class AccessTokenActorType extends ActorType {
* pertinent to site-level operations and interactions in the actor framework.
*/
class SiteActorType {
constructor (o, ...a) {
for ( const k in o ) {
this[k] = o[k];
}
}
/**
* Constructor for the SiteActorType class.
* Initializes a new instance of SiteActorType with the provided properties.
*
* @param {Object} o - The properties to initialize the SiteActorType with.
* @param {...*} a - Additional arguments.
*/
constructor (o, ...a) {
for ( const k in o ) {
this[k] = o[k];
}
}

get uid () {
return `site:` + this.site.name
}
Expand Down
10 changes: 5 additions & 5 deletions src/backend/src/services/auth/AntiCSRFService.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ const BaseService = require("../BaseService");


/**
* Class representing the AntiCSRFService, which extends BaseService.
* This service is responsible for issuing and managing anti-CSRF tokens
* to enhance security for web requests by validating session-based tokens
* and preventing cross-site request forgery attacks.
*/
* A utility class used by AntiCSRFService to manage a circular queue of
* CSRF tokens (or, as we like to call them, "anti-CSRF" tokens).
*
* A token expires when it is evicted from the queue.
*/
class CircularQueue {
constructor (size) {
this.size = size;
Expand Down
Loading

0 comments on commit 540821c

Please sign in to comment.