From: Jérôme Benoit Date: Fri, 16 Sep 2022 06:22:02 +0000 (+0200) Subject: Convert Statistics interface to type X-Git-Tag: v1.1.74~35 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8a36b1eb6df21e7ff434b36333d26739edf0e146;p=e-mobility-charging-stations-simulator.git Convert Statistics interface to type Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index eb437ab0..85f8f371 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -18,7 +18,7 @@ import { ChargingStationWorkerMessageEvents, } from '../types/ChargingStationWorker'; import type { StationTemplateUrl } from '../types/ConfigurationData'; -import type Statistics from '../types/Statistics'; +import type { Statistics } from '../types/Statistics'; import Configuration from '../utils/Configuration'; import logger from '../utils/Logger'; import Utils from '../utils/Utils'; diff --git a/src/charging-station/MessageChannelUtils.ts b/src/charging-station/MessageChannelUtils.ts index 19266f73..fe11041a 100644 --- a/src/charging-station/MessageChannelUtils.ts +++ b/src/charging-station/MessageChannelUtils.ts @@ -3,7 +3,7 @@ import { ChargingStationWorkerMessage, ChargingStationWorkerMessageEvents, } from '../types/ChargingStationWorker'; -import type Statistics from '../types/Statistics'; +import type { Statistics } from '../types/Statistics'; import type ChargingStation from './ChargingStation'; export class MessageChannelUtils { diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 6513bba5..d3a174c0 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -7,9 +7,7 @@ import { parentPort } from 'worker_threads'; import { MessageChannelUtils } from '../charging-station/MessageChannelUtils'; import { MessageType } from '../types/ocpp/MessageType'; import type { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; -import type Statistics from '../types/Statistics'; -// eslint-disable-next-line no-duplicate-imports -import type { StatisticsData, TimeSeries } from '../types/Statistics'; +import type { Statistics, StatisticsData, TimeSeries } from '../types/Statistics'; import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../utils/CircularArray'; import Configuration from '../utils/Configuration'; import logger from '../utils/Logger'; diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index 2cdab505..84652903 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -5,7 +5,7 @@ import fs from 'fs'; import lockfile from 'proper-lockfile'; import { FileType } from '../../types/FileType'; -import type Statistics from '../../types/Statistics'; +import type { Statistics } from '../../types/Statistics'; import FileUtils from '../../utils/FileUtils'; import Utils from '../../utils/Utils'; import { Storage } from './Storage'; diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index 44be7491..0c2b28ad 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -5,7 +5,7 @@ import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; import { PerformanceData } from '../../types/orm/entities/PerformanceData'; import { PerformanceRecord } from '../../types/orm/entities/PerformanceRecord'; -import type Statistics from '../../types/Statistics'; +import type { Statistics } from '../../types/Statistics'; import { MikroORMDBType, StorageType } from '../../types/Storage'; import Constants from '../../utils/Constants'; import { Storage } from './Storage'; diff --git a/src/performance/storage/MongoDBStorage.ts b/src/performance/storage/MongoDBStorage.ts index f10481a0..71179908 100644 --- a/src/performance/storage/MongoDBStorage.ts +++ b/src/performance/storage/MongoDBStorage.ts @@ -2,7 +2,7 @@ import { MongoClient } from 'mongodb'; -import type Statistics from '../../types/Statistics'; +import type { Statistics } from '../../types/Statistics'; import { StorageType } from '../../types/Storage'; import Constants from '../../utils/Constants'; import { Storage } from './Storage'; diff --git a/src/performance/storage/Storage.ts b/src/performance/storage/Storage.ts index d85d8c41..66bbc5f5 100644 --- a/src/performance/storage/Storage.ts +++ b/src/performance/storage/Storage.ts @@ -4,7 +4,7 @@ import { URL } from 'url'; import type { EmptyObject } from '../../types/EmptyObject'; import type { HandleErrorParams } from '../../types/Error'; -import type Statistics from '../../types/Statistics'; +import type { Statistics } from '../../types/Statistics'; import { DBName, StorageType } from '../../types/Storage'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index 020ec7bd..58e10ce8 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -3,7 +3,7 @@ import type ChargingStationInfo from './ChargingStationInfo'; import type { ConnectorStatus } from './ConnectorStatus'; import type { JsonObject } from './JsonType'; import type { BootNotificationResponse } from './ocpp/Responses'; -import type Statistics from './Statistics'; +import type { Statistics } from './Statistics'; import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker'; export interface ChargingStationWorkerOptions extends JsonObject { diff --git a/src/types/Statistics.ts b/src/types/Statistics.ts index 26f6bc9f..72f96696 100644 --- a/src/types/Statistics.ts +++ b/src/types/Statistics.ts @@ -22,11 +22,11 @@ export type StatisticsData = { stdDevTimeMeasurement: number; }; -export default interface Statistics extends WorkerData { +export type Statistics = WorkerData & { id: string; name: string; uri: string; createdAt: Date; updatedAt?: Date; statisticsData: Map>; -} +};