feat: add GFF type schema definitions for visual editors

This commit is contained in:
plenarius
2026-04-20 20:07:48 -04:00
parent 3b91c0312d
commit c7f5646e62
8 changed files with 720 additions and 0 deletions
+12
View File
@@ -9,6 +9,7 @@ import {
import { lookupResref, getResrefCount } from "../nwscript/resref-index.js";
import { lookupTlk, getTlkCount } from "../nwscript/tlk-index.js";
import { get2DAFile, list2DAFiles, get2DARow } from "../nwscript/twoda-index.js";
import { getSchema } from "../gff/schema.js";
const router = Router();
@@ -110,4 +111,15 @@ router.get("/2da/:name/:row", (req, res) => {
res.json(data);
});
router.get("/gff-schema/:type", async (req, res) => {
try {
const schema = await getSchema(req.params.type);
if (!schema) return res.status(404).json({ error: "unknown GFF type" });
res.json(schema);
} catch (err: unknown) {
const message = err instanceof Error ? err.message : "Unknown error";
res.status(500).json({ error: message });
}
});
export default router;