repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
IdTagsCache.ts
diff --git
a/src/charging-station/IdTagsCache.ts
b/src/charging-station/IdTagsCache.ts
index b50c062008b9b1388d9ea21cfeb21ac3ba0018ce..da4b38bfce79de421343e16f90dd2b6a17e85c6b 100644
(file)
--- a/
src/charging-station/IdTagsCache.ts
+++ b/
src/charging-station/IdTagsCache.ts
@@
-1,16
+1,16
@@
import { type FSWatcher, readFileSync } from 'node:fs'
import { type FSWatcher, readFileSync } from 'node:fs'
-import type { ChargingStation } from './ChargingStation.js'
-import { getIdTagsFile } from './Helpers.js'
import { FileType, IdTagDistribution } from '../types/index.js'
import {
handleFileException,
isNotEmptyString,
import { FileType, IdTagDistribution } from '../types/index.js'
import {
handleFileException,
isNotEmptyString,
- logPrefix,
logger,
logger,
+ logPrefix,
secureRandom,
watchJsonFile
} from '../utils/index.js'
secureRandom,
watchJsonFile
} from '../utils/index.js'
+import type { ChargingStation } from './ChargingStation.js'
+import { getIdTagsFile } from './Helpers.js'
interface IdTagsCacheValueType {
idTags: string[]
interface IdTagsCacheValueType {
idTags: string[]
@@
-48,9
+48,10
@@
export class IdTagsCache {
chargingStation: ChargingStation,
connectorId: number
): string {
chargingStation: ChargingStation,
connectorId: number
): string {
- const hashId = chargingStation.stationInfo.hashId
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const idTagsFile = getIdTagsFile(chargingStation.stationInfo)!
+ const hashId = chargingStation.stationInfo!.hashId
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ const idTagsFile = getIdTagsFile(chargingStation.stationInfo!)!
switch (distribution) {
case IdTagDistribution.RANDOM:
return this.getRandomIdTag(hashId, idTagsFile)
switch (distribution) {
case IdTagDistribution.RANDOM:
return this.getRandomIdTag(hashId, idTagsFile)
@@
-108,12
+109,13
@@
export class IdTagsCache {
private getConnectorAffinityIdTag (chargingStation: ChargingStation, connectorId: number): string {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
private getConnectorAffinityIdTag (chargingStation: ChargingStation, connectorId: number): string {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- const file = getIdTagsFile(chargingStation.stationInfo)!
+ const file = getIdTagsFile(chargingStation.stationInfo
!
)!
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const idTags = this.getIdTags(file)!
const addressableKey = this.getIdTagsCacheIndexesAddressableKey(
file,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const idTags = this.getIdTags(file)!
const addressableKey = this.getIdTagsCacheIndexesAddressableKey(
file,
- chargingStation.stationInfo.hashId
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ chargingStation.stationInfo!.hashId
)
this.idTagsCachesAddressableIndexes.set(
addressableKey,
)
this.idTagsCachesAddressableIndexes.set(
addressableKey,
@@
-141,8
+143,7
@@
export class IdTagsCache {
logger.debug(
`${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload`
)
logger.debug(
`${this.logPrefix(file)} ${FileType.Authorization} file have changed, reload`
)
- this.deleteIdTagsCache(file)
- this.deleteIdTagsCacheIndexes(file)
+ this.deleteIdTags(file)
} catch (error) {
handleFileException(
file,
} catch (error) {
handleFileException(
file,
@@
-176,7
+177,7
@@
export class IdTagsCache {
deleted.push(this.idTagsCachesAddressableIndexes.delete(key))
}
}
deleted.push(this.idTagsCachesAddressableIndexes.delete(key))
}
}
- return !deleted.some(
(value)
=> !value)
+ return !deleted.some(
value
=> !value)
}
private getIdTagsCacheIndexesAddressableKey (prefix: string, uid: string): string {
}
private getIdTagsCacheIndexesAddressableKey (prefix: string, uid: string): string {