mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
* fix(audio): preserve subprocess evidence through CLI diagnostics * test(producer): retain real engine exports in assembly mock * fix(audio): retain triggering interruption within diagnostic cap * fix(producer): sanitize audio evidence before encoder error construction * test(cli): isolate diagnostic render temporary project
29 lines
1.0 KiB
TypeScript
29 lines
1.0 KiB
TypeScript
import type { CaptureWarning } from "../types.js";
|
|
|
|
/** Clone every mutable field before a warning crosses an async or ownership boundary. */
|
|
export function cloneCaptureWarning<T extends CaptureWarning>(warning: T): T {
|
|
return {
|
|
...warning,
|
|
details: warning.details
|
|
? {
|
|
...warning.details,
|
|
audioFailures: warning.details.audioFailures?.map((failure) => ({
|
|
...failure,
|
|
...(failure.subprocess ? { subprocess: { ...failure.subprocess } } : {}),
|
|
})),
|
|
sources: warning.details.sources ? [...warning.details.sources] : undefined,
|
|
failureReasons: warning.details.failureReasons
|
|
? [...warning.details.failureReasons]
|
|
: undefined,
|
|
failureStages: warning.details.failureStages
|
|
? [...warning.details.failureStages]
|
|
: undefined,
|
|
}
|
|
: undefined,
|
|
} as T;
|
|
}
|
|
|
|
export function cloneCaptureWarnings<T extends CaptureWarning>(warnings: readonly T[]): T[] {
|
|
return warnings.map(cloneCaptureWarning);
|
|
}
|