refactor: cleanup worker related type definitions
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 25 Mar 2024 08:37:29 +0000 (09:37 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 25 Mar 2024 08:37:29 +0000 (09:37 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package.json
pnpm-lock.yaml
src/performance/index.ts
src/types/ChargingStationWorker.ts
src/worker/WorkerTypes.ts

index 503799e29723fd96aaa3cffdaf09735e6c711214..c2a7af09ac1f965aae8753be9a54dae9eab6327b 100644 (file)
     "poolifier": "^3.1.22",
     "rambda": "^9.1.1",
     "tar": "^6.2.1",
-    "winston": "^3.12.0",
+    "winston": "^3.13.0",
     "winston-daily-rotate-file": "^5.0.0",
     "ws": "^8.16.0"
   },
index a1b9d4ba43f462cee8694bf888929113795cc389..45875fe37e25f4a4ebbabc06114b2148769435a8 100644 (file)
@@ -66,11 +66,11 @@ importers:
         specifier: ^6.2.1
         version: 6.2.1
       winston:
-        specifier: ^3.12.0
-        version: 3.12.0
+        specifier: ^3.13.0
+        version: 3.13.0
       winston-daily-rotate-file:
         specifier: ^5.0.0
-        version: 5.0.0(winston@3.12.0)
+        version: 5.0.0(winston@3.13.0)
       ws:
         specifier: ^8.16.0
         version: 8.16.0(bufferutil@4.0.8)(utf-8-validate@6.0.3)
@@ -4818,11 +4818,11 @@ packages:
       safe-regex-test: 1.0.3
       string.prototype.trim: 1.2.9
       string.prototype.trimend: 1.0.8
-      string.prototype.trimstart: 1.0.7
+      string.prototype.trimstart: 1.0.8
       typed-array-buffer: 1.0.2
       typed-array-byte-length: 1.0.1
       typed-array-byte-offset: 1.0.2
-      typed-array-length: 1.0.5
+      typed-array-length: 1.0.6
       unbox-primitive: 1.0.2
       which-typed-array: 1.1.15
     dev: true
@@ -10254,12 +10254,13 @@ packages:
       es-object-atoms: 1.0.0
     dev: true
 
-  /string.prototype.trimstart@1.0.7:
-    resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==}
+  /string.prototype.trimstart@1.0.8:
+    resolution: {integrity: sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==}
+    engines: {node: '>= 0.4'}
     dependencies:
       call-bind: 1.0.7
       define-properties: 1.2.1
-      es-abstract: 1.23.2
+      es-object-atoms: 1.0.0
     dev: true
 
   /string_decoder@1.1.1:
@@ -10781,8 +10782,8 @@ packages:
       is-typed-array: 1.1.13
     dev: true
 
-  /typed-array-length@1.0.5:
-    resolution: {integrity: sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA==}
+  /typed-array-length@1.0.6:
+    resolution: {integrity: sha512-/OxDN6OtAk5KBpGb28T+HZc2M+ADtvRxXrKKbUwtsLgdoxgX13hyy7ek6bFRl5+aBs2yZzB0c4CnQfAtVypW/g==}
     engines: {node: '>= 0.4'}
     dependencies:
       call-bind: 1.0.7
@@ -11375,7 +11376,7 @@ packages:
       execa: 5.1.1
     dev: true
 
-  /winston-daily-rotate-file@5.0.0(winston@3.12.0):
+  /winston-daily-rotate-file@5.0.0(winston@3.13.0):
     resolution: {integrity: sha512-JDjiXXkM5qvwY06733vf09I2wnMXpZEhxEVOSPenZMii+g7pcDcTBt2MRugnoi8BwVSuCT2jfRXBUy+n1Zz/Yw==}
     engines: {node: '>=8'}
     peerDependencies:
@@ -11384,7 +11385,7 @@ packages:
       file-stream-rotator: 0.6.1
       object-hash: 3.0.0
       triple-beam: 1.4.1
-      winston: 3.12.0
+      winston: 3.13.0
       winston-transport: 4.7.0
     dev: false
 
@@ -11397,8 +11398,8 @@ packages:
       triple-beam: 1.4.1
     dev: false
 
-  /winston@3.12.0:
-    resolution: {integrity: sha512-OwbxKaOlESDi01mC9rkM0dQqQt2I8DAUMRLZ/HpbwvDXm85IryEHgoogy5fziQy38PntgZsLlhAYHz//UPHZ5w==}
+  /winston@3.13.0:
+    resolution: {integrity: sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==}
     engines: {node: '>= 12.0.0'}
     dependencies:
       '@colors/colors': 1.6.0
index 1cbed3782f18202307b662ee92398d1d6a2f511e..851999c96aff134f8e6a2474127bbc70840ac580 100644 (file)
@@ -1,3 +1,3 @@
 export { PerformanceStatistics } from './PerformanceStatistics.js'
-export { type Storage } from './storage/Storage.js'
+export type { Storage } from './storage/Storage.js'
 export { StorageFactory } from './storage/StorageFactory.js'
index 336b50e87c76da63a95425fca72711805a8b24ce..4d47a5e3698bb96a5bad1e9f3093af396993be32 100644 (file)
@@ -1,6 +1,6 @@
 import type { WebSocket } from 'ws'
 
-import { type WorkerData, type WorkerMessage } from '../worker/index.js'
+import type { WorkerData } from '../worker/index.js'
 import type { ChargingStationAutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator.js'
 import { ChargingStationEvents } from './ChargingStationEvents.js'
 import type { ChargingStationInfo } from './ChargingStationInfo.js'
@@ -62,9 +62,7 @@ export type ChargingStationWorkerMessageEvents =
 
 export type ChargingStationWorkerMessageData = ChargingStationData | Statistics
 
-export type ChargingStationWorkerMessage<T extends ChargingStationWorkerMessageData> = Omit<
-WorkerMessage<T>,
-'uuid' | 'event'
-> & {
+export interface ChargingStationWorkerMessage<T extends ChargingStationWorkerMessageData> {
   event: ChargingStationWorkerMessageEvents
+  data: T
 }
index e1e89a7cde183ac99841b55fdc67b04ad0839329..b180983e8a9594c3e1308fa12679a4fc2cfd4493 100644 (file)
@@ -45,6 +45,13 @@ export interface WorkerOptions {
 
 export type WorkerData = Record<string, unknown>
 
+export interface WorkerDataError extends WorkerData {
+  event: WorkerMessageEvents
+  name: string
+  message: string
+  stack?: string
+}
+
 export interface WorkerSetElement {
   worker: Worker
   numberOfWorkerElements: number
@@ -61,10 +68,3 @@ export enum WorkerMessageEvents {
   addedWorkerElement = 'addedWorkerElement',
   workerElementError = 'workerElementError'
 }
-
-export interface WorkerDataError extends WorkerData {
-  event: WorkerMessageEvents
-  name: string
-  message: string
-  stack?: string
-}