(value: unknown, path: string)
| 271 | } |
| 272 | |
| 273 | function parseCaptureConfig(value: unknown, path: string): ReproParseResult<ReproCaptureConfig> { |
| 274 | if (!isJsonObject(value)) { |
| 275 | return fail("ZR_REPRO_INVALID_BUNDLE", path, "captureConfig must be an object"); |
| 276 | } |
| 277 | const known = assertKnownFields(value, CAPTURE_CONFIG_KEYS, path); |
| 278 | if (!known.ok) return known; |
| 279 | |
| 280 | const captureRawEvents = readBoolean(value, "captureRawEvents", `${path}.captureRawEvents`); |
| 281 | if (!captureRawEvents.ok) return captureRawEvents; |
| 282 | const captureDrawlistBytes = readBoolean( |
| 283 | value, |
| 284 | "captureDrawlistBytes", |
| 285 | `${path}.captureDrawlistBytes`, |
| 286 | ); |
| 287 | if (!captureDrawlistBytes.ok) return captureDrawlistBytes; |
| 288 | const maxEventBytes = readNonNegativeInteger(value, "maxEventBytes", `${path}.maxEventBytes`); |
| 289 | if (!maxEventBytes.ok) return maxEventBytes; |
| 290 | const maxDrawlistBytes = readNonNegativeInteger( |
| 291 | value, |
| 292 | "maxDrawlistBytes", |
| 293 | `${path}.maxDrawlistBytes`, |
| 294 | ); |
| 295 | if (!maxDrawlistBytes.ok) return maxDrawlistBytes; |
| 296 | const maxFrames = readNonNegativeInteger(value, "maxFrames", `${path}.maxFrames`); |
| 297 | if (!maxFrames.ok) return maxFrames; |
| 298 | const fpsCap = readPositiveInteger(value, "fpsCap", `${path}.fpsCap`); |
| 299 | if (!fpsCap.ok) return fpsCap; |
| 300 | const cursorProtocolVersion = parseCursorProtocolVersion( |
| 301 | readField(value, "cursorProtocolVersion"), |
| 302 | `${path}.cursorProtocolVersion`, |
| 303 | ); |
| 304 | if (!cursorProtocolVersion.ok) return cursorProtocolVersion; |
| 305 | |
| 306 | return ok({ |
| 307 | captureRawEvents: captureRawEvents.value, |
| 308 | captureDrawlistBytes: captureDrawlistBytes.value, |
| 309 | maxEventBytes: maxEventBytes.value, |
| 310 | maxDrawlistBytes: maxDrawlistBytes.value, |
| 311 | maxFrames: maxFrames.value, |
| 312 | fpsCap: fpsCap.value, |
| 313 | cursorProtocolVersion: cursorProtocolVersion.value, |
| 314 | }); |
| 315 | } |
| 316 | |
| 317 | function parseColorMode(value: unknown, path: string): ReproParseResult<ColorMode> { |
| 318 | if (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > 3) { |
no test coverage detected