X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftypes%2FChargingStationWorker.ts;h=740d6e50a21a0e30f2138be7cbce8dd49fcf046c;hb=f938317f2902366a85a8f76de55ee51f1d4a662a;hp=3164414ae59a5b558a8a70693f8dc3f879510a02;hpb=52952bf8f73e5ad1a85c0c9205412a9198bfc720;p=e-mobility-charging-stations-simulator.git diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index 3164414a..740d6e50 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -1,64 +1,65 @@ -import type { WebSocket } from 'ws'; +import type { WebSocket } from 'ws' -import type { - BootNotificationResponse, - ChargingStationAutomaticTransactionGeneratorConfiguration, - ChargingStationInfo, - ChargingStationOcppConfiguration, - ConnectorStatus, - EvseStatus, - JsonObject, - Statistics, -} from './internal'; -import { type WorkerData, type WorkerMessage, WorkerMessageEvents } from '../worker'; +import type { ChargingStationAutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator.js' +import { ChargingStationEvents } from './ChargingStationEvents.js' +import type { ChargingStationInfo } from './ChargingStationInfo.js' +import type { ChargingStationOcppConfiguration } from './ChargingStationOcppConfiguration.js' +import type { ConnectorStatus } from './ConnectorStatus.js' +import type { EvseStatus } from './Evse.js' +import type { JsonObject } from './JsonType.js' +import type { BootNotificationResponse } from './ocpp/Responses.js' +import type { Statistics } from './Statistics.js' +import { type WorkerData, type WorkerMessage, WorkerMessageEvents } from '../worker/index.js' interface ChargingStationWorkerOptions extends JsonObject { - elementStartDelay?: number; + elementStartDelay?: number } export interface ChargingStationWorkerData extends WorkerData { - index: number; - templateFile: string; - chargingStationWorkerOptions?: ChargingStationWorkerOptions; + index: number + templateFile: string + chargingStationWorkerOptions?: ChargingStationWorkerOptions } -type EvseStatusType = Omit & { - connectors?: ConnectorStatus[]; -}; +export type EvseStatusWorkerType = Omit & { + connectors?: ConnectorStatus[] +} export interface ChargingStationData extends WorkerData { - started: boolean; - stationInfo: ChargingStationInfo; - connectors: ConnectorStatus[]; - evses: EvseStatusType[]; - ocppConfiguration: ChargingStationOcppConfiguration; + started: boolean + stationInfo: ChargingStationInfo + connectors: ConnectorStatus[] + evses: EvseStatusWorkerType[] + ocppConfiguration: ChargingStationOcppConfiguration wsState?: - | typeof WebSocket.CONNECTING - | typeof WebSocket.OPEN - | typeof WebSocket.CLOSING - | typeof WebSocket.CLOSED; - bootNotificationResponse?: BootNotificationResponse; - automaticTransactionGenerator?: ChargingStationAutomaticTransactionGeneratorConfiguration; + | typeof WebSocket.CONNECTING + | typeof WebSocket.OPEN + | typeof WebSocket.CLOSING + | typeof WebSocket.CLOSED + bootNotificationResponse?: BootNotificationResponse + automaticTransactionGenerator?: ChargingStationAutomaticTransactionGeneratorConfiguration } enum ChargingStationMessageEvents { - started = 'started', - stopped = 'stopped', - updated = 'updated', performanceStatistics = 'performanceStatistics', } export const ChargingStationWorkerMessageEvents = { ...WorkerMessageEvents, - ...ChargingStationMessageEvents, -} as const; -export type ChargingStationWorkerMessageEvents = WorkerMessageEvents | ChargingStationMessageEvents; + ...ChargingStationEvents, + ...ChargingStationMessageEvents +} as const +// eslint-disable-next-line @typescript-eslint/no-redeclare +export type ChargingStationWorkerMessageEvents = + | WorkerMessageEvents + | ChargingStationEvents + | ChargingStationMessageEvents -export type ChargingStationWorkerMessageData = ChargingStationData | Statistics; +export type ChargingStationWorkerMessageData = ChargingStationData | Statistics export type ChargingStationWorkerMessage = Omit< - WorkerMessage, - 'id' +WorkerMessage, +'event' > & { - id: ChargingStationWorkerMessageEvents; -}; + event: ChargingStationWorkerMessageEvents +}