import IObjectMetadata from '../objects/IObjectMetadata'; import ICommit from '../commits/ICommit'; /** * Generic interface to add commit strategy algorithm support */ export default abstract class CommitStrategy { /** * Given an object id and corresponding commits, reconstructs the object according to the commit strategy * @param objectId Id of the object to reconstruct * @param commits All corresponding commits to use in the reconstruction * @returns The final state of the object according to the commit strategy in terms of metadata and data */ abstract resolveObject(objectId: string, commits: ICommit[]): { /** Resolved object metadata */ metadata: IObjectMetadata; /** Resolved object data */ data: any; }; /** * Filters a series of commits given an object id and commit strategy to match against * @param objectId Object ID all commits must be for * @param commitStrategy Commit strategy all commits must use * @param commits Commits to filter * @returns filtered commits */ protected filterCommits(objectId: string, commitStrategy: string, commits: ICommit[]): ICommit[]; }