MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / parseCaptureConfig

Function parseCaptureConfig

packages/core/src/repro/schema.ts:273–315  ·  view source on GitHub ↗
(value: unknown, path: string)

Source from the content-addressed store, hash-verified

271}
272
273function 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
317function parseColorMode(value: unknown, path: string): ReproParseResult<ColorMode> {
318 if (typeof value !== "number" || !Number.isInteger(value) || value < 0 || value > 3) {

Callers 1

validateV1BundleFunction · 0.85

Calls 9

isJsonObjectFunction · 0.85
assertKnownFieldsFunction · 0.85
readBooleanFunction · 0.85
readNonNegativeIntegerFunction · 0.85
readPositiveIntegerFunction · 0.85
readFieldFunction · 0.85
failFunction · 0.70
okFunction · 0.70

Tested by

no test coverage detected