feat(core-shared): BindContext.auditLog? field (5th generic)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-11 16:04:58 +02:00
parent a7e383593a
commit a3b7100d10

View File

@@ -6,6 +6,7 @@ import type {
RealtimeBroadcasterProtocol, RealtimeBroadcasterProtocol,
RealtimeRegistryProtocol, RealtimeRegistryProtocol,
MetricsProtocol, MetricsProtocol,
AuditLogProtocol,
} from "./bind-protocols"; } from "./bind-protocols";
/** Always-present fields. Feature binders rely on these unconditionally. */ /** Always-present fields. Feature binders rely on these unconditionally. */
@@ -17,25 +18,28 @@ type BindContextBase = {
/** /**
* Optional cross-cutting deps. Generics let the app aggregator narrow the * Optional cross-cutting deps. Generics let the app aggregator narrow the
* shape to full interfaces (`IEventBus`, `IRealtimeBroadcaster`, `IMetrics`, * shape to full interfaces (`IEventBus`, `IRealtimeBroadcaster`, `IMetrics`,
* etc.); feature binders see only the protocol surface, which is enough for * `IAuditLog`, etc.); feature binders see only the protocol surface, which is
* the methods they call. When an optional core package is absent the * enough for the methods they call. When an optional core package is absent the
* corresponding generic defaults to its protocol type, and `ctx.bus` / * corresponding generic defaults to its protocol type, and `ctx.bus` /
* `ctx.realtime` / `ctx.metrics` are undefined at runtime. * `ctx.realtime` / `ctx.metrics` / `ctx.auditLog` are undefined at runtime.
* *
* The 4th generic `Metrics` defaults to `MetricsProtocol` so existing call * The 4th generic `Metrics` and 5th generic `Audit` both default to their
* sites that pass 3 explicit args remain backward-compatible. * protocol types so existing call sites that pass fewer explicit args remain
* backward-compatible.
*/ */
export type BindContext< export type BindContext<
Bus extends EventBusProtocol = EventBusProtocol, Bus extends EventBusProtocol = EventBusProtocol,
Realtime extends RealtimeBroadcasterProtocol = RealtimeBroadcasterProtocol, Realtime extends RealtimeBroadcasterProtocol = RealtimeBroadcasterProtocol,
RealtimeReg extends RealtimeRegistryProtocol = RealtimeRegistryProtocol, RealtimeReg extends RealtimeRegistryProtocol = RealtimeRegistryProtocol,
Metrics extends MetricsProtocol = MetricsProtocol, Metrics extends MetricsProtocol = MetricsProtocol,
Audit extends AuditLogProtocol = AuditLogProtocol,
> = BindContextBase & { > = BindContextBase & {
bus?: Bus; bus?: Bus;
queue?: IJobQueue; queue?: IJobQueue;
realtime?: Realtime; realtime?: Realtime;
realtimeRegistry?: RealtimeReg; realtimeRegistry?: RealtimeReg;
metrics?: Metrics; metrics?: Metrics;
auditLog?: Audit;
}; };
/** Production binders also receive the resolved Payload config. */ /** Production binders also receive the resolved Payload config. */
@@ -44,6 +48,7 @@ export type BindProductionContext<
Realtime extends RealtimeBroadcasterProtocol = RealtimeBroadcasterProtocol, Realtime extends RealtimeBroadcasterProtocol = RealtimeBroadcasterProtocol,
RealtimeReg extends RealtimeRegistryProtocol = RealtimeRegistryProtocol, RealtimeReg extends RealtimeRegistryProtocol = RealtimeRegistryProtocol,
Metrics extends MetricsProtocol = MetricsProtocol, Metrics extends MetricsProtocol = MetricsProtocol,
> = BindContext<Bus, Realtime, RealtimeReg, Metrics> & { Audit extends AuditLogProtocol = AuditLogProtocol,
> = BindContext<Bus, Realtime, RealtimeReg, Metrics, Audit> & {
config: SanitizedConfig; config: SanitizedConfig;
}; };