@riddledc/riddle-proof 0.7.158 → 0.7.160
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 +15 -5
- package/dist/{chunk-YB3LNLZB.js → chunk-MV7UM4EV.js} +228 -5
- package/dist/cli.cjs +280 -13
- package/dist/cli.js +53 -9
- package/dist/index.cjs +228 -5
- package/dist/index.js +1 -1
- package/dist/profile.cjs +228 -5
- package/dist/profile.d.cts +3 -1
- package/dist/profile.d.ts +3 -1
- package/dist/profile.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -8782,6 +8782,7 @@ var RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES = [
|
|
|
8782
8782
|
"fill",
|
|
8783
8783
|
"set_input_value",
|
|
8784
8784
|
"set_range_value",
|
|
8785
|
+
"canvas_signature",
|
|
8785
8786
|
"assert_text_visible",
|
|
8786
8787
|
"assert_text_absent",
|
|
8787
8788
|
"assert_selector_count",
|
|
@@ -9283,6 +9284,26 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
9283
9284
|
reason: result.reason ?? result.error ?? null
|
|
9284
9285
|
}));
|
|
9285
9286
|
}
|
|
9287
|
+
function profileSetupCanvasSignatureReceipts(results) {
|
|
9288
|
+
return results.filter((result) => profileSetupResultAction(result) === "canvas_signature").map((result) => ({
|
|
9289
|
+
ordinal: result.ordinal ?? null,
|
|
9290
|
+
ok: result.ok !== false,
|
|
9291
|
+
selector: result.selector ?? null,
|
|
9292
|
+
frame_selector: result.frame_selector ?? null,
|
|
9293
|
+
label: result.label ?? null,
|
|
9294
|
+
hash: result.hash ?? null,
|
|
9295
|
+
data_length: result.data_length ?? null,
|
|
9296
|
+
width: result.width ?? null,
|
|
9297
|
+
height: result.height ?? null,
|
|
9298
|
+
css_width: result.css_width ?? null,
|
|
9299
|
+
css_height: result.css_height ?? null,
|
|
9300
|
+
compare_to: result.compare_to ?? null,
|
|
9301
|
+
previous_hash: result.previous_hash ?? null,
|
|
9302
|
+
changed: result.changed ?? null,
|
|
9303
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
9304
|
+
reason: result.reason ?? result.error ?? null
|
|
9305
|
+
}));
|
|
9306
|
+
}
|
|
9286
9307
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
9287
9308
|
if (items.length <= limit) return items;
|
|
9288
9309
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -9327,6 +9348,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9327
9348
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
9328
9349
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
9329
9350
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
9351
|
+
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
9352
|
+
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
9330
9353
|
const clickedItems = results.filter((result) => profileSetupResultAction(result) === "click" && result.ok !== false).map((result) => {
|
|
9331
9354
|
const clickCount = typeof result.click_count === "number" && Number.isFinite(result.click_count) && result.click_count > 1 ? result.click_count : void 0;
|
|
9332
9355
|
return {
|
|
@@ -9378,6 +9401,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountByViewpo
|
|
|
9378
9401
|
set_range_value_total: rangeValueReceipts.length,
|
|
9379
9402
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
9380
9403
|
set_range_value: sampledRangeValueReceipts,
|
|
9404
|
+
canvas_signature_total: canvasSignatureReceipts.length,
|
|
9405
|
+
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
9406
|
+
canvas_signature: sampledCanvasSignatureReceipts,
|
|
9381
9407
|
clicked,
|
|
9382
9408
|
text_samples,
|
|
9383
9409
|
failed: failed.map((result) => ({
|
|
@@ -9430,7 +9456,7 @@ function isSupportedCheckType(value) {
|
|
|
9430
9456
|
}
|
|
9431
9457
|
function normalizeSetupActionType(value, index) {
|
|
9432
9458
|
const normalizedInput = String(value || "").trim().replace(/-/g, "_");
|
|
9433
|
-
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
9459
|
+
const normalized = normalizedInput === "clear_browser_storage" ? "clear_storage" : normalizedInput === "reset_console" || normalizedInput === "clear_browser_console" || normalizedInput === "reset_browser_console" ? "clear_console" : normalizedInput === "pointer_drag" || normalizedInput === "mouse_drag" || normalizedInput === "drag_to" ? "drag" : normalizedInput === "keyboard_press" || normalizedInput === "key_press" ? "press" : normalizedInput === "set_slider_value" || normalizedInput === "slider_value" || normalizedInput === "set_slider" || normalizedInput === "set_range" || normalizedInput === "range_value" || normalizedInput === "range_input" || normalizedInput === "set_range_input" ? "set_range_value" : normalizedInput === "canvas_hash" || normalizedInput === "capture_canvas_hash" || normalizedInput === "capture_canvas_signature" || normalizedInput === "canvas_state_signature" ? "canvas_signature" : normalizedInput === "capture_screenshot" || normalizedInput === "save_screenshot" || normalizedInput === "setup_screenshot" ? "screenshot" : normalizedInput === "accept_dialog" || normalizedInput === "accept_dialogs" || normalizedInput === "confirm_dialog" || normalizedInput === "set_dialog_response" ? "dialog_response" : normalizedInput === "dismiss_dialog" || normalizedInput === "dismiss_dialogs" || normalizedInput === "cancel_dialog" ? "dialog_response" : normalizedInput === "window_call_until" || normalizedInput === "call_until" || normalizedInput === "window_call_repeat_until" || normalizedInput === "repeat_window_call_until" ? "window_call_until" : normalizedInput === "window_evaluate" || normalizedInput === "browser_eval" || normalizedInput === "browser_evaluate" || normalizedInput === "evaluate_script" || normalizedInput === "profile_script" ? "window_eval" : normalizedInput;
|
|
9434
9460
|
if (RIDDLE_PROOF_PROFILE_SETUP_ACTION_TYPES.includes(normalized)) {
|
|
9435
9461
|
return normalized;
|
|
9436
9462
|
}
|
|
@@ -9559,7 +9585,7 @@ function normalizeSetupAction(input, index) {
|
|
|
9559
9585
|
if (frameIndex !== void 0 && (!Number.isInteger(frameIndex) || frameIndex < 0)) {
|
|
9560
9586
|
throw new Error(`target.setup_actions[${index}].frame_index must be a non-negative integer.`);
|
|
9561
9587
|
}
|
|
9562
|
-
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9588
|
+
if ((type === "click" || type === "drag" || type === "fill" || type === "set_input_value" || type === "set_range_value" || type === "canvas_signature" || type === "wait_for_selector" || type === "wait_for_text" || type === "assert_text_visible" || type === "assert_text_absent" || type === "assert_selector_count") && !selector) {
|
|
9563
9589
|
throw new Error(`target.setup_actions[${index}] ${type} requires selector.`);
|
|
9564
9590
|
}
|
|
9565
9591
|
const fromX = numberValue3(valueFromOwn(input, "from_x", "fromX", "start_x", "startX", "x1"));
|
|
@@ -9653,7 +9679,11 @@ function normalizeSetupAction(input, index) {
|
|
|
9653
9679
|
"assign_return_to",
|
|
9654
9680
|
"assignReturnTo",
|
|
9655
9681
|
"return_state_path",
|
|
9656
|
-
"returnStatePath"
|
|
9682
|
+
"returnStatePath",
|
|
9683
|
+
"store_signature_to",
|
|
9684
|
+
"storeSignatureTo",
|
|
9685
|
+
"signature_path",
|
|
9686
|
+
"signaturePath"
|
|
9657
9687
|
);
|
|
9658
9688
|
const captureReturn = input.capture_return === false || input.captureReturn === false || input.include_return === false || input.includeReturn === false || input.omit_return === true || input.omitReturn === true ? false : void 0;
|
|
9659
9689
|
const untilPath = stringFromOwn(input, "until_path", "untilPath", "until_state_path", "untilStatePath", "until_window_path", "untilWindowPath", "until");
|
|
@@ -9705,6 +9735,8 @@ function normalizeSetupAction(input, index) {
|
|
|
9705
9735
|
store_return_to: storeReturnTo,
|
|
9706
9736
|
capture_return: captureReturn,
|
|
9707
9737
|
return_summary_fields: normalizeReturnSummaryFields(input, index),
|
|
9738
|
+
compare_to: stringFromOwn(input, "compare_to", "compareTo", "previous_signature_path", "previousSignaturePath", "previous_path", "previousPath", "changed_from", "changedFrom"),
|
|
9739
|
+
expect_changed: booleanValue(valueFromOwn(input, "expect_changed", "expectChanged", "should_change", "shouldChange", "changed")),
|
|
9708
9740
|
until_path: untilPath,
|
|
9709
9741
|
until_expected_value: hasUntilExpectedValue ? toJsonValue(valueFromOwn(input, "until_expected_value", "untilExpectedValue", "until_expected", "untilExpected", "until_value", "untilValue", "expected_value", "expectedValue", "expected")) : void 0,
|
|
9710
9742
|
max_calls: maxCalls,
|
|
@@ -10827,7 +10859,14 @@ function textSequenceForCheck(viewport, check) {
|
|
|
10827
10859
|
const matchTexts = Array.isArray(sequence.match_texts) ? sequence.match_texts : [];
|
|
10828
10860
|
const visibleTexts = Array.isArray(sequence.visible_texts) ? sequence.visible_texts : [];
|
|
10829
10861
|
const texts = Array.isArray(sequence.texts) ? sequence.texts : [];
|
|
10830
|
-
|
|
10862
|
+
let candidates;
|
|
10863
|
+
if (check.type === "selector_text_visible") {
|
|
10864
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : visibleTexts;
|
|
10865
|
+
} else if (check.type === "selector_text_absent") {
|
|
10866
|
+
candidates = matchTexts.length ? matchTexts : texts;
|
|
10867
|
+
} else {
|
|
10868
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : matchTexts.length ? matchTexts : visibleTexts.length ? visibleTexts : texts;
|
|
10869
|
+
}
|
|
10831
10870
|
return candidates.map((text) => String(text).replace(/\s+/g, " ").trim()).filter(Boolean);
|
|
10832
10871
|
}
|
|
10833
10872
|
return [];
|
|
@@ -12207,7 +12246,14 @@ function textSequenceForCheck(viewport, check) {
|
|
|
12207
12246
|
const matchTexts = Array.isArray(sequence.match_texts) ? sequence.match_texts : [];
|
|
12208
12247
|
const visibleTexts = Array.isArray(sequence.visible_texts) ? sequence.visible_texts : [];
|
|
12209
12248
|
const texts = Array.isArray(sequence.texts) ? sequence.texts : [];
|
|
12210
|
-
|
|
12249
|
+
let candidates;
|
|
12250
|
+
if (check.type === "selector_text_visible") {
|
|
12251
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : visibleTexts;
|
|
12252
|
+
} else if (check.type === "selector_text_absent") {
|
|
12253
|
+
candidates = matchTexts.length ? matchTexts : texts;
|
|
12254
|
+
} else {
|
|
12255
|
+
candidates = visibleMatchTexts.length ? visibleMatchTexts : matchTexts.length ? matchTexts : visibleTexts.length ? visibleTexts : texts;
|
|
12256
|
+
}
|
|
12211
12257
|
return candidates.map((text) => String(text || "").replace(/\s+/g, " ").trim()).filter(Boolean);
|
|
12212
12258
|
}
|
|
12213
12259
|
return [];
|
|
@@ -12817,6 +12863,28 @@ function profileSetupRangeValueReceipts(results) {
|
|
|
12817
12863
|
reason: result.reason || result.error || null,
|
|
12818
12864
|
}));
|
|
12819
12865
|
}
|
|
12866
|
+
function profileSetupCanvasSignatureReceipts(results) {
|
|
12867
|
+
return (results || [])
|
|
12868
|
+
.filter((result) => result && profileSetupResultAction(result) === "canvas_signature")
|
|
12869
|
+
.map((result) => ({
|
|
12870
|
+
ordinal: result.ordinal ?? null,
|
|
12871
|
+
ok: result.ok !== false,
|
|
12872
|
+
selector: result.selector ?? null,
|
|
12873
|
+
frame_selector: result.frame_selector ?? null,
|
|
12874
|
+
label: result.label ?? null,
|
|
12875
|
+
hash: result.hash ?? null,
|
|
12876
|
+
data_length: result.data_length ?? null,
|
|
12877
|
+
width: result.width ?? null,
|
|
12878
|
+
height: result.height ?? null,
|
|
12879
|
+
css_width: result.css_width ?? null,
|
|
12880
|
+
css_height: result.css_height ?? null,
|
|
12881
|
+
compare_to: result.compare_to ?? null,
|
|
12882
|
+
previous_hash: result.previous_hash ?? null,
|
|
12883
|
+
changed: result.changed ?? null,
|
|
12884
|
+
return_stored_to: result.return_stored_to ?? null,
|
|
12885
|
+
reason: result.reason || result.error || null,
|
|
12886
|
+
}));
|
|
12887
|
+
}
|
|
12820
12888
|
function sampleProfileSetupSummaryItems(items, limit) {
|
|
12821
12889
|
if ((items || []).length <= limit) return items || [];
|
|
12822
12890
|
const firstCount = Math.floor(limit / 2);
|
|
@@ -12875,6 +12943,8 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
12875
12943
|
const sampledWindowEvalReceipts = sampleProfileSetupSummaryItems(windowEvalReceipts, 8);
|
|
12876
12944
|
const rangeValueReceipts = profileSetupRangeValueReceipts(results);
|
|
12877
12945
|
const sampledRangeValueReceipts = sampleProfileSetupSummaryItems(rangeValueReceipts, 8);
|
|
12946
|
+
const canvasSignatureReceipts = profileSetupCanvasSignatureReceipts(results);
|
|
12947
|
+
const sampledCanvasSignatureReceipts = sampleProfileSetupSummaryItems(canvasSignatureReceipts, 8);
|
|
12878
12948
|
const clickedItems = results
|
|
12879
12949
|
.filter((result) => result && profileSetupResultAction(result) === "click" && result.ok !== false)
|
|
12880
12950
|
.map((result) => {
|
|
@@ -12936,6 +13006,9 @@ function profileSetupSummary(viewports, actionCount, expectedActionCountsByViewp
|
|
|
12936
13006
|
set_range_value_total: rangeValueReceipts.length,
|
|
12937
13007
|
set_range_value_truncated: rangeValueReceipts.length > sampledRangeValueReceipts.length,
|
|
12938
13008
|
set_range_value: sampledRangeValueReceipts,
|
|
13009
|
+
canvas_signature_total: canvasSignatureReceipts.length,
|
|
13010
|
+
canvas_signature_truncated: canvasSignatureReceipts.length > sampledCanvasSignatureReceipts.length,
|
|
13011
|
+
canvas_signature: sampledCanvasSignatureReceipts,
|
|
12939
13012
|
clicked,
|
|
12940
13013
|
text_samples: textSamples,
|
|
12941
13014
|
failed: failed.map((result) => ({
|
|
@@ -14951,6 +15024,156 @@ async function executeSetupAction(action, ordinal, viewport) {
|
|
|
14951
15024
|
reason: rangeResult && rangeResult.ok === true ? undefined : rangeResult?.reason || "range_value_not_set",
|
|
14952
15025
|
};
|
|
14953
15026
|
}
|
|
15027
|
+
if (type === "canvas_signature") {
|
|
15028
|
+
const scope = await setupActionScope(action, timeout);
|
|
15029
|
+
if (!scope.ok) return setupScopeFailure(base, scope);
|
|
15030
|
+
const locator = scope.context.locator(action.selector);
|
|
15031
|
+
const count = await locator.count();
|
|
15032
|
+
if (!count) return { ...base, ...setupScopeEvidence(scope), reason: "selector_not_found", count };
|
|
15033
|
+
const targetIndex = Number.isInteger(action.index) ? action.index : 0;
|
|
15034
|
+
if (targetIndex < 0 || targetIndex >= count) return { ...base, ...setupScopeEvidence(scope), reason: "index_out_of_range", count, target_index: targetIndex };
|
|
15035
|
+
const target = locator.nth(targetIndex);
|
|
15036
|
+
await target.waitFor({ state: "visible", timeout });
|
|
15037
|
+
const storeReturnTo = String(action.store_return_to || action.storeReturnTo || action.save_return_to || action.saveReturnTo || action.store_signature_to || action.storeSignatureTo || action.signature_path || action.signaturePath || "").trim();
|
|
15038
|
+
const compareTo = String(action.compare_to || action.compareTo || action.previous_signature_path || action.previousSignaturePath || action.previous_path || action.previousPath || action.changed_from || action.changedFrom || "").trim();
|
|
15039
|
+
const expectChanged = action.expect_changed === true || action.expectChanged === true || action.should_change === true || action.shouldChange === true || action.changed === true
|
|
15040
|
+
? true
|
|
15041
|
+
: action.expect_changed === false || action.expectChanged === false || action.should_change === false || action.shouldChange === false || action.changed === false
|
|
15042
|
+
? false
|
|
15043
|
+
: undefined;
|
|
15044
|
+
const signatureResult = await target.evaluate((element, payload) => {
|
|
15045
|
+
const toJsonValue = (value) => {
|
|
15046
|
+
if (value === null || value === undefined) return null;
|
|
15047
|
+
if (typeof value === "string" || typeof value === "boolean") return value;
|
|
15048
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
15049
|
+
if (Array.isArray(value)) return value.map(toJsonValue);
|
|
15050
|
+
if (typeof value === "object") {
|
|
15051
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, toJsonValue(child)]));
|
|
15052
|
+
}
|
|
15053
|
+
return String(value);
|
|
15054
|
+
};
|
|
15055
|
+
const pathParts = (path) => String(path || "").split(".").map((part) => part.trim()).filter(Boolean);
|
|
15056
|
+
const readWindowPath = (path) => {
|
|
15057
|
+
const parts = pathParts(path);
|
|
15058
|
+
if (parts[0] === "window") parts.shift();
|
|
15059
|
+
if (!parts.length) return { ok: false, reason: "missing_path" };
|
|
15060
|
+
let current = window;
|
|
15061
|
+
for (const part of parts) {
|
|
15062
|
+
if (current === null || current === undefined) return { ok: false, reason: "path_not_found", missing_part: part };
|
|
15063
|
+
current = current[part];
|
|
15064
|
+
if (current === undefined) return { ok: false, reason: "path_not_found", missing_part: part };
|
|
15065
|
+
}
|
|
15066
|
+
return { ok: true, value: toJsonValue(current) };
|
|
15067
|
+
};
|
|
15068
|
+
const storeWindowValue = (path, value) => {
|
|
15069
|
+
const parts = pathParts(path);
|
|
15070
|
+
if (parts[0] === "window") parts.shift();
|
|
15071
|
+
if (!parts.length) return { ok: false, reason: "missing_store_path" };
|
|
15072
|
+
let target = window;
|
|
15073
|
+
for (let index = 0; index < parts.length - 1; index += 1) {
|
|
15074
|
+
const part = parts[index];
|
|
15075
|
+
if (target[part] === null || typeof target[part] !== "object") target[part] = {};
|
|
15076
|
+
target = target[part];
|
|
15077
|
+
}
|
|
15078
|
+
target[parts[parts.length - 1]] = value;
|
|
15079
|
+
return { ok: true, path: parts.join(".") };
|
|
15080
|
+
};
|
|
15081
|
+
const hashText = (text) => {
|
|
15082
|
+
let hash = 2166136261;
|
|
15083
|
+
const step = Math.max(1, Math.floor((text.length || 1) / 4000));
|
|
15084
|
+
for (let index = 0; index < text.length; index += step) {
|
|
15085
|
+
hash ^= text.charCodeAt(index);
|
|
15086
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
15087
|
+
}
|
|
15088
|
+
return String(hash);
|
|
15089
|
+
};
|
|
15090
|
+
const tag = String(element && element.tagName ? element.tagName : "").toLowerCase();
|
|
15091
|
+
if (tag !== "canvas") return { ok: false, reason: "not_canvas_element", tag };
|
|
15092
|
+
const rect = element.getBoundingClientRect();
|
|
15093
|
+
let data = "";
|
|
15094
|
+
try {
|
|
15095
|
+
data = element.toDataURL("image/png");
|
|
15096
|
+
} catch (error) {
|
|
15097
|
+
return {
|
|
15098
|
+
ok: false,
|
|
15099
|
+
reason: "canvas_read_failed",
|
|
15100
|
+
error: String(error && error.message ? error.message : error).slice(0, 1000),
|
|
15101
|
+
width: element.width || 0,
|
|
15102
|
+
height: element.height || 0,
|
|
15103
|
+
css_width: Math.round(rect.width || 0),
|
|
15104
|
+
css_height: Math.round(rect.height || 0),
|
|
15105
|
+
};
|
|
15106
|
+
}
|
|
15107
|
+
const result = {
|
|
15108
|
+
ok: Boolean(element.width > 0 && element.height > 0 && data.length > 0),
|
|
15109
|
+
reason: element.width > 0 && element.height > 0 && data.length > 0 ? undefined : "empty_canvas_signature",
|
|
15110
|
+
hash: hashText(data),
|
|
15111
|
+
data_length: data.length,
|
|
15112
|
+
width: element.width || 0,
|
|
15113
|
+
height: element.height || 0,
|
|
15114
|
+
css_width: Math.round(rect.width || 0),
|
|
15115
|
+
css_height: Math.round(rect.height || 0),
|
|
15116
|
+
compare_to: payload.compareTo || undefined,
|
|
15117
|
+
previous_hash: null,
|
|
15118
|
+
changed: null,
|
|
15119
|
+
};
|
|
15120
|
+
if (payload.compareTo) {
|
|
15121
|
+
const previous = readWindowPath(payload.compareTo);
|
|
15122
|
+
if (!previous.ok) {
|
|
15123
|
+
result.ok = false;
|
|
15124
|
+
result.reason = previous.reason || "compare_path_not_found";
|
|
15125
|
+
result.missing_part = previous.missing_part || undefined;
|
|
15126
|
+
} else {
|
|
15127
|
+
const previousValue = previous.value;
|
|
15128
|
+
const previousHash = previousValue && typeof previousValue === "object" && !Array.isArray(previousValue)
|
|
15129
|
+
? previousValue.hash || previousValue.signature || previousValue.canvas_hash || null
|
|
15130
|
+
: typeof previousValue === "string"
|
|
15131
|
+
? previousValue
|
|
15132
|
+
: null;
|
|
15133
|
+
result.previous_hash = previousHash === null || previousHash === undefined ? null : String(previousHash);
|
|
15134
|
+
result.changed = result.previous_hash === null ? null : result.previous_hash !== result.hash;
|
|
15135
|
+
if (payload.expectChanged === true && result.changed !== true) {
|
|
15136
|
+
result.ok = false;
|
|
15137
|
+
result.reason = "canvas_signature_unchanged";
|
|
15138
|
+
} else if (payload.expectChanged === false && result.changed !== false) {
|
|
15139
|
+
result.ok = false;
|
|
15140
|
+
result.reason = "canvas_signature_changed";
|
|
15141
|
+
}
|
|
15142
|
+
}
|
|
15143
|
+
}
|
|
15144
|
+
if (payload.storeReturnTo) {
|
|
15145
|
+
const stored = storeWindowValue(payload.storeReturnTo, result);
|
|
15146
|
+
if (!stored.ok) {
|
|
15147
|
+
return { ...result, ok: false, reason: "signature_store_failed", store_reason: stored.reason };
|
|
15148
|
+
}
|
|
15149
|
+
return { ...result, return_stored_to: stored.path };
|
|
15150
|
+
}
|
|
15151
|
+
return result;
|
|
15152
|
+
}, { compareTo, expectChanged, storeReturnTo });
|
|
15153
|
+
return {
|
|
15154
|
+
...base,
|
|
15155
|
+
...setupScopeEvidence(scope),
|
|
15156
|
+
ok: signatureResult && signatureResult.ok === true,
|
|
15157
|
+
count,
|
|
15158
|
+
target_index: targetIndex,
|
|
15159
|
+
label: action.label || action.name || undefined,
|
|
15160
|
+
hash: signatureResult?.hash,
|
|
15161
|
+
data_length: signatureResult?.data_length,
|
|
15162
|
+
width: signatureResult?.width,
|
|
15163
|
+
height: signatureResult?.height,
|
|
15164
|
+
css_width: signatureResult?.css_width,
|
|
15165
|
+
css_height: signatureResult?.css_height,
|
|
15166
|
+
compare_to: signatureResult?.compare_to || compareTo || undefined,
|
|
15167
|
+
previous_hash: signatureResult?.previous_hash,
|
|
15168
|
+
changed: signatureResult?.changed,
|
|
15169
|
+
return_stored_to: signatureResult?.return_stored_to || storeReturnTo || undefined,
|
|
15170
|
+
missing_part: signatureResult?.missing_part || undefined,
|
|
15171
|
+
store_reason: signatureResult?.store_reason || undefined,
|
|
15172
|
+
tag: signatureResult?.tag,
|
|
15173
|
+
reason: signatureResult && signatureResult.ok === true ? undefined : signatureResult?.reason || "canvas_signature_failed",
|
|
15174
|
+
error: signatureResult?.error || undefined,
|
|
15175
|
+
};
|
|
15176
|
+
}
|
|
14954
15177
|
if (type === "assert_selector_count") {
|
|
14955
15178
|
const scope = await setupActionScope(action, timeout);
|
|
14956
15179
|
if (!scope.ok) return setupScopeFailure(base, scope);
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
resolveRiddleProofProfileTimeoutSec,
|
|
63
63
|
slugifyRiddleProofProfileName,
|
|
64
64
|
summarizeRiddleProofProfileResult
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-MV7UM4EV.js";
|
|
66
66
|
import {
|
|
67
67
|
DEFAULT_RIDDLE_API_BASE_URL,
|
|
68
68
|
DEFAULT_RIDDLE_API_KEY_FILE,
|