feat: preselect all entity types except IP, Datum and Referenz

Forms and the project-file command now preselect the backend's
default_entity_types from /api/entity-types instead of every type. Older
backends without that field fall back to all types except IP, DATUM and
REFERENZ. Saved project selections are still loaded unchanged; the
project-file command keeps excluding ORT by default as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-01 06:04:40 +00:00
parent 1eba3f5921
commit e2df0cda33
14 changed files with 110 additions and 34 deletions

View File

@@ -0,0 +1,22 @@
import { expect, it } from "bun:test";
import { entityTypeCatalog } from "../src/lib/entity-types";
const all = ["PERSON", "EMAIL", "REFERENZ", "ORT", "DATUM", "URL", "IP"];
it("uses the backend default selection when Velum reports one", () => {
expect(
entityTypeCatalog({
entity_types: all,
default_entity_types: ["PERSON", "IP", "UNBEKANNT"],
}),
).toEqual({ all, defaults: ["PERSON", "IP"] });
});
it("leaves IP, Datum and Referenz off for backends without a default list", () => {
expect(entityTypeCatalog({ entity_types: all }).defaults).toEqual([
"PERSON",
"EMAIL",
"ORT",
"URL",
]);
});

View File

@@ -6,6 +6,7 @@ import ts from "typescript";
import * as xlsxRestoration from "../src/lib/xlsx-restoration";
import * as imagePolicy from "../src/lib/image-policy";
import * as projectCapabilities from "../src/lib/project-capabilities";
import * as entityTypes from "../src/lib/entity-types";
import { checkedImagePolicy, checkedImageReport, DEFAULT_IMAGE_POLICY, KEEP_IMAGE_WARNING, sameImagePolicyCoverage, summarizeImages } from "../src/lib/image-policy";
const policies = ["placeholder", "remove", "keep"] as const;
@@ -64,6 +65,7 @@ it("übermittelt dieselbe Bildoption in Vorschau, Anwendung und erneutem Abgleic
"./lib/image-policy": imagePolicy,
"./lib/xlsx-restoration": xlsxRestoration,
"./lib/project-capabilities": projectCapabilities,
"./lib/entity-types": entityTypes,
};
const module = { exports: {} as { pseudonymizeDocument: (...args: unknown[]) => Promise<unknown>; requireProjectCapabilities: (images?: boolean) => Promise<void> } };
new Function("require", "module", "exports", code)((id: string) => mocks[id] ?? require(id), module, module.exports);
@@ -97,6 +99,7 @@ it("restores XLSX locally and keeps the API route for DOCX", async () => {
"./preferences": { getPreferences: () => ({ velumBaseUrl: "https://velum.test" }) },
"./lib/image-policy": imagePolicy,
"./lib/project-capabilities": projectCapabilities,
"./lib/entity-types": entityTypes,
"./lib/xlsx-restoration": xlsxRestoration,
};
const module = { exports: {} as { depseudonymizeDocument: (name: string, data: Buffer, mapping: Record<string, { original: string; type: string }>) => Promise<Buffer> } };