refactor: remove dead code and unused exports
CI / check (push) Successful in 29s
CI / release (push) Skipped
CI / deploy (push) Successful in 59s

Delete proxy-auth.ts, types/index.ts, staff-user.ts+test, local-imports.ts+test (only used by their own tests). Remove unused foundation exports: sanitizeFilename, canonicalizeFormValue, canonicalizeFormData, ConflictError, getRequestStore, getClientIp, elapsed. Remove stale TODO comments from rank-authority.ts and notice.ts. Fix biome lint warnings in catalog-repair.ts.
This commit is contained in:
openhands committed 2026-08-07 18:55:02 +02:00
1 parent 510d070dc5
commit 24bf8eabb9
12 files changed
+2 -265

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
// TODO: Check of dit bestand weg kan — uitsluitend gebruikt door eigen test
export interface AdminMutationNotice {
tone: "ok" | "danger";
label: "Saved" | "Error";
-1
View File
@@ -1,4 +1,3 @@
// TODO: Check of dit bestand weg kan — uitsluitend gebruikt door eigen test
import type { AuthorizationActor } from "@/lib/admin/authorization-policy";
export interface RankAuthorityDb {
-20
View File
@@ -1,20 +0,0 @@
import { describe, expect, it } from "vitest";
import { resolveStaffUser } from "@/lib/admin/staff-user";
describe("resolveStaffUser", () => {
it("rejects a session whose database rank has been revoked", async () => {
const findUser = async () => ({ id: 7, rank: 1, username: "Alice" });
await expect(resolveStaffUser("7", 7, findUser)).resolves.toBeNull();
});
it("returns the current database identity instead of stale JWT values", async () => {
const findUser = async () => ({ id: 7, rank: 8, username: "CurrentName" });
await expect(resolveStaffUser("7", 7, findUser)).resolves.toEqual({
id: 7,
rank: 8,
username: "CurrentName",
});
});
});
-22
View File
@@ -1,22 +0,0 @@
// TODO: Check of dit bestand weg kan — uitsluitend gebruikt door eigen test
import { isStaff } from "@/lib/admin/is-staff";
export interface StaffUserRecord {
id: number;
rank: number;
username: string;
}
export type FindStaffUser = (id: number) => Promise<StaffUserRecord | null>;
export async function resolveStaffUser(
sessionUserId: string,
minStaffRank: number,
findUser: FindStaffUser,
): Promise<StaffUserRecord | null> {
const id = Number(sessionUserId);
if (!Number.isSafeInteger(id) || id <= 0) return null;
const user = await findUser(id);
return user && isStaff(user.rank, minStaffRank) ? user : null;
}