"eslint-plugin-prettier": "^4.0.0",
"expect": "^28.1.0",
"husky": "^8.0.1",
- "lint-staged": "^12.4.1",
+ "lint-staged": "^12.4.2",
"mocha": "^10.0.0",
"mochawesome": "^7.1.3",
"nyc": "^15.1.0",
}
},
"node_modules/keyv": {
- "version": "4.2.9",
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.2.9.tgz",
- "integrity": "sha512-vqRBrN4xQHud7UMAGzGGFbt96MtGB9pb0OOg8Dhtq5RtiswCb1pCFq878iqC4hdeOP6eDPnCoFxA+2TXx427Ow==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.3.0.tgz",
+ "integrity": "sha512-C30Un9+63J0CsR7Wka5quXKqYZsT6dcRQ2aOwGcSc3RiQ4HGWpTAHlCA+puNfw2jA/s11EsxA1nCXgZRuRKMQQ==",
"dev": true,
"dependencies": {
"compress-brotli": "^1.3.8",
"dev": true
},
"node_modules/lint-staged": {
- "version": "12.4.1",
- "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.1.tgz",
- "integrity": "sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==",
+ "version": "12.4.2",
+ "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.2.tgz",
+ "integrity": "sha512-JAJGIzY/OioIUtrRePr8go6qUxij//mL+RGGoFKU3VWQRtIHgWoHizSqH0QVn2OwrbXS9Q6CICQjfj+E5qvrXg==",
"dev": true,
"dependencies": {
"cli-truncate": "^3.1.0",
}
},
"node_modules/new-github-release-url/node_modules/type-fest": {
- "version": "2.12.2",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.12.2.tgz",
- "integrity": "sha512-qt6ylCGpLjZ7AaODxbpyBZSs9fCI9SkL3Z9q2oxMBQhs/uyY+VD8jHA8ULCGmWQJlBgqvO3EJeAngOHD8zQCrQ==",
+ "version": "2.13.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.13.0.tgz",
+ "integrity": "sha512-lPfAm42MxE4/456+QyIaaVBAwgpJb6xZ8PRu09utnhPdWwcyj9vgy6Sq0Z5yNbJ21EdxB5dRU/Qg8bsyAMtlcw==",
"dev": true,
"engines": {
"node": ">=12.20"
}
},
"keyv": {
- "version": "4.2.9",
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.2.9.tgz",
- "integrity": "sha512-vqRBrN4xQHud7UMAGzGGFbt96MtGB9pb0OOg8Dhtq5RtiswCb1pCFq878iqC4hdeOP6eDPnCoFxA+2TXx427Ow==",
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.3.0.tgz",
+ "integrity": "sha512-C30Un9+63J0CsR7Wka5quXKqYZsT6dcRQ2aOwGcSc3RiQ4HGWpTAHlCA+puNfw2jA/s11EsxA1nCXgZRuRKMQQ==",
"dev": true,
"requires": {
"compress-brotli": "^1.3.8",
"dev": true
},
"lint-staged": {
- "version": "12.4.1",
- "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.1.tgz",
- "integrity": "sha512-PTXgzpflrQ+pODQTG116QNB+Q6uUTDg5B5HqGvNhoQSGt8Qy+MA/6zSnR8n38+sxP5TapzeQGTvoKni0KRS8Vg==",
+ "version": "12.4.2",
+ "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-12.4.2.tgz",
+ "integrity": "sha512-JAJGIzY/OioIUtrRePr8go6qUxij//mL+RGGoFKU3VWQRtIHgWoHizSqH0QVn2OwrbXS9Q6CICQjfj+E5qvrXg==",
"dev": true,
"requires": {
"cli-truncate": "^3.1.0",
},
"dependencies": {
"type-fest": {
- "version": "2.12.2",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.12.2.tgz",
- "integrity": "sha512-qt6ylCGpLjZ7AaODxbpyBZSs9fCI9SkL3Z9q2oxMBQhs/uyY+VD8jHA8ULCGmWQJlBgqvO3EJeAngOHD8zQCrQ==",
+ "version": "2.13.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.13.0.tgz",
+ "integrity": "sha512-lPfAm42MxE4/456+QyIaaVBAwgpJb6xZ8PRu09utnhPdWwcyj9vgy6Sq0Z5yNbJ21EdxB5dRU/Qg8bsyAMtlcw==",
"dev": true
}
}
import ChargingStationConfiguration from '../types/ChargingStationConfiguration';
import ChargingStationTemplate from '../types/ChargingStationTemplate';
-import { ChargingStationUtils } from './ChargingStationUtils';
import LRUCache from 'mnemonist/lru-map-with-delete';
+import Utils from '../utils/Utils';
enum CacheType {
CHARGING_STATION_TEMPLATE = 'chargingStationTemplate',
public setChargingStationConfiguration(
chargingStationConfiguration: ChargingStationConfiguration
): void {
- if (
- ChargingStationUtils.isChargingStationConfigurationCacheable(chargingStationConfiguration)
- ) {
+ if (this.isChargingStationConfigurationCacheable(chargingStationConfiguration)) {
this.set(
CacheType.CHARGING_STATION_CONFIGURATION + chargingStationConfiguration.configurationHash,
chargingStationConfiguration
private delete(key: string): void {
this.lruCache.delete(key);
}
+
+ private isChargingStationConfigurationCacheable(
+ chargingStationConfiguration: ChargingStationConfiguration
+ ): boolean {
+ return (
+ !Utils.isNullOrUndefined(chargingStationConfiguration?.configurationKey) &&
+ !Utils.isNullOrUndefined(chargingStationConfiguration?.stationInfo) &&
+ !Utils.isNullOrUndefined(chargingStationConfiguration?.configurationHash) &&
+ !Utils.isEmptyArray(chargingStationConfiguration?.configurationKey) &&
+ !Utils.isEmptyObject(chargingStationConfiguration?.stationInfo) &&
+ !Utils.isEmptyString(chargingStationConfiguration?.configurationHash)
+ );
+ }
}
import BaseError from '../exception/BaseError';
import { BootNotificationRequest } from '../types/ocpp/Requests';
import ChargingStation from './ChargingStation';
-import ChargingStationConfiguration from '../types/ChargingStationConfiguration';
import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils';
import ChargingStationInfo from '../types/ChargingStationInfo';
import Configuration from '../utils/Configuration';
);
}
- public static isChargingStationConfigurationCacheable(
- chargingStationConfiguration: ChargingStationConfiguration
- ): boolean {
- return (
- !Utils.isNullOrUndefined(chargingStationConfiguration?.configurationKey) &&
- !Utils.isNullOrUndefined(chargingStationConfiguration?.stationInfo) &&
- !Utils.isNullOrUndefined(chargingStationConfiguration?.configurationHash) &&
- !Utils.isEmptyArray(chargingStationConfiguration?.configurationKey) &&
- !Utils.isEmptyObject(chargingStationConfiguration?.stationInfo) &&
- !Utils.isEmptyString(chargingStationConfiguration?.configurationHash)
- );
- }
-
private static getRandomSerialNumberSuffix(params?: {
randomBytesLength?: number;
upperCase?: boolean;