From: Jérôme Benoit Date: Mon, 25 Mar 2024 08:37:29 +0000 (+0100) Subject: refactor: cleanup worker related type definitions X-Git-Tag: v1.3.1~1 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=551f2b6e68f544b559243a2634c8b52a15bcdeec;p=e-mobility-charging-stations-simulator.git refactor: cleanup worker related type definitions Signed-off-by: Jérôme Benoit --- diff --git a/package.json b/package.json index 503799e2..c2a7af09 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,7 @@ "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" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a1b9d4ba..45875fe3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/src/performance/index.ts b/src/performance/index.ts index 1cbed378..851999c9 100644 --- a/src/performance/index.ts +++ b/src/performance/index.ts @@ -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' diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index 336b50e8..4d47a5e3 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -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 = Omit< -WorkerMessage, -'uuid' | 'event' -> & { +export interface ChargingStationWorkerMessage { event: ChargingStationWorkerMessageEvents + data: T } diff --git a/src/worker/WorkerTypes.ts b/src/worker/WorkerTypes.ts index e1e89a7c..b180983e 100644 --- a/src/worker/WorkerTypes.ts +++ b/src/worker/WorkerTypes.ts @@ -45,6 +45,13 @@ export interface WorkerOptions { export type WorkerData = Record +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 -}