From 4c3c0d59f56be4d58e906e938c00390b41e0ca7f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 19 May 2023 18:55:16 +0200 Subject: [PATCH] refactor: revert internal exports MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../AutomaticTransactionGenerator.ts | 4 ++- src/charging-station/Bootstrap.ts | 4 ++- src/charging-station/ChargingStation.ts | 31 ++++++++----------- .../ChargingStationConfigurationUtils.ts | 2 +- src/charging-station/ChargingStationUtils.ts | 2 +- src/charging-station/ChargingStationWorker.ts | 3 +- .../ChargingStationWorkerBroadcastChannel.ts | 8 ++--- src/charging-station/IdTagsCache.ts | 3 +- src/charging-station/MessageChannelUtils.ts | 2 +- src/charging-station/SharedLRUCache.ts | 2 +- .../UIServiceWorkerBroadcastChannel.ts | 3 +- src/charging-station/index.ts | 12 +++---- src/charging-station/internal.ts | 19 ------------ .../ocpp/1.6/OCPP16Constants.ts | 2 +- .../ocpp/1.6/OCPP16IncomingRequestService.ts | 4 ++- .../ocpp/1.6/OCPP16RequestService.ts | 10 +++--- .../ocpp/1.6/OCPP16ResponseService.ts | 3 +- .../ocpp/1.6/OCPP16ServiceUtils.ts | 2 +- .../ocpp/2.0/OCPP20Constants.ts | 2 +- .../ocpp/2.0/OCPP20IncomingRequestService.ts | 3 +- .../ocpp/2.0/OCPP20RequestService.ts | 10 +++--- .../ocpp/2.0/OCPP20ResponseService.ts | 3 +- .../ocpp/2.0/OCPP20ServiceUtils.ts | 2 +- .../ocpp/OCPPIncomingRequestService.ts | 3 +- .../ocpp/OCPPRequestService.ts | 7 +++-- .../ocpp/OCPPResponseService.ts | 2 +- src/charging-station/ocpp/OCPPServiceUtils.ts | 3 +- src/charging-station/ocpp/index.ts | 24 +++++++------- src/charging-station/ocpp/internal.ts | 17 ---------- .../ui-server/AbstractUIServer.ts | 3 +- .../ui-server/UIHttpServer.ts | 3 +- .../ui-server/UIServerFactory.ts | 5 ++- .../ui-server/UIWebSocketServer.ts | 3 +- .../ui-services/AbstractUIService.ts | 4 ++- .../ui-server/ui-services/UIService001.ts | 3 +- .../ui-server/ui-services/UIServiceFactory.ts | 4 ++- src/start.ts | 3 +- 37 files changed, 99 insertions(+), 121 deletions(-) delete mode 100644 src/charging-station/internal.ts delete mode 100644 src/charging-station/ocpp/internal.ts diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 948b375e..2eec1f22 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -2,7 +2,9 @@ import { AsyncResource } from 'node:async_hooks'; -import { type ChargingStation, ChargingStationUtils, IdTagsCache } from './internal'; +import type { ChargingStation } from './ChargingStation'; +import { ChargingStationUtils } from './ChargingStationUtils'; +import { IdTagsCache } from './IdTagsCache'; import { BaseError } from '../exception'; // import { PerformanceStatistics } from '../performance'; import { PerformanceStatistics } from '../performance/PerformanceStatistics'; diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 653a8ddb..cdfb26a6 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -6,7 +6,9 @@ import { type Worker, isMainThread } from 'node:worker_threads'; import chalk from 'chalk'; -import { type AbstractUIServer, ChargingStationUtils, UIServerFactory } from './internal'; +import { ChargingStationUtils } from './ChargingStationUtils'; +import type { AbstractUIServer } from './ui-server/AbstractUIServer'; +import { UIServerFactory } from './ui-server/UIServerFactory'; import packageJson 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 0ae3be5f..d730a2cb 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -9,33 +9,28 @@ import { parentPort } from 'node:worker_threads'; import merge from 'just-merge'; import WebSocket, { type RawData } from 'ws'; +import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator'; +import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; +import { ChargingStationUtils } from './ChargingStationUtils'; +import { ChargingStationWorkerBroadcastChannel } from './ChargingStationWorkerBroadcastChannel'; +import { IdTagsCache } from './IdTagsCache'; +import { MessageChannelUtils } from './MessageChannelUtils'; import { - AutomaticTransactionGenerator, - ChargingStationConfigurationUtils, - ChargingStationUtils, - ChargingStationWorkerBroadcastChannel, - IdTagsCache, - MessageChannelUtils, - SharedLRUCache, -} from './internal'; -import { - // OCPP16IncomingRequestService, + OCPP16IncomingRequestService, OCPP16RequestService, - // OCPP16ResponseService, + OCPP16ResponseService, OCPP16ServiceUtils, OCPP20IncomingRequestService, OCPP20RequestService, - // OCPP20ResponseService, + OCPP20ResponseService, type OCPPIncomingRequestService, type OCPPRequestService, - // OCPPServiceUtils, + OCPPServiceUtils, } from './ocpp'; -import { OCPP16IncomingRequestService } from './ocpp/1.6/OCPP16IncomingRequestService'; -import { OCPP16ResponseService } from './ocpp/1.6/OCPP16ResponseService'; -import { OCPP20ResponseService } from './ocpp/2.0/OCPP20ResponseService'; -import { OCPPServiceUtils } from './ocpp/OCPPServiceUtils'; +import { SharedLRUCache } from './SharedLRUCache'; import { BaseError, OCPPError } from '../exception'; -import { PerformanceStatistics } from '../performance'; +// import { PerformanceStatistics } from '../performance'; +import { PerformanceStatistics } from '../performance/PerformanceStatistics'; import { type AutomaticTransactionGeneratorConfiguration, AvailabilityType, diff --git a/src/charging-station/ChargingStationConfigurationUtils.ts b/src/charging-station/ChargingStationConfigurationUtils.ts index 373cdc6d..e529aa7f 100644 --- a/src/charging-station/ChargingStationConfigurationUtils.ts +++ b/src/charging-station/ChargingStationConfigurationUtils.ts @@ -1,4 +1,4 @@ -import type { ChargingStation } from './internal'; +import type { ChargingStation } from './ChargingStation'; import type { ConfigurationKey, ConfigurationKeyType } from '../types'; import { logger } from '../utils'; diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index d8f67c21..2a60bb41 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url'; import chalk from 'chalk'; import moment from 'moment'; -import type { ChargingStation } from './internal'; +import type { ChargingStation } from './ChargingStation'; import { BaseError } from '../exception'; import { AmpereUnits, diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index 4361ab9b..c4ff06ea 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -4,7 +4,8 @@ import { parentPort, workerData } from 'node:worker_threads'; import { ThreadWorker } from 'poolifier'; -import { ChargingStation, ChargingStationUtils } from './internal'; +import { ChargingStation } from './ChargingStation'; +import { ChargingStationUtils } from './ChargingStationUtils'; import type { ChargingStationWorkerData } from '../types'; import { Utils } from '../utils'; import { WorkerConstants, type WorkerMessage, WorkerMessageEvents } from '../worker'; diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index c03c4acb..30cef34e 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -1,9 +1,7 @@ -import { - type ChargingStation, - ChargingStationConfigurationUtils, - WorkerBroadcastChannel, -} from './internal'; +import type { ChargingStation } from './ChargingStation'; +import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; import { OCPP16ServiceUtils } from './ocpp'; +import { WorkerBroadcastChannel } from './WorkerBroadcastChannel'; import { BaseError, type OCPPError } from '../exception'; import { AuthorizationStatus, diff --git a/src/charging-station/IdTagsCache.ts b/src/charging-station/IdTagsCache.ts index e5d28181..ceea0e5b 100644 --- a/src/charging-station/IdTagsCache.ts +++ b/src/charging-station/IdTagsCache.ts @@ -1,6 +1,7 @@ import fs from 'node:fs'; -import { type ChargingStation, ChargingStationUtils } from './internal'; +import type { ChargingStation } from './ChargingStation'; +import { ChargingStationUtils } from './ChargingStationUtils'; import { FileType, IdTagDistribution } from '../types'; import { FileUtils, Utils, logger } from '../utils'; diff --git a/src/charging-station/MessageChannelUtils.ts b/src/charging-station/MessageChannelUtils.ts index 11ecd3ca..5c1d1cac 100644 --- a/src/charging-station/MessageChannelUtils.ts +++ b/src/charging-station/MessageChannelUtils.ts @@ -1,4 +1,4 @@ -import type { ChargingStation } from './internal'; +import type { ChargingStation } from './ChargingStation'; import { type ChargingStationData, type ChargingStationWorkerMessage, diff --git a/src/charging-station/SharedLRUCache.ts b/src/charging-station/SharedLRUCache.ts index 1243d6ae..ba0a47d5 100644 --- a/src/charging-station/SharedLRUCache.ts +++ b/src/charging-station/SharedLRUCache.ts @@ -1,6 +1,6 @@ import LRUCache from 'mnemonist/lru-map-with-delete.js'; -import { Bootstrap } from './internal'; +import { Bootstrap } from './Bootstrap'; import type { ChargingStationConfiguration, ChargingStationTemplate } from '../types'; import { Utils } from '../utils'; diff --git a/src/charging-station/UIServiceWorkerBroadcastChannel.ts b/src/charging-station/UIServiceWorkerBroadcastChannel.ts index 5f77b0e3..075a92c4 100644 --- a/src/charging-station/UIServiceWorkerBroadcastChannel.ts +++ b/src/charging-station/UIServiceWorkerBroadcastChannel.ts @@ -1,4 +1,5 @@ -import { type AbstractUIService, WorkerBroadcastChannel } from './internal'; +import type { AbstractUIService } from './ui-server/ui-services/AbstractUIService'; +import { WorkerBroadcastChannel } from './WorkerBroadcastChannel'; import { type BroadcastChannelResponse, type BroadcastChannelResponsePayload, diff --git a/src/charging-station/index.ts b/src/charging-station/index.ts index 3b7660fe..db87a0d9 100644 --- a/src/charging-station/index.ts +++ b/src/charging-station/index.ts @@ -1,7 +1,5 @@ -export { - Bootstrap, - type ChargingStation, - ChargingStationConfigurationUtils, - ChargingStationUtils, - MessageChannelUtils, -} from './internal'; +export { Bootstrap } from './Bootstrap'; +export type { ChargingStation } from './ChargingStation'; +export { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; +export { ChargingStationUtils } from './ChargingStationUtils'; +export { MessageChannelUtils } from './MessageChannelUtils'; diff --git a/src/charging-station/internal.ts b/src/charging-station/internal.ts deleted file mode 100644 index cdeabbaf..00000000 --- a/src/charging-station/internal.ts +++ /dev/null @@ -1,19 +0,0 @@ -export * from './IdTagsCache'; -export * from './AutomaticTransactionGenerator'; -export * from './Bootstrap'; -export * from './ChargingStation'; -export * from './ChargingStationConfigurationUtils'; -export * from './ChargingStationUtils'; -export * from './ChargingStationWorkerBroadcastChannel'; -export * from './MessageChannelUtils'; -export * from './SharedLRUCache'; -export * from './UIServiceWorkerBroadcastChannel'; -export * from './WorkerBroadcastChannel'; -export * from './ui-server/AbstractUIServer'; -export * from './ui-server/UIHttpServer'; -export * from './ui-server/UIServerFactory'; -export * from './ui-server/UIServerUtils'; -export * from './ui-server/UIWebSocketServer'; -export * from './ui-server/ui-services/AbstractUIService'; -export * from './ui-server/ui-services/UIService001'; -export * from './ui-server/ui-services/UIServiceFactory'; diff --git a/src/charging-station/ocpp/1.6/OCPP16Constants.ts b/src/charging-station/ocpp/1.6/OCPP16Constants.ts index 3c3102cc..c33e5529 100644 --- a/src/charging-station/ocpp/1.6/OCPP16Constants.ts +++ b/src/charging-station/ocpp/1.6/OCPP16Constants.ts @@ -1,5 +1,5 @@ import { type ConnectorStatusTransition, OCPP16ChargePointStatus } from '../../../types'; -import { OCPPConstants } from '../internal'; +import { OCPPConstants } from '../OCPPConstants'; export class OCPP16Constants extends OCPPConstants { static readonly ChargePointStatusChargingStationTransitions: Readonly< diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index a7d02dca..a33d0c26 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -8,6 +8,8 @@ import type { JSONSchemaType } from 'ajv'; import { Client, type FTPResponse } from 'basic-ftp'; import tar from 'tar'; +import { OCPP16Constants } from './OCPP16Constants'; +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import { type ChargingStation, ChargingStationConfigurationUtils, @@ -83,7 +85,7 @@ import { type UnlockConnectorResponse, } from '../../../types'; import { Constants, Utils, logger } from '../../../utils'; -import { OCPP16Constants, OCPP16ServiceUtils, OCPPIncomingRequestService } from '../internal'; +import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService'; const moduleName = 'OCPP16IncomingRequestService'; diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index 3bc73aaa..8ff6bea4 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -2,6 +2,8 @@ import type { JSONSchemaType } from 'ajv'; +import { OCPP16Constants } from './OCPP16Constants'; +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import type { ChargingStation } from '../../../charging-station'; import { OCPPError } from '../../../exception'; import { @@ -23,12 +25,8 @@ import { type RequestParams, } from '../../../types'; import { Constants, Utils } from '../../../utils'; -import { - OCPP16Constants, - OCPP16ServiceUtils, - OCPPRequestService, - type OCPPResponseService, -} from '../internal'; +import { OCPPRequestService } from '../OCPPRequestService'; +import type { OCPPResponseService } from '../OCPPResponseService'; const moduleName = 'OCPP16RequestService'; diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 889b0235..8703c7e5 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -4,6 +4,7 @@ import { parentPort } from 'node:worker_threads'; import type { JSONSchemaType } from 'ajv'; +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import { type ChargingStation, ChargingStationConfigurationUtils, @@ -50,7 +51,7 @@ import { type UnlockConnectorResponse, } from '../../../types'; import { Constants, Utils, logger } from '../../../utils'; -import { OCPP16ServiceUtils, OCPPResponseService } from '../internal'; +import { OCPPResponseService } from '../OCPPResponseService'; const moduleName = 'OCPP16ResponseService'; diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index a271d2ae..68f4a6ea 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -30,7 +30,7 @@ import { Voltage, } from '../../../types'; import { ACElectricUtils, Constants, DCElectricUtils, Utils, logger } from '../../../utils'; -import { OCPPServiceUtils } from '../internal'; +import { OCPPServiceUtils } from '../OCPPServiceUtils'; export class OCPP16ServiceUtils extends OCPPServiceUtils { public static checkFeatureProfile( diff --git a/src/charging-station/ocpp/2.0/OCPP20Constants.ts b/src/charging-station/ocpp/2.0/OCPP20Constants.ts index 1575833a..8c64d8e7 100644 --- a/src/charging-station/ocpp/2.0/OCPP20Constants.ts +++ b/src/charging-station/ocpp/2.0/OCPP20Constants.ts @@ -1,5 +1,5 @@ import { type ConnectorStatusTransition, OCPP20ConnectorStatusEnumType } from '../../../types'; -import { OCPPConstants } from '../internal'; +import { OCPPConstants } from '../OCPPConstants'; export class OCPP20Constants extends OCPPConstants { static readonly ChargingStationStatusTransitions: Readonly = diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 3ca4d3cf..143eee88 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -2,6 +2,7 @@ import type { JSONSchemaType } from 'ajv'; +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; import type { ChargingStation } from '../../../charging-station'; import { OCPPError } from '../../../exception'; import { @@ -14,7 +15,7 @@ import { OCPPVersion, } from '../../../types'; import { logger } from '../../../utils'; -import { OCPP20ServiceUtils, OCPPIncomingRequestService } from '../internal'; +import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService'; const moduleName = 'OCPP20IncomingRequestService'; diff --git a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts index e65ff3d4..9faa7952 100644 --- a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts @@ -2,6 +2,8 @@ import type { JSONSchemaType } from 'ajv'; +import { OCPP20Constants } from './OCPP20Constants'; +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; import type { ChargingStation } from '../../../charging-station'; import { OCPPError } from '../../../exception'; import { @@ -16,12 +18,8 @@ import { type RequestParams, } from '../../../types'; import { Utils } from '../../../utils'; -import { - OCPP20Constants, - OCPP20ServiceUtils, - OCPPRequestService, - type OCPPResponseService, -} from '../internal'; +import { OCPPRequestService } from '../OCPPRequestService'; +import type { OCPPResponseService } from '../OCPPResponseService'; const moduleName = 'OCPP20RequestService'; diff --git a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts index a0af4ab1..535014ff 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts @@ -2,6 +2,7 @@ import type { JSONSchemaType } from 'ajv'; +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; import { type ChargingStation, ChargingStationConfigurationUtils } from '../../../charging-station'; import { OCPPError } from '../../../exception'; import { @@ -20,7 +21,7 @@ import { type ResponseHandler, } from '../../../types'; import { logger } from '../../../utils'; -import { OCPP20ServiceUtils, OCPPResponseService } from '../internal'; +import { OCPPResponseService } from '../OCPPResponseService'; const moduleName = 'OCPP20ResponseService'; diff --git a/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts b/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts index 9fb61bd0..38b80968 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts @@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url'; import type { JSONSchemaType } from 'ajv'; import { type JsonType, OCPPVersion } from '../../../types'; -import { OCPPServiceUtils } from '../internal'; +import { OCPPServiceUtils } from '../OCPPServiceUtils'; export class OCPP20ServiceUtils extends OCPPServiceUtils { public static parseJsonSchemaFile( diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 80857cc7..c98c28b8 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -3,7 +3,8 @@ import { AsyncResource } from 'node:async_hooks'; import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; -import { OCPPConstants, OCPPServiceUtils } from './internal'; +import { OCPPConstants } from './OCPPConstants'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import { type ChargingStation, ChargingStationUtils } from '../../charging-station'; import { OCPPError } from '../../exception'; import type { diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 3eb85e30..30e4a4a8 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,10 +1,13 @@ import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; -import { OCPPConstants, type OCPPResponseService, OCPPServiceUtils } from './internal'; +import { OCPPConstants } from './OCPPConstants'; +import type { OCPPResponseService } from './OCPPResponseService'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import type { ChargingStation } from '../../charging-station'; import { OCPPError } from '../../exception'; -import { PerformanceStatistics } from '../../performance'; +// import { PerformanceStatistics } from '../../performance'; +import { PerformanceStatistics } from '../../performance/PerformanceStatistics'; import { type EmptyObject, type ErrorCallback, diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index c7730890..caf826e0 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,7 +1,7 @@ import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; -import { OCPPServiceUtils } from './internal'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import type { ChargingStation } from '../../charging-station'; import { OCPPError } from '../../exception'; import type { diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index ef678f31..9e8db34e 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -2,7 +2,8 @@ import fs from 'node:fs'; import type { DefinedError, ErrorObject, JSONSchemaType } from 'ajv'; -import { OCPP16Constants, OCPP20Constants } from './internal'; +import { OCPP16Constants } from './1.6/OCPP16Constants'; +import { OCPP20Constants } from './2.0/OCPP20Constants'; import { type ChargingStation, ChargingStationConfigurationUtils } from '../../charging-station'; import { BaseError } from '../../exception'; import { diff --git a/src/charging-station/ocpp/index.ts b/src/charging-station/ocpp/index.ts index 9e0738b8..02fadb3e 100644 --- a/src/charging-station/ocpp/index.ts +++ b/src/charging-station/ocpp/index.ts @@ -1,13 +1,11 @@ -export { - OCPP16IncomingRequestService, - OCPP16RequestService, - OCPP16ResponseService, - // FIXME: shall not be exported - OCPP16ServiceUtils, - OCPP20IncomingRequestService, - OCPP20RequestService, - OCPP20ResponseService, - OCPPIncomingRequestService, - OCPPRequestService, - OCPPServiceUtils, -} from './internal'; +export { OCPP16IncomingRequestService } from './1.6/OCPP16IncomingRequestService'; +export { OCPP16RequestService } from './1.6/OCPP16RequestService'; +export { OCPP16ResponseService } from './1.6/OCPP16ResponseService'; +// FIXME: shall not be exported +export { OCPP16ServiceUtils } from './1.6/OCPP16ServiceUtils'; +export { OCPP20IncomingRequestService } from './2.0/OCPP20IncomingRequestService'; +export { OCPP20RequestService } from './2.0/OCPP20RequestService'; +export { OCPP20ResponseService } from './2.0/OCPP20ResponseService'; +export { OCPPIncomingRequestService } from './OCPPIncomingRequestService'; +export { OCPPRequestService } from './OCPPRequestService'; +export { OCPPServiceUtils } from './OCPPServiceUtils'; diff --git a/src/charging-station/ocpp/internal.ts b/src/charging-station/ocpp/internal.ts deleted file mode 100644 index f1c9af00..00000000 --- a/src/charging-station/ocpp/internal.ts +++ /dev/null @@ -1,17 +0,0 @@ -export * from './1.6/OCPP16Constants'; -export * from './1.6/OCPP16IncomingRequestService'; -export * from './1.6/OCPP16RequestService'; -export * from './1.6/OCPP16ResponseService'; -export * from './1.6/OCPP16ServiceUtils'; - -export * from './2.0/OCPP20Constants'; -export * from './2.0/OCPP20IncomingRequestService'; -export * from './2.0/OCPP20RequestService'; -export * from './2.0/OCPP20ResponseService'; -export * from './2.0/OCPP20ServiceUtils'; - -export * from './OCPPConstants'; -export * from './OCPPIncomingRequestService'; -export * from './OCPPRequestService'; -export * from './OCPPResponseService'; -export * from './OCPPServiceUtils'; diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index ca53d558..f2429ae1 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -2,6 +2,8 @@ import { type IncomingMessage, Server, type ServerResponse } from 'node:http'; import type { WebSocket } from 'ws'; +import type { AbstractUIService } from './ui-services/AbstractUIService'; +import { UIServiceFactory } from './ui-services/UIServiceFactory'; import { AuthenticationType, type ChargingStationData, @@ -13,7 +15,6 @@ import { type ResponsePayload, type UIServerConfiguration, } from '../../types'; -import { type AbstractUIService, UIServiceFactory } from '../internal'; export abstract class AbstractUIServer { public readonly chargingStations: Map; diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index 9e333026..b99ef36a 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -2,6 +2,8 @@ import type { IncomingMessage, RequestListener, ServerResponse } from 'node:http import { StatusCodes } from 'http-status-codes'; +import { AbstractUIServer } from './AbstractUIServer'; +import { UIServerUtils } from './UIServerUtils'; import { BaseError } from '../../exception'; import { type ProcedureName, @@ -14,7 +16,6 @@ import { type UIServerConfiguration, } from '../../types'; import { Constants, Utils, logger } from '../../utils'; -import { AbstractUIServer, UIServerUtils } from '../internal'; const moduleName = 'UIHttpServer'; diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index 905ce66d..a5fb5a5d 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -1,8 +1,11 @@ import chalk from 'chalk'; +import type { AbstractUIServer } from './AbstractUIServer'; +import { UIHttpServer } from './UIHttpServer'; +import { UIServerUtils } from './UIServerUtils'; +import { UIWebSocketServer } from './UIWebSocketServer'; import { ApplicationProtocol, type UIServerConfiguration } from '../../types'; import { Configuration } from '../../utils'; -import { type AbstractUIServer, UIHttpServer, UIServerUtils, UIWebSocketServer } from '../internal'; export class UIServerFactory { private constructor() { diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index bf9eb8b3..cc00db13 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -4,6 +4,8 @@ import type { Duplex } from 'node:stream'; import { StatusCodes } from 'http-status-codes'; import WebSocket, { type RawData, WebSocketServer } from 'ws'; +import { AbstractUIServer } from './AbstractUIServer'; +import { UIServerUtils } from './UIServerUtils'; import { type ProtocolRequest, type ProtocolResponse, @@ -11,7 +13,6 @@ import { WebSocketCloseEventStatusCode, } from '../../types'; import { Constants, Utils, logger } from '../../utils'; -import { AbstractUIServer, UIServerUtils } from '../internal'; const moduleName = 'UIWebSocketServer'; diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index 900b79d5..0aaeb3aa 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -11,7 +11,9 @@ import { ResponseStatus, } from '../../../types'; import { Utils, logger } from '../../../utils'; -import { type AbstractUIServer, Bootstrap, UIServiceWorkerBroadcastChannel } from '../../internal'; +import { Bootstrap } from '../../Bootstrap'; +import { UIServiceWorkerBroadcastChannel } from '../../UIServiceWorkerBroadcastChannel'; +import type { AbstractUIServer } from '../AbstractUIServer'; const moduleName = 'AbstractUIService'; diff --git a/src/charging-station/ui-server/ui-services/UIService001.ts b/src/charging-station/ui-server/ui-services/UIService001.ts index 4a1d1e9a..598ebb26 100644 --- a/src/charging-station/ui-server/ui-services/UIService001.ts +++ b/src/charging-station/ui-server/ui-services/UIService001.ts @@ -1,5 +1,6 @@ +import { AbstractUIService } from './AbstractUIService'; import { type ProcedureName, type ProtocolRequestHandler, ProtocolVersion } from '../../../types'; -import { type AbstractUIServer, AbstractUIService } from '../../internal'; +import type { AbstractUIServer } from '../AbstractUIServer'; 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 2d2fa6c8..47a1893d 100644 --- a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts +++ b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts @@ -1,5 +1,7 @@ +import type { AbstractUIService } from './AbstractUIService'; +import { UIService001 } from './UIService001'; import { ProtocolVersion } from '../../../types'; -import { type AbstractUIServer, type AbstractUIService, UIService001 } from '../../internal'; +import type { AbstractUIServer } from '../AbstractUIServer'; export class UIServiceFactory { private constructor() { diff --git a/src/start.ts b/src/start.ts index 12acc3eb..ee4d336e 100644 --- a/src/start.ts +++ b/src/start.ts @@ -2,7 +2,8 @@ import chalk from 'chalk'; -import { Bootstrap } from './charging-station'; +// import { Bootstrap } from './charging-station'; +import { Bootstrap } from './charging-station/Bootstrap'; Bootstrap.getInstance() .start() -- 2.34.1