From: Jérôme Benoit Date: Fri, 28 Jul 2023 23:31:22 +0000 (+0200) Subject: refactor: cleanup module name namespace X-Git-Tag: v1.2.20~99 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=357a5553eba0104e7017b3d955a3ea6da0ef6a6d;p=e-mobility-charging-stations-simulator.git refactor: cleanup module name namespace Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index f90662fc..5e11f36e 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -5,8 +5,8 @@ import { AsyncResource } from 'node:async_hooks'; import { hoursToMilliseconds, secondsToMilliseconds } from 'date-fns'; import type { ChargingStation } from './ChargingStation'; -import { checkChargingStation } from './ChargingStationUtils'; import { IdTagsCache } from './IdTagsCache'; +import { checkChargingStation } from './Utils'; import { BaseError } from '../exception'; import { PerformanceStatistics } from '../performance'; import { diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 16a590a9..76b2c299 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -8,9 +8,9 @@ import { isMainThread } from 'node:worker_threads'; import chalk from 'chalk'; import { availableParallelism } from 'poolifier'; -import { waitChargingStationEvents } from './ChargingStationUtils'; import type { AbstractUIServer } from './ui-server/AbstractUIServer'; import { UIServerFactory } from './ui-server/UIServerFactory'; +import { waitChargingStationEvents } from './Utils'; import { version } from '../../package.json' assert { type: 'json' }; import { BaseError } from '../exception'; import { type Storage, StorageFactory } from '../performance'; diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index f1dac8a3..aad6a537 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -25,7 +25,21 @@ import { deleteConfigurationKey, getConfigurationKey, setConfigurationKeyValue, -} from './ChargingStationConfigurationKeyUtils'; +} from './ConfigurationKeyUtils'; +import { IdTagsCache } from './IdTagsCache'; +import { + OCPP16IncomingRequestService, + OCPP16RequestService, + OCPP16ResponseService, + OCPP16ServiceUtils, + OCPP20IncomingRequestService, + OCPP20RequestService, + OCPP20ResponseService, + type OCPPIncomingRequestService, + type OCPPRequestService, + OCPPServiceUtils, +} from './ocpp'; +import { SharedLRUCache } from './SharedLRUCache'; import { buildConnectorsMap, checkConnectorsConfiguration, @@ -48,21 +62,7 @@ import { propagateSerialNumber, stationTemplateToStationInfo, warnTemplateKeysDeprecation, -} from './ChargingStationUtils'; -import { IdTagsCache } from './IdTagsCache'; -import { - OCPP16IncomingRequestService, - OCPP16RequestService, - OCPP16ResponseService, - OCPP16ServiceUtils, - OCPP20IncomingRequestService, - OCPP20RequestService, - OCPP20ResponseService, - type OCPPIncomingRequestService, - type OCPPRequestService, - OCPPServiceUtils, -} from './ocpp'; -import { SharedLRUCache } from './SharedLRUCache'; +} from './Utils'; import { BaseError, OCPPError } from '../exception'; import { PerformanceStatistics } from '../performance'; import { diff --git a/src/charging-station/ChargingStationConfigurationKeyUtils.ts b/src/charging-station/ConfigurationKeyUtils.ts similarity index 100% rename from src/charging-station/ChargingStationConfigurationKeyUtils.ts rename to src/charging-station/ConfigurationKeyUtils.ts diff --git a/src/charging-station/IdTagsCache.ts b/src/charging-station/IdTagsCache.ts index 86214393..e88a3a5d 100644 --- a/src/charging-station/IdTagsCache.ts +++ b/src/charging-station/IdTagsCache.ts @@ -1,7 +1,7 @@ import { type FSWatcher, readFileSync } from 'node:fs'; import type { ChargingStation } from './ChargingStation'; -import { getIdTagsFile } from './ChargingStationUtils'; +import { getIdTagsFile } from './Utils'; import { FileType, IdTagDistribution } from '../types'; import { handleFileException, diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/Utils.ts similarity index 99% rename from src/charging-station/ChargingStationUtils.ts rename to src/charging-station/Utils.ts index d7da3dc8..fa60c9a5 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/Utils.ts @@ -19,7 +19,7 @@ import { } from 'date-fns'; import type { ChargingStation } from './ChargingStation'; -import { getConfigurationKey } from './ChargingStationConfigurationKeyUtils'; +import { getConfigurationKey } from './ConfigurationKeyUtils'; import { BaseError } from '../exception'; import { AmpereUnits, @@ -65,7 +65,7 @@ import { secureRandom, } from '../utils'; -const moduleName = 'ChargingStationUtils'; +const moduleName = 'Utils'; export const getChargingStationId = ( index: number, diff --git a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts index f591bfbe..83684c64 100644 --- a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts @@ -39,7 +39,7 @@ import { } from '../../types'; import { Constants, convertToInt, isEmptyObject, isNullOrUndefined, logger } from '../../utils'; import type { ChargingStation } from '../ChargingStation'; -import { getConfigurationKey } from '../ChargingStationConfigurationKeyUtils'; +import { getConfigurationKey } from '../ConfigurationKeyUtils'; import { OCPP16ServiceUtils } from '../ocpp'; const moduleName = 'ChargingStationWorkerBroadcastChannel'; diff --git a/src/charging-station/index.ts b/src/charging-station/index.ts index d377e7e8..32417cb2 100644 --- a/src/charging-station/index.ts +++ b/src/charging-station/index.ts @@ -4,10 +4,10 @@ export { addConfigurationKey, getConfigurationKey, setConfigurationKeyValue, -} from './ChargingStationConfigurationKeyUtils'; +} from './ConfigurationKeyUtils'; export { getIdTagsFile, checkChargingStation, resetConnectorStatus, hasFeatureProfile, -} from './ChargingStationUtils'; +} from './Utils';