refactor(domain): extract source-map envelope walk and disambiguate stringValue (#828)
Move the indexed sections walk shared by the browser fetcher and the artifact reader into domain/sourceMapEnvelope with the fetchers stricter offset validation as an option; both validators keep their leaf strictness. Rename the browser CDP stringValue to cdpStringValue across its 18 files, fold the fingerprint duplicate into the static helper, and rename the version-keys shadow to nonEmptyString.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { inferJsonShape, type JsonShape } from "../domain/jsonShape.js";
|
||||
import {
|
||||
recordValue,
|
||||
stringValue,
|
||||
cdpStringValue,
|
||||
type UnknownRecord,
|
||||
} from "./CdpCaptureValues.js";
|
||||
import { decodeBase64, isJsonContentType } from "./CdpCaptureEventHelpers.js";
|
||||
@@ -14,7 +14,7 @@ export const ingestResponseBodyShape = (
|
||||
value: unknown,
|
||||
): void => {
|
||||
const result = recordValue(value);
|
||||
const body = stringValue(result?.body);
|
||||
const body = cdpStringValue(result?.body);
|
||||
if (body === undefined) {
|
||||
invalidResponseBodyShape(state, requestId);
|
||||
return;
|
||||
@@ -37,7 +37,7 @@ export const requestBodyShape = (
|
||||
): NetworkState["body_shapes"] => {
|
||||
if (!state.input.include_json_body_shapes)
|
||||
return { status: "not_approved", request: null, response: null };
|
||||
const body = stringValue(request.postData);
|
||||
const body = cdpStringValue(request.postData);
|
||||
if (!isJsonContentType(recordValue(request.headers)) || body === undefined)
|
||||
return { status: "unavailable", request: null, response: null };
|
||||
const inferred = inferBodyShape(body);
|
||||
|
||||
Reference in New Issue
Block a user