import chalk from 'chalk'
import { type MessageHandler, availableParallelism } from 'poolifier'
-import { waitChargingStationEvents } from './Helpers.js'
+import { buildTemplateName, waitChargingStationEvents } from './Helpers.js'
import type { AbstractUIServer } from './ui-server/AbstractUIServer.js'
import { UIServerFactory } from './ui-server/UIServerFactory.js'
import { version } from '../../package.json'
import {
Configuration,
Constants,
- buildTemplateName,
buildTemplateStatisticsPayload,
formatDurationMilliSeconds,
generateUUID,
} from './ConfigurationKeyUtils.js'
import {
buildConnectorsMap,
+ buildTemplateName,
checkChargingStation,
checkConfiguration,
checkConnectorsConfiguration,
buildEvsesStatus,
buildStartedMessage,
buildStoppedMessage,
- buildTemplateName,
buildUpdatedMessage,
clone,
convertToBoolean,
import { createHash, randomBytes } from 'node:crypto'
import type { EventEmitter } from 'node:events'
-import { basename, dirname, join } from 'node:path'
+import { basename, dirname, isAbsolute, join, parse, relative, resolve } from 'node:path'
import { env } from 'node:process'
import { fileURLToPath } from 'node:url'
const moduleName = 'Helpers'
+export const buildTemplateName = (templateFile: string): string => {
+ if (isAbsolute(templateFile)) {
+ templateFile = relative(
+ resolve(join(dirname(fileURLToPath(import.meta.url)), 'assets', 'station-templates')),
+ templateFile
+ )
+ }
+ const templateFileParsedPath = parse(templateFile)
+ return join(templateFileParsedPath.dir, templateFileParsedPath.name)
+}
+
export const getChargingStationId = (
index: number,
stationTemplate: ChargingStationTemplate | undefined
import { getRandomValues, randomBytes, randomInt, randomUUID } from 'node:crypto'
-import { dirname, isAbsolute, join, parse, relative, resolve } from 'node:path'
import { env, nextTick } from 'node:process'
-import { fileURLToPath } from 'node:url'
import {
formatDuration,
)
}
-export const buildTemplateName = (templateFile: string): string => {
- if (isAbsolute(templateFile)) {
- templateFile = relative(
- resolve(join(dirname(fileURLToPath(import.meta.url)), 'assets', 'station-templates')),
- templateFile
- )
- }
- const templateFileParsedPath = parse(templateFile)
- return join(templateFileParsedPath.dir, templateFileParsedPath.name)
-}
-
export const extractTimeSeriesValues = (timeSeries: TimestampedData[]): number[] => {
return timeSeries.map(timeSeriesItem => timeSeriesItem.value)
}
} from './MessageChannelUtils.js'
export {
JSONStringifyWithMapSupport,
- buildTemplateName,
clone,
convertToBoolean,
convertToDate,