@riddledc/riddle-proof 0.7.94 → 0.7.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/{chunk-FQ4QBY2N.js → chunk-G3UY3SHZ.js} +160 -18
- package/dist/cli.cjs +171 -22
- package/dist/cli.js +12 -5
- package/dist/index.cjs +160 -18
- package/dist/index.js +1 -1
- package/dist/profile.cjs +160 -18
- package/dist/profile.d.cts +2 -0
- package/dist/profile.d.ts +2 -0
- package/dist/profile.js +1 -1
- package/package.json +1 -1
package/dist/profile.cjs
CHANGED
|
@@ -828,6 +828,12 @@ function normalizeCheck(input, index) {
|
|
|
828
828
|
`checks[${index}] allowed_statuses`
|
|
829
829
|
) : void 0;
|
|
830
830
|
const maxLinks = isLinkStatusCheck ? normalizePositiveInteger(input.max_links ?? input.maxLinks ?? input.limit, `checks[${index}] max_links`, 500) : void 0;
|
|
831
|
+
const minBytes = isLinkStatusCheck ? normalizePositiveInteger(input.min_bytes ?? input.minBytes ?? input.min_response_bytes ?? input.minResponseBytes, `checks[${index}] min_bytes`) : void 0;
|
|
832
|
+
const expectedContentType = isLinkStatusCheck ? stringValue(input.expected_content_type) || stringValue(input.expectedContentType) || stringValue(input.content_type) || stringValue(input.contentType) : void 0;
|
|
833
|
+
const allowedContentTypes = isLinkStatusCheck ? normalizeStringList(
|
|
834
|
+
input.allowed_content_types ?? input.allowedContentTypes ?? input.expected_content_types ?? input.expectedContentTypes,
|
|
835
|
+
`checks[${index}] allowed_content_types`
|
|
836
|
+
) ?? (expectedContentType ? [expectedContentType] : void 0) : void 0;
|
|
831
837
|
if (isLinkStatusCheck) {
|
|
832
838
|
if (minCount !== void 0 && (!Number.isInteger(minCount) || minCount < 0)) {
|
|
833
839
|
throw new Error(`checks[${index}] ${type} min_count must be a non-negative integer.`);
|
|
@@ -869,6 +875,8 @@ function normalizeCheck(input, index) {
|
|
|
869
875
|
same_origin_only: isLinkStatusCheck ? input.same_origin_only === true || input.sameOriginOnly === true : void 0,
|
|
870
876
|
dedupe: isLinkStatusCheck ? input.dedupe === false ? false : true : void 0,
|
|
871
877
|
require_nonzero_bytes: isLinkStatusCheck ? input.require_nonzero_bytes === true || input.requireNonzeroBytes === true : void 0,
|
|
878
|
+
min_bytes: minBytes,
|
|
879
|
+
allowed_content_types: allowedContentTypes,
|
|
872
880
|
allow_get_fallback: isLinkStatusCheck ? input.allow_get_fallback === false || input.allowGetFallback === false ? false : true : void 0,
|
|
873
881
|
max_overflow_px: numberValue(input.max_overflow_px),
|
|
874
882
|
timeout_ms: numberValue(input.timeout_ms) ?? numberValue(input.timeoutMs),
|
|
@@ -975,15 +983,40 @@ function linkStatusIsAllowed(status, check) {
|
|
|
975
983
|
const allowed = linkStatusAllowedStatuses(check);
|
|
976
984
|
return allowed?.length ? allowed.includes(status) : status >= 200 && status < 400;
|
|
977
985
|
}
|
|
986
|
+
function linkStatusObservedBytes(result) {
|
|
987
|
+
const bytes = numberValue(result.bytes);
|
|
988
|
+
const contentLength = numberValue(result.content_length);
|
|
989
|
+
return Math.max(bytes ?? 0, contentLength ?? 0) || void 0;
|
|
990
|
+
}
|
|
991
|
+
function normalizeLinkStatusContentType(value) {
|
|
992
|
+
const normalized = value?.split(";")[0]?.trim().toLowerCase();
|
|
993
|
+
return normalized || void 0;
|
|
994
|
+
}
|
|
995
|
+
function linkStatusContentTypeOk(result, check) {
|
|
996
|
+
const expected = check.allowed_content_types;
|
|
997
|
+
if (!expected?.length) return true;
|
|
998
|
+
const actual = normalizeLinkStatusContentType(stringValue(result.content_type));
|
|
999
|
+
if (!actual) return false;
|
|
1000
|
+
return expected.some((contentType) => {
|
|
1001
|
+
const normalized = normalizeLinkStatusContentType(contentType);
|
|
1002
|
+
if (!normalized) return false;
|
|
1003
|
+
if (normalized.endsWith("/*")) return actual.startsWith(normalized.slice(0, -1));
|
|
1004
|
+
return actual === normalized;
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
978
1007
|
function linkStatusResultOk(result, check) {
|
|
979
1008
|
const status = numberValue(result.status);
|
|
980
1009
|
if (!linkStatusIsAllowed(status, check)) return false;
|
|
981
1010
|
if (stringValue(result.error)) return false;
|
|
982
1011
|
if (result.ok === false) return false;
|
|
1012
|
+
if (!linkStatusContentTypeOk(result, check)) return false;
|
|
983
1013
|
if (check.require_nonzero_bytes) {
|
|
984
|
-
const
|
|
985
|
-
|
|
986
|
-
|
|
1014
|
+
const observedBytes = linkStatusObservedBytes(result);
|
|
1015
|
+
if (observedBytes === void 0 || observedBytes <= 0) return false;
|
|
1016
|
+
}
|
|
1017
|
+
if (check.min_bytes !== void 0) {
|
|
1018
|
+
const observedBytes = linkStatusObservedBytes(result);
|
|
1019
|
+
if (observedBytes === void 0 || observedBytes < check.min_bytes) return false;
|
|
987
1020
|
}
|
|
988
1021
|
return true;
|
|
989
1022
|
}
|
|
@@ -1005,6 +1038,10 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
1005
1038
|
}
|
|
1006
1039
|
const results = Array.isArray(linkEvidence.results) ? linkEvidence.results.filter(isRecord) : [];
|
|
1007
1040
|
const totalCount = numberValue(linkEvidence.total_count) ?? results.length;
|
|
1041
|
+
const resultCount = numberValue(linkEvidence.result_count) ?? totalCount;
|
|
1042
|
+
const storedResultCount = numberValue(linkEvidence.stored_result_count) ?? results.length;
|
|
1043
|
+
const omittedResultCount = numberValue(linkEvidence.omitted_result_count) ?? Math.max(0, resultCount - storedResultCount);
|
|
1044
|
+
const omittedSuccessCount = numberValue(linkEvidence.omitted_success_count) ?? 0;
|
|
1008
1045
|
const okCount = results.filter((result) => linkStatusResultOk(result, check)).length;
|
|
1009
1046
|
const failures = results.filter((result) => !linkStatusResultOk(result, check)).map((result) => ({
|
|
1010
1047
|
code: "link_status_failed",
|
|
@@ -1012,7 +1049,10 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
1012
1049
|
status: numberValue(result.status) ?? null,
|
|
1013
1050
|
method: stringValue(result.method) ?? null,
|
|
1014
1051
|
error: stringValue(result.error) ?? null,
|
|
1015
|
-
|
|
1052
|
+
content_type: stringValue(result.content_type) ?? null,
|
|
1053
|
+
bytes: linkStatusObservedBytes(result) ?? null,
|
|
1054
|
+
min_bytes: check.min_bytes ?? null,
|
|
1055
|
+
allowed_content_types: check.allowed_content_types ?? null
|
|
1016
1056
|
}));
|
|
1017
1057
|
if (stringValue(linkEvidence.error)) {
|
|
1018
1058
|
failures.push({ code: "link_status_capture_failed", error: stringValue(linkEvidence.error) ?? "" });
|
|
@@ -1049,6 +1089,13 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
1049
1089
|
failed_count: failures.length,
|
|
1050
1090
|
truncated: linkEvidence.truncated === true,
|
|
1051
1091
|
max_links: numberValue(linkEvidence.max_links) ?? check.max_links ?? 100,
|
|
1092
|
+
result_count: resultCount,
|
|
1093
|
+
stored_result_count: storedResultCount,
|
|
1094
|
+
omitted_result_count: omittedResultCount,
|
|
1095
|
+
omitted_success_count: omittedSuccessCount,
|
|
1096
|
+
results_compacted: linkEvidence.results_compacted === true || omittedResultCount > 0,
|
|
1097
|
+
min_bytes: check.min_bytes ?? null,
|
|
1098
|
+
allowed_content_types: check.allowed_content_types ?? null,
|
|
1052
1099
|
status_counts: statusCounts,
|
|
1053
1100
|
failures: failures.slice(0, 20)
|
|
1054
1101
|
};
|
|
@@ -1577,6 +1624,8 @@ function assessCheckFromEvidence(check, evidence) {
|
|
|
1577
1624
|
min_count: check.min_count ?? null,
|
|
1578
1625
|
allowed_statuses: linkStatusAllowedStatuses(check) || ["2xx", "3xx"],
|
|
1579
1626
|
require_nonzero_bytes: check.require_nonzero_bytes === true,
|
|
1627
|
+
min_bytes: check.min_bytes ?? null,
|
|
1628
|
+
allowed_content_types: check.allowed_content_types ?? null,
|
|
1580
1629
|
viewports: summaries.map((summary) => toJsonValue(summary)),
|
|
1581
1630
|
failures: failed.flatMap((summary) => Array.isArray(summary.failures) ? summary.failures.map((failure) => toJsonValue({ viewport: stringValue(summary.viewport) ?? null, failure })) : [])
|
|
1582
1631
|
},
|
|
@@ -2180,15 +2229,41 @@ function linkStatusIsAllowed(status, check) {
|
|
|
2180
2229
|
const allowed = linkStatusAllowedStatuses(check);
|
|
2181
2230
|
return Array.isArray(allowed) && allowed.length ? allowed.includes(status) : status >= 200 && status < 400;
|
|
2182
2231
|
}
|
|
2232
|
+
function linkStatusObservedBytes(result) {
|
|
2233
|
+
const bytes = typeof result.bytes === "number" && Number.isFinite(result.bytes) ? result.bytes : undefined;
|
|
2234
|
+
const contentLength = typeof result.content_length === "number" && Number.isFinite(result.content_length) ? result.content_length : undefined;
|
|
2235
|
+
const observed = Math.max(bytes || 0, contentLength || 0);
|
|
2236
|
+
return observed > 0 ? observed : undefined;
|
|
2237
|
+
}
|
|
2238
|
+
function normalizeLinkStatusContentType(value) {
|
|
2239
|
+
if (typeof value !== "string") return undefined;
|
|
2240
|
+
const normalized = (value.split(";")[0] || "").trim().toLowerCase();
|
|
2241
|
+
return normalized || undefined;
|
|
2242
|
+
}
|
|
2243
|
+
function linkStatusContentTypeOk(result, check) {
|
|
2244
|
+
if (!Array.isArray(check.allowed_content_types) || !check.allowed_content_types.length) return true;
|
|
2245
|
+
const actual = normalizeLinkStatusContentType(result.content_type);
|
|
2246
|
+
if (!actual) return false;
|
|
2247
|
+
return check.allowed_content_types.some((contentType) => {
|
|
2248
|
+
const normalized = normalizeLinkStatusContentType(contentType);
|
|
2249
|
+
if (!normalized) return false;
|
|
2250
|
+
if (normalized.endsWith("/*")) return actual.startsWith(normalized.slice(0, -1));
|
|
2251
|
+
return actual === normalized;
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2183
2254
|
function linkStatusResultOk(result, check) {
|
|
2184
2255
|
if (!result || typeof result !== "object" || Array.isArray(result)) return false;
|
|
2185
2256
|
if (!linkStatusIsAllowed(result.status, check)) return false;
|
|
2186
2257
|
if (typeof result.error === "string" && result.error.trim()) return false;
|
|
2187
2258
|
if (result.ok === false) return false;
|
|
2259
|
+
if (!linkStatusContentTypeOk(result, check)) return false;
|
|
2188
2260
|
if (check.require_nonzero_bytes === true) {
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2261
|
+
const observedBytes = linkStatusObservedBytes(result);
|
|
2262
|
+
if (observedBytes === undefined || observedBytes <= 0) return false;
|
|
2263
|
+
}
|
|
2264
|
+
if (typeof check.min_bytes === "number" && Number.isFinite(check.min_bytes)) {
|
|
2265
|
+
const observedBytes = linkStatusObservedBytes(result);
|
|
2266
|
+
if (observedBytes === undefined || observedBytes < check.min_bytes) return false;
|
|
2192
2267
|
}
|
|
2193
2268
|
return true;
|
|
2194
2269
|
}
|
|
@@ -2207,6 +2282,10 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
2207
2282
|
}
|
|
2208
2283
|
const results = Array.isArray(linkEvidence.results) ? linkEvidence.results.filter((result) => result && typeof result === "object" && !Array.isArray(result)) : [];
|
|
2209
2284
|
const totalCount = typeof linkEvidence.total_count === "number" && Number.isFinite(linkEvidence.total_count) ? linkEvidence.total_count : results.length;
|
|
2285
|
+
const resultCount = typeof linkEvidence.result_count === "number" && Number.isFinite(linkEvidence.result_count) ? linkEvidence.result_count : totalCount;
|
|
2286
|
+
const storedResultCount = typeof linkEvidence.stored_result_count === "number" && Number.isFinite(linkEvidence.stored_result_count) ? linkEvidence.stored_result_count : results.length;
|
|
2287
|
+
const omittedResultCount = typeof linkEvidence.omitted_result_count === "number" && Number.isFinite(linkEvidence.omitted_result_count) ? linkEvidence.omitted_result_count : Math.max(0, resultCount - storedResultCount);
|
|
2288
|
+
const omittedSuccessCount = typeof linkEvidence.omitted_success_count === "number" && Number.isFinite(linkEvidence.omitted_success_count) ? linkEvidence.omitted_success_count : 0;
|
|
2210
2289
|
const okCount = results.filter((result) => linkStatusResultOk(result, check)).length;
|
|
2211
2290
|
const failures = results
|
|
2212
2291
|
.filter((result) => !linkStatusResultOk(result, check))
|
|
@@ -2216,11 +2295,10 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
2216
2295
|
status: typeof result.status === "number" && Number.isFinite(result.status) ? result.status : null,
|
|
2217
2296
|
method: typeof result.method === "string" ? result.method : null,
|
|
2218
2297
|
error: typeof result.error === "string" ? result.error : null,
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
: null,
|
|
2298
|
+
content_type: typeof result.content_type === "string" ? result.content_type : null,
|
|
2299
|
+
bytes: linkStatusObservedBytes(result) ?? null,
|
|
2300
|
+
min_bytes: typeof check.min_bytes === "number" && Number.isFinite(check.min_bytes) ? check.min_bytes : null,
|
|
2301
|
+
allowed_content_types: Array.isArray(check.allowed_content_types) ? check.allowed_content_types : null,
|
|
2224
2302
|
}));
|
|
2225
2303
|
if (typeof linkEvidence.error === "string" && linkEvidence.error.trim()) {
|
|
2226
2304
|
failures.push({ code: "link_status_capture_failed", error: linkEvidence.error });
|
|
@@ -2255,6 +2333,13 @@ function summarizeLinkStatusEvidence(viewport, check) {
|
|
|
2255
2333
|
failed_count: failures.length,
|
|
2256
2334
|
truncated: linkEvidence.truncated === true,
|
|
2257
2335
|
max_links: typeof linkEvidence.max_links === "number" ? linkEvidence.max_links : check.max_links || 100,
|
|
2336
|
+
result_count: resultCount,
|
|
2337
|
+
stored_result_count: storedResultCount,
|
|
2338
|
+
omitted_result_count: omittedResultCount,
|
|
2339
|
+
omitted_success_count: omittedSuccessCount,
|
|
2340
|
+
results_compacted: linkEvidence.results_compacted === true || omittedResultCount > 0,
|
|
2341
|
+
min_bytes: typeof check.min_bytes === "number" && Number.isFinite(check.min_bytes) ? check.min_bytes : null,
|
|
2342
|
+
allowed_content_types: Array.isArray(check.allowed_content_types) ? check.allowed_content_types : null,
|
|
2258
2343
|
status_counts: linkEvidence.status_counts && typeof linkEvidence.status_counts === "object" && !Array.isArray(linkEvidence.status_counts) ? linkEvidence.status_counts : {},
|
|
2259
2344
|
failures: failures.slice(0, 20),
|
|
2260
2345
|
};
|
|
@@ -2951,6 +3036,8 @@ function assessProfile(profile, evidence) {
|
|
|
2951
3036
|
min_count: check.min_count ?? null,
|
|
2952
3037
|
allowed_statuses: linkStatusAllowedStatuses(check) || ["2xx", "3xx"],
|
|
2953
3038
|
require_nonzero_bytes: check.require_nonzero_bytes === true,
|
|
3039
|
+
min_bytes: check.min_bytes ?? null,
|
|
3040
|
+
allowed_content_types: check.allowed_content_types ?? null,
|
|
2954
3041
|
viewports: summaries,
|
|
2955
3042
|
failures: failed.flatMap((summary) => Array.isArray(summary.failures)
|
|
2956
3043
|
? summary.failures.map((failure) => ({ viewport: summary.viewport || null, failure }))
|
|
@@ -4098,6 +4185,28 @@ function linkProbeAllowed(status, check) {
|
|
|
4098
4185
|
: null;
|
|
4099
4186
|
return allowed ? allowed.includes(status) : status >= 200 && status < 400;
|
|
4100
4187
|
}
|
|
4188
|
+
function linkProbeObservedBytes(result) {
|
|
4189
|
+
const bytes = typeof result.bytes === "number" && Number.isFinite(result.bytes) ? result.bytes : undefined;
|
|
4190
|
+
const contentLength = typeof result.content_length === "number" && Number.isFinite(result.content_length) ? result.content_length : undefined;
|
|
4191
|
+
const observed = Math.max(bytes || 0, contentLength || 0);
|
|
4192
|
+
return observed > 0 ? observed : undefined;
|
|
4193
|
+
}
|
|
4194
|
+
function normalizeLinkProbeContentType(value) {
|
|
4195
|
+
if (typeof value !== "string") return undefined;
|
|
4196
|
+
const normalized = (value.split(";")[0] || "").trim().toLowerCase();
|
|
4197
|
+
return normalized || undefined;
|
|
4198
|
+
}
|
|
4199
|
+
function linkProbeContentTypeAllowed(result, check) {
|
|
4200
|
+
if (!Array.isArray(check.allowed_content_types) || !check.allowed_content_types.length) return true;
|
|
4201
|
+
const actual = normalizeLinkProbeContentType(result.content_type);
|
|
4202
|
+
if (!actual) return false;
|
|
4203
|
+
return check.allowed_content_types.some((contentType) => {
|
|
4204
|
+
const normalized = normalizeLinkProbeContentType(contentType);
|
|
4205
|
+
if (!normalized) return false;
|
|
4206
|
+
if (normalized.endsWith("/*")) return actual.startsWith(normalized.slice(0, -1));
|
|
4207
|
+
return actual === normalized;
|
|
4208
|
+
});
|
|
4209
|
+
}
|
|
4101
4210
|
function linkProbeResponseFields(response, method) {
|
|
4102
4211
|
const contentLengthHeader = response.headers && typeof response.headers.get === "function" ? response.headers.get("content-length") : null;
|
|
4103
4212
|
const contentLength = contentLengthHeader && /^\d+$/.test(contentLengthHeader) ? Number(contentLengthHeader) : null;
|
|
@@ -4112,6 +4221,7 @@ function linkProbeResponseFields(response, method) {
|
|
|
4112
4221
|
}
|
|
4113
4222
|
async function probeLinkStatus(candidate, check) {
|
|
4114
4223
|
const requireNonzeroBytes = check.require_nonzero_bytes === true;
|
|
4224
|
+
const minBytes = typeof check.min_bytes === "number" && Number.isFinite(check.min_bytes) ? Math.max(1, Math.floor(check.min_bytes)) : null;
|
|
4115
4225
|
const allowGetFallback = check.allow_get_fallback !== false;
|
|
4116
4226
|
const result = {
|
|
4117
4227
|
url: candidate.url,
|
|
@@ -4129,7 +4239,7 @@ async function probeLinkStatus(candidate, check) {
|
|
|
4129
4239
|
};
|
|
4130
4240
|
const applyResponse = async (response, method, readBytes) => {
|
|
4131
4241
|
Object.assign(result, linkProbeResponseFields(response, method));
|
|
4132
|
-
if (readBytes
|
|
4242
|
+
if (readBytes) {
|
|
4133
4243
|
try {
|
|
4134
4244
|
const buffer = await response.arrayBuffer();
|
|
4135
4245
|
result.bytes = buffer.byteLength;
|
|
@@ -4138,7 +4248,9 @@ async function probeLinkStatus(candidate, check) {
|
|
|
4138
4248
|
}
|
|
4139
4249
|
}
|
|
4140
4250
|
result.ok = linkProbeAllowed(result.status, check)
|
|
4141
|
-
&& (
|
|
4251
|
+
&& linkProbeContentTypeAllowed(result, check)
|
|
4252
|
+
&& (!requireNonzeroBytes || ((linkProbeObservedBytes(result) || 0) > 0))
|
|
4253
|
+
&& (minBytes === null || ((linkProbeObservedBytes(result) || 0) >= minBytes))
|
|
4142
4254
|
&& !result.error;
|
|
4143
4255
|
};
|
|
4144
4256
|
try {
|
|
@@ -4155,9 +4267,9 @@ async function probeLinkStatus(candidate, check) {
|
|
|
4155
4267
|
method: "GET",
|
|
4156
4268
|
redirect: "follow",
|
|
4157
4269
|
cache: "no-store",
|
|
4158
|
-
headers: { Range: "bytes=0-
|
|
4270
|
+
headers: { Range: "bytes=0-" + String((minBytes || 1) - 1) },
|
|
4159
4271
|
});
|
|
4160
|
-
await applyResponse(response, "GET", requireNonzeroBytes);
|
|
4272
|
+
await applyResponse(response, "GET", requireNonzeroBytes || minBytes !== null);
|
|
4161
4273
|
return result;
|
|
4162
4274
|
} catch (error) {
|
|
4163
4275
|
result.error = String(error && error.message ? error.message : error).slice(0, 500);
|
|
@@ -4165,6 +4277,30 @@ async function probeLinkStatus(candidate, check) {
|
|
|
4165
4277
|
return result;
|
|
4166
4278
|
}
|
|
4167
4279
|
}
|
|
4280
|
+
function compactLinkProbeResults(results) {
|
|
4281
|
+
const allResults = Array.isArray(results) ? results : [];
|
|
4282
|
+
if (allResults.length <= 20) {
|
|
4283
|
+
return {
|
|
4284
|
+
result_count: allResults.length,
|
|
4285
|
+
stored_result_count: allResults.length,
|
|
4286
|
+
omitted_result_count: 0,
|
|
4287
|
+
omitted_success_count: 0,
|
|
4288
|
+
results_compacted: false,
|
|
4289
|
+
results: allResults,
|
|
4290
|
+
};
|
|
4291
|
+
}
|
|
4292
|
+
const successResults = allResults.filter((result) => result && result.ok);
|
|
4293
|
+
const sampledSuccesses = new Set(successResults.slice(0, 5));
|
|
4294
|
+
const storedResults = allResults.filter((result) => result && (!result.ok || sampledSuccesses.has(result)));
|
|
4295
|
+
return {
|
|
4296
|
+
result_count: allResults.length,
|
|
4297
|
+
stored_result_count: storedResults.length,
|
|
4298
|
+
omitted_result_count: allResults.length - storedResults.length,
|
|
4299
|
+
omitted_success_count: Math.max(0, successResults.length - sampledSuccesses.size),
|
|
4300
|
+
results_compacted: storedResults.length < allResults.length,
|
|
4301
|
+
results: storedResults,
|
|
4302
|
+
};
|
|
4303
|
+
}
|
|
4168
4304
|
async function collectLinkStatus(check) {
|
|
4169
4305
|
const selector = linkStatusSelector(check);
|
|
4170
4306
|
const candidateResult = await collectLinkCandidates(selector);
|
|
@@ -4211,13 +4347,17 @@ async function collectLinkStatus(check) {
|
|
|
4211
4347
|
status: result.status,
|
|
4212
4348
|
method: result.method,
|
|
4213
4349
|
error: result.error,
|
|
4214
|
-
|
|
4350
|
+
content_type: result.content_type,
|
|
4351
|
+
bytes: linkProbeObservedBytes(result) || null,
|
|
4352
|
+
min_bytes: typeof check.min_bytes === "number" && Number.isFinite(check.min_bytes) ? check.min_bytes : null,
|
|
4353
|
+
allowed_content_types: Array.isArray(check.allowed_content_types) ? check.allowed_content_types : null,
|
|
4215
4354
|
}));
|
|
4216
4355
|
const statusCounts = {};
|
|
4217
4356
|
for (const result of results) {
|
|
4218
4357
|
const key = result.status == null ? "error" : String(result.status);
|
|
4219
4358
|
statusCounts[key] = (statusCounts[key] || 0) + 1;
|
|
4220
4359
|
}
|
|
4360
|
+
const compactedResults = compactLinkProbeResults(results);
|
|
4221
4361
|
return {
|
|
4222
4362
|
version: "riddle-proof.link-status.v1",
|
|
4223
4363
|
selector,
|
|
@@ -4225,6 +4365,8 @@ async function collectLinkStatus(check) {
|
|
|
4225
4365
|
same_origin_only: linkProbeSameOriginOnly(check),
|
|
4226
4366
|
dedupe: linkProbeDedupe(check),
|
|
4227
4367
|
require_nonzero_bytes: check.require_nonzero_bytes === true,
|
|
4368
|
+
min_bytes: typeof check.min_bytes === "number" && Number.isFinite(check.min_bytes) ? check.min_bytes : null,
|
|
4369
|
+
allowed_content_types: Array.isArray(check.allowed_content_types) ? check.allowed_content_types : null,
|
|
4228
4370
|
allowed_statuses: Array.isArray(check.allowed_statuses) && check.allowed_statuses.length
|
|
4229
4371
|
? check.allowed_statuses
|
|
4230
4372
|
: typeof check.expected_status === "number"
|
|
@@ -4237,7 +4379,7 @@ async function collectLinkStatus(check) {
|
|
|
4237
4379
|
failed_count: failures.length,
|
|
4238
4380
|
status_counts: statusCounts,
|
|
4239
4381
|
failures: failures.slice(0, 20),
|
|
4240
|
-
|
|
4382
|
+
...compactedResults,
|
|
4241
4383
|
};
|
|
4242
4384
|
}
|
|
4243
4385
|
async function frameEvidence(selector) {
|
package/dist/profile.d.cts
CHANGED
|
@@ -138,6 +138,8 @@ interface RiddleProofProfileCheck {
|
|
|
138
138
|
same_origin_only?: boolean;
|
|
139
139
|
dedupe?: boolean;
|
|
140
140
|
require_nonzero_bytes?: boolean;
|
|
141
|
+
min_bytes?: number;
|
|
142
|
+
allowed_content_types?: string[];
|
|
141
143
|
allow_get_fallback?: boolean;
|
|
142
144
|
max_overflow_px?: number;
|
|
143
145
|
timeout_ms?: number;
|
package/dist/profile.d.ts
CHANGED
|
@@ -138,6 +138,8 @@ interface RiddleProofProfileCheck {
|
|
|
138
138
|
same_origin_only?: boolean;
|
|
139
139
|
dedupe?: boolean;
|
|
140
140
|
require_nonzero_bytes?: boolean;
|
|
141
|
+
min_bytes?: number;
|
|
142
|
+
allowed_content_types?: string[];
|
|
141
143
|
allow_get_fallback?: boolean;
|
|
142
144
|
max_overflow_px?: number;
|
|
143
145
|
timeout_ms?: number;
|
package/dist/profile.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
resolveRiddleProofProfileTimeoutSec,
|
|
20
20
|
slugifyRiddleProofProfileName,
|
|
21
21
|
summarizeRiddleProofProfileResult
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-G3UY3SHZ.js";
|
|
23
23
|
export {
|
|
24
24
|
RIDDLE_PROOF_PROFILE_CHECK_TYPES,
|
|
25
25
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|