From: Jérôme Benoit Date: Thu, 7 Mar 2024 18:51:54 +0000 (+0100) Subject: refactor: cleanup eslint configuration X-Git-Tag: v1.3.0~28 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4c3f6c20f9416e148a3d26b6a06acc13274ab469;p=e-mobility-charging-stations-simulator.git refactor: cleanup eslint configuration Signed-off-by: Jérôme Benoit --- diff --git a/.eslintrc.cjs b/.eslintrc.cjs index a9d87cf3..ec043bbe 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -8,10 +8,10 @@ module.exports = defineConfig({ node: true }, parserOptions: { - ecmaVersion: 2022, - sourceType: 'module' + sourceType: 'module', + ecmaVersion: 2022 }, - plugins: ['import'], + plugins: ['simple-import-sort', 'import'], extends: ['eslint:recommended', 'plugin:import/recommended'], settings: { 'import/resolver': { @@ -21,36 +21,38 @@ module.exports = defineConfig({ } }, rules: { - 'sort-imports': [ - 'error', - { - ignoreCase: false, - ignoreDeclarationSort: true, - ignoreMemberSort: false, - memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], - allowSeparatedGroups: true - } - ], - 'import/order': [ - 'error', - { - groups: [ - 'builtin', // Built-in imports (come from NodeJS native) go first - 'external', // <- External imports - 'internal', // <- Absolute imports - ['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together - 'index', // <- Index imports - 'unknown' // <- Unknown - ], - 'newlines-between': 'always', - alphabetize: { - /* Sort in ascending order. Options: ["ignore", "asc", "desc"] */ - order: 'asc', - /* Ignore case. Options: [true, false] */ - caseInsensitive: true - } - } - ] + 'simple-import-sort/imports': 'error', + 'simple-import-sort/exports': 'error' + // 'sort-imports': [ + // 'error', + // { + // ignoreCase: false, + // ignoreDeclarationSort: true, + // ignoreMemberSort: false, + // memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], + // allowSeparatedGroups: true + // } + // ], + // 'import/order': [ + // 'error', + // { + // groups: [ + // 'builtin', // Built-in imports (come from NodeJS native) go first + // 'external', // <- External imports + // 'internal', // <- Absolute imports + // ['sibling', 'parent'], // <- Relative imports, the sibling and parent types they can be mingled together + // 'index', // <- Index imports + // 'unknown' // <- Unknown + // ], + // 'newlines-between': 'always', + // alphabetize: { + // /* Sort in ascending order. Options: ["ignore", "asc", "desc"] */ + // order: 'asc', + // /* Ignore case. Options: [true, false] */ + // caseInsensitive: true + // } + // } + // ] }, overrides: [ { diff --git a/package.json b/package.json index 85953eb9..97a64568 100644 --- a/package.json +++ b/package.json @@ -140,6 +140,7 @@ "eslint-define-config": "^2.1.0", "eslint-import-resolver-typescript": "^3.6.1", "eslint-plugin-import": "^2.29.1", + "eslint-plugin-simple-import-sort": "^12.0.0", "eslint-plugin-jsdoc": "^48.2.1", "eslint-plugin-n": "^16.6.2", "eslint-plugin-tsdoc": "^0.2.17", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 26aed9cc..b01a20fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -157,6 +157,9 @@ importers: eslint-plugin-n: specifier: ^16.6.2 version: 16.6.2(eslint@8.57.0) + eslint-plugin-simple-import-sort: + specifier: ^12.0.0 + version: 12.0.0(eslint@8.57.0) eslint-plugin-tsdoc: specifier: ^0.2.17 version: 0.2.17 diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 95483b8e..40b7c781 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -2,10 +2,6 @@ import { hoursToMilliseconds, secondsToMilliseconds } from 'date-fns' -import type { ChargingStation } from './ChargingStation.js' -import { checkChargingStation } from './Helpers.js' -import { IdTagsCache } from './IdTagsCache.js' -import { isIdTagAuthorized } from './ocpp/index.js' import { BaseError } from '../exception/index.js' import { PerformanceStatistics } from '../performance/index.js' import { @@ -18,17 +14,21 @@ import { type StopTransactionResponse } from '../types/index.js' import { - Constants, clone, + Constants, convertToDate, formatDurationMilliSeconds, getRandomInteger, isValidDate, - logPrefix, logger, + logPrefix, secureRandom, sleep } from '../utils/index.js' +import type { ChargingStation } from './ChargingStation.js' +import { checkChargingStation } from './Helpers.js' +import { IdTagsCache } from './IdTagsCache.js' +import { isIdTagAuthorized } from './ocpp/index.js' export class AutomaticTransactionGenerator { private static readonly instances: Map = new Map< diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index faa29e68..d31b1e5d 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -5,14 +5,11 @@ import { dirname, extname, join } from 'node:path' import process, { exit } from 'node:process' import { fileURLToPath } from 'node:url' import { isMainThread } from 'node:worker_threads' -import type { Worker } from 'worker_threads' import chalk from 'chalk' -import { type MessageHandler, availableParallelism } from 'poolifier' +import { availableParallelism, type MessageHandler } from 'poolifier' +import type { Worker } from 'worker_threads' -import { buildTemplateName, waitChargingStationEvents } from './Helpers.js' -import type { AbstractUIServer } from './ui-server/AbstractUIServer.js' -import { UIServerFactory } from './ui-server/UIServerFactory.js' import { version } from '../../package.json' import { BaseError } from '../exception/index.js' import { type Storage, StorageFactory } from '../performance/index.js' @@ -34,19 +31,22 @@ import { type WorkerConfiguration } from '../types/index.js' import { + buildTemplateStatisticsPayload, Configuration, Constants, - buildTemplateStatisticsPayload, formatDurationMilliSeconds, generateUUID, handleUncaughtException, handleUnhandledRejection, isAsyncFunction, isNotEmptyArray, - logPrefix, - logger + logger, + logPrefix } from '../utils/index.js' import { type WorkerAbstract, WorkerFactory } from '../worker/index.js' +import { buildTemplateName, waitChargingStationEvents } from './Helpers.js' +import type { AbstractUIServer } from './ui-server/AbstractUIServer.js' +import { UIServerFactory } from './ui-server/UIServerFactory.js' const moduleName = 'Bootstrap' diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 5a724e53..31ce3342 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -2,7 +2,7 @@ import { createHash } from 'node:crypto' import { EventEmitter } from 'node:events' -import { type FSWatcher, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs' +import { existsSync, type FSWatcher, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { URL } from 'node:url' import { parentPort } from 'node:worker_threads' @@ -11,58 +11,6 @@ import { millisecondsToSeconds, secondsToMilliseconds } from 'date-fns' import { mergeDeepRight } from 'rambda' import { type RawData, WebSocket } from 'ws' -import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js' -import { ChargingStationWorkerBroadcastChannel } from './broadcast-channel/ChargingStationWorkerBroadcastChannel.js' -import { - addConfigurationKey, - deleteConfigurationKey, - getConfigurationKey, - setConfigurationKeyValue -} from './ConfigurationKeyUtils.js' -import { - buildConnectorsMap, - buildTemplateName, - checkChargingStation, - checkConfiguration, - checkConnectorsConfiguration, - checkStationInfoConnectorStatus, - checkTemplate, - createBootNotificationRequest, - createSerialNumber, - getAmperageLimitationUnitDivider, - getBootConnectorStatus, - getChargingStationConnectorChargingProfilesPowerLimit, - getChargingStationId, - getDefaultVoltageOut, - getHashId, - getIdTagsFile, - getMaxNumberOfEvses, - getNumberOfReservableConnectors, - getPhaseRotationValue, - hasFeatureProfile, - hasReservationExpired, - initializeConnectorsMapStatus, - propagateSerialNumber, - setChargingStationOptions, - stationTemplateToStationInfo, - warnTemplateKeysDeprecation -} from './Helpers.js' -import { IdTagsCache } from './IdTagsCache.js' -import { - OCPP16IncomingRequestService, - OCPP16RequestService, - OCPP16ResponseService, - OCPP20IncomingRequestService, - OCPP20RequestService, - OCPP20ResponseService, - type OCPPIncomingRequestService, - type OCPPRequestService, - buildMeterValue, - buildTransactionEndMeterValue, - getMessageTypeString, - sendAndSetConnectorStatus -} from './ocpp/index.js' -import { SharedLRUCache } from './SharedLRUCache.js' import { BaseError, OCPPError } from '../exception/index.js' import { PerformanceStatistics } from '../performance/index.js' import { @@ -114,17 +62,14 @@ import { SupervisionUrlDistribution, SupportedFeatureProfiles, type Voltage, - type WSError, WebSocketCloseEventStatusCode, + type WSError, type WsOptions } from '../types/index.js' import { ACElectricUtils, AsyncLock, AsyncLockType, - Configuration, - Constants, - DCElectricUtils, buildAddedMessage, buildChargingStationAutomaticTransactionGeneratorConfiguration, buildConnectorsStatus, @@ -134,9 +79,12 @@ import { buildStoppedMessage, buildUpdatedMessage, clone, + Configuration, + Constants, convertToBoolean, convertToDate, convertToInt, + DCElectricUtils, exponentialDelay, formatDurationMilliSeconds, formatDurationSeconds, @@ -145,8 +93,8 @@ import { handleFileException, isNotEmptyArray, isNotEmptyString, - logPrefix, logger, + logPrefix, min, once, roundTo, @@ -154,6 +102,58 @@ import { sleep, watchJsonFile } from '../utils/index.js' +import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator.js' +import { ChargingStationWorkerBroadcastChannel } from './broadcast-channel/ChargingStationWorkerBroadcastChannel.js' +import { + addConfigurationKey, + deleteConfigurationKey, + getConfigurationKey, + setConfigurationKeyValue +} from './ConfigurationKeyUtils.js' +import { + buildConnectorsMap, + buildTemplateName, + checkChargingStation, + checkConfiguration, + checkConnectorsConfiguration, + checkStationInfoConnectorStatus, + checkTemplate, + createBootNotificationRequest, + createSerialNumber, + getAmperageLimitationUnitDivider, + getBootConnectorStatus, + getChargingStationConnectorChargingProfilesPowerLimit, + getChargingStationId, + getDefaultVoltageOut, + getHashId, + getIdTagsFile, + getMaxNumberOfEvses, + getNumberOfReservableConnectors, + getPhaseRotationValue, + hasFeatureProfile, + hasReservationExpired, + initializeConnectorsMapStatus, + propagateSerialNumber, + setChargingStationOptions, + stationTemplateToStationInfo, + warnTemplateKeysDeprecation +} from './Helpers.js' +import { IdTagsCache } from './IdTagsCache.js' +import { + buildMeterValue, + buildTransactionEndMeterValue, + getMessageTypeString, + OCPP16IncomingRequestService, + OCPP16RequestService, + OCPP16ResponseService, + OCPP20IncomingRequestService, + OCPP20RequestService, + OCPP20ResponseService, + type OCPPIncomingRequestService, + type OCPPRequestService, + sendAndSetConnectorStatus +} from './ocpp/index.js' +import { SharedLRUCache } from './SharedLRUCache.js' export class ChargingStation extends EventEmitter { public readonly index: number diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index 2623f127..35a7e534 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -4,7 +4,6 @@ import { parentPort } from 'node:worker_threads' import { ThreadWorker } from 'poolifier' -import { ChargingStation } from './ChargingStation.js' import { BaseError } from '../exception/index.js' import type { ChargingStationData, @@ -12,8 +11,9 @@ import type { ChargingStationWorkerEventError, ChargingStationWorkerMessage } from '../types/index.js' -import { Configuration, buildChargingStationDataPayload } from '../utils/index.js' +import { buildChargingStationDataPayload, Configuration } from '../utils/index.js' import { type WorkerMessage, WorkerMessageEvents } from '../worker/index.js' +import { ChargingStation } from './ChargingStation.js' export let chargingStationWorker: object if (Configuration.workerPoolInUse()) { diff --git a/src/charging-station/ConfigurationKeyUtils.ts b/src/charging-station/ConfigurationKeyUtils.ts index 075a4979..4b9eb40a 100644 --- a/src/charging-station/ConfigurationKeyUtils.ts +++ b/src/charging-station/ConfigurationKeyUtils.ts @@ -1,6 +1,6 @@ -import type { ChargingStation } from './ChargingStation.js' import type { ConfigurationKey, ConfigurationKeyType } from '../types/index.js' import { logger } from '../utils/index.js' +import type { ChargingStation } from './ChargingStation.js' interface ConfigurationKeyOptions { readonly?: boolean diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index 9c790268..726a0ab3 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -6,13 +6,13 @@ import { fileURLToPath } from 'node:url' import chalk from 'chalk' import { - type Interval, addDays, addSeconds, addWeeks, differenceInDays, differenceInSeconds, differenceInWeeks, + type Interval, isAfter, isBefore, isDate, @@ -22,8 +22,6 @@ import { } from 'date-fns' import { maxTime } from 'date-fns/constants' -import type { ChargingStation } from './ChargingStation.js' -import { getConfigurationKey } from './ConfigurationKeyUtils.js' import { BaseError } from '../exception/index.js' import { AmpereUnits, @@ -56,11 +54,11 @@ import { } from '../types/index.js' import { ACElectricUtils, - Constants, - DCElectricUtils, clone, + Constants, convertToDate, convertToInt, + DCElectricUtils, isArraySorted, isEmptyObject, isEmptyString, @@ -70,6 +68,8 @@ import { logger, secureRandom } from '../utils/index.js' +import type { ChargingStation } from './ChargingStation.js' +import { getConfigurationKey } from './ConfigurationKeyUtils.js' const moduleName = 'Helpers' diff --git a/src/charging-station/IdTagsCache.ts b/src/charging-station/IdTagsCache.ts index e1bc8b84..da4b38bf 100644 --- a/src/charging-station/IdTagsCache.ts +++ b/src/charging-station/IdTagsCache.ts @@ -1,16 +1,16 @@ import { type FSWatcher, readFileSync } from 'node:fs' -import type { ChargingStation } from './ChargingStation.js' -import { getIdTagsFile } from './Helpers.js' import { FileType, IdTagDistribution } from '../types/index.js' import { handleFileException, isNotEmptyString, - logPrefix, logger, + logPrefix, secureRandom, watchJsonFile } from '../utils/index.js' +import type { ChargingStation } from './ChargingStation.js' +import { getIdTagsFile } from './Helpers.js' interface IdTagsCacheValueType { idTags: string[] diff --git a/src/charging-station/SharedLRUCache.ts b/src/charging-station/SharedLRUCache.ts index eaa8c912..b2a90e0f 100644 --- a/src/charging-station/SharedLRUCache.ts +++ b/src/charging-station/SharedLRUCache.ts @@ -1,8 +1,8 @@ import { LRUMapWithDelete as LRUCache } from 'mnemonist' -import { Bootstrap } from './Bootstrap.js' import type { ChargingStationConfiguration, ChargingStationTemplate } from '../types/index.js' import { isEmptyObject, isNotEmptyArray, isNotEmptyString } from '../utils/index.js' +import { Bootstrap } from './Bootstrap.js' enum CacheType { chargingStationTemplate = 'chargingStationTemplate', diff --git a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts index 26aa61d3..1a825e39 100644 --- a/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/ChargingStationWorkerBroadcastChannel.ts @@ -1,6 +1,5 @@ import { secondsToMilliseconds } from 'date-fns' -import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js' import { BaseError, type OCPPError } from '../../exception/index.js' import { AuthorizationStatus, @@ -47,6 +46,7 @@ import { import type { ChargingStation } from '../ChargingStation.js' import { getConfigurationKey } from '../ConfigurationKeyUtils.js' import { buildMeterValue } from '../ocpp/index.js' +import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js' const moduleName = 'ChargingStationWorkerBroadcastChannel' diff --git a/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts index 3a0c75b7..ef07b5da 100644 --- a/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts @@ -1,4 +1,3 @@ -import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js' import { type BroadcastChannelResponse, type BroadcastChannelResponsePayload, @@ -8,6 +7,7 @@ import { } from '../../types/index.js' import { logger } from '../../utils/index.js' import type { AbstractUIService } from '../ui-server/ui-services/AbstractUIService.js' +import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js' const moduleName = 'UIServiceWorkerBroadcastChannel' diff --git a/src/charging-station/broadcast-channel/WorkerBroadcastChannel.ts b/src/charging-station/broadcast-channel/WorkerBroadcastChannel.ts index dfd0c3e5..91c92ac2 100644 --- a/src/charging-station/broadcast-channel/WorkerBroadcastChannel.ts +++ b/src/charging-station/broadcast-channel/WorkerBroadcastChannel.ts @@ -6,7 +6,7 @@ import type { JsonType, MessageEvent } from '../../types/index.js' -import { logPrefix, logger, validateUUID } from '../../utils/index.js' +import { logger, logPrefix, validateUUID } from '../../utils/index.js' const moduleName = 'WorkerBroadcastChannel' diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 6d60d402..a61cb219 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -2,25 +2,23 @@ import { createWriteStream, readdirSync } from 'node:fs' import { dirname, extname, join, resolve } from 'node:path' -import { URL, fileURLToPath } from 'node:url' +import { fileURLToPath, URL } from 'node:url' import type { ValidateFunction } from 'ajv' import { Client, type FTPResponse } from 'basic-ftp' import { - type Interval, addSeconds, differenceInSeconds, + type Interval, isDate, secondsToMilliseconds } from 'date-fns' import { maxTime } from 'date-fns/constants' import { create } from 'tar' -import { OCPP16Constants } from './OCPP16Constants.js' -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' import { - type ChargingStation, canProceedChargingProfile, + type ChargingStation, checkChargingStation, getConfigurationKey, getConnectorChargingProfiles, @@ -114,6 +112,8 @@ import { sleep } from '../../../utils/index.js' import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService.js' +import { OCPP16Constants } from './OCPP16Constants.js' +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' const moduleName = 'OCPP16IncomingRequestService' diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 74c00daa..d673e8a3 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -2,8 +2,6 @@ import type { ValidateFunction } from 'ajv' -import { OCPP16Constants } from './OCPP16Constants.js' -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' import type { ChargingStation } from '../../../charging-station/index.js' import { OCPPError } from '../../../exception/index.js' import { @@ -28,6 +26,8 @@ import { import { Constants, generateUUID } from '../../../utils/index.js' import { OCPPRequestService } from '../OCPPRequestService.js' import type { OCPPResponseService } from '../OCPPResponseService.js' +import { OCPP16Constants } from './OCPP16Constants.js' +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' const moduleName = 'OCPP16RequestService' diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 3905445e..0fa38728 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -3,10 +3,9 @@ import type { ValidateFunction } from 'ajv' import { secondsToMilliseconds } from 'date-fns' -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' import { - type ChargingStation, addConfigurationKey, + type ChargingStation, getConfigurationKey, hasReservationExpired, resetConnectorStatus @@ -53,6 +52,7 @@ import { } from '../../../types/index.js' import { Constants, convertToInt, isAsyncFunction, logger } from '../../../utils/index.js' import { OCPPResponseService } from '../OCPPResponseService.js' +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils.js' const moduleName = 'OCPP16ResponseService' diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index a959844a..d9144064 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -2,16 +2,15 @@ import type { JSONSchemaType } from 'ajv' import { - type Interval, addSeconds, areIntervalsOverlapping, differenceInSeconds, + type Interval, isAfter, isBefore, isWithinInterval } from 'date-fns' -import { OCPP16Constants } from './OCPP16Constants.js' import { type ChargingStation, hasFeatureProfile, @@ -40,6 +39,7 @@ import { } from '../../../types/index.js' import { convertToDate, isNotEmptyArray, logger, roundTo } from '../../../utils/index.js' import { OCPPServiceUtils } from '../OCPPServiceUtils.js' +import { OCPP16Constants } from './OCPP16Constants.js' export class OCPP16ServiceUtils extends OCPPServiceUtils { public static checkFeatureProfile ( diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 2a561e45..b1cd51fc 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -2,7 +2,6 @@ import type { ValidateFunction } from 'ajv' -import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js' import type { ChargingStation } from '../../../charging-station/index.js' import { OCPPError } from '../../../exception/index.js' import { @@ -15,6 +14,7 @@ import { } from '../../../types/index.js' import { isAsyncFunction, logger } from '../../../utils/index.js' import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService.js' +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js' const moduleName = 'OCPP20IncomingRequestService' diff --git a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts index 03921891..6673b9b4 100644 --- a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts @@ -2,8 +2,6 @@ import type { ValidateFunction } from 'ajv' -import { OCPP20Constants } from './OCPP20Constants.js' -import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js' import type { ChargingStation } from '../../../charging-station/index.js' import { OCPPError } from '../../../exception/index.js' import { @@ -20,6 +18,8 @@ import { import { generateUUID } from '../../../utils/index.js' import { OCPPRequestService } from '../OCPPRequestService.js' import type { OCPPResponseService } from '../OCPPResponseService.js' +import { OCPP20Constants } from './OCPP20Constants.js' +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js' const moduleName = 'OCPP20RequestService' diff --git a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts index 9473324f..6ab91c07 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts @@ -2,8 +2,7 @@ import type { ValidateFunction } from 'ajv' -import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js' -import { type ChargingStation, addConfigurationKey } from '../../../charging-station/index.js' +import { addConfigurationKey, type ChargingStation } from '../../../charging-station/index.js' import { OCPPError } from '../../../exception/index.js' import { ErrorType, @@ -21,6 +20,7 @@ import { } from '../../../types/index.js' import { isAsyncFunction, logger } from '../../../utils/index.js' import { OCPPResponseService } from '../OCPPResponseService.js' +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js' const moduleName = 'OCPP20ResponseService' diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 49128ccb..7c88547a 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -3,8 +3,6 @@ import { EventEmitter } from 'node:events' import _Ajv, { type ValidateFunction } from 'ajv' import _ajvFormats from 'ajv-formats' -import { OCPPConstants } from './OCPPConstants.js' -import { OCPPServiceUtils } from './OCPPServiceUtils.js' import { type ChargingStation, getIdTagsFile } from '../../charging-station/index.js' import { OCPPError } from '../../exception/index.js' import type { @@ -15,6 +13,8 @@ import type { OCPPVersion } from '../../types/index.js' import { logger, setDefaultErrorParams } from '../../utils/index.js' +import { OCPPConstants } from './OCPPConstants.js' +import { OCPPServiceUtils } from './OCPPServiceUtils.js' type Ajv = _Ajv.default // eslint-disable-next-line @typescript-eslint/no-redeclare const Ajv = _Ajv.default diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 4d279ade..781a2b8c 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,9 +1,6 @@ import _Ajv, { type ValidateFunction } from 'ajv' import _ajvFormats from 'ajv-formats' -import { OCPPConstants } from './OCPPConstants.js' -import type { OCPPResponseService } from './OCPPResponseService.js' -import { OCPPServiceUtils } from './OCPPServiceUtils.js' import type { ChargingStation } from '../../charging-station/index.js' import { OCPPError } from '../../exception/index.js' import { PerformanceStatistics } from '../../performance/index.js' @@ -29,6 +26,9 @@ import { handleSendMessageError, logger } from '../../utils/index.js' +import { OCPPConstants } from './OCPPConstants.js' +import type { OCPPResponseService } from './OCPPResponseService.js' +import { OCPPServiceUtils } from './OCPPServiceUtils.js' type Ajv = _Ajv.default // eslint-disable-next-line @typescript-eslint/no-redeclare const Ajv = _Ajv.default diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index a526c28c..0e9c6164 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,7 +1,6 @@ import _Ajv, { type ValidateFunction } from 'ajv' import _ajvFormats from 'ajv-formats' -import { OCPPServiceUtils } from './OCPPServiceUtils.js' import type { ChargingStation } from '../../charging-station/index.js' import { OCPPError } from '../../exception/index.js' import type { @@ -11,6 +10,7 @@ import type { RequestCommand } from '../../types/index.js' import { Constants, logger } from '../../utils/index.js' +import { OCPPServiceUtils } from './OCPPServiceUtils.js' type Ajv = _Ajv.default // eslint-disable-next-line @typescript-eslint/no-redeclare const Ajv = _Ajv.default diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 35b15d94..38f218ee 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -5,9 +5,6 @@ import { fileURLToPath } from 'node:url' import type { DefinedError, ErrorObject, JSONSchemaType } from 'ajv' import { isDate } from 'date-fns' -import { OCPP16Constants } from './1.6/OCPP16Constants.js' -import { OCPP20Constants } from './2.0/OCPP20Constants.js' -import { OCPPConstants } from './OCPPConstants.js' import { type ChargingStation, getConfigurationKey, @@ -51,21 +48,24 @@ import { import { ACElectricUtils, Constants, - DCElectricUtils, convertToFloat, convertToInt, + DCElectricUtils, getRandomFloatFluctuatedRounded, getRandomFloatRounded, getRandomInteger, handleFileException, isNotEmptyArray, isNotEmptyString, - logPrefix, logger, + logPrefix, max, min, roundTo } from '../../utils/index.js' +import { OCPP16Constants } from './1.6/OCPP16Constants.js' +import { OCPP20Constants } from './2.0/OCPP20Constants.js' +import { OCPPConstants } from './OCPPConstants.js' export const getMessageTypeString = (messageType: MessageType | undefined): string => { switch (messageType) { diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index 566d4961..9056dc0d 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -1,11 +1,8 @@ import { type IncomingMessage, Server, type ServerResponse } from 'node:http' -import { type Http2Server, createServer } from 'node:http2' +import { createServer, type Http2Server } from 'node:http2' import type { WebSocket } from 'ws' -import type { AbstractUIService } from './ui-services/AbstractUIService.js' -import { UIServiceFactory } from './ui-services/UIServiceFactory.js' -import { getUsernameAndPasswordFromAuthorizationToken } from './UIServerUtils.js' import { BaseError } from '../../exception/index.js' import { ApplicationProtocolVersion, @@ -20,6 +17,9 @@ import { type UIServerConfiguration } from '../../types/index.js' import { logger } from '../../utils/index.js' +import type { AbstractUIService } from './ui-services/AbstractUIService.js' +import { UIServiceFactory } from './ui-services/UIServiceFactory.js' +import { getUsernameAndPasswordFromAuthorizationToken } from './UIServerUtils.js' const moduleName = 'AbstractUIServer' diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index fb967ef4..b5c30b31 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -2,8 +2,6 @@ import type { IncomingMessage, ServerResponse } from 'node:http' import { StatusCodes } from 'http-status-codes' -import { AbstractUIServer } from './AbstractUIServer.js' -import { isProtocolAndVersionSupported } from './UIServerUtils.js' import { BaseError } from '../../exception/index.js' import { ApplicationProtocolVersion, @@ -18,12 +16,14 @@ import { } from '../../types/index.js' import { Constants, - JSONStringifyWithMapSupport, generateUUID, isNotEmptyString, - logPrefix, - logger + JSONStringifyWithMapSupport, + logger, + logPrefix } from '../../utils/index.js' +import { AbstractUIServer } from './AbstractUIServer.js' +import { isProtocolAndVersionSupported } from './UIServerUtils.js' const moduleName = 'UIHttpServer' diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index d7de7ddd..0eb71cd4 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -1,9 +1,5 @@ import chalk from 'chalk' -import type { AbstractUIServer } from './AbstractUIServer.js' -import { UIHttpServer } from './UIHttpServer.js' -import { isLoopback } from './UIServerUtils.js' -import { UIWebSocketServer } from './UIWebSocketServer.js' import { BaseError } from '../../exception/index.js' import { ApplicationProtocol, @@ -11,6 +7,10 @@ import { AuthenticationType, type UIServerConfiguration } from '../../types/index.js' +import type { AbstractUIServer } from './AbstractUIServer.js' +import { UIHttpServer } from './UIHttpServer.js' +import { isLoopback } from './UIServerUtils.js' +import { UIWebSocketServer } from './UIWebSocketServer.js' // eslint-disable-next-line @typescript-eslint/no-extraneous-class export class UIServerFactory { diff --git a/src/charging-station/ui-server/UIServerUtils.ts b/src/charging-station/ui-server/UIServerUtils.ts index 2aa2e92b..cfe4fd2f 100644 --- a/src/charging-station/ui-server/UIServerUtils.ts +++ b/src/charging-station/ui-server/UIServerUtils.ts @@ -2,7 +2,7 @@ import type { IncomingMessage } from 'node:http' import { BaseError } from '../../exception/index.js' import { Protocol, ProtocolVersion } from '../../types/index.js' -import { logPrefix, logger } from '../../utils/index.js' +import { logger, logPrefix } from '../../utils/index.js' export const getUsernameAndPasswordFromAuthorizationToken = ( authorizationToken: string, diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index 1e1a372c..29a65675 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -4,12 +4,6 @@ import type { Duplex } from 'node:stream' import { StatusCodes } from 'http-status-codes' import { type RawData, WebSocket, WebSocketServer } from 'ws' -import { AbstractUIServer } from './AbstractUIServer.js' -import { - getProtocolAndVersion, - handleProtocols, - isProtocolAndVersionSupported -} from './UIServerUtils.js' import { type ProtocolRequest, type ProtocolResponse, @@ -18,13 +12,19 @@ import { } from '../../types/index.js' import { Constants, - JSONStringifyWithMapSupport, getWebSocketCloseEventStatusString, isNotEmptyString, - logPrefix, + JSONStringifyWithMapSupport, logger, + logPrefix, validateUUID } from '../../utils/index.js' +import { AbstractUIServer } from './AbstractUIServer.js' +import { + getProtocolAndVersion, + handleProtocols, + isProtocolAndVersionSupported +} from './UIServerUtils.js' const moduleName = 'UIWebSocketServer' diff --git a/src/charging-station/ui-server/ui-services/UIService001.ts b/src/charging-station/ui-server/ui-services/UIService001.ts index 674f8985..511bfa7a 100644 --- a/src/charging-station/ui-server/ui-services/UIService001.ts +++ b/src/charging-station/ui-server/ui-services/UIService001.ts @@ -1,6 +1,6 @@ -import { AbstractUIService } from './AbstractUIService.js' import { type ProtocolRequestHandler, ProtocolVersion } from '../../../types/index.js' import type { AbstractUIServer } from '../AbstractUIServer.js' +import { AbstractUIService } from './AbstractUIService.js' export class UIService001 extends AbstractUIService { constructor (uiServer: AbstractUIServer) { diff --git a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts index 81fc2201..08d81a36 100644 --- a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts +++ b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts @@ -1,7 +1,7 @@ -import type { AbstractUIService } from './AbstractUIService.js' -import { UIService001 } from './UIService001.js' import { ProtocolVersion } from '../../../types/index.js' import type { AbstractUIServer } from '../AbstractUIServer.js' +import type { AbstractUIService } from './AbstractUIService.js' +import { UIService001 } from './UIService001.js' // eslint-disable-next-line @typescript-eslint/no-extraneous-class export class UIServiceFactory { diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index 27876dad..1e716ae4 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -1,8 +1,8 @@ // Partial Copyright Jerome Benoit. 2021-2024. All Rights Reserved. -import { BaseError } from './BaseError.js' import type { ErrorType, IncomingRequestCommand, JsonType, RequestCommand } from '../types/index.js' import { Constants } from '../utils/index.js' +import { BaseError } from './BaseError.js' export class OCPPError extends BaseError { code: ErrorType diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index e9059522..bf333dfd 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -1,6 +1,6 @@ // Partial Copyright Jerome Benoit. 2021-2024. All Rights Reserved. -import { type PerformanceEntry, PerformanceObserver, performance } from 'node:perf_hooks' +import { performance, type PerformanceEntry, PerformanceObserver } from 'node:perf_hooks' import type { URL } from 'node:url' import { parentPort } from 'node:worker_threads' @@ -19,17 +19,17 @@ import { type TimestampedData } from '../types/index.js' import { + average, + buildPerformanceStatisticsMessage, CircularArray, Configuration, Constants, - JSONStringifyWithMapSupport, - average, - buildPerformanceStatisticsMessage, extractTimeSeriesValues, formatDurationSeconds, generateUUID, - logPrefix, + JSONStringifyWithMapSupport, logger, + logPrefix, max, median, min, diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index a69edd69..648b9c62 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -3,15 +3,15 @@ import { closeSync, existsSync, mkdirSync, openSync, writeSync } from 'node:fs' import { dirname } from 'node:path' -import { Storage } from './Storage.js' import { BaseError } from '../../exception/index.js' import { FileType, type Statistics } from '../../types/index.js' import { AsyncLock, AsyncLockType, - JSONStringifyWithMapSupport, - handleFileException + handleFileException, + JSONStringifyWithMapSupport } from '../../utils/index.js' +import { Storage } from './Storage.js' export class JsonFileStorage extends Storage { private fd?: number diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index e9169306..7b4545bd 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -3,9 +3,9 @@ import { MikroORM as MariaDbORM, type Options as MariaDbOptions } from '@mikro-orm/mariadb' import { MikroORM as SqliteORM, type Options as SqliteOptions } from '@mikro-orm/sqlite' -import { Storage } from './Storage.js' import { type PerformanceRecord, type Statistics, StorageType } from '../../types/index.js' import { Constants } from '../../utils/index.js' +import { Storage } from './Storage.js' export class MikroOrmStorage extends Storage { private readonly storageType: StorageType diff --git a/src/performance/storage/MongoDBStorage.ts b/src/performance/storage/MongoDBStorage.ts index b3d535e2..c3c98022 100644 --- a/src/performance/storage/MongoDBStorage.ts +++ b/src/performance/storage/MongoDBStorage.ts @@ -2,10 +2,10 @@ import { MongoClient } from 'mongodb' -import { Storage } from './Storage.js' import { BaseError } from '../../exception/index.js' import { type Statistics, StorageType } from '../../types/index.js' import { Constants } from '../../utils/index.js' +import { Storage } from './Storage.js' export class MongoDBStorage extends Storage { private readonly client?: MongoClient diff --git a/src/performance/storage/None.ts b/src/performance/storage/None.ts index 6506d36b..af3e273e 100644 --- a/src/performance/storage/None.ts +++ b/src/performance/storage/None.ts @@ -1,7 +1,7 @@ // Copyright Jerome Benoit. 2021-2024. All Rights Reserved. -import { Storage } from './Storage.js' import type { Statistics } from '../../types/index.js' +import { Storage } from './Storage.js' export class None extends Storage { constructor () { diff --git a/src/performance/storage/StorageFactory.ts b/src/performance/storage/StorageFactory.ts index 9da6b54e..2b6b84ff 100644 --- a/src/performance/storage/StorageFactory.ts +++ b/src/performance/storage/StorageFactory.ts @@ -1,12 +1,12 @@ // Copyright Jerome Benoit. 2021-2024. All Rights Reserved. +import { BaseError } from '../../exception/index.js' +import { StorageType } from '../../types/index.js' import { JsonFileStorage } from './JsonFileStorage.js' import { MikroOrmStorage } from './MikroOrmStorage.js' import { MongoDBStorage } from './MongoDBStorage.js' import { None } from './None.js' import type { Storage } from './Storage.js' -import { BaseError } from '../../exception/index.js' -import { StorageType } from '../../types/index.js' // eslint-disable-next-line @typescript-eslint/no-extraneous-class export class StorageFactory { diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index ff3c5ef0..861d447e 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -1,5 +1,6 @@ import type { WebSocket } from 'ws' +import { type WorkerData, type WorkerMessage, WorkerMessageEvents } from '../worker/index.js' import type { ChargingStationAutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator.js' import { ChargingStationEvents } from './ChargingStationEvents.js' import type { ChargingStationInfo } from './ChargingStationInfo.js' @@ -9,7 +10,6 @@ import type { EvseStatus } from './Evse.js' import type { JsonObject } from './JsonType.js' import type { BootNotificationResponse } from './ocpp/Responses.js' import type { Statistics } from './Statistics.js' -import { type WorkerData, type WorkerMessage, WorkerMessageEvents } from '../worker/index.js' export interface ChargingStationOptions extends JsonObject { supervisionUrls?: string | string[] diff --git a/src/types/ConfigurationData.ts b/src/types/ConfigurationData.ts index fe8b8481..3248ec55 100644 --- a/src/types/ConfigurationData.ts +++ b/src/types/ConfigurationData.ts @@ -3,9 +3,9 @@ import type { ResourceLimits } from 'node:worker_threads' import type { WorkerChoiceStrategy } from 'poolifier' +import type { WorkerProcessType } from '../worker/index.js' import type { StorageType } from './Storage.js' import type { ApplicationProtocol, AuthenticationType } from './UIProtocol.js' -import type { WorkerProcessType } from '../worker/index.js' type ServerOptions = ListenOptions diff --git a/src/types/Statistics.ts b/src/types/Statistics.ts index ecb3c2bf..9abd0a89 100644 --- a/src/types/Statistics.ts +++ b/src/types/Statistics.ts @@ -1,6 +1,6 @@ -import type { IncomingRequestCommand, RequestCommand } from './ocpp/Requests.js' import type { CircularArray } from '../utils/index.js' import type { WorkerData } from '../worker/index.js' +import type { IncomingRequestCommand, RequestCommand } from './ocpp/Requests.js' export interface TimestampedData { timestamp: number diff --git a/src/types/index.ts b/src/types/index.ts index f312480a..023107fd 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,87 +1,86 @@ -export { - ApplicationProtocol, - AuthenticationType, - ProcedureName, - Protocol, - type ProtocolRequest, - type ProtocolRequestHandler, - type ProtocolResponse, - ProtocolVersion, - type RequestPayload, - type ResponsePayload, - ResponseStatus, - type SimulatorState, - type TemplateStatistics -} from './UIProtocol.js' export { type AutomaticTransactionGeneratorConfiguration, type ChargingStationAutomaticTransactionGeneratorConfiguration, IdTagDistribution, type Status } from './AutomaticTransactionGenerator.js' -export { type GenericResponse, GenericStatus, RegistrationStatusEnumType } from './ocpp/Common.js' +export type { + ChargingStationConfiguration, + EvseStatusConfiguration +} from './ChargingStationConfiguration.js' +export { ChargingStationEvents } from './ChargingStationEvents.js' +export type { ChargingStationInfo } from './ChargingStationInfo.js' +export type { + ChargingStationOcppConfiguration, + ConfigurationKey +} from './ChargingStationOcppConfiguration.js' export { - AvailabilityType, - type BootNotificationRequest, - type CachedRequest, - type DataTransferRequest, - type DiagnosticsStatusNotificationRequest, - type ErrorCallback, - FirmwareStatus, - type FirmwareStatusNotificationRequest, - type HeartbeatRequest, - type IncomingRequest, - IncomingRequestCommand, - type IncomingRequestHandler, - MessageTrigger, - type MeterValuesRequest, - type OutgoingRequest, - RequestCommand, - type RequestParams, - type ResponseCallback, - type ResponseType, - type StatusNotificationRequest -} from './ocpp/Requests.js' + AmpereUnits, + type ChargingStationTemplate, + CurrentType, + type FirmwareUpgrade, + PowerUnits, + Voltage, + type WsOptions +} from './ChargingStationTemplate.js' export { - AvailabilityStatus, - type BootNotificationResponse, - ChargingProfileStatus, - type ClearCacheResponse, - ClearChargingProfileStatus, - ConfigurationStatus, - type DataTransferResponse, - DataTransferStatus, - type DiagnosticsStatusNotificationResponse, - type ErrorResponse, - type FirmwareStatusNotificationResponse, - type HeartbeatResponse, - type MeterValuesResponse, - ReservationStatus, - type Response, - type ResponseHandler, - type StatusNotificationResponse, - TriggerMessageStatus, - UnlockStatus -} from './ocpp/Responses.js' + type ChargingStationData, + type ChargingStationOptions, + type ChargingStationWorkerData, + type ChargingStationWorkerEventError, + type ChargingStationWorkerMessage, + type ChargingStationWorkerMessageData, + ChargingStationWorkerMessageEvents, + type EvseStatusWorkerType +} from './ChargingStationWorker.js' export { - AuthorizationStatus, - type AuthorizeRequest, - type AuthorizeResponse, - type StartTransactionRequest, - type StartTransactionResponse, - StopTransactionReason, - type StopTransactionRequest, - type StopTransactionResponse -} from './ocpp/Transaction.js' -export { BootReasonEnumType, OCPP20ConnectorStatusEnumType } from './ocpp/2.0/Common.js' + ApplicationProtocolVersion, + type ConfigurationData, + ConfigurationSection, + type ElementsPerWorkerType, + type LogConfiguration, + type StationTemplateUrl, + type StorageConfiguration, + SupervisionUrlDistribution, + type UIServerConfiguration, + type WorkerConfiguration +} from './ConfigurationData.js' +export type { ConnectorStatus } from './ConnectorStatus.js' +export type { EmptyObject } from './EmptyObject.js' +export type { HandleErrorParams } from './Error.js' +export type { EvseStatus, EvseTemplate } from './Evse.js' +export { FileType } from './FileType.js' +export type { JsonObject, JsonType } from './JsonType.js' +export type { + MeasurandPerPhaseSampledValueTemplates, + SampledValueTemplate +} from './MeasurandPerPhaseSampledValueTemplates.js' +export type { MeasurandValues } from './MeasurandValues.js' +export { OCPP16ChargePointErrorCode } from './ocpp/1.6/ChargePointErrorCode.js' +export { OCPP16ChargePointStatus } from './ocpp/1.6/ChargePointStatus.js' export { - BroadcastChannelProcedureName, - type BroadcastChannelRequest, - type BroadcastChannelRequestPayload, - type BroadcastChannelResponse, - type BroadcastChannelResponsePayload, - type MessageEvent -} from './WorkerBroadcastChannel.js' + type OCPP16ChargingProfile, + OCPP16ChargingProfilePurposeType, + OCPP16ChargingRateUnitType, + type OCPP16ChargingSchedule, + type OCPP16ChargingSchedulePeriod +} from './ocpp/1.6/ChargingProfile.js' +export { + OCPP16StandardParametersKey, + OCPP16SupportedFeatureProfiles +} from './ocpp/1.6/Configuration.js' +export { OCPP16DiagnosticsStatus } from './ocpp/1.6/DiagnosticsStatus.js' +export { + type OCPP16MeterValue, + OCPP16MeterValueContext, + OCPP16MeterValueLocation, + OCPP16MeterValueMeasurand, + OCPP16MeterValuePhase, + type OCPP16MeterValuesRequest, + type OCPP16MeterValuesResponse, + OCPP16MeterValueUnit, + type OCPP16SampledValue +} from './ocpp/1.6/MeterValues.js' export { type ChangeConfigurationRequest, type GetConfigurationRequest, @@ -133,6 +132,32 @@ export { type SetChargingProfileResponse, type UnlockConnectorResponse } from './ocpp/1.6/Responses.js' +export { + OCPP16AuthorizationStatus, + type OCPP16AuthorizeRequest, + type OCPP16AuthorizeResponse, + type OCPP16StartTransactionRequest, + type OCPP16StartTransactionResponse, + OCPP16StopTransactionReason, + type OCPP16StopTransactionRequest, + type OCPP16StopTransactionResponse +} from './ocpp/1.6/Transaction.js' +export { BootReasonEnumType, OCPP20ConnectorStatusEnumType } from './ocpp/2.0/Common.js' +export { + type OCPP20BootNotificationRequest, + type OCPP20ClearCacheRequest, + type OCPP20HeartbeatRequest, + OCPP20IncomingRequestCommand, + OCPP20RequestCommand, + type OCPP20StatusNotificationRequest +} from './ocpp/2.0/Requests.js' +export type { + OCPP20BootNotificationResponse, + OCPP20ClearCacheResponse, + OCPP20HeartbeatResponse, + OCPP20StatusNotificationResponse +} from './ocpp/2.0/Responses.js' +export { OCPP20OptionalVariableName } from './ocpp/2.0/Variables.js' export { ChargePointErrorCode } from './ocpp/ChargePointErrorCode.js' export { type ChargingProfile, @@ -141,46 +166,7 @@ export { type ChargingSchedulePeriod, RecurrencyKindType } from './ocpp/ChargingProfile.js' -export type { - ChargingStationConfiguration, - EvseStatusConfiguration -} from './ChargingStationConfiguration.js' -export { - type ChargingStationData, - type ChargingStationWorkerData, - type ChargingStationWorkerEventError, - type ChargingStationWorkerMessage, - type ChargingStationWorkerMessageData, - ChargingStationWorkerMessageEvents, - type ChargingStationOptions, - type EvseStatusWorkerType -} from './ChargingStationWorker.js' -export type { ChargingStationInfo } from './ChargingStationInfo.js' -export type { - ChargingStationOcppConfiguration, - ConfigurationKey -} from './ChargingStationOcppConfiguration.js' -export { - AmpereUnits, - type ChargingStationTemplate, - CurrentType, - type FirmwareUpgrade, - PowerUnits, - Voltage, - type WsOptions -} from './ChargingStationTemplate.js' -export { - ApplicationProtocolVersion, - type ConfigurationData, - ConfigurationSection, - type ElementsPerWorkerType, - type LogConfiguration, - type StationTemplateUrl, - type StorageConfiguration, - SupervisionUrlDistribution, - type UIServerConfiguration, - type WorkerConfiguration -} from './ConfigurationData.js' +export { type GenericResponse, GenericStatus, RegistrationStatusEnumType } from './ocpp/Common.js' export { type ConfigurationKeyType, ConnectorPhaseRotation, @@ -189,20 +175,8 @@ export { SupportedFeatureProfiles, VendorParametersKey } from './ocpp/Configuration.js' -export type { ConnectorStatus } from './ConnectorStatus.js' export { ConnectorStatusEnum, type ConnectorStatusTransition } from './ocpp/ConnectorStatusEnum.js' -export { DBName, StorageType } from './Storage.js' -export type { EmptyObject } from './EmptyObject.js' export { ErrorType } from './ocpp/ErrorType.js' -export type { EvseTemplate, EvseStatus } from './Evse.js' -export { FileType } from './FileType.js' -export type { HandleErrorParams } from './Error.js' -export type { JsonObject, JsonType } from './JsonType.js' -export type { - MeasurandPerPhaseSampledValueTemplates, - SampledValueTemplate -} from './MeasurandPerPhaseSampledValueTemplates.js' -export type { MeasurandValues } from './MeasurandValues.js' export { MessageType } from './ocpp/MessageType.js' export { type MeterValue, @@ -213,57 +187,65 @@ export { MeterValueUnit, type SampledValue } from './ocpp/MeterValues.js' +export { OCPPVersion } from './ocpp/OCPPVersion.js' export { - type OCPP16MeterValue, - OCPP16MeterValueContext, - OCPP16MeterValueLocation, - OCPP16MeterValueMeasurand, - OCPP16MeterValuePhase, - OCPP16MeterValueUnit, - type OCPP16MeterValuesRequest, - type OCPP16MeterValuesResponse, - type OCPP16SampledValue -} from './ocpp/1.6/MeterValues.js' -export { - OCPP16AuthorizationStatus, - type OCPP16AuthorizeRequest, - type OCPP16AuthorizeResponse, - type OCPP16StartTransactionRequest, - type OCPP16StartTransactionResponse, - OCPP16StopTransactionReason, - type OCPP16StopTransactionRequest, - type OCPP16StopTransactionResponse -} from './ocpp/1.6/Transaction.js' -export { OCPP16ChargePointErrorCode } from './ocpp/1.6/ChargePointErrorCode.js' -export { OCPP16ChargePointStatus } from './ocpp/1.6/ChargePointStatus.js' + AvailabilityType, + type BootNotificationRequest, + type CachedRequest, + type DataTransferRequest, + type DiagnosticsStatusNotificationRequest, + type ErrorCallback, + FirmwareStatus, + type FirmwareStatusNotificationRequest, + type HeartbeatRequest, + type IncomingRequest, + IncomingRequestCommand, + type IncomingRequestHandler, + MessageTrigger, + type MeterValuesRequest, + type OutgoingRequest, + RequestCommand, + type RequestParams, + type ResponseCallback, + type ResponseType, + type StatusNotificationRequest +} from './ocpp/Requests.js' export { - type OCPP16ChargingProfile, - OCPP16ChargingProfilePurposeType, - OCPP16ChargingRateUnitType, - type OCPP16ChargingSchedule, - type OCPP16ChargingSchedulePeriod -} from './ocpp/1.6/ChargingProfile.js' + type Reservation, + type ReservationKey, + ReservationTerminationReason +} from './ocpp/Reservation.js' export { - OCPP16StandardParametersKey, - OCPP16SupportedFeatureProfiles -} from './ocpp/1.6/Configuration.js' -export { OCPP16DiagnosticsStatus } from './ocpp/1.6/DiagnosticsStatus.js' + AvailabilityStatus, + type BootNotificationResponse, + ChargingProfileStatus, + type ClearCacheResponse, + ClearChargingProfileStatus, + ConfigurationStatus, + type DataTransferResponse, + DataTransferStatus, + type DiagnosticsStatusNotificationResponse, + type ErrorResponse, + type FirmwareStatusNotificationResponse, + type HeartbeatResponse, + type MeterValuesResponse, + ReservationStatus, + type Response, + type ResponseHandler, + type StatusNotificationResponse, + TriggerMessageStatus, + UnlockStatus +} from './ocpp/Responses.js' export { - type OCPP20BootNotificationRequest, - type OCPP20ClearCacheRequest, - type OCPP20HeartbeatRequest, - OCPP20IncomingRequestCommand, - OCPP20RequestCommand, - type OCPP20StatusNotificationRequest -} from './ocpp/2.0/Requests.js' -export type { - OCPP20BootNotificationResponse, - OCPP20ClearCacheResponse, - OCPP20HeartbeatResponse, - OCPP20StatusNotificationResponse -} from './ocpp/2.0/Responses.js' -export { OCPP20OptionalVariableName } from './ocpp/2.0/Variables.js' -export { OCPPVersion } from './ocpp/OCPPVersion.js' + AuthorizationStatus, + type AuthorizeRequest, + type AuthorizeResponse, + type StartTransactionRequest, + type StartTransactionResponse, + StopTransactionReason, + type StopTransactionRequest, + type StopTransactionResponse +} from './ocpp/Transaction.js' export { PerformanceRecord } from './orm/entities/PerformanceRecord.js' export type { InternalTemplateStatistics, @@ -271,14 +253,32 @@ export type { StatisticsData, TimestampedData } from './Statistics.js' +export { DBName, StorageType } from './Storage.js' +export { + ApplicationProtocol, + AuthenticationType, + ProcedureName, + Protocol, + type ProtocolRequest, + type ProtocolRequestHandler, + type ProtocolResponse, + ProtocolVersion, + type RequestPayload, + type ResponsePayload, + ResponseStatus, + type SimulatorState, + type TemplateStatistics +} from './UIProtocol.js' export { - type WSError, WebSocketCloseEventStatusCode, - WebSocketCloseEventStatusString + WebSocketCloseEventStatusString, + type WSError } from './WebSocket.js' export { - type Reservation, - type ReservationKey, - ReservationTerminationReason -} from './ocpp/Reservation.js' -export { ChargingStationEvents } from './ChargingStationEvents.js' + BroadcastChannelProcedureName, + type BroadcastChannelRequest, + type BroadcastChannelRequestPayload, + type BroadcastChannelResponse, + type BroadcastChannelResponsePayload, + type MessageEvent +} from './WorkerBroadcastChannel.js' diff --git a/src/types/ocpp/1.6/Requests.ts b/src/types/ocpp/1.6/Requests.ts index 26dd03f7..c57be203 100644 --- a/src/types/ocpp/1.6/Requests.ts +++ b/src/types/ocpp/1.6/Requests.ts @@ -1,3 +1,5 @@ +import type { EmptyObject } from '../../EmptyObject.js' +import type { JsonObject } from '../../JsonType.js' import type { OCPP16ChargePointErrorCode } from './ChargePointErrorCode.js' import type { OCPP16ChargePointStatus } from './ChargePointStatus.js' import type { @@ -7,8 +9,6 @@ import type { } from './ChargingProfile.js' import type { OCPP16StandardParametersKey, OCPP16VendorParametersKey } from './Configuration.js' import type { OCPP16DiagnosticsStatus } from './DiagnosticsStatus.js' -import type { EmptyObject } from '../../EmptyObject.js' -import type { JsonObject } from '../../JsonType.js' export enum OCPP16RequestCommand { BOOT_NOTIFICATION = 'BootNotification', diff --git a/src/types/ocpp/1.6/Responses.ts b/src/types/ocpp/1.6/Responses.ts index b8c36ed2..8b67a926 100644 --- a/src/types/ocpp/1.6/Responses.ts +++ b/src/types/ocpp/1.6/Responses.ts @@ -1,8 +1,8 @@ -import type { OCPP16ChargingSchedule } from './ChargingProfile.js' import type { EmptyObject } from '../../EmptyObject.js' import type { JsonObject } from '../../JsonType.js' import type { GenericStatus, RegistrationStatusEnumType } from '../Common.js' import type { OCPPConfigurationKey } from '../Configuration.js' +import type { OCPP16ChargingSchedule } from './ChargingProfile.js' export interface OCPP16HeartbeatResponse extends JsonObject { currentTime: Date diff --git a/src/types/ocpp/1.6/Transaction.ts b/src/types/ocpp/1.6/Transaction.ts index 2e6c7289..f9659f69 100644 --- a/src/types/ocpp/1.6/Transaction.ts +++ b/src/types/ocpp/1.6/Transaction.ts @@ -1,5 +1,5 @@ -import type { OCPP16MeterValue } from './MeterValues.js' import type { JsonObject } from '../../JsonType.js' +import type { OCPP16MeterValue } from './MeterValues.js' export enum OCPP16StopTransactionReason { EMERGENCY_STOP = 'EmergencyStop', diff --git a/src/types/ocpp/2.0/Requests.ts b/src/types/ocpp/2.0/Requests.ts index d2c87287..f075e642 100644 --- a/src/types/ocpp/2.0/Requests.ts +++ b/src/types/ocpp/2.0/Requests.ts @@ -1,11 +1,11 @@ +import type { EmptyObject } from '../../EmptyObject.js' +import type { JsonObject } from '../../JsonType.js' import type { BootReasonEnumType, InstallCertificateUseEnumType, OCPP20ConnectorStatusEnumType } from './Common.js' import type { OCPP20SetVariableDataType } from './Variables.js' -import type { EmptyObject } from '../../EmptyObject.js' -import type { JsonObject } from '../../JsonType.js' export enum OCPP20RequestCommand { BOOT_NOTIFICATION = 'BootNotification', diff --git a/src/types/ocpp/2.0/Responses.ts b/src/types/ocpp/2.0/Responses.ts index 51d6ad44..4248c5d8 100644 --- a/src/types/ocpp/2.0/Responses.ts +++ b/src/types/ocpp/2.0/Responses.ts @@ -1,12 +1,12 @@ +import type { EmptyObject } from '../../EmptyObject.js' +import type { JsonObject } from '../../JsonType.js' +import type { RegistrationStatusEnumType } from '../Common.js' import type { GenericStatusEnumType, InstallCertificateStatusEnumType, StatusInfoType } from './Common.js' import type { OCPP20SetVariableResultType } from './Variables.js' -import type { EmptyObject } from '../../EmptyObject.js' -import type { JsonObject } from '../../JsonType.js' -import type { RegistrationStatusEnumType } from '../Common.js' export interface OCPP20BootNotificationResponse extends JsonObject { currentTime: Date diff --git a/src/types/ocpp/2.0/Variables.ts b/src/types/ocpp/2.0/Variables.ts index 439abf35..04a34456 100644 --- a/src/types/ocpp/2.0/Variables.ts +++ b/src/types/ocpp/2.0/Variables.ts @@ -1,5 +1,5 @@ -import type { EVSEType, StatusInfoType } from './Common.js' import type { JsonObject } from '../../JsonType.js' +import type { EVSEType, StatusInfoType } from './Common.js' enum OCPP20ComponentName { AlignedDataCtrlr = 'AlignedDataCtrlr', diff --git a/src/types/ocpp/Configuration.ts b/src/types/ocpp/Configuration.ts index c1742348..f1cd34ba 100644 --- a/src/types/ocpp/Configuration.ts +++ b/src/types/ocpp/Configuration.ts @@ -1,3 +1,4 @@ +import type { JsonObject } from '../JsonType.js' import { OCPP16StandardParametersKey, OCPP16SupportedFeatureProfiles, @@ -8,7 +9,6 @@ import { OCPP20RequiredVariableName, OCPP20VendorVariableName } from './2.0/Variables.js' -import type { JsonObject } from '../JsonType.js' export const StandardParametersKey = { ...OCPP16StandardParametersKey, diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index c718f1e0..12e1c68c 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -1,3 +1,6 @@ +import type { ChargingStation } from '../../charging-station/index.js' +import type { OCPPError } from '../../exception/index.js' +import type { JsonType } from '../JsonType.js' import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus.js' import type { OCPP16MeterValuesRequest } from './1.6/MeterValues.js' import { @@ -23,9 +26,6 @@ import { type OCPP20StatusNotificationRequest } from './2.0/Requests.js' import type { MessageType } from './MessageType.js' -import type { ChargingStation } from '../../charging-station/index.js' -import type { OCPPError } from '../../exception/index.js' -import type { JsonType } from '../JsonType.js' export const RequestCommand = { ...OCPP16RequestCommand, diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index 9983ee8a..aac5a5fc 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -1,3 +1,5 @@ +import type { ChargingStation } from '../../charging-station/index.js' +import type { JsonType } from '../JsonType.js' import type { OCPP16MeterValuesResponse } from './1.6/MeterValues.js' import { OCPP16AvailabilityStatus, @@ -19,8 +21,6 @@ import type { OCPP20BootNotificationResponse, OCPP20ClearCacheResponse } from '. import { type GenericResponse, GenericStatus } from './Common.js' import type { ErrorType } from './ErrorType.js' import type { MessageType } from './MessageType.js' -import type { ChargingStation } from '../../charging-station/index.js' -import type { JsonType } from '../JsonType.js' export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType] diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index d577ded4..46ad889c 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -6,16 +6,6 @@ import { fileURLToPath } from 'node:url' import chalk from 'chalk' import { mergeDeepRight } from 'rambda' -import { - buildPerformanceUriFilePath, - checkWorkerElementsPerWorker, - checkWorkerProcessType, - getDefaultPerformanceStorageUri, - handleFileException, - logPrefix -} from './ConfigurationUtils.js' -import { Constants } from './Constants.js' -import { hasOwnProp, isCFEnvironment, once } from './Utils.js' import { ApplicationProtocol, ApplicationProtocolVersion, @@ -37,6 +27,16 @@ import { DEFAULT_WORKER_START_DELAY, WorkerProcessType } from '../worker/index.js' +import { + buildPerformanceUriFilePath, + checkWorkerElementsPerWorker, + checkWorkerProcessType, + getDefaultPerformanceStorageUri, + handleFileException, + logPrefix +} from './ConfigurationUtils.js' +import { Constants } from './Constants.js' +import { hasOwnProp, isCFEnvironment, once } from './Utils.js' type ConfigurationSectionType = | LogConfiguration diff --git a/src/utils/ConfigurationUtils.ts b/src/utils/ConfigurationUtils.ts index fd976859..2a85bb0e 100644 --- a/src/utils/ConfigurationUtils.ts +++ b/src/utils/ConfigurationUtils.ts @@ -3,10 +3,10 @@ import { fileURLToPath } from 'node:url' import chalk from 'chalk' -import { Constants } from './Constants.js' -import { isNotEmptyString, logPrefix as utilsLogPrefix } from './Utils.js' import { type ElementsPerWorkerType, type FileType, StorageType } from '../types/index.js' import { WorkerProcessType } from '../worker/index.js' +import { Constants } from './Constants.js' +import { isNotEmptyString, logPrefix as utilsLogPrefix } from './Utils.js' export const logPrefix = (): string => { return utilsLogPrefix(' Simulator configuration |') diff --git a/src/utils/ErrorUtils.ts b/src/utils/ErrorUtils.ts index bd4fcf37..9c243a29 100644 --- a/src/utils/ErrorUtils.ts +++ b/src/utils/ErrorUtils.ts @@ -2,8 +2,6 @@ import process from 'node:process' import chalk from 'chalk' -import { logger } from './Logger.js' -import { isNotEmptyString } from './Utils.js' import type { ChargingStation } from '../charging-station/index.js' import type { EmptyObject, @@ -13,6 +11,8 @@ import type { JsonType, RequestCommand } from '../types/index.js' +import { logger } from './Logger.js' +import { isNotEmptyString } from './Utils.js' const defaultErrorParams = { throwError: true, diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index bc8dd07c..543a2b23 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -1,9 +1,9 @@ -import { type FSWatcher, type WatchListener, readFileSync, watch } from 'node:fs' +import { type FSWatcher, readFileSync, watch, type WatchListener } from 'node:fs' +import type { FileType, JsonType } from '../types/index.js' import { handleFileException } from './ErrorUtils.js' import { logger } from './Logger.js' import { isNotEmptyString } from './Utils.js' -import type { FileType, JsonType } from '../types/index.js' export const watchJsonFile = ( file: string, diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index 7d80e1ae..b13ec047 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -3,9 +3,9 @@ import { createLogger, format, type transport } from 'winston' import TransportType from 'winston/lib/winston/transports/index.js' import DailyRotateFile from 'winston-daily-rotate-file' +import { ConfigurationSection, type LogConfiguration } from '../types/index.js' import { Configuration } from './Configuration.js' import { insertAt } from './Utils.js' -import { ConfigurationSection, type LogConfiguration } from '../types/index.js' const logConfiguration = Configuration.getConfigurationSection( ConfigurationSection.log diff --git a/src/utils/MessageChannelUtils.ts b/src/utils/MessageChannelUtils.ts index 65dcc9a8..0306d60e 100644 --- a/src/utils/MessageChannelUtils.ts +++ b/src/utils/MessageChannelUtils.ts @@ -1,10 +1,3 @@ -import { - OutputFormat, - buildChargingStationAutomaticTransactionGeneratorConfiguration, - buildConnectorsStatus, - buildEvsesStatus -} from './ChargingStationConfigurationUtils.js' -import { clone } from './Utils.js' import type { ChargingStation } from '../charging-station/index.js' import { type ChargingStationData, @@ -14,6 +7,13 @@ import { type Statistics, type TemplateStatistics } from '../types/index.js' +import { + buildChargingStationAutomaticTransactionGeneratorConfiguration, + buildConnectorsStatus, + buildEvsesStatus, + OutputFormat +} from './ChargingStationConfigurationUtils.js' +import { clone } from './Utils.js' export const buildAddedMessage = ( chargingStation: ChargingStation diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index abfac5e4..c021cadb 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -13,13 +13,13 @@ import { secondsToMilliseconds } from 'date-fns' -import { Constants } from './Constants.js' import { type EmptyObject, type ProtocolResponse, type TimestampedData, WebSocketCloseEventStatusString } from '../types/index.js' +import { Constants } from './Constants.js' export const logPrefix = (prefixString = ''): string => { return `${new Date().toLocaleString()}${prefixString}` diff --git a/src/utils/index.ts b/src/utils/index.ts index 1bc4fe7e..81dc04d2 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,14 +1,14 @@ -export { ACElectricUtils, DCElectricUtils } from './ElectricUtils.js' export { AsyncLock, AsyncLockType } from './AsyncLock.js' export { - OutputFormat, buildChargingStationAutomaticTransactionGeneratorConfiguration, buildConnectorsStatus, - buildEvsesStatus + buildEvsesStatus, + OutputFormat } from './ChargingStationConfigurationUtils.js' export { CircularArray } from './CircularArray.js' export { Configuration } from './Configuration.js' export { Constants } from './Constants.js' +export { ACElectricUtils, DCElectricUtils } from './ElectricUtils.js' export { handleFileException, handleSendMessageError, @@ -17,6 +17,7 @@ export { setDefaultErrorParams } from './ErrorUtils.js' export { watchJsonFile } from './FileUtils.js' +export { logger } from './Logger.js' export { buildAddedMessage, buildChargingStationDataPayload, @@ -27,8 +28,8 @@ export { buildTemplateStatisticsPayload, buildUpdatedMessage } from './MessageChannelUtils.js' +export { average, median, nthPercentile, stdDeviation } from './StatisticUtils.js' export { - JSONStringifyWithMapSupport, clone, convertToBoolean, convertToDate, @@ -51,6 +52,7 @@ export { isNotEmptyArray, isNotEmptyString, isValidDate, + JSONStringifyWithMapSupport, logPrefix, max, min, @@ -60,5 +62,3 @@ export { sleep, validateUUID } from './Utils.js' -export { average, median, nthPercentile, stdDeviation } from './StatisticUtils.js' -export { logger } from './Logger.js'