refactor(simulator): switch to internal modules export/import design
[e-mobility-charging-stations-simulator.git] / src / charging-station / UIServiceWorkerBroadcastChannel.ts
index 77ae46f2bbb6c560cde45ba9234a917b65803515..d9e746393d32b03f6062787a8924d819d864bf1d 100644 (file)
@@ -1,5 +1,4 @@
-import type { AbstractUIService } from './ui-server/ui-services/AbstractUIService';
-import { WorkerBroadcastChannel } from './WorkerBroadcastChannel';
+import { type AbstractUIService, WorkerBroadcastChannel } from './internal';
 import {
   type BroadcastChannelResponse,
   type BroadcastChannelResponsePayload,
@@ -70,31 +69,31 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
       status: responsesStatus,
       hashIdsSucceeded: this.responses
         .get(uuid)
-        ?.responses.map(({ status, hashId }) => {
+        ?.responses.filter(({ hashId }) => hashId !== undefined)
+        .map(({ status, hashId }) => {
           if (status === ResponseStatus.SUCCESS) {
             return hashId;
           }
-        })
-        .filter((hashId) => hashId !== undefined),
+        }),
       ...(responsesStatus === ResponseStatus.FAILURE && {
         hashIdsFailed: this.responses
           .get(uuid)
-          ?.responses.map(({ status, hashId }) => {
+          ?.responses.filter(({ hashId }) => hashId !== undefined)
+          .map(({ status, hashId }) => {
             if (status === ResponseStatus.FAILURE) {
               return hashId;
             }
-          })
-          .filter((hashId) => hashId !== undefined),
+          }),
       }),
       ...(responsesStatus === ResponseStatus.FAILURE && {
         responsesFailed: this.responses
           .get(uuid)
-          ?.responses.map((response) => {
+          ?.responses.filter((response) => response !== undefined)
+          .map((response) => {
             if (response.status === ResponseStatus.FAILURE) {
               return response;
             }
-          })
-          .filter((response) => response !== undefined),
+          }),
       }),
     };
   }