refactor(simulator): remove unneeded type casting
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPRequestService.ts
index 4ef39b52ebec7e7e843a13b9b388bea1de8ec567..4115eff1144f1c50a91e79f7197632f47fd6e553 100644 (file)
@@ -1,8 +1,8 @@
 import Ajv, { type JSONSchemaType } from 'ajv';
 import ajvFormats from 'ajv-formats';
 
-import type { OCPPResponseService } from './OCPPResponseService';
-import { OCPPServiceUtils } from './OCPPServiceUtils';
+import { type OCPPResponseService, OCPPServiceUtils } from './internal';
+import type { ChargingStation } from '../../charging-station';
 import { OCPPError } from '../../exception';
 import { PerformanceStatistics } from '../../performance';
 import {
@@ -23,10 +23,7 @@ import {
   type ResponseCallback,
   type ResponseType,
 } from '../../types';
-import { Constants } from '../../utils/Constants';
-import { logger } from '../../utils/Logger';
-import { Utils } from '../../utils/Utils';
-import type { ChargingStation } from '../ChargingStation';
+import { Constants, Utils, logger } from '../../utils';
 
 const moduleName = 'OCPPRequestService';
 
@@ -278,7 +275,7 @@ export abstract class OCPPRequestService {
                 ErrorType.GENERIC_ERROR,
                 `WebSocket closed or errored for buffered message id '${messageId}' with content '${messageToSend}'`,
                 commandName,
-                (messagePayload as JsonObject)?.details ?? {}
+                (messagePayload as JsonObject)?.details ?? Constants.EMPTY_FREEZED_OBJECT
               )
             );
           } else if (wsClosedOrErrored) {
@@ -286,7 +283,7 @@ export abstract class OCPPRequestService {
               ErrorType.GENERIC_ERROR,
               `WebSocket closed or errored for non buffered message id '${messageId}' with content '${messageToSend}'`,
               commandName,
-              (messagePayload as JsonObject)?.details ?? {}
+              (messagePayload as JsonObject)?.details ?? Constants.EMPTY_FREEZED_OBJECT
             );
             // Reject response
             if (messageType !== MessageType.CALL_MESSAGE) {
@@ -361,7 +358,7 @@ export abstract class OCPPRequestService {
           ErrorType.GENERIC_ERROR,
           `Timeout for message id '${messageId}'`,
           commandName,
-          (messagePayload as JsonObject)?.details ?? {}
+          (messagePayload as JsonObject)?.details ?? Constants.EMPTY_FREEZED_OBJECT
         ),
         () => {
           messageType === MessageType.CALL_MESSAGE && chargingStation.requests.delete(messageId);