fix: compact hwlab web probe script output
This commit is contained in:
@@ -48,7 +48,7 @@ function compactWebProbeScriptBlock(value: unknown): Record<string, unknown> {
|
||||
|
||||
function compactWebProbeSteps(value: unknown): Record<string, unknown>[] {
|
||||
if (!Array.isArray(value)) return [];
|
||||
return value.slice(-30).map((item) => {
|
||||
return value.slice(-5).map((item) => {
|
||||
const step = record(item);
|
||||
return {
|
||||
index: typeof step.index === "number" ? step.index : null,
|
||||
@@ -85,18 +85,18 @@ function compactIssueSummary(value: Record<string, unknown>): Record<string, unk
|
||||
|
||||
function compactJsonForIssue(value: unknown, depth = 0): unknown {
|
||||
if (value === null || value === undefined) return value ?? null;
|
||||
if (typeof value === "string") return value.replace(/\s+/gu, " ").trim().slice(0, 600);
|
||||
if (typeof value === "string") return value.replace(/\s+/gu, " ").trim().slice(0, 240);
|
||||
if (typeof value === "number" || typeof value === "boolean") return value;
|
||||
if (depth >= 5) return "[max-depth]";
|
||||
if (Array.isArray(value)) return value.slice(0, 30).map((item) => compactJsonForIssue(item, depth + 1));
|
||||
if (depth >= 4) return "[max-depth]";
|
||||
if (Array.isArray(value)) return value.slice(0, 8).map((item) => compactJsonForIssue(item, depth + 1));
|
||||
if (typeof value === "object") {
|
||||
const out: Record<string, unknown> = {};
|
||||
for (const [key, nested] of Object.entries(value as Record<string, unknown>).slice(0, 40)) {
|
||||
for (const [key, nested] of Object.entries(value as Record<string, unknown>).slice(0, 16)) {
|
||||
out[key] = compactJsonForIssue(nested, depth + 1);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
return String(value).slice(0, 600);
|
||||
return String(value).slice(0, 240);
|
||||
}
|
||||
|
||||
function compactStepForIssue(value: unknown): Record<string, unknown> | null {
|
||||
|
||||
Reference in New Issue
Block a user