Release Healer Man 0.1.56
This commit is contained in:
1 parent
38b3d4d160
commit
a05a79eb83
16 files changed
+388
-116
No files matched your search
@@ -10,6 +10,10 @@ export interface BalanceLabRuntimeStatus {
|
||||
readonly executable: string;
|
||||
readonly version: string | null;
|
||||
readonly error: string | null;
|
||||
readonly maxConcurrent: number;
|
||||
readonly running: number;
|
||||
readonly queued: number;
|
||||
readonly maxQueued: number;
|
||||
}
|
||||
|
||||
export interface BalanceLabJobSpec {
|
||||
@@ -183,6 +187,17 @@ export async function startBalanceLabJob(spec: BalanceLabJobSpec, token: string)
|
||||
)).job;
|
||||
}
|
||||
|
||||
export async function startBalanceLabJobs(
|
||||
specs: readonly BalanceLabJobSpec[],
|
||||
token: string,
|
||||
): Promise<readonly BalanceLabJob[]> {
|
||||
return (await requestOnlineJson<{ jobs: BalanceLabJob[] }>(
|
||||
"/api/gm/balance-lab/jobs/batch",
|
||||
{ method: "POST", body: JSON.stringify({ specs }) },
|
||||
token,
|
||||
)).jobs;
|
||||
}
|
||||
|
||||
export async function getBalanceLabJob(id: string, token: string): Promise<BalanceLabJob> {
|
||||
return (await requestOnlineJson<{ job: BalanceLabJob }>(
|
||||
`/api/gm/balance-lab/jobs/${encodeURIComponent(id)}`,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { balanceLabBracketLevels } from "./balanceLabSchedules";
|
||||
|
||||
describe("Balance Lab level schedules", () => {
|
||||
it("includes level 1 and every ten-level bracket through 80", () => {
|
||||
expect(balanceLabBracketLevels(10)).toEqual([1, 10, 20, 30, 40, 50, 60, 70, 80]);
|
||||
});
|
||||
|
||||
it("supports every five levels without duplicating level 1", () => {
|
||||
expect(balanceLabBracketLevels(5)).toEqual([
|
||||
1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80,
|
||||
]);
|
||||
});
|
||||
|
||||
it("supports a job for every level from 1 through 80", () => {
|
||||
const levels = balanceLabBracketLevels(1);
|
||||
expect(levels).toHaveLength(80);
|
||||
expect(levels[0]).toBe(1);
|
||||
expect(levels.at(-1)).toBe(80);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
export type BalanceLabBracketStep = 1 | 5 | 10;
|
||||
|
||||
export function balanceLabBracketLevels(step: BalanceLabBracketStep): readonly number[] {
|
||||
if (step === 1) return Array.from({ length: 80 }, (_, index) => index + 1);
|
||||
return [1, ...Array.from({ length: Math.floor(80 / step) }, (_, index) => (index + 1) * step)];
|
||||
}
|
||||
Reference in new issue
Block a user