]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor: align intermediate variable naming with codebase conventions
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Mar 2026 19:54:42 +0000 (20:54 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 27 Mar 2026 20:01:49 +0000 (21:01 +0100)
Systematic rename of 24 variables to follow established patterns:
- connector → connectorStatus for ConnectorStatus values (8 decls + params)
- Stats → Statistics: workerScriptStats, strategyStats, cacheStats (5)
- Config → Configuration: newConfig, authConfig, logConfig, configData (7)
- entry → descriptive names: ipRateLimitEntry, authCacheEntry,
  rateLimitEntry, variableGroupEntry, pairedBoundsEntry (6)
- Fix variable shadowing in OCPP20ServiceUtils.startPeriodicMeterValues
  by naming outer setup variable initialConnectorStatus

13 files changed:
src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts
src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts
src/charging-station/ocpp/2.0/OCPP20VariableManager.ts
src/charging-station/ocpp/OCPPServiceUtils.ts
src/charging-station/ocpp/auth/cache/InMemoryAuthCache.ts
src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts
src/charging-station/ocpp/auth/strategies/LocalAuthStrategy.ts
src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts
src/charging-station/ocpp/auth/utils/AuthValidators.ts
src/charging-station/ui-server/UIServerSecurity.ts
src/charging-station/ui-server/mcp/MCPTools.ts
src/utils/Configuration.ts
src/worker/WorkerAbstract.ts

index 7f88d8feaba696ffbbd9e0c55e3f9c297c3cf174..ed17e2d6fc19b8270ce35adda12413b09fe4d847 100644 (file)
@@ -882,9 +882,9 @@ export class OCPP20IncomingRequestService extends OCPPIncomingRequestService {
               })
             }
             if (r.attributeStatus === GetVariableStatusEnumType.Accepted) {
-              const entry = grouped.get(key)
-              if (entry) {
-                entry.attributes.push({
+              const variableGroupEntry = grouped.get(key)
+              if (variableGroupEntry) {
+                variableGroupEntry.attributes.push({
                   type: r.attributeType ?? AttributeEnumType.Actual,
                   value: r.attributeValue,
                 })
index 1f5ee248fec90d71728a5cc3bf3a1964a1c64734..f2e4d29f60a9760ec9c1e809a77509f1a0ffdda0 100644 (file)
@@ -569,8 +569,8 @@ export class OCPP20ServiceUtils extends OCPPServiceUtils {
     connectorId: number,
     interval: number
   ): void {
-    const connector = chargingStation.getConnectorStatus(connectorId)
-    if (connector == null) {
+    const initialConnectorStatus = chargingStation.getConnectorStatus(connectorId)
+    if (initialConnectorStatus == null) {
       logger.error(
         `${chargingStation.logPrefix()} ${moduleName}.startPeriodicMeterValues: Connector ${connectorId.toString()} not found`
       )
@@ -582,13 +582,13 @@ export class OCPP20ServiceUtils extends OCPPServiceUtils {
       )
       return
     }
-    if (connector.transactionMeterValuesSetInterval != null) {
+    if (initialConnectorStatus.transactionMeterValuesSetInterval != null) {
       logger.warn(
         `${chargingStation.logPrefix()} ${moduleName}.startPeriodicMeterValues: TxUpdatedInterval already started, stopping first`
       )
       OCPP20ServiceUtils.stopPeriodicMeterValues(chargingStation, connectorId)
     }
-    connector.transactionMeterValuesSetInterval = setInterval(() => {
+    initialConnectorStatus.transactionMeterValuesSetInterval = setInterval(() => {
       const connectorStatus = chargingStation.getConnectorStatus(connectorId)
       if (connectorStatus?.transactionStarted === true && connectorStatus.transactionId != null) {
         if (
@@ -710,10 +710,10 @@ export class OCPP20ServiceUtils extends OCPPServiceUtils {
     chargingStation: ChargingStation,
     connectorId: number
   ): void {
-    const connector = chargingStation.getConnectorStatus(connectorId)
-    if (connector?.transactionMeterValuesSetInterval != null) {
-      clearInterval(connector.transactionMeterValuesSetInterval)
-      delete connector.transactionMeterValuesSetInterval
+    const connectorStatus = chargingStation.getConnectorStatus(connectorId)
+    if (connectorStatus?.transactionMeterValuesSetInterval != null) {
+      clearInterval(connectorStatus.transactionMeterValuesSetInterval)
+      delete connectorStatus.transactionMeterValuesSetInterval
       logger.info(
         `${chargingStation.logPrefix()} ${moduleName}.stopPeriodicMeterValues: TxUpdatedInterval stopped`
       )
index 3acba831e8a0cc50949562b014a6254a75bf8423..4717498fed8df15ad5f38b9f91aac0d0ef94dc99 100644 (file)
@@ -141,13 +141,13 @@ export class OCPP20VariableManager {
         variableData.component.instance,
         variableData.variable.name
       )
-      const entry = pairedBounds.get(varKey) ?? {}
+      const pairedBoundsEntry = pairedBounds.get(varKey) ?? {}
       if (resolvedAttr === AttributeEnumType.MinSet) {
-        entry.minValue = variableData.attributeValue
+        pairedBoundsEntry.minValue = variableData.attributeValue
       } else {
-        entry.maxValue = variableData.attributeValue
+        pairedBoundsEntry.maxValue = variableData.attributeValue
       }
-      pairedBounds.set(varKey, entry)
+      pairedBounds.set(varKey, pairedBoundsEntry)
     }
 
     // Pre-apply coherent MinSet/MaxSet pairs so per-item cross-check sees paired values
index 8beae8f6a68b17b7daf42456334db1f124bc0fb9..d9d38c926e7ff487cefccfed90dde5b073751070 100644 (file)
@@ -807,7 +807,7 @@ const validateSocMeasurandValue = (
   socMaximumValue: number,
   debug: boolean
 ): void => {
-  const connector = chargingStation.getConnectorStatus(connectorId)
+  const connectorStatus = chargingStation.getConnectorStatus(connectorId)
   if (
     convertToInt(sampledValue.value) > socMaximumValue ||
     convertToInt(sampledValue.value) < socMinimumValue ||
@@ -817,7 +817,7 @@ const validateSocMeasurandValue = (
       `${chargingStation.logPrefix()} ${moduleName}.validateSocMeasurandValue: MeterValues measurand ${
         sampledValue.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-      }: connector id ${connectorId.toString()}, transaction id ${connector?.transactionId?.toString()}, value: ${socMinimumValue.toString()}/${sampledValue.value.toString()}/${socMaximumValue.toString()}`
+      }: connector id ${connectorId.toString()}, transaction id ${connectorStatus?.transactionId?.toString()}, value: ${socMinimumValue.toString()}/${sampledValue.value.toString()}/${socMaximumValue.toString()}`
     )
   }
 }
@@ -1030,21 +1030,21 @@ const buildEnergyMeasurandValue = (
 }
 
 const updateConnectorEnergyValues = (
-  connector: ConnectorStatus | undefined,
+  connectorStatus: ConnectorStatus | undefined,
   energyValue: number
 ): void => {
-  if (connector != null) {
+  if (connectorStatus != null) {
     if (
-      connector.energyActiveImportRegisterValue != null &&
-      connector.energyActiveImportRegisterValue >= 0 &&
-      connector.transactionEnergyActiveImportRegisterValue != null &&
-      connector.transactionEnergyActiveImportRegisterValue >= 0
+      connectorStatus.energyActiveImportRegisterValue != null &&
+      connectorStatus.energyActiveImportRegisterValue >= 0 &&
+      connectorStatus.transactionEnergyActiveImportRegisterValue != null &&
+      connectorStatus.transactionEnergyActiveImportRegisterValue >= 0
     ) {
-      connector.energyActiveImportRegisterValue += energyValue
-      connector.transactionEnergyActiveImportRegisterValue += energyValue
+      connectorStatus.energyActiveImportRegisterValue += energyValue
+      connectorStatus.transactionEnergyActiveImportRegisterValue += energyValue
     } else {
-      connector.energyActiveImportRegisterValue = 0
-      connector.transactionEnergyActiveImportRegisterValue = 0
+      connectorStatus.energyActiveImportRegisterValue = 0
+      connectorStatus.transactionEnergyActiveImportRegisterValue = 0
     }
   }
 }
@@ -1060,12 +1060,12 @@ const validateEnergyMeasurandValue = (
   debug: boolean
 ): void => {
   if (energyValue > maxValue || energyValue < minValue || debug) {
-    const connector = chargingStation.getConnectorStatus(connectorId)
+    const connectorStatus = chargingStation.getConnectorStatus(connectorId)
     logger.error(
       `${chargingStation.logPrefix()} ${moduleName}.validateEnergyMeasurandValue: MeterValues measurand ${
         sampledValue.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-      }: connector id ${connectorId.toString()}, transaction id ${connector?.transactionId?.toString()}, value: ${minValue.toString()}/${energyValue.toString()}/${maxValue.toString()}, duration: ${interval.toString()}ms`
+      }: connector id ${connectorId.toString()}, transaction id ${connectorStatus?.transactionId?.toString()}, value: ${minValue.toString()}/${energyValue.toString()}/${maxValue.toString()}, duration: ${interval.toString()}ms`
     )
   }
 }
@@ -1276,7 +1276,7 @@ const buildPowerMeasurandValue = (
 const validatePowerMeasurandValue = (
   chargingStation: ChargingStation,
   connectorId: number,
-  connector: ConnectorStatus | undefined,
+  connectorStatus: ConnectorStatus | undefined,
   sampledValue: SampledValue,
   connectorMaximumPower: number,
   connectorMinimumPower: number,
@@ -1291,7 +1291,7 @@ const validatePowerMeasurandValue = (
       `${chargingStation.logPrefix()} ${moduleName}.validatePowerMeasurandValue: MeterValues measurand ${
         sampledValue.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-      }: connector id ${connectorId.toString()}, transaction id ${connector?.transactionId?.toString()}, value: ${connectorMinimumPower.toString()}/${sampledValue.value.toString()}/${connectorMaximumPower.toString()}`
+      }: connector id ${connectorId.toString()}, transaction id ${connectorStatus?.transactionId?.toString()}, value: ${connectorMinimumPower.toString()}/${sampledValue.value.toString()}/${connectorMaximumPower.toString()}`
     )
   }
 }
@@ -1299,7 +1299,7 @@ const validatePowerMeasurandValue = (
 const validateCurrentMeasurandValue = (
   chargingStation: ChargingStation,
   connectorId: number,
-  connector: ConnectorStatus | undefined,
+  connectorStatus: ConnectorStatus | undefined,
   sampledValue: SampledValue,
   connectorMaximumAmperage: number,
   connectorMinimumAmperage: number,
@@ -1314,7 +1314,7 @@ const validateCurrentMeasurandValue = (
       `${chargingStation.logPrefix()} ${moduleName}.validateCurrentMeasurandValue: MeterValues measurand ${
         sampledValue.measurand ?? MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-      }: connector id ${connectorId.toString()}, transaction id ${connector?.transactionId?.toString()}, value: ${connectorMinimumAmperage.toString()}/${sampledValue.value.toString()}/${connectorMaximumAmperage.toString()}`
+      }: connector id ${connectorId.toString()}, transaction id ${connectorStatus?.transactionId?.toString()}, value: ${connectorMinimumAmperage.toString()}/${sampledValue.value.toString()}/${connectorMaximumAmperage.toString()}`
     )
   }
 }
@@ -1322,7 +1322,7 @@ const validateCurrentMeasurandValue = (
 const validateCurrentMeasurandPhaseValue = (
   chargingStation: ChargingStation,
   connectorId: number,
-  connector: ConnectorStatus | undefined,
+  connectorStatus: ConnectorStatus | undefined,
   sampledValue: SampledValue,
   connectorMaximumAmperage: number,
   connectorMinimumAmperage: number,
@@ -1340,7 +1340,7 @@ const validateCurrentMeasurandPhaseValue = (
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         sampledValue.phase
         // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-      }, connector id ${connectorId.toString()}, transaction id ${connector?.transactionId?.toString()}, value: ${connectorMinimumAmperage.toString()}/${sampledValue.value.toString()}/${connectorMaximumAmperage.toString()}`
+      }, connector id ${connectorId.toString()}, transaction id ${connectorStatus?.transactionId?.toString()}, value: ${connectorMinimumAmperage.toString()}/${sampledValue.value.toString()}/${connectorMaximumAmperage.toString()}`
     )
   }
 }
@@ -1563,7 +1563,7 @@ export const buildMeterValue = (
           RequestCommand.METER_VALUES
         )
       }
-      const connector = chargingStation.getConnectorStatus(connectorId)
+      const connectorStatus = chargingStation.getConnectorStatus(connectorId)
       const meterValue = buildEmptyMeterValue() as OCPP16MeterValue
       const buildVersionedSampledValue = (
         sampledValueTemplate: SampledValueTemplate,
@@ -1638,7 +1638,7 @@ export const buildMeterValue = (
         validatePowerMeasurandValue(
           chargingStation,
           connectorId,
-          connector,
+          connectorStatus,
           meterValue.sampledValue[sampledValuesIndex],
           connectorMaximumPower / unitDivider,
           connectorMinimumPower / unitDivider,
@@ -1667,7 +1667,7 @@ export const buildMeterValue = (
               validatePowerMeasurandValue(
                 chargingStation,
                 connectorId,
-                connector,
+                connectorStatus,
                 meterValue.sampledValue[sampledValuesPerPhaseIndex],
                 connectorMaximumPowerPerPhase / unitDivider,
                 connectorMinimumPowerPerPhase / unitDivider,
@@ -1702,7 +1702,7 @@ export const buildMeterValue = (
         validateCurrentMeasurandValue(
           chargingStation,
           connectorId,
-          connector,
+          connectorStatus,
           meterValue.sampledValue[sampledValuesIndex],
           connectorMaximumAmperage,
           connectorMinimumAmperage,
@@ -1728,7 +1728,7 @@ export const buildMeterValue = (
           validateCurrentMeasurandPhaseValue(
             chargingStation,
             connectorId,
-            connector,
+            connectorStatus,
             meterValue.sampledValue[sampledValuesPerPhaseIndex],
             connectorMaximumAmperage,
             connectorMinimumAmperage,
@@ -1739,7 +1739,7 @@ export const buildMeterValue = (
       // Energy.Active.Import.Register measurand (default)
       const energyMeasurand = buildEnergyMeasurandValue(chargingStation, connectorId, interval)
       if (energyMeasurand != null) {
-        updateConnectorEnergyValues(connector, energyMeasurand.value)
+        updateConnectorEnergyValues(connectorStatus, energyMeasurand.value)
         const unitDivider =
           energyMeasurand.template.unit === MeterValueUnit.KILO_WATT_HOUR ? 1000 : 1
         const energySampledValue = buildVersionedSampledValue(
@@ -1782,7 +1782,7 @@ export const buildMeterValue = (
           RequestCommand.METER_VALUES
         )
       }
-      const connector = chargingStation.getConnectorStatus(connectorId)
+      const connectorStatus = chargingStation.getConnectorStatus(connectorId)
       const meterValue = buildEmptyMeterValue() as OCPP20MeterValue
       const buildVersionedSampledValue = (
         sampledValueTemplate: SampledValueTemplate,
@@ -1849,7 +1849,7 @@ export const buildMeterValue = (
         evseId
       )
       if (energyMeasurand != null) {
-        updateConnectorEnergyValues(connector, energyMeasurand.value)
+        updateConnectorEnergyValues(connectorStatus, energyMeasurand.value)
         const unitDivider =
           energyMeasurand.template.unit === MeterValueUnit.KILO_WATT_HOUR ? 1000 : 1
         const energySampledValue = buildVersionedSampledValue(
index 26cdd3330c93eae853e08c13e155dbf232903073..aa6bbf4b8ead531ac916772e5e8da8f957354835 100644 (file)
@@ -175,32 +175,32 @@ export class InMemoryAuthCache implements AuthCache {
       return undefined
     }
 
-    const entry = this.cache.get(identifier)
+    const authCacheEntry = this.cache.get(identifier)
 
     // Cache miss
-    if (!entry) {
+    if (!authCacheEntry) {
       this.stats.misses++
       return undefined
     }
 
     // Check expiration
     const now = Date.now()
-    if (now >= entry.expiresAt) {
+    if (now >= authCacheEntry.expiresAt) {
       this.stats.expired++
       // Transition to EXPIRED status instead of deleting (C10.FR.08)
-      entry.result = { ...entry.result, status: AuthorizationStatus.EXPIRED }
+      authCacheEntry.result = { ...authCacheEntry.result, status: AuthorizationStatus.EXPIRED }
       // Apply absolute lifetime cap to expired-transition TTL refresh (default-TTL entries only)
-      if (!entry.hasExplicitTtl) {
-        const absoluteDeadline = entry.createdAt + this.maxAbsoluteLifetimeMs
+      if (!authCacheEntry.hasExplicitTtl) {
+        const absoluteDeadline = authCacheEntry.createdAt + this.maxAbsoluteLifetimeMs
         if (absoluteDeadline > now) {
-          entry.expiresAt = Math.min(now + this.defaultTtl * 1000, absoluteDeadline)
+          authCacheEntry.expiresAt = Math.min(now + this.defaultTtl * 1000, absoluteDeadline)
         }
       }
       this.lruOrder.set(identifier, now)
       logger.debug(
         `${moduleName}: Expired entry transitioned to EXPIRED for identifier: ${truncateId(identifier)}`
       )
-      return entry.result
+      return authCacheEntry.result
     }
 
     // Cache hit - update LRU order and reset TTL (C10.FR.08)
@@ -209,12 +209,15 @@ export class InMemoryAuthCache implements AuthCache {
 
     // Reset TTL on access for default-TTL entries only; explicit TTL entries (e.g. CSMS
     // cacheExpiryDateTime) keep their original expiration per OCPP spec.
-    if (!entry.hasExplicitTtl && entry.createdAt + this.maxAbsoluteLifetimeMs > now) {
-      entry.expiresAt = now + this.defaultTtl * 1000
+    if (
+      !authCacheEntry.hasExplicitTtl &&
+      authCacheEntry.createdAt + this.maxAbsoluteLifetimeMs > now
+    ) {
+      authCacheEntry.expiresAt = now + this.defaultTtl * 1000
     }
 
     logger.debug(`${moduleName}: Cache hit for identifier: ${truncateId(identifier)}`)
-    return entry.result
+    return authCacheEntry.result
   }
 
   /**
@@ -369,32 +372,32 @@ export class InMemoryAuthCache implements AuthCache {
     this.stats.rateLimitChecks++
 
     const now = Date.now()
-    const entry = this.rateLimits.get(identifier)
+    const rateLimitEntry = this.rateLimits.get(identifier)
 
     // No existing entry - create one
-    if (!entry) {
+    if (!rateLimitEntry) {
       this.rateLimits.set(identifier, { count: 1, windowStart: now })
       this.boundRateLimitsMap()
       return true
     }
 
     // Check if window has expired
-    const windowExpired = now - entry.windowStart >= this.rateLimit.windowMs
+    const windowExpired = now - rateLimitEntry.windowStart >= this.rateLimit.windowMs
     if (windowExpired) {
       // Reset window
-      entry.count = 1
-      entry.windowStart = now
+      rateLimitEntry.count = 1
+      rateLimitEntry.windowStart = now
       return true
     }
 
     // Within window - check count
-    if (entry.count >= this.rateLimit.maxRequests) {
+    if (rateLimitEntry.count >= this.rateLimit.maxRequests) {
       // Rate limit exceeded
       return false
     }
 
     // Increment count
-    entry.count++
+    rateLimitEntry.count++
     return true
   }
 
@@ -425,8 +428,11 @@ export class InMemoryAuthCache implements AuthCache {
     let candidateTime = Number.POSITIVE_INFINITY
 
     for (const [identifier, accessTime] of this.lruOrder.entries()) {
-      const entry = this.cache.get(identifier)
-      if (entry?.result.status !== AuthorizationStatus.ACCEPTED && accessTime < candidateTime) {
+      const authCacheEntry = this.cache.get(identifier)
+      if (
+        authCacheEntry?.result.status !== AuthorizationStatus.ACCEPTED &&
+        accessTime < candidateTime
+      ) {
         candidateTime = accessTime
         candidateIdentifier = identifier
       }
index 8420bc36365a167736f57e1b1752ef8092aa5870..58e87650a24d3741916d5f946d9d2f00baa7804c 100644 (file)
@@ -369,21 +369,21 @@ export class OCPPAuthServiceImpl implements OCPPAuthService {
         : 0
 
     // Get rate limiting stats from cache via remote strategy
-    let rateLimitStats:
+    let rateLimitStatistics:
       | undefined
       | { blockedRequests: number; rateLimitedIdentifiers: number; totalChecks: number }
     const remoteStrategy = this.strategies.get('remote')
     if (remoteStrategy?.getStats) {
-      const strategyStats = await remoteStrategy.getStats()
-      if ('cache' in strategyStats) {
-        const cacheStats = strategyStats.cache as {
+      const strategyStatistics = await remoteStrategy.getStats()
+      if ('cache' in strategyStatistics) {
+        const cacheStatistics = strategyStatistics.cache as {
           rateLimit?: {
             blockedRequests: number
             rateLimitedIdentifiers: number
             totalChecks: number
           }
         }
-        rateLimitStats = cacheStats.rateLimit
+        rateLimitStatistics = cacheStatistics.rateLimit
       }
     }
 
@@ -393,7 +393,7 @@ export class OCPPAuthServiceImpl implements OCPPAuthService {
       failedAuth: this.metrics.failedAuth,
       lastUpdatedDate: this.metrics.lastReset,
       localUsageRate: Math.round(localUsageRate * 10000) / 100,
-      rateLimit: rateLimitStats,
+      rateLimit: rateLimitStatistics,
       remoteSuccessRate: Math.round(remoteSuccessRate * 10000) / 100,
       successfulAuth: this.metrics.successfulAuth,
       totalRequests: this.metrics.totalRequests,
@@ -587,13 +587,13 @@ export class OCPPAuthServiceImpl implements OCPPAuthService {
    */
   public updateConfiguration (config: Partial<AuthConfiguration>): void {
     // Merge new config with existing
-    const newConfig = { ...this.config, ...config }
+    const newConfiguration = { ...this.config, ...config }
 
     // Validate merged configuration
-    AuthConfigValidator.validate(newConfig)
+    AuthConfigValidator.validate(newConfiguration)
 
     // Apply validated configuration
-    this.config = newConfig
+    this.config = newConfiguration
 
     logger.info(
       `${this.chargingStation.logPrefix()} ${moduleName}.updateConfiguration: Authentication configuration updated`
index d80f1a046cb5a5a190554824b1c65e4a2365e552..3f0b7bcace5c9b08f2777e2550f9f692a2d3a54d 100644 (file)
@@ -207,13 +207,13 @@ export class LocalAuthStrategy implements AuthStrategy {
    * @returns Strategy statistics including hit rates, request counts, and cache status
    */
   public getStats (): JsonObject {
-    const cacheStats = this.authCache ? this.authCache.getStats() : null
+    const cacheStatistics = this.authCache ? this.authCache.getStats() : null
 
     return {
       ...this.stats,
       cacheHitRate:
         this.stats.totalRequests > 0 ? (this.stats.cacheHits / this.stats.totalRequests) * 100 : 0,
-      cacheStats,
+      cacheStatistics,
       hasAuthCache: !!this.authCache,
       hasLocalAuthListManager: !!this.localAuthListManager,
       isInitialized: this.isInitialized,
index bae4ac19d673616e8cef6b35e1491bd5566cc48e..f716257b008813e689dfa67c8ae5e109b4367e6d 100644 (file)
@@ -218,7 +218,7 @@ export class RemoteAuthStrategy implements AuthStrategy {
    * @returns Strategy statistics including success rates, response times, and error counts
    */
   public async getStats (): Promise<JsonObject> {
-    const cacheStats = this.authCache ? this.authCache.getStats() : null
+    const cacheStatistics = this.authCache ? this.authCache.getStats() : null
 
     let adapterAvailable = false
     if (this.adapter) {
@@ -232,7 +232,7 @@ export class RemoteAuthStrategy implements AuthStrategy {
     return {
       ...this.stats,
       adapterAvailable,
-      cacheStats,
+      cacheStatistics,
       hasAdapter: this.adapter != null,
       hasAuthCache: !!this.authCache,
       isInitialized: this.isInitialized,
index a8e18f10a3ea52d9b318c295c2d3afc55517c304..250f1a1735ce82d4b0cdf0bdaa1904347ad057e6 100644 (file)
@@ -101,40 +101,43 @@ function validateAuthConfiguration (config: unknown): boolean {
     return false
   }
 
-  const authConfig = config as AuthConfiguration
+  const authConfiguration = config as AuthConfiguration
 
   // Validate required boolean fields exist
   if (
-    typeof authConfig.authorizationCacheEnabled !== 'boolean' ||
-    typeof authConfig.localAuthListEnabled !== 'boolean' ||
-    typeof authConfig.offlineAuthorizationEnabled !== 'boolean' ||
-    typeof authConfig.allowOfflineTxForUnknownId !== 'boolean' ||
-    typeof authConfig.localPreAuthorize !== 'boolean' ||
-    typeof authConfig.certificateAuthEnabled !== 'boolean'
+    typeof authConfiguration.authorizationCacheEnabled !== 'boolean' ||
+    typeof authConfiguration.localAuthListEnabled !== 'boolean' ||
+    typeof authConfiguration.offlineAuthorizationEnabled !== 'boolean' ||
+    typeof authConfiguration.allowOfflineTxForUnknownId !== 'boolean' ||
+    typeof authConfiguration.localPreAuthorize !== 'boolean' ||
+    typeof authConfiguration.certificateAuthEnabled !== 'boolean'
   ) {
     return false
   }
 
   // Validate authorization timeout (required, must be positive)
-  if (typeof authConfig.authorizationTimeout !== 'number' || authConfig.authorizationTimeout <= 0) {
+  if (
+    typeof authConfiguration.authorizationTimeout !== 'number' ||
+    authConfiguration.authorizationTimeout <= 0
+  ) {
     return false
   }
 
   // Validate optional cache lifetime if provided
   if (
-    authConfig.authorizationCacheLifetime !== undefined &&
-    (typeof authConfig.authorizationCacheLifetime !== 'number' ||
-      authConfig.authorizationCacheLifetime < 0)
+    authConfiguration.authorizationCacheLifetime !== undefined &&
+    (typeof authConfiguration.authorizationCacheLifetime !== 'number' ||
+      authConfiguration.authorizationCacheLifetime < 0)
   ) {
     return false
   }
 
   // Validate optional max cache entries if provided
   if (
-    authConfig.maxCacheEntries !== undefined &&
-    (typeof authConfig.maxCacheEntries !== 'number' ||
-      authConfig.maxCacheEntries < 1 ||
-      !Number.isInteger(authConfig.maxCacheEntries))
+    authConfiguration.maxCacheEntries !== undefined &&
+    (typeof authConfiguration.maxCacheEntries !== 'number' ||
+      authConfiguration.maxCacheEntries < 1 ||
+      !Number.isInteger(authConfiguration.maxCacheEntries))
   ) {
     return false
   }
index 6295cf54894964418c581d7749508b43a5ece822..fa5b9a83ba8ec60bb1d272b56354a7f49b4961cd 100644 (file)
@@ -68,9 +68,9 @@ export const createRateLimiter = (
       }
     }
 
-    const entry = trackedIps.get(ipAddress)
+    const ipRateLimitEntry = trackedIps.get(ipAddress)
 
-    if (entry === undefined || now >= entry.resetTime) {
+    if (ipRateLimitEntry === undefined || now >= ipRateLimitEntry.resetTime) {
       trackedIps.set(ipAddress, {
         count: 1,
         resetTime: now + windowMs,
@@ -78,8 +78,8 @@ export const createRateLimiter = (
       return true
     }
 
-    if (entry.count < maxRequests) {
-      entry.count++
+    if (ipRateLimitEntry.count < maxRequests) {
+      ipRateLimitEntry.count++
       return true
     }
 
index 22d5aef49c844c551d3a43027e25198d632d2819..a31b49a5add95fc571c43a365ace748f512dd9e7 100644 (file)
@@ -12,14 +12,14 @@ const DEFAULT_TAIL_LINES = 200
 const TAIL_BYTES = 65_536
 
 const getLogFilePath = (configField: 'errorFile' | 'file', date?: string): string | undefined => {
-  const logConfig = Configuration.getConfigurationSection<LogConfiguration>(
+  const logConfiguration = Configuration.getConfigurationSection<LogConfiguration>(
     ConfigurationSection.log
   )
-  const relativePath = logConfig[configField]
+  const relativePath = logConfiguration[configField]
   if (relativePath == null) {
     return undefined
   }
-  if (logConfig.rotate !== true) {
+  if (logConfiguration.rotate !== true) {
     return resolve(relativePath)
   }
   const now = new Date()
index a3a16cfebd387e644480f32ce3e260bf92865058..a7745520a9797b8725768d715749706687dca576 100644 (file)
@@ -178,11 +178,11 @@ export class Configuration {
     if (
       Configuration.getConfigurationData()?.['supervisionURLs' as keyof ConfigurationData] != null
     ) {
-      const configData = Configuration.getConfigurationData()
-      if (configData != null) {
-        configData.supervisionUrls = configData['supervisionURLs' as keyof ConfigurationData] as
-          | string
-          | string[]
+      const configurationData = Configuration.getConfigurationData()
+      if (configurationData != null) {
+        configurationData.supervisionUrls = configurationData[
+          'supervisionURLs' as keyof ConfigurationData
+        ] as string | string[]
       }
     }
     return Configuration.getConfigurationData()?.supervisionUrls
@@ -206,7 +206,7 @@ export class Configuration {
   }
 
   private static buildLogSection (): LogConfiguration {
-    const configData = Configuration.getConfigurationData()
+    const configurationData = Configuration.getConfigurationData()
     const deprecatedLogKeyMap: [keyof ConfigurationData, keyof LogConfiguration][] = [
       ['logEnabled', 'enabled'],
       ['logFile', 'file'],
@@ -221,14 +221,14 @@ export class Configuration {
     ]
     const deprecatedLogConfiguration: Record<string, unknown> = {}
     for (const [deprecatedKey, newKey] of deprecatedLogKeyMap) {
-      if (has(deprecatedKey, configData)) {
-        deprecatedLogConfiguration[newKey] = configData?.[deprecatedKey]
+      if (has(deprecatedKey, configurationData)) {
+        deprecatedLogConfiguration[newKey] = configurationData?.[deprecatedKey]
       }
     }
     const logConfiguration: LogConfiguration = {
       ...defaultLogConfiguration,
       ...(deprecatedLogConfiguration as Partial<LogConfiguration>),
-      ...(has(ConfigurationSection.log, configData) && configData?.log),
+      ...(has(ConfigurationSection.log, configurationData) && configurationData?.log),
     }
     return logConfiguration
   }
@@ -290,7 +290,7 @@ export class Configuration {
   }
 
   private static buildWorkerSection (): WorkerConfiguration {
-    const configData = Configuration.getConfigurationData()
+    const configurationData = Configuration.getConfigurationData()
     const deprecatedWorkerKeyMap: [keyof ConfigurationData, keyof WorkerConfiguration][] = [
       ['workerProcess', 'processType'],
       ['workerStartDelay', 'startDelay'],
@@ -301,22 +301,22 @@ export class Configuration {
     ]
     const deprecatedWorkerConfiguration: Record<string, unknown> = {}
     for (const [deprecatedKey, newKey] of deprecatedWorkerKeyMap) {
-      if (has(deprecatedKey, configData)) {
-        deprecatedWorkerConfiguration[newKey] = configData?.[deprecatedKey]
+      if (has(deprecatedKey, configurationData)) {
+        deprecatedWorkerConfiguration[newKey] = configurationData?.[deprecatedKey]
       }
     }
-    if (has('elementStartDelay', configData?.worker)) {
+    if (has('elementStartDelay', configurationData?.worker)) {
       // eslint-disable-next-line @typescript-eslint/no-deprecated -- intentional deprecated key migration
-      deprecatedWorkerConfiguration.elementAddDelay = configData?.worker?.elementStartDelay
+      deprecatedWorkerConfiguration.elementAddDelay = configurationData?.worker?.elementStartDelay
     }
-    if (configData != null) {
+    if (configurationData != null) {
       // eslint-disable-next-line @typescript-eslint/no-deprecated -- intentional deprecated key removal
-      delete configData.workerPoolStrategy
+      delete configurationData.workerPoolStrategy
     }
     const workerConfiguration: WorkerConfiguration = {
       ...defaultWorkerConfiguration,
       ...(deprecatedWorkerConfiguration as Partial<WorkerConfiguration>),
-      ...(has(ConfigurationSection.worker, configData) && configData?.worker),
+      ...(has(ConfigurationSection.worker, configurationData) && configurationData?.worker),
     }
     if (workerConfiguration.processType != null) {
       checkWorkerProcessType(workerConfiguration.processType)
@@ -483,9 +483,9 @@ export class Configuration {
       Configuration.getConfigurationData()?.['stationTemplateURLs' as keyof ConfigurationData] !=
       null
     ) {
-      const configData = Configuration.getConfigurationData()
-      if (configData != null) {
-        configData.stationTemplateUrls = configData[
+      const configurationData = Configuration.getConfigurationData()
+      if (configurationData != null) {
+        configurationData.stationTemplateUrls = configurationData[
           'stationTemplateURLs' as keyof ConfigurationData
         ] as StationTemplateUrl[]
       }
index c63af4f4bb5e774423be5204314eed74f5c6387a..a2946a1f8e6533bed7c5cb2a98ce61db9f1c4c27 100644 (file)
@@ -29,11 +29,11 @@ export abstract class WorkerAbstract<D extends WorkerData, R extends WorkerData>
     if (workerScript.trim().length === 0) {
       throw new Error('Worker script is an empty string')
     }
-    const workerScriptStats = statSync(workerScript, { throwIfNoEntry: false })
-    if (workerScriptStats == null) {
+    const workerScriptStatistics = statSync(workerScript, { throwIfNoEntry: false })
+    if (workerScriptStatistics == null) {
       throw new Error(`Worker script file does not exist: '${workerScript}'`)
     }
-    if (!workerScriptStats.isFile()) {
+    if (!workerScriptStatistics.isFile()) {
       throw new Error(`Worker script is not a regular file: '${workerScript}'`)
     }
     this.workerScript = workerScript