mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
* fix(audio): preserve causes and use portable padding * fix(audio): address failure taxonomy review
25 lines
847 B
TypeScript
25 lines
847 B
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,
|
|
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);
|
|
}
|