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.

16 lines
670 B

import fs from "node:fs";
import { BASELINE_HAR } from "./lib/paths";
import { countAxelQuoteTiers, extractAxelQuoteContract } from "./lib/axel-quote-contract";
const har = JSON.parse(fs.readFileSync(BASELINE_HAR, "utf8")) as {
log?: { entries?: Array<{ request: { url: string }; response: { content?: { text?: string } } }> };
};
const entry = har.log?.entries?.find((e) => e.request.url.includes("axel/quote"));
if (!entry?.response.content?.text) {
console.log("no axel/quote");
process.exit(1);
}
const body = JSON.parse(entry.response.content.text) as unknown;
const contract = extractAxelQuoteContract(body);
console.log(JSON.stringify(contract, null, 2));