debug: temporary tags debug endpoint

This commit is contained in:
Jeff Emmett 2026-03-24 13:48:21 -07:00
parent a3b6d7f425
commit d7e195c0b3
1 changed files with 20 additions and 0 deletions

View File

@ -337,6 +337,26 @@ routes.get("/api/events", async (c) => {
return c.json({ count: rows.length, results: rows });
});
// DEBUG: raw Automerge event data (temporary)
routes.get("/api/events-debug", async (c) => {
const space = c.req.param("space") || "demo";
const dataSpace = c.get("effectiveSpace") || space;
const doc = ensureDoc(dataSpace);
const events = Object.values(doc.events).slice(0, 3);
const raw = events.map((e) => ({
title: e.title,
tags_value: e.tags,
tags_type: typeof e.tags,
tags_truthy: !!e.tags,
tags_isArray: Array.isArray(e.tags),
tags_json: JSON.stringify(e.tags),
tags_arrayFrom: e.tags ? Array.from(e.tags) : 'WAS_FALSY',
has_tags_key: 'tags' in e,
all_keys: Object.keys(e),
}));
return c.json(raw);
});
// POST /api/events — create event
routes.post("/api/events", async (c) => {
const token = extractToken(c.req.raw.headers);