]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
docs: harmonize JSDoc @param/@returns across entire codebase
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 24 Mar 2026 16:54:43 +0000 (17:54 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 24 Mar 2026 16:54:43 +0000 (17:54 +0100)
- Add missing dash separator to @param tags in OCPP20VariableRegistry
  and OCPPServiceUtils (35 occurrences)
- Fill empty @param descriptions in Helpers, IdTagsCache,
  OCPPRequestService, and Worker modules (23 occurrences)
- Replace type-only @returns with meaningful descriptions

src/charging-station/Helpers.ts
src/charging-station/IdTagsCache.ts
src/charging-station/ocpp/2.0/OCPP20VariableRegistry.ts
src/charging-station/ocpp/OCPPRequestService.ts
src/charging-station/ocpp/OCPPServiceUtils.ts
src/worker/WorkerAbstract.ts
src/worker/WorkerDynamicPool.ts
src/worker/WorkerFixedPool.ts
src/worker/WorkerSet.ts

index 36f3ff68dd72fdf87e6aa82cff8be49ed2ec5816..3056a7bb741e4365250753d85b88d20bde9c3405 100644 (file)
@@ -805,7 +805,7 @@ export const getChargingStationChargingProfilesLimit = (
  * and sorted by priorities
  * @param chargingStation - Charging station
  * @param connectorId - Connector id
- * @returns connector charging profiles array
+ * @returns Connector charging profiles array
  */
 export const getConnectorChargingProfiles = (
   chargingStation: ChargingStation,
@@ -1069,9 +1069,9 @@ const getSingleChargingSchedule = (
 /**
  * Get the charging profiles limit for a connector
  * Charging profiles shall already be sorted by priorities
- * @param chargingStation -
- * @param connectorId -
- * @param chargingProfiles -
+ * @param chargingStation - The charging station instance
+ * @param connectorId - The connector identifier
+ * @param chargingProfiles - Array of charging profiles
  * @returns ChargingProfilesLimit
  */
 const getChargingProfilesLimit = (
@@ -1366,10 +1366,10 @@ const canProceedRecurringChargingProfile = (
 
 /**
  * Adjust recurring charging profile startSchedule to the current recurrency time interval if needed
- * @param chargingProfile -
- * @param currentDate -
- * @param logPrefix -
- * @returns boolean
+ * @param chargingProfile - The charging profile to adjust
+ * @param currentDate - The current date/time
+ * @param logPrefix - Prefix for logging messages
+ * @returns Whether the charging profile is active at the given date
  */
 const prepareRecurringChargingProfile = (
   chargingProfile: ChargingProfile,
index a73dcfa989839ab85f37fe9f7b68d322b38ed51f..166280c865c33d52e858bd7369c8a1df065949cc 100644 (file)
@@ -41,10 +41,10 @@ export class IdTagsCache {
   /**
    * Gets one idtag from the cache given the distribution
    * Must be called after checking the cache is not an empty array
-   * @param distribution -
-   * @param chargingStation -
-   * @param connectorId -
-   * @returns string
+   * @param distribution - The distribution strategy for selecting an idtag
+   * @param chargingStation - The charging station instance
+   * @param connectorId - The connector identifier
+   * @returns Selected idtag string
    */
   public getIdTag (
     distribution: IdTagDistribution,
@@ -71,8 +71,8 @@ export class IdTagsCache {
   /**
    * Gets all idtags from the cache
    * Must be called after checking the cache is not an empty array
-   * @param file -
-   * @returns string[] | undefined
+   * @param file - The idtags file path
+   * @returns Array of idtag strings or undefined if not cached
    */
   public getIdTags (file: string): string[] | undefined {
     if (!this.hasIdTagsCache(file)) {
index 470ef54d06b9b00dd472980b33ead70b64c2be71..da809ee36fcb822e2c8fbde4bd74f50de977116e 100644 (file)
@@ -91,9 +91,9 @@ export interface VariableMetadata {
  * 2. Case-insensitive composite key (lookup convenience): `${component}[.<instance>].${variable}` all lower case
  *    - Built with buildCaseInsensitiveCompositeKey().
  * Rationale: Maintain original case for canonical metadata storage while offering tolerant lookups.
- * @param component Component name.
- * @param variable Variable name.
- * @param instance Optional instance qualifier.
+ * @param component Component name.
+ * @param variable Variable name.
+ * @param instance Optional instance qualifier.
  * @returns Primary registry key string.
  */
 function buildRegistryKey (component: string, variable: string, instance?: string): string {
@@ -2375,9 +2375,9 @@ export const VARIABLE_REGISTRY: Record<string, VariableMetadata> = {
 /**
  * Build composite lookup key (lower-cased) including optional instance.
  * Format: `component[.instance].variable` all lower case.
- * @param component Component name.
- * @param instance Optional instance qualifier.
- * @param variable Variable name.
+ * @param component Component name.
+ * @param instance Optional instance qualifier.
+ * @param variable Variable name.
  * @returns Lower-case composite key for lookup.
  */
 export function buildCaseInsensitiveCompositeKey (
@@ -2398,9 +2398,9 @@ const VARIABLE_REGISTRY_LOOKUP_CI: Record<string, VariableMetadata> = Object.val
 
 /**
  * Apply optional metadata post-processing to a resolved variable value.
- * @param chargingStation Charging station context.
- * @param variableMetadata Variable metadata entry.
- * @param value Resolved raw value.
+ * @param chargingStation Charging station context.
+ * @param variableMetadata Variable metadata entry.
+ * @param value Resolved raw value.
  * @returns Post-processed value (or original when no postProcess defined).
  */
 export function applyPostProcess (
@@ -2416,8 +2416,8 @@ export function applyPostProcess (
 
 /**
  * Enforce reporting/value size limit on a string.
- * @param value Incoming value string.
- * @param sizeLimitRaw Raw size limit value (string form).
+ * @param value Incoming value string.
+ * @param sizeLimitRaw Raw size limit value (string form).
  * @returns Possibly truncated value respecting size limit.
  */
 export function enforceReportingValueSize (value: string, sizeLimitRaw: string): string {
@@ -2430,9 +2430,9 @@ export function enforceReportingValueSize (value: string, sizeLimitRaw: string):
 
 /**
  * Retrieve variable metadata with case-insensitive fallback.
- * @param component Component name.
- * @param variable Variable name.
- * @param instance Optional instance qualifier.
+ * @param component Component name.
+ * @param variable Variable name.
+ * @param instance Optional instance qualifier.
  * @returns Matching variable metadata or undefined.
  */
 export function getVariableMetadata (
@@ -2459,7 +2459,7 @@ export function getVariableMetadata (
 
 /**
  * Check if variable metadata is persistent.
- * @param variableMetadata Variable metadata entry.
+ * @param variableMetadata Variable metadata entry.
  * @returns True when persistence is Persistent.
  */
 export function isPersistent (variableMetadata: VariableMetadata): boolean {
@@ -2468,7 +2468,7 @@ export function isPersistent (variableMetadata: VariableMetadata): boolean {
 
 /**
  * Check if variable metadata is read-only.
- * @param variableMetadata Variable metadata entry.
+ * @param variableMetadata Variable metadata entry.
  * @returns True when mutability is ReadOnly.
  */
 export function isReadOnly (variableMetadata: VariableMetadata): boolean {
@@ -2477,7 +2477,7 @@ export function isReadOnly (variableMetadata: VariableMetadata): boolean {
 
 /**
  * Check if variable metadata is write-only.
- * @param variableMetadata Variable metadata entry.
+ * @param variableMetadata Variable metadata entry.
  * @returns True when mutability is WriteOnly.
  */
 export function isWriteOnly (variableMetadata: VariableMetadata): boolean {
@@ -2486,8 +2486,8 @@ export function isWriteOnly (variableMetadata: VariableMetadata): boolean {
 
 /**
  * Resolve variable value using dynamicValueResolver if present else defaultValue.
- * @param chargingStation Charging station context.
- * @param variableMetadata Variable metadata entry.
+ * @param chargingStation Charging station context.
+ * @param variableMetadata Variable metadata entry.
  * @returns Resolved value string (empty when no default).
  */
 export function resolveValue (
@@ -2503,8 +2503,8 @@ export function resolveValue (
 /**
  * Validate raw value against variable metadata constraints.
  * Performs length, datatype specific and enumeration checks.
- * @param variableMetadata Variable metadata entry.
- * @param rawValue Raw value string to validate.
+ * @param variableMetadata Variable metadata entry.
+ * @param rawValue Raw value string to validate.
  * @returns Validation result with ok flag and optional reason/info.
  */
 export function validateValue (
@@ -2721,7 +2721,7 @@ export function validateValue (
 
 /**
  * Validate URL using generic parsing (any scheme accepted).
- * @param value Raw URL string.
+ * @param value Raw URL string.
  * @returns Validation result with ok flag and optional reason/info.
  */
 function validateGenericUrl (value: string): {
@@ -2737,8 +2737,8 @@ function validateGenericUrl (value: string): {
 
 /**
  * Validate URL scheme against an allowed list after generic format check.
- * @param value Raw URL string.
- * @param allowedSchemes Allowed protocol schemes (with trailing colon).
+ * @param value Raw URL string.
+ * @param allowedSchemes Allowed protocol schemes (with trailing colon).
  * @returns Validation result with ok flag and optional reason/info.
  */
 function validateUrlScheme (
index 3a39a37330491df6fa817d03202f480266656dbc..a365828cf4e68025e39fdd603dae40fca9ef9c9a 100644 (file)
@@ -345,8 +345,8 @@ export abstract class OCPPRequestService {
       return await new Promise<ResponseType>((resolve, reject: (reason?: unknown) => void) => {
         /**
          * Function that will receive the request's response
-         * @param payload -
-         * @param requestPayload -
+         * @param payload - The response payload
+         * @param requestPayload - The original request payload
          */
         const responseCallback = (payload: JsonType, requestPayload: JsonType): void => {
           if (chargingStation.stationInfo?.enableStatistics === true) {
@@ -376,8 +376,8 @@ export abstract class OCPPRequestService {
 
         /**
          * Function that will receive the request's error response
-         * @param ocppError -
-         * @param requestStatistic -
+         * @param ocppError - The OCPP error response
+         * @param requestStatistic - Whether to record request statistics
          */
         const errorCallback = (ocppError: OCPPError, requestStatistic = true): void => {
           if (requestStatistic && chargingStation.stationInfo?.enableStatistics === true) {
index 2b7b1304f38667ed39449d60e1366fcf56766093..f502a87986569d49cd8d2ca09c4f73c147fbba49 100644 (file)
@@ -2115,11 +2115,11 @@ const getSampledValueTemplate = (
 
 /**
  * Builds a sampled value object according to the specified OCPP version.
- * @param ocppVersion The OCPP version to use for formatting the sampled value
- * @param sampledValueTemplate Template containing measurement configuration and metadata
- * @param value The measured numeric value to be included in the sampled value
- * @param context Optional context specifying when the measurement was taken (e.g., Sample.Periodic)
- * @param phase Optional phase information for multi-phase electrical measurements
+ * @param ocppVersion The OCPP version to use for formatting the sampled value
+ * @param sampledValueTemplate Template containing measurement configuration and metadata
+ * @param value The measured numeric value to be included in the sampled value
+ * @param context Optional context specifying when the measurement was taken (e.g., Sample.Periodic)
+ * @param phase Optional phase information for multi-phase electrical measurements
  * @returns A sampled value object formatted according to the specified OCPP version
  */
 function buildSampledValue (
@@ -2380,13 +2380,13 @@ export class OCPPServiceUtils {
   /**
    * Creates a Map of compiled OCPP payload validators from configurations.
    * Reduces code duplication across OCPP services.
-   * @param configs Array of tuples containing command and validator configuration
-   * @param options Factory options including OCPP version, schema directory, etc.
-   * @param options.ocppVersion The OCPP version for schema validation
-   * @param options.schemaDir Directory path containing JSON schemas
-   * @param options.moduleName Name of the module for logging
-   * @param options.methodName Name of the method for logging
-   * @param ajvInstance Configured Ajv instance for validation
+   * @param configs Array of tuples containing command and validator configuration
+   * @param options Factory options including OCPP version, schema directory, etc.
+   * @param options.ocppVersion The OCPP version for schema validation
+   * @param options.schemaDir Directory path containing JSON schemas
+   * @param options.moduleName Name of the module for logging
+   * @param options.methodName Name of the method for logging
+   * @param ajvInstance Configured Ajv instance for validation
    * @returns Map of commands to their compiled validation functions
    */
   public static createPayloadValidatorMap<Command extends JsonType>(
@@ -2491,7 +2491,7 @@ export class OCPPServiceUtils {
 
   /**
    * Configuration for a single payload validator.
-   * @param schemaPath Path to the JSON schema file
+   * @param schemaPath Path to the JSON schema file
    * @returns Configuration object for payload validator creation
    */
   public static readonly PayloadValidatorConfig = (schemaPath: string) =>
@@ -2501,10 +2501,10 @@ export class OCPPServiceUtils {
 
   /**
    * Options for payload validator creation.
-   * @param ocppVersion The OCPP version
-   * @param schemaDir Directory containing JSON schemas
-   * @param moduleName Name of the OCPP module
-   * @param methodName Name of the method/command
+   * @param ocppVersion The OCPP version
+   * @param schemaDir Directory containing JSON schemas
+   * @param moduleName Name of the OCPP module
+   * @param methodName Name of the method/command
    * @returns Options object for payload validator creation
    */
   public static readonly PayloadValidatorOptions = (
@@ -2523,10 +2523,10 @@ export class OCPPServiceUtils {
   /**
    * Parses and loads a JSON schema file for OCPP payload validation.
    * Handles file reading and JSON parsing for schema validation.
-   * @param relativePath Path to the schema file relative to the OCPP utils directory
-   * @param ocppVersion The OCPP version for error logging context
-   * @param moduleName Optional module name for error logging
-   * @param methodName Optional method name for error logging
+   * @param relativePath Path to the schema file relative to the OCPP utils directory
+   * @param ocppVersion The OCPP version for error logging context
+   * @param moduleName Optional module name for error logging
+   * @param methodName Optional method name for error logging
    * @returns Parsed JSON schema object
    * @throws {NodeJS.ErrnoException} If the schema file cannot be read or parsed
    */
index a38db441b92f8523e7c7018c34317e8f96cb95a0..c63af4f4bb5e774423be5204314eed74f5c6387a 100644 (file)
@@ -16,8 +16,8 @@ export abstract class WorkerAbstract<D extends WorkerData, R extends WorkerData>
 
   /**
    * `WorkerAbstract` constructor.
-   * @param workerScript -
-   * @param workerOptions -
+   * @param workerScript - Path to the worker script file
+   * @param workerOptions - Worker configuration options
    */
   constructor (workerScript: string | undefined, workerOptions: WorkerOptions) {
     if (workerScript == null) {
@@ -42,7 +42,7 @@ export abstract class WorkerAbstract<D extends WorkerData, R extends WorkerData>
 
   /**
    * Adds a task element to the worker pool/set.
-   * @param elementData -
+   * @param elementData - The element data to process
    */
   public abstract addElement (elementData: D): Promise<R>
   /**
index f7ed91b1d91b08a2436dcc51636a597631958ffd..66febb575be54e7f6192267a0c1c1c887076159e 100644 (file)
@@ -31,8 +31,8 @@ export class WorkerDynamicPool<D extends WorkerData, R extends WorkerData> exten
 
   /**
    * Creates a new `WorkerDynamicPool`.
-   * @param workerScript -
-   * @param workerOptions -
+   * @param workerScript - Path to the worker script file
+   * @param workerOptions - Worker pool configuration options
    */
   constructor (workerScript: string, workerOptions: WorkerOptions) {
     super(workerScript, workerOptions)
index f5d9b01e87c73a7ef88ea5306061329e1fe379b3..c05864d1b78fa2d951c2c1f33d59b1e02a5b1304 100644 (file)
@@ -31,8 +31,8 @@ export class WorkerFixedPool<D extends WorkerData, R extends WorkerData> extends
 
   /**
    * Creates a new `WorkerFixedPool`.
-   * @param workerScript -
-   * @param workerOptions -
+   * @param workerScript - Path to the worker script file
+   * @param workerOptions - Worker pool configuration options
    */
   constructor (workerScript: string, workerOptions: WorkerOptions) {
     super(workerScript, workerOptions)
index c5ae6ed2b70c33a986bd02c04fb86a83d084ed8b..78a47e72609ba02d47338849ef02ef038cb79099 100644 (file)
@@ -59,8 +59,8 @@ export class WorkerSet<D extends WorkerData, R extends WorkerData> extends Worke
 
   /**
    * Creates a new `WorkerSet`.
-   * @param workerScript -
-   * @param workerOptions -
+   * @param workerScript - Path to the worker script file
+   * @param workerOptions - Worker set configuration options
    */
   constructor (workerScript: string, workerOptions: WorkerOptions) {
     super(workerScript, workerOptions)