"settings": {
"jsdoc": {
"mode": "typescript"
+ },
+ "import/resolver": {
+ "typescript": {
+ "project": "./tsconfig.json"
+ }
}
},
"rules": {
"warn",
{
"ignoreCase": false,
- "ignoreDeclarationSort": false,
+ "ignoreDeclarationSort": true,
"ignoreMemberSort": false,
- "memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
+ "memberSyntaxSortOrder": ["none", "all", "multiple", "single"],
+ "allowSeparatedGroups": true
+ }
+ ],
+ "import/no-unresolved": "error",
+ "import/order": [
+ "error",
+ {
+ "groups": [
+ "builtin", // Built-in imports (come from NodeJS native) go first
+ "external", // <- External imports
+ "internal", // <- Absolute imports
+ ["sibling", "parent"], // <- Relative imports, the sibling and parent types they can be mingled together
+ "index", // <- Index imports
+ "unknown" // <- Unknown
+ ],
+ "newlines-between": "always",
+ "alphabetize": {
+ /* Sort in ascending order. Options: ["ignore", "asc", "desc"] */
+ "order": "asc",
+ /* Ignore case. Options: [true, false] */
+ "caseInsensitive": true
+ }
}
],
"object-curly-spacing": ["error", "always"],
// See https://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
- "amatiasq.sort-imports",
"codezombiech.gitignore",
"dbaeumer.vscode-eslint",
"eamodio.gitlens",
{
+ "editor.formatOnSave": false,
"editor.codeActionsOnSave": {
- "source.fixAll.eslint": true
+ "source.fixAll": true
}
}
"cross-env": "^7.0.3",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
- "eslint-import-resolver-typescript": "^3.2.6",
+ "eslint-import-resolver-typescript": "^3.2.7",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.3",
"eslint-plugin-node": "^11.1.0",
}
},
"node_modules/@types/node": {
- "version": "18.0.4",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.4.tgz",
- "integrity": "sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA=="
+ "version": "18.0.6",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.6.tgz",
+ "integrity": "sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw=="
},
"node_modules/@types/object-path": {
"version": "0.11.1",
}
},
"node_modules/eslint-import-resolver-typescript": {
- "version": "3.2.6",
- "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.2.6.tgz",
- "integrity": "sha512-Gk7+viMP9Ho5Q36gmXw3UJrnSCbMTStLS+TuF49SdsOUQGNvhg7ZVsnaieuN0FNNWPB+Xf5tBwADgEuoRPeDDw==",
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.2.7.tgz",
+ "integrity": "sha512-WvcsRy3aPmwVsuS/XVliAJWpIdTlaFXXZPZk3TCbvvF8RtaAkjAhcLL5bl5VEoTmE+XnTHjIbWMzNZcOQpK/DA==",
"dev": true,
"dependencies": {
"debug": "^4.3.4",
"globby": "^13.1.2",
"is-core-module": "^2.9.0",
"is-glob": "^4.0.3",
- "synckit": "^0.7.2"
+ "synckit": "^0.8.1"
},
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
}
},
"node_modules/synckit": {
- "version": "0.7.2",
- "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.7.2.tgz",
- "integrity": "sha512-CSZRtSRZ8RhJGMtWyLRqlarmWPPlsgZJHtV6cz0VTHNOg+R7UBoE2eNPQmB5Qrhtk3RX2AAcJmVwMXFULVQSwg==",
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.1.tgz",
+ "integrity": "sha512-rJEeygO5PNmcZICmrgnbOd2usi5zWE1ESc0Gn5tTmJlongoU8zCTwMFQtar2UgMSiR68vK9afPQ+uVs2lURSIA==",
"dev": true,
"dependencies": {
- "@pkgr/utils": "^2.2.0",
+ "@pkgr/utils": "^2.3.0",
"tslib": "^2.4.0"
},
"engines": {
- "node": "^12.20.0 || ^14.18.0 || >=16.0.0"
+ "node": "^14.18.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/unts"
}
},
"@types/node": {
- "version": "18.0.4",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.4.tgz",
- "integrity": "sha512-M0+G6V0Y4YV8cqzHssZpaNCqvYwlCiulmm0PwpNLF55r/+cT8Ol42CHRU1SEaYFH2rTwiiE1aYg/2g2rrtGdPA=="
+ "version": "18.0.6",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.6.tgz",
+ "integrity": "sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw=="
},
"@types/object-path": {
"version": "0.11.1",
}
},
"eslint-import-resolver-typescript": {
- "version": "3.2.6",
- "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.2.6.tgz",
- "integrity": "sha512-Gk7+viMP9Ho5Q36gmXw3UJrnSCbMTStLS+TuF49SdsOUQGNvhg7ZVsnaieuN0FNNWPB+Xf5tBwADgEuoRPeDDw==",
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.2.7.tgz",
+ "integrity": "sha512-WvcsRy3aPmwVsuS/XVliAJWpIdTlaFXXZPZk3TCbvvF8RtaAkjAhcLL5bl5VEoTmE+XnTHjIbWMzNZcOQpK/DA==",
"dev": true,
"requires": {
"debug": "^4.3.4",
"globby": "^13.1.2",
"is-core-module": "^2.9.0",
"is-glob": "^4.0.3",
- "synckit": "^0.7.2"
+ "synckit": "^0.8.1"
},
"dependencies": {
"globby": {
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
},
"synckit": {
- "version": "0.7.2",
- "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.7.2.tgz",
- "integrity": "sha512-CSZRtSRZ8RhJGMtWyLRqlarmWPPlsgZJHtV6cz0VTHNOg+R7UBoE2eNPQmB5Qrhtk3RX2AAcJmVwMXFULVQSwg==",
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.1.tgz",
+ "integrity": "sha512-rJEeygO5PNmcZICmrgnbOd2usi5zWE1ESc0Gn5tTmJlongoU8zCTwMFQtar2UgMSiR68vK9afPQ+uVs2lURSIA==",
"dev": true,
"requires": {
- "@pkgr/utils": "^2.2.0",
+ "@pkgr/utils": "^2.3.0",
"tslib": "^2.4.0"
}
},
"lint": "cross-env TIMING=1 eslint --cache --ext .js,.ts src",
"lint:fix": "cross-env TIMING=1 eslint --cache --fix --ext .js,.ts src",
"format": "prettier --write .",
- "import-sort": "npx import-sort-cli --write 'src/**/*.ts{,x}'",
"test": "cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\"} nyc mocha test/**/*Test.ts",
"coverage": "nyc report --reporter=lcov",
"coverage:html": "nyc report --reporter=html",
"cross-env": "^7.0.3",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.5.0",
- "eslint-import-resolver-typescript": "^3.2.6",
+ "eslint-import-resolver-typescript": "^3.2.7",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsdoc": "^39.3.3",
"eslint-plugin-node": "^11.1.0",
+import fs from 'fs';
+
import { FileType } from '../types/FileType';
import FileUtils from '../utils/FileUtils';
-import Utils from '../utils/Utils';
-import fs from 'fs';
import logger from '../utils/Logger';
+import Utils from '../utils/Utils';
export default class AuthorizedTagsCache {
private static instance: AuthorizedTagsCache | null = null;
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import PerformanceStatistics from '../performance/PerformanceStatistics';
+import {
+ AutomaticTransactionGeneratorConfiguration,
+ Status,
+} from '../types/AutomaticTransactionGenerator';
+import { MeterValuesRequest, RequestCommand } from '../types/ocpp/Requests';
+import { MeterValuesResponse } from '../types/ocpp/Responses';
import {
AuthorizationStatus,
AuthorizeRequest,
StopTransactionRequest,
StopTransactionResponse,
} from '../types/ocpp/Transaction';
-import {
- AutomaticTransactionGeneratorConfiguration,
- Status,
-} from '../types/AutomaticTransactionGenerator';
-import { MeterValuesRequest, RequestCommand } from '../types/ocpp/Requests';
-
-import type ChargingStation from './ChargingStation';
import Constants from '../utils/Constants';
-import { MeterValuesResponse } from '../types/ocpp/Responses';
-import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils';
-import PerformanceStatistics from '../performance/PerformanceStatistics';
-import Utils from '../utils/Utils';
import logger from '../utils/Logger';
+import Utils from '../utils/Utils';
+import type ChargingStation from './ChargingStation';
+import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils';
export default class AutomaticTransactionGenerator {
private static readonly instances: Map<string, AutomaticTransactionGenerator> = new Map<
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import path from 'path';
+import { fileURLToPath } from 'url';
+import { isMainThread } from 'worker_threads';
+
+import chalk from 'chalk';
+
+import { version } from '../../package.json';
+import { Storage } from '../performance/storage/Storage';
+import { StorageFactory } from '../performance/storage/StorageFactory';
import {
ChargingStationWorkerData,
ChargingStationWorkerMessage,
ChargingStationWorkerMessageEvents,
} from '../types/ChargingStationWorker';
-
-import { AbstractUIServer } from './ui-server/AbstractUIServer';
-import { ApplicationProtocol } from '../types/UIProtocol';
-import { ChargingStationUtils } from './ChargingStationUtils';
-import Configuration from '../utils/Configuration';
import { StationTemplateUrl } from '../types/ConfigurationData';
import Statistics from '../types/Statistics';
-import { Storage } from '../performance/storage/Storage';
-import { StorageFactory } from '../performance/storage/StorageFactory';
-import UIServerFactory from './ui-server/UIServerFactory';
-import { UIServiceUtils } from './ui-server/ui-services/UIServiceUtils';
+import { ApplicationProtocol } from '../types/UIProtocol';
+import Configuration from '../utils/Configuration';
import Utils from '../utils/Utils';
import WorkerAbstract from '../worker/WorkerAbstract';
import WorkerFactory from '../worker/WorkerFactory';
-import chalk from 'chalk';
-import { fileURLToPath } from 'url';
-import { isMainThread } from 'worker_threads';
-import path from 'path';
-import { version } from '../../package.json';
+import { ChargingStationUtils } from './ChargingStationUtils';
+import { AbstractUIServer } from './ui-server/AbstractUIServer';
+import { UIServiceUtils } from './ui-server/ui-services/UIServiceUtils';
+import UIServerFactory from './ui-server/UIServerFactory';
export default class Bootstrap {
private static instance: Bootstrap | null = null;
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { ACElectricUtils, DCElectricUtils } from '../utils/ElectricUtils';
+import crypto from 'crypto';
+import fs from 'fs';
+import path from 'path';
+import { URL, fileURLToPath } from 'url';
+import { parentPort } from 'worker_threads';
+
+import WebSocket, { Data, RawData } from 'ws';
+
+import BaseError from '../exception/BaseError';
+import OCPPError from '../exception/OCPPError';
+import PerformanceStatistics from '../performance/PerformanceStatistics';
+import { AutomaticTransactionGeneratorConfiguration } from '../types/AutomaticTransactionGenerator';
+import ChargingStationConfiguration from '../types/ChargingStationConfiguration';
+import ChargingStationInfo from '../types/ChargingStationInfo';
+import ChargingStationOcppConfiguration from '../types/ChargingStationOcppConfiguration';
+import ChargingStationTemplate, {
+ CurrentType,
+ PowerUnits,
+ WsOptions,
+} from '../types/ChargingStationTemplate';
+import { ChargingStationWorkerMessageEvents } from '../types/ChargingStationWorker';
+import { SupervisionUrlDistribution } from '../types/ConfigurationData';
+import { ConnectorStatus } from '../types/ConnectorStatus';
+import { FileType } from '../types/FileType';
+import { JsonType } from '../types/JsonType';
+import { ChargePointErrorCode } from '../types/ocpp/ChargePointErrorCode';
+import { ChargePointStatus } from '../types/ocpp/ChargePointStatus';
+import { ChargingProfile, ChargingRateUnitType } from '../types/ocpp/ChargingProfile';
+import {
+ ConnectorPhaseRotation,
+ StandardParametersKey,
+ SupportedFeatureProfiles,
+ VendorDefaultParametersKey,
+} from '../types/ocpp/Configuration';
+import { ErrorType } from '../types/ocpp/ErrorType';
+import { MessageType } from '../types/ocpp/MessageType';
+import { MeterValue, MeterValueMeasurand } from '../types/ocpp/MeterValues';
+import { OCPPVersion } from '../types/ocpp/OCPPVersion';
import {
AvailabilityType,
BootNotificationRequest,
Response,
StatusNotificationResponse,
} from '../types/ocpp/Responses';
-import { ChargingProfile, ChargingRateUnitType } from '../types/ocpp/ChargingProfile';
-import ChargingStationTemplate, {
- CurrentType,
- PowerUnits,
- WsOptions,
-} from '../types/ChargingStationTemplate';
-import {
- ConnectorPhaseRotation,
- StandardParametersKey,
- SupportedFeatureProfiles,
- VendorDefaultParametersKey,
-} from '../types/ocpp/Configuration';
-import { MeterValue, MeterValueMeasurand } from '../types/ocpp/MeterValues';
import {
StopTransactionReason,
StopTransactionRequest,
StopTransactionResponse,
} from '../types/ocpp/Transaction';
-import { URL, fileURLToPath } from 'url';
import { WSError, WebSocketCloseEventStatusCode } from '../types/WebSocket';
-import WebSocket, { Data, RawData } from 'ws';
-
+import Configuration from '../utils/Configuration';
+import Constants from '../utils/Constants';
+import { ACElectricUtils, DCElectricUtils } from '../utils/ElectricUtils';
+import FileUtils from '../utils/FileUtils';
+import logger from '../utils/Logger';
+import Utils from '../utils/Utils';
import AuthorizedTagsCache from './AuthorizedTagsCache';
import AutomaticTransactionGenerator from './AutomaticTransactionGenerator';
-import { AutomaticTransactionGeneratorConfiguration } from '../types/AutomaticTransactionGenerator';
-import BaseError from '../exception/BaseError';
-import { ChargePointErrorCode } from '../types/ocpp/ChargePointErrorCode';
-import { ChargePointStatus } from '../types/ocpp/ChargePointStatus';
-import ChargingStationConfiguration from '../types/ChargingStationConfiguration';
import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils';
-import ChargingStationInfo from '../types/ChargingStationInfo';
-import ChargingStationOcppConfiguration from '../types/ChargingStationOcppConfiguration';
import { ChargingStationUtils } from './ChargingStationUtils';
-import { ChargingStationWorkerMessageEvents } from '../types/ChargingStationWorker';
-import Configuration from '../utils/Configuration';
-import { ConnectorStatus } from '../types/ConnectorStatus';
-import Constants from '../utils/Constants';
-import { ErrorType } from '../types/ocpp/ErrorType';
-import { FileType } from '../types/FileType';
-import FileUtils from '../utils/FileUtils';
-import { JsonType } from '../types/JsonType';
-import { MessageType } from '../types/ocpp/MessageType';
import OCPP16IncomingRequestService from './ocpp/1.6/OCPP16IncomingRequestService';
import OCPP16RequestService from './ocpp/1.6/OCPP16RequestService';
import OCPP16ResponseService from './ocpp/1.6/OCPP16ResponseService';
import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils';
-import OCPPError from '../exception/OCPPError';
import OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService';
import OCPPRequestService from './ocpp/OCPPRequestService';
-import { OCPPVersion } from '../types/ocpp/OCPPVersion';
-import PerformanceStatistics from '../performance/PerformanceStatistics';
import SharedLRUCache from './SharedLRUCache';
-import { SupervisionUrlDistribution } from '../types/ConfigurationData';
-import Utils from '../utils/Utils';
-import crypto from 'crypto';
-import fs from 'fs';
-import logger from '../utils/Logger';
-import { parentPort } from 'worker_threads';
-import path from 'path';
export default class ChargingStation {
public hashId!: string;
-import ChargingStation from './ChargingStation';
import { ConfigurationKey } from '../types/ChargingStationOcppConfiguration';
import { StandardParametersKey } from '../types/ocpp/Configuration';
import logger from '../utils/Logger';
+import ChargingStation from './ChargingStation';
export class ChargingStationConfigurationUtils {
private constructor() {
-import { ChargingProfile, ChargingSchedulePeriod } from '../types/ocpp/ChargingProfile';
-import { ChargingProfileKindType, RecurrencyKindType } from '../types/ocpp/1.6/ChargingProfile';
+import crypto from 'crypto';
+import path from 'path';
+import { fileURLToPath } from 'url';
+
+import moment from 'moment';
+
+import BaseError from '../exception/BaseError';
+import ChargingStationInfo from '../types/ChargingStationInfo';
import ChargingStationTemplate, {
AmpereUnits,
CurrentType,
Voltage,
} from '../types/ChargingStationTemplate';
-import { MeterValueMeasurand, MeterValuePhase } from '../types/ocpp/MeterValues';
-
-import BaseError from '../exception/BaseError';
-import { BootNotificationRequest } from '../types/ocpp/Requests';
-import ChargingStation from './ChargingStation';
-import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils';
-import ChargingStationInfo from '../types/ChargingStationInfo';
-import Configuration from '../utils/Configuration';
-import Constants from '../utils/Constants';
import { SampledValueTemplate } from '../types/MeasurandPerPhaseSampledValueTemplates';
+import { ChargingProfileKindType, RecurrencyKindType } from '../types/ocpp/1.6/ChargingProfile';
+import { ChargingProfile, ChargingSchedulePeriod } from '../types/ocpp/ChargingProfile';
import { StandardParametersKey } from '../types/ocpp/Configuration';
-import Utils from '../utils/Utils';
+import { MeterValueMeasurand, MeterValuePhase } from '../types/ocpp/MeterValues';
+import { BootNotificationRequest } from '../types/ocpp/Requests';
import { WebSocketCloseEventStatusString } from '../types/WebSocket';
import { WorkerProcessType } from '../types/Worker';
-import crypto from 'crypto';
-import { fileURLToPath } from 'url';
+import Configuration from '../utils/Configuration';
+import Constants from '../utils/Constants';
import logger from '../utils/Logger';
-import moment from 'moment';
-import path from 'path';
+import Utils from '../utils/Utils';
+import ChargingStation from './ChargingStation';
+import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils';
export class ChargingStationUtils {
private constructor() {
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import { parentPort, workerData } from 'worker_threads';
+
+import { ThreadWorker } from 'poolifier';
+
import {
ChargingStationWorkerData,
ChargingStationWorkerMessage,
ChargingStationWorkerMessageEvents,
} from '../types/ChargingStationWorker';
-import { parentPort, workerData } from 'worker_threads';
-
-import ChargingStation from './ChargingStation';
-import { ChargingStationUtils } from './ChargingStationUtils';
-import { ThreadWorker } from 'poolifier';
import Utils from '../utils/Utils';
import WorkerConstants from '../worker/WorkerConstants';
+import ChargingStation from './ChargingStation';
+import { ChargingStationUtils } from './ChargingStationUtils';
// Conditionally export ThreadWorker instance for pool usage
export let threadWorker: ThreadWorker;
+import LRUCache from 'mnemonist/lru-map-with-delete';
+
import ChargingStationConfiguration from '../types/ChargingStationConfiguration';
import ChargingStationTemplate from '../types/ChargingStationTemplate';
-import LRUCache from 'mnemonist/lru-map-with-delete';
import Utils from '../utils/Utils';
enum CacheType {
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import fs from 'fs';
+import path from 'path';
+import { URL, fileURLToPath } from 'url';
+
+import { Client, FTPResponse } from 'basic-ftp';
+import tar from 'tar';
+
+import OCPPError from '../../../exception/OCPPError';
+import { JsonType } from '../../../types/JsonType';
+import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode';
+import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
+import {
+ ChargingProfilePurposeType,
+ OCPP16ChargingProfile,
+} from '../../../types/ocpp/1.6/ChargingProfile';
+import {
+ OCPP16StandardParametersKey,
+ OCPP16SupportedFeatureProfiles,
+} from '../../../types/ocpp/1.6/Configuration';
+import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
+import {
+ OCPP16MeterValuesRequest,
+ OCPP16MeterValuesResponse,
+} from '../../../types/ocpp/1.6/MeterValues';
import {
ChangeAvailabilityRequest,
ChangeConfigurationRequest,
SetChargingProfileResponse,
UnlockConnectorResponse,
} from '../../../types/ocpp/1.6/Responses';
-import {
- ChargingProfilePurposeType,
- OCPP16ChargingProfile,
-} from '../../../types/ocpp/1.6/ChargingProfile';
-import { Client, FTPResponse } from 'basic-ftp';
import {
OCPP16AuthorizationStatus,
OCPP16AuthorizeRequest,
OCPP16StopTransactionRequest,
OCPP16StopTransactionResponse,
} from '../../../types/ocpp/1.6/Transaction';
-import {
- OCPP16MeterValuesRequest,
- OCPP16MeterValuesResponse,
-} from '../../../types/ocpp/1.6/MeterValues';
-import {
- OCPP16StandardParametersKey,
- OCPP16SupportedFeatureProfiles,
-} from '../../../types/ocpp/1.6/Configuration';
-import { URL, fileURLToPath } from 'url';
-
+import { OCPPConfigurationKey } from '../../../types/ocpp/Configuration';
+import { ErrorType } from '../../../types/ocpp/ErrorType';
+import { IncomingRequestHandler } from '../../../types/ocpp/Requests';
+import { DefaultResponse } from '../../../types/ocpp/Responses';
+import Constants from '../../../utils/Constants';
+import logger from '../../../utils/Logger';
+import Utils from '../../../utils/Utils';
import type ChargingStation from '../../ChargingStation';
import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils';
import { ChargingStationUtils } from '../../ChargingStationUtils';
-import Constants from '../../../utils/Constants';
-import { DefaultResponse } from '../../../types/ocpp/Responses';
-import { ErrorType } from '../../../types/ocpp/ErrorType';
-import { IncomingRequestHandler } from '../../../types/ocpp/Requests';
-import { JsonType } from '../../../types/JsonType';
-import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode';
-import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
-import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus';
-import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
-import { OCPPConfigurationKey } from '../../../types/ocpp/Configuration';
-import OCPPError from '../../../exception/OCPPError';
import OCPPIncomingRequestService from '../OCPPIncomingRequestService';
-import Utils from '../../../utils/Utils';
-import fs from 'fs';
-import logger from '../../../utils/Logger';
-import path from 'path';
-import tar from 'tar';
+import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
const moduleName = 'OCPP16IncomingRequestService';
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import OCPPError from '../../../exception/OCPPError';
import { JsonObject, JsonType } from '../../../types/JsonType';
-
-import type ChargingStation from '../../ChargingStation';
-import Constants from '../../../utils/Constants';
-import { ErrorType } from '../../../types/ocpp/ErrorType';
import { OCPP16RequestCommand } from '../../../types/ocpp/1.6/Requests';
-import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
-import OCPPError from '../../../exception/OCPPError';
-import OCPPRequestService from '../OCPPRequestService';
-import type OCPPResponseService from '../OCPPResponseService';
+import { ErrorType } from '../../../types/ocpp/ErrorType';
import { RequestParams } from '../../../types/ocpp/Requests';
+import Constants from '../../../utils/Constants';
import Utils from '../../../utils/Utils';
+import type ChargingStation from '../../ChargingStation';
+import OCPPRequestService from '../OCPPRequestService';
+import type OCPPResponseService from '../OCPPResponseService';
+import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
const moduleName = 'OCPP16RequestService';
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import OCPPError from '../../../exception/OCPPError';
+import { JsonType } from '../../../types/JsonType';
+import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode';
+import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
+import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration';
import {
- OCPP16AuthorizationStatus,
- OCPP16AuthorizeRequest,
- OCPP16AuthorizeResponse,
- OCPP16StartTransactionRequest,
- OCPP16StartTransactionResponse,
- OCPP16StopTransactionRequest,
- OCPP16StopTransactionResponse,
-} from '../../../types/ocpp/1.6/Transaction';
+ OCPP16MeterValuesRequest,
+ OCPP16MeterValuesResponse,
+} from '../../../types/ocpp/1.6/MeterValues';
import {
OCPP16BootNotificationRequest,
OCPP16RequestCommand,
OCPP16StatusNotificationResponse,
} from '../../../types/ocpp/1.6/Responses';
import {
- OCPP16MeterValuesRequest,
- OCPP16MeterValuesResponse,
-} from '../../../types/ocpp/1.6/MeterValues';
-
-import type ChargingStation from '../../ChargingStation';
-import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils';
+ OCPP16AuthorizationStatus,
+ OCPP16AuthorizeRequest,
+ OCPP16AuthorizeResponse,
+ OCPP16StartTransactionRequest,
+ OCPP16StartTransactionResponse,
+ OCPP16StopTransactionRequest,
+ OCPP16StopTransactionResponse,
+} from '../../../types/ocpp/1.6/Transaction';
import { ErrorType } from '../../../types/ocpp/ErrorType';
-import { JsonType } from '../../../types/JsonType';
-import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode';
-import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus';
-import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
-import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration';
-import OCPPError from '../../../exception/OCPPError';
-import OCPPResponseService from '../OCPPResponseService';
import { ResponseHandler } from '../../../types/ocpp/Responses';
-import Utils from '../../../utils/Utils';
import logger from '../../../utils/Logger';
+import Utils from '../../../utils/Utils';
+import type ChargingStation from '../../ChargingStation';
+import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils';
+import OCPPResponseService from '../OCPPResponseService';
+import { OCPP16ServiceUtils } from './OCPP16ServiceUtils';
const moduleName = 'OCPP16ResponseService';
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { ACElectricUtils, DCElectricUtils } from '../../../utils/ElectricUtils';
+import OCPPError from '../../../exception/OCPPError';
import { CurrentType, Voltage } from '../../../types/ChargingStationTemplate';
import MeasurandPerPhaseSampledValueTemplates, {
SampledValueTemplate,
} from '../../../types/MeasurandPerPhaseSampledValueTemplates';
+import MeasurandValues from '../../../types/MeasurandValues';
+import {
+ OCPP16StandardParametersKey,
+ OCPP16SupportedFeatureProfiles,
+} from '../../../types/ocpp/1.6/Configuration';
import {
MeterValueContext,
MeterValueLocation,
OCPP16IncomingRequestCommand,
OCPP16RequestCommand,
} from '../../../types/ocpp/1.6/Requests';
-import {
- OCPP16StandardParametersKey,
- OCPP16SupportedFeatureProfiles,
-} from '../../../types/ocpp/1.6/Configuration';
-
+import { ErrorType } from '../../../types/ocpp/ErrorType';
+import Constants from '../../../utils/Constants';
+import { ACElectricUtils, DCElectricUtils } from '../../../utils/ElectricUtils';
+import logger from '../../../utils/Logger';
+import Utils from '../../../utils/Utils';
import type ChargingStation from '../../ChargingStation';
import { ChargingStationUtils } from '../../ChargingStationUtils';
-import Constants from '../../../utils/Constants';
-import { ErrorType } from '../../../types/ocpp/ErrorType';
-import MeasurandValues from '../../../types/MeasurandValues';
-import OCPPError from '../../../exception/OCPPError';
import { OCPPServiceUtils } from '../OCPPServiceUtils';
-import Utils from '../../../utils/Utils';
-import logger from '../../../utils/Logger';
export class OCPP16ServiceUtils extends OCPPServiceUtils {
public static checkFeatureProfile(
-import type ChargingStation from '../ChargingStation';
import { HandleErrorParams } from '../../types/Error';
-import { IncomingRequestCommand } from '../../types/ocpp/Requests';
import { JsonType } from '../../types/JsonType';
+import { IncomingRequestCommand } from '../../types/ocpp/Requests';
import logger from '../../utils/Logger';
+import type ChargingStation from '../ChargingStation';
export default abstract class OCPPIncomingRequestService {
private static instance: OCPPIncomingRequestService | null = null;
-import { ErrorResponse, Response } from '../../types/ocpp/Responses';
+import OCPPError from '../../exception/OCPPError';
+import PerformanceStatistics from '../../performance/PerformanceStatistics';
+import { EmptyObject } from '../../types/EmptyObject';
+import { HandleErrorParams } from '../../types/Error';
+import { JsonObject, JsonType } from '../../types/JsonType';
+import { ErrorType } from '../../types/ocpp/ErrorType';
+import { MessageType } from '../../types/ocpp/MessageType';
import {
IncomingRequestCommand,
OutgoingRequest,
RequestParams,
ResponseType,
} from '../../types/ocpp/Requests';
-import { JsonObject, JsonType } from '../../types/JsonType';
-
-import type ChargingStation from '../ChargingStation';
+import { ErrorResponse, Response } from '../../types/ocpp/Responses';
import Constants from '../../utils/Constants';
-import { EmptyObject } from '../../types/EmptyObject';
-import { ErrorType } from '../../types/ocpp/ErrorType';
-import { HandleErrorParams } from '../../types/Error';
-import { MessageType } from '../../types/ocpp/MessageType';
-import OCPPError from '../../exception/OCPPError';
-import type OCPPResponseService from './OCPPResponseService';
-import PerformanceStatistics from '../../performance/PerformanceStatistics';
-import Utils from '../../utils/Utils';
import logger from '../../utils/Logger';
+import Utils from '../../utils/Utils';
+import type ChargingStation from '../ChargingStation';
+import type OCPPResponseService from './OCPPResponseService';
export default abstract class OCPPRequestService {
private static instance: OCPPRequestService | null = null;
-import type ChargingStation from '../ChargingStation';
import { JsonType } from '../../types/JsonType';
import { RequestCommand } from '../../types/ocpp/Requests';
+import type ChargingStation from '../ChargingStation';
export default abstract class OCPPResponseService {
private static instance: OCPPResponseService | null = null;
-import AbstractUIService from './ui-services/AbstractUIService';
import { Server as HttpServer } from 'http';
-import { ProtocolVersion } from '../../types/UIProtocol';
+
import WebSocket from 'ws';
+import { ProtocolVersion } from '../../types/UIProtocol';
+import AbstractUIService from './ui-services/AbstractUIService';
+
export abstract class AbstractUIServer {
public readonly chargingStations: Set<string>;
protected readonly uiServices: Map<ProtocolVersion, AbstractUIService>;
-import { AbstractUIServer } from './AbstractUIServer';
+import chalk from 'chalk';
+
+import { ServerOptions } from '../../types/ConfigurationData';
import { ApplicationProtocol } from '../../types/UIProtocol';
import Configuration from '../../utils/Configuration';
-import { ServerOptions } from '../../types/ConfigurationData';
+import { AbstractUIServer } from './AbstractUIServer';
import { UIServiceUtils } from './ui-services/UIServiceUtils';
import UIWebSocketServer from './UIWebSocketServer';
-import chalk from 'chalk';
export default class UIServerFactory {
private constructor() {
-import { Protocol, ProtocolVersion } from '../../types/UIProtocol';
-
-import { AbstractUIServer } from './AbstractUIServer';
-import Configuration from '../../utils/Configuration';
import { IncomingMessage } from 'http';
-import { ServerOptions } from '../../types/ConfigurationData';
-import UIServiceFactory from './ui-services/UIServiceFactory';
-import Utils from '../../utils/Utils';
+
import WebSocket from 'ws';
+
+import { ServerOptions } from '../../types/ConfigurationData';
+import { Protocol, ProtocolVersion } from '../../types/UIProtocol';
+import Configuration from '../../utils/Configuration';
import logger from '../../utils/Logger';
+import Utils from '../../utils/Utils';
+import { AbstractUIServer } from './AbstractUIServer';
+import UIServiceFactory from './ui-services/UIServiceFactory';
export default class UIWebSocketServer extends AbstractUIServer {
public constructor(options?: ServerOptions) {
+import { RawData } from 'ws';
+
+import BaseError from '../../../exception/BaseError';
+import { JsonType } from '../../../types/JsonType';
import {
ProtocolCommand,
ProtocolRequest,
ProtocolRequestHandler,
} from '../../../types/UIProtocol';
-
-import { AbstractUIServer } from '../AbstractUIServer';
-import BaseError from '../../../exception/BaseError';
-import { JsonType } from '../../../types/JsonType';
-import { RawData } from 'ws';
-import Utils from '../../../utils/Utils';
import logger from '../../../utils/Logger';
+import Utils from '../../../utils/Utils';
+import { AbstractUIServer } from '../AbstractUIServer';
export default abstract class AbstractUIService {
protected readonly uiServer: AbstractUIServer;
+import { JsonType } from '../../../types/JsonType';
import { ProtocolCommand, ProtocolRequestHandler } from '../../../types/UIProtocol';
-
import { AbstractUIServer } from '../AbstractUIServer';
import AbstractUIService from './AbstractUIService';
-import { JsonType } from '../../../types/JsonType';
export default class UIService001 extends AbstractUIService {
constructor(uiServer: AbstractUIServer) {
+import { ProtocolVersion } from '../../../types/UIProtocol';
import { AbstractUIServer } from '../AbstractUIServer';
import AbstractUIService from './AbstractUIService';
-import { ProtocolVersion } from '../../../types/UIProtocol';
import UIService001 from './UIService001';
export default class UIServiceFactory {
-import { Protocol, ProtocolVersion } from '../../../types/UIProtocol';
-
import { IncomingMessage } from 'http';
-import Utils from '../../../utils/Utils';
+
+import { Protocol, ProtocolVersion } from '../../../types/UIProtocol';
import logger from '../../../utils/Logger';
+import Utils from '../../../utils/Utils';
export class UIServiceUtils {
private constructor() {
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
+import { JsonType } from '../types/JsonType';
+import { ErrorType } from '../types/ocpp/ErrorType';
import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests';
-
import BaseError from './BaseError';
-import { ErrorType } from '../types/ocpp/ErrorType';
-import { JsonType } from '../types/JsonType';
export default class OCPPError extends BaseError {
code: ErrorType;
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../utils/CircularArray';
-import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests';
import { PerformanceEntry, PerformanceObserver, performance } from 'perf_hooks';
-import Statistics, { StatisticsData, TimeSeries } from '../types/Statistics';
+import { URL } from 'url';
+import { parentPort } from 'worker_threads';
import { ChargingStationWorkerMessageEvents } from '../types/ChargingStationWorker';
-import Configuration from '../utils/Configuration';
import { MessageType } from '../types/ocpp/MessageType';
-import { URL } from 'url';
-import Utils from '../utils/Utils';
+import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests';
+import Statistics, { StatisticsData, TimeSeries } from '../types/Statistics';
+import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../utils/CircularArray';
+import Configuration from '../utils/Configuration';
import logger from '../utils/Logger';
-import { parentPort } from 'worker_threads';
+import Utils from '../utils/Utils';
export default class PerformanceStatistics {
private static readonly instances: Map<string, PerformanceStatistics> = new Map<
// Copyright Jerome Benoit. 2021. All Rights Reserved.
+import fs from 'fs';
+
+import lockfile from 'proper-lockfile';
+
import { FileType } from '../../types/FileType';
-import FileUtils from '../../utils/FileUtils';
import Statistics from '../../types/Statistics';
+import FileUtils from '../../utils/FileUtils';
import { Storage } from './Storage';
-import fs from 'fs';
-import lockfile from 'proper-lockfile';
export class JsonFileStorage extends Storage {
private fd: number | null = null;
// Copyright Jerome Benoit. 2021. All Rights Reserved.
import { Configuration, Connection, IDatabaseDriver, MikroORM, Options } from '@mikro-orm/core';
-import { MikroORMDBType, StorageType } from '../../types/Storage';
+import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
-import Constants from '../../utils/Constants';
import { PerformanceData } from '../../types/orm/entities/PerformanceData';
import { PerformanceRecord } from '../../types/orm/entities/PerformanceRecord';
import Statistics from '../../types/Statistics';
+import { MikroORMDBType, StorageType } from '../../types/Storage';
+import Constants from '../../utils/Constants';
import { Storage } from './Storage';
-import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
export class MikroOrmStorage extends Storage {
private storageType: StorageType;
// Copyright Jerome Benoit. 2021. All Rights Reserved.
-import Constants from '../../utils/Constants';
import { MongoClient } from 'mongodb';
+
import Statistics from '../../types/Statistics';
-import { Storage } from './Storage';
import { StorageType } from '../../types/Storage';
+import Constants from '../../utils/Constants';
+import { Storage } from './Storage';
export class MongoDBStorage extends Storage {
private readonly client: MongoClient | null;
// Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { DBName, StorageType } from '../../types/Storage';
+import { URL } from 'url';
import { EmptyObject } from '../../types/EmptyObject';
import { HandleErrorParams } from '../../types/Error';
import Statistics from '../../types/Statistics';
-import { URL } from 'url';
-import Utils from '../../utils/Utils';
+import { DBName, StorageType } from '../../types/Storage';
import logger from '../../utils/Logger';
+import Utils from '../../utils/Utils';
export abstract class Storage {
protected readonly storageUri: URL;
// Copyright Jerome Benoit. 2021. All Rights Reserved.
+import { StorageType } from '../../types/Storage';
import { JsonFileStorage } from './JsonFileStorage';
import { MikroOrmStorage } from './MikroOrmStorage';
import { MongoDBStorage } from './MongoDBStorage';
import { Storage } from './Storage';
-import { StorageType } from '../../types/Storage';
export class StorageFactory {
private constructor() {
#!/usr/bin/env node
-const MongoClient = require('mongodb');
const fs = require('fs');
+const MongoClient = require('mongodb');
+
// This script deletes charging stations
// Filter charging stations by id pattern
#!/usr/bin/env node
-const MongoClient = require('mongodb');
const fs = require('fs');
+const MongoClient = require('mongodb');
+
// This script sets charging stations public or private
// Filter charging stations by id pattern
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import Bootstrap from './charging-station/Bootstrap';
import chalk from 'chalk';
+import Bootstrap from './charging-station/Bootstrap';
+
Bootstrap.getInstance()
.start()
.catch((error) => {
+import { ClientRequestArgs } from 'http';
+
+import { ClientOptions } from 'ws';
+
import { AutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator';
import ChargingStationOcppConfiguration from './ChargingStationOcppConfiguration';
-import { ClientOptions } from 'ws';
-import { ClientRequestArgs } from 'http';
import { ConnectorStatus } from './ConnectorStatus';
import { OCPPProtocol } from './ocpp/OCPPProtocol';
import { OCPPVersion } from './ocpp/OCPPVersion';
-import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker';
-
import { JsonObject } from './JsonType';
+import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker';
export interface ChargingStationWorkerOptions extends JsonObject {
elementStartDelay?: number;
import { ListenOptions } from 'net';
-import { StorageType } from './Storage';
-import { ServerOptions as WSServerOptions } from 'ws';
+
import type { WorkerChoiceStrategy } from 'poolifier';
+import { ServerOptions as WSServerOptions } from 'ws';
+
+import { StorageType } from './Storage';
import { WorkerProcessType } from './Worker';
export type ServerOptions = WSServerOptions & ListenOptions;
-import { AvailabilityType } from './ocpp/Requests';
+import { SampledValueTemplate } from './MeasurandPerPhaseSampledValueTemplates';
import { ChargePointStatus } from './ocpp/ChargePointStatus';
import { ChargingProfile } from './ocpp/ChargingProfile';
import { MeterValue } from './ocpp/MeterValues';
-import { SampledValueTemplate } from './MeasurandPerPhaseSampledValueTemplates';
+import { AvailabilityType } from './ocpp/Requests';
export interface ConnectorStatus {
availability: AvailabilityType;
-import { JsonObject } from './JsonType';
-import { PoolOptions } from 'poolifier';
import { Worker } from 'worker_threads';
+import { PoolOptions } from 'poolifier';
+
+import { JsonObject } from './JsonType';
+
export enum WorkerProcessType {
WORKER_SET = 'workerSet',
DYNAMIC_POOL = 'dynamicPool',
-import { ChargingProfilePurposeType, OCPP16ChargingProfile } from './ChargingProfile';
-
import { EmptyObject } from '../../EmptyObject';
import { JsonObject } from '../../JsonType';
import { OCPP16ChargePointErrorCode } from './ChargePointErrorCode';
import { OCPP16ChargePointStatus } from './ChargePointStatus';
-import { OCPP16DiagnosticsStatus } from './DiagnosticsStatus';
+import { ChargingProfilePurposeType, OCPP16ChargingProfile } from './ChargingProfile';
import { OCPP16StandardParametersKey } from './Configuration';
+import { OCPP16DiagnosticsStatus } from './DiagnosticsStatus';
export enum OCPP16RequestCommand {
BOOT_NOTIFICATION = 'BootNotification',
+import { JsonObject } from '../JsonType';
import {
OCPP16StandardParametersKey,
OCPP16SupportedFeatureProfiles,
OCPP16VendorDefaultParametersKey,
} from './1.6/Configuration';
-import { JsonObject } from '../JsonType';
-
export type StandardParametersKey = OCPP16StandardParametersKey;
export const StandardParametersKey = {
+import type ChargingStation from '../../charging-station/ChargingStation';
+import OCPPError from '../../exception/OCPPError';
+import { JsonType } from '../JsonType';
+import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
+import { OCPP16MeterValuesRequest } from './1.6/MeterValues';
import {
OCPP16AvailabilityType,
OCPP16BootNotificationRequest,
OCPP16RequestCommand,
OCPP16StatusNotificationRequest,
} from './1.6/Requests';
-
-import type ChargingStation from '../../charging-station/ChargingStation';
-import { JsonType } from '../JsonType';
import { MessageType } from './MessageType';
-import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
-import { OCPP16MeterValuesRequest } from './1.6/MeterValues';
-import OCPPError from '../../exception/OCPPError';
export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
+import type ChargingStation from '../../charging-station/ChargingStation';
+import { JsonType } from '../JsonType';
+import { OCPP16MeterValuesResponse } from './1.6/MeterValues';
import {
OCPP16AvailabilityStatus,
OCPP16BootNotificationResponse,
OCPP16TriggerMessageStatus,
OCPP16UnlockStatus,
} from './1.6/Responses';
-
-import type ChargingStation from '../../charging-station/ChargingStation';
import { ErrorType } from './ErrorType';
-import { JsonType } from '../JsonType';
import { MessageType } from './MessageType';
-import { OCPP16MeterValuesResponse } from './1.6/MeterValues';
export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType];
-import Bootstrap from '../../charging-station/Bootstrap';
import express from 'express';
+import Bootstrap from '../../charging-station/Bootstrap';
+
const pageHeader = `
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
+import fs from 'fs';
+import path from 'path';
+import { fileURLToPath } from 'url';
+
+import chalk from 'chalk';
+
import ConfigurationData, {
StationTemplateUrl,
StorageConfiguration,
UIServerConfiguration,
WorkerConfiguration,
} from '../types/ConfigurationData';
-
-import Constants from './Constants';
import { EmptyObject } from '../types/EmptyObject';
-import { FileType } from '../types/FileType';
import { HandleErrorParams } from '../types/Error';
+import { FileType } from '../types/FileType';
import { StorageType } from '../types/Storage';
-import WorkerConstants from '../worker/WorkerConstants';
import { WorkerProcessType } from '../types/Worker';
-import chalk from 'chalk';
-import { fileURLToPath } from 'url';
-import fs from 'fs';
-import path from 'path';
+import WorkerConstants from '../worker/WorkerConstants';
+import Constants from './Constants';
export default class Configuration {
private static configurationFile = path.join(
+import { MeterValueMeasurand } from '../types/ocpp/MeterValues';
import {
AvailabilityStatus,
ChargingProfileStatus,
UnlockStatus,
} from '../types/ocpp/Responses';
-import { MeterValueMeasurand } from '../types/ocpp/MeterValues';
-
export default class Constants {
static readonly OCPP_RESPONSE_EMPTY = Object.freeze({});
static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: DefaultStatus.ACCEPTED });
+import fs from 'fs';
+
+import chalk from 'chalk';
+
import { EmptyObject } from '../types/EmptyObject';
-import { FileType } from '../types/FileType';
import { HandleErrorParams } from '../types/Error';
+import { FileType } from '../types/FileType';
import { JsonType } from '../types/JsonType';
-import Utils from './Utils';
-import chalk from 'chalk';
-import fs from 'fs';
import logger from './Logger';
+import Utils from './Utils';
export default class FileUtils {
private constructor() {
+import { Format } from 'logform';
import { Logger, createLogger, format, transport } from 'winston';
-
-import Configuration from './Configuration';
import DailyRotateFile from 'winston-daily-rotate-file';
-import { Format } from 'logform';
import TransportType from 'winston/lib/winston/transports/index.js';
+
+import Configuration from './Configuration';
import Utils from './Utils';
let transports: transport[];
import crypto from 'crypto';
+
import { v4 as uuid } from 'uuid';
export default class Utils {
-import { WorkerData, WorkerOptions } from '../types/Worker';
+import fs from 'fs';
+import { WorkerData, WorkerOptions } from '../types/Worker';
import WorkerConstants from './WorkerConstants';
-import fs from 'fs';
export default abstract class WorkerAbstract<T extends WorkerData> {
protected readonly workerScript: string;
-import { WorkerData, WorkerOptions } from '../types/Worker';
-
import { DynamicThreadPool } from 'poolifier';
+
+import { WorkerData, WorkerOptions } from '../types/Worker';
import Utils from '../utils/Utils';
import WorkerAbstract from './WorkerAbstract';
import { WorkerUtils } from './WorkerUtils';
import { Worker, isMainThread } from 'worker_threads';
-import { WorkerData, WorkerOptions, WorkerProcessType } from '../types/Worker';
import { PoolOptions } from 'poolifier';
+
+import { WorkerData, WorkerOptions, WorkerProcessType } from '../types/Worker';
import type WorkerAbstract from './WorkerAbstract';
import WorkerConstants from './WorkerConstants';
import WorkerDynamicPool from './WorkerDynamicPool';
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { WorkerData, WorkerMessageEvents, WorkerOptions, WorkerSetElement } from '../types/Worker';
+import { Worker } from 'worker_threads';
+import { WorkerData, WorkerMessageEvents, WorkerOptions, WorkerSetElement } from '../types/Worker';
import Utils from '../utils/Utils';
-import { Worker } from 'worker_threads';
import WorkerAbstract from './WorkerAbstract';
import { WorkerUtils } from './WorkerUtils';
-import { WorkerData, WorkerOptions } from '../types/Worker';
-
import { FixedThreadPool } from 'poolifier';
+
+import { WorkerData, WorkerOptions } from '../types/Worker';
import Utils from '../utils/Utils';
import WorkerAbstract from './WorkerAbstract';
import { WorkerUtils } from './WorkerUtils';
-const RoboHydraHead = require('robohydra').heads.RoboHydraHead;
-const RoboHydraWebSocketHead = require('robohydra').heads.RoboHydraWebSocketHead;
-const RoboHydraWebSocketHeadProxy = require('robohydra').heads.RoboHydraWebSocketHeadProxy;
+// eslint-disable-next-line node/no-unpublished-require
+const RoboHydra = require('robohydra');
+const RoboHydraHead = RoboHydra.heads.RoboHydraHead;
+const RoboHydraWebSocketHead = RoboHydra.heads.RoboHydraWebSocketHead;
+const RoboHydraWebSocketHeadProxy = RoboHydra.heads.RoboHydraWebSocketHeadProxy;
+// eslint-disable-next-line no-unused-vars
exports.getBodyParts = function (conf) {
let wsSocket;
return {
-import { CircularArray } from '../../src/utils/CircularArray';
import { expect } from 'expect';
+import { CircularArray } from '../../src/utils/CircularArray';
+
describe('Circular array test suite', () => {
it('Verify that circular array can be instantiated', () => {
const circularArray = new CircularArray();