import { env, exit } from 'node:process'
-const skipPreinstall = parseInt(env.SKIP_PREINSTALL) || env.VCAP_APPLICATION != null
+const skipPreinstall = Number.parseInt(env.SKIP_PREINSTALL) || env.VCAP_APPLICATION != null
if (skipPreinstall) {
// eslint-disable-next-line n/no-process-exit
exit()
"username": "admin",
"password": "admin"
},
- "dataPropertyOrder": { "&": ["baseUrl", "protocol", "version", "username", "password"] },
+ "dataPropertyOrder": {
+ "&": ["baseUrl", "protocol", "version", "username", "password"]
+ },
"color": null,
"isPrivate": false,
"metaSortKey": 1661789025528,
"protocol": "ui",
"version": "0.0.1"
},
- "dataPropertyOrder": { "&": ["baseUrl", "username", "password", "protocol", "version"] },
+ "dataPropertyOrder": {
+ "&": ["baseUrl", "username", "password", "protocol", "version"]
+ },
"color": null,
"isPrivate": false,
"metaSortKey": 1671183662529,
const connectorStatus = this.chargingStation.getConnectorStatus(connectorId)
if (connectorStatus?.transactionStarted === true) {
logger.info(
- `${this.logPrefix(
- connectorId
- )} entered in transaction loop while a transaction ${connectorStatus.transactionId} is already started on connector ${connectorId}`
+ `${this.logPrefix(connectorId)} entered in transaction loop while a transaction ${
+ connectorStatus.transactionId
+ } is already started on connector ${connectorId}`
)
return false
}
while (connectorStatus?.transactionStarted === true) {
if (!logged) {
logger.info(
- `${this.logPrefix(
- connectorId
- )} transaction loop waiting for started transaction ${connectorStatus.transactionId} on connector ${connectorId} to be stopped`
+ `${this.logPrefix(connectorId)} transaction loop waiting for started transaction ${
+ connectorStatus.transactionId
+ } on connector ${connectorId} to be stopped`
)
logged = true
}
)
} else if (this.chargingStation.getAutomaticTransactionGeneratorStatuses() != null) {
logger.warn(
- `${this.logPrefix(connectorId)} no status found for connector #${connectorId} in charging station configuration file. New status will be created`
+ `${this.logPrefix(
+ connectorId
+ )} no status found for connector #${connectorId} in charging station configuration file. New status will be created`
)
}
if (connectorStatus != null) {
startResponse = await this.chargingStation.ocppRequestService.requestHandler<
Partial<StartTransactionRequest>,
StartTransactionResponse
- >(this.chargingStation, RequestCommand.START_TRANSACTION, { connectorId })
+ >(this.chargingStation, RequestCommand.START_TRANSACTION, {
+ connectorId
+ })
this.handleStartTransactionResponse(connectorId, startResponse)
PerformanceStatistics.endMeasure(measureId, beginId)
return startResponse
)
console.info(
chalk.green(
- `Charging stations simulator ${
- this.version
- } started with ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s) from ${this.numberOfChargingStationTemplates} charging station template(s) and ${
+ `Charging stations simulator ${this.version} started with ${
+ this.numberOfConfiguredChargingStations
+ } configured and ${
+ this.numberOfProvisionedChargingStations
+ } provisioned charging station(s) from ${
+ this.numberOfChargingStationTemplates
+ } charging station template(s) and ${
Configuration.workerDynamicPoolInUse() ? `${workerConfiguration.poolMinSize}/` : ''
}${this.workerImplementation?.size}${
Configuration.workerPoolInUse() ? `/${workerConfiguration.poolMaxSize}` : ''
poolOptions: {
messageHandler: this.messageHandler.bind(this) as MessageHandler<Worker>,
...(workerConfiguration.resourceLimits != null && {
- workerOptions: { resourceLimits: workerConfiguration.resourceLimits }
+ workerOptions: {
+ resourceLimits: workerConfiguration.resourceLimits
+ }
})
}
}
break
default:
throw new BaseError(
- `Unknown charging station worker message event: '${event}' received with data: ${JSON.stringify(data, undefined, 2)}`
+ `Unknown charging station worker message event: '${event}' received with data: ${JSON.stringify(
+ data,
+ undefined,
+ 2
+ )}`
)
}
} catch (error) {
data.stationInfo.chargingStationId
} (hashId: ${data.stationInfo.hashId}) added (${
this.numberOfAddedChargingStations
- } added from ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s))`
+ } added from ${this.numberOfConfiguredChargingStations} configured and ${
+ this.numberOfProvisionedChargingStations
+ } provisioned charging station(s))`
)
}
data.stationInfo.chargingStationId
} (hashId: ${data.stationInfo.hashId}) deleted (${
this.numberOfAddedChargingStations
- } added from ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s))`
+ } added from ${this.numberOfConfiguredChargingStations} configured and ${
+ this.numberOfProvisionedChargingStations
+ } provisioned charging station(s))`
)
}
: this.configuredSupervisionUrl.href
}`
return new URL(
- `${wsConnectionBaseUrlStr}${!wsConnectionBaseUrlStr.endsWith('/') ? '/' : ''}${this.stationInfo?.chargingStationId}`
+ `${wsConnectionBaseUrlStr}${
+ !wsConnectionBaseUrlStr.endsWith('/') ? '/' : ''
+ }${this.stationInfo?.chargingStationId}`
)
}
addConfigurationKey(this, StandardParametersKey.HeartbeatInterval, '0')
}
if (getConfigurationKey(this, StandardParametersKey.HeartBeatInterval) == null) {
- addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', { visible: false })
+ addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', {
+ visible: false
+ })
}
if (
this.stationInfo?.supervisionUrlOcppConfiguration === true &&
isNotEmptyString(this.stationInfo.supervisionUrlOcppKey) &&
getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey) != null
) {
- deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey, { save: false })
+ deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey, {
+ save: false
+ })
}
if (
isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
...(this.connectors.size > 0 && {
connectorsStatus: configurationData.connectorsStatus
}),
- ...(this.evses.size > 0 && { evsesStatus: configurationData.evsesStatus })
+ ...(this.evses.size > 0 && {
+ evsesStatus: configurationData.evsesStatus
+ })
} satisfies ChargingStationConfiguration)
)
.digest('hex')
if (this.isWebSocketConnectionOpened()) {
this.emit(ChargingStationEvents.updated)
logger.info(
- `${this.logPrefix()} Connection to OCPP server through ${this.wsConnectionUrl.href} succeeded`
+ `${this.logPrefix()} Connection to OCPP server through ${
+ this.wsConnectionUrl.href
+ } succeeded`
)
let registrationRetryCount = 0
if (!this.isRegistered()) {
// eslint-disable-next-line @typescript-eslint/no-base-to-string
}' message '${data.toString()}'${
this.requests.has(messageId)
- ? ` matching cached request '${JSON.stringify(this.getCachedRequest(messageType, messageId))}'`
+ ? ` matching cached request '${JSON.stringify(
+ this.getCachedRequest(messageType, messageId)
+ )}'`
: ''
} processing error:`,
error
)
stationTemplate.randomConnectors = true
}
- return { configuredMaxConnectors, templateMaxConnectors, templateMaxAvailableConnectors }
+ return {
+ configuredMaxConnectors,
+ templateMaxConnectors,
+ templateMaxAvailableConnectors
+ }
}
export const checkStationInfoConnectorStatus = (
randomSerialNumber?: boolean
}
): void => {
- params = { ...{ randomSerialNumberUpperCase: true, randomSerialNumber: true }, ...params }
+ params = {
+ ...{ randomSerialNumberUpperCase: true, randomSerialNumber: true },
+ ...params
+ }
const serialNumberSuffix =
params.randomSerialNumber === true
? getRandomSerialNumberSuffix({
> = Object.freeze([
{ to: OCPP16ChargePointStatus.Available },
// { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Faulted
+ },
{ to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Available },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.Available
+ },
// { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.Faulted
+ },
{ to: OCPP16ChargePointStatus.Faulted },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable }
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Available
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Unavailable
+ }
// { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }
])
Object.freeze([
{ to: OCPP16ChargePointStatus.Available },
// { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.SuspendedEVSE },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Preparing
+ },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Charging
+ },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.SuspendedEV
+ },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.SuspendedEVSE
+ },
// { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Finishing },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Reserved
+ },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.Available,
+ to: OCPP16ChargePointStatus.Faulted
+ },
// { to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Available },
+ {
+ from: OCPP16ChargePointStatus.Preparing,
+ to: OCPP16ChargePointStatus.Available
+ },
// { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.SuspendedEVSE },
- { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Finishing },
+ {
+ from: OCPP16ChargePointStatus.Preparing,
+ to: OCPP16ChargePointStatus.Charging
+ },
+ {
+ from: OCPP16ChargePointStatus.Preparing,
+ to: OCPP16ChargePointStatus.SuspendedEV
+ },
+ {
+ from: OCPP16ChargePointStatus.Preparing,
+ to: OCPP16ChargePointStatus.SuspendedEVSE
+ },
+ {
+ from: OCPP16ChargePointStatus.Preparing,
+ to: OCPP16ChargePointStatus.Finishing
+ },
// { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Reserved },
// { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Preparing, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Preparing,
+ to: OCPP16ChargePointStatus.Faulted
+ },
// { to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Available },
+ {
+ from: OCPP16ChargePointStatus.Charging,
+ to: OCPP16ChargePointStatus.Available
+ },
// { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Preparing },
// { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.SuspendedEVSE },
- { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Finishing },
+ {
+ from: OCPP16ChargePointStatus.Charging,
+ to: OCPP16ChargePointStatus.SuspendedEV
+ },
+ {
+ from: OCPP16ChargePointStatus.Charging,
+ to: OCPP16ChargePointStatus.SuspendedEVSE
+ },
+ {
+ from: OCPP16ChargePointStatus.Charging,
+ to: OCPP16ChargePointStatus.Finishing
+ },
// { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Charging, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Charging,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.Charging,
+ to: OCPP16ChargePointStatus.Faulted
+ },
// { to: OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Available },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEV,
+ to: OCPP16ChargePointStatus.Available
+ },
// { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Charging },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEV,
+ to: OCPP16ChargePointStatus.Charging
+ },
// { from: OCPP16ChargePointStatus.SuspendedEV, OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.SuspendedEVSE },
- { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Finishing },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEV,
+ to: OCPP16ChargePointStatus.SuspendedEVSE
+ },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEV,
+ to: OCPP16ChargePointStatus.Finishing
+ },
// { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.SuspendedEV, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEV,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEV,
+ to: OCPP16ChargePointStatus.Faulted
+ },
// { to: OCPP16ChargePointStatus.SuspendedEVSE },
- { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Available },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEVSE,
+ to: OCPP16ChargePointStatus.Available
+ },
// { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.SuspendedEV },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEVSE,
+ to: OCPP16ChargePointStatus.Charging
+ },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEVSE,
+ to: OCPP16ChargePointStatus.SuspendedEV
+ },
// { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.SuspendedEVSE },
- { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Finishing },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEVSE,
+ to: OCPP16ChargePointStatus.Finishing
+ },
// { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.SuspendedEVSE, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEVSE,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.SuspendedEVSE,
+ to: OCPP16ChargePointStatus.Faulted
+ },
// { to: OCPP16ChargePointStatus.Finishing},
- { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Preparing },
+ {
+ from: OCPP16ChargePointStatus.Finishing,
+ to: OCPP16ChargePointStatus.Available
+ },
+ {
+ from: OCPP16ChargePointStatus.Finishing,
+ to: OCPP16ChargePointStatus.Preparing
+ },
// { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Charging },
// { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.SuspendedEV },
// { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.SuspendedEVSE },
// { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Finishing },
// { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Finishing, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Finishing,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.Finishing,
+ to: OCPP16ChargePointStatus.Faulted
+ },
// { to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Preparing },
+ {
+ from: OCPP16ChargePointStatus.Reserved,
+ to: OCPP16ChargePointStatus.Available
+ },
+ {
+ from: OCPP16ChargePointStatus.Reserved,
+ to: OCPP16ChargePointStatus.Preparing
+ },
// { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Charging },
// { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.SuspendedEV },
// { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.SuspendedEVSE },
// { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Finishing },
// { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Reserved, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Reserved,
+ to: OCPP16ChargePointStatus.Unavailable
+ },
+ {
+ from: OCPP16ChargePointStatus.Reserved,
+ to: OCPP16ChargePointStatus.Faulted
+ },
{ to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.SuspendedEVSE },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.Available
+ },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.Preparing
+ },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.Charging
+ },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.SuspendedEV
+ },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.SuspendedEVSE
+ },
// { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Finishing },
// { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Reserved },
// { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Faulted },
+ {
+ from: OCPP16ChargePointStatus.Unavailable,
+ to: OCPP16ChargePointStatus.Faulted
+ },
{ to: OCPP16ChargePointStatus.Faulted },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Preparing },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Charging },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.SuspendedEV },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.SuspendedEVSE },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Finishing },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Reserved },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable }
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Available
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Preparing
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Charging
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.SuspendedEV
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.SuspendedEVSE
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Finishing
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Reserved
+ },
+ {
+ from: OCPP16ChargePointStatus.Faulted,
+ to: OCPP16ChargePointStatus.Unavailable
+ }
// { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted }
])
}
.then(response => {
if (response.status === OCPP16AuthorizationStatus.ACCEPTED) {
logger.debug(
- `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for idTag '${idTag}'`
+ `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId} for idTag '${idTag}'`
)
} else {
logger.debug(
- `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for idTag '${idTag}'`
+ `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId} for idTag '${idTag}'`
)
}
})
.then(response => {
if (response.status === GenericStatus.Accepted) {
logger.debug(
- `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for transaction '${transactionId}'`
+ `${chargingStation.logPrefix()} Remote stop transaction ACCEPTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId} for transaction '${transactionId}'`
)
} else {
logger.debug(
- `${chargingStation.logPrefix()} Remote stop transaction REJECTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for transaction '${transactionId}'`
+ `${chargingStation.logPrefix()} Remote stop transaction REJECTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId} for transaction '${transactionId}'`
)
}
})
)
}
logger.debug(
- `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${chargingStation.stationInfo?.chargingStationId}#${transactionConnectorId}}, idTag '${idTag}'`
+ `${chargingStation.logPrefix()} Remote start transaction ACCEPTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${transactionConnectorId}}, idTag '${idTag}'`
)
return OCPP16Constants.OCPP_RESPONSE_ACCEPTED
}
): GenericResponse {
const connectorStatus = chargingStation.getConnectorStatus(connectorId)
logger.debug(
- `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId}, idTag '${idTag}', availability '${connectorStatus?.availability}', status '${connectorStatus?.status}'`
+ `${chargingStation.logPrefix()} Remote start transaction REJECTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId}, idTag '${idTag}', availability '${
+ connectorStatus?.availability
+ }', status '${connectorStatus?.status}'`
)
return OCPP16Constants.OCPP_RESPONSE_REJECTED
}
if (chargingProfile.chargingProfilePurpose === OCPP16ChargingProfilePurposeType.TX_PROFILE) {
OCPP16ServiceUtils.setChargingProfile(chargingStation, connectorId, chargingProfile)
logger.debug(
- `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on ${chargingStation.stationInfo?.chargingStationId}#${connectorId}`,
+ `${chargingStation.logPrefix()} Charging profile(s) set at remote start transaction on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId}`,
chargingProfile
)
return true
chargingStation,
OCPP16IncomingRequestCommand.CANCEL_RESERVATION,
error as Error,
- { errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED }
+ {
+ errorResponse: OCPP16Constants.OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED
+ }
)!
}
}
authorizeConnectorStatus.idTagAuthorized = false
delete authorizeConnectorStatus.authorizeIdTag
logger.debug(
- `${chargingStation.logPrefix()} idTag '${requestPayload.idTag}' rejected with status '${
- payload.idTagInfo.status
- }'`
+ `${chargingStation.logPrefix()} idTag '${
+ requestPayload.idTag
+ }' rejected with status '${payload.idTagInfo.status}'`
)
}
} else {
connectorStatus?.status !== OCPP16ChargePointStatus.Preparing
) {
logger.error(
- `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId} with status ${connectorStatus?.status}`
+ `${chargingStation.logPrefix()} Trying to start a transaction on connector id ${connectorId} with status ${
+ connectorStatus?.status
+ }`
)
return
}
logger.warn(
`${chargingStation.logPrefix()} Reserved transaction ${
payload.transactionId
- } started with a different idTag ${requestPayload.idTag} than the reservation one ${
- reservation.idTag
- }`
+ } started with a different idTag ${
+ requestPayload.idTag
+ } than the reservation one ${reservation.idTag}`
)
}
if (hasReservationExpired(reservation)) {
OCPP16ChargePointStatus.Charging
)
logger.info(
- `${chargingStation.logPrefix()} Transaction with id ${
- payload.transactionId
- } STARTED on ${chargingStation.stationInfo?.chargingStationId}#${connectorId} for idTag '${
- requestPayload.idTag
- }'`
+ `${chargingStation.logPrefix()} Transaction with id ${payload.transactionId} STARTED on ${
+ chargingStation.stationInfo?.chargingStationId
+ }#${connectorId} for idTag '${requestPayload.idTag}'`
)
if (chargingStation.stationInfo?.powerSharedByConnectors === true) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
from: OCPP20ConnectorStatusEnumType.Available,
to: OCPP20ConnectorStatusEnumType.Unavailable
},
- { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Faulted },
+ {
+ from: OCPP20ConnectorStatusEnumType.Available,
+ to: OCPP20ConnectorStatusEnumType.Faulted
+ },
{ to: OCPP20ConnectorStatusEnumType.Unavailable },
{
from: OCPP20ConnectorStatusEnumType.Unavailable,
to: OCPP20ConnectorStatusEnumType.Faulted
},
{ to: OCPP20ConnectorStatusEnumType.Faulted },
- { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Available },
+ {
+ from: OCPP20ConnectorStatusEnumType.Faulted,
+ to: OCPP20ConnectorStatusEnumType.Available
+ },
{
from: OCPP20ConnectorStatusEnumType.Faulted,
to: OCPP20ConnectorStatusEnumType.Unavailable
[
{ to: OCPP20ConnectorStatusEnumType.Available },
// { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Available },
- { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Occupied },
- { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Reserved },
+ {
+ from: OCPP20ConnectorStatusEnumType.Available,
+ to: OCPP20ConnectorStatusEnumType.Occupied
+ },
+ {
+ from: OCPP20ConnectorStatusEnumType.Available,
+ to: OCPP20ConnectorStatusEnumType.Reserved
+ },
{
from: OCPP20ConnectorStatusEnumType.Available,
to: OCPP20ConnectorStatusEnumType.Unavailable
},
- { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Faulted },
+ {
+ from: OCPP20ConnectorStatusEnumType.Available,
+ to: OCPP20ConnectorStatusEnumType.Faulted
+ },
// { to: OCPP20ConnectorStatusEnumType.Occupied },
- { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Available },
+ {
+ from: OCPP20ConnectorStatusEnumType.Occupied,
+ to: OCPP20ConnectorStatusEnumType.Available
+ },
// { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Occupied },
// { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Reserved },
{
from: OCPP20ConnectorStatusEnumType.Occupied,
to: OCPP20ConnectorStatusEnumType.Unavailable
},
- { from: OCPP20ConnectorStatusEnumType.Occupied, to: OCPP20ConnectorStatusEnumType.Faulted },
+ {
+ from: OCPP20ConnectorStatusEnumType.Occupied,
+ to: OCPP20ConnectorStatusEnumType.Faulted
+ },
// { to: OCPP20ConnectorStatusEnumType.Reserved },
- { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Available },
- { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Occupied },
+ {
+ from: OCPP20ConnectorStatusEnumType.Reserved,
+ to: OCPP20ConnectorStatusEnumType.Available
+ },
+ {
+ from: OCPP20ConnectorStatusEnumType.Reserved,
+ to: OCPP20ConnectorStatusEnumType.Occupied
+ },
// { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Reserved },
{
from: OCPP20ConnectorStatusEnumType.Reserved,
to: OCPP20ConnectorStatusEnumType.Unavailable
},
- { from: OCPP20ConnectorStatusEnumType.Reserved, to: OCPP20ConnectorStatusEnumType.Faulted },
+ {
+ from: OCPP20ConnectorStatusEnumType.Reserved,
+ to: OCPP20ConnectorStatusEnumType.Faulted
+ },
{ to: OCPP20ConnectorStatusEnumType.Unavailable },
{
from: OCPP20ConnectorStatusEnumType.Unavailable,
to: OCPP20ConnectorStatusEnumType.Faulted
},
{ to: OCPP20ConnectorStatusEnumType.Faulted },
- { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Available },
- { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Occupied },
- { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Reserved },
+ {
+ from: OCPP20ConnectorStatusEnumType.Faulted,
+ to: OCPP20ConnectorStatusEnumType.Available
+ },
+ {
+ from: OCPP20ConnectorStatusEnumType.Faulted,
+ to: OCPP20ConnectorStatusEnumType.Occupied
+ },
+ {
+ from: OCPP20ConnectorStatusEnumType.Faulted,
+ to: OCPP20ConnectorStatusEnumType.Reserved
+ },
{
from: OCPP20ConnectorStatusEnumType.Faulted,
to: OCPP20ConnectorStatusEnumType.Unavailable
static readonly OCPP_REQUEST_EMPTY = Constants.EMPTY_FROZEN_OBJECT
static readonly OCPP_RESPONSE_EMPTY = Constants.EMPTY_FROZEN_OBJECT
- static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: GenericStatus.Accepted })
- static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: GenericStatus.Rejected })
+ static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({
+ status: GenericStatus.Accepted
+ })
+
+ static readonly OCPP_RESPONSE_REJECTED = Object.freeze({
+ status: GenericStatus.Rejected
+ })
static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
status: ConfigurationStatus.ACCEPTED
status: ClearChargingProfileStatus.UNKNOWN
})
- static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED })
+ static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({
+ status: UnlockStatus.UNLOCKED
+ })
+
static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({
status: UnlockStatus.UNLOCK_FAILED
})
params.skipBufferingOnError === false ? '' : 'non '
}buffered message id '${messageId}' with content '${messageToSend}'`,
commandName,
- { name: error.name, message: error.message, stack: error.stack }
+ {
+ name: error.name,
+ message: error.message,
+ stack: error.stack
+ }
)
)
}
const socMinimumValue = socSampledValueTemplate.minimumValue ?? 0
const socSampledValueTemplateValue = isNotEmptyString(socSampledValueTemplate.value)
? getRandomFloatFluctuatedRounded(
- parseInt(socSampledValueTemplate.value),
+ Number.parseInt(socSampledValueTemplate.value),
socSampledValueTemplate.fluctuationPercent ?? Constants.DEFAULT_FLUCTUATION_PERCENT
)
: randomInt(socMinimumValue, socMaximumValue)
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${socMinimumValue}/${
+ }: connector id ${connectorId}, transaction id ${
+ connector?.transactionId
+ }, value: ${socMinimumValue}/${
meterValue.sampledValue[sampledValuesIndex].value
}/${socMaximumValue}`
)
)
if (voltageSampledValueTemplate != null) {
const voltageSampledValueTemplateValue = isNotEmptyString(voltageSampledValueTemplate.value)
- ? parseInt(voltageSampledValueTemplate.value)
+ ? Number.parseInt(voltageSampledValueTemplate.value)
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
chargingStation.stationInfo.voltageOut!
const fluctuationPercent =
const voltagePhaseLineToNeutralSampledValueTemplateValue = isNotEmptyString(
voltagePhaseLineToNeutralSampledValueTemplate.value
)
- ? parseInt(voltagePhaseLineToNeutralSampledValueTemplate.value)
+ ? Number.parseInt(voltagePhaseLineToNeutralSampledValueTemplate.value)
: // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
chargingStation.stationInfo.voltageOut!
const fluctuationPhaseToNeutralPercent =
const voltagePhaseLineToLineSampledValueTemplateValue = isNotEmptyString(
voltagePhaseLineToLineSampledValueTemplate.value
)
- ? parseInt(voltagePhaseLineToLineSampledValueTemplate.value)
+ ? Number.parseInt(voltagePhaseLineToLineSampledValueTemplate.value)
: voltagePhaseLineToLineValueRounded
const fluctuationPhaseLineToLinePercent =
voltagePhaseLineToLineSampledValueTemplate.fluctuationPercent ??
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumPowerRounded}/${
+ }: connector id ${connectorId}, transaction id ${
+ connector?.transactionId
+ }, value: ${connectorMinimumPowerRounded}/${
meterValue.sampledValue[sampledValuesIndex].value
}/${connectorMaximumPowerRounded}`
)
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: phase ${
meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
- }, connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumPowerPerPhaseRounded}/${
+ }, connector id ${connectorId}, transaction id ${
+ connector?.transactionId
+ }, value: ${connectorMinimumPowerPerPhaseRounded}/${
meterValue.sampledValue[sampledValuesPerPhaseIndex].value
}/${connectorMaximumPowerPerPhaseRounded}`
)
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumAmperage}/${
+ }: connector id ${connectorId}, transaction id ${
+ connector?.transactionId
+ }, value: ${connectorMinimumAmperage}/${
meterValue.sampledValue[sampledValuesIndex].value
}/${connectorMaximumAmperage}`
)
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
}: phase ${
meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
- }, connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumAmperage}/${
+ }, connector id ${connectorId}, transaction id ${
+ connector?.transactionId
+ }, value: ${connectorMinimumAmperage}/${
meterValue.sampledValue[sampledValuesPerPhaseIndex].value
}/${connectorMaximumAmperage}`
)
`${chargingStation.logPrefix()} MeterValues measurand ${
meterValue.sampledValue[sampledValuesIndex].measurand ??
MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: connector id ${connectorId}, transaction id ${connector?.transactionId}, value: ${connectorMinimumEnergyRounded}/${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${interval}ms`
+ }: connector id ${connectorId}, transaction id ${
+ connector?.transactionId
+ }, value: ${connectorMinimumEnergyRounded}/${energyValueRounded}/${connectorMaximumEnergyRounded}, duration: ${interval}ms`
)
}
}
value: string | undefined,
maxLimit: number,
minLimit: number,
- options?: { limitationEnabled?: boolean, fallbackValue?: number, unitMultiplier?: number }
+ options?: {
+ limitationEnabled?: boolean
+ fallbackValue?: number
+ unitMultiplier?: number
+ }
): number => {
options = {
...{
},
...options
}
- const parsedValue = parseInt(value ?? '')
+ const parsedValue = Number.parseInt(value ?? '')
if (options.limitationEnabled === true) {
return max(
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- min((!isNaN(parsedValue) ? parsedValue : Infinity) * options.unitMultiplier!, maxLimit),
+ min(
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ (!isNaN(parsedValue) ? parsedValue : Number.POSITIVE_INFINITY) * options.unitMultiplier!,
+ maxLimit
+ ),
minLimit
)
}
const authorizationProtocol = req.headers['sec-websocket-protocol']?.split(/,\s+/).pop()
const [username, password] = getUsernameAndPasswordFromAuthorizationToken(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join('=')}`
+ `${authorizationProtocol}${Array(((4 - (authorizationProtocol!.length % 4)) % 4) + 1).join(
+ '='
+ )}`
.split('.')
.pop() ?? '',
next
uiServerConfiguration.type as ApplicationProtocol
)
) {
- // eslint-disable-next-line @typescript-eslint/no-base-to-string
- const logMsg = `Unknown application protocol type '${uiServerConfiguration.type}' in '${ConfigurationSection.uiServer}' configuration section from values '${ApplicationProtocol.toString()}', defaulting to '${
+ const logMsg = `Unknown application protocol type '${uiServerConfiguration.type}' in '${
+ ConfigurationSection.uiServer
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
+ }' configuration section from values '${ApplicationProtocol.toString()}', defaulting to '${
ApplicationProtocol.WS
}'`
logger.warn(`${UIServerFactory.logPrefix()} ${logMsg}`)
)
if (performanceStorageConfiguration.enabled === true) {
logger.info(
- `${this.logPrefix()} storage enabled: type ${performanceStorageConfiguration.type}, uri: ${
- performanceStorageConfiguration.uri
- }`
+ `${this.logPrefix()} storage enabled: type ${
+ performanceStorageConfiguration.type
+ }, uri: ${performanceStorageConfiguration.uri}`
)
}
}
Constants.DEFAULT_CIRCULAR_BUFFER_CAPACITY
)
}
- this.statistics.statisticsData
- .get(entry.name)
- ?.measurementTimeSeries?.push({ timestamp: entry.startTime, value: entry.duration })
+ this.statistics.statisticsData.get(entry.name)?.measurementTimeSeries?.push({
+ timestamp: entry.startTime,
+ value: entry.duration
+ })
const timeMeasurementValues = extractTimeSeriesValues(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
this.statistics.statisticsData.get(entry.name)!.measurementTimeSeries!
await this.client
?.db(this.dbName)
.collection<Statistics>(Constants.PERFORMANCE_RECORDS_TABLE)
- .replaceOne({ id: performanceStatistics.id }, performanceStatistics, { upsert: true })
+ .replaceOne({ id: performanceStatistics.id }, performanceStatistics, {
+ upsert: true
+ })
} catch (error) {
this.handleDBError(StorageType.MONGO_DB, error as Error, Constants.PERFORMANCE_RECORDS_TABLE)
}
type: StorageType,
error: Error,
table?: string,
- params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+ params: HandleErrorParams<EmptyObject> = {
+ throwError: false,
+ consoleOut: false
+ }
): void {
setDefaultErrorParams(params, { throwError: false, consoleOut: false })
const inTableOrCollectionStr = table != null && ` in table or collection '${table}'`
// Mongo Connection and Query
if (config?.mongoConnectionString) {
// eslint-disable-next-line n/handle-callback-err
- MongoClient.connect(config.mongoConnectionString, async function (_err, client) {
+ MongoClient.connect(config.mongoConnectionString, async (_err, client) => {
const db = client.db()
for await (const tenantID of config.tenantIDs) {
// Mongo Connection and Query
if (config?.mongoConnectionString) {
// eslint-disable-next-line n/handle-callback-err
- MongoClient.connect(config.mongoConnectionString, async function (_err, client) {
+ MongoClient.connect(config.mongoConnectionString, async (_err, client) => {
const db = client.db()
for await (const tenantID of config.tenantIDs) {
)
}
-export const enum OutputFormat {
+export enum OutputFormat {
configuration = 'configuration',
worker = 'worker'
}
if (isCFEnvironment()) {
delete uiServerConfiguration.options?.host
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- uiServerConfiguration.options!.port = parseInt(env.PORT!)
+ uiServerConfiguration.options!.port = Number.parseInt(env.PORT!)
}
return uiServerConfiguration
}
chargingStation: ChargingStation,
commandName: RequestCommand | IncomingRequestCommand,
error: Error,
- params: HandleErrorParams<EmptyObject> = { throwError: false, consoleOut: false }
+ params: HandleErrorParams<EmptyObject> = {
+ throwError: false,
+ consoleOut: false
+ }
): void => {
setDefaultErrorParams(params, { throwError: false, consoleOut: false })
logger.error(`${chargingStation.logPrefix()} Request command '${commandName}' error:`, error)
}
let changedValue: number = value as number
if (typeof value === 'string') {
- changedValue = parseInt(value)
+ changedValue = Number.parseInt(value)
}
if (isNaN(changedValue)) {
throw new Error(`Cannot convert to integer: '${String(value)}'`)
}
let changedValue: number = value as number
if (typeof value === 'string') {
- changedValue = parseFloat(value)
+ changedValue = Number.parseFloat(value)
}
if (isNaN(changedValue)) {
throw new Error(`Cannot convert to float: '${String(value)}'`)
if (is(Map, value)) {
switch (mapFormat) {
case MapStringifyFormat.object:
- return { ...Object.fromEntries<Map<string, Record<string, unknown>>>(value.entries()) }
+ return {
+ ...Object.fromEntries<Map<string, Record<string, unknown>>>(value.entries())
+ }
case MapStringifyFormat.array:
default:
return [...value]
data: elementData
} satisfies WorkerMessage<D>
workerSetElement.worker.postMessage(message)
- this.promiseResponseMap.set(message.uuid, { resolve, reject, workerSetElement })
+ this.promiseResponseMap.set(message.uuid, {
+ resolve,
+ reject,
+ workerSetElement
+ })
})
const response = await sendMessageToWorker
// Add element sequentially to optimize memory at startup
worker.once('exit', () => {
this.removeWorkerSetElement(this.getWorkerSetElementByWorker(worker))
})
- const workerSetElement: WorkerSetElement = { worker, numberOfWorkerElements: 0 }
+ const workerSetElement: WorkerSetElement = {
+ worker,
+ numberOfWorkerElements: 0
+ }
this.workerSet.add(workerSetElement)
this.workerStartup = false
return workerSetElement
expect(isAsyncFunction([])).toBe(false)
expect(isAsyncFunction(new Date())).toBe(false)
// eslint-disable-next-line prefer-regex-literals
- expect(isAsyncFunction(new RegExp('[a-z]', 'i'))).toBe(false)
+ expect(isAsyncFunction(/[a-z]/i)).toBe(false)
expect(isAsyncFunction(new Error())).toBe(false)
expect(isAsyncFunction(new Map())).toBe(false)
expect(isAsyncFunction(new Set())).toBe(false)
}
public async deleteChargingStation(hashId: string): Promise<ResponsePayload> {
- return this.sendRequest(ProcedureName.DELETE_CHARGING_STATIONS, { hashIds: [hashId] })
+ return this.sendRequest(ProcedureName.DELETE_CHARGING_STATIONS, {
+ hashIds: [hashId]
+ })
}
public async setSupervisionUrl(hashId: string, supervisionUrl: string): Promise<ResponsePayload> {
}
public async startChargingStation(hashId: string): Promise<ResponsePayload> {
- return this.sendRequest(ProcedureName.START_CHARGING_STATION, { hashIds: [hashId] })
+ return this.sendRequest(ProcedureName.START_CHARGING_STATION, {
+ hashIds: [hashId]
+ })
}
public async stopChargingStation(hashId: string): Promise<ResponsePayload> {
- return this.sendRequest(ProcedureName.STOP_CHARGING_STATION, { hashIds: [hashId] })
+ return this.sendRequest(ProcedureName.STOP_CHARGING_STATION, {
+ hashIds: [hashId]
+ })
}
public async openConnection(hashId: string): Promise<ResponsePayload> {
this.uiServerConfiguration.authentication?.type === AuthenticationType.PROTOCOL_BASIC_AUTH
? [
`${this.uiServerConfiguration.protocol}${this.uiServerConfiguration.version}`,
- `authorization.basic.${btoa(`${this.uiServerConfiguration.authentication.username}:${this.uiServerConfiguration.authentication.password}`).replace(/={1,2}$/, '')}`
+ `authorization.basic.${btoa(
+ `${this.uiServerConfiguration.authentication.username}:${this.uiServerConfiguration.authentication.password}`
+ ).replace(/={1,2}$/, '')}`
]
: `${this.uiServerConfiguration.protocol}${this.uiServerConfiguration.version}`
this.ws = new WebSocket(
- `${this.uiServerConfiguration.secure === true ? ApplicationProtocol.WSS : ApplicationProtocol.WS}://${this.uiServerConfiguration.host}:${this.uiServerConfiguration.port}`,
+ `${
+ this.uiServerConfiguration.secure === true
+ ? ApplicationProtocol.WSS
+ : ApplicationProtocol.WS
+ }://${this.uiServerConfiguration.host}:${this.uiServerConfiguration.port}`,
protocols
)
this.ws.onopen = () => {
}
let changedValue: number = value as number
if (typeof value === 'string') {
- changedValue = parseInt(value)
+ changedValue = Number.parseInt(value)
}
if (isNaN(changedValue)) {
throw new Error(`Cannot convert to integer: '${String(value)}'`)
-export {}
+export type {}
declare module 'vue' {
export interface GlobalComponents {
)
const simulatorButtonMessage = computed<string>(
() =>
- `${simulatorState.value?.started === true ? 'Stop' : 'Start'} Simulator${simulatorState.value?.version != null ? ` (${simulatorState.value.version})` : ''}`
+ `${simulatorState.value?.started === true ? 'Stop' : 'Start'} Simulator${
+ simulatorState.value?.version != null ? ` (${simulatorState.value.version})` : ''
+ }`
)
const state = ref<{
unregisterWSEventListeners()
})
-const uiServerConfigurations: { index: number; configuration: UIServerConfigurationSection }[] = (
+const uiServerConfigurations: {
+ index: number
+ configuration: UIServerConfigurationSection
+}[] = (
app?.appContext.config.globalProperties.$configuration.value
.uiServer as UIServerConfigurationSection[]
).map((configuration: UIServerConfigurationSection, index: number) => ({
import serveStatic from 'serve-static'
const isCFEnvironment = env.VCAP_APPLICATION != null
-const PORT = isCFEnvironment ? parseInt(env.PORT) : 3030
+const PORT = isCFEnvironment ? Number.parseInt(env.PORT) : 3030
const uiPath = join(dirname(fileURLToPath(import.meta.url)), './dist')
const serve = serveStatic(uiPath)