build(simulator): fix type import
[e-mobility-charging-stations-simulator.git] / src / charging-station / ui-server / ui-services / AbstractUIService.ts
index 49d10abfa21e52b1075624bbf3f462881e6b8063..900b79d5d1789fc7e5757166b920ab85330c67d2 100644 (file)
@@ -1,5 +1,4 @@
 import { BaseError, type OCPPError } from '../../../exception';
-import { Bootstrap } from '../../../internal';
 import {
   BroadcastChannelProcedureName,
   type BroadcastChannelRequestPayload,
@@ -11,10 +10,8 @@ import {
   type ResponsePayload,
   ResponseStatus,
 } from '../../../types';
-import { logger } from '../../../utils/Logger';
-import { Utils } from '../../../utils/Utils';
-import { UIServiceWorkerBroadcastChannel } from '../../UIServiceWorkerBroadcastChannel';
-import type { AbstractUIServer } from '../AbstractUIServer';
+import { Utils, logger } from '../../../utils';
+import { type AbstractUIServer, Bootstrap, UIServiceWorkerBroadcastChannel } from '../../internal';
 
 const moduleName = 'AbstractUIService';
 
@@ -33,6 +30,7 @@ export abstract class AbstractUIService {
       BroadcastChannelProcedureName.START_AUTOMATIC_TRANSACTION_GENERATOR,
     [ProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR]:
       BroadcastChannelProcedureName.STOP_AUTOMATIC_TRANSACTION_GENERATOR,
+    [ProcedureName.SET_SUPERVISION_URL]: BroadcastChannelProcedureName.SET_SUPERVISION_URL,
     [ProcedureName.START_TRANSACTION]: BroadcastChannelProcedureName.START_TRANSACTION,
     [ProcedureName.STOP_TRANSACTION]: BroadcastChannelProcedureName.STOP_TRANSACTION,
     [ProcedureName.AUTHORIZE]: BroadcastChannelProcedureName.AUTHORIZE,
@@ -100,7 +98,7 @@ export abstract class AbstractUIService {
       };
     } finally {
       // Send response for payload not forwarded to broadcast channel
-      if (responsePayload !== undefined) {
+      if (!Utils.isNullOrUndefined(responsePayload)) {
         this.sendResponse(messageId, responsePayload);
       }
     }
@@ -153,6 +151,7 @@ export abstract class AbstractUIService {
   ): void {
     if (Utils.isNotEmptyArray(payload.hashIds)) {
       payload.hashIds = payload.hashIds
+        .filter((hashId) => !Utils.isNullOrUndefined(hashId))
         .map((hashId) => {
           if (this.uiServer.chargingStations.has(hashId) === true) {
             return hashId;
@@ -163,8 +162,7 @@ export abstract class AbstractUIService {
               'sendBroadcastChannelRequest'
             )} Charging station with hashId '${hashId}' not found`
           );
-        })
-        .filter((hashId) => hashId !== undefined);
+        });
     }
     const expectedNumberOfResponses = Utils.isNotEmptyArray(payload.hashIds)
       ? payload.hashIds.length