59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import type { SerializedProjectCommand } from "../models/project-command.model.js";
|
|
import type { ProjectRevisionSource } from "./project-revision.store.js";
|
|
|
|
export type ProjectHistoryDirection = "undo" | "redo";
|
|
|
|
export interface ProjectHistoryState {
|
|
projectId: string;
|
|
currentRevision: number;
|
|
undoDepth: number;
|
|
redoDepth: number;
|
|
undoChangeSetId: string | null;
|
|
redoChangeSetId: string | null;
|
|
}
|
|
|
|
export interface ProjectHistoryCommand {
|
|
changeSetId: string;
|
|
command: SerializedProjectCommand;
|
|
}
|
|
|
|
export interface ProjectRevisionSummary {
|
|
revisionId: string;
|
|
changeSetId: string;
|
|
revisionNumber: number;
|
|
createdAtIso: string;
|
|
actorId: string | null;
|
|
source: ProjectRevisionSource;
|
|
description: string | null;
|
|
commandType: string;
|
|
payloadSchemaVersion: number;
|
|
}
|
|
|
|
export interface ProjectRevisionPage {
|
|
projectId: string;
|
|
currentRevision: number;
|
|
revisions: ProjectRevisionSummary[];
|
|
nextBeforeRevision: number | null;
|
|
}
|
|
|
|
export interface ListProjectRevisionsInput {
|
|
projectId: string;
|
|
limit: number;
|
|
beforeRevision?: number;
|
|
}
|
|
|
|
export interface ProjectHistoryStore {
|
|
getState(projectId: string): ProjectHistoryState | null;
|
|
listRevisions(
|
|
input: ListProjectRevisionsInput
|
|
): ProjectRevisionPage | null;
|
|
listRevisionsByNumbers(
|
|
projectId: string,
|
|
revisionNumbers: number[]
|
|
): ProjectRevisionSummary[];
|
|
getNextCommand(
|
|
projectId: string,
|
|
direction: ProjectHistoryDirection
|
|
): ProjectHistoryCommand | null;
|
|
}
|