// Copyright (c) Dolittle. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. import { Constructor } from '@dolittle/types'; import { ProjectionCurrentState } from '@dolittle/contracts/Runtime/Projections/State_pb'; import { Key } from '../../Key'; import { CurrentState } from '../CurrentState'; /** * Defines a system that converts projections to SDK representations. */ export abstract class IConvertProjectionsToSDK { /** * Convert from the runtime respresentation to the SDK's representation of the current state of a projection. * @param {Constructor | undefined} type - The optional read model type to convert to. * @param {ProjectionCurrentState} source - The current state to convert. * @template TProjection The type of the projection. */ abstract convert(type: Constructor | undefined, source: ProjectionCurrentState): CurrentState; /** * Convert from an list of runtime respresentations of the current state of a projection to the SDK's representation. * @param {Constructor | undefined} type - The optional read model type to convert to. * @param {ProjectionCurrentState[]} sources - A list of states to convert. * @template TProjection The type of the projection. */ abstract convertAll(type: Constructor | undefined, sources: ProjectionCurrentState[]): Map>; }