* Validate an explicitly-supplied `outputResolution`. Rejects (a) non-string * values, which parseRenderOverrides would otherwise silently coerce to * `undefined`; (b) unknown presets; and (c) the alpha-format combination — * outputResolution drives deviceScaleFactor supersampling, which the webm
(body: Record<string, unknown>)
| 235 | * reject it here for a clean 400 regardless of which caller sent it. |
| 236 | */ |
| 237 | function validateOutputResolutionOverride(body: Record<string, unknown>): string | undefined { |
| 238 | if (body.outputResolution === undefined) return undefined; |
| 239 | if (typeof body.outputResolution !== "string") { |
| 240 | return 'outputResolution must be a string preset (e.g. "4k", "landscape-4k")'; |
| 241 | } |
| 242 | const normalized = normalizeResolutionFlag(body.outputResolution); |
| 243 | if (body.outputResolution.trim().length > 0 && normalized === undefined) { |
| 244 | return `Invalid outputResolution "${body.outputResolution}". Must be one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k (aliases: 1080p, 4k, …).`; |
| 245 | } |
| 246 | if (normalized !== undefined && (body.format === "webm" || body.format === "mov")) { |
| 247 | return `outputResolution is not supported with format "${body.format}" — the alpha (webm/mov) capture path can't supersample. Use format "mp4", or omit outputResolution to render at the composition's native dimensions.`; |
| 248 | } |
| 249 | return undefined; |
| 250 | } |
| 251 | |
| 252 | export async function prepareRenderBody( |
| 253 | body: Record<string, unknown>, |
no test coverage detected