@dolittle/sdk.projections
Version:
Dolittle is a decentralized, distributed, event-driven microservice platform built to harness the power of events.
44 lines • 2.42 kB
TypeScript
import { EventType, EventTypeMap, ScopeId } from '@dolittle/sdk.events';
import { Constructor } from '@dolittle/types';
import { ProjectionCopies } from './Copies/ProjectionCopies';
import { DeleteReadModelInstance } from './DeleteReadModelInstance';
import { EventSelector } from './EventSelector';
import { IProjection } from './IProjection';
import { KeySelector } from './KeySelector';
import { ProjectionCallback } from './ProjectionCallback';
import { ProjectionContext } from './ProjectionContext';
import { ProjectionId } from './ProjectionId';
import { ProjectionAlias } from './ProjectionAlias';
/**
* Represents an implementation of {@link IProjection<T>}.
* @template T The type of the projection read model.
*/
export declare class Projection<T> extends IProjection<T> {
readonly projectionId: ProjectionId;
readonly readModelTypeOrInstance: Constructor<T> | T;
readonly scopeId: ScopeId;
private readonly _eventMap;
readonly copies: ProjectionCopies;
readonly alias: ProjectionAlias | undefined;
/** @inheritdoc */
readonly readModelType: Constructor<T> | undefined;
/** @inheritdoc */
readonly initialState: T;
/** @inheritdoc */
readonly events: Iterable<EventSelector>;
/** @inheritdoc */
readonly hasAlias: boolean;
/**
* Initializes a new instance of {@link Projection}.
* @param {ProjectionId} projectionId - The unique identifier for the projection.
* @param {Constructor<T>|T} readModelTypeOrInstance - The read model type or instance produced by the projection.
* @param {ScopeId} scopeId - The identifier of the scope the projection is in.
* @param {EventTypeMap<[ProjectionCallback<any>, KeySelector]>} _eventMap - The events with respective callbacks and keyselectors used by the projection.
* @param {ProjectionCopies} copies - The read model copies specification for the projection.
* @param {ProjectionAlias | undefined} alias - The optional projection alias.
*/
constructor(projectionId: ProjectionId, readModelTypeOrInstance: Constructor<T> | T, scopeId: ScopeId, _eventMap: EventTypeMap<[ProjectionCallback<any>, KeySelector]>, copies: ProjectionCopies, alias?: ProjectionAlias | undefined);
/** @inheritdoc */
on(readModel: T, event: any, eventType: EventType, context: ProjectionContext): Promise<T | DeleteReadModelInstance>;
}
//# sourceMappingURL=Projection.d.ts.map