50 lines
1.2 KiB
TypeScript
50 lines
1.2 KiB
TypeScript
export type Status = {
|
|
running: boolean;
|
|
};
|
|
|
|
export async function status(): Promise<Status> {
|
|
return await fetch("/api/status")
|
|
.then((v) => v.json())
|
|
.then((v) => v.status);
|
|
}
|
|
|
|
export type FlameGraphNode = {
|
|
fn: number;
|
|
acc: number;
|
|
parent: number;
|
|
children: FlameGraphNode[];
|
|
};
|
|
|
|
export async function flameGraphData(): Promise<FlameGraphNode> {
|
|
return await fetch("/api/flame-graph")
|
|
.then((v) => v.json())
|
|
.then((v) => v.flameGraph);
|
|
}
|
|
|
|
export type FlameGraphFnNames = { [key: number]: string };
|
|
|
|
export async function flameGraphFnNames(): Promise<FlameGraphFnNames> {
|
|
return await fetch("/api/flame-graph-fn-names")
|
|
.then((v) => v.json())
|
|
.then((v) => v.fnNames);
|
|
}
|
|
|
|
export async function codeData(): Promise<string> {
|
|
return await fetch("/api/source")
|
|
.then((v) => v.json())
|
|
.then((v) => v.text);
|
|
}
|
|
|
|
export type CodeCovEntry = {
|
|
index: number;
|
|
line: number;
|
|
col: number;
|
|
covers: number;
|
|
};
|
|
|
|
export async function codeCoverageData(): Promise<CodeCovEntry[]> {
|
|
return await fetch("/api/code-coverage")
|
|
.then((v) => v.json())
|
|
.then((v) => v.codeCoverage);
|
|
}
|