/** * CDC (Change Data Capture) module exports * * This module provides a production-ready CDC client with: * - Connection health monitoring with latency tracking * - Circuit breaker pattern for resilience * - Subscription state machine with clear lifecycle * - Batched change processing for high throughput * - Debugging utilities (subscription inspector, event log) * - Rich error types with actionable messages * - Built-in logging with configurable levels * - React hooks for framework integration * - Event emitter compatibility * * Performance targets: * - <1KB memory per idle subscription * - <5ms processing time per change event * - Automatic backoff under server pressure */ // Stream manager (existing) export { CDCStreamManager, createCDCStreamManager, createCDCStreamManagerAsync, // LSN utilities for efficient comparison parseLsn, compareLsn, isLsnGte, // Types type SubscriptionState as StreamSubscriptionState, type SubscriptionConfig, type SubscriptionStatus as StreamSubscriptionStatus, type CDCStreamManagerConfig, type CDCStatePersistence, type CDCMetrics, } from './stream-manager' // Error types export { CDCError, CDCErrorCode, CDCConnectionError, CDCTimeoutError, CDCSubscriptionError, CDCInvalidTableError, CDCCircuitOpenError, CDCStateError, CDCResourceError, CDCParseError, wrapError, } from './errors' // Logger export { CDCLogger, SubscriptionLogger, LogLevel, createCDCLogger, defaultLogger, type LogEntry, type LogHandler, type LoggerConfig, } from './logger' // Circuit breaker export { CircuitBreaker, CircuitState, createCircuitBreaker, type CircuitBreakerConfig, type CircuitBreakerStats, } from './circuit-breaker' // Health monitor export { HealthMonitor, HealthStatus, createHealthMonitor, type HealthMonitorConfig, type HealthCheckResult, } from './health-monitor' // State machine export { SubscriptionStateMachine, SubscriptionState, SubscriptionEvent, createStateMachine, isConnectedState, canReconnect, getStateDescription, getValidEventsFromState, getTransitionsFromState, // Constants DEFAULT_MAX_HISTORY_SIZE, DEBUG_RECENT_HISTORY_COUNT, // Types type StateMachineConfig, type StateTransition, } from './state-machine' // Event emitter export { CDCEventEmitter, createEventEmitter, type CDCEventType, type CDCEventPayloads, type CDCEventListener, type EventEmitterConfig, } from './event-emitter' // Batch processor export { BatchProcessor, createBatchProcessor, coalesceEvents, type BatchProcessorConfig, type EventBatch, } from './batch-processor' // Debug utilities export { EventLog, PerformanceProfiler, SubscriptionInspector, createInspector, formatSnapshot, type EventLogEntry, type SubscriptionSnapshot, type PerformanceMetrics, } from './debug-utils' // React hooks (lazy loaded to avoid React dependency) export { useSubscription, useTable, useCDCConnection, isReactAvailable, type UseSubscriptionOptions, type UseSubscriptionResult, type UseTableOptions, type UseTableResult, type UseCDCConnectionOptions, type UseCDCConnectionResult, type SubscriptionStatus, } from './react-hooks' // Re-export sync primitives from @dotdo/postgres-shared for convenience export { DeltaCompressor, decompressBatch, calculateCompressionRatio, TransactionBatcher, BloomFilter, ConflictDetector, MergeEngine, SyncProgressTracker, // Types type RowChange, type DeltaCompressedChange, type DeltaCompressedBatch, type MergeStrategy, type MergeConflict, type MergeResult, type MergeConfig, type MergeResolver, type SyncProgress, type TransactionBatch, } from '@dotdo/postgres-shared'