You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
968 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/** axel/quote 契约阶段0 录证结论阶段1 runtime 白名单) */
export const AXEL_QUOTE_URL_FRAGMENT = "services.mothership.com/axel/quote";
export function isAxelQuoteResponseUrl(url: string): boolean {
return url.toLowerCase().includes("axel/quote");
}
function getAt(obj: unknown, ...keys: string[]): unknown {
let cur = obj;
for (const key of keys) {
if (cur == null || typeof cur !== "object" || Array.isArray(cur)) {
return undefined;
}
cur = (cur as Record<string, unknown>)[key];
}
return cur;
}
/** guaranteed 分支lowest 缺失时 fallback bestValue录证 2026-06 */
export function resolveGuaranteedLowestTier(
guaranteed: unknown,
): unknown {
if (guaranteed == null || typeof guaranteed !== "object" || Array.isArray(guaranteed)) {
return undefined;
}
const lowest = getAt(guaranteed, "lowest");
if (lowest != null) {
return lowest;
}
return getAt(guaranteed, "bestValue");
}