MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / canApplyEditHistoryEntry

Function canApplyEditHistoryEntry

packages/studio/src/utils/editHistory.ts:150–162  ·  view source on GitHub ↗
(
  entry: EditHistoryEntry,
  direction: EditHistoryDirection,
  currentHashes: Record<string, string>,
)

Source from the content-addressed store, hash-verified

148}
149
150export function canApplyEditHistoryEntry(
151 entry: EditHistoryEntry,
152 direction: EditHistoryDirection,
153 currentHashes: Record<string, string>,
154): EditHistoryApplyCheck {
155 for (const [path, snapshot] of Object.entries(entry.files)) {
156 const expected = direction === "undo" ? snapshot.afterHash : snapshot.beforeHash;
157 if (currentHashes[path] !== expected) {
158 return { ok: false, reason: "content-mismatch", path };
159 }
160 }
161 return { ok: true };
162}
163
164export function undoEditHistory(
165 state: EditHistoryState,

Callers 3

undoEditHistoryFunction · 0.85
redoEditHistoryFunction · 0.85

Calls 1

entriesMethod · 0.80

Tested by

no test coverage detected