cloneObject,
formatDurationMilliSeconds,
getRandomInteger,
- isNullOrUndefined,
logPrefix,
logger,
secureRandom,
const transactionId = this.chargingStation.getConnectorStatus(connectorId)?.transactionId
logger.debug(
`${this.logPrefix(connectorId)} stopping a not started transaction${
- !isNullOrUndefined(transactionId) ? ` with id ${transactionId}` : ''
+ transactionId != null ? ` with id ${transactionId}` : ''
}`
)
}
private readonly logPrefix = (connectorId?: number): string => {
return logPrefix(
` ${this.chargingStation.stationInfo.chargingStationId} | ATG${
- !isNullOrUndefined(connectorId) ? ` on connector #${connectorId}` : ''
+ connectorId != null ? ` on connector #${connectorId}` : ''
}:`
)
}
handleUncaughtException,
handleUnhandledRejection,
isNotEmptyArray,
- isNullOrUndefined,
logPrefix,
logger
} from '../utils/index.js'
? `/${workerConfiguration.poolMaxSize?.toString()}`
: ''
} worker(s) concurrently running in '${workerConfiguration.processType}' mode${
- !isNullOrUndefined(this.workerImplementation?.maxElementsPerWorker)
+ this.workerImplementation?.maxElementsPerWorker != null
? ` (${this.workerImplementation?.maxElementsPerWorker} charging station(s) per worker)`
: ''
}`
import { Bootstrap } from './Bootstrap.js'
import type { ChargingStationConfiguration, ChargingStationTemplate } from '../types/index.js'
-import {
- isEmptyObject,
- isNotEmptyArray,
- isNotEmptyString,
- isNullOrUndefined
-} from '../utils/index.js'
+import { isEmptyObject, isNotEmptyArray, isNotEmptyString } from '../utils/index.js'
enum CacheType {
chargingStationTemplate = 'chargingStationTemplate',
chargingStationConfiguration: ChargingStationConfiguration
): boolean {
return (
- !isNullOrUndefined(chargingStationConfiguration?.configurationKey) &&
- !isNullOrUndefined(chargingStationConfiguration?.stationInfo) &&
- !isNullOrUndefined(chargingStationConfiguration?.automaticTransactionGenerator) &&
- !isNullOrUndefined(chargingStationConfiguration?.configurationHash) &&
+ chargingStationConfiguration?.configurationKey != null &&
+ chargingStationConfiguration?.stationInfo != null &&
+ chargingStationConfiguration?.automaticTransactionGenerator != null &&
+ chargingStationConfiguration?.configurationHash != null &&
isNotEmptyArray(chargingStationConfiguration?.configurationKey) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- !isEmptyObject(chargingStationConfiguration.stationInfo!) &&
+ !isEmptyObject(chargingStationConfiguration.stationInfo) &&
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- !isEmptyObject(chargingStationConfiguration.automaticTransactionGenerator!) &&
+ !isEmptyObject(chargingStationConfiguration.automaticTransactionGenerator) &&
isNotEmptyString(chargingStationConfiguration?.configurationHash)
)
}
type StopTransactionRequest,
type StopTransactionResponse
} from '../../types/index.js'
-import {
- Constants,
- convertToInt,
- isEmptyObject,
- isNullOrUndefined,
- logger
-} from '../../utils/index.js'
+import { Constants, convertToInt, isEmptyObject, logger } from '../../utils/index.js'
import type { ChargingStation } from '../ChargingStation.js'
import { getConfigurationKey } from '../ConfigurationKeyUtils.js'
import { buildMeterValue } from '../ocpp/index.js'
}
const [uuid, command, requestPayload] = validatedMessageEvent.data as BroadcastChannelRequest
if (
- !isNullOrUndefined(requestPayload.hashIds) &&
- requestPayload.hashIds?.includes(this.chargingStation.stationInfo.hashId) === false
+ requestPayload.hashIds != null &&
+ !requestPayload.hashIds.includes(this.chargingStation.stationInfo.hashId)
) {
return
}
- if (!isNullOrUndefined(requestPayload.hashId)) {
+ if (requestPayload.hashId != null) {
logger.error(
`${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' array instead`
)
let commandResponse: CommandResponse | void | undefined
try {
commandResponse = await this.commandHandler(command, requestPayload)
- if (isNullOrUndefined(commandResponse) || isEmptyObject(commandResponse as CommandResponse)) {
+ if (commandResponse == null || isEmptyObject(commandResponse)) {
responsePayload = {
hashId: this.chargingStation.stationInfo.hashId,
status: ResponseStatus.SUCCESS
responsePayload = this.commandResponseToResponsePayload(
command,
requestPayload,
- commandResponse as CommandResponse
+ commandResponse
)
}
} catch (error) {