refactor(catalog): unify commands and embed guarded catalog workspace

This commit is contained in:
Simo committed 2026-09-06 19:40:52 +02:00
1 parent 16f35568f5
commit 193b6686a9
57 files changed
+3268 -728

No files matched your search

+10 -1
View File
@@ -1,5 +1,6 @@
import { promises as fs } from "node:fs";
import path from "node:path";
import { logger } from "@/lib/logger";
import {
catalogStateRoot,
readManagedCatalogConfig,
@@ -18,6 +19,7 @@ export function catalogExportQueue() {
export function isCatalogMutation(method: string, pathname: string) {
return (
["POST", "PUT", "PATCH", "DELETE"].includes(method) &&
pathname.replace(/\/$/, "") !== "/api/admin/catalog/status" &&
(pathname.startsWith("/api/admin/import/") ||
pathname.startsWith("/api/admin/catalog/") ||
pathname.startsWith("/api/admin/furni/") ||
@@ -53,7 +55,14 @@ export async function withCatalogExport<T>(
try {
return await operation();
} finally {
await finish();
try {
await finish();
} catch (error) {
logger.error("Catalog operation finished but export scheduling failed", {
module: "catalog",
error,
});
}
}
}