EdgeStream
@edge-stream/system-events
The system events package provides types, topic constants, and hooks for platform-level events — health status, deployment notifications, configuration reloads, maintenance windows, and admin broadcasts.
Installation
pnpm add @edge-stream/system-events
Key Exports
import {
SystemEventPlugin, // IMessagePlugin implementation
SystemTopics, // topic constants
HealthAggregatorHook, // aggregates health events into a service map
// TypeScript interfaces
type SystemHealthEvent,
type DeploymentStartedEvent,
type DeploymentCompletedEvent,
type ConfigChangedEvent,
type MaintenanceStartedEvent,
type MaintenanceEndedEvent,
type SystemBroadcastEvent,
} from '@edge-stream/system-events';
Topic Constants
import { SystemTopics } from '@edge-stream/system-events';
SystemTopics.HEALTH // 'system.health'
SystemTopics.DEPLOYMENT_STARTED // 'system.deployment.started'
SystemTopics.DEPLOYMENT_COMPLETED // 'system.deployment.completed'
SystemTopics.CONFIG_CHANGED // 'system.config.changed'
SystemTopics.MAINTENANCE_STARTED // 'system.maintenance.started'
SystemTopics.MAINTENANCE_ENDED // 'system.maintenance.ended'
SystemTopics.BROADCAST // 'system.broadcast'
SystemTopics.NAMESPACE_PATTERN // 'system.*'
HealthAggregatorHook
Accumulates system.health messages into a service health map, deduplicating by serviceId. Useful for building a health dashboard without managing state in subscribers:
import { HealthAggregatorHook } from '@edge-stream/system-events';
const healthHook = new HealthAggregatorHook();
server.incomingPipeline.addHook(healthHook);
// Access the aggregated health map directly
const healthMap = healthHook.getHealthMap();
// { 'process-engine': { status: 'healthy', ... }, 'atlas-forms': { status: 'degraded', ... } }
Setup
import { SystemEventPlugin, SystemTopics, type SystemBroadcastEvent } from '@edge-stream/system-events';
const plugin = new SystemEventPlugin();
plugin.createDefaultHooks().forEach(hook =>
server.incomingPipeline.addHook(hook)
);
stream.subscribe<SystemBroadcastEvent>('bas', SystemTopics.BROADCAST, (envelope) => {
const { severity, title, message, targetAudience, tenantId } = envelope.body;
// filter and display
if (targetAudience === 'all' || tenantId === currentTenantId) {
notificationService.show({ severity, title, message });
}
});