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

-8
View File
@@ -49,14 +49,6 @@ export class RateLimitError extends DomainError {
}
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export class ConflictError extends DomainError {
constructor(message: string) {
super(message, 409);
this.name = "ConflictError";
}
}
export class DatabaseError extends DomainError {
public readonly cause: unknown;
-16
View File
@@ -30,27 +30,11 @@ export function runWithStore<T>(store: RequestStore, fn: () => T): T {
return als.run(store, fn);
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function getRequestStore(): RequestStore | null {
return als.getStore() ?? null;
}
export function getRequestId(): RequestId {
return als.getStore()?.requestId ?? generateRequestId();
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function getClientIp(): IpAddress {
return als.getStore()?.ip ?? ("0.0.0.0" as IpAddress);
}
export function setContextUserId(userId: UserId): void {
const store = als.getStore();
if (store) store.userId = userId;
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function elapsed(): number {
const store = als.getStore();
return store ? Date.now() - store.startedAt : 0;
}
-44
View File
@@ -208,50 +208,6 @@ export function sanitizeField(
return s.slice(0, maxLen);
}
const INVALID_FILENAME_CHARS = /[<>:"/\\|?*]/;
function removeControlChars(s: string): string {
let result = "";
for (let i = 0; i < s.length; i++) {
const code = s.charCodeAt(i);
if (code >= 32) result += s.charAt(i);
}
return result;
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function sanitizeFilename(name: string): string {
return removeControlChars(
name
.normalize("NFC")
.replace(INVALID_FILENAME_CHARS, "")
.replace(/\.\.(?:\/|$)/g, ""),
)
.trim()
.slice(0, 255);
}
export function canonicalizeFormValue(
value: FormDataEntryValue | null,
maxLen?: number,
): string {
const s = canonicalize(String(value ?? ""));
return maxLen ? s.slice(0, maxLen) : s;
}
// TODO: Check of dit weg kan — niet geïmporteerd in de codebase
export function canonicalizeFormData(
formData: FormData,
fields: Record<string, number | undefined>,
): Record<string, string> {
return Object.fromEntries(
Object.entries(fields).map(([key, maxLen]) => [
key,
canonicalizeFormValue(formData.get(key), maxLen),
]),
);
}
export async function extractClientIpAsync(): Promise<IpAddress> {
try {
const h = await headers();