From 0dd1fb158fa202630ff7ed64599feece78792953 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 19 Mar 2026 15:24:42 +0100 Subject: [PATCH] refactor(ocpp): consolidate cross-stack types and harmonize barrel imports Consolidate OCPP types with common semantics across 1.6 and 2.0 stacks (AuthorizationStatus, StopTransactionReason, MessageTrigger, DataTransfer, TriggerMessageStatus, UnlockStatus, AvailabilityStatus, HeartbeatRequest/ Response, StatusNotificationResponse, FirmwareStatusNotificationResponse). Harmonize all imports across src/ and tests/ to use the barrel (types/index.ts) instead of direct version-specific type paths, matching the pattern already established by the OCPP 1.6 handlers. --- eslint.config.js | 1 + src/charging-station/ChargingStation.ts | 4 +- .../ocpp/2.0/OCPP20CertificateManager.ts | 2 +- .../ocpp/2.0/OCPP20IncomingRequestService.ts | 18 ++++---- .../ocpp/2.0/OCPP20ResponseService.ts | 9 ++-- .../ocpp/2.0/OCPP20ServiceUtils.ts | 22 ++++------ src/charging-station/ocpp/OCPPServiceUtils.ts | 4 +- .../ocpp/auth/adapters/OCPP16AuthAdapter.ts | 2 +- .../ocpp/auth/adapters/OCPP20AuthAdapter.ts | 15 ++++--- .../auth/factories/AuthComponentFactory.ts | 3 +- .../ocpp/auth/interfaces/OCPPAuthService.ts | 3 +- .../ocpp/auth/services/OCPPAuthServiceImpl.ts | 5 +-- .../auth/strategies/RemoteAuthStrategy.ts | 2 +- .../ocpp/auth/types/AuthTypes.ts | 7 ++-- src/charging-station/ocpp/index.ts | 5 +-- src/types/index.ts | 20 +++++++++ src/types/ocpp/2.0/index.ts | 11 ----- src/types/ocpp/Requests.ts | 16 ++++++-- src/types/ocpp/Responses.ts | 41 +++++++++++++++---- src/types/ocpp/Transaction.ts | 7 +++- .../ocpp/1.6/OCPP16Constants.test.ts | 2 +- ...gRequestService-ChangeAvailability.test.ts | 2 +- ...comingRequestService-Configuration.test.ts | 6 ++- ...P16IncomingRequestService-Firmware.test.ts | 2 +- ...ingRequestService-RemoteStopUnlock.test.ts | 13 +++--- ...IncomingRequestService-Reservation.test.ts | 2 +- ...OCPP16IncomingRequestService-Reset.test.ts | 3 +- ...omingRequestService-SimpleHandlers.test.ts | 2 +- ...comingRequestService-SmartCharging.test.ts | 7 ++-- ...OCPP16Integration-ChargingProfiles.test.ts | 11 +++-- .../OCPP16Integration-Configuration.test.ts | 6 ++- .../OCPP16Integration-Reservations.test.ts | 2 +- .../OCPP16Integration-Transactions.test.ts | 12 +++--- .../OCPP16ResponseService-BootAuth.test.ts | 2 +- ...OCPP16ResponseService-Transactions.test.ts | 10 +++-- .../ocpp/1.6/OCPP16ServiceUtils.test.ts | 2 +- .../ocpp/1.6/OCPP16TestUtils.ts | 13 +++--- ...RequestService-CustomerInformation.test.ts | 2 +- ...comingRequestService-GetBaseReport.test.ts | 2 +- ...IncomingRequestService-GroupIdStop.test.ts | 6 ++- ...0IncomingRequestService-MasterPass.test.ts | 2 +- ...mingRequestService-RemoteStartAuth.test.ts | 12 +++--- ...estService-RequestStartTransaction.test.ts | 14 +++---- ...uestService-RequestStopTransaction.test.ts | 6 +-- ...ngRequestService-SetNetworkProfile.test.ts | 8 ++-- ...P20RequestService-BootNotification.test.ts | 2 +- .../OCPP20ResponseService-CacheUpdate.test.ts | 3 +- ...20ResponseService-TransactionEvent.test.ts | 4 +- ...CPP20ServiceUtils-TransactionEvent.test.ts | 22 ++++------ .../ocpp/2.0/OCPP20TestUtils.ts | 4 +- .../ocpp/2.0/OCPP20VariableManager.test.ts | 2 +- .../ocpp/auth/OCPPAuthIntegration.test.ts | 2 +- .../auth/adapters/OCPP16AuthAdapter.test.ts | 5 +-- .../auth/adapters/OCPP20AuthAdapter.test.ts | 4 +- .../factories/AuthComponentFactory.test.ts | 2 +- .../ocpp/auth/helpers/MockFactories.ts | 2 +- .../services/OCPPAuthServiceFactory.test.ts | 2 +- .../auth/services/OCPPAuthServiceImpl.test.ts | 2 +- .../CertificateAuthStrategy.test.ts | 2 +- ...lAuthStrategy-DisablePostAuthorize.test.ts | 2 +- .../auth/strategies/LocalAuthStrategy.test.ts | 2 +- .../strategies/RemoteAuthStrategy.test.ts | 2 +- .../ocpp/auth/types/AuthTypes.test.ts | 6 +-- .../ocpp/auth/utils/AuthHelpers.test.ts | 2 +- .../ocpp/auth/utils/AuthValidators.test.ts | 2 +- tests/helpers/OCPPAuthIntegrationTest.ts | 2 +- 66 files changed, 222 insertions(+), 200 deletions(-) delete mode 100644 src/types/ocpp/2.0/index.ts diff --git a/eslint.config.js b/eslint.config.js index ce1d6d31..69be31d7 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -67,6 +67,7 @@ export default defineConfig([ 'AUTHCTRLR', 'recloser', 'deauthorize', + 'Deauth', 'DEAUTHORIZE', 'deauthorized', 'DEAUTHORIZED', diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 7fd59b9a..be7b228b 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -9,6 +9,8 @@ import { URL } from 'node:url' import { parentPort } from 'node:worker_threads' import { type RawData, WebSocket } from 'ws' +import type { OCPP16StopTransactionReason } from '../types/index.js' + import { BaseError, OCPPError } from '../exception/index.js' import { PerformanceStatistics } from '../performance/index.js' import { @@ -1223,7 +1225,7 @@ export class ChargingStation extends EventEmitter { >(this, RequestCommand.STOP_TRANSACTION, { meterStop: this.getEnergyActiveImportRegisterByTransactionId(rawTransactionId, true), transactionId, - ...(reason != null && { reason }), + ...(reason != null && { reason: reason as OCPP16StopTransactionReason }), }) } diff --git a/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts b/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts index e255cb2e..8de4b883 100644 --- a/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts +++ b/src/charging-station/ocpp/2.0/OCPP20CertificateManager.ts @@ -14,7 +14,7 @@ import { GetCertificateIdUseEnumType, HashAlgorithmEnumType, InstallCertificateUseEnumType, -} from '../../../types/ocpp/2.0/Common.js' +} from '../../../types/index.js' import { convertToDate, getErrorMessage } from '../../../utils/index.js' /** diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 99d3c41a..02fd5234 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -3,11 +3,6 @@ import type { ValidateFunction } from 'ajv' import type { ChargingStation } from '../../../charging-station/index.js' -import type { - OCPP20ChargingProfileType, - OCPP20ChargingScheduleType, - OCPP20IdTokenType, -} from '../../../types/ocpp/2.0/Transaction.js' import { OCPPError } from '../../../exception/index.js' import { @@ -41,6 +36,11 @@ import { type OCPP20CertificateSignedResponse, type OCPP20ChangeAvailabilityRequest, type OCPP20ChangeAvailabilityResponse, + OCPP20ChargingProfileKindEnumType, + OCPP20ChargingProfilePurposeEnumType, + type OCPP20ChargingProfileType, + OCPP20ChargingRateUnitEnumType, + type OCPP20ChargingScheduleType, type OCPP20ClearCacheResponse, OCPP20ComponentName, OCPP20ConnectorStatusEnumType, @@ -66,6 +66,7 @@ import { type OCPP20GetVariablesResponse, type OCPP20HeartbeatRequest, type OCPP20HeartbeatResponse, + type OCPP20IdTokenType, OCPP20IncomingRequestCommand, type OCPP20InstallCertificateRequest, type OCPP20InstallCertificateResponse, @@ -79,6 +80,7 @@ import { type OCPP20NotifyReportRequest, type OCPP20NotifyReportResponse, OCPP20OperationalStatusEnumType, + OCPP20ReasonEnumType, OCPP20RequestCommand, type OCPP20RequestStartTransactionRequest, type OCPP20RequestStartTransactionResponse, @@ -119,12 +121,6 @@ import { UpdateFirmwareStatusEnumType, UploadLogStatusEnumType, } from '../../../types/index.js' -import { - OCPP20ChargingProfileKindEnumType, - OCPP20ChargingProfilePurposeEnumType, - OCPP20ChargingRateUnitEnumType, - OCPP20ReasonEnumType, -} from '../../../types/ocpp/2.0/Transaction.js' import { convertToDate, generateUUID, diff --git a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts index 9810439b..ef07ca6c 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts @@ -1,15 +1,15 @@ import type { ValidateFunction } from 'ajv' -import type { OCPP20IncomingRequestCommand } from '../../../types/index.js' - import { addConfigurationKey, type ChargingStation } from '../../../charging-station/index.js' import { ChargingStationEvents, ConnectorStatusEnum, type JsonType, + OCPP20AuthorizationStatusEnumType, type OCPP20BootNotificationResponse, type OCPP20FirmwareStatusNotificationResponse, type OCPP20HeartbeatResponse, + type OCPP20IncomingRequestCommand, type OCPP20LogStatusNotificationResponse, type OCPP20MeterValuesResponse, type OCPP20NotifyCustomerInformationResponse, @@ -18,6 +18,7 @@ import { OCPP20RequestCommand, type OCPP20SecurityEventNotificationResponse, type OCPP20StatusNotificationResponse, + OCPP20TransactionEventEnumType, type OCPP20TransactionEventRequest, type OCPP20TransactionEventResponse, OCPPVersion, @@ -25,10 +26,6 @@ import { type RequestCommand, type ResponseHandler, } from '../../../types/index.js' -import { - OCPP20AuthorizationStatusEnumType, - OCPP20TransactionEventEnumType, -} from '../../../types/ocpp/2.0/Transaction.js' import { convertToDate, logger } from '../../../utils/index.js' import { mapOCPP20TokenType, OCPPAuthServiceFactory } from '../auth/index.js' import { OCPPResponseService } from '../OCPPResponseService.js' diff --git a/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts b/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts index 866a36b5..91d57c85 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ServiceUtils.ts @@ -7,29 +7,25 @@ import { ConnectorStatusEnum, ErrorType, type JsonObject, + OCPP20ChargingStateEnumType, OCPP20ComponentName, + type OCPP20EVSEType, OCPP20IncomingRequestCommand, + OCPP20MeasurandEnumType, + type OCPP20MeterValue, + OCPP20ReadingContextEnumType, + OCPP20ReasonEnumType, OCPP20RequestCommand, + OCPP20RequiredVariableName, OCPP20TransactionEventEnumType, + type OCPP20TransactionEventOptions, type OCPP20TransactionEventRequest, type OCPP20TransactionEventResponse, + type OCPP20TransactionType, OCPP20TriggerReasonEnumType, OCPPVersion, type UUIDv4, } from '../../../types/index.js' -import { OCPP20RequiredVariableName } from '../../../types/index.js' -import { - OCPP20MeasurandEnumType, - type OCPP20MeterValue, - OCPP20ReadingContextEnumType, -} from '../../../types/ocpp/2.0/MeterValues.js' -import { - OCPP20ChargingStateEnumType, - type OCPP20EVSEType, - OCPP20ReasonEnumType, - type OCPP20TransactionEventOptions, - type OCPP20TransactionType, -} from '../../../types/ocpp/2.0/Transaction.js' import { Constants, convertToIntOrNaN, diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index d5b2abcc..224880b6 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -2075,7 +2075,9 @@ export class OCPPServiceUtils { chargingStation: ChargingStation, messageTrigger: MessageTrigger ): boolean { - const isMessageTrigger = Object.values(MessageTrigger).includes(messageTrigger) + const isMessageTrigger = (Object.values(MessageTrigger) as MessageTrigger[]).includes( + messageTrigger + ) if (isMessageTrigger && chargingStation.stationInfo?.messageTriggerSupport == null) { return true } else if ( diff --git a/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts b/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts index 83cd7fe2..678640b7 100644 --- a/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts +++ b/src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.ts @@ -11,10 +11,10 @@ import { getConfigurationKey } from '../../../../charging-station/ConfigurationK import { type OCPP16AuthorizeRequest, type OCPP16AuthorizeResponse, + OCPPVersion, RequestCommand, StandardParametersKey, } from '../../../../types/index.js' -import { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' import { logger, truncateId } from '../../../../utils/index.js' import { AuthContext, diff --git a/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts b/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts index b805a23f..22ec843f 100644 --- a/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts +++ b/src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts @@ -1,4 +1,8 @@ -import type { RequestStartStopStatusEnumType } from '../../../../types/index.js' +import type { + AdditionalInfoType, + OCPP20TransactionEventResponse, + RequestStartStopStatusEnumType, +} from '../../../../types/index.js' import type { ChargingStation } from '../../../index.js' import type { OCPPAuthAdapter } from '../interfaces/OCPPAuthService.js' import type { @@ -10,16 +14,15 @@ import type { import { OCPP20ServiceUtils } from '../../2.0/OCPP20ServiceUtils.js' import { OCPP20VariableManager } from '../../2.0/OCPP20VariableManager.js' -import { GetVariableStatusEnumType, type OCPP20IdTokenType } from '../../../../types/index.js' import { - type AdditionalInfoType, + GetVariableStatusEnumType, OCPP20AuthorizationStatusEnumType, OCPP20IdTokenEnumType, + type OCPP20IdTokenType, OCPP20TransactionEventEnumType, - type OCPP20TransactionEventResponse, OCPP20TriggerReasonEnumType, -} from '../../../../types/ocpp/2.0/Transaction.js' -import { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' + OCPPVersion, +} from '../../../../types/index.js' import { generateUUID, logger, truncateId } from '../../../../utils/index.js' import { AuthContext, diff --git a/src/charging-station/ocpp/auth/factories/AuthComponentFactory.ts b/src/charging-station/ocpp/auth/factories/AuthComponentFactory.ts index 27128d71..026bca55 100644 --- a/src/charging-station/ocpp/auth/factories/AuthComponentFactory.ts +++ b/src/charging-station/ocpp/auth/factories/AuthComponentFactory.ts @@ -9,8 +9,7 @@ import type { import type { AuthConfiguration } from '../types/AuthTypes.js' import { OCPPError } from '../../../../exception/OCPPError.js' -import { ErrorType } from '../../../../types/index.js' -import { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' +import { ErrorType, OCPPVersion } from '../../../../types/index.js' import { InMemoryAuthCache } from '../cache/InMemoryAuthCache.js' import { AuthConfigValidator } from '../utils/ConfigValidator.js' diff --git a/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts b/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts index 6fc794be..d7b54acc 100644 --- a/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts +++ b/src/charging-station/ocpp/auth/interfaces/OCPPAuthService.ts @@ -1,5 +1,4 @@ -import type { OCPP20IdTokenInfoType } from '../../../../types/ocpp/2.0/Transaction.js' -import type { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' +import type { OCPP20IdTokenInfoType, OCPPVersion } from '../../../../types/index.js' import type { AuthConfiguration, AuthorizationResult, diff --git a/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts b/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts index a570d32b..04abcc97 100644 --- a/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts +++ b/src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts @@ -1,11 +1,10 @@ -import type { OCPP20IdTokenInfoType } from '../../../../types/ocpp/2.0/Transaction.js' +import type { OCPP20IdTokenInfoType } from '../../../../types/index.js' import type { OCPP16AuthAdapter } from '../adapters/OCPP16AuthAdapter.js' import type { OCPP20AuthAdapter } from '../adapters/OCPP20AuthAdapter.js' import type { LocalAuthStrategy } from '../strategies/LocalAuthStrategy.js' import { OCPPError } from '../../../../exception/OCPPError.js' -import { ErrorType } from '../../../../types/index.js' -import { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' +import { ErrorType, OCPPVersion } from '../../../../types/index.js' import { convertToDate, ensureError, diff --git a/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts b/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts index 6a1fb91b..c60a44d1 100644 --- a/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts +++ b/src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts @@ -1,4 +1,4 @@ -import type { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' +import type { OCPPVersion } from '../../../../types/index.js' import type { AuthCache, AuthStrategy, diff --git a/src/charging-station/ocpp/auth/types/AuthTypes.ts b/src/charging-station/ocpp/auth/types/AuthTypes.ts index 1fba4f64..2f7d7bce 100644 --- a/src/charging-station/ocpp/auth/types/AuthTypes.ts +++ b/src/charging-station/ocpp/auth/types/AuthTypes.ts @@ -1,12 +1,11 @@ -import type { JsonObject } from '../../../../types/JsonType.js' -import type { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js' +import type { JsonObject, OCPPVersion } from '../../../../types/index.js' -import { OCPP16AuthorizationStatus } from '../../../../types/ocpp/1.6/Transaction.js' import { + OCPP16AuthorizationStatus, OCPP20AuthorizationStatusEnumType, OCPP20IdTokenEnumType, RequestStartStopStatusEnumType, -} from '../../../../types/ocpp/2.0/Transaction.js' +} from '../../../../types/index.js' /** * Authentication context for strategy selection diff --git a/src/charging-station/ocpp/index.ts b/src/charging-station/ocpp/index.ts index 960b0952..47f32ffc 100644 --- a/src/charging-station/ocpp/index.ts +++ b/src/charging-station/ocpp/index.ts @@ -1,7 +1,4 @@ -export { - OCPP20TransactionEventEnumType, - OCPP20TriggerReasonEnumType, -} from '../../types/ocpp/2.0/Transaction.js' +export { OCPP20TransactionEventEnumType, OCPP20TriggerReasonEnumType } from '../../types/index.js' export { OCPP16IncomingRequestService } from './1.6/OCPP16IncomingRequestService.js' export { OCPP16RequestService } from './1.6/OCPP16RequestService.js' export { OCPP16ResponseService } from './1.6/OCPP16ResponseService.js' diff --git a/src/types/index.ts b/src/types/index.ts index ed5470e7..e8582e20 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -63,6 +63,7 @@ export { OCPP16ChargePointErrorCode } from './ocpp/1.6/ChargePointErrorCode.js' export { OCPP16ChargePointStatus } from './ocpp/1.6/ChargePointStatus.js' export { type OCPP16ChargingProfile, + OCPP16ChargingProfileKindType, OCPP16ChargingProfilePurposeType, OCPP16ChargingRateUnitType, type OCPP16ChargingSchedule, @@ -110,6 +111,7 @@ export { type RemoteStartTransactionRequest, type RemoteStopTransactionRequest, type ResetRequest, + ResetType, type SetChargingProfileRequest, type UnlockConnectorRequest, } from './ocpp/1.6/Requests.js' @@ -117,19 +119,25 @@ export { type ChangeConfigurationResponse, type GetConfigurationResponse, type GetDiagnosticsResponse, + OCPP16AvailabilityStatus, type OCPP16BootNotificationResponse, type OCPP16ChangeAvailabilityResponse, + OCPP16ChargingProfileStatus, type OCPP16ClearChargingProfileResponse, + OCPP16ClearChargingProfileStatus, + OCPP16ConfigurationStatus, type OCPP16DataTransferResponse, OCPP16DataTransferStatus, type OCPP16DiagnosticsStatusNotificationResponse, type OCPP16FirmwareStatusNotificationResponse, type OCPP16GetCompositeScheduleResponse, type OCPP16HeartbeatResponse, + OCPP16ReservationStatus, type OCPP16ReserveNowResponse, type OCPP16StatusNotificationResponse, type OCPP16TriggerMessageResponse, OCPP16TriggerMessageStatus, + OCPP16UnlockStatus, type OCPP16UpdateFirmwareResponse, type SetChargingProfileResponse, type UnlockConnectorResponse, @@ -151,6 +159,7 @@ export { type CertificateHashDataType, CertificateSigningUseEnumType, ChangeAvailabilityStatusEnumType, + type ChargingStationType, type CustomDataType, CustomerInformationStatusEnumType, DataEnumType, @@ -174,6 +183,9 @@ export { OCPP20FirmwareStatusEnumType, OCPP20OperationalStatusEnumType, OCPP20UnitEnumType, + OCPPInterfaceEnumType, + OCPPTransportEnumType, + OCPPVersionEnumType, type OCSPRequestDataType, ReasonCodeEnumType, ReportBaseEnumType, @@ -266,6 +278,7 @@ export type { OCPP20UpdateFirmwareResponse, } from './ocpp/2.0/Responses.js' export { + type AdditionalInfoType, type ComponentType, OCPP20AuthorizationStatusEnumType, OCPP20ChargingProfileKindEnumType, @@ -274,9 +287,16 @@ export { OCPP20ChargingRateUnitEnumType, type OCPP20ChargingSchedulePeriodType, type OCPP20ChargingScheduleType, + OCPP20ChargingStateEnumType, OCPP20ConnectorStatusEnumType, + type OCPP20EVSEType, + OCPP20IdTokenEnumType, + type OCPP20IdTokenInfoType, type OCPP20IdTokenType, + OCPP20MessageFormatEnumType, + OCPP20ReasonEnumType, OCPP20TransactionEventEnumType, + type OCPP20TransactionEventOptions, type OCPP20TransactionEventRequest, type OCPP20TransactionEventResponse, type OCPP20TransactionType, diff --git a/src/types/ocpp/2.0/index.ts b/src/types/ocpp/2.0/index.ts deleted file mode 100644 index 0d56994d..00000000 --- a/src/types/ocpp/2.0/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type { OCPP20MeterValue } from './MeterValues.js' -export type { - OCPP20ChargingStateEnumType, - OCPP20EVSEType, - OCPP20IdTokenInfoType, - OCPP20IdTokenType, - OCPP20ReasonEnumType, - OCPP20TransactionEventEnumType, - OCPP20TransactionEventOptions, - OCPP20TransactionEventRequest, -} from './Transaction.js' diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index 566514c4..3cc1df8b 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -21,10 +21,16 @@ import { type OCPP16ReserveNowRequest, type OCPP16StatusNotificationRequest, } from './1.6/Requests.js' -import { OCPP20FirmwareStatusEnumType, OCPP20OperationalStatusEnumType } from './2.0/Common.js' +import { + MessageTriggerEnumType, + OCPP20FirmwareStatusEnumType, + OCPP20OperationalStatusEnumType, +} from './2.0/Common.js' import { type OCPP20BootNotificationRequest, + type OCPP20DataTransferRequest, type OCPP20FirmwareStatusNotificationRequest, + type OCPP20HeartbeatRequest, OCPP20IncomingRequestCommand, OCPP20RequestCommand, type OCPP20StatusNotificationRequest, @@ -39,7 +45,7 @@ export type CachedRequest = [ JsonType ] -export type DataTransferRequest = OCPP16DataTransferRequest +export type DataTransferRequest = OCPP16DataTransferRequest | OCPP20DataTransferRequest export type DiagnosticsStatusNotificationRequest = OCPP16DiagnosticsStatusNotificationRequest @@ -49,7 +55,8 @@ export type FirmwareStatusNotificationRequest = | OCPP16FirmwareStatusNotificationRequest | OCPP20FirmwareStatusNotificationRequest -export type HeartbeatRequest = OCPP16HeartbeatRequest +// eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents +export type HeartbeatRequest = OCPP16HeartbeatRequest | OCPP20HeartbeatRequest export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType] @@ -83,9 +90,10 @@ export interface RequestParams { export const MessageTrigger = { ...OCPP16MessageTrigger, + ...MessageTriggerEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type MessageTrigger = OCPP16MessageTrigger +export type MessageTrigger = MessageTriggerEnumType | OCPP16MessageTrigger export type MeterValuesRequest = OCPP16MeterValuesRequest | OCPP20MeterValuesRequest diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index ef7e95ed..58ccd5db 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -2,7 +2,14 @@ import type { ChargingStation } from '../../charging-station/index.js' import type { JsonType } from '../JsonType.js' import type { OCPP16MeterValuesResponse } from './1.6/MeterValues.js' import type { OCPP20MeterValuesResponse } from './2.0/MeterValues.js' -import type { OCPP20BootNotificationResponse, OCPP20ClearCacheResponse } from './2.0/Responses.js' +import type { + OCPP20BootNotificationResponse, + OCPP20ClearCacheResponse, + OCPP20DataTransferResponse, + OCPP20FirmwareStatusNotificationResponse, + OCPP20HeartbeatResponse, + OCPP20StatusNotificationResponse, +} from './2.0/Responses.js' import type { ErrorType } from './ErrorType.js' import type { MessageType } from './MessageType.js' @@ -22,6 +29,12 @@ import { OCPP16TriggerMessageStatus, OCPP16UnlockStatus, } from './1.6/Responses.js' +import { + ChangeAvailabilityStatusEnumType, + DataTransferStatusEnumType, + TriggerMessageStatusEnumType, + UnlockStatusEnumType, +} from './2.0/Common.js' import { type GenericResponse, GenericStatus } from './Common.js' export type BootNotificationResponse = @@ -32,15 +45,18 @@ export type CancelReservationResponse = GenericResponse export type ClearCacheResponse = GenericResponse | OCPP20ClearCacheResponse -export type DataTransferResponse = OCPP16DataTransferResponse +export type DataTransferResponse = OCPP16DataTransferResponse | OCPP20DataTransferResponse export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotificationResponse export type ErrorResponse = [MessageType.CALL_ERROR_MESSAGE, string, ErrorType, string, JsonType] -export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse +export type FirmwareStatusNotificationResponse = + | OCPP16FirmwareStatusNotificationResponse + // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents + | OCPP20FirmwareStatusNotificationResponse -export type HeartbeatResponse = OCPP16HeartbeatResponse +export type HeartbeatResponse = OCPP16HeartbeatResponse | OCPP20HeartbeatResponse // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents export type MeterValuesResponse = OCPP16MeterValuesResponse | OCPP20MeterValuesResponse @@ -53,13 +69,17 @@ export type ResponseHandler = ( requestPayload?: JsonType ) => Promise | void -export type StatusNotificationResponse = OCPP16StatusNotificationResponse +export type StatusNotificationResponse = + | OCPP16StatusNotificationResponse + // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents + | OCPP20StatusNotificationResponse export const AvailabilityStatus = { ...OCPP16AvailabilityStatus, + ...ChangeAvailabilityStatusEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type AvailabilityStatus = OCPP16AvailabilityStatus +export type AvailabilityStatus = ChangeAvailabilityStatusEnumType | OCPP16AvailabilityStatus export const ChargingProfileStatus = { ...OCPP16ChargingProfileStatus, @@ -81,21 +101,24 @@ export type ConfigurationStatus = OCPP16ConfigurationStatus export const UnlockStatus = { ...OCPP16UnlockStatus, + ...UnlockStatusEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type UnlockStatus = OCPP16UnlockStatus +export type UnlockStatus = OCPP16UnlockStatus | UnlockStatusEnumType export const TriggerMessageStatus = { ...OCPP16TriggerMessageStatus, + ...TriggerMessageStatusEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type TriggerMessageStatus = OCPP16TriggerMessageStatus +export type TriggerMessageStatus = OCPP16TriggerMessageStatus | TriggerMessageStatusEnumType export const DataTransferStatus = { ...OCPP16DataTransferStatus, + ...DataTransferStatusEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type DataTransferStatus = OCPP16DataTransferStatus +export type DataTransferStatus = DataTransferStatusEnumType | OCPP16DataTransferStatus export const ReservationStatus = { ...OCPP16ReservationStatus, diff --git a/src/types/ocpp/Transaction.ts b/src/types/ocpp/Transaction.ts index 83f16acc..4bf4f778 100644 --- a/src/types/ocpp/Transaction.ts +++ b/src/types/ocpp/Transaction.ts @@ -8,12 +8,14 @@ import { type OCPP16StopTransactionRequest, type OCPP16StopTransactionResponse, } from './1.6/Transaction.js' +import { OCPP20AuthorizationStatusEnumType, OCPP20ReasonEnumType } from './2.0/Transaction.js' export const AuthorizationStatus = { ...OCPP16AuthorizationStatus, + ...OCPP20AuthorizationStatusEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type AuthorizationStatus = OCPP16AuthorizationStatus +export type AuthorizationStatus = OCPP16AuthorizationStatus | OCPP20AuthorizationStatusEnumType export type AuthorizeRequest = OCPP16AuthorizeRequest @@ -25,9 +27,10 @@ export type StartTransactionResponse = OCPP16StartTransactionResponse export const StopTransactionReason = { ...OCPP16StopTransactionReason, + ...OCPP20ReasonEnumType, } as const // eslint-disable-next-line @typescript-eslint/no-redeclare -export type StopTransactionReason = OCPP16StopTransactionReason +export type StopTransactionReason = OCPP16StopTransactionReason | OCPP20ReasonEnumType export type StopTransactionRequest = OCPP16StopTransactionRequest diff --git a/tests/charging-station/ocpp/1.6/OCPP16Constants.test.ts b/tests/charging-station/ocpp/1.6/OCPP16Constants.test.ts index bde3b6a4..b4665cc2 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16Constants.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16Constants.test.ts @@ -6,7 +6,7 @@ import assert from 'node:assert/strict' import { afterEach, describe, it } from 'node:test' import { OCPP16Constants } from '../../../../src/charging-station/ocpp/1.6/OCPP16Constants.js' -import { OCPP16ChargePointStatus } from '../../../../src/types/ocpp/1.6/ChargePointStatus.js' +import { OCPP16ChargePointStatus } from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' await describe('OCPP16Constants', async () => { diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-ChangeAvailability.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-ChangeAvailability.test.ts index 85449f37..426785ac 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-ChangeAvailability.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-ChangeAvailability.test.ts @@ -12,10 +12,10 @@ import type { ChargingStation } from '../../../../src/charging-station/ChargingS import type { TestableOCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/__testable__/index.js' import { + OCPP16AvailabilityStatus, OCPP16AvailabilityType, type OCPP16ChangeAvailabilityRequest, } from '../../../../src/types/index.js' -import { OCPP16AvailabilityStatus } from '../../../../src/types/ocpp/1.6/Responses.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, setMockRequestHandler } from './OCPP16TestUtils.js' diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Configuration.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Configuration.test.ts index b9567e79..324991c7 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Configuration.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Configuration.test.ts @@ -12,8 +12,10 @@ import type { GetConfigurationRequest, } from '../../../../src/types/index.js' -import { OCPP16StandardParametersKey } from '../../../../src/types/index.js' -import { OCPP16ConfigurationStatus } from '../../../../src/types/ocpp/1.6/Responses.js' +import { + OCPP16ConfigurationStatus, + OCPP16StandardParametersKey, +} from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Firmware.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Firmware.test.ts index d5038ac4..bc1646c3 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Firmware.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Firmware.test.ts @@ -11,12 +11,12 @@ import type { GetDiagnosticsRequest } from '../../../../src/types/index.js' import { OCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.js' import { + OCPP16FirmwareStatus, OCPP16IncomingRequestCommand, OCPP16StandardParametersKey, type OCPP16UpdateFirmwareRequest, type OCPP16UpdateFirmwareResponse, } from '../../../../src/types/index.js' -import { OCPP16FirmwareStatus } from '../../../../src/types/ocpp/1.6/Requests.js' import { flushMicrotasks, standardCleanup, diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-RemoteStopUnlock.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-RemoteStopUnlock.test.ts index 9a4e4a8d..56d2e609 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-RemoteStopUnlock.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-RemoteStopUnlock.test.ts @@ -10,15 +10,16 @@ import { afterEach, beforeEach, describe, it, mock } from 'node:test' import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js' import type { TestableOCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/__testable__/index.js' -import type { RemoteStopTransactionRequest } from '../../../../src/types/ocpp/1.6/Requests.js' -import type { GenericResponse } from '../../../../src/types/ocpp/Common.js' +import type { GenericResponse, RemoteStopTransactionRequest } from '../../../../src/types/index.js' import { OCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.js' import { OCPP16ServiceUtils } from '../../../../src/charging-station/ocpp/1.6/OCPP16ServiceUtils.js' -import { OCPP16IncomingRequestCommand } from '../../../../src/types/ocpp/1.6/Requests.js' -import { OCPP16UnlockStatus } from '../../../../src/types/ocpp/1.6/Responses.js' -import { OCPP16AuthorizationStatus } from '../../../../src/types/ocpp/1.6/Transaction.js' -import { GenericStatus } from '../../../../src/types/ocpp/Common.js' +import { + GenericStatus, + OCPP16AuthorizationStatus, + OCPP16IncomingRequestCommand, + OCPP16UnlockStatus, +} from '../../../../src/types/index.js' import { flushMicrotasks, setupConnectorWithTransaction, diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reservation.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reservation.test.ts index 74fb0a7a..44b2b044 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reservation.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reservation.test.ts @@ -17,9 +17,9 @@ import { GenericStatus, OCPP16AuthorizationStatus, OCPP16ChargePointStatus, + OCPP16ReservationStatus, OCPP16StandardParametersKey, } from '../../../../src/types/index.js' -import { OCPP16ReservationStatus } from '../../../../src/types/ocpp/1.6/Responses.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reset.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reset.test.ts index 91be4938..77f75214 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reset.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-Reset.test.ts @@ -8,8 +8,7 @@ import { afterEach, beforeEach, describe, it } from 'node:test' import type { ResetRequest } from '../../../../src/types/index.js' -import { GenericStatus } from '../../../../src/types/index.js' -import { ResetType } from '../../../../src/types/ocpp/1.6/Requests.js' +import { GenericStatus, ResetType } from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SimpleHandlers.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SimpleHandlers.test.ts index c953f7ef..e6b49eac 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SimpleHandlers.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SimpleHandlers.test.ts @@ -6,7 +6,7 @@ import assert from 'node:assert/strict' import { afterEach, beforeEach, describe, it } from 'node:test' -import { OCPP16DataTransferStatus } from '../../../../src/types/ocpp/1.6/Responses.js' +import { OCPP16DataTransferStatus } from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, diff --git a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SmartCharging.test.ts b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SmartCharging.test.ts index e2b6c58d..c69dd972 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SmartCharging.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-SmartCharging.test.ts @@ -13,12 +13,13 @@ import type { SetChargingProfileRequest, } from '../../../../src/types/index.js' -import { GenericStatus, OCPP16StandardParametersKey } from '../../../../src/types/index.js' -import { OCPP16ChargingProfilePurposeType } from '../../../../src/types/ocpp/1.6/ChargingProfile.js' import { + GenericStatus, + OCPP16ChargingProfilePurposeType, OCPP16ChargingProfileStatus, OCPP16ClearChargingProfileStatus, -} from '../../../../src/types/ocpp/1.6/Responses.js' + OCPP16StandardParametersKey, +} from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { ChargingProfileFixtures, diff --git a/tests/charging-station/ocpp/1.6/OCPP16Integration-ChargingProfiles.test.ts b/tests/charging-station/ocpp/1.6/OCPP16Integration-ChargingProfiles.test.ts index 17a60205..ad3eef64 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16Integration-ChargingProfiles.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16Integration-ChargingProfiles.test.ts @@ -9,22 +9,21 @@ import assert from 'node:assert/strict' import { afterEach, beforeEach, describe, it } from 'node:test' import type { + OCPP16ChargingProfile, OCPP16ClearChargingProfileRequest, OCPP16GetCompositeScheduleRequest, SetChargingProfileRequest, } from '../../../../src/types/index.js' -import type { OCPP16ChargingProfile } from '../../../../src/types/ocpp/1.6/ChargingProfile.js' -import { GenericStatus, OCPP16StandardParametersKey } from '../../../../src/types/index.js' import { + GenericStatus, OCPP16ChargingProfileKindType, OCPP16ChargingProfilePurposeType, - OCPP16ChargingRateUnitType, -} from '../../../../src/types/ocpp/1.6/ChargingProfile.js' -import { OCPP16ChargingProfileStatus, + OCPP16ChargingRateUnitType, OCPP16ClearChargingProfileStatus, -} from '../../../../src/types/ocpp/1.6/Responses.js' + OCPP16StandardParametersKey, +} from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { ChargingProfileFixtures, diff --git a/tests/charging-station/ocpp/1.6/OCPP16Integration-Configuration.test.ts b/tests/charging-station/ocpp/1.6/OCPP16Integration-Configuration.test.ts index dbe1216a..6e9a2513 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16Integration-Configuration.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16Integration-Configuration.test.ts @@ -13,8 +13,10 @@ import type { GetConfigurationRequest, } from '../../../../src/types/index.js' -import { OCPP16StandardParametersKey } from '../../../../src/types/index.js' -import { OCPP16ConfigurationStatus } from '../../../../src/types/ocpp/1.6/Responses.js' +import { + OCPP16ConfigurationStatus, + OCPP16StandardParametersKey, +} from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, diff --git a/tests/charging-station/ocpp/1.6/OCPP16Integration-Reservations.test.ts b/tests/charging-station/ocpp/1.6/OCPP16Integration-Reservations.test.ts index 9994f6e6..19f2952f 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16Integration-Reservations.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16Integration-Reservations.test.ts @@ -18,9 +18,9 @@ import type { import { GenericStatus, OCPP16AuthorizationStatus, + OCPP16ReservationStatus, OCPP16StandardParametersKey, } from '../../../../src/types/index.js' -import { OCPP16ReservationStatus } from '../../../../src/types/ocpp/1.6/Responses.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createOCPP16IncomingRequestTestContext, diff --git a/tests/charging-station/ocpp/1.6/OCPP16Integration-Transactions.test.ts b/tests/charging-station/ocpp/1.6/OCPP16Integration-Transactions.test.ts index 4d9b8f88..9b9e5d0d 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16Integration-Transactions.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16Integration-Transactions.test.ts @@ -12,16 +12,14 @@ import { afterEach, beforeEach, describe, it } from 'node:test' import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js' import type { TestableOCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/__testable__/index.js' import type { OCPP16ResponseService } from '../../../../src/charging-station/ocpp/1.6/OCPP16ResponseService.js' -import type { - RemoteStartTransactionRequest, - RemoteStopTransactionRequest, -} from '../../../../src/types/ocpp/1.6/Requests.js' import type { OCPP16StartTransactionRequest, OCPP16StartTransactionResponse, OCPP16StopTransactionRequest, OCPP16StopTransactionResponse, -} from '../../../../src/types/ocpp/1.6/Transaction.js' + RemoteStartTransactionRequest, + RemoteStopTransactionRequest, +} from '../../../../src/types/index.js' import { createTestableIncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/__testable__/index.js' import { OCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.js' @@ -29,12 +27,12 @@ import { OCPP16ResponseService as OCPP16ResponseServiceClass } from '../../../.. import { AvailabilityType, GenericStatus, + OCPP16AuthorizationStatus, OCPP16ChargePointStatus, OCPP16MeterValueUnit, + OCPP16RequestCommand, OCPPVersion, } from '../../../../src/types/index.js' -import { OCPP16RequestCommand } from '../../../../src/types/ocpp/1.6/Requests.js' -import { OCPP16AuthorizationStatus } from '../../../../src/types/ocpp/1.6/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { setupConnectorWithTransaction, diff --git a/tests/charging-station/ocpp/1.6/OCPP16ResponseService-BootAuth.test.ts b/tests/charging-station/ocpp/1.6/OCPP16ResponseService-BootAuth.test.ts index 442a02f0..2f734751 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16ResponseService-BootAuth.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16ResponseService-BootAuth.test.ts @@ -16,7 +16,7 @@ import { afterEach, beforeEach, describe, it, mock } from 'node:test' import type { OCPP16AuthorizeRequest, OCPP16AuthorizeResponse, -} from '../../../../src/types/ocpp/1.6/Transaction.js' +} from '../../../../src/types/index.js' import { ChargingStationEvents, diff --git a/tests/charging-station/ocpp/1.6/OCPP16ResponseService-Transactions.test.ts b/tests/charging-station/ocpp/1.6/OCPP16ResponseService-Transactions.test.ts index 09fd6caf..f87d80dd 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16ResponseService-Transactions.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16ResponseService-Transactions.test.ts @@ -15,11 +15,13 @@ import type { OCPP16StartTransactionResponse, OCPP16StopTransactionRequest, OCPP16StopTransactionResponse, -} from '../../../../src/types/ocpp/1.6/Transaction.js' +} from '../../../../src/types/index.js' -import { OCPP16MeterValueUnit } from '../../../../src/types/index.js' -import { OCPP16RequestCommand } from '../../../../src/types/ocpp/1.6/Requests.js' -import { OCPP16AuthorizationStatus } from '../../../../src/types/ocpp/1.6/Transaction.js' +import { + OCPP16AuthorizationStatus, + OCPP16MeterValueUnit, + OCPP16RequestCommand, +} from '../../../../src/types/index.js' import { setupConnectorWithTransaction, standardCleanup, diff --git a/tests/charging-station/ocpp/1.6/OCPP16ServiceUtils.test.ts b/tests/charging-station/ocpp/1.6/OCPP16ServiceUtils.test.ts index ded3c30a..45d0a4be 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16ServiceUtils.test.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16ServiceUtils.test.ts @@ -13,6 +13,7 @@ import { OCPP16ServiceUtils } from '../../../../src/charging-station/ocpp/1.6/OC import { OCPPServiceUtils } from '../../../../src/charging-station/ocpp/OCPPServiceUtils.js' import { type OCPP16ChargingProfile, + OCPP16ChargingProfileKindType, OCPP16ChargingProfilePurposeType, OCPP16ChargingRateUnitType, type OCPP16ChargingSchedule, @@ -27,7 +28,6 @@ import { OCPP16SupportedFeatureProfiles, OCPPVersion, } from '../../../../src/types/index.js' -import { OCPP16ChargingProfileKindType } from '../../../../src/types/ocpp/1.6/ChargingProfile.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createMockChargingStation } from '../../helpers/StationHelpers.js' import { createCommandsSupport, createMeterValuesTemplate } from './OCPP16TestUtils.js' diff --git a/tests/charging-station/ocpp/1.6/OCPP16TestUtils.ts b/tests/charging-station/ocpp/1.6/OCPP16TestUtils.ts index ea99cf8b..b456dff6 100644 --- a/tests/charging-station/ocpp/1.6/OCPP16TestUtils.ts +++ b/tests/charging-station/ocpp/1.6/OCPP16TestUtils.ts @@ -9,14 +9,15 @@ import { mock } from 'node:test' import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js' import type { ChargingStationInfo } from '../../../../src/types/ChargingStationInfo.js' import type { ConfigurationKey } from '../../../../src/types/ChargingStationOcppConfiguration.js' -import type { JsonObject } from '../../../../src/types/JsonType.js' -import type { SampledValueTemplate } from '../../../../src/types/MeasurandPerPhaseSampledValueTemplates.js' import type { + IncomingRequestCommand, OCPP16ChargingProfile, OCPP16ChargingSchedulePeriod, -} from '../../../../src/types/ocpp/1.6/ChargingProfile.js' -import type { OCPP16SampledValue } from '../../../../src/types/ocpp/1.6/MeterValues.js' -import type { IncomingRequestCommand, RequestCommand } from '../../../../src/types/ocpp/Requests.js' + OCPP16SampledValue, + RequestCommand, +} from '../../../../src/types/index.js' +import type { JsonObject } from '../../../../src/types/JsonType.js' +import type { SampledValueTemplate } from '../../../../src/types/MeasurandPerPhaseSampledValueTemplates.js' import { createTestableIncomingRequestService, @@ -28,13 +29,13 @@ import { OCPP16IncomingRequestService } from '../../../../src/charging-station/o import { OCPP16RequestService } from '../../../../src/charging-station/ocpp/1.6/OCPP16RequestService.js' import { OCPP16ResponseService } from '../../../../src/charging-station/ocpp/1.6/OCPP16ResponseService.js' import { + OCPP16ChargingProfileKindType, OCPP16ChargingProfilePurposeType, OCPP16ChargingRateUnitType, type OCPP16RequestCommand, OCPP16StandardParametersKey, OCPPVersion, } from '../../../../src/types/index.js' -import { OCPP16ChargingProfileKindType } from '../../../../src/types/ocpp/1.6/ChargingProfile.js' import { Constants } from '../../../../src/utils/index.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CustomerInformation.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CustomerInformation.test.ts index 22f82e65..bf6d8c1a 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CustomerInformation.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-CustomerInformation.test.ts @@ -15,10 +15,10 @@ import { HashAlgorithmEnumType, type OCPP20CustomerInformationRequest, type OCPP20CustomerInformationResponse, + OCPP20IdTokenEnumType, OCPP20IncomingRequestCommand, OCPPVersion, } from '../../../../src/types/index.js' -import { OCPP20IdTokenEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { flushMicrotasks, standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts index c84ae05d..29eb13c8 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GetBaseReport.test.ts @@ -29,8 +29,8 @@ import { OCPPVersion, ReportBaseEnumType, type ReportDataType, + StandardParametersKey, } from '../../../../src/types/index.js' -import { StandardParametersKey } from '../../../../src/types/ocpp/Configuration.js' import { Constants } from '../../../../src/utils/index.js' import { flushMicrotasks, standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GroupIdStop.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GroupIdStop.test.ts index 0447013d..db4cd183 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GroupIdStop.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-GroupIdStop.test.ts @@ -12,8 +12,10 @@ import type { OCPP20RequestStartTransactionRequest } from '../../../../src/types import { createTestableIncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/__testable__/index.js' import { OCPP20IncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.js' import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js' -import { RequestStartStopStatusEnumType } from '../../../../src/types/index.js' -import { OCPP20IdTokenEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' +import { + OCPP20IdTokenEnumType, + RequestStartStopStatusEnumType, +} from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { createMockAuthService } from '../auth/helpers/MockFactories.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-MasterPass.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-MasterPass.test.ts index 3e0ad1c7..cc16925b 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-MasterPass.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-MasterPass.test.ts @@ -15,10 +15,10 @@ import { OCPP20VariableManager } from '../../../../src/charging-station/ocpp/2.0 import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js' import { GetVariableStatusEnumType, + OCPP20IdTokenEnumType, OCPPVersion, RequestStartStopStatusEnumType, } from '../../../../src/types/index.js' -import { OCPP20IdTokenEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts index ee1e0164..97c3f347 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RemoteStartAuth.test.ts @@ -12,17 +12,15 @@ import type { ConnectorStatus } from '../../../../src/types/ConnectorStatus.js' import { OCPP20IncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.js' import { ConnectorStatusEnum, - type OCPP20RequestStartTransactionRequest, - RequestStartStopStatusEnumType, -} from '../../../../src/types/index.js' -import { OCPP20OperationalStatusEnumType } from '../../../../src/types/ocpp/2.0/Common.js' -import { OCPP20ChargingProfileKindEnumType, OCPP20ChargingProfilePurposeEnumType, OCPP20IdTokenEnumType, type OCPP20IdTokenType, -} from '../../../../src/types/ocpp/2.0/Transaction.js' -import { OCPPVersion } from '../../../../src/types/ocpp/OCPPVersion.js' + OCPP20OperationalStatusEnumType, + type OCPP20RequestStartTransactionRequest, + OCPPVersion, + RequestStartStopStatusEnumType, +} from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' await describe('G03 - Remote Start Pre-Authorization', async () => { diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts index 82e065f7..4a65d95b 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts @@ -9,19 +9,20 @@ import { afterEach, beforeEach, describe, it } from 'node:test' import type { ChargingStation } from '../../../../src/charging-station/index.js' import type { + OCPP20ChargingProfileType, + OCPP20ChargingRateUnitEnumType, OCPP20RequestStartTransactionRequest, OCPP20RequestStartTransactionResponse, OCPP20TransactionEventRequest, } from '../../../../src/types/index.js' -import type { - OCPP20ChargingProfileType, - OCPP20ChargingRateUnitEnumType, -} from '../../../../src/types/ocpp/2.0/Transaction.js' import { createTestableIncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/__testable__/index.js' import { OCPP20IncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.js' import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js' import { + OCPP20ChargingProfileKindEnumType, + OCPP20ChargingProfilePurposeEnumType, + OCPP20IdTokenEnumType, OCPP20IncomingRequestCommand, OCPP20RequestCommand, OCPP20TransactionEventEnumType, @@ -29,11 +30,6 @@ import { OCPPVersion, RequestStartStopStatusEnumType, } from '../../../../src/types/index.js' -import { - OCPP20ChargingProfileKindEnumType, - OCPP20ChargingProfilePurposeEnumType, - OCPP20IdTokenEnumType, -} from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { flushMicrotasks, standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts index 2d5b0a8b..85ff25fa 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts @@ -21,17 +21,15 @@ import { createTestableIncomingRequestService } from '../../../../src/charging-s import { OCPP20IncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.js' import { OCPPAuthServiceFactory } from '../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js' import { + OCPP20IdTokenEnumType, OCPP20IncomingRequestCommand, + OCPP20ReasonEnumType, OCPP20RequestCommand, OCPP20TransactionEventEnumType, OCPP20TriggerReasonEnumType, OCPPVersion, RequestStartStopStatusEnumType, } from '../../../../src/types/index.js' -import { - OCPP20IdTokenEnumType, - OCPP20ReasonEnumType, -} from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { flushMicrotasks, standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetNetworkProfile.test.ts b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetNetworkProfile.test.ts index 0a537e98..42e03490 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetNetworkProfile.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-SetNetworkProfile.test.ts @@ -12,15 +12,13 @@ import { createTestableIncomingRequestService } from '../../../../src/charging-s import { OCPP20IncomingRequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.js' import { type OCPP20SetNetworkProfileRequest, + OCPPInterfaceEnumType, + OCPPTransportEnumType, OCPPVersion, + OCPPVersionEnumType, ReasonCodeEnumType, SetNetworkProfileStatusEnumType, } from '../../../../src/types/index.js' -import { - OCPPInterfaceEnumType, - OCPPTransportEnumType, - OCPPVersionEnumType, -} from '../../../../src/types/ocpp/2.0/Common.js' import { Constants } from '../../../../src/utils/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts b/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts index 0d8b3240..96ce6e54 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20RequestService-BootNotification.test.ts @@ -9,10 +9,10 @@ import type { ChargingStation } from '../../../../src/charging-station/index.js' import { BootReasonEnumType, + type ChargingStationType, type OCPP20BootNotificationRequest, OCPP20RequestCommand, } from '../../../../src/types/index.js' -import { type ChargingStationType } from '../../../../src/types/ocpp/2.0/Common.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGE_POINT_MODEL, diff --git a/tests/charging-station/ocpp/2.0/OCPP20ResponseService-CacheUpdate.test.ts b/tests/charging-station/ocpp/2.0/OCPP20ResponseService-CacheUpdate.test.ts index a3cd6f2e..91ff9057 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20ResponseService-CacheUpdate.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20ResponseService-CacheUpdate.test.ts @@ -17,8 +17,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPP20AuthorizationStatusEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' -import { OCPPVersion } from '../../../../src/types/ocpp/OCPPVersion.js' +import { OCPP20AuthorizationStatusEnumType, OCPPVersion } from '../../../../src/types/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20ResponseService-TransactionEvent.test.ts b/tests/charging-station/ocpp/2.0/OCPP20ResponseService-TransactionEvent.test.ts index d1c58150..2ccc4b04 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20ResponseService-TransactionEvent.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20ResponseService-TransactionEvent.test.ts @@ -16,13 +16,13 @@ import type { UUIDv4 } from '../../../../src/types/UUID.js' import { OCPP20ResponseService } from '../../../../src/charging-station/ocpp/2.0/OCPP20ResponseService.js' import { OCPP20ServiceUtils } from '../../../../src/charging-station/ocpp/2.0/OCPP20ServiceUtils.js' -import { OCPPVersion } from '../../../../src/types/index.js' import { OCPP20AuthorizationStatusEnumType, OCPP20MessageFormatEnumType, OCPP20TransactionEventEnumType, OCPP20TriggerReasonEnumType, -} from '../../../../src/types/ocpp/2.0/Transaction.js' + OCPPVersion, +} from '../../../../src/types/index.js' import { Constants } from '../../../../src/utils/index.js' import { setupConnectorWithTransaction, diff --git a/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts b/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts index 1f0915c0..24f4f97b 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20ServiceUtils-TransactionEvent.test.ts @@ -24,26 +24,20 @@ import { OCPP20VariableManager } from '../../../../src/charging-station/ocpp/2.0 import { OCPPError } from '../../../../src/exception/OCPPError.js' import { AttributeEnumType, - OCPP20ComponentName, - OCPP20RequiredVariableName, -} from '../../../../src/types/index.js' -import { ConnectorStatusEnum, - OCPP20TransactionEventEnumType, - OCPP20TriggerReasonEnumType, - OCPPVersion, -} from '../../../../src/types/index.js' -import { - OCPP20MeasurandEnumType, - OCPP20ReadingContextEnumType, -} from '../../../../src/types/ocpp/2.0/MeterValues.js' -import { OCPP20ChargingStateEnumType, + OCPP20ComponentName, OCPP20IdTokenEnumType, type OCPP20IdTokenType, + OCPP20MeasurandEnumType, + OCPP20ReadingContextEnumType, OCPP20ReasonEnumType, + OCPP20RequiredVariableName, + OCPP20TransactionEventEnumType, type OCPP20TransactionType, -} from '../../../../src/types/ocpp/2.0/Transaction.js' + OCPP20TriggerReasonEnumType, + OCPPVersion, +} from '../../../../src/types/index.js' import { Constants, generateUUID } from '../../../../src/utils/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts b/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts index bdd112a5..4f856429 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20TestUtils.ts @@ -13,10 +13,10 @@ import type { CertificateHashDataType, GetCertificateIdUseEnumType, JsonType, + OCPP20IdTokenType, OCPP20RequestCommand, OCSPRequestDataType, } from '../../../../src/types/index.js' -import type { OCPP20IdTokenType } from '../../../../src/types/ocpp/2.0/Transaction.js' import { OCPP20RequestService } from '../../../../src/charging-station/ocpp/2.0/OCPP20RequestService.js' import { OCPP20ResponseService } from '../../../../src/charging-station/ocpp/2.0/OCPP20ResponseService.js' @@ -24,10 +24,10 @@ import { ConnectorStatusEnum, DeleteCertificateStatusEnumType, HashAlgorithmEnumType, + OCPP20IdTokenEnumType, OCPP20RequiredVariableName, OCPPVersion, } from '../../../../src/types/index.js' -import { OCPP20IdTokenEnumType } from '../../../../src/types/ocpp/2.0/Transaction.js' import { Constants } from '../../../../src/utils/index.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' import { diff --git a/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts b/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts index 0958d034..0b8fb228 100644 --- a/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts +++ b/tests/charging-station/ocpp/2.0/OCPP20VariableManager.test.ts @@ -30,9 +30,9 @@ import { OCPPVersion, ReasonCodeEnumType, SetVariableStatusEnumType, + StandardParametersKey, type VariableType, } from '../../../../src/types/index.js' -import { StandardParametersKey } from '../../../../src/types/ocpp/Configuration.js' import { Constants } from '../../../../src/utils/index.js' import { standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { TEST_CHARGING_STATION_BASE_NAME } from '../../ChargingStationTestConstants.js' diff --git a/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts b/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts index 5dae7cf3..ae45818f 100644 --- a/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts +++ b/tests/charging-station/ocpp/auth/OCPPAuthIntegration.test.ts @@ -18,7 +18,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../src/types/index.js' import { sleep, standardCleanup } from '../../../helpers/TestLifecycleHelpers.js' import { createMockChargingStation } from '../../ChargingStationTestUtils.js' import { diff --git a/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts b/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts index 238b108d..be453597 100644 --- a/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts +++ b/tests/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.test.ts @@ -6,7 +6,7 @@ import assert from 'node:assert/strict' import { afterEach, beforeEach, describe, it } from 'node:test' import type { ChargingStation } from '../../../../../src/charging-station/ChargingStation.js' -import type { OCPP16AuthorizeResponse } from '../../../../../src/types/ocpp/1.6/Transaction.js' +import type { OCPP16AuthorizeResponse } from '../../../../../src/types/index.js' import { OCPP16AuthAdapter } from '../../../../../src/charging-station/ocpp/auth/adapters/OCPP16AuthAdapter.js' import { @@ -16,8 +16,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPP16AuthorizationStatus } from '../../../../../src/types/ocpp/1.6/Transaction.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPP16AuthorizationStatus, OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult, createMockIdentifier } from '../helpers/MockFactories.js' diff --git a/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts b/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts index cabe073e..1619637c 100644 --- a/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts +++ b/tests/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.test.ts @@ -20,8 +20,8 @@ import { OCPP20AuthorizationStatusEnumType, OCPP20IdTokenEnumType, RequestStartStopStatusEnumType, -} from '../../../../../src/types/ocpp/2.0/Transaction.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +} from '../../../../../src/types/index.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult, createMockIdentifier } from '../helpers/MockFactories.js' diff --git a/tests/charging-station/ocpp/auth/factories/AuthComponentFactory.test.ts b/tests/charging-station/ocpp/auth/factories/AuthComponentFactory.test.ts index c84008a2..88f71e7d 100644 --- a/tests/charging-station/ocpp/auth/factories/AuthComponentFactory.test.ts +++ b/tests/charging-station/ocpp/auth/factories/AuthComponentFactory.test.ts @@ -9,7 +9,7 @@ import { afterEach, describe, it } from 'node:test' import type { AuthConfiguration } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthComponentFactory } from '../../../../../src/charging-station/ocpp/auth/factories/AuthComponentFactory.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { TEST_AUTHORIZATION_TIMEOUT_MS } from '../../../ChargingStationTestConstants.js' import { createMockChargingStation } from '../../../ChargingStationTestUtils.js' diff --git a/tests/charging-station/ocpp/auth/helpers/MockFactories.ts b/tests/charging-station/ocpp/auth/helpers/MockFactories.ts index b303bd9a..1a100b58 100644 --- a/tests/charging-station/ocpp/auth/helpers/MockFactories.ts +++ b/tests/charging-station/ocpp/auth/helpers/MockFactories.ts @@ -23,7 +23,7 @@ import { IdentifierType, type UnifiedIdentifier, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' /** * Factory functions for creating test mocks and fixtures diff --git a/tests/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.test.ts b/tests/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.test.ts index 1090c4d2..645a7292 100644 --- a/tests/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.test.ts +++ b/tests/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.test.ts @@ -8,7 +8,7 @@ import { afterEach, beforeEach, describe, it } from 'node:test' import type { ChargingStation } from '../../../../../src/charging-station/ChargingStation.js' import { OCPPAuthServiceFactory } from '../../../../../src/charging-station/ocpp/auth/services/OCPPAuthServiceFactory.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthServiceTestStation } from '../helpers/MockFactories.js' diff --git a/tests/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.test.ts b/tests/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.test.ts index abbbc7ed..5285371b 100644 --- a/tests/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.test.ts +++ b/tests/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.test.ts @@ -17,7 +17,7 @@ import { IdentifierType, type UnifiedIdentifier, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthServiceTestStation } from '../helpers/MockFactories.js' diff --git a/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts b/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts index 88c837f9..40258482 100644 --- a/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/CertificateAuthStrategy.test.ts @@ -15,7 +15,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthorizationResult, diff --git a/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy-DisablePostAuthorize.test.ts b/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy-DisablePostAuthorize.test.ts index c383a49f..3573265b 100644 --- a/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy-DisablePostAuthorize.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy-DisablePostAuthorize.test.ts @@ -11,7 +11,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthCache, diff --git a/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts b/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts index f6534e1d..b684a91b 100644 --- a/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/LocalAuthStrategy.test.ts @@ -18,7 +18,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthCache, diff --git a/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts b/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts index 9ebbb81f..58fa2cef 100644 --- a/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts +++ b/tests/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.test.ts @@ -19,7 +19,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' import { createMockAuthCache, diff --git a/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts b/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts index 9ff15c61..2d934f6d 100644 --- a/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts +++ b/tests/charging-station/ocpp/auth/types/AuthTypes.test.ts @@ -22,12 +22,12 @@ import { requiresAdditionalInfo, type UnifiedIdentifier, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPP16AuthorizationStatus } from '../../../../../src/types/ocpp/1.6/Transaction.js' import { + OCPP16AuthorizationStatus, OCPP20IdTokenEnumType, + OCPPVersion, RequestStartStopStatusEnumType, -} from '../../../../../src/types/ocpp/2.0/Transaction.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +} from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthTypes', async () => { diff --git a/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts b/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts index 653561cd..d59523f5 100644 --- a/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts +++ b/tests/charging-station/ocpp/auth/utils/AuthHelpers.test.ts @@ -14,7 +14,7 @@ import { type UnifiedIdentifier, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthHelpers } from '../../../../../src/charging-station/ocpp/auth/utils/AuthHelpers.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthHelpers', async () => { diff --git a/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts b/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts index 80c6b81b..9eceffa4 100644 --- a/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts +++ b/tests/charging-station/ocpp/auth/utils/AuthValidators.test.ts @@ -11,7 +11,7 @@ import { type UnifiedIdentifier, } from '../../../../../src/charging-station/ocpp/auth/types/AuthTypes.js' import { AuthValidators } from '../../../../../src/charging-station/ocpp/auth/utils/AuthValidators.js' -import { OCPPVersion } from '../../../../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../../../../src/types/index.js' import { standardCleanup } from '../../../../helpers/TestLifecycleHelpers.js' await describe('AuthValidators', async () => { diff --git a/tests/helpers/OCPPAuthIntegrationTest.ts b/tests/helpers/OCPPAuthIntegrationTest.ts index 18a5b1e8..0f0b3852 100644 --- a/tests/helpers/OCPPAuthIntegrationTest.ts +++ b/tests/helpers/OCPPAuthIntegrationTest.ts @@ -13,7 +13,7 @@ import { AuthorizationStatus, IdentifierType, } from '../../src/charging-station/ocpp/auth/types/AuthTypes.js' -import { OCPPVersion } from '../../src/types/ocpp/OCPPVersion.js' +import { OCPPVersion } from '../../src/types/index.js' import { logger } from '../../src/utils/Logger.js' export class OCPPAuthIntegrationTest { -- 2.43.0