]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor: close barrel gaps for ui-server, broadcast-channel, DEFAULT_PERSIST_STATE...
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 5 Jul 2026 18:31:05 +0000 (20:31 +0200)
committerGitHub <noreply@github.com>
Sun, 5 Jul 2026 18:31:05 +0000 (20:31 +0200)
Close 3 barrel gaps identified during the PR #1950 audit chain.

New barrels (respect the flat parent barrel convention already used by
`src/charging-station/ocpp/index.ts`, `.../meter-values/index.ts`,
`src/performance/index.ts`):

- `src/charging-station/ui-server/index.ts` — exposes UIMCPServer,
  UIServerFactory, UIWebSocketServer, HttpMethod (UIServerUtils),
  DEFAULT_COMPRESSION_THRESHOLD_BYTES (UIServerSecurity),
  AbstractUIService, BroadcastChannelResponseLogContext. Deliberately
  omits UIHttpServer (@deprecated pending removal), AbstractUIServer
  (internal extension point), UIServerAccessPolicy/UIServerNet
  helpers, and ui-services concrete implementations — all documented
  in the `@file` JSDoc header.

- `src/charging-station/broadcast-channel/index.ts` — exposes
  ChargingStationWorkerBroadcastChannel and
  UIServiceWorkerBroadcastChannel. Deliberately omits
  WorkerBroadcastChannel (abstract base with only internal subclasses)
  — documented in the `@file` JSDoc header.

Both barrels carry an `@file` header matching the peer convention
(`meter-values/index.ts`, `ocpp/auth/index.ts`) that documents what is
exposed AND what is deliberately NOT re-exported and why — anchoring
the exposure discipline in the file itself.

Extended barrel:
- `src/utils/index.ts`: add `DEFAULT_PERSIST_STATE` to the
  `Configuration` re-export block. Closes an Explore-flagged barrel
  gap prospectively; zero current callers affected.

No consumer migrations in this PR — tests inside the sub-components
follow the "test-of-that-file uses direct import" precedent from
PR #1950. Source-to-source deep imports (5 sites: Bootstrap.ts,
ChargingStation.ts, ConfigurationSchema.ts,
UIServiceWorkerBroadcastChannel.ts, AbstractUIService.ts) are deferred
to a follow-up PR-D' to keep this PR focused on barrel infrastructure.

Quality gates: typecheck clean, lint clean, 577/577 targeted tests
pass (ui-server + broadcast-channel + Configuration suites).

Diff: +41/-1 across 3 files.

Reviews applied (3 rounds, 4 agents each): 1 substantive convergent
finding v2 addressed (JSDoc headers on both new barrels); v3 saturation
HIGH declared by 4/4 agents (0 substantive findings, 6 false positives
rejected via caller-trace).

src/charging-station/broadcast-channel/index.ts [new file with mode: 0644]
src/charging-station/ui-server/index.ts [new file with mode: 0644]
src/utils/index.ts

diff --git a/src/charging-station/broadcast-channel/index.ts b/src/charging-station/broadcast-channel/index.ts
new file mode 100644 (file)
index 0000000..5f78283
--- /dev/null
@@ -0,0 +1,11 @@
+/**
+ * @file Broadcast channel component barrel.
+ * @description Exposes the two concrete `WorkerBroadcastChannel` subclasses used for
+ *   main-thread ↔ worker-thread OCPP message routing.
+ *
+ *   Deliberately not re-exported:
+ *   - `WorkerBroadcastChannel` — abstract base subclassed only by the two concrete
+ *     channels within this sub-component; no external extenders exist.
+ */
+export { ChargingStationWorkerBroadcastChannel } from './ChargingStationWorkerBroadcastChannel.js'
+export { UIServiceWorkerBroadcastChannel } from './UIServiceWorkerBroadcastChannel.js'
diff --git a/src/charging-station/ui-server/index.ts b/src/charging-station/ui-server/index.ts
new file mode 100644 (file)
index 0000000..015ae8b
--- /dev/null
@@ -0,0 +1,29 @@
+/**
+ * @file UI server component barrel.
+ * @description Exposes concrete UI server implementations (`UIMCPServer`,
+ *   `UIWebSocketServer`) selected through `UIServerFactory`, the transport-agnostic
+ *   `HttpMethod` enum, the `DEFAULT_COMPRESSION_THRESHOLD_BYTES` canonical default,
+ *   plus the `AbstractUIService` base class and its `BroadcastChannelResponseLogContext`
+ *   type which are consumed as extension points across the broadcast-channel boundary.
+ *
+ *   Deliberately not re-exported:
+ *   - `AbstractUIServer` — internal extension point subclassed only by the concrete
+ *     servers within this sub-component; no external extenders exist.
+ *   - `UIHttpServer` — `@deprecated` pending removal; re-exporting through a fresh
+ *     barrel would surface the deprecation on every consumer via
+ *     `@typescript-eslint/no-deprecated`.
+ *   - `UIServerAccessPolicy` / `UIServerNet` / `UIServerSecurity` helpers beyond
+ *     `DEFAULT_COMPRESSION_THRESHOLD_BYTES` — internal to `UIServerFactory` and
+ *     the concrete servers.
+ *   - `ui-services/UIService001` / `ui-services/UIServiceFactory` concrete
+ *     implementations — internal to `AbstractUIService`.
+ */
+export {
+  AbstractUIService,
+  type BroadcastChannelResponseLogContext,
+} from './ui-services/AbstractUIService.js'
+export { UIMCPServer } from './UIMCPServer.js'
+export { UIServerFactory } from './UIServerFactory.js'
+export { DEFAULT_COMPRESSION_THRESHOLD_BYTES } from './UIServerSecurity.js'
+export { HttpMethod } from './UIServerUtils.js'
+export { UIWebSocketServer } from './UIWebSocketServer.js'
index d915ca86ad1fa16fd6b28759bdbfbfbd9cfe2a02..c1db125d67862a46629428583b563ef1fe590e12 100644 (file)
@@ -7,7 +7,7 @@ export {
   buildEvseEntries,
   buildEvsesStatus,
 } from './ChargingStationConfigurationUtils.js'
-export { Configuration } from './Configuration.js'
+export { Configuration, DEFAULT_PERSIST_STATE } from './Configuration.js'
 export {
   applyConfigurationMigration,
   coerceConfigurationVersion,