* Parse the lenient form of the variable + resolution overrides used by * `parseRenderOptions`. Invalid shapes coerce to `undefined` here; * `validateRenderOverrides` separately rejects explicitly-supplied bad values * with a 400 so they aren't silently ignored.
(body: Record<string, unknown>)
| 162 | * with a 400 so they aren't silently ignored. |
| 163 | */ |
| 164 | function parseRenderOverrides(body: Record<string, unknown>): { |
| 165 | variables?: Record<string, unknown>; |
| 166 | outputResolution?: CanvasResolution; |
| 167 | } { |
| 168 | // Only forward a plain JSON object. Arrays / primitives / null → undefined. |
| 169 | const variables = isPlainObject(body.variables) ? body.variables : undefined; |
| 170 | // Accept canonical presets and aliases ("4k", "landscape-4k", …). |
| 171 | const outputResolution = |
| 172 | typeof body.outputResolution === "string" |
| 173 | ? normalizeResolutionFlag(body.outputResolution) |
| 174 | : undefined; |
| 175 | return { variables, outputResolution }; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Build the `createRenderJob` config from a prepared render input. Shared by |
no test coverage detected