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

Function captureOnDiskBefore

packages/studio/src/utils/sdkCutover.ts:66–77  ·  view source on GitHub ↗

* Capture the undo-history `before` baseline for timing/GSAP persists: the exact * on-disk bytes when a reader is available (so undo restores them verbatim), * falling back to the SDK's pre-edit serialization when it isn't. Never throws — * a failed read degrades to the serialized fallback rather

(
  deps: CutoverDeps,
  targetPath: string,
  serializedFallback: string,
)

Source from the content-addressed store, hash-verified

64 * a failed read degrades to the serialized fallback rather than aborting the edit.
65 */
66async function captureOnDiskBefore(
67 deps: CutoverDeps,
68 targetPath: string,
69 serializedFallback: string,
70): Promise<string> {
71 if (!deps.readProjectFile) return serializedFallback;
72 try {
73 return await deps.readProjectFile(targetPath);
74 } catch {
75 return serializedFallback;
76 }
77}
78
79/** True when targetPath isn't the composition the SDK session models. */
80function wrongCompositionFile(deps: CutoverDeps, targetPath: string): boolean {

Callers 2

sdkTimingPersistFunction · 0.85
runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected