import 'reflect-metadata'; import { IClientArtifactsProvider } from '../artifacts/index.js'; import { ChronicleConnection } from '../connection/index.js'; import { ConnectionLifecycle } from '../connection/ConnectionLifecycle.js'; import { IReducers } from './IReducers.js'; import type { ReadModelNamingPolicy } from '../readModels/ReadModelNamingPolicy.js'; import type { IEventStore } from '../IEventStore.js'; import type { ClientArtifactsActivator } from '../artifacts/ClientArtifactsActivator.js'; /** * Implements {@link IReducers}, managing discovery and registration of reducers * with the Chronicle Kernel via bidirectional gRPC streaming. */ export declare class Reducers implements IReducers { private readonly _clientArtifacts; private readonly _connection; private readonly _eventStoreName; private readonly _namespace; private readonly _defaultSinkTypeId; private readonly _eventStore?; private readonly _artifactActivator?; private readonly _readModelNamingPolicy?; /** How long to wait before re-establishing an observation whose stream ended. */ private static readonly _reobserveDelayMs; private readonly _logger; private readonly _lifecycle; private readonly _unsubscribeDisconnected; private readonly _reducers; private readonly _queues; private readonly _observations; private _registered; private _disposed; /** * Creates a new {@link Reducers} instance. * @param _clientArtifacts - Provider for discovered client artifact types. * @param _connection - The Chronicle gRPC connection. * @param _eventStoreName - The name of the event store. * @param _namespace - The namespace within the event store. * @param lifecycle - The connection lifecycle used to react to disconnect events. * @param _defaultSinkTypeId - The default sink type identifier used when registering read models. * @param _eventStore - The event store handed to reducers that request it. * @param _artifactActivator - Optional per-delivery activator. * @param _readModelNamingPolicy - Optional policy naming the container of each read model. */ constructor(_clientArtifacts: IClientArtifactsProvider, _connection: ChronicleConnection, _eventStoreName: string, _namespace: string, lifecycle: ConnectionLifecycle, _defaultSinkTypeId: string, _eventStore?: IEventStore | undefined, _artifactActivator?: ClientArtifactsActivator | undefined, _readModelNamingPolicy?: ReadModelNamingPolicy | undefined); /** Stops observations permanently when the owning client is disposed. */ dispose(): void; /** @inheritdoc */ discover(): Promise; /** @inheritdoc */ register(): Promise; private registerReadModels; private getReducerSchema; private startObservation; private runObservation; /** * Re-establishes an observation whose stream ended. * * The stream ending without an error is not proof that all is well — the kernel * closes a cross-store (inbox) observation's stream rather than tailing it * forever, so a reducer that does not re-subscribe there silently stops * observing until the whole client reconnects. Both endings are therefore * retried, and the delay keeps a stream that keeps ending from becoming a hot * loop. */ private scheduleReobserve; private getReducerReadModelIdentifier; private observeReducer; private createRegistrationMessage; private beginReduction; private notifyReplayTransition; private notifyActivatedReplayTransition; private requireEventStore; private reduceEvents; private processEvents; private processEvent; private invokeHandler; private disconnectAll; } //# sourceMappingURL=Reducers.d.ts.map