New POST /api/admin/import/furni/verify re-runs the full interaction verification over items_base at any time, plus a Tools dropdown entry in the furni import admin. It corrects interaction_type, interaction_modes_count and allow_sit/lay/walk against real furniture data (furnidata flags + .nitro animation states); items without real data are skipped and existing emulator handler types are preserved.
41 lines
984 B
TypeScript
41 lines
984 B
TypeScript
export const VERIFY_INTERACTIONS_URL = "/api/admin/import/furni/verify";
|
|
|
|
export interface VerifyInteractionsResult {
|
|
fixed: number;
|
|
checked: number;
|
|
skipped: number;
|
|
errors: string[];
|
|
}
|
|
|
|
type AdminFetcher = (
|
|
input: RequestInfo | URL,
|
|
init?: RequestInit,
|
|
) => Promise<Response>;
|
|
|
|
export async function requestVerifyInteractions(
|
|
fetcher: AdminFetcher,
|
|
): Promise<VerifyInteractionsResult> {
|
|
const response = await fetcher(VERIFY_INTERACTIONS_URL, { method: "POST" });
|
|
const payload = (await response.json()) as Record<string, unknown>;
|
|
if (!response.ok) {
|
|
throw new Error(
|
|
typeof payload.error === "string"
|
|
? payload.error
|
|
: "Interaction verification failed",
|
|
);
|
|
}
|
|
|
|
const errors = Array.isArray(payload.errors)
|
|
? payload.errors.filter(
|
|
(value): value is string => typeof value === "string",
|
|
)
|
|
: [];
|
|
|
|
return {
|
|
fixed: Number(payload.fixed) || 0,
|
|
checked: Number(payload.checked) || 0,
|
|
skipped: Number(payload.skipped) || 0,
|
|
errors,
|
|
};
|
|
}
|