import type { PartitionedEvent, ConsumerCheckpoint } from "../types/index.js"; import { PartitionStore } from "../infra/event-store.js"; import type { ICheckpointStore } from "../infra/checkpoint-store.js"; import { rebuildState } from "./replay.js"; /** Partition router — deterministic key → partition mapping */ export declare class PartitionRouter { private partitionCount; constructor(partitionCount?: number); /** Route a key to a partition using stable hash */ route(key: string): number; } /** Event producer — writes events to partitioned log */ export declare class EventProducer { private store; private router; constructor(store: PartitionStore, router: PartitionRouter); /** Produce an event */ produce(params: { partitionKey: string; type: string; payload: Record; actor: string; capability: string; transactionId: string; }): Promise; /** Produce multiple events */ produceBatch(params: { partitionKey: string; actor: string; capability: string; transactionId: string; }, events: Array<{ type: string; payload: Record; }>): Promise; } /** Consumer group — replays events and builds state */ export declare class ConsumerGroup { private store; private checkpoints; private groupId; private partitionCount; constructor(groupId: string, store: PartitionStore, checkpoints: ICheckpointStore, partitionCount?: number); /** Initialize checkpoints for this group */ initialize(): Promise; /** Replay all events from all partitions (full rebuild) */ replayAll(): Promise; /** Consume events from a partition starting from checkpoint */ consumePartition(partition: number): Promise; /** Consume all new events across all partitions */ consumeAll(): Promise; /** Commit offset for a partition */ commitOffset(partition: number, offset: number): Promise; /** Build state from all events (full replay) */ buildState(): Promise>; /** Get current checkpoint positions */ getCheckpoints(): Promise; }